Commit ccae2ec3 authored by oscar's avatar oscar

提交更新

parent 895d7636
......@@ -2,6 +2,8 @@ cmake_minimum_required(VERSION 3.0.2)
project(third_map)
set(USING_EXE OFF)
SET(CMAKE_BUILD_TYPE "Debug")
#SET(CMAKE_BUILD_TYPE "Release")
......@@ -15,6 +17,7 @@ include_directories(
${PROJECT_SOURCE_DIR}/src/SDK/include/
)
add_definitions(-D_DEBUG_API_)
add_library(odrManager SHARED IMPORTED)
set_target_properties(odrManager PROPERTIES IMPORTED_LOCATION ${PROJECT_SOURCE_DIR}/src/SDK/lib/libOdrManager.so)
......@@ -25,10 +28,12 @@ add_library(${PROJECT_NAME} SHARED
target_link_libraries(${PROJECT_NAME} odrManager)
#add_executable(test_map
# main.cpp
#)
if(USING_EXE)
add_executable(test_map
main.cpp
)
#target_link_libraries(test_map
# ${PROJECT_NAME}
# )
\ No newline at end of file
target_link_libraries(test_map
${PROJECT_NAME}
)
endif()
\ No newline at end of file
......@@ -36,35 +36,65 @@ namespace jf {
{
if (g_load == 0)
return false;
#ifdef _DEBUG_API_
std::vector<OdrInfo> odr = g_map.GetOdrInfoByXY(ptInLoc.dLon, ptInLoc.dLat);
printf("odr size = %d\n", odr.size());
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);
}
#else
std::vector<OdrInfo> odr = g_map.GetOdrInfo(ptInLoc.dLon, ptInLoc.dLat);
#endif
if (odr.size() == 0)
{
printf("not in map lon = %.8f, lat = %.8f\n", ptInLoc.dLon, ptInLoc.dLat);
return false;
std::string roadId = odr[0]._roadID;
std::string sectionId = odr[0]._sectionID;
std::string laneId = odr[0]._laneID;
}
std::string roadId;
#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);
int _sectionId = std::stol(sectionId);
int _laneId = std::stol(laneId);
#ifdef _DEBUG_API_
std::cout << "lOutRaodId = " << lOutRaodId << ",_sectionId = " << _sectionId << ", _laneId = " << _laneId << std::endl;
#endif
char** preRoadId = nullptr;
int preSize = 0;
bool retPre = g_map.GetPreRoadID(roadId.c_str(), preRoadId, preSize);
if (retPre)
{
#ifdef _DEBUG_API_
std::cout << "vctlOutPreRoadId size = " << preSize << std::endl;
#endif
for (int i = 0; i < preSize; i++)
{
std::string prdId = preRoadId[i];
long preIdx = std::stol(prdId);
vctlOutPreRoadId.push_back(preIdx);
#ifdef _DEBUG_API_
std::cout << "vctlOutPreRoadId i = " << i << ", roadId = " << preIdx << std::endl;
#endif
}
}
char** nextRoadId = nullptr;
......@@ -72,13 +102,17 @@ namespace jf {
bool retNext = g_map.GetSucRoadID(roadId.c_str(), nextRoadId, nextSize);
if (retNext)
{
#ifdef _DEBUG_API_
std::cout << "vctlOutNxtRoadId size = " << nextSize << std::endl;
#endif
for (int i = 0; i < nextSize; i++)
{
std::string nextId = nextRoadId[i];
long nextIdx = std::stol(nextId);
vctlOutNxtRoadId.push_back(nextIdx);
#ifdef _DEBUG_API_
std::cout << "vctlOutNxtRoadId i = " << i << ", roadId = " << nextIdx << std::endl;
#endif
}
}
char** allLaneIds = nullptr;
......@@ -86,17 +120,21 @@ namespace jf {
bool retALane = g_map.GetAllDrivingLaneIDS(roadId.c_str(), sectionId.c_str(), allLaneIds, allLaneSize);
if (retALane)
{
#ifdef _DEBUG_API_
std::cout << "GetAllDrivingLaneIDS size = " << allLaneSize << std::endl;
for (int i = 0; i < allLaneSize; i++)
{
std::cout << "GetAllDrivingLaneIDS i = " << i << ", laneId = " << allLaneIds[i] << std::endl;
}
#endif
}
nOutLaneCnt = allLaneSize;
nOutLaneNum = abs(_laneId);
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;
#endif
// "Driving" "Biking" "Shoulder" "SideWalk" "Parking" "Restricted" "Border" "none"
if ("Driving" == typeString)
......@@ -131,10 +169,14 @@ namespace jf {
{
nOutLaneType = LaneType::Ohters;
}
#ifdef _DEBUG_API_
std::cout << "nOutLaneType = " << static_cast<int>(nOutLaneType) << std::endl;
#endif
bool isJunction = g_map.bJunctionRoad(roadId.c_str());
#ifdef _DEBUG_API_
std::cout << "bJunctionRoad = " << isJunction << std::endl;
#endif
if (isJunction)
{
nOutLaneType = LaneType::JunctionLane;
......@@ -142,7 +184,6 @@ namespace jf {
NearestRoadMark mark = g_map.GetNeartestLaneRoadMarkByXY(ptInLoc.dLon, ptInLoc.dLat);
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)
nOutLeftEdgeCrossType = EdgeCrossType::Unable;
else if (mark._leftRoadMark->_type == ODR_ROAD_MARK_TYPE_BROKEN)
......@@ -153,11 +194,13 @@ namespace jf {
nOutLeftEdgeCrossType = EdgeCrossType::RightAble;
else
nOutLeftEdgeCrossType = EdgeCrossType::NotInvestigated;
#ifdef _DEBUG_API_
std::cout << "_leftRoadMark _type = " << mark._leftRoadMark->_type << std::endl;
std::cout << "nOutLeftEdgeCrossType = " << static_cast<int>(nOutLeftEdgeCrossType) << std::endl;
#endif
}
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)
nOutRightEdgeCrossType = EdgeCrossType::Unable;
else if (mark._rightRoadMark->_type == ODR_ROAD_MARK_TYPE_BROKEN)
......@@ -168,13 +211,13 @@ namespace jf {
nOutRightEdgeCrossType = EdgeCrossType::RightAble;
else
nOutRightEdgeCrossType = EdgeCrossType::NotInvestigated;
#ifdef _DEBUG_API_
std::cout << "_rightRoadMark _type = " << mark._rightRoadMark->_type << std::endl;
std::cout << "nOutRightEdgeCrossType = " << static_cast<int>(nOutRightEdgeCrossType) << std::endl;
#endif
}
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);
// std::cout << "GetHdgByXY comValue = " << 90 << ",return = " << angle << std::endl;
// angle = g_map.GetHdgByXY(ptInLoc.dLon,ptInLoc.dLat,180.0);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment