How to draw a circle using Arcgis Java SDK on the arcgis Scene?
The Buffer operation will help you here:
https://developers.arcgis.com/java/api-reference/reference/com/esri/arcgisruntime/geometry/GeometryEngine.html#buffer(com.esri.arcgisruntime.geometry.Geometry,double)
However you need to be careful when using this in 3D if your location is in WGS84 (latitude / longitude) as the buffer used the unit of measure associated with the spatial reference of your point. This will be in degrees is its WGS84 and you may wonder why your buffers are quite large!
The trick is to work in a Projected Coordinate system for this so you can use metres as your unit of measure. So imagine you've got a point collected from a click even on your scene, you would convert this before using a buffer:
// get the point as a web mercator point Point mapPoint = (Point) GeometryEngine.project( wgs84Point, SpatialReferences.getWebMercator()); System.out.println("SR : " + mapPoint.getSpatialReference().getWKText()); // 500 metre buffer Polygon polygon =GeometryEngine.buffer(mapPoint, 500); // some styles SimpleLineSymbol simpleLineSymbol = new SimpleLineSymbol(SimpleLineSymbol.Style.SOLID, 0xFF00FF00, 3); SimpleFillSymbol simpleFillSymbol = new SimpleFillSymbol(SimpleFillSymbol.Style.SOLID, 0xFFFF0000, simpleLineSymbol); // make a graphic and draw it! Graphic graphic = new Graphic(polygon, simpleFillSymbol); graphicsOverlay.getGraphics().add(graphic);
Does this help?
I'm not sure if this relevant to your app, but did you know you can draw domes / spheres in your 3D app like this:
You can draw one of these with the following code:
// dome symbol SimpleMarkerSceneSymbol dome = new SimpleMarkerSceneSymbol(SimpleMarkerSceneSymbol.Style.SPHERE,0x400000FF, 1000, 1000,1000, SceneSymbol.AnchorPosition.CENTER); // graphic for the dome Graphic domeGraphic = new Graphic(wgs84Point, dome); graphicsOverlay.getGraphics().add(domeGraphic);
Thank you! It works fine. I have one more qestion. If i have several circles, can i mark their intersection zone in some different color?
You can create a new geometry with represents the intersection of your polygons. Take a look at
https://developers.arcgis.com/java/api-reference/reference/com/esri/arcgisruntime/geometry/GeometryEngine.html#intersection(com.esri.arcgisruntime.geometry.Geometry,com.esri.arcgisruntime.geometry.Geometry)
Or maybe this may help:
https://developers.arcgis.com/java/api-reference/reference/com/esri/arcgisruntime/geometry/GeometryEngine.html#intersections(com.esri.arcgisruntime.geometry.Geometry,com.esri.arcgisruntime.geometry.Geometry)
Membros conectados podem postar, seguir atualizações e mais. Novo aqui? Registre uma conta gratuita.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.