ofs-object 0.1.4 → 0.1.5
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/dist/index.d.ts +37 -19
- package/dist/ofs-object.cjs +121 -120
- package/dist/ofs-object.js +9212 -9128
- package/docs/API.md +26 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -364,6 +364,9 @@ export declare abstract class BaseGLAdapter implements IMapAdapter {
|
|
|
364
364
|
*/
|
|
365
365
|
protected listen(event: string, handler: (e: any) => void): void;
|
|
366
366
|
protected setupMapEventListeners(): void;
|
|
367
|
+
/** undefined = not worked out yet for the current style */
|
|
368
|
+
private styleFontCache;
|
|
369
|
+
getStyleFont(): string[] | null;
|
|
367
370
|
getRawMap<T = any>(): T;
|
|
368
371
|
/**
|
|
369
372
|
* Take every source and layer this adapter added off a map it does not own, so the host is
|
|
@@ -406,27 +409,18 @@ export declare function bulgePoints(p1: Position, p2: Position, bulge: number, m
|
|
|
406
409
|
export declare function bulgeThroughPoint(start: Coordinate, through: Coordinate, end: Coordinate, projection?: PlanarProjection): number;
|
|
407
410
|
|
|
408
411
|
export declare class CADOperations {
|
|
409
|
-
/**
|
|
410
|
-
* Split a Polygon using a LineString.
|
|
411
|
-
* Creates a hairline buffer "blade" to perform difference, then flattens into pieces.
|
|
412
|
-
*/
|
|
413
|
-
/**
|
|
414
|
-
* Extend a ray from startPt through endPt until safely outside the polygon's bounding box.
|
|
415
|
-
* Uses Cartesian unit vector in coordinate space to avoid spherical bearing drift.
|
|
416
|
-
*/
|
|
417
|
-
private static extendRayOutside;
|
|
418
|
-
/**
|
|
419
|
-
* Prepare cutting line: ensures head and tail pierce outside the polygon if they stop inside.
|
|
420
|
-
* The cutting line is ALWAYS kept as a single continuous LineString (never decomposed into separate rays).
|
|
421
|
-
*/
|
|
422
|
-
private static prepareCuttingLine;
|
|
423
412
|
/**
|
|
424
413
|
* Split a single Polygon by a single LineString using planar graph noded polygonization.
|
|
425
414
|
*/
|
|
426
415
|
private static splitSinglePolygonByLine;
|
|
427
416
|
/**
|
|
428
|
-
* Split a Polygon using a LineString.
|
|
429
|
-
*
|
|
417
|
+
* Split a Polygon using a LineString. Returns null when the line does not cut it.
|
|
418
|
+
*
|
|
419
|
+
* The line has to cross the polygon from one side to the other, as in QGIS. An end that stops
|
|
420
|
+
* inside used to be carried on in a straight line - 1.5 times the polygon's diagonal, worked out in
|
|
421
|
+
* degrees - so a line that only poked in still cut, along a path nobody drew. Now it does not cut.
|
|
422
|
+
* An end on the boundary is fine, snapped or computed onto an edge: that is a crossing, and the
|
|
423
|
+
* noding below finds it without any extension.
|
|
430
424
|
*/
|
|
431
425
|
static splitPolygonByLine(polygon: Feature<Polygon | MultiPolygon>, cuttingLine: Feature<LineString>): Feature<Polygon>[] | null;
|
|
432
426
|
/**
|
|
@@ -1248,8 +1242,11 @@ export declare interface DrawGuideSettings {
|
|
|
1248
1242
|
angles: boolean;
|
|
1249
1243
|
/** How far off the segment the dimension line sits, in screen pixels */
|
|
1250
1244
|
dimensionOffsetPixels: number;
|
|
1251
|
-
/**
|
|
1252
|
-
|
|
1245
|
+
/**
|
|
1246
|
+
* Glyph font stack for the labels; the map style's glyph server must have it. null (the default)
|
|
1247
|
+
* uses the font the basemap's own labels use - see `IMapAdapter.getStyleFont`.
|
|
1248
|
+
*/
|
|
1249
|
+
font: string[] | null;
|
|
1253
1250
|
}
|
|
1254
1251
|
|
|
1255
1252
|
/** Minimal 2D context surface used by the drawing helpers (so they can be tested without a DOM) */
|
|
@@ -1780,6 +1777,12 @@ export declare interface IMapAdapter {
|
|
|
1780
1777
|
setDoubleClickZoom(enabled: boolean): void;
|
|
1781
1778
|
/** Raw map engine access */
|
|
1782
1779
|
getRawMap<T = any>(): T;
|
|
1780
|
+
/**
|
|
1781
|
+
* The glyph font stack the basemap's own labels use, so text added on top is drawn in a font its
|
|
1782
|
+
* glyph server has. Null when the style names none. Optional: an adapter without it gets the
|
|
1783
|
+
* engine default font.
|
|
1784
|
+
*/
|
|
1785
|
+
getStyleFont?(): string[] | null;
|
|
1783
1786
|
/** Cleanup */
|
|
1784
1787
|
destroy(): void;
|
|
1785
1788
|
}
|
|
@@ -2975,6 +2978,8 @@ export declare class OFSDataSource extends TypedEventEmitter<OFSDataSourceEvents
|
|
|
2975
2978
|
* Create buffer around feature and add as new feature or replace
|
|
2976
2979
|
*/
|
|
2977
2980
|
buffer(layerId: string, featureId: string | number, distance: number, units?: turf.Units, targetLayerId?: string): Feature<Polygon | MultiPolygon>;
|
|
2981
|
+
/** The polygon layer that buffers of a line or point layer go into, created on first use */
|
|
2982
|
+
private bufferLayerFor;
|
|
2978
2983
|
/**
|
|
2979
2984
|
* Calculate polygon area in square meters or hectares
|
|
2980
2985
|
*/
|
|
@@ -3508,7 +3513,6 @@ export declare class OFSDrawTools extends TypedEventEmitter<DrawEvents> {
|
|
|
3508
3513
|
result: Feature<Geometry>;
|
|
3509
3514
|
};
|
|
3510
3515
|
private replaceLineWithPieces;
|
|
3511
|
-
private safeRawMap;
|
|
3512
3516
|
/** Segments of all visible features except `exclude` (used as cutting edges / boundaries) */
|
|
3513
3517
|
private boundarySegments;
|
|
3514
3518
|
/**
|
|
@@ -3590,6 +3594,8 @@ export declare class OFSDrawTools extends TypedEventEmitter<DrawEvents> {
|
|
|
3590
3594
|
* in any mode), then the active drawing mode, and nothing at all when no tool is running.
|
|
3591
3595
|
*/
|
|
3592
3596
|
private applyCursor;
|
|
3597
|
+
/** The font the guide labels are drawn in: the one set, else the basemap's, else the engine default */
|
|
3598
|
+
private guideFont;
|
|
3593
3599
|
/** Current guide settings (a copy: change them through `setGuides`) */
|
|
3594
3600
|
getGuides(): DrawGuideSettings;
|
|
3595
3601
|
/**
|
|
@@ -4235,6 +4241,13 @@ export declare class OFSThematicEngine extends TypedEventEmitter<ThematicEvents>
|
|
|
4235
4241
|
exportThemes(): ThematicDefinition[];
|
|
4236
4242
|
/** Restore themes saved with exportThemes */
|
|
4237
4243
|
importThemes(themes: ThematicDefinition[]): void;
|
|
4244
|
+
/**
|
|
4245
|
+
* Settings that belong to the layer rather than to the way it is classified, carried over when the
|
|
4246
|
+
* renderer changes. In QGIS labels are a tab of their own and switching Single / Categorized /
|
|
4247
|
+
* Graduated never touches them; here switching used to drop them, along with the selection
|
|
4248
|
+
* highlight colour.
|
|
4249
|
+
*/
|
|
4250
|
+
private carriedLayerSettings;
|
|
4238
4251
|
private carriedSymbol;
|
|
4239
4252
|
/**
|
|
4240
4253
|
* Create a simple uniform color theme
|
|
@@ -4257,6 +4270,11 @@ export declare class OFSThematicEngine extends TypedEventEmitter<ThematicEvents>
|
|
|
4257
4270
|
* symbol overrides are kept where the same category value / class position still exists.
|
|
4258
4271
|
*/
|
|
4259
4272
|
reclassify(layer: OFSLayerData): ThematicDefinition | undefined;
|
|
4273
|
+
/**
|
|
4274
|
+
* The first colour of `palette` that is clearly different from every colour in `inUse`; when the
|
|
4275
|
+
* palette has none left, the colour furthest from them all.
|
|
4276
|
+
*/
|
|
4277
|
+
private unusedClassColor;
|
|
4260
4278
|
private createCategoricalThemeData;
|
|
4261
4279
|
/**
|
|
4262
4280
|
* Merge changes into the base symbol (creates a simple theme when the layer has none)
|