com.partnersoft.maps.app
Class MapDrawingLogic

java.lang.Object
  extended by com.partnersoft.maps.app.MapDrawingLogic

public class MapDrawingLogic
extends java.lang.Object

Takes care of drawing logic - the manipulation of editable map geometry.

Author:
Paul Reavis Copyright 2005 Partner Software, Inc.

Field Summary
protected  com.partnersoft.maps.app.MapDrawingLogic.DrawingScript currentScript
           
protected  int mode
           
static int MODE_ADD
           
static int MODE_BROWSE
           
static int MODE_MOVE
           
static int MODE_ROTATE
           
 
Constructor Summary
MapDrawingLogic(MapApp app)
           
 
Method Summary
 void changeType(java.lang.Object newType)
          Changes the datatype of the current selection.
 void copy()
           
 void delete()
          Deletes the currently-selected item.
 int getMode()
           
 JobDataComponent getSelectedJobDataComponent()
          Returns the currently-selected JobDataComponent, if any.
 void gpsNewLocation(double angle, double distance)
          This adds a new location based on the current GPS reading.
 boolean hitWheelMenu(int pixelX, int pixelY)
          Checks for a hit on the wheel menu.
 boolean hoverWheelMenu(int pixelX, int pixelY)
          Checks for indication (hover) on the wheel menu.
protected  void initialize()
           
 void move(double x, double y)
          Moves the currently selected item to the given location.
 boolean onWheelMenu(int pixelX, int pixelY)
           
 void placeNewLocation(double x, double y)
          Adds a new location, to the currently selected job, alternative, and chain.
 void placeNewLocation(java.lang.String action, double x, double y)
           
 void rotate(double x, double y)
          Rotates the currently selected item to the given angle (in degrees).
 void rubberband(double x1, double y1, double x2, double y2)
           
 void setCurrentSelection(MapDataItem item)
           
 void setMode(int newMode)
           
 void setSpinning(boolean tizit)
           
 void setStretching(boolean tizit)
           
 void shootNewLocation(double angle, double distance)
          Shoots a new location from the currently-selected location based on angle and distance.
 void spin(double x, double y)
           
 void stretchTo(double x, double y)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MODE_BROWSE

public static final int MODE_BROWSE
See Also:
Constant Field Values

MODE_ADD

public static final int MODE_ADD
See Also:
Constant Field Values

MODE_MOVE

public static final int MODE_MOVE
See Also:
Constant Field Values

MODE_ROTATE

public static final int MODE_ROTATE
See Also:
Constant Field Values

mode

protected int mode

currentScript

protected com.partnersoft.maps.app.MapDrawingLogic.DrawingScript currentScript
Constructor Detail

MapDrawingLogic

public MapDrawingLogic(MapApp app)
Method Detail

initialize

protected void initialize()

placeNewLocation

public void placeNewLocation(double x,
                             double y)
Adds a new location, to the currently selected job, alternative, and chain. If there is no currently selected chain, makes a new one. If there is a currently selected location, it uses it as a parent and adds a connecting span as well. The new location becomes the current selection.


placeNewLocation

public void placeNewLocation(java.lang.String action,
                             double x,
                             double y)

shootNewLocation

public void shootNewLocation(double angle,
                             double distance)
Shoots a new location from the currently-selected location based on angle and distance. Angle is in degrees.


gpsNewLocation

public void gpsNewLocation(double angle,
                           double distance)
This adds a new location based on the current GPS reading. Otherwise it is identical to placeNewLocation.


getSelectedJobDataComponent

public JobDataComponent getSelectedJobDataComponent()
Returns the currently-selected JobDataComponent, if any. If anything else or nothing is selected, then it returns null.


rotate

public void rotate(double x,
                   double y)
Rotates the currently selected item to the given angle (in degrees).


move

public void move(double x,
                 double y)
Moves the currently selected item to the given location.


delete

public void delete()
Deletes the currently-selected item.


changeType

public void changeType(java.lang.Object newType)
Changes the datatype of the current selection.


setCurrentSelection

public void setCurrentSelection(MapDataItem item)

copy

public void copy()

setStretching

public void setStretching(boolean tizit)

setSpinning

public void setSpinning(boolean tizit)

stretchTo

public void stretchTo(double x,
                      double y)

spin

public void spin(double x,
                 double y)

rubberband

public void rubberband(double x1,
                       double y1,
                       double x2,
                       double y2)

setMode

public void setMode(int newMode)

getMode

public int getMode()

hitWheelMenu

public boolean hitWheelMenu(int pixelX,
                            int pixelY)
Checks for a hit on the wheel menu. If it hits, takes appropriate action and returns true. Otherwise, returns false.


hoverWheelMenu

public boolean hoverWheelMenu(int pixelX,
                              int pixelY)
Checks for indication (hover) on the wheel menu. If the pixels are over the wheel, it takes appropriate action and returns true. Otherwise, returns false.


onWheelMenu

public boolean onWheelMenu(int pixelX,
                           int pixelY)