|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.bbn.openmap.event.MapMouseAdapter com.bbn.openmap.omGraphics.EditableOMGraphic com.bbn.openmap.omGraphics.EditableOMAbstractLine com.bbn.openmap.omGraphics.EditableOMPoly
public class EditableOMPoly
The EditableOMPoly encompasses an OMPoly, providing methods for modifying or creating it.
Nested Class Summary | |
---|---|
static class |
EditableOMPoly.OMPolyUndoEvent
Subclass for undoing edits for OMPoly classes, handles enclose/unenclose events. |
Nested classes/interfaces inherited from class com.bbn.openmap.omGraphics.EditableOMGraphic |
---|
EditableOMGraphic.OMGraphicUndoEvent |
Field Summary | |
---|---|
protected OffsetGrabPoint |
gpm
|
protected OffsetGrabPoint |
gpo
|
protected boolean |
manualEnclosed
Whether the poly is a polygon, as opposed to a polyline. |
static int |
OFFSET_POINT_INDEX
|
protected OMPoly |
poly
|
protected java.util.List<GrabPoint> |
polyGrabPoints
|
protected int |
selectNodeIndex
Set the index of the grab point that should be rendered differently, in order to highlight a specific node. |
Fields inherited from class com.bbn.openmap.omGraphics.EditableOMAbstractLine |
---|
arrowheadMenu |
Fields inherited from class com.bbn.openmap.omGraphics.EditableOMGraphic |
---|
actionMask, canGrabGraphic, DEBUG, DEBUG_DETAIL, gPoints, GRAB_POINT_DRAWING_ATTRIBUTES_ATTRIBUTE, holder, i18n, lastMouseEvent, listeners, mouseModeServiceList, movingPoint, popupIsUp, projection, SELECTED_GRAB_POINT_DRAWING_ATTRIBUTES_ATTRIBUTE, showGUI, stateMachine, undoStack, xorRendering |
Constructor Summary | |
---|---|
EditableOMPoly()
Create the EditableOMPoly, setting the state machine to create the poly off of the gestures. |
|
EditableOMPoly(GraphicAttributes ga)
Create an EditableOMPoly with the polyType and renderType parameters in the GraphicAttributes object. |
|
EditableOMPoly(OMPoly omp)
Create the EditableOMPoly with an OMPoly already defined, ready for editing. |
Method Summary | |
---|---|
int |
addMovingPoint(int x,
int y)
Add a point to the end of the polyline/polygon and then make it the moving one. |
int |
addPoint(GrabPoint gp)
Add a point at a certain point in the polygon coordinate list. |
int |
addPoint(GrabPoint gp,
int position)
Add a point at a certain point in the polygon coordinate list. |
int |
addPoint(int x,
int y)
Add a point to the end of the polyline/polygon. |
int |
addPoint(int x,
int y,
int position)
Add a point at a certain point in the polygon coordinate list. |
protected void |
addPolyGrabPointsToOGP(OffsetGrabPoint ogp)
This method adds all the GrabPoints associated with the polygon nodes and adds them to the offset GrabPoint representing the lat/lon anchor point. |
void |
assertGrabPoints()
Check to make sure the grab points are not null. |
void |
attachToMovingGrabPoint(OffsetGrabPoint gp)
Attach to the Moving OffsetGrabPoint so if it moves, it will move this EditableOMGraphic with it. |
void |
clearSelectedNode()
Make sure no node is highlighted. |
protected GrabPoint |
createGrabPoint(int x,
int y,
int index,
int last)
An internal method that tries to make sure that the grab point for the first node, and for the last, in case of an enclosed polygon, are OffsetGrabPoints. |
void |
createGraphic(GraphicAttributes ga)
Create and set the graphic within the state machine. |
OMGraphic |
createGraphic(int renderType,
int lineType)
Extendable method to create specific subclasses of OMPolys. |
protected UndoEvent |
createUndoEventForCurrentState(java.lang.String whatHappened)
Create an UndoEvent that can get an OMPoly back to what it looks like right now. |
void |
deletePoint()
Delete a point off the end of the polyline/polygon. |
void |
deletePoint(int position)
Delete a point at a certain point in the polygon coordinate list. |
void |
detachFromMovingGrabPoint(OffsetGrabPoint gp)
Detach from a Moving OffsetGrabPoint. |
void |
enablePolygonButton(boolean enable)
|
void |
enablePolygonEditButtons(boolean enable)
|
void |
enclose(boolean e)
|
boolean |
evaluateEnclosed()
Method checks if the polygon should be enclosed, and then adds an addition point to the end of the polygon, setting the end point on top of the beginning point. |
boolean |
generate(Projection proj)
Use the current projection to place the graphics on the screen. |
protected void |
generateGrabPoints(Projection proj)
Generate the grab points, checking the OMGraphic to see if it contains information about what the grab points should look like. |
GrabPoint |
getGrabPoint(int index)
Return a particular GrabPoint at a particular point in the array. |
GrabPoint[] |
getGrabPoints()
Get the array of grab points used for the EditableOMGraphic. |
OMGraphic |
getGraphic()
Get the OMGraphic being created/modified by the EditableOMPoly. |
java.awt.Component |
getGUI(GraphicAttributes graphicAttributes)
Adds widgets to modify polygon. |
java.net.URL |
getImageURL(java.lang.String imageName)
|
GrabPoint |
getMovingPoint(java.awt.event.MouseEvent e)
Given a MouseEvent, find a GrabPoint that it is touching, and set the moving point to that GrabPoint. |
javax.swing.JComponent |
getPolyGUI()
|
javax.swing.JComponent |
getPolyGUI(boolean includeEnclose,
boolean includeExt,
boolean includeAdd,
boolean includeDelete,
int orientation)
|
javax.swing.JComponent |
getPolyGUI(boolean includeEnclose,
boolean includeExt,
boolean includeAdd,
boolean includeDelete,
int orientation,
javax.swing.JComponent buttonBox)
|
javax.swing.JComponent |
getPolyGUI(int orientation,
javax.swing.JComponent toolbar)
|
int |
getSelectNodeIndex()
|
void |
init()
Create and initialize the state machine that interprets the modifying gestures/commands, as well as initialize the grab points. |
boolean |
isEnclosed()
Returns whether the graphic will be a polygon, instead of a polyline. |
void |
move(java.awt.event.MouseEvent e)
Called to set the OffsetGrabPoint to the current mouse location, and update the OffsetGrabPoint with all the other GrabPoint locations, so everything can shift smoothly. |
void |
regenerate(Projection proj)
Given a new projection, the grab points may need to be repositioned off the current position of the graphic. |
void |
render(java.awt.Graphics graphics)
Draw the EditableOMPoly parts into the java.awt.Graphics object. |
void |
setEnclosed(boolean set)
Set the flag to make the polygon enclosed, which automatically connects the last point with the first point. |
boolean |
setGrabPoint(GrabPoint gb,
int index)
Set the GrabPoint at a particule index of the array. |
void |
setGrabPoints()
Take the current location of the GrabPoints, and modify the location parameters of the OMPoly with them. |
boolean |
setGrabPoints(GrabPoint[] points)
Set the grab point objects within the EditableOMGraphic array. |
void |
setGrabPoints(OMGraphic graphic)
Set the grab points for the graphic provided, setting them on the extents of the graphic. |
void |
setGraphic(OMGraphic graphic)
Set the graphic within the state machine. |
void |
setMovingPoint(GrabPoint gp)
Set the GrabPoint that is in the middle of being modified, as a result of a mouseDragged event, or other selection process. |
void |
setSelectNodeIndex(int selectNodeIndex)
|
protected boolean |
syncEnclosed()
Method connects the last point to the first point. |
protected boolean |
unsyncEnclosed()
Method disconnects the last point from the first point. |
int |
whichGrabPoint(GrabPoint gp)
Given a grab point, return its index into the polygon array. |
Methods inherited from class com.bbn.openmap.omGraphics.EditableOMAbstractLine |
---|
createArrowIcon, getArrowHeadMenu |
Methods inherited from class java.lang.Object |
---|
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected java.util.List<GrabPoint> polyGrabPoints
protected OffsetGrabPoint gpo
protected OffsetGrabPoint gpm
protected OMPoly poly
protected boolean manualEnclosed
protected int selectNodeIndex
public static int OFFSET_POINT_INDEX
Constructor Detail |
---|
public EditableOMPoly()
public EditableOMPoly(GraphicAttributes ga)
public EditableOMPoly(OMPoly omp)
omp
- OMPoly that should be edited.Method Detail |
---|
public void init()
public void setGraphic(OMGraphic graphic)
setGraphic
in class EditableOMGraphic
graphic
- OMGraphic.public boolean evaluateEnclosed()
protected boolean syncEnclosed()
protected boolean unsyncEnclosed()
public void enclose(boolean e)
public void setEnclosed(boolean set)
public boolean isEnclosed()
public void createGraphic(GraphicAttributes ga)
createGraphic
in class EditableOMGraphic
ga
- GraphicAttributes, describing the graphic to be created.public OMGraphic createGraphic(int renderType, int lineType)
public OMGraphic getGraphic()
getGraphic
in class EditableOMGraphic
public void attachToMovingGrabPoint(OffsetGrabPoint gp)
attachToMovingGrabPoint
in class EditableOMGraphic
public void detachFromMovingGrabPoint(OffsetGrabPoint gp)
detachFromMovingGrabPoint
in class EditableOMGraphic
public void setMovingPoint(GrabPoint gp)
setMovingPoint
in class EditableOMGraphic
public GrabPoint getMovingPoint(java.awt.event.MouseEvent e)
getMovingPoint
in class EditableOMGraphic
e
- MouseEvent
public void assertGrabPoints()
protected GrabPoint createGrabPoint(int x, int y, int index, int last)
x
- the horizontal pixel location of the grab point.y
- the vertical pixel location of the grab point.index
- the index of the grab point.last
- the index of the last point.public void setGrabPoints(OMGraphic graphic)
public void setGrabPoints()
setGrabPoints
in class EditableOMGraphic
public int addMovingPoint(int x, int y)
public int addPoint(int x, int y)
public int addPoint(int x, int y, int position)
public int addPoint(GrabPoint gp)
gp
- the GrabPoint set to the screen coordinates of the point to be
added.
public int addPoint(GrabPoint gp, int position)
public void deletePoint()
public void deletePoint(int position)
public void move(java.awt.event.MouseEvent e)
move
in class EditableOMGraphic
protected void addPolyGrabPointsToOGP(OffsetGrabPoint ogp)
public boolean generate(Projection proj)
generate
in class EditableOMGraphic
proj
- com.bbn.openmap.proj.Projection
protected void generateGrabPoints(Projection proj)
proj
- public void regenerate(Projection proj)
regenerate
in class EditableOMGraphic
public void render(java.awt.Graphics graphics)
render
in class EditableOMGraphic
graphics
- java.awt.Graphics.public boolean setGrabPoints(GrabPoint[] points)
setGrabPoints
in class EditableOMGraphic
points
- a GrabPoint[] for the points on the polygon.
public GrabPoint[] getGrabPoints()
getGrabPoints
in class EditableOMGraphic
public boolean setGrabPoint(GrabPoint gb, int index)
setGrabPoint
in class EditableOMGraphic
gb
- GrabPoint to assign within array.index
- the index of the array to put the GrabPoint. This index
should be -1 for the offset grab point, or the index of the corner
of the poly, in order starting from 0.
public int whichGrabPoint(GrabPoint gp)
public GrabPoint getGrabPoint(int index)
getGrabPoint
in class EditableOMGraphic
public java.awt.Component getGUI(GraphicAttributes graphicAttributes)
getGUI
in class EditableOMAbstractLine
graphicAttributes
- the GraphicAttributes to use to get the GUI
widget from to control those parameters for this EOMG.
public void enablePolygonButton(boolean enable)
public void enablePolygonEditButtons(boolean enable)
public javax.swing.JComponent getPolyGUI()
public javax.swing.JComponent getPolyGUI(int orientation, javax.swing.JComponent toolbar)
public javax.swing.JComponent getPolyGUI(boolean includeEnclose, boolean includeExt, boolean includeAdd, boolean includeDelete, int orientation)
public javax.swing.JComponent getPolyGUI(boolean includeEnclose, boolean includeExt, boolean includeAdd, boolean includeDelete, int orientation, javax.swing.JComponent buttonBox)
public java.net.URL getImageURL(java.lang.String imageName)
public int getSelectNodeIndex()
public void setSelectNodeIndex(int selectNodeIndex)
selectNodeIndex
- the selectNodeIndex to setpublic void clearSelectedNode()
protected UndoEvent createUndoEventForCurrentState(java.lang.String whatHappened)
createUndoEventForCurrentState
in class EditableOMGraphic
whatHappened
- String describing what got you here. You can leave this null if you just want to go with the default.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |