package testing; import com.esri.client.local.ArcGISLocalFeatureLayer; import com.esri.core.geometry.Geometry.Type; public class getGeomTypes { public static void main(String[] args) { String mapPackage = "C:\\eclipse_config\\3.7.2\\ITN_EditMap\\data\\set1\\mapPackge_referencesdata_includesSDE.mpk"; ArcGISLocalFeatureLayer flObj = new ArcGISLocalFeatureLayer( mapPackage, "roads_gdbc"); Type geomType = flObj.getGeometryType(); if (geomType == Type.Polygon || geomType == Type.Envelope) { flObj.setOpacity(3f); } else { flObj.setOpacity(8f); } } }
Solved! Go to Solution.
@Test public void addLocalFeatureLayer() throws InterruptedException { final Lock lock = new ReentrantLock(); lock.lock(); try { final Condition condition = lock.newCondition(); final ArcGISLocalFeatureLayer layer = new ArcGISLocalFeatureLayer(mapPackagePath, "Germany"); layer.addLayerInitializeCompleteListener(new LayerInitializeCompleteListener() { @Override public void layerInitializeComplete(LayerInitializeCompleteEvent e) { lock.lock(); try { assertTrue("The local layer must have a valid URL!", null != layer.getUrl()); Type geometryType = layer.getGeometryType(); assertTrue("The geometry type is not valid!", Geometry.Type.Polygon == geometryType); } finally { condition.signal(); lock.unlock(); } } }); layer.initializeAsync(); condition.await(); } finally { lock.unlock(); } }
@Test public void addLocalFeatureLayer() throws InterruptedException { final Lock lock = new ReentrantLock(); lock.lock(); try { final Condition condition = lock.newCondition(); final ArcGISLocalFeatureLayer layer = new ArcGISLocalFeatureLayer(mapPackagePath, "Germany"); layer.addLayerInitializeCompleteListener(new LayerInitializeCompleteListener() { @Override public void layerInitializeComplete(LayerInitializeCompleteEvent e) { lock.lock(); try { assertTrue("The local layer must have a valid URL!", null != layer.getUrl()); Type geometryType = layer.getGeometryType(); assertTrue("The geometry type is not valid!", Geometry.Type.Polygon == geometryType); } finally { condition.signal(); lock.unlock(); } } }); layer.initializeAsync(); condition.await(); } finally { lock.unlock(); } }