1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79
| vector<CFrame> goodFrame;
vector<CGPRMCdata> GPRMCdataUsed;
///////////////////////////////////////
dans le main
.
.
.
for (size_t i=0, size=goodFrame.size() ; i < size ; i++)
{
TempDataGPRMC.ExtractDataFromFrame(goodFrame[i].GetData());
GPRMCdataUsed[1+i] = TempDataGPRMC;
}
///////////////////////////////////
dans CGPRMC.H
class CGPRMCdata
{
public:
//Constructors
CGPRMCdata();
CGPRMCdata(const CGPRMCdata&);
//Destructor
~CGPRMCdata();
void ExtractDataFromFrame(CString);
CString nTime;
CString nLatitude;
CString nLongitude;
CString nOrientationLat;
CString nOrientationLong;
};
//////////////////////////////////
dans CGPRMC.cpp
void CGPRMCdata::ExtractDataFromFrame(CString AnalysedFrame)
{
char step []=",";
int first=NULL;
int second=NULL;
first = AnalysedFrame.Find(step,second); // cherche la première ","
second = AnalysedFrame.Find(step,first+1);// cherche la deuxième ","
while (first!=-1 && second !=-1)
{
if(first==5 && second==15) // extraction de l'heure
{
nTime=AnalysedFrame.Mid(first+1,(second-first-1));
}
if(first==17 && second==25)// extraction de la latidude
{
nLatitude=AnalysedFrame.Mid(first+1,(second-first-1));
}
if(first==25 && second==27)// extraction de N ou S
{
nOrientationLat=AnalysedFrame.Mid(first+1,(second-first-1));
}
if(first==27 && second==36)// extraction de la longitude
{
nLongitude=AnalysedFrame.Mid(first+1,(second-first-1));
}
if(first==36 && second==38)// extraction de E ou W
{
nOrientationLong=AnalysedFrame.Mid(first+1,(second-first-1));
}
first = second;
second = AnalysedFrame.Find(step,first+1);
}
} |
Partager