geoVeRoPy.common module

exception geoVeRoPy.common.EmptyError[source]
exception geoVeRoPy.common.InvalidPolygonError[source]
exception geoVeRoPy.common.KeyExistError[source]
exception geoVeRoPy.common.KeyNotExistError[source]
exception geoVeRoPy.common.MissingParameterError[source]
exception geoVeRoPy.common.OutOfRangeError[source]
exception geoVeRoPy.common.UnsupportedInputError[source]
exception geoVeRoPy.common.VrpSolverNotAvailableError[source]
exception geoVeRoPy.common.ZeroVectorError[source]
geoVeRoPy.common.findBoundingBox(boundingBox=(None, None, None, None), pts: list[list[float] | tuple[float, float]] | None = None, nodes: dict | None = None, locFieldName='loc', arcs: dict | None = None, arcFieldName='arc', arcStartLocFieldName='startLoc', arcEndLocFieldName='endLoc', poly: list[list[float]] | list[tuple[float, float]] | None = None, polys: list[list[list[float]]] | list[list[tuple[float, float]]] | None = None, polygons: dict | None = None, anchorFieldName: str = 'anchor', polyFieldName: str = 'poly', xyReverseFlag: bool = False, edgeWidth: float = 0.1)[source]

Given a list of objects, returns a bounding box of all given objects.

Parameters:
  • boundingBox (list|tuple, optional, default as None) – An existing bounding box

  • pts (list of pts, optional, default as None) – A list of pts

  • nodes (dict, optional, default as None) – A nodes dictionary

  • locFieldName (str, optional, default as 'loc') – The field in nodes indicates locations of nodes

  • arcs (dict, optional, default as None) – An arcs dictionary

  • arcFieldName (str, optional, default as 'arc') – The field in arcs indicates locations of arcs

  • poly (poly, optional, default as None) – A poly

  • polys (polys, optional, default as None) – A list of polys

  • polygons (dict, optional, default as None) – A polygons dictionary

  • anchorFieldName (str, optional, default as anchor) – The field in polygons indicates anchor of each polygon

  • polyFieldName (str, optional, default as poly) – The field in polygons indicates polygons

  • xyReverseFlag (bool, optional, default as True) – True if x, y is reversed.

  • edgeWidth (float, optional, default as 0.1) – The extra space around bounding box

Returns:

A bounding box

Return type:

(float, float, float, float)

geoVeRoPy.common.findFigSize(boundingBox, width=None, height=None)[source]

Given a bounding box, a width(or height), returns the height(or width) of the figure

Parameters:
  • boundingBox (4-tuple, required) – The bounding box of the figure

  • width (float|None, optional, default as None) – The desired width of the figure

  • height (float|None, optional, default as None) – The desired height of the figure

Returns:

The (width, height) proportional to bounding box

Return type:

float, float

geoVeRoPy.common.loadDictionary(name: str) None[source]

Load a dictionary from a local .pkl file

Parameters:

name (str, required) – The name of local file with .pkl

Returns:

The dictionary loaded from local

Return type:

dict

geoVeRoPy.common.rndPick(coefficients: list[int | float]) int[source]

Given a list of coefficients, randomly returns an index of the list by coefficient

Parameters:

coefficient (list, required) – A list of probabilities.

Returns:

An index randomly selected

Return type:

int

geoVeRoPy.common.saveDictionary(obj, name: str) None[source]

Save the dictionary to local file as .pkl

Parameters:
  • obj (dict, required) – The dictionary to be saved

  • name (str, required) – The name of local file without .pkl