BlackBerry Forums Support Community
              

Closed Thread
 
Thread Tools
Old 03-16-2010, 10:45 AM   #1
edward89
New Member
 
Join Date: Mar 2010
Model: 8220
PIN: N/A
Carrier: Rogers
Posts: 3
Default Mapfield and Layers

Please Login to Remove!

Hi all

I'm developing a small map-based app... basically a two-layered application when the bottom layer contains a Mapfield object, and where the top layer displays points, and other polygon shapes and lines for routes, zones, etc.

My question is my layer-based approach the best for this application? And if so how do i append the mapfield object (_mapfield) to the layer?

here's the api reference I'm trying to use:

blackberry.com/developers/docs/4.5.0api/javax/microedition/lcdui/game/LayerManager.html

Thanks again
Offline  
Old 03-25-2010, 12:29 PM   #2
edward89
New Member
 
Join Date: Mar 2010
Model: 8220
PIN: N/A
Carrier: Rogers
Posts: 3
Default Problem Solved!

Mapfield has a paint method that allows you to paint graphics onto the mapfield object. Thus, the layering method was not required, and it was possible to directly drop bitmap resource (i.e. image files, dots, etc.) directly onto the map.

I created a child class of Mapfield (i.e. class mod_map extends Mapfield) and declared the paint method as seen below. This method executes when the object is created, thus requires the vector object "_poi" to be passed into the constructor in the beginning itself.

I've attached my code below, and i beleive its pretty self explanatory. "red_marker" and "cursor" are .png resource i'm using to drop red points on the map




Code:
 public void paint (Graphics g)
    {
        super.paint(g);
            
        // Place a cursor permanently at the center of the map.
        int width = getPreferredWidth();
        int height = getPreferredHeight();
        g.drawBitmap((width/2), (height/2), width, height, cursor, 0, 0); 
        
           
    
        // Draw the POI's onto the map
        if ( _poi != null ) {
            for (int i = _poi.size() - 1 ; i >= 0  ; --i) {
                XYPoint temp_xy = new XYPoint();
                pointOfInterest temp = (pointOfInterest) _poi.elementAt(i);
                convertWorldToField(temp.lat_long, temp_xy);
                g.drawBitmap(temp_xy.x, temp_xy.y, width, height, red_marker, 0, 0); 
            }
       }
    }
Offline  
Old 03-25-2010, 03:35 PM   #3
jacob.tabak
Knows Where the Search Button Is
 
Join Date: Mar 2010
Model: N/A
PIN: N/A
Carrier: Fledge
Posts: 43
Default

Ed,

I apologize for not responding to this when you first posted it.

I was going to suggest the paint method (it is a field, after all) because I thought it would be easier but since I know nothing about game development or layers I thought it would be best for me to keep my mouth shut.
Offline  
Old 04-05-2010, 01:16 PM   #4
edward89
New Member
 
Join Date: Mar 2010
Model: 8220
PIN: N/A
Carrier: Rogers
Posts: 3
Default

no problem jacob. I'm at a point where i'm trying to paint zones and routes on the map based on some points... I'm not fairly certain how to approach this. If you have any input/good resources on this topic, it would be really appreciated. Thanks
Offline  
Closed Thread



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


1PC USED A54MA30B Mitsubishi F500/A500/A540 Series 30-37KW Mainboard #CZ picture

1PC USED A54MA30B Mitsubishi F500/A500/A540 Series 30-37KW Mainboard #CZ

$228.00



1PC USED A54MA55B BC186A413G52 Mitsubishi A500/F540 Series 55KW Drive Board #CZ picture

1PC USED A54MA55B BC186A413G52 Mitsubishi A500/F540 Series 55KW Drive Board #CZ

$317.00



NSK TiMAX NL95M/ A500/ A500L/ AK500L/ AS500L /AW500L CERAMIC BEARINGS  picture

NSK TiMAX NL95M/ A500/ A500L/ AK500L/ AS500L /AW500L CERAMIC BEARINGS

$80.75



Mitsubishi A500 Variable Freq. Drive VFD AC Inverter 480V 3 PH 6.7A 3 HP Max picture

Mitsubishi A500 Variable Freq. Drive VFD AC Inverter 480V 3 PH 6.7A 3 HP Max

$299.99



Dentistry Replacement NSK TiMAX NL95M/ A500/ A500L/ AK500L/ AS500L /AW500L NEW picture

Dentistry Replacement NSK TiMAX NL95M/ A500/ A500L/ AK500L/ AS500L /AW500L NEW

$79.95



Mitsubishi FR-A540-0.75K-NA AC DRIVE INVERTER 1 HP 380-480 VAC 50/60 HZ 4.1 AMP  picture

Mitsubishi FR-A540-0.75K-NA AC DRIVE INVERTER 1 HP 380-480 VAC 50/60 HZ 4.1 AMP

$649.99







Copyright © 2004-2016 BlackBerryForums.com.
The names RIM © and BlackBerry © are registered Trademarks of BlackBerry Inc.