Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void PaintLandingGroundTrack(HDC hDC)
- {
- std::map<double,double> gTrack;
- std::fstream track;
- track.open("groundtrack.txt",std::ios::in);
- if(track.is_open())
- {
- std::string line;
- double tlat, tlon;
- while(std::getline(track,line))
- {
- sscanf(line.c_str(),"%lf%lf",&tlon,&tlat);
- gTrack.insert(std::pair<double,double>(tlon,tlat));
- }
- }
- track.close();
- HPEN greenp = CreatePen(PS_SOLID,4,RGB(0,255,0));
- HPEN oldp = (HPEN) SelectObject(hDC,greenp);
- float KSC_LR_LON_SCALE = 82.0f/20.0f; //82px per 20 degrees longitude
- float KSC_LR_LAT_SCALE = 46.0f/10.0f; //50.5px per 10 degrees latitude
- float KSC_SR_LON_SCALE = 100.0f/0.2f; //100px per 0.2 degree
- float KSC_SR_LAT_SCALE = 53.0f/0.1f; //53px per 0.1 degree
- //float longt = (81.235-80.4f)* KSC_SR_LON_SCALE; //-80 = 80W
- //float lat = (29.175f-29.0f)* KSC_SR_LAT_SCALE; //80N
- switch(mWindow)
- {
- case 3: //KSC
- if(mGTMode == 1) //long range
- {
- std::map<double,double>::iterator it;
- int licznik = 0;
- POINT *groundTrack = new POINT[(int)gTrack.size()];
- for(it = gTrack.begin(); it!=gTrack.end(); it++)
- {
- groundTrack[licznik].x = 68+(151.0f+it->first)*KSC_LR_LON_SCALE;
- groundTrack[licznik].y = 55+(88.0f-it->second)*KSC_LR_LAT_SCALE;
- licznik++;
- }
- //LineTo(hDC,68+longt,55+lat); //first is longitude, second latitude
- MoveToEx(hDC,groundTrack[0].x,groundTrack[0].y,NULL);
- PolylineTo(hDC,groundTrack,gTrack.size());
- delete[] groundTrack;
- }
- if(mGTMode == 2) //medium range
- {
- }
- if(mGTMode == 3) //short range
- {
- std::map<double,double>::iterator it;
- int licznik = 0;
- POINT *groundTrack = new POINT[(int)gTrack.size()];
- for(it = gTrack.begin(); it!=gTrack.end(); it++)
- {
- if(it->first<-81.235 || it->second>29.175)
- continue;
- groundTrack[licznik].x = 78.0f+(81.235000f+it->first)*KSC_SR_LON_SCALE;
- groundTrack[licznik].y = 55.0f+(29.175000f-it->second)*KSC_SR_LAT_SCALE;
- licznik++;
- }
- //LineTo(hDC,68+longt,55+lat); //first is longitude, second latitude
- MoveToEx(hDC,groundTrack[0].x,groundTrack[0].y,NULL);
- PolylineTo(hDC,groundTrack,licznik-1);
- delete[] groundTrack;
- //LineTo(hDC,78+longt,55+lat);
- }
- break;
- }
- SelectObject(hDC,oldp);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement