Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
J
jfxmap_python
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
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
oscar
jfxmap_python
Commits
f284442e
Commit
f284442e
authored
Jan 26, 2022
by
oscar
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
提交接口修改
parent
872bbca3
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
52 additions
and
48 deletions
+52
-48
HdLib.cpp
jfxmap/offline/Core/HdLib.cpp
+43
-0
HdLib.h
jfxmap/offline/Core/HdLib.h
+1
-1
MapLib.cpp
jfxmap/offline/Core/MapLib.cpp
+4
-0
MapLib.h
jfxmap/offline/Core/MapLib.h
+2
-0
MapApi.hpp
jfxmap/offline/Public/MapApi.hpp
+1
-0
MapInterface.cpp
python_so/MapInterface.cpp
+1
-47
No files found.
jfxmap/offline/Core/HdLib.cpp
View file @
f284442e
...
...
@@ -78,6 +78,49 @@ bool HdLib::GetDataNearby(const Point &ptPoint, float fLonIntervalHalfMetre, flo
return
true
;
}
// The function will return YES if the point x,y is inside the polygon, or
// NO if it is not. If the point is exactly on the edge of the polygon,
// then the function may return YES or NO.
bool
IsPointInPolygon
(
std
::
vector
<
std
::
vector
<
float
>>&
poly
,
Point
&
pt
)
{
int
i
,
j
;
bool
c
=
false
;
for
(
i
=
0
,
j
=
poly
.
size
()
-
1
;
i
<
poly
.
size
();
j
=
i
++
)
{
if
((((
poly
[
i
][
1
]
<=
pt
.
dLat
)
&&
(
pt
.
dLat
<
poly
[
j
][
1
]))
||
((
poly
[
j
][
1
]
<=
pt
.
dLat
)
&&
(
pt
.
dLat
<
poly
[
i
][
1
])))
&&
(
pt
.
dLon
<
(
poly
[
j
][
0
]
-
poly
[
i
][
0
])
*
(
pt
.
dLat
-
poly
[
i
][
1
])
/
(
poly
[
j
][
1
]
-
poly
[
i
][
1
])
+
poly
[
i
][
0
]))
{
c
=
!
c
;
}
}
return
c
;
}
bool
HdLib
::
GetIsInCross
(
const
Point
&
ptPoint
)
{
std
::
vector
<
const
HdLink
*>
vcthlLinkNearby
=
{};
if
(
false
==
GetDataNearby
(
ptInLoc
,
10.0
f
,
10.0
f
,
vcthlLinkNearby
))
{
return
false
;
}
isInCross
=
0
;
for
(
int
i
=
0
;
i
<
vcthlLinkNearby
.
size
();
i
++
)
{
if
(
vcthlLinkNearby
[
i
])
{
for
(
int
j
=
0
;
j
<
vcthlLinkNearby
[
i
]
->
vctcrCrossing
;
j
++
)
{
if
(
IsPointInPolygon
(
vcthlLinkNearby
[
i
]
->
vctcrCrossing
[
j
]
->
vctvdGeoArea
,
ptInLoc
))
{
return
true
;
}
}
}
}
return
false
;
}
/**
* 求某个点在一系列轨迹点上的Index位置
*/
...
...
jfxmap/offline/Core/HdLib.h
View file @
f284442e
...
...
@@ -152,7 +152,7 @@ class HdLib {
// 可以选择GetDataNearby_param参数过滤和排序
// TODO : 为了兼容旧版本,hdlib不做tile管理
bool
GetDataNearby
(
const
Point
&
ptPoint
,
float
lon_interval_half_metre
,
float
flatintervalhalfmetre
,
std
::
vector
<
const
HdLink
*>
&
vcthlOutLink
,
GetDataNearby_param
p
=
GetDataNearby_param
::
none
,
bool
bManageTile
=
true
);
bool
GetIsInCross
(
const
Point
&
ptPoint
);
// 查看link是否可达
bool
IsLinkArrivable
(
const
HdLink
*
hlFrom
,
const
HdLink
*
hlTo
,
int
nMaxDepth
=
5
);
bool
LoadTile
(
const
Point
&
ptPoint
,
bool
nManageTile
=
true
);
...
...
jfxmap/offline/Core/MapLib.cpp
View file @
f284442e
...
...
@@ -64,6 +64,10 @@ bool MapLib::GetLinkPreNxt(const HdLinkId &lLinkId, std::vector<HdLinkId> &vctli
void
MapLib
::
HmmBindRoad
(
const
BindRoadInput
&
input
,
BindRoadOutput
&
output
)
{
return
m_brdBindroad
.
BindRoadHmm
(
input
,
output
);
}
// bool MapLib::GetDataNearby(const Point &ptPoint, float fLonIntervalHalfMetre, float fLatIntervalHalfMetre, std::vector<HdLinkId> &vcthlOutLink) { return m_spHdLib->GetDataNearby(ptPoint, fLonIntervalHalfMetre, fLatIntervalHalfMetre, vcthlOutLink); }
bool
MapLib
::
GetIsInCross
(
const
Point
&
ptPoint
)
{
return
m_spHdLib
->
GetIsInCross
(
ptPoint
);
}
bool
MapLib
::
GetNearEndpoints
(
const
Point
&
ptPoint
,
std
::
vector
<
Point
>
&
vctptOutPoint
,
std
::
vector
<
LinkEndpoint
>
&
vctleOutLinkEp
,
std
::
vector
<
double
>
&
vctdOutDistance
)
{
return
m_spHdLib
->
GetNearEndpoints
(
ptPoint
,
MapConfig
::
route_rect_lon
,
MapConfig
::
route_rect_lat
,
vctptOutPoint
,
vctleOutLinkEp
,
vctdOutDistance
);
...
...
jfxmap/offline/Core/MapLib.h
View file @
f284442e
...
...
@@ -16,6 +16,8 @@ class MapLib {
bool
BFSLinks
(
const
HdLinkId
&
from
,
double
&
ret
,
bool
backward
,
bool
&
outFound
,
double
outIterMetre
,
HdLinkId
&
outLink
);
void
HmmBindRoad
(
const
BindRoadInput
&
input
,
BindRoadOutput
&
output
);
bool
GetDataNearby
(
const
Point
&
ptPoint
,
float
fLonIntervalHalfMetre
,
float
fLatIntervalHalfMetre
,
std
::
vector
<
HdLinkId
>
&
vcthlOutLink
);
bool
GetIsInCross
(
const
Point
&
ptPoint
);
/**
* @brief 初始化
...
...
jfxmap/offline/Public/MapApi.hpp
View file @
f284442e
...
...
@@ -16,6 +16,7 @@ class MapLib {
bool
BFSLinks
(
const
HdLinkId
&
from
,
double
&
ret
,
bool
backward
,
bool
&
outFound
,
double
outIterMetre
,
HdLinkId
&
outLink
);
bool
HmmBindRoad
(
const
BindRoadInput
&
input
,
BindRoadOutput
&
output
);
bool
GetDataNearby
(
const
Point
&
ptPoint
,
float
fLonIntervalHalfMetre
,
float
fLatIntervalHalfMetre
,
std
::
vector
<
HdLinkId
>
&
vcthlOutLink
);
bool
GetIsInCross
(
const
Point
&
ptPoint
);
/**
* @brief 初始化
...
...
python_so/MapInterface.cpp
View file @
f284442e
...
...
@@ -22,25 +22,6 @@ bool MapInterface::GetMapData(const Point &ptInLoc, double dCarAngle, int &nOutL
return
GetMapData
(
ptInLoc
,
dCarAngle
,
lRoadId
,
vctlPreRoadId
,
vctlNxtRoadId
,
nOutLaneCnt
,
nOutLaneNum
,
nOutLaneType
,
nOutLeftEdgeCrossType
,
nOutRightEdgeCrossType
,
nOutSpeedLimit
,
dOutLaneAngle
,
ptOutFoot
,
isInCross
);
}
// The function will return YES if the point x,y is inside the polygon, or
// NO if it is not. If the point is exactly on the edge of the polygon,
// then the function may return YES or NO.
bool
IsPointInPolygon
(
std
::
vector
<
std
::
vector
<
float
>>&
poly
,
Point
&
pt
)
{
int
i
,
j
;
bool
c
=
false
;
for
(
i
=
0
,
j
=
poly
.
size
()
-
1
;
i
<
poly
.
size
();
j
=
i
++
)
{
if
((((
poly
[
i
][
1
]
<=
pt
.
dLat
)
&&
(
pt
.
dLat
<
poly
[
j
][
1
]))
||
((
poly
[
j
][
1
]
<=
pt
.
dLat
)
&&
(
pt
.
dLat
<
poly
[
i
][
1
])))
&&
(
pt
.
dLon
<
(
poly
[
j
][
0
]
-
poly
[
i
][
0
])
*
(
pt
.
dLat
-
poly
[
i
][
1
])
/
(
poly
[
j
][
1
]
-
poly
[
i
][
1
])
+
poly
[
i
][
0
]))
{
c
=
!
c
;
}
}
return
c
;
}
bool
MapInterface
::
GetMapData
(
const
Point
&
ptInLoc
,
double
dCarAngle
,
long
&
lOutRaodId
,
std
::
vector
<
long
>
&
vctlOutPreRoadId
,
std
::
vector
<
long
>
&
vctlOutNxtRoadId
,
int
&
nOutLaneCnt
,
int
&
nOutLaneNum
,
LaneType
&
nOutLaneType
,
EdgeCrossType
&
nOutLeftEdgeCrossType
,
EdgeCrossType
&
nOutRightEdgeCrossType
,
int
&
nOutSpeedLimit
,
double
&
dOutLaneAngle
,
Point
&
ptOutFoot
,
int
&
isInCross
)
{
std
::
vector
<
HdLinkId
>
vcthlLinkIds
=
{};
...
...
@@ -59,36 +40,9 @@ bool MapInterface::GetMapData(const Point &ptInLoc, double dCarAngle, long &lOut
//std::cout << "MapInterface::GetMapData(), Locate lane failed." << std::endl;
return
false
;
}
std
::
vector
<
HdLinkId
>
vcthlLinkNearby
=
{};
if
(
false
==
m_mlMapLib
.
GetDataNearby
(
ptInLoc
,
10.0
f
,
10.0
f
,
vcthlLinkNearby
))
{
nOutLaneCnt
=
0
;
nOutLaneNum
=
0
;
nOutLaneType
=
LaneType
::
NotInvestigated
;
nOutLeftEdgeCrossType
=
EdgeCrossType
::
NotInvestigated
;
nOutRightEdgeCrossType
=
EdgeCrossType
::
NotInvestigated
;
nOutSpeedLimit
=
0
;
dOutLaneAngle
=
0.0
;
ptOutFoot
=
ptInLoc
;
return
false
;
}
for
(
int
i
=
0
;
i
<
vcthlLinkNearby
.
size
();
i
++
)
{
const
HdLinkId
&
hlLinkId
=
vcthlLinkNearby
[
i
];
const
HdLink
*
cphlLink
=
m_mlMapLib
.
GetLinkData
(
hlLinkId
);
if
(
cphlLink
)
{
for
(
int
j
=
0
;
j
<
cphlLink
->
vctcrCrossing
;
j
++
)
{
if
(
IsPointInPolygon
(
cphlLink
->
vctcrCrossing
[
j
]
->
vctvdGeoArea
,
ptInLoc
))
if
(
true
==
m_mlMapLib
.
GetIsInCross
(
ptInLoc
))
{
isInCross
=
1
;
break
;
}
}
}
if
(
isInCross
==
1
)
break
;
}
int
nIndex
=
0
;
double
dMinAngleDiff
=
std
::
numeric_limits
<
double
>::
max
();
...
...
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