com.bbn.openmap.omGraphics
Class EditableOMGraphicList

java.lang.Object
  extended by com.bbn.openmap.event.MapMouseAdapter
      extended by com.bbn.openmap.omGraphics.EditableOMGraphic
          extended by com.bbn.openmap.omGraphics.EditableOMGraphicList
All Implemented Interfaces:
MapMouseListener

public class EditableOMGraphicList
extends EditableOMGraphic

An EditableOMGraphic list encapsulates an OMGraphicList to move the editable ones around when they are selected as a group.


Nested Class Summary
 
Nested classes/interfaces inherited from class com.bbn.openmap.omGraphics.EditableOMGraphic
EditableOMGraphic.OMGraphicUndoEvent
 
Field Summary
protected  java.util.List<EditableOMGraphic> editables
          The list of editables wrapping the list contents.
protected  OffsetGrabPoint gpm
          For grabbing the list objects and moving them.
protected  OMGraphicList list
          The list of OMGraphics being selected and moved.
 
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
EditableOMGraphicList()
          Create an empty EditableOMGraphicList, ready to have OMGraphics added to it.
EditableOMGraphicList(OMGraphicList oml)
          Create the EditableOMGraphicList with an OMGraphicList already defined, ready for editing.
 
Method Summary
 void add(EditableOMGraphic editable)
          Add the EditableOMGraphic to the list.
 void add(OMGraphicList list, OMDrawingTool drawingTool)
           
 EditableOMGraphic add(OMGraphic omg, OMDrawingTool drawingTool)
          Create an EditableOMGraphic and add it to the list.
 void clear()
          Remove all EditableOMGraphics and clear out.
 void createGraphic(GraphicAttributes ga)
          Create and set the graphic within the state machine.
 boolean generate(Projection proj)
          Use the current projection to place the graphics on the screen.
 java.util.List<EditableOMGraphic> getEditables()
           
 GrabPoint[] getGrabPoints()
          Get the array of grab points used for the EditableOMGraphic.
 OMGraphic getGraphic()
          Get the OMGraphic being created/modified by the EditableOMGraphicList.
 GrabPoint getMovingPoint(java.awt.event.MouseEvent me)
          Given a MouseEvent, find a GrabPoint that it is touching, and set the moving point to that GrabPoint.
 void init()
          Create and initialize the state machine that interprets the modifying gestures/commands, as well as initialize the grab points.
 void init(OMDrawingTool drawingTool)
          Must be called on a EditableOMGraphicList that is created from an OMGraphicList containing OMGraphics.
 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.
 boolean remove(EditableOMGraphic editable)
          Remove the EditableOMGraphic from the list.
 void remove(OMGraphic omg)
          Remove an OMGraphic from being moved.
 void render(java.awt.Graphics graphics)
          Draw the EditableOMGraphicList parts into the java.awt.Graphics object.
 void setGrabPoints()
          Take the current location of the GrabPoints, and modify the location parameters of the OMLine with them.
 void setGraphic(OMGraphic graphic)
          Set the graphic within the state machine.
 void setProjection(Projection proj)
          Set the current projection.
 
Methods inherited from class com.bbn.openmap.omGraphics.EditableOMGraphic
_getMovingPoint, addEOMGListener, attachToMovingGrabPoint, cleanMap, createAttributePanel, createUndoEventForCurrentState, detachFromMovingGrabPoint, finalize, fireEvent, fireEvent, fireEvent, fireEvent, getActionMask, getCanGrabGraphic, getGrabPoint, getGUI, getGUI, getMouseModeServiceList, getMovingPoint, getProjection, getProjectionPoint, getShowGUI, getStateMachine, getUndoStack, handleInitialMouseEvent, isMouseEventTouching, isMouseEventTouchingTheEdge, isPopupIsUp, isXorRendering, modifyOMGraphicForEditRender, mouseClicked, mouseDragged, mouseEntered, mouseExited, mouseMoved, mouseMoved, mousePressed, mouseReleased, redraw, redraw, redraw, removeEOMGListener, repaint, repaintRender, reset, resetOMGraphicAfterEditRender, setActionMask, setCanGrabGraphic, setGrabPoint, setGrabPoints, setMouseModeServiceList, setMovingPoint, setPopupIsUp, setShowGUI, setStateMachine, setUndoStack, setXorRendering, updateCurrentState
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

gpm

protected OffsetGrabPoint gpm
For grabbing the list objects and moving them.


list

protected OMGraphicList list
The list of OMGraphics being selected and moved.


editables

protected java.util.List<EditableOMGraphic> editables
The list of editables wrapping the list contents.

Constructor Detail

EditableOMGraphicList

public EditableOMGraphicList()
Create an empty EditableOMGraphicList, ready to have OMGraphics added to it.


EditableOMGraphicList

public EditableOMGraphicList(OMGraphicList oml)
Create the EditableOMGraphicList with an OMGraphicList already defined, ready for editing.

Parameters:
oml - OMGraphicList that should be handled.
Method Detail

getEditables

public java.util.List<EditableOMGraphic> getEditables()

init

public void init()
Create and initialize the state machine that interprets the modifying gestures/commands, as well as initialize the grab points. Also allocates the grab point array needed by the EditableOMGraphicList.


init

public void init(OMDrawingTool drawingTool)
Must be called on a EditableOMGraphicList that is created from an OMGraphicList containing OMGraphics.

Parameters:
drawingTool - OMDrawingTool used to create EditableOMGraphics for other OMGraphics on the list, which will in turn be managed by this EditableOMGraphicList. If this is null, nothing will get done. If this drawing tool doesn't know how to create an EditableOMGraphic for anything on the list, those things will not be managed.

getGrabPoints

public GrabPoint[] getGrabPoints()
Description copied from class: EditableOMGraphic
Get the array of grab points used for the EditableOMGraphic. Given a mouse event, you can see if one of these is affected, and move it accordingly. Call setGrabPoints() when modifications are done, so that the OMGraphic is modified.

Overrides:
getGrabPoints in class EditableOMGraphic

setGraphic

public void setGraphic(OMGraphic graphic)
Set the graphic within the state machine. If the graphic is null, then one shall be created, and located off screen until the gestures driving the state machine place it on the map.

Specified by:
setGraphic in class EditableOMGraphic
Parameters:
graphic - OMGraphic.

createGraphic

public void createGraphic(GraphicAttributes ga)
Create and set the graphic within the state machine. The GraphicAttributes describe the type of line to create.

Specified by:
createGraphic in class EditableOMGraphic
Parameters:
ga - GraphicAttributes, describing the graphic to be created.

getGraphic

public OMGraphic getGraphic()
Get the OMGraphic being created/modified by the EditableOMGraphicList.

Specified by:
getGraphic in class EditableOMGraphic

add

public void add(OMGraphicList list,
                OMDrawingTool drawingTool)

add

public EditableOMGraphic add(OMGraphic omg,
                             OMDrawingTool drawingTool)
Create an EditableOMGraphic and add it to the list.

Parameters:
omg - OMGraphic to add.
drawingTool - to use to figure out what EditableOMGraphic to use for the OMGraphic.
Returns:
EditableOMGraphic if successful, null if not.

add

public void add(EditableOMGraphic editable)
Add the EditableOMGraphic to the list.


remove

public void remove(OMGraphic omg)
Remove an OMGraphic from being moved.


remove

public boolean remove(EditableOMGraphic editable)
Remove the EditableOMGraphic from the list.


clear

public void clear()
Remove all EditableOMGraphics and clear out.


setProjection

public void setProjection(Projection proj)
Set the current projection.

Overrides:
setProjection in class EditableOMGraphic

setGrabPoints

public void setGrabPoints()
Take the current location of the GrabPoints, and modify the location parameters of the OMLine with them. Called when you want the graphic to change according to the grab points.

Specified by:
setGrabPoints in class EditableOMGraphic

getMovingPoint

public GrabPoint getMovingPoint(java.awt.event.MouseEvent me)
Description copied from class: EditableOMGraphic
Given a MouseEvent, find a GrabPoint that it is touching, and set the moving point to that GrabPoint. Called when a MouseEvent happens like a mousePressed or mouseReleased, and you want to find out if a GrabPoint should be used to make modifications to the graphic or its position. This method should only be called to establish a moving point. getMovingPoint() should be called to check to see if one has been established, and then redraw(MouseEvent) would be called to move that moving point.

Overrides:
getMovingPoint in class EditableOMGraphic
Parameters:
me - MouseEvent
Returns:
GrabPoint that is touched by the MouseEvent, null if none are.

move

public 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. Should also set the OffsetGrabPoint to the movingPoint. Should be called only once at the beginning of the general movement, in order to set the movingPoint. After that, redraw(e) should just be called, and the movingPoint will make the adjustments to the graphic that are needed.

Specified by:
move in class EditableOMGraphic

generate

public boolean generate(Projection proj)
Use the current projection to place the graphics on the screen. Has to be called to at least assure the graphics that they are ready for rendering. Called when the graphic position changes.

Specified by:
generate in class EditableOMGraphic
Parameters:
proj - com.bbn.openmap.proj.Projection
Returns:
true

regenerate

public void regenerate(Projection proj)
Given a new projection, the grab points may need to be repositioned off the current position of the graphic. Called when the projection changes.

Specified by:
regenerate in class EditableOMGraphic

render

public void render(java.awt.Graphics graphics)
Draw the EditableOMGraphicList parts into the java.awt.Graphics object. The grab points are only rendered if the line machine state is LineSelectedState.LINE_SELECTED.

Specified by:
render in class EditableOMGraphic
Parameters:
graphics - java.awt.Graphics.


Copyright (C) BBNT Solutions LLC; See http://openmap.bbn.com/ for details