com.esri.core.symbol.SimpleFillSymbol Java Examples
The following examples show how to use
com.esri.core.symbol.SimpleFillSymbol.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: GeoJsonApp.java From arcgis-runtime-demo-java with Apache License 2.0 | 6 votes |
/** * Parse GeoJSON file and add the features to a graphics layer. * @param graphicsLayer layer to which the features should be added. */ private void addGeoJsonFeatures(GraphicsLayer graphicsLayer) { try { // create an instance of the parser GeoJsonParser geoJsonParser = new GeoJsonParser(); // provide the symbology for the features CompositeSymbol symbol = new CompositeSymbol(); symbol.add(new SimpleFillSymbol(new Color(0, 255, 0, 70))); symbol.add(new SimpleLineSymbol(Color.BLACK, 2)); geoJsonParser.setSymbol(symbol).setOutSpatialReference(map.getSpatialReference()); // parse geojson data File geoJsonFile = new File(GEOJSON_DATA_FILE); List<Feature> features = geoJsonParser.parseFeatures(geoJsonFile); // add parsed features to a layer for (Feature f : features) { graphicsLayer.addGraphic(new Graphic(f.getGeometry(), f.getSymbol(), f.getAttributes())); } } catch (Exception ex) { throw new RuntimeException(ex); } }
Example #2
Source File: ClusterLayer.java From arcgis-runtime-demo-java with Apache License 2.0 | 5 votes |
private Symbol createPolygonSymbol(Color color, int num) { List<Symbol> symbols = new ArrayList<Symbol>(); symbols.add(new SimpleFillSymbol(new Color(color.getRed(), color.getGreen(), color.getBlue(), 70))); symbols.add(new TextSymbol(14, "" + num, Color.WHITE)); CompositeSymbol cs = new CompositeSymbol(symbols); return cs; }
Example #3
Source File: GeometryOnlineApp.java From arcgis-runtime-demo-java with Apache License 2.0 | 5 votes |
@Override public void onMouseClicked(MouseEvent event) { graphicsLayer.removeAll(); // add buffer as a graphic Point mapPoint = map.toMapPoint(event.getX(), event.getY()); final Geometry buffer = GeometryEngine.buffer( mapPoint, map.getSpatialReference(), 200000, map.getSpatialReference().getUnit()); graphicsLayer.addGraphic(new Graphic(buffer, new SimpleFillSymbol(new Color(255, 0, 0, 255)))); // get states at the buffered area QueryTask queryTask = new QueryTask(featureLayer.getUrl()); QueryParameters queryParams = new QueryParameters(); queryParams.setInSpatialReference(map.getSpatialReference()); queryParams.setOutSpatialReference(map.getSpatialReference()); queryParams.setGeometry(buffer); queryParams.setReturnGeometry(true); queryParams.setOutFields(new String[] {"STATE_NAME"}); queryTask.execute(queryParams, new CallbackListener<FeatureResult>() { @Override public void onError(Throwable arg0) { // deal with any exception } @Override public void onCallback(FeatureResult result) { for (Object objFeature : result) { Feature feature = (Feature) objFeature; graphicsLayer.addGraphic(new Graphic(feature.getGeometry(), stateSymbol)); graphicsLayer.addGraphic(new Graphic(buffer, new SimpleFillSymbol(new Color(255, 0, 0, 255)))); } } }); }
Example #4
Source File: GeometryOnlineApp.java From arcgis-runtime-demo-java with Apache License 2.0 | 5 votes |
@Override public void onMouseClicked(MouseEvent event) { graphicsLayer.removeAll(); // add buffer as a graphic Point mapPoint = map.toMapPoint(event.getX(), event.getY()); Geometry buffer = GeometryEngine.buffer( mapPoint, map.getSpatialReference(), 200000, map.getSpatialReference().getUnit()); graphicsLayer.addGraphic(new Graphic(buffer, new SimpleFillSymbol(new Color(100, 0, 0, 80)))); // get states at the buffered area QueryTask queryTask = new QueryTask(featureLayer.getUrl()); QueryParameters queryParams = new QueryParameters(); queryParams.setInSpatialReference(map.getSpatialReference()); queryParams.setOutSpatialReference(map.getSpatialReference()); queryParams.setGeometry(buffer); queryParams.setReturnGeometry(true); queryParams.setOutFields(new String[] {"STATE_NAME"}); queryTask.executeAsync(queryParams, new CallbackListener<FeatureResult>() { @Override public void onError(Throwable arg0) { // deal with any exception } @Override public void onCallback(FeatureResult result) { for (Object objFeature : result) { Feature feature = (Feature) objFeature; graphicsLayer.addGraphic(new Graphic(feature.getGeometry(), stateSymbol)); } } }); }