Commit b9b7506e authored by suhuiguang's avatar suhuiguang

1.修改

parent 16ff3558
...@@ -59,16 +59,6 @@ class PointsPool extends Component { ...@@ -59,16 +59,6 @@ class PointsPool extends Component {
onMarkersCreated = (type, { markersCache }) => { onMarkersCreated = (type, { markersCache }) => {
this.markerList[type] = markersCache; this.markerList[type] = markersCache;
let stagePilot = this.props.stagePilot;
debugger;
// if(markersCache&&stagePilot) {
// // console.log(this.markerList)
// console.log(markersCache)
// // console.log(this.props)
// markersCache.eachValue(item => {
// item.node._userData = { ...item.extData };
// stagePilot.positionCtl.objects.push(item.node); })
// }
(markersCache || []).forEach(mc => { (markersCache || []).forEach(mc => {
const extData = mc.getExtData(); const extData = mc.getExtData();
if (extData.hasOwnProperty('visible')){ if (extData.hasOwnProperty('visible')){
......
...@@ -780,18 +780,22 @@ class View3D extends Component { ...@@ -780,18 +780,22 @@ class View3D extends Component {
} }
//选中点变化 //选中点变化
selectPointChange = (selectPoints) => { selectPointChange = (selectPoints) => {
if(selectPoints.isRegion){ const { markers, pointType } = this.state;
this.setState({selectArea:selectPoints}) if (selectPoints.isRegion){
}else{ this.setState({ selectArea: selectPoints });
this.dragItemChange(selectPoints) } else {
this.dragItemChange(selectPoints);
markers[pointType].map(e => {
if (e.id === selectPoints.id){
selectPoints.position = e.position;
}
});
this.setState({ this.setState({
selectArea:'', selectArea: '',
selectPoints, selectPoints,
showRightPanel: true, showRightPanel: true
selectPoints
}); });
} }
} }
getAreas = (treeData) => { getAreas = (treeData) => {
...@@ -1259,29 +1263,22 @@ class View3D extends Component { ...@@ -1259,29 +1263,22 @@ class View3D extends Component {
}); });
}; };
/**
* 更新 markers data changeMarkersData = (position,type,id) => {
* 批量更新 const me = this;
* @params {Object} markersData {markerType<String>: markers<Array>} const { markers, selectPoints } = me.state;
*/ const index = markers[type].findIndex(e=>e.id === id);
changeMarkersData = markersData => { if (index >= 0){
if (!utils.isEmpty(markersData)) { markers[type][index].position = position;
const { markers } = this.state; markers[type][index].isEdit = true;
const newMarkers = Object.assign({}, markers, markersData); selectPoints.position = position;
this.setState({ me.setState({
markers: newMarkers markers,
selectPoints
}); });
} }
}; };
createInfowindow = text => {
const div = document.createElement('div');
div.style.position = 'absolute';
div.className = 'three-ui-infowindow';
div.innerText = text;
return div;
};
afterRender = () => { afterRender = () => {
// this.infoHelper && this.infoHelper.update(); // this.infoHelper && this.infoHelper.update();
}; };
...@@ -1546,19 +1543,19 @@ class View3D extends Component { ...@@ -1546,19 +1543,19 @@ class View3D extends Component {
const { markers } = me.state; const { markers } = me.state;
const isInside = me.polygonRegion && extData.parentId && me.polygonRegion[extData.parentId].pointInPolygon([position.x,position.y,position.z]); const isInside = me.polygonRegion && extData.parentId && me.polygonRegion[extData.parentId].pointInPolygon([position.x,position.y,position.z]);
// if (isInside){ // if (isInside){
markers[extData.type].forEach(e => { markers[extData.type].forEach(e => {
if (e.id === extData.id){ if (e.id === extData.id){
e.position = position; e.position = position;
e.isEdit = true; e.isEdit = true;
} }
}); });
extData.position = position; extData.position = position;
this.setState({ this.setState({
markers, markers,
positionxyz: position, positionxyz: position,
showRightPanel: true, showRightPanel: true,
selectPoints: extData selectPoints: extData
}); });
// } else { // } else {
// message.error('不能放置非所在区域'); // message.error('不能放置非所在区域');
// } // }
...@@ -1670,7 +1667,7 @@ class View3D extends Component { ...@@ -1670,7 +1667,7 @@ class View3D extends Component {
> >
{startAsyncLoad && <WorkerObjContent objs={asyncModels} onWorkerMessage={this.onWorkerLoading} enableLoading afterInit={this.onAfterWorkerInit} />} {startAsyncLoad && <WorkerObjContent objs={asyncModels} onWorkerMessage={this.onWorkerLoading} enableLoading afterInit={this.onAfterWorkerInit} />}
{isEditMode && pageType === 'region' ? '' : {isEditMode && pageType === 'region' ? '' :
<PointsPool markers={markers} isEditMode={isEditMode} selectPoints={selectPoints} updateMarker={this.updateMarker} planStarted={alarmStarted} stagePilot={this.stagePilot} positionCtl={this.positionCtl} addMarker={this.addMarker}/>} <PointsPool markers={markers} isEditMode={isEditMode} selectPoints={selectPoints} updateMarker={this.updateMarker} planStarted={alarmStarted} stagePilot={this.stagePilot} positionCtl={this.positionCtl} addMarker={this.addMarker} ref={node => this.pointsPool = node} />}
{fireTruckRoute && <FatLine {...lineData.fatLineConf} linePath={JSON.parse(fireTruckRoute)} visible={showFireTruckRoute} />} {fireTruckRoute && <FatLine {...lineData.fatLineConf} linePath={JSON.parse(fireTruckRoute)} visible={showFireTruckRoute} />}
<FlameFire position={firePosition} width={10} height={20} depth={8} sliceSpacing={1} visible={planStarted} /> <FlameFire position={firePosition} width={10} height={20} depth={8} sliceSpacing={1} visible={planStarted} />
{isEditMode && this.renderAreas()} {isEditMode && this.renderAreas()}
......
...@@ -134,7 +134,7 @@ export default function marker3DFactory(WrappedComponent = 'div', options){ ...@@ -134,7 +134,7 @@ export default function marker3DFactory(WrappedComponent = 'div', options){
} }
} }
markerCreated = ({ markersCache }) => { markerCreated = ({ markersCache }) => {
let {isEditMode,selectKey} =this.props let { isEditMode,selectKey } =this.props;
this.markersCache = markersCache; this.markersCache = markersCache;
this.stagePilot = this.props.stagePilot; this.stagePilot = this.props.stagePilot;
this.outlineHelper = this.stagePilot ? this.stagePilot.outlineHelper : undefined; this.outlineHelper = this.stagePilot ? this.stagePilot.outlineHelper : undefined;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment