X-Git-Url: http://shamusworld.gotdns.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fbase%2Fentitycontainer.cpp;h=ec5840fb906d91896914db8cd22d471980941138;hb=e1d1cacbb43055988d0d9db632fdf05c0bea9543;hp=238c5a8b3f239508520f97655eda934eb59762f7;hpb=3239ef39dcee08fa6e8cd68cdf2727fc68cc7a8c;p=architektonas diff --git a/src/base/entitycontainer.cpp b/src/base/entitycontainer.cpp index 238c5a8..ec5840f 100644 --- a/src/base/entitycontainer.cpp +++ b/src/base/entitycontainer.cpp @@ -29,21 +29,21 @@ #include "graphicview.h" #include "paintinterface.h" -bool RS_EntityContainer::autoUpdateBorders = true; +bool EntityContainer::autoUpdateBorders = true; /** * Default constructor. * * @param owner True if we own and also delete the entities. */ -RS_EntityContainer::RS_EntityContainer(RS_EntityContainer * parent/*= NULL*/, bool owner/*= true*/): - RS_Entity(parent), entityIterator(entities) +EntityContainer::EntityContainer(EntityContainer * parent/*= NULL*/, bool owner/*= true*/): + Entity(parent), entityIterator(entities) //NOTE: This constructor may not be explicitly OR implicitly called, meaning that // entityIterator will not get initialized! { #warning "!!! Need to deal with setAutoDelete() Qt3->Qt4 !!!" // entities.setAutoDelete(owner); - RS_DEBUG->print("RS_EntityContainer::RS_EntityContainer: owner: %d", (int)owner); + DEBUG->print("EntityContainer::EntityContainer: owner: %d", (int)owner); subContainer = NULL; //autoUpdateBorders = true; } @@ -52,8 +52,8 @@ RS_EntityContainer::RS_EntityContainer(RS_EntityContainer * parent/*= NULL*/, bo * Copy constructor. Makes a deep copy of all entities. */ /* -RS_EntityContainer::RS_EntityContainer(const RS_EntityContainer& ec) - : RS_Entity(ec) +EntityContainer::EntityContainer(const EntityContainer& ec) + : Entity(ec) { } */ @@ -61,18 +61,18 @@ RS_EntityContainer::RS_EntityContainer(const RS_EntityContainer& ec) /** * Destructor. */ -RS_EntityContainer::~RS_EntityContainer() +EntityContainer::~EntityContainer() { clear(); } -RS_Entity * RS_EntityContainer::clone() +Entity * EntityContainer::clone() { -// RS_DEBUG->print("RS_EntityContainer::clone: ori autoDel: %d", entities.autoDelete()); - RS_EntityContainer * ec = new RS_EntityContainer(*this); +// DEBUG->print("EntityContainer::clone: ori autoDel: %d", entities.autoDelete()); + EntityContainer * ec = new EntityContainer(*this); #warning "!!! Need to deal with setAutoDelete() Qt3->Qt4 !!!" // ec->entities.setAutoDelete(entities.autoDelete()); -// RS_DEBUG->print("RS_EntityContainer::clone: clone autoDel: %d", ec->entities.autoDelete()); +// DEBUG->print("EntityContainer::clone: clone autoDel: %d", ec->entities.autoDelete()); ec->detach(); ec->initId(); @@ -83,17 +83,17 @@ RS_Entity * RS_EntityContainer::clone() * Detaches shallow copies and creates deep copies of all subentities. * This is called after cloning entity containers. */ -void RS_EntityContainer::detach() +void EntityContainer::detach() { -// Q3PtrList tmp; - QList tmp; +// Q3PtrList tmp; + QList tmp; #warning "!!! Need to deal with setAutoDelete() Qt3->Qt4 !!!" // bool autoDel = entities.autoDelete(); -// RS_DEBUG->print("RS_EntityContainer::detach: autoDel: %d", (int)autoDel); +// DEBUG->print("EntityContainer::detach: autoDel: %d", (int)autoDel); // entities.setAutoDelete(false); // make deep copies of all entities: - for(RS_Entity * e=firstEntity(); e!=NULL; e=nextEntity()) + for(Entity * e=firstEntity(); e!=NULL; e=nextEntity()) { if (!e->getFlag(RS2::FlagTemp)) { @@ -106,37 +106,35 @@ void RS_EntityContainer::detach() // entities.setAutoDelete(autoDel); // point to new deep copies: -// for(RS_Entity * e=tmp.first(); e!=NULL; e=tmp.next()) +// for(Entity * e=tmp.first(); e!=NULL; e=tmp.next()) for(int i=0; ireparent(this); } } /** @return RS2::EntityContainer */ -/*virtual*/ RS2::EntityType RS_EntityContainer::rtti() const +/*virtual*/ RS2::EntityType EntityContainer::rtti() const { return RS2::EntityContainer; } -void RS_EntityContainer::reparent(RS_EntityContainer * parent) +void EntityContainer::reparent(EntityContainer * parent) { - RS_Entity::reparent(parent); + Entity::reparent(parent); - // All sub-entities: - for(RS_Entity * e=firstEntity(RS2::ResolveNone); e!=NULL; e=nextEntity(RS2::ResolveNone)) - { - e->reparent(parent); - } + // All sub-entities: + for(Entity * e=firstEntity(RS2::ResolveNone); e!=NULL; e=nextEntity(RS2::ResolveNone)) + e->reparent(parent); } /** * @return true: because entities made from this class * and subclasses are containers for other entities. */ -/*virtual*/ bool RS_EntityContainer::isContainer() const +/*virtual*/ bool EntityContainer::isContainer() const { return true; } @@ -145,7 +143,7 @@ void RS_EntityContainer::reparent(RS_EntityContainer * parent) * @return false: because entities made from this class * and subclasses are containers for other entities. */ -/*virtual*/ bool RS_EntityContainer::isAtomic() const +/*virtual*/ bool EntityContainer::isAtomic() const { return false; } @@ -156,28 +154,28 @@ void RS_EntityContainer::reparent(RS_EntityContainer * parent) * @param undone true: entity has become invisible. * false: entity has become visible. */ -void RS_EntityContainer::undoStateChanged(bool undone) +void EntityContainer::undoStateChanged(bool undone) { - RS_Entity::undoStateChanged(undone); + Entity::undoStateChanged(undone); // ! don't pass on to subentities. undo list handles them // All sub-entities: - /*for (RS_Entity* e=firstEntity(RS2::ResolveNone); + /*for (Entity* e=firstEntity(RS2::ResolveNone); e!=NULL; e=nextEntity(RS2::ResolveNone)) { e->setUndoState(undone); }*/ } -void RS_EntityContainer::setVisible(bool v) +void EntityContainer::setVisible(bool v) { - RS_DEBUG->print("RS_EntityContainer::setVisible: %d", v); - RS_Entity::setVisible(v); + DEBUG->print("EntityContainer::setVisible: %d", v); + Entity::setVisible(v); // All sub-entities: - for(RS_Entity * e=firstEntity(RS2::ResolveNone); e!=NULL; e=nextEntity(RS2::ResolveNone)) + for(Entity * e=firstEntity(RS2::ResolveNone); e!=NULL; e=nextEntity(RS2::ResolveNone)) { - RS_DEBUG->print("RS_EntityContainer::setVisible: subentity: %d", v); + DEBUG->print("EntityContainer::setVisible: subentity: %d", v); e->setVisible(v); } } @@ -185,11 +183,11 @@ void RS_EntityContainer::setVisible(bool v) /** * @return Total length of all entities in this container. */ -double RS_EntityContainer::getLength() +double EntityContainer::getLength() { double ret = 0.0; - for(RS_Entity * e=firstEntity(RS2::ResolveNone); e!=NULL; e=nextEntity(RS2::ResolveNone)) + for(Entity * e=firstEntity(RS2::ResolveNone); e!=NULL; e=nextEntity(RS2::ResolveNone)) { if (e->isVisible()) { @@ -213,13 +211,13 @@ double RS_EntityContainer::getLength() /** * Selects this entity. */ -bool RS_EntityContainer::setSelected(bool select) +bool EntityContainer::setSelected(bool select) { // This entity's select: - if (RS_Entity::setSelected(select)) + if (Entity::setSelected(select)) { // All sub-entity's select: - for(RS_Entity * e=firstEntity(RS2::ResolveNone); e!=NULL; e=nextEntity(RS2::ResolveNone)) + for(Entity * e=firstEntity(RS2::ResolveNone); e!=NULL; e=nextEntity(RS2::ResolveNone)) { if (e->isVisible()) { @@ -238,14 +236,14 @@ bool RS_EntityContainer::setSelected(bool select) /** * Toggles select on this entity. */ -bool RS_EntityContainer::toggleSelected() +bool EntityContainer::toggleSelected() { // Toggle this entity's select: - if (RS_Entity::toggleSelected()) + if (Entity::toggleSelected()) { // Toggle all sub-entity's select: - /*for (RS_Entity* e=firstEntity(RS2::ResolveNone); + /*for (Entity* e=firstEntity(RS2::ResolveNone); e!=NULL; e=nextEntity(RS2::ResolveNone)) { e->toggleSelected(); @@ -263,11 +261,11 @@ bool RS_EntityContainer::toggleSelected() * * @param select True to select, False to deselect the entities. */ -void RS_EntityContainer::selectWindow(Vector v1, Vector v2, bool select, bool cross) +void EntityContainer::selectWindow(Vector v1, Vector v2, bool select, bool cross) { bool included; - for(RS_Entity * e=firstEntity(RS2::ResolveNone); e!=NULL; e=nextEntity(RS2::ResolveNone)) + for(Entity * e=firstEntity(RS2::ResolveNone); e!=NULL; e=nextEntity(RS2::ResolveNone)) { included = false; @@ -280,25 +278,25 @@ void RS_EntityContainer::selectWindow(Vector v1, Vector v2, bool select, bool cr } else if (cross == true) { - RS_Line l[] = + Line l[] = { - RS_Line(NULL, RS_LineData(v1, Vector(v2.x, v1.y))), - RS_Line(NULL, RS_LineData(Vector(v2.x, v1.y), v2)), - RS_Line(NULL, RS_LineData(v2, Vector(v1.x, v2.y))), - RS_Line(NULL, RS_LineData(Vector(v1.x, v2.y), v1)) + Line(NULL, LineData(v1, Vector(v2.x, v1.y))), + Line(NULL, LineData(Vector(v2.x, v1.y), v2)), + Line(NULL, LineData(v2, Vector(v1.x, v2.y))), + Line(NULL, LineData(Vector(v1.x, v2.y), v1)) }; VectorSolutions sol; if (e->isContainer()) { - RS_EntityContainer * ec = (RS_EntityContainer *)e; + EntityContainer * ec = (EntityContainer *)e; - for(RS_Entity * se=ec->firstEntity(RS2::ResolveAll); se!=NULL && included==false; + for(Entity * se=ec->firstEntity(RS2::ResolveAll); se!=NULL && included==false; se=ec->nextEntity(RS2::ResolveAll)) { for(int i=0; i<4; ++i) { - sol = RS_Information::getIntersection(se, &l[i], true); + sol = Information::getIntersection(se, &l[i], true); if (sol.hasValid()) { @@ -312,7 +310,7 @@ void RS_EntityContainer::selectWindow(Vector v1, Vector v2, bool select, bool cr { for(int i=0; i<4; ++i) { - sol = RS_Information::getIntersection(e, &l[i], true); + sol = Information::getIntersection(e, &l[i], true); if (sol.hasValid()) { @@ -335,20 +333,20 @@ void RS_EntityContainer::selectWindow(Vector v1, Vector v2, bool select, bool cr * Adds a entity to this container and updates the borders of this * entity-container if autoUpdateBorders is true. */ -void RS_EntityContainer::addEntity(RS_Entity * entity) +void EntityContainer::addEntity(Entity * entity) { /* if (isDocument()) { - RS_LayerList* lst = getDocument()->getLayerList(); + LayerList* lst = getDocument()->getLayerList(); if (lst!=NULL) { - RS_Layer* l = lst->getActive(); + Layer* l = lst->getActive(); if (l!=NULL && l->isLocked()) { return; } } } */ -//printf("RS_EntityContainer::addEntity(): entity=%08X\n", entity); +//printf("EntityContainer::addEntity(): entity=%08X\n", entity); if (!entity) return; @@ -367,7 +365,7 @@ void RS_EntityContainer::addEntity(RS_Entity * entity) * Inserts a entity to this container at the given position and updates * the borders of this entity-container if autoUpdateBorders is true. */ -void RS_EntityContainer::insertEntity(int index, RS_Entity * entity) +void EntityContainer::insertEntity(int index, Entity * entity) { if (entity == NULL) return; @@ -382,7 +380,7 @@ void RS_EntityContainer::insertEntity(int index, RS_Entity * entity) * Replaces the entity at the given index with the given entity * and updates the borders of this entity-container if autoUpdateBorders is true. */ -void RS_EntityContainer::replaceEntity(int index, RS_Entity * entity) +void EntityContainer::replaceEntity(int index, Entity * entity) { if (entity == NULL) return; @@ -397,7 +395,7 @@ void RS_EntityContainer::replaceEntity(int index, RS_Entity * entity) * Removes an entity from this container and updates the borders of * this entity-container if autoUpdateBorders is true. */ -bool RS_EntityContainer::removeEntity(RS_Entity * entity) +bool EntityContainer::removeEntity(Entity * entity) { // bool ret = entities.remove(entity); bool ret = (bool)entities.removeAll(entity); @@ -411,7 +409,7 @@ bool RS_EntityContainer::removeEntity(RS_Entity * entity) /** * Erases all entities in this container and resets the borders.. */ -void RS_EntityContainer::clear() +void EntityContainer::clear() { entities.clear(); resetBorders(); @@ -420,7 +418,7 @@ void RS_EntityContainer::clear() /** * Counts all entities (branches of the tree). */ -unsigned long int RS_EntityContainer::count() +unsigned long int EntityContainer::count() { return entities.count(); } @@ -428,11 +426,11 @@ unsigned long int RS_EntityContainer::count() /** * Counts all entities (leaves of the tree). */ -unsigned long int RS_EntityContainer::countDeep() +unsigned long int EntityContainer::countDeep() { unsigned long int c = 0; - for(RS_Entity * t=firstEntity(RS2::ResolveNone); t!=NULL; t=nextEntity(RS2::ResolveNone)) + for(Entity * t=firstEntity(RS2::ResolveNone); t!=NULL; t=nextEntity(RS2::ResolveNone)) { c += t->countDeep(); } @@ -443,11 +441,11 @@ unsigned long int RS_EntityContainer::countDeep() /** * Counts the selected entities in this container. */ -unsigned long int RS_EntityContainer::countSelected() +unsigned long int EntityContainer::countSelected() { unsigned long int c = 0; - for(RS_Entity * t=firstEntity(RS2::ResolveNone); t!=NULL; t=nextEntity(RS2::ResolveNone)) + for(Entity * t=firstEntity(RS2::ResolveNone); t!=NULL; t=nextEntity(RS2::ResolveNone)) { if (t->isSelected()) { @@ -462,7 +460,7 @@ unsigned long int RS_EntityContainer::countSelected() * Enables / disables automatic update of borders on entity removals * and additions. By default this is turned on. */ -/*virtual*/ void RS_EntityContainer::setAutoUpdateBorders(bool enable) +/*virtual*/ void EntityContainer::setAutoUpdateBorders(bool enable) { autoUpdateBorders = enable; } @@ -470,9 +468,9 @@ unsigned long int RS_EntityContainer::countSelected() /** * Adjusts the borders of this graphic (max/min values) */ -void RS_EntityContainer::adjustBorders(RS_Entity * entity) +void EntityContainer::adjustBorders(Entity * entity) { - //RS_DEBUG->print("RS_EntityContainer::adjustBorders"); + //DEBUG->print("EntityContainer::adjustBorders"); //resetBorders(); if (entity != NULL) @@ -496,17 +494,17 @@ void RS_EntityContainer::adjustBorders(RS_Entity * entity) /** * Recalculates the borders of this entity container. */ -void RS_EntityContainer::calculateBorders() +void EntityContainer::calculateBorders() { - RS_DEBUG->print("RS_EntityContainer::calculateBorders"); + DEBUG->print("EntityContainer::calculateBorders"); resetBorders(); - for(RS_Entity * e=firstEntity(RS2::ResolveNone); e!=NULL; e=nextEntity(RS2::ResolveNone)) + for(Entity * e=firstEntity(RS2::ResolveNone); e!=NULL; e=nextEntity(RS2::ResolveNone)) { - RS_Layer * layer = e->getLayer(); + Layer * layer = e->getLayer(); - RS_DEBUG->print("RS_EntityContainer::calculateBorders: isVisible: %d", (int)e->isVisible()); + DEBUG->print("EntityContainer::calculateBorders: isVisible: %d", (int)e->isVisible()); if (e->isVisible() && (layer == NULL || !layer->isFrozen())) { @@ -515,7 +513,7 @@ void RS_EntityContainer::calculateBorders() } } - RS_DEBUG->print("RS_EntityContainer::calculateBorders: size 1: %f,%f", getSize().x, getSize().y); + DEBUG->print("EntityContainer::calculateBorders: size 1: %f,%f", getSize().x, getSize().y); // needed for correcting corrupt data (PLANS.dxf) if (minV.x > maxV.x || minV.x > RS_MAXDOUBLE || maxV.x > RS_MAXDOUBLE @@ -532,31 +530,31 @@ void RS_EntityContainer::calculateBorders() maxV.y = 0.0; } - RS_DEBUG->print("RS_EntityCotnainer::calculateBorders: size: %f,%f", getSize().x, getSize().y); + DEBUG->print("EntityCotnainer::calculateBorders: size: %f,%f", getSize().x, getSize().y); - //RS_DEBUG->print(" borders: %f/%f %f/%f", minV.x, minV.y, maxV.x, maxV.y); + //DEBUG->print(" borders: %f/%f %f/%f", minV.x, minV.y, maxV.x, maxV.y); //printf("borders: %lf/%lf %lf/%lf\n", minV.x, minV.y, maxV.x, maxV.y); - //RS_Entity::calculateBorders(); + //Entity::calculateBorders(); } /** * Recalculates the borders of this entity container including * invisible entities. */ -void RS_EntityContainer::forcedCalculateBorders() +void EntityContainer::forcedCalculateBorders() { - //RS_DEBUG->print("RS_EntityContainer::calculateBorders"); + //DEBUG->print("EntityContainer::calculateBorders"); resetBorders(); - for(RS_Entity * e=firstEntity(RS2::ResolveNone); e!=NULL; e=nextEntity(RS2::ResolveNone)) + for(Entity * e=firstEntity(RS2::ResolveNone); e!=NULL; e=nextEntity(RS2::ResolveNone)) { - //RS_Layer* layer = e->getLayer(); + //Layer* layer = e->getLayer(); if (e->isContainer()) { - ((RS_EntityContainer *)e)->forcedCalculateBorders(); + ((EntityContainer *)e)->forcedCalculateBorders(); } else { @@ -581,74 +579,74 @@ void RS_EntityContainer::forcedCalculateBorders() maxV.y = 0.0; } - //RS_DEBUG->print(" borders: %f/%f %f/%f", minV.x, minV.y, maxV.x, maxV.y); + //DEBUG->print(" borders: %f/%f %f/%f", minV.x, minV.y, maxV.x, maxV.y); //printf("borders: %lf/%lf %lf/%lf\n", minV.x, minV.y, maxV.x, maxV.y); - //RS_Entity::calculateBorders(); + //Entity::calculateBorders(); } /** * Updates all Dimension entities in this container and * reposition their labels. */ -void RS_EntityContainer::updateDimensions() +void EntityContainer::updateDimensions() { - RS_DEBUG->print("RS_EntityContainer::updateDimensions()"); + DEBUG->print("EntityContainer::updateDimensions()"); - //for (RS_Entity* e=firstEntity(RS2::ResolveNone); + //for (Entity* e=firstEntity(RS2::ResolveNone); // e!=NULL; // e=nextEntity(RS2::ResolveNone)) { #if 0 -// Q3PtrListIterator it = createIterator(); - QListIterator it = createIterator(); -// return QListIterator(entities); +// Q3PtrListIterator it = createIterator(); + QListIterator it = createIterator(); +// return QListIterator(entities); - RS_Entity * e; + Entity * e; while ((e = it.current()) != NULL) { ++it; - if (RS_Information::isDimension(e->rtti())) + if (Information::isDimension(e->rtti())) { // update and reposition label: - ((RS_Dimension *)e)->update(true); + ((Dimension *)e)->update(true); } else if (e->isContainer()) { - ((RS_EntityContainer *)e)->updateDimensions(); + ((EntityContainer *)e)->updateDimensions(); } } #else for(int i=0; irtti())) + if (Information::isDimension(e->rtti())) // update and reposition label: - ((RS_Dimension *)e)->update(true); + ((Dimension *)e)->update(true); else if (e->isContainer()) - ((RS_EntityContainer *)e)->updateDimensions(); + ((EntityContainer *)e)->updateDimensions(); } #endif - RS_DEBUG->print("RS_EntityContainer::updateDimensions() OK"); + DEBUG->print("EntityContainer::updateDimensions() OK"); } /** * Updates all Insert entities in this container. */ -void RS_EntityContainer::updateInserts() +void EntityContainer::updateInserts() { - RS_DEBUG->print("RS_EntityContainer::updateInserts()"); + DEBUG->print("EntityContainer::updateInserts()"); - //for (RS_Entity* e=firstEntity(RS2::ResolveNone); + //for (Entity* e=firstEntity(RS2::ResolveNone); // e!=NULL; // e=nextEntity(RS2::ResolveNone)) { #if 0 - Q3PtrListIterator it = createIterator(); - RS_Entity * e; + Q3PtrListIterator it = createIterator(); + Entity * e; while ((e = it.current()) != NULL) { @@ -656,126 +654,126 @@ void RS_EntityContainer::updateInserts() //// Only update our own inserts and not inserts of inserts if (e->rtti() == RS2::EntityInsert /*&& e->getParent()==this*/) { - ((RS_Insert *)e)->update(); + ((Insert *)e)->update(); } else if (e->isContainer() && e->rtti() != RS2::EntityHatch) { - ((RS_EntityContainer *)e)->updateInserts(); + ((EntityContainer *)e)->updateInserts(); } } #else for(int i=0; irtti() == RS2::EntityInsert /*&& e->getParent()==this*/) - ((RS_Insert *)e)->update(); + ((Insert *)e)->update(); else if (e->isContainer() && e->rtti() != RS2::EntityHatch) - ((RS_EntityContainer *)e)->updateInserts(); + ((EntityContainer *)e)->updateInserts(); } #endif - RS_DEBUG->print("RS_EntityContainer::updateInserts() OK"); + DEBUG->print("EntityContainer::updateInserts() OK"); } /** * 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 QString& oldName, const QString& newName) +void EntityContainer::renameInserts(const QString& oldName, const QString& newName) { - RS_DEBUG->print("RS_EntityContainer::renameInserts()"); + DEBUG->print("EntityContainer::renameInserts()"); - //for (RS_Entity* e=firstEntity(RS2::ResolveNone); + //for (Entity* e=firstEntity(RS2::ResolveNone); // e!=NULL; // e=nextEntity(RS2::ResolveNone)) { #if 0 - Q3PtrListIterator it = createIterator(); - RS_Entity* e; + Q3PtrListIterator it = createIterator(); + Entity* e; while ( (e = it.current()) != NULL ) { ++it; if (e->rtti()==RS2::EntityInsert) { - RS_Insert* i = ((RS_Insert*)e); + Insert* i = ((Insert*)e); if (i->getName()==oldName) { i->setName(newName); } } else if (e->isContainer()) { - ((RS_EntityContainer*)e)->renameInserts(oldName, newName); + ((EntityContainer*)e)->renameInserts(oldName, newName); } } #else for(int i=0; irtti() == RS2::EntityInsert) { - RS_Insert * i = ((RS_Insert *)e); + Insert * i = ((Insert *)e); if (i->getName() == oldName) i->setName(newName); } else if (e->isContainer()) - ((RS_EntityContainer *)e)->renameInserts(oldName, newName); + ((EntityContainer *)e)->renameInserts(oldName, newName); } #endif - RS_DEBUG->print("RS_EntityContainer::renameInserts() OK"); + DEBUG->print("EntityContainer::renameInserts() OK"); } /** * Updates all Spline entities in this container. */ -void RS_EntityContainer::updateSplines() +void EntityContainer::updateSplines() { - RS_DEBUG->print("RS_EntityContainer::updateSplines()"); + DEBUG->print("EntityContainer::updateSplines()"); - //for (RS_Entity* e=firstEntity(RS2::ResolveNone); + //for (Entity* e=firstEntity(RS2::ResolveNone); // e!=NULL; // e=nextEntity(RS2::ResolveNone)) { #if 0 - Q3PtrListIterator it = createIterator(); - RS_Entity* e; + Q3PtrListIterator it = createIterator(); + 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(); + ((Spline*)e)->update(); } else if (e->isContainer() && e->rtti()!=RS2::EntityHatch) { - ((RS_EntityContainer*)e)->updateSplines(); + ((EntityContainer*)e)->updateSplines(); } } #else for(int i=0; irtti() == RS2::EntitySpline /*&& e->getParent()==this*/) - ((RS_Spline *)e)->update(); + ((Spline *)e)->update(); else if (e->isContainer() && e->rtti() != RS2::EntityHatch) - ((RS_EntityContainer *)e)->updateSplines(); + ((EntityContainer *)e)->updateSplines(); } #endif - RS_DEBUG->print("RS_EntityContainer::updateSplines() OK"); + DEBUG->print("EntityContainer::updateSplines() OK"); } /** * Updates the sub entities of this container. */ -void RS_EntityContainer::update() +void EntityContainer::update() { - //for (RS_Entity* e=firstEntity(RS2::ResolveNone); + //for (Entity* e=firstEntity(RS2::ResolveNone); // e!=NULL; // e=nextEntity(RS2::ResolveNone)) { #if 0 - Q3PtrListIterator it = createIterator(); - RS_Entity* e; + Q3PtrListIterator it = createIterator(); + Entity* e; while ( (e = it.current()) != NULL ) { ++it; e->update(); @@ -783,7 +781,7 @@ void RS_EntityContainer::update() #else for(int i=0; iupdate(); entities[i]->update(); } @@ -794,7 +792,7 @@ void RS_EntityContainer::update() * Returns the first entity or NULL if this graphic is empty. * @param level */ -RS_Entity * RS_EntityContainer::firstEntity(RS2::ResolveLevel level) +Entity * EntityContainer::firstEntity(RS2::ResolveLevel level) { switch (level) { @@ -808,15 +806,15 @@ RS_Entity * RS_EntityContainer::firstEntity(RS2::ResolveLevel level) case RS2::ResolveAllButInserts: { subContainer = NULL; -// RS_Entity * e = entities.first(); +// Entity * e = entities.first(); // entityIterator.toFront(); entityIterator = entities; - RS_Entity * e = (entityIterator.hasNext() ? entityIterator.next() : NULL); + Entity * e = (entityIterator.hasNext() ? entityIterator.next() : NULL); if (e != NULL && e->isContainer() && e->rtti() != RS2::EntityInsert) { - subContainer = (RS_EntityContainer *)e; - e = ((RS_EntityContainer *)e)->firstEntity(level); + subContainer = (EntityContainer *)e; + e = ((EntityContainer *)e)->firstEntity(level); // emtpy container: if (e == NULL) @@ -833,15 +831,15 @@ RS_Entity * RS_EntityContainer::firstEntity(RS2::ResolveLevel level) case RS2::ResolveAll: { subContainer = NULL; -// RS_Entity * e = entities.first(); +// Entity * e = entities.first(); // entityIterator.toFront(); entityIterator = entities; - RS_Entity * e = (entityIterator.hasNext() ? entityIterator.next() : NULL); + Entity * e = (entityIterator.hasNext() ? entityIterator.next() : NULL); if (e != NULL && e->isContainer()) { - subContainer = (RS_EntityContainer *)e; - e = ((RS_EntityContainer *)e)->firstEntity(level); + subContainer = (EntityContainer *)e; + e = ((EntityContainer *)e)->firstEntity(level); // emtpy container: if (e == NULL) @@ -866,7 +864,7 @@ RS_Entity * RS_EntityContainer::firstEntity(RS2::ResolveLevel level) * \li \p 1 (default) only Groups are resolved * \li \p 2 all Entity Containers are resolved */ -RS_Entity * RS_EntityContainer::lastEntity(RS2::ResolveLevel level) +Entity * EntityContainer::lastEntity(RS2::ResolveLevel level) { switch (level) { @@ -879,16 +877,16 @@ RS_Entity * RS_EntityContainer::lastEntity(RS2::ResolveLevel level) case RS2::ResolveAllButInserts: { -// RS_Entity * e = entities.last(); +// Entity * e = entities.last(); entityIterator = entities; entityIterator.toBack(); - RS_Entity * e = (entityIterator.hasPrevious() ? entityIterator.previous() : NULL); + Entity * e = (entityIterator.hasPrevious() ? entityIterator.previous() : NULL); subContainer = NULL; if (e != NULL && e->isContainer() && e->rtti() != RS2::EntityInsert) { - subContainer = (RS_EntityContainer *)e; - e = ((RS_EntityContainer *)e)->lastEntity(level); + subContainer = (EntityContainer *)e; + e = ((EntityContainer *)e)->lastEntity(level); } return e; @@ -897,16 +895,16 @@ RS_Entity * RS_EntityContainer::lastEntity(RS2::ResolveLevel level) case RS2::ResolveAll: { -// RS_Entity * e = entities.last(); +// Entity * e = entities.last(); entityIterator = entities; entityIterator.toBack(); - RS_Entity * e = (entityIterator.hasPrevious() ? entityIterator.previous() : NULL); + Entity * e = (entityIterator.hasPrevious() ? entityIterator.previous() : NULL); subContainer = NULL; if (e != NULL && e->isContainer()) { - subContainer = (RS_EntityContainer *)e; - e = ((RS_EntityContainer *)e)->lastEntity(level); + subContainer = (EntityContainer *)e; + e = ((EntityContainer *)e)->lastEntity(level); } return e; @@ -921,7 +919,7 @@ RS_Entity * RS_EntityContainer::lastEntity(RS2::ResolveLevel level) * Returns the next entity or container or \p NULL if the last entity * returned by \p next() was the last entity in the container. */ -RS_Entity * RS_EntityContainer::nextEntity(RS2::ResolveLevel level) +Entity * EntityContainer::nextEntity(RS2::ResolveLevel level) { switch (level) { @@ -932,7 +930,7 @@ RS_Entity * RS_EntityContainer::nextEntity(RS2::ResolveLevel level) case RS2::ResolveAllButInserts: { - RS_Entity * e = NULL; + Entity * e = NULL; if (subContainer != NULL) { @@ -956,8 +954,8 @@ RS_Entity * RS_EntityContainer::nextEntity(RS2::ResolveLevel level) if (e != NULL && e->isContainer() && e->rtti() != RS2::EntityInsert) { - subContainer = (RS_EntityContainer *)e; - e = ((RS_EntityContainer *)e)->firstEntity(level); + subContainer = (EntityContainer *)e; + e = ((EntityContainer *)e)->firstEntity(level); // emtpy container: if (e == NULL) @@ -973,7 +971,7 @@ RS_Entity * RS_EntityContainer::nextEntity(RS2::ResolveLevel level) case RS2::ResolveAll: { - RS_Entity * e = NULL; + Entity * e = NULL; if (subContainer != NULL) { @@ -993,8 +991,8 @@ RS_Entity * RS_EntityContainer::nextEntity(RS2::ResolveLevel level) if (e != NULL && e->isContainer()) { - subContainer = (RS_EntityContainer *)e; - e = ((RS_EntityContainer *)e)->firstEntity(level); + subContainer = (EntityContainer *)e; + e = ((EntityContainer *)e)->firstEntity(level); // emtpy container: if (e == NULL) @@ -1015,9 +1013,9 @@ RS_Entity * RS_EntityContainer::nextEntity(RS2::ResolveLevel level) * Returns the prev entity or container or \p NULL if the last entity * returned by \p prev() was the first entity in the container. */ -RS_Entity * RS_EntityContainer::prevEntity(RS2::ResolveLevel level) +Entity * EntityContainer::prevEntity(RS2::ResolveLevel level) { - RS_Entity * e = NULL; + Entity * e = NULL; switch (level) { @@ -1047,8 +1045,8 @@ RS_Entity * RS_EntityContainer::prevEntity(RS2::ResolveLevel level) if (e != NULL && e->isContainer() && e->rtti() != RS2::EntityInsert) { - subContainer = (RS_EntityContainer *)e; - e = ((RS_EntityContainer *)e)->lastEntity(level); + subContainer = (EntityContainer *)e; + e = ((EntityContainer *)e)->lastEntity(level); // emtpy container: if (e == NULL) @@ -1081,8 +1079,8 @@ RS_Entity * RS_EntityContainer::prevEntity(RS2::ResolveLevel level) if (e != NULL && e->isContainer()) { - subContainer = (RS_EntityContainer *)e; - e = ((RS_EntityContainer *)e)->lastEntity(level); + subContainer = (EntityContainer *)e; + e = ((EntityContainer *)e)->lastEntity(level); // emtpy container: if (e == NULL) @@ -1101,7 +1099,7 @@ RS_Entity * RS_EntityContainer::prevEntity(RS2::ResolveLevel level) /** * @return Entity at the given index or NULL if the index is out of range. */ -RS_Entity * RS_EntityContainer::entityAt(uint index) +Entity * EntityContainer::entityAt(uint index) { return entities.at(index); } @@ -1109,7 +1107,7 @@ RS_Entity * RS_EntityContainer::entityAt(uint index) /** * @return Current index. */ -int RS_EntityContainer::entityAt() +int EntityContainer::entityAt() { #warning "!!! Not sure how to convert this from Qt3 -> Qt4 !!! (it seems we can ignore this for now as nothing calls it)" // return entities.at(); @@ -1119,7 +1117,7 @@ int RS_EntityContainer::entityAt() /** * Finds the given entity and makes it the current entity if found. */ -int RS_EntityContainer::findEntity(RS_Entity * entity) +int EntityContainer::findEntity(Entity * entity) { // return entities.find(entity); @@ -1132,7 +1130,7 @@ int RS_EntityContainer::findEntity(RS_Entity * entity) /** * @return The current entity. */ -RS_Entity * RS_EntityContainer::currentEntity() +Entity * EntityContainer::currentEntity() { // return entities.current(); @@ -1146,15 +1144,15 @@ RS_Entity * RS_EntityContainer::currentEntity() /** * Returns the copy to a new iterator for traversing the entities. */ -//Q3PtrListIterator RS_EntityContainer::createIterator() -QListIterator RS_EntityContainer::createIterator() +//Q3PtrListIterator EntityContainer::createIterator() +QListIterator EntityContainer::createIterator() { -// return Q3PtrListIterator(entities); - return QListIterator(entities); +// return Q3PtrListIterator(entities); + return QListIterator(entities); } #endif -/*virtual*/ bool RS_EntityContainer::isEmpty() +/*virtual*/ bool EntityContainer::isEmpty() { return (count() == 0); } @@ -1163,18 +1161,18 @@ QListIterator RS_EntityContainer::createIterator() * @return The point which is closest to 'coord' * (one of the vertexes) */ -Vector RS_EntityContainer::getNearestEndpoint(const Vector & coord, double * dist) +Vector EntityContainer::getNearestEndpoint(const Vector & coord, double * dist) { double minDist = RS_MAXDOUBLE; // minimum measured distance double curDist; // currently measured distance Vector closestPoint(false); // closest found endpoint Vector point; // endpoint found - //Q3PtrListIterator it = createIterator(); - //RS_Entity* en; + //Q3PtrListIterator it = createIterator(); + //Entity* en; //while ( (en = it.current()) != NULL ) { // ++it; - for (RS_Entity* en = firstEntity(); + for (Entity* en = firstEntity(); en != NULL; en = nextEntity()) { @@ -1193,12 +1191,12 @@ Vector RS_EntityContainer::getNearestEndpoint(const Vector & coord, double * dis return closestPoint; } -Vector RS_EntityContainer::getNearestPointOnEntity(const Vector & coord, - bool onEntity, double * dist, RS_Entity ** entity) +Vector EntityContainer::getNearestPointOnEntity(const Vector & coord, + bool onEntity, double * dist, Entity ** entity) { Vector point(false); - RS_Entity * e = getNearestEntity(coord, dist, RS2::ResolveNone); + Entity * e = getNearestEntity(coord, dist, RS2::ResolveNone); if (e && e->isVisible()) point = e->getNearestPointOnEntity(coord, onEntity, dist, entity); @@ -1206,10 +1204,10 @@ Vector RS_EntityContainer::getNearestPointOnEntity(const Vector & coord, return point; } -Vector RS_EntityContainer::getNearestCenter(const Vector & coord, double * dist) +Vector EntityContainer::getNearestCenter(const Vector & coord, double * dist) { Vector point(false); - RS_Entity * closestEntity = getNearestEntity(coord, NULL, RS2::ResolveNone); + Entity * closestEntity = getNearestEntity(coord, NULL, RS2::ResolveNone); if (closestEntity) point = closestEntity->getNearestCenter(coord, dist); @@ -1217,10 +1215,10 @@ Vector RS_EntityContainer::getNearestCenter(const Vector & coord, double * dist) return point; } -Vector RS_EntityContainer::getNearestMiddle(const Vector & coord, double * dist) +Vector EntityContainer::getNearestMiddle(const Vector & coord, double * dist) { Vector point(false); - RS_Entity * closestEntity = getNearestEntity(coord, NULL, RS2::ResolveNone); + Entity * closestEntity = getNearestEntity(coord, NULL, RS2::ResolveNone); if (closestEntity) point = closestEntity->getNearestMiddle(coord, dist); @@ -1228,11 +1226,11 @@ Vector RS_EntityContainer::getNearestMiddle(const Vector & coord, double * dist) return point; } -Vector RS_EntityContainer::getNearestDist(double distance, const Vector & coord, +Vector EntityContainer::getNearestDist(double distance, const Vector & coord, double * dist) { Vector point(false); - RS_Entity * closestEntity = getNearestEntity(coord, NULL, RS2::ResolveNone); + Entity * closestEntity = getNearestEntity(coord, NULL, RS2::ResolveNone); if (closestEntity) point = closestEntity->getNearestDist(distance, coord, dist); @@ -1243,7 +1241,7 @@ Vector RS_EntityContainer::getNearestDist(double distance, const Vector & coord, /** * @return The intersection which is closest to 'coord' */ -Vector RS_EntityContainer::getNearestIntersection(const Vector & coord, +Vector EntityContainer::getNearestIntersection(const Vector & coord, double * dist) { double minDist = RS_MAXDOUBLE; // minimum measured distance @@ -1251,18 +1249,18 @@ Vector RS_EntityContainer::getNearestIntersection(const Vector & coord, Vector closestPoint(false); // closest found endpoint Vector point; // endpoint found VectorSolutions sol; - RS_Entity * closestEntity; + Entity * closestEntity; closestEntity = getNearestEntity(coord, NULL, RS2::ResolveAll); if (closestEntity) { - for(RS_Entity * en=firstEntity(RS2::ResolveAll); en!=NULL; + for(Entity * en=firstEntity(RS2::ResolveAll); en!=NULL; en = nextEntity(RS2::ResolveAll)) { if (en->isVisible() && en!=closestEntity) { - sol = RS_Information::getIntersection(closestEntity, en, true); + sol = Information::getIntersection(closestEntity, en, true); for(int i=0; i<4; i++) { @@ -1289,14 +1287,14 @@ Vector RS_EntityContainer::getNearestIntersection(const Vector & coord, return closestPoint; } -Vector RS_EntityContainer::getNearestRef(const Vector & coord, double * dist) +Vector EntityContainer::getNearestRef(const Vector & coord, double * dist) { double minDist = RS_MAXDOUBLE; // minimum measured distance double curDist; // currently measured distance Vector closestPoint(false); // closest found endpoint Vector point; // endpoint found - for(RS_Entity * en=firstEntity(); en!=NULL; en=nextEntity()) + for(Entity * en=firstEntity(); en!=NULL; en=nextEntity()) { if (en->isVisible()) { @@ -1316,7 +1314,7 @@ Vector RS_EntityContainer::getNearestRef(const Vector & coord, double * dist) return closestPoint; } -Vector RS_EntityContainer::getNearestSelectedRef(const Vector & coord, +Vector EntityContainer::getNearestSelectedRef(const Vector & coord, double * dist) { double minDist = RS_MAXDOUBLE; // minimum measured distance @@ -1324,7 +1322,7 @@ Vector RS_EntityContainer::getNearestSelectedRef(const Vector & coord, Vector closestPoint(false); // closest found endpoint Vector point; // endpoint found - for(RS_Entity * en=firstEntity(); en!=NULL; en=nextEntity()) + for(Entity * en=firstEntity(); en!=NULL; en=nextEntity()) { if (en->isVisible() && en->isSelected() && !en->isParentSelected()) { @@ -1344,25 +1342,25 @@ Vector RS_EntityContainer::getNearestSelectedRef(const Vector & coord, return closestPoint; } -double RS_EntityContainer::getDistanceToPoint(const Vector & coord, - RS_Entity ** entity, RS2::ResolveLevel level, double solidDist) +double EntityContainer::getDistanceToPoint(const Vector & coord, + Entity ** entity, RS2::ResolveLevel level, double solidDist) { - RS_DEBUG->print("RS_EntityContainer::getDistanceToPoint"); + DEBUG->print("EntityContainer::getDistanceToPoint"); double minDist = RS_MAXDOUBLE; // minimum measured distance double curDist; // currently measured distance - RS_Entity * closestEntity = NULL; // closest entity found - RS_Entity * subEntity = NULL; + Entity * closestEntity = NULL; // closest entity found + Entity * subEntity = NULL; //int k=0; - for(RS_Entity * e=firstEntity(level); e!=NULL; e=nextEntity(level)) + for(Entity * e=firstEntity(level); e!=NULL; e=nextEntity(level)) { if (e->isVisible()) { - RS_DEBUG->print("entity: getDistanceToPoint"); - RS_DEBUG->print("entity: %d", e->rtti()); + DEBUG->print("entity: getDistanceToPoint"); + DEBUG->print("entity: %d", e->rtti()); curDist = e->getDistanceToPoint(coord, &subEntity, level, solidDist); - RS_DEBUG->print("entity: getDistanceToPoint: OK"); + DEBUG->print("entity: getDistanceToPoint: OK"); if (curDistprint("RS_EntityContainer::getDistanceToPoint: OK"); + DEBUG->print("EntityContainer::getDistanceToPoint: OK"); return minDist; } -RS_Entity * RS_EntityContainer::getNearestEntity(const Vector & coord, +Entity * EntityContainer::getNearestEntity(const Vector & coord, double * dist, RS2::ResolveLevel level) { - RS_DEBUG->print("RS_EntityContainer::getNearestEntity"); - RS_Entity * e = NULL; + DEBUG->print("EntityContainer::getNearestEntity"); + Entity * e = NULL; // distance for points inside solids: double solidDist = RS_MAXDOUBLE; @@ -1404,7 +1402,7 @@ RS_Entity * RS_EntityContainer::getNearestEntity(const Vector & coord, if (dist) *dist = d; - RS_DEBUG->print("RS_EntityContainer::getNearestEntity: OK"); + DEBUG->print("EntityContainer::getNearestEntity: OK"); return e; } @@ -1416,24 +1414,24 @@ RS_Entity * RS_EntityContainer::getNearestEntity(const Vector & coord, * @retval true all contours were closed * @retval false at least one contour is not closed */ -bool RS_EntityContainer::optimizeContours() +bool EntityContainer::optimizeContours() { - RS_DEBUG->print("RS_EntityContainer::optimizeContours"); + DEBUG->print("EntityContainer::optimizeContours"); Vector current(false); Vector start(false); - RS_EntityContainer tmp; + EntityContainer tmp; bool changed = false; bool closed = true; for(uint ci=0; ciisEdge() && !e1->isContainer() && !e1->isProcessed()) { - RS_AtomicEntity * ce = (RS_AtomicEntity *)e1; + AtomicEntity * ce = (AtomicEntity *)e1; // next contour start: ce->setProcessed(true); @@ -1449,12 +1447,12 @@ bool RS_EntityContainer::optimizeContours() done = true; for(uint ei=0; eiisEdge() && !e2->isContainer() && !e2->isProcessed()) { - RS_AtomicEntity * e = (RS_AtomicEntity *)e2; + AtomicEntity * e = (AtomicEntity *)e2; if (e->getStartpoint().distanceTo(current) < 1.0e-4) { @@ -1466,7 +1464,7 @@ bool RS_EntityContainer::optimizeContours() else if (e->getEndpoint().distanceTo(current) < 1.0e-4) { e->setProcessed(true); - RS_AtomicEntity * cl = (RS_AtomicEntity *)e->clone(); + AtomicEntity * cl = (AtomicEntity *)e->clone(); cl->reverse(); tmp.addEntity(cl); current = cl->getEndpoint(); @@ -1493,7 +1491,7 @@ bool RS_EntityContainer::optimizeContours() { done = true; - for(RS_Entity * en=firstEntity(); en!=NULL; en=nextEntity()) + for(Entity * en=firstEntity(); en!=NULL; en=nextEntity()) { if (!en->isContainer()) { @@ -1506,19 +1504,19 @@ bool RS_EntityContainer::optimizeContours() while (!done); // add new sorted entities: - for(RS_Entity * en=tmp.firstEntity(); en!=NULL; en=tmp.nextEntity()) + for(Entity * en=tmp.firstEntity(); en!=NULL; en=tmp.nextEntity()) { en->setProcessed(false); addEntity(en->clone()); } - RS_DEBUG->print("RS_EntityContainer::optimizeContours: OK"); + DEBUG->print("EntityContainer::optimizeContours: OK"); return closed; } -bool RS_EntityContainer::hasEndpointsWithinWindow(Vector v1, Vector v2) +bool EntityContainer::hasEndpointsWithinWindow(Vector v1, Vector v2) { - for(RS_Entity * e=firstEntity(RS2::ResolveNone); e!=NULL; e=nextEntity(RS2::ResolveNone)) + for(Entity * e=firstEntity(RS2::ResolveNone); e!=NULL; e=nextEntity(RS2::ResolveNone)) { if (e->hasEndpointsWithinWindow(v1, v2)) return true; @@ -1527,29 +1525,29 @@ bool RS_EntityContainer::hasEndpointsWithinWindow(Vector v1, Vector v2) return false; } -void RS_EntityContainer::move(Vector offset) +void EntityContainer::move(Vector offset) { - for(RS_Entity * e=firstEntity(RS2::ResolveNone); e!=NULL; e=nextEntity(RS2::ResolveNone)) + for(Entity * e=firstEntity(RS2::ResolveNone); e!=NULL; e=nextEntity(RS2::ResolveNone)) e->move(offset); if (autoUpdateBorders) calculateBorders(); } -void RS_EntityContainer::rotate(Vector center, double angle) +void EntityContainer::rotate(Vector center, double angle) { - for(RS_Entity * e=firstEntity(RS2::ResolveNone); e!=NULL; e=nextEntity(RS2::ResolveNone)) + for(Entity * e=firstEntity(RS2::ResolveNone); e!=NULL; e=nextEntity(RS2::ResolveNone)) e->rotate(center, angle); if (autoUpdateBorders) calculateBorders(); } -void RS_EntityContainer::scale(Vector center, Vector factor) +void EntityContainer::scale(Vector center, Vector factor) { if (fabs(factor.x) > RS_TOLERANCE && fabs(factor.y) > RS_TOLERANCE) { - for(RS_Entity * e=firstEntity(RS2::ResolveNone); e!=NULL; e=nextEntity(RS2::ResolveNone)) + for(Entity * e=firstEntity(RS2::ResolveNone); e!=NULL; e=nextEntity(RS2::ResolveNone)) e->scale(center, factor); } @@ -1557,16 +1555,16 @@ void RS_EntityContainer::scale(Vector center, Vector factor) calculateBorders(); } -void RS_EntityContainer::mirror(Vector axisPoint1, Vector axisPoint2) +void EntityContainer::mirror(Vector axisPoint1, Vector axisPoint2) { if (axisPoint1.distanceTo(axisPoint2) > 1.0e-6) { - for(RS_Entity * e=firstEntity(RS2::ResolveNone); e!=NULL; e=nextEntity(RS2::ResolveNone)) + for(Entity * e=firstEntity(RS2::ResolveNone); e!=NULL; e=nextEntity(RS2::ResolveNone)) e->mirror(axisPoint1, axisPoint2); } } -void RS_EntityContainer::stretch(Vector firstCorner, Vector secondCorner, +void EntityContainer::stretch(Vector firstCorner, Vector secondCorner, Vector offset) { if (getMin().isInWindow(firstCorner, secondCorner) && @@ -1576,51 +1574,51 @@ void RS_EntityContainer::stretch(Vector firstCorner, Vector secondCorner, } else { - for(RS_Entity * e=firstEntity(RS2::ResolveNone); e!=NULL; e=nextEntity(RS2::ResolveNone)) + for(Entity * e=firstEntity(RS2::ResolveNone); e!=NULL; e=nextEntity(RS2::ResolveNone)) e->stretch(firstCorner, secondCorner, offset); } - // some entitiycontainers might need an update (e.g. RS_Leader): + // some entitiycontainers might need an update (e.g. Leader): update(); } -void RS_EntityContainer::moveRef(const Vector & ref, const Vector & offset) +void EntityContainer::moveRef(const Vector & ref, const Vector & offset) { - for(RS_Entity* e=firstEntity(RS2::ResolveNone); e!=NULL; e=nextEntity(RS2::ResolveNone)) + for(Entity* e=firstEntity(RS2::ResolveNone); e!=NULL; e=nextEntity(RS2::ResolveNone)) e->moveRef(ref, offset); if (autoUpdateBorders) calculateBorders(); } -void RS_EntityContainer::moveSelectedRef(const Vector & ref, const Vector & offset) +void EntityContainer::moveSelectedRef(const Vector & ref, const Vector & offset) { - for(RS_Entity * e=firstEntity(RS2::ResolveNone); e!=NULL; e=nextEntity(RS2::ResolveNone)) + for(Entity * e=firstEntity(RS2::ResolveNone); e!=NULL; e=nextEntity(RS2::ResolveNone)) e->moveSelectedRef(ref, offset); if (autoUpdateBorders) calculateBorders(); } -void RS_EntityContainer::draw(PaintInterface * painter, GraphicView * view, double /*patternOffset*/) +void EntityContainer::draw(PaintInterface * painter, GraphicView * view, double /*patternOffset*/) { if (!painter || !view) return; - for(RS_Entity * e=firstEntity(RS2::ResolveNone); e!=NULL; e=nextEntity(RS2::ResolveNone)) + for(Entity * e=firstEntity(RS2::ResolveNone); e!=NULL; e=nextEntity(RS2::ResolveNone)) #if 0 { if (e->rtti() == RS2::EntityText) { std::cout << "About to draw TEXT entity... " - << "TEXT=\"" << ((RS_Text *)e)->getText().toAscii().data() << "\"" << std::endl; + << "TEXT=\"" << ((Text *)e)->getText().toAscii().data() << "\"" << std::endl; } //OK, we have text, but no insert entities at least none that are drawn... //Ah! But with a standard text entity, it DOES have them! else if (e->rtti() == RS2::EntityInsert) { std::cout << "About to draw INSERT entity... " - << "INSERT=\"" << ((RS_Insert *)e)->getData().name.toAscii().data() << "\"" << std::endl; + << "INSERT=\"" << ((Insert *)e)->getData().name.toAscii().data() << "\"" << std::endl; } #endif view->drawEntity(e); @@ -1632,7 +1630,7 @@ else if (e->rtti() == RS2::EntityInsert) /** * Dumps the entities to stdout. */ -std::ostream & operator<<(std::ostream & os, RS_EntityContainer & ec) +std::ostream & operator<<(std::ostream & os, EntityContainer & ec) { static int indent = 0; char * tab = new char[indent * 2 + 1]; @@ -1648,7 +1646,7 @@ std::ostream & operator<<(std::ostream & os, RS_EntityContainer & ec) os << tab << "Borders[" << id << "]: " << ec.minV << " - " << ec.maxV << "\n"; //os << tab << "Unit[" << id << "]: " - //<< RS_Units::unit2string (ec.unit) << "\n"; + //<< Units::unit2string (ec.unit) << "\n"; if (ec.getLayer()) { os << tab << "Layer[" << id << "]: " @@ -1672,25 +1670,25 @@ QString s; os << "(# of entities in this = " << ec.entities.size() << ")\n"; for(int i=0; irtti()); os << s.toAscii().data(); } s.sprintf("(firstEntity = $%08X)\n", ec.firstEntity()); os << s.toAscii().data(); - for(RS_Entity * t=ec.firstEntity(); t!=NULL; t=ec.nextEntity()) + for(Entity * t=ec.firstEntity(); t!=NULL; t=ec.nextEntity()) { switch (t->rtti()) { case RS2::EntityInsert: - os << tab << *((RS_Insert *)t); - os << tab << *((RS_Entity *)t); - os << tab << *((RS_EntityContainer *)t); + os << tab << *((Insert *)t); + os << tab << *((Entity *)t); + os << tab << *((EntityContainer *)t); break; default: if (t->isContainer()) - os << tab << *((RS_EntityContainer *)t); + os << tab << *((EntityContainer *)t); else os << tab << *t;