ofs-object 0.1.5 → 0.1.6

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/README.md CHANGED
@@ -302,6 +302,10 @@ initMap();
302
302
  </script>
303
303
  ```
304
304
 
305
+ > `mount()` ตกแต่งหน้าตาของ console อย่างเดียว **ไม่จัดตำแหน่งให้** — วาง element `console-mount` ตาม layout
306
+ > ของหน้าเอง หรือใส่ class `ofs-console-floating` ให้ลอยชิดล่างของ parent ที่ `position: relative`
307
+ > (ก่อน 0.1.6 ไลบรารีบังคับ `position: absolute; left: 80px; right: 420px` ซึ่งเป็นขนาดของ playground)
308
+
305
309
  ---
306
310
 
307
311
  ### React
package/dist/index.d.ts CHANGED
@@ -366,7 +366,17 @@ export declare abstract class BaseGLAdapter implements IMapAdapter {
366
366
  protected setupMapEventListeners(): void;
367
367
  /** undefined = not worked out yet for the current style */
368
368
  private styleFontCache;
369
+ /**
370
+ * Font for text when the basemap names none - a satellite or OSM raster basemap has no labels to
371
+ * read one from. It must exist on the style's glyph server. null leaves the engine default
372
+ * ("Open Sans Regular"), which many glyph servers do not have.
373
+ */
374
+ private fallbackFont;
375
+ /** Set before `init()` / `attach()` to apply everywhere; set later, labels already drawn are redone */
376
+ setFallbackFont(font: string[] | null): void;
377
+ /** The basemap's own label font; else the fallback font; else null */
369
378
  getStyleFont(): string[] | null;
379
+ private readStyleFont;
370
380
  getRawMap<T = any>(): T;
371
381
  /**
372
382
  * Take every source and layer this adapter added off a map it does not own, so the host is
@@ -593,6 +603,8 @@ export declare interface CategoricalFieldStats {
593
603
  export declare interface CategoricalThemeOptions {
594
604
  reverse?: boolean;
595
605
  baseSymbol?: SymbolStyleInput;
606
+ /** Keep categories that no feature has any more when reclassifying (see ThematicDefinition) */
607
+ keepEmptyCategories?: boolean;
596
608
  }
597
609
 
598
610
  /**
@@ -1779,10 +1791,12 @@ export declare interface IMapAdapter {
1779
1791
  getRawMap<T = any>(): T;
1780
1792
  /**
1781
1793
  * 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.
1794
+ * glyph server has; when the style names none (a raster basemap), the fallback font; else null.
1795
+ * Optional: an adapter without it gets the engine default font.
1784
1796
  */
1785
1797
  getStyleFont?(): string[] | null;
1798
+ /** Font to use when the basemap names none; it must exist on the style's glyph server */
1799
+ setFallbackFont?(font: string[] | null): void;
1786
1800
  /** Cleanup */
1787
1801
  destroy(): void;
1788
1802
  }
@@ -2903,7 +2917,7 @@ export declare class OFSDataSource extends TypedEventEmitter<OFSDataSourceEvents
2903
2917
  setLayerGroupVisibility(groupId: string, visible: boolean): void;
2904
2918
  /** Move a layer into a group (null = top level) */
2905
2919
  moveLayerToGroup(layerId: string, groupId: string | null): void;
2906
- /** True when the layer is inside the group, directly or through sub-groups */
2920
+ /** True when the layer (of either kind) is inside the group, directly or through sub-groups */
2907
2921
  isLayerInGroup(layerId: string, groupId: string): boolean;
2908
2922
  /** A layer of either kind is drawn when it and all of its parent groups are visible */
2909
2923
  isLayerRendered(layerId: string): boolean;
@@ -3954,8 +3968,14 @@ export declare class OFSLegendTools extends TypedEventEmitter<LegendEvents> {
3954
3968
  * Notify subscribers of a state change
3955
3969
  */
3956
3970
  notifyUpdate(): void;
3971
+ /** A legend row of either kind: a feature layer or a tile layer */
3972
+ private findRow;
3957
3973
  toggleLayerVisibility(layerId: string): void;
3958
3974
  setLayerOpacity(layerId: string, opacity: number): void;
3975
+ /**
3976
+ * Make a layer the one new features go into. A tile layer cannot hold features, so choosing one -
3977
+ * clicking a basemap row in the legend, say - is ignored rather than an error.
3978
+ */
3959
3979
  setActiveLayer(layerId: string): void;
3960
3980
  toggleLayerPinned(layerId: string): void;
3961
3981
  /** Move a layer one place up among its siblings in the legend tree (above a sibling group as a whole) */
@@ -4111,6 +4131,12 @@ export declare interface OFSObjectConfig {
4111
4131
  * with `consoleWidget.submit(text)` and render the `console:line` / `console:prompt` events.
4112
4132
  */
4113
4133
  console?: IOFSConsole;
4134
+ /**
4135
+ * Font for labels and drawing guides when the basemap has no labels to take one from - satellite
4136
+ * imagery, OSM raster tiles. It must exist on the style's glyph server, e.g. `['Noto Sans Regular']`
4137
+ * for OpenFreeMap. A basemap that has labels still wins: its font is known to exist.
4138
+ */
4139
+ fallbackFont?: string[];
4114
4140
  }
4115
4141
 
4116
4142
  export declare interface OFSProjectFile {
@@ -4178,6 +4204,8 @@ export declare class OFSSymbologyPanel {
4178
4204
  private options;
4179
4205
  /** Renderer settings chosen in the form but not yet applied with "Classify" */
4180
4206
  private draft;
4207
+ /** Last real color of each color control, so switching "no color" off restores it */
4208
+ private colorMemory;
4181
4209
  constructor(legendTools: OFSLegendTools, options?: SymbologyPanelOptions);
4182
4210
  mount(target: HTMLElement | string): void;
4183
4211
  unmount(): void;
@@ -4189,6 +4217,9 @@ export declare class OFSSymbologyPanel {
4189
4217
  private render;
4190
4218
  /** Labels tab: field or expression, size, colour, halo and zoom range */
4191
4219
  private renderLabels;
4220
+ private colorKey;
4221
+ /** Color picker plus a "no color" (transparent) toggle */
4222
+ private colorControl;
4192
4223
  private renderClassification;
4193
4224
  private renderClassTable;
4194
4225
  private dashSelect;
@@ -4196,6 +4227,8 @@ export declare class OFSSymbologyPanel {
4196
4227
  private classify;
4197
4228
  private handleClick;
4198
4229
  private handleChange;
4230
+ /** Apply a form control's value (or an override, e.g. "no color") to the layer */
4231
+ private apply;
4199
4232
  }
4200
4233
 
4201
4234
  export declare class OFSThematicEngine extends TypedEventEmitter<ThematicEvents> {
@@ -5442,6 +5475,12 @@ export declare interface ThematicDefinition {
5442
5475
  enableSelectionHighlight?: boolean;
5443
5476
  /** Labels drawn for this layer */
5444
5477
  label?: LabelSettings;
5478
+ /**
5479
+ * Categorised: keep categories no feature has when the theme is reclassified, instead of dropping
5480
+ * them. For a fixed colour table - crop types, land-use codes - that should read the same whether or
5481
+ * not this season's data has every value yet.
5482
+ */
5483
+ keepEmptyCategories?: boolean;
5445
5484
  }
5446
5485
 
5447
5486
  export declare interface ThematicEngineOptions {