I want to delete any scene image by clicking on it or nearby. How can i do it?
For example i have a method for adding an image to the Scene
public void AddImage(String imgPath, double longitude, double latitude) {
GraphicsOverlay graphicsOverlay = new GraphicsOverlay();
sceneView.getGraphicsOverlays().add(graphicsOverlay);
PictureMarkerSymbol markerSymbol = new PictureMarkerSymbol(imgPath);
markerSymbol.setHeight(20);
markerSymbol.setWidth(20);
markerSymbol.loadAsync();
markerSymbol.addDoneLoadingListener(() -> {
if (markerSymbol.getLoadStatus() == com.esri.arcgisruntime.loadable.LoadStatus.LOADED) {
com.esri.arcgisruntime.geometry.Point symbolPoint = new com.esri.arcgisruntime.geometry.Point(longitude, latitude, SpatialReferences.getWgs84());
Graphic symbolGraphic = new Graphic(symbolPoint, markerSymbol);
graphicsOverlay.getGraphics().add(symbolGraphic);
sceneView.getGraphicsOverlays().add(graphicsOverlay);
} else {
System.out.println("Failed to load: " + markerSymbol.getLoadError().getCause());
}
});
}
Also i want to have a method to delete image from the Scene by clicking button Delete and clicking on that image icon on the Scene after that.
public void DeleteBtn_Click(javafx.event.ActionEvent actionEvent) {
sceneView.setInteractionListener(new SceneView.DefaultInteractionListener(sceneView) {
public void onMousePressed(javafx.scene.input.MouseEvent e) {
javafx.geometry.Point2D screenPoint = new javafx.geometry.Point2D(Math.round(e.getX()),
Math.round(e.getY()));
DeleteImage(screenPoint);///so i need a method that get screenPoint and deletes an image near the screenPoint coordinates
}
});
}
So i need a method that gets javafx.geometry.Point2D point and deletes an image located near the coordinates of this point. I didnt find any java arcgis api functions suitable for this.