@itwin/map-layers-formats 4.7.0-dev.0 → 4.7.0-dev.4
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/lib/cjs/ArcGisFeature/ArcGisFeatureFormat.js.map +1 -1
- package/lib/cjs/ArcGisFeature/ArcGisFeatureProvider.js.map +1 -1
- package/lib/cjs/ArcGisFeature/ArcGisFeatureQuery.js.map +1 -1
- package/lib/cjs/ArcGisFeature/ArcGisFeatureReader.js.map +1 -1
- package/lib/cjs/ArcGisFeature/ArcGisFeatureResponse.js.map +1 -1
- package/lib/cjs/ArcGisFeature/ArcGisJsonFeatureReader.js.map +1 -1
- package/lib/cjs/ArcGisFeature/ArcGisPbfFeatureReader.js.map +1 -1
- package/lib/cjs/ArcGisFeature/ArcGisSymbologyRenderer.js.map +1 -1
- package/lib/cjs/ArcGisFeature/EsriSymbology.js.map +1 -1
- package/lib/cjs/ArcGisFeature/esriPBuffer.gen.js.map +1 -1
- package/lib/cjs/Feature/DefaultMarkerIcon.js +9 -9
- package/lib/cjs/Feature/DefaultMarkerIcon.js.map +1 -1
- package/lib/cjs/Feature/FeatureCanvasRenderer.js.map +1 -1
- package/lib/cjs/Feature/FeatureInfoReader.js.map +1 -1
- package/lib/cjs/Feature/FeatureSymbology.js.map +1 -1
- package/lib/cjs/Feature/RandomMapColor.js.map +1 -1
- package/lib/cjs/GeoJSON/GeoJSONGeometry.js.map +1 -1
- package/lib/cjs/GeoJSON/GeoJSONGeometryReader.js.map +1 -1
- package/lib/cjs/Icons/MapInfoIcon.js.map +1 -1
- package/lib/cjs/OgcApiFeatures/OgcApiFeaturesFormat.js.map +1 -1
- package/lib/cjs/OgcApiFeatures/OgcApiFeaturesProvider.js.map +1 -1
- package/lib/cjs/OgcApiFeatures/OgcApiFeaturesReader.js.map +1 -1
- package/lib/cjs/Tools/GeometryTerrainDraper.d.ts +20 -0
- package/lib/cjs/Tools/GeometryTerrainDraper.d.ts.map +1 -0
- package/lib/cjs/Tools/GeometryTerrainDraper.js +153 -0
- package/lib/cjs/Tools/GeometryTerrainDraper.js.map +1 -0
- package/lib/cjs/Tools/MapFeatureInfoDecorator.d.ts +15 -10
- package/lib/cjs/Tools/MapFeatureInfoDecorator.d.ts.map +1 -1
- package/lib/cjs/Tools/MapFeatureInfoDecorator.js +191 -150
- package/lib/cjs/Tools/MapFeatureInfoDecorator.js.map +1 -1
- package/lib/cjs/Tools/MapFeatureInfoTool.d.ts.map +1 -1
- package/lib/cjs/Tools/MapFeatureInfoTool.js +6 -3
- package/lib/cjs/Tools/MapFeatureInfoTool.js.map +1 -1
- package/lib/cjs/map-layers-formats.js.map +1 -1
- package/lib/cjs/mapLayersFormats.js.map +1 -1
- package/lib/esm/ArcGisFeature/ArcGisFeatureFormat.js.map +1 -1
- package/lib/esm/ArcGisFeature/ArcGisFeatureProvider.js.map +1 -1
- package/lib/esm/ArcGisFeature/ArcGisFeatureQuery.js.map +1 -1
- package/lib/esm/ArcGisFeature/ArcGisFeatureReader.js.map +1 -1
- package/lib/esm/ArcGisFeature/ArcGisFeatureResponse.js.map +1 -1
- package/lib/esm/ArcGisFeature/ArcGisJsonFeatureReader.js.map +1 -1
- package/lib/esm/ArcGisFeature/ArcGisPbfFeatureReader.js.map +1 -1
- package/lib/esm/ArcGisFeature/ArcGisSymbologyRenderer.js.map +1 -1
- package/lib/esm/ArcGisFeature/EsriSymbology.js.map +1 -1
- package/lib/esm/ArcGisFeature/esriPBuffer.gen.js.map +1 -1
- package/lib/esm/Feature/DefaultMarkerIcon.js +9 -9
- package/lib/esm/Feature/DefaultMarkerIcon.js.map +1 -1
- package/lib/esm/Feature/FeatureCanvasRenderer.js.map +1 -1
- package/lib/esm/Feature/FeatureInfoReader.js.map +1 -1
- package/lib/esm/Feature/FeatureSymbology.js.map +1 -1
- package/lib/esm/Feature/RandomMapColor.js.map +1 -1
- package/lib/esm/GeoJSON/GeoJSONGeometry.js.map +1 -1
- package/lib/esm/GeoJSON/GeoJSONGeometryReader.js.map +1 -1
- package/lib/esm/Icons/MapInfoIcon.js.map +1 -1
- package/lib/esm/OgcApiFeatures/OgcApiFeaturesFormat.js.map +1 -1
- package/lib/esm/OgcApiFeatures/OgcApiFeaturesProvider.js.map +1 -1
- package/lib/esm/OgcApiFeatures/OgcApiFeaturesReader.js.map +1 -1
- package/lib/esm/Tools/GeometryTerrainDraper.d.ts +20 -0
- package/lib/esm/Tools/GeometryTerrainDraper.d.ts.map +1 -0
- package/lib/esm/Tools/GeometryTerrainDraper.js +149 -0
- package/lib/esm/Tools/GeometryTerrainDraper.js.map +1 -0
- package/lib/esm/Tools/MapFeatureInfoDecorator.d.ts +15 -10
- package/lib/esm/Tools/MapFeatureInfoDecorator.d.ts.map +1 -1
- package/lib/esm/Tools/MapFeatureInfoDecorator.js +193 -152
- package/lib/esm/Tools/MapFeatureInfoDecorator.js.map +1 -1
- package/lib/esm/Tools/MapFeatureInfoTool.d.ts.map +1 -1
- package/lib/esm/Tools/MapFeatureInfoTool.js +6 -3
- package/lib/esm/Tools/MapFeatureInfoTool.js.map +1 -1
- package/lib/esm/map-layers-formats.js.map +1 -1
- package/lib/esm/mapLayersFormats.js.map +1 -1
- package/lib/public/locales/en/mapLayersFormats.json +18 -18
- package/package.json +13 -13
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GeometryTerrainDraper = void 0;
|
|
4
|
+
/*---------------------------------------------------------------------------------------------
|
|
5
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
6
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
7
|
+
*--------------------------------------------------------------------------------------------*/
|
|
8
|
+
const core_frontend_1 = require("@itwin/core-frontend");
|
|
9
|
+
const core_geometry_1 = require("@itwin/core-geometry");
|
|
10
|
+
const core_bentley_1 = require("@itwin/core-bentley");
|
|
11
|
+
const loggerCategory = "MapLayersFormats.GeometryTerrainDraper";
|
|
12
|
+
/** A TileGeometryCollector that restricts collection to tiles that overlap a line string.
|
|
13
|
+
/* @internal
|
|
14
|
+
*/
|
|
15
|
+
class LineSegmentCollector extends core_frontend_1.TileGeometryCollector {
|
|
16
|
+
constructor(user, chordTolerance, range, transform, points) {
|
|
17
|
+
super({ user, chordTolerance, range, transform });
|
|
18
|
+
this._points = points;
|
|
19
|
+
}
|
|
20
|
+
addMissingTile(tile) {
|
|
21
|
+
core_bentley_1.Logger.logTrace(loggerCategory, `CollectorAdd missing tile: ${tile.contentId}`);
|
|
22
|
+
super.addMissingTile(tile);
|
|
23
|
+
}
|
|
24
|
+
collectTile(tile) {
|
|
25
|
+
let status = super.collectTile(tile);
|
|
26
|
+
if ("reject" !== status && !this.rangeOverlapsLineString(tile.range)) {
|
|
27
|
+
status = "reject";
|
|
28
|
+
}
|
|
29
|
+
core_bentley_1.Logger.logTrace(loggerCategory, `collectTile - tile: ${tile.contentId} status: ${status} isReady: ${tile.isReady} status:${tile.loadStatus}`);
|
|
30
|
+
return status;
|
|
31
|
+
}
|
|
32
|
+
rangeOverlapsLineString(range) {
|
|
33
|
+
let inside = false;
|
|
34
|
+
const clipper = core_geometry_1.ConvexClipPlaneSet.createRange3dPlanes(range, true, true, true, true, false, false);
|
|
35
|
+
if (this._options.transform)
|
|
36
|
+
clipper.transformInPlace(this._options.transform);
|
|
37
|
+
for (let i = 0; i < this._points.length - 1 && !inside; i++)
|
|
38
|
+
inside = clipper.announceClippedSegmentIntervals(0, 1, this._points.getPoint3dAtUncheckedPointIndex(i), this._points.getPoint3dAtUncheckedPointIndex(i + 1));
|
|
39
|
+
return inside;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
/** @internal */
|
|
43
|
+
class GeometryTerrainDraper {
|
|
44
|
+
constructor(viewport, treeRef) {
|
|
45
|
+
this.viewport = viewport;
|
|
46
|
+
this.treeRef = treeRef;
|
|
47
|
+
// The side angle measures how close the sweep vector is from being parallel to a side face.
|
|
48
|
+
// The larger the angle, the more nearly vertical facets are ignored.
|
|
49
|
+
// This is an "empirical" value that was determined by looking at "problematic" polyfaces
|
|
50
|
+
this.sideAngle = core_geometry_1.Angle.createDegrees(0.06);
|
|
51
|
+
this.maxDistanceZ = 1.0E5; // Expand the Z Range, but not so much that we get opposite side of globe.
|
|
52
|
+
this.tileUserId = core_frontend_1.TileUser.generateId();
|
|
53
|
+
core_frontend_1.IModelApp.tileAdmin.registerUser(this);
|
|
54
|
+
}
|
|
55
|
+
dispose() {
|
|
56
|
+
core_frontend_1.IModelApp.tileAdmin.forgetUser(this);
|
|
57
|
+
}
|
|
58
|
+
get iModel() { return this.viewport.iModel; }
|
|
59
|
+
onRequestStateChanged() {
|
|
60
|
+
this.viewport.invalidateDecorations();
|
|
61
|
+
}
|
|
62
|
+
discloseTileTrees(trees) {
|
|
63
|
+
trees.disclose(this.treeRef);
|
|
64
|
+
}
|
|
65
|
+
// Filter out non-top facets:
|
|
66
|
+
// For unknown reasons, there are "perpendicular" facets appearing in the terrain meshes.
|
|
67
|
+
getMeshTopFacets(mesh) {
|
|
68
|
+
// constant inputs
|
|
69
|
+
const sweepVector = core_geometry_1.Vector3d.unitZ();
|
|
70
|
+
// i.e., region is horizontal
|
|
71
|
+
// create subset visitor from the top facets
|
|
72
|
+
const topFacets = [];
|
|
73
|
+
const facetNormal = core_geometry_1.Vector3d.createZero();
|
|
74
|
+
for (const visitor = mesh.createVisitor(0); visitor.moveToNextFacet();) {
|
|
75
|
+
if (core_geometry_1.PolygonOps.unitNormal(visitor.point, facetNormal)) {
|
|
76
|
+
const theta = facetNormal.angleFromPerpendicular(sweepVector);
|
|
77
|
+
if (!theta.isMagnitudeLessThanOrEqual(this.sideAngle)) { // skip side facet
|
|
78
|
+
if (facetNormal.dotProduct(sweepVector) > 0) // this is a top facet
|
|
79
|
+
topFacets.push(visitor.currentReadIndex());
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
return core_geometry_1.IndexedPolyfaceSubsetVisitor.createSubsetVisitor(mesh, topFacets, 0);
|
|
84
|
+
}
|
|
85
|
+
drapeLineString(outStrings, inPoints, tolerance, range) {
|
|
86
|
+
const tree = this.treeRef.treeOwner.load();
|
|
87
|
+
if (!tree)
|
|
88
|
+
return "loading";
|
|
89
|
+
const expandedRange = core_geometry_1.Range3d.createFrom(range);
|
|
90
|
+
expandedRange.extendZOnly(-this.maxDistanceZ);
|
|
91
|
+
expandedRange.extendZOnly(this.maxDistanceZ);
|
|
92
|
+
const collector = new LineSegmentCollector(this, tolerance, expandedRange, tree.iModelTransform, inPoints);
|
|
93
|
+
this.treeRef.collectTileGeometry(collector);
|
|
94
|
+
collector.requestMissingTiles();
|
|
95
|
+
if (collector.isAllGeometryLoaded && collector.polyfaces.length > 0) {
|
|
96
|
+
for (const polyface of collector.polyfaces) {
|
|
97
|
+
// Use this to serialize (problematic) polyface
|
|
98
|
+
// console.log (`const polyface = ${JSON.stringify(IModelJson.Writer.toIModelJson(polyface))}`);
|
|
99
|
+
outStrings.push(...core_geometry_1.PolyfaceQuery.sweepLineStringToFacets(inPoints, polyface, core_geometry_1.SweepLineStringToFacetsOptions.create(core_geometry_1.Vector3d.unitZ(), this.sideAngle, true, true, false, false)));
|
|
100
|
+
}
|
|
101
|
+
return "complete";
|
|
102
|
+
}
|
|
103
|
+
return "loading";
|
|
104
|
+
}
|
|
105
|
+
drapeLoop(outMeshes, loop, tolerance, range) {
|
|
106
|
+
const tree = this.treeRef.treeOwner.load();
|
|
107
|
+
if (!tree)
|
|
108
|
+
return "loading";
|
|
109
|
+
const expandedRange = core_geometry_1.Range3d.createFrom(range);
|
|
110
|
+
expandedRange.extendZOnly(-this.maxDistanceZ);
|
|
111
|
+
expandedRange.extendZOnly(this.maxDistanceZ);
|
|
112
|
+
const strokes = loop.getPackedStrokes();
|
|
113
|
+
if (!strokes)
|
|
114
|
+
return "complete";
|
|
115
|
+
const collector = new LineSegmentCollector(this, tolerance, expandedRange, tree.iModelTransform, strokes);
|
|
116
|
+
this.treeRef.collectTileGeometry(collector);
|
|
117
|
+
collector.requestMissingTiles();
|
|
118
|
+
if (collector.isAllGeometryLoaded && collector.polyfaces.length > 0) {
|
|
119
|
+
for (const polyface of collector.polyfaces) {
|
|
120
|
+
const topFacets = this.getMeshTopFacets(polyface);
|
|
121
|
+
const mesh = core_geometry_1.PolyfaceClip.drapeRegion(topFacets, loop);
|
|
122
|
+
if (mesh)
|
|
123
|
+
outMeshes.push(mesh);
|
|
124
|
+
}
|
|
125
|
+
return "complete";
|
|
126
|
+
}
|
|
127
|
+
return "loading";
|
|
128
|
+
}
|
|
129
|
+
drapePoint(outPoint, point, chordTolerance, range) {
|
|
130
|
+
const tree = this.treeRef.treeOwner.load();
|
|
131
|
+
if (!tree)
|
|
132
|
+
return "loading";
|
|
133
|
+
const expandedRange = core_geometry_1.Range3d.createFrom(range);
|
|
134
|
+
expandedRange.extendZOnly(-this.maxDistanceZ);
|
|
135
|
+
expandedRange.extendZOnly(this.maxDistanceZ);
|
|
136
|
+
const collector = new core_frontend_1.TileGeometryCollector({ chordTolerance, range: expandedRange, user: this });
|
|
137
|
+
this.treeRef.collectTileGeometry(collector);
|
|
138
|
+
collector.requestMissingTiles();
|
|
139
|
+
if (collector.isAllGeometryLoaded && collector.polyfaces.length > 0) {
|
|
140
|
+
for (const polyface of collector.polyfaces) {
|
|
141
|
+
// Im assuming a single polyface here since we are draping a single point
|
|
142
|
+
const facetLocation = core_geometry_1.PolyfaceQuery.intersectRay3d(polyface, core_geometry_1.Ray3d.create(point, core_geometry_1.Vector3d.unitZ()));
|
|
143
|
+
if (!facetLocation)
|
|
144
|
+
continue;
|
|
145
|
+
outPoint.setFromPoint3d(facetLocation.point);
|
|
146
|
+
}
|
|
147
|
+
return "complete";
|
|
148
|
+
}
|
|
149
|
+
return "loading";
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
exports.GeometryTerrainDraper = GeometryTerrainDraper;
|
|
153
|
+
//# sour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;QAE7C,MAAM,SAAS,GAAG,IAAI,qCAAqB,CAAC,EAAC,cAAc,EAAE,KAAK,EAAE,aAAa,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;QACjG,IAAI,CAAC,OAAO,CAAC,mBAAmB,CAAC,SAAS,CAAC,CAAC;QAC5C,SAAS,CAAC,mBAAmB,EAAE,CAAC;QAEhC,IAAI,SAAS,CAAC,mBAAmB,IAAI,SAAS,CAAC,SAAS,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACpE,KAAK,MAAM,QAAQ,IAAI,SAAS,CAAC,SAAS,EAAE,CAAC;gBAC3C,yEAAyE;gBACzE,MAAM,aAAa,GAAG,6BAAa,CAAC,cAAc,CAAC,QAAQ,EAAE,qBAAK,CAAC,MAAM,CAAC,KAAK,EAAE,wBAAQ,CAAC,KAAK,EAAE,CAAE,CAAC,CAAC;gBACrG,IAAI,CAAC,aAAa;oBAChB,SAAS;gBACX,QAAQ,CAAC,cAAc,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;YAC/C,CAAC;YACD,OAAO,UAAU,CAAC;QACpB,CAAC;QACD,OAAO,SAAS,CAAC;IACnB,CAAC;CACF;AAtID,sDAsIC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\nimport {\r\n CollectTileStatus, DisclosedTileTreeSet,\r\n GeometryTileTreeReference, IModelApp,\r\n Tile, TileGeometryCollector, TileUser, Viewport } from \"@itwin/core-frontend\";\r\nimport { Angle, ConvexClipPlaneSet, CurvePrimitive, GrowableXYZArray, IndexedPolyface, IndexedPolyfaceSubsetVisitor, Loop, Point3d, Polyface, PolyfaceClip, PolyfaceQuery, PolygonOps, Range3d, Ray3d, SweepLineStringToFacetsOptions, Transform, Vector3d } from \"@itwin/core-geometry\";\r\nimport { Logger } from \"@itwin/core-bentley\";\r\n\r\nconst loggerCategory = \"MapLayersFormats.GeometryTerrainDraper\";\r\n\r\n/** A TileGeometryCollector that restricts collection to tiles that overlap a line string.\r\n/* @internal\r\n*/\r\nclass LineSegmentCollector extends TileGeometryCollector {\r\n private _points: GrowableXYZArray;\r\n\r\n constructor(user: TileUser, chordTolerance: number, range: Range3d, transform: Transform, points: GrowableXYZArray) {\r\n super({ user, chordTolerance, range, transform });\r\n this._points = points;\r\n }\r\n\r\n public override addMissingTile(tile: Tile): void {\r\n Logger.logTrace(loggerCategory, `CollectorAdd missing tile: ${tile.contentId}`);\r\n super.addMissingTile(tile);\r\n }\r\n\r\n public override collectTile(tile: Tile): CollectTileStatus {\r\n let status = super.collectTile(tile);\r\n\r\n if (\"reject\" !== status && !this.rangeOverlapsLineString(tile.range)) {\r\n status = \"reject\";\r\n }\r\n\r\n Logger.logTrace(loggerCategory, `collectTile - tile: ${tile.contentId} status: ${status } isReady: ${tile.isReady} status:${tile.loadStatus}`);\r\n return status;\r\n }\r\n\r\n private rangeOverlapsLineString(range: Range3d) {\r\n let inside = false;\r\n const clipper = ConvexClipPlaneSet.createRange3dPlanes(range, true, true, true, true, false, false);\r\n if (this._options.transform)\r\n clipper.transformInPlace(this._options.transform);\r\n\r\n for (let i = 0; i < this._points.length - 1 && !inside; i++)\r\n inside = clipper.announceClippedSegmentIntervals(0, 1, this._points.getPoint3dAtUncheckedPointIndex(i), this._points.getPoint3dAtUncheckedPointIndex(i + 1));\r\n\r\n return inside;\r\n }\r\n}\r\n\r\n/** @internal */\r\nexport class GeometryTerrainDraper implements TileUser {\r\n // The side angle measures how close the sweep vector is from being parallel to a side face.\r\n // The larger the angle, the more nearly vertical facets are ignored.\r\n // This is an \"empirical\" value that was determined by looking at \"problematic\" polyfaces\r\n public readonly sideAngle = Angle.createDegrees(0.06);\r\n\r\n public readonly maxDistanceZ = 1.0E5; // Expand the Z Range, but not so much that we get opposite side of globe.\r\n public readonly tileUserId: number;\r\n\r\n public constructor(public readonly viewport: Viewport, public readonly treeRef: GeometryTileTreeReference) {\r\n this.tileUserId = TileUser.generateId();\r\n IModelApp.tileAdmin.registerUser(this);\r\n }\r\n\r\n public dispose(): void {\r\n IModelApp.tileAdmin.forgetUser(this);\r\n }\r\n\r\n public get iModel() { return this.viewport.iModel; }\r\n\r\n public onRequestStateChanged() {\r\n this.viewport.invalidateDecorations();\r\n }\r\n\r\n public discloseTileTrees(trees: DisclosedTileTreeSet) {\r\n trees.disclose(this.treeRef);\r\n }\r\n\r\n // Filter out non-top facets:\r\n // For unknown reasons, there are \"perpendicular\" facets appearing in the terrain meshes.\r\n public getMeshTopFacets(mesh: IndexedPolyface) {\r\n // constant inputs\r\n const sweepVector = Vector3d.unitZ();\r\n // i.e., region is horizontal\r\n // create subset visitor from the top facets\r\n const topFacets: number[] = [];\r\n const facetNormal = Vector3d.createZero();\r\n\r\n for (const visitor = mesh.createVisitor(0); visitor.moveToNextFacet(); ) {\r\n if (PolygonOps.unitNormal(visitor.point, facetNormal)) {\r\n const theta = facetNormal.angleFromPerpendicular(sweepVector);\r\n if (!theta.isMagnitudeLessThanOrEqual(this.sideAngle)) { // skip side facet\r\n if (facetNormal.dotProduct(sweepVector) > 0) // this is a top facet\r\n topFacets.push(visitor.currentReadIndex());\r\n }\r\n }\r\n }\r\n\r\n return IndexedPolyfaceSubsetVisitor.createSubsetVisitor(mesh, topFacets, 0);\r\n }\r\n\r\n public drapeLineString(outStrings: CurvePrimitive[], inPoints: GrowableXYZArray, tolerance: number, range: Range3d): \"loading\" | \"complete\" {\r\n const tree = this.treeRef.treeOwner.load();\r\n if (!tree)\r\n return \"loading\";\r\n\r\n const expandedRange = Range3d.createFrom(range);\r\n expandedRange.extendZOnly(-this.maxDistanceZ);\r\n expandedRange.extendZOnly(this.maxDistanceZ);\r\n\r\n const collector = new LineSegmentCollector(this, tolerance, expandedRange, tree.iModelTransform, inPoints);\r\n this.treeRef.collectTileGeometry(collector);\r\n collector.requestMissingTiles();\r\n\r\n if (collector.isAllGeometryLoaded && collector.polyfaces.length > 0) {\r\n\r\n for (const polyface of collector.polyfaces) {\r\n // Use this to serialize (problematic) polyface\r\n // console.log (`const polyface = ${JSON.stringify(IModelJson.Writer.toIModelJson(polyface))}`);\r\n outStrings.push(...PolyfaceQuery.sweepLineStringToFacets(\r\n inPoints,\r\n polyface,\r\n SweepLineStringToFacetsOptions.create(Vector3d.unitZ(), this.sideAngle, true, true, false, false)));\r\n }\r\n\r\n return \"complete\";\r\n }\r\n\r\n return \"loading\";\r\n }\r\n\r\n public drapeLoop(outMeshes: Polyface[], loop: Loop, tolerance: number, range: Range3d): \"loading\" | \"complete\" {\r\n const tree = this.treeRef.treeOwner.load();\r\n if (!tree)\r\n return \"loading\";\r\n\r\n const expandedRange = Range3d.createFrom(range);\r\n expandedRange.extendZOnly(-this.maxDistanceZ);\r\n expandedRange.extendZOnly(this.maxDistanceZ);\r\n\r\n const strokes = loop.getPackedStrokes();\r\n if (!strokes)\r\n return \"complete\";\r\n\r\n const collector = new LineSegmentCollector(this, tolerance, expandedRange, tree.iModelTransform, strokes);\r\n this.treeRef.collectTileGeometry(collector);\r\n collector.requestMissingTiles();\r\n\r\n if (collector.isAllGeometryLoaded && collector.polyfaces.length > 0) {\r\n for (const polyface of collector.polyfaces) {\r\n const topFacets = this.getMeshTopFacets(polyface);\r\n const mesh = PolyfaceClip.drapeRegion(topFacets, loop);\r\n if (mesh)\r\n outMeshes.push(mesh);\r\n }\r\n return \"complete\";\r\n }\r\n return \"loading\";\r\n }\r\n public drapePoint(outPoint: Point3d, point: Point3d, chordTolerance: number, range: Range3d): \"loading\" | \"complete\" {\r\n const tree = this.treeRef.treeOwner.load();\r\n if (!tree)\r\n return \"loading\";\r\n\r\n const expandedRange = Range3d.createFrom(range);\r\n expandedRange.extendZOnly(-this.maxDistanceZ);\r\n expandedRange.extendZOnly(this.maxDistanceZ);\r\n\r\n const collector = new TileGeometryCollector({chordTolerance, range: expandedRange, user: this });\r\n this.treeRef.collectTileGeometry(collector);\r\n collector.requestMissingTiles();\r\n\r\n if (collector.isAllGeometryLoaded && collector.polyfaces.length > 0) {\r\n for (const polyface of collector.polyfaces) {\r\n // Im assuming a single polyface here since we are draping a single point\r\n const facetLocation = PolyfaceQuery.intersectRay3d(polyface, Ray3d.create(point, Vector3d.unitZ() ));\r\n if (!facetLocation)\r\n continue;\r\n outPoint.setFromPoint3d(facetLocation.point);\r\n }\r\n return \"complete\";\r\n }\r\n return \"loading\";\r\n }\r\n}\r\n"]}
|
|
@@ -1,37 +1,42 @@
|
|
|
1
1
|
import { ColorDef } from "@itwin/core-common";
|
|
2
2
|
import { DecorateContext, Decorator } from "@itwin/core-frontend";
|
|
3
|
-
import {
|
|
3
|
+
import { Point2d, Point3d } from "@itwin/core-geometry";
|
|
4
4
|
import { MapFeatureInfoToolData } from "./MapFeatureInfoTool";
|
|
5
5
|
/** @internal */
|
|
6
6
|
export declare class MapFeatureInfoDecorator implements Decorator {
|
|
7
7
|
hidden: boolean;
|
|
8
8
|
readonly useCachedDecorations = true;
|
|
9
|
-
readonly disableTerrainDraper =
|
|
9
|
+
readonly disableTerrainDraper = false;
|
|
10
10
|
markerSize: Point2d;
|
|
11
11
|
lineWidth: number;
|
|
12
|
+
maxDrapeSizePixels: number;
|
|
13
|
+
chordTolerancePixels: number;
|
|
12
14
|
private _highlightColor;
|
|
13
15
|
get highlightColor(): ColorDef;
|
|
14
16
|
set highlightColor(color: ColorDef);
|
|
15
17
|
get defaultMarkerIconSvgXml(): string;
|
|
16
|
-
private _drapePoints;
|
|
17
18
|
private _scratchPoints;
|
|
18
|
-
private
|
|
19
|
-
private
|
|
19
|
+
private _drapeGraphicsStates;
|
|
20
|
+
private _drapedPrimitives;
|
|
20
21
|
private _allGeomDraped;
|
|
21
22
|
private _draper?;
|
|
22
23
|
private _markerImage;
|
|
23
24
|
private _markerSet;
|
|
24
25
|
extraMarkers: Point3d[] | undefined;
|
|
25
|
-
private
|
|
26
|
+
private _data;
|
|
26
27
|
private readonly _graphicType;
|
|
27
28
|
constructor();
|
|
28
29
|
private updateMarkerImage;
|
|
29
|
-
private
|
|
30
|
-
|
|
31
|
-
|
|
30
|
+
private computePixelSize;
|
|
31
|
+
private computeChordTolerance;
|
|
32
|
+
clearData: () => void;
|
|
33
|
+
setData: (data: MapFeatureInfoToolData) => void;
|
|
32
34
|
private getGeometryTreeRef;
|
|
33
35
|
protected renderGraphics(context: DecorateContext): import("@itwin/core-frontend").RenderGraphic | undefined;
|
|
34
|
-
|
|
36
|
+
private initializeDrapeState;
|
|
37
|
+
private drapeGeometries;
|
|
38
|
+
private appendDrapedGeometries;
|
|
39
|
+
private appendGeometries;
|
|
35
40
|
decorate(context: DecorateContext): void;
|
|
36
41
|
}
|
|
37
42
|
//# sourceMappingURL=MapFeatureInfoDecorator.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MapFeatureInfoDecorator.d.ts","sourceRoot":"","sources":["../../../src/Tools/MapFeatureInfoDecorator.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"MapFeatureInfoDecorator.d.ts","sourceRoot":"","sources":["../../../src/Tools/MapFeatureInfoDecorator.ts"],"names":[],"mappings":"AAIA,OAAO,EAAuB,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AACnE,OAAO,EACmB,eAAe,EAAE,SAAS,EAGrB,MAAM,sBAAsB,CAAC;AAC5D,OAAO,EAAkC,OAAO,EAAE,OAAO,EAA+C,MAAM,sBAAsB,CAAC;AACrI,OAAO,EAAE,sBAAsB,EAAE,MAAM,sBAAsB,CAAC;AAkG9D,gBAAgB;AAChB,qBAAa,uBAAwB,YAAW,SAAS;IAChD,MAAM,UAAS;IACtB,SAAgB,oBAAoB,QAAQ;IAC5C,SAAgB,oBAAoB,SAAS;IACtC,UAAU,UAAuB;IACjC,SAAS,SAAM;IAIf,kBAAkB,SAAS;IAI3B,oBAAoB,SAAM;IAEjC,OAAO,CAAC,eAAe,CAAmC;IAC1D,IAAW,cAAc,IACQ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