map overlays

Put problem concerning MapActivities, MapViews, Overlays and GPS in this forum.

map overlays

Postby pujitha » Sun Jan 10, 2010 2:58 pm

hi all

what does the argument "shadow" mean in draw method of map overlay class???
how its value is set and when is it called??

i thought draw method should be called in this way <classname>.draw() iam i right??
pujitha
Freshman
Freshman
 
Posts: 2
Joined: Sun Jan 10, 2010 2:37 pm

Top

Postby Draffodx » Mon Jan 11, 2010 3:11 pm

it simply allows you to create a shadow for whatever you display on the overlay
Draffodx
Master Developer
Master Developer
 
Posts: 205
Joined: Wed Nov 12, 2008 2:31 pm

Postby pujitha » Tue Jan 12, 2010 2:50 am

in the below code where is draw method called??
here setlocation method is called to update location but how draw is called??
mypositionoverlay which extends the overlay class

public class mypositionoverlay extends Overlay{
Location location;
public Location getLocation() {
return location;
}
public void setLocation(Location location) {
this.location = location;
}

@Override
public void draw(Canvas canvas, MapView mapView, boolean shadow) {
Projection projection = mapView.getProjection();
if (shadow == false) {

//draw location on map
}
super.draw(canvas, mapView, shadow);
}

//whereami class
public class whereami1 extends MapActivity {

private final LocationListener locationListener = new LocationListener ()
{
public void onLocationChanged(Location location) {
updateWithNewLocation(location);
}
public void onProviderDisabled(String provider){
updateWithNewLocation(null);
}
public void onProviderEnabled(String provider){ }
public void onStatusChanged(String provider, int status,
Bundle extras){ }
};
MapController mapController;


@Override
protected boolean isRouteDisplayed() {
return false;
}


mypositionoverlay positionOverlay;
@Override


// Add the MyPositionOverlay
positionOverlay = new mypositionoverlay();
List<Overlay> overlays = myMapView.getOverlays();
overlays.add(positionOverlay);



Location location = locationManager.getLastKnownLocation(provider);
updateWithNewLocation(location);
locationManager.requestLocationUpdates(provider, 2000, 10,
locationListener);
}


//location is updated to the overlay
private void updateWithNewLocation(Location location)
{
String latLongString;
TextView myLocationText;


String addressString = "No address found";


if (location != null) {
// Update my location marker
positionOverlay.setLocation(location);


}
pujitha
Freshman
Freshman
 
Posts: 2
Joined: Sun Jan 10, 2010 2:37 pm

Top

Return to Map Problems

Who is online

Users browsing this forum: Yahoo [Bot] and 2 guests