bleNaviPy.indoorGML.parserJSON module

This is a module for parcing indoorGML and BleNavi json files

class bleNaviPy.indoorGML.parserJSON.ParserJSON

Bases: object

Class to parse a JSON file with indoorGML info

static addHolesToCells(cells: List[bleNaviPy.indoorGML.geometry.cellGeometry.CellGeometry], holes: List[bleNaviPy.indoorGML.geometry.holeGeometry.HoleGeometry]) → None

Add holes geometries to matching cells

Parameters
  • cells (List[CellGeometry])

  • holes (List[HoleGeometry])

static getBeaconGeometries(project_data: any) → List[bleNaviPy.beacon.beacon.Beacon]

Get beacons from project file

Parameters

project_data (any) – Project json data

Returns

List of beacons from the project file

Return type

List[Beacon]

static getCellGeometries(project_data: any) → List[bleNaviPy.indoorGML.geometry.cellGeometry.CellGeometry]

Get Cell geometries from a project data

Parameters

project_data (any) – Project json data

Returns

List of cells from project file

Return type

List[CellGeometry]

static getCellName(cell_id: str, cell_properties: List[any]) → str

Get cell name by cellId

Parameters
  • cell_id (str) – Cell id

  • cell_properties (List[any]) – List of all cell properties

Returns

Cell name

Return type

str

static getGeometryFromBleNaviFile(filename: string) → FloorGeometry

Get floor geometry using BleNaviFile

Parameters

filename (string) – Filename of saved floor geometry

Returns

[Floor geometry saved in a file]

Return type

FloorGeometry

Examples

>>> from bleNaviPy.indoorGML.parserJSON import ParserJSON
>>> from bleNaviPy.indoorGML.geometry.floorGeometry import FloorGeometry
>>> floor: FloorGeometry = ParserJSON.getGeometryFromBleNaviFile("test.json")
Floor: Cells: 3
static getGeometryFromIndoorGMLFile(filename: str) → bleNaviPy.indoorGML.geometry.floorGeometry.FloorGeometry

Get floor geometry from json file

Parameters

filename (str) – [file path]

Returns

[Floor geometry from file]

Return type

FloorGeometry

Examples

>>> from bleNaviPy.indoorGML.parserJSON import ParserJSON
>>> from bleNaviPy.indoorGML.geometry.floorGeometry import FloorGeometry
>>> floor: FloorGeometry = ParserJSON.getGeometryFromIndoorGMLFile("test.json")
Floor: Cells: 3
static getHolesGeometries(project_data: any) → List[bleNaviPy.indoorGML.geometry.holeGeometry.HoleGeometry]

Get holes from a project file

Parameters

project_data (any) – Project json data

Returns

List of holes geometries from the project file

Return type

List[HoleGeometry]

static getProjectData(json_data: any) → any

get first project data

Parameters

json_data (any) – Json data read from the file

Returns

project json data

Return type

any

static getTransitionGeometries(project_data: any) → List[bleNaviPy.indoorGML.geometry.transitionGeometry.TransitionGeometry]

Get transitions from a project file

Parameters

project_data (any) – Project json data

Returns

List of transitions geometries from the project file

Return type

List[TransitionGeometry]

static opened(filename: string, mode: string = 'r')

Open file context

Parameters
  • filename (string) – File path

  • mode (string, optional) – Open mode. Passed into open function. Defaults to “r”.

Returns

Return a opened file or an error

Return type

List[TextIOWrapper, IOError]

Yields

Iterator[List[TextIOWrapper, IOError]]

static saveFloorGeometry(filename: string, floor_geometry: FloorGeometry, indent: number = 4) → None

Save floor geometry to BleNaviFile

Parameters
  • filename (string) – Save filename

  • floor_geometry (FloorGeometry) – Floor geometry to save

  • indent (number, optional) – Indent passed to json.dump function. If you want to keep the file oneline pass here None Defaults to 4.

static setFloorProperties(project_data: any, floor: bleNaviPy.indoorGML.geometry.floorGeometry.FloorGeometry) → None

Set floor set floor properties into project data file

Parameters
  • project_data (any) – project data

  • floor (FloorGeometry)