Commit a61eb045 authored by oscar's avatar oscar

提交接口变动

parent 48059d99
......@@ -76,8 +76,8 @@ namespace jf {
bool GetMapData(const Point& ptInLoc, double dCarAngle, long& lOutRaodId, std::vector<long>& vctlOutPreRoadId, std::vector<long>& vctlOutNxtRoadId, int& nLaneCnt, int& nOutLaneNum, LaneType& nOutLaneType, EdgeCrossType& nOutLeftEdgeCrossType,
EdgeCrossType& nOutRightEdgeCrossType, int& nOutSpeedLimit, double& dOutLaneAngle, Point& ptOutFoot);
bool GetMapIDS(const Point& ptInLoc, int& id);
bool GetMapIDS(const Point& ptInLoc,double dCarAngle, int& id);
};
} // namespace jf
#endif
\ No newline at end of file
#endif
......@@ -48,7 +48,7 @@ namespace jf {
#endif
if (odr.size() == 0)
{
printf("not in map lon = %.8f, lat = %.8f\n", ptInLoc.dLon, ptInLoc.dLat);
printf("not 2 in map lon = %.8f, lat = %.8f\n", ptInLoc.dLon, ptInLoc.dLat);
return false;
}
std::string roadId;
......@@ -56,10 +56,12 @@ namespace jf {
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);
double carAngle = (90 - dCarAngle)/180*3.1415926;
double angle = g_map.GetHdg(ptInLoc.dLon, ptInLoc.dLat, dCarAngle, roadId);
#endif
dOutLaneAngle = angle;
dOutLaneAngle = -(angle*180/3.1415926 - 90);
if(dOutLaneAngle < 0)
dOutLaneAngle += 360;
std::string sectionId;
std::string laneId;
for (auto its : odr)
......@@ -75,7 +77,8 @@ namespace jf {
lOutRaodId = std::stol(roadId);
int _sectionId = sectionId == "" ? 0 : std::stol(sectionId);
int _laneId = laneId == "" ? 0 : std::stol(laneId);
int _laneId = laneId == "" ? 0: std::stol(laneId);
//printf("GetHdg laneId = %d, dCarAngle = %f, carAngle = %f, angle = %f, dOutLandAngle = %f,ptInLoc.dLon = %.8f, ptInLoc.dLat = %.8f\n",_laneId,dCarAngle,carAngle,angle,dOutLaneAngle,ptInLoc.dLon, ptInLoc.dLat);
#ifdef _DEBUG_API_
std::cout << "lOutRaodId = " << lOutRaodId << ",_sectionId = " << _sectionId << ", _laneId = " << _laneId << std::endl;
#endif
......@@ -179,7 +182,8 @@ namespace jf {
#endif
if (isJunction)
{
nOutLaneType = LaneType::JunctionLane;
std::cout << "bJunctionRoad is true" << std::endl;
nOutLaneType = LaneType::JunctionLane;
}
#ifdef _DEBUG_API_
NearestRoadMark mark = g_map.GetNeartestLaneRoadMarkByXY(ptInLoc.dLon, ptInLoc.dLat);
......@@ -229,22 +233,38 @@ namespace jf {
return true;
}
bool MapInterface::GetMapIDS(const Point& ptInLoc, int& id)
bool MapInterface::GetMapIDS(const Point& ptInLoc, double dCarAngle,int& id)
{
id = 0;
char** vecRoad = nullptr;
int nSize = 0;
auto result = g_map.GetAllJunctionRoadIDS(ptInLoc.dLon, ptInLoc.dLat, vecRoad, nSize);
if (result)
std::vector<OdrInfo> odr = g_map.GetOdrInfo(ptInLoc.dLon, ptInLoc.dLat);
if (odr.size() == 0)
{
if (nSize == 1)
{
std::string ids = vecRoad[0];
id = std::stol(ids);
}
printf("not 3 in map lon = %.8f, lat = %.8f\n", ptInLoc.dLon, ptInLoc.dLat);
return false;
}
//std::string roadId;
double carAngle = (90 - dCarAngle)/180*3.1415926;
long int roadLaneId = 0;
bool result = g_map.GetHdg(ptInLoc.dLon, ptInLoc.dLat, dCarAngle, roadLaneId);
printf("GetHdg result = %d, roadLaneId = %d, lon = %.8f,lat = %.8f,dCarAngle = %f\n",result,roadLaneId,ptInLoc.dLon, ptInLoc.dLat,dCarAngle);
if(result)
id = roadLaneId;
else
id = 0;
// id = 0;
// char** vecRoad = nullptr;
// int nSize = 0;
// auto result = g_map.GetAllJunctionRoadIDS(ptInLoc.dLon, ptInLoc.dLat, vecRoad, nSize);
// if (result)
// {
// if (nSize == 1)
// {
// std::string ids = vecRoad[0];
// id = std::stol(ids);
// }
// }
// printf("GetMapIDS result = %d, nSize = %d, id = %d,ptInLoc.dLon = %.8f, ptInLoc.dLat = %.8f\n",result,nSize,id,ptInLoc.dLon, ptInLoc.dLat);
return true;
}
} // namespace jf
\ No newline at end of file
} // namespace jf
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