Adapt style for Map reader (point, line)
This commit is contained in:
parent
1d6b396d8b
commit
474521c841
4 changed files with 56 additions and 22 deletions
|
@ -9,7 +9,8 @@ const SwitchMapStyle = ({ isVector }) => {
|
||||||
|
|
||||||
const imgStyle = {
|
const imgStyle = {
|
||||||
width: '100%',
|
width: '100%',
|
||||||
height: '100%'
|
height: '100%',
|
||||||
|
cursor: 'pointer'
|
||||||
};
|
};
|
||||||
|
|
||||||
const textStyle = {
|
const textStyle = {
|
||||||
|
@ -24,11 +25,6 @@ const SwitchMapStyle = ({ isVector }) => {
|
||||||
<div className="text" style={textStyle}>
|
<div className="text" style={textStyle}>
|
||||||
{style}
|
{style}
|
||||||
</div>
|
</div>
|
||||||
<style jsx>{`
|
|
||||||
img:hover {
|
|
||||||
cursor: pointer;
|
|
||||||
}
|
|
||||||
`}</style>
|
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
|
@ -12,25 +12,25 @@ const MapReader = ({ featureCollection }) => {
|
||||||
[b1, b2]
|
[b1, b2]
|
||||||
];
|
];
|
||||||
|
|
||||||
const selectionsFeatureCollection = {
|
|
||||||
type: 'FeatureCollection',
|
|
||||||
features: []
|
|
||||||
};
|
|
||||||
const cadastresFeatureCollection = {
|
const cadastresFeatureCollection = {
|
||||||
type: 'FeatureCollection',
|
type: 'FeatureCollection',
|
||||||
features: []
|
features: []
|
||||||
};
|
};
|
||||||
|
|
||||||
for (let feature of featureCollection.features) {
|
const selectionsLineFeatureCollection = {
|
||||||
switch (feature.properties.source) {
|
type: 'FeatureCollection',
|
||||||
case 'selection_utilisateur':
|
features: []
|
||||||
selectionsFeatureCollection.features.push(feature);
|
};
|
||||||
break;
|
|
||||||
case 'cadastre':
|
const selectionsPolygonFeatureCollection = {
|
||||||
cadastresFeatureCollection.features.push(feature);
|
type: 'FeatureCollection',
|
||||||
break;
|
features: []
|
||||||
}
|
};
|
||||||
}
|
|
||||||
|
const selectionsPointFeatureCollection = {
|
||||||
|
type: 'FeatureCollection',
|
||||||
|
features: []
|
||||||
|
};
|
||||||
|
|
||||||
const polygonSelectionFill = {
|
const polygonSelectionFill = {
|
||||||
'fill-color': '#EC3323',
|
'fill-color': '#EC3323',
|
||||||
|
@ -42,6 +42,15 @@ const MapReader = ({ featureCollection }) => {
|
||||||
'line-width': 4
|
'line-width': 4
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const lineStringSelectionLine = {
|
||||||
|
'line-color': 'rgba(55, 42, 127, 1.00)',
|
||||||
|
'line-width': 3
|
||||||
|
};
|
||||||
|
|
||||||
|
const pointSelectionFill = {
|
||||||
|
'circle-color': '#EC3323'
|
||||||
|
};
|
||||||
|
|
||||||
const polygonCadastresFill = {
|
const polygonCadastresFill = {
|
||||||
'fill-color': '#9CA090',
|
'fill-color': '#9CA090',
|
||||||
'fill-opacity': 0.5
|
'fill-opacity': 0.5
|
||||||
|
@ -53,6 +62,27 @@ const MapReader = ({ featureCollection }) => {
|
||||||
'line-dasharray': [1, 1]
|
'line-dasharray': [1, 1]
|
||||||
};
|
};
|
||||||
|
|
||||||
|
for (let feature of featureCollection.features) {
|
||||||
|
switch (feature.properties.source) {
|
||||||
|
case 'selection_utilisateur':
|
||||||
|
switch (feature.geometry.type) {
|
||||||
|
case 'LineString':
|
||||||
|
selectionsLineFeatureCollection.features.push(feature);
|
||||||
|
break;
|
||||||
|
case 'Polygon':
|
||||||
|
selectionsPolygonFeatureCollection.features.push(feature);
|
||||||
|
break;
|
||||||
|
case 'Point':
|
||||||
|
selectionsPointFeatureCollection.features.push(feature);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 'cadastre':
|
||||||
|
cadastresFeatureCollection.features.push(feature);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (!mapboxgl.supported()) {
|
if (!mapboxgl.supported()) {
|
||||||
return (
|
return (
|
||||||
<p>
|
<p>
|
||||||
|
@ -74,10 +104,18 @@ const MapReader = ({ featureCollection }) => {
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<GeoJSONLayer
|
<GeoJSONLayer
|
||||||
data={selectionsFeatureCollection}
|
data={selectionsPolygonFeatureCollection}
|
||||||
fillPaint={polygonSelectionFill}
|
fillPaint={polygonSelectionFill}
|
||||||
linePaint={polygonSelectionLine}
|
linePaint={polygonSelectionLine}
|
||||||
/>
|
/>
|
||||||
|
<GeoJSONLayer
|
||||||
|
data={selectionsLineFeatureCollection}
|
||||||
|
linePaint={lineStringSelectionLine}
|
||||||
|
/>
|
||||||
|
<GeoJSONLayer
|
||||||
|
data={selectionsPointFeatureCollection}
|
||||||
|
circlePaint={pointSelectionFill}
|
||||||
|
/>
|
||||||
<GeoJSONLayer
|
<GeoJSONLayer
|
||||||
data={cadastresFeatureCollection}
|
data={cadastresFeatureCollection}
|
||||||
fillPaint={polygonCadastresFill}
|
fillPaint={polygonCadastresFill}
|
|
@ -1,3 +1,3 @@
|
||||||
import Loadable from '../components/Loadable';
|
import Loadable from '../components/Loadable';
|
||||||
|
|
||||||
export default Loadable(() => import('../components/MapEditor/MapEditor'));
|
export default Loadable(() => import('../components/MapEditor'));
|
||||||
|
|
Loading…
Reference in a new issue