org.kaboum
Class KaboumGEOMETRYOpMode

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by org.kaboum.KaboumOpMode
              extended by org.kaboum.KaboumGEOMETRYOpMode
All Implemented Interfaces:
java.awt.event.ActionListener, java.awt.event.MouseListener, java.awt.event.MouseMotionListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, java.util.EventListener
Direct Known Subclasses:
KaboumLINESTRINGOpMode, KaboumPOINTOpMode, KaboumPOLYGONOpMode

public abstract class KaboumGEOMETRYOpMode
extends KaboumOpMode

Abstract class to create or modify KaboumGeometry within the applet.

Author:
Jérôme Gasperi aka jrom
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
protected static KaboumGeometryGlobalDescriptor activeGGD
          Active GGD
protected static int activePointClickedPosition
          Active Point clicked position within the current coordinate vector
protected static KaboumGeometry activeSimpleGeometry
          Active geometry (MUST NOT BE A GEOMETRY COLLECTION!)
protected  int ADD_POINT
           
protected  java.awt.Point currentMousePosition
          Mouse position
protected  int dctime
          Double click time
protected  int DRAG_POINT
           
protected  int dragPointPosition
          Current drag point position
protected  boolean dragStatus
          True if mouse is dragged
protected  boolean firstPointDragged
          True if the mouse dragged a point for the first time
protected  java.awt.Point freezedMousePosition
          Last mouse position
protected  boolean isMenuOn
          True if the validate/undo menu is on
static java.lang.String PARAM_CANCELALLOWED
           
static java.lang.String PARAM_DCTIME
           
static java.lang.String PARAM_DRAGALLOWED
          CONSTANTS
static java.lang.String PARAM_HOLEALLOWED
           
static java.lang.String PARAM_MULTIALLOWED
           
static java.lang.String PARAM_PIXELPRECISION
           
static java.lang.String PARAM_PRECISION
           
static java.lang.String PARAM_SUPPRESSIONALLOWED
           
static java.lang.String PARAM_SUPPRESSIONWITHINCOLLECTIONALLOWED
           
protected  Kaboum parent
          Reference to the parent applet
protected  java.awt.event.MouseEvent pmc
          Current mouse event
protected  java.awt.PopupMenu pop
          Popup menu (activated by right click mouse)
protected static KaboumCoordinate[] savedCoordinates
          Savec Coordinates array
protected  int SELECT_OBJECT
          Private constant
protected  int SHOW_MENU
           
protected  int VALIDATE_OBJECT
           
 
Fields inherited from class org.kaboum.KaboumOpMode
mp
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
KaboumGEOMETRYOpMode(Kaboum parent)
          Constructor
KaboumGEOMETRYOpMode(Kaboum parent, java.lang.String id)
          Constructor
 
Method Summary
 void actionPerformed(java.awt.event.ActionEvent e)
          actionPerformed event e
protected abstract  void actionPerformedAddGeometryWithinCollection(java.awt.event.ActionEvent e)
          Add a geometry within this collection
protected  void actionPerformedAddHoleWithinGeometry(java.awt.event.ActionEvent e)
          Add a hole within this geometry.
 void actionPerformedAddPoint(java.awt.event.ActionEvent e)
          actionPerformed event e : AddPoint
protected  void actionPerformedCancelGeometry(java.awt.event.ActionEvent e)
          Return an alert box that indicate that the current Geometry is cancelled
protected abstract  void actionPerformedNewObject(java.awt.event.ActionEvent e)
          actionPerformed event e : NewObject
 void actionPerformedPreValidateObject(java.awt.event.ActionEvent e)
          ActionPerformed event e : PreValidateObject
protected abstract  void actionPerformedRemoveGeometryWithinCollection(java.awt.event.ActionEvent e)
          Remove a geometry within this collection
 void actionPerformedRemoveObject(java.awt.event.ActionEvent e)
          actionPerformed event e : RemoveObject
 void actionPerformedRemovePoint(java.awt.event.ActionEvent e)
          actionPerformed event e : RemovePoint
 void actionPerformedTopology(java.awt.event.ActionEvent e)
          actionPerformed event e : Topology
 void actionPerformedUndo(java.awt.event.ActionEvent e)
          actionPerformed event e : Undo
 void actionPerformedValidateObject(java.awt.event.ActionEvent e)
          actionPerformed event e : ValidateObject
protected  void addGenericMenu()
          Add the generic menu
protected  void addSeparatorMenu()
          Add a separator menu
protected  void addTopologicalMenu()
          Add the topological menu
 void destroyEvent()
           
static java.lang.String[] getParametersList()
           
 boolean insertCoordinate(KaboumCoordinate internal, int position)
           
protected  boolean intersect(int tmpPointId)
          Intersection procedure.
abstract  boolean isValid(KaboumGeometryGlobalDescriptor ggd)
           
 void mouseClicked(java.awt.event.MouseEvent evt)
           
 void mouseDragged(java.awt.event.MouseEvent evt)
           
 void mouseMoved(java.awt.event.MouseEvent evt)
           
 void mousePressed(java.awt.event.MouseEvent evt)
           
 void mouseReleased(java.awt.event.MouseEvent evt)
           
abstract  void paint(java.awt.Graphics g)
           
 boolean removeCoordinateAt(int position)
           
 boolean removeLastCoordinate()
           
protected  void reset()
          Reset the current active geometry
protected  void resolveMouseAddPoint(java.awt.Point mouse, int action)
          Resolve MOUSE LEFT CLICK action : Add a point
protected  void resolveMouseDragPoint(java.awt.Point mouse, int action)
          Resolve MOUSE DRAG BUTTON action : Drag a point
protected  void resolveMouseEvent(java.awt.Point mouse, int action)
          Resolve Mouse Event action
protected  void resolveMouseSelectObject(java.awt.Point mouse, int action)
          Resolve MOUSE CONTROL CLICK action : Select an object
protected  void resolveMouseShowMenu(java.awt.Point mouse, int action)
          Resolve MOUSE RIGHT OR MIDDLE CLICK action : Show menu
protected  void resolveMouseValidateObject(java.awt.Point mouse, int action)
          Resolve MOUSE RIGHT BUTTON action : Validate object
protected  void saveCurrentCoordinates()
           
protected  int selectAbsoluteCoordinatePosition(java.awt.Point mouse)
          Select absolute coordinate position
protected  int selectAbsoluteCoordinatePosition(java.awt.Point mouse, KaboumCoordinate[] internals)
          Select absolute coordinate position
protected  int selectCoordinatePosition(java.awt.Point mouse)
          Return the position of a point in a coordinate list corresponding to a (x,y) mouse click within a box of w * h.
 void setActiveGGD(KaboumGeometryGlobalDescriptor ggd)
          Set the input geometry as the activeGGD
 
Methods inherited from class org.kaboum.KaboumOpMode
mouseEntered, mouseExited
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, addNotify, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getInsets, getLayout, getListeners, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, paramString, preferredSize, print, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, removeNotify, setComponentZOrder, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, setLayout, transferFocusBackward, transferFocusDownCycle, update, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getAccessibleContext, getBackground, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, reshape, resize, resize, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setMinimumSize, setName, setPreferredSize, setSize, setSize, setVisible, show, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

PARAM_DRAGALLOWED

public static final java.lang.String PARAM_DRAGALLOWED
CONSTANTS

See Also:
Constant Field Values

PARAM_SUPPRESSIONALLOWED

public static final java.lang.String PARAM_SUPPRESSIONALLOWED
See Also:
Constant Field Values

PARAM_PRECISION

public static final java.lang.String PARAM_PRECISION
See Also:
Constant Field Values

PARAM_DCTIME

public static final java.lang.String PARAM_DCTIME
See Also:
Constant Field Values

PARAM_PIXELPRECISION

public static final java.lang.String PARAM_PIXELPRECISION
See Also:
Constant Field Values

PARAM_MULTIALLOWED

public static final java.lang.String PARAM_MULTIALLOWED
See Also:
Constant Field Values

PARAM_HOLEALLOWED

public static final java.lang.String PARAM_HOLEALLOWED
See Also:
Constant Field Values

PARAM_SUPPRESSIONWITHINCOLLECTIONALLOWED

public static final java.lang.String PARAM_SUPPRESSIONWITHINCOLLECTIONALLOWED
See Also:
Constant Field Values

PARAM_CANCELALLOWED

public static final java.lang.String PARAM_CANCELALLOWED
See Also:
Constant Field Values

SELECT_OBJECT

protected final int SELECT_OBJECT
Private constant

See Also:
Constant Field Values

ADD_POINT

protected final int ADD_POINT
See Also:
Constant Field Values

SHOW_MENU

protected final int SHOW_MENU
See Also:
Constant Field Values

DRAG_POINT

protected final int DRAG_POINT
See Also:
Constant Field Values

VALIDATE_OBJECT

protected final int VALIDATE_OBJECT
See Also:
Constant Field Values

parent

protected Kaboum parent
Reference to the parent applet


pop

protected java.awt.PopupMenu pop
Popup menu (activated by right click mouse)


activeGGD

protected static KaboumGeometryGlobalDescriptor activeGGD
Active GGD


activeSimpleGeometry

protected static KaboumGeometry activeSimpleGeometry
Active geometry (MUST NOT BE A GEOMETRY COLLECTION!)


savedCoordinates

protected static KaboumCoordinate[] savedCoordinates
Savec Coordinates array


activePointClickedPosition

protected static int activePointClickedPosition
Active Point clicked position within the current coordinate vector


dragPointPosition

protected int dragPointPosition
Current drag point position


freezedMousePosition

protected java.awt.Point freezedMousePosition
Last mouse position


currentMousePosition

protected java.awt.Point currentMousePosition
Mouse position


pmc

protected java.awt.event.MouseEvent pmc
Current mouse event


dctime

protected int dctime
Double click time


isMenuOn

protected boolean isMenuOn
True if the validate/undo menu is on


dragStatus

protected boolean dragStatus
True if mouse is dragged


firstPointDragged

protected boolean firstPointDragged
True if the mouse dragged a point for the first time

Constructor Detail

KaboumGEOMETRYOpMode

public KaboumGEOMETRYOpMode(Kaboum parent)
Constructor

Parameters:
parent - Parent reference

KaboumGEOMETRYOpMode

public KaboumGEOMETRYOpMode(Kaboum parent,
                            java.lang.String id)
Constructor

Parameters:
parent - Parent reference
id - Pre-selected object
Method Detail

getParametersList

public static java.lang.String[] getParametersList()

setActiveGGD

public void setActiveGGD(KaboumGeometryGlobalDescriptor ggd)
Set the input geometry as the activeGGD


reset

protected void reset()
Reset the current active geometry


destroyEvent

public void destroyEvent()
Overrides:
destroyEvent in class KaboumOpMode

actionPerformed

public void actionPerformed(java.awt.event.ActionEvent e)
actionPerformed event e

Specified by:
actionPerformed in interface java.awt.event.ActionListener
Overrides:
actionPerformed in class KaboumOpMode
Parameters:
e - action to perform

resolveMouseEvent

protected void resolveMouseEvent(java.awt.Point mouse,
                                 int action)
Resolve Mouse Event action

Parameters:
mouse - mouse point
action - action to resolve

actionPerformedPreValidateObject

public void actionPerformedPreValidateObject(java.awt.event.ActionEvent e)
ActionPerformed event e : PreValidateObject

Parameters:
e - action to perform

actionPerformedUndo

public void actionPerformedUndo(java.awt.event.ActionEvent e)
actionPerformed event e : Undo

Parameters:
e - action to perform

actionPerformedAddPoint

public void actionPerformedAddPoint(java.awt.event.ActionEvent e)
actionPerformed event e : AddPoint

Parameters:
e - action to perform

actionPerformedRemovePoint

public void actionPerformedRemovePoint(java.awt.event.ActionEvent e)
actionPerformed event e : RemovePoint

Parameters:
e - action to perform

actionPerformedValidateObject

public void actionPerformedValidateObject(java.awt.event.ActionEvent e)
actionPerformed event e : ValidateObject

Parameters:
e - action to perform

actionPerformedRemoveObject

public void actionPerformedRemoveObject(java.awt.event.ActionEvent e)
actionPerformed event e : RemoveObject

Parameters:
e - action to perform

actionPerformedTopology

public void actionPerformedTopology(java.awt.event.ActionEvent e)
actionPerformed event e : Topology

Parameters:
e - action to perform

addGenericMenu

protected void addGenericMenu()
Add the generic menu


addTopologicalMenu

protected void addTopologicalMenu()
Add the topological menu


addSeparatorMenu

protected void addSeparatorMenu()
Add a separator menu


mouseDragged

public void mouseDragged(java.awt.event.MouseEvent evt)
Specified by:
mouseDragged in interface java.awt.event.MouseMotionListener
Overrides:
mouseDragged in class KaboumOpMode

mouseClicked

public void mouseClicked(java.awt.event.MouseEvent evt)
Specified by:
mouseClicked in interface java.awt.event.MouseListener
Overrides:
mouseClicked in class KaboumOpMode

mousePressed

public void mousePressed(java.awt.event.MouseEvent evt)
Specified by:
mousePressed in interface java.awt.event.MouseListener
Overrides:
mousePressed in class KaboumOpMode

mouseReleased

public void mouseReleased(java.awt.event.MouseEvent evt)
Specified by:
mouseReleased in interface java.awt.event.MouseListener
Overrides:
mouseReleased in class KaboumOpMode

mouseMoved

public void mouseMoved(java.awt.event.MouseEvent evt)
Specified by:
mouseMoved in interface java.awt.event.MouseMotionListener
Overrides:
mouseMoved in class KaboumOpMode

intersect

protected boolean intersect(int tmpPointId)
Intersection procedure. If tmpPointId is != -1, only the two segments linked to tmpPointId are treated. This avoid recomputation of others segments when only one point had changed

Parameters:
tmpPointId - Point to use
type - Type of intersection

saveCurrentCoordinates

protected void saveCurrentCoordinates()

resolveMouseValidateObject

protected void resolveMouseValidateObject(java.awt.Point mouse,
                                          int action)
Resolve MOUSE RIGHT BUTTON action : Validate object

Parameters:
mouse - mouse position
action - action to resolve

resolveMouseSelectObject

protected void resolveMouseSelectObject(java.awt.Point mouse,
                                        int action)
Resolve MOUSE CONTROL CLICK action : Select an object

Parameters:
mouse - mouse position
action - action to resolve

resolveMouseShowMenu

protected void resolveMouseShowMenu(java.awt.Point mouse,
                                    int action)
Resolve MOUSE RIGHT OR MIDDLE CLICK action : Show menu

Parameters:
mouse - mouse position
action - action to resolve

selectCoordinatePosition

protected int selectCoordinatePosition(java.awt.Point mouse)
Return the position of a point in a coordinate list corresponding to a (x,y) mouse click within a box of w * h. Return -1 if no points are found

Parameters:
mouse - mouse position

selectAbsoluteCoordinatePosition

protected int selectAbsoluteCoordinatePosition(java.awt.Point mouse,
                                               KaboumCoordinate[] internals)
Select absolute coordinate position


selectAbsoluteCoordinatePosition

protected int selectAbsoluteCoordinatePosition(java.awt.Point mouse)
Select absolute coordinate position


resolveMouseDragPoint

protected void resolveMouseDragPoint(java.awt.Point mouse,
                                     int action)
Resolve MOUSE DRAG BUTTON action : Drag a point

Parameters:
mouse - mouse position
action - action to resolve

resolveMouseAddPoint

protected void resolveMouseAddPoint(java.awt.Point mouse,
                                    int action)
Resolve MOUSE LEFT CLICK action : Add a point

Parameters:
mouse - mouse position
action - action to resolve

removeLastCoordinate

public boolean removeLastCoordinate()

removeCoordinateAt

public boolean removeCoordinateAt(int position)

insertCoordinate

public boolean insertCoordinate(KaboumCoordinate internal,
                                int position)

actionPerformedAddHoleWithinGeometry

protected void actionPerformedAddHoleWithinGeometry(java.awt.event.ActionEvent e)
Add a hole within this geometry. This has no sense for other geometries than Polygon


actionPerformedCancelGeometry

protected void actionPerformedCancelGeometry(java.awt.event.ActionEvent e)
Return an alert box that indicate that the current Geometry is cancelled


actionPerformedAddGeometryWithinCollection

protected abstract void actionPerformedAddGeometryWithinCollection(java.awt.event.ActionEvent e)
Add a geometry within this collection


actionPerformedRemoveGeometryWithinCollection

protected abstract void actionPerformedRemoveGeometryWithinCollection(java.awt.event.ActionEvent e)
Remove a geometry within this collection


actionPerformedNewObject

protected abstract void actionPerformedNewObject(java.awt.event.ActionEvent e)
actionPerformed event e : NewObject

Parameters:
e - action to perform

isValid

public abstract boolean isValid(KaboumGeometryGlobalDescriptor ggd)

paint

public abstract void paint(java.awt.Graphics g)
Overrides:
paint in class java.awt.Container


Copyright © 2005 Kaboum team. All Rights Reserved.