Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
Toggle navigation
This project
Loading...
Sign in
platform
/
fanxing_new
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 2fe5bf34
authored
Mar 06, 2020
by
潘建波
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
修改冲突提交
1 parent
4aaf34ab
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
95 additions
and
90 deletions
src/views/sceneManage/setting/areaconfig/TraficCanvas.vue
src/views/sceneManage/setting/areaconfig/TraficCanvas.vue
View file @
2fe5bf3
...
...
@@ -341,12 +341,12 @@ export default {
typeFlag
:
1
,
//选择属性弹窗状态
lineNum
:
1
,
//车道线/车道序号
curLayerstate
:
false
,
//行人检测区域属性设置
testLayerstate
:
false
,
//测试检测区域属性设置
testLayerstate
:
false
,
//测试检测区域属性设置
polygon_id
:
""
,
//行人检测区域id
polygon_name
:
""
,
//行人检测区域name
markLineType
:
"0"
,
lanuse
:
'0'
,
//车道属性类型
guidingtype
:
''
,
//车道导向类型
lanuse
:
"0"
,
//车道属性类型
guidingtype
:
""
,
//车道导向类型
markLineDirect
:
""
,
childUrl
:
""
,
//红绿灯区域截图
scale
:
{},
//红绿灯区域截图放大倍数
...
...
@@ -354,11 +354,11 @@ export default {
type
:
"1"
,
distribute
:
"1"
,
shap
:
"1"
,
delay
:
3
delay
:
3
},
roiBody
:
{},
XMLStr
:
""
,
eventData
:
[]
eventData
:
[]
};
},
props
:
[
"bgUrl"
],
...
...
@@ -401,21 +401,25 @@ export default {
id
:
"noStopLayer"
,
name
:
"layer"
});
this
.
bicyLayer
=
new
Kinetic
.
Layer
({
//行人检测区域
this
.
bicyLayer
=
new
Kinetic
.
Layer
({
//行人检测区域
id
:
"bicyLayer"
,
name
:
"layer"
});
this
.
densityLayer
=
new
Kinetic
.
Layer
({
//密度
id
:
'densityLayer'
,
name
:
"layer"
this
.
densityLayer
=
new
Kinetic
.
Layer
({
//密度
id
:
"densityLayer"
,
name
:
"layer"
});
this
.
foreignLayer
=
new
Kinetic
.
Layer
({
//异物
id
:
'foreignLayer'
,
name
:
"layer"
this
.
foreignLayer
=
new
Kinetic
.
Layer
({
//异物
id
:
"foreignLayer"
,
name
:
"layer"
});
this
.
testRegionLayer
=
new
Kinetic
.
Layer
({
//测试检测区域
id
:
'testRegionLayer'
,
name
:
"layer"
this
.
testRegionLayer
=
new
Kinetic
.
Layer
({
//测试检测区域
id
:
"testRegionLayer"
,
name
:
"layer"
});
let
shadow
=
new
Kinetic
.
Rect
({
...
...
@@ -455,7 +459,7 @@ export default {
this
.
stage
.
add
(
this
.
noStopLayer
);
this
.
stage
.
add
(
this
.
densityLayer
);
this
.
stage
.
add
(
this
.
foreignLayer
);
this
.
stage
.
add
(
this
.
testRegionLayer
)
this
.
stage
.
add
(
this
.
testRegionLayer
);
this
.
layers
=
[
this
.
testLayer
,
this
.
lineLayer
,
...
...
@@ -602,19 +606,19 @@ export default {
line
.
index
=
ele
.
lane_no
;
let
lane_guid_type
=
0
;
let
lane_use
=
0
;
if
(
obj
.
lanes
.
lane_count
==
1
)
{
lane_guid_type
=
obj
.
lanes
.
lane
.
lane_guiding_type
lane_use
=
obj
.
lanes
.
lane
.
lane_use_type
if
(
obj
.
lanes
.
lane_count
==
1
)
{
lane_guid_type
=
obj
.
lanes
.
lane
.
lane_guiding_type
;
lane_use
=
obj
.
lanes
.
lane
.
lane_use_type
;
}
else
{
lane_guid_type
=
obj
.
lanes
.
lane
[
index
].
lane_guiding_type
;
lane_use
=
obj
.
lanes
.
lane
[
index
].
lane_use_type
lane_use
=
obj
.
lanes
.
lane
[
index
].
lane_use_type
;
}
this
.
roads
[
parseInt
(
ele
.
lane_seq
-
1
)]
=
{
type
:
ele
.
lane_type
,
index
:
ele
.
lane_no
,
direct
:
direct
,
lane_guiding_type
:
lane_guid
_type
,
lane_use_type
:
lane_us
e
lane_guiding_type
:
obj
.
lanes
.
lane
[
index
].
lane_guiding
_type
,
lane_use_type
:
obj
.
lanes
.
lane
[
index
].
lane_use_typ
e
};
}
});
...
...
@@ -636,6 +640,7 @@ export default {
let
bottom
=
points
.
bottom
*
500
;
let
pointsAry
=
[
left
,
top
,
left
,
bottom
,
right
,
bottom
,
right
,
top
];
let
rect
=
this
.
drawRect
(
"morePoints"
,
pointsAry
,
this
.
color
[
3
]);
let
linghtRoi
=
{
light_region_seq
:
1
,
top
:
(
top
/
500
).
toFixed
(
6
),
...
...
@@ -647,7 +652,8 @@ export default {
(
rect
.
light_type
=
ele
.
light_type
),
(
rect
.
light_distribute
=
ele
.
light_distribute
),
(
rect
.
light_shape
=
ele
.
light_shape
),
(
rect
.
light_delay
=
ele
.
light_yellow_delay
||
ele
.
light_yellow_interval
),
(
rect
.
light_delay
=
ele
.
light_yellow_delay
||
ele
.
light_yellow_interval
),
(
rect
.
light_regions
=
{
light_region_count
:
1
,
light_region
:
linghtRoi
...
...
@@ -986,7 +992,7 @@ export default {
this
.
markLineType
=
this
.
roads
[
shape
.
roadIndex
].
type
;
this
.
markLineDirect
=
this
.
roads
[
shape
.
roadIndex
].
direct
;
this
.
guidingtype
=
this
.
roads
[
shape
.
roadIndex
].
lane_guiding_type
;
this
.
lanuse
=
this
.
roads
[
shape
.
roadIndex
].
lane_use_type
||
'0'
;
this
.
lanuse
=
this
.
roads
[
shape
.
roadIndex
].
lane_use_type
||
"0"
;
shape
.
setFill
(
"rgba("
+
this
.
color
[
1
]
+
",0.3)"
);
let
gLine
=
this
.
greenLines
[
shape
.
roadIndex
];
if
(
gLine
.
getParent
().
attrs
.
name
==
"arr"
)
{
...
...
@@ -1030,13 +1036,12 @@ export default {
type
:
shape
.
light_type
,
shap
:
shape
.
light_shape
,
distribute
:
shape
.
light_distribute
,
delay
:
shape
.
light_delay
delay
:
shape
.
light_delay
};
}
else
if
(
this
.
drawState
==
6
||
this
.
drawState
==
7
||
this
.
drawState
==
8
||
this
.
drawState
==
9
this
.
drawState
==
8
)
{
this
.
polygon_name
=
shape
.
polygon_name
;
this
.
polygon_id
=
shape
.
polygon_id
;
...
...
@@ -1115,7 +1120,7 @@ export default {
type
:
"1"
,
distribute
:
"1"
,
shap
:
"1"
,
delay
:
3
delay
:
3
};
this
.
layers
[
this
.
drawState
].
draw
();
},
...
...
@@ -1246,12 +1251,10 @@ export default {
},
0
);
layer
.
draw
();
}
if
(
this
.
drawState
==
6
||
this
.
drawState
==
7
||
this
.
drawState
==
8
)
{
if
(
this
.
drawState
==
6
||
this
.
drawState
==
7
||
this
.
drawState
==
8
)
{
this
.
curLayerstate
=
true
;
}
if
(
this
.
drawState
==
9
)
{
if
(
this
.
drawState
==
9
)
{
this
.
testLayerstate
=
true
;
}
},
...
...
@@ -1316,7 +1319,6 @@ export default {
//清空输入框
this
.
polygon_id
=
""
;
this
.
polygon_name
=
""
;
},
curlayCancel
()
{
let
curLayers
=
this
.
layers
[
this
.
drawState
].
get
(
".rect"
);
...
...
@@ -1442,6 +1444,7 @@ export default {
this
.
roadFlag
=
false
;
break
;
case
2
:
// eslint-disable-next-line no-case-declarations
let
rindex
=
this
.
roads
.
indexOf
(
this
.
selectedShape
);
console
.
log
(
rindex
);
this
.
roads
[
rindex
]
=
""
;
...
...
@@ -1449,6 +1452,7 @@ export default {
case
6
:
this
.
polygon_name
=
""
;
this
.
polygon_id
=
""
;
// eslint-disable-next-line no-fallthrough
default
:
break
;
}
...
...
@@ -1575,7 +1579,7 @@ export default {
type
:
"1"
,
distribute
:
"1"
,
shap
:
"1"
,
delay
:
3
delay
:
3
};
this
.
selectedShape
=
null
;
},
...
...
@@ -1597,9 +1601,9 @@ export default {
color
=
typeof
color
!=
"color"
?
color
:
"#000"
;
// 计算各角度和对应的P2,P3坐标
var
angle
=
Math
.
atan2
(
c1
[
1
]
-
c2
[
1
],
c1
[
0
]
-
c2
[
0
])
*
180
/
Math
.
PI
,
angle1
=
(
angle
+
theta
)
*
Math
.
PI
/
180
,
angle2
=
(
angle
-
theta
)
*
Math
.
PI
/
180
,
var
angle
=
(
Math
.
atan2
(
c1
[
1
]
-
c2
[
1
],
c1
[
0
]
-
c2
[
0
])
*
180
)
/
Math
.
PI
,
angle1
=
((
angle
+
theta
)
*
Math
.
PI
)
/
180
,
angle2
=
((
angle
-
theta
)
*
Math
.
PI
)
/
180
,
topX
=
headlen
*
Math
.
cos
(
angle1
),
topY
=
headlen
*
Math
.
sin
(
angle1
),
botX
=
headlen
*
Math
.
cos
(
angle2
),
...
...
@@ -1609,7 +1613,7 @@ export default {
arrowY
=
c1
[
1
]
-
topY
;
// let line = this.drawLine({x:c1[0],y:c1[1]},{x:c2[0],y:c2[1]},color)
line
.
attrs
.
name
=
"`centerLine`
"
;
line
.
attrs
.
name
=
"centerLine
"
;
arrowX
=
c2
[
0
]
+
topX
;
arrowY
=
c2
[
1
]
+
topY
;
...
...
@@ -1656,38 +1660,41 @@ export default {
// console.log('蓝色车道线')
// console.log(this.blueLines)
this
.
blueLines
.
forEach
((
ele
,
index
)
=>
{
if
(
ele
.
attrs
.
points
[
1
]
-
ele
.
attrs
.
points
[
3
]
>
0
)
{
if
(
ele
.
attrs
.
points
[
1
]
-
ele
.
attrs
.
points
[
3
]
>
0
)
{
var
copypoint
=
Array
.
from
(
ele
.
attrs
.
points
);
ele
.
attrs
.
points
[
0
]
=
copypoint
[
2
]
ele
.
attrs
.
points
[
1
]
=
copypoint
[
3
]
ele
.
attrs
.
points
[
2
]
=
copypoint
[
0
]
ele
.
attrs
.
points
[
3
]
=
copypoint
[
1
]
ele
.
attrs
.
points
[
0
]
=
copypoint
[
2
];
ele
.
attrs
.
points
[
1
]
=
copypoint
[
3
];
ele
.
attrs
.
points
[
2
]
=
copypoint
[
0
];
ele
.
attrs
.
points
[
3
]
=
copypoint
[
1
];
// console.log('*******蓝色车道线*******')
// console.log(ele)
}
})
});
//车道线根据坐标排序
function
sortBlueLine
(
arr
){
// eslint-disable-next-line no-inner-declarations
function
sortBlueLine
(
arr
)
{
var
len
=
arr
.
length
;
for
(
var
i
=
0
;
i
<
len
;
i
++
)
{
for
(
var
j
=
0
;
j
<
len
-
1
-
i
;
j
++
)
{
if
(
arr
[
j
].
attrs
.
points
[
0
]
>
arr
[
j
+
1
].
attrs
.
points
[
0
])
{
//相邻元素两两对比
var
temp
=
arr
[
j
+
1
];
//元素交换
arr
[
j
+
1
]
=
arr
[
j
];
if
(
arr
[
j
].
attrs
.
points
[
0
]
>
arr
[
j
+
1
].
attrs
.
points
[
0
])
{
//相邻元素两两对比
var
temp
=
arr
[
j
+
1
];
//元素交换
arr
[
j
+
1
]
=
arr
[
j
];
arr
[
j
]
=
temp
;
}
}
}
return
arr
;
}
console
.
log
(
'排序后的蓝色车道线'
)
console
.
log
(
sortBlueLine
(
this
.
blueLines
))
console
.
log
(
"排序后的蓝色车道线"
);
console
.
log
(
sortBlueLine
(
this
.
blueLines
));
this
.
blueLines
.
forEach
((
ele
,
index
)
=>
{
let
points
=
this
.
sortLinePoints
(
ele
.
attrs
.
points
);
let
points
=
this
.
sortLinePoints
(
ele
.
attrs
.
points
);
if
(
index
>
0
)
{
//绘制车道
let
lastPoints
=
this
.
sortLinePoints
(
this
.
blueLines
[
index
-
1
].
attrs
.
points
);
let
lastPoints
=
this
.
sortLinePoints
(
this
.
blueLines
[
index
-
1
].
attrs
.
points
);
let
num1
=
Math
.
pow
(
points
[
0
]
-
lastPoints
[
0
],
2
)
+
Math
.
pow
(
points
[
1
]
-
lastPoints
[
1
],
2
)
+
...
...
@@ -1731,8 +1738,7 @@ export default {
(
mPoints
[
0
]
+
mPoints
[
6
])
/
2
,
(
mPoints
[
1
]
+
mPoints
[
7
])
/
2
,
(
mPoints
[
2
]
+
mPoints
[
4
])
/
2
,
(
mPoints
[
3
]
+
mPoints
[
5
])
/
2
,
(
mPoints
[
3
]
+
mPoints
[
5
])
/
2
];
road
.
cPoints
=
cPoints
;
let
cLine
=
this
.
drawLine
(
"morePoints"
,
cPoints
,
this
.
color
[
2
]);
...
...
@@ -1789,7 +1795,6 @@ export default {
childCancle
:
function
()
{
this
.
$refs
.
lightCanvas
.
cancle
();
},
//生成xml
save
:
function
()
{
this
.
cancleSelectedGroup
();
//车牌检测区域
...
...
@@ -2051,7 +2056,7 @@ export default {
this
.
roiBody
.
lanes
=
{
lane_count
:
lanaAry
.
length
?
lanaAry
.
length
:
0
,
lane
:
lanaAry
?
lanaAry
:
[]
}
};
//对向车道
try
{
this
.
subtendLayer
.
get
(
".rect"
).
forEach
((
el
,
index
)
=>
{
...
...
@@ -2094,14 +2099,14 @@ export default {
lightAry
.
push
({
light_seq
:
index
+
1
,
light_type
:
ele
.
light_type
,
light_id
:
ele
.
light_type
,
light_id
:
ele
.
light_type
,
light_distribute
:
ele
.
light_distribute
,
light_number_type
:
ele
.
light_distribute
,
light_number_type
:
ele
.
light_distribute
,
light_yellow_delay
:
Number
(
ele
.
light_delay
),
light_yellow_interval
:
Number
(
ele
.
light_delay
),
light_shape
:
ele
.
light_shape
,
light_shape_type
:
ele
.
light_shape
,
light_regions
:
ele
.
light_regions
,
light_yellow_interval
:
Number
(
ele
.
light_delay
),
light_shape
:
ele
.
light_shape
,
light_shape_type
:
ele
.
light_shape
,
light_regions
:
ele
.
light_regions
});
});
}
catch
(
error
)
{}
...
...
@@ -2245,8 +2250,8 @@ export default {
});
}
testRegion
.
push
({
polygon_id
:
el
.
polygon_id
,
polygon_name
:
el
.
polygon_name
,
polygon_id
:
el
.
polygon_id
,
polygon_name
:
el
.
polygon_name
,
polygon_point_count
:
foAry
.
length
,
point
:
foAry
});
...
...
@@ -2270,48 +2275,48 @@ export default {
(
this
.
needRect
=
false
),
(
this
.
needLine
=
false
),
(
this
.
canvasState
=
0
),
(
this
.
polygon_name
=
''
),
(
this
.
polygon_id
=
''
),
(
this
.
polygon_name
=
""
),
(
this
.
polygon_id
=
""
),
(
this
.
polyline
=
0
);
$
(
".modal-lt button"
).
removeClass
(
"active"
);
},
sortLinePoints
(
pointarr
)
{
try
{
sortLinePoints
(
pointarr
)
{
try
{
let
newpoint
=
[];
if
((
pointarr
[
1
]
-
pointarr
[
3
])
>
0
)
{
newpoint
[
0
]
=
pointarr
[
2
]
newpoint
[
1
]
=
pointarr
[
3
]
newpoint
[
2
]
=
pointarr
[
0
]
newpoint
[
3
]
=
pointarr
[
1
]
if
(
pointarr
[
1
]
-
pointarr
[
3
]
>
0
)
{
newpoint
[
0
]
=
pointarr
[
2
];
newpoint
[
1
]
=
pointarr
[
3
];
newpoint
[
2
]
=
pointarr
[
0
];
newpoint
[
3
]
=
pointarr
[
1
];
}
else
{
newpoint
=
pointarr
newpoint
=
pointarr
;
}
return
newpoint
}
catch
(
err
)
{
console
.
log
(
err
)
return
newpoint
;
}
catch
(
err
)
{
console
.
log
(
err
);
}
},
changetestid
()
{
changetestid
()
{
this
.
eventData
.
forEach
(
ele
=>
{
if
(
ele
.
value
==
this
.
polygon_id
)
{
this
.
polygon_name
=
ele
.
name
if
(
ele
.
value
==
this
.
polygon_id
)
{
this
.
polygon_name
=
ele
.
name
;
}
})
});
}
},
mounted
()
{
console
.
log
(
eventJson
)
this
.
eventData
=
eventJson
console
.
log
(
eventJson
);
this
.
eventData
=
eventJson
;
// this.stageInit()
key
(
'alt+1'
,()
=>
{
if
(
this
.
istest
)
{
this
.
istest
=
false
key
(
"alt+1"
,
()
=>
{
if
(
this
.
istest
)
{
this
.
istest
=
false
;
}
else
{
this
.
istest
=
true
this
.
istest
=
true
;
}
})
});
}
};
};
</
script
>
<
style
scoped
>
...
...
Write
Preview
Markdown
is supported
Attach a file
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 post a comment