X-Git-Url: http://shamusworld.gotdns.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fbase%2Fmodification.cpp;fp=src%2Fbase%2Fmodification.cpp;h=9cac119726fc5d8492623222baefbff7462a269d;hb=16354e0421b316a62c6b9f7b0b4f3b8cf6f06284;hp=c93ea261eebb0e9786df1add7941006b414ce6b3;hpb=3239ef39dcee08fa6e8cd68cdf2727fc68cc7a8c;p=architektonas diff --git a/src/base/modification.cpp b/src/base/modification.cpp index c93ea26..9cac119 100644 --- a/src/base/modification.cpp +++ b/src/base/modification.cpp @@ -36,7 +36,7 @@ * any views to be updated. * @param handleUndo true: Handle undo functionalitiy. */ -RS_Modification::RS_Modification(RS_EntityContainer & container, +Modification::Modification(EntityContainer & container, GraphicView * graphicView, bool handleUndo) { this->container = &container; @@ -49,31 +49,31 @@ RS_Modification::RS_Modification(RS_EntityContainer & container, /** * Deletes all selected entities. */ -void RS_Modification::remove() +void Modification::remove() { if (container == NULL) { - RS_DEBUG->print("RS_Modification::remove: no valid container", RS_Debug::D_WARNING); + DEBUG->print("Modification::remove: no valid container", Debug::D_WARNING); return; } - if (document != NULL) + if (document) document->startUndoCycle(); // not safe (?) - for(RS_Entity * e=container->firstEntity(); e!=NULL; e=container->nextEntity()) + for(Entity * e=container->firstEntity(); e!=NULL; e=container->nextEntity()) { - if (e != NULL && e->isSelected()) + if (e && e->isSelected()) { e->setSelected(false); e->changeUndoState(); - if (document != NULL) + if (document) document->addUndoable(e); } } - if (document != NULL) + if (document) document->endUndoCycle(); graphicView->redraw(); @@ -82,29 +82,29 @@ void RS_Modification::remove() /** * Changes the attributes of all selected */ -bool RS_Modification::changeAttributes(RS_AttributesData & data) +bool Modification::changeAttributes(AttributesData & data) { if (!container) { - RS_DEBUG->print("RS_Modification::changeAttributes: no valid container", RS_Debug::D_WARNING); + DEBUG->print("Modification::changeAttributes: no valid container", Debug::D_WARNING); return false; } - QList addList; + QList addList; if (document) document->startUndoCycle(); - for(RS_Entity * e=container->firstEntity(); e!=NULL; e=container->nextEntity()) + for(Entity * e=container->firstEntity(); e!=NULL; e=container->nextEntity()) { //for (uint i=0; icount(); ++i) { - //RS_Entity* e = container->entityAt(i); + //Entity* e = container->entityAt(i); if (e && e->isSelected()) { - RS_Entity * ec = e->clone(); + Entity * ec = e->clone(); ec->setSelected(false); - RS_Pen pen = ec->getPen(false); + Pen pen = ec->getPen(false); if (data.changeLayer == true) ec->setLayer(data.layer); @@ -127,7 +127,7 @@ bool RS_Modification::changeAttributes(RS_AttributesData & data) // ec->setPenToActive(); //} //if (ec->rtti()==RS2::EntityInsert) { - // ((RS_Insert*)ec)->update(); + // ((Insert*)ec)->update(); //} ec->update(); addList.append(ec); @@ -156,19 +156,19 @@ bool RS_Modification::changeAttributes(RS_AttributesData & data) * @param ref Reference point. The entities will be moved by -ref. * @param cut true: cut instead of copying, false: copy */ -void RS_Modification::copy(const Vector& ref, const bool cut) { +void Modification::copy(const Vector& ref, const bool cut) { if (container==NULL) { - RS_DEBUG->print("RS_Modification::copy: no valid container", - RS_Debug::D_WARNING); + DEBUG->print("Modification::copy: no valid container", + Debug::D_WARNING); return; } - RS_CLIPBOARD->clear(); + CLIPBOARD->clear(); if (graphic!=NULL) { - RS_CLIPBOARD->getGraphic()->setUnit(graphic->getUnit()); + CLIPBOARD->getGraphic()->setUnit(graphic->getUnit()); } else { - RS_CLIPBOARD->getGraphic()->setUnit(RS2::None); + CLIPBOARD->getGraphic()->setUnit(RS2::None); } // start undo cycle for the container if we're cutting @@ -177,10 +177,10 @@ void RS_Modification::copy(const Vector& ref, const bool cut) { } // copy entities / layers / blocks - for (RS_Entity* e=container->firstEntity(); e!=NULL; + for (Entity* e=container->firstEntity(); e!=NULL; e=container->nextEntity()) { //for (uint i=0; icount(); ++i) { - //RS_Entity* e = container->entityAt(i); + //Entity* e = container->entityAt(i); if (e!=NULL && e->isSelected()) { copyEntity(e, ref, cut); @@ -203,7 +203,7 @@ void RS_Modification::copy(const Vector& ref, const bool cut) { * @param ref Reference point. The entities will be moved by -ref. * @param cut true: cut instead of copying, false: copy */ -void RS_Modification::copyEntity(RS_Entity * e, const Vector & ref, const bool cut) +void Modification::copyEntity(Entity * e, const Vector & ref, const bool cut) { if (e && e->isSelected()) { @@ -236,15 +236,15 @@ void RS_Modification::copyEntity(RS_Entity * e, const Vector & ref, const bool c } // add entity to clipboard: - RS_Entity * c = e->clone(); + Entity * c = e->clone(); c->move(-ref); - RS_CLIPBOARD->addEntity(c); + CLIPBOARD->addEntity(c); copyLayers(e); copyBlocks(e); // set layer to the layer clone: - RS_Layer * l = e->getLayer(); + Layer * l = e->getLayer(); if (l) c->setLayer(l->getName()); @@ -252,13 +252,13 @@ void RS_Modification::copyEntity(RS_Entity * e, const Vector & ref, const bool c // make sure all sub entities point to layers of the clipboard if (c->isContainer()) { - RS_EntityContainer * ec = (RS_EntityContainer *)c; + EntityContainer * ec = (EntityContainer *)c; - for(RS_Entity * e2=ec->firstEntity(RS2::ResolveAll); e2!=NULL; + for(Entity * e2=ec->firstEntity(RS2::ResolveAll); e2!=NULL; e2=ec->nextEntity(RS2::ResolveAll)) { - //RS_Entity* e2 = ec->entityAt(i); - RS_Layer * l2 = e2->getLayer(); + //Entity* e2 = ec->entityAt(i); + Layer * l2 = e2->getLayer(); if (l2) e2->setLayer(l2->getName()); @@ -280,7 +280,7 @@ void RS_Modification::copyEntity(RS_Entity * e, const Vector & ref, const bool c /** * Copies all layers of the given entity to the clipboard. */ -void RS_Modification::copyLayers(RS_Entity* e) { +void Modification::copyLayers(Entity* e) { if (e==NULL) { return; @@ -289,10 +289,10 @@ void RS_Modification::copyLayers(RS_Entity* e) { // add layer(s) of the entity if it's not an insert // (inserts are on layer '0'): if (e->rtti()!=RS2::EntityInsert) { - RS_Layer* l = e->getLayer(); + Layer* l = e->getLayer(); if (l!=NULL) { - if (!RS_CLIPBOARD->hasLayer(l->getName())) { - RS_CLIPBOARD->addLayer(l->clone()); + if (!CLIPBOARD->hasLayer(l->getName())) { + CLIPBOARD->addLayer(l->clone()); } } } @@ -300,12 +300,12 @@ void RS_Modification::copyLayers(RS_Entity* e) { // special handling of inserts: else { // insert: add layer(s) of subentities: - RS_Block* b = ((RS_Insert*)e)->getBlockForInsert(); + Block* b = ((Insert*)e)->getBlockForInsert(); if (b!=NULL) { - for (RS_Entity* e2=b->firstEntity(); e2!=NULL; + for (Entity* e2=b->firstEntity(); e2!=NULL; e2=b->nextEntity()) { //for (uint i=0; icount(); ++i) { - //RS_Entity* e2 = b->entityAt(i); + //Entity* e2 = b->entityAt(i); copyLayers(e2); } } @@ -317,7 +317,7 @@ void RS_Modification::copyLayers(RS_Entity* e) { /** * Copies all blocks of the given entity to the clipboard. */ -void RS_Modification::copyBlocks(RS_Entity* e) { +void Modification::copyBlocks(Entity* e) { if (e==NULL) { return; @@ -325,17 +325,17 @@ void RS_Modification::copyBlocks(RS_Entity* e) { // add block of the entity if it's an insert if (e->rtti()==RS2::EntityInsert) { - RS_Block* b = ((RS_Insert*)e)->getBlockForInsert(); + Block* b = ((Insert*)e)->getBlockForInsert(); if (b!=NULL) { // add block of an insert: - if (!RS_CLIPBOARD->hasBlock(b->getName())) { - RS_CLIPBOARD->addBlock((RS_Block*)b->clone()); + if (!CLIPBOARD->hasBlock(b->getName())) { + CLIPBOARD->addBlock((Block*)b->clone()); } - for (RS_Entity* e2=b->firstEntity(); e2!=NULL; + for (Entity* e2=b->firstEntity(); e2!=NULL; e2=b->nextEntity()) { //for (uint i=0; icount(); ++i) { - //RS_Entity* e2 = b->entityAt(i); + //Entity* e2 = b->entityAt(i); copyBlocks(e2); } } @@ -353,23 +353,23 @@ void RS_Modification::copyBlocks(RS_Entity* e) { * @param source The source from where to paste. NULL means the source * is the clipboard. */ -void RS_Modification::paste(const RS_PasteData& data, Drawing* source) { +void Modification::paste(const PasteData& data, Drawing* source) { if (graphic==NULL) { - RS_DEBUG->print(RS_Debug::D_WARNING, - "RS_Modification::paste: Graphic is NULL"); + DEBUG->print(Debug::D_WARNING, + "Modification::paste: Graphic is NULL"); return; } double factor = 1.0; if (source==NULL) { - source = RS_CLIPBOARD->getGraphic(); + source = CLIPBOARD->getGraphic(); // graphics from the clipboard need to be scaled. from the part lib not: RS2::Unit sourceUnit = source->getUnit(); RS2::Unit targetUnit = graphic->getUnit(); - factor = RS_Units::convert(1.0, sourceUnit, targetUnit); + factor = Units::convert(1.0, sourceUnit, targetUnit); } if (document!=NULL) { @@ -379,9 +379,9 @@ void RS_Modification::paste(const RS_PasteData& data, Drawing* source) { // insert layers: if (graphic!=NULL) { - RS_Layer* layer = graphic->getActiveLayer(); + Layer* layer = graphic->getActiveLayer(); for(uint i=0; icountLayers(); ++i) { - RS_Layer* l = source->layerAt(i); + Layer* l = source->layerAt(i); if (l!=NULL) { if (graphic->findLayer(l->getName())==NULL) { graphic->addLayer(l->clone()); @@ -394,24 +394,24 @@ void RS_Modification::paste(const RS_PasteData& data, Drawing* source) { // insert blocks: if (graphic!=NULL) { for(uint i=0; icountBlocks(); ++i) { - RS_Block* b = source->blockAt(i); + Block* b = source->blockAt(i); if (b!=NULL) { if (graphic->findBlock(b->getName())==NULL) { - RS_Block* bc = (RS_Block*)b->clone(); + Block* bc = (Block*)b->clone(); bc->reparent(container); //bc->scale(bc->getBasePoint(), Vector(factor, factor)); // scale block but don't scale inserts in block // (they already scale with their block) for(uint i2=0; i2count(); ++i2) { - RS_Entity* e = bc->entityAt(i2); + Entity* e = bc->entityAt(i2); if (e!=NULL && e->rtti()!=RS2::EntityInsert) { e->scale(bc->getBasePoint(), Vector(factor, factor)); } else { - Vector ip = ((RS_Insert*)e)->getInsertionPoint(); + Vector ip = ((Insert*)e)->getInsertionPoint(); ip.scale(bc->getBasePoint(), Vector(factor, factor)); - ((RS_Insert*)e)->setInsertionPoint(ip); + ((Insert*)e)->setInsertionPoint(ip); e->update(); } } @@ -423,19 +423,19 @@ void RS_Modification::paste(const RS_PasteData& data, Drawing* source) { } // add entities to this host (graphic or a new block) - RS_EntityContainer* host = container; + EntityContainer* host = container; QString blockName; // create new block: if (graphic!=NULL) { if (data.asInsert==true) { - RS_BlockList* blkList = graphic->getBlockList(); + BlockList* blkList = graphic->getBlockList(); if (blkList!=NULL) { blockName = blkList->newName(data.blockName); - RS_Block* blk = - new RS_Block(graphic, - RS_BlockData(blockName, + Block* blk = + new Block(graphic, + BlockData(blockName, Vector(0.0,0.0), false)); graphic->addBlock(blk); @@ -445,29 +445,29 @@ void RS_Modification::paste(const RS_PasteData& data, Drawing* source) { } // insert entities: - //for (uint i=0; i<((RS_EntityContainer*)source)->count(); ++i) { - //RS_Entity* e = source->entityAt(i); - for (RS_Entity* e=((RS_EntityContainer*)source)->firstEntity(); + //for (uint i=0; i<((EntityContainer*)source)->count(); ++i) { + //Entity* e = source->entityAt(i); + for (Entity* e=((EntityContainer*)source)->firstEntity(); e!=NULL; - e=((RS_EntityContainer*)source)->nextEntity()) { + e=((EntityContainer*)source)->nextEntity()) { if (e!=NULL) { QString layerName = "0"; - RS_Layer* layer = e->getLayer(); + Layer* layer = e->getLayer(); if (layer!=NULL) { layerName = layer->getName(); } - RS_Entity* e2 = e->clone(); + Entity* e2 = e->clone(); e2->reparent(host); if (data.asInsert==false) { e2->move(data.insertionPoint); } // don't adjust insert factor - block was already adjusted to unit if (e2->rtti()==RS2::EntityInsert) { - Vector ip = ((RS_Insert*)e2)->getInsertionPoint(); + Vector ip = ((Insert*)e2)->getInsertionPoint(); ip.scale(data.insertionPoint, Vector(factor, factor)); - ((RS_Insert*)e2)->setInsertionPoint(ip); + ((Insert*)e2)->setInsertionPoint(ip); e2->update(); } else { e2->scale(data.insertionPoint, Vector(factor, factor)); @@ -477,13 +477,13 @@ void RS_Modification::paste(const RS_PasteData& data, Drawing* source) { // make sure all sub entities point to layers of the container if (e2->isContainer()) { - RS_EntityContainer* ec = (RS_EntityContainer*)e2; + EntityContainer* ec = (EntityContainer*)e2; - for (RS_Entity* e3 = ec->firstEntity(RS2::ResolveAll); e3!=NULL; + for (Entity* e3 = ec->firstEntity(RS2::ResolveAll); e3!=NULL; e3 = ec->nextEntity(RS2::ResolveAll)) { - //RS_Entity* e3 = ec->entityAt(i); - RS_Layer* l2 = e3->getLayer(); + //Entity* e3 = ec->entityAt(i); + Layer* l2 = e3->getLayer(); if (l2!=NULL) { e3->setLayer(l2->getName()); } @@ -497,9 +497,9 @@ void RS_Modification::paste(const RS_PasteData& data, Drawing* source) { } if (data.asInsert==true) { - RS_Insert* ins = - new RS_Insert(container, - RS_InsertData( + Insert* ins = + new Insert(container, + InsertData( blockName, data.insertionPoint, Vector(data.factor, data.factor), @@ -539,30 +539,30 @@ void RS_Modification::paste(const RS_PasteData& data, Drawing* source) { * * @return true */ -bool RS_Modification::splitPolyline(RS_Polyline& polyline, - RS_Entity& e1, Vector v1, - RS_Entity& e2, Vector v2, - RS_Polyline** polyline1, - RS_Polyline** polyline2) const { +bool Modification::splitPolyline(Polyline& polyline, + Entity& e1, Vector v1, + Entity& e2, Vector v2, + Polyline** polyline1, + Polyline** polyline2) const { if (container==NULL) { - RS_DEBUG->print("RS_Modification::splitPolyline: no valid container", - RS_Debug::D_WARNING); + DEBUG->print("Modification::splitPolyline: no valid container", + Debug::D_WARNING); return false; } - RS_Entity* firstEntity = polyline.firstEntity(); + Entity* firstEntity = polyline.firstEntity(); Vector firstPoint(false); if (firstEntity->rtti()==RS2::EntityLine) { - firstPoint = ((RS_Line*)firstEntity)->getStartpoint(); + firstPoint = ((Line*)firstEntity)->getStartpoint(); } - RS_Polyline* pl1 = - new RS_Polyline(container, - RS_PolylineData(firstPoint, Vector(0.0,0.0), 0)); - RS_Polyline* pl2 = new RS_Polyline(container); - RS_Polyline* pl = pl1; // Current polyline - RS_Line* line = NULL; - RS_Arc* arc = NULL; + Polyline* pl1 = + new Polyline(container, + PolylineData(firstPoint, Vector(0.0,0.0), 0)); + Polyline* pl2 = new Polyline(container); + Polyline* pl = pl1; // Current polyline + Line* line = NULL; + Arc* arc = NULL; if (polyline1!=NULL) { *polyline1 = pl1; @@ -571,15 +571,15 @@ bool RS_Modification::splitPolyline(RS_Polyline& polyline, *polyline2 = pl2; } - for (RS_Entity* e = polyline.firstEntity(); + for (Entity* e = polyline.firstEntity(); e != NULL; e = polyline.nextEntity()) { if (e->rtti()==RS2::EntityLine) { - line = (RS_Line*)e; + line = (Line*)e; arc = NULL; } else if (e->rtti()==RS2::EntityArc) { - arc = (RS_Arc*)e; + arc = (Arc*)e; line = NULL; } else { line = NULL; @@ -638,25 +638,25 @@ bool RS_Modification::splitPolyline(RS_Polyline& polyline, * @return Pointer to the new polyline or NULL. */ /* -RS_Polyline* RS_Modification::addPolylineNode(RS_Polyline& polyline, - const RS_AtomicEntity& segment, +Polyline* Modification::addPolylineNode(Polyline& polyline, + const AtomicEntity& segment, const Vector& node) { - RS_DEBUG->print("RS_Modification::addPolylineNode"); + DEBUG->print("Modification::addPolylineNode"); if (container==NULL) { - RS_DEBUG->print("RS_Modification::addPolylineNode: no valid container", - RS_Debug::D_WARNING); + DEBUG->print("Modification::addPolylineNode: no valid container", + Debug::D_WARNING); return NULL; } if (segment.getParent()!=&polyline) { - RS_DEBUG->print("RS_Modification::addPolylineNode: " + DEBUG->print("Modification::addPolylineNode: " "segment not part of the polyline", - RS_Debug::D_WARNING); + Debug::D_WARNING); return NULL; } - RS_Polyline* newPolyline = new RS_Polyline(container); + Polyline* newPolyline = new Polyline(container); newPolyline->setClosed(polyline.isClosed()); newPolyline->setSelected(polyline.isSelected()); newPolyline->setLayer(polyline.getLayer()); @@ -664,23 +664,23 @@ RS_Polyline* RS_Modification::addPolylineNode(RS_Polyline& polyline, // copy polyline and add new node: bool first = true; - RS_Entity* lastEntity = polyline.lastEntity(); - for (RS_Entity* e=polyline.firstEntity(); e!=NULL; + Entity* lastEntity = polyline.lastEntity(); + for (Entity* e=polyline.firstEntity(); e!=NULL; e=polyline.nextEntity()) { if (e->isAtomic()) { - RS_AtomicEntity* ae = (RS_AtomicEntity*)e; + AtomicEntity* ae = (AtomicEntity*)e; double bulge = 0.0; if (ae->rtti()==RS2::EntityArc) { - RS_DEBUG->print("RS_Modification::addPolylineNode: arc segment"); - bulge = ((RS_Arc*)ae)->getBulge(); + DEBUG->print("Modification::addPolylineNode: arc segment"); + bulge = ((Arc*)ae)->getBulge(); } else { - RS_DEBUG->print("RS_Modification::addPolylineNode: line segment"); + DEBUG->print("Modification::addPolylineNode: line segment"); bulge = 0.0; } if (first) { - RS_DEBUG->print("RS_Modification::addPolylineNode: first segment: %f/%f", + DEBUG->print("Modification::addPolylineNode: first segment: %f/%f", ae->getStartpoint().x, ae->getStartpoint().y); newPolyline->setNextBulge(bulge); @@ -690,15 +690,15 @@ RS_Polyline* RS_Modification::addPolylineNode(RS_Polyline& polyline, // segment to split: if (ae==&segment) { - RS_DEBUG->print("RS_Modification::addPolylineNode: split segment found"); + DEBUG->print("Modification::addPolylineNode: split segment found"); - RS_DEBUG->print("RS_Modification::addPolylineNode: node: %f/%f", + DEBUG->print("Modification::addPolylineNode: node: %f/%f", node.x, node.y); newPolyline->setNextBulge(0.0); newPolyline->addVertex(node); - RS_DEBUG->print("RS_Modification::addPolylineNode: after node: %f/%f", + DEBUG->print("Modification::addPolylineNode: after node: %f/%f", ae->getEndpoint().x, ae->getEndpoint().y); if (ae!=lastEntity || polyline.isClosed()==false) { @@ -706,7 +706,7 @@ RS_Polyline* RS_Modification::addPolylineNode(RS_Polyline& polyline, newPolyline->addVertex(ae->getEndpoint()); } } else { - RS_DEBUG->print("RS_Modification::addPolylineNode: normal vertex found: %f/%f", + DEBUG->print("Modification::addPolylineNode: normal vertex found: %f/%f", ae->getEndpoint().x, ae->getEndpoint().y); if (ae!=lastEntity || polyline.isClosed()==false) { @@ -715,9 +715,9 @@ RS_Polyline* RS_Modification::addPolylineNode(RS_Polyline& polyline, } } } else { - RS_DEBUG->print("RS_Modification::addPolylineNode: " + DEBUG->print("Modification::addPolylineNode: " "Polyline contains non-atomic entities", - RS_Debug::D_WARNING); + Debug::D_WARNING); } } @@ -755,29 +755,29 @@ RS_Polyline* RS_Modification::addPolylineNode(RS_Polyline& polyline, * @return Pointer to the new polyline or NULL. */ /* -RS_Polyline* RS_Modification::deletePolylineNode(RS_Polyline& polyline, +Polyline* Modification::deletePolylineNode(Polyline& polyline, const Vector& node) { - RS_DEBUG->print("RS_Modification::deletePolylineNode"); + DEBUG->print("Modification::deletePolylineNode"); if (container==NULL) { - RS_DEBUG->print("RS_Modification::addPolylineNode: no valid container", - RS_Debug::D_WARNING); + DEBUG->print("Modification::addPolylineNode: no valid container", + Debug::D_WARNING); return NULL; } if (node.valid==false) { - RS_DEBUG->print("RS_Modification::deletePolylineNode: " + DEBUG->print("Modification::deletePolylineNode: " "node not valid", - RS_Debug::D_WARNING); + Debug::D_WARNING); return NULL; } // check if the polyline is no longer there after deleting the node: if (polyline.count()==1) { - RS_Entity* e = polyline.firstEntity(); + Entity* e = polyline.firstEntity(); if (e!=NULL && e->isAtomic()) { - RS_AtomicEntity* ae = (RS_AtomicEntity*)e; + AtomicEntity* ae = (AtomicEntity*)e; if (node.distanceTo(ae->getStartpoint())<1.0e-6 || node.distanceTo(ae->getEndpoint())<1.0e-6) { @@ -796,7 +796,7 @@ RS_Polyline* RS_Modification::deletePolylineNode(RS_Polyline& polyline, return NULL; } - RS_Polyline* newPolyline = new RS_Polyline(container); + Polyline* newPolyline = new Polyline(container); newPolyline->setClosed(polyline.isClosed()); newPolyline->setSelected(polyline.isSelected()); newPolyline->setLayer(polyline.getLayer()); @@ -805,18 +805,18 @@ RS_Polyline* RS_Modification::deletePolylineNode(RS_Polyline& polyline, // copy polyline and drop deleted node: bool first = true; bool lastDropped = false; - RS_Entity* lastEntity = polyline.lastEntity(); - for (RS_Entity* e=polyline.firstEntity(); e!=NULL; + Entity* lastEntity = polyline.lastEntity(); + for (Entity* e=polyline.firstEntity(); e!=NULL; e=polyline.nextEntity()) { if (e->isAtomic()) { - RS_AtomicEntity* ae = (RS_AtomicEntity*)e; + AtomicEntity* ae = (AtomicEntity*)e; double bulge = 0.0; if (ae->rtti()==RS2::EntityArc) { - RS_DEBUG->print("RS_Modification::deletePolylineNode: arc segment"); - bulge = ((RS_Arc*)ae)->getBulge(); + DEBUG->print("Modification::deletePolylineNode: arc segment"); + bulge = ((Arc*)ae)->getBulge(); } else { - RS_DEBUG->print("RS_Modification::deletePolylineNode: line segment"); + DEBUG->print("Modification::deletePolylineNode: line segment"); bulge = 0.0; } @@ -827,7 +827,7 @@ RS_Polyline* RS_Modification::deletePolylineNode(RS_Polyline& polyline, // first vertex (startpoint) if (first && node.distanceTo(ae->getStartpoint())>1.0e-6) { - RS_DEBUG->print("RS_Modification::deletePolylineNode: first node: %f/%f", + DEBUG->print("Modification::deletePolylineNode: first node: %f/%f", ae->getStartpoint().x, ae->getStartpoint().y); newPolyline->setNextBulge(bulge); @@ -837,7 +837,7 @@ RS_Polyline* RS_Modification::deletePolylineNode(RS_Polyline& polyline, // normal node (not deleted): if (first==false && node.distanceTo(ae->getEndpoint())>1.0e-6) { - RS_DEBUG->print("RS_Modification::deletePolylineNode: normal vertex found: %f/%f", + DEBUG->print("Modification::deletePolylineNode: normal vertex found: %f/%f", ae->getEndpoint().x, ae->getEndpoint().y); if (lastDropped) { //bulge = 0.0; @@ -849,18 +849,18 @@ RS_Polyline* RS_Modification::deletePolylineNode(RS_Polyline& polyline, // drop deleted node: else { - RS_DEBUG->print("RS_Modification::deletePolylineNode: deleting vertex: %f/%f", + DEBUG->print("Modification::deletePolylineNode: deleting vertex: %f/%f", ae->getEndpoint().x, ae->getEndpoint().y); lastDropped = true; } } else { - RS_DEBUG->print("RS_Modification::deletePolylineNode: " + DEBUG->print("Modification::deletePolylineNode: " "Polyline contains non-atomic entities", - RS_Debug::D_WARNING); + Debug::D_WARNING); } } - RS_DEBUG->print("RS_Modification::deletePolylineNode: ending polyline"); + DEBUG->print("Modification::deletePolylineNode: ending polyline"); newPolyline->setNextBulge(polyline.getClosingBulge()); newPolyline->endPolyline(); @@ -868,14 +868,14 @@ RS_Polyline* RS_Modification::deletePolylineNode(RS_Polyline& polyline, //} // add new polyline: - RS_DEBUG->print("RS_Modification::deletePolylineNode: adding new polyline"); + DEBUG->print("Modification::deletePolylineNode: adding new polyline"); container->addEntity(newPolyline); if (graphicView!=NULL) { graphicView->deleteEntity(&polyline); graphicView->drawEntity(newPolyline); } - RS_DEBUG->print("RS_Modification::deletePolylineNode: handling undo"); + DEBUG->print("Modification::deletePolylineNode: handling undo"); if (document!=NULL && handleUndo) { document->startUndoCycle(); @@ -901,46 +901,46 @@ RS_Polyline* RS_Modification::deletePolylineNode(RS_Polyline& polyline, * @return Pointer to the new polyline or NULL. */ /* -RS_Polyline* RS_Modification::deletePolylineNodesBetween(RS_Polyline& polyline, - RS_AtomicEntity& segment, const Vector& node1, const Vector& node2) { +Polyline* Modification::deletePolylineNodesBetween(Polyline& polyline, + AtomicEntity& segment, const Vector& node1, const Vector& node2) { - RS_DEBUG->print("RS_Modification::deletePolylineNodesBetween"); + DEBUG->print("Modification::deletePolylineNodesBetween"); if (container==NULL) { - RS_DEBUG->print("RS_Modification::addPolylineNodesBetween: no valid container", - RS_Debug::D_WARNING); + DEBUG->print("Modification::addPolylineNodesBetween: no valid container", + Debug::D_WARNING); return NULL; } if (node1.valid==false || node2.valid==false) { - RS_DEBUG->print("RS_Modification::deletePolylineNodesBetween: " + DEBUG->print("Modification::deletePolylineNodesBetween: " "node not valid", - RS_Debug::D_WARNING); + Debug::D_WARNING); return NULL; } if (node1.distanceTo(node2)<1.0e-6) { - RS_DEBUG->print("RS_Modification::deletePolylineNodesBetween: " + DEBUG->print("Modification::deletePolylineNodesBetween: " "nodes are identical", - RS_Debug::D_WARNING); + Debug::D_WARNING); return NULL; } // check if there's nothing to delete: - for (RS_Entity* e=polyline.firstEntity(); e!=NULL; + for (Entity* e=polyline.firstEntity(); e!=NULL; e=polyline.nextEntity()) { if (e->isAtomic()) { - RS_AtomicEntity* ae = (RS_AtomicEntity*)e; + AtomicEntity* ae = (AtomicEntity*)e; if ((node1.distanceTo(ae->getStartpoint())<1.0e-6 && node2.distanceTo(ae->getEndpoint())<1.0e-6) || (node2.distanceTo(ae->getStartpoint())<1.0e-6 && node1.distanceTo(ae->getEndpoint())<1.0e-6)) { - RS_DEBUG->print("RS_Modification::deletePolylineNodesBetween: " + DEBUG->print("Modification::deletePolylineNodesBetween: " "nothing to delete", - RS_Debug::D_WARNING); + Debug::D_WARNING); return NULL; } } @@ -961,11 +961,11 @@ RS_Polyline* RS_Modification::deletePolylineNodesBetween(RS_Polyline& polyline, bool found = false; double length1 = 0.0; double length2 = 0.0; - RS_Entity* e=polyline.firstEntity(); + Entity* e=polyline.firstEntity(); if (startpointInvolved) { if (e->isAtomic()) { - RS_AtomicEntity* ae = (RS_AtomicEntity*)e; + AtomicEntity* ae = (AtomicEntity*)e; length1+=ae->getLength(); } e = polyline.nextEntity(); @@ -973,7 +973,7 @@ RS_Polyline* RS_Modification::deletePolylineNodesBetween(RS_Polyline& polyline, for (; e!=NULL; e=polyline.nextEntity()) { if (e->isAtomic()) { - RS_AtomicEntity* ae = (RS_AtomicEntity*)e; + AtomicEntity* ae = (AtomicEntity*)e; if (node1.distanceTo(ae->getStartpoint())<1.0e-6 || node2.distanceTo(ae->getStartpoint())<1.0e-6) { @@ -995,7 +995,7 @@ RS_Polyline* RS_Modification::deletePolylineNodesBetween(RS_Polyline& polyline, } } - RS_Polyline* newPolyline = new RS_Polyline(container); + Polyline* newPolyline = new Polyline(container); newPolyline->setClosed(polyline.isClosed()); newPolyline->setSelected(polyline.isSelected()); newPolyline->setLayer(polyline.getLayer()); @@ -1011,28 +1011,28 @@ RS_Polyline* RS_Modification::deletePolylineNodesBetween(RS_Polyline& polyline, bool removing = deleteStart; bool done = false; bool nextIsStraight = false; - RS_Entity* lastEntity = polyline.lastEntity(); + Entity* lastEntity = polyline.lastEntity(); int i=0; double bulge = 0.0; - for (RS_Entity* e=polyline.firstEntity(); e!=NULL; + for (Entity* e=polyline.firstEntity(); e!=NULL; e=polyline.nextEntity()) { - RS_DEBUG->print("RS_Modification::deletePolylineNodesBetween: entity: %d", i++); - RS_DEBUG->print("RS_Modification::deletePolylineNodesBetween: removing: %d", (int)removing); + DEBUG->print("Modification::deletePolylineNodesBetween: entity: %d", i++); + DEBUG->print("Modification::deletePolylineNodesBetween: removing: %d", (int)removing); if (e->isAtomic()) { - RS_AtomicEntity* ae = (RS_AtomicEntity*)e; + AtomicEntity* ae = (AtomicEntity*)e; if (ae->rtti()==RS2::EntityArc) { - RS_DEBUG->print("RS_Modification::deletePolylineNodesBetween: arc segment"); - bulge = ((RS_Arc*)ae)->getBulge(); + DEBUG->print("Modification::deletePolylineNodesBetween: arc segment"); + bulge = ((Arc*)ae)->getBulge(); } else { - RS_DEBUG->print("RS_Modification::deletePolylineNodesBetween: line segment"); + DEBUG->print("Modification::deletePolylineNodesBetween: line segment"); bulge = 0.0; } // last entity is closing entity and will be added below with endPolyline() if (e==lastEntity && polyline.isClosed()) { - RS_DEBUG->print("RS_Modification::deletePolylineNodesBetween: " + DEBUG->print("Modification::deletePolylineNodesBetween: " "dropping last vertex of closed polyline"); continue; } @@ -1040,7 +1040,7 @@ RS_Polyline* RS_Modification::deletePolylineNodesBetween(RS_Polyline& polyline, // first vertex (startpoint) if (first) { if (!removing) { - RS_DEBUG->print("RS_Modification::deletePolylineNodesBetween: first node: %f/%f", + DEBUG->print("Modification::deletePolylineNodesBetween: first node: %f/%f", ae->getStartpoint().x, ae->getStartpoint().y); newPolyline->setNextBulge(bulge); newPolyline->addVertex(ae->getStartpoint()); @@ -1052,7 +1052,7 @@ RS_Polyline* RS_Modification::deletePolylineNodesBetween(RS_Polyline& polyline, if (removing==true && (node1.distanceTo(ae->getEndpoint())<1.0e-6 || node2.distanceTo(ae->getEndpoint())<1.0e-6)) { - RS_DEBUG->print("RS_Modification::deletePolylineNodesBetween: " + DEBUG->print("Modification::deletePolylineNodesBetween: " "stop removing at: %f/%f", ae->getEndpoint().x, ae->getEndpoint().y); removing = false; @@ -1064,7 +1064,7 @@ RS_Polyline* RS_Modification::deletePolylineNodesBetween(RS_Polyline& polyline, // normal node (not deleted): if (removing==false && (done==false || deleteStart==false)) { - RS_DEBUG->print("RS_Modification::deletePolylineNodesBetween: " + DEBUG->print("Modification::deletePolylineNodesBetween: " "normal vertex found: %f/%f", ae->getEndpoint().x, ae->getEndpoint().y); if (nextIsStraight) { @@ -1077,7 +1077,7 @@ RS_Polyline* RS_Modification::deletePolylineNodesBetween(RS_Polyline& polyline, // drop deleted node: else { - RS_DEBUG->print("RS_Modification::deletePolylineNodesBetween: " + DEBUG->print("Modification::deletePolylineNodesBetween: " "deleting vertex: %f/%f", ae->getEndpoint().x, ae->getEndpoint().y); } @@ -1086,7 +1086,7 @@ RS_Polyline* RS_Modification::deletePolylineNodesBetween(RS_Polyline& polyline, if (done==false && removing==false && (node1.distanceTo(ae->getEndpoint())<1.0e-6 || node2.distanceTo(ae->getEndpoint())<1.0e-6)) { - RS_DEBUG->print("RS_Modification::deletePolylineNodesBetween: " + DEBUG->print("Modification::deletePolylineNodesBetween: " "start removing at: %f/%f", ae->getEndpoint().x, ae->getEndpoint().y); removing = true; @@ -1096,25 +1096,25 @@ RS_Polyline* RS_Modification::deletePolylineNodesBetween(RS_Polyline& polyline, done=false; } } else { - RS_DEBUG->print("RS_Modification::deletePolylineNodesBetween: " + DEBUG->print("Modification::deletePolylineNodesBetween: " "Polyline contains non-atomic entities", - RS_Debug::D_WARNING); + Debug::D_WARNING); } } - RS_DEBUG->print("RS_Modification::deletePolylineNodesBetween: ending polyline"); + DEBUG->print("Modification::deletePolylineNodesBetween: ending polyline"); newPolyline->setNextBulge(polyline.getClosingBulge()); newPolyline->endPolyline(); // add new polyline: - RS_DEBUG->print("RS_Modification::deletePolylineNodesBetween: adding new polyline"); + DEBUG->print("Modification::deletePolylineNodesBetween: adding new polyline"); container->addEntity(newPolyline); if (graphicView!=NULL) { graphicView->deleteEntity(&polyline); graphicView->drawEntity(newPolyline); } - RS_DEBUG->print("RS_Modification::deletePolylineNodesBetween: handling undo"); + DEBUG->print("Modification::deletePolylineNodesBetween: handling undo"); if (document!=NULL && handleUndo) { document->startUndoCycle(); @@ -1142,44 +1142,44 @@ RS_Polyline* RS_Modification::deletePolylineNodesBetween(RS_Polyline& polyline, * @return Pointer to the new polyline or NULL. */ /* -RS_Polyline* RS_Modification::polylineTrim(RS_Polyline& polyline, - RS_AtomicEntity& segment1, - RS_AtomicEntity& segment2) { +Polyline* Modification::polylineTrim(Polyline& polyline, + AtomicEntity& segment1, + AtomicEntity& segment2) { - RS_DEBUG->print("RS_Modification::polylineTrim"); + DEBUG->print("Modification::polylineTrim"); if (container==NULL) { - RS_DEBUG->print("RS_Modification::addPolylineNodesBetween: no valid container", - RS_Debug::D_WARNING); + DEBUG->print("Modification::addPolylineNodesBetween: no valid container", + Debug::D_WARNING); return NULL; } if (segment1.getParent()!=&polyline || segment2.getParent()!=&polyline) { - RS_DEBUG->print("RS_Modification::polylineTrim: " + DEBUG->print("Modification::polylineTrim: " "segments not in polyline", - RS_Debug::D_WARNING); + Debug::D_WARNING); return NULL; } if (&segment1==&segment2) { - RS_DEBUG->print("RS_Modification::polylineTrim: " + DEBUG->print("Modification::polylineTrim: " "segments are identical", - RS_Debug::D_WARNING); + Debug::D_WARNING); return NULL; } VectorSolutions sol; - sol = RS_Information::getIntersection(&segment1, &segment2, false); + sol = Information::getIntersection(&segment1, &segment2, false); if (sol.getNumber()==0) { - RS_DEBUG->print("RS_Modification::polylineTrim: " + DEBUG->print("Modification::polylineTrim: " "segments cannot be trimmed", - RS_Debug::D_WARNING); + Debug::D_WARNING); return NULL; } // check which segment comes first in the polyline: - RS_AtomicEntity* firstSegment; + AtomicEntity* firstSegment; if (polyline.findEntity(&segment1) > polyline.findEntity(&segment2)) { firstSegment = &segment2; } else { @@ -1188,12 +1188,12 @@ RS_Polyline* RS_Modification::polylineTrim(RS_Polyline& polyline, // find out if we need to trim towards the open part of the polyline bool reverseTrim; - reverseTrim = !RS_Math::isSameDirection(firstSegment->getDirection1(), + reverseTrim = !Math::isSameDirection(firstSegment->getDirection1(), firstSegment->getStartpoint().angleTo(sol.get(0)), M_PI/2.0); - //reverseTrim = reverseTrim || !RS_Math::isSameDirection(segment2.getDirection1(), + //reverseTrim = reverseTrim || !Math::isSameDirection(segment2.getDirection1(), // segment2.getStartpoint().angleTo(sol.get(0)), M_PI/2.0); - RS_Polyline* newPolyline = new RS_Polyline(container); + Polyline* newPolyline = new Polyline(container); newPolyline->setClosed(polyline.isClosed()); newPolyline->setSelected(polyline.isSelected()); newPolyline->setLayer(polyline.getLayer()); @@ -1205,31 +1205,31 @@ RS_Polyline* RS_Modification::polylineTrim(RS_Polyline& polyline, bool first = true; bool removing = false; bool nextIsStraight = false; - RS_Entity* lastEntity = polyline.lastEntity(); - for (RS_Entity* e=polyline.firstEntity(); e!=NULL; + Entity* lastEntity = polyline.lastEntity(); + for (Entity* e=polyline.firstEntity(); e!=NULL; e=polyline.nextEntity()) { if (e->isAtomic()) { - RS_AtomicEntity* ae = (RS_AtomicEntity*)e; + AtomicEntity* ae = (AtomicEntity*)e; double bulge = 0.0; if (ae->rtti()==RS2::EntityArc) { - RS_DEBUG->print("RS_Modification::polylineTrim: arc segment"); - bulge = ((RS_Arc*)ae)->getBulge(); + DEBUG->print("Modification::polylineTrim: arc segment"); + bulge = ((Arc*)ae)->getBulge(); } else { - RS_DEBUG->print("RS_Modification::polylineTrim: line segment"); + DEBUG->print("Modification::polylineTrim: line segment"); bulge = 0.0; } // last entity is closing entity and will be added below with endPolyline() if (e==lastEntity && polyline.isClosed()) { - RS_DEBUG->print("RS_Modification::polylineTrim: " + DEBUG->print("Modification::polylineTrim: " "dropping last vertex of closed polyline"); continue; } // first vertex (startpoint) if (first) { - RS_DEBUG->print("RS_Modification::polylineTrim: first node: %f/%f", + DEBUG->print("Modification::polylineTrim: first node: %f/%f", ae->getStartpoint().x, ae->getStartpoint().y); newPolyline->setNextBulge(bulge); @@ -1239,7 +1239,7 @@ RS_Polyline* RS_Modification::polylineTrim(RS_Polyline& polyline, // trim and start removing nodes: if (removing==false && (ae==&segment1 || ae==&segment2)) { - RS_DEBUG->print("RS_Modification::polylineTrim: " + DEBUG->print("Modification::polylineTrim: " "start removing at trim point %f/%f", sol.get(0).x, sol.get(0).y); newPolyline->setNextBulge(0.0); @@ -1250,14 +1250,14 @@ RS_Polyline* RS_Modification::polylineTrim(RS_Polyline& polyline, // stop removing nodes: else if (removing==true && (ae==&segment1 || ae==&segment2)) { - RS_DEBUG->print("RS_Modification::polylineTrim: stop removing at: %f/%f", + DEBUG->print("Modification::polylineTrim: stop removing at: %f/%f", ae->getEndpoint().x, ae->getEndpoint().y); removing = false; } // normal node (not deleted): if (removing==false) { - RS_DEBUG->print("RS_Modification::polylineTrim: normal vertex found: %f/%f", + DEBUG->print("Modification::polylineTrim: normal vertex found: %f/%f", ae->getEndpoint().x, ae->getEndpoint().y); if (nextIsStraight) { newPolyline->setNextBulge(0.0); @@ -1268,9 +1268,9 @@ RS_Polyline* RS_Modification::polylineTrim(RS_Polyline& polyline, newPolyline->addVertex(ae->getEndpoint()); } } else { - RS_DEBUG->print("RS_Modification::polylineTrim: " + DEBUG->print("Modification::polylineTrim: " "Polyline contains non-atomic entities", - RS_Debug::D_WARNING); + Debug::D_WARNING); } } } @@ -1281,31 +1281,31 @@ RS_Polyline* RS_Modification::polylineTrim(RS_Polyline& polyline, //bool first = true; bool removing = true; bool nextIsStraight = false; - RS_Entity* lastEntity = polyline.lastEntity(); - for (RS_Entity* e=polyline.firstEntity(); e!=NULL; + Entity* lastEntity = polyline.lastEntity(); + for (Entity* e=polyline.firstEntity(); e!=NULL; e=polyline.nextEntity()) { if (e->isAtomic()) { - RS_AtomicEntity* ae = (RS_AtomicEntity*)e; + AtomicEntity* ae = (AtomicEntity*)e; double bulge = 0.0; if (ae->rtti()==RS2::EntityArc) { - RS_DEBUG->print("RS_Modification::polylineTrim: arc segment"); - bulge = ((RS_Arc*)ae)->getBulge(); + DEBUG->print("Modification::polylineTrim: arc segment"); + bulge = ((Arc*)ae)->getBulge(); } else { - RS_DEBUG->print("RS_Modification::polylineTrim: line segment"); + DEBUG->print("Modification::polylineTrim: line segment"); bulge = 0.0; } // last entity is closing entity and will be added below with endPolyline() if (e==lastEntity && polyline.isClosed()) { - RS_DEBUG->print("RS_Modification::polylineTrim: " + DEBUG->print("Modification::polylineTrim: " "dropping last vertex of closed polyline"); continue; } // trim and stop removing nodes: if (removing==true && (ae==&segment1 || ae==&segment2)) { - RS_DEBUG->print("RS_Modification::polylineTrim: " + DEBUG->print("Modification::polylineTrim: " "stop removing at trim point %f/%f", sol.get(0).x, sol.get(0).y); newPolyline->setNextBulge(0.0); @@ -1317,7 +1317,7 @@ RS_Polyline* RS_Modification::polylineTrim(RS_Polyline& polyline, // start removing nodes again: else if (removing==false && (ae==&segment1 || ae==&segment2)) { - RS_DEBUG->print("RS_Modification::polylineTrim: start removing at: %f/%f", + DEBUG->print("Modification::polylineTrim: start removing at: %f/%f", ae->getEndpoint().x, ae->getEndpoint().y); newPolyline->setNextBulge(0.0); // start of new polyline: @@ -1327,7 +1327,7 @@ RS_Polyline* RS_Modification::polylineTrim(RS_Polyline& polyline, // normal node (not deleted): if (removing==false) { - RS_DEBUG->print("RS_Modification::polylineTrim: normal vertex found: %f/%f", + DEBUG->print("Modification::polylineTrim: normal vertex found: %f/%f", ae->getEndpoint().x, ae->getEndpoint().y); if (nextIsStraight) { newPolyline->setNextBulge(0.0); @@ -1338,26 +1338,26 @@ RS_Polyline* RS_Modification::polylineTrim(RS_Polyline& polyline, newPolyline->addVertex(ae->getEndpoint()); } } else { - RS_DEBUG->print("RS_Modification::polylineTrim: " + DEBUG->print("Modification::polylineTrim: " "Polyline contains non-atomic entities", - RS_Debug::D_WARNING); + Debug::D_WARNING); } } } - RS_DEBUG->print("RS_Modification::polylineTrim: ending polyline"); + DEBUG->print("Modification::polylineTrim: ending polyline"); newPolyline->setNextBulge(polyline.getClosingBulge()); newPolyline->endPolyline(); // add new polyline: - RS_DEBUG->print("RS_Modification::polylineTrim: adding new polyline"); + DEBUG->print("Modification::polylineTrim: adding new polyline"); container->addEntity(newPolyline); if (graphicView!=NULL) { graphicView->deleteEntity(&polyline); graphicView->drawEntity(newPolyline); } - RS_DEBUG->print("RS_Modification::polylineTrim: handling undo"); + DEBUG->print("Modification::polylineTrim: handling undo"); if (document!=NULL && handleUndo) { document->startUndoCycle(); @@ -1376,17 +1376,17 @@ RS_Polyline* RS_Modification::polylineTrim(RS_Polyline& polyline, * Moves all selected entities with the given data for the move * modification. */ -bool RS_Modification::move(RS_MoveData & data) +bool Modification::move(MoveData & data) { if (container == NULL) { - RS_DEBUG->print("RS_Modification::move: no valid container", RS_Debug::D_WARNING); + DEBUG->print("Modification::move: no valid container", Debug::D_WARNING); return false; } -// Q3PtrList addList; +// Q3PtrList addList; // addList.setAutoDelete(false); - QList addList; + QList addList; if (document != NULL && handleUndo) document->startUndoCycle(); @@ -1396,12 +1396,12 @@ bool RS_Modification::move(RS_MoveData & data) { // too slow: //for (uint i=0; icount(); ++i) { - //RS_Entity* e = container->entityAt(i); - for(RS_Entity* e=container->firstEntity(); e!=NULL; e=container->nextEntity()) + //Entity* e = container->entityAt(i); + for(Entity* e=container->firstEntity(); e!=NULL; e=container->nextEntity()) { if (e != NULL && e->isSelected()) { - RS_Entity * ec = e->clone(); + Entity * ec = e->clone(); ec->move(data.offset * num); if (data.useCurrentLayer) @@ -1411,7 +1411,7 @@ bool RS_Modification::move(RS_MoveData & data) ec->setPenToActive(); if (ec->rtti() == RS2::EntityInsert) - ((RS_Insert *)ec)->update(); + ((Insert *)ec)->update(); // since 2.0.4.0: keep selection ec->setSelected(true); @@ -1435,18 +1435,18 @@ bool RS_Modification::move(RS_MoveData & data) /** * Rotates all selected entities with the given data for the rotation. */ -bool RS_Modification::rotate(RS_RotateData & data) +bool Modification::rotate(RotateData & data) { if (container == NULL) { - RS_DEBUG->print("RS_Modification::rotate: no valid container", - RS_Debug::D_WARNING); + DEBUG->print("Modification::rotate: no valid container", + Debug::D_WARNING); return false; } -// Q3PtrList addList; +// Q3PtrList addList; // addList.setAutoDelete(false); - QList addList; + QList addList; if (document!=NULL && handleUndo) document->startUndoCycle(); @@ -1454,14 +1454,14 @@ bool RS_Modification::rotate(RS_RotateData & data) // Create new entites for(int num=1; num<=data.number || (data.number==0 && num<=1); num++) { - for (RS_Entity * e=container->firstEntity(); e!=NULL; e=container->nextEntity()) + for (Entity * e=container->firstEntity(); e!=NULL; e=container->nextEntity()) { //for (uint i=0; icount(); ++i) { - //RS_Entity* e = container->entityAt(i); + //Entity* e = container->entityAt(i); if (e != NULL && e->isSelected()) { - RS_Entity * ec = e->clone(); + Entity * ec = e->clone(); ec->setSelected(false); ec->rotate(data.center, data.angle*num); @@ -1472,7 +1472,7 @@ bool RS_Modification::rotate(RS_RotateData & data) ec->setPenToActive(); if (ec->rtti() == RS2::EntityInsert) - ((RS_Insert *)ec)->update(); + ((Insert *)ec)->update(); addList.append(ec); } @@ -1495,17 +1495,17 @@ bool RS_Modification::rotate(RS_RotateData & data) * Moves all selected entities with the given data for the scale * modification. */ -bool RS_Modification::scale(RS_ScaleData & data) +bool Modification::scale(ScaleData & data) { if (container == NULL) { - RS_DEBUG->print("RS_Modification::scale: no valid container", RS_Debug::D_WARNING); + DEBUG->print("Modification::scale: no valid container", Debug::D_WARNING); return false; } -// Q3PtrList addList; +// Q3PtrList addList; // addList.setAutoDelete(false); - QList addList; + QList addList; if (document!=NULL && handleUndo) document->startUndoCycle(); @@ -1513,15 +1513,15 @@ bool RS_Modification::scale(RS_ScaleData & data) // Create new entites for(int num=1; num<=data.number || (data.number==0 && num<=1); num++) { - for(RS_Entity* e=container->firstEntity(); e!=NULL; e=container->nextEntity()) + for(Entity* e=container->firstEntity(); e!=NULL; e=container->nextEntity()) { //for (uint i=0; icount(); ++i) { - //RS_Entity* e = container->entityAt(i); + //Entity* e = container->entityAt(i); if (e != NULL && e->isSelected()) { - RS_Entity * ec = e->clone(); + Entity * ec = e->clone(); ec->setSelected(false); - ec->scale(data.referencePoint, RS_Math::pow(data.factor, num)); + ec->scale(data.referencePoint, Math::pow(data.factor, num)); if (data.useCurrentLayer) ec->setLayerToActive(); @@ -1530,7 +1530,7 @@ bool RS_Modification::scale(RS_ScaleData & data) ec->setPenToActive(); if (ec->rtti()==RS2::EntityInsert) - ((RS_Insert*)ec)->update(); + ((Insert*)ec)->update(); addList.append(ec); } @@ -1553,17 +1553,17 @@ bool RS_Modification::scale(RS_ScaleData & data) * Mirror all selected entities with the given data for the mirror * modification. */ -bool RS_Modification::mirror(RS_MirrorData & data) +bool Modification::mirror(MirrorData & data) { if (container==NULL) { - RS_DEBUG->print("RS_Modification::mirror: no valid container", - RS_Debug::D_WARNING); + DEBUG->print("Modification::mirror: no valid container", + Debug::D_WARNING); return false; } -// Q3PtrList addList; +// Q3PtrList addList; // addList.setAutoDelete(false); - QList addList; + QList addList; if (document!=NULL && handleUndo) { document->startUndoCycle(); @@ -1573,14 +1573,14 @@ bool RS_Modification::mirror(RS_MirrorData & data) for (int num=1; num<=(int)data.copy || (data.copy==false && num<=1); num++) { - for (RS_Entity* e=container->firstEntity(); + for (Entity* e=container->firstEntity(); e!=NULL; e=container->nextEntity()) { //for (uint i=0; icount(); ++i) { - //RS_Entity* e = container->entityAt(i); + //Entity* e = container->entityAt(i); if (e!=NULL && e->isSelected()) { - RS_Entity* ec = e->clone(); + Entity* ec = e->clone(); ec->setSelected(false); ec->mirror(data.axisPoint1, data.axisPoint2); @@ -1591,7 +1591,7 @@ bool RS_Modification::mirror(RS_MirrorData & data) ec->setPenToActive(); } if (ec->rtti()==RS2::EntityInsert) { - ((RS_Insert*)ec)->update(); + ((Insert*)ec)->update(); } addList.append(ec); } @@ -1614,17 +1614,17 @@ bool RS_Modification::mirror(RS_MirrorData & data) /** * Rotates entities around two centers with the given parameters. */ -bool RS_Modification::rotate2(RS_Rotate2Data & data) +bool Modification::rotate2(Rotate2Data & data) { if (container==NULL) { - RS_DEBUG->print("RS_Modification::rotate2: no valid container", - RS_Debug::D_WARNING); + DEBUG->print("Modification::rotate2: no valid container", + Debug::D_WARNING); return false; } -// Q3PtrList addList; +// Q3PtrList addList; // addList.setAutoDelete(false); - QList addList; + QList addList; if (document!=NULL && handleUndo) { document->startUndoCycle(); @@ -1635,14 +1635,14 @@ bool RS_Modification::rotate2(RS_Rotate2Data & data) num<=data.number || (data.number==0 && num<=1); num++) { - for (RS_Entity* e=container->firstEntity(); + for (Entity* e=container->firstEntity(); e!=NULL; e=container->nextEntity()) { //for (uint i=0; icount(); ++i) { - //RS_Entity* e = container->entityAt(i); + //Entity* e = container->entityAt(i); if (e!=NULL && e->isSelected()) { - RS_Entity* ec = e->clone(); + Entity* ec = e->clone(); ec->setSelected(false); ec->rotate(data.center1, data.angle1*num); @@ -1657,7 +1657,7 @@ bool RS_Modification::rotate2(RS_Rotate2Data & data) ec->setPenToActive(); } if (ec->rtti()==RS2::EntityInsert) { - ((RS_Insert*)ec)->update(); + ((Insert*)ec)->update(); } addList.append(ec); } @@ -1680,17 +1680,17 @@ bool RS_Modification::rotate2(RS_Rotate2Data & data) /** * Moves and rotates entities with the given parameters. */ -bool RS_Modification::moveRotate(RS_MoveRotateData & data) +bool Modification::moveRotate(MoveRotateData & data) { if (container==NULL) { - RS_DEBUG->print("RS_Modification::moveRotate: no valid container", - RS_Debug::D_WARNING); + DEBUG->print("Modification::moveRotate: no valid container", + Debug::D_WARNING); return false; } -// Q3PtrList addList; +// Q3PtrList addList; // addList.setAutoDelete(false); - QList addList; + QList addList; if (document!=NULL && handleUndo) { document->startUndoCycle(); @@ -1700,14 +1700,14 @@ bool RS_Modification::moveRotate(RS_MoveRotateData & data) for (int num=1; num<=data.number || (data.number==0 && num<=1); num++) { - for (RS_Entity* e=container->firstEntity(); + for (Entity* e=container->firstEntity(); e!=NULL; e=container->nextEntity()) { //for (uint i=0; icount(); ++i) { - //RS_Entity* e = container->entityAt(i); + //Entity* e = container->entityAt(i); if (e!=NULL && e->isSelected()) { - RS_Entity* ec = e->clone(); + Entity* ec = e->clone(); ec->setSelected(false); ec->move(data.offset*num); @@ -1720,7 +1720,7 @@ bool RS_Modification::moveRotate(RS_MoveRotateData & data) ec->setPenToActive(); } if (ec->rtti()==RS2::EntityInsert) { - ((RS_Insert*)ec)->update(); + ((Insert*)ec)->update(); } addList.append(ec); } @@ -1745,19 +1745,19 @@ bool RS_Modification::moveRotate(RS_MoveRotateData & data) * * @param remove true: Remove entites. */ -void RS_Modification::deselectOriginals(bool remove) +void Modification::deselectOriginals(bool remove) { - for(RS_Entity* e=container->firstEntity(); e!=NULL; e=container->nextEntity()) + for(Entity* e=container->firstEntity(); e!=NULL; e=container->nextEntity()) { //for (uint i=0; icount(); ++i) { - //RS_Entity* e = container->entityAt(i); + //Entity* e = container->entityAt(i); if (e != NULL) { bool selected = false; /* if (e->isAtomic()) { - RS_AtomicEntity* ae = (RS_AtomicEntity*)e; + AtomicEntity* ae = (AtomicEntity*)e; if (ae->isStartpointSelected() || ae->isEndpointSelected()) { @@ -1800,13 +1800,13 @@ void RS_Modification::deselectOriginals(bool remove) * * @param addList Entities to add. */ -//void RS_Modification::addNewEntities(Q3PtrList & addList) -void RS_Modification::addNewEntities(QList & addList) +//void Modification::addNewEntities(Q3PtrList & addList) +void Modification::addNewEntities(QList & addList) { -// for(RS_Entity * e=addList.first(); e!=NULL; e=addList.next()) +// for(Entity * e=addList.first(); e!=NULL; e=addList.next()) for(int i=0; i & addList) * @param limitEntity Entity to which the trim entity will be trimmed. * @param both true: Trim both entities. false: trim trimEntity only. */ -bool RS_Modification::trim(const Vector& trimCoord, RS_AtomicEntity* trimEntity, - const Vector& limitCoord, RS_Entity* limitEntity, bool both) +bool Modification::trim(const Vector& trimCoord, AtomicEntity* trimEntity, + const Vector& limitCoord, Entity* limitEntity, bool both) { if (trimEntity==NULL || limitEntity==NULL) { - RS_DEBUG->print(RS_Debug::D_WARNING, - "RS_Modification::trim: At least one entity is NULL"); + DEBUG->print(Debug::D_WARNING, + "Modification::trim: At least one entity is NULL"); return false; } if (both && !limitEntity->isAtomic()) { - RS_DEBUG->print(RS_Debug::D_WARNING, - "RS_Modification::trim: limitEntity is not atomic"); + DEBUG->print(Debug::D_WARNING, + "Modification::trim: limitEntity is not atomic"); } VectorSolutions sol; @@ -1854,21 +1854,21 @@ bool RS_Modification::trim(const Vector& trimCoord, RS_AtomicEntity* trimEntity, if (limitEntity->isAtomic()) { // intersection(s) of the two entities: - sol = RS_Information::getIntersection(trimEntity, limitEntity, false); + sol = Information::getIntersection(trimEntity, limitEntity, false); } else if (limitEntity->isContainer()) { - RS_EntityContainer* ec = (RS_EntityContainer*)limitEntity; + EntityContainer* ec = (EntityContainer*)limitEntity; sol.alloc(128); int i=0; - for (RS_Entity* e=ec->firstEntity(RS2::ResolveAll); e!=NULL; + for (Entity* e=ec->firstEntity(RS2::ResolveAll); e!=NULL; e=ec->nextEntity(RS2::ResolveAll)) { //for (int i=0; icount(); ++i) { - // RS_Entity* e = container->entityAt(i); + // Entity* e = container->entityAt(i); if (e!=NULL) { - VectorSolutions s2 = RS_Information::getIntersection(trimEntity, + VectorSolutions s2 = Information::getIntersection(trimEntity, e, false); if (s2.hasValid()) { @@ -1888,23 +1888,23 @@ bool RS_Modification::trim(const Vector& trimCoord, RS_AtomicEntity* trimEntity, if (!sol.hasValid()) return false; - RS_AtomicEntity * trimmed1 = NULL; - RS_AtomicEntity * trimmed2 = NULL; + AtomicEntity * trimmed1 = NULL; + AtomicEntity * trimmed2 = NULL; // remove trim entity from view: if (trimEntity->rtti() == RS2::EntityCircle) { // convert a circle into a trimmable arc - RS_Circle * c = (RS_Circle *)trimEntity; + Circle * c = (Circle *)trimEntity; double am = c->getCenter().angleTo(trimCoord); - RS_ArcData d(c->getCenter(), c->getRadius(), - RS_Math::correctAngle(am - M_PI / 2), - RS_Math::correctAngle(am + M_PI / 2), false); - trimmed1 = new RS_Arc(trimEntity->getParent(), d); + ArcData d(c->getCenter(), c->getRadius(), + Math::correctAngle(am - M_PI / 2), + Math::correctAngle(am + M_PI / 2), false); + trimmed1 = new Arc(trimEntity->getParent(), d); } else { - trimmed1 = (RS_AtomicEntity *)trimEntity->clone(); + trimmed1 = (AtomicEntity *)trimEntity->clone(); trimmed1->setHighlighted(false); } @@ -1917,7 +1917,7 @@ bool RS_Modification::trim(const Vector& trimCoord, RS_AtomicEntity* trimEntity, // remove limit entity from view: if (both) { - trimmed2 = (RS_AtomicEntity *)limitEntity->clone(); + trimmed2 = (AtomicEntity *)limitEntity->clone(); trimmed2->setHighlighted(false); #warning "!!! Old rendering path needs upgrading !!!" @@ -1931,13 +1931,13 @@ bool RS_Modification::trim(const Vector& trimCoord, RS_AtomicEntity* trimEntity, int ind = 0; Vector is = sol.getClosest(limitCoord, NULL, &ind); //sol.getClosest(limitCoord, NULL, &ind); - RS_DEBUG->print("RS_Modification::trim: limitCoord: %f/%f", limitCoord.x, limitCoord.y); - RS_DEBUG->print("RS_Modification::trim: sol.get(0): %f/%f", sol.get(0).x, sol.get(0).y); - RS_DEBUG->print("RS_Modification::trim: sol.get(1): %f/%f", sol.get(1).x, sol.get(1).y); - RS_DEBUG->print("RS_Modification::trim: ind: %d", ind); + DEBUG->print("Modification::trim: limitCoord: %f/%f", limitCoord.x, limitCoord.y); + DEBUG->print("Modification::trim: sol.get(0): %f/%f", sol.get(0).x, sol.get(0).y); + DEBUG->print("Modification::trim: sol.get(1): %f/%f", sol.get(1).x, sol.get(1).y); + DEBUG->print("Modification::trim: ind: %d", ind); Vector is2 = sol.get(ind==0 ? 1 : 0); //Vector is2 = sol.get(ind); - RS_DEBUG->print("RS_Modification::trim: is2: %f/%f", is2.x, is2.y); + DEBUG->print("Modification::trim: is2: %f/%f", is2.x, is2.y); //RS2::Ending ending = trimmed1->getTrimPoint(trimCoord, is); RS2::Ending ending = trimmed1->getTrimPoint(trimCoord, is); @@ -2017,19 +2017,19 @@ bool RS_Modification::trim(const Vector& trimCoord, RS_AtomicEntity* trimEntity, * @param trimEntity Entity which will be trimmed. * @param dist Amount to trim by. */ -bool RS_Modification::trimAmount(const Vector & trimCoord, - RS_AtomicEntity * trimEntity, double dist) +bool Modification::trimAmount(const Vector & trimCoord, + AtomicEntity * trimEntity, double dist) { if (!trimEntity) { - RS_DEBUG->print(RS_Debug::D_WARNING, "RS_Modification::trimAmount: Entity is NULL"); + DEBUG->print(Debug::D_WARNING, "Modification::trimAmount: Entity is NULL"); return false; } - RS_AtomicEntity * trimmed = NULL; + AtomicEntity * trimmed = NULL; // remove trim entity: - trimmed = (RS_AtomicEntity*)trimEntity->clone(); + trimmed = (AtomicEntity*)trimEntity->clone(); #warning "!!! Old rendering path needs upgrading !!!" #if 0 @@ -2075,26 +2075,26 @@ bool RS_Modification::trimAmount(const Vector & trimCoord, /** * Cuts the given entity at the given point. */ -bool RS_Modification::cut(const Vector& cutCoord, - RS_AtomicEntity* cutEntity) { +bool Modification::cut(const Vector& cutCoord, + AtomicEntity* cutEntity) { if (cutEntity==NULL) { - RS_DEBUG->print(RS_Debug::D_WARNING, - "RS_Modification::cut: Entity is NULL"); + DEBUG->print(Debug::D_WARNING, + "Modification::cut: Entity is NULL"); return false; } if (!cutCoord.valid) { - RS_DEBUG->print(RS_Debug::D_WARNING, - "RS_Modification::cut: Point invalid."); + DEBUG->print(Debug::D_WARNING, + "Modification::cut: Point invalid."); return false; } // cut point is at endpoint of entity: if (cutCoord.distanceTo(cutEntity->getStartpoint())<1.0e-6 || cutCoord.distanceTo(cutEntity->getEndpoint())<1.0e-6) { - RS_DEBUG->print(RS_Debug::D_WARNING, - "RS_Modification::cut: Cutting point on endpoint"); + DEBUG->print(Debug::D_WARNING, + "Modification::cut: Cutting point on endpoint"); return false; } @@ -2105,15 +2105,15 @@ bool RS_Modification::cut(const Vector& cutCoord, graphicView->deleteEntity(cutEntity); #endif - RS_AtomicEntity * cut1 = NULL; - RS_AtomicEntity * cut2 = NULL; + AtomicEntity * cut1 = NULL; + AtomicEntity * cut2 = NULL; // create new two halves: if (cutEntity->rtti() == RS2::EntityCircle) { - RS_Circle * c = (RS_Circle *)cutEntity; - cut1 = new RS_Arc(cutEntity->getParent(), - RS_ArcData(c->getCenter(), + Circle * c = (Circle *)cutEntity; + cut1 = new Arc(cutEntity->getParent(), + ArcData(c->getCenter(), c->getRadius(), 0.0,0.0, false)); cut1->setPen(cutEntity->getPen()); @@ -2125,8 +2125,8 @@ bool RS_Modification::cut(const Vector& cutCoord, } else { - cut1 = (RS_AtomicEntity*)cutEntity->clone(); - cut2 = (RS_AtomicEntity*)cutEntity->clone(); + cut1 = (AtomicEntity*)cutEntity->clone(); + cut2 = (AtomicEntity*)cutEntity->clone(); cut1->trimEndpoint(cutCoord); cut2->trimStartpoint(cutCoord); @@ -2162,30 +2162,30 @@ bool RS_Modification::cut(const Vector& cutCoord, /** * Stretching. */ -bool RS_Modification::stretch(const Vector& firstCorner, const Vector& secondCorner, +bool Modification::stretch(const Vector& firstCorner, const Vector& secondCorner, const Vector& offset) { if (!offset.valid) { - RS_DEBUG->print(RS_Debug::D_WARNING, - "RS_Modification::stretch: Offset invalid"); + DEBUG->print(Debug::D_WARNING, + "Modification::stretch: Offset invalid"); return false; } -// Q3PtrList addList; +// Q3PtrList addList; // addList.setAutoDelete(false); - QList addList; + QList addList; if (document!=NULL && handleUndo) { document->startUndoCycle(); } // Create new entites - for (RS_Entity* e=container->firstEntity(); + for (Entity* e=container->firstEntity(); e!=NULL; e=container->nextEntity()) { //for (int i=0; icount(); ++i) { - // RS_Entity* e = container->entityAt(i); + // Entity* e = container->entityAt(i); if (e!=NULL && e->isVisible() && @@ -2193,7 +2193,7 @@ bool RS_Modification::stretch(const Vector& firstCorner, const Vector& secondCor (e->isInWindow(firstCorner, secondCorner) || e->hasEndpointsWithinWindow(firstCorner, secondCorner))) { - RS_Entity* ec = e->clone(); + Entity* ec = e->clone(); ec->stretch(firstCorner, secondCorner, offset); addList.append(ec); e->setSelected(true); @@ -2224,19 +2224,19 @@ bool RS_Modification::stretch(const Vector& firstCorner, const Vector& secondCor * @param entity2 Second entity of the corner. * @param data Lengths and trim flag. */ -bool RS_Modification::bevel(const Vector& coord1, RS_AtomicEntity* entity1, - const Vector& coord2, RS_AtomicEntity* entity2, - RS_BevelData& data) { +bool Modification::bevel(const Vector& coord1, AtomicEntity* entity1, + const Vector& coord2, AtomicEntity* entity2, + BevelData& data) { - RS_DEBUG->print("RS_Modification::bevel"); + DEBUG->print("Modification::bevel"); if (entity1==NULL || entity2==NULL) { - RS_DEBUG->print(RS_Debug::D_WARNING, - "RS_Modification::bevel: At least one entity is NULL"); + DEBUG->print(Debug::D_WARNING, + "Modification::bevel: At least one entity is NULL"); return false; } - RS_EntityContainer* baseContainer = container; + EntityContainer* baseContainer = container; bool isPolyline = false; bool isClosedPolyline = false; @@ -2246,16 +2246,16 @@ bool RS_Modification::bevel(const Vector& coord1, RS_AtomicEntity* entity1, // find out whether we're bevelling within a polyline: if (entity1->getParent()!=NULL && entity1->getParent()->rtti()==RS2::EntityPolyline) { - RS_DEBUG->print("RS_Modification::bevel: trimming polyline segments"); + DEBUG->print("Modification::bevel: trimming polyline segments"); if (entity1->getParent()!=entity2->getParent()) { - RS_DEBUG->print(RS_Debug::D_WARNING, - "RS_Modification::bevel: entities not in the same polyline"); + DEBUG->print(Debug::D_WARNING, + "Modification::bevel: entities not in the same polyline"); return false; } // clone polyline for undo if (document!=NULL && handleUndo) { - RS_EntityContainer* cl = - (RS_EntityContainer*)entity1->getParent()->clone(); + EntityContainer* cl = + (EntityContainer*)entity1->getParent()->clone(); container->addEntity(cl); //cl->setUndoState(true); document->addUndoable(cl); @@ -2266,33 +2266,33 @@ bool RS_Modification::bevel(const Vector& coord1, RS_AtomicEntity* entity1, baseContainer = cl; } - entity1 = (RS_AtomicEntity*)baseContainer->entityAt(entity1->getParent()->findEntity(entity1)); - entity2 = (RS_AtomicEntity*)baseContainer->entityAt(entity2->getParent()->findEntity(entity2)); + entity1 = (AtomicEntity*)baseContainer->entityAt(entity1->getParent()->findEntity(entity1)); + entity2 = (AtomicEntity*)baseContainer->entityAt(entity2->getParent()->findEntity(entity2)); //baseContainer = entity1->getParent(); isPolyline = true; - isClosedPolyline = ((RS_Polyline*)entity1)->isClosed(); + isClosedPolyline = ((Polyline*)entity1)->isClosed(); } - RS_DEBUG->print("RS_Modification::bevel: getting intersection"); + DEBUG->print("Modification::bevel: getting intersection"); VectorSolutions sol = - RS_Information::getIntersection(entity1, entity2, false); + Information::getIntersection(entity1, entity2, false); if (sol.getNumber()==0) { return false; } - RS_AtomicEntity* trimmed1 = NULL; - RS_AtomicEntity* trimmed2 = NULL; + AtomicEntity* trimmed1 = NULL; + AtomicEntity* trimmed2 = NULL; //if (data.trim || isPolyline) { if (isPolyline) { trimmed1 = entity1; trimmed2 = entity2; } else { - trimmed1 = (RS_AtomicEntity*)entity1->clone(); - trimmed2 = (RS_AtomicEntity*)entity2->clone(); + trimmed1 = (AtomicEntity*)entity1->clone(); + trimmed2 = (AtomicEntity*)entity2->clone(); } #warning "!!! Old rendering path needs upgrading !!!" @@ -2316,7 +2316,7 @@ bool RS_Modification::bevel(const Vector& coord1, RS_AtomicEntity* entity1, #endif // trim entities to intersection - RS_DEBUG->print("RS_Modification::bevel: trim entities to intersection 01"); + DEBUG->print("Modification::bevel: trim entities to intersection 01"); bool start1 = false; Vector is = sol.getClosest(coord2); RS2::Ending ending1 = trimmed1->getTrimPoint(coord1, is); @@ -2333,7 +2333,7 @@ bool RS_Modification::bevel(const Vector& coord1, RS_AtomicEntity* entity1, break; } - RS_DEBUG->print("RS_Modification::bevel: trim entities to intersection 02"); + DEBUG->print("Modification::bevel: trim entities to intersection 02"); bool start2 = false; is = sol.getClosest(coord1); RS2::Ending ending2 = trimmed2->getTrimPoint(coord2, is); @@ -2353,12 +2353,12 @@ bool RS_Modification::bevel(const Vector& coord1, RS_AtomicEntity* entity1, // find definitive bevel points - RS_DEBUG->print("RS_Modification::bevel: find definitive bevel points"); + DEBUG->print("Modification::bevel: find definitive bevel points"); Vector bp1 = trimmed1->getNearestDist(data.length1, start1); Vector bp2 = trimmed2->getNearestDist(data.length2, start2); // final trim: - RS_DEBUG->print("RS_Modification::bevel: final trim"); + DEBUG->print("Modification::bevel: final trim"); if (data.trim==true) { switch (ending1) { case RS2::EndingStart: @@ -2397,8 +2397,8 @@ bool RS_Modification::bevel(const Vector& coord1, RS_AtomicEntity* entity1, // add bevel line: - RS_DEBUG->print("RS_Modification::bevel: add bevel line"); - RS_Line* bevel = new RS_Line(baseContainer, RS_LineData(bp1, bp2)); + DEBUG->print("Modification::bevel: add bevel line"); + Line* bevel = new Line(baseContainer, LineData(bp1, bp2)); if (isPolyline==false) { baseContainer->addEntity(bevel); @@ -2436,7 +2436,7 @@ bool RS_Modification::bevel(const Vector& coord1, RS_AtomicEntity* entity1, } if (isPolyline) { - ((RS_Polyline*)baseContainer)->updateEndpoints(); + ((Polyline*)baseContainer)->updateEndpoints(); } if (graphicView!=NULL) { @@ -2447,7 +2447,7 @@ bool RS_Modification::bevel(const Vector& coord1, RS_AtomicEntity* entity1, } } - RS_DEBUG->print("RS_Modification::bevel: handling undo"); + DEBUG->print("Modification::bevel: handling undo"); if (document!=NULL && handleUndo) { //document->startUndoCycle(); @@ -2470,10 +2470,10 @@ bool RS_Modification::bevel(const Vector& coord1, RS_AtomicEntity* entity1, } if (data.trim==false) { - RS_DEBUG->print("RS_Modification::bevel: delete trimmed elements"); + DEBUG->print("Modification::bevel: delete trimmed elements"); delete trimmed1; delete trimmed2; - RS_DEBUG->print("RS_Modification::bevel: delete trimmed elements: ok"); + DEBUG->print("Modification::bevel: delete trimmed elements: ok"); } return true; @@ -2490,20 +2490,20 @@ bool RS_Modification::bevel(const Vector& coord1, RS_AtomicEntity* entity1, * @param entity2 Second entity of the corner. * @param data Radius and trim flag. */ -bool RS_Modification::round(const Vector& coord, +bool Modification::round(const Vector& coord, const Vector& coord1, - RS_AtomicEntity* entity1, + AtomicEntity* entity1, const Vector& coord2, - RS_AtomicEntity* entity2, - RS_RoundData& data) { + AtomicEntity* entity2, + RoundData& data) { if (entity1==NULL || entity2==NULL) { - RS_DEBUG->print(RS_Debug::D_WARNING, - "RS_Modification::round: At least one entity is NULL"); + DEBUG->print(Debug::D_WARNING, + "Modification::round: At least one entity is NULL"); return false; } - RS_EntityContainer* baseContainer = container; + EntityContainer* baseContainer = container; bool isPolyline = false; bool isClosedPolyline = false; @@ -2516,8 +2516,8 @@ bool RS_Modification::round(const Vector& coord, entity1->getParent()->rtti()==RS2::EntityPolyline) { if (entity1->getParent()!=entity2->getParent()) { - RS_DEBUG->print(RS_Debug::D_WARNING, - "RS_Modification::round: entities not in " + DEBUG->print(Debug::D_WARNING, + "Modification::round: entities not in " "the same polyline"); if (document!=NULL && handleUndo) { document->endUndoCycle(); @@ -2527,8 +2527,8 @@ bool RS_Modification::round(const Vector& coord, // clone polyline for undo if (document!=NULL && handleUndo) { - RS_EntityContainer* cl = - (RS_EntityContainer*)entity1->getParent()->clone(); + EntityContainer* cl = + (EntityContainer*)entity1->getParent()->clone(); container->addEntity(cl); document->addUndoable(cl); @@ -2538,23 +2538,23 @@ bool RS_Modification::round(const Vector& coord, baseContainer = cl; } - entity1 = (RS_AtomicEntity*)baseContainer->entityAt(entity1->getParent()->findEntity(entity1)); - entity2 = (RS_AtomicEntity*)baseContainer->entityAt(entity2->getParent()->findEntity(entity2)); + entity1 = (AtomicEntity*)baseContainer->entityAt(entity1->getParent()->findEntity(entity1)); + entity2 = (AtomicEntity*)baseContainer->entityAt(entity2->getParent()->findEntity(entity2)); isPolyline = true; - isClosedPolyline = ((RS_Polyline*)entity1)->isClosed(); + isClosedPolyline = ((Polyline*)entity1)->isClosed(); } // create 2 tmp parallels - RS_Creation creation(NULL, NULL); - RS_Entity* par1 = creation.createParallel(coord, data.radius, 1, entity1); - RS_Entity* par2 = creation.createParallel(coord, data.radius, 1, entity2); + Creation creation(NULL, NULL); + Entity* par1 = creation.createParallel(coord, data.radius, 1, entity1); + Entity* par2 = creation.createParallel(coord, data.radius, 1, entity2); VectorSolutions sol2 = - RS_Information::getIntersection(entity1, entity2, false); + Information::getIntersection(entity1, entity2, false); VectorSolutions sol = - RS_Information::getIntersection(par1, par2, false); + Information::getIntersection(par1, par2, false); if (sol.getNumber()==0) { if (document!=NULL && handleUndo) { @@ -2569,25 +2569,25 @@ bool RS_Modification::round(const Vector& coord, Vector p2 = entity2->getNearestPointOnEntity(is, false); double ang1 = is.angleTo(p1); double ang2 = is.angleTo(p2); - bool reversed = (RS_Math::getAngleDifference(ang1, ang2)>M_PI); + bool reversed = (Math::getAngleDifference(ang1, ang2)>M_PI); - RS_Arc* arc = new RS_Arc(baseContainer, - RS_ArcData(is, + Arc* arc = new Arc(baseContainer, + ArcData(is, data.radius, ang1, ang2, reversed)); - RS_AtomicEntity* trimmed1 = NULL; - RS_AtomicEntity* trimmed2 = NULL; + AtomicEntity* trimmed1 = NULL; + AtomicEntity* trimmed2 = NULL; if (data.trim || isPolyline) { if (isPolyline) { trimmed1 = entity1; trimmed2 = entity2; } else { - trimmed1 = (RS_AtomicEntity*)entity1->clone(); - trimmed2 = (RS_AtomicEntity*)entity2->clone(); + trimmed1 = (AtomicEntity*)entity1->clone(); + trimmed2 = (AtomicEntity*)entity2->clone(); } #warning "!!! Old rendering path needs upgrading !!!" @@ -2659,10 +2659,10 @@ bool RS_Modification::round(const Vector& coord, arc->setLayer(baseContainer->getLayer()); arc->setPen(baseContainer->getPen()); - RS_DEBUG->print("RS_Modification::round: idx1print("RS_Modification::round: idx1!=0: %d", (int)(idx1!=0)); - RS_DEBUG->print("RS_Modification::round: idx2==0: %d", (int)(idx2==0)); - RS_DEBUG->print("RS_Modification::round: idx1==(int)baseContainer->count()-1: %d", + DEBUG->print("Modification::round: idx1print("Modification::round: idx1!=0: %d", (int)(idx1!=0)); + DEBUG->print("Modification::round: idx2==0: %d", (int)(idx2==0)); + DEBUG->print("Modification::round: idx1==(int)baseContainer->count()-1: %d", (int)(idx1==(int)baseContainer->count()-1)); bool insertAfter1 = false; @@ -2692,7 +2692,7 @@ bool RS_Modification::round(const Vector& coord, } if (isPolyline) { - ((RS_Polyline*)baseContainer)->updateEndpoints(); + ((Polyline*)baseContainer)->updateEndpoints(); } if (graphicView!=NULL) { @@ -2731,39 +2731,39 @@ bool RS_Modification::round(const Vector& coord, * Removes the selected entity containers and adds the entities in them as * new single entities. */ -bool RS_Modification::explode() +bool Modification::explode() { if (container == NULL) { - RS_DEBUG->print("RS_Modification::explode: no valid container for addinge entities", - RS_Debug::D_WARNING); + DEBUG->print("Modification::explode: no valid container for addinge entities", + Debug::D_WARNING); return false; } -// Q3PtrList addList; +// Q3PtrList addList; // addList.setAutoDelete(false); - QList addList; + QList addList; if (document!=NULL && handleUndo) { document->startUndoCycle(); } - for (RS_Entity* e=container->firstEntity(); + for (Entity* e=container->firstEntity(); e!=NULL; e=container->nextEntity()) { //for (uint i=0; icount(); ++i) { - //RS_Entity* e = container->entityAt(i); + //Entity* e = container->entityAt(i); if (e!=NULL && e->isSelected()) { if (e->isContainer()) { // add entities from container: - RS_EntityContainer* ec = (RS_EntityContainer*)e; + EntityContainer* ec = (EntityContainer*)e; //ec->setSelected(false); // iterate and explode container: //for (uint i2=0; i2count(); ++i2) { - // RS_Entity* e2 = ec->entityAt(i2); + // Entity* e2 = ec->entityAt(i2); RS2::ResolveLevel rl; bool resolvePen; bool resolveLayer; @@ -2801,11 +2801,11 @@ bool RS_Modification::explode() break; } - for (RS_Entity* e2 = ec->firstEntity(rl); e2!=NULL; + for (Entity* e2 = ec->firstEntity(rl); e2!=NULL; e2 = ec->nextEntity(rl)) { if (e2!=NULL) { - RS_Entity* clone = e2->clone(); + Entity* clone = e2->clone(); clone->setSelected(false); clone->reparent(container); @@ -2842,30 +2842,30 @@ bool RS_Modification::explode() return true; } -bool RS_Modification::explodeTextIntoLetters() +bool Modification::explodeTextIntoLetters() { if (container == NULL) { - RS_DEBUG->print("RS_Modification::explodeTextIntoLetters: no valid container" - " for addinge entities", RS_Debug::D_WARNING); + DEBUG->print("Modification::explodeTextIntoLetters: no valid container" + " for addinge entities", Debug::D_WARNING); return false; } -// Q3PtrList addList; +// Q3PtrList addList; // addList.setAutoDelete(false); - QList addList; + QList addList; if (document!=NULL && handleUndo) { document->startUndoCycle(); } - for (RS_Entity* e=container->firstEntity(); + for (Entity* e=container->firstEntity(); e!=NULL; e=container->nextEntity()) { if (e!=NULL && e->isSelected()) { if (e->rtti()==RS2::EntityText) { // add letters of text: - RS_Text* text = (RS_Text*)e; + Text* text = (Text*)e; explodeTextIntoLetters(text, addList); } else { e->setSelected(false); @@ -2887,14 +2887,14 @@ bool RS_Modification::explodeTextIntoLetters() return true; } -//bool RS_Modification::explodeTextIntoLetters(RS_Text* text, Q3PtrList& addList) -bool RS_Modification::explodeTextIntoLetters(RS_Text * text, QList & addList) +//bool Modification::explodeTextIntoLetters(Text* text, Q3PtrList& addList) +bool Modification::explodeTextIntoLetters(Text * text, QList & addList) { if (text == NULL) return false; // iterate though lines: - for(RS_Entity * e2=text->firstEntity(); e2!=NULL; e2=text->nextEntity()) + for(Entity * e2=text->firstEntity(); e2!=NULL; e2=text->nextEntity()) { if (e2 == NULL) break; @@ -2902,23 +2902,23 @@ bool RS_Modification::explodeTextIntoLetters(RS_Text * text, QList // text lines: if (e2->rtti() == RS2::EntityContainer) { - RS_EntityContainer * line = (RS_EntityContainer *)e2; + EntityContainer * line = (EntityContainer *)e2; // iterate though letters: - for(RS_Entity * e3=line->firstEntity(); e3!=NULL; e3=line->nextEntity()) + for(Entity * e3=line->firstEntity(); e3!=NULL; e3=line->nextEntity()) { if (e3 == NULL) break; // super / sub texts: if (e3->rtti() == RS2::EntityText) - explodeTextIntoLetters((RS_Text *)e3, addList); + explodeTextIntoLetters((Text *)e3, addList); // normal letters: else if (e3->rtti() == RS2::EntityInsert) { - RS_Insert * letter = (RS_Insert *)e3; + Insert * letter = (Insert *)e3; - RS_Text * tl = new RS_Text(container, RS_TextData(letter->getInsertionPoint(), + Text * tl = new Text(container, TextData(letter->getInsertionPoint(), text->getHeight(), 100.0, RS2::VAlignBottom, RS2::HAlignLeft, RS2::LeftToRight, RS2::Exact, 1.0, letter->getName(), text->getStyle(), letter->getAngle(), RS2::Update)); @@ -2939,27 +2939,27 @@ bool RS_Modification::explodeTextIntoLetters(RS_Text * text, QList /** * Moves all reference points of selected entities with the given data. */ -bool RS_Modification::moveRef(RS_MoveRefData& data) +bool Modification::moveRef(MoveRefData& data) { if (container == NULL) { - RS_DEBUG->print("RS_Modification::moveRef: no valid container", RS_Debug::D_WARNING); + DEBUG->print("Modification::moveRef: no valid container", Debug::D_WARNING); return false; } - // Q3PtrList addList; + // Q3PtrList addList; // addList.setAutoDelete(false); - QList addList; + QList addList; if (document != NULL && handleUndo) document->startUndoCycle(); // Create new entites - for(RS_Entity * e=container->firstEntity(); e!=NULL; e=container->nextEntity()) + for(Entity * e=container->firstEntity(); e!=NULL; e=container->nextEntity()) { if (e != NULL && e->isSelected()) { - RS_Entity * ec = e->clone(); + Entity * ec = e->clone(); ec->moveRef(data.ref, data.offset); // since 2.0.4.0: keep it selected ec->setSelected(true);