Select to view content in your preferred language

GraphicsLayer + SimpleFillSymbol issue in 1.1.1 SDK

1773
2
Jump to solution
06-17-2012 04:34 PM
StephenQuan
Deactivated User
I'm encountering a polygon drawing issue with the automatic black outline you get when using SimpleFillSymbol on the GraphicsLayer.

When using Australian coordinates (Elmore, Victoria, Australia) the automatically black outline does not follow the perimeter of the polygon. Instead, it is incorrectly drawn to infinity.

When using American coordinates (e.g. ESRI campus) the black outline does follow the perimeter of the polygon.

So, this feels like there's an arithmetic issue in the 1.1.1 SDK. The same code works correctly in the 1.0.1 SDK.

[ATTACH=CONFIG]15270[/ATTACH]

The following code example is a modified Hello World Map sample with code for GraphicsLayer with the Polygon and SimpleFillSymbol. Both Elmore and Redlands coordinates are provided with the Redlands commented out.

package com.esri.android.graphicsdemo;  import android.app.Activity; import android.graphics.Color; import android.os.Bundle;  import com.esri.android.map.GraphicsLayer; import com.esri.android.map.MapView; import com.esri.android.map.ags.ArcGISTiledMapServiceLayer; import com.esri.core.geometry.Envelope; import com.esri.core.geometry.GeometryEngine; import com.esri.core.geometry.Line; import com.esri.core.geometry.MultiPath; import com.esri.core.geometry.Point; import com.esri.core.geometry.Polygon; import com.esri.core.geometry.Segment; import com.esri.core.geometry.SpatialReference; import com.esri.core.map.Graphic; import com.esri.core.symbol.SimpleFillSymbol; import com.esri.core.symbol.SimpleMarkerSymbol;  public class GraphicsDemoActivity extends Activity {  MapView map = null;   public void onCreate(Bundle savedInstanceState)  {   super.onCreate(savedInstanceState);   setContentView(R.layout.main);    // Retrieve the map and initial extent from XML layout   map = (MapView)findViewById(R.id.map);   map.addLayer(new ArcGISTiledMapServiceLayer("" +   "http://services.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer"));    // Prepare Web Mercator projection.   SpatialReference sr = SpatialReference.create(102100);      // Define 3 points in Elmore, Victoria, Australia.    Point pt1 = GeometryEngine.project(144.5933, -36.5067, sr);   Point pt2 = GeometryEngine.project(144.6307, -36.5067, sr);   Point pt3 = GeometryEngine.project(144.6109, -36.4799, sr);      // Define 3 points on ESRI Redlands Campus   //Point pt1 = GeometryEngine.project(-117.200, 34.057, sr);   //Point pt2 = GeometryEngine.project(-117.198, 34.057, sr);   //Point pt3 = GeometryEngine.project(-117.199, 34.059, sr);      // Determine a simple bounding box for the points.   Envelope extent = new Envelope(pt1.getX(), pt1.getY(), pt2.getX(), pt3.getY());   extent.inflate(10000, 10000);    // Create a graphics layer and add it to the map.   GraphicsLayer graphicsLayer = new GraphicsLayer();   map.addLayer(graphicsLayer);   map.setExtent(extent);    // Add a GRAY filled polygon to the graphics layer.    MultiPath poly = new Polygon();   Segment seg = new Line();   seg.setStart(pt1);   seg.setEnd(pt2);   poly.addSegment(seg,  true);   seg = new Line();   seg.setStart(pt2);   seg.setEnd(pt3);   poly.addSegment(seg,  false);   seg = new Line();   seg.setStart(pt3);   seg.setEnd(pt1);   poly.addSegment(seg,  false);   poly.closePathWithLine();   graphicsLayer.addGraphic(new Graphic(poly, new SimpleFillSymbol(Color.GRAY)));    // Add RED markers to the graphics layer.   graphicsLayer.addGraphic(new Graphic(pt1, new SimpleMarkerSymbol(Color.RED, 10, SimpleMarkerSymbol.STYLE.CIRCLE)));   graphicsLayer.addGraphic(new Graphic(pt2, new SimpleMarkerSymbol(Color.RED, 10, SimpleMarkerSymbol.STYLE.CIRCLE)));   graphicsLayer.addGraphic(new Graphic(pt3, new SimpleMarkerSymbol(Color.RED, 10, SimpleMarkerSymbol.STYLE.CIRCLE)));  }   protected void onPause()  {   super.onPause();   map.pause();  }   protected void onResume()  {   super.onResume();   map.unpause();  } }
0 Kudos
1 Solution

Accepted Solutions
StephenQuan
Deactivated User
This appears to be fixed in the 2.0.0 SDK.

View solution in original post

0 Kudos
2 Replies
StephenQuan
Deactivated User
These devices DO reproduce the issue:

  • Samsung Galaxy Tab 10.1, Android 3.2

  • Samsung Gio, Android 2.2.1


These devices DO NOT reproduce the issue:

  • Samsung Nexus S, Android 4.0.4

  • Samsung Tab 7, Android 2.3.3

  • HTC Desire, Android 2.2

  • Emulator with GPU emulation, Android 4.0.3


**EDIT** When testing on the older 1.0.1 SDK the issue doesn't occur on the all of the above devices.
0 Kudos
StephenQuan
Deactivated User
This appears to be fixed in the 2.0.0 SDK.
0 Kudos