Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
amos-station-module-view
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
station
amos-station-module-view
Commits
5679d8dd
Commit
5679d8dd
authored
Jun 05, 2020
by
张博
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'developer' of
http://172.16.10.76/station/amos-station-module-view
into developer
parents
65b85573
5b53aa58
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
166 additions
and
85 deletions
+166
-85
View3D.js
mods/components/3dviewConvertor/view/View3D.js
+79
-52
RightEditPointPanel.js
...Convertor/view/moduleEditComponent/RightEditPointPanel.js
+82
-27
marker3DFactory.js
...components/3dviewConvertor/view/points/marker3DFactory.js
+5
-6
No files found.
mods/components/3dviewConvertor/view/View3D.js
View file @
5679d8dd
...
...
@@ -483,7 +483,7 @@ class View3D extends Component {
onAllDone
=
objGroup
=>
{
this
.
sceneFactory
.
level
.
change
(
objGroup
);
this
.
cameraFactory
.
fitView
(
desigerHelperConfig
.
cameraEffect
);
this
.
stagePilot
.
rendererFactory
.
setupUModelSahdow
();
//接受阴影
this
.
setState
({
startAsyncLoad
:
true
});
...
...
@@ -493,6 +493,8 @@ class View3D extends Component {
onAfterWorkerInit
=
workerObjGroup
=>
{
// 处理跳跃
this
.
lensJumpFactory
.
process
(
workerObjGroup
);
// 子线程模型加上阴影
workerObjGroup
.
toggleShadow
(
true
);
};
onComplete
=
obj
=>
{
...
...
@@ -546,17 +548,29 @@ class View3D extends Component {
}
}
};
getPointList
=
(
pointType
)
=>
{
let
{
markers
}
=
this
.
state
this
.
clearMarkers
();
getPointListAction
().
then
(
data
=>
{
for
(
let
i
=
0
;
i
<
data
.
length
;
i
++
){
if
(
pointType
&&
data
[
i
].
type
==
pointType
){
markers
[
pointType
].
push
(
data
[
i
]);
}
getPointLoop
=
({
markers
},
pointType
,
treeData
)
=>
{
treeData
.
forEach
(
t
=>
{
if
(
t
.
isRegion
&&
t
.
children
&&
t
.
children
.
length
>
0
){
this
.
getPointLoop
(
{
markers
},
pointType
,
t
.
children
)
}
else
if
(
t
.
position3d
){
t
.
position
=
t
.
position3d
;
t
.
key
=
`
${
t
.
type
}
-
${
t
.
id
}
`
;
t
.
label
=
t
.
name
;
markers
[
pointType
].
push
(
t
);
}
});
}
//编辑模式获取点
getPointList
=
(
pointType
,
treeData
)
=>
{
this
.
clearMarkers
();
if
(
treeData
){
let
markers
=
{};
markers
[
pointType
]
=
[];
this
.
getPointLoop
(
{
markers
},
pointType
,
treeData
);
this
.
setState
({
markers
})
}
)
}
}
startDrow
=
(
areaItem
)
=>
{
// this.a3dRef.addPen(m);
...
...
@@ -773,7 +787,6 @@ class View3D extends Component {
this
.
setState
({
selectArea
:
''
,
selectPoints
,
positionxyz
:
selectPoints
.
position3d
&&
selectPoints
.
position3d
.
split
(
","
),
showRightPanel
:
true
,
});
}
...
...
@@ -882,18 +895,14 @@ class View3D extends Component {
savePointData
=
()
=>
{
let
{
markers
,
pointType
,
isPointSave
}
=
this
.
state
;
this
.
setState
({
isPointSave
:
true
});
console
.
log
(
markers
);
let
paramsArr
=
[];
for
(
let
key
in
markers
){
let
item
=
markers
[
key
];
for
(
let
i
=
0
;
i
<
item
.
length
;
i
++
)
{
paramsArr
.
push
({
pointId
:
item
[
i
].
id
,
pointType
:
item
[
i
].
type
,
position3d
:
`
${
item
[
i
].
position
[
0
]}
,
${
item
[
i
].
position
[
1
]}
,
${
item
[
i
].
position
[
2
]}
`
});
}
}
paramsArr
=
markers
[
pointType
].
filter
(
e
=>
e
.
isEdit
).
map
(
item
=>
{
return
{
pointId
:
item
.
id
,
pointType
:
item
.
type
,
position3d
:
item
.
position
.
length
>
1
?
`
${
item
.
position
[
0
]}
,
${
item
.
position
[
1
]}
,
${
item
.
position
[
2
]}
`
:
null
};
});
savePointListAction
(
paramsArr
).
then
(
data
=>
{
getPointTreeAction
(
pointType
).
then
(
...
...
@@ -1038,7 +1047,8 @@ class View3D extends Component {
this
.
disabledCamera
();
}
else
{
getPointTreeAction
(
pointTypeArr
[
0
].
code
||
''
).
then
(
data
=>
{
this
.
generateList
(
data
)
this
.
getPointList
(
pointTypeArr
[
0
].
code
,
data
);
this
.
generateList
(
data
);
this
.
setState
({
pointType
:
pointTypeArr
[
0
].
code
||
''
,
treeData
:
data
||
[],
...
...
@@ -1058,8 +1068,8 @@ class View3D extends Component {
pointType
,
treeData
:
[]
});
this
.
getPointList
(
pointType
);
getPointTreeAction
(
pointType
).
then
(
data
=>
{
this
.
getPointList
(
pointType
,
data
);
this
.
setState
({
pointType
,
treeData
:
data
||
[]
...
...
@@ -1095,6 +1105,7 @@ class View3D extends Component {
}
drop
=
(
event
)
=>
{
console
.
log
(
'drop'
);
event
.
preventDefault
();
this
.
setState
({
isPointSave
:
false
});
let
{
dragItem
,
markers
}
=
this
.
state
;
...
...
@@ -1128,11 +1139,19 @@ class View3D extends Component {
title
:
dragItem
.
name
,
label
:
dragItem
.
name
,
level
:
dragItem
.
level
,
levelStr
:
dragItem
.
levelStr
,
isEdit
:
true
,
levelStr
:
dragItem
.
levelStr
};
let
selectPoints
=
{
id
:
dragItem
.
id
,
type
:
dragItem
.
type
}
markers
[
`
${
type
}
`
].
push
(
addPointParam
);
this
.
setState
({
markers
:
deepCopy
(
markers
)
markers
:
deepCopy
(
markers
),
selectPoints
// positionxyz: position.toArray()
});
}
}
...
...
@@ -1151,19 +1170,19 @@ class View3D extends Component {
isEditMode
=
true
;
this
.
setState
({
isEditMode
});
if
(
isEditMode
===
true
)
{
getAreaTreeAction
().
then
(
d
ata
=>
{
this
.
generateList
(
d
ata
)
getAreaTreeAction
().
then
(
treeD
ata
=>
{
this
.
generateList
(
treeD
ata
)
this
.
setState
({
treeData
:
d
ata
||
[]
treeData
:
treeD
ata
||
[]
});
});
getPointTypeAction
().
then
(
data
=>
{
console
.
log
(
data
);
this
.
setState
({
pointTypeArr
:
data
||
[],
pointType
:
data
[
0
]
?
data
[
0
].
code
:
''
getPointTypeAction
().
then
(
data
=>
{
console
.
log
(
data
);
this
.
setState
({
pointTypeArr
:
data
||
[],
pointType
:
data
[
0
]
?
data
[
0
].
code
:
''
});
this
.
getPointList
(
data
[
0
].
code
,
treeData
);
});
this
.
getPointList
(
data
[
0
].
code
);
});
}
}
...
...
@@ -1515,22 +1534,30 @@ class View3D extends Component {
// 非法元素
return
object
;
}
addMarker
=
({
extData
,
position
})
=>
{
const
{
markers
}
=
this
.
state
let
paramsArr
=
[{
pointId
:
extData
.
id
,
pointType
:
extData
.
type
,
position3d
:
`
${
position
[
0
]}
,
${
position
[
1
]}
,
${
position
[
2
]}
`
}];
console
.
log
(
paramsArr
)
savePointListAction
(
paramsArr
).
then
(
data
=>
{
})
this
.
setState
({
positionxyz
:
position
,
showRightPanel
:
true
,
selectPoints
:
extData
})
addMarker
=
({
extData
,
position
})
=>
{
const
me
=
this
;
const
{
markers
}
=
me
;
const
isInside
=
me
.
polygonRegion
&&
extData
.
parentId
&&
me
.
polygonRegion
[
extData
.
parentId
].
pointInPolygon
([
position
.
x
,
position
.
y
,
position
.
z
]);
if
(
isInside
){
markers
[
extData
.
type
].
forEach
(
e
=>
{
if
(
e
.
id
===
extData
.
id
){
e
.
position
=
`
${
position
[
0
]}
,
${
position
[
1
]}
,
${
position
[
2
]}
`
;
e
.
isEdit
=
true
;
}
});
extData
.
position
=
position
;
this
.
setState
({
markers
,
positionxyz
:
position
,
showRightPanel
:
true
,
selectPoints
:
extData
});
}
else
{
message
.
error
(
'不能放置非所在区域'
);
}
}
render
()
{
const
{
objs
,
...
...
@@ -1685,7 +1712,7 @@ class View3D extends Component {
showRightPanel
&&
pageType
===
'region'
?
<
RightEditRegionPanel
detailData
=
{
selectArea
}
rightHeight
=
{
rightHeight
}
closeRightPanel
=
{()
=>
this
.
setState
({
showRightPanel
:
false
})}
changeRoutePath
=
{
this
.
changeRoutePath
}
routePathData
=
{
this
.
state
.
routePathData
}
/> : '
'
}
{
showRightPanel
&&
pageType
===
'point'
?
<
RightEditPointPanel
detailData
=
{
selectPoints
}
positionxyz
=
{
positionxyz
}
closeRightPanel
=
{()
=>
this
.
setState
({
showRightPanel
:
false
})
}
/> : '
'
showRightPanel
&&
pageType
===
'point'
?
<
RightEditPointPanel
detailData
=
{
selectPoints
}
showRightPanel
=
{
showRightPanel
}
closeRightPanel
=
{()
=>
this
.
setState
({
showRightPanel
:
false
})}
markers
=
{
markers
}
changeMarkersData
=
{
this
.
changeMarkersData
}
/> : '
'
}
<
/div
>
<
/div
>
...
...
mods/components/3dviewConvertor/view/moduleEditComponent/RightEditPointPanel.js
View file @
5679d8dd
...
...
@@ -17,42 +17,64 @@ class RightEditPointPanel extends Component {
super
(
props
);
this
.
state
=
{
form
:
{
},
rules
:{},
detailData
:[]
form
:
{},
rules
:
{},
detailData
:
[],
positionxyz
:
[],
positionX
:
''
,
positionY
:
''
,
positionZ
:
''
,
};
}
componentDidMount
()
{
let
{
detailData
}
=
this
.
props
let
{
detailData
,
markers
}
=
this
.
props
getPointTreeDetailAction
(
detailData
.
id
,
detailData
.
type
).
then
(
data
=>
{
console
.
log
(
data
);
// this.mreageDetailData( data,markers );
this
.
setState
({
detailData
:
data
||
[],
},
err
=>
{
console
.
log
(
err
)
});
});
}
componentWillUnmount
()
{
}
componentWillReceiveProps
(
nextProps
)
{
let
{
detailData
}
=
nextProps
let
{
detailData
,
markers
,
showRightPanel
}
=
nextProps
;
console
.
log
(
'componentWillReceivePropscomponentWillReceiveProps'
);
// positionxyz && this.setState({ positionxyz, positionX: positionxyz[0], positionY: positionxyz[1], positionZ: positionxyz[2] });
getPointTreeDetailAction
(
detailData
.
id
,
detailData
.
type
).
then
(
data
=>
{
console
.
log
(
data
);
this
.
setState
({
detailData
:
data
||
[],
},
err
=>
{
console
.
log
(
err
)
});
if
(
detailData
.
position3d
){
data
.
position
=
detailData
.
position3d
;
}
else
if
(
!
data
.
position
){
const
curTypeMaker
=
markers
[
data
.
type
];
for
(
let
i
=
0
;
i
<
curTypeMaker
.
length
;
i
++
)
{
if
(
data
.
id
==
curTypeMaker
[
i
].
id
){
data
.
position
=
curTypeMaker
[
i
].
position
;
}
}
}
this
.
setState
({
detailData
:
data
,
positionX
:
data
.
position
[
0
],
positionY
:
data
.
position
[
1
],
positionZ
:
data
.
position
[
2
]});
});
}
mreageDetailData
=
(
detailData
,
markers
)
=>
{
const
curTypeMaker
=
markers
[
detailData
.
type
];
for
(
let
i
=
0
;
i
<
curTypeMaker
.
length
;
i
++
)
{
if
(
detailData
.
id
==
curTypeMaker
[
i
].
id
){
const
position
=
curTypeMaker
[
i
].
position
;
// detailData.position3d =
position
&&
this
.
setState
({
positionX
:
position
[
0
],
positionY
:
position
[
1
],
positionZ
:
position
[
2
]
});
}
}
this
.
setState
({
detailData
});
}
onChange
=
(
key
,
e
)
=>
{
const
value
=
e
.
target
.
value
;
const
newForm
=
Object
.
assign
({},
this
.
state
.
form
,
{
[
key
]:
value
});
...
...
@@ -66,6 +88,7 @@ class RightEditPointPanel extends Component {
form
:
newForm
});
}
onHobbyChange
=
(
value
,
item
)
=>
{
const
newForm
=
Object
.
assign
({},
this
.
state
.
form
,
{
'level'
:
value
});
this
.
setState
({
...
...
@@ -73,12 +96,6 @@ class RightEditPointPanel extends Component {
});
}
handleSubmit
=
(
e
)
=>
{
// e.preventDefault();
this
.
form
.
validate
((
valid
,
dataValues
,
errors
)
=>
{
...
...
@@ -92,9 +109,38 @@ class RightEditPointPanel extends Component {
});
}
onChangePosition
=
(
inputType
,
value
)
=>
{
let
{
positionX
,
positionY
,
positionZ
}
=
this
.
state
;
if
(
inputType
===
'positionX'
){
this
.
state
.
positionX
=
Number
(
value
);
}
else
if
(
inputType
===
'positionY'
){
this
.
state
.
positionY
=
Number
(
value
);
}
else
{
this
.
state
.
positionZ
=
Number
(
value
);
}
let
position
=
[
positionX
,
positionY
,
positionZ
];
this
.
mreageMarkerPosition
(
position
);
}
mreageMarkerPosition
=
(
position
)
=>
{
let
{
markers
}
=
this
.
props
;
const
{
detailData
}
=
this
.
state
;
const
curTypeMaker
=
markers
[
detailData
.
type
]
||
[];
for
(
let
index
=
0
;
index
<
curTypeMaker
.
length
;
index
++
)
{
const
marker
=
curTypeMaker
[
index
];
if
(
marker
.
id
===
detailData
.
id
){
marker
.
position
=
position
;
marker
.
isChange
=
true
;
this
.
props
.
changeMarkersData
(
markers
);
}
}
}
render
()
{
let
{
rules
,
form
,
pointTypeArr
,
pointType
,
detailData
,
}
=
this
.
state
;
let
{
pageType
,
positionxyz
}
=
this
.
props
;
let
{
rules
,
form
,
pointTypeArr
,
pointType
,
detailData
,
positionxyz
,
positionX
,
positionY
,
positionZ
}
=
this
.
state
;
let
{
pageType
}
=
this
.
props
;
let
radio
=
detailData
.
isIndoor
?
"prop1"
:
"prop2"
let
position
=
(
detailData
.
position3d
)
&&
detailData
.
position3d
.
split
(
","
)
const
formItemLayout
=
{
...
...
@@ -164,17 +210,26 @@ class RightEditPointPanel extends Component {
<
div
className
=
'position'
>
<
div
className
=
'positionItem'
>
<
FormItem
label
=
"X"
field
=
"positionX"
{...
formItemLayout
}
>
<
Input
value
=
{
positionxyz
&&
positionxyz
[
0
]}
/
>
<
Input
value
=
{
this
.
state
.
positionX
}
onChange
=
{
(
e
)
=>
this
.
onChangePosition
(
'positionX'
,
e
.
target
.
value
)
}
/
>
<
/FormItem
>
<
/div
>
<
div
className
=
'positionItem'
>
<
FormItem
label
=
"Y"
field
=
"positionY"
{...
formItemLayout
}
>
<
Input
value
=
{
positionxyz
&&
positionxyz
[
1
]}
/
>
<
Input
value
=
{
this
.
state
.
positionY
}
onChange
=
{
(
e
)
=>
this
.
onChangePosition
(
'positionY'
,
e
.
target
.
value
)
}
/
>
<
/FormItem
>
<
/div
>
<
div
className
=
'positionItem'
>
<
FormItem
label
=
"Z"
field
=
"positionZ"
{...
formItemLayout
}
>
<
Input
value
=
{
positionxyz
&&
positionxyz
[
2
]}
/
>
<
Input
value
=
{
this
.
state
.
positionZ
}
onChange
=
{
(
e
)
=>
this
.
onChangePosition
(
'positionZ'
,
e
.
target
.
value
)
}
/
>
<
/FormItem
>
<
/div
>
<
/div
>
...
...
mods/components/3dviewConvertor/view/points/marker3DFactory.js
View file @
5679d8dd
...
...
@@ -80,7 +80,7 @@ export default function marker3DFactory(WrappedComponent = 'div', options){
componentWillReceiveProps
=
nextProps
=>
{
if
(
nextProps
.
isEditMode
){
this
.
markersCache
.
eachValue
(
obj
=>
{
this
.
setTopCardConf
(
obj
,
obj
.
extData
);
//
this.setTopCardConf(obj, obj.extData);
if
(
nextProps
.
selectPoints
.
type
==
obj
.
extData
.
type
&&
nextProps
.
selectPoints
.
id
==
obj
.
extData
.
id
){
this
.
setTwinkleConf
(
obj
);
}
...
...
@@ -182,12 +182,11 @@ export default function marker3DFactory(WrappedComponent = 'div', options){
imgHeight
:
128
,
image
:
markerTitleBgMapper
[
'base'
]
};
if
(
type
===
'riskSource'
){
if
(
type
===
'riskSource'
&&
!
this
.
props
.
isEditMode
){
cardTitle
=
'风险值'
+
title
}
else
{
cardTitle
=
title
?
title
:
nam
e
;
cardTitle
=
name
?
name
:
titl
e
;
}
obj
.
baseObjHelper
.
title
=
cardTitle
;
}
...
...
@@ -226,7 +225,7 @@ export default function marker3DFactory(WrappedComponent = 'div', options){
};
render
()
{
const
{
markers
,
...
rest
}
=
this
.
props
;
const
{
markers
,
isEditMode
,
...
rest
}
=
this
.
props
;
const
{
planStarted
}
=
this
.
state
;
let
dialogStyle
=
{
zIndex
:
1000
};
...
...
@@ -235,7 +234,7 @@ export default function marker3DFactory(WrappedComponent = 'div', options){
<
WrappedComponent
>
<
Markers
{...
rest
}
draggable
draggable
=
{
isEditMode
}
markers
=
{
result
}
events
=
{
this
.
markerEvents
}
onCreated
=
{
this
.
markerCreated
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment