Remove precomputed style properties

This commit is contained in:
wpetit 2021-01-25 10:26:48 +01:00
parent 988ec50368
commit f60a97b8f8
5 changed files with 7 additions and 17 deletions

View File

@ -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);

View File

@ -48,7 +48,7 @@ export class Converter {
],
featureMapper: (feature, opts) => feature,
colorOpts: {
hue: 'monochrome',
hue: 'blue',
luminosity: 'dark',
seed: 1,
},

View File

@ -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 {

View File

@ -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) {

View File

@ -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);