de.fhpotsdam.unfolding.data
Class MarkerFactory

java.lang.Object
  extended by de.fhpotsdam.unfolding.data.MarkerFactory

public class MarkerFactory
extends java.lang.Object

A factory to create markers from features. The factory creates appropriate markers the each feature type, e.g. a polygon marker for a polygon feature, and handle multi-marker from multi-feature, as well.

See the following example on how to use this factory to create your own custom markers. For this, set the marker class for each feature type with the setPointClass(Class) etc methods.

 MarkerFactory markerFactory = new MarkerFactory();
 markerFactory.setPolygonClass(MyPolygonMarker.class);
 List<Marker> markers = markerFactory.createMarkers(features);
 

By default, this factory creates the simple markers provided by Unfolding, such as SimplePointMarker.


Constructor Summary
MarkerFactory()
          Creates a new MarkerFactory.
 
Method Summary
protected  Marker createLinesMarker(ShapeFeature feature)
           
 Marker createMarker(Feature feature)
          Creates a marker for the feature.
 java.util.List<Marker> createMarkers(java.util.List<Feature> features)
          Creates markers for each feature.
protected  Marker createPointMarker(PointFeature feature)
           
protected  Marker createPolygonMarker(ShapeFeature feature)
           
 void setLineClass(java.lang.Class lineMarkerClass)
          Sets the marker class for markers to be created for lines features.
 void setPointClass(java.lang.Class pointMarkerClass)
          Sets the marker class for markers to be created for point features.
 void setPolygonClass(java.lang.Class polygonMarkerClass)
          Sets the marker class for markers to be created for polygon features.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MarkerFactory

public MarkerFactory()
Creates a new MarkerFactory.

Method Detail

createMarkers

public java.util.List<Marker> createMarkers(java.util.List<Feature> features)
Creates markers for each feature. Marker depends on feature type.

Parameters:
features - The list of features.
Returns:
A list of markers.

createMarker

public Marker createMarker(Feature feature)
                    throws java.lang.Exception
Creates a marker for the feature. Marker depends on feature type.

Parameters:
feature - The feature.
Returns:
A marker of the appropriate type with ID and properties.
Throws:
java.lang.Exception

setPointClass

public void setPointClass(java.lang.Class pointMarkerClass)
Sets the marker class for markers to be created for point features.

Parameters:
pointMarkerClass - A marker class.

setLineClass

public void setLineClass(java.lang.Class lineMarkerClass)
Sets the marker class for markers to be created for lines features.

Parameters:
lineMarkerClass - A marker class.

setPolygonClass

public void setPolygonClass(java.lang.Class polygonMarkerClass)
Sets the marker class for markers to be created for polygon features.

Parameters:
polygonMarkerClass - A marker class.

createPointMarker

protected Marker createPointMarker(PointFeature feature)
                            throws java.lang.Exception
Throws:
java.lang.Exception

createLinesMarker

protected Marker createLinesMarker(ShapeFeature feature)
                            throws java.lang.Exception
Throws:
java.lang.Exception

createPolygonMarker

protected Marker createPolygonMarker(ShapeFeature feature)
                              throws java.lang.Exception
Throws:
java.lang.Exception