Package repast.simphony.space.gis
Class ShapefileLoader<T>
java.lang.Object
repast.simphony.space.gis.ShapefileLoader<T>
Creates and sets agents properties from a features in shapefile.
- Author:
- Nick Collier
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
hasNext()
Returns true if there are more features left to process, otherwise false.void
load()
Creates all the agents for the shapefile features, setting each agent's properteis to the value of a feature's relevant attributes.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.Sets the specified object's properties to the relevant attributes values of the next feature.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.
-
Constructor Details
-
ShapefileLoader
Creates a shapefile loader for agents of the specified class and whose data source is the specified shapefile. The agents will be placed into the specified Geography according to the geometry specified in the shapefile and transformed according to the geography's CRS.- Parameters:
clazz
- the agent classshapefile
- the shapefile that serves as the datasource for the agent propertiesgeography
- the geography to hold spatial locations of the agentscontext
- the context to add the agents to
-
-
Method Details
-
load
public void load()Creates all the agents for the shapefile features, setting each agent's properteis to the value of a feature's relevant attributes. -
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
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
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.
-
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.
-