com.partnersoft.maps.app
Class MapSelectionLogic

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

public class MapSelectionLogic
extends java.lang.Object

Nonvisual plumbing for controlling the current selection, selection list, and indications.

Author:
Paul Reavis Copyright 2002-2005 Partner Software, Inc.

Constructor Summary
MapSelectionLogic(MapApp app)
           
 
Method Summary
 void addAndSelect(int dataSetID, int dataID)
           
 void addAndSelect(RoverSet roverSet, int dataID)
           
 void addAndSelect(java.lang.String roverSetName, int dataID)
           
 void addSelection(double x, double y, int pixelX, int pixelY)
          Adds the items at the given coordinates.
 void addSelection(int dataSetID, int dataID)
           
 void addSelection(RoverSet roverSet, int dataID)
           
 void addSelectionListener(MapSelectionListener listener)
           
 void addToSelectionList(java.util.ArrayList<MapDataLink> smore)
          Adds the contents of a list to the existing contents of the selection list.
 void centerSelection()
           
 void clearHover()
          Clear all indications caused by hovering.
 void clearSelectionList()
          Clears all items in the selection list.
 void ensureSelectionIsVisible()
           
 MapDataItem getCurrentItem()
          FIXME: take this out, it's a duplicate for getSelectedItem().
 Point getLocationNearestLastSelect()
          Returns the point (the point itself for point or text items; a vertex for lines and areas and merged items) for current selection nearest the coordinates of the last mouse selection event.
 java.lang.String getSelectedDataAsText()
           
 MapDataItem getSelectedItem()
           
 java.util.List<MapDataLink> getSelectionList()
           
 void hover(double x, double y, int pixelX, int pixelY)
          "Hover" (causing indication behavior) at the given coordinates.
 void initialize()
          Initializes the view from preferences.
 void mouseAddSelection(double x, double y, int pixelX, int pixelY)
          Adds the items at the given coordinates, as done by a mouse guesture.
 void mouseSelect(double x, double y, int pixelX, int pixelY)
          Select the item at the given coordinates, as done by a mouse guesture.
 MapDataItem pickDataItemAtPoint(java.lang.String mapsetName, NameSet dataTypes, double x, double y)
          "Pick" (find using geometric search) data item with the given parameters at the given point.
 MapDataItem pickDataItemAtPoint(java.lang.String mapsetName, java.lang.String dataType, double x, double y)
          "Pick" (find using geometric search) data item with the given parameters at the given point.
 void removeSelection(MapDataItem item)
           
 void removeSelectionListener(MapSelectionListener listener)
           
 void removeSelectionsInMapSet(java.lang.String mapsetName)
          Removes all selected items coming from the given mapset.
 void select(double x, double y, int pixelX, int pixelY)
          Select the item at the given coordinates.
 boolean select(MapDataItem item, java.lang.String fieldName)
          Reselects using a previously loaded item and a key field name that it uses to grab the right one.
 boolean select(java.lang.String dataType, java.lang.String fieldName, java.lang.Object fieldValue, XyPoint location)
          Selects the item with the desired data type, field name, and field value.
 boolean select(java.lang.String dataType, java.lang.String fieldName, java.lang.String fieldValue, double x, double y)
          Selects the item with the desired data type, field name, and field value.
 void selectAtPixel(int pixelX, int pixelY)
          Select the item at the given pixel coordinates.
 void selectAtPoint(double x, double y)
          Select the item at the given map coordinates.
 void selectAtPoint(XyPoint point)
          Select the item at the given map coordinates.
 void selectNext()
          Selects the next item in the selection list.
 void selectPrevious()
          Selects the previous item in the selection list.
 void setCurrentSelection(int newSelection)
           
 void setSelection(RoverSet roverSet, int dataID)
           
 void setSelectionList(java.util.ArrayList newList)
           
 void setSelectionList(java.util.ArrayList newList, int newCurrentSelection)
           
 void updateWheelMenu()
           
 void wheelSelectNext()
          Selects the next item in the selection list as done by the wheel menu.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MapSelectionLogic

public MapSelectionLogic(MapApp app)
Method Detail

initialize

public void initialize()
Initializes the view from preferences.


getSelectedItem

public MapDataItem getSelectedItem()

getLocationNearestLastSelect

public Point getLocationNearestLastSelect()
Returns the point (the point itself for point or text items; a vertex for lines and areas and merged items) for current selection nearest the coordinates of the last mouse selection event. Perhaps simpler: the part of the selected graphic nearest where the user clicked to select it.


selectPrevious

public void selectPrevious()
Selects the previous item in the selection list. Loops if already on the first item.


selectNext

public void selectNext()
Selects the next item in the selection list. Loops if already on the last item.


wheelSelectNext

public void wheelSelectNext()
Selects the next item in the selection list as done by the wheel menu. Loops if already on the last item.


addToSelectionList

public void addToSelectionList(java.util.ArrayList<MapDataLink> smore)
Adds the contents of a list to the existing contents of the selection list.


getSelectionList

public java.util.List<MapDataLink> getSelectionList()

setSelectionList

public void setSelectionList(java.util.ArrayList newList)

setSelectionList

public void setSelectionList(java.util.ArrayList newList,
                             int newCurrentSelection)

setCurrentSelection

public void setCurrentSelection(int newSelection)

setSelection

public void setSelection(RoverSet roverSet,
                         int dataID)

addSelection

public void addSelection(int dataSetID,
                         int dataID)

addSelection

public void addSelection(RoverSet roverSet,
                         int dataID)

addAndSelect

public void addAndSelect(int dataSetID,
                         int dataID)

addAndSelect

public void addAndSelect(RoverSet roverSet,
                         int dataID)

addAndSelect

public void addAndSelect(java.lang.String roverSetName,
                         int dataID)

removeSelection

public void removeSelection(MapDataItem item)

getCurrentItem

public MapDataItem getCurrentItem()
FIXME: take this out, it's a duplicate for getSelectedItem(). Don't break any scripts, though.

Returns:

ensureSelectionIsVisible

public void ensureSelectionIsVisible()

centerSelection

public void centerSelection()

clearSelectionList

public void clearSelectionList()
Clears all items in the selection list.


removeSelectionsInMapSet

public void removeSelectionsInMapSet(java.lang.String mapsetName)
Removes all selected items coming from the given mapset.

Parameters:
mapsetName -

selectAtPoint

public void selectAtPoint(double x,
                          double y)
Select the item at the given map coordinates.


selectAtPoint

public void selectAtPoint(XyPoint point)
Select the item at the given map coordinates.


selectAtPixel

public void selectAtPixel(int pixelX,
                          int pixelY)
Select the item at the given pixel coordinates.


select

public void select(double x,
                   double y,
                   int pixelX,
                   int pixelY)
Select the item at the given coordinates.


select

public boolean select(java.lang.String dataType,
                      java.lang.String fieldName,
                      java.lang.Object fieldValue,
                      XyPoint location)
Selects the item with the desired data type, field name, and field value. Selects nothing if there is no match. Returns true if the selection succeded.


select

public boolean select(java.lang.String dataType,
                      java.lang.String fieldName,
                      java.lang.String fieldValue,
                      double x,
                      double y)
Selects the item with the desired data type, field name, and field value. Returns true if the selection succeded.


select

public boolean select(MapDataItem item,
                      java.lang.String fieldName)
Reselects using a previously loaded item and a key field name that it uses to grab the right one. This is useful for action scripts which need to reselect an item after modifying it. Returns true if the selection succeded.


addSelection

public void addSelection(double x,
                         double y,
                         int pixelX,
                         int pixelY)
Adds the items at the given coordinates.


mouseSelect

public void mouseSelect(double x,
                        double y,
                        int pixelX,
                        int pixelY)
Select the item at the given coordinates, as done by a mouse guesture. This has some special behavior with regard to the wheel menu's placement behavior.


mouseAddSelection

public void mouseAddSelection(double x,
                              double y,
                              int pixelX,
                              int pixelY)
Adds the items at the given coordinates, as done by a mouse guesture. This has some special behavior with regard to the wheel menu's placement behavior.


hover

public void hover(double x,
                  double y,
                  int pixelX,
                  int pixelY)
"Hover" (causing indication behavior) at the given coordinates.


clearHover

public void clearHover()
Clear all indications caused by hovering.


updateWheelMenu

public void updateWheelMenu()

addSelectionListener

public void addSelectionListener(MapSelectionListener listener)

removeSelectionListener

public void removeSelectionListener(MapSelectionListener listener)

pickDataItemAtPoint

public MapDataItem pickDataItemAtPoint(java.lang.String mapsetName,
                                       java.lang.String dataType,
                                       double x,
                                       double y)
"Pick" (find using geometric search) data item with the given parameters at the given point.


pickDataItemAtPoint

public MapDataItem pickDataItemAtPoint(java.lang.String mapsetName,
                                       NameSet dataTypes,
                                       double x,
                                       double y)
"Pick" (find using geometric search) data item with the given parameters at the given point.


getSelectedDataAsText

public java.lang.String getSelectedDataAsText()