4.2.7. Perimeter

class pyprom.lib.containers.perimeter.Perimeter(pointList=None, pointIndex=None, datamap=None, mapEdge=False, mapEdgePoints=None)[source]

Container for Perimeter type lists. A Perimeter is all points Diagonally or Orthogonally neighboring a member of a pyprom.lib.containers.multipoint.MultiPoint

__eq__(other)[source]

Determines if this object is equal to another.

Parameters

other – other Perimeter to check.

Type

Perimeter

Returns

equality

Return type

bool

Raises

TypeError if other not of Perimeter

__getitem__(idx)[source]

Gives Perimeter list like get capabilities

Parameters

idx (int) – index value

Returns

pyprom.lib.locations.gridpoint.GridPoint self.point at idx

__init__(pointList=None, pointIndex=None, datamap=None, mapEdge=False, mapEdgePoints=None)[source]
Parameters
  • pointList (list(tuple(x, y, elevation))) – tuple(x, y, elevation) which make up the Perimeter.

  • pointIndex (dict({X: { Y: tuple(x, y, elevation)}}) – Members as a dict().

  • datamap (pyprom.lib.datamap.DataMap object.) – datamap which this Perimeter uses.

  • mapEdge (bool) – is this a map edge?

  • mapEdgePoints (list(tuple(x, y, ele))) – list of Points (tuple) on the map edge.

__iter__()[source]
Returns

self.points as iterator

__len__()[source]
Returns

number of items in self.points

Return type

int

__ne__(other)[source]

Determines if this object is not equal to another.

Parameters

other – other Perimeter to check.

Type

Perimeter

Returns

inequality

Return type

bool

Raises

TypeError if other not of Perimeter

__repr__()[source]
Returns

String representation of this object

__setitem__(idx, point)[source]

Gives Perimeter list like set capabilities

Parameters
  • idx (int) – index value

  • point (tuple(x, y, elevation)) – GridPoint or tuple for setitem.

__str__()
Returns

String representation of this object

__unicode__()
Returns

String representation of this object

_check_and_return_incoming_point_type(point)[source]

Make sure incoming point type is a tuple with length 3, or explicitly a pyprom.lib.locations.gridpoint.GridPoint

Parameters

point – tuple, or pyprom.lib.locations.gridpoint.GridPoint

Raises

TypeError if point not of pyprom.lib.locations.gridpoint.GridPoint or tuple

Raises

Exception if tuple length != 3

Returns

tuple(x, y, elevation)

append(point)[source]

Add a pyprom.lib.locations.gridpoint.GridPoint or tuple(x, y, elevation) to this container.

Parameters

point (tuple(x, y, elevation)) – GridPoint or tuple to append.

findHighEdges(elevation)[source]

Finds all points that are higher than passed in elevation and returns them as a list of contiguous point lists

Returns

list of lists of points containing perimeter member points higher than elevation

Return type

list(list(tuples)))

findHighPerimeter(elevation)[source]

This function returns all points higher than the passed in elevation and returns them in a list of tuples

Parameters

elevation (int, float) –

Returns

List of points as tuples

Return type

list(tuple(x, y, elevation))

classmethod from_dict(perimeterDict, datamap=None)[source]

Create this object from dictionary representation

Parameters
  • perimeterDict (dict) – dict() representation of this object.

  • datamap (pyprom.lib.datamap.DataMap object.) – datamap which this Perimeter uses.

Returns

a new Perimeter object.

Return type

Perimeter

to_dict()[source]

Create the dictionary representation of this object.

Returns

dict() representation of Perimeter

Return type

dict()