@drawtonomy/sdk 0.10.0 → 0.11.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +190 -0
- package/dist/exporter/index.d.ts +2 -2
- package/dist/exporter/index.d.ts.map +1 -1
- package/dist/exporter/index.js +1 -1
- package/dist/exporter/index.js.map +1 -1
- package/dist/exporter/lanelet2.d.ts +12 -0
- package/dist/exporter/lanelet2.d.ts.map +1 -1
- package/dist/exporter/lanelet2.js +112 -31
- package/dist/exporter/lanelet2.js.map +1 -1
- package/dist/exporter/odrCarryThrough.d.ts +2 -2
- package/dist/exporter/odrCarryThrough.d.ts.map +1 -1
- package/dist/exporter/odrCarryThrough.js +1 -1
- package/dist/exporter/odrCarryThrough.js.map +1 -1
- package/dist/exporter/odrToShapes.d.ts.map +1 -1
- package/dist/exporter/odrToShapes.js +202 -24
- package/dist/exporter/odrToShapes.js.map +1 -1
- package/dist/exporter/opendrive.d.ts.map +1 -1
- package/dist/exporter/opendrive.js +119 -28
- package/dist/exporter/opendrive.js.map +1 -1
- package/dist/exporter/opendriveParser.d.ts +8 -0
- package/dist/exporter/opendriveParser.d.ts.map +1 -1
- package/dist/exporter/opendriveParser.js +14 -5
- package/dist/exporter/opendriveParser.js.map +1 -1
- package/dist/exporter/osmToShapes.d.ts +26 -1
- package/dist/exporter/osmToShapes.d.ts.map +1 -1
- package/dist/exporter/osmToShapes.js +54 -9
- package/dist/exporter/osmToShapes.js.map +1 -1
- package/dist/types.d.ts +29 -1
- package/dist/types.d.ts.map +1 -1
- package/package.json +6 -7
package/LICENSE
ADDED
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to the Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by the Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding any notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
Copyright 2025 drawtonomy
|
|
179
|
+
|
|
180
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
181
|
+
you may not use this file except in compliance with the License.
|
|
182
|
+
You may obtain a copy of the License at
|
|
183
|
+
|
|
184
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
185
|
+
|
|
186
|
+
Unless required by applicable law or agreed to in writing, software
|
|
187
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
188
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
189
|
+
See the License for the specific language governing permissions and
|
|
190
|
+
limitations under the License.
|
package/dist/exporter/index.d.ts
CHANGED
|
@@ -7,9 +7,9 @@ export { buildEsminiZip, type EsminiPackageOptions, type EsminiPackageResult } f
|
|
|
7
7
|
export { buildZip, type ZipEntry } from './zip';
|
|
8
8
|
export { sanitizeFileBaseName } from './sanitize';
|
|
9
9
|
export { PIXELS_PER_METER } from './units';
|
|
10
|
-
export { exportToLanelet2, DEFAULT_ORIGIN_LAT, DEFAULT_ORIGIN_LON, type Lanelet2ExportOptions, type OsmSidecar, type MapOrigin, } from './lanelet2';
|
|
10
|
+
export { exportToLanelet2, trafficSignCode, trafficSignRelationSubtype, DEFAULT_ORIGIN_LAT, DEFAULT_ORIGIN_LON, type Lanelet2ExportOptions, type OsmSidecar, type MapOrigin, } from './lanelet2';
|
|
11
11
|
export { parseOsmXml, latLonToCanvas, canvasToLatLon, type OsmData, type OsmNode, type OsmWay, type OsmRelation, } from './osmParser';
|
|
12
|
-
export { osmToShapes, alignBoundaries, createShapeIdAllocator, type ImportedShapes, type ImportedPoint, type ImportedLinestring, type ImportedLane, type ImportedTrafficLight, type ImportedCrosswalk, type ImportBounds, type OsmToShapesOptions, type ShapeIdAllocator, } from './osmToShapes';
|
|
12
|
+
export { osmToShapes, alignBoundaries, createShapeIdAllocator, type ImportedShapes, type ImportedPoint, type ImportedLinestring, type ImportedLane, type ImportedTrafficLight, type ImportedTrafficSign, type ImportedCrosswalk, type ImportBounds, type OsmToShapesOptions, type ShapeIdAllocator, } from './osmToShapes';
|
|
13
13
|
export { parseOpenDriveXml, type OdrMap, type OdrHeader, type OdrRoad, type OdrGeometry, type OdrLane, type OdrLaneSection, type OdrLaneOffset, type OdrWidth, type OdrRoadMark, type OdrRoadLink, type OdrSignal, type OdrSignalValidity, type OdrObject, type OdrJunction, type OdrJunctionConnection, type OdrJunctionLaneLink, type OdrCubic, } from './opendriveParser';
|
|
14
14
|
export { evalGeometry, evalPoly3, fresnel, sampleReferenceLine, type GeomPose, type ReferenceSample, type SampleReferenceLineOptions, } from './odrGeometry';
|
|
15
15
|
export { odrToShapes, parseGeoReferenceOrigin, type OdrImportResult, type OdrRoadRecord, type OdrSidecar, type OdrToShapesOptions, } from './odrToShapes';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/exporter/index.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,iBAAiB,EAAE,KAAK,sBAAsB,EAAE,M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tB,OAAO,EACL,iBAAiB,EACjB,KAAK,MAAM,EACX,KAAK,SAAS,EACd,KAAK,OAAO,EACZ,KAAK,WAAW,EAChB,KAAK,OAAO,EACZ,KAAK,cAAc,EACnB,KAAK,aAAa,EAClB,KAAK,QAAQ,EACb,KAAK,WAAW,EAChB,KAAK,WAAW,EAChB,KAAK,SAAS,EACd,KAAK,iBAAiB,EACtB,KAAK,SAAS,EACd,KAAK,WAAW,EAChB,KAAK,qBAAqB,EAC1B,KAAK,mBAAmB,EACxB,KAAK,QAAQ,GACd,MAAM,mBAAmB,CAAA;AAC1B,OAAO,EACL,YAAY,EACZ,SAAS,EACT,OAAO,EACP,mBAAmB,EACnB,KAAK,QAAQ,EACb,KAAK,eAAe,EACpB,KAAK,0BAA0B,GAChC,MAAM,eAAe,CAAA;AACtB,OAAO,EACL,WAAW,EACX,uBAAuB,EACvB,KAAK,eAAe,EACpB,KAAK,aAAa,EAClB,KAAK,UAAU,EACf,KAAK,kBAAkB,GACxB,MAAM,eAAe,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/exporter/index.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,iBAAiB,EAAE,KAAK,sBAAsB,EAAE,MAAM,aAAa,CAAA;AAC5E,OAAO,EACL,iBAAiB,EACjB,eAAe,EACf,kBAAkB,EAClB,sBAAsB,EACtB,KAAK,SAAS,GACf,MAAM,cAAc,CAAA;AACrB,OAAO,EACL,oBAAoB,EACpB,2BAA2B,EAC3B,KAAK,yBAAyB,EAC9B,KAAK,gBAAgB,GACtB,MAAM,gBAAgB,CAAA;AACvB,OAAO,EACL,mBAAmB,EACnB,sBAAsB,EACtB,KAAK,eAAe,EACpB,KAAK,mBAAmB,GACzB,MAAM,cAAc,CAAA;AACrB,OAAO,EACL,0BAA0B,EAC1B,aAAa,EACb,eAAe,EACf,KAAK,OAAO,EACZ,KAAK,gBAAgB,GACtB,MAAM,kBAAkB,CAAA;AACzB,OAAO,EAA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B,EACnB,KAAK,QAAQ,EACb,KAAK,eAAe,EACpB,KAAK,0BAA0B,GAChC,MAAM,eAAe,CAAA;AACtB,OAAO,EACL,WAAW,EACX,uBAAuB,EACvB,KAAK,eAAe,EACpB,KAAK,aAAa,EAClB,KAAK,UAAU,EACf,KAAK,kBAAkB,GACxB,MAAM,eAAe,CAAA"}
|
package/dist/exporter/index.js
CHANGED
|
@@ -15,7 +15,7 @@ export { buildEsminiZip } from './packageEsmini';
|
|
|
15
15
|
export { buildZip } from './zip';
|
|
16
16
|
export { sanitizeFileBaseName } from './sanitize';
|
|
17
17
|
export { PIXELS_PER_METER } from './units';
|
|
18
|
-
export { exportToLanelet2, DEFAULT_ORIGIN_LAT, DEFAULT_ORIGIN_LON, } from './lanelet2';
|
|
18
|
+
export { exportToLanelet2, trafficSignCode, trafficSignRelationSubtype, DEFAULT_ORIGIN_LAT, DEFAULT_ORIGIN_LON, } from './lanelet2';
|
|
19
19
|
export { parseOsmXml, latLonToCanvas, canvasToLatLon, } from './osmParser';
|
|
20
20
|
export { osmToShapes, alignBoundaries, createShapeIdAllocator, } from './osmToShapes';
|
|
21
21
|
export { parseOpenDriveXml, } from './opendriveParser';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/exporter/index.ts"],"names":[],"mappings":"AAAA,qCAAqC;AACrC,EAAE;AACF,4EAA4E;AAC5E,4EAA4E;AAC5E,8EAA8E;AAC9E,6EAA6E;AAC7E,0EAA0E;AAC1E,yCAAyC;AAEzC,OAAO,EAAE,iBAAiB,EAA+B,MAAM,aAAa,CAAA;AAC5E,OAAO,EACL,iBAAiB,EACjB,eAAe,EACf,kBAAkB,EAClB,sBAAsB,GAEvB,MAAM,cAAc,CAAA;AACrB,OAAO,EACL,oBAAoB,EACpB,2BAA2B,GAG5B,MAAM,gBAAgB,CAAA;AACvB,OAAO,EACL,mBAAmB,EACnB,sBAAsB,GAGvB,MAAM,cAAc,CAAA;AACrB,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AO,EACL,gBAAgB,EAChB,eAAe,EACf,0BAA0B,EAC1B,kBAAkB,EAClB,kBAAkB,GAInB,MAAM,YAAY,CAAA;AACnB,OAAO,EACL,WAAW,EACX,cAAc,EACd,cAAc,GAKf,MAAM,aAAa,CAAA;AACpB,OAAO,EACL,WAAW,EACX,eAAe,EACf,sBAAsB,GAWvB,MAAM,eAAe,CAAA;AACtB,OAAO,EACL,iBAAiB,GAkBlB,MAAM,mBAAmB,CAAA;AAC1B,OAAO,EACL,YAAY,EACZ,SAAS,EACT,OAAO,EACP,mBAAmB,GAIpB,MAAM,eAAe,CAAA;AACtB,OAAO,EACL,WAAW,EACX,uBAAuB,GAKxB,MAAM,eAAe,CAAA"}
|
|
@@ -1,4 +1,16 @@
|
|
|
1
1
|
import type { DrawtonomySnapshot } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* Sign code (Lanelet2 traffic sign subtype, e.g. "de274" / "usR1-1") of a
|
|
4
|
+
* traffic sign shape. `sign_code` wins; a `subtype` that is not one of the
|
|
5
|
+
* regulatory element subtypes (round-trip metadata) is accepted as a code.
|
|
6
|
+
*/
|
|
7
|
+
export declare function trafficSignCode(attrs: Record<string, string | undefined>): string;
|
|
8
|
+
/**
|
|
9
|
+
* Regulatory element subtype of a traffic sign shape: `speed_limit` when the
|
|
10
|
+
* shape came from / represents a speed limit (recorded RE subtype or a
|
|
11
|
+
* lanelet2 `sign_type` value such as "50 km/h"), otherwise `traffic_sign`.
|
|
12
|
+
*/
|
|
13
|
+
export declare function trafficSignRelationSubtype(attrs: Record<string, string | undefined>): 'traffic_sign' | 'speed_limit';
|
|
2
14
|
/** Sidecar captured at OSM import time. Used to round-trip tags / `ele`. */
|
|
3
15
|
export interface OsmSidecar {
|
|
4
16
|
rawXml: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lanelet2.d.ts","sourceRoot":"","sources":["../../src/exporter/lanelet2.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"lanelet2.d.ts","sourceRoot":"","sources":["../../src/exporter/lanelet2.ts"],"names":[],"mappings":"AAmCA,OAAO,KAAK,EAGV,kBAAkB,EAMnB,MAAM,UAAU,CAAA;AAUjB;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,GAAG,MAAM,CAMjF;AAED;;;;GAIG;AACH,wBAAgB,0BAA0B,CACxC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,GACxC,cAAc,GAAG,aAAa,CAEhC;AAED,4EAA4E;AAC5E,MAAM,WAAW,UAAU;IACzB,MAAM,EAAE,MAAM,CAAA;IACd,SAAS,EAAE,MAAM,CAAA;IACjB,SAAS,EAAE,MAAM,CAAA;CAClB;AAED,iDAAiD;AACjD,MAAM,WAAW,SAAS;IACxB,GAAG,EAAE,MAAM,GAAG,IAAI,CAAA;IAClB,GAAG,EAAE,MAAM,GAAG,IAAI,CAAA;CACnB;AAED,MAAM,WAAW,qBAAqB;IACpC,OAAO,CAAC,EAAE,UAAU,GAAG,IAAI,CAAA;IAC3B,SAAS,CAAC,EAAE,SAAS,GAAG,IAAI,CAAA;CAC7B;AAED;;;;GAIG;AACH,eAAO,MAAM,kBAAkB,WAAW,CAAA;AAC1C,eAAO,MAAM,kBAAkB,YAAY,CAAA;AAysB3C,yDAAyD;AACzD,wBAAgB,gBAAgB,CAC9B,QAAQ,EAAE,kBAAkB,EAC5B,OAAO,GAAE,qBAA0B,GAClC,MAAM,CAiDR"}
|
|
@@ -11,6 +11,11 @@
|
|
|
11
11
|
// member is a synthesized 2-node way at the signal position and whose
|
|
12
12
|
// "ref_line" member is the stop line way; affected lanelet relations gain a
|
|
13
13
|
// `role=regulatory_element` member pointing back at it
|
|
14
|
+
// - Each TrafficSignShape carrying `affectedLaneIds` becomes a
|
|
15
|
+
// `<relation type=regulatory_element subtype=traffic_sign>` (or
|
|
16
|
+
// `subtype=speed_limit` for speed limit signs, carrying the standard
|
|
17
|
+
// `sign_type` tag) with the same refers / ref_line structure; the refers
|
|
18
|
+
// way is tagged `type=traffic_sign subtype=<sign code>`
|
|
14
19
|
// - Each LaneShape carrying `yieldLaneIds` additionally emits a
|
|
15
20
|
// `<relation type=regulatory_element subtype=right_of_way>` whose
|
|
16
21
|
// "right_of_way" member is the lane's lanelet and whose "yield" members are
|
|
@@ -28,6 +33,27 @@
|
|
|
28
33
|
// `drawtonomy_origin_lon` so re-importing the file restores the same canvas
|
|
29
34
|
// origin. Standard OSM consumers ignore unknown attributes.
|
|
30
35
|
import { canvasToLatLon, parseOsmXml } from './osmParser';
|
|
36
|
+
/**
|
|
37
|
+
* Sign code (Lanelet2 traffic sign subtype, e.g. "de274" / "usR1-1") of a
|
|
38
|
+
* traffic sign shape. `sign_code` wins; a `subtype` that is not one of the
|
|
39
|
+
* regulatory element subtypes (round-trip metadata) is accepted as a code.
|
|
40
|
+
*/
|
|
41
|
+
export function trafficSignCode(attrs) {
|
|
42
|
+
if (attrs.sign_code)
|
|
43
|
+
return attrs.sign_code;
|
|
44
|
+
if (attrs.subtype && attrs.subtype !== 'traffic_sign' && attrs.subtype !== 'speed_limit') {
|
|
45
|
+
return attrs.subtype;
|
|
46
|
+
}
|
|
47
|
+
return 'unknown';
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Regulatory element subtype of a traffic sign shape: `speed_limit` when the
|
|
51
|
+
* shape came from / represents a speed limit (recorded RE subtype or a
|
|
52
|
+
* lanelet2 `sign_type` value such as "50 km/h"), otherwise `traffic_sign`.
|
|
53
|
+
*/
|
|
54
|
+
export function trafficSignRelationSubtype(attrs) {
|
|
55
|
+
return attrs.subtype === 'speed_limit' || attrs.sign_type ? 'speed_limit' : 'traffic_sign';
|
|
56
|
+
}
|
|
31
57
|
/**
|
|
32
58
|
* Default origin used when neither a sidecar nor a map origin is supplied.
|
|
33
59
|
* Tokyo Teleport Station — picked because it is in a flat area visible at
|
|
@@ -63,6 +89,7 @@ function buildFromShapes(shapes, originLat, originLon, sidecarData) {
|
|
|
63
89
|
const linestrings = [];
|
|
64
90
|
const lanes = [];
|
|
65
91
|
const trafficLights = [];
|
|
92
|
+
const trafficSigns = [];
|
|
66
93
|
const crosswalks = [];
|
|
67
94
|
for (const s of shapes) {
|
|
68
95
|
if (s.type === 'point')
|
|
@@ -73,6 +100,8 @@ function buildFromShapes(shapes, originLat, originLon, sidecarData) {
|
|
|
73
100
|
lanes.push(s);
|
|
74
101
|
else if (s.type === 'traffic_light')
|
|
75
102
|
trafficLights.push(s);
|
|
103
|
+
else if (s.type === 'traffic_sign')
|
|
104
|
+
trafficSigns.push(s);
|
|
76
105
|
else if (s.type === 'crosswalk')
|
|
77
106
|
crosswalks.push(s);
|
|
78
107
|
}
|
|
@@ -83,8 +112,31 @@ function buildFromShapes(shapes, originLat, originLon, sidecarData) {
|
|
|
83
112
|
const shapeWayOsmIds = new Set();
|
|
84
113
|
const shapeRelationOsmIds = new Set();
|
|
85
114
|
// Resolve a shape -> OSM ID. Empty `osmId` (newly drawn shape) gets a fresh
|
|
86
|
-
// negative ID, matching the OSM convention for unsubmitted edits.
|
|
115
|
+
// negative ID, matching the OSM convention for unsubmitted edits. Fresh IDs
|
|
116
|
+
// must never collide with negative IDs already taken by imported shapes or
|
|
117
|
+
// sidecar elements (maps previously exported from here use negative IDs),
|
|
118
|
+
// so allocation starts below every reserved ID.
|
|
87
119
|
let nextNewId = -1;
|
|
120
|
+
const reserveId = (id) => {
|
|
121
|
+
if (!id)
|
|
122
|
+
return;
|
|
123
|
+
const n = Number(id);
|
|
124
|
+
if (Number.isInteger(n) && n <= nextNewId)
|
|
125
|
+
nextNewId = n - 1;
|
|
126
|
+
};
|
|
127
|
+
for (const s of shapes) {
|
|
128
|
+
const props = s.props;
|
|
129
|
+
reserveId(props.osmId);
|
|
130
|
+
reserveId(props.attributes?.refers_osm_id);
|
|
131
|
+
}
|
|
132
|
+
if (sidecarData) {
|
|
133
|
+
for (const id of sidecarData.nodes.keys())
|
|
134
|
+
reserveId(id);
|
|
135
|
+
for (const id of sidecarData.ways.keys())
|
|
136
|
+
reserveId(id);
|
|
137
|
+
for (const r of sidecarData.relations)
|
|
138
|
+
reserveId(r.id);
|
|
139
|
+
}
|
|
88
140
|
const newIdFor = new Map();
|
|
89
141
|
const resolveOsmId = (shapeId, propsOsmId) => {
|
|
90
142
|
if (propsOsmId && propsOsmId.length > 0)
|
|
@@ -183,8 +235,9 @@ function buildFromShapes(shapes, originLat, originLon, sidecarData) {
|
|
|
183
235
|
relationsOut.push(relationOut);
|
|
184
236
|
laneRelationByShapeId.set(lane.id, relationOut);
|
|
185
237
|
}
|
|
186
|
-
// Traffic lights with affected lanes -> relations
|
|
187
|
-
// subtype=traffic_light
|
|
238
|
+
// Traffic lights / signs with affected lanes -> relations
|
|
239
|
+
// (type=regulatory_element, subtype=traffic_light / traffic_sign /
|
|
240
|
+
// speed_limit). The signal or sign itself is represented as a 2-node
|
|
188
241
|
// "refers" way spanning the shape's width; the stop line (when present)
|
|
189
242
|
// joins as the "ref_line" way, and each affected lanelet references the
|
|
190
243
|
// regulatory element back.
|
|
@@ -201,23 +254,27 @@ function buildFromShapes(shapes, originLat, originLon, sidecarData) {
|
|
|
201
254
|
}
|
|
202
255
|
}
|
|
203
256
|
};
|
|
204
|
-
for
|
|
205
|
-
|
|
257
|
+
// Shared emission for refers-way-based regulatory elements (traffic lights
|
|
258
|
+
// and traffic signs). The two callbacks finalize the format-specific tags
|
|
259
|
+
// of the synthesized refers way and of the regulatory element relation.
|
|
260
|
+
const emitRefersRegulatoryElement = (shape, finishRefersTags, finishRelationTags) => {
|
|
261
|
+
const affected = shape.props.affectedLaneIds ?? [];
|
|
206
262
|
if (affected.length === 0)
|
|
207
|
-
|
|
208
|
-
const
|
|
263
|
+
return;
|
|
264
|
+
const attrs = (shape.props.attributes ?? {});
|
|
265
|
+
const reOsmId = resolveOsmId(shape.id, shape.props.osmId);
|
|
209
266
|
shapeRelationOsmIds.add(reOsmId);
|
|
210
267
|
// Round-trip fidelity: a signal imported from this sidecar and left
|
|
211
268
|
// unedited re-emits its original refers way / nodes / relation verbatim.
|
|
212
269
|
// The 2-node synthesis below would otherwise lose the original way's
|
|
213
270
|
// orientation, elevation and any extra members (light_bulbs etc.).
|
|
214
271
|
const originalRelation = sidecarData?.relations.find(r => r.id === reOsmId);
|
|
215
|
-
const recordedRefersId =
|
|
272
|
+
const recordedRefersId = attrs.refers_osm_id;
|
|
216
273
|
const originalRefers = recordedRefersId ? sidecarData?.ways.get(recordedRefersId) : undefined;
|
|
217
274
|
if (originalRelation && originalRefers && originalRefers.nodeRefs.length >= 2) {
|
|
218
275
|
const nodeA = sidecarData?.nodes.get(originalRefers.nodeRefs[0]);
|
|
219
276
|
const nodeB = sidecarData?.nodes.get(originalRefers.nodeRefs[originalRefers.nodeRefs.length - 1]);
|
|
220
|
-
const current = canvasToLatLon(
|
|
277
|
+
const current = canvasToLatLon(shape.x, shape.y, originLat, originLon);
|
|
221
278
|
// Unmoved = the shape still sits at the refers way midpoint (import
|
|
222
279
|
// placed it there; ~1e-9 deg covers projection round-trip fp error).
|
|
223
280
|
const unmoved = !!nodeA && !!nodeB &&
|
|
@@ -225,8 +282,8 @@ function buildFromShapes(shapes, originLat, originLon, sidecarData) {
|
|
|
225
282
|
Math.abs((nodeA.lon + nodeB.lon) / 2 - current.lon) < 1e-9;
|
|
226
283
|
// The stop line link must still match the original ref_line member.
|
|
227
284
|
const originalRefLine = originalRelation.members.find(m => m.type === 'way' && m.role === 'ref_line')?.ref;
|
|
228
|
-
const stopLs =
|
|
229
|
-
? shapeMap.get(
|
|
285
|
+
const stopLs = shape.props.stopLineId
|
|
286
|
+
? shapeMap.get(shape.props.stopLineId)
|
|
230
287
|
: undefined;
|
|
231
288
|
const currentRefLine = stopLs ? resolveOsmId(stopLs.id, stopLs.props.osmId) : undefined;
|
|
232
289
|
if (unmoved && originalRefLine === currentRefLine) {
|
|
@@ -249,24 +306,24 @@ function buildFromShapes(shapes, originLat, originLon, sidecarData) {
|
|
|
249
306
|
tags: { ...originalRelation.tags },
|
|
250
307
|
});
|
|
251
308
|
linkAffectedLanelets(reOsmId, affected);
|
|
252
|
-
|
|
309
|
+
return;
|
|
253
310
|
}
|
|
254
311
|
}
|
|
255
312
|
// "refers" way: reuse the way / node IDs recorded at import time (the
|
|
256
313
|
// `refers_osm_id` attribute) so the sidecar copies are overridden rather
|
|
257
314
|
// than duplicated; otherwise allocate fresh negative IDs.
|
|
258
|
-
const refersWayId =
|
|
315
|
+
const refersWayId = attrs.refers_osm_id || resolveOsmId(`${shape.id}#refers`, undefined);
|
|
259
316
|
const sidecarRefers = sidecarData?.ways.get(refersWayId);
|
|
260
317
|
const reuseNodes = !!sidecarRefers && sidecarRefers.nodeRefs.length >= 2;
|
|
261
318
|
const nodeIdA = reuseNodes
|
|
262
319
|
? sidecarRefers.nodeRefs[0]
|
|
263
|
-
: resolveOsmId(`${
|
|
320
|
+
: resolveOsmId(`${shape.id}#refers_a`, undefined);
|
|
264
321
|
const nodeIdB = reuseNodes
|
|
265
322
|
? sidecarRefers.nodeRefs[sidecarRefers.nodeRefs.length - 1]
|
|
266
|
-
: resolveOsmId(`${
|
|
267
|
-
const halfW = (
|
|
268
|
-
const a = canvasToLatLon(
|
|
269
|
-
const b = canvasToLatLon(
|
|
323
|
+
: resolveOsmId(`${shape.id}#refers_b`, undefined);
|
|
324
|
+
const halfW = (shape.props.w ?? 0) / 2;
|
|
325
|
+
const a = canvasToLatLon(shape.x - halfW, shape.y, originLat, originLon);
|
|
326
|
+
const b = canvasToLatLon(shape.x + halfW, shape.y, originLat, originLon);
|
|
270
327
|
for (const [nid, ll] of [[nodeIdA, a], [nodeIdB, b]]) {
|
|
271
328
|
shapeNodeOsmIds.add(nid);
|
|
272
329
|
const originalNode = sidecarData?.nodes.get(nid);
|
|
@@ -280,23 +337,15 @@ function buildFromShapes(shapes, originLat, originLon, sidecarData) {
|
|
|
280
337
|
}
|
|
281
338
|
shapeWayOsmIds.add(refersWayId);
|
|
282
339
|
const refersTags = sidecarRefers ? { ...sidecarRefers.tags } : {};
|
|
283
|
-
refersTags
|
|
284
|
-
// Autoware requires subtype and height on the traffic light way; keep
|
|
285
|
-
// sidecar values when present, allow shape attributes to override, and
|
|
286
|
-
// fall back to the common defaults.
|
|
287
|
-
const tlAttrs = (tl.props.attributes ?? {});
|
|
288
|
-
if (!refersTags.subtype)
|
|
289
|
-
refersTags.subtype = tlAttrs.subtype || 'red_yellow_green';
|
|
290
|
-
if (!refersTags.height)
|
|
291
|
-
refersTags.height = tlAttrs.height || '0.5';
|
|
340
|
+
finishRefersTags(refersTags, attrs);
|
|
292
341
|
waysOut.set(refersWayId, { id: refersWayId, nodeRefs: [nodeIdA, nodeIdB], tags: refersTags });
|
|
293
342
|
const members = [
|
|
294
343
|
{ type: 'way', ref: refersWayId, role: 'refers' },
|
|
295
344
|
];
|
|
296
345
|
// "ref_line": the stop line linestring, already exported as a way above.
|
|
297
346
|
// Ensure the way carries type=stop_line so consumers recognize it.
|
|
298
|
-
if (
|
|
299
|
-
const stopLs = shapeMap.get(
|
|
347
|
+
if (shape.props.stopLineId) {
|
|
348
|
+
const stopLs = shapeMap.get(shape.props.stopLineId);
|
|
300
349
|
if (stopLs) {
|
|
301
350
|
const stopWayId = resolveOsmId(stopLs.id, stopLs.props.osmId);
|
|
302
351
|
const stopWay = waysOut.get(stopWayId);
|
|
@@ -306,10 +355,42 @@ function buildFromShapes(shapes, originLat, originLon, sidecarData) {
|
|
|
306
355
|
}
|
|
307
356
|
}
|
|
308
357
|
const tags = originalRelation ? { ...originalRelation.tags } : {};
|
|
309
|
-
tags
|
|
310
|
-
tags.subtype = 'traffic_light';
|
|
358
|
+
finishRelationTags(tags, attrs);
|
|
311
359
|
relationsOut.push({ id: reOsmId, members, tags });
|
|
312
360
|
linkAffectedLanelets(reOsmId, affected);
|
|
361
|
+
};
|
|
362
|
+
for (const tl of trafficLights) {
|
|
363
|
+
emitRefersRegulatoryElement(tl, (refersTags, attrs) => {
|
|
364
|
+
refersTags.type = 'traffic_light';
|
|
365
|
+
// Autoware requires subtype and height on the traffic light way; keep
|
|
366
|
+
// sidecar values when present, allow shape attributes to override, and
|
|
367
|
+
// fall back to the common defaults.
|
|
368
|
+
if (!refersTags.subtype)
|
|
369
|
+
refersTags.subtype = attrs.subtype || 'red_yellow_green';
|
|
370
|
+
if (!refersTags.height)
|
|
371
|
+
refersTags.height = attrs.height || '0.5';
|
|
372
|
+
}, tags => {
|
|
373
|
+
tags.type = 'regulatory_element';
|
|
374
|
+
tags.subtype = 'traffic_light';
|
|
375
|
+
});
|
|
376
|
+
}
|
|
377
|
+
for (const ts of trafficSigns) {
|
|
378
|
+
emitRefersRegulatoryElement(ts, (refersTags, attrs) => {
|
|
379
|
+
refersTags.type = 'traffic_sign';
|
|
380
|
+
// The refers way carries the sign code as its subtype (ISO 3166
|
|
381
|
+
// region code + sign number). A sidecar subtype only survives when
|
|
382
|
+
// the shape has no code of its own.
|
|
383
|
+
const code = trafficSignCode(attrs);
|
|
384
|
+
if (!refersTags.subtype || code !== 'unknown')
|
|
385
|
+
refersTags.subtype = code;
|
|
386
|
+
}, (tags, attrs) => {
|
|
387
|
+
tags.type = 'regulatory_element';
|
|
388
|
+
tags.subtype = trafficSignRelationSubtype(attrs);
|
|
389
|
+
// Lanelet2 speed_limit convention: the value with unit (e.g.
|
|
390
|
+
// "50 km/h") rides on the relation as `sign_type`.
|
|
391
|
+
if (attrs.sign_type)
|
|
392
|
+
tags.sign_type = attrs.sign_type;
|
|
393
|
+
});
|
|
313
394
|
}
|
|
314
395
|
// Lanes with yieldLaneIds -> relations (type=regulatory_element,
|
|
315
396
|
// subtype=right_of_way). The lane plays the "right_of_way" role and each
|