30 using namespace GMap3d;
36 for (
unsigned long int num=0; it.
cont(); ++it, ++num)
37 (*it)->setDirectInfo(ADirectInfoIndex, (
void *) num);
40 TSaveFormat CGMapVertex::getFileFormat(
const char * AFilename)
42 ifstream stream(AFilename);
45 stream.getline(
id,256);
59 return "Moka file [binary]";
61 return "Moka file [ascii]";
71 stream.open(AFilename, ios::trunc | ios::binary);
73 stream.open(AFilename, ios::trunc);
75 bool result =
save(stream, AFormat);
84 stream.open(AFilename, ios::binary);
86 stream.open(AFilename);
95 int directInfoIndex = getNewDirectInfo();
96 const char * header = getFileHeader(AFormat);
108 default: cerr <<
"CGMapVertex.save: Format inconnu!!!" << endl;
111 AStream << header << endl;
119 m[i % 8] = FMaskMarks[i];
120 u[i % 8] = FUsedMarks[i];
135 for (; ok && it.cont(); ++it)
138 ok = current->
save(AStream, AFormat, directInfoIndex);
141 freeDirectInfo(directInfoIndex);
153 cerr <<
"CGMapVertex.load: Format inconnu!!!" << endl;
160 AStream.getline(
id, 256);
162 if (strcmp(
id, getFileHeader(AFormat)) != 0)
167 bitset<NB_MARKS> streamUsed;
168 bitset<NB_MARKS> streamMask;
170 assert(NB_MARKS % 8 == 0);
183 if (u[i % 8] && ! FUsedMarks[i])
184 cerr <<
"CGMapVertex::load: Marque n°" << i
185 <<
" ignorée lors du chargement." << endl;
187 streamUsed.set(i, u[i % 8]);
188 streamMask.set(i, m[i % 8]);
192 bitset<NB_MARKS> marksToKeep = FUsedMarks & streamUsed;
195 int mark = getNewMark();
197 negateMaskMark(mark);
200 for (
bool cont =
true; cont; )
203 cont = dart->
load(AStream, AFormat);
208 setMarks(dart, (dart->
getMarks() ^ streamMask) & marksToKeep);
215 negateMaskMark(mark);
226 for (; it.cont(); ++it)
227 if (isMarked(*it, mark))
230 unsetMark(*it, mark);
235 for (; i<nbLoaded; ++i)
236 for (
int dim=0; dim<=3; ++dim)
238 int n = (
long int) table[i]->getAlpha(dim) -1;
244 linkAlpha(table[i], table[n], dim);
257 TSaveFormat format= CGMapVertex::getFileFormat(AFilename);
260 return load(AFilename,format);