* @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) {
-
- if (e!=NULL && e->isSelected()) {
- // delete entity in graphic view:
- if (cut) {
- if (graphicView!=NULL) {
- graphicView->deleteEntity(e);
- }
- e->setSelected(false);
- } else {
- if (graphicView!=NULL) {
- graphicView->deleteEntity(e);
- }
- e->setSelected(false);
- if (graphicView!=NULL) {
- graphicView->drawEntity(e);
- }
- }
+void RS_Modification::copyEntity(RS_Entity * e, const Vector & ref, const bool cut)
+{
+ if (e && e->isSelected())
+ {
+ // delete entity in graphic view:
+ if (cut)
+ {
+#warning "!!! Old rendering path needs upgrading !!!"
+#if 0
+ if (graphicView)
+ graphicView->deleteEntity(e);
+#endif
- // add entity to clipboard:
- RS_Entity* c = e->clone();
- c->move(-ref);
- RS_CLIPBOARD->addEntity(c);
+ e->setSelected(false);
+ }
+ else
+ {
+#warning "!!! Old rendering path needs upgrading !!!"
+#if 0
+ if (graphicView)
+ graphicView->deleteEntity(e);
+#endif
- copyLayers(e);
- copyBlocks(e);
+ e->setSelected(false);
- // set layer to the layer clone:
- RS_Layer* l = e->getLayer();
- if (l!=NULL) {
- c->setLayer(l->getName());
- }
+#warning "!!! Old rendering path needs upgrading !!!"
+#if 0
+ if (graphicView)
+ graphicView->drawEntity(e);
+#endif
+ }
- // make sure all sub entities point to layers of the clipboard
- if (c->isContainer()) {
- RS_EntityContainer* ec = (RS_EntityContainer*)c;
+ // add entity to clipboard:
+ RS_Entity * c = e->clone();
+ c->move(-ref);
+ RS_CLIPBOARD->addEntity(c);
- for (RS_Entity* e2 = ec->firstEntity(RS2::ResolveAll); e2!=NULL;
- e2 = ec->nextEntity(RS2::ResolveAll)) {
+ copyLayers(e);
+ copyBlocks(e);
- //RS_Entity* e2 = ec->entityAt(i);
- RS_Layer* l2 = e2->getLayer();
+ // set layer to the layer clone:
+ RS_Layer * l = e->getLayer();
- if (l2!=NULL) {
- e2->setLayer(l2->getName());
- }
- }
- }
+ if (l)
+ c->setLayer(l->getName());
- if (cut) {
- e->changeUndoState();
- if (document!=NULL) {
- document->addUndoable(e);
- }
- }
- }
+ // make sure all sub entities point to layers of the clipboard
+ if (c->isContainer())
+ {
+ RS_EntityContainer * ec = (RS_EntityContainer *)c;
+
+ for(RS_Entity * e2=ec->firstEntity(RS2::ResolveAll); e2!=NULL;
+ e2=ec->nextEntity(RS2::ResolveAll))
+ {
+ //RS_Entity* e2 = ec->entityAt(i);
+ RS_Layer * l2 = e2->getLayer();
+ if (l2)
+ e2->setLayer(l2->getName());
+ }
+ }
+
+ if (cut)
+ {
+ e->changeUndoState();
+
+ if (document)
+ document->addUndoable(e);
+ }
+ }
}
}
}
- if (sol.hasValid()==false) {
- return false;
- }
+ if (!sol.hasValid())
+ return false;
- RS_AtomicEntity* trimmed1 = NULL;
- RS_AtomicEntity* trimmed2 = NULL;
+ RS_AtomicEntity * trimmed1 = NULL;
+ RS_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;
- 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);
- } else {
- trimmed1 = (RS_AtomicEntity*)trimEntity->clone();
- trimmed1->setHighlighted(false);
- }
- if (graphicView!=NULL) {
- graphicView->deleteEntity(trimEntity);
- }
+ // remove trim entity from view:
+ if (trimEntity->rtti() == RS2::EntityCircle)
+ {
+ // convert a circle into a trimmable arc
+ RS_Circle * c = (RS_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);
+ }
+ else
+ {
+ trimmed1 = (RS_AtomicEntity *)trimEntity->clone();
+ trimmed1->setHighlighted(false);
+ }
- // remove limit entity from view:
- if (both) {
- trimmed2 = (RS_AtomicEntity*)limitEntity->clone();
- trimmed2->setHighlighted(false);
- if (graphicView!=NULL) {
- graphicView->deleteEntity(limitEntity);
- }
- }
+#warning "!!! Old rendering path needs upgrading !!!"
+#if 0
+ if (graphicView)
+ graphicView->deleteEntity(trimEntity);
+#endif
+
+ // remove limit entity from view:
+ if (both)
+ {
+ trimmed2 = (RS_AtomicEntity *)limitEntity->clone();
+ trimmed2->setHighlighted(false);
+
+#warning "!!! Old rendering path needs upgrading !!!"
+#if 0
+ if (graphicView)
+ graphicView->deleteEntity(limitEntity);
+#endif
+ }
// trim trim entity
int ind = 0;
* @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 RS_Modification::trimAmount(const Vector & trimCoord,
+ RS_AtomicEntity * trimEntity, double dist)
+{
+ if (!trimEntity)
+ {
+ RS_DEBUG->print(RS_Debug::D_WARNING, "RS_Modification::trimAmount: Entity is NULL");
+ return false;
+ }
- if (trimEntity==NULL) {
- RS_DEBUG->print(RS_Debug::D_WARNING,
- "RS_Modification::trimAmount: Entity is NULL");
- return false;
- }
+ RS_AtomicEntity * trimmed = NULL;
- RS_AtomicEntity* trimmed = NULL;
+ // remove trim entity:
+ trimmed = (RS_AtomicEntity*)trimEntity->clone();
- // remove trim entity:
- trimmed = (RS_AtomicEntity*)trimEntity->clone();
- if (graphicView!=NULL) {
- graphicView->deleteEntity(trimEntity);
- }
+#warning "!!! Old rendering path needs upgrading !!!"
+#if 0
+ if (graphicView)
+ graphicView->deleteEntity(trimEntity);
+#endif
- // trim trim entity
- Vector is = trimmed->getNearestDist(-dist, trimCoord);
- if (trimCoord.distanceTo(trimmed->getStartpoint()) <
- trimCoord.distanceTo(trimmed->getEndpoint())) {
- trimmed->trimStartpoint(is);
- } else {
- trimmed->trimEndpoint(is);
- }
+ // trim trim entity
+ Vector is = trimmed->getNearestDist(-dist, trimCoord);
+ if (trimCoord.distanceTo(trimmed->getStartpoint()) <
+ trimCoord.distanceTo(trimmed->getEndpoint()))
+ {
+ trimmed->trimStartpoint(is);
+ }
+ else
+ {
+ trimmed->trimEndpoint(is);
+ }
- // add new trimmed trim entity:
- container->addEntity(trimmed);
+ // add new trimmed trim entity:
+ container->addEntity(trimmed);
- if (graphicView!=NULL) {
- graphicView->drawEntity(trimmed);
- }
+#warning "!!! Old rendering path needs upgrading !!!"
+#if 0
+ if (graphicView)
+ graphicView->drawEntity(trimmed);
+#endif
- if (document!=NULL && handleUndo) {
- document->startUndoCycle();
- document->addUndoable(trimmed);
- trimEntity->setUndoState(true);
- document->addUndoable(trimEntity);
- document->endUndoCycle();
- }
+ if (document && handleUndo)
+ {
+ document->startUndoCycle();
+ document->addUndoable(trimmed);
+ trimEntity->setUndoState(true);
+ document->addUndoable(trimEntity);
+ document->endUndoCycle();
+ }
- return true;
+ return true;
}
return false;
}
- // delete cut entity on the screen:
- if (graphicView!=NULL) {
- graphicView->deleteEntity(cutEntity);
- }
+#warning "!!! Old rendering path needs upgrading !!!"
+#if 0
+ // delete cut entity on the screen:
+ if (graphicView)
+ graphicView->deleteEntity(cutEntity);
+#endif
- RS_AtomicEntity* cut1 = NULL;
- RS_AtomicEntity* cut2 = NULL;
+ RS_AtomicEntity * cut1 = NULL;
+ RS_AtomicEntity * cut2 = NULL;
// create new two halves:
- if (cutEntity->rtti()==RS2::EntityCircle) {
- RS_Circle* c = (RS_Circle*)cutEntity;
+ if (cutEntity->rtti() == RS2::EntityCircle)
+ {
+ RS_Circle * c = (RS_Circle *)cutEntity;
cut1 = new RS_Arc(cutEntity->getParent(),
RS_ArcData(c->getCenter(),
c->getRadius(),
cut1->trimEndpoint(cutCoord);
cut1->trimStartpoint(cutCoord);
- } else {
+ }
+ else
+ {
cut1 = (RS_AtomicEntity*)cutEntity->clone();
cut2 = (RS_AtomicEntity*)cutEntity->clone();
trimmed2 = (RS_AtomicEntity*)entity2->clone();
}
- // remove trim entity (on screen):
- if (data.trim==true || isPolyline) {
- if (graphicView!=NULL) {
- if (isPolyline) {
- graphicView->deleteEntity(baseContainer);
- } else {
- graphicView->deleteEntity(entity1);
- graphicView->deleteEntity(entity2);
- }
- }
- }
+#warning "!!! Old rendering path needs upgrading !!!"
+#if 0
+ // remove trim entity (on screen):
+ if (data.trim || isPolyline)
+ {
+ if (graphicView)
+ {
+ if (isPolyline)
+ {
+ graphicView->deleteEntity(baseContainer);
+ }
+ else
+ {
+ graphicView->deleteEntity(entity1);
+ graphicView->deleteEntity(entity2);
+ }
+ }
+ }
+#endif
// trim entities to intersection
RS_DEBUG->print("RS_Modification::bevel: trim entities to intersection 01");
trimmed2 = (RS_AtomicEntity*)entity2->clone();
}
- // remove trim entity:
- if (graphicView!=NULL) {
- if (isPolyline) {
- graphicView->deleteEntity(baseContainer);
- } else {
- graphicView->deleteEntity(entity1);
- graphicView->deleteEntity(entity2);
- }
- }
+#warning "!!! Old rendering path needs upgrading !!!"
+#if 0
+ // remove trim entity:
+ if (graphicView!=NULL)
+ {
+ if (isPolyline)
+ {
+ graphicView->deleteEntity(baseContainer);
+ }
+ else
+ {
+ graphicView->deleteEntity(entity1);
+ graphicView->deleteEntity(entity2);
+ }
+ }
+#endif
// trim entities to intersection
Vector is2 = sol2.getClosest(coord2);