Commit d49ba871 authored by 张博's avatar 张博

拖拽

parent 597a66d2
......@@ -96,7 +96,9 @@ class PointsPool extends Component {
updateMarkers = (data) => {
this.props.updateMarker(data);
}
addMarker=(data)=>{
this.props.addMarker(data)
}
render() {
const { markers, ...rest } = this.props;
let hideDetector = false;
......@@ -105,11 +107,14 @@ class PointsPool extends Component {
}
return (
<Shuttle>
<RiskPoint
<PersonPoint3D
{...rest}
markers={markers.riskSource}
onCreated={(val) => this.onMarkersCreated('riskSource', val)}
isEditMode={this.props.isEditMode}
addMarker={this.addMarker}
stagePilot={this.props.stagePilot}
positionCtl={this.props.positionCtl}
/>
{/* <PatrolPoint
{...rest}
......
......@@ -4,7 +4,7 @@ import { utils,UUID } from 'amos-tool';
import { PubSub } from 'ray-eventpool';
import { Connect as UIConnect, Modal,message } from 'amos-framework';
import { FatLine } from 'amos-3d/lib/advanced';
import A3DDesigner, { Connect, FireObject,DESIGNER_CONSTS,PolygonRegion, PointLight } from 'amos-3d/lib/designer';
import A3DDesigner, { Connect, FireObject,DESIGNER_CONSTS,PolygonRegion } from 'amos-3d/lib/designer';
import WorkerObjContent from 'amos-3d/lib/worker/WorkerObjContent';
import { transitionHelper } from 'amos-3d/lib/helpers';
import * as endConf from 'amos-processor/lib/config/endconf';
......@@ -120,7 +120,8 @@ class View3D extends Component {
startLoadExceptionArea: false, //是否开始加载区域marker
sideControlShow: false, //隐藏耳朵
isShowActionBar: true, //显示工具栏
errorAreaId: '' //异常区域id
errorAreaId: '' ,//异常区域id
positionxyz:null
};
getObjFromNet(view3dFile, (objs, asyncModels) => {
......@@ -451,7 +452,7 @@ class View3D extends Component {
});
};
onGraphCreated = ({ cameraFactory, sceneFactory, outlineFactory, r3d, stagePilot }) => {
onGraphCreated = ({ cameraFactory, sceneFactory, outlineFactory, r3d, stagePilot}) => {
this.cameraFactory = cameraFactory;
this.sceneFactory = sceneFactory;
this.outlineFactory = outlineFactory;
......@@ -459,6 +460,7 @@ class View3D extends Component {
this.polygonRegion = {};
this.stagePilot = stagePilot;
this.positionCtl = stagePilot.positionCtl;
// 重新设置 outline 风格
this.outlineFactory.outlineConfig = {
visibleEdgeColor: '#f8a303',
......@@ -476,7 +478,6 @@ class View3D extends Component {
onAllDone = objGroup => {
this.sceneFactory.level.change(objGroup);
this.cameraFactory.fitView(desigerHelperConfig.cameraEffect);
this.stagePilot.rendererFactory.setupUModelSahdow();
this.setState({
startAsyncLoad: true
});
......@@ -486,8 +487,6 @@ class View3D extends Component {
onAfterWorkerInit = workerObjGroup => {
// 处理跳跃
this.lensJumpFactory.process(workerObjGroup);
// 子线程模型加上阴影
workerObjGroup.toggleShadow(true);
};
onComplete = obj => {
......@@ -500,6 +499,7 @@ class View3D extends Component {
me.outlineFactory.toggleOutline(evt.object);
me.focusObject(evt.object);
}
});
}
// 处理跳跃
......@@ -1347,7 +1347,50 @@ class View3D extends Component {
setHeaderName =(name)=>{
this.setState({ headerName: name });
}
markerCreated = (markersCache) => {
this.markersCache = markersCache;
};
prevProcessTarget = (object) => {
// 处理 target 元素,只有标识了 isMarkerRoot 的 Object3D 才是真实的 marker root 元素, 同时为其注入了 `extData`
const target = object.getBusinessNode(obj => obj.isMarkerRoot);
if (target){
return target;
}
// 非法元素
return object;
}
addMarker=({extData,position})=>{
let {markers} =this.state
let middleMarkers = markers[`${extData.type}`]
// let position= {
// x: position.toArray()[0],
// y: position.toArray()[0],
// z: position.toArray()[0]
// }
// for (let i = 0; i < middleMarkers.length; i++) {
// if(middleMarkers[i].key == extData.key){
// }
// }
let paramsArr = [{
extData: extData.id,
pointType: extData.type,
position3d: position
}];
savePointListAction(paramsArr).then(data => {
alert(data)
getPointTreeAction(pointType).then(data => {
this.setState({
treeData: data || [],
pageType: 'point',
showRightPanel: false
});
});
})
//this.setState({positionxyz:position.toArray()})
}
render() {
const {
objs,
......@@ -1365,7 +1408,8 @@ class View3D extends Component {
sideControlShow,
isShowActionBar,
headerName,
errorAreaId
errorAreaId,
positionxyz
} = this.state;
const { dimension, hiddenScreenSaver, editModelChange } = this.props;
const graphicProps = {
......@@ -1402,14 +1446,6 @@ class View3D extends Component {
firePosition = { x: -90.827, y: 30.4577, z: 1.0839 };
}
const shadowLight = {
castShadow: true,
shadowMapWidth: 1024 * 4,
shadowMapHeight: 1024 * 4,
intensity: 0.5,
distance: 0,
decay: 2
};
return (
<div className='ModuleEditPage'>
<div
......@@ -1454,10 +1490,10 @@ class View3D extends Component {
penProps={penProps}
enablePositionCtl
positionCtlProps={positionCtlProps}
onCreated={this.onGraphCreated}
>
<PointLight {...shadowLight} position={[100, 200, 50]} />
{startAsyncLoad && <WorkerObjContent objs={asyncModels} onAllDone={this.workerLoadComplete} onWorkerMessage={this.onWorkerLoading} enableLoading afterInit={this.onAfterWorkerInit} />}
{editFlag && pageType === 'region' ? '' : <PointsPool markers={markers} updateMarker={this.updateMarker} planStarted={alarmStarted} stagePilot={this.stagePilot} />}
{startAsyncLoad && <WorkerObjContent objs={asyncModels} onWorkerMessage={this.onWorkerLoading} enableLoading afterInit={this.onAfterWorkerInit} />}
{editFlag && pageType === 'region' ? '' : <PointsPool markers={markers} updateMarker={this.updateMarker} planStarted={alarmStarted} stagePilot={this.stagePilot} positionCtl={this.positionCtl} addMarker={this.addMarker}/>}
{fireTruckRoute && <FatLine {...lineData.fatLineConf} linePath={JSON.parse(fireTruckRoute)} visible={showFireTruckRoute} />}
<FlameFire position={firePosition} width={10} height={20} depth={8} sliceSpacing={1} visible={planStarted} />
{editFlag && this.renderAreas()}
......@@ -1503,7 +1539,7 @@ class View3D extends Component {
showRightPanel && pageType === 'region' ? <RightEditRegionPanel detailData={selectArea} closeRightPanel={()=>this.setState({showRightPanel:false})}/> : ''
}
{
showRightPanel && pageType === 'point' ? <RightEditPointPanel detailData={selectPoints} closeRightPanel={()=>this.setState({showRightPanel:false})}/> : ''
showRightPanel && pageType === 'point' ? <RightEditPointPanel detailData={selectPoints} positionxyz={positionxyz} closeRightPanel={()=>this.setState({showRightPanel:false})}/> : ''
}
</div>
</div>
......
......@@ -197,7 +197,7 @@ class PointLeftTree extends Component {
<Select onChange={this.onSelectChange} defaultValue={pointType} className='leftSelect'>
{
pointTypeArr.map(item => {
return (<Option value={item.code}>{item.name}</Option>)
return (<Option value={item.code} >{item.name}</Option>)
})
}
</Select>
......
......@@ -93,8 +93,8 @@ class RightEditPointPanel extends Component {
}
render() {
let { rules, form,pointTypeArr,pointType ,detailData} = this.state;
let { pageType } = this.props;
let { rules, form,pointTypeArr,pointType ,detailData,} = this.state;
let { pageType,positionxyz } = this.props;
let radio = detailData.isIndoor ? "prop1":"prop2"
let position = (detailData.position3d) && detailData.position3d.split(",")
const formItemLayout = {
......@@ -164,17 +164,17 @@ class RightEditPointPanel extends Component {
<div className='position'>
<div className='positionItem'>
<FormItem label="X" field="positionX" {...formItemLayout}>
<Input value={position && position[0]} />
<Input value={positionxyz && positionxyz[0]} />
</FormItem>
</div>
<div className='positionItem'>
<FormItem label="Y" field="positionY" {...formItemLayout}>
<Input value={position && position[1]} />
<Input value={positionxyz && positionxyz[1]} />
</FormItem>
</div>
<div className='positionItem'>
<FormItem label="Z" field="positionZ" {...formItemLayout}>
<Input value={position && position[2]} />
<Input value={positionxyz && positionxyz[2]} />
</FormItem>
</div>
</div>
......
......@@ -76,7 +76,6 @@ class RightEditRegionPanel extends Component {
handleSubmit = (e) => {
// e.preventDefault();
this.form.validate((valid, dataValues, errors) => {
alert(JSON.stringify(dataValues))
console.log('返回内容:', dataValues, valid, errors);
if (valid) {
//AmosAlert.success('结果', JSON.stringify(dataValues));
......
......@@ -60,10 +60,12 @@ export default function marker3DFactory(WrappedComponent = 'div', options){
mouseover: (marker) => {
marker.object2DPipe.pipeNode.visible = true;
marker.object2DPipe.pipeNode.elementVisible = true;
marker.object2DPipe && marker.object2DPipe.toggleDisplay(true);
},
mouseout: (marker) => {
marker.object2DPipe.pipeNode.visible = false;
marker.object2DPipe.pipeNode.elementVisible = false;
marker.object2DPipe && marker.object2DPipe.toggleDisplay(false);
}
};
this.state = {
......@@ -78,7 +80,31 @@ export default function marker3DFactory(WrappedComponent = 'div', options){
componentWillReceiveProps = nextProps => {
this.setState({ planStarted: nextProps.planStarted });
}
markerCreated = ({ markersCache }) => {
this.markersCache = markersCache
this.props.positionCtl && this.props.positionCtl.addListener('changeDone', this.onEditorChangeDone);
// 拖拽过程即刻改变line
this.props.positionCtl &&this.props.positionCtl.addListener('objectChange', this.onEditorChange);
// 绑定 positionCtl
this.props.positionCtl && this.markersCache.eachValue(item => {
this.props.positionCtl.addObjects(item.node);
});
};
// onEditorChange = (evt) => {
// if (evt && evt.target && evt.target.object){
// const marker = evt.target.object;
// console.log(marker)
// this.props.addMarker(marker)
// }
// }
onEditorChangeDone = (evt) => {
if (evt && evt.target && evt.target.object){
const marker = evt.target.object;
//alert(marker.position.toArray());//(marker.extData
this.props.addMarker(marker)
}
}
onMarkerClick = (marker, e) => {
const { isClick } = this.state;
if (isClick) {
......@@ -104,6 +130,7 @@ export default function marker3DFactory(WrappedComponent = 'div', options){
{...rest}
markers={result}
events={this.markerEvents}
onCreated={this.markerCreated}
/>
{ !planStarted && <PointDialog style={dialogStyle} ref={node => this.pdRef = node} />}
</WrappedComponent>
......
......@@ -92,9 +92,9 @@ export default function markerFactory(WrappedComponent = 'div', options){
return <MarkerIcon {...extData} markerType={markerType} />;
}
}
markerCreated = ({ markersCache }) => {
this.markersCache = markersCache;
};
markerCreated = ({ markersCache }) => {
this.markersCache = markersCache;
};
render() {
const { markers } = this.props;
const { planStarted } = this.state;
......
This diff is collapsed.
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