|
@@ -1870,7 +1870,52 @@ iv::decition::Decition iv::decition::DecideGps00::getDecideFromGPS(GPS_INS now_g
|
|
|
return gps_decition;
|
|
|
}
|
|
|
|
|
|
+iv::Station iv::decition::DecideGps00::getNearestStation(iv::GPS_INS now_gps_ins,std::vector<Station> station_n,std::vector<GPSData> gpsMap){
|
|
|
|
|
|
+ int now_index=0,front_index=0;
|
|
|
+ int station_size=station_n.size();
|
|
|
+
|
|
|
+ for(int i=0;i<station_size;i++)
|
|
|
+ {
|
|
|
+ int minDistance=10;
|
|
|
+ for (int j = 0; j < gpsMap.size(); j++)
|
|
|
+ {
|
|
|
+ double tmpdis = GetDistance(station_n[i].station_location, (*gpsMap[j]));
|
|
|
+ if (tmpdis < minDistance )
|
|
|
+ {
|
|
|
+ minDistance = tmpdis;
|
|
|
+ station_n[i].map_index=j;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ int minDistance=10;
|
|
|
+ for (int j = 0; j < gpsMap.size(); j++)
|
|
|
+ {
|
|
|
+ double tmpdis = GetDistance(now_gps_ins, (*gpsMap[j]));
|
|
|
+ if (tmpdis < minDistance )
|
|
|
+ {
|
|
|
+ minDistance = tmpdis;
|
|
|
+ now_index=j;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ int min_index=gpsMap.size()-1;
|
|
|
+ int station_index=0;
|
|
|
+ for(int i=0;i<station_size;i++)
|
|
|
+ {
|
|
|
+ if(station_n[i].map_index>now_index)
|
|
|
+ {
|
|
|
+ front_index=station_n[i].map_index;
|
|
|
+ if(front_index<min_index)
|
|
|
+ {
|
|
|
+ min_index=front_index;
|
|
|
+ station_index=i;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ return station_n[station_index];
|
|
|
+
|
|
|
+}
|
|
|
|
|
|
void iv::decition::DecideGps00::initMethods(){
|
|
|
|