int main() { Local location = create_l(N); check(location); printf("\n<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<\n"); check_one(location); printf("\n<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<\n"); delete_step(2, location ); check(location); printf("\n<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<\n"); }
bool BooleanTool::executeForObjects(PathObject* subject, PathObjects& in_objects, PathObjects& out_objects, CombinedUndoStep& undo_step) { if (!executeForObjects(subject, in_objects, out_objects)) { Q_ASSERT(out_objects.size() == 0); return false; // in release build } // Add original objects to undo step, and remove them from map. QScopedPointer<AddObjectsUndoStep> add_step(new AddObjectsUndoStep(map)); for (PathObject* object : in_objects) { if (op != Difference || object == subject) { add_step->addObject(object, object); } } // Keep as separate loop to get the correct index in the previous loop for (PathObject* object : in_objects) { if (op != Difference || object == subject) { map->removeObjectFromSelection(object, false); map->getCurrentPart()->deleteObject(object, true); object->setMap(map); // necessary so objects are saved correctly } } // Add resulting objects to map, and create delete step for them QScopedPointer<DeleteObjectsUndoStep> delete_step(new DeleteObjectsUndoStep(map)); MapPart* part = map->getCurrentPart(); for (PathObject* object : out_objects) { map->addObject(object); map->addObjectToSelection(object, false); } // Keep as separate loop to get the correct index in the previous loop for (PathObject* object : out_objects) { delete_step->addObject(part->findObjectIndex(object)); } undo_step.push(add_step.take()); undo_step.push(delete_step.take()); return true; }