* 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;
/**
* 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();
/**
* 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<RS_Entity *> addList;
+ QList<Entity *> 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; i<container->count(); ++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);
// ec->setPenToActive();
//}
//if (ec->rtti()==RS2::EntityInsert) {
- // ((RS_Insert*)ec)->update();
+ // ((Insert*)ec)->update();
//}
ec->update();
addList.append(ec);
* @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
}
// 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; i<container->count(); ++i) {
- //RS_Entity* e = container->entityAt(i);
+ //Entity* e = container->entityAt(i);
if (e!=NULL && e->isSelected()) {
copyEntity(e, ref, 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())
{
}
// 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());
// 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());
/**
* 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;
// 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());
}
}
}
// 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; i<b->count(); ++i) {
- //RS_Entity* e2 = b->entityAt(i);
+ //Entity* e2 = b->entityAt(i);
copyLayers(e2);
}
}
/**
* 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;
// 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; i<b->count(); ++i) {
- //RS_Entity* e2 = b->entityAt(i);
+ //Entity* e2 = b->entityAt(i);
copyBlocks(e2);
}
}
* @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) {
// insert layers:
if (graphic!=NULL) {
- RS_Layer* layer = graphic->getActiveLayer();
+ Layer* layer = graphic->getActiveLayer();
for(uint i=0; i<source->countLayers(); ++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());
// insert blocks:
if (graphic!=NULL) {
for(uint i=0; i<source->countBlocks(); ++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; i2<bc->count(); ++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();
}
}
}
// 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);
}
// 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));
// 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());
}
}
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),
*
* @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;
*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;
* @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());
// 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);
// 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) {
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) {
}
}
} else {
- RS_DEBUG->print("RS_Modification::addPolylineNode: "
+ DEBUG->print("Modification::addPolylineNode: "
"Polyline contains non-atomic entities",
- RS_Debug::D_WARNING);
+ Debug::D_WARNING);
}
}
* @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) {
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());
// 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;
}
// 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);
// 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;
// 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();
//}
// 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();
* @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;
}
}
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();
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) {
}
}
- RS_Polyline* newPolyline = new RS_Polyline(container);
+ Polyline* newPolyline = new Polyline(container);
newPolyline->setClosed(polyline.isClosed());
newPolyline->setSelected(polyline.isSelected());
newPolyline->setLayer(polyline.getLayer());
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;
}
// 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());
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;
// 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) {
// drop deleted node:
else {
- RS_DEBUG->print("RS_Modification::deletePolylineNodesBetween: "
+ DEBUG->print("Modification::deletePolylineNodesBetween: "
"deleting vertex: %f/%f",
ae->getEndpoint().x, ae->getEndpoint().y);
}
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;
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();
* @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 {
// 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());
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);
// 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);
// 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);
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);
}
}
}
//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);
// 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:
// 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);
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();
* 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<RS_Entity> addList;
+// Q3PtrList<Entity> addList;
// addList.setAutoDelete(false);
- QList<RS_Entity *> addList;
+ QList<Entity *> addList;
if (document != NULL && handleUndo)
document->startUndoCycle();
{
// too slow:
//for (uint i=0; i<container->count(); ++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)
ec->setPenToActive();
if (ec->rtti() == RS2::EntityInsert)
- ((RS_Insert *)ec)->update();
+ ((Insert *)ec)->update();
// since 2.0.4.0: keep selection
ec->setSelected(true);
/**
* 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<RS_Entity> addList;
+// Q3PtrList<Entity> addList;
// addList.setAutoDelete(false);
- QList<RS_Entity *> addList;
+ QList<Entity *> addList;
if (document!=NULL && handleUndo)
document->startUndoCycle();
// 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; i<container->count(); ++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);
ec->setPenToActive();
if (ec->rtti() == RS2::EntityInsert)
- ((RS_Insert *)ec)->update();
+ ((Insert *)ec)->update();
addList.append(ec);
}
* 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<RS_Entity> addList;
+// Q3PtrList<Entity> addList;
// addList.setAutoDelete(false);
- QList<RS_Entity *> addList;
+ QList<Entity *> addList;
if (document!=NULL && handleUndo)
document->startUndoCycle();
// 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; i<container->count(); ++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();
ec->setPenToActive();
if (ec->rtti()==RS2::EntityInsert)
- ((RS_Insert*)ec)->update();
+ ((Insert*)ec)->update();
addList.append(ec);
}
* 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<RS_Entity> addList;
+// Q3PtrList<Entity> addList;
// addList.setAutoDelete(false);
- QList<RS_Entity *> addList;
+ QList<Entity *> addList;
if (document!=NULL && handleUndo) {
document->startUndoCycle();
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; i<container->count(); ++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);
ec->setPenToActive();
}
if (ec->rtti()==RS2::EntityInsert) {
- ((RS_Insert*)ec)->update();
+ ((Insert*)ec)->update();
}
addList.append(ec);
}
/**
* 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<RS_Entity> addList;
+// Q3PtrList<Entity> addList;
// addList.setAutoDelete(false);
- QList<RS_Entity *> addList;
+ QList<Entity *> addList;
if (document!=NULL && handleUndo) {
document->startUndoCycle();
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; i<container->count(); ++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);
ec->setPenToActive();
}
if (ec->rtti()==RS2::EntityInsert) {
- ((RS_Insert*)ec)->update();
+ ((Insert*)ec)->update();
}
addList.append(ec);
}
/**
* 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<RS_Entity> addList;
+// Q3PtrList<Entity> addList;
// addList.setAutoDelete(false);
- QList<RS_Entity *> addList;
+ QList<Entity *> addList;
if (document!=NULL && handleUndo) {
document->startUndoCycle();
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; i<container->count(); ++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);
ec->setPenToActive();
}
if (ec->rtti()==RS2::EntityInsert) {
- ((RS_Insert*)ec)->update();
+ ((Insert*)ec)->update();
}
addList.append(ec);
}
*
* @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; i<container->count(); ++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()) {
*
* @param addList Entities to add.
*/
-//void RS_Modification::addNewEntities(Q3PtrList<RS_Entity> & addList)
-void RS_Modification::addNewEntities(QList<RS_Entity *> & addList)
+//void Modification::addNewEntities(Q3PtrList<Entity> & addList)
+void Modification::addNewEntities(QList<Entity *> & 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.size(); i++)
{
- RS_Entity * e = addList[i];
+ Entity * e = addList[i];
if (e != NULL)
{
* @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;
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; i<container->count(); ++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()) {
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);
}
// 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 !!!"
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);
* @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
/**
* 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;
}
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());
}
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);
/**
* 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<RS_Entity> addList;
+// Q3PtrList<Entity> addList;
// addList.setAutoDelete(false);
- QList<RS_Entity *> addList;
+ QList<Entity *> 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; i<container->count(); ++i) {
- // RS_Entity* e = container->entityAt(i);
+ // Entity* e = container->entityAt(i);
if (e!=NULL &&
e->isVisible() &&
(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);
* @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;
// 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);
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 !!!"
#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);
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);
// 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:
// 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);
}
if (isPolyline) {
- ((RS_Polyline*)baseContainer)->updateEndpoints();
+ ((Polyline*)baseContainer)->updateEndpoints();
}
if (graphicView!=NULL) {
}
}
- RS_DEBUG->print("RS_Modification::bevel: handling undo");
+ DEBUG->print("Modification::bevel: handling undo");
if (document!=NULL && handleUndo) {
//document->startUndoCycle();
}
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;
* @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;
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();
// 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);
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) {
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 !!!"
arc->setLayer(baseContainer->getLayer());
arc->setPen(baseContainer->getPen());
- RS_DEBUG->print("RS_Modification::round: idx1<idx2: %d", (int)(idx1<idx2));
- RS_DEBUG->print("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: idx1<idx2: %d", (int)(idx1<idx2));
+ DEBUG->print("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;
}
if (isPolyline) {
- ((RS_Polyline*)baseContainer)->updateEndpoints();
+ ((Polyline*)baseContainer)->updateEndpoints();
}
if (graphicView!=NULL) {
* 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<RS_Entity> addList;
+// Q3PtrList<Entity> addList;
// addList.setAutoDelete(false);
- QList<RS_Entity *> addList;
+ QList<Entity *> 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; i<container->count(); ++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; i2<ec->count(); ++i2) {
- // RS_Entity* e2 = ec->entityAt(i2);
+ // Entity* e2 = ec->entityAt(i2);
RS2::ResolveLevel rl;
bool resolvePen;
bool resolveLayer;
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);
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<RS_Entity> addList;
+// Q3PtrList<Entity> addList;
// addList.setAutoDelete(false);
- QList<RS_Entity *> addList;
+ QList<Entity *> 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);
return true;
}
-//bool RS_Modification::explodeTextIntoLetters(RS_Text* text, Q3PtrList<RS_Entity>& addList)
-bool RS_Modification::explodeTextIntoLetters(RS_Text * text, QList<RS_Entity *> & addList)
+//bool Modification::explodeTextIntoLetters(Text* text, Q3PtrList<Entity>& addList)
+bool Modification::explodeTextIntoLetters(Text * text, QList<Entity *> & 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;
// 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));
/**
* 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<RS_Entity> addList;
+ // Q3PtrList<Entity> addList;
// addList.setAutoDelete(false);
- QList<RS_Entity *> addList;
+ QList<Entity *> 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);