de.cesr.sesamgim.util
Class GShapefileLoader<AgentT extends GimMilieuAgent<AgentT>,T extends GimSuperContextAssignable<AgentT>>

java.lang.Object
  extended by de.cesr.sesamgim.util.GShapefileLoader<AgentT,T>

public class GShapefileLoader<AgentT extends GimMilieuAgent<AgentT>,T extends GimSuperContextAssignable<AgentT>>
extends Object

SesamGIM - Geographical Initialisation for Milieu Agents


Field Summary
protected  Class<? extends GimAreaContext> areaContextClass
           
 
Constructor Summary
GShapefileLoader(Class<T> clazz, URL shapefile, repast.simphony.space.gis.Geography geography)
          Creates a shape file loader for agents of the specified class and whose data source is the specified shape file.
 
Method Summary
protected  GimAreaContext<AgentT> checkWithinArea(com.vividsolutions.jts.geom.Geometry geometry, boolean allowOverhang, boolean useCentroid)
          Checks whether the given PLZ area geometry intersects with any area shape.
 boolean hasNext()
          Returns true if there are more features left to process, otherwise false.
 void load()
          Creates all the agents for the shape file features, setting each agent's properties to the value of a feature's relevant attributes.
 T next()
          Creates the next agent from the next feature in the shapefile, setting that agent's properties to the value of that feature's relevant attributes.
 T next(GimMcInitialiseService<AgentT> mcInitService)
          Used for GimPlzContexts.
 T next(GimPlzInitialiseService<AgentT> plzInitService)
          Used for GimPlzContexts.
 T next(T obj)
          Sets the specified object's properties to the relevant attributes values of the next feature.
 T nextWithArgs(Object... constructorArgs)
          Creates the next agent from the next feature in the shapefile, setting that agent's properties to the value of that feature's relevant attributes.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

areaContextClass

protected Class<? extends GimAreaContext> areaContextClass
Constructor Detail

GShapefileLoader

public GShapefileLoader(Class<T> clazz,
                        URL shapefile,
                        repast.simphony.space.gis.Geography geography)
Creates a shape file loader for agents of the specified class and whose data source is the specified shape file. The agents will be placed into the specified Geography according to the geometry specified in the shape file and transformed according to the geography's CRS.

Parameters:
clazz - the agent class
shapefile - the shape file that serves as the data source for the agent properties
geography - the geography to hold spatial locations of the agents
context - the context to add the agents to
Method Detail

checkWithinArea

protected GimAreaContext<AgentT> checkWithinArea(com.vividsolutions.jts.geom.Geometry geometry,
                                                 boolean allowOverhang,
                                                 boolean useCentroid)
Checks whether the given PLZ area geometry intersects with any area shape.

Parameters:
geometry -
allowOverhang - if true resulting shapes may be larger then given geometry (important for plz areas)
Returns:

load

public void load()
Creates all the agents for the shape file features, setting each agent's properties to the value of a feature's relevant attributes.


next

public T next()
Creates the next agent from the next feature in the shapefile, setting that agent's properties to the value of that feature's relevant attributes.

Returns:
the created agent

nextWithArgs

public T nextWithArgs(Object... constructorArgs)
                                                         throws IllegalArgumentException
Creates the next agent from the next feature in the shapefile, setting that agent's properties to the value of that feature's relevant attributes. Note that the constructor matching is somewhat naive and looks for exact matches.

Parameters:
constructorArgs - parameters to pass to the constructor when creating the agent.
Returns:
the created agent
Throws:
IllegalArgumentException - if the constructor args don't match a constructor.

next

public T next(T obj)
Sets the specified object's properties to the relevant attributes values of the next feature.

Parameters:
obj - the object whose properties we want to set.
Returns:
the object with is properties now set.

next

public T next(GimPlzInitialiseService<AgentT> plzInitService)
Used for GimPlzContexts.

Parameters:
plzInitService -
Returns:

next

public T next(GimMcInitialiseService<AgentT> mcInitService)
Used for GimPlzContexts.

Parameters:
plzInitService -
Returns:

hasNext

public boolean hasNext()
Returns true if there are more features left to process, otherwise false.

Returns:
true if there are more features left to process, otherwise false.