Interface CanvasLayer
- All Superinterfaces:
- Layer
GeoMap used to display vector geometries
 and draw geometries via UI.
 
 GeoMap UI component has the canvas initially and it can be obtained by calling
 GeoMap.getCanvas() method.
 
 Before attempting to draw geometries make sure that the canvas is selected on a map.
 It can be done by invoking geoMap.selectLayerById("canvas") on GeoMap
 or specifying the selected layer in the XML-descriptor of the GeoMap.
- 
Nested Class SummaryNested ClassesModifier and TypeInterfaceDescriptionstatic interfaceA common interface for a wrapper encapsulating a vector geometry on the canvas and providing an API to control it.static interfaceA wrapper class encapsulatingPointon the canvas.static interfaceA wrapper class encapsulatingPolygonon the canvas.static interfaceA wrapper class encapsulatingLineStringon the canvas.
- 
Field SummaryFields
- 
Method SummaryModifier and TypeMethodDescriptionaddPoint(org.locationtech.jts.geom.Point point) Adds a JTS point to the canvas.Registers a new point click listener.Registers a new point modified (drag end) listener.Registers a new point right click listener.addPolygon(org.locationtech.jts.geom.Polygon polygon) Adds a JTS polygon to the canvas.Registers a new polygon click listener.Registers a new polygon modified listener.Registers a new polygon right click listener.addPolyline(org.locationtech.jts.geom.LineString polyline) Adds a JTS linestring to the canvas.Registers a new polyline click listener.Registers a new polyline modified listener.Registers a new polyline right click listener.voidCancels the drawing mode.voidclear()Removes all geometries from the canvas.voiddrawPoint(Consumer<CanvasLayer.Point> afterPointDrawnAction) Activates the point drawing mode.voiddrawPolygon(Consumer<CanvasLayer.Polygon> afterPolygonDrawnAction) Activates the polygon drawing mode.voiddrawPolyline(Consumer<CanvasLayer.Polyline> afterPolylineDrawnAction) Activates the polyline drawing mode.voidremovePoint(CanvasLayer.Point point) Removes a point from the canvas.voidremovePolygon(CanvasLayer.Polygon polygon) Removes a polygon from the canvas.voidremovePolyline(CanvasLayer.Polyline polyline) Removes a polyline from the canvas.Methods inherited from interface io.jmix.mapsui.component.layer.LayergetId, getMaxZoom, getMinZoom, isEditable, isVisible, refresh, setEditable, setMaxZoom, setMinZoom, setVisible
- 
Field Details- 
ID- See Also:
 
 
- 
- 
Method Details- 
addPointAdds a JTS point to the canvas.This method returns an instance of CanvasLayer.Pointwhich controls the added point on the canvas. This object can be used to define point's appearance, subscribe to events. You can also pass this object toremovePoint(Point)method to remove the point from the canvas.- Parameters:
- point- JTS point
- Returns:
- canvas point
 
- 
addPolylineAdds a JTS linestring to the canvas.This method returns an instance of CanvasLayer.Polylinewhich controls the added polyline on the canvas. This object can be used to define polyline's appearance, subscribe to events. You can also pass this object toremovePolyline(Polyline)method to remove the polyline from the canvas.- Parameters:
- polyline- JTS linestring
- Returns:
- canvas polyline
 
- 
addPolygonAdds a JTS polygon to the canvas.This method returns an instance of CanvasLayer.Polygonwhich controls the added polygon on the canvas. This object can be used to define polygon's appearance, subscribe to events. You can also pass this object toremovePolygon(Polygon)method to remove the polygon from the canvas.- Parameters:
- polygon- JTS polygon
- Returns:
- canvas polygon
 
- 
removePointRemoves a point from the canvas.- Parameters:
- point- canvas point
 
- 
removePolylineRemoves a polyline from the canvas.- Parameters:
- polyline- canvas polyline
 
- 
removePolygonRemoves a polygon from the canvas.- Parameters:
- polygon- canvas polygon
 
- 
clearvoid clear()Removes all geometries from the canvas.
- 
drawPointActivates the point drawing mode.After the point is drawn the afterPointDrawnActionis invoked. This action can be used to obtain the geometry value or to apply additional settings for the point.Note that drawn point stays on the canvas, but it can be removed in the afterPointDrawnAction.- Parameters:
- afterPointDrawnAction- consumer that takes drawn- CanvasLayer.Pointas an argument
 
- 
drawPolylineActivates the polyline drawing mode.After the polyline is drawn the afterPolylineDrawnActionis invoked. This action can be used to obtain the geometry value or to apply additional settings for the polyline.Note that drawn polyline stays on the canvas, but it can be removed in the afterPolylineDrawnAction.- Parameters:
- afterPolylineDrawnAction- consumer that takes drawn- CanvasLayer.Polylineas an argument
 
- 
drawPolygonActivates the polygon drawing mode.After the polygon is drawn the afterPolygonDrawnActionis invoked. This action can be used to obtain the geometry value or to apply additional settings for the polygon.Note that drawn polygon stays on the canvas, but it can be removed in the afterPolygonDrawnAction.- Parameters:
- afterPolygonDrawnAction- consumer that takes drawn- CanvasLayer.Polygonas an argument
 
- 
cancelDrawingvoid cancelDrawing()Cancels the drawing mode.
- 
addPointClickListenerRegisters a new point click listener. Listener will be receiving events from all points on the canvas.- Parameters:
- listener- the listener to be added
- Returns:
- a registration object for removing an event listener added to a source
 
- 
addPointRightClickListenerRegisters a new point right click listener. Listener will be receiving events from all points on the canvas.- Parameters:
- listener- the listener to be added
- Returns:
- a registration object for removing an event listener added to a source
 
- 
addPointModifiedListenerRegisters a new point modified (drag end) listener. Listener will be receiving events from all points on the canvas.- Parameters:
- listener- the listener to be added
- Returns:
- a registration object for removing an event listener added to a source
 
- 
addPolylineClickListenerRegisters a new polyline click listener. Listener will be receiving events from all polylines on the canvas.- Parameters:
- listener- the listener to be added
- Returns:
- a registration object for removing an event listener added to a source
 
- 
addPolylineRightClickListenerRegisters a new polyline right click listener. Listener will be receiving events from all polylines on the canvas.- Parameters:
- listener- the listener to be added
- Returns:
- a registration object for removing an event listener added to a source
 
- 
addPolylineModifiedEventRegisters a new polyline modified listener. Listener will be receiving events from all polylines on the canvas.- Parameters:
- listener- the listener to be added
- Returns:
- a registration object for removing an event listener added to a source
 
- 
addPolygonClickListenerRegisters a new polygon click listener. Listener will be receiving events from all polygons on the canvas.- Parameters:
- listener- the listener to be added
- Returns:
- a registration object for removing an event listener added to a source
 
- 
addPolygonRightClickListenerRegisters a new polygon right click listener. Listener will be receiving events from all polygons on the canvas.- Parameters:
- listener- the listener to be added
- Returns:
- a registration object for removing an event listener added to a source
 
- 
addPolygonModifiedEventRegisters a new polygon modified listener. Listener will be receiving events from all polygons on the canvas.- Parameters:
- listener- the listener to be added
- Returns:
- a registration object for removing an event listener added to a source
 
 
-