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
bf4c3390
Commit
bf4c3390
authored
Jun 12, 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
7d940ca8
996cb134
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
42 additions
and
63 deletions
+42
-63
marker3DFactory.js
...components/3dviewConvertor/view/points/marker3DFactory.js
+42
-63
No files found.
mods/components/3dviewConvertor/view/points/marker3DFactory.js
View file @
bf4c3390
...
@@ -3,29 +3,20 @@ import PropTypes from 'prop-types';
...
@@ -3,29 +3,20 @@ import PropTypes from 'prop-types';
import
{
utils
}
from
'amos-tool'
;
import
{
utils
}
from
'amos-tool'
;
import
{
Markers
}
from
'amos-3d/lib/designer'
;
import
{
Markers
}
from
'amos-3d/lib/designer'
;
import
formatUrl
from
'amos-processor/lib/utils/urlFormat'
;
import
formatUrl
from
'amos-processor/lib/utils/urlFormat'
;
import
{
EVENT_CONSTS
}
from
'amos-3d/lib/designer'
;
import
{
CONSTS
}
from
'./../../consts/storageConsts'
;
import
{
CONSTS
}
from
'./../../consts/storageConsts'
;
import
PointDialog
from
'./PointDialog'
;
import
PointDialog
from
'./PointDialog'
;
import
{
tirggerPlanTopic
}
from
'./../dataProcessor'
;
import
{
tirggerPlanTopic
,
tirggerTransTopic
}
from
'./../dataProcessor'
;
import
{
marker3DIoncMapper
,
markerTitleBgMapper
}
from
'./../../consts/imgStatic'
;
import
{
marker3DIoncMapper
,
markerTitleBgMapper
}
from
'./../../consts/imgStatic'
;
import
{
eventTopics
,
isPointEvent
,
isLevelFilter
}
from
'./../consts'
;
import
{
parseMarkers
,
parseLevelFilter
}
from
'../dataProcessor'
;
const
{
EVENT_TYPE_CORE
}
=
EVENT_CONSTS
;
const
getIcon
=
(
markerType
,
level
)
=>
{
const
getIcon
=
(
markerType
,
level
)
=>
{
// return marker3DIoncMapper[`${markerType}_${level}`];
if
(
markerType
===
'riskSource'
||
markerType
===
'patrol'
||
markerType
===
'impEquipmentMode'
)
{
if
(
markerType
===
'riskSource'
||
markerType
===
'patrol'
||
markerType
===
'impEquipmentMode'
)
{
return
marker3DIoncMapper
[
`
${
markerType
}
_
${
level
}
`
];
return
marker3DIoncMapper
[
`
${
markerType
}
_
${
level
}
`
];
}
}
return
marker3DIoncMapper
[
`
${
markerType
}
`
];
return
marker3DIoncMapper
[
`
${
markerType
}
`
];
};
};
// const createMarkerLabel = text => {
// const div = document.createElement('div');
// div.style.position = 'absolute';
// div.style.marginTop = '-3rem';
// div.className = 'three-ui-anchor';
// div.innerText = text;
// return div;
// };
const
urlMapper
=
{
const
urlMapper
=
{
fireCar
:
{
file
:
'fire-car'
,
label
:
'消防车'
},
fireCar
:
{
file
:
'fire-car'
,
label
:
'消防车'
},
fireEquipment
:
{
file
:
'fireEquip'
,
label
:
'消防设备'
},
fireEquipment
:
{
file
:
'fireEquip'
,
label
:
'消防设备'
},
...
@@ -42,7 +33,13 @@ export default function marker3DFactory(WrappedComponent = 'div', options) {
...
@@ -42,7 +33,13 @@ export default function marker3DFactory(WrappedComponent = 'div', options) {
// marker 显隐
// marker 显隐
visible
:
PropTypes
.
bool
,
visible
:
PropTypes
.
bool
,
markers
:
PropTypes
.
array
,
markers
:
PropTypes
.
array
,
planStarted
:
PropTypes
.
bool
planStarted
:
PropTypes
.
bool
,
isEditMode
:
PropTypes
.
bool
,
addMarker
:
PropTypes
.
func
,
stagePilot
:
PropTypes
.
object
,
subscribe
:
PropTypes
.
func
,
selectPoints
:
PropTypes
.
object
,
onCreated
:
PropTypes
.
func
};
};
constructor
(
props
)
{
constructor
(
props
)
{
...
@@ -50,28 +47,7 @@ export default function marker3DFactory(WrappedComponent = 'div', options) {
...
@@ -50,28 +47,7 @@ export default function marker3DFactory(WrappedComponent = 'div', options) {
this
.
markerList
=
{};
this
.
markerList
=
{};
this
.
markerEvents
=
{
this
.
markerEvents
=
{
click
:
this
.
onMarkerClick
,
click
:
this
.
onMarkerClick
,
// dblclick: this.onMarkerDblClick,
dragend
:
this
.
markerDragend
dragend
:
this
.
markerDragend
,
mouseover
:
(
marker
)
=>
{
if
(
marker
.
object2DPipe
){
marker
.
object2DPipe
.
pipeNode
.
visible
=
true
;
marker
.
object2DPipe
.
pipeNode
.
elementVisible
=
true
;
marker
.
object2DPipe
.
toggleDisplay
(
true
);
}
if
(
!
this
.
props
.
isEditMode
)
{
this
.
setTopCardConf
(
marker
,
marker
.
extData
);
}
},
mouseout
:
(
marker
)
=>
{
if
(
marker
.
object2DPipe
){
marker
.
object2DPipe
.
pipeNode
.
visible
=
false
;
marker
.
object2DPipe
.
pipeNode
.
elementVisible
=
false
;
marker
.
object2DPipe
.
toggleDisplay
(
false
);
}
if
(
!
this
.
props
.
isEditMode
)
{
marker
.
baseObjHelper
.
title
=
null
;
}
}
};
};
this
.
state
=
{
this
.
state
=
{
isClick
:
true
isClick
:
true
...
@@ -80,19 +56,8 @@ export default function marker3DFactory(WrappedComponent = 'div', options) {
...
@@ -80,19 +56,8 @@ export default function marker3DFactory(WrappedComponent = 'div', options) {
componentWillMount
=
()
=>
{
componentWillMount
=
()
=>
{
this
.
setState
({
planStarted
:
this
.
props
.
planStarted
});
this
.
setState
({
planStarted
:
this
.
props
.
planStarted
});
};
}
// componentDidMount() {
// this.props.subscribe(eventTopics.base3d_view, (topic, data) => {
// if (isPointEvent(topic)){
// parseMarkers(this, topic, data);
// } else if (isLevelFilter(topic)) {
// parseLevelFilter(this, topic, data);
// }
// });
// this.props.subscribe('base3d.fromws1.showFireTruckRoute', (topic, data) => {
// parseMarkers(this, topic, data);
// });
// }
componentWillReceiveProps
=
nextProps
=>
{
componentWillReceiveProps
=
nextProps
=>
{
if
(
nextProps
.
isEditMode
)
{
if
(
nextProps
.
isEditMode
)
{
this
.
markersCache
.
eachValue
(
obj
=>
{
this
.
markersCache
.
eachValue
(
obj
=>
{
...
@@ -103,7 +68,8 @@ export default function marker3DFactory(WrappedComponent = 'div', options) {
...
@@ -103,7 +68,8 @@ export default function marker3DFactory(WrappedComponent = 'div', options) {
});
});
}
}
this
.
setState
({
planStarted
:
nextProps
.
planStarted
});
this
.
setState
({
planStarted
:
nextProps
.
planStarted
});
};
}
componentWillUnmount
()
{
componentWillUnmount
()
{
this
.
objAnchorHelper
&&
this
.
objAnchorHelper
.
destroy
();
this
.
objAnchorHelper
&&
this
.
objAnchorHelper
.
destroy
();
}
}
...
@@ -131,7 +97,6 @@ export default function marker3DFactory(WrappedComponent = 'div', options) {
...
@@ -131,7 +97,6 @@ export default function marker3DFactory(WrappedComponent = 'div', options) {
return
false
;
return
false
;
}
}
tirggerPlanTopic
(
CONSTS
.
plan_detail
,
{
type
:
marker
.
extData
.
type
,
data
:
marker
.
extData
});
tirggerPlanTopic
(
CONSTS
.
plan_detail
,
{
type
:
marker
.
extData
.
type
,
data
:
marker
.
extData
});
if
(
isClick
)
{
if
(
isClick
)
{
this
.
setState
({
isClick
:
false
});
//将isClick 变成false,将不会执行处理事件
this
.
setState
({
isClick
:
false
});
//将isClick 变成false,将不会执行处理事件
// this.pdRef && this.pdRef.onOpenClick(marker);
// this.pdRef && this.pdRef.onOpenClick(marker);
...
@@ -145,11 +110,12 @@ export default function marker3DFactory(WrappedComponent = 'div', options) {
...
@@ -145,11 +110,12 @@ export default function marker3DFactory(WrappedComponent = 'div', options) {
that
.
setState
({
isClick
:
true
});
// 将isClick设置为true
that
.
setState
({
isClick
:
true
});
// 将isClick设置为true
},
1000
);
},
1000
);
};
};
setTwinkleConf
=
(
obj
)
=>
{
const
{
twinkle
,
frequency
}
=
obj
.
extData
;
setTwinkleConf
=
obj
=>
{
let
pulsePeriod
=
twinkle
&&
frequency
!==
0
?
1
/
frequency
:
null
;
const
{
twinkle
,
frequency
}
=
obj
.
extData
;
let
pulsePeriod
=
twinkle
&&
frequency
!==
0
?
1
/
frequency
:
null
;
let
color
=
twinkle
&&
frequency
!==
0
?
'#FF0000'
:
null
;
let
color
=
twinkle
&&
frequency
!==
0
?
'#FF0000'
:
null
;
if
(
!
obj
.
baseObjHelper
.
outlineHelper
){
if
(
!
obj
.
baseObjHelper
.
outlineHelper
)
{
obj
.
baseObjHelper
.
setOutlineHelper
(
this
.
outlineHelper
);
obj
.
baseObjHelper
.
setOutlineHelper
(
this
.
outlineHelper
);
}
}
obj
.
baseObjHelper
.
style
.
outlineColor
=
color
;
obj
.
baseObjHelper
.
style
.
outlineColor
=
color
;
...
@@ -159,8 +125,8 @@ export default function marker3DFactory(WrappedComponent = 'div', options) {
...
@@ -159,8 +125,8 @@ export default function marker3DFactory(WrappedComponent = 'div', options) {
});
});
};
};
setTopCardConf
=
(
obj
,
extData
)
=>
{
setTopCardConf
=
(
obj
,
extData
)
=>
{
const
{
title
,
name
}
=
extData
;
const
{
title
,
name
}
=
extData
;
let
cardTitle
=
null
;
let
cardTitle
=
null
;
console
.
log
(
extData
);
console
.
log
(
extData
);
obj
.
baseObjHelper
.
titleConfig
=
{
obj
.
baseObjHelper
.
titleConfig
=
{
...
@@ -189,6 +155,7 @@ export default function marker3DFactory(WrappedComponent = 'div', options) {
...
@@ -189,6 +155,7 @@ export default function marker3DFactory(WrappedComponent = 'div', options) {
// }
// }
obj
.
baseObjHelper
.
title
=
cardTitle
;
obj
.
baseObjHelper
.
title
=
cardTitle
;
};
};
markerDragend
=
(
marker
,
evt
)
=>
{
markerDragend
=
(
marker
,
evt
)
=>
{
if
(
marker
)
{
if
(
marker
)
{
console
.
log
(
marker
.
position
);
console
.
log
(
marker
.
position
);
...
@@ -197,8 +164,8 @@ export default function marker3DFactory(WrappedComponent = 'div', options) {
...
@@ -197,8 +164,8 @@ export default function marker3DFactory(WrappedComponent = 'div', options) {
}
}
};
};
markerCreated
=
(
data
)
=>
{
markerCreated
=
(
data
)
=>
{
le
t
{
isEditMode
}
=
this
.
props
;
cons
t
{
isEditMode
}
=
this
.
props
;
le
t
{
markersCache
}
=
data
;
cons
t
{
markersCache
}
=
data
;
if
(
markersCache
.
cacheMap
.
size
>
0
)
{
if
(
markersCache
.
cacheMap
.
size
>
0
)
{
this
.
props
.
onCreated
(
data
);
this
.
props
.
onCreated
(
data
);
}
}
...
@@ -206,16 +173,28 @@ export default function marker3DFactory(WrappedComponent = 'div', options) {
...
@@ -206,16 +173,28 @@ export default function marker3DFactory(WrappedComponent = 'div', options) {
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
;
markersCache
.
eachValue
(
obj
=>
{
markersCache
.
eachValue
(
obj
=>
{
if
(
isEditMode
){
const
extData
=
obj
.
extData
;
this
.
setTopCardConf
(
obj
,
obj
.
extData
);
if
(
isEditMode
)
{
this
.
setTopCardConf
(
obj
,
extData
);
}
}
if
(
obj
.
extData
.
type
===
'riskSource'
&&
markerType
!==
'impEquipmentMode'
&&
!
isEditMode
)
{
if
(
extData
.
type
===
'riskSource'
&&
markerType
!==
'impEquipmentMode'
&&
!
isEditMode
)
{
this
.
setTwinkleConf
(
obj
);
this
.
setTwinkleConf
(
obj
);
}
}
// 鼠标移入
obj
.
node
.
on
(
EVENT_TYPE_CORE
.
MouseEnter
,
evt
=>
{
if
(
!
isEditMode
)
{
this
.
setTopCardConf
(
obj
,
extData
);
}
});
// 鼠标移出
obj
.
node
.
on
(
EVENT_TYPE_CORE
.
MouseLeave
,
evt
=>
{
if
(
!
isEditMode
)
{
obj
.
baseObjHelper
.
title
=
null
;
}
});
});
});
}
}
buildMarkerOptions
=
(
markers
,
markerType
,
defaultParams
=
{})
=>
{
buildMarkerOptions
=
(
markers
,
markerType
,
defaultParams
=
{})
=>
{
console
.
log
(
markers
);
const
{
isEditMode
}
=
this
.
props
;
const
{
isEditMode
}
=
this
.
props
;
if
(
!
utils
.
isEmpty
(
markers
))
{
if
(
!
utils
.
isEmpty
(
markers
))
{
markers
.
forEach
(
m
=>
{
markers
.
forEach
(
m
=>
{
...
@@ -260,7 +239,7 @@ export default function marker3DFactory(WrappedComponent = 'div', options) {
...
@@ -260,7 +239,7 @@ export default function marker3DFactory(WrappedComponent = 'div', options) {
return
(
return
(
<
WrappedComponent
>
<
WrappedComponent
>
<
Markers
{...
rest
}
draggable
=
{
isEditMode
}
markers
=
{
result
}
events
=
{
this
.
markerEvents
}
onCreated
=
{
this
.
markerCreated
}
/
>
<
Markers
{...
rest
}
draggable
=
{
isEditMode
}
markers
=
{
result
}
events
=
{
this
.
markerEvents
}
onCreated
=
{
this
.
markerCreated
}
/
>
{
!
planStarted
&&
<
PointDialog
style
=
{
dialogStyle
}
ref
=
{
node
=>
(
this
.
pdRef
=
node
)
}
/>
}
{
!
planStarted
&&
<
PointDialog
style
=
{
dialogStyle
}
ref
=
{
node
=>
this
.
pdRef
=
node
}
/>
}
<
/WrappedComponent
>
<
/WrappedComponent
>
);
);
}
}
...
...
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