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


New Allen Bradley 1762-IT4 MicroLogix Thermocouple/mV 4-Channel Input AB 1762IT4 picture

New Allen Bradley 1762-IT4 MicroLogix Thermocouple/mV 4-Channel Input AB 1762IT4

$405.00



New Original Omron CJ1W-TS561 Thermocouple Input input unit CJ1WTS561 picture

New Original Omron CJ1W-TS561 Thermocouple Input input unit CJ1WTS561

$916.00



New Original Omron CJ1W-TS561 Thermocouple Input Input Unit CJ1WTS561 picture

New Original Omron CJ1W-TS561 Thermocouple Input Input Unit CJ1WTS561

$820.00



1769-IT6 Allen Bradley Compact I/O Thermocouple/mV Input Module Faakart picture

1769-IT6 Allen Bradley Compact I/O Thermocouple/mV Input Module Faakart

$720.00



1980-060 - Thermocouple 60 inch picture

1980-060 - Thermocouple 60 inch

$24.00



K-Type Thermocouple Probe Digital Thermometer Steel Sensor Spiral Cable  picture

K-Type Thermocouple Probe Digital Thermometer Steel Sensor Spiral Cable

$12.49







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