|
| 1 | +# This file is automatically generated by pyo3_stub_gen |
| 2 | +# ruff: noqa: E501, F401 |
| 3 | + |
| 4 | +import typing |
| 5 | + |
| 6 | +class Anchor: |
| 7 | + r""" |
| 8 | + An `Anchor` is a reference point for a given [`Curve`]. |
| 9 | + It can be a milestone, a bridge… |
| 10 | + """ |
| 11 | + name: str |
| 12 | + position: typing.Optional[Point] |
| 13 | + curve_position: float |
| 14 | + scale_position: float |
| 15 | + |
| 16 | +class AnchorOnLrm: |
| 17 | + r""" |
| 18 | + The linear position of an anchor doesn’t always match the measured distance |
| 19 | + For example if a road was transformed into a bypass, resulting in a longer road, |
| 20 | + but measurements are kept the same |
| 21 | + The start of the curve might also be different from the `0` of the LRM |
| 22 | + """ |
| 23 | + def __new__(cls,anchor_index:int, distance_along_lrm:float): ... |
| 24 | + ... |
| 25 | + |
| 26 | +class Builder: |
| 27 | + def __new__(cls,): ... |
| 28 | + def add_node(self, id:str, coord:Point, properties:typing.Mapping[str, str]) -> int: |
| 29 | + r""" |
| 30 | + Add a new topological node (e.g. a railway switch) |
| 31 | + """ |
| 32 | + ... |
| 33 | + |
| 34 | + def add_anchor(self, id:str, coord:Point, properties:typing.Mapping[str, str], name:typing.Optional[str]) -> int: |
| 35 | + r""" |
| 36 | + Add a new anchor by its cooordinates |
| 37 | + """ |
| 38 | + ... |
| 39 | + |
| 40 | + def add_projected_anchor(self, id:str, position_on_curve:float, properties:typing.Mapping[str, str], name:typing.Optional[str]) -> int: |
| 41 | + r""" |
| 42 | + Add a new anchor by its position along the curve |
| 43 | + """ |
| 44 | + ... |
| 45 | + |
| 46 | + def add_segment(self, id:str, geometry:typing.Sequence[Point], start_node_index:int, end_node_index:int) -> int: |
| 47 | + r""" |
| 48 | + Add a new segment |
| 49 | + |
| 50 | + The geometry represents the curve |
| 51 | + start_node_index and end_node_index are the topological extremeties returned by `add_node` |
| 52 | + """ |
| 53 | + ... |
| 54 | + |
| 55 | + def add_traversal(self, traversal_id:str, segments:typing.Sequence[SegmentOfTraversal]) -> None: |
| 56 | + r""" |
| 57 | + Add a traversal |
| 58 | + |
| 59 | + segments represent the curve of the traversal |
| 60 | + """ |
| 61 | + ... |
| 62 | + |
| 63 | + def add_lrm(self, id:str, traversal_index:int, anchors:typing.Sequence[AnchorOnLrm], properties:typing.Mapping[str, str]) -> None: |
| 64 | + r""" |
| 65 | + Add a linear referencing model |
| 66 | + |
| 67 | + It is composed by the traversal identified by traversa_index (that represents the curve) |
| 68 | + and the anchors (that represent the milestones) |
| 69 | + """ |
| 70 | + ... |
| 71 | + |
| 72 | + def get_traversal_indexes(self) -> dict[str, int]: |
| 73 | + r""" |
| 74 | + List all the traversals by their id and index |
| 75 | + """ |
| 76 | + ... |
| 77 | + |
| 78 | + def read_from_osm(self, input_osm_file:pathlib.Path, lrm_tag:str, required:typing.Sequence[tuple[str, str]], to_reject:typing.Sequence[tuple[str, str]]) -> None: |
| 79 | + r""" |
| 80 | + Read the topology from an OpenStreetMap source |
| 81 | + |
| 82 | + It reads the nodes, segments and traversals. |
| 83 | + """ |
| 84 | + ... |
| 85 | + |
| 86 | + def save(self, out_file:pathlib.Path, properties:typing.Mapping[str, str]) -> None: |
| 87 | + r""" |
| 88 | + Save the lrs to a file |
| 89 | + """ |
| 90 | + ... |
| 91 | + |
| 92 | + def euclidean_distance(self, lrm_index_a:int, lrm_index_b:int) -> float: |
| 93 | + r""" |
| 94 | + Compute the euclidean distance between two lrms |
| 95 | + """ |
| 96 | + ... |
| 97 | + |
| 98 | + def get_nodes_of_traversal(self, lrm_index:int) -> list[int]: |
| 99 | + r""" |
| 100 | + List all the node indices of a traversal |
| 101 | + """ |
| 102 | + ... |
| 103 | + |
| 104 | + def get_node_coord(self, node_index:int) -> Point: |
| 105 | + r""" |
| 106 | + Get the coordinates of a node identified by its index |
| 107 | + """ |
| 108 | + ... |
| 109 | + |
| 110 | + def project(self, lrm_index:int, point:Point) -> typing.Optional[float]: |
| 111 | + r""" |
| 112 | + Project a point on a the curve of an lrm |
| 113 | + |
| 114 | + Return a value between 0 and 1, both included |
| 115 | + Return None if the curve of the traversal is not defined |
| 116 | + """ |
| 117 | + ... |
| 118 | + |
| 119 | + def reverse(self, lrm_index:int) -> None: |
| 120 | + r""" |
| 121 | + Reverse the orientation of the lrm |
| 122 | + |
| 123 | + If it is composed by the segments (a, b)-(b, c) it will be (c, b)-(b, a) |
| 124 | + """ |
| 125 | + ... |
| 126 | + |
| 127 | + |
| 128 | +class LrmScaleMeasure: |
| 129 | + r""" |
| 130 | + Represent a position on an [`LrmScale`] relative as an `offset` to an [`Anchor`]. |
| 131 | + """ |
| 132 | + anchor_name: str |
| 133 | + scale_offset: float |
| 134 | + def __new__(cls,anchor_name:str, scale_offset:float): ... |
| 135 | + |
| 136 | +class Lrs: |
| 137 | + r""" |
| 138 | + Holds the whole Linear Referencing System. |
| 139 | + """ |
| 140 | + def __new__(cls,data:bytes): ... |
| 141 | + def lrm_len(self) -> int: |
| 142 | + r""" |
| 143 | + How many LRMs compose the LRS. |
| 144 | + """ |
| 145 | + ... |
| 146 | + |
| 147 | + def get_lrm_geom(self, index:int) -> list[Point]: |
| 148 | + r""" |
| 149 | + Return the geometry of the LRM. |
| 150 | + """ |
| 151 | + ... |
| 152 | + |
| 153 | + def get_lrm_scale_id(self, index:int) -> str: |
| 154 | + r""" |
| 155 | + `id` of the [`LrmScale`]. |
| 156 | + """ |
| 157 | + ... |
| 158 | + |
| 159 | + def get_anchors(self, lrm_index:int) -> list[Anchor]: |
| 160 | + r""" |
| 161 | + All the [`Anchor`]s of a LRM. |
| 162 | + """ |
| 163 | + ... |
| 164 | + |
| 165 | + def resolve(self, lrm_index:int, measure:LrmScaleMeasure) -> Point: |
| 166 | + r""" |
| 167 | + Get the position given a [`LrmScaleMeasure`]. |
| 168 | + """ |
| 169 | + ... |
| 170 | + |
| 171 | + def locate_point(self, lrm_index:int, measure:LrmScaleMeasure) -> float: |
| 172 | + r""" |
| 173 | + Get the positon along the curve given a [`LrmScaleMeasure`] |
| 174 | + The value will be between 0.0 and 1.0, both included |
| 175 | + """ |
| 176 | + ... |
| 177 | + |
| 178 | + def resolve_range(self, lrm_index:int, from:LrmScaleMeasure, to:LrmScaleMeasure) -> list[Point]: |
| 179 | + r""" |
| 180 | + Given two [`LrmScaleMeasure`]s, return a range of [`Point`] that represent a line string. |
| 181 | + """ |
| 182 | + ... |
| 183 | + |
| 184 | + def find_lrm(self, lrm_id:str) -> typing.Optional[int]: |
| 185 | + r""" |
| 186 | + Given a ID returns the corresponding lrs index (or None if not found) |
| 187 | + """ |
| 188 | + ... |
| 189 | + |
| 190 | + |
| 191 | +class Point: |
| 192 | + r""" |
| 193 | + A geographical [`Point`], it can be either a projected or spherical coordinates. |
| 194 | + """ |
| 195 | + x: float |
| 196 | + y: float |
| 197 | + def __new__(cls,x:float, y:float): ... |
| 198 | + |
| 199 | +class SegmentOfTraversal: |
| 200 | + r""" |
| 201 | + A traversal is composed by segments |
| 202 | + """ |
| 203 | + def __new__(cls,segment_index:int, reversed:bool): ... |
| 204 | + ... |
| 205 | + |
0 commit comments