/** * Constructor. */ RS_ActionPARISDebugCreateContainer::RS_ActionPARISDebugCreateContainer( RS_EntityContainer& container, RS_GraphicView& graphicView) : RS_ActionInterface("rs_actionparischeckcont", container, graphicView) { //QMessageBox::about(NULL, "info", "check container"); RS_Document* theDoc = (RS_Document*) &container; if (theDoc->countSelected() < 2) { return; } RS_EntityContainer* con = new RS_EntityContainer(theDoc, true); RS_PtrListIterator<RS_Entity> it = theDoc->createIterator(); RS_Entity* e; while ( (e = it.current()) != 0) { ++it; if (e->isSelected()) { con->addEntity(e); e->setParent(con); } } theDoc -> addEntity(con); }
/** * Renames all inserts with name 'oldName' to 'newName'. This is * called after a block was rename to update the inserts. */ void RS_EntityContainer::renameInserts(const RS_String& oldName, const RS_String& newName) { RS_DEBUG->print("RS_EntityContainer::renameInserts()"); //for (RS_Entity* e=firstEntity(RS2::ResolveNone); // e!=NULL; // e=nextEntity(RS2::ResolveNone)) { RS_PtrListIterator<RS_Entity> it = createIterator(); RS_Entity* e; while ( (e = it.current()) != NULL ) { ++it; if (e->rtti()==RS2::EntityInsert) { RS_Insert* i = ((RS_Insert*)e); if (i->getName()==oldName) { i->setName(newName); } } else if (e->isContainer()) { ((RS_EntityContainer*)e)->renameInserts(oldName, newName); } } RS_DEBUG->print("RS_EntityContainer::renameInserts() OK"); }
/** * Updates the sub entities of this container. */ void RS_EntityContainer::update() { //for (RS_Entity* e=firstEntity(RS2::ResolveNone); // e!=NULL; // e=nextEntity(RS2::ResolveNone)) { RS_PtrListIterator<RS_Entity> it = createIterator(); RS_Entity* e; while ( (e = it.current()) != NULL ) { ++it; e->update(); } }
/** * Updates all Spline entities in this container. */ void RS_EntityContainer::updateSplines() { RS_DEBUG->print("RS_EntityContainer::updateSplines()"); //for (RS_Entity* e=firstEntity(RS2::ResolveNone); // e!=NULL; // e=nextEntity(RS2::ResolveNone)) { RS_PtrListIterator<RS_Entity> it = createIterator(); RS_Entity* e; while ( (e = it.current()) != NULL ) { ++it; //// Only update our own inserts and not inserts of inserts if (e->rtti()==RS2::EntitySpline /*&& e->getParent()==this*/) { ((RS_Spline*)e)->update(); } else if (e->isContainer() && e->rtti()!=RS2::EntityHatch) { ((RS_EntityContainer*)e)->updateSplines(); } } RS_DEBUG->print("RS_EntityContainer::updateSplines() OK"); }
/** * Updates all Dimension entities in this container and * reposition their labels. */ void RS_EntityContainer::updateDimensions() { RS_DEBUG->print("RS_EntityContainer::updateDimensions()"); //for (RS_Entity* e=firstEntity(RS2::ResolveNone); // e!=NULL; // e=nextEntity(RS2::ResolveNone)) { RS_PtrListIterator<RS_Entity> it = createIterator(); RS_Entity* e; while ( (e = it.current()) != NULL ) { ++it; if (RS_Information::isDimension(e->rtti())) { // update and reposition label: ((RS_Dimension*)e)->update(true); } else if (e->isContainer()) { ((RS_EntityContainer*)e)->updateDimensions(); } } RS_DEBUG->print("RS_EntityContainer::updateDimensions() OK"); }