25 #include "message-macros.hh"
29 using namespace GMap3d;
39 AStream <<
"Intersection";
42 AStream <<
"Difference1";
45 AStream <<
"Difference2";
57 CBooleanOperations::CBooleanOperations(CGMapVertex * AMap,
60 bool ACalculateOrientation,
62 : FMap(AMap), FObject1(AObject1), FObject2(AObject2),
63 FCalculateOrientation(ACalculateOrientation), FVertexDI(AVertexDI)
67 FObject1Mark = FMap->getNewMark();
68 FObject2Mark = FMap->getNewMark();
71 FMap->markOrbit(FObject1, ORBIT_CC, FObject1Mark);
74 FMap->markOrbit(FObject2, ORBIT_CC, FObject2Mark);
87 FMap->unmarkAll(FObject1Mark);
88 FMap->unmarkAll(FObject2Mark);
89 FMap->freeMark(FObject1Mark);
90 FMap->freeMark(FObject2Mark);
125 return (FObject1 != NULL && FObject2 != NULL &&
126 !FMap->isSameOrbit(FObject1, FObject2, ORBIT_CC));
150 CDynamicCoverageCC cov(FMap, FObject1);
152 switch (AOperation) {
154 for (; cov.cont(); cov++) {
155 if (!FMap->isMarked(*cov, FObject1Mark) &&
156 !FMap->isMarked(*cov, FObject2Mark))
157 FMap->setMark(*cov, AMark);
162 for (; cov.cont(); cov++) {
163 if (FMap->isMarked(*cov, FObject1Mark) &&
164 FMap->isMarked(*cov, FObject2Mark))
165 FMap->setMark(*cov, AMark);
170 for (; cov.cont(); cov++) {
171 if (FMap->isMarked(*cov, FObject1Mark) &&
172 !FMap->isMarked(*cov, FObject2Mark))
173 FMap->setMark(*cov, AMark);
178 for (; cov.cont(); cov++) {
179 if (!FMap->isMarked(*cov, FObject1Mark) &&
180 FMap->isMarked(*cov, FObject2Mark))
181 FMap->setMark(*cov, AMark);
194 CDynamicCoverageCC cov(FMap, FObject1);
196 switch (AOperation) {
198 for (; cov.cont(); cov++) {
199 if (FMap->isMarked(*cov, FObject1Mark) ||
200 FMap->isMarked(*cov, FObject2Mark))
201 FMap->setMark(*cov, AMark);
206 for (; cov.cont(); cov++) {
207 if (!FMap->isMarked(*cov, FObject1Mark) ||
208 !FMap->isMarked(*cov, FObject2Mark))
209 FMap->setMark(*cov, AMark);
214 for (; cov.cont(); cov++) {
215 if (!FMap->isMarked(*cov, FObject1Mark) ||
216 FMap->isMarked(*cov, FObject2Mark))
217 FMap->setMark(*cov, AMark);
222 for (; cov.cont(); cov++) {
223 if (FMap->isMarked(*cov, FObject1Mark) ||
224 !FMap->isMarked(*cov, FObject2Mark))
225 FMap->setMark(*cov, AMark);
234 int AKeepMark,
int ADiscardMark)
238 CDynamicCoverageCC cov(FMap, FObject1);
240 switch (AOperation) {
242 for (; cov.cont(); cov++) {
243 if (!FMap->isMarked(*cov, FObject1Mark) &&
244 !FMap->isMarked(*cov, FObject2Mark))
245 FMap->setMark(*cov, AKeepMark);
247 FMap->setMark(*cov, ADiscardMark);
252 for (; cov.cont(); cov++) {
253 if (FMap->isMarked(*cov, FObject1Mark) &&
254 FMap->isMarked(*cov, FObject2Mark))
255 FMap->setMark(*cov, AKeepMark);
257 FMap->setMark(*cov, ADiscardMark);
262 for (; cov.cont(); cov++) {
263 if (FMap->isMarked(*cov, FObject1Mark) &&
264 !FMap->isMarked(*cov, FObject2Mark))
265 FMap->setMark(*cov, AKeepMark);
267 FMap->setMark(*cov, ADiscardMark);
272 for (; cov.cont(); cov++) {
273 if (!FMap->isMarked(*cov, FObject1Mark) &&
274 FMap->isMarked(*cov, FObject2Mark))
275 FMap->setMark(*cov, AKeepMark);
277 FMap->setMark(*cov, ADiscardMark);
290 CDynamicCoverageCC cov(FMap, FObject1);
292 switch (AOperation) {
294 for (; cov.cont() && !d; cov++) {
295 if (!FMap->isMarked(*cov, FObject1Mark) &&
296 !FMap->isMarked(*cov, FObject2Mark))
302 for (; cov.cont() && !d; cov++) {
303 if (FMap->isMarked(*cov, FObject1Mark) &&
304 FMap->isMarked(*cov, FObject2Mark))
310 for (; cov.cont() && !d; cov++) {
311 if (FMap->isMarked(*cov, FObject1Mark) &&
312 !FMap->isMarked(*cov, FObject2Mark))
318 for (; cov.cont() && !d; cov++) {
319 if (!FMap->isMarked(*cov, FObject1Mark) &&
320 FMap->isMarked(*cov, FObject2Mark))
336 CDynamicCoverageCC cov(FMap, FObject1);
338 switch (AOperation) {
340 for (; cov.cont() && !d; cov++) {
341 if (FMap->isMarked(*cov, FObject1Mark) ||
342 FMap->isMarked(*cov, FObject2Mark))
348 for (; cov.cont() && !d; cov++) {
349 if (!FMap->isMarked(*cov, FObject1Mark) ||
350 !FMap->isMarked(*cov, FObject2Mark))
356 for (; cov.cont() && !d; cov++) {
357 if (!FMap->isMarked(*cov, FObject1Mark) ||
358 FMap->isMarked(*cov, FObject2Mark))
364 for (; cov.cont() && !d; cov++) {
365 if (FMap->isMarked(*cov, FObject1Mark) ||
366 !FMap->isMarked(*cov, FObject2Mark))
378 list<CDart*> * ACompoundList)
382 int keep_mark = FMap->getNewMark();
383 int discard_mark = FMap->getNewMark();
388 if (FMap->isMarked(FObject1, discard_mark)) FObject1 = NULL;
389 if (FMap->isMarked(FObject2, discard_mark)) FObject2 = NULL;
390 FMap->deleteMarkedDarts(discard_mark);
395 FMap->unmarkAll(keep_mark);
399 FMap->freeMark(keep_mark);
400 FMap->freeMark(discard_mark);
406 list<CDart*> * ACompoundList)
410 int keep_mark = FMap->getNewMark();
411 int discard_mark = FMap->getNewMark();
416 if (FMap->isMarked(FObject1, discard_mark)) FObject1 = NULL;
417 if (FMap->isMarked(FObject2, discard_mark)) FObject2 = NULL;
418 FMap->deleteMarkedDarts(discard_mark);
423 FMap->unmarkAll(keep_mark);
427 FMap->freeMark(keep_mark);
428 FMap->freeMark(discard_mark);
456 return FCalculateOrientation;
470 for (CDynamicCoverageAll cov(FMap); cov.cont(); ++cov)
471 if (FMap->isMarked(*cov, AMark)) {
472 FMap->unmarkOrbit(*cov, ORBIT_CC, AMark);
473 AList->push_back(*cov);