com.vividsolutions.jump.workbench.ui
Class SelectionManager

java.lang.Object
  extended bycom.vividsolutions.jump.workbench.ui.SelectionManager

public class SelectionManager
extends java.lang.Object

Provides aggregate information for selected features, parts, and linestrings. Note that there is a difference between "selected features" and "features with selected items": the former consists of wholly selected features; the latter, wholly and partially selected features. To access a specific level of selection, use #getFeatureSelection, #getPartSelection, or #getLineStringSelection. "Parts" are components of GeometryCollections.

To get wholly selected features (i.e. not those that just have selected parts or linestrings), use getFeatureSelection().getFeaturesWithSelectedItems()

To get features that are selected or have selected parts or linestrings, use getFeaturesWithSelectedItems()

Yes there is a way to listen for selection events: LayerViewPanel#addListener.


Constructor Summary
SelectionManager(LayerViewPanel panel, LayerManagerProxy layerManagerProxy)
           
 
Method Summary
 boolean arePanelUpdatesEnabled()
           
 void clear()
           
 java.util.Collection createFeaturesFromSelectedItems()
          A feature may get split into two or more -- for example, if two linestrings of a feature are selected.
 java.util.Collection createFeaturesFromSelectedItems(Layer layer)
           
 void dispose()
           
 FeatureSelection getFeatureSelection()
           
 java.util.Collection getFeaturesWithSelectedItems()
           
 java.util.Collection getFeaturesWithSelectedItems(Layer layer)
           
 java.util.Collection getLayersWithSelectedItems()
           
 LineStringSelection getLineStringSelection()
           
 PartSelection getPartSelection()
           
 java.util.Collection getSelectedItems()
          "items" rather than "geometries" because the user may have selected a part of a Geometry (an element of a GeometryCollection or a ring of a Polygon).
 java.util.Collection getSelectedItems(Layer layer)
           
 java.util.Collection getSelectedItems(Layer layer, Feature feature)
           
 java.util.Collection getSelectedItems(Layer layer, Feature feature, com.vividsolutions.jts.geom.Geometry geometry)
           
 java.util.Collection getSelections()
           
 void setPanelUpdatesEnabled(boolean panelUpdatesEnabled)
           
 void unselectFromFeaturesWithModifiedItemCounts(Layer layer, java.util.Collection features, java.util.Collection oldFeatureClones)
           
 void unselectItems(Layer layer)
           
 void unselectItems(Layer layer, java.util.Collection features)
           
 void updatePanel()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SelectionManager

public SelectionManager(LayerViewPanel panel,
                        LayerManagerProxy layerManagerProxy)
Method Detail

createFeaturesFromSelectedItems

public java.util.Collection createFeaturesFromSelectedItems()
A feature may get split into two or more -- for example, if two linestrings of a feature are selected.


createFeaturesFromSelectedItems

public java.util.Collection createFeaturesFromSelectedItems(Layer layer)

clear

public void clear()

getFeatureSelection

public FeatureSelection getFeatureSelection()

getLineStringSelection

public LineStringSelection getLineStringSelection()

getSelections

public java.util.Collection getSelections()
Returns:
AbstractSelections

getSelectedItems

public java.util.Collection getSelectedItems()
"items" rather than "geometries" because the user may have selected a part of a Geometry (an element of a GeometryCollection or a ring of a Polygon).

Returns:
a collection of Geometries

getSelectedItems

public java.util.Collection getSelectedItems(Layer layer)

getSelectedItems

public java.util.Collection getSelectedItems(Layer layer,
                                             Feature feature)

getSelectedItems

public java.util.Collection getSelectedItems(Layer layer,
                                             Feature feature,
                                             com.vividsolutions.jts.geom.Geometry geometry)
Parameters:
geometry - the feature's Geometry or equivalent; that is, a clone or similar enough Geometry from which Geometries can be retrieved using the selection indices

getLayersWithSelectedItems

public java.util.Collection getLayersWithSelectedItems()

getPartSelection

public PartSelection getPartSelection()

updatePanel

public void updatePanel()

setPanelUpdatesEnabled

public void setPanelUpdatesEnabled(boolean panelUpdatesEnabled)

getFeaturesWithSelectedItems

public java.util.Collection getFeaturesWithSelectedItems(Layer layer)

unselectItems

public void unselectItems(Layer layer)

unselectItems

public void unselectItems(Layer layer,
                          java.util.Collection features)

unselectFromFeaturesWithModifiedItemCounts

public void unselectFromFeaturesWithModifiedItemCounts(Layer layer,
                                                       java.util.Collection features,
                                                       java.util.Collection oldFeatureClones)

getFeaturesWithSelectedItems

public java.util.Collection getFeaturesWithSelectedItems()

arePanelUpdatesEnabled

public boolean arePanelUpdatesEnabled()

dispose

public void dispose()