Package svs_simulation :: Package terrain :: Module base_classes :: Class Partition
[show private | hide private]
[frames | no frames]

Class Partition

GenericTerrainObject --+
                       |
                      Partition


Represents a section of a terrain.

The partition handles objects and structures within the terrain.
Method Summary
  __str__(self)
Returns string representation of partition.
  addAgent(self, agent)
Adds a new agent to the partition.
  addObject(self, obj)
Adds a new object to the partition.
  addStructure(self, structure)
Adds a new structure to the partition.
  clearObjectFromTiles(self, obj)
Clears tiles representation for structure.
  clearStructureFromTiles(self, structure)
Clears tiles representation for structure.
  containsPoint(self, x, y)
Checks if point is within bounds of partition.
  createStructureFromName(self, structureName)
Checks of structure with given name alreday exists, and returns this, iof not creates a new structure.
  createTiles(self, tilesX, tilesY)
Creates empty tile set for partition.
  decode(self, data, terrain)
Applies encoded data to self.
  decodeAgents(self, data)
Constructs classes from encoded data of agents within partition.
  decodeObjects(self, data)
Constructs classes from encoded data of objects within partition.
  decodeStructures(self, data)
Constructs classes from encoded data of structures within partition.
dict encode(self, structures, objects, agents)
Returns encoded model of data within partition.
dict encodeAgents(self)
Returns encoded model of agents within partition.
dict encodeObjects(self)
Returns encoded model of objects within partition.
dict encodeStructures(self)
Returns encoded model of structures within partition.
array getAgentsInArea(self, minX, minY, maxX, maxY, returnTagged)
Returns a list of agents that lie within the specified bounds.
array getObjectsInArea(self, minX, minY, maxX, maxY, returnTagged)
Returns a list of objects that lie within the specified bounds.
  getStructureAtPoint(self, x, y)
Returns structure containing specified coordinates.
array getStructuresInArea(self, minX, minY, maxX, maxY, returnTagged)
Returns a list of structures that lie within the specified bounds.
array getStructuresInAreaWithDensity(self, minX, minY, maxX, maxY, density)
Returns a list of structures that lie within the specified bounds and whose density is greater then or equal to the specified density.
array getTaggedEntitiesInArea(self, minX, minY, maxX, maxY)
Returns a list of entities that lie within the specified bounds and are tagged.
  hasObstaclesInArea(self, minX, minY, maxX, maxY)
Tests if any obstacles exist in specified area.
  intersects(self, minX, minY, maxX, maxY)
Checks if specified area intersects with partition.
  mapObjectToTiles(self, obj)
Creates tiles representation for object.
  mapStructureToTiles(self, structure)
Creates tiles representation for structure.
  removeAgent(self, agent)
Removes an existing agent from the partition.
  removeObject(self, obj)
Removes an existing object from the partition.
  removeStructure(self, structure)
Removes an existing structure from the partition.
  resolveBounds(self)
Checks the bounds of the partition match its contents.
  setup(self, name, terrain, bounds, spaceX, spaceY, margin)
  update(self, timeInterval)
Forwards and update message to components in the partition.
    Inherited from GenericTerrainObject
  __init__(self)
  addEntity(self, entity)
Adds entity to terrain object.
  addGraph(self, graphName, graph)
Adds new graph to object.
  getBoundsMaxX(self)
Returns maximum x coordinate from bounds.
  getBoundsMaxY(self)
Returns maximum y coordinate from bounds.
  getBoundsMinX(self)
Returns minimum x coordinate from bounds.
  getBoundsMinY(self)
Returns minimum y coordinate from bounds.
  getGraph(self, graphName)
Returns named graph.
  removeEntity(self, entity)
Adds entity to terrain object.

Method Details

__str__(self)
(Informal representation operator)

Returns string representation of partition.

addAgent(self, agent)

Adds a new agent to the partition.

addObject(self, obj)

Adds a new object to the partition.

addStructure(self, structure)

Adds a new structure to the partition.

Every structure must have a unique name. If a structure is added with an existing name it is rejected.

clearObjectFromTiles(self, obj)

Clears tiles representation for structure.

clearStructureFromTiles(self, structure)

Clears tiles representation for structure.

containsPoint(self, x, y)

Checks if point is within bounds of partition.
Overrides:
svs_simulation.terrain.util_classes.GenericTerrainObject.containsPoint

createStructureFromName(self, structureName)

Checks of structure with given name alreday exists, and returns this, iof not creates a new structure.

createTiles(self, tilesX, tilesY)

Creates empty tile set for partition.

decode(self, data, terrain=None)

Applies encoded data to self.

decodeAgents(self, data)

Constructs classes from encoded data of agents within partition.
Parameters:
data
           (type=dict)

decodeObjects(self, data)

Constructs classes from encoded data of objects within partition.
Parameters:
data
           (type=dict)

decodeStructures(self, data)

Constructs classes from encoded data of structures within partition.
Parameters:
data
           (type=dict)

encode(self, structures=True, objects=True, agents=False)

Returns encoded model of data within partition.
Returns:
dict

encodeAgents(self)

Returns encoded model of agents within partition.
Returns:
dict

encodeObjects(self)

Returns encoded model of objects within partition.
Returns:
dict

encodeStructures(self)

Returns encoded model of structures within partition.
Returns:
dict

getAgentsInArea(self, minX, minY, maxX, maxY, returnTagged=False)

Returns a list of agents that lie within the specified bounds.
Returns:
array

getObjectsInArea(self, minX, minY, maxX, maxY, returnTagged=False)

Returns a list of objects that lie within the specified bounds.
Returns:
array

getStructureAtPoint(self, x, y)

Returns structure containing specified coordinates.

Returns None if not found.

getStructuresInArea(self, minX, minY, maxX, maxY, returnTagged=False)

Returns a list of structures that lie within the specified bounds.
Returns:
array

getStructuresInAreaWithDensity(self, minX, minY, maxX, maxY, density=0.0)

Returns a list of structures that lie within the specified bounds and whose density is greater then or equal to the specified density.
Returns:
array

getTaggedEntitiesInArea(self, minX, minY, maxX, maxY)

Returns a list of entities that lie within the specified bounds and are tagged.

This returns a list including agents, objects and structures.
Returns:
array

hasObstaclesInArea(self, minX, minY, maxX, maxY)

Tests if any obstacles exist in specified area.

Returns True if there are, False otherwise.

intersects(self, minX, minY, maxX, maxY)

Checks if specified area intersects with partition.

mapObjectToTiles(self, obj)

Creates tiles representation for object.

mapStructureToTiles(self, structure)

Creates tiles representation for structure.

removeAgent(self, agent)

Removes an existing agent from the partition.

removeObject(self, obj)

Removes an existing object from the partition.

removeStructure(self, structure)

Removes an existing structure from the partition.

resolveBounds(self)

Checks the bounds of the partition match its contents.

update(self, timeInterval)

Forwards and update message to components in the partition.
Overrides:
svs_simulation.terrain.util_classes.GenericTerrainObject.update

Generated by Epydoc 2.1 on Thu Oct 20 15:30:28 2005 http://epydoc.sf.net