Skip to content

Commit

Permalink
Add polylineWidth param to set line width
Browse files Browse the repository at this point in the history
  • Loading branch information
glughi committed Nov 11, 2024
1 parent 43a726b commit 2c21a65
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
4 changes: 2 additions & 2 deletions lib/ModelMixins/GeojsonMixin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -857,7 +857,7 @@ function GeoJsonMixin<T extends AbstractConstructor<BaseType>>(Base: T) {
color: useOutlineColorForLineFeatures
? getOutlineColorValue
: getColorValue,
width: getOutlineWidthValue
width: this.terria.configParameters.polylineWidth ?? getOutlineWidthValue
}),
minzoom: 0,
maxzoom: Infinity,
Expand Down Expand Up @@ -1076,7 +1076,7 @@ function GeoJsonMixin<T extends AbstractConstructor<BaseType>>(Base: T) {
polygonStroke: getColor(this.terria.baseMapContrastColor),
polylineStroke: getRandomCssColor(this.name ?? ""),
markerStrokeWidth: 1,
polylineStrokeWidth: 2,
polylineStrokeWidth: this.terria.configParameters.polylineWidth ?? 2,
polygonStrokeWidth: 1,
fill: getRandomCssColor((this.name ?? "") + " fill"),
fillAlpha: 0.75
Expand Down
1 change: 1 addition & 0 deletions lib/Models/Catalog/CatalogItems/KmlCatalogItem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ class KmlCatalogItem

// Clamp to ground
if (isDefined(entity.polyline)) {
entity.polyline.width = new ConstantProperty(this.terria.configParameters.polylineWidth ?? 2);
entity.polyline.clampToGround = new ConstantProperty(true);
entity.polyline.arcType = new ConstantProperty(ArcType.GEODESIC);
} else if (isDefined(entity.billboard)) {
Expand Down
8 changes: 7 additions & 1 deletion lib/Models/Terria.ts
Original file line number Diff line number Diff line change
Expand Up @@ -423,6 +423,11 @@ export interface ConfigParameters {
* CSS color of Cesium globe (see doc of Cesium.Color.fromCssColorString)
*/
cesiumGlobeColor?: string;

/**
* Polyline width for KML and GeoJson (and derived)
*/
polylineWidth?: number;
}

interface StartOptions {
Expand Down Expand Up @@ -660,7 +665,8 @@ export default class Terria {
useElevationMeanSeaLevel: false,
mapViewers: ["3d", "3dsmooth", "2d"],
pickSize: undefined,
cesiumGlobeColor: undefined
cesiumGlobeColor: undefined,
polylineWidth: undefined
};

@observable
Expand Down

0 comments on commit 2c21a65

Please sign in to comment.