From f60a97b8f8f5633554aed688d0f338cb408423a4 Mon Sep 17 00:00:00 2001 From: William Petit Date: Mon, 25 Jan 2021 10:26:48 +0100 Subject: [PATCH] Remove precomputed style properties --- lib/cg-point.js | 5 +---- lib/converter.js | 2 +- lib/parcel.js | 3 ++- lib/pipe-network.js | 9 ++------- lib/surface.js | 5 +---- 5 files changed, 7 insertions(+), 17 deletions(-) diff --git a/lib/cg-point.js b/lib/cg-point.js index 1e464a0..8d4d405 100644 --- a/lib/cg-point.js +++ b/lib/cg-point.js @@ -32,10 +32,7 @@ export function convertCGPoints(xmlObj, projection, opts) { name: name, description: description, landxmlType: LANDXML_POINT, - "stroke-width": 0, - "color": "transparent", - "fill": getColor(`point-${name}`, opts.colorOpts), - "fill-opacity": 0.3, + landxmlColor: getColor(`point-${name}`, opts.colorOpts), }; const pointFeature = convertPoint(p, projection, featureProps, opts); diff --git a/lib/converter.js b/lib/converter.js index e914e15..d1ec839 100644 --- a/lib/converter.js +++ b/lib/converter.js @@ -48,7 +48,7 @@ export class Converter { ], featureMapper: (feature, opts) => feature, colorOpts: { - hue: 'monochrome', + hue: 'blue', luminosity: 'dark', seed: 1, }, diff --git a/lib/parcel.js b/lib/parcel.js index bdf9313..e5a0036 100644 --- a/lib/parcel.js +++ b/lib/parcel.js @@ -1,4 +1,4 @@ -import { getProp, parseSequence } from './util' +import { getProp, parseSequence, getColor } from './util' import { polygon } from '@turf/helpers'; import proj4 from 'proj4'; @@ -63,6 +63,7 @@ export function convertParcels(xmlObj, projection, opts) { landxmlState: opc.$.state, landxmlParcelType: opc.$.parcelType, landxmlType: LANDXML_PARCEL, + landxmlColor: getColor(`parcel-${name}`, opts.colorOpts), } polygons.push(polygon(coords, parameters)) } else { diff --git a/lib/pipe-network.js b/lib/pipe-network.js index 1bd6265..6c88e42 100644 --- a/lib/pipe-network.js +++ b/lib/pipe-network.js @@ -28,8 +28,6 @@ export function convertPipeNetworks(xmlObj, projection, opts) { const baseProps = { name: pn.$.name, description: pn.$.desc, - "stroke-width": 0.1, - "fill-opacity": 0.5, }; const localStructs = convertStructs(pn, projection, baseProps, opts); @@ -41,13 +39,10 @@ export function convertPipeNetworks(xmlObj, projection, opts) { }); pipeNetworkNodes.forEach(pn => { - const baseProps = { name: pn.$.name, description: pn.$.desc, landxmlType: LANDXML_PIPE_NETWORK_PIPE, - "stroke-width": 1, - "fill-opacity": 1, }; const pipes = convertPipes(pn, structs, projection, baseProps, opts); @@ -78,7 +73,7 @@ function convertPipes(pipeNetwork, structs, projection, baseProps, opts) { const featureProps = Object.assign({}, baseProps, { name: name, description: baseProps.description ? baseProps.description + ' - ' + p.$.desc : p.$.desc, - stroke: getColor(`pipe-network-pipe-${name}`, opts.colorOpts) + landxmlColor: getColor(`pipe-network-pipe-${name}`, opts.colorOpts) }); if (circPipeNode !== undefined) { @@ -138,7 +133,7 @@ function convertStructs(pipeNetwork, projection, baseProps, opts) { landxmlStruct: structType, landxmlElevRim: 'elevRim' in s.$ ? parseFloat(s.$.elevRim) : undefined, landxmlElevSump: 'elevSump' in s.$ ? parseFloat(s.$.elevSump) : undefined, - fill: getColor(`pipe-network-struct-${name}`, opts.colorOpts) + landxmlColor: getColor(`pipe-network-struct-${name}`, opts.colorOpts) }); if (circStructNode !== undefined) { diff --git a/lib/surface.js b/lib/surface.js index 9f7e114..381ec13 100644 --- a/lib/surface.js +++ b/lib/surface.js @@ -33,10 +33,7 @@ export function convertSurfaces(xmlObj, projection, opts) { name: name, description: description, landxmlType: LANDXML_SURFACE, - "stroke-width": 0, - "color": "transparent", - "fill": getColor(`surface-${name}`, opts.colorOpts), - "fill-opacity": 0.3, + landxmlColor: getColor(`surface-${name}`, opts.colorOpts), }; let surfaceFeatures = convertBoundaries(s, projection, featureProps, opts);