Class AreaListenerImpl
- All Implemented Interfaces:
PolylineListener,ToolListener
Listener for calculating the area of a polygon, defined in the associated MapControl
object.
If the view port of the associated MapControl isn't projected gets the area according the
geographical coordinates.
- Author:
- Vicente Caballero Navarro
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected MeasureEventInformation about all vertexes andGeneralPathXs of the polyline.protected MapControlReference to theMapControlobject that uses. -
Constructor Summary
ConstructorsConstructorDescriptionCreates a new listener for calculating the area of a polygon. -
Method Summary
Modifier and TypeMethodDescriptionbooleanDetermines if the drawing process that this tool executes on theMapControlinstance could be canceled or not.Gets theCursorassociated to this tool.static voidvoidpointFixed(MeasureEvent event) Called when user executes a mouse click and selects a vertex of the polyline.voidpoints(MeasureEvent event) Called when user moves the mouse after selecting a vertex of the polyline.voidpolylineFinished(MeasureEvent event) Called when user executes a double click with the mouse, finishing the drawn of the polyline.protected doublereturnArea(Point2D point) Returns the area of the polygon, usingreturnCoordsAreaif theViewPortof the associatedMapControlis projected, or usingreturnGeoCAreaif isn't.doublereturnCoordsArea(Double[] xs, Double[] ys, Point2D point) Returns the area of the polygon using point as initial, in real values with the current measure unit, according the projection in theViewPortof theMapControl.doublereturnGeoCArea(Double[] xs, Double[] ys, Point2D point) Returns the area in geographical coordinates of the polygon, according the Haversine function.
-
Field Details
-
mapCtrl
Reference to theMapControlobject that uses. -
event
Information about all vertexes andGeneralPathXs of the polyline.
-
-
Constructor Details
-
AreaListenerImpl
Creates a new listener for calculating the area of a polygon.
- Parameters:
mc- theMapControlwhere is calculated the area
-
-
Method Details
-
points
Description copied from interface:PolylineListenerCalled when user moves the mouse after selecting a vertex of the polyline.
Each kind of polyline listener calculates different information with the data of the
MeasureEvent, according its nature.- Specified by:
pointsin interfacePolylineListener- Parameters:
event- information about the mouse event, and geometry data of the polyline
-
returnArea
Returns the area of the polygon, using
returnCoordsAreaif theViewPortof the associatedMapControlis projected, or usingreturnGeoCAreaif isn't.- Parameters:
point- unused parameter- Returns:
- area from the vertexes stored at the measure event in real coordinates, or, if the
MapControlisn't projected, in geographical coordinates - See Also:
-
returnCoordsArea
Returns the area of the polygon using point as initial, in real values with the current measure unit, according the projection in the
ViewPortof theMapControl.- Parameters:
xs- abscissa coordinate of all vertexes of the polygonys- ordinate coordinate of all vertexes of the polygonpoint- point 2D used as first vertex in the calculation of the area- Returns:
- the area of the polygon
-
main
-
returnGeoCArea
Returns the area in geographical coordinates of the polygon, according the Haversine function.
- See Also:
-
getImageCursor
Description copied from interface:ToolListenerGets the
Cursorassociated to this tool.- Specified by:
getImageCursorin interfaceToolListener- Returns:
- component with the bitmap associated to this tool
-
pointFixed
Description copied from interface:PolylineListenerCalled when user executes a mouse click and selects a vertex of the polyline.
- Specified by:
pointFixedin interfacePolylineListener- Parameters:
event- information about the mouse event, and geometry data of the polyline
-
polylineFinished
Description copied from interface:PolylineListenerCalled when user executes a double click with the mouse, finishing the drawn of the polyline.
All features of the active and vector layers of the associated
MapControlobject that their area intersect with the polygonal area defined in the event, will be selected.- Specified by:
polylineFinishedin interfacePolylineListener- Parameters:
event- information about the mouse event, and geometry data of the polyline
-
cancelDrawing
public boolean cancelDrawing()Description copied from interface:ToolListenerDetermines if the drawing process that this tool executes on the
MapControlinstance could be canceled or not.- Specified by:
cancelDrawingin interfaceToolListener- Returns:
trueif is cancellable; otherwise returnsfalse
-