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
| int nbPolygons; //var for count number of polygons
int nbPoints; //Var for count number of point into a polygon
ifstream Reader; //stream for read Reader
Reader.open((char*)ReaderFile.c_str(), ios::in | ios::binary); //open Reader file
if(!Reader)//if the file can't be open
{
Log << "ERROR\n";
}
Reader.read((char *) &nbPolygons,4);//we read 4bit(int) corresponding to the nb of polygons
Log << "Nb poly = " <<nbPolygons << "\n";
for(int i = 1; i <= nbPolygons; i++)//for each polygon...
{
int x;
int y;
PointF tmpPoint[nbPolygons];
Reader.read((char *) &nbPoints,4);//we read 4bit(int) corresponding to the nb of points into a polygon
for (int j = 1; j <= nbPoints; j++)// for each point
{
Reader.read((char *) &x,4);
Reader.read((char *) &y,4);
Log << "Poly = " << i <<"/"<< nbPolygons << " Nb points = " << j <<"/"<< nbPoints <<" X = " <<(float)x << " Y = "<< (float)y <<" \n";
tmpPoint[j] = PointF (x,y);
}
PointF* pPoints = tmpPoint;
graphics.DrawPolygon(&blackPen, pPoints,2);
}
Log << "Fin";
Log.close();
Reader.close(); |
Partager