Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
T
thirdparty_map
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
thirdparty_map
Commits
ccae2ec3
Commit
ccae2ec3
authored
Mar 31, 2022
by
oscar
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
提交更新
parent
895d7636
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
65 additions
and
17 deletions
+65
-17
CMakeLists.txt
CMakeLists.txt
+12
-7
MapInterface.cpp
src/MapInterface.cpp
+53
-10
No files found.
CMakeLists.txt
View file @
ccae2ec3
...
@@ -2,6 +2,8 @@ cmake_minimum_required(VERSION 3.0.2)
...
@@ -2,6 +2,8 @@ cmake_minimum_required(VERSION 3.0.2)
project
(
third_map
)
project
(
third_map
)
set
(
USING_EXE OFF
)
SET
(
CMAKE_BUILD_TYPE
"Debug"
)
SET
(
CMAKE_BUILD_TYPE
"Debug"
)
#SET(CMAKE_BUILD_TYPE "Release")
#SET(CMAKE_BUILD_TYPE "Release")
...
@@ -15,6 +17,7 @@ include_directories(
...
@@ -15,6 +17,7 @@ include_directories(
${
PROJECT_SOURCE_DIR
}
/src/SDK/include/
${
PROJECT_SOURCE_DIR
}
/src/SDK/include/
)
)
add_definitions
(
-D_DEBUG_API_
)
add_library
(
odrManager SHARED IMPORTED
)
add_library
(
odrManager SHARED IMPORTED
)
set_target_properties
(
odrManager PROPERTIES IMPORTED_LOCATION
${
PROJECT_SOURCE_DIR
}
/src/SDK/lib/libOdrManager.so
)
set_target_properties
(
odrManager PROPERTIES IMPORTED_LOCATION
${
PROJECT_SOURCE_DIR
}
/src/SDK/lib/libOdrManager.so
)
...
@@ -25,10 +28,12 @@ add_library(${PROJECT_NAME} SHARED
...
@@ -25,10 +28,12 @@ add_library(${PROJECT_NAME} SHARED
target_link_libraries
(
${
PROJECT_NAME
}
odrManager
)
target_link_libraries
(
${
PROJECT_NAME
}
odrManager
)
#add_executable(test_map
if
(
USING_EXE
)
# main.cpp
add_executable
(
test_map
#)
main.cpp
)
#target_link_libraries(test_map
target_link_libraries
(
test_map
# ${PROJECT_NAME}
${
PROJECT_NAME
}
# )
)
\ No newline at end of file
endif
()
\ No newline at end of file
src/MapInterface.cpp
View file @
ccae2ec3
...
@@ -36,35 +36,65 @@ namespace jf {
...
@@ -36,35 +36,65 @@ namespace jf {
{
{
if
(
g_load
==
0
)
if
(
g_load
==
0
)
return
false
;
return
false
;
#ifdef _DEBUG_API_
std
::
vector
<
OdrInfo
>
odr
=
g_map
.
GetOdrInfoByXY
(
ptInLoc
.
dLon
,
ptInLoc
.
dLat
);
std
::
vector
<
OdrInfo
>
odr
=
g_map
.
GetOdrInfoByXY
(
ptInLoc
.
dLon
,
ptInLoc
.
dLat
);
printf
(
"odr size = %d
\n
"
,
odr
.
size
());
printf
(
"odr size = %d
\n
"
,
odr
.
size
());
for
(
auto
iter
:
odr
)
for
(
auto
iter
:
odr
)
{
{
printf
(
"roadID = %s,sectionID = %s,laneID = %s, _s = %f. _t = %f
\n
"
,
iter
.
_roadID
,
iter
.
_sectionID
,
iter
.
_laneID
,
iter
.
_s
,
iter
.
_t
);
printf
(
"roadID = %s,sectionID = %s,laneID = %s, _s = %f. _t = %f
\n
"
,
iter
.
_roadID
,
iter
.
_sectionID
,
iter
.
_laneID
,
iter
.
_s
,
iter
.
_t
);
}
}
#else
std
::
vector
<
OdrInfo
>
odr
=
g_map
.
GetOdrInfo
(
ptInLoc
.
dLon
,
ptInLoc
.
dLat
);
#endif
if
(
odr
.
size
()
==
0
)
if
(
odr
.
size
()
==
0
)
{
printf
(
"not in map lon = %.8f, lat = %.8f
\n
"
,
ptInLoc
.
dLon
,
ptInLoc
.
dLat
);
return
false
;
return
false
;
std
::
string
roadId
=
odr
[
0
].
_roadID
;
}
std
::
string
sectionId
=
odr
[
0
].
_sectionID
;
std
::
string
roadId
;
std
::
string
laneId
=
odr
[
0
].
_laneID
;
#ifdef _DEBUG_API_
double
angle
=
g_map
.
GetHdgByXY
(
3926.381879
,
11180.870534
,
dCarAngle
,
roadId
);
std
::
cout
<<
"GetHdgByXY comValue = "
<<
dCarAngle
<<
",return = "
<<
angle
<<
",roadId = "
<<
roadId
<<
std
::
endl
;
#else
double
angle
=
g_map
.
GetHdg
(
ptInLoc
.
dLon
,
ptInLoc
.
dLat
,
dCarAngle
,
roadId
);
#endif
dOutLaneAngle
=
angle
;
std
::
string
sectionId
;
std
::
string
laneId
;
for
(
auto
its
:
odr
)
{
std
::
string
id
=
its
.
_roadID
;
if
(
id
==
roadId
)
{
sectionId
=
its
.
_sectionID
;
laneId
=
its
.
_laneID
;
break
;
}
}
lOutRaodId
=
std
::
stol
(
roadId
);
lOutRaodId
=
std
::
stol
(
roadId
);
int
_sectionId
=
std
::
stol
(
sectionId
);
int
_sectionId
=
std
::
stol
(
sectionId
);
int
_laneId
=
std
::
stol
(
laneId
);
int
_laneId
=
std
::
stol
(
laneId
);
#ifdef _DEBUG_API_
std
::
cout
<<
"lOutRaodId = "
<<
lOutRaodId
<<
",_sectionId = "
<<
_sectionId
<<
", _laneId = "
<<
_laneId
<<
std
::
endl
;
std
::
cout
<<
"lOutRaodId = "
<<
lOutRaodId
<<
",_sectionId = "
<<
_sectionId
<<
", _laneId = "
<<
_laneId
<<
std
::
endl
;
#endif
char
**
preRoadId
=
nullptr
;
char
**
preRoadId
=
nullptr
;
int
preSize
=
0
;
int
preSize
=
0
;
bool
retPre
=
g_map
.
GetPreRoadID
(
roadId
.
c_str
(),
preRoadId
,
preSize
);
bool
retPre
=
g_map
.
GetPreRoadID
(
roadId
.
c_str
(),
preRoadId
,
preSize
);
if
(
retPre
)
if
(
retPre
)
{
{
#ifdef _DEBUG_API_
std
::
cout
<<
"vctlOutPreRoadId size = "
<<
preSize
<<
std
::
endl
;
std
::
cout
<<
"vctlOutPreRoadId size = "
<<
preSize
<<
std
::
endl
;
#endif
for
(
int
i
=
0
;
i
<
preSize
;
i
++
)
for
(
int
i
=
0
;
i
<
preSize
;
i
++
)
{
{
std
::
string
prdId
=
preRoadId
[
i
];
std
::
string
prdId
=
preRoadId
[
i
];
long
preIdx
=
std
::
stol
(
prdId
);
long
preIdx
=
std
::
stol
(
prdId
);
vctlOutPreRoadId
.
push_back
(
preIdx
);
vctlOutPreRoadId
.
push_back
(
preIdx
);
#ifdef _DEBUG_API_
std
::
cout
<<
"vctlOutPreRoadId i = "
<<
i
<<
", roadId = "
<<
preIdx
<<
std
::
endl
;
std
::
cout
<<
"vctlOutPreRoadId i = "
<<
i
<<
", roadId = "
<<
preIdx
<<
std
::
endl
;
#endif
}
}
}
}
char
**
nextRoadId
=
nullptr
;
char
**
nextRoadId
=
nullptr
;
...
@@ -72,13 +102,17 @@ namespace jf {
...
@@ -72,13 +102,17 @@ namespace jf {
bool
retNext
=
g_map
.
GetSucRoadID
(
roadId
.
c_str
(),
nextRoadId
,
nextSize
);
bool
retNext
=
g_map
.
GetSucRoadID
(
roadId
.
c_str
(),
nextRoadId
,
nextSize
);
if
(
retNext
)
if
(
retNext
)
{
{
#ifdef _DEBUG_API_
std
::
cout
<<
"vctlOutNxtRoadId size = "
<<
nextSize
<<
std
::
endl
;
std
::
cout
<<
"vctlOutNxtRoadId size = "
<<
nextSize
<<
std
::
endl
;
#endif
for
(
int
i
=
0
;
i
<
nextSize
;
i
++
)
for
(
int
i
=
0
;
i
<
nextSize
;
i
++
)
{
{
std
::
string
nextId
=
nextRoadId
[
i
];
std
::
string
nextId
=
nextRoadId
[
i
];
long
nextIdx
=
std
::
stol
(
nextId
);
long
nextIdx
=
std
::
stol
(
nextId
);
vctlOutNxtRoadId
.
push_back
(
nextIdx
);
vctlOutNxtRoadId
.
push_back
(
nextIdx
);
#ifdef _DEBUG_API_
std
::
cout
<<
"vctlOutNxtRoadId i = "
<<
i
<<
", roadId = "
<<
nextIdx
<<
std
::
endl
;
std
::
cout
<<
"vctlOutNxtRoadId i = "
<<
i
<<
", roadId = "
<<
nextIdx
<<
std
::
endl
;
#endif
}
}
}
}
char
**
allLaneIds
=
nullptr
;
char
**
allLaneIds
=
nullptr
;
...
@@ -86,17 +120,21 @@ namespace jf {
...
@@ -86,17 +120,21 @@ namespace jf {
bool
retALane
=
g_map
.
GetAllDrivingLaneIDS
(
roadId
.
c_str
(),
sectionId
.
c_str
(),
allLaneIds
,
allLaneSize
);
bool
retALane
=
g_map
.
GetAllDrivingLaneIDS
(
roadId
.
c_str
(),
sectionId
.
c_str
(),
allLaneIds
,
allLaneSize
);
if
(
retALane
)
if
(
retALane
)
{
{
#ifdef _DEBUG_API_
std
::
cout
<<
"GetAllDrivingLaneIDS size = "
<<
allLaneSize
<<
std
::
endl
;
std
::
cout
<<
"GetAllDrivingLaneIDS size = "
<<
allLaneSize
<<
std
::
endl
;
for
(
int
i
=
0
;
i
<
allLaneSize
;
i
++
)
for
(
int
i
=
0
;
i
<
allLaneSize
;
i
++
)
{
{
std
::
cout
<<
"GetAllDrivingLaneIDS i = "
<<
i
<<
", laneId = "
<<
allLaneIds
[
i
]
<<
std
::
endl
;
std
::
cout
<<
"GetAllDrivingLaneIDS i = "
<<
i
<<
", laneId = "
<<
allLaneIds
[
i
]
<<
std
::
endl
;
}
}
#endif
}
}
nOutLaneCnt
=
allLaneSize
;
nOutLaneCnt
=
allLaneSize
;
nOutLaneNum
=
abs
(
_laneId
);
nOutLaneNum
=
abs
(
_laneId
);
std
::
string
typeString
=
g_map
.
GetLaneTypeString
(
roadId
.
c_str
(),
sectionId
.
c_str
(),
laneId
.
c_str
());
std
::
string
typeString
=
g_map
.
GetLaneTypeString
(
roadId
.
c_str
(),
sectionId
.
c_str
(),
laneId
.
c_str
());
#ifdef _DEBUG_API_
std
::
cout
<<
"GetLaneTypeString type = "
<<
typeString
<<
std
::
endl
;
std
::
cout
<<
"GetLaneTypeString type = "
<<
typeString
<<
std
::
endl
;
#endif
// "Driving" "Biking" "Shoulder" "SideWalk" "Parking" "Restricted" "Border" "none"
// "Driving" "Biking" "Shoulder" "SideWalk" "Parking" "Restricted" "Border" "none"
if
(
"Driving"
==
typeString
)
if
(
"Driving"
==
typeString
)
...
@@ -131,10 +169,14 @@ namespace jf {
...
@@ -131,10 +169,14 @@ namespace jf {
{
{
nOutLaneType
=
LaneType
::
Ohters
;
nOutLaneType
=
LaneType
::
Ohters
;
}
}
#ifdef _DEBUG_API_
std
::
cout
<<
"nOutLaneType = "
<<
static_cast
<
int
>
(
nOutLaneType
)
<<
std
::
endl
;
std
::
cout
<<
"nOutLaneType = "
<<
static_cast
<
int
>
(
nOutLaneType
)
<<
std
::
endl
;
#endif
bool
isJunction
=
g_map
.
bJunctionRoad
(
roadId
.
c_str
());
bool
isJunction
=
g_map
.
bJunctionRoad
(
roadId
.
c_str
());
#ifdef _DEBUG_API_
std
::
cout
<<
"bJunctionRoad = "
<<
isJunction
<<
std
::
endl
;
std
::
cout
<<
"bJunctionRoad = "
<<
isJunction
<<
std
::
endl
;
#endif
if
(
isJunction
)
if
(
isJunction
)
{
{
nOutLaneType
=
LaneType
::
JunctionLane
;
nOutLaneType
=
LaneType
::
JunctionLane
;
...
@@ -142,7 +184,6 @@ namespace jf {
...
@@ -142,7 +184,6 @@ namespace jf {
NearestRoadMark
mark
=
g_map
.
GetNeartestLaneRoadMarkByXY
(
ptInLoc
.
dLon
,
ptInLoc
.
dLat
);
NearestRoadMark
mark
=
g_map
.
GetNeartestLaneRoadMarkByXY
(
ptInLoc
.
dLon
,
ptInLoc
.
dLat
);
if
(
mark
.
_leftRoadMark
)
if
(
mark
.
_leftRoadMark
)
{
{
std
::
cout
<<
"_leftRoadMark _type = "
<<
mark
.
_leftRoadMark
->
_type
<<
std
::
endl
;
if
(
mark
.
_leftRoadMark
->
_type
==
ODR_ROAD_MARK_TYPE_SOLID
||
mark
.
_leftRoadMark
->
_type
==
ODR_ROAD_MARK_TYPE_SOLID_SOLID
)
if
(
mark
.
_leftRoadMark
->
_type
==
ODR_ROAD_MARK_TYPE_SOLID
||
mark
.
_leftRoadMark
->
_type
==
ODR_ROAD_MARK_TYPE_SOLID_SOLID
)
nOutLeftEdgeCrossType
=
EdgeCrossType
::
Unable
;
nOutLeftEdgeCrossType
=
EdgeCrossType
::
Unable
;
else
if
(
mark
.
_leftRoadMark
->
_type
==
ODR_ROAD_MARK_TYPE_BROKEN
)
else
if
(
mark
.
_leftRoadMark
->
_type
==
ODR_ROAD_MARK_TYPE_BROKEN
)
...
@@ -153,11 +194,13 @@ namespace jf {
...
@@ -153,11 +194,13 @@ namespace jf {
nOutLeftEdgeCrossType
=
EdgeCrossType
::
RightAble
;
nOutLeftEdgeCrossType
=
EdgeCrossType
::
RightAble
;
else
else
nOutLeftEdgeCrossType
=
EdgeCrossType
::
NotInvestigated
;
nOutLeftEdgeCrossType
=
EdgeCrossType
::
NotInvestigated
;
#ifdef _DEBUG_API_
std
::
cout
<<
"_leftRoadMark _type = "
<<
mark
.
_leftRoadMark
->
_type
<<
std
::
endl
;
std
::
cout
<<
"nOutLeftEdgeCrossType = "
<<
static_cast
<
int
>
(
nOutLeftEdgeCrossType
)
<<
std
::
endl
;
std
::
cout
<<
"nOutLeftEdgeCrossType = "
<<
static_cast
<
int
>
(
nOutLeftEdgeCrossType
)
<<
std
::
endl
;
#endif
}
}
if
(
mark
.
_rightRoadMark
)
if
(
mark
.
_rightRoadMark
)
{
{
std
::
cout
<<
"_rightRoadMark _type = "
<<
mark
.
_rightRoadMark
->
_type
<<
std
::
endl
;
if
(
mark
.
_rightRoadMark
->
_type
==
ODR_ROAD_MARK_TYPE_SOLID
||
mark
.
_leftRoadMark
->
_type
==
ODR_ROAD_MARK_TYPE_SOLID_SOLID
)
if
(
mark
.
_rightRoadMark
->
_type
==
ODR_ROAD_MARK_TYPE_SOLID
||
mark
.
_leftRoadMark
->
_type
==
ODR_ROAD_MARK_TYPE_SOLID_SOLID
)
nOutRightEdgeCrossType
=
EdgeCrossType
::
Unable
;
nOutRightEdgeCrossType
=
EdgeCrossType
::
Unable
;
else
if
(
mark
.
_rightRoadMark
->
_type
==
ODR_ROAD_MARK_TYPE_BROKEN
)
else
if
(
mark
.
_rightRoadMark
->
_type
==
ODR_ROAD_MARK_TYPE_BROKEN
)
...
@@ -168,13 +211,13 @@ namespace jf {
...
@@ -168,13 +211,13 @@ namespace jf {
nOutRightEdgeCrossType
=
EdgeCrossType
::
RightAble
;
nOutRightEdgeCrossType
=
EdgeCrossType
::
RightAble
;
else
else
nOutRightEdgeCrossType
=
EdgeCrossType
::
NotInvestigated
;
nOutRightEdgeCrossType
=
EdgeCrossType
::
NotInvestigated
;
#ifdef _DEBUG_API_
std
::
cout
<<
"_rightRoadMark _type = "
<<
mark
.
_rightRoadMark
->
_type
<<
std
::
endl
;
std
::
cout
<<
"nOutRightEdgeCrossType = "
<<
static_cast
<
int
>
(
nOutRightEdgeCrossType
)
<<
std
::
endl
;
std
::
cout
<<
"nOutRightEdgeCrossType = "
<<
static_cast
<
int
>
(
nOutRightEdgeCrossType
)
<<
std
::
endl
;
#endif
}
}
nOutSpeedLimit
=
0
;
nOutSpeedLimit
=
0
;
double
angle
=
g_map
.
GetHdgByXY
(
3926.381879
,
11180.870534
,
dCarAngle
);
std
::
cout
<<
"GetHdgByXY comValue = "
<<
dCarAngle
<<
",return = "
<<
angle
<<
std
::
endl
;
dOutLaneAngle
=
angle
;
// angle = g_map.GetHdgByXY(ptInLoc.dLon,ptInLoc.dLat,90.0);
// angle = g_map.GetHdgByXY(ptInLoc.dLon,ptInLoc.dLat,90.0);
// std::cout << "GetHdgByXY comValue = " << 90 << ",return = " << angle << std::endl;
// std::cout << "GetHdgByXY comValue = " << 90 << ",return = " << angle << std::endl;
// angle = g_map.GetHdgByXY(ptInLoc.dLon,ptInLoc.dLat,180.0);
// angle = g_map.GetHdgByXY(ptInLoc.dLon,ptInLoc.dLat,180.0);
...
...
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