Compare commits

...

2 Commits

Author SHA1 Message Date
wpetit 9c143649a2 Reset style GeoJSON preview example 2021-01-25 10:29:56 +01:00
wpetit f60a97b8f8 Remove precomputed style properties 2021-01-25 10:26:48 +01:00
6 changed files with 12 additions and 22 deletions

View File

@ -116,10 +116,10 @@
geojsonLayer = L.geoJSON(geojson, {
style: feature => {
return {
color: feature.properties.color,
fillColor: feature.properties.fill,
fillOpacity: feature.properties['fill-opacity'],
weight: feature.properties['stroke-width'],
color: feature.properties.landxmlColor,
fillColor: feature.properties.landxmlColor,
fillOpacity: 0.5,
weight: 1,
}
},
onEachFeature: (f, l) => {
@ -141,7 +141,7 @@
if(feature.geometry.type !== 'Point') {
// Style selected
selectedFeature.setStyle({
'fillColor': 'blue'
'fillOpacity': 0.9
})
}

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