Compare commits

..

No commits in common. "ae42ed2c8452b51964f7392fd86a9a8b50e5e612" and "ee019effd7a057bb407a1a290d114c061ed11763" have entirely different histories.

4 changed files with 46 additions and 177 deletions

View File

@ -373,7 +373,7 @@ const map = {
layerVisible = { layerVisible = {
RealDrpLayer: false, RealDrpLayer: false,
RealHDLayer: false, RealHDLayer: false,
RealSkLayer: false, RealSkLayer: true,
BxSkLayer: false, BxSkLayer: false,
FzdxLayer: false, FzdxLayer: false,
WataLayer: false, WataLayer: false,

View File

@ -14,16 +14,6 @@ import DpTableRow from '../../../../layouts/mui/DpTableRow';
import clsx from 'clsx'; import clsx from 'clsx';
import { renderDrp } from '../../../../utils/renutils'; import { renderDrp } from '../../../../utils/renutils';
const DRP_COLORS = [
'#ffffff',
'rgb(122, 232, 122)',
'rgb(227, 255, 83)',
'rgb(255, 140, 83)',
'rgb(255, 0, 0)',
'rgb(232, 122, 219)',
'rgb(136, 11, 29)',
]
const data1 = [ const data1 = [
{ {
"stcd": "61612150", "stcd": "61612150",
@ -877,40 +867,21 @@ function DrpReal({ style }) {
useEffect(()=>{ useEffect(()=>{
getDrp(skObj) getDrp(skObj)
getHd(skObj) getHd(skObj)
return ()=>{
const map = window.__mapref;
const layer = map.getLayer('关联站点')
if(layer){
map.removeLayer('关联站点');
map.removeSource('关联站点');
}
}
},[skObj]) },[skObj])
useEffect(()=>{ useEffect(()=>{
const map = window.__mapref; const map = window.__mapref;
if(map){ if(map){
if(tab==='1'&&drpData){ if(tab==='1'&&drpData?.length>0){
setLayer(drpData,'drp') setLayer(drpData,'drp')
} }
if(tab==='2'&&hdData){
setLayer(hdData,'hd')
}
}else{
const dsq = setInterval(() => {
const map = window.__mapref;
if(map && drpData.length>0){
clearInterval(dsq)
setLayer(drpData,'drp')
}
}, 500);
} }
},[drpData,hdData,skObj,tab]) },[drpData,hdData,skObj,tab])
const getDrp = async(skObj)=>{ const getDrp = async(skObj)=>{
const { lgtd, lttd } = skObj const { lgtd, lttd } = skObj
const step = 0.05 const step = 0.05
@ -958,74 +929,14 @@ function DrpReal({ style }) {
} }
const setLayer = (data=[],type)=>{ const setLayer = (data=[],type)=>{
if(data.length===0){return}
const map = window.__mapref; const map = window.__mapref;
const layer = map.getLayer('关联站点') const layer = map.getLayer('关联站点')
if(layer){ if(layer){
map.removeLayer('关联站点'); map.removeLayer('关联站点');
map.removeSource('关联站点'); map.removeSource('关联站点');
} }
if(data.length===0){return} map.addLayer({
if(type==='drp'){
map.addLayer({
'id': '关联站点',//+new Date().getTime(),
'type': 'circle',
'source': {
'type': 'geojson',
'data': {
'type': 'FeatureCollection',
'features': [],
},
},
'paint': {
'circle-color': [
'case',
['==', ['get', 'state'], 1], [
'interpolate-hcl',
['linear'],
['get', 'h1'],
0, DRP_COLORS[0],
10, DRP_COLORS[1],
25, DRP_COLORS[2],
50, DRP_COLORS[3],
100, DRP_COLORS[4],
250, DRP_COLORS[5],
500, DRP_COLORS[6],
],
'#aaa'
],
'circle-opacity': [
'case',
['==', ['get', 'state'], 1], 1,
0.6
],
'circle-stroke-width': [
'step',
['zoom'],
0,
12, 2,
14, 3
],
'circle-stroke-color': [
'match',
['get', 'type'],
'sh', '#91eda1',
'sw', '#f8ec82',
'qx', '#e091ed',
'#fff'
],
'circle-radius': [
'interpolate',
['linear'],
['zoom'],
10, 6,
14, 10,
]
},
'visibility': 'visible',
});
}
if(type==='hd'){
map.addLayer({
'id': '关联站点',//+new Date().getTime(), 'id': '关联站点',//+new Date().getTime(),
'type': 'symbol', 'type': 'symbol',
'source': { 'source': {
@ -1036,36 +947,35 @@ function DrpReal({ style }) {
}, },
}, },
'layout': { 'layout': {
'icon-allow-overlap': true, // 'icon-allow-overlap': true,
'text-allow-overlap': true, // 'text-allow-overlap': true,
'icon-image': '水位站', 'icon-image': '水库-离线', // 从properties中动态读取icon字段
'icon-size': [ 'icon-size': [
'interpolate', ['linear'], ['zoom'],
10, 0.6,
14, 0.6,
],
'text-size': [
'interpolate', ['linear'], ['zoom'], 'interpolate', ['linear'], ['zoom'],
10, 0.5, 5, 10,
14, 1, 14, 14,
], ],
'text-size': [ 'text-font': ['Roboto Black'],
'interpolate', ['linear'], ['zoom'], 'text-field': [
10, 10, 'step',
14, 16, ['zoom'],
], '',
}, 8, ['get', 'stnm']
],
'text-anchor': 'top',
'text-offset': [0, 1],
},
'paint': { 'paint': {
'text-color': [ 'text-color': '#fff'
'case',
['!=', ['get', 'state'], 1], '#888',
['==', ['get', 'warning'], 3], '#f00',
['==', ['get', 'warning'], 2], 'yellow',
['==', ['get', 'warning'], 1], 'yellow',
'#0f0'
],
'text-halo-color': '#062040',
'text-halo-width': 1
}, },
'visibility': 'visible', 'visibility': 'visible',
}); });
} map.getSource('sk1111').setData(parseGeoJSON(data))
map.getSource('关联站点').setData(parseGeoJSON(data))
} }
@ -1115,7 +1025,6 @@ function DrpReal({ style }) {
<div className="table-ellipsis cursor-pointer" onClick={() => { <div className="table-ellipsis cursor-pointer" onClick={() => {
const { lgtd, lttd } = row; const { lgtd, lttd } = row;
if (lgtd && lttd) { if (lgtd && lttd) {
dispatch.runtime.setFeaturePop({ type: 'RealDrpPop', properties: row, coordinates: [row.lgtd, row.lttd] });
dispatch.runtime.setCameraTarget({ dispatch.runtime.setCameraTarget({
center: [lgtd, lttd], center: [lgtd, lttd],
zoom: 15, zoom: 15,
@ -1150,7 +1059,6 @@ function DrpReal({ style }) {
<div className="table-ellipsis cursor-pointer" onClick={() => { <div className="table-ellipsis cursor-pointer" onClick={() => {
const { lgtd, lttd } = row; const { lgtd, lttd } = row;
if (lgtd && lttd) { if (lgtd && lttd) {
dispatch.runtime.setFeaturePop({ type: 'RealHDPop', properties: row, coordinates: [row.lgtd, row.lttd] });
dispatch.runtime.setCameraTarget({ dispatch.runtime.setCameraTarget({
center: [lgtd, lttd], center: [lgtd, lttd],
zoom: 15, zoom: 15,

View File

@ -12,7 +12,6 @@ import DpTableCell from '../../../../layouts/mui/DpTableCell';
import DpTableRow from '../../../../layouts/mui/DpTableRow'; import DpTableRow from '../../../../layouts/mui/DpTableRow';
import clsx from 'clsx'; import clsx from 'clsx';
import { adnmExact, adnmZhen } from '../../../../models/_/adcd'; import { adnmExact, adnmZhen } from '../../../../models/_/adcd';
import { geometryBound, geometryCenter } from '../../../../utils/tools'
const data1 = [ const data1 = [
@ -1274,6 +1273,10 @@ function DrpReal({ style }) {
const [azdData,setAzdData] = useState([]) const [azdData,setAzdData] = useState([])
const [qsydwData,setQsydwData] = useState([]) const [qsydwData,setQsydwData] = useState([])
const [yhjmhData,setYhjmhData] = useState([]) const [yhjmhData,setYhjmhData] = useState([])
const dispatch = useDispatch(); const dispatch = useDispatch();
const skObj = useSelector(s => s.runtime.skObj); const skObj = useSelector(s => s.runtime.skObj);
useEffect(()=>{ useEffect(()=>{
@ -1362,31 +1365,15 @@ function DrpReal({ style }) {
tabs={ tabs={
<span className="button-group"> <span className="button-group">
<span className={clsx({ active: tab==='1' })} onClick={() => { <span className={clsx({ active: tab==='1' })} onClick={() => {
dispatch.map.setLayerVisible({Dcpj_danadLayer:true});
dispatch.map.setLayerVisible({Dcpj_placementLayer:false});
dispatch.map.setLayerVisible({Dcpj_bsnssinfoLayer:false});
dispatch.map.setLayerVisible({Dcpj_flrvvlgLayer:false});
setTab('1') setTab('1')
}}>危险区</span> }}>危险区</span>
<span className={clsx({ active: tab==='2' })} onClick={() => { <span className={clsx({ active: tab==='2' })} onClick={() => {
dispatch.map.setLayerVisible({Dcpj_danadLayer:false});
dispatch.map.setLayerVisible({Dcpj_placementLayer:true});
dispatch.map.setLayerVisible({Dcpj_bsnssinfoLayer:false});
dispatch.map.setLayerVisible({Dcpj_flrvvlgLayer:false});
setTab('2') setTab('2')
}}>安置点</span> }}>安置点</span>
<span className={clsx({ active: tab==='3' })} onClick={() => { <span className={clsx({ active: tab==='3' })} onClick={() => {
dispatch.map.setLayerVisible({Dcpj_danadLayer:false});
dispatch.map.setLayerVisible({Dcpj_placementLayer:false});
dispatch.map.setLayerVisible({Dcpj_bsnssinfoLayer:true});
dispatch.map.setLayerVisible({Dcpj_flrvvlgLayer:false});
setTab('3') setTab('3')
}}>企事业单位</span> }}>企事业单位</span>
<span className={clsx({ active: tab==='4' })} onClick={() => { <span className={clsx({ active: tab==='4' })} onClick={() => {
dispatch.map.setLayerVisible({Dcpj_danadLayer:false});
dispatch.map.setLayerVisible({Dcpj_placementLayer:false});
dispatch.map.setLayerVisible({Dcpj_bsnssinfoLayer:false});
dispatch.map.setLayerVisible({Dcpj_flrvvlgLayer:true});
setTab('4') setTab('4')
}}>沿河居民户</span> }}>沿河居民户</span>
</span> </span>
@ -1410,20 +1397,14 @@ function DrpReal({ style }) {
{/* <DpTableCell align="center">{index+1}</DpTableCell> */} {/* <DpTableCell align="center">{index+1}</DpTableCell> */}
<DpTableCell component="th" scope="row"> <DpTableCell component="th" scope="row">
<div className="table-ellipsis cursor-pointer" onClick={() => { <div className="table-ellipsis cursor-pointer" onClick={() => {
const { geometry } = row; const { res_lon:lgtd, res_lat:lttd } = row;
if (geometry) { if (lgtd && lttd) {
const bbox = geometryBound(geometry); dispatch.runtime.setCameraTarget({
const center = geometryCenter(geometry); center: [lgtd, lttd],
if (bbox && center) { zoom: 15,
dispatch.map.setLayerVisible({Dcpj_danadLayer:true}); pitch: 60,
dispatch.runtime.setFeaturePop({ type: 'danad', properties: row, coordinates: center }); bearing: 0
dispatch.runtime.setCameraTarget({ });
bounds: [[bbox[0], bbox[1]], [bbox[2], bbox[3]]],
zoom: 15,
pitch: 60,
bearing: 0
});
}
} }
}}>{row.NAME}</div> }}>{row.NAME}</div>
</DpTableCell> </DpTableCell>
@ -1451,8 +1432,6 @@ function DrpReal({ style }) {
<div className="table-ellipsis cursor-pointer" onClick={() => { <div className="table-ellipsis cursor-pointer" onClick={() => {
const { lgtd, lttd } = row; const { lgtd, lttd } = row;
if (lgtd && lttd) { if (lgtd && lttd) {
dispatch.map.setLayerVisible({Dcpj_placementLayer:true});
dispatch.runtime.setFeaturePop({ type: 'placement', properties: row, coordinates: [row.lgtd, row.lttd] });
dispatch.runtime.setCameraTarget({ dispatch.runtime.setCameraTarget({
center: [lgtd, lttd], center: [lgtd, lttd],
zoom: 15, zoom: 15,
@ -1486,8 +1465,6 @@ function DrpReal({ style }) {
<div className="table-ellipsis cursor-pointer" onClick={() => { <div className="table-ellipsis cursor-pointer" onClick={() => {
const { lgtd, lttd } = row; const { lgtd, lttd } = row;
if (lgtd && lttd) { if (lgtd && lttd) {
dispatch.map.setLayerVisible({Dcpj_bsnssinfoLayer:true});
dispatch.runtime.setFeaturePop({ type: 'bsnssinfo', properties: row, coordinates: [row.lgtd, row.lttd] });
dispatch.runtime.setCameraTarget({ dispatch.runtime.setCameraTarget({
center: [lgtd, lttd], center: [lgtd, lttd],
zoom: 15, zoom: 15,
@ -1521,8 +1498,6 @@ function DrpReal({ style }) {
<div className="table-ellipsis cursor-pointer" onClick={() => { <div className="table-ellipsis cursor-pointer" onClick={() => {
const { lgtd, lttd } = row; const { lgtd, lttd } = row;
if (lgtd && lttd) { if (lgtd && lttd) {
dispatch.map.setLayerVisible({Dcpj_flrvvlgLayer:true});
dispatch.runtime.setFeaturePop({ type: 'flrvvlg', properties: row, coordinates: [row.lgtd, row.lttd] });
dispatch.runtime.setCameraTarget({ dispatch.runtime.setCameraTarget({
center: [lgtd, lttd], center: [lgtd, lttd],
zoom: 15, zoom: 15,

View File

@ -11612,13 +11612,13 @@ function SkReal({ style }) {
const dispatch = useDispatch(); const dispatch = useDispatch();
const setSkLayer = (data=[])=>{ const setSkLayer = (data=[])=>{
if(data.length===0){return}
const map = window.__mapref; const map = window.__mapref;
const layer = map.getLayer('sk1111') const layer = map.getLayer('sk1111')
if(layer){ if(layer){
map.removeLayer('sk1111'); map.removeLayer('sk1111');
map.removeSource('sk1111'); map.removeSource('sk1111');
} }
if(data.length===0){return}
map.addLayer({ map.addLayer({
'id': 'sk1111',//+new Date().getTime(), 'id': 'sk1111',//+new Date().getTime(),
'type': 'symbol', 'type': 'symbol',
@ -11661,13 +11661,13 @@ function SkReal({ style }) {
map.getSource('sk1111').setData(parseGeoJSON(data)) map.getSource('sk1111').setData(parseGeoJSON(data))
} }
const setSkLayer2 = (data=[])=>{ const setSkLayer2 = (data=[])=>{
if(data.length===0){return}
const map = window.__mapref; const map = window.__mapref;
const layer = map.getLayer('sk2222') const layer = map.getLayer('sk2222')
if(layer){ if(layer){
map.removeLayer('sk2222'); map.removeLayer('sk2222');
map.removeSource('sk2222'); map.removeSource('sk2222');
} }
if(data.length===0){return}
map.addLayer({ map.addLayer({
'id': 'sk2222',//+new Date().getTime(), 'id': 'sk2222',//+new Date().getTime(),
'type': 'symbol', 'type': 'symbol',
@ -11756,20 +11756,6 @@ function SkReal({ style }) {
setSkLayer2([data1[0]]) setSkLayer2([data1[0]])
} }
}, 500); }, 500);
return ()=>{
const map = window.__mapref;
const layer = map.getLayer('sk1111')
if(layer){
map.removeLayer('sk1111');
map.removeSource('sk1111');
}
const layer2 = map.getLayer('sk2222')
if(layer2){
map.removeLayer('sk2222');
map.removeSource('sk2222');
}
}
},[]) },[])
return ( return (