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


CH341A 24 25 Series EEPROM Flash BIOS USB Programmer Module + SOIC8 Test Clip picture

CH341A 24 25 Series EEPROM Flash BIOS USB Programmer Module + SOIC8 Test Clip

$5.88



5PCS EEPROM IC ATMEL DIP-28 AT28C256 AT28C256-15PU US picture

5PCS EEPROM IC ATMEL DIP-28 AT28C256 AT28C256-15PU US

$27.99



USB BIOS EEPROM SPI FLASH Programmer CH341A 24 25 series BIOS Writer Burner Chip picture

USB BIOS EEPROM SPI FLASH Programmer CH341A 24 25 series BIOS Writer Burner Chip

$7.57



10PCS W27C512-45Z W27C512 DIP IC EEPROM 512KBIT 45NS Winbond EEPROMs USA picture

10PCS W27C512-45Z W27C512 DIP IC EEPROM 512KBIT 45NS Winbond EEPROMs USA

$17.98



EZP2019 High Speed SPI Programmer SOP8 Adapter 24 25 93 EEPROM 25 Flash Block A picture

EZP2019 High Speed SPI Programmer SOP8 Adapter 24 25 93 EEPROM 25 Flash Block A

$22.38



REVELPROG-IS SERIAL FLASH & EEPROM PROGRAMMER (1.8V - 5V + ISP, USB) picture

REVELPROG-IS SERIAL FLASH & EEPROM PROGRAMMER (1.8V - 5V + ISP, USB)

$139.00







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