org.openjump.core.apitools
Class LayerTools

java.lang.Object
  extended by org.openjump.core.apitools.ToolToMakeYourLifeEasier
      extended by org.openjump.core.apitools.LayerTools

public class LayerTools
extends ToolToMakeYourLifeEasier

Class for more convenient use of Layer objects. Offers methods e.g. to get features that reside within a given geometry or to easily add a result layer to the map.

Author:
Ole Rahn FH Osnabrück - University of Applied Sciences Osnabrück Project PIROL 2005 Daten- und Wissensmanagement [sstein] - 22.Feb.2009 - modified to work in OpenJUMP

Field Summary
protected  PlugInContext context
           
 
Constructor Summary
LayerTools(PlugInContext context)
           
 
Method Summary
static Layer addAndSelectStandardResultLayer(java.lang.String title, FeatureCollection featCollection, java.awt.Color color, PlugInContext context, FeatureCollectionRole role)
           
static Layer addAndSelectStandardResultLayer(java.lang.String title, FeatureCollection featCollection, PlugInContext context, FeatureCollectionRole role)
           
static Layer addStandardResultLayer(java.lang.String title, FeatureCollection featCollection, java.awt.Color color, PlugInContext context, boolean select, FeatureCollectionRole role)
           
static Layer addStandardResultLayer(java.lang.String title, FeatureCollection featCollection, java.awt.Color color, PlugInContext context, FeatureCollectionRole role)
           
 Layer addStandardResultLayer(java.lang.String title, FeatureCollection featCollection, FeatureCollectionRole role)
           
static Layer addStandardResultLayer(java.lang.String title, FeatureCollection featCollection, PlugInContext context, FeatureCollectionRole role)
           
 java.util.List getFeaturesInFence()
           
 Feature[] getFeaturesInFenceInLayer(Feature[] featArray, com.vividsolutions.jts.geom.Geometry fenceGeometry)
           
 Feature[] getFeaturesInFenceInLayer(Layer layer, com.vividsolutions.jts.geom.Geometry fenceGeometry)
           
 com.vividsolutions.jts.geom.Geometry getFenceGeometry()
           
 java.util.Map getLayer2FeatureMap(java.util.List features)
           
static java.util.Map getLayer2FeatureMap(java.util.List features, PlugInContext context)
           
 int getNumSelectedLayers()
           
static int getNumSelectedLayers(PlugInContext context)
           
 Category getResultCategory()
           
static Category getResultCategory(PlugInContext context)
           
 java.util.List getSelectedFeatures()
           
static Layer getSelectedLayer(PlugInContext context)
          get one Layer that is selected
static Layerable getSelectedLayerable(PlugInContext context, java.lang.Class layerableClass)
          get one Layer that is selected
 Layer[] getSelectedLayers()
           
static Layer[] getSelectedLayers(PlugInContext context, int num)
          Get a given number of selected Layers.
static java.lang.String getUniqueLayerName(PlugInContext context, java.lang.String name)
          returns a layername, that is not yet used in the layername panel
static Layer putGeometryArrayIntoMap(com.vividsolutions.jts.geom.Geometry[] geometryArray, PlugInContext context)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

context

protected PlugInContext context
Constructor Detail

LayerTools

public LayerTools(PlugInContext context)
Method Detail

getSelectedLayers

public Layer[] getSelectedLayers()

getSelectedFeatures

public java.util.List getSelectedFeatures()

getFenceGeometry

public com.vividsolutions.jts.geom.Geometry getFenceGeometry()

getFeaturesInFence

public java.util.List getFeaturesInFence()

getFeaturesInFenceInLayer

public Feature[] getFeaturesInFenceInLayer(Layer layer,
                                           com.vividsolutions.jts.geom.Geometry fenceGeometry)

getFeaturesInFenceInLayer

public Feature[] getFeaturesInFenceInLayer(Feature[] featArray,
                                           com.vividsolutions.jts.geom.Geometry fenceGeometry)

getNumSelectedLayers

public int getNumSelectedLayers()

getNumSelectedLayers

public static int getNumSelectedLayers(PlugInContext context)

addStandardResultLayer

public static Layer addStandardResultLayer(java.lang.String title,
                                           FeatureCollection featCollection,
                                           PlugInContext context,
                                           FeatureCollectionRole role)

addAndSelectStandardResultLayer

public static Layer addAndSelectStandardResultLayer(java.lang.String title,
                                                    FeatureCollection featCollection,
                                                    java.awt.Color color,
                                                    PlugInContext context,
                                                    FeatureCollectionRole role)

addAndSelectStandardResultLayer

public static Layer addAndSelectStandardResultLayer(java.lang.String title,
                                                    FeatureCollection featCollection,
                                                    PlugInContext context,
                                                    FeatureCollectionRole role)

addStandardResultLayer

public static Layer addStandardResultLayer(java.lang.String title,
                                           FeatureCollection featCollection,
                                           java.awt.Color color,
                                           PlugInContext context,
                                           FeatureCollectionRole role)

addStandardResultLayer

public static Layer addStandardResultLayer(java.lang.String title,
                                           FeatureCollection featCollection,
                                           java.awt.Color color,
                                           PlugInContext context,
                                           boolean select,
                                           FeatureCollectionRole role)

addStandardResultLayer

public Layer addStandardResultLayer(java.lang.String title,
                                    FeatureCollection featCollection,
                                    FeatureCollectionRole role)

getLayer2FeatureMap

public java.util.Map getLayer2FeatureMap(java.util.List features)

putGeometryArrayIntoMap

public static final Layer putGeometryArrayIntoMap(com.vividsolutions.jts.geom.Geometry[] geometryArray,
                                                  PlugInContext context)

getLayer2FeatureMap

public static java.util.Map getLayer2FeatureMap(java.util.List features,
                                                PlugInContext context)

getResultCategory

public Category getResultCategory()

getResultCategory

public static Category getResultCategory(PlugInContext context)

getSelectedLayers

public static Layer[] getSelectedLayers(PlugInContext context,
                                        int num)
Get a given number of selected Layers.

Parameters:
context - the current PlugInContext
num - max. number of layers to return, -1 returns all selected layers
Returns:
a given number of selected Layers, null if no Layers are selected

getSelectedLayer

public static Layer getSelectedLayer(PlugInContext context)
get one Layer that is selected

Parameters:
context - the current PlugInContext
Returns:
one selected Layer, null if no Layers are selected

getSelectedLayerable

public static Layerable getSelectedLayerable(PlugInContext context,
                                             java.lang.Class layerableClass)
get one Layer that is selected

Parameters:
context - the current PlugInContext
Returns:
one selected Layer, null if no Layers are selected

getUniqueLayerName

public static java.lang.String getUniqueLayerName(PlugInContext context,
                                                  java.lang.String name)
returns a layername, that is not yet used in the layername panel