Select to view content in your preferred language

Problem of displaying graphics on mapview

487
1
08-22-2012 11:32 PM
lujun
by
Emerging Contributor
I have drawn 2 graphics on the same point.
   
Graphic graphic = new Graphic(new Point(x, y),new SimpleMarkerSymbol(Color.BLACK, 12, STYLE.CIRCLE));

//...omit some code
PictureMarkerSymbol symbol = new PictureMarkerSymbol(image);
Graphic g = new Graphic(point, symbol);

layer.addGraphic(g);
layer.addGraphic(graphic);



As shown,one is a circle,another is a picture.They both locate at the same point.And when i double click on the map to zoom ln,the circle is still on the map Point while the picture deviate from the Point.When u zoom in more and more ,the
deviation becomes larger and larger.
0 Kudos
1 Reply
deleted-user-ATjHIWsdQYmT
Deactivated User
You are adding your new Graphic, "graphic" at new Point(x,y):
Graphic graphic = new Graphic(new Point(x, y),new SimpleMarkerSymbol(Color.BLACK, 12, STYLE.CIRCLE));

...And you are adding your new Graphic "graphic" at "location"
Graphic g = new Graphic (point,symbol);


are "point" and "new Point(x,y);" the same location?  Why not just create a new point object and re-use it?
Point p = new Point(x,y);
Graphic graphic = new Graphic(p,new SimpleMarkerSymbol(Color.BLACK, 12, STYLE.CIRCLE));
Graphic g = new Graphic (p,symbol);


If these are in fact the same point location, you might want to check and see if your picture marker symbol is being inserted with an offset by default.  I'm not 100% sure but picture marker symbols might be inserted lower-left.  You can adjust for this using .setOffsetX(); and .setOffsetY();
http://help.arcgis.com/en/arcgismobile/10.0/apis/android/api/com/esri/core/symbol/MarkerSymbol.html#...


0 Kudos