Class PolylineBehavior
- All Implemented Interfaces:
IBehavior
- Direct Known Subclasses:
PolygonBehavior
Behavior that allows user to draw a polyline by its vertexes on the image of
the associated MapControl using a
PolylineListener.
- Author:
- Vicente Caballero Navarro, Pablo Piqueras Bartolomé
-
Field Summary
FieldsModifier and TypeFieldDescriptionThe abscissa coordinate of all vertexes of the polyline.The ordinate coordinate of all vertexes of the polyline.protected booleanDetermines if user is setting the vertexes (with one click of the button 1 of the mouse), or not.protected PolylineListenerTool listener used to work with theMapControlobject.Fields inherited from class org.gvsig.fmap.mapcontrol.tools.Behavior.Behavior
BUTTON_LEFT, BUTTON_MIDDLE, BUTTON_RIGHT, geomManager, LOG, LOGGER -
Constructor Summary
ConstructorsConstructorDescriptionCreates a new behavior for drawing a polyline by its vertexes. -
Method Summary
Modifier and TypeMethodDescriptionprotected voidAdds a new point to the polyline.protected voidChanges the last point added of the polyline.protected voiddrawPolyLine(MapControlDrawer mapControlDrawer) Draws the polyline in theGraphics2Dof the associatedMapControl.Gets theToolListenerused by this behavior to perform actions on the associatedMapControlobject.voidvoidvoidvoidpaintComponent(MapControlDrawer mapControlDrawer) Method executed in real-time, when user is working with a tool on the associatedMapControlobject, repainting theMapControl's image.voidsetListener(ToolListener listener) Sets a tool listener to work with theMapControlusing this behavior.Methods inherited from class org.gvsig.fmap.mapcontrol.tools.Behavior.Behavior
clean, createArc, createArc, createArc, createCircle, createEllipse, createPoint, createPoint, getImageCursor, getMapControl, getUseSnapping, isMyButton, isMyButton, mouseEntered, mouseExited, mousePressed, mouseReleased, mouseWheelMoved, paintComponent, resetMyButton, setMapControl, setUseSnapping
-
Field Details
-
arrayX
The abscissa coordinate of all vertexes of the polyline. -
arrayY
The ordinate coordinate of all vertexes of the polyline. -
isClicked
protected boolean isClickedDetermines if user is setting the vertexes (with one click of the button 1 of the mouse), or not. -
listener
Tool listener used to work with theMapControlobject.- See Also:
-
-
Constructor Details
-
PolylineBehavior
Creates a new behavior for drawing a polyline by its vertexes.
- Parameters:
mli- listener used to permit this object to work with the associatedMapControl
-
-
Method Details
-
paintComponent
Description copied from interface:IBehaviorMethod executed in real-time, when user is working with a tool on the associated
MapControlobject, repainting theMapControl's image.Returns immediately in all cases, even if the complete image has not yet been loaded.
This method will be implemented according to the specific nature of each behavior, and its extra and particular features.
- Specified by:
paintComponentin interfaceIBehavior- Overrides:
paintComponentin classBehavior- See Also:
-
mouseClicked
- Specified by:
mouseClickedin interfaceIBehavior- Overrides:
mouseClickedin classBehavior- Throws:
BehaviorException- any exception processing the action associated to a mouse clicked event, by theIBehaviorobject- See Also:
-
mouseDragged
- Specified by:
mouseDraggedin interfaceIBehavior- Overrides:
mouseDraggedin classBehavior- Throws:
BehaviorException- any exception processing the action associated to a mouse dragged event, by theIBehaviorobject- See Also:
-
changeLastPoint
Changes the last point added of the polyline.
- Parameters:
p- a point which will replace the last added to the polyline
-
mouseMoved
- Specified by:
mouseMovedin interfaceIBehavior- Overrides:
mouseMovedin classBehavior- Throws:
BehaviorException- any exception processing the action associated to a mouse moved event, by theIBehaviorobject- See Also:
-
drawPolyLine
Draws the polyline in the
Graphics2Dof the associatedMapControl.- Parameters:
mapControlDrawer-
-
addPoint
Adds a new point to the polyline.
- Parameters:
p- a new point to the polyline
-
setListener
Sets a tool listener to work with the
MapControlusing this behavior.- Parameters:
listener- aPolylineListenerobject for this behavior
-
getListener
Description copied from interface:IBehaviorGets the
ToolListenerused by this behavior to perform actions on the associatedMapControlobject.- Specified by:
getListenerin interfaceIBehavior- Specified by:
getListenerin classBehavior- Returns:
- the
ToolListenerused by this behavior
-