src/forms
HEADERS = \
- src/base/rs.h \
src/base/actioninterface.h \
src/base/arc.h \
src/base/atomicentity.h \
src/base/ellipse.h \
src/base/entity.h \
src/base/entitycontainer.h \
+ src/base/enums.h \
src/base/eventhandler.h \
src/base/fileio.h \
src/base/filtercxf.h \
src/base/point.h \
src/base/polyline.h \
src/base/preview.h \
- src/base/python.h \
- src/base/python_wrappers.h \
src/base/script.h \
src/base/scriptlist.h \
src/base/selection.h \
- src/base/simplepython.h \
src/base/snapper.h \
src/base/solid.h \
src/base/spline.h \
src/base/ellipse.cpp \
src/base/entity.cpp \
src/base/entitycontainer.cpp \
+ src/base/enums.cpp \
src/base/eventhandler.cpp \
src/base/fileio.cpp \
src/base/filtercxf.cpp \
src/base/point.cpp \
src/base/polyline.cpp \
src/base/preview.cpp \
- src/base/python.cpp \
- src/base/python_wrappers.cpp \
src/base/script.cpp \
src/base/scriptlist.cpp \
src/base/selection.cpp \
- src/base/simplepython.cpp \
src/base/snapper.cpp \
src/base/solid.cpp \
src/base/spline.cpp \
#include "drawing.h"
#include "dialogfactory.h"
-ActionBlocksAdd::ActionBlocksAdd(RS_EntityContainer & container, GraphicView & graphicView):
+ActionBlocksAdd::ActionBlocksAdd(EntityContainer & container, GraphicView & graphicView):
ActionInterface("Add Block", container, graphicView)
{
}
void ActionBlocksAdd::trigger()
{
- RS_DEBUG->print("adding block");
+ DEBUG->print("adding block");
if (graphic)
{
- RS_BlockList * blockList = graphic->getBlockList();
+ BlockList * blockList = graphic->getBlockList();
if (blockList)
{
- RS_BlockData d = RS_DIALOGFACTORY->requestNewBlockDialog(blockList);
+ BlockData d = DIALOGFACTORY->requestNewBlockDialog(blockList);
if (d.isValid())
- graphic->addBlock(new RS_Block(container, d));
+ graphic->addBlock(new Block(container, d));
}
}
class ActionBlocksAdd: public ActionInterface
{
public:
- ActionBlocksAdd(RS_EntityContainer & container, GraphicView & graphicView);
+ ActionBlocksAdd(EntityContainer & container, GraphicView & graphicView);
~ActionBlocksAdd();
virtual void init(int status = 0);
#include "dialogfactory.h"
ActionBlocksAttributes::ActionBlocksAttributes(
- RS_EntityContainer & container, GraphicView & graphicView):
+ EntityContainer & container, GraphicView & graphicView):
ActionInterface("Edit Block Attributes", container, graphicView)
{
}
void ActionBlocksAttributes::trigger()
{
- RS_DEBUG->print("editing block attributes");
+ DEBUG->print("editing block attributes");
- if (graphic && RS_DIALOGFACTORY)
+ if (graphic && DIALOGFACTORY)
{
- RS_Block * block = graphic->getActiveBlock();
- RS_BlockList * blockList = graphic->getBlockList();
+ Block * block = graphic->getActiveBlock();
+ BlockList * blockList = graphic->getBlockList();
if (blockList && block)
{
QString oldName = block->getName();
- RS_BlockData d = RS_DIALOGFACTORY->requestBlockAttributesDialog(blockList);
+ BlockData d = DIALOGFACTORY->requestBlockAttributesDialog(blockList);
if (d.isValid())
{
class ActionBlocksAttributes: public ActionInterface
{
public:
- ActionBlocksAttributes(RS_EntityContainer & container, GraphicView & graphicView);
+ ActionBlocksAttributes(EntityContainer & container, GraphicView & graphicView);
~ActionBlocksAttributes();
virtual void init(int status = 0);
// Who When What
// --- ---------- -----------------------------------------------------------
// JLH 06/03/2010 Added this text. :-)
-// JLH 06/03/2010 Scrubbed out all occurances of RS_CoordinateEvent
+// JLH 06/03/2010 Scrubbed out all occurances of CoordinateEvent
//
#include "actionblockscreate.h"
/**
* Constructor.
*/
-ActionBlocksCreate::ActionBlocksCreate(RS_EntityContainer & container, GraphicView & graphicView): ActionInterface("Blocks Create", container, graphicView)
+ActionBlocksCreate::ActionBlocksCreate(EntityContainer & container, GraphicView & graphicView): ActionInterface("Blocks Create", container, graphicView)
{
referencePoint = Vector(false);
}
//deletePreview();
//clearPreview();
- //RS_Modification m(*container, graphicView);
+ //Modification m(*container, graphicView);
//m.paste(data.insertionPoint);
- //std::cout << *RS_Clipboard::instance();
+ //std::cout << *Clipboard::instance();
if (graphic != NULL)
{
- RS_BlockList * blockList = graphic->getBlockList();
+ BlockList * blockList = graphic->getBlockList();
if (blockList != NULL)
{
- RS_BlockData d = RS_DIALOGFACTORY->requestNewBlockDialog(blockList);
+ BlockData d = DIALOGFACTORY->requestNewBlockDialog(blockList);
if (!d.name.isEmpty())
{
- RS_Creation creation(container, graphicView);
+ Creation creation(container, graphicView);
creation.createBlock(d, referencePoint, true);
- RS_InsertData id(d.name, referencePoint, Vector(1.0, 1.0), 0.0, 1, 1, Vector(0.0, 0.0));
+ InsertData id(d.name, referencePoint, Vector(1.0, 1.0), 0.0, 1, 1, Vector(0.0, 0.0));
creation.createInsert(id);
}
}
clearPreview();
//preview->addAllFrom(*block);
//preview->move(data.insertionPoint);
- RS_Creation creation(preview, NULL, false);
+ Creation creation(preview, NULL, false);
creation.createInsert(data);
drawPreview();
}*/
switch (getStatus())
{
case SetReferencePoint:
- RS_DIALOGFACTORY->updateMouseWidget(tr("Specify reference point"), tr("Cancel"));
+ DIALOGFACTORY->updateMouseWidget(tr("Specify reference point"), tr("Cancel"));
break;
default:
- RS_DIALOGFACTORY->updateMouseWidget("", "");
+ DIALOGFACTORY->updateMouseWidget("", "");
break;
}
}
void ActionBlocksCreate::updateToolBar()
{
if (!isFinished())
- RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarSnap);
+ DIALOGFACTORY->requestToolBar(RS2::ToolBarSnap);
else
- RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarMain);
+ DIALOGFACTORY->requestToolBar(RS2::ToolBarMain);
}
};
public:
- ActionBlocksCreate(RS_EntityContainer & container, GraphicView & graphicView);
+ ActionBlocksCreate(EntityContainer & container, GraphicView & graphicView);
~ActionBlocksCreate();
virtual RS2::ActionType rtti();
#include "drawing.h"
#include "dialogfactory.h"
-ActionBlocksEdit::ActionBlocksEdit(RS_EntityContainer & container, GraphicView & graphicView):
+ActionBlocksEdit::ActionBlocksEdit(EntityContainer & container, GraphicView & graphicView):
ActionInterface("Edit Block", container, graphicView)
{
}
void ActionBlocksEdit::trigger()
{
- RS_DEBUG->print("edit block");
+ DEBUG->print("edit block");
- if (graphic && RS_DIALOGFACTORY)
- RS_DIALOGFACTORY->requestEditBlockWindow(graphic->getBlockList());
+ if (graphic && DIALOGFACTORY)
+ DIALOGFACTORY->requestEditBlockWindow(graphic->getBlockList());
else
- RS_DEBUG->print(RS_Debug::D_WARNING, "ActionBlocksEdit::trigger(): graphic is NULL");
+ DEBUG->print(Debug::D_WARNING, "ActionBlocksEdit::trigger(): graphic is NULL");
finish();
}
class ActionBlocksEdit: public ActionInterface
{
public:
- ActionBlocksEdit(RS_EntityContainer & container, GraphicView & graphicView);
+ ActionBlocksEdit(EntityContainer & container, GraphicView & graphicView);
~ActionBlocksEdit();
virtual void init(int status = 0);
/**
* Constructor.
*/
-ActionBlocksExplode::ActionBlocksExplode(RS_EntityContainer & container, GraphicView & graphicView):
+ActionBlocksExplode::ActionBlocksExplode(EntityContainer & container, GraphicView & graphicView):
ActionInterface("Blocks Explode", container, graphicView)
{
}
void ActionBlocksExplode::trigger()
{
- RS_Modification m(*container, graphicView);
+ Modification m(*container, graphicView);
m.explode();
}
class ActionBlocksExplode: public ActionInterface
{
public:
- ActionBlocksExplode(RS_EntityContainer & container, GraphicView & graphicView);
+ ActionBlocksExplode(EntityContainer & container, GraphicView & graphicView);
~ActionBlocksExplode();
virtual RS2::ActionType rtti();
#include "drawing.h"
#include "graphicview.h"
-ActionBlocksFreezeAll::ActionBlocksFreezeAll(bool freeze, RS_EntityContainer & container,
+ActionBlocksFreezeAll::ActionBlocksFreezeAll(bool freeze, EntityContainer & container,
GraphicView & graphicView): ActionInterface("Freeze all Blocks", container, graphicView)
{
this->freeze = freeze;
void ActionBlocksFreezeAll::trigger()
{
- RS_DEBUG->print("ActionBlocksFreezeAll::trigger");
+ DEBUG->print("ActionBlocksFreezeAll::trigger");
if (graphic)
graphic->freezeAllBlocks(freeze);
class ActionBlocksFreezeAll: public ActionInterface
{
public:
- ActionBlocksFreezeAll(bool freeze, RS_EntityContainer & container, GraphicView & graphicView);
+ ActionBlocksFreezeAll(bool freeze, EntityContainer & container, GraphicView & graphicView);
~ActionBlocksFreezeAll();
virtual void init(int status = 0);
// Who When What
// --- ---------- -----------------------------------------------------------
// JLH 06/03/2010 Added this text. :-)
-// JLH 06/03/2010 Scrubbed out all occurances of RS_CoordinateEvent
+// JLH 06/03/2010 Scrubbed out all occurances of CoordinateEvent
//
#include "actionblocksinsert.h"
/**
* Constructor.
*/
-ActionBlocksInsert::ActionBlocksInsert(RS_EntityContainer & container, GraphicView & graphicView):
+ActionBlocksInsert::ActionBlocksInsert(EntityContainer & container, GraphicView & graphicView):
ActionInterface("Blocks Insert", container, graphicView)
{
}
void ActionBlocksInsert::reset()
{
- data = RS_InsertData("", Vector(0.0, 0.0), Vector(1.0, 1.0), 0.0, 1, 1,
+ data = InsertData("", Vector(0.0, 0.0), Vector(1.0, 1.0), 0.0, 1, 1,
Vector(1.0, 1.0), NULL, RS2::Update);
}
// deletePreview();
// clearPreview();
- //RS_Modification m(*container, graphicView);
+ //Modification m(*container, graphicView);
//m.paste(data.insertionPoint);
- //std::cout << *RS_Clipboard::instance();
+ //std::cout << *Clipboard::instance();
if (block)
{
- RS_Creation creation(container, graphicView);
+ Creation creation(container, graphicView);
data.updateMode = RS2::Update;
creation.createInsert(data);
}
// clearPreview();
//preview->addAllFrom(*block);
//preview->move(data.insertionPoint);
-// RS_Creation creation(preview, NULL, false);
- RS_Creation creation(&(graphicView->preview), NULL, false);
+// Creation creation(preview, NULL, false);
+ Creation creation(&(graphicView->preview), NULL, false);
// Create insert as preview only
data.updateMode = RS2::PreviewUpdate;
creation.createInsert(data);
trigger();
}
-void ActionBlocksInsert::commandEvent(RS_CommandEvent * e)
+void ActionBlocksInsert::commandEvent(CommandEvent * e)
{
QString c = e->getCommand().toLower();
if (checkCommand("help", c))
{
- RS_DIALOGFACTORY->commandMessage(msgAvailableCommands()
+ DIALOGFACTORY->commandMessage(msgAvailableCommands()
+ getAvailableCommands().join(", "));
return;
}
case SetAngle:
{
bool ok;
- double a = RS_Math::eval(c, &ok);
+ double a = Math::eval(c, &ok);
if (ok)
- data.angle = RS_Math::deg2rad(a);
+ data.angle = Math::deg2rad(a);
else
- RS_DIALOGFACTORY->commandMessage(tr("Not a valid expression"));
+ DIALOGFACTORY->commandMessage(tr("Not a valid expression"));
- RS_DIALOGFACTORY->requestOptions(this, true, true);
+ DIALOGFACTORY->requestOptions(this, true, true);
setStatus(lastStatus);
}
break;
case SetFactor:
{
bool ok;
- double f = RS_Math::eval(c, &ok);
+ double f = Math::eval(c, &ok);
if (ok)
setFactor(f);
else
- RS_DIALOGFACTORY->commandMessage(tr("Not a valid expression"));
+ DIALOGFACTORY->commandMessage(tr("Not a valid expression"));
- RS_DIALOGFACTORY->requestOptions(this, true, true);
+ DIALOGFACTORY->requestOptions(this, true, true);
setStatus(lastStatus);
}
break;
case SetColumns:
{
bool ok;
- int cols = (int)RS_Math::eval(c, &ok);
+ int cols = (int)Math::eval(c, &ok);
if (ok)
data.cols = cols;
else
- RS_DIALOGFACTORY->commandMessage(tr("Not a valid expression"));
+ DIALOGFACTORY->commandMessage(tr("Not a valid expression"));
- RS_DIALOGFACTORY->requestOptions(this, true, true);
+ DIALOGFACTORY->requestOptions(this, true, true);
setStatus(lastStatus);
}
break;
case SetRows:
{
bool ok;
- int rows = (int)RS_Math::eval(c, &ok);
+ int rows = (int)Math::eval(c, &ok);
if (ok)
data.rows = rows;
else
- RS_DIALOGFACTORY->commandMessage(tr("Not a valid expression"));
+ DIALOGFACTORY->commandMessage(tr("Not a valid expression"));
- RS_DIALOGFACTORY->requestOptions(this, true, true);
+ DIALOGFACTORY->requestOptions(this, true, true);
setStatus(lastStatus);
}
break;
case SetColumnSpacing:
{
bool ok;
- double cs = (int)RS_Math::eval(c, &ok);
+ double cs = (int)Math::eval(c, &ok);
if (ok)
data.spacing.x = cs;
else
- RS_DIALOGFACTORY->commandMessage(tr("Not a valid expression"));
+ DIALOGFACTORY->commandMessage(tr("Not a valid expression"));
- RS_DIALOGFACTORY->requestOptions(this, true, true);
+ DIALOGFACTORY->requestOptions(this, true, true);
setStatus(lastStatus);
}
break;
case SetRowSpacing:
{
bool ok;
- int rs = (int)RS_Math::eval(c, &ok);
+ int rs = (int)Math::eval(c, &ok);
if (ok)
data.spacing.y = rs;
else
- RS_DIALOGFACTORY->commandMessage(tr("Not a valid expression"));
+ DIALOGFACTORY->commandMessage(tr("Not a valid expression"));
- RS_DIALOGFACTORY->requestOptions(this, true, true);
+ DIALOGFACTORY->requestOptions(this, true, true);
setStatus(lastStatus);
}
break;
void ActionBlocksInsert::showOptions()
{
ActionInterface::showOptions();
- RS_DIALOGFACTORY->requestOptions(this, true);
+ DIALOGFACTORY->requestOptions(this, true);
}
void ActionBlocksInsert::hideOptions()
{
ActionInterface::hideOptions();
- RS_DIALOGFACTORY->requestOptions(this, false);
+ DIALOGFACTORY->requestOptions(this, false);
}
void ActionBlocksInsert::updateMouseButtonHints()
switch (getStatus())
{
case SetTargetPoint:
- RS_DIALOGFACTORY->updateMouseWidget(tr("Specify reference point"), tr("Cancel"));
+ DIALOGFACTORY->updateMouseWidget(tr("Specify reference point"), tr("Cancel"));
break;
case SetAngle:
- RS_DIALOGFACTORY->updateMouseWidget(tr("Enter angle:"), "");
+ DIALOGFACTORY->updateMouseWidget(tr("Enter angle:"), "");
break;
case SetFactor:
- RS_DIALOGFACTORY->updateMouseWidget(tr("Enter factor:"), "");
+ DIALOGFACTORY->updateMouseWidget(tr("Enter factor:"), "");
break;
case SetColumns:
- RS_DIALOGFACTORY->updateMouseWidget(tr("Enter columns:"), "");
+ DIALOGFACTORY->updateMouseWidget(tr("Enter columns:"), "");
break;
case SetRows:
- RS_DIALOGFACTORY->updateMouseWidget(tr("Enter rows:"), "");
+ DIALOGFACTORY->updateMouseWidget(tr("Enter rows:"), "");
break;
case SetColumnSpacing:
- RS_DIALOGFACTORY->updateMouseWidget(tr("Enter column spacing:"), "");
+ DIALOGFACTORY->updateMouseWidget(tr("Enter column spacing:"), "");
break;
case SetRowSpacing:
- RS_DIALOGFACTORY->updateMouseWidget(tr("Enter row spacing:"), "");
+ DIALOGFACTORY->updateMouseWidget(tr("Enter row spacing:"), "");
break;
default:
- RS_DIALOGFACTORY->updateMouseWidget("", "");
+ DIALOGFACTORY->updateMouseWidget("", "");
break;
}
}
void ActionBlocksInsert::updateToolBar()
{
if (!isFinished())
- RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarSnap);
+ DIALOGFACTORY->requestToolBar(RS2::ToolBarSnap);
else
- RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarMain);
+ DIALOGFACTORY->requestToolBar(RS2::ToolBarMain);
}
double ActionBlocksInsert::getAngle()
};
public:
- ActionBlocksInsert(RS_EntityContainer & container, GraphicView & graphicView);
+ ActionBlocksInsert(EntityContainer & container, GraphicView & graphicView);
~ActionBlocksInsert();
virtual RS2::ActionType rtti();
virtual void mouseMoveEvent(QMouseEvent * e);
virtual void mouseReleaseEvent(QMouseEvent * e);
virtual void coordinateEvent(Vector * e);
- virtual void commandEvent(RS_CommandEvent * e);
+ virtual void commandEvent(CommandEvent * e);
virtual QStringList getAvailableCommands();
virtual void showOptions();
virtual void hideOptions();
void setRowSpacing(double rs);
protected:
- RS_Block * block;
- RS_InsertData data;
+ Block * block;
+ InsertData data;
/** Last status before entering option. */
Status lastStatus;
#include "graphicview.h"
#include "insert.h"
-ActionBlocksRemove::ActionBlocksRemove(RS_EntityContainer & container, GraphicView & graphicView):
+ActionBlocksRemove::ActionBlocksRemove(EntityContainer & container, GraphicView & graphicView):
ActionInterface("Remove Block", container, graphicView)
{
}
void ActionBlocksRemove::trigger()
{
- RS_DEBUG->print("ActionBlocksRemove::trigger");
+ DEBUG->print("ActionBlocksRemove::trigger");
if (graphic)
{
- RS_Block * block = RS_DIALOGFACTORY->requestBlockRemovalDialog(graphic->getBlockList());
+ Block * block = DIALOGFACTORY->requestBlockRemovalDialog(graphic->getBlockList());
// list of containers that might refer to the block via inserts:
- QList<RS_EntityContainer *> containerList;
+ QList<EntityContainer *> containerList;
containerList.append(graphic);
- RS_BlockList * blkLst = graphic->getBlockList();
+ BlockList * blkLst = graphic->getBlockList();
for(uint bi=0; bi<blkLst->count(); bi++)
containerList.append(blkLst->at(bi));
{
for(int i=0; i<containerList.size(); i++)
{
- RS_EntityContainer * cont = containerList[i];
+ EntityContainer * cont = containerList[i];
// remove all inserts from the graphic:
bool done;
{
done = true;
- for(RS_Entity * e=cont->firstEntity(RS2::ResolveNone); e!=NULL;
+ for(Entity * e=cont->firstEntity(RS2::ResolveNone); e!=NULL;
e=cont->nextEntity(RS2::ResolveNone))
{
if (e->rtti() == RS2::EntityInsert)
{
- RS_Insert * ins = (RS_Insert *)e;
+ Insert * ins = (Insert *)e;
if (ins->getName() == block->getName())
{
}
// close all windows that are editing this block:
- if (RS_DIALOGFACTORY)
- RS_DIALOGFACTORY->closeEditBlockWindow(block);
+ if (DIALOGFACTORY)
+ DIALOGFACTORY->closeEditBlockWindow(block);
// Now remove the block from the block list:
graphic->removeBlock(block);
}
finish();
- RS_DIALOGFACTORY->updateSelectionWidget(container->countSelected());
+ DIALOGFACTORY->updateSelectionWidget(container->countSelected());
}
void ActionBlocksRemove::init(int status)
class ActionBlocksRemove: public ActionInterface
{
public:
- ActionBlocksRemove(RS_EntityContainer & container, GraphicView & graphicView);
+ ActionBlocksRemove(EntityContainer & container, GraphicView & graphicView);
~ActionBlocksRemove();
virtual void init(int status = 0);
#include "drawing.h"
#include "graphicview.h"
-ActionBlocksToggleView::ActionBlocksToggleView(RS_EntityContainer & container,
+ActionBlocksToggleView::ActionBlocksToggleView(EntityContainer & container,
GraphicView & graphicView): ActionInterface("Toggle Block Visibility",
container, graphicView)
{
void ActionBlocksToggleView::trigger()
{
- RS_DEBUG->print("toggle block");
+ DEBUG->print("toggle block");
if (graphic)
{
- RS_Block * block = graphic->getActiveBlock();
+ Block * block = graphic->getActiveBlock();
graphic->toggleBlock(block);
}
class ActionBlocksToggleView: public ActionInterface
{
public:
- ActionBlocksToggleView(RS_EntityContainer & container, GraphicView & graphicView);
+ ActionBlocksToggleView(EntityContainer & container, GraphicView & graphicView);
~ActionBlocksToggleView();
virtual void init(int status = 0);
#include "actiondefault.h"
-#include "rs.h"
+#include "enums.h"
#include "commandevent.h"
#include "debug.h"
#include "dialogfactory.h"
/**
* Constructor.
*/
-ActionDefault::ActionDefault(RS_EntityContainer & container,
+ActionDefault::ActionDefault(EntityContainer & container,
GraphicView & graphicView):
ActionInterface("Default", container, graphicView)
{
- RS_DEBUG->print("ActionDefault::ActionDefault");
+ DEBUG->print("ActionDefault::ActionDefault");
//hm.
// graphicView.snapper.SetVisible();
// graphicView.preview.SetVisible();
- RS_DEBUG->print("ActionDefault::ActionDefault: OK");
+ DEBUG->print("ActionDefault::ActionDefault: OK");
}
ActionDefault::~ActionDefault()
void ActionDefault::init(int status /*= 0*/)
{
- RS_DEBUG->print("ActionDefault::init");
+ DEBUG->print("ActionDefault::init");
ActionInterface::init(status);
v1 = v2 = Vector(false);
graphicView->snapper.setSnapMode(RS2::SnapFree);
graphicView->snapper.setSnapRestriction(RS2::RestrictNothing);
restrBak = RS2::RestrictNothing;
- RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarMain);
+ DIALOGFACTORY->requestToolBar(RS2::ToolBarMain);
- RS_DEBUG->print("ActionDefault::init: OK");
+ DEBUG->print("ActionDefault::init: OK");
}
void ActionDefault::trigger()
Vector mouse = graphicView->toGraph(Vector(e->x(), e->y()));
Vector relMouse = mouse - graphicView->getRelativeZero();
- RS_DIALOGFACTORY->updateCoordinateWidget(mouse, relMouse);
+ DIALOGFACTORY->updateCoordinateWidget(mouse, relMouse);
switch (getStatus())
{
if (ref.valid && graphicView->toGuiDX(dist) < 8)
{
- RS_DEBUG->print("ActionDefault::mouseMoveEvent: moving reference point");
+ DEBUG->print("ActionDefault::mouseMoveEvent: moving reference point");
setStatus(MovingRef);
v1 = ref;
graphicView->moveRelativeZero(v1);
else
{
// test for an entity to drag:
- RS_Entity * en = graphicView->snapper.catchEntity(v1);
+ Entity * en = graphicView->snapper.catchEntity(v1);
if (en && en->isSelected())
{
- RS_DEBUG->print("ActionDefault::mouseMoveEvent: moving entity");
+ DEBUG->print("ActionDefault::mouseMoveEvent: moving entity");
setStatus(Moving);
v1 = en->getNearestRef(v1);
graphicView->moveRelativeZero(v1);
graphicView->preview.clear();
- graphicView->preview.addEntity(new RS_Line(&(graphicView->preview),
- RS_LineData(Vector(v1.x, v1.y), Vector(v2.x, v1.y))));
- graphicView->preview.addEntity(new RS_Line(&(graphicView->preview),
- RS_LineData(Vector(v2.x, v1.y), Vector(v2.x, v2.y))));
- graphicView->preview.addEntity(new RS_Line(&(graphicView->preview),
- RS_LineData(Vector(v2.x, v2.y), Vector(v1.x, v2.y))));
- graphicView->preview.addEntity(new RS_Line(&(graphicView->preview),
- RS_LineData(Vector(v1.x, v2.y), Vector(v1.x, v1.y))));
+ graphicView->preview.addEntity(new Line(&(graphicView->preview),
+ LineData(Vector(v1.x, v1.y), Vector(v2.x, v1.y))));
+ graphicView->preview.addEntity(new Line(&(graphicView->preview),
+ LineData(Vector(v2.x, v1.y), Vector(v2.x, v2.y))));
+ graphicView->preview.addEntity(new Line(&(graphicView->preview),
+ LineData(Vector(v2.x, v2.y), Vector(v1.x, v2.y))));
+ graphicView->preview.addEntity(new Line(&(graphicView->preview),
+ LineData(Vector(v1.x, v2.y), Vector(v1.x, v1.y))));
graphicView->preview.SetVisible();
graphicView->redraw();
// deleteSnapper();
// deletePreview();
// clearPreview();
- RS_Modification m(*container, graphicView);
- RS_MoveData data;
+ Modification m(*container, graphicView);
+ MoveData data;
data.number = 0;
data.useCurrentLayer = false;
data.useCurrentAttributes = false;
data.offset = v2 - v1;
m.move(data);
setStatus(Neutral);
- RS_DIALOGFACTORY->updateSelectionWidget(container->countSelected());
- RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarMain);
+ DIALOGFACTORY->updateSelectionWidget(container->countSelected());
+ DIALOGFACTORY->requestToolBar(RS2::ToolBarMain);
}
break;
// deleteSnapper();
// deletePreview();
// clearPreview();
- RS_Modification m(*container, graphicView);
- RS_MoveRefData data;
+ Modification m(*container, graphicView);
+ MoveRefData data;
data.ref = v1;
data.offset = v2 - v1;
m.moveRef(data);
setStatus(Neutral);
- RS_DIALOGFACTORY->updateSelectionWidget(container->countSelected());
- RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarMain);
+ DIALOGFACTORY->updateSelectionWidget(container->countSelected());
+ DIALOGFACTORY->requestToolBar(RS2::ToolBarMain);
}
break;
void ActionDefault::mouseReleaseEvent(QMouseEvent * e)
{
- RS_DEBUG->print("ActionDefault::mouseReleaseEvent()");
+ DEBUG->print("ActionDefault::mouseReleaseEvent()");
if (e->button() == Qt::LeftButton)
{
case Dragging:
{
// select single entity:
- RS_Entity * en = graphicView->snapper.catchEntity(e);
+ Entity * en = graphicView->snapper.catchEntity(e);
if (en)
{
// deletePreview();
// clearPreview();
- RS_Selection s(*container, graphicView);
+ Selection s(*container, graphicView);
s.selectSingle(en);
- RS_DIALOGFACTORY->updateSelectionWidget(container->countSelected());
+ DIALOGFACTORY->updateSelectionWidget(container->countSelected());
e->accept();
setStatus(Neutral);
graphicView->preview.SetVisible(false);
bool cross = (v2.y > v1.y);
- RS_Selection s(*container, graphicView);
+ Selection s(*container, graphicView);
s.selectWindow(v1, v2, true, cross);
- RS_DIALOGFACTORY->updateSelectionWidget(container->countSelected());
+ DIALOGFACTORY->updateSelectionWidget(container->countSelected());
setStatus(Neutral);
e->accept();
// clearPreview();
// deleteSnapper();
setStatus(Neutral);
- RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarMain);
+ DIALOGFACTORY->requestToolBar(RS2::ToolBarMain);
e->accept();
break;
default:
graphicView->snapper.SetVisible(false);
graphicView->preview.SetVisible(false);
- RS_DIALOGFACTORY->requestPreviousMenu();
+ DIALOGFACTORY->requestPreviousMenu();
e->accept();
break;
}
}
}
-void ActionDefault::commandEvent(RS_CommandEvent * e)
+void ActionDefault::commandEvent(CommandEvent * e)
{
QString c = e->getCommand().toLower();
}
switch (getStatus())
{
case Neutral:
- RS_DIALOGFACTORY->updateMouseWidget("", "");
+ DIALOGFACTORY->updateMouseWidget("", "");
break;
case SetCorner2:
- RS_DIALOGFACTORY->updateMouseWidget(tr("Drag to second point"), tr("Back"));
+ DIALOGFACTORY->updateMouseWidget(tr("Drag to second point"), tr("Back"));
break;
default:
- RS_DIALOGFACTORY->updateMouseWidget("", "");
+ DIALOGFACTORY->updateMouseWidget("", "");
break;
}
}
case Moving:
case MovingRef:
- RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarSnap);
+ DIALOGFACTORY->requestToolBar(RS2::ToolBarSnap);
break;
default:
};
public:
- ActionDefault(RS_EntityContainer & container, GraphicView & graphicView);
+ ActionDefault(EntityContainer & container, GraphicView & graphicView);
virtual ~ActionDefault();
virtual RS2::ActionType rtti();
virtual void mouseMoveEvent(QMouseEvent * e);
virtual void mousePressEvent(QMouseEvent * e);
virtual void mouseReleaseEvent(QMouseEvent * e);
- virtual void commandEvent(RS_CommandEvent * e);
+ virtual void commandEvent(CommandEvent * e);
virtual QStringList getAvailableCommands();
virtual void updateMouseButtonHints();
virtual void updateMouseCursor();
#include "preview.h"
#include "snapper.h"
-ActionDimAligned::ActionDimAligned(RS_EntityContainer & container, GraphicView & graphicView): ActionDimension("Draw aligned dimensions",
+ActionDimAligned::ActionDimAligned(EntityContainer & container, GraphicView & graphicView): ActionDimension("Draw aligned dimensions",
container, graphicView)
{
reset();
void ActionDimAligned::reset()
{
ActionDimension::reset();
- edata = RS_DimAlignedData(Vector(false), Vector(false));
+ edata = DimAlignedData(Vector(false), Vector(false));
lastStatus = SetExtPoint1;
- if (RS_DIALOGFACTORY != NULL)
- RS_DIALOGFACTORY->requestOptions(this, true, true);
+ if (DIALOGFACTORY != NULL)
+ DIALOGFACTORY->requestOptions(this, true, true);
}
void ActionDimAligned::trigger()
graphicView->moveRelativeZero(data.definitionPoint);
//data.text = getText();
- RS_DimAligned * dim = new RS_DimAligned(container, data, edata);
+ DimAligned * dim = new DimAligned(container, data, edata);
dim->setLayerToActive();
dim->setPenToActive();
dim->update();
graphicView->moveRelativeZero(rz);
drawSnapper();
- RS_DEBUG->print("ActionDimAligned::trigger(): dim added: %d", dim->getId());
+ DEBUG->print("ActionDimAligned::trigger(): dim added: %d", dim->getId());
}
void ActionDimAligned::preparePreview()
{
Vector dirV;
dirV.setPolar(100.0, edata.extensionPoint1.angleTo(edata.extensionPoint2) + M_PI / 2.0);
- RS_ConstructionLine cl(NULL, RS_ConstructionLineData(edata.extensionPoint2,
+ ConstructionLine cl(NULL, ConstructionLineData(edata.extensionPoint2,
edata.extensionPoint2 + dirV));
data.definitionPoint = cl.getNearestPointOnEntity(data.definitionPoint);
}
void ActionDimAligned::mouseMoveEvent(QMouseEvent * e)
{
- RS_DEBUG->print("ActionDimAligned::mouseMoveEvent begin");
+ DEBUG->print("ActionDimAligned::mouseMoveEvent begin");
Vector mouse = snapPoint(e);
switch (getStatus())
{
deletePreview();
clearPreview();
-// preview->addEntity(new RS_Line(preview, RS_LineData(edata.extensionPoint1, mouse)));
+// preview->addEntity(new Line(preview, LineData(edata.extensionPoint1, mouse)));
drawPreview();
}
break;
preparePreview();
//data.text = getText();
-// RS_DimAligned * dim = new RS_DimAligned(preview, data, edata);
+// DimAligned * dim = new DimAligned(preview, data, edata);
// dim->update();
// preview->addEntity(dim);
drawPreview();
break;
}
- RS_DEBUG->print("ActionDimAligned::mouseMoveEvent end");
+ DEBUG->print("ActionDimAligned::mouseMoveEvent end");
}
void ActionDimAligned::mouseReleaseEvent(QMouseEvent * e)
}
}
-void ActionDimAligned::commandEvent(RS_CommandEvent * e)
+void ActionDimAligned::commandEvent(CommandEvent * e)
{
QString c = e->getCommand().toLower();
if (checkCommand("help", c))
{
- if (RS_DIALOGFACTORY != NULL)
- RS_DIALOGFACTORY->commandMessage(msgAvailableCommands()
+ if (DIALOGFACTORY != NULL)
+ DIALOGFACTORY->commandMessage(msgAvailableCommands()
+ getAvailableCommands().join(", "));
return;
case SetText:
setText(c);
- if (RS_DIALOGFACTORY != NULL)
- RS_DIALOGFACTORY->requestOptions(this, true, true);
+ if (DIALOGFACTORY != NULL)
+ DIALOGFACTORY->requestOptions(this, true, true);
setStatus(lastStatus);
graphicView->enableCoordinateInput();
void ActionDimAligned::updateMouseButtonHints()
{
- if (RS_DIALOGFACTORY != NULL)
+ if (DIALOGFACTORY != NULL)
{
switch (getStatus())
{
case SetExtPoint1:
- RS_DIALOGFACTORY->updateMouseWidget(tr("Specify first extension line origin"), tr("Cancel"));
+ DIALOGFACTORY->updateMouseWidget(tr("Specify first extension line origin"), tr("Cancel"));
break;
case SetExtPoint2:
- RS_DIALOGFACTORY->updateMouseWidget(tr("Specify second extension line origin"), tr("Back"));
+ DIALOGFACTORY->updateMouseWidget(tr("Specify second extension line origin"), tr("Back"));
break;
case SetDefPoint:
- RS_DIALOGFACTORY->updateMouseWidget(tr("Specify dimension line location"), tr("Back"));
+ DIALOGFACTORY->updateMouseWidget(tr("Specify dimension line location"), tr("Back"));
break;
case SetText:
- RS_DIALOGFACTORY->updateMouseWidget(tr("Enter dimension text:"), "");
+ DIALOGFACTORY->updateMouseWidget(tr("Enter dimension text:"), "");
break;
default:
- RS_DIALOGFACTORY->updateMouseWidget("", "");
+ DIALOGFACTORY->updateMouseWidget("", "");
break;
}
}
void ActionDimAligned::hideOptions()
{
- if (RS_DIALOGFACTORY != NULL)
- RS_DIALOGFACTORY->requestOptions(this, false);
+ if (DIALOGFACTORY != NULL)
+ DIALOGFACTORY->requestOptions(this, false);
ActionDimension::hideOptions();
}
{
ActionDimension::showOptions();
- if (RS_DIALOGFACTORY != NULL)
- RS_DIALOGFACTORY->requestOptions(this, true);
+ if (DIALOGFACTORY != NULL)
+ DIALOGFACTORY->requestOptions(this, true);
}
};
public:
- ActionDimAligned(RS_EntityContainer & container, GraphicView & graphicView);
+ ActionDimAligned(EntityContainer & container, GraphicView & graphicView);
~ActionDimAligned();
virtual RS2::ActionType rtti();
virtual void mouseMoveEvent(QMouseEvent * e);
virtual void mouseReleaseEvent(QMouseEvent * e);
virtual void coordinateEvent(Vector * e);
- virtual void commandEvent(RS_CommandEvent * e);
+ virtual void commandEvent(CommandEvent * e);
virtual QStringList getAvailableCommands();
virtual void hideOptions();
virtual void showOptions();
/**
* Aligned dimension data.
*/
- RS_DimAlignedData edata;
+ DimAlignedData edata;
/** Last status before entering text. */
Status lastStatus;
#include "information.h"
#include "preview.h"
-ActionDimAngular::ActionDimAngular(RS_EntityContainer & container, GraphicView & graphicView): ActionDimension("Draw Angular Dimensions",
+ActionDimAngular::ActionDimAngular(EntityContainer & container, GraphicView & graphicView): ActionDimension("Draw Angular Dimensions",
container, graphicView)
{
reset();
void ActionDimAngular::reset()
{
ActionDimension::reset();
- edata = RS_DimAngularData(Vector(false), Vector(false), Vector(false), Vector(false));
+ edata = DimAngularData(Vector(false), Vector(false), Vector(false), Vector(false));
line1 = NULL;
line2 = NULL;
center = Vector(false);
- RS_DIALOGFACTORY->requestOptions(this, true, true);
+ DIALOGFACTORY->requestOptions(this, true, true);
}
void ActionDimAngular::trigger()
if (line1 != NULL && line2 != NULL)
{
- RS_DimAngular * newEntity = NULL;
+ DimAngular * newEntity = NULL;
- newEntity = new RS_DimAngular(container,
+ newEntity = new DimAngular(container,
data,
edata);
graphicView->moveRelativeZero(rz);
}
else
- RS_DEBUG->print("ActionDimAngular::trigger:"
+ DEBUG->print("ActionDimAngular::trigger:"
" Entity is NULL\n");
}
void ActionDimAngular::mouseMoveEvent(QMouseEvent * e)
{
- RS_DEBUG->print("ActionDimAngular::mouseMoveEvent begin");
+ DEBUG->print("ActionDimAngular::mouseMoveEvent begin");
Vector mouse(graphicView->toGraphX(e->x()), graphicView->toGraphY(e->y()));
Vector mouse = snapPoint(e);
edata.definitionPoint4 = mouse;
-// RS_DimAngular * d = new RS_DimAngular(preview, data, edata);
+// DimAngular * d = new DimAngular(preview, data, edata);
// d->update();
//
// deletePreview();
break;
}
- RS_DEBUG->print("ActionDimAngular::mouseMoveEvent end");
+ DEBUG->print("ActionDimAngular::mouseMoveEvent end");
}
void ActionDimAngular::mouseReleaseEvent(QMouseEvent * e)
{
case SetLine1:
{
- RS_Entity * en = catchEntity(e, RS2::ResolveAll);
+ Entity * en = catchEntity(e, RS2::ResolveAll);
if (en != NULL
&& en->rtti() == RS2::EntityLine)
{
- line1 = (RS_Line *)en;
+ line1 = (Line *)en;
setStatus(SetLine2);
}
}
case SetLine2:
{
- RS_Entity * en = catchEntity(e, RS2::ResolveAll);
+ Entity * en = catchEntity(e, RS2::ResolveAll);
if (en != NULL
&& en->rtti() == RS2::EntityLine)
{
- line2 = (RS_Line *)en;
+ line2 = (Line *)en;
VectorSolutions sol =
- RS_Information::getIntersectionLineLine(line1, line2);
+ Information::getIntersectionLineLine(line1, line2);
if (sol.get(0).valid)
{
}
}
-void ActionDimAngular::commandEvent(RS_CommandEvent * e)
+void ActionDimAngular::commandEvent(CommandEvent * e)
{
QString c = e->getCommand().toLower();
if (checkCommand("help", c))
{
- RS_DIALOGFACTORY->commandMessage(msgAvailableCommands()
+ DIALOGFACTORY->commandMessage(msgAvailableCommands()
+ getAvailableCommands().join(", "));
return;
}
if (getStatus() == SetText)
{
setText(c);
- RS_DIALOGFACTORY->requestOptions(this, true, true);
+ DIALOGFACTORY->requestOptions(this, true, true);
graphicView->enableCoordinateInput();
setStatus(lastStatus);
return;
{
ActionInterface::showOptions();
- RS_DIALOGFACTORY->requestOptions(this, true);
+ DIALOGFACTORY->requestOptions(this, true);
}
void ActionDimAngular::hideOptions()
{
ActionInterface::hideOptions();
- RS_DIALOGFACTORY->requestOptions(this, false);
+ DIALOGFACTORY->requestOptions(this, false);
}
void ActionDimAngular::updateMouseButtonHints()
switch (getStatus())
{
case SetLine1:
- RS_DIALOGFACTORY->updateMouseWidget(tr("Select first line"),
+ DIALOGFACTORY->updateMouseWidget(tr("Select first line"),
tr("Cancel"));
break;
case SetLine2:
- RS_DIALOGFACTORY->updateMouseWidget(tr("Select second line"),
+ DIALOGFACTORY->updateMouseWidget(tr("Select second line"),
tr("Cancel"));
break;
case SetPos:
- RS_DIALOGFACTORY->updateMouseWidget(
+ DIALOGFACTORY->updateMouseWidget(
tr("Specify dimension arc line location"), tr("Cancel"));
break;
case SetText:
- RS_DIALOGFACTORY->updateMouseWidget(tr("Enter dimension text:"), "");
+ DIALOGFACTORY->updateMouseWidget(tr("Enter dimension text:"), "");
break;
default:
- RS_DIALOGFACTORY->updateMouseWidget("", "");
+ DIALOGFACTORY->updateMouseWidget("", "");
break;
}
}
#include "dimangular.h"
#include "vector.h"
-class RS_Line;
+class Line;
/**
* This action class can handle user events to draw angular dimensions.
};
public:
- ActionDimAngular(RS_EntityContainer & container, GraphicView & graphicView);
+ ActionDimAngular(EntityContainer & container, GraphicView & graphicView);
~ActionDimAngular();
virtual RS2::ActionType rtti();
virtual void mouseMoveEvent(QMouseEvent * e);
virtual void mouseReleaseEvent(QMouseEvent * e);
virtual void coordinateEvent(Vector * e);
- virtual void commandEvent(RS_CommandEvent * e);
+ virtual void commandEvent(CommandEvent * e);
virtual QStringList getAvailableCommands();
virtual void hideOptions();
virtual void showOptions();
private:
/** 1st chosen line */
- RS_Line * line1;
+ Line * line1;
/** 2nd chosen line */
- RS_Line * line2;
+ Line * line2;
/** Center of arc */
Vector center;
/** Data of new dimension */
- RS_DimAngularData edata;
+ DimAngularData edata;
/** Last status before entering text. */
Status lastStatus;
};
#include "graphicview.h"
#include "preview.h"
-ActionDimDiametric::ActionDimDiametric(RS_EntityContainer & container,
+ActionDimDiametric::ActionDimDiametric(EntityContainer & container,
GraphicView & graphicView): ActionDimension("Draw Diametric Dimensions",
container, graphicView)
{
void ActionDimDiametric::reset()
{
ActionDimension::reset();
- edata = RS_DimDiametricData(Vector(false), 0.0);
+ edata = DimDiametricData(Vector(false), 0.0);
entity = NULL;
pos = Vector(false);
- RS_DIALOGFACTORY->requestOptions(this, true, true);
+ DIALOGFACTORY->requestOptions(this, true, true);
}
void ActionDimDiametric::trigger()
if (entity)
{
- RS_DimDiametric * newEntity = NULL;
+ DimDiametric * newEntity = NULL;
- newEntity = new RS_DimDiametric(container,
+ newEntity = new DimDiametric(container,
data,
edata);
graphicView->moveRelativeZero(rz);
}
else
- RS_DEBUG->print("ActionDimDiametric::trigger: Entity is NULL\n");
+ DEBUG->print("ActionDimDiametric::trigger: Entity is NULL\n");
}
void ActionDimDiametric::preparePreview()
if (entity->rtti() == RS2::EntityArc)
{
- radius = ((RS_Arc *)entity)->getRadius();
- center = ((RS_Arc *)entity)->getCenter();
+ radius = ((Arc *)entity)->getRadius();
+ center = ((Arc *)entity)->getCenter();
}
else if (entity->rtti() == RS2::EntityCircle)
{
- radius = ((RS_Circle *)entity)->getRadius();
- center = ((RS_Circle *)entity)->getCenter();
+ radius = ((Circle *)entity)->getRadius();
+ center = ((Circle *)entity)->getCenter();
}
double angle = center.angleTo(pos);
void ActionDimDiametric::mouseMoveEvent(QMouseEvent * e)
{
- RS_DEBUG->print("ActionDimDiametric::mouseMoveEvent begin");
+ DEBUG->print("ActionDimDiametric::mouseMoveEvent begin");
Vector mouse(graphicView->toGraphX(e->x()), graphicView->toGraphY(e->y()));
pos = snapPoint(e);
preparePreview();
-// RS_DimDiametric * d = new RS_DimDiametric(preview, data, edata);
+// DimDiametric * d = new DimDiametric(preview, data, edata);
// d->update();
//
// deletePreview();
break;
}
- RS_DEBUG->print("ActionDimDiametric::mouseMoveEvent end");
+ DEBUG->print("ActionDimDiametric::mouseMoveEvent end");
}
void ActionDimDiametric::mouseReleaseEvent(QMouseEvent * e)
switch (getStatus())
{
case SetEntity: {
- RS_Entity * en = catchEntity(e, RS2::ResolveAll);
+ Entity * en = catchEntity(e, RS2::ResolveAll);
if (en != NULL)
{
if (entity->rtti() == RS2::EntityArc)
center =
- ((RS_Arc *)entity)->getCenter();
+ ((Arc *)entity)->getCenter();
else if (entity->rtti() == RS2::EntityCircle)
center =
- ((RS_Circle *)entity)->getCenter();
+ ((Circle *)entity)->getCenter();
graphicView->moveRelativeZero(center);
setStatus(SetPos);
}
else
- RS_DIALOGFACTORY->commandMessage(tr("Not a circle "
+ DIALOGFACTORY->commandMessage(tr("Not a circle "
"or arc entity"));
}
}
}
}
-void ActionDimDiametric::commandEvent(RS_CommandEvent * e)
+void ActionDimDiametric::commandEvent(CommandEvent * e)
{
QString c = e->getCommand().toLower();
if (checkCommand("help", c))
{
- RS_DIALOGFACTORY->commandMessage(msgAvailableCommands()
+ DIALOGFACTORY->commandMessage(msgAvailableCommands()
+ getAvailableCommands().join(", "));
return;
}
if (getStatus() == SetText)
{
setText(c);
- RS_DIALOGFACTORY->requestOptions(this, true, true);
+ DIALOGFACTORY->requestOptions(this, true, true);
graphicView->enableCoordinateInput();
setStatus(lastStatus);
return;
if (getStatus() == SetPos)
{
bool ok;
- double a = RS_Math::eval(c, &ok);
+ double a = Math::eval(c, &ok);
if (ok == true)
{
- pos.setPolar(1.0, RS_Math::deg2rad(a));
+ pos.setPolar(1.0, Math::deg2rad(a));
pos += data.definitionPoint;
trigger();
reset();
setStatus(SetEntity);
}
else
- RS_DIALOGFACTORY->commandMessage(tr("Not a valid expression"));
+ DIALOGFACTORY->commandMessage(tr("Not a valid expression"));
return;
}
}
switch (getStatus())
{
case SetEntity:
- RS_DIALOGFACTORY->updateMouseWidget(tr("Select arc or circle entity"),
+ DIALOGFACTORY->updateMouseWidget(tr("Select arc or circle entity"),
tr("Cancel"));
break;
case SetPos:
- RS_DIALOGFACTORY->updateMouseWidget(
+ DIALOGFACTORY->updateMouseWidget(
tr("Specify dimension line location"), tr("Cancel"));
break;
case SetText:
- RS_DIALOGFACTORY->updateMouseWidget(tr("Enter dimension text:"), "");
+ DIALOGFACTORY->updateMouseWidget(tr("Enter dimension text:"), "");
break;
default:
- RS_DIALOGFACTORY->updateMouseWidget("", "");
+ DIALOGFACTORY->updateMouseWidget("", "");
break;
}
}
{
ActionInterface::showOptions();
- RS_DIALOGFACTORY->requestOptions(this, true);
+ DIALOGFACTORY->requestOptions(this, true);
}
void ActionDimDiametric::hideOptions()
{
ActionInterface::hideOptions();
- //RS_DIALOGFACTORY->requestDimDiametricOptions(edata, false);
- RS_DIALOGFACTORY->requestOptions(this, false);
+ //DIALOGFACTORY->requestDimDiametricOptions(edata, false);
+ DIALOGFACTORY->requestOptions(this, false);
}
#include "dimdiametric.h"
#include "vector.h"
-class RS_Entity;
+class Entity;
/**
* This action class can handle user events to draw diametric dimensions.
};
public:
- ActionDimDiametric(RS_EntityContainer & container, GraphicView & graphicView);
+ ActionDimDiametric(EntityContainer & container, GraphicView & graphicView);
~ActionDimDiametric();
virtual RS2::ActionType rtti();
virtual void mouseMoveEvent(QMouseEvent * e);
virtual void mouseReleaseEvent(QMouseEvent * e);
virtual void coordinateEvent(Vector * e);
- virtual void commandEvent(RS_CommandEvent * e);
+ virtual void commandEvent(CommandEvent * e);
virtual QStringList getAvailableCommands();
virtual void hideOptions();
virtual void showOptions();
private:
/** Chosen entity (arc / circle) */
- RS_Entity * entity;
+ Entity * entity;
/** Chosen position */
Vector pos;
/** Data of new dimension */
- RS_DimDiametricData edata;
+ DimDiametricData edata;
/** Last status before entering text. */
Status lastStatus;
};
#include "dialogfactory.h"
#include "graphicview.h"
-ActionDimension::ActionDimension(const char * name, RS_EntityContainer & container, GraphicView & graphicView):
+ActionDimension::ActionDimension(const char * name, EntityContainer & container, GraphicView & graphicView):
ActionInterface(name, container, graphicView)
{
reset();
void ActionDimension::reset()
{
- data = RS_DimensionData(Vector(false), Vector(false), RS2::VAlignMiddle,
+ data = DimensionData(Vector(false), Vector(false), RS2::VAlignMiddle,
RS2::HAlignCenter, RS2::Exact, 1.0, "", "Standard", 0.0);
diameter = false;
}
{
ActionInterface::hideOptions();
- if (RS_DIALOGFACTORY)
- RS_DIALOGFACTORY->requestOptions(this, false);
+ if (DIALOGFACTORY)
+ DIALOGFACTORY->requestOptions(this, false);
}
void ActionDimension::showOptions()
{
ActionInterface::showOptions();
- if (RS_DIALOGFACTORY)
- RS_DIALOGFACTORY->requestOptions(this, true, true);
+ if (DIALOGFACTORY)
+ DIALOGFACTORY->requestOptions(this, true, true);
}
void ActionDimension::updateMouseCursor()
void ActionDimension::updateToolBar()
{
- if (!RS_DIALOGFACTORY)
+ if (!DIALOGFACTORY)
return;
if (!isFinished())
- RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarSnap);
+ DIALOGFACTORY->requestToolBar(RS2::ToolBarSnap);
else
- RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarDim);
+ DIALOGFACTORY->requestToolBar(RS2::ToolBarDim);
}
QString ActionDimension::getText()
class ActionDimension: public ActionInterface
{
public:
- ActionDimension(const char * name, RS_EntityContainer & container, GraphicView & graphicView);
+ ActionDimension(const char * name, EntityContainer & container, GraphicView & graphicView);
~ActionDimension();
virtual void reset();
/**
* Generic dimension data.
*/
- RS_DimensionData data;
+ DimensionData data;
QString label;
QString tol1;
#include "graphicview.h"
#include "preview.h"
-ActionDimLeader::ActionDimLeader(RS_EntityContainer & container, GraphicView & graphicView):
+ActionDimLeader::ActionDimLeader(EntityContainer & container, GraphicView & graphicView):
ActionInterface("Draw leaders", container, graphicView)
{
reset();
void ActionDimLeader::reset()
{
- //data = RS_LineData(Vector(false), Vector(false));
+ //data = LineData(Vector(false), Vector(false));
//start = Vector(false);
//history.clear();
points.clear();
if (points.count() > 0)
{
- RS_Leader * leader = new RS_Leader(container, RS_LeaderData(true));
+ Leader * leader = new Leader(container, LeaderData(true));
leader->setLayerToActive();
leader->setPenToActive();
graphicView->moveRelativeZero(rz);
//drawSnapper();
- RS_DEBUG->print("ActionDimLeader::trigger(): leader added: %d", leader->getId());
+ DEBUG->print("ActionDimLeader::trigger(): leader added: %d", leader->getId());
}
}
void ActionDimLeader::mouseMoveEvent(QMouseEvent * e)
{
- RS_DEBUG->print("ActionDimLeader::mouseMoveEvent begin");
+ DEBUG->print("ActionDimLeader::mouseMoveEvent begin");
Vector mouse = snapPoint(e);
Vector * v = points[i];
// if (last.valid)
-// preview->addEntity(new RS_Line(preview, RS_LineData(last, *v)));
+// preview->addEntity(new Line(preview, LineData(last, *v)));
last = *v;
}
Vector p = *points.last();
-// preview->addEntity(new RS_Line(preview, RS_LineData(p, mouse)));
+// preview->addEntity(new Line(preview, LineData(p, mouse)));
drawPreview();
}
- RS_DEBUG->print("ActionDimLeader::mouseMoveEvent end");
+ DEBUG->print("ActionDimLeader::mouseMoveEvent end");
}
void ActionDimLeader::mouseReleaseEvent(QMouseEvent * e)
}
}
-void ActionDimLeader::commandEvent(RS_CommandEvent * e)
+void ActionDimLeader::commandEvent(CommandEvent * e)
{
QString c = e->getCommand().toLower();
if (checkCommand("help", c))
{
- if (RS_DIALOGFACTORY != NULL)
- RS_DIALOGFACTORY->commandMessage(msgAvailableCommands()
+ if (DIALOGFACTORY != NULL)
+ DIALOGFACTORY->commandMessage(msgAvailableCommands()
+ getAvailableCommands().join(", "));
return;
void ActionDimLeader::updateMouseButtonHints()
{
- if (RS_DIALOGFACTORY != NULL)
+ if (DIALOGFACTORY != NULL)
{
switch (getStatus())
{
case SetStartpoint:
- RS_DIALOGFACTORY->updateMouseWidget(tr("Specify target point"), tr("Cancel"));
+ DIALOGFACTORY->updateMouseWidget(tr("Specify target point"), tr("Cancel"));
break;
case SetEndpoint:
- RS_DIALOGFACTORY->updateMouseWidget(tr("Specify next point"), tr("Finish"));
+ DIALOGFACTORY->updateMouseWidget(tr("Specify next point"), tr("Finish"));
break;
default:
- RS_DIALOGFACTORY->updateMouseWidget("", "");
+ DIALOGFACTORY->updateMouseWidget("", "");
break;
}
}
void ActionDimLeader::updateToolBar()
{
- if (RS_DIALOGFACTORY)
+ if (DIALOGFACTORY)
{
if (!isFinished())
- RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarSnap);
+ DIALOGFACTORY->requestToolBar(RS2::ToolBarSnap);
else
- RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarDim);
+ DIALOGFACTORY->requestToolBar(RS2::ToolBarDim);
}
}
};
public:
- ActionDimLeader(RS_EntityContainer & container, GraphicView & graphicView);
+ ActionDimLeader(EntityContainer & container, GraphicView & graphicView);
~ActionDimLeader();
virtual RS2::ActionType rtti();
virtual void mouseReleaseEvent(QMouseEvent * e);
virtual void keyPressEvent(QKeyEvent *);
virtual void coordinateEvent(Vector * e);
- virtual void commandEvent(RS_CommandEvent * e);
+ virtual void commandEvent(CommandEvent * e);
virtual QStringList getAvailableCommands();
virtual void showOptions();
virtual void hideOptions();
/**
* Leader entity.
*/
- RS_Leader * leader;
+ Leader * leader;
/**
* Points set so far.
*/
* @param fixedAngle true: The user can't change the angle.
* false: The user can change the angle in a option widget.
*/
-ActionDimLinear::ActionDimLinear(RS_EntityContainer & container,
+ActionDimLinear::ActionDimLinear(EntityContainer & container,
GraphicView & graphicView, double angle, bool fixedAngle):
ActionDimension("Draw linear dimensions", container, graphicView)
{
void ActionDimLinear::reset()
{
ActionDimension::reset();
- edata = RS_DimLinearData(Vector(false), Vector(false), (fixedAngle ? edata.angle : 0.0), 0.0);
+ edata = DimLinearData(Vector(false), Vector(false), (fixedAngle ? edata.angle : 0.0), 0.0);
- if (RS_DIALOGFACTORY)
- RS_DIALOGFACTORY->requestOptions(this, true, true);
+ if (DIALOGFACTORY)
+ DIALOGFACTORY->requestOptions(this, true, true);
}
void ActionDimLinear::trigger()
{
ActionDimension::trigger();
preparePreview();
- RS_DimLinear * dim = new RS_DimLinear(container, data, edata);
+ DimLinear * dim = new DimLinear(container, data, edata);
dim->setLayerToActive();
dim->setPenToActive();
dim->update();
graphicView->snapper.SetVisible(false);
graphicView->redraw();
- RS_DEBUG->print("ActionDimLinear::trigger(): dim added: %d", dim->getId());
+ DEBUG->print("ActionDimLinear::trigger(): dim added: %d", dim->getId());
}
void ActionDimLinear::preparePreview()
Vector dirV;
dirV.setPolar(100.0, edata.angle + M_PI / 2.0);
- RS_ConstructionLine cl(NULL, RS_ConstructionLineData(edata.extensionPoint2,
+ ConstructionLine cl(NULL, ConstructionLineData(edata.extensionPoint2,
edata.extensionPoint2 + dirV));
data.definitionPoint = cl.getNearestPointOnEntity(data.definitionPoint);
void ActionDimLinear::mouseMoveEvent(QMouseEvent * e)
{
- RS_DEBUG->print("ActionDimLinear::mouseMoveEvent begin");
+ DEBUG->print("ActionDimLinear::mouseMoveEvent begin");
Vector mouse = snapPoint(e);
{
// deletePreview();
// clearPreview();
-// preview->addEntity(new RS_Line(preview,
-// RS_LineData(edata.extensionPoint1, mouse)));
+// preview->addEntity(new Line(preview,
+// LineData(edata.extensionPoint1, mouse)));
// drawPreview();
graphicView->preview.clear();
- graphicView->preview.addEntity(new RS_Line(&(graphicView->preview),
- RS_LineData(edata.extensionPoint1, mouse)));
+ graphicView->preview.addEntity(new Line(&(graphicView->preview),
+ LineData(edata.extensionPoint1, mouse)));
graphicView->preview.SetVisible();
graphicView->redraw();
}
// clearPreview();
data.definitionPoint = mouse;
// preparePreview();
-// RS_DimLinear * dim = new RS_DimLinear(preview, data, edata);
+// DimLinear * dim = new DimLinear(preview, data, edata);
// dim->update();
// preview->addEntity(dim);
// drawPreview();
graphicView->preview.clear();
preparePreview();
- RS_DimLinear * dim = new RS_DimLinear(&(graphicView->preview), data, edata);
+ DimLinear * dim = new DimLinear(&(graphicView->preview), data, edata);
dim->update();
graphicView->preview.addEntity(dim);
graphicView->preview.SetVisible();
break;
}
- RS_DEBUG->print("ActionDimLinear::mouseMoveEvent end");
+ DEBUG->print("ActionDimLinear::mouseMoveEvent end");
}
void ActionDimLinear::mouseReleaseEvent(QMouseEvent * e)
}
}
-void ActionDimLinear::commandEvent(RS_CommandEvent * e)
+void ActionDimLinear::commandEvent(CommandEvent * e)
{
QString c = e->getCommand().toLower();
if (checkCommand("help", c))
{
- if (RS_DIALOGFACTORY)
- RS_DIALOGFACTORY->commandMessage(msgAvailableCommands()
+ if (DIALOGFACTORY)
+ DIALOGFACTORY->commandMessage(msgAvailableCommands()
+ getAvailableCommands().join(", "));
return;
}
case SetText:
setText(c);
- if (RS_DIALOGFACTORY)
- RS_DIALOGFACTORY->requestOptions(this, true, true);
+ if (DIALOGFACTORY)
+ DIALOGFACTORY->requestOptions(this, true, true);
graphicView->enableCoordinateInput();
setStatus(lastStatus);
case SetAngle:
{
bool ok;
- double a = RS_Math::eval(c, &ok);
+ double a = Math::eval(c, &ok);
if (ok)
- setAngle(RS_Math::deg2rad(a));
- else if (RS_DIALOGFACTORY)
- RS_DIALOGFACTORY->commandMessage(tr("Not a valid expression"));
+ setAngle(Math::deg2rad(a));
+ else if (DIALOGFACTORY)
+ DIALOGFACTORY->commandMessage(tr("Not a valid expression"));
- if (RS_DIALOGFACTORY)
- RS_DIALOGFACTORY->requestOptions(this, true, true);
+ if (DIALOGFACTORY)
+ DIALOGFACTORY->requestOptions(this, true, true);
setStatus(lastStatus);
}
void ActionDimLinear::updateMouseButtonHints()
{
- if (RS_DIALOGFACTORY)
+ if (DIALOGFACTORY)
{
switch (getStatus())
{
case SetExtPoint1:
- RS_DIALOGFACTORY->updateMouseWidget(
+ DIALOGFACTORY->updateMouseWidget(
tr("Specify first extension line origin"), tr("Cancel"));
break;
case SetExtPoint2:
- RS_DIALOGFACTORY->updateMouseWidget(
+ DIALOGFACTORY->updateMouseWidget(
tr("Specify second extension line origin"), tr("Back"));
break;
case SetDefPoint:
- RS_DIALOGFACTORY->updateMouseWidget(
+ DIALOGFACTORY->updateMouseWidget(
tr("Specify dimension line location"), tr("Back"));
break;
case SetText:
- RS_DIALOGFACTORY->updateMouseWidget(tr("Enter dimension text:"), "");
+ DIALOGFACTORY->updateMouseWidget(tr("Enter dimension text:"), "");
break;
case SetAngle:
- RS_DIALOGFACTORY->updateMouseWidget(tr("Enter dimension line angle:"), "");
+ DIALOGFACTORY->updateMouseWidget(tr("Enter dimension line angle:"), "");
break;
default:
- RS_DIALOGFACTORY->updateMouseWidget("", "");
+ DIALOGFACTORY->updateMouseWidget("", "");
break;
}
}
{
ActionInterface::showOptions();
- if (RS_DIALOGFACTORY)
- RS_DIALOGFACTORY->requestOptions(this, true, true);
+ if (DIALOGFACTORY)
+ DIALOGFACTORY->requestOptions(this, true, true);
}
void ActionDimLinear::hideOptions()
{
ActionInterface::hideOptions();
- if (RS_DIALOGFACTORY)
- RS_DIALOGFACTORY->requestOptions(this, false);
+ if (DIALOGFACTORY)
+ DIALOGFACTORY->requestOptions(this, false);
}
double ActionDimLinear::getAngle()
};
public:
- ActionDimLinear(RS_EntityContainer & container, GraphicView & graphicView,
+ ActionDimLinear(EntityContainer & container, GraphicView & graphicView,
double angle = 0.0, bool fixedAngle = false);
~ActionDimLinear();
virtual void mouseMoveEvent(QMouseEvent * e);
virtual void mouseReleaseEvent(QMouseEvent * e);
virtual void coordinateEvent(Vector * e);
- virtual void commandEvent(RS_CommandEvent * e);
+ virtual void commandEvent(CommandEvent * e);
virtual QStringList getAvailableCommands();
virtual void hideOptions();
virtual void showOptions();
/**
* Aligned dimension data.
*/
- RS_DimLinearData edata;
+ DimLinearData edata;
/**
* Is the angle fixed?
*/
#include "graphicview.h"
#include "preview.h"
-ActionDimRadial::ActionDimRadial(RS_EntityContainer & container, GraphicView & graphicView):
+ActionDimRadial::ActionDimRadial(EntityContainer & container, GraphicView & graphicView):
ActionDimension("Draw Radial Dimensions", container, graphicView)
{
reset();
{
ActionDimension::reset();
- edata = RS_DimRadialData(Vector(false), 0.0);
+ edata = DimRadialData(Vector(false), 0.0);
entity = NULL;
pos = Vector(false);
- RS_DIALOGFACTORY->requestOptions(this, true, true);
+ DIALOGFACTORY->requestOptions(this, true, true);
}
void ActionDimRadial::trigger()
if (entity)
{
- RS_DimRadial * newEntity = new RS_DimRadial(container, data, edata);
+ DimRadial * newEntity = new DimRadial(container, data, edata);
newEntity->setLayerToActive();
newEntity->setPenToActive();
newEntity->update();
//drawSnapper();
}
else
- RS_DEBUG->print("ActionDimRadial::trigger: Entity is NULL\n");
+ DEBUG->print("ActionDimRadial::trigger: Entity is NULL\n");
}
void ActionDimRadial::preparePreview()
double radius = 0.0;
if (entity->rtti() == RS2::EntityArc)
- radius = ((RS_Arc *)entity)->getRadius();
+ radius = ((Arc *)entity)->getRadius();
else if (entity->rtti() == RS2::EntityCircle)
- radius = ((RS_Circle *)entity)->getRadius();
+ radius = ((Circle *)entity)->getRadius();
edata.definitionPoint.setPolar(radius, angle);
edata.definitionPoint += data.definitionPoint;
void ActionDimRadial::mouseMoveEvent(QMouseEvent * e)
{
- RS_DEBUG->print("ActionDimRadial::mouseMoveEvent begin");
+ DEBUG->print("ActionDimRadial::mouseMoveEvent begin");
switch (getStatus())
{
preparePreview();
-// RS_DimRadial * d = new RS_DimRadial(preview, data, edata);
+// DimRadial * d = new DimRadial(preview, data, edata);
// d->update();
//
// deletePreview();
break;
}
- RS_DEBUG->print("ActionDimRadial::mouseMoveEvent end");
+ DEBUG->print("ActionDimRadial::mouseMoveEvent end");
}
void ActionDimRadial::mouseReleaseEvent(QMouseEvent * e)
switch (getStatus())
{
case SetEntity: {
- RS_Entity * en = catchEntity(e, RS2::ResolveAll);
+ Entity * en = catchEntity(e, RS2::ResolveAll);
if (en != NULL)
{
if (entity->rtti() == RS2::EntityArc)
data.definitionPoint =
- ((RS_Arc *)entity)->getCenter();
+ ((Arc *)entity)->getCenter();
else if (entity->rtti() == RS2::EntityCircle)
data.definitionPoint =
- ((RS_Circle *)entity)->getCenter();
+ ((Circle *)entity)->getCenter();
graphicView->moveRelativeZero(data.definitionPoint);
setStatus(SetPos);
}
else
- RS_DIALOGFACTORY->commandMessage(tr("Not a circle "
+ DIALOGFACTORY->commandMessage(tr("Not a circle "
"or arc entity"));
}
}
}
}
-void ActionDimRadial::commandEvent(RS_CommandEvent * e)
+void ActionDimRadial::commandEvent(CommandEvent * e)
{
QString c = e->getCommand().toLower();
if (checkCommand("help", c))
{
- RS_DIALOGFACTORY->commandMessage(msgAvailableCommands()
+ DIALOGFACTORY->commandMessage(msgAvailableCommands()
+ getAvailableCommands().join(", "));
return;
}
if (getStatus() == SetText)
{
setText(c);
- RS_DIALOGFACTORY->requestOptions(this, true, true);
+ DIALOGFACTORY->requestOptions(this, true, true);
graphicView->enableCoordinateInput();
setStatus(lastStatus);
return;
if (getStatus() == SetPos)
{
bool ok;
- double a = RS_Math::eval(c, &ok);
+ double a = Math::eval(c, &ok);
if (ok == true)
{
- pos.setPolar(1.0, RS_Math::deg2rad(a));
+ pos.setPolar(1.0, Math::deg2rad(a));
pos += data.definitionPoint;
trigger();
reset();
setStatus(SetEntity);
}
else
- RS_DIALOGFACTORY->commandMessage(tr("Not a valid expression"));
+ DIALOGFACTORY->commandMessage(tr("Not a valid expression"));
return;
}
switch (getStatus())
{
case SetEntity:
- RS_DIALOGFACTORY->updateMouseWidget(tr("Select arc or circle entity"),
+ DIALOGFACTORY->updateMouseWidget(tr("Select arc or circle entity"),
tr("Cancel"));
break;
case SetPos:
- RS_DIALOGFACTORY->updateMouseWidget(
+ DIALOGFACTORY->updateMouseWidget(
tr("Specify dimension line position or enter angle:"),
tr("Cancel"));
break;
case SetText:
- RS_DIALOGFACTORY->updateMouseWidget(tr("Enter dimension text:"), "");
+ DIALOGFACTORY->updateMouseWidget(tr("Enter dimension text:"), "");
break;
default:
- RS_DIALOGFACTORY->updateMouseWidget("", "");
+ DIALOGFACTORY->updateMouseWidget("", "");
break;
}
}
{
ActionInterface::showOptions();
- RS_DIALOGFACTORY->requestOptions(this, true);
- //RS_DIALOGFACTORY->requestDimRadialOptions(edata, true);
+ DIALOGFACTORY->requestOptions(this, true);
+ //DIALOGFACTORY->requestDimRadialOptions(edata, true);
}
void ActionDimRadial::hideOptions()
{
ActionInterface::hideOptions();
- //RS_DIALOGFACTORY->requestDimRadialOptions(edata, false);
- RS_DIALOGFACTORY->requestOptions(this, false);
+ //DIALOGFACTORY->requestDimRadialOptions(edata, false);
+ DIALOGFACTORY->requestOptions(this, false);
}
#include "dimradial.h"
#include "vector.h"
-class RS_Entity;
+class Entity;
/**
* This action class can handle user events to draw radial dimensions.
};
public:
- ActionDimRadial(RS_EntityContainer & container, GraphicView & graphicView);
+ ActionDimRadial(EntityContainer & container, GraphicView & graphicView);
~ActionDimRadial();
virtual RS2::ActionType rtti();
virtual void mouseMoveEvent(QMouseEvent * e);
virtual void mouseReleaseEvent(QMouseEvent * e);
virtual void coordinateEvent(Vector * e);
- virtual void commandEvent(RS_CommandEvent * e);
+ virtual void commandEvent(CommandEvent * e);
virtual QStringList getAvailableCommands();
virtual void hideOptions();
virtual void showOptions();
private:
/** Chosen entity (arc / circle) */
- RS_Entity * entity;
+ Entity * entity;
/** Chosen position */
Vector pos;
/** Data of new dimension */
- RS_DimRadialData edata;
+ DimRadialData edata;
/** Last status before entering text. */
Status lastStatus;
};
#include "graphicview.h"
#include "preview.h"
-ActionDrawArc::ActionDrawArc(RS_EntityContainer & container, GraphicView & graphicView):
+ActionDrawArc::ActionDrawArc(EntityContainer & container, GraphicView & graphicView):
ActionInterface("Draw arcs", container, graphicView)
{
reset();
void ActionDrawArc::reset()
{
if (data.reversed)
- data = RS_ArcData(Vector(false), 0.0, 2 * M_PI, 0.0, true);
+ data = ArcData(Vector(false), 0.0, 2 * M_PI, 0.0, true);
else
- data = RS_ArcData(Vector(false), 0.0, 0.0, 2 * M_PI, false);
+ data = ArcData(Vector(false), 0.0, 0.0, 2 * M_PI, false);
}
void ActionDrawArc::init(int status)
{
ActionInterface::trigger();
- RS_Arc * arc = new RS_Arc(container, data);
+ Arc * arc = new Arc(container, data);
arc->setLayerToActive();
arc->setPenToActive();
container->addEntity(arc);
setStatus(SetCenter);
reset();
- RS_DEBUG->print("ActionDrawArc::trigger(): arc added: %d", arc->getId());
+ DEBUG->print("ActionDrawArc::trigger(): arc added: %d", arc->getId());
}
void ActionDrawArc::mouseMoveEvent(QMouseEvent * e)
{
- RS_DEBUG->print("ActionDrawArc::mouseMoveEvent begin");
+ DEBUG->print("ActionDrawArc::mouseMoveEvent begin");
Vector mouse = snapPoint(e);
switch (getStatus())
data.radius = data.center.distanceTo(mouse);
deletePreview();
clearPreview();
-// preview->addEntity(new RS_Circle(preview, RS_CircleData(data.center, data.radius)));
+// preview->addEntity(new Circle(preview, CircleData(data.center, data.radius)));
drawPreview();
}
break;
data.angle1 = data.center.angleTo(mouse);
if (data.reversed)
- data.angle2 = RS_Math::correctAngle(data.angle1 - M_PI / 3);
+ data.angle2 = Math::correctAngle(data.angle1 - M_PI / 3);
else
- data.angle2 = RS_Math::correctAngle(data.angle1 + M_PI / 3);
+ data.angle2 = Math::correctAngle(data.angle1 + M_PI / 3);
deletePreview();
clearPreview();
-// preview->addEntity(new RS_Arc(preview, data));
+// preview->addEntity(new Arc(preview, data));
drawPreview();
break;
data.angle2 = data.center.angleTo(mouse);
deletePreview();
clearPreview();
-// preview->addEntity(new RS_Arc(preview, data));
+// preview->addEntity(new Arc(preview, data));
drawPreview();
break;
data.angle2 = data.angle1 + data.center.angleTo(mouse);
deletePreview();
clearPreview();
-// preview->addEntity(new RS_Arc(preview, data));
+// preview->addEntity(new Arc(preview, data));
drawPreview();
break;
data.angle2 = data.angle1 + asin(x / (2 * data.radius)) * 2;
deletePreview();
clearPreview();
-// preview->addEntity(new RS_Arc(preview, data));
+// preview->addEntity(new Arc(preview, data));
drawPreview();
}
}
break;
}
- RS_DEBUG->print("ActionDrawArc::mouseMoveEvent end");
+ DEBUG->print("ActionDrawArc::mouseMoveEvent end");
}
void ActionDrawArc::mouseReleaseEvent(QMouseEvent * e)
}
}
-void ActionDrawArc::commandEvent(RS_CommandEvent * e)
+void ActionDrawArc::commandEvent(CommandEvent * e)
{
QString c = e->getCommand().toLower();
- if (RS_COMMANDS->checkCommand("help", c))
+ if (COMMANDS->checkCommand("help", c))
{
- if (RS_DIALOGFACTORY != NULL)
- RS_DIALOGFACTORY->commandMessage(msgAvailableCommands()
+ if (DIALOGFACTORY != NULL)
+ DIALOGFACTORY->commandMessage(msgAvailableCommands()
+ getAvailableCommands().join(", "));
return;
}
- if (RS_COMMANDS->checkCommand("reversed", c))
+ if (COMMANDS->checkCommand("reversed", c))
{
e->accept();
setReversed(!isReversed());
- if (RS_DIALOGFACTORY != NULL)
- RS_DIALOGFACTORY->requestOptions(this, true, true);
+ if (DIALOGFACTORY != NULL)
+ DIALOGFACTORY->requestOptions(this, true, true);
return;
}
{
case SetRadius: {
bool ok;
- double r = RS_Math::eval(c, &ok);
+ double r = Math::eval(c, &ok);
if (ok == true)
{
data.radius = r;
setStatus(SetAngle1);
}
- else if (RS_DIALOGFACTORY != NULL)
- RS_DIALOGFACTORY->commandMessage(tr("Not a valid expression"));
+ else if (DIALOGFACTORY != NULL)
+ DIALOGFACTORY->commandMessage(tr("Not a valid expression"));
}
break;
case SetAngle1: {
bool ok;
- double a = RS_Math::eval(c, &ok);
+ double a = Math::eval(c, &ok);
if (ok == true)
{
- data.angle1 = RS_Math::deg2rad(a);
+ data.angle1 = Math::deg2rad(a);
setStatus(SetAngle2);
}
- else if (RS_DIALOGFACTORY != NULL)
- RS_DIALOGFACTORY->commandMessage(tr("Not a valid expression"));
+ else if (DIALOGFACTORY != NULL)
+ DIALOGFACTORY->commandMessage(tr("Not a valid expression"));
}
break;
case SetAngle2:
- if (RS_COMMANDS->checkCommand("angle", c))
+ if (COMMANDS->checkCommand("angle", c))
setStatus(SetIncAngle);
- else if (RS_COMMANDS->checkCommand("chord length", c))
+ else if (COMMANDS->checkCommand("chord length", c))
setStatus(SetChordLength);
else
{
bool ok;
- double a = RS_Math::eval(c, &ok);
+ double a = Math::eval(c, &ok);
if (ok == true)
{
- data.angle2 = RS_Math::deg2rad(a);
+ data.angle2 = Math::deg2rad(a);
trigger();
}
- else if (RS_DIALOGFACTORY != NULL)
- RS_DIALOGFACTORY->commandMessage(tr("Not a valid expression"));
+ else if (DIALOGFACTORY != NULL)
+ DIALOGFACTORY->commandMessage(tr("Not a valid expression"));
}
break;
case SetIncAngle: {
bool ok;
- double a = RS_Math::eval(c, &ok);
+ double a = Math::eval(c, &ok);
if (ok == true)
{
- data.angle2 = data.angle1 + RS_Math::deg2rad(a);
+ data.angle2 = data.angle1 + Math::deg2rad(a);
trigger();
}
- else if (RS_DIALOGFACTORY != NULL)
- RS_DIALOGFACTORY->commandMessage(tr("Not a valid expression"));
+ else if (DIALOGFACTORY != NULL)
+ DIALOGFACTORY->commandMessage(tr("Not a valid expression"));
}
break;
case SetChordLength: {
bool ok;
- double l = RS_Math::eval(c, &ok);
+ double l = Math::eval(c, &ok);
if (ok == true)
{
data.angle2 = data.angle1 + asin(l / (2 * data.radius)) * 2;
trigger();
}
- else if (RS_DIALOGFACTORY != NULL)
- RS_DIALOGFACTORY->commandMessage(
+ else if (DIALOGFACTORY != NULL)
+ DIALOGFACTORY->commandMessage(
tr("Not a valid chord length"));
}
- else if (RS_DIALOGFACTORY != NULL)
- RS_DIALOGFACTORY->commandMessage(tr("Not a valid expression"));
+ else if (DIALOGFACTORY != NULL)
+ DIALOGFACTORY->commandMessage(tr("Not a valid expression"));
}
break;
QStringList ActionDrawArc::getAvailableCommands()
{
QStringList cmd;
- cmd += RS_COMMANDS->command("reversed");
+ cmd += COMMANDS->command("reversed");
return cmd;
}
void ActionDrawArc::updateMouseButtonHints()
{
- if (RS_DIALOGFACTORY != NULL)
+ if (DIALOGFACTORY != NULL)
{
switch (getStatus())
{
case SetCenter:
- RS_DIALOGFACTORY->updateMouseWidget(tr("Specify center"), tr("Cancel"));
+ DIALOGFACTORY->updateMouseWidget(tr("Specify center"), tr("Cancel"));
break;
case SetRadius:
- RS_DIALOGFACTORY->updateMouseWidget(tr("Specify radius"), tr("Back"));
+ DIALOGFACTORY->updateMouseWidget(tr("Specify radius"), tr("Back"));
break;
case SetAngle1:
- RS_DIALOGFACTORY->updateMouseWidget(
+ DIALOGFACTORY->updateMouseWidget(
tr("Specify start angle:"), tr("Back"));
break;
case SetAngle2:
- RS_DIALOGFACTORY->updateMouseWidget(
+ DIALOGFACTORY->updateMouseWidget(
tr("Specify end angle or [Angle/chord Length]"),
tr("Back"));
break;
case SetIncAngle:
- RS_DIALOGFACTORY->updateMouseWidget(tr("Specify included angle:"),
+ DIALOGFACTORY->updateMouseWidget(tr("Specify included angle:"),
tr("Back"));
break;
case SetChordLength:
- RS_DIALOGFACTORY->updateMouseWidget(tr("Specify chord length:"),
+ DIALOGFACTORY->updateMouseWidget(tr("Specify chord length:"),
tr("Back"));
break;
default:
- RS_DIALOGFACTORY->updateMouseWidget("", "");
+ DIALOGFACTORY->updateMouseWidget("", "");
break;
}
}
{
ActionInterface::showOptions();
- if (RS_DIALOGFACTORY)
- RS_DIALOGFACTORY->requestOptions(this, true);
+ if (DIALOGFACTORY)
+ DIALOGFACTORY->requestOptions(this, true);
}
void ActionDrawArc::hideOptions()
{
ActionInterface::hideOptions();
- if (RS_DIALOGFACTORY)
- RS_DIALOGFACTORY->requestOptions(this, false);
+ if (DIALOGFACTORY)
+ DIALOGFACTORY->requestOptions(this, false);
}
void ActionDrawArc::updateMouseCursor()
void ActionDrawArc::updateToolBar()
{
- if (!RS_DIALOGFACTORY)
+ if (!DIALOGFACTORY)
return;
if (!isFinished())
- RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarSnap);
+ DIALOGFACTORY->requestToolBar(RS2::ToolBarSnap);
else
- RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarArcs);
+ DIALOGFACTORY->requestToolBar(RS2::ToolBarArcs);
}
bool ActionDrawArc::isReversed()
};
public:
- ActionDrawArc(RS_EntityContainer & container, GraphicView & graphicView);
+ ActionDrawArc(EntityContainer & container, GraphicView & graphicView);
~ActionDrawArc();
virtual RS2::ActionType rtti();
virtual void mouseMoveEvent(QMouseEvent * e);
virtual void mouseReleaseEvent(QMouseEvent * e);
virtual void coordinateEvent(Vector * e);
- virtual void commandEvent(RS_CommandEvent * e);
+ virtual void commandEvent(CommandEvent * e);
virtual QStringList getAvailableCommands();
virtual void hideOptions();
virtual void showOptions();
/**
* Arc data defined so far.
*/
- RS_ArcData data;
+ ArcData data;
};
#endif // __ACTIONDRAWARC_H__
#include "graphicview.h"
#include "preview.h"
-ActionDrawArc3P::ActionDrawArc3P(RS_EntityContainer & container, GraphicView & graphicView):
+ActionDrawArc3P::ActionDrawArc3P(EntityContainer & container, GraphicView & graphicView):
ActionInterface("Draw arcs 3P", container, graphicView)
{
reset();
if (data.isValid())
{
- RS_Arc * arc = new RS_Arc(container, data);
+ Arc * arc = new Arc(container, data);
arc->setLayerToActive();
arc->setPenToActive();
container->addEntity(arc);
reset();
}
else
- RS_DIALOGFACTORY->commandMessage(tr("Invalid arc data."));
+ DIALOGFACTORY->commandMessage(tr("Invalid arc data."));
}
void ActionDrawArc3P::preparePreview()
if (point1.valid && point2.valid && point3.valid)
{
- RS_Arc arc(NULL, data);
+ Arc arc(NULL, data);
bool suc = arc.createFrom3P(point1, point2, point3);
if (suc)
if (point1.valid)
{
-// RS_Line * line = new RS_Line(preview, RS_LineData(point1, point2));
+// Line * line = new Line(preview, LineData(point1, point2));
//
// deletePreview();
// clearPreview();
if (data.isValid())
{
-// RS_Arc * arc = new RS_Arc(preview, data);
+// Arc * arc = new Arc(preview, data);
//
// deletePreview();
// clearPreview();
}
}
-void ActionDrawArc3P::commandEvent(RS_CommandEvent * e)
+void ActionDrawArc3P::commandEvent(CommandEvent * e)
{
QString c = e->getCommand().toLower();
if (checkCommand("help", c))
{
- RS_DIALOGFACTORY->commandMessage(msgAvailableCommands()
+ DIALOGFACTORY->commandMessage(msgAvailableCommands()
+ getAvailableCommands().join(", "));
return;
}
- if (RS_COMMANDS->checkCommand("center", c, rtti()))
+ if (COMMANDS->checkCommand("center", c, rtti()))
{
finish();
graphicView->setCurrentAction(new ActionDrawArc(*container, *graphicView));
switch (getStatus())
{
case SetPoint1:
- RS_DIALOGFACTORY->updateMouseWidget(tr("Specify startpoint or [Center]"), tr("Cancel"));
+ DIALOGFACTORY->updateMouseWidget(tr("Specify startpoint or [Center]"), tr("Cancel"));
break;
case SetPoint2:
- RS_DIALOGFACTORY->updateMouseWidget(tr("Specify second point"), tr("Back"));
+ DIALOGFACTORY->updateMouseWidget(tr("Specify second point"), tr("Back"));
break;
case SetPoint3:
- RS_DIALOGFACTORY->updateMouseWidget(tr("Specify endpoint"), tr("Back"));
+ DIALOGFACTORY->updateMouseWidget(tr("Specify endpoint"), tr("Back"));
break;
default:
- RS_DIALOGFACTORY->updateMouseWidget("", "");
+ DIALOGFACTORY->updateMouseWidget("", "");
break;
}
}
void ActionDrawArc3P::updateToolBar()
{
if (!isFinished())
- RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarSnap);
+ DIALOGFACTORY->requestToolBar(RS2::ToolBarSnap);
else
- RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarArcs);
+ DIALOGFACTORY->requestToolBar(RS2::ToolBarArcs);
}
};
public:
- ActionDrawArc3P(RS_EntityContainer & container, GraphicView & graphicView);
+ ActionDrawArc3P(EntityContainer & container, GraphicView & graphicView);
~ActionDrawArc3P();
void reset();
virtual void mouseMoveEvent(QMouseEvent * e);
virtual void mouseReleaseEvent(QMouseEvent * e);
virtual void coordinateEvent(Vector * e);
- virtual void commandEvent(RS_CommandEvent * e);
+ virtual void commandEvent(CommandEvent * e);
virtual QStringList getAvailableCommands();
virtual void updateMouseButtonHints();
virtual void updateMouseCursor();
/**
* Arc data defined so far.
*/
- RS_ArcData data;
+ ArcData data;
/**
* 1st point.
*/
#include "graphicview.h"
#include "preview.h"
-ActionDrawArcTangential::ActionDrawArcTangential(RS_EntityContainer & container, GraphicView & graphicView): ActionInterface("Draw arcs tangential",
+ActionDrawArcTangential::ActionDrawArcTangential(EntityContainer & container, GraphicView & graphicView): ActionInterface("Draw arcs tangential",
container, graphicView)
{
reset();
if (point.valid == false || baseEntity == NULL)
{
- RS_DEBUG->print("ActionDrawArcTangential::trigger: "
+ DEBUG->print("ActionDrawArcTangential::trigger: "
"conditions not met");
return;
}
preparePreview();
- RS_Arc * arc = new RS_Arc(container, data);
+ Arc * arc = new Arc(container, data);
arc->setLayerToActive();
arc->setPenToActive();
container->addEntity(arc);
if (isStartPoint)
{
startPoint = baseEntity->getStartpoint();
- direction = RS_Math::correctAngle(baseEntity->getDirection1() + M_PI);
+ direction = Math::correctAngle(baseEntity->getDirection1() + M_PI);
}
else
{
startPoint = baseEntity->getEndpoint();
- direction = RS_Math::correctAngle(baseEntity->getDirection2() + M_PI);
+ direction = Math::correctAngle(baseEntity->getDirection2() + M_PI);
}
- RS_Arc arc(NULL, RS_ArcData());
+ Arc arc(NULL, ArcData());
bool suc = arc.createFrom2PDirectionRadius(startPoint, point, direction, data.radius);
if (suc)
if (data.isValid())
{
-// RS_Arc * arc = new RS_Arc(preview, data);
+// Arc * arc = new Arc(preview, data);
// deletePreview();
// clearPreview();
// preview->addEntity(arc);
case SetBaseEntity:
{
Vector coord = graphicView->toGraph(e->x(), e->y());
- RS_Entity * entity = catchEntity(coord, RS2::ResolveAll);
+ Entity * entity = catchEntity(coord, RS2::ResolveAll);
if (entity != NULL)
{
if (entity->isAtomic())
{
- baseEntity = (RS_AtomicEntity *)entity;
+ baseEntity = (AtomicEntity *)entity;
if (baseEntity->getStartpoint().distanceTo(coord)
< baseEntity->getEndpoint().distanceTo(coord))
}
}
-void ActionDrawArcTangential::commandEvent(RS_CommandEvent * e)
+void ActionDrawArcTangential::commandEvent(CommandEvent * e)
{
QString c = e->getCommand().toLower();
if (checkCommand("help", c))
{
- RS_DIALOGFACTORY->commandMessage(msgAvailableCommands()
+ DIALOGFACTORY->commandMessage(msgAvailableCommands()
+ getAvailableCommands().join(", "));
return;
}
{
ActionInterface::showOptions();
- if (RS_DIALOGFACTORY != NULL)
- RS_DIALOGFACTORY->requestOptions(this, true);
+ if (DIALOGFACTORY != NULL)
+ DIALOGFACTORY->requestOptions(this, true);
updateMouseButtonHints();
}
{
ActionInterface::hideOptions();
- if (RS_DIALOGFACTORY != NULL)
- RS_DIALOGFACTORY->requestOptions(this, false);
+ if (DIALOGFACTORY != NULL)
+ DIALOGFACTORY->requestOptions(this, false);
}
void ActionDrawArcTangential::updateMouseButtonHints()
switch (getStatus())
{
case SetBaseEntity:
- RS_DIALOGFACTORY->updateMouseWidget(
+ DIALOGFACTORY->updateMouseWidget(
tr("Specify base entity"),
tr("Cancel"));
break;
case SetEndAngle:
- RS_DIALOGFACTORY->updateMouseWidget(
+ DIALOGFACTORY->updateMouseWidget(
tr("Specify end angle"), tr("Back"));
break;
default:
- RS_DIALOGFACTORY->updateMouseWidget("", "");
+ DIALOGFACTORY->updateMouseWidget("", "");
break;
}
}
void ActionDrawArcTangential::updateToolBar()
{
if (!isFinished())
- RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarSnap);
+ DIALOGFACTORY->requestToolBar(RS2::ToolBarSnap);
else
- RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarArcs);
+ DIALOGFACTORY->requestToolBar(RS2::ToolBarArcs);
}
void ActionDrawArcTangential::setRadius(double r)
#include "arc.h"
#include "vector.h"
-class RS_AtomicEntity;
+class AtomicEntity;
/**
* This action class can handle user events to draw
};
public:
- ActionDrawArcTangential(RS_EntityContainer & container, GraphicView & graphicView);
+ ActionDrawArcTangential(EntityContainer & container, GraphicView & graphicView);
~ActionDrawArcTangential();
virtual RS2::ActionType rtti();
virtual void mouseMoveEvent(QMouseEvent * e);
virtual void mouseReleaseEvent(QMouseEvent * e);
virtual void coordinateEvent(Vector * e);
- virtual void commandEvent(RS_CommandEvent * e);
+ virtual void commandEvent(CommandEvent * e);
virtual QStringList getAvailableCommands();
virtual void hideOptions();
virtual void showOptions();
/**
* Base entity.
*/
- RS_AtomicEntity * baseEntity;
+ AtomicEntity * baseEntity;
/**
* Start point of base entity clicked?
*/
/**
* Arc data calculated.
*/
- RS_ArcData data;
+ ArcData data;
};
#endif // __ACTIONDRAWARCTANGENTIAL_H__
#include "graphicview.h"
#include "preview.h"
-ActionDrawCircle::ActionDrawCircle(RS_EntityContainer & container, GraphicView & graphicView):
+ActionDrawCircle::ActionDrawCircle(EntityContainer & container, GraphicView & graphicView):
ActionInterface("Draw circles", container, graphicView)
{
reset();
void ActionDrawCircle::reset()
{
- data = RS_CircleData(Vector(false), 0.0);
+ data = CircleData(Vector(false), 0.0);
}
void ActionDrawCircle::init(int status)
{
ActionInterface::trigger();
- RS_Circle * circle = new RS_Circle(container, data);
+ Circle * circle = new Circle(container, data);
circle->setLayerToActive();
circle->setPenToActive();
container->addEntity(circle);
setStatus(SetCenter);
reset();
- RS_DEBUG->print("ActionDrawCircle::trigger(): circle added: %d", circle->getId());
+ DEBUG->print("ActionDrawCircle::trigger(): circle added: %d", circle->getId());
}
void ActionDrawCircle::mouseMoveEvent(QMouseEvent * e)
{
- RS_DEBUG->print("ActionDrawCircle::mouseMoveEvent begin");
+ DEBUG->print("ActionDrawCircle::mouseMoveEvent begin");
Vector mouse = snapPoint(e);
data.radius = data.center.distanceTo(mouse);
deletePreview();
clearPreview();
-// preview->addEntity(new RS_Circle(preview, data));
+// preview->addEntity(new Circle(preview, data));
drawPreview();
}
break;
}
- RS_DEBUG->print("ActionDrawCircle::mouseMoveEvent end");
+ DEBUG->print("ActionDrawCircle::mouseMoveEvent end");
}
void ActionDrawCircle::mouseReleaseEvent(QMouseEvent * e)
}
}
-void ActionDrawCircle::commandEvent(RS_CommandEvent * e)
+void ActionDrawCircle::commandEvent(CommandEvent * e)
{
QString c = e->getCommand().toLower();
if (checkCommand("help", c))
{
- if (RS_DIALOGFACTORY)
- RS_DIALOGFACTORY->commandMessage(msgAvailableCommands()
+ if (DIALOGFACTORY)
+ DIALOGFACTORY->commandMessage(msgAvailableCommands()
+ getAvailableCommands().join(", "));
return;
}
case SetRadius:
{
bool ok;
- double r = RS_Math::eval(c, &ok);
+ double r = Math::eval(c, &ok);
if (ok)
data.radius = r;
- else if (RS_DIALOGFACTORY)
- RS_DIALOGFACTORY->commandMessage(tr("Not a valid expression"));
+ else if (DIALOGFACTORY)
+ DIALOGFACTORY->commandMessage(tr("Not a valid expression"));
trigger();
//setStatus(SetCenter);
switch (getStatus())
{
case SetCenter:
- if (RS_DIALOGFACTORY)
- RS_DIALOGFACTORY->updateMouseWidget(tr("Specify center"), tr("Cancel"));
+ if (DIALOGFACTORY)
+ DIALOGFACTORY->updateMouseWidget(tr("Specify center"), tr("Cancel"));
break;
case SetRadius:
- if (RS_DIALOGFACTORY)
- RS_DIALOGFACTORY->updateMouseWidget(tr("Specify radius"), tr("Back"));
+ if (DIALOGFACTORY)
+ DIALOGFACTORY->updateMouseWidget(tr("Specify radius"), tr("Back"));
break;
default:
- if (RS_DIALOGFACTORY)
- RS_DIALOGFACTORY->updateMouseWidget("", "");
+ if (DIALOGFACTORY)
+ DIALOGFACTORY->updateMouseWidget("", "");
break;
}
}
{
if (!isFinished())
{
- if (RS_DIALOGFACTORY)
- RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarSnap);
+ if (DIALOGFACTORY)
+ DIALOGFACTORY->requestToolBar(RS2::ToolBarSnap);
}
- else if (RS_DIALOGFACTORY)
- RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarCircles);
+ else if (DIALOGFACTORY)
+ DIALOGFACTORY->requestToolBar(RS2::ToolBarCircles);
}
};
public:
- ActionDrawCircle(RS_EntityContainer & container, GraphicView & graphicView);
+ ActionDrawCircle(EntityContainer & container, GraphicView & graphicView);
~ActionDrawCircle();
virtual RS2::ActionType rtti();
virtual void mouseMoveEvent(QMouseEvent * e);
virtual void mouseReleaseEvent(QMouseEvent * e);
virtual void coordinateEvent(Vector * e);
- virtual void commandEvent(RS_CommandEvent * e);
+ virtual void commandEvent(CommandEvent * e);
virtual QStringList getAvailableCommands();
virtual void hideOptions();
virtual void showOptions();
/**
* Circle data defined so far.
*/
- RS_CircleData data;
+ CircleData data;
};
#endif // __ACTIONDRAWCIRCLE_H__
#include "graphicview.h"
#include "preview.h"
-ActionDrawCircle2P::ActionDrawCircle2P(RS_EntityContainer & container, GraphicView & graphicView): ActionInterface("Draw circles",
+ActionDrawCircle2P::ActionDrawCircle2P(EntityContainer & container, GraphicView & graphicView): ActionInterface("Draw circles",
container, graphicView)
{
reset();
if (data.isValid())
{
- RS_Circle * circle = new RS_Circle(container, data);
+ Circle * circle = new Circle(container, data);
circle->setLayerToActive();
circle->setPenToActive();
container->addEntity(circle);
setStatus(SetPoint1);
reset();
}
- else if (RS_DIALOGFACTORY != NULL)
- RS_DIALOGFACTORY->requestWarningDialog(tr("Invalid Circle data."));
+ else if (DIALOGFACTORY != NULL)
+ DIALOGFACTORY->requestWarningDialog(tr("Invalid Circle data."));
}
void ActionDrawCircle2P::preparePreview()
if (point1.valid && point2.valid)
{
- RS_Circle circle(NULL, data);
+ Circle circle(NULL, data);
bool suc = circle.createFrom2P(point1, point2);
if (suc)
if (data.isValid())
{
-// RS_Circle * circle = new RS_Circle(preview, data);
+// Circle * circle = new Circle(preview, data);
// deletePreview();
// clearPreview();
// preview->addEntity(circle);
}
}
-void ActionDrawCircle2P::commandEvent(RS_CommandEvent * e)
+void ActionDrawCircle2P::commandEvent(CommandEvent * e)
{
QString c = e->getCommand().toLower();
if (checkCommand("help", c))
{
- if (RS_DIALOGFACTORY != NULL)
- RS_DIALOGFACTORY->commandMessage(msgAvailableCommands()
+ if (DIALOGFACTORY != NULL)
+ DIALOGFACTORY->commandMessage(msgAvailableCommands()
+ getAvailableCommands().join(", "));
return;
}
void ActionDrawCircle2P::updateMouseButtonHints()
{
- if (RS_DIALOGFACTORY != NULL)
+ if (DIALOGFACTORY != NULL)
{
switch (getStatus())
{
case SetPoint1:
- RS_DIALOGFACTORY->updateMouseWidget(
+ DIALOGFACTORY->updateMouseWidget(
tr("Specify first point"), tr("Cancel"));
break;
case SetPoint2:
- RS_DIALOGFACTORY->updateMouseWidget(
+ DIALOGFACTORY->updateMouseWidget(
tr("Specify second point"), tr("Back"));
break;
default:
- RS_DIALOGFACTORY->updateMouseWidget("", "");
+ DIALOGFACTORY->updateMouseWidget("", "");
break;
}
}
void ActionDrawCircle2P::updateToolBar()
{
- if (RS_DIALOGFACTORY)
+ if (DIALOGFACTORY)
{
if (!isFinished())
- RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarSnap);
+ DIALOGFACTORY->requestToolBar(RS2::ToolBarSnap);
else
- RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarCircles);
+ DIALOGFACTORY->requestToolBar(RS2::ToolBarCircles);
}
}
};
public:
- ActionDrawCircle2P(RS_EntityContainer & container, GraphicView & graphicView);
+ ActionDrawCircle2P(EntityContainer & container, GraphicView & graphicView);
~ActionDrawCircle2P();
void reset();
virtual void mouseMoveEvent(QMouseEvent * e);
virtual void mouseReleaseEvent(QMouseEvent * e);
virtual void coordinateEvent(Vector * e);
- virtual void commandEvent(RS_CommandEvent * e);
+ virtual void commandEvent(CommandEvent * e);
virtual QStringList getAvailableCommands();
virtual void updateMouseButtonHints();
virtual void updateMouseCursor();
/**
* Circle data defined so far.
*/
- RS_CircleData data;
+ CircleData data;
/**
* 1st point.
*/
#include "graphicview.h"
#include "preview.h"
-ActionDrawCircle3P::ActionDrawCircle3P(RS_EntityContainer & container,
+ActionDrawCircle3P::ActionDrawCircle3P(EntityContainer & container,
GraphicView & graphicView): ActionInterface("Draw circles",
container, graphicView)
{
if (data.isValid())
{
- RS_Circle * circle = new RS_Circle(container, data);
+ Circle * circle = new Circle(container, data);
circle->setLayerToActive();
circle->setPenToActive();
container->addEntity(circle);
reset();
}
else
- RS_DIALOGFACTORY->requestWarningDialog(tr("Invalid circle data."));
+ DIALOGFACTORY->requestWarningDialog(tr("Invalid circle data."));
}
void ActionDrawCircle3P::preparePreview()
if (point1.valid && point2.valid && point3.valid)
{
- RS_Circle circle(NULL, data);
+ Circle circle(NULL, data);
bool success = circle.createFrom3P(point1, point2, point3);
if (success)
if (data.isValid())
{
-// RS_Circle * circle = new RS_Circle(preview, data);
+// Circle * circle = new Circle(preview, data);
//
// deletePreview();
// clearPreview();
}
}
-void ActionDrawCircle3P::commandEvent(RS_CommandEvent * e)
+void ActionDrawCircle3P::commandEvent(CommandEvent * e)
{
QString c = e->getCommand().toLower();
if (checkCommand("help", c))
{
- RS_DIALOGFACTORY->commandMessage(msgAvailableCommands()
+ DIALOGFACTORY->commandMessage(msgAvailableCommands()
+ getAvailableCommands().join(", "));
return;
}
switch (getStatus())
{
case SetPoint1:
- RS_DIALOGFACTORY->updateMouseWidget(tr("Specify first point"), tr("Cancel"));
+ DIALOGFACTORY->updateMouseWidget(tr("Specify first point"), tr("Cancel"));
break;
case SetPoint2:
- RS_DIALOGFACTORY->updateMouseWidget(tr("Specify second point"), tr("Back"));
+ DIALOGFACTORY->updateMouseWidget(tr("Specify second point"), tr("Back"));
break;
case SetPoint3:
- RS_DIALOGFACTORY->updateMouseWidget(tr("Specify third point"), tr("Back"));
+ DIALOGFACTORY->updateMouseWidget(tr("Specify third point"), tr("Back"));
break;
default:
- RS_DIALOGFACTORY->updateMouseWidget("", "");
+ DIALOGFACTORY->updateMouseWidget("", "");
break;
}
}
void ActionDrawCircle3P::updateToolBar()
{
if (!isFinished())
- RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarSnap);
+ DIALOGFACTORY->requestToolBar(RS2::ToolBarSnap);
else
- RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarCircles);
+ DIALOGFACTORY->requestToolBar(RS2::ToolBarCircles);
}
};
public:
- ActionDrawCircle3P(RS_EntityContainer & container, GraphicView & graphicView);
+ ActionDrawCircle3P(EntityContainer & container, GraphicView & graphicView);
~ActionDrawCircle3P();
void reset();
virtual void mouseMoveEvent(QMouseEvent * e);
virtual void mouseReleaseEvent(QMouseEvent * e);
virtual void coordinateEvent(Vector * e);
- virtual void commandEvent(RS_CommandEvent * e);
+ virtual void commandEvent(CommandEvent * e);
virtual QStringList getAvailableCommands();
virtual void updateMouseButtonHints();
virtual void updateMouseCursor();
/**
* Circle data defined so far.
*/
- RS_CircleData data;
+ CircleData data;
/**
* 1st point.
*/
/**
* Constructor.
*/
-ActionDrawCircleCR::ActionDrawCircleCR(RS_EntityContainer & container, GraphicView & graphicView): ActionInterface("Draw circles CR",
+ActionDrawCircleCR::ActionDrawCircleCR(EntityContainer & container, GraphicView & graphicView): ActionInterface("Draw circles CR",
container, graphicView)
{
reset();
void ActionDrawCircleCR::reset()
{
- data = RS_CircleData(Vector(false), 0.0);
+ data = CircleData(Vector(false), 0.0);
}
void ActionDrawCircleCR::init(int status)
{
ActionInterface::trigger();
- RS_Circle * circle = new RS_Circle(container, data);
+ Circle * circle = new Circle(container, data);
circle->setLayerToActive();
circle->setPenToActive();
container->addEntity(circle);
setStatus(SetCenter);
- RS_DEBUG->print("ActionDrawCircleCR::trigger(): circle added: %d", circle->getId());
+ DEBUG->print("ActionDrawCircleCR::trigger(): circle added: %d", circle->getId());
}
void ActionDrawCircleCR::mouseMoveEvent(QMouseEvent * e)
{
- RS_DEBUG->print("ActionDrawCircleCR::mouseMoveEvent begin");
+ DEBUG->print("ActionDrawCircleCR::mouseMoveEvent begin");
Vector mouse = snapPoint(e);
switch (getStatus())
data.center = mouse;
deletePreview();
clearPreview();
-// preview->addEntity(new RS_Circle(preview, data));
+// preview->addEntity(new Circle(preview, data));
drawPreview();
break;
}
- RS_DEBUG->print("ActionDrawCircleCR::mouseMoveEvent end");
+ DEBUG->print("ActionDrawCircleCR::mouseMoveEvent end");
}
void ActionDrawCircleCR::mouseReleaseEvent(QMouseEvent * e)
}
}
-void ActionDrawCircleCR::commandEvent(RS_CommandEvent * e)
+void ActionDrawCircleCR::commandEvent(CommandEvent * e)
{
QString c = e->getCommand().toLower();
if (checkCommand("help", c))
{
- RS_DIALOGFACTORY->commandMessage(msgAvailableCommands()
+ DIALOGFACTORY->commandMessage(msgAvailableCommands()
+ getAvailableCommands().join(", "));
return;
}
case SetRadius:
{
bool ok;
- double r = RS_Math::eval(c, &ok);
+ double r = Math::eval(c, &ok);
if (ok == true)
data.radius = r;
else
- RS_DIALOGFACTORY->commandMessage(tr("Not a valid expression"));
+ DIALOGFACTORY->commandMessage(tr("Not a valid expression"));
- RS_DIALOGFACTORY->requestOptions(this, true, true);
+ DIALOGFACTORY->requestOptions(this, true, true);
setStatus(SetCenter);
}
break;
switch (getStatus())
{
case SetCenter:
- RS_DIALOGFACTORY->updateMouseWidget(tr("Specify circle center"), tr("Cancel"));
+ DIALOGFACTORY->updateMouseWidget(tr("Specify circle center"), tr("Cancel"));
break;
case SetRadius:
- RS_DIALOGFACTORY->updateMouseWidget(tr("Specify circle radius"), tr("Back"));
+ DIALOGFACTORY->updateMouseWidget(tr("Specify circle radius"), tr("Back"));
break;
default:
- RS_DIALOGFACTORY->updateMouseWidget("", "");
+ DIALOGFACTORY->updateMouseWidget("", "");
break;
}
}
{
ActionInterface::showOptions();
- RS_DIALOGFACTORY->requestOptions(this, true);
+ DIALOGFACTORY->requestOptions(this, true);
}
void ActionDrawCircleCR::hideOptions()
{
ActionInterface::hideOptions();
- RS_DIALOGFACTORY->requestOptions(this, false);
+ DIALOGFACTORY->requestOptions(this, false);
}
void ActionDrawCircleCR::updateMouseCursor()
void ActionDrawCircleCR::updateToolBar()
{
if (!isFinished())
- RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarSnap);
+ DIALOGFACTORY->requestToolBar(RS2::ToolBarSnap);
else
- RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarCircles);
+ DIALOGFACTORY->requestToolBar(RS2::ToolBarCircles);
}
double ActionDrawCircleCR::getRadius()
};
public:
- ActionDrawCircleCR(RS_EntityContainer & container, GraphicView & graphicView);
+ ActionDrawCircleCR(EntityContainer & container, GraphicView & graphicView);
~ActionDrawCircleCR();
virtual RS2::ActionType rtti();
virtual void mouseMoveEvent(QMouseEvent * e);
virtual void mouseReleaseEvent(QMouseEvent * e);
virtual void coordinateEvent(Vector * e);
- virtual void commandEvent(RS_CommandEvent * e);
+ virtual void commandEvent(CommandEvent * e);
virtual QStringList getAvailableCommands();
virtual void hideOptions();
virtual void showOptions();
/**
* Circle data defined so far.
*/
- RS_CircleData data;
+ CircleData data;
};
#endif // __ACTIONDRAWCIRCLECR_H__
* @param isArc true if this action will produce an ellipse arc.
* false if it will produce a full ellipse.
*/
-ActionDrawEllipseAxis::ActionDrawEllipseAxis(RS_EntityContainer & container, GraphicView & graphicView, bool isArc): ActionInterface("Draw ellipse with axis",
+ActionDrawEllipseAxis::ActionDrawEllipseAxis(EntityContainer & container, GraphicView & graphicView, bool isArc): ActionInterface("Draw ellipse with axis",
container, graphicView)
{
this->isArc = isArc;
{
ActionInterface::trigger();
- RS_EllipseData ellipseData(center, major, ratio, angle1, angle2, false);
- RS_Ellipse * ellipse = new RS_Ellipse(container, ellipseData);
+ EllipseData ellipseData(center, major, ratio, angle1, angle2, false);
+ Ellipse * ellipse = new Ellipse(container, ellipseData);
ellipse->setLayerToActive();
ellipse->setPenToActive();
setStatus(SetCenter);
- RS_DEBUG->print("ActionDrawEllipseAxis::trigger():"
+ DEBUG->print("ActionDrawEllipseAxis::trigger():"
" entity added: %d", ellipse->getId());
}
void ActionDrawEllipseAxis::mouseMoveEvent(QMouseEvent * e)
{
- RS_DEBUG->print("ActionDrawEllipseAxis::mouseMoveEvent begin");
+ DEBUG->print("ActionDrawEllipseAxis::mouseMoveEvent begin");
Vector mouse = snapPoint(e);
{
deletePreview();
clearPreview();
- RS_EllipseData ed(center, mouse - center, 0.5, 0.0, 2 * M_PI, false);
-// preview->addEntity(new RS_Ellipse(preview, ed));
+ EllipseData ed(center, mouse - center, 0.5, 0.0, 2 * M_PI, false);
+// preview->addEntity(new Ellipse(preview, ed));
drawPreview();
}
break;
{
deletePreview();
clearPreview();
- RS_Line line(NULL, RS_LineData(center - major, center + major));
+ Line line(NULL, LineData(center - major, center + major));
double d = line.getDistanceToPoint(mouse);
ratio = d / (line.getLength() / 2);
- RS_EllipseData ed(center, major, ratio, 0.0, 2 * M_PI, false);
-// preview->addEntity(new RS_Ellipse(preview, ed));
+ EllipseData ed(center, major, ratio, 0.0, 2 * M_PI, false);
+// preview->addEntity(new Ellipse(preview, ed));
drawPreview();
}
break;
v.scale(Vector(1.0, 1.0 / ratio));
angle1 = v.angle(); // + major.angle();
-// preview->addEntity(new RS_Line(preview, RS_LineData(center, mouse)));
+// preview->addEntity(new Line(preview, LineData(center, mouse)));
- RS_EllipseData ed(center, major, ratio, angle1, angle1 + 1.0, false);
-// preview->addEntity(new RS_Ellipse(preview, ed));
+ EllipseData ed(center, major, ratio, angle1, angle1 + 1.0, false);
+// preview->addEntity(new Ellipse(preview, ed));
drawPreview();
}
break;
v.scale(Vector(1.0, 1.0 / ratio));
angle2 = v.angle(); // + major.angle();
-// preview->addEntity(new RS_Line(preview, RS_LineData(center, mouse)));
+// preview->addEntity(new Line(preview, LineData(center, mouse)));
- RS_EllipseData ed(center, major, ratio, angle1, angle2, false);
-// preview->addEntity(new RS_Ellipse(preview, ed));
+ EllipseData ed(center, major, ratio, angle1, angle2, false);
+// preview->addEntity(new Ellipse(preview, ed));
drawPreview();
}
break;
}
- RS_DEBUG->print("ActionDrawEllipseAxis::mouseMoveEvent end");
+ DEBUG->print("ActionDrawEllipseAxis::mouseMoveEvent end");
}
void ActionDrawEllipseAxis::mouseReleaseEvent(QMouseEvent * e)
case SetMinor:
{
- RS_Line line(NULL, RS_LineData(center - major, center + major));
+ Line line(NULL, LineData(center - major, center + major));
double d = line.getDistanceToPoint(mouse);
ratio = d / (line.getLength() / 2);
}
}
-void ActionDrawEllipseAxis::commandEvent(RS_CommandEvent * e)
+void ActionDrawEllipseAxis::commandEvent(CommandEvent * e)
{
QString c = e->getCommand().toLower();
if (checkCommand("help", c))
{
- if (RS_DIALOGFACTORY != NULL)
- RS_DIALOGFACTORY->commandMessage(msgAvailableCommands()
+ if (DIALOGFACTORY != NULL)
+ DIALOGFACTORY->commandMessage(msgAvailableCommands()
+ getAvailableCommands().join(", "));
return;
}
{
case SetMinor: {
bool ok;
- double m = RS_Math::eval(c, &ok);
+ double m = Math::eval(c, &ok);
if (ok == true)
{
else
setStatus(SetAngle1);
}
- else if (RS_DIALOGFACTORY != NULL)
- RS_DIALOGFACTORY->commandMessage(tr("Not a valid expression"));
+ else if (DIALOGFACTORY != NULL)
+ DIALOGFACTORY->commandMessage(tr("Not a valid expression"));
}
break;
case SetAngle1: {
bool ok;
- double a = RS_Math::eval(c, &ok);
+ double a = Math::eval(c, &ok);
if (ok == true)
{
- angle1 = RS_Math::deg2rad(a);
+ angle1 = Math::deg2rad(a);
setStatus(SetAngle2);
}
- else if (RS_DIALOGFACTORY != NULL)
- RS_DIALOGFACTORY->commandMessage(tr("Not a valid expression"));
+ else if (DIALOGFACTORY != NULL)
+ DIALOGFACTORY->commandMessage(tr("Not a valid expression"));
}
break;
case SetAngle2: {
bool ok;
- double a = RS_Math::eval(c, &ok);
+ double a = Math::eval(c, &ok);
if (ok == true)
{
- angle2 = RS_Math::deg2rad(a);
+ angle2 = Math::deg2rad(a);
trigger();
}
- else if (RS_DIALOGFACTORY != NULL)
- RS_DIALOGFACTORY->commandMessage(tr("Not a valid expression"));
+ else if (DIALOGFACTORY != NULL)
+ DIALOGFACTORY->commandMessage(tr("Not a valid expression"));
}
break;
void ActionDrawEllipseAxis::updateMouseButtonHints()
{
- if (RS_DIALOGFACTORY != NULL)
+ if (DIALOGFACTORY != NULL)
{
switch (getStatus())
{
case SetCenter:
- RS_DIALOGFACTORY->updateMouseWidget(tr("Specify ellipse center"),
+ DIALOGFACTORY->updateMouseWidget(tr("Specify ellipse center"),
tr("Cancel"));
break;
case SetMajor:
- RS_DIALOGFACTORY->updateMouseWidget(tr("Specify endpoint of major axis"),
+ DIALOGFACTORY->updateMouseWidget(tr("Specify endpoint of major axis"),
tr("Back"));
break;
case SetMinor:
- RS_DIALOGFACTORY->updateMouseWidget(
+ DIALOGFACTORY->updateMouseWidget(
tr("Specify endpoint or length of minor axis:"),
tr("Back"));
break;
case SetAngle1:
- RS_DIALOGFACTORY->updateMouseWidget(tr("Specify start angle"),
+ DIALOGFACTORY->updateMouseWidget(tr("Specify start angle"),
tr("Back"));
break;
case SetAngle2:
- RS_DIALOGFACTORY->updateMouseWidget(tr("Specify end angle"),
+ DIALOGFACTORY->updateMouseWidget(tr("Specify end angle"),
tr("Back"));
break;
default:
- RS_DIALOGFACTORY->updateMouseWidget("", "");
+ DIALOGFACTORY->updateMouseWidget("", "");
break;
}
}
void ActionDrawEllipseAxis::updateToolBar()
{
- if (RS_DIALOGFACTORY)
+ if (DIALOGFACTORY)
{
if (!isFinished())
- RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarSnap);
+ DIALOGFACTORY->requestToolBar(RS2::ToolBarSnap);
else
- RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarEllipses);
+ DIALOGFACTORY->requestToolBar(RS2::ToolBarEllipses);
}
}
};
public:
- ActionDrawEllipseAxis(RS_EntityContainer & container, GraphicView & graphicView, bool isArc);
+ ActionDrawEllipseAxis(EntityContainer & container, GraphicView & graphicView, bool isArc);
~ActionDrawEllipseAxis();
virtual void init(int status = 0);
virtual void mouseMoveEvent(QMouseEvent * e);
virtual void mouseReleaseEvent(QMouseEvent * e);
virtual void coordinateEvent(Vector * e);
- virtual void commandEvent(RS_CommandEvent * e);
+ virtual void commandEvent(CommandEvent * e);
virtual QStringList getAvailableCommands();
virtual void updateMouseButtonHints();
virtual void updateMouseCursor();
#include "graphicview.h"
#include "information.h"
-ActionDrawHatch::ActionDrawHatch(RS_EntityContainer & container, GraphicView & graphicView):
+ActionDrawHatch::ActionDrawHatch(EntityContainer & container, GraphicView & graphicView):
ActionInterface("Draw Hatch", container, graphicView)
{
hatch = NULL;
ActionInterface::init(status);
clearPreview();
- RS_Hatch tmp(container, data);
+ Hatch tmp(container, data);
tmp.setLayerToActive();
tmp.setPenToActive();
- if (RS_DIALOGFACTORY->requestHatchDialog(&tmp))
+ if (DIALOGFACTORY->requestHatchDialog(&tmp))
{
data = tmp.getData();
trigger();
void ActionDrawHatch::trigger()
{
- RS_DEBUG->print("ActionDrawHatch::trigger()");
+ DEBUG->print("ActionDrawHatch::trigger()");
deleteSnapper();
- RS_Entity * e;
+ Entity * e;
// deselect unhatchable entities:
for(e=container->firstEntity(RS2::ResolveNone); e!=NULL;
&& (e->rtti() == RS2::EntityHatch
|| e->rtti() == RS2::EntityEllipse || e->rtti() == RS2::EntityPoint
|| e->rtti() == RS2::EntityText
- || RS_Information::isDimension(e->rtti())))
+ || Information::isDimension(e->rtti())))
e->setSelected(false);
}
&& (e->rtti() == RS2::EntityHatch
|| e->rtti() == RS2::EntityEllipse || e->rtti() == RS2::EntityPoint
|| e->rtti() == RS2::EntityText
- || RS_Information::isDimension(e->rtti())))
+ || Information::isDimension(e->rtti())))
e->setSelected(false);
}
return;
}
- hatch = new RS_Hatch(container, data);
+ hatch = new Hatch(container, data);
hatch->setLayerToActive();
hatch->setPenToActive();
- RS_EntityContainer * loop = new RS_EntityContainer(hatch);
- loop->setPen(RS_Pen(RS2::FlagInvalid));
+ EntityContainer * loop = new EntityContainer(hatch);
+ loop->setPen(Pen(RS2::FlagInvalid));
// add selected contour:
- for(RS_Entity * e=container->firstEntity(RS2::ResolveAll); e!=NULL;
+ for(Entity * e=container->firstEntity(RS2::ResolveAll); e!=NULL;
e=container->nextEntity(RS2::ResolveAll))
{
if (e->isSelected())
|| e->getParent()->rtti() == RS2::EntityPolyline))
e->getParent()->setSelected(false);
- RS_Entity * cp = e->clone();
- cp->setPen(RS_Pen(RS2::FlagInvalid));
+ Entity * cp = e->clone();
+ cp->setPen(Pen(RS2::FlagInvalid));
cp->reparent(loop);
loop->addEntity(cp);
}
hatch->update();
graphicView->drawEntity(hatch);
- RS_DIALOGFACTORY->commandMessage(tr("Hatch created successfully."));
+ DIALOGFACTORY->commandMessage(tr("Hatch created successfully."));
}
else
{
delete hatch;
hatch = NULL;
- RS_DIALOGFACTORY->commandMessage(tr("Invalid hatch area. Please check that "
+ DIALOGFACTORY->commandMessage(tr("Invalid hatch area. Please check that "
"the entities chosen form one or more closed contours."));
}
}
void ActionDrawHatch::mouseMoveEvent(QMouseEvent *)
{
- RS_DEBUG->print("ActionDrawHatch::mouseMoveEvent begin");
+ DEBUG->print("ActionDrawHatch::mouseMoveEvent begin");
/*if (getStatus()==SetPos) {
Vector mouse = snapPoint(e);
drawPreview();
}*/
- RS_DEBUG->print("ActionDrawHatch::mouseMoveEvent end");
+ DEBUG->print("ActionDrawHatch::mouseMoveEvent end");
}
void ActionDrawHatch::mouseReleaseEvent(QMouseEvent * e)
void ActionDrawHatch::updateMouseButtonHints()
{
- RS_DIALOGFACTORY->updateMouseWidget("", "");
+ DIALOGFACTORY->updateMouseWidget("", "");
}
void ActionDrawHatch::updateMouseCursor()
void ActionDrawHatch::updateToolBar()
{
- RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarMain);
+ DIALOGFACTORY->requestToolBar(RS2::ToolBarMain);
}
};
public:
- ActionDrawHatch(RS_EntityContainer & container, GraphicView & graphicView);
+ ActionDrawHatch(EntityContainer & container, GraphicView & graphicView);
~ActionDrawHatch();
virtual void init(int status = 0);
virtual void updateToolBar();
private:
- RS_HatchData data;
- RS_Hatch * hatch;
+ HatchData data;
+ Hatch * hatch;
};
#endif // __ACTIONDRAWHATCH_H__
/**
* Constructor.
*/
-ActionDrawImage::ActionDrawImage(RS_EntityContainer & container, GraphicView & graphicView):
+ActionDrawImage::ActionDrawImage(EntityContainer & container, GraphicView & graphicView):
ActionInterface("Image", container, graphicView)
{
}
reset();
- data.file = RS_DIALOGFACTORY->requestImageOpenDialog();
+ data.file = DIALOGFACTORY->requestImageOpenDialog();
graphicView->redraw();
if (!data.file.isEmpty())
{
finish();
updateToolBar();
- //RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarMain);
+ //DIALOGFACTORY->requestToolBar(RS2::ToolBarMain);
}
}
void ActionDrawImage::reset()
{
- data = RS_ImageData(0,
+ data = ImageData(0,
Vector(0.0, 0.0),
Vector(1.0, 0.0),
Vector(0.0, 1.0),
if (!data.file.isEmpty())
{
- RS_Creation creation(container, graphicView);
+ Creation creation(container, graphicView);
creation.createImage(data);
}
// deletePreview();
// clearPreview();
-// RS_Line * line;
-// line = new RS_Line(preview, RS_LineData(Vector(0, 0), Vector(img.width(), 0)));
+// Line * line;
+// line = new Line(preview, LineData(Vector(0, 0), Vector(img.width(), 0)));
// preview->addEntity(line);
-// line = new RS_Line(preview,
-// RS_LineData(Vector(img.width(), 0), Vector(img.width(), img.height())));
+// line = new Line(preview,
+// LineData(Vector(img.width(), 0), Vector(img.width(), img.height())));
// preview->addEntity(line);
-// line = new RS_Line(preview,
-// RS_LineData(Vector(img.width(), img.height()), Vector(0, img.height())));
+// line = new Line(preview,
+// LineData(Vector(img.width(), img.height()), Vector(0, img.height())));
// preview->addEntity(line);
-// line = new RS_Line(preview, RS_LineData(Vector(0, img.height()), Vector(0, 0)));
+// line = new Line(preview, LineData(Vector(0, img.height()), Vector(0, 0)));
// preview->addEntity(line);
// preview->scale(Vector(0, 0), Vector(data.uVector.magnitude(), data.uVector.magnitude()));
// preview->rotate(Vector(0, 0), data.uVector.angle());
trigger();
}
-void ActionDrawImage::commandEvent(RS_CommandEvent * e)
+void ActionDrawImage::commandEvent(CommandEvent * e)
{
QString c = e->getCommand().toLower();
if (checkCommand("help", c))
{
- RS_DIALOGFACTORY->commandMessage(msgAvailableCommands()
+ DIALOGFACTORY->commandMessage(msgAvailableCommands()
+ getAvailableCommands().join(", "));
return;
}
case SetAngle:
{
bool ok;
- double a = RS_Math::eval(c, &ok);
+ double a = Math::eval(c, &ok);
if (ok)
- setAngle(RS_Math::deg2rad(a));
+ setAngle(Math::deg2rad(a));
else
- RS_DIALOGFACTORY->commandMessage(tr("Not a valid expression"));
+ DIALOGFACTORY->commandMessage(tr("Not a valid expression"));
- RS_DIALOGFACTORY->requestOptions(this, true, true);
+ DIALOGFACTORY->requestOptions(this, true, true);
setStatus(lastStatus);
}
break;
case SetFactor:
{
bool ok;
- double f = RS_Math::eval(c, &ok);
+ double f = Math::eval(c, &ok);
if (ok)
setFactor(f);
else
- RS_DIALOGFACTORY->commandMessage(tr("Not a valid expression"));
+ DIALOGFACTORY->commandMessage(tr("Not a valid expression"));
- RS_DIALOGFACTORY->requestOptions(this, true, true);
+ DIALOGFACTORY->requestOptions(this, true, true);
setStatus(lastStatus);
}
break;
{
ActionInterface::showOptions();
- RS_DIALOGFACTORY->requestOptions(this, true);
+ DIALOGFACTORY->requestOptions(this, true);
}
void ActionDrawImage::hideOptions()
{
ActionInterface::hideOptions();
- RS_DIALOGFACTORY->requestOptions(this, false);
+ DIALOGFACTORY->requestOptions(this, false);
}
void ActionDrawImage::updateMouseButtonHints()
switch (getStatus())
{
case SetTargetPoint:
- RS_DIALOGFACTORY->updateMouseWidget(tr("Specify reference point"), tr("Cancel"));
+ DIALOGFACTORY->updateMouseWidget(tr("Specify reference point"), tr("Cancel"));
break;
case SetAngle:
- RS_DIALOGFACTORY->updateMouseWidget(tr("Enter angle:"), "");
+ DIALOGFACTORY->updateMouseWidget(tr("Enter angle:"), "");
break;
case SetFactor:
- RS_DIALOGFACTORY->updateMouseWidget(tr("Enter factor:"), "");
+ DIALOGFACTORY->updateMouseWidget(tr("Enter factor:"), "");
break;
default:
- RS_DIALOGFACTORY->updateMouseWidget("", "");
+ DIALOGFACTORY->updateMouseWidget("", "");
break;
}
}
void ActionDrawImage::updateToolBar()
{
if (!isFinished())
- RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarSnap);
+ DIALOGFACTORY->requestToolBar(RS2::ToolBarSnap);
else
- RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarMain);
+ DIALOGFACTORY->requestToolBar(RS2::ToolBarMain);
}
double ActionDrawImage::getAngle()
};
public:
- ActionDrawImage(RS_EntityContainer & container, GraphicView & graphicView);
+ ActionDrawImage(EntityContainer & container, GraphicView & graphicView);
~ActionDrawImage();
virtual RS2::ActionType rtti();
virtual void mouseMoveEvent(QMouseEvent * e);
virtual void mouseReleaseEvent(QMouseEvent * e);
virtual void coordinateEvent(Vector * e);
- virtual void commandEvent(RS_CommandEvent * e);
+ virtual void commandEvent(CommandEvent * e);
virtual QStringList getAvailableCommands();
virtual void showOptions();
virtual void hideOptions();
void setFactor(double f);
protected:
- RS_ImageData data;
+ ImageData data;
QImage img;
/** Last status before entering option. */
#include "graphicview.h"
#include "preview.h"
-ActionDrawLine::ActionDrawLine(RS_EntityContainer & container, GraphicView & graphicView):
+ActionDrawLine::ActionDrawLine(EntityContainer & container, GraphicView & graphicView):
ActionInterface("Draw lines", container, graphicView)
{
- RS_DEBUG->print("ActionDrawLine::ActionDrawLine");
+ DEBUG->print("ActionDrawLine::ActionDrawLine");
reset();
//hm.
// graphicView.snapper.SetContainer(&container);
// graphicView.snapper.SetGraphicView(&graphicView);
// graphicView.snapper.SetVisible();
// graphicView.preview.SetVisible();
- RS_DEBUG->print("ActionDrawLine::ActionDrawLine: OK");
+ DEBUG->print("ActionDrawLine::ActionDrawLine: OK");
}
ActionDrawLine::~ActionDrawLine()
void ActionDrawLine::reset()
{
- RS_DEBUG->print("ActionDrawLine::reset");
- data = RS_LineData(Vector(false), Vector(false));
+ DEBUG->print("ActionDrawLine::reset");
+ data = LineData(Vector(false), Vector(false));
start = Vector(false);
ClearHistory();
- RS_DEBUG->print("ActionDrawLine::reset: OK");
+ DEBUG->print("ActionDrawLine::reset: OK");
}
void ActionDrawLine::init(int status)
{
- RS_DEBUG->print("ActionDrawLine::init");
+ DEBUG->print("ActionDrawLine::init");
ActionInterface::init(status);
reset();
- RS_DEBUG->print("ActionDrawLine::init: OK");
+ DEBUG->print("ActionDrawLine::init: OK");
}
void ActionDrawLine::trigger()
{
graphicView->preview.clear();
- RS_Line * line = new RS_Line(container, data);
+ Line * line = new Line(container, data);
line->setLayerToActive();
line->setPenToActive();
container->addEntity(line);
//std::cout << container;
//printf("ActionDrawLine::trigger(): new line is %f,%f to %f,%f\n", data.startpoint.x, data.startpoint.y, data.endpoint.x, data.endpoint.y);
//This makes it come back as "Unknown Entity"
-//std::cout << *((RS_Entity *)container);
+//std::cout << *((Entity *)container);
//std::cout << *container;
// Update undo list:
graphicView->moveRelativeZero(line->getEndpoint());
//hm. [OK, it just moves the relative zero tho. Overkill. And remove preview, so OK.]
graphicView->redraw();
- RS_DEBUG->print("ActionDrawLine::trigger(): line added: %d", line->getId());
+ DEBUG->print("ActionDrawLine::trigger(): line added: %d", line->getId());
}
void ActionDrawLine::mouseMoveEvent(QMouseEvent * e)
{
- RS_DEBUG->print("ActionDrawLine::mouseMoveEvent begin");
+ DEBUG->print("ActionDrawLine::mouseMoveEvent begin");
- RS_DEBUG->print("ActionDrawLine::mouseMoveEvent: snap point");
+ DEBUG->print("ActionDrawLine::mouseMoveEvent: snap point");
Vector mouse = graphicView->snapper.snapPoint(e);
- RS_DEBUG->print("ActionDrawLine::mouseMoveEvent: snap point: OK");
+ DEBUG->print("ActionDrawLine::mouseMoveEvent: snap point: OK");
if (getStatus() == SetEndpoint && data.startpoint.valid)
{
- RS_DEBUG->print("ActionDrawLine::mouseMoveEvent: update preview");
+ DEBUG->print("ActionDrawLine::mouseMoveEvent: update preview");
// This is lame. Creating a new Line every time the endpoint moves.
// Surely we can alter the line entity inside the preview, no?
#if 0
graphicView->preview.clear(); // Remove entities from the container
- RS_Line * line = new RS_Line(&(graphicView->preview), RS_LineData(data.startpoint, mouse));
+ Line * line = new Line(&(graphicView->preview), LineData(data.startpoint, mouse));
graphicView->preview.addEntity(line);
#else
// We can assume there's only one line in there, can't we?
- RS_Line * line = (RS_Line *)graphicView->preview.firstEntity(RS2::ResolveNone);
+ Line * line = (Line *)graphicView->preview.firstEntity(RS2::ResolveNone);
if (line)
{
}
else
{
- line = new RS_Line(&(graphicView->preview), RS_LineData(data.startpoint, mouse));
+ line = new Line(&(graphicView->preview), LineData(data.startpoint, mouse));
graphicView->preview.addEntity(line);
}
#endif
//hm. [ok, this works. :-D]
graphicView->redraw();
- RS_DEBUG->print("ActionDrawLine::mouseMoveEvent end");
+ DEBUG->print("ActionDrawLine::mouseMoveEvent end");
}
void ActionDrawLine::mouseReleaseEvent(QMouseEvent * e)
void ActionDrawLine::coordinateEvent(Vector * e)
{
- RS_DEBUG->print("ActionDrawLine::coordinateEvent");
+ DEBUG->print("ActionDrawLine::coordinateEvent");
if (!e)
{
- RS_DEBUG->print("ActionDrawLine::coordinateEvent: event was NULL");
+ DEBUG->print("ActionDrawLine::coordinateEvent: event was NULL");
return;
}
break;
}
- RS_DEBUG->print("ActionDrawLine::coordinateEvent: OK");
+ DEBUG->print("ActionDrawLine::coordinateEvent: OK");
}
-void ActionDrawLine::commandEvent(RS_CommandEvent * e)
+void ActionDrawLine::commandEvent(CommandEvent * e)
{
- RS_DEBUG->print("ActionDrawLine::commandEvent");
+ DEBUG->print("ActionDrawLine::commandEvent");
QString c = e->getCommand().toLower();
switch (getStatus())
if (checkCommand("help", c))
{
- RS_DIALOGFACTORY->commandMessage(msgAvailableCommands()
+ DIALOGFACTORY->commandMessage(msgAvailableCommands()
+ getAvailableCommands().join(", "));
return;
}
break;
}
- RS_DEBUG->print("ActionDrawLine::commandEvent: OK");
+ DEBUG->print("ActionDrawLine::commandEvent: OK");
}
QStringList ActionDrawLine::getAvailableCommands()
switch (getStatus())
{
case SetStartpoint:
- RS_DIALOGFACTORY->updateMouseWidget(tr("Specify first point"), tr("Cancel"));
+ DIALOGFACTORY->updateMouseWidget(tr("Specify first point"), tr("Cancel"));
break;
case SetEndpoint:
if (history.count() >= 3)
{
- msg += RS_COMMANDS->command("close");
+ msg += COMMANDS->command("close");
msg += "/";
}
if (history.count() >= 2)
- msg += RS_COMMANDS->command("undo");
+ msg += COMMANDS->command("undo");
if (history.count() >= 2)
- RS_DIALOGFACTORY->updateMouseWidget(tr("Specify next point or [%1]").arg(msg), tr("Back"));
+ DIALOGFACTORY->updateMouseWidget(tr("Specify next point or [%1]").arg(msg), tr("Back"));
else
- RS_DIALOGFACTORY->updateMouseWidget(tr("Specify next point"), tr("Back"));
+ DIALOGFACTORY->updateMouseWidget(tr("Specify next point"), tr("Back"));
}
break;
default:
- RS_DIALOGFACTORY->updateMouseWidget("", "");
+ DIALOGFACTORY->updateMouseWidget("", "");
break;
}
}
void ActionDrawLine::showOptions()
{
- RS_DEBUG->print("ActionDrawLine::showOptions");
+ DEBUG->print("ActionDrawLine::showOptions");
ActionInterface::showOptions();
- RS_DIALOGFACTORY->requestOptions(this, true);
- RS_DEBUG->print("ActionDrawLine::showOptions: OK");
+ DIALOGFACTORY->requestOptions(this, true);
+ DEBUG->print("ActionDrawLine::showOptions: OK");
}
void ActionDrawLine::hideOptions()
{
ActionInterface::hideOptions();
- RS_DIALOGFACTORY->requestOptions(this, false);
+ DIALOGFACTORY->requestOptions(this, false);
}
void ActionDrawLine::updateMouseCursor()
void ActionDrawLine::updateToolBar()
{
if (!isFinished())
- RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarSnap);
+ DIALOGFACTORY->requestToolBar(RS2::ToolBarSnap);
else
- RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarLines);
+ DIALOGFACTORY->requestToolBar(RS2::ToolBarLines);
}
void ActionDrawLine::close()
graphicView->moveRelativeZero(start);
}
else
- RS_DIALOGFACTORY->commandMessage(tr("Cannot close sequence of lines: Not enough entities defined yet."));
+ DIALOGFACTORY->commandMessage(tr("Cannot close sequence of lines: Not enough entities defined yet."));
}
void ActionDrawLine::undo()
graphicView->redraw();
}
else
- RS_DIALOGFACTORY->commandMessage(tr("Cannot undo: Not enough entities defined yet."));
+ DIALOGFACTORY->commandMessage(tr("Cannot undo: Not enough entities defined yet."));
}
void ActionDrawLine::ClearHistory(void)
};
public:
- ActionDrawLine(RS_EntityContainer & container, GraphicView & graphicView);
+ ActionDrawLine(EntityContainer & container, GraphicView & graphicView);
virtual ~ActionDrawLine();
virtual RS2::ActionType rtti();
virtual void mouseMoveEvent(QMouseEvent * e);
virtual void mouseReleaseEvent(QMouseEvent * e);
virtual void coordinateEvent(Vector * e);
- virtual void commandEvent(RS_CommandEvent * e);
+ virtual void commandEvent(CommandEvent * e);
virtual QStringList getAvailableCommands();
virtual void showOptions();
virtual void hideOptions();
/**
* Line data defined so far.
*/
- RS_LineData data;
+ LineData data;
/**
* Start point of the series of lines. Used for close function.
*/
#include "graphicview.h"
#include "preview.h"
-ActionDrawLineAngle::ActionDrawLineAngle(RS_EntityContainer & container,
+ActionDrawLineAngle::ActionDrawLineAngle(EntityContainer & container,
GraphicView & graphicView, double a, bool fa):
ActionInterface("Draw lines with given angle", container, graphicView),
pos(Vector(false)), angle(a), length(1.0), fixedAngle(fa), snpPoint(0)
void ActionDrawLineAngle::reset()
{
- data = RS_LineData(Vector(false), Vector(false));
+ data = LineData(Vector(false), Vector(false));
}
void ActionDrawLineAngle::init(int status)
{
ActionInterface::trigger();
preparePreview();
- RS_Line * line = new RS_Line(container, data);
+ Line * line = new Line(container, data);
line->setLayerToActive();
line->setPenToActive();
container->addEntity(line);
graphicView->drawEntity(line);
graphicView->moveRelativeZero(data.startpoint);
graphicView->redraw();
- RS_DEBUG->print("ActionDrawLineAngle::trigger(): line added: %d", line->getId());
+ DEBUG->print("ActionDrawLineAngle::trigger(): line added: %d", line->getId());
}
void ActionDrawLineAngle::mouseMoveEvent(QMouseEvent * e)
{
- RS_DEBUG->print("ActionDrawLineAngle::mouseMoveEvent begin");
+ DEBUG->print("ActionDrawLineAngle::mouseMoveEvent begin");
if (getStatus() == SetPos)
{
// deletePreview();
// clearPreview();
// preparePreview();
-// preview->addEntity(new RS_Line(preview, data));
+// preview->addEntity(new Line(preview, data));
// drawPreview();
preparePreview();
graphicView->preview.clear();
- graphicView->preview.addEntity(new RS_Line(&(graphicView->preview), data));
+ graphicView->preview.addEntity(new Line(&(graphicView->preview), data));
}
graphicView->redraw();
- RS_DEBUG->print("ActionDrawLineAngle::mouseMoveEvent end");
+ DEBUG->print("ActionDrawLineAngle::mouseMoveEvent end");
}
void ActionDrawLineAngle::mouseReleaseEvent(QMouseEvent * e)
p1 = pos;
p2 += p1;
- data = RS_LineData(p1, p2);
+ data = LineData(p1, p2);
}
void ActionDrawLineAngle::coordinateEvent(Vector * e)
}
}
-void ActionDrawLineAngle::commandEvent(RS_CommandEvent * e)
+void ActionDrawLineAngle::commandEvent(CommandEvent * e)
{
QString c = e->getCommand().toLower();
if (checkCommand("help", c))
{
- RS_DIALOGFACTORY->commandMessage(msgAvailableCommands()
+ DIALOGFACTORY->commandMessage(msgAvailableCommands()
+ getAvailableCommands().join(", "));
return;
}
case SetAngle:
{
bool ok;
- double a = RS_Math::eval(c, &ok);
+ double a = Math::eval(c, &ok);
if (ok)
- angle = RS_Math::deg2rad(a);
+ angle = Math::deg2rad(a);
else
- RS_DIALOGFACTORY->commandMessage(tr("Not a valid expression"));
+ DIALOGFACTORY->commandMessage(tr("Not a valid expression"));
- RS_DIALOGFACTORY->requestOptions(this, true, true);
+ DIALOGFACTORY->requestOptions(this, true, true);
setStatus(SetPos);
}
break;
case SetLength:
{
bool ok;
- double l = RS_Math::eval(c, &ok);
+ double l = Math::eval(c, &ok);
if (ok)
length = l;
else
- RS_DIALOGFACTORY->commandMessage(tr("Not a valid expression"));
+ DIALOGFACTORY->commandMessage(tr("Not a valid expression"));
- RS_DIALOGFACTORY->requestOptions(this, true, true);
+ DIALOGFACTORY->requestOptions(this, true, true);
setStatus(SetPos);
}
break;
switch (getStatus())
{
case SetPos:
- RS_DIALOGFACTORY->updateMouseWidget(tr("Specify position"), tr("Cancel"));
+ DIALOGFACTORY->updateMouseWidget(tr("Specify position"), tr("Cancel"));
break;
case SetAngle:
- RS_DIALOGFACTORY->updateMouseWidget(tr("Enter angle:"), tr("Back"));
+ DIALOGFACTORY->updateMouseWidget(tr("Enter angle:"), tr("Back"));
break;
case SetLength:
- RS_DIALOGFACTORY->updateMouseWidget(tr("Enter length:"), tr("Back"));
+ DIALOGFACTORY->updateMouseWidget(tr("Enter length:"), tr("Back"));
break;
default:
void ActionDrawLineAngle::showOptions()
{
ActionInterface::showOptions();
- RS_DIALOGFACTORY->requestOptions(this, true);
+ DIALOGFACTORY->requestOptions(this, true);
}
void ActionDrawLineAngle::hideOptions()
{
ActionInterface::hideOptions();
- RS_DIALOGFACTORY->requestOptions(this, false);
+ DIALOGFACTORY->requestOptions(this, false);
}
void ActionDrawLineAngle::updateMouseCursor()
void ActionDrawLineAngle::updateToolBar()
{
if (!isFinished())
- RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarSnap);
+ DIALOGFACTORY->requestToolBar(RS2::ToolBarSnap);
else
- RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarLines);
+ DIALOGFACTORY->requestToolBar(RS2::ToolBarLines);
}
void ActionDrawLineAngle::setSnapPoint(int sp)
SetLength /**< Setting length in the command line. */
};
- ActionDrawLineAngle(RS_EntityContainer & container, GraphicView & graphicView,
+ ActionDrawLineAngle(EntityContainer & container, GraphicView & graphicView,
double angle = 0.0, bool fixedAngle = false);
~ActionDrawLineAngle();
virtual void mouseReleaseEvent(QMouseEvent * e);
void preparePreview();
virtual void coordinateEvent(Vector * e);
- virtual void commandEvent(RS_CommandEvent * e);
+ virtual void commandEvent(CommandEvent * e);
virtual QStringList getAvailableCommands();
virtual void hideOptions();
virtual void showOptions();
protected:
/** Line data defined so far. */
- RS_LineData data;
+ LineData data;
/** Position. */
Vector pos;
/** Line angle. */
#include "graphicview.h"
#include "preview.h"
-ActionDrawLineBisector::ActionDrawLineBisector(RS_EntityContainer & container,
+ActionDrawLineBisector::ActionDrawLineBisector(EntityContainer & container,
GraphicView & graphicView):
ActionInterface("Draw Bisectors", container, graphicView),
bisector(NULL), line1(NULL), line2(NULL), length(10.0), number(1),
void ActionDrawLineBisector::trigger()
{
ActionInterface::trigger();
- RS_Creation creation(container, graphicView);
+ Creation creation(container, graphicView);
creation.createBisector(coord1, coord2, length, number, line1, line2);
graphicView->redraw();
}
void ActionDrawLineBisector::mouseMoveEvent(QMouseEvent * e)
{
- RS_DEBUG->print("ActionDrawLineBisector::mouseMoveEvent begin");
+ DEBUG->print("ActionDrawLineBisector::mouseMoveEvent begin");
Vector mouse = Vector(graphicView->toGraphX(e->x()),
graphicView->toGraphY(e->y()));
case SetLine2:
{
coord2 = mouse;
- RS_Entity * en = catchEntity(e, RS2::ResolveAll);
+ Entity * en = catchEntity(e, RS2::ResolveAll);
if (en && en->rtti() == RS2::EntityLine)
{
- line2 = (RS_Line *)en;
+ line2 = (Line *)en;
graphicView->preview.clear();
- RS_Creation creation(&(graphicView->preview), NULL, false);
+ Creation creation(&(graphicView->preview), NULL, false);
creation.createBisector(coord1, coord2, length, number, line1, line2);
}
}
}
graphicView->redraw();
- RS_DEBUG->print("ActionDrawLineBisector::mouseMoveEvent end");
+ DEBUG->print("ActionDrawLineBisector::mouseMoveEvent end");
}
void ActionDrawLineBisector::mouseReleaseEvent(QMouseEvent * e)
case SetLine1:
{
coord1 = mouse;
- RS_Entity * en = catchEntity(e, RS2::ResolveAll);
+ Entity * en = catchEntity(e, RS2::ResolveAll);
if (en && en->rtti() == RS2::EntityLine)
{
- line1 = (RS_Line *)en;
+ line1 = (Line *)en;
setStatus(SetLine2);
}
}
}
}
-void ActionDrawLineBisector::commandEvent(RS_CommandEvent * e)
+void ActionDrawLineBisector::commandEvent(CommandEvent * e)
{
QString c = e->getCommand().toLower();
if (checkCommand("help", c))
{
- RS_DIALOGFACTORY->commandMessage(msgAvailableCommands()
+ DIALOGFACTORY->commandMessage(msgAvailableCommands()
+ getAvailableCommands().join(", "));
return;
}
case SetLength:
{
bool ok;
- double l = RS_Math::eval(c, &ok);
+ double l = Math::eval(c, &ok);
if (ok)
length = l;
else
- RS_DIALOGFACTORY->commandMessage(tr("Not a valid expression"));
+ DIALOGFACTORY->commandMessage(tr("Not a valid expression"));
- RS_DIALOGFACTORY->requestOptions(this, true, true);
+ DIALOGFACTORY->requestOptions(this, true, true);
setStatus(lastStatus);
}
break;
case SetNumber:
{
bool ok;
- int n = (int)RS_Math::eval(c, &ok);
+ int n = (int)Math::eval(c, &ok);
if (ok)
number = n;
else
- RS_DIALOGFACTORY->commandMessage(tr("Not a valid expression"));
+ DIALOGFACTORY->commandMessage(tr("Not a valid expression"));
- RS_DIALOGFACTORY->requestOptions(this, true, true);
+ DIALOGFACTORY->requestOptions(this, true, true);
setStatus(lastStatus);
}
break;
switch (getStatus())
{
case SetLine1:
- RS_DIALOGFACTORY->updateMouseWidget(tr("Select first line"), tr("Cancel"));
+ DIALOGFACTORY->updateMouseWidget(tr("Select first line"), tr("Cancel"));
break;
case SetLine2:
- RS_DIALOGFACTORY->updateMouseWidget(tr("Select second line"), tr("Back"));
+ DIALOGFACTORY->updateMouseWidget(tr("Select second line"), tr("Back"));
break;
case SetLength:
- RS_DIALOGFACTORY->updateMouseWidget(tr("Enter bisector length:"), tr("Back"));
+ DIALOGFACTORY->updateMouseWidget(tr("Enter bisector length:"), tr("Back"));
break;
case SetNumber:
- RS_DIALOGFACTORY->updateMouseWidget(tr("Enter number of bisectors:"), tr("Back"));
+ DIALOGFACTORY->updateMouseWidget(tr("Enter number of bisectors:"), tr("Back"));
break;
default:
- RS_DIALOGFACTORY->updateMouseWidget("", "");
+ DIALOGFACTORY->updateMouseWidget("", "");
break;
}
}
void ActionDrawLineBisector::showOptions()
{
ActionInterface::showOptions();
- RS_DIALOGFACTORY->requestOptions(this, true);
+ DIALOGFACTORY->requestOptions(this, true);
}
void ActionDrawLineBisector::hideOptions()
{
ActionInterface::hideOptions();
- RS_DIALOGFACTORY->requestOptions(this, false);
+ DIALOGFACTORY->requestOptions(this, false);
}
void ActionDrawLineBisector::updateMouseCursor()
void ActionDrawLineBisector::updateToolBar()
{
- RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarLines);
+ DIALOGFACTORY->requestToolBar(RS2::ToolBarLines);
}
void ActionDrawLineBisector::setLength(double l)
#include "actioninterface.h"
#include "vector.h"
-class RS_Line;
+class Line;
/**
* This action class can handle user events to draw bisectors.
};
public:
- ActionDrawLineBisector(RS_EntityContainer & container, GraphicView & graphicView);
+ ActionDrawLineBisector(EntityContainer & container, GraphicView & graphicView);
~ActionDrawLineBisector();
virtual RS2::ActionType rtti();
virtual void trigger();
virtual void mouseMoveEvent(QMouseEvent * e);
virtual void mouseReleaseEvent(QMouseEvent * e);
- virtual void commandEvent(RS_CommandEvent * e);
+ virtual void commandEvent(CommandEvent * e);
virtual QStringList getAvailableCommands();
virtual void hideOptions();
virtual void showOptions();
private:
/** Closest bisector. */
- RS_Line * bisector;
+ Line * bisector;
/** First chosen entity */
- RS_Line * line1;
+ Line * line1;
/** Second chosen entity */
- RS_Line * line2;
+ Line * line2;
/** Data of new bisector */
- RS_LineData data;
+ LineData data;
/** Length of the bisector. */
double length;
/** Number of bisectors to create. */
#include "graphicview.h"
#include "polyline.h"
-ActionDrawLineFree::ActionDrawLineFree(RS_EntityContainer & container,
+ActionDrawLineFree::ActionDrawLineFree(EntityContainer & container,
GraphicView & graphicView): ActionInterface("Draw freehand lines",
container, graphicView)
{
document->endUndoCycle();
}
- RS_DEBUG->print("ActionDrawLineFree::trigger():"
+ DEBUG->print("ActionDrawLineFree::trigger():"
" polyline added: %d", polyline->getId());
polyline = NULL;
}
if (vertex.valid && polyline)
{
Vector v = snapPoint(e);
- RS_Entity * ent = polyline->addVertex(v);
+ Entity * ent = polyline->addVertex(v);
ent->setLayerToActive();
ent->setPenToActive();
vertex = v;
- RS_DEBUG->print("ActionDrawLineFree::mouseMoveEvent():"
+ DEBUG->print("ActionDrawLineFree::mouseMoveEvent():"
" line added: %d", ent->getId());
}
}
if (e->button() == Qt::LeftButton)
{
vertex = snapPoint(e);
- polyline = new RS_Polyline(container, RS_PolylineData(vertex, vertex, 0));
+ polyline = new Polyline(container, PolylineData(vertex, vertex, 0));
polyline->setLayerToActive();
polyline->setPenToActive();
}
switch (getStatus())
{
case 0:
- RS_DIALOGFACTORY->updateMouseWidget(tr("Click and drag to draw a line"), tr("Cancel"));
+ DIALOGFACTORY->updateMouseWidget(tr("Click and drag to draw a line"), tr("Cancel"));
break;
default:
- RS_DIALOGFACTORY->updateMouseWidget("", "");
+ DIALOGFACTORY->updateMouseWidget("", "");
break;
}
}
void ActionDrawLineFree::updateToolBar()
{
if (!isFinished())
- RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarSnap);
+ DIALOGFACTORY->requestToolBar(RS2::ToolBarSnap);
else
- RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarLines);
+ DIALOGFACTORY->requestToolBar(RS2::ToolBarLines);
}
#include "actioninterface.h"
#include "vector.h"
-class RS_Polyline;
+class Polyline;
/**
* This action class can handle user events to draw freehand lines.
class ActionDrawLineFree: public ActionInterface
{
public:
- ActionDrawLineFree(RS_EntityContainer & container, GraphicView & graphicView);
+ ActionDrawLineFree(EntityContainer & container, GraphicView & graphicView);
~ActionDrawLineFree();
virtual void trigger();
protected:
Vector vertex;
- RS_Polyline * polyline;
+ Polyline * polyline;
};
#endif // __ACTIONDRAWLINEFREE_H__
#include "graphicview.h"
#include "preview.h"
-ActionDrawLineHorVert::ActionDrawLineHorVert(RS_EntityContainer & container, GraphicView & graphicView): ActionInterface("Draw horizontal/vertical lines",
+ActionDrawLineHorVert::ActionDrawLineHorVert(EntityContainer & container, GraphicView & graphicView): ActionInterface("Draw horizontal/vertical lines",
container, graphicView)
{
reset();
- RS_DEBUG->print("ActionDrawLineHorVert::constructor");
+ DEBUG->print("ActionDrawLineHorVert::constructor");
}
ActionDrawLineHorVert::~ActionDrawLineHorVert()
void ActionDrawLineHorVert::reset()
{
- data = RS_LineData(Vector(false), Vector(false));
+ data = LineData(Vector(false), Vector(false));
}
void ActionDrawLineHorVert::init(int status)
{
ActionInterface::init(status);
reset();
- RS_DEBUG->print("ActionDrawLineHorVert::init");
+ DEBUG->print("ActionDrawLineHorVert::init");
}
void ActionDrawLineHorVert::trigger()
{
ActionInterface::trigger();
- RS_Line * line = new RS_Line(container, data);
+ Line * line = new Line(container, data);
line->setLayerToActive();
line->setPenToActive();
container->addEntity(line);
graphicView->moveRelativeZero(Vector(0.0, 0.0));
graphicView->drawEntity(line);
graphicView->moveRelativeZero(line->getMiddlepoint());
- RS_DEBUG->print("ActionDrawLineHorVert::trigger():"
+ DEBUG->print("ActionDrawLineHorVert::trigger():"
" line added: %d", line->getId());
}
void ActionDrawLineHorVert::mouseMoveEvent(QMouseEvent * e)
{
- RS_DEBUG->print("ActionDrawLineHorVert::mouseMoveEvent begin");
+ DEBUG->print("ActionDrawLineHorVert::mouseMoveEvent begin");
Vector mouse = snapPoint(e);
deletePreview();
clearPreview();
- data = RS_LineData(p1, p2);
-// preview->addEntity(new RS_Line(preview, data));
+ data = LineData(p1, p2);
+// preview->addEntity(new Line(preview, data));
drawPreview();
}
- RS_DEBUG->print("ActionDrawLineHorVert::mouseMoveEvent end");
+ DEBUG->print("ActionDrawLineHorVert::mouseMoveEvent end");
}
void ActionDrawLineHorVert::mouseReleaseEvent(QMouseEvent * e)
switch (getStatus())
{
case SetStartpoint:
- RS_DIALOGFACTORY->updateMouseWidget(tr("Specify first point"), tr("Cancel"));
+ DIALOGFACTORY->updateMouseWidget(tr("Specify first point"), tr("Cancel"));
break;
case SetEndpoint:
- RS_DIALOGFACTORY->updateMouseWidget(tr("Specify second point"), tr("Back"));
+ DIALOGFACTORY->updateMouseWidget(tr("Specify second point"), tr("Back"));
break;
default:
- RS_DIALOGFACTORY->updateMouseWidget("", "");
+ DIALOGFACTORY->updateMouseWidget("", "");
break;
}
}
void ActionDrawLineHorVert::updateToolBar()
{
if (!isFinished())
- RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarSnap);
+ DIALOGFACTORY->requestToolBar(RS2::ToolBarSnap);
else
- RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarLines);
+ DIALOGFACTORY->requestToolBar(RS2::ToolBarLines);
}
};
public:
- ActionDrawLineHorVert(RS_EntityContainer & container, GraphicView & graphicView);
+ ActionDrawLineHorVert(EntityContainer & container, GraphicView & graphicView);
~ActionDrawLineHorVert();
void reset();
/**
* Line data.
*/
- RS_LineData data;
+ LineData data;
/**
* 2 points
*/
#include "graphicview.h"
#include "preview.h"
-ActionDrawLineParallel::ActionDrawLineParallel(RS_EntityContainer & container,
+ActionDrawLineParallel::ActionDrawLineParallel(EntityContainer & container,
GraphicView & graphicView):
ActionInterface("Draw Parallels", container, graphicView),
parallel(NULL), distance(1.0), number(1), coord(Vector(false)), entity(NULL)
void ActionDrawLineParallel::trigger()
{
ActionInterface::trigger();
- RS_Creation creation(container, graphicView);
- RS_Entity * e = creation.createParallel(coord, distance, number, entity);
+ Creation creation(container, graphicView);
+ Entity * e = creation.createParallel(coord, distance, number, entity);
if (!e)
- RS_DEBUG->print("ActionDrawLineParallel::trigger: No parallels added\n");
+ DEBUG->print("ActionDrawLineParallel::trigger: No parallels added\n");
graphicView->preview.clear();
graphicView->redraw();
void ActionDrawLineParallel::mouseMoveEvent(QMouseEvent * e)
{
- RS_DEBUG->print("ActionDrawLineParallel::mouseMoveEvent begin");
+ DEBUG->print("ActionDrawLineParallel::mouseMoveEvent begin");
coord = Vector(graphicView->toGraphX(e->x()), graphicView->toGraphY(e->y()));
entity = catchEntity(e, RS2::ResolveAll);
#if 0
deletePreview();
clearPreview();
- RS_Creation creation(preview, NULL, false);
+ Creation creation(preview, NULL, false);
creation.createParallel(coord, distance, number, entity);
drawPreview();
#else
graphicView->preview.clear();
- RS_Creation creation(&(graphicView->preview), NULL, false);
+ Creation creation(&(graphicView->preview), NULL, false);
creation.createParallel(coord, distance, number, entity);
graphicView->redraw();
#endif
break;
}
- RS_DEBUG->print("ActionDrawLineParallel::mouseMoveEvent end");
+ DEBUG->print("ActionDrawLineParallel::mouseMoveEvent end");
}
void ActionDrawLineParallel::mouseReleaseEvent(QMouseEvent * e)
void ActionDrawLineParallel::updateMouseButtonHints()
{
- if (RS_DIALOGFACTORY)
+ if (DIALOGFACTORY)
{
switch (getStatus())
{
case SetEntity:
- RS_DIALOGFACTORY->updateMouseWidget(
+ DIALOGFACTORY->updateMouseWidget(
tr("Specify Distance <%1> or select entity or [%2]")
- .arg(distance).arg(RS_COMMANDS->command("through")),
+ .arg(distance).arg(COMMANDS->command("through")),
tr("Cancel"));
break;
case SetNumber:
- RS_DIALOGFACTORY->updateMouseWidget(tr("Enter number:"), "");
+ DIALOGFACTORY->updateMouseWidget(tr("Enter number:"), "");
break;
default:
- RS_DIALOGFACTORY->updateMouseWidget("", "");
+ DIALOGFACTORY->updateMouseWidget("", "");
break;
}
}
{
ActionInterface::showOptions();
- if (RS_DIALOGFACTORY)
- RS_DIALOGFACTORY->requestOptions(this, true);
+ if (DIALOGFACTORY)
+ DIALOGFACTORY->requestOptions(this, true);
updateMouseButtonHints();
}
{
ActionInterface::hideOptions();
- if (RS_DIALOGFACTORY)
- RS_DIALOGFACTORY->requestOptions(this, false);
+ if (DIALOGFACTORY)
+ DIALOGFACTORY->requestOptions(this, false);
}
-void ActionDrawLineParallel::commandEvent(RS_CommandEvent * e)
+void ActionDrawLineParallel::commandEvent(CommandEvent * e)
{
QString c = e->getCommand().toLower();
if (checkCommand("help", c))
{
- if (RS_DIALOGFACTORY)
- RS_DIALOGFACTORY->commandMessage(msgAvailableCommands()
+ if (DIALOGFACTORY)
+ DIALOGFACTORY->commandMessage(msgAvailableCommands()
+ getAvailableCommands().join(", "));
return;
else
{
bool ok;
- double d = RS_Math::eval(c, &ok);
+ double d = Math::eval(c, &ok);
if (ok && d > 1.0e-10)
distance = d;
- else if (RS_DIALOGFACTORY)
- RS_DIALOGFACTORY->commandMessage(tr("Not a valid expression"));
+ else if (DIALOGFACTORY)
+ DIALOGFACTORY->commandMessage(tr("Not a valid expression"));
- if (RS_DIALOGFACTORY != NULL)
- RS_DIALOGFACTORY->requestOptions(this, true, true);
+ if (DIALOGFACTORY != NULL)
+ DIALOGFACTORY->requestOptions(this, true, true);
updateMouseButtonHints();
//setStatus(SetEntity);
{
if (n > 0 && n < 100)
number = n;
- else if (RS_DIALOGFACTORY)
- RS_DIALOGFACTORY->commandMessage(tr("Not a valid number. Try 1..99"));
+ else if (DIALOGFACTORY)
+ DIALOGFACTORY->commandMessage(tr("Not a valid number. Try 1..99"));
}
- else if (RS_DIALOGFACTORY)
- RS_DIALOGFACTORY->commandMessage(tr("Not a valid expression"));
+ else if (DIALOGFACTORY)
+ DIALOGFACTORY->commandMessage(tr("Not a valid expression"));
- if (RS_DIALOGFACTORY)
- RS_DIALOGFACTORY->requestOptions(this, true, true);
+ if (DIALOGFACTORY)
+ DIALOGFACTORY->requestOptions(this, true, true);
setStatus(SetEntity);
}
void ActionDrawLineParallel::updateToolBar()
{
- if (RS_DIALOGFACTORY)
- RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarLines);
+ if (DIALOGFACTORY)
+ DIALOGFACTORY->requestToolBar(RS2::ToolBarLines);
}
double ActionDrawLineParallel::getDistance()
#include "actioninterface.h"
#include "vector.h"
-class RS_Entity;
+class Entity;
/**
* This action class can handle user events to draw parallel lines, arcs and
};
public:
- ActionDrawLineParallel(RS_EntityContainer & container, GraphicView & graphicView);
+ ActionDrawLineParallel(EntityContainer & container, GraphicView & graphicView);
~ActionDrawLineParallel();
virtual RS2::ActionType rtti();
virtual void mouseMoveEvent(QMouseEvent * e);
virtual void mouseReleaseEvent(QMouseEvent * e);
virtual void updateMouseButtonHints();
- virtual void commandEvent(RS_CommandEvent * e);
+ virtual void commandEvent(CommandEvent * e);
virtual QStringList getAvailableCommands();
virtual void hideOptions();
virtual void showOptions();
private:
/** Closest parallel. */
- RS_Entity * parallel;
+ Entity * parallel;
/** Data of new line */
- RS_LineData data;
+ LineData data;
/** Distance of the parallel. */
double distance;
/** Number of parallels. */
/** Coordinate of the mouse. */
Vector coord;
/** Original entity. */
- RS_Entity * entity;
+ Entity * entity;
};
#endif // __ACTIONDRAWLINEPARALLEL_H__
#include "preview.h"
ActionDrawLineParallelThrough::ActionDrawLineParallelThrough(
- RS_EntityContainer & container, GraphicView & graphicView):
+ EntityContainer & container, GraphicView & graphicView):
ActionInterface("Draw Parallels", container, graphicView)
{
parallel = NULL;
if (entity)
{
- RS_Creation creation(container, graphicView);
- RS_Entity * e = creation.createParallelThrough(coord, number, entity);
+ Creation creation(container, graphicView);
+ Entity * e = creation.createParallelThrough(coord, number, entity);
if (!e)
- RS_DEBUG->print("ActionDrawLineParallelThrough::trigger:"
+ DEBUG->print("ActionDrawLineParallelThrough::trigger:"
" No parallels added\n");
}
}
void ActionDrawLineParallelThrough::mouseMoveEvent(QMouseEvent * e)
{
- RS_DEBUG->print("ActionDrawLineParallelThrough::mouseMoveEvent begin");
+ DEBUG->print("ActionDrawLineParallelThrough::mouseMoveEvent begin");
switch (getStatus())
{
deletePreview();
clearPreview();
-// RS_Creation creation(preview, NULL, false);
+// Creation creation(preview, NULL, false);
// creation.createParallelThrough(coord, number, entity);
drawPreview();
break;
}
- RS_DEBUG->print("ActionDrawLineParallelThrough::mouseMoveEvent end");
+ DEBUG->print("ActionDrawLineParallelThrough::mouseMoveEvent end");
}
void ActionDrawLineParallelThrough::mouseReleaseEvent(QMouseEvent * e)
switch (getStatus())
{
case SetEntity:
- RS_DIALOGFACTORY->updateMouseWidget(tr("Select entity"), tr("Cancel"));
+ DIALOGFACTORY->updateMouseWidget(tr("Select entity"), tr("Cancel"));
break;
case SetPos:
- RS_DIALOGFACTORY->updateMouseWidget(tr("Specify through point"), tr("Back"));
+ DIALOGFACTORY->updateMouseWidget(tr("Specify through point"), tr("Back"));
break;
case SetNumber:
- RS_DIALOGFACTORY->updateMouseWidget(tr("Number:"), tr("Back"));
+ DIALOGFACTORY->updateMouseWidget(tr("Number:"), tr("Back"));
break;
default:
- RS_DIALOGFACTORY->updateMouseWidget("", "");
+ DIALOGFACTORY->updateMouseWidget("", "");
break;
}
}
void ActionDrawLineParallelThrough::showOptions()
{
ActionInterface::showOptions();
- RS_DIALOGFACTORY->requestOptions(this, true);
+ DIALOGFACTORY->requestOptions(this, true);
updateMouseButtonHints();
}
void ActionDrawLineParallelThrough::hideOptions()
{
ActionInterface::hideOptions();
- RS_DIALOGFACTORY->requestOptions(this, false);
+ DIALOGFACTORY->requestOptions(this, false);
}
-void ActionDrawLineParallelThrough::commandEvent(RS_CommandEvent * e)
+void ActionDrawLineParallelThrough::commandEvent(CommandEvent * e)
{
QString c = e->getCommand().toLower();
if (checkCommand("help", c))
{
- RS_DIALOGFACTORY->commandMessage(msgAvailableCommands()
+ DIALOGFACTORY->commandMessage(msgAvailableCommands()
+ getAvailableCommands().join(", "));
return;
}
if (n > 0 && n < 100)
number = n;
else
- RS_DIALOGFACTORY->commandMessage(tr("Not a valid number. "
+ DIALOGFACTORY->commandMessage(tr("Not a valid number. "
"Try 1..99"));
}
else
- RS_DIALOGFACTORY->commandMessage(tr("Not a valid expression"));
- RS_DIALOGFACTORY->requestOptions(this, true, true);
+ DIALOGFACTORY->commandMessage(tr("Not a valid expression"));
+ DIALOGFACTORY->requestOptions(this, true, true);
setStatus(lastStatus);
}
break;
void ActionDrawLineParallelThrough::updateToolBar()
{
if (getStatus() == SetPos && !isFinished())
- RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarSnap);
+ DIALOGFACTORY->requestToolBar(RS2::ToolBarSnap);
else
- RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarLines);
+ DIALOGFACTORY->requestToolBar(RS2::ToolBarLines);
}
int ActionDrawLineParallelThrough::getNumber()
#include "actioninterface.h"
#include "vector.h"
-class RS_Entity;
+class Entity;
/**
* This action class can handle user events to draw parallel lines, arcs and
};
public:
- ActionDrawLineParallelThrough(RS_EntityContainer & container, GraphicView & graphicView);
+ ActionDrawLineParallelThrough(EntityContainer & container, GraphicView & graphicView);
~ActionDrawLineParallelThrough();
virtual RS2::ActionType rtti();
virtual void mouseReleaseEvent(QMouseEvent * e);
virtual void updateMouseButtonHints();
virtual void coordinateEvent(Vector * e);
- virtual void commandEvent(RS_CommandEvent * e);
+ virtual void commandEvent(CommandEvent * e);
virtual QStringList getAvailableCommands();
virtual void hideOptions();
virtual void showOptions();
private:
/** Closest parallel. */
- RS_Entity * parallel;
+ Entity * parallel;
/** Data of new line */
- RS_LineData data;
+ LineData data;
/** Number of parallels. */
int number;
/** Coordinate of the mouse. */
Vector coord;
/** Original entity. */
- RS_Entity * entity;
+ Entity * entity;
/** Last status before entering length or number. */
Status lastStatus;
};
#include "graphicview.h"
#include "preview.h"
-ActionDrawLinePolygon::ActionDrawLinePolygon(RS_EntityContainer & container,
+ActionDrawLinePolygon::ActionDrawLinePolygon(EntityContainer & container,
GraphicView & graphicView): ActionInterface("Draw Polygons",
container, graphicView)
{
// deletePreview();
// clearPreview();
- RS_Creation creation(container, graphicView);
+ Creation creation(container, graphicView);
bool ok = creation.createPolygon(center, corner, number);
if (!ok)
- RS_DEBUG->print("ActionDrawLinePolygon::trigger: No polygon added\n");
+ DEBUG->print("ActionDrawLinePolygon::trigger: No polygon added\n");
}
void ActionDrawLinePolygon::mouseMoveEvent(QMouseEvent * e)
{
- RS_DEBUG->print("ActionDrawLinePolygon::mouseMoveEvent begin");
+ DEBUG->print("ActionDrawLinePolygon::mouseMoveEvent begin");
Vector mouse = snapPoint(e);
deletePreview();
clearPreview();
-// RS_Creation creation(preview, NULL, false);
+// Creation creation(preview, NULL, false);
// creation.createPolygon(center, corner, number);
drawPreview();
void ActionDrawLinePolygon::updateMouseButtonHints()
{
- if (RS_DIALOGFACTORY != NULL)
+ if (DIALOGFACTORY != NULL)
{
switch (getStatus())
{
case SetCenter:
- RS_DIALOGFACTORY->updateMouseWidget(tr("Specify center"),
+ DIALOGFACTORY->updateMouseWidget(tr("Specify center"),
"");
break;
case SetCorner:
- RS_DIALOGFACTORY->updateMouseWidget(tr("Specify a corner"), "");
+ DIALOGFACTORY->updateMouseWidget(tr("Specify a corner"), "");
break;
case SetNumber:
- RS_DIALOGFACTORY->updateMouseWidget(tr("Enter number:"), "");
+ DIALOGFACTORY->updateMouseWidget(tr("Enter number:"), "");
break;
default:
- RS_DIALOGFACTORY->updateMouseWidget("", "");
+ DIALOGFACTORY->updateMouseWidget("", "");
break;
}
}
{
ActionInterface::showOptions();
- if (RS_DIALOGFACTORY != NULL)
- RS_DIALOGFACTORY->requestOptions(this, true);
+ if (DIALOGFACTORY != NULL)
+ DIALOGFACTORY->requestOptions(this, true);
}
void ActionDrawLinePolygon::hideOptions()
{
ActionInterface::hideOptions();
- if (RS_DIALOGFACTORY != NULL)
- RS_DIALOGFACTORY->requestOptions(this, false);
+ if (DIALOGFACTORY != NULL)
+ DIALOGFACTORY->requestOptions(this, false);
}
-void ActionDrawLinePolygon::commandEvent(RS_CommandEvent * e)
+void ActionDrawLinePolygon::commandEvent(CommandEvent * e)
{
QString c = e->getCommand().toLower();
if (checkCommand("help", c))
{
- if (RS_DIALOGFACTORY != NULL)
- RS_DIALOGFACTORY->commandMessage(msgAvailableCommands()
+ if (DIALOGFACTORY != NULL)
+ DIALOGFACTORY->commandMessage(msgAvailableCommands()
+ getAvailableCommands().join(", "));
return;
}
{
if (n > 0 && n < 10000)
number = n;
- else if (RS_DIALOGFACTORY != NULL)
- RS_DIALOGFACTORY->commandMessage(tr("Not a valid number. "
+ else if (DIALOGFACTORY != NULL)
+ DIALOGFACTORY->commandMessage(tr("Not a valid number. "
"Try 1..9999"));
}
- else if (RS_DIALOGFACTORY != NULL)
- RS_DIALOGFACTORY->commandMessage(tr("Not a valid expression"));
+ else if (DIALOGFACTORY != NULL)
+ DIALOGFACTORY->commandMessage(tr("Not a valid expression"));
- if (RS_DIALOGFACTORY != NULL)
- RS_DIALOGFACTORY->requestOptions(this, true, true);
+ if (DIALOGFACTORY != NULL)
+ DIALOGFACTORY->requestOptions(this, true, true);
setStatus(lastStatus);
}
break;
void ActionDrawLinePolygon::updateToolBar()
{
- if (RS_DIALOGFACTORY != NULL)
+ if (DIALOGFACTORY != NULL)
{
if (!isFinished())
- RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarSnap);
+ DIALOGFACTORY->requestToolBar(RS2::ToolBarSnap);
else
- RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarLines);
+ DIALOGFACTORY->requestToolBar(RS2::ToolBarLines);
}
}
};
public:
- ActionDrawLinePolygon(RS_EntityContainer & container, GraphicView & graphicView);
+ ActionDrawLinePolygon(EntityContainer & container, GraphicView & graphicView);
~ActionDrawLinePolygon();
virtual RS2::ActionType rtti();
virtual void mouseReleaseEvent(QMouseEvent * e);
virtual void updateMouseButtonHints();
virtual void coordinateEvent(Vector * e);
- virtual void commandEvent(RS_CommandEvent * e);
+ virtual void commandEvent(CommandEvent * e);
virtual QStringList getAvailableCommands();
virtual void hideOptions();
virtual void showOptions();
#include "graphicview.h"
#include "preview.h"
-ActionDrawLinePolygon2::ActionDrawLinePolygon2(RS_EntityContainer & container, GraphicView & graphicView): ActionInterface("Draw Polygons",
+ActionDrawLinePolygon2::ActionDrawLinePolygon2(EntityContainer & container, GraphicView & graphicView): ActionInterface("Draw Polygons",
container, graphicView)
{
corner1 = Vector(false);
deletePreview();
clearPreview();
- RS_Creation creation(container, graphicView);
+ Creation creation(container, graphicView);
bool ok = creation.createPolygon2(corner1, corner2, number);
if (!ok)
- RS_DEBUG->print("ActionDrawLinePolygon2::trigger: No polygon added\n");
+ DEBUG->print("ActionDrawLinePolygon2::trigger: No polygon added\n");
}
void ActionDrawLinePolygon2::mouseMoveEvent(QMouseEvent * e)
{
- RS_DEBUG->print("ActionDrawLinePolygon2::mouseMoveEvent begin");
+ DEBUG->print("ActionDrawLinePolygon2::mouseMoveEvent begin");
Vector mouse = snapPoint(e);
deletePreview();
clearPreview();
-// RS_Creation creation(preview, NULL, false);
+// Creation creation(preview, NULL, false);
// creation.createPolygon2(corner1, corner2, number);
drawPreview();
void ActionDrawLinePolygon2::updateMouseButtonHints()
{
- if (RS_DIALOGFACTORY != NULL)
+ if (DIALOGFACTORY != NULL)
{
switch (getStatus())
{
case SetCorner1:
- RS_DIALOGFACTORY->updateMouseWidget(tr("Specify first corner"),
+ DIALOGFACTORY->updateMouseWidget(tr("Specify first corner"),
tr("Cancel"));
break;
case SetCorner2:
- RS_DIALOGFACTORY->updateMouseWidget(tr("Specify second corner"),
+ DIALOGFACTORY->updateMouseWidget(tr("Specify second corner"),
tr("Back"));
break;
case SetNumber:
- RS_DIALOGFACTORY->updateMouseWidget(tr("Number:"), tr("Back"));
+ DIALOGFACTORY->updateMouseWidget(tr("Number:"), tr("Back"));
break;
default:
- RS_DIALOGFACTORY->updateMouseWidget("", "");
+ DIALOGFACTORY->updateMouseWidget("", "");
break;
}
}
{
ActionInterface::showOptions();
- if (RS_DIALOGFACTORY != NULL)
- RS_DIALOGFACTORY->requestOptions(this, true);
+ if (DIALOGFACTORY != NULL)
+ DIALOGFACTORY->requestOptions(this, true);
}
void ActionDrawLinePolygon2::hideOptions()
{
ActionInterface::hideOptions();
- if (RS_DIALOGFACTORY != NULL)
- RS_DIALOGFACTORY->requestOptions(this, false);
+ if (DIALOGFACTORY != NULL)
+ DIALOGFACTORY->requestOptions(this, false);
}
-void ActionDrawLinePolygon2::commandEvent(RS_CommandEvent * e)
+void ActionDrawLinePolygon2::commandEvent(CommandEvent * e)
{
QString c = e->getCommand().toLower();
if (checkCommand("help", c))
{
- if (RS_DIALOGFACTORY != NULL)
- RS_DIALOGFACTORY->commandMessage(msgAvailableCommands()
+ if (DIALOGFACTORY != NULL)
+ DIALOGFACTORY->commandMessage(msgAvailableCommands()
+ getAvailableCommands().join(", "));
return;
}
{
if (n > 0 && n < 10000)
number = n;
- else if (RS_DIALOGFACTORY != NULL)
- RS_DIALOGFACTORY->commandMessage(tr("Not a valid number. "
+ else if (DIALOGFACTORY != NULL)
+ DIALOGFACTORY->commandMessage(tr("Not a valid number. "
"Try 1..9999"));
}
- else if (RS_DIALOGFACTORY != NULL)
- RS_DIALOGFACTORY->commandMessage(tr("Not a valid expression."));
+ else if (DIALOGFACTORY != NULL)
+ DIALOGFACTORY->commandMessage(tr("Not a valid expression."));
- if (RS_DIALOGFACTORY != NULL)
- RS_DIALOGFACTORY->requestOptions(this, true, true);
+ if (DIALOGFACTORY != NULL)
+ DIALOGFACTORY->requestOptions(this, true, true);
setStatus(lastStatus);
}
break;
void ActionDrawLinePolygon2::updateToolBar()
{
- if (RS_DIALOGFACTORY != NULL)
+ if (DIALOGFACTORY != NULL)
{
if (!isFinished())
- RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarSnap);
+ DIALOGFACTORY->requestToolBar(RS2::ToolBarSnap);
else
- RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarLines);
+ DIALOGFACTORY->requestToolBar(RS2::ToolBarLines);
}
}
};
public:
- ActionDrawLinePolygon2(RS_EntityContainer & container, GraphicView & graphicView);
+ ActionDrawLinePolygon2(EntityContainer & container, GraphicView & graphicView);
~ActionDrawLinePolygon2();
virtual RS2::ActionType rtti();
virtual void mouseReleaseEvent(QMouseEvent * e);
virtual void updateMouseButtonHints();
virtual void coordinateEvent(Vector * e);
- virtual void commandEvent(RS_CommandEvent * e);
+ virtual void commandEvent(CommandEvent * e);
virtual QStringList getAvailableCommands();
virtual void hideOptions();
virtual void showOptions();
#include "preview.h"
ActionDrawLineRectangle::ActionDrawLineRectangle(
- RS_EntityContainer & container, GraphicView & graphicView):
+ EntityContainer & container, GraphicView & graphicView):
ActionInterface("Draw rectangles", container, graphicView)
{
reset();
void ActionDrawLineRectangle::reset()
{
for(int i=0; i<4; i++)
- data[i] = RS_LineData(Vector(false), Vector(false));
+ data[i] = LineData(Vector(false), Vector(false));
}
void ActionDrawLineRectangle::init(int status)
{
ActionInterface::trigger();
- RS_Line * line[4];
+ Line * line[4];
preparePreview();
// create and add rectangle:
for(int i=0; i<4; i++)
{
- line[i] = new RS_Line(container, data[i]);
+ line[i] = new Line(container, data[i]);
line[i]->setLayerToActive();
line[i]->setPenToActive();
container->addEntity(line[i]);
for(int i=0; i<4; i++)
{
graphicView->drawEntity(line[i]);
- RS_DEBUG->print("ActionDrawLineRectangle::trigger(): line added: %d", line[i]->getId());
+ DEBUG->print("ActionDrawLineRectangle::trigger(): line added: %d", line[i]->getId());
}
graphicView->moveRelativeZero(corner2);
void ActionDrawLineRectangle::mouseMoveEvent(QMouseEvent * e)
{
- RS_DEBUG->print("ActionDrawLineRectangle::mouseMoveEvent begin");
+ DEBUG->print("ActionDrawLineRectangle::mouseMoveEvent begin");
Vector mouse = snapPoint(e);
// preparePreview();
// for(int i=0; i<4; i++)
-// preview->addEntity(new RS_Line(preview, data[i]));
+// preview->addEntity(new Line(preview, data[i]));
// drawPreview();
preparePreview();
graphicView->preview.clear();
for(int i=0; i<4; i++)
- graphicView->preview.addEntity(new RS_Line(&(graphicView->preview), data[i]));
+ graphicView->preview.addEntity(new Line(&(graphicView->preview), data[i]));
}
graphicView->redraw();
- RS_DEBUG->print("ActionDrawLineRectangle::mouseMoveEvent end");
+ DEBUG->print("ActionDrawLineRectangle::mouseMoveEvent end");
}
void ActionDrawLineRectangle::mouseReleaseEvent(QMouseEvent * e)
void ActionDrawLineRectangle::preparePreview()
{
- data[0] = RS_LineData(corner1, Vector(corner2.x, corner1.y));
- data[1] = RS_LineData(Vector(corner2.x, corner1.y), corner2);
- data[2] = RS_LineData(corner2, Vector(corner1.x, corner2.y));
- data[3] = RS_LineData(Vector(corner1.x, corner2.y), corner1);
+ data[0] = LineData(corner1, Vector(corner2.x, corner1.y));
+ data[1] = LineData(Vector(corner2.x, corner1.y), corner2);
+ data[2] = LineData(corner2, Vector(corner1.x, corner2.y));
+ data[3] = LineData(Vector(corner1.x, corner2.y), corner1);
}
void ActionDrawLineRectangle::coordinateEvent(Vector * e)
}
}
-void ActionDrawLineRectangle::commandEvent(RS_CommandEvent * e)
+void ActionDrawLineRectangle::commandEvent(CommandEvent * e)
{
QString c = e->getCommand().toLower();
if (checkCommand("help", c))
{
- if (RS_DIALOGFACTORY)
- RS_DIALOGFACTORY->commandMessage(msgAvailableCommands()
+ if (DIALOGFACTORY)
+ DIALOGFACTORY->commandMessage(msgAvailableCommands()
+ getAvailableCommands().join(", "));
return;
}
void ActionDrawLineRectangle::updateMouseButtonHints()
{
- if (RS_DIALOGFACTORY)
+ if (DIALOGFACTORY)
{
switch (getStatus())
{
case SetCorner1:
- RS_DIALOGFACTORY->updateMouseWidget(tr("Specify first corner"), tr("Cancel"));
+ DIALOGFACTORY->updateMouseWidget(tr("Specify first corner"), tr("Cancel"));
break;
case SetCorner2:
- RS_DIALOGFACTORY->updateMouseWidget(tr("Specify second corner"), tr("Back"));
+ DIALOGFACTORY->updateMouseWidget(tr("Specify second corner"), tr("Back"));
break;
default:
- RS_DIALOGFACTORY->updateMouseWidget("", "");
+ DIALOGFACTORY->updateMouseWidget("", "");
break;
}
}
void ActionDrawLineRectangle::updateToolBar()
{
- if (RS_DIALOGFACTORY)
+ if (DIALOGFACTORY)
{
if (!isFinished())
- RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarSnap);
+ DIALOGFACTORY->requestToolBar(RS2::ToolBarSnap);
else
- RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarLines);
+ DIALOGFACTORY->requestToolBar(RS2::ToolBarLines);
}
}
};
public:
- ActionDrawLineRectangle(RS_EntityContainer & container, GraphicView & graphicView);
+ ActionDrawLineRectangle(EntityContainer & container, GraphicView & graphicView);
~ActionDrawLineRectangle();
void reset();
virtual void mouseReleaseEvent(QMouseEvent * e);
void preparePreview();
virtual void coordinateEvent(Vector * e);
- virtual void commandEvent(RS_CommandEvent * e);
+ virtual void commandEvent(CommandEvent * e);
virtual QStringList getAvailableCommands();
virtual void updateMouseButtonHints();
virtual void updateMouseCursor();
protected:
/** Line data for the 4 lines. */
- RS_LineData data[4];
+ LineData data[4];
/** 1st corner. */
Vector corner1;
/** 2nd corner. */
#include "graphicview.h"
#include "preview.h"
-ActionDrawLineRelAngle::ActionDrawLineRelAngle(RS_EntityContainer & container,
+ActionDrawLineRelAngle::ActionDrawLineRelAngle(EntityContainer & container,
GraphicView & graphicView, double angle, bool fixedAngle):
ActionInterface("Draw Lines with relative angles", container, graphicView)
{
deletePreview();
clearPreview();
- RS_Creation creation(container, graphicView);
+ Creation creation(container, graphicView);
creation.createLineRelAngle(pos, entity, angle, length);
}
void ActionDrawLineRelAngle::mouseMoveEvent(QMouseEvent * e)
{
- RS_DEBUG->print("ActionDrawLineRelAngle::mouseMoveEvent begin");
+ DEBUG->print("ActionDrawLineRelAngle::mouseMoveEvent begin");
Vector mouse(graphicView->toGraphX(e->x()), graphicView->toGraphY(e->y()));
switch (getStatus())
deletePreview();
clearPreview();
-// RS_Creation creation(preview, NULL, false);
+// Creation creation(preview, NULL, false);
// creation.createLineRelAngle(pos, entity, angle, length);
drawPreview();
break;
}
- RS_DEBUG->print("ActionDrawLineRelAngle::mouseMoveEvent end");
+ DEBUG->print("ActionDrawLineRelAngle::mouseMoveEvent end");
}
void ActionDrawLineRelAngle::mouseReleaseEvent(QMouseEvent * e)
{
case SetEntity:
{
- RS_Entity * en = catchEntity(e, RS2::ResolveAll);
+ Entity * en = catchEntity(e, RS2::ResolveAll);
if (en != NULL
&& (en->rtti() == RS2::EntityLine
}
}
-void ActionDrawLineRelAngle::commandEvent(RS_CommandEvent * e)
+void ActionDrawLineRelAngle::commandEvent(CommandEvent * e)
{
QString c = e->getCommand().toLower();
if (checkCommand("help", c))
{
- if (RS_DIALOGFACTORY != NULL)
- RS_DIALOGFACTORY->commandMessage(msgAvailableCommands()
+ if (DIALOGFACTORY != NULL)
+ DIALOGFACTORY->commandMessage(msgAvailableCommands()
+ getAvailableCommands().join(", "));
return;
}
case SetAngle:
{
bool ok;
- double a = RS_Math::eval(c, &ok);
+ double a = Math::eval(c, &ok);
if (ok)
- angle = RS_Math::deg2rad(a);
- else if (RS_DIALOGFACTORY)
- RS_DIALOGFACTORY->commandMessage(tr("Not a valid expression"));
+ angle = Math::deg2rad(a);
+ else if (DIALOGFACTORY)
+ DIALOGFACTORY->commandMessage(tr("Not a valid expression"));
- if (RS_DIALOGFACTORY)
- RS_DIALOGFACTORY->requestOptions(this, true, true);
+ if (DIALOGFACTORY)
+ DIALOGFACTORY->requestOptions(this, true, true);
setStatus(SetPos);
}
case SetLength:
{
bool ok;
- double l = RS_Math::eval(c, &ok);
+ double l = Math::eval(c, &ok);
if (ok)
length = l;
- else if (RS_DIALOGFACTORY)
- RS_DIALOGFACTORY->commandMessage(tr("Not a valid expression"));
+ else if (DIALOGFACTORY)
+ DIALOGFACTORY->commandMessage(tr("Not a valid expression"));
- if (RS_DIALOGFACTORY)
- RS_DIALOGFACTORY->requestOptions(this, true, true);
+ if (DIALOGFACTORY)
+ DIALOGFACTORY->requestOptions(this, true, true);
setStatus(SetPos);
}
void ActionDrawLineRelAngle::updateMouseButtonHints()
{
- if (RS_DIALOGFACTORY)
+ if (DIALOGFACTORY)
{
switch (getStatus())
{
case SetEntity:
- RS_DIALOGFACTORY->updateMouseWidget(tr("Select base entity"),
+ DIALOGFACTORY->updateMouseWidget(tr("Select base entity"),
tr("Cancel"));
break;
case SetPos:
- RS_DIALOGFACTORY->updateMouseWidget(tr("Specify position"),
+ DIALOGFACTORY->updateMouseWidget(tr("Specify position"),
tr("Back"));
break;
default:
- RS_DIALOGFACTORY->updateMouseWidget("", "");
+ DIALOGFACTORY->updateMouseWidget("", "");
break;
}
}
{
ActionInterface::showOptions();
- if (RS_DIALOGFACTORY)
- RS_DIALOGFACTORY->requestOptions(this, true);
+ if (DIALOGFACTORY)
+ DIALOGFACTORY->requestOptions(this, true);
}
void ActionDrawLineRelAngle::hideOptions()
{
ActionInterface::hideOptions();
- if (RS_DIALOGFACTORY)
- RS_DIALOGFACTORY->requestOptions(this, false);
+ if (DIALOGFACTORY)
+ DIALOGFACTORY->requestOptions(this, false);
}
void ActionDrawLineRelAngle::updateMouseCursor()
void ActionDrawLineRelAngle::updateToolBar()
{
- if (RS_DIALOGFACTORY)
+ if (DIALOGFACTORY)
{
if (!isFinished())
- RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarSnap);
+ DIALOGFACTORY->requestToolBar(RS2::ToolBarSnap);
else
- RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarLines);
+ DIALOGFACTORY->requestToolBar(RS2::ToolBarLines);
}
}
#include "actioninterface.h"
#include "vector.h"
-class RS_Entity;
+class Entity;
/**
* This action class can handle user events to draw lines with a given angle
};
public:
- ActionDrawLineRelAngle(RS_EntityContainer & container, GraphicView & graphicView, double angle = 0.0, bool fixedAngle = false);
+ ActionDrawLineRelAngle(EntityContainer & container, GraphicView & graphicView, double angle = 0.0, bool fixedAngle = false);
~ActionDrawLineRelAngle();
virtual RS2::ActionType rtti();
virtual void mouseMoveEvent(QMouseEvent * e);
virtual void mouseReleaseEvent(QMouseEvent * e);
virtual void coordinateEvent(Vector * e);
- virtual void commandEvent(RS_CommandEvent * e);
+ virtual void commandEvent(CommandEvent * e);
virtual QStringList getAvailableCommands();
virtual void hideOptions();
virtual void showOptions();
private:
/** Chosen entity */
- RS_Entity * entity;
+ Entity * entity;
/** Chosen position */
Vector pos;
/** Data of new line */
- RS_LineData data;
+ LineData data;
/**
* Line angle.
*/
#include "graphicview.h"
#include "preview.h"
-ActionDrawLineTangent1::ActionDrawLineTangent1(RS_EntityContainer & container, GraphicView & graphicView): ActionInterface("Draw Tangents 1",
+ActionDrawLineTangent1::ActionDrawLineTangent1(EntityContainer & container, GraphicView & graphicView): ActionInterface("Draw Tangents 1",
container, graphicView)
{
tangent = NULL;
if (tangent)
{
- RS_Entity * newEntity = NULL;
- newEntity = new RS_Line(container, tangent->getData());
+ Entity * newEntity = NULL;
+ newEntity = new Line(container, tangent->getData());
if (newEntity)
{
tangent = NULL;
}
else
- RS_DEBUG->print("ActionDrawLineTangent1::trigger:"
+ DEBUG->print("ActionDrawLineTangent1::trigger:"
" Entity is NULL\n");
}
void ActionDrawLineTangent1::mouseMoveEvent(QMouseEvent * e)
{
- RS_DEBUG->print("ActionDrawLineTangent1::mouseMoveEvent begin");
+ DEBUG->print("ActionDrawLineTangent1::mouseMoveEvent begin");
Vector mouse(graphicView->toGraphX(e->x()), graphicView->toGraphY(e->y()));
switch (getStatus())
case SetCircle:
{
- RS_Entity * en = catchEntity(e, RS2::ResolveAll);
+ Entity * en = catchEntity(e, RS2::ResolveAll);
if (en && (en->rtti() == RS2::EntityCircle
|| en->rtti() == RS2::EntityArc
|| en->rtti() == RS2::EntityEllipse))
{
circle = en;
- RS_Creation creation(NULL, NULL);
- RS_Line * t = creation.createTangent1(mouse, point, circle);
+ Creation creation(NULL, NULL);
+ Line * t = creation.createTangent1(mouse, point, circle);
if (t)
{
if (tangent)
delete tangent;
- tangent = (RS_Line *)t->clone();
+ tangent = (Line *)t->clone();
deletePreview();
clearPreview();
break;
}
- RS_DEBUG->print("ActionDrawLineTangent1::mouseMoveEvent end");
+ DEBUG->print("ActionDrawLineTangent1::mouseMoveEvent end");
}
void ActionDrawLineTangent1::mouseReleaseEvent(QMouseEvent * e)
void ActionDrawLineTangent1::updateMouseButtonHints()
{
- if (RS_DIALOGFACTORY != NULL)
+ if (DIALOGFACTORY != NULL)
{
switch (getStatus())
{
case SetPoint:
- RS_DIALOGFACTORY->updateMouseWidget(tr("Specify point"), tr("Cancel"));
+ DIALOGFACTORY->updateMouseWidget(tr("Specify point"), tr("Cancel"));
break;
case SetCircle:
- RS_DIALOGFACTORY->updateMouseWidget(tr("Select circle, arc or ellipse"),
+ DIALOGFACTORY->updateMouseWidget(tr("Select circle, arc or ellipse"),
tr("Back"));
break;
default:
- RS_DIALOGFACTORY->updateMouseWidget("", "");
+ DIALOGFACTORY->updateMouseWidget("", "");
break;
}
}
void ActionDrawLineTangent1::updateToolBar()
{
- if (RS_DIALOGFACTORY)
+ if (DIALOGFACTORY)
{
if (!isFinished())
- RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarSnap);
+ DIALOGFACTORY->requestToolBar(RS2::ToolBarSnap);
else
- RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarLines);
+ DIALOGFACTORY->requestToolBar(RS2::ToolBarLines);
}
}
#include "actioninterface.h"
#include "vector.h"
-class RS_Line;
-class RS_Entity;
+class Line;
+class Entity;
/**
* This action class can handle user events to draw tangents from points
};
public:
- ActionDrawLineTangent1(RS_EntityContainer & container, GraphicView & graphicView);
+ ActionDrawLineTangent1(EntityContainer & container, GraphicView & graphicView);
~ActionDrawLineTangent1();
virtual void trigger();
private:
/** Closest tangent. */
- RS_Line * tangent;
+ Line * tangent;
/** Chosen startpoint */
Vector point;
/** Chosen entity */
- RS_Entity * circle;
+ Entity * circle;
/** Data of new tangent */
- RS_LineData data;
+ LineData data;
};
#endif // __ACTIONDRAWLINETANGENT1_H__
#include "preview.h"
ActionDrawLineTangent2::ActionDrawLineTangent2(
- RS_EntityContainer & container, GraphicView & graphicView):
+ EntityContainer & container, GraphicView & graphicView):
ActionInterface("Draw Tangents 2", container, graphicView)
{
tangent = NULL;
if (tangent != NULL)
{
- RS_Entity * newEntity = NULL;
- newEntity = new RS_Line(container, tangent->getData());
+ Entity * newEntity = NULL;
+ newEntity = new Line(container, tangent->getData());
if (newEntity != NULL)
{
tangent = NULL;
}
else
- RS_DEBUG->print("ActionDrawLineTangent2::trigger:"
+ DEBUG->print("ActionDrawLineTangent2::trigger:"
" Entity is NULL\n");
}
void ActionDrawLineTangent2::mouseMoveEvent(QMouseEvent * e)
{
- RS_DEBUG->print("ActionDrawLineTangent2::mouseMoveEvent begin");
+ DEBUG->print("ActionDrawLineTangent2::mouseMoveEvent begin");
Vector mouse(graphicView->toGraphX(e->x()), graphicView->toGraphY(e->y()));
switch (getStatus())
{
case SetCircle1: {
- RS_Entity * en = catchEntity(e, RS2::ResolveAll);
+ Entity * en = catchEntity(e, RS2::ResolveAll);
if (en != NULL && (en->rtti() == RS2::EntityCircle
|| en->rtti() == RS2::EntityArc))
case SetCircle2:
{
- RS_Entity * en = catchEntity(e, RS2::ResolveAll);
+ Entity * en = catchEntity(e, RS2::ResolveAll);
if (en && (en->rtti() == RS2::EntityCircle
|| en->rtti() == RS2::EntityArc))
{
circle2 = en;
- RS_Creation creation(NULL, NULL);
- RS_Line * t = creation.createTangent2(mouse, circle1, circle2);
+ Creation creation(NULL, NULL);
+ Line * t = creation.createTangent2(mouse, circle1, circle2);
if (t)
{
if (tangent)
delete tangent;
- tangent = (RS_Line *)t->clone();
+ tangent = (Line *)t->clone();
deletePreview();
clearPreview();
break;
}
- RS_DEBUG->print("ActionDrawLineTangent2::mouseMoveEvent end");
+ DEBUG->print("ActionDrawLineTangent2::mouseMoveEvent end");
}
void ActionDrawLineTangent2::mouseReleaseEvent(QMouseEvent * e)
void ActionDrawLineTangent2::updateMouseButtonHints()
{
- if (RS_DIALOGFACTORY != NULL)
+ if (DIALOGFACTORY != NULL)
{
switch (getStatus())
{
case SetCircle1:
- RS_DIALOGFACTORY->updateMouseWidget(tr("Select first circle or arc"),
+ DIALOGFACTORY->updateMouseWidget(tr("Select first circle or arc"),
tr("Cancel"));
break;
case SetCircle2:
- RS_DIALOGFACTORY->updateMouseWidget(tr("Select second circle or arc"),
+ DIALOGFACTORY->updateMouseWidget(tr("Select second circle or arc"),
tr("Back"));
break;
default:
- RS_DIALOGFACTORY->updateMouseWidget("", "");
+ DIALOGFACTORY->updateMouseWidget("", "");
break;
}
}
void ActionDrawLineTangent2::updateToolBar()
{
- if (RS_DIALOGFACTORY != NULL)
- RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarLines);
+ if (DIALOGFACTORY != NULL)
+ DIALOGFACTORY->requestToolBar(RS2::ToolBarLines);
}
#include "line.h"
#include "actioninterface.h"
-class RS_Entity;
+class Entity;
/**
* This action class can handle user events to draw tangents from circle to
* circle.
};
public:
- ActionDrawLineTangent2(RS_EntityContainer & container, GraphicView & graphicView);
+ ActionDrawLineTangent2(EntityContainer & container, GraphicView & graphicView);
~ActionDrawLineTangent2();
virtual void trigger();
private:
/** Closest tangent. */
- RS_Line * tangent;
+ Line * tangent;
/** 1st chosen entity */
- RS_Entity * circle1;
+ Entity * circle1;
/** 2nd chosen entity */
- RS_Entity * circle2;
+ Entity * circle2;
/** Data of new tangent */
- RS_LineData data;
+ LineData data;
};
#endif // __ACTIONDRAWLINETANGENT2_H__
#include "graphicview.h"
#include "preview.h"
-ActionDrawPoint::ActionDrawPoint(RS_EntityContainer & container, GraphicView & graphicView):
+ActionDrawPoint::ActionDrawPoint(EntityContainer & container, GraphicView & graphicView):
ActionInterface("Draw Points", container, graphicView)
{
}
{
if (pt.valid)
{
- RS_Point * point = new RS_Point(container, RS_PointData(pt));
+ Point * point = new Point(container, PointData(pt));
container->addEntity(point);
if (document)
trigger();
}
-void ActionDrawPoint::commandEvent(RS_CommandEvent * e)
+void ActionDrawPoint::commandEvent(CommandEvent * e)
{
QString c = e->getCommand().toLower();
if (checkCommand("help", c))
{
- if (RS_DIALOGFACTORY != NULL)
- RS_DIALOGFACTORY->commandMessage(msgAvailableCommands()
+ if (DIALOGFACTORY != NULL)
+ DIALOGFACTORY->commandMessage(msgAvailableCommands()
+ getAvailableCommands().join(", "));
return;
void ActionDrawPoint::updateMouseButtonHints()
{
- if (RS_DIALOGFACTORY != NULL)
+ if (DIALOGFACTORY != NULL)
{
switch (getStatus())
{
case 0:
- RS_DIALOGFACTORY->updateMouseWidget(tr("Specify location"), tr("Cancel"));
+ DIALOGFACTORY->updateMouseWidget(tr("Specify location"), tr("Cancel"));
break;
default:
- RS_DIALOGFACTORY->updateMouseWidget("", "");
+ DIALOGFACTORY->updateMouseWidget("", "");
break;
}
}
void ActionDrawPoint::updateToolBar()
{
- if (RS_DIALOGFACTORY != NULL)
+ if (DIALOGFACTORY != NULL)
{
if (!isFinished())
- RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarSnap);
+ DIALOGFACTORY->requestToolBar(RS2::ToolBarSnap);
else
- RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarPoints);
+ DIALOGFACTORY->requestToolBar(RS2::ToolBarPoints);
}
}
class ActionDrawPoint: public ActionInterface
{
public:
- ActionDrawPoint(RS_EntityContainer & container, GraphicView & graphicView);
+ ActionDrawPoint(EntityContainer & container, GraphicView & graphicView);
~ActionDrawPoint();
virtual void trigger();
virtual void mouseMoveEvent(QMouseEvent * e);
virtual void mouseReleaseEvent(QMouseEvent * e);
virtual void coordinateEvent(Vector * e);
- virtual void commandEvent(RS_CommandEvent * e);
+ virtual void commandEvent(CommandEvent * e);
virtual QStringList getAvailableCommands();
virtual void updateMouseButtonHints();
virtual void updateMouseCursor();
#include "graphicview.h"
#include "preview.h"
-ActionDrawSpline::ActionDrawSpline(RS_EntityContainer & container, GraphicView & graphicView):
+ActionDrawSpline::ActionDrawSpline(EntityContainer & container, GraphicView & graphicView):
ActionInterface("Draw splines", container, graphicView)
{
reset();
#warning "!!! Need to port setAutoDelete() behaviour from Qt3 to Qt4 !!!"
// history.setAutoDelete(true);
- data = RS_SplineData(3, false);
+ data = SplineData(3, false);
//bHistory.setAutoDelete(true);
}
graphicView->drawEntity(spline);
graphicView->moveRelativeZero(r);
drawSnapper();
- RS_DEBUG->print("ActionDrawSpline::trigger(): spline added: %d", spline->getId());
+ DEBUG->print("ActionDrawSpline::trigger(): spline added: %d", spline->getId());
spline = NULL;
//history.clear();
void ActionDrawSpline::mouseMoveEvent(QMouseEvent * e)
{
- RS_DEBUG->print("ActionDrawSpline::mouseMoveEvent begin");
+ DEBUG->print("ActionDrawSpline::mouseMoveEvent begin");
Vector mouse = snapPoint(e);
deletePreview();
clearPreview();
- RS_Spline * tmpSpline = (RS_Spline *)spline->clone();
+ Spline * tmpSpline = (Spline *)spline->clone();
tmpSpline->addControlPoint(mouse);
tmpSpline->update();
// preview->addEntity(tmpSpline);
QList<Vector>::iterator it;
// for(it=cpts.begin(); it!=cpts.end(); it+)
-// preview->addEntity(new RS_Point(preview, RS_PointData(*it)));
+// preview->addEntity(new Point(preview, PointData(*it)));
drawPreview();
}
- RS_DEBUG->print("ActionDrawSpline::mouseMoveEvent end");
+ DEBUG->print("ActionDrawSpline::mouseMoveEvent end");
}
void ActionDrawSpline::mouseReleaseEvent(QMouseEvent * e)
if (!spline)
{
- spline = new RS_Spline(container, data);
+ spline = new Spline(container, data);
spline->addControlPoint(mouse);
}
}
}
-void ActionDrawSpline::commandEvent(RS_CommandEvent * e)
+void ActionDrawSpline::commandEvent(CommandEvent * e)
{
QString c = e->getCommand().toLower();
case SetStartpoint:
if (checkCommand("help", c))
{
- RS_DIALOGFACTORY->commandMessage(msgAvailableCommands()
+ DIALOGFACTORY->commandMessage(msgAvailableCommands()
+ getAvailableCommands().join(", "));
return;
}
switch (getStatus())
{
case SetStartpoint:
- RS_DIALOGFACTORY->updateMouseWidget(tr("Specify first control point"),
+ DIALOGFACTORY->updateMouseWidget(tr("Specify first control point"),
tr("Cancel"));
break;
if (history.count() >= 3)
{
- msg += RS_COMMANDS->command("close");
+ msg += COMMANDS->command("close");
msg += "/";
}
if (history.count() >= 2)
- msg += RS_COMMANDS->command("undo");
+ msg += COMMANDS->command("undo");
if (history.count() >= 2)
- RS_DIALOGFACTORY->updateMouseWidget(
+ DIALOGFACTORY->updateMouseWidget(
tr("Specify next control point or [%1]").arg(msg),
tr("Back"));
else
- RS_DIALOGFACTORY->updateMouseWidget(
+ DIALOGFACTORY->updateMouseWidget(
tr("Specify next control point"),
tr("Back"));
}
break;
default:
- RS_DIALOGFACTORY->updateMouseWidget("", "");
+ DIALOGFACTORY->updateMouseWidget("", "");
break;
}
}
void ActionDrawSpline::showOptions()
{
ActionInterface::showOptions();
- RS_DIALOGFACTORY->requestOptions(this, true);
+ DIALOGFACTORY->requestOptions(this, true);
}
void ActionDrawSpline::hideOptions()
{
ActionInterface::hideOptions();
- RS_DIALOGFACTORY->requestOptions(this, false);
+ DIALOGFACTORY->requestOptions(this, false);
}
void ActionDrawSpline::updateMouseCursor()
void ActionDrawSpline::updateToolBar()
{
if (!isFinished())
- RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarSnap);
+ DIALOGFACTORY->requestToolBar(RS2::ToolBarSnap);
else
- RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarMain);
+ DIALOGFACTORY->requestToolBar(RS2::ToolBarMain);
}
void ActionDrawSpline::undo()
}
}
else
- RS_DIALOGFACTORY->commandMessage(
+ DIALOGFACTORY->commandMessage(
tr("Cannot undo: Not enough entities defined yet."));
}
};
public:
- ActionDrawSpline(RS_EntityContainer & container, GraphicView & graphicView);
+ ActionDrawSpline(EntityContainer & container, GraphicView & graphicView);
virtual ~ActionDrawSpline();
virtual RS2::ActionType rtti();
virtual void mouseMoveEvent(QMouseEvent * e);
virtual void mouseReleaseEvent(QMouseEvent * e);
virtual void coordinateEvent(Vector * e);
- virtual void commandEvent(RS_CommandEvent * e);
+ virtual void commandEvent(CommandEvent * e);
virtual QStringList getAvailableCommands();
virtual void showOptions();
virtual void hideOptions();
/**
* Spline data defined so far.
*/
- RS_SplineData data;
+ SplineData data;
/**
* Polyline entity we're working on.
*/
- RS_Spline * spline;
+ Spline * spline;
/**
* Point history (for undo)
#include "graphicview.h"
#include "preview.h"
-ActionDrawText::ActionDrawText(RS_EntityContainer & container, GraphicView & graphicView): ActionInterface("Draw Text", container, graphicView)
+ActionDrawText::ActionDrawText(EntityContainer & container, GraphicView & graphicView): ActionInterface("Draw Text", container, graphicView)
{
pos = Vector(false);
textChanged = true;
{
ActionInterface::init(status);
- if (RS_DIALOGFACTORY == NULL)
+ if (DIALOGFACTORY == NULL)
return;
switch (status)
clearPreview();
reset();
- RS_Text tmp(NULL, data);
+ Text tmp(NULL, data);
- if (RS_DIALOGFACTORY->requestTextDialog(&tmp))
+ if (DIALOGFACTORY->requestTextDialog(&tmp))
{
data = tmp.getData();
preparePreview();
break;
case SetPos:
- RS_DIALOGFACTORY->requestOptions(this, true, true);
+ DIALOGFACTORY->requestOptions(this, true, true);
break;
default:
void ActionDrawText::reset()
{
- data = RS_TextData(Vector(0.0, 0.0), 1.0, 100.0, RS2::VAlignTop,
+ data = TextData(Vector(0.0, 0.0), 1.0, 100.0, RS2::VAlignTop,
RS2::HAlignLeft, RS2::LeftToRight, RS2::Exact, 1.0, data.text,
"standard", 0.0, RS2::Update);
}
void ActionDrawText::trigger()
{
- RS_DEBUG->print("ActionDrawText::trigger()");
+ DEBUG->print("ActionDrawText::trigger()");
if (pos.valid)
{
clearPreview();
deleteSnapper();
- RS_Text * text = new RS_Text(container, data);
+ Text * text = new Text(container, data);
text->update();
container->addEntity(text);
{
/* clearPreview();
data.insertionPoint = Vector(0.0, 0.0);
- RS_Text * text = new RS_Text(preview, data);
+ Text * text = new Text(preview, data);
text->update();
preview->addEntity(text);
textChanged = false;*/
void ActionDrawText::mouseMoveEvent(QMouseEvent * e)
{
- RS_DEBUG->print("ActionDrawText::mouseMoveEvent begin");
+ DEBUG->print("ActionDrawText::mouseMoveEvent begin");
if (getStatus() == SetPos)
{
drawPreview();
}
- RS_DEBUG->print("ActionDrawText::mouseMoveEvent end");
+ DEBUG->print("ActionDrawText::mouseMoveEvent end");
}
void ActionDrawText::mouseReleaseEvent(QMouseEvent * e)
}
}
-void ActionDrawText::commandEvent(RS_CommandEvent * e)
+void ActionDrawText::commandEvent(CommandEvent * e)
{
QString c = e->getCommand().toLower();
if (checkCommand("help", c))
{
- if (RS_DIALOGFACTORY != NULL)
- RS_DIALOGFACTORY->commandMessage(msgAvailableCommands()
+ if (DIALOGFACTORY != NULL)
+ DIALOGFACTORY->commandMessage(msgAvailableCommands()
+ getAvailableCommands().join(", "));
return;
}
case SetText:
setText(e->getCommand());
- if (RS_DIALOGFACTORY)
- RS_DIALOGFACTORY->requestOptions(this, true, true);
+ if (DIALOGFACTORY)
+ DIALOGFACTORY->requestOptions(this, true, true);
graphicView->enableCoordinateInput();
setStatus(SetPos);
{
ActionInterface::showOptions();
- if (RS_DIALOGFACTORY)
- RS_DIALOGFACTORY->requestOptions(this, true, true);
+ if (DIALOGFACTORY)
+ DIALOGFACTORY->requestOptions(this, true, true);
}
void ActionDrawText::hideOptions()
{
ActionInterface::hideOptions();
- if (RS_DIALOGFACTORY)
- RS_DIALOGFACTORY->requestOptions(this, false);
+ if (DIALOGFACTORY)
+ DIALOGFACTORY->requestOptions(this, false);
}
void ActionDrawText::updateMouseButtonHints()
{
- if (!RS_DIALOGFACTORY)
+ if (!DIALOGFACTORY)
return;
switch (getStatus())
{
case SetPos:
- RS_DIALOGFACTORY->updateMouseWidget(tr("Specify insertion point"), tr("Cancel"));
+ DIALOGFACTORY->updateMouseWidget(tr("Specify insertion point"), tr("Cancel"));
break;
case SetText:
- RS_DIALOGFACTORY->updateMouseWidget(tr("Enter text:"), tr("Back"));
+ DIALOGFACTORY->updateMouseWidget(tr("Enter text:"), tr("Back"));
break;
default:
- RS_DIALOGFACTORY->updateMouseWidget("", "");
+ DIALOGFACTORY->updateMouseWidget("", "");
break;
}
}
void ActionDrawText::updateToolBar()
{
- if (!RS_DIALOGFACTORY)
+ if (!DIALOGFACTORY)
return;
switch (getStatus())
{
case SetPos:
- RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarSnap);
+ DIALOGFACTORY->requestToolBar(RS2::ToolBarSnap);
break;
default:
- RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarMain);
+ DIALOGFACTORY->requestToolBar(RS2::ToolBarMain);
break;
}
}
};
public:
- ActionDrawText(RS_EntityContainer & container, GraphicView & graphicView);
+ ActionDrawText(EntityContainer & container, GraphicView & graphicView);
~ActionDrawText();
virtual RS2::ActionType rtti();
virtual void mouseMoveEvent(QMouseEvent * e);
virtual void mouseReleaseEvent(QMouseEvent * e);
virtual void coordinateEvent(Vector * e);
- virtual void commandEvent(RS_CommandEvent * e);
+ virtual void commandEvent(CommandEvent * e);
virtual QStringList getAvailableCommands();
virtual void hideOptions();
virtual void showOptions();
double getAngle();
private:
- RS_TextData data;
+ TextData data;
Vector pos;
bool textChanged;
};
*
* @param undo true for undo and false for redo.
*/
-ActionEditCopy::ActionEditCopy(bool copy, RS_EntityContainer & container, GraphicView & graphicView):
+ActionEditCopy::ActionEditCopy(bool copy, EntityContainer & container, GraphicView & graphicView):
ActionInterface("Edit Copy", container, graphicView)
{
this->copy = copy;
{
deleteSnapper();
- RS_Modification m(*container, graphicView);
+ Modification m(*container, graphicView);
m.copy(referencePoint, !copy);
finish();
graphicView->killSelectActions();
- RS_DIALOGFACTORY->updateSelectionWidget(container->countSelected());
+ DIALOGFACTORY->updateSelectionWidget(container->countSelected());
}
void ActionEditCopy::mouseMoveEvent(QMouseEvent * e)
switch (getStatus())
{
case SetReferencePoint:
- RS_DIALOGFACTORY->updateMouseWidget(tr("Specify reference point"),
+ DIALOGFACTORY->updateMouseWidget(tr("Specify reference point"),
tr("Cancel"));
break;
default:
- RS_DIALOGFACTORY->updateMouseWidget("", "");
+ DIALOGFACTORY->updateMouseWidget("", "");
break;
}
}
void ActionEditCopy::updateToolBar()
{
if (!isFinished())
- RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarSnap);
+ DIALOGFACTORY->requestToolBar(RS2::ToolBarSnap);
else
- RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarMain);
+ DIALOGFACTORY->requestToolBar(RS2::ToolBarMain);
}
};
public:
- ActionEditCopy(bool copy, RS_EntityContainer & container, GraphicView & graphicView);
+ ActionEditCopy(bool copy, EntityContainer & container, GraphicView & graphicView);
~ActionEditCopy();
virtual void init(int status = 0);
*
* @param undo true for undo and false for redo.
*/
-ActionEditPaste::ActionEditPaste(RS_EntityContainer & container, GraphicView & graphicView): ActionInterface("Edit Paste",
+ActionEditPaste::ActionEditPaste(EntityContainer & container, GraphicView & graphicView): ActionInterface("Edit Paste",
container, graphicView)
{
}
deletePreview();
clearPreview();
- RS_Modification m(*container, graphicView);
- m.paste(RS_PasteData(targetPoint, 1.0, 0.0, false, ""));
+ Modification m(*container, graphicView);
+ m.paste(PasteData(targetPoint, 1.0, 0.0, false, ""));
graphicView->redraw();
finish();
deletePreview();
clearPreview();
-// preview->addAllFrom(*RS_CLIPBOARD->getGraphic());
+// preview->addAllFrom(*CLIPBOARD->getGraphic());
// preview->move(targetPoint);
if (graphic)
{
- RS2::Unit sourceUnit = RS_CLIPBOARD->getGraphic()->getUnit();
+ RS2::Unit sourceUnit = CLIPBOARD->getGraphic()->getUnit();
RS2::Unit targetUnit = graphic->getUnit();
- double f = RS_Units::convert(1.0, sourceUnit, targetUnit);
+ double f = Units::convert(1.0, sourceUnit, targetUnit);
// preview->scale(targetPoint, Vector(f, f));
}
switch (getStatus())
{
case SetTargetPoint:
- RS_DIALOGFACTORY->updateMouseWidget(tr("Set reference point"),
+ DIALOGFACTORY->updateMouseWidget(tr("Set reference point"),
tr("Cancel"));
break;
default:
- RS_DIALOGFACTORY->updateMouseWidget("", "");
+ DIALOGFACTORY->updateMouseWidget("", "");
break;
}
}
void ActionEditPaste::updateToolBar()
{
if (!isFinished())
- RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarSnap);
+ DIALOGFACTORY->requestToolBar(RS2::ToolBarSnap);
else
- RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarMain);
+ DIALOGFACTORY->requestToolBar(RS2::ToolBarMain);
}
};
public:
- ActionEditPaste(RS_EntityContainer & container, GraphicView & graphicView);
+ ActionEditPaste(EntityContainer & container, GraphicView & graphicView);
~ActionEditPaste();
virtual void init(int status = 0);
*
* @param undo true for undo and false for redo.
*/
-ActionEditUndo::ActionEditUndo(bool undo, RS_EntityContainer & container, GraphicView & graphicView): ActionInterface("Edit Undo", container, graphicView)
+ActionEditUndo::ActionEditUndo(bool undo, EntityContainer & container, GraphicView & graphicView): ActionInterface("Edit Undo", container, graphicView)
{
this->undo = undo;
}
graphicView->redraw();
finish();
- RS_DIALOGFACTORY->updateSelectionWidget(container->countSelected());
+ DIALOGFACTORY->updateSelectionWidget(container->countSelected());
}
class ActionEditUndo: public ActionInterface
{
public:
- ActionEditUndo(bool undo, RS_EntityContainer & container, GraphicView & graphicView);
+ ActionEditUndo(bool undo, EntityContainer & container, GraphicView & graphicView);
~ActionEditUndo();
virtual void init(int status = 0);
//#include "drawing.h"
-ActionFileNew::ActionFileNew(RS_EntityContainer & container, GraphicView & graphicView):
+ActionFileNew::ActionFileNew(EntityContainer & container, GraphicView & graphicView):
ActionInterface("File New", container, graphicView)
{
}
{
/*
// Not supported currently
- RS_DEBUG->print("ActionFileNew::trigger");
+ DEBUG->print("ActionFileNew::trigger");
- QString fileName; //= RS_DIALOGFACTORY->requestFileNewDialog();
+ QString fileName; //= DIALOGFACTORY->requestFileNewDialog();
if (graphic!=NULL && !fileName.isEmpty()) {
graphic->open(fileName, );
}
class ActionFileNew: public ActionInterface
{
public:
- ActionFileNew(RS_EntityContainer & container, GraphicView & graphicView);
+ ActionFileNew(EntityContainer & container, GraphicView & graphicView);
~ActionFileNew();
virtual void init(int status = 0);
//#include "drawing.h"
-ActionFileOpen::ActionFileOpen(RS_EntityContainer & container, GraphicView & graphicView):
+ActionFileOpen::ActionFileOpen(EntityContainer & container, GraphicView & graphicView):
ActionInterface("File Open", container, graphicView)
{
}
{
/*
// Not supported currently
- RS_DEBUG->print("ActionFileOpen::trigger");
+ DEBUG->print("ActionFileOpen::trigger");
- QString fileName; //= RS_DIALOGFACTORY->requestFileOpenDialog();
+ QString fileName; //= DIALOGFACTORY->requestFileOpenDialog();
if (graphic!=NULL && !fileName.isEmpty()) {
graphic->open(fileName, );
}
class ActionFileOpen: public ActionInterface
{
public:
- ActionFileOpen(RS_EntityContainer & container, GraphicView & graphicView);
+ ActionFileOpen(EntityContainer & container, GraphicView & graphicView);
~ActionFileOpen();
virtual void init(int status = 0);
#include "drawing.h"
-ActionFileSave::ActionFileSave(RS_EntityContainer & container, GraphicView & graphicView):
+ActionFileSave::ActionFileSave(EntityContainer & container, GraphicView & graphicView):
ActionInterface("File Save", container, graphicView)
{
}
void ActionFileSave::trigger()
{
- RS_DEBUG->print("ActionFileSave::trigger");
+ DEBUG->print("ActionFileSave::trigger");
if (graphic != NULL)
graphic->save();
class ActionFileSave: public ActionInterface
{
public:
- ActionFileSave(RS_EntityContainer & container, GraphicView & graphicView);
+ ActionFileSave(EntityContainer & container, GraphicView & graphicView);
~ActionFileSave();
virtual void init(int status = 0);
#include "drawing.h"
-ActionFileSaveAs::ActionFileSaveAs(RS_EntityContainer & container, GraphicView & graphicView):
+ActionFileSaveAs::ActionFileSaveAs(EntityContainer & container, GraphicView & graphicView):
ActionInterface("Add Layer", container, graphicView)
{
}
void ActionFileSaveAs::trigger()
{
- RS_DEBUG->print("ActionFileSaveAs::trigger");
- QString fileName; // = RS_DIALOGFACTORY->requestFileSaveAsDialog();
+ DEBUG->print("ActionFileSaveAs::trigger");
+ QString fileName; // = DIALOGFACTORY->requestFileSaveAsDialog();
if (graphic != NULL && !fileName.isEmpty())
graphic->saveAs(fileName, RS2::FormatUnknown);
class ActionFileSaveAs: public ActionInterface
{
public:
- ActionFileSaveAs(RS_EntityContainer & container, GraphicView & graphicView);
+ ActionFileSaveAs(EntityContainer & container, GraphicView & graphicView);
~ActionFileSaveAs();
virtual void init(int status = 0);
#include "graphicview.h"
#include "information.h"
-ActionInfoAngle::ActionInfoAngle(RS_EntityContainer & container, GraphicView & graphicView): ActionInterface("Info Angle",
+ActionInfoAngle::ActionInfoAngle(EntityContainer & container, GraphicView & graphicView): ActionInterface("Info Angle",
container, graphicView)
{
}
void ActionInfoAngle::trigger()
{
- RS_DEBUG->print("ActionInfoAngle::trigger()");
+ DEBUG->print("ActionInfoAngle::trigger()");
deleteSnapper();
if (entity1 != NULL && entity2 != NULL)
{
- VectorSolutions sol = RS_Information::getIntersection(entity1, entity2, false);
+ VectorSolutions sol = Information::getIntersection(entity1, entity2, false);
if (sol.hasValid())
{
double angle = fabs(angle2 - angle1);
QString str;
- str.sprintf("%.6f", RS_Math::rad2deg(angle));
- RS_DIALOGFACTORY->commandMessage(tr("Angle: %1%2").arg(str).arg(QChar(0xB0)));
+ str.sprintf("%.6f", Math::rad2deg(angle));
+ DIALOGFACTORY->commandMessage(tr("Angle: %1%2").arg(str).arg(QChar(0xB0)));
}
}
else
- RS_DIALOGFACTORY->commandMessage(tr("Lines are parallel"));
+ DIALOGFACTORY->commandMessage(tr("Lines are parallel"));
}
}
void ActionInfoAngle::mouseMoveEvent(QMouseEvent * /*e*/)
{
- RS_DEBUG->print("ActionInfoAngle::mouseMoveEvent begin");
+ DEBUG->print("ActionInfoAngle::mouseMoveEvent begin");
switch (getStatus())
{
break;
}
- RS_DEBUG->print("ActionInfoAngle::mouseMoveEvent end");
+ DEBUG->print("ActionInfoAngle::mouseMoveEvent end");
}
void ActionInfoAngle::mouseReleaseEvent(QMouseEvent * e)
switch (getStatus())
{
case SetEntity1:
- RS_DIALOGFACTORY->updateMouseWidget(
+ DIALOGFACTORY->updateMouseWidget(
tr("Specify first line"), tr("Cancel"));
break;
case SetEntity2:
- RS_DIALOGFACTORY->updateMouseWidget(
+ DIALOGFACTORY->updateMouseWidget(
tr("Specify second line"), tr("Back"));
break;
default:
- RS_DIALOGFACTORY->updateMouseWidget("", "");
+ DIALOGFACTORY->updateMouseWidget("", "");
break;
}
}
{
case SetEntity1:
case SetEntity2:
- RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarSnap);
+ DIALOGFACTORY->requestToolBar(RS2::ToolBarSnap);
break;
default:
- RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarInfo);
+ DIALOGFACTORY->requestToolBar(RS2::ToolBarInfo);
break;
}
}
#include "actioninterface.h"
#include "vector.h"
-class RS_Entity;
+class Entity;
/**
* This action class can handle user events to measure angles.
};
public:
- ActionInfoAngle(RS_EntityContainer & container, GraphicView & graphicView);
+ ActionInfoAngle(EntityContainer & container, GraphicView & graphicView);
~ActionInfoAngle();
virtual void init(int status = 0);
virtual void updateToolBar();
private:
- RS_Entity * entity1;
+ Entity * entity1;
Vector point1;
- RS_Entity * entity2;
+ Entity * entity2;
Vector point2;
Vector intersection;
#include "graphicview.h"
#include "preview.h"
-ActionInfoArea::ActionInfoArea(RS_EntityContainer & container, GraphicView & graphicView): ActionInterface("Info Area",
+ActionInfoArea::ActionInfoArea(EntityContainer & container, GraphicView & graphicView): ActionInterface("Info Area",
container, graphicView)
{
}
void ActionInfoArea::trigger()
{
- RS_DEBUG->print("ActionInfoArea::trigger()");
+ DEBUG->print("ActionInfoArea::trigger()");
if (ia.isValid())
{
double area = ia.getArea();
double circ = ia.getCircumference();
- RS_DEBUG->print("ActionInfoArea::trigger: area: %f", area);
- RS_DIALOGFACTORY->commandMessage(tr("Area: %1").arg(area));
- RS_DIALOGFACTORY->commandMessage(tr("Circumference: %1").arg(circ));
+ DEBUG->print("ActionInfoArea::trigger: area: %f", area);
+ DIALOGFACTORY->commandMessage(tr("Area: %1").arg(area));
+ DIALOGFACTORY->commandMessage(tr("Circumference: %1").arg(circ));
}
ia.reset();
double dist = point1.distanceTo(point2);
QString str;
str.sprintf("%.6f", dist);
- RS_DIALOGFACTORY->commandMessage(tr("Distance: %1").arg(str));
+ DIALOGFACTORY->commandMessage(tr("Distance: %1").arg(str));
}
*/
}
void ActionInfoArea::mouseMoveEvent(QMouseEvent * e)
{
- //RS_DEBUG->print("ActionInfoArea::mouseMoveEvent begin");
+ //DEBUG->print("ActionInfoArea::mouseMoveEvent begin");
if (getStatus() == SetFirstPoint
|| getStatus() == SetNextPoint)
closingLine = NULL;
}
-// currentLine = new RS_Line(preview, RS_LineData(prev, mouse));
+// currentLine = new Line(preview, LineData(prev, mouse));
// preview->addEntity(currentLine);
// if (preview->count() > 1)
// {
-// closingLine = new RS_Line(preview, RS_LineData(mouse, point1));
+// closingLine = new Line(preview, LineData(mouse, point1));
// preview->addEntity(closingLine);
// }
closingLine = NULL;
}
-// currentLine = new RS_Line(preview, RS_LineData(prev, point1));
+// currentLine = new Line(preview, LineData(prev, point1));
// preview->addEntity(currentLine);
drawPreview();
}
clearPreview();
ia.addPoint(mouse);
- RS_DIALOGFACTORY->commandMessage(tr("Point: %1/%2").arg(mouse.x).arg(mouse.y));
+ DIALOGFACTORY->commandMessage(tr("Point: %1/%2").arg(mouse.x).arg(mouse.y));
graphicView->moveRelativeZero(point1);
prev = mouse;
if (point1.valid)
{
ia.addPoint(mouse);
- RS_DIALOGFACTORY->commandMessage(tr("Point: %1/%2").arg(mouse.x).arg(mouse.y));
+ DIALOGFACTORY->commandMessage(tr("Point: %1/%2").arg(mouse.x).arg(mouse.y));
currentLine = NULL;
switch (getStatus())
{
case SetFirstPoint:
- RS_DIALOGFACTORY->updateMouseWidget(
+ DIALOGFACTORY->updateMouseWidget(
tr("Specify first point of polygon"),
tr("Cancel"));
break;
case SetNextPoint:
- RS_DIALOGFACTORY->updateMouseWidget(
+ DIALOGFACTORY->updateMouseWidget(
tr("Specify next point of polygon"),
tr("Terminate"));
break;
default:
- RS_DIALOGFACTORY->updateMouseWidget("", "");
+ DIALOGFACTORY->updateMouseWidget("", "");
break;
}
}
{
case SetFirstPoint:
case SetNextPoint:
- RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarSnap);
+ DIALOGFACTORY->requestToolBar(RS2::ToolBarSnap);
break;
default:
- RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarInfo);
+ DIALOGFACTORY->requestToolBar(RS2::ToolBarInfo);
break;
}
}
#include "actioninterface.h"
#include "vector.h"
-class RS_Entity;
+class Entity;
/**
* This action class can handle user events to measure distances between
};
public:
- ActionInfoArea(RS_EntityContainer & container, GraphicView & graphicView);
+ ActionInfoArea(EntityContainer & container, GraphicView & graphicView);
~ActionInfoArea();
virtual void init(int status = 0);
private:
Vector point1;
Vector prev;
- RS_Entity * currentLine;
- RS_Entity * closingLine;
- RS_InfoArea ia;
+ Entity * currentLine;
+ Entity * closingLine;
+ InfoArea ia;
};
#endif // __ACTIONINFOAREA_H__
#include "graphicview.h"
#include "preview.h"
-ActionInfoDist::ActionInfoDist(RS_EntityContainer & container, GraphicView & graphicView): ActionInterface("Info Dist",
+ActionInfoDist::ActionInfoDist(EntityContainer & container, GraphicView & graphicView): ActionInterface("Info Dist",
container, graphicView)
{
}
void ActionInfoDist::trigger()
{
- RS_DEBUG->print("ActionInfoDist::trigger()");
+ DEBUG->print("ActionInfoDist::trigger()");
if (point1.valid && point2.valid)
{
double dist = point1.distanceTo(point2);
QString str;
str.sprintf("%.6f", dist);
- RS_DIALOGFACTORY->commandMessage(tr("Distance: %1").arg(str));
+ DIALOGFACTORY->commandMessage(tr("Distance: %1").arg(str));
}
}
void ActionInfoDist::mouseMoveEvent(QMouseEvent * e)
{
- RS_DEBUG->print("ActionInfoDist::mouseMoveEvent begin");
+ DEBUG->print("ActionInfoDist::mouseMoveEvent begin");
if (getStatus() == SetPoint1
|| getStatus() == SetPoint2)
deletePreview();
clearPreview();
-// preview->addEntity(new RS_Line(preview, RS_LineData(point1, point2)));
+// preview->addEntity(new Line(preview, LineData(point1, point2)));
drawPreview();
}
break;
}
}
- RS_DEBUG->print("ActionInfoDist::mouseMoveEvent end");
+ DEBUG->print("ActionInfoDist::mouseMoveEvent end");
}
void ActionInfoDist::mouseReleaseEvent(QMouseEvent * e)
switch (getStatus())
{
case SetPoint1:
- RS_DIALOGFACTORY->updateMouseWidget(
+ DIALOGFACTORY->updateMouseWidget(
tr("Specify first point of distance"),
tr("Cancel"));
break;
case SetPoint2:
- RS_DIALOGFACTORY->updateMouseWidget(
+ DIALOGFACTORY->updateMouseWidget(
tr("Specify second point of distance"),
tr("Back"));
break;
default:
- RS_DIALOGFACTORY->updateMouseWidget("", "");
+ DIALOGFACTORY->updateMouseWidget("", "");
break;
}
}
{
case SetPoint1:
case SetPoint2:
- RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarSnap);
+ DIALOGFACTORY->requestToolBar(RS2::ToolBarSnap);
break;
default:
- RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarInfo);
+ DIALOGFACTORY->requestToolBar(RS2::ToolBarInfo);
break;
}
}
};
public:
- ActionInfoDist(RS_EntityContainer & container, GraphicView & graphicView);
+ ActionInfoDist(EntityContainer & container, GraphicView & graphicView);
~ActionInfoDist();
virtual void init(int status = 0);
#include "graphicview.h"
#include "preview.h"
-ActionInfoDist2::ActionInfoDist2(RS_EntityContainer & container, GraphicView & graphicView):
+ActionInfoDist2::ActionInfoDist2(EntityContainer & container, GraphicView & graphicView):
ActionInterface("Info Dist2", container, graphicView)
{
}
void ActionInfoDist2::trigger()
{
- RS_DEBUG->print("ActionInfoDist2::trigger()");
+ DEBUG->print("ActionInfoDist2::trigger()");
deleteSnapper();
if (point.valid && entity != NULL)
double dist = entity->getDistanceToPoint(point);
QString str;
str.sprintf("%.6f", dist);
- RS_DIALOGFACTORY->commandMessage(tr("Distance: %1").arg(str));
+ DIALOGFACTORY->commandMessage(tr("Distance: %1").arg(str));
}
}
void ActionInfoDist2::mouseMoveEvent(QMouseEvent * e)
{
- RS_DEBUG->print("ActionInfoDist2::mouseMoveEvent begin");
+ DEBUG->print("ActionInfoDist2::mouseMoveEvent begin");
switch (getStatus())
{
break;
}
- RS_DEBUG->print("ActionInfoDist2::mouseMoveEvent end");
+ DEBUG->print("ActionInfoDist2::mouseMoveEvent end");
}
void ActionInfoDist2::mouseReleaseEvent(QMouseEvent * e)
switch (getStatus())
{
case SetEntity:
- RS_DIALOGFACTORY->updateMouseWidget(tr("Specify entity"), tr("Cancel"));
+ DIALOGFACTORY->updateMouseWidget(tr("Specify entity"), tr("Cancel"));
break;
case SetPoint:
- RS_DIALOGFACTORY->updateMouseWidget(tr("Specify point"), tr("Back"));
+ DIALOGFACTORY->updateMouseWidget(tr("Specify point"), tr("Back"));
break;
default:
- RS_DIALOGFACTORY->updateMouseWidget("", "");
+ DIALOGFACTORY->updateMouseWidget("", "");
break;
}
}
{
case SetPoint:
case SetEntity:
- RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarSnap);
+ DIALOGFACTORY->requestToolBar(RS2::ToolBarSnap);
break;
default:
- RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarInfo);
+ DIALOGFACTORY->requestToolBar(RS2::ToolBarInfo);
break;
}
}
#include "actioninterface.h"
#include "vector.h"
-class RS_Entity;
+class Entity;
/**
* This action class can handle user events to measure distances between
};
public:
- ActionInfoDist2(RS_EntityContainer & container, GraphicView & graphicView);
+ ActionInfoDist2(EntityContainer & container, GraphicView & graphicView);
~ActionInfoDist2();
virtual void init(int status = 0);
virtual void updateToolBar();
private:
- RS_Entity * entity;
+ Entity * entity;
Vector point;
};
#include "graphicview.h"
#include "information.h"
-ActionInfoInside::ActionInfoInside(RS_EntityContainer & container, GraphicView & graphicView):
+ActionInfoInside::ActionInfoInside(EntityContainer & container, GraphicView & graphicView):
ActionInterface("Info Inside", container, graphicView)
{
- contour = new RS_EntityContainer(NULL, false);
+ contour = new EntityContainer(NULL, false);
- for (RS_Entity * e = container.firstEntity(); e != NULL; e = container.nextEntity())
+ for (Entity * e = container.firstEntity(); e != NULL; e = container.nextEntity())
if (e->isSelected())
contour->addEntity(e);
}
deleteSnapper();
bool onContour = false;
- if (RS_Information::isPointInsideContour(pt, contour, &onContour))
- RS_DIALOGFACTORY->commandMessage(tr("Point is inside selected contour."));
+ if (Information::isPointInsideContour(pt, contour, &onContour))
+ DIALOGFACTORY->commandMessage(tr("Point is inside selected contour."));
else
- RS_DIALOGFACTORY->commandMessage(tr("Point is outside selected contour."));
+ DIALOGFACTORY->commandMessage(tr("Point is outside selected contour."));
finish();
}
switch (getStatus())
{
case 0:
- RS_DIALOGFACTORY->updateMouseWidget(tr("Specify point"), tr("Cancel"));
+ DIALOGFACTORY->updateMouseWidget(tr("Specify point"), tr("Cancel"));
break;
default:
- RS_DIALOGFACTORY->updateMouseWidget("", "");
+ DIALOGFACTORY->updateMouseWidget("", "");
break;
}
}
void ActionInfoInside::updateToolBar()
{
if (!isFinished())
- RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarSnap);
+ DIALOGFACTORY->requestToolBar(RS2::ToolBarSnap);
else
- RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarInfo);
+ DIALOGFACTORY->requestToolBar(RS2::ToolBarInfo);
}
class ActionInfoInside: public ActionInterface
{
public:
- ActionInfoInside(RS_EntityContainer & container, GraphicView & graphicView);
+ ActionInfoInside(EntityContainer & container, GraphicView & graphicView);
~ActionInfoInside();
virtual void trigger();
private:
Vector pt;
- RS_EntityContainer * contour;
+ EntityContainer * contour;
};
#endif // __ACTIONINFOINSIDE_H__
#include "debug.h"
#include "dialogfactory.h"
-ActionInfoTotalLength::ActionInfoTotalLength(RS_EntityContainer & container, GraphicView & graphicView): ActionInterface("Info Total Length",
+ActionInfoTotalLength::ActionInfoTotalLength(EntityContainer & container, GraphicView & graphicView): ActionInterface("Info Total Length",
container, graphicView)
{
}
void ActionInfoTotalLength::trigger()
{
- RS_DEBUG->print("ActionInfoTotalLength::trigger()");
+ DEBUG->print("ActionInfoTotalLength::trigger()");
double len = 0.0;
- for(RS_Entity * e=container->firstEntity(RS2::ResolveNone); e!=NULL;
+ for(Entity * e=container->firstEntity(RS2::ResolveNone); e!=NULL;
e=container->nextEntity(RS2::ResolveNone))
{
if (e->isVisible() && e->isSelected())
}
if (len > 0.0)
- RS_DIALOGFACTORY->commandMessage(
+ DIALOGFACTORY->commandMessage(
tr("Total Length of selected entities: %1").arg(len));
else
- RS_DIALOGFACTORY->commandMessage(tr("At least one of the selected "
+ DIALOGFACTORY->commandMessage(tr("At least one of the selected "
"entities cannot be measured."));
finish();
void ActionInfoTotalLength::updateToolBar()
{
- if (RS_DIALOGFACTORY != NULL)
+ if (DIALOGFACTORY != NULL)
{
if (!isFinished())
- RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarInfo);
+ DIALOGFACTORY->requestToolBar(RS2::ToolBarInfo);
else
- RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarMain);
+ DIALOGFACTORY->requestToolBar(RS2::ToolBarMain);
}
}
};
public:
- ActionInfoTotalLength(RS_EntityContainer & container, GraphicView & graphicView);
+ ActionInfoTotalLength(EntityContainer & container, GraphicView & graphicView);
~ActionInfoTotalLength();
virtual void init(int status = 0);
#include "dialogfactory.h"
#include "drawing.h"
-ActionLayersAdd::ActionLayersAdd(RS_EntityContainer & container, GraphicView & graphicView):
+ActionLayersAdd::ActionLayersAdd(EntityContainer & container, GraphicView & graphicView):
ActionInterface("Add Layer", container, graphicView)
{
}
void ActionLayersAdd::trigger()
{
- RS_DEBUG->print("add layer");
+ DEBUG->print("add layer");
- if (RS_DIALOGFACTORY && graphic)
+ if (DIALOGFACTORY && graphic)
{
- RS_Layer * layer = RS_DIALOGFACTORY->requestNewLayerDialog(graphic->getLayerList());
+ Layer * layer = DIALOGFACTORY->requestNewLayerDialog(graphic->getLayerList());
if (layer)
graphic->addLayer(layer);
class ActionLayersAdd: public ActionInterface
{
public:
- ActionLayersAdd(RS_EntityContainer & container, GraphicView & graphicView);
+ ActionLayersAdd(EntityContainer & container, GraphicView & graphicView);
~ActionLayersAdd();
virtual void init(int status = 0);
#include "graphicview.h"
#include "drawing.h"
-ActionLayersEdit::ActionLayersEdit(RS_EntityContainer & container, GraphicView & graphicView):
+ActionLayersEdit::ActionLayersEdit(EntityContainer & container, GraphicView & graphicView):
ActionInterface("Edit Layer", container, graphicView)
{
}
void ActionLayersEdit::trigger()
{
- RS_DEBUG->print("ActionLayersEdit::trigger");
- RS_Layer * layer = NULL;
+ DEBUG->print("ActionLayersEdit::trigger");
+ Layer * layer = NULL;
if (graphic)
{
- layer = RS_DIALOGFACTORY->requestEditLayerDialog(graphic->getLayerList());
+ layer = DIALOGFACTORY->requestEditLayerDialog(graphic->getLayerList());
if (layer)
{
graphic->editLayer(graphic->getActiveLayer(), *layer);
// Update updatable entities on the layer that has changed
- for(RS_Entity * e=graphic->firstEntity(RS2::ResolveNone);
+ for(Entity * e=graphic->firstEntity(RS2::ResolveNone);
e!=NULL; e=graphic->nextEntity(RS2::ResolveNone))
{
- RS_Layer * l = e->getLayer();
+ Layer * l = e->getLayer();
if (l && l->getName() == layer->getName())
e->update();
class ActionLayersEdit: public ActionInterface
{
public:
- ActionLayersEdit(RS_EntityContainer & container, GraphicView & graphicView);
+ ActionLayersEdit(EntityContainer & container, GraphicView & graphicView);
~ActionLayersEdit();
virtual void init(int status = 0);
#include "drawing.h"
ActionLayersFreezeAll::ActionLayersFreezeAll(bool freeze,
- RS_EntityContainer & container, GraphicView & graphicView):
+ EntityContainer & container, GraphicView & graphicView):
ActionInterface("Freeze all Layers", container, graphicView)
{
this->freeze = freeze;
void ActionLayersFreezeAll::trigger()
{
- RS_DEBUG->print("ActionLayersFreezeAll::trigger");
+ DEBUG->print("ActionLayersFreezeAll::trigger");
if (graphic)
graphic->freezeAllLayers(freeze);
class ActionLayersFreezeAll: public ActionInterface
{
public:
- ActionLayersFreezeAll(bool freeze, RS_EntityContainer & container, GraphicView & graphicView);
+ ActionLayersFreezeAll(bool freeze, EntityContainer & container, GraphicView & graphicView);
~ActionLayersFreezeAll();
virtual void init(int status = 0);
#include "dialogfactory.h"
#include "drawing.h"
-ActionLayersRemove::ActionLayersRemove(RS_EntityContainer & container,
+ActionLayersRemove::ActionLayersRemove(EntityContainer & container,
GraphicView & graphicView):
ActionInterface("Remove Layer", container, graphicView)
{
void ActionLayersRemove::trigger()
{
- RS_DEBUG->print("ActionLayersRemove::trigger");
+ DEBUG->print("ActionLayersRemove::trigger");
if (graphic)
{
- RS_Layer * layer =
- RS_DIALOGFACTORY->requestLayerRemovalDialog(graphic->getLayerList());
+ Layer * layer =
+ DIALOGFACTORY->requestLayerRemovalDialog(graphic->getLayerList());
// Now remove the layer from the layer list:
graphic->removeLayer(layer);
}
finish();
- RS_DIALOGFACTORY->updateSelectionWidget(container->countSelected());
+ DIALOGFACTORY->updateSelectionWidget(container->countSelected());
}
void ActionLayersRemove::init(int status)
class ActionLayersRemove: public ActionInterface
{
public:
- ActionLayersRemove(RS_EntityContainer & container, GraphicView & graphicView);
+ ActionLayersRemove(EntityContainer & container, GraphicView & graphicView);
~ActionLayersRemove();
virtual void init(int status = 0);
#include "graphicview.h"
#include "drawing.h"
-ActionLayersToggleLock::ActionLayersToggleLock(RS_EntityContainer & container, GraphicView & graphicView): ActionInterface("Toggle Layer Visibility",
+ActionLayersToggleLock::ActionLayersToggleLock(EntityContainer & container, GraphicView & graphicView): ActionInterface("Toggle Layer Visibility",
container, graphicView)
{
}
void ActionLayersToggleLock::trigger()
{
- RS_DEBUG->print("toggle layer");
+ DEBUG->print("toggle layer");
if (graphic)
{
- RS_Layer * layer = graphic->getActiveLayer();
+ Layer * layer = graphic->getActiveLayer();
if (layer)
{
// deselect entities on locked layer:
if (layer->isLocked())
{
- for(RS_Entity * e=container->firstEntity(); e!=NULL;
+ for(Entity * e=container->firstEntity(); e!=NULL;
e=container->nextEntity())
{
if (e != NULL && e->isVisible() && e->getLayer() == layer)
class ActionLayersToggleLock: public ActionInterface
{
public:
- ActionLayersToggleLock(RS_EntityContainer & container, GraphicView & graphicView);
+ ActionLayersToggleLock(EntityContainer & container, GraphicView & graphicView);
~ActionLayersToggleLock();
virtual void init(int status = 0);
#include "drawing.h"
-ActionLayersToggleView::ActionLayersToggleView(RS_EntityContainer & container, GraphicView & graphicView): ActionInterface("Toggle Layer Visibility",
+ActionLayersToggleView::ActionLayersToggleView(EntityContainer & container, GraphicView & graphicView): ActionInterface("Toggle Layer Visibility",
container, graphicView)
{
}
void ActionLayersToggleView::trigger()
{
- RS_DEBUG->print("toggle layer");
+ DEBUG->print("toggle layer");
if (graphic != NULL)
{
- RS_Layer * layer = graphic->getActiveLayer();
+ Layer * layer = graphic->getActiveLayer();
graphic->toggleLayer(layer);
}
class ActionLayersToggleView: public ActionInterface
{
public:
- ActionLayersToggleView(RS_EntityContainer & container, GraphicView & graphicView);
+ ActionLayersToggleView(EntityContainer & container, GraphicView & graphicView);
~ActionLayersToggleView();
virtual void init(int status = 0);
/**
* Constructor.
*/
-ActionLibraryInsert::ActionLibraryInsert(RS_EntityContainer & container, GraphicView & graphicView):
+ActionLibraryInsert::ActionLibraryInsert(EntityContainer & container, GraphicView & graphicView):
ActionInterface("Library Insert", container, graphicView)
{
}
data.file = file;
if (!prev.open(file, RS2::FormatUnknown))
- RS_DIALOGFACTORY->commandMessage(tr("Cannot open file '%1'").arg(file));
+ DIALOGFACTORY->commandMessage(tr("Cannot open file '%1'").arg(file));
}
void ActionLibraryInsert::reset()
{
- /*data = RS_InsertData("",
+ /*data = InsertData("",
Vector(0.0,0.0),
Vector(1.0,1.0),
0.0,
deletePreview();
clearPreview();
- RS_Creation creation(container, graphicView);
+ Creation creation(container, graphicView);
creation.createLibraryInsert(data);
graphicView->redraw();
// unit conversion:
if (graphic)
{
- double uf = RS_Units::convert(1.0, prev.getUnit(), graphic->getUnit());
+ double uf = Units::convert(1.0, prev.getUnit(), graphic->getUnit());
// preview->scale(data.insertionPoint, Vector(uf, uf));
}
trigger();
}
-void ActionLibraryInsert::commandEvent(RS_CommandEvent * e)
+void ActionLibraryInsert::commandEvent(CommandEvent * e)
{
QString c = e->getCommand().toLower();
if (checkCommand("help", c))
{
- RS_DIALOGFACTORY->commandMessage(msgAvailableCommands() + getAvailableCommands().join(", "));
+ DIALOGFACTORY->commandMessage(msgAvailableCommands() + getAvailableCommands().join(", "));
return;
}
case SetAngle:
{
bool ok;
- double a = RS_Math::eval(c, &ok);
+ double a = Math::eval(c, &ok);
if (ok == true)
- data.angle = RS_Math::deg2rad(a);
+ data.angle = Math::deg2rad(a);
else
- RS_DIALOGFACTORY->commandMessage(tr("Not a valid expression"));
+ DIALOGFACTORY->commandMessage(tr("Not a valid expression"));
- RS_DIALOGFACTORY->requestOptions(this, true, true);
+ DIALOGFACTORY->requestOptions(this, true, true);
setStatus(lastStatus);
}
break;
case SetFactor:
{
bool ok;
- double f = RS_Math::eval(c, &ok);
+ double f = Math::eval(c, &ok);
if (ok == true)
setFactor(f);
else
- RS_DIALOGFACTORY->commandMessage(tr("Not a valid expression"));
+ DIALOGFACTORY->commandMessage(tr("Not a valid expression"));
- RS_DIALOGFACTORY->requestOptions(this, true, true);
+ DIALOGFACTORY->requestOptions(this, true, true);
setStatus(lastStatus);
}
break;
{
ActionInterface::showOptions();
- RS_DIALOGFACTORY->requestOptions(this, true);
+ DIALOGFACTORY->requestOptions(this, true);
}
void ActionLibraryInsert::hideOptions()
{
ActionInterface::hideOptions();
- RS_DIALOGFACTORY->requestOptions(this, false);
+ DIALOGFACTORY->requestOptions(this, false);
}
void ActionLibraryInsert::updateMouseButtonHints()
switch (getStatus())
{
case SetTargetPoint:
- RS_DIALOGFACTORY->updateMouseWidget(tr("Specify reference point"), tr("Cancel"));
+ DIALOGFACTORY->updateMouseWidget(tr("Specify reference point"), tr("Cancel"));
break;
case SetAngle:
- RS_DIALOGFACTORY->updateMouseWidget(tr("Enter angle:"), "");
+ DIALOGFACTORY->updateMouseWidget(tr("Enter angle:"), "");
break;
case SetFactor:
- RS_DIALOGFACTORY->updateMouseWidget(tr("Enter factor:"), "");
+ DIALOGFACTORY->updateMouseWidget(tr("Enter factor:"), "");
break;
default:
- RS_DIALOGFACTORY->updateMouseWidget("", "");
+ DIALOGFACTORY->updateMouseWidget("", "");
break;
}
}
void ActionLibraryInsert::updateToolBar()
{
if (!isFinished())
- RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarSnap);
+ DIALOGFACTORY->requestToolBar(RS2::ToolBarSnap);
else
- RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarMain);
+ DIALOGFACTORY->requestToolBar(RS2::ToolBarMain);
}
double ActionLibraryInsert::getAngle()
};
public:
- ActionLibraryInsert(RS_EntityContainer & container, GraphicView & graphicView);
+ ActionLibraryInsert(EntityContainer & container, GraphicView & graphicView);
virtual ~ActionLibraryInsert();
virtual RS2::ActionType rtti();
virtual void mouseMoveEvent(QMouseEvent * e);
virtual void mouseReleaseEvent(QMouseEvent * e);
virtual void coordinateEvent(Vector * e);
- virtual void commandEvent(RS_CommandEvent * e);
+ virtual void commandEvent(CommandEvent * e);
virtual QStringList getAvailableCommands();
virtual void showOptions();
virtual void hideOptions();
protected:
Drawing prev;
- RS_LibraryInsertData data;
+ LibraryInsertData data;
/** Last status before entering option. */
Status lastStatus;
#include "graphicview.h"
ActionLockRelativeZero::ActionLockRelativeZero(
- RS_EntityContainer & container, GraphicView & graphicView, bool on):
+ EntityContainer & container, GraphicView & graphicView, bool on):
ActionInterface("(Un-)lock the relative Zero", container, graphicView)
{
this->on = on;
class ActionLockRelativeZero: public ActionInterface
{
public:
- ActionLockRelativeZero(RS_EntityContainer & container, GraphicView & graphicView, bool on);
+ ActionLockRelativeZero(EntityContainer & container, GraphicView & graphicView, bool on);
~ActionLockRelativeZero();
virtual void init(int status = 0);
#include "modification.h"
ActionModifyAttributes::ActionModifyAttributes(
- RS_EntityContainer & container, GraphicView & graphicView):
+ EntityContainer & container, GraphicView & graphicView):
ActionInterface("Change Attributes", container, graphicView)
{
}
void ActionModifyAttributes::trigger()
{
- RS_DEBUG->print("ActionModifyAttributes::trigger()");
+ DEBUG->print("ActionModifyAttributes::trigger()");
- RS_AttributesData data;
- data.pen = RS_Pen();
+ AttributesData data;
+ data.pen = Pen();
data.layer = "0";
data.changeColor = false;
data.changeLineType = false;
if (graphic)
{
- if (RS_DIALOGFACTORY->requestAttributesDialog(data,
+ if (DIALOGFACTORY->requestAttributesDialog(data,
*graphic->getLayerList()))
{
- RS_Modification m(*container, graphicView);
+ Modification m(*container, graphicView);
m.changeAttributes(data);
}
}
finish();
graphicView->killSelectActions();
- RS_DIALOGFACTORY->updateSelectionWidget(container->countSelected());
+ DIALOGFACTORY->updateSelectionWidget(container->countSelected());
}
void ActionModifyAttributes::updateMouseButtonHints()
switch (getStatus())
{
//case Acknowledge:
- //RS_DIALOGFACTORY->updateMouseWidget(tr("Acknowledge"), tr("Cancel"));
+ //DIALOGFACTORY->updateMouseWidget(tr("Acknowledge"), tr("Cancel"));
//break;
default:
- RS_DIALOGFACTORY->updateMouseWidget("", "");
+ DIALOGFACTORY->updateMouseWidget("", "");
break;
}
}
void ActionModifyAttributes::updateToolBar()
{
if (!isFinished())
- RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarModify);
+ DIALOGFACTORY->requestToolBar(RS2::ToolBarModify);
else
- RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarMain);
+ DIALOGFACTORY->requestToolBar(RS2::ToolBarMain);
}
};
public:
- ActionModifyAttributes(RS_EntityContainer & container, GraphicView & graphicView);
+ ActionModifyAttributes(EntityContainer & container, GraphicView & graphicView);
~ActionModifyAttributes();
virtual void init(int status = 0);
#include "dialogfactory.h"
#include "information.h"
-ActionModifyBevel::ActionModifyBevel(RS_EntityContainer & container, GraphicView & graphicView): ActionInterface("Bevel Entities",
+ActionModifyBevel::ActionModifyBevel(EntityContainer & container, GraphicView & graphicView): ActionInterface("Bevel Entities",
container, graphicView)
{
entity1 = NULL;
void ActionModifyBevel::trigger()
{
- RS_DEBUG->print("ActionModifyBevel::trigger()");
+ DEBUG->print("ActionModifyBevel::trigger()");
if (entity1 && entity1->isAtomic()
&& entity2 && entity2->isAtomic())
{
- RS_Modification m(*container, graphicView);
- m.bevel(coord1, (RS_AtomicEntity *)entity1, coord2, (RS_AtomicEntity *)entity2, data);
+ Modification m(*container, graphicView);
+ m.bevel(coord1, (AtomicEntity *)entity1, coord2, (AtomicEntity *)entity2, data);
entity1 = NULL;
entity2 = NULL;
setStatus(SetEntity1);
- RS_DIALOGFACTORY->updateSelectionWidget(container->countSelected());
+ DIALOGFACTORY->updateSelectionWidget(container->countSelected());
}
}
void ActionModifyBevel::mouseMoveEvent(QMouseEvent * e)
{
- RS_DEBUG->print("ActionModifyBevel::mouseMoveEvent begin");
+ DEBUG->print("ActionModifyBevel::mouseMoveEvent begin");
Vector mouse = graphicView->toGraph(e->x(), e->y());
- RS_Entity * se = catchEntity(e, RS2::ResolveAll);
+ Entity * se = catchEntity(e, RS2::ResolveAll);
switch (getStatus())
{
case SetEntity2:
- if (entity1 != NULL && RS_Information::isTrimmable(entity1))
+ if (entity1 != NULL && Information::isTrimmable(entity1))
{
coord2 = mouse;
entity2 = se;
break;
}
- RS_DEBUG->print("ActionModifyBevel::mouseMoveEvent end");
+ DEBUG->print("ActionModifyBevel::mouseMoveEvent end");
}
void ActionModifyBevel::mouseReleaseEvent(QMouseEvent * e)
case SetEntity2:
if (entity2 != NULL && entity2->isAtomic()
- && RS_Information::isTrimmable(entity1, entity2))
+ && Information::isTrimmable(entity1, entity2))
trigger();
break;
}
}
-void ActionModifyBevel::commandEvent(RS_CommandEvent * e)
+void ActionModifyBevel::commandEvent(CommandEvent * e)
{
QString c = e->getCommand().toLower();
if (checkCommand("help", c))
{
- RS_DIALOGFACTORY->commandMessage(msgAvailableCommands()
+ DIALOGFACTORY->commandMessage(msgAvailableCommands()
+ getAvailableCommands().join(", "));
return;
}
//lastStatus = (Status)getStatus();
//setStatus(SetTrim);
data.trim = !data.trim;
- RS_DIALOGFACTORY->requestOptions(this, true, true);
+ DIALOGFACTORY->requestOptions(this, true, true);
}
break;
case SetLength1: {
bool ok;
- double l = RS_Math::eval(c, &ok);
+ double l = Math::eval(c, &ok);
if (ok == true)
data.length1 = l;
else
- RS_DIALOGFACTORY->commandMessage(tr("Not a valid expression"));
- RS_DIALOGFACTORY->requestOptions(this, true, true);
+ DIALOGFACTORY->commandMessage(tr("Not a valid expression"));
+ DIALOGFACTORY->requestOptions(this, true, true);
setStatus(lastStatus);
}
break;
case SetLength2: {
bool ok;
- double l = RS_Math::eval(c, &ok);
+ double l = Math::eval(c, &ok);
if (ok == true)
data.length2 = l;
else
- RS_DIALOGFACTORY->commandMessage(tr("Not a valid expression"));
- RS_DIALOGFACTORY->requestOptions(this, true, true);
+ DIALOGFACTORY->commandMessage(tr("Not a valid expression"));
+ DIALOGFACTORY->requestOptions(this, true, true);
setStatus(lastStatus);
}
break;
} else if (c==cmdNo.toLower() || c==cmdNo2) {
data.trim = false;
} else {
- RS_DIALOGFACTORY->commandMessage(tr("Please enter 'Yes' "
+ DIALOGFACTORY->commandMessage(tr("Please enter 'Yes' "
"or 'No'"));
}
- RS_DIALOGFACTORY->requestOptions(this, true, true);
+ DIALOGFACTORY->requestOptions(this, true, true);
setStatus(lastStatus);
}
break;*/
{
ActionInterface::showOptions();
- RS_DIALOGFACTORY->requestOptions(this, true);
+ DIALOGFACTORY->requestOptions(this, true);
}
void ActionModifyBevel::hideOptions()
{
ActionInterface::hideOptions();
- RS_DIALOGFACTORY->requestOptions(this, false);
+ DIALOGFACTORY->requestOptions(this, false);
}
void ActionModifyBevel::updateMouseButtonHints()
switch (getStatus())
{
case SetEntity1:
- RS_DIALOGFACTORY->updateMouseWidget(tr("Select first entity"),
+ DIALOGFACTORY->updateMouseWidget(tr("Select first entity"),
tr("Cancel"));
break;
case SetEntity2:
- RS_DIALOGFACTORY->updateMouseWidget(tr("Select second entity"),
+ DIALOGFACTORY->updateMouseWidget(tr("Select second entity"),
tr("Back"));
break;
case SetLength1:
- RS_DIALOGFACTORY->updateMouseWidget(tr("Enter length 1:"),
+ DIALOGFACTORY->updateMouseWidget(tr("Enter length 1:"),
tr("Back"));
break;
case SetLength2:
- RS_DIALOGFACTORY->updateMouseWidget(tr("Enter length 2:"),
+ DIALOGFACTORY->updateMouseWidget(tr("Enter length 2:"),
tr("Back"));
break;
/*case SetTrim:
- RS_DIALOGFACTORY->updateMouseWidget(tr("Trim on? (yes/no):"),
+ DIALOGFACTORY->updateMouseWidget(tr("Trim on? (yes/no):"),
"");
break;*/
default:
- RS_DIALOGFACTORY->updateMouseWidget("", "");
+ DIALOGFACTORY->updateMouseWidget("", "");
break;
}
}
void ActionModifyBevel::updateToolBar()
{
- RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarModify);
+ DIALOGFACTORY->requestToolBar(RS2::ToolBarModify);
}
void ActionModifyBevel::setLength1(double l1)
};
public:
- ActionModifyBevel(RS_EntityContainer & container, GraphicView & graphicView);
+ ActionModifyBevel(EntityContainer & container, GraphicView & graphicView);
~ActionModifyBevel();
virtual RS2::ActionType rtti();
virtual void trigger();
virtual void mouseMoveEvent(QMouseEvent * e);
virtual void mouseReleaseEvent(QMouseEvent * e);
- virtual void commandEvent(RS_CommandEvent * e);
+ virtual void commandEvent(CommandEvent * e);
virtual QStringList getAvailableCommands();
virtual void hideOptions();
virtual void showOptions();
bool isTrimOn();
private:
- RS_Entity * entity1;
+ Entity * entity1;
Vector coord1;
- RS_Entity * entity2;
+ Entity * entity2;
Vector coord2;
- RS_BevelData data;
+ BevelData data;
/** Last status before entering angle. */
Status lastStatus;
};
#include "graphicview.h"
#include "modification.h"
-ActionModifyCut::ActionModifyCut(RS_EntityContainer & container,
+ActionModifyCut::ActionModifyCut(EntityContainer & container,
GraphicView & graphicView): ActionInterface("Cut Entity",
container, graphicView)
{
void ActionModifyCut::trigger()
{
- RS_DEBUG->print("ActionModifyCut::trigger()");
+ DEBUG->print("ActionModifyCut::trigger()");
if (cutEntity != NULL && cutEntity->isAtomic() && cutCoord.valid
&& cutEntity->isPointOnEntity(cutCoord))
cutEntity->setHighlighted(false);
graphicView->drawEntity(cutEntity);
- RS_Modification m(*container, graphicView);
- m.cut(cutCoord, (RS_AtomicEntity *)cutEntity);
+ Modification m(*container, graphicView);
+ m.cut(cutCoord, (AtomicEntity *)cutEntity);
cutEntity = NULL;
cutCoord = Vector(false);
setStatus(ChooseCutEntity);
- RS_DIALOGFACTORY->updateSelectionWidget(container->countSelected());
+ DIALOGFACTORY->updateSelectionWidget(container->countSelected());
}
}
void ActionModifyCut::mouseMoveEvent(QMouseEvent * e)
{
- RS_DEBUG->print("ActionModifyCut::mouseMoveEvent begin");
+ DEBUG->print("ActionModifyCut::mouseMoveEvent begin");
switch (getStatus())
{
break;
}
- RS_DEBUG->print("ActionModifyTrim::mouseMoveEvent end");
+ DEBUG->print("ActionModifyTrim::mouseMoveEvent end");
}
void ActionModifyCut::mouseReleaseEvent(QMouseEvent * e)
cutEntity = catchEntity(e);
if (cutEntity == NULL)
- RS_DIALOGFACTORY->commandMessage(tr("No Entity found."));
+ DIALOGFACTORY->commandMessage(tr("No Entity found."));
else if (cutEntity->rtti() != RS2::EntityLine
&& cutEntity->rtti() != RS2::EntityArc
&& cutEntity->rtti() != RS2::EntityCircle
&& cutEntity->rtti() != RS2::EntityEllipse)
- RS_DIALOGFACTORY->commandMessage(
+ DIALOGFACTORY->commandMessage(
tr("Entity must be a line, arc, circle or ellipse."));
else
{
cutCoord = snapPoint(e);
if (cutEntity == NULL)
- RS_DIALOGFACTORY->commandMessage(tr("No Entity found."));
+ DIALOGFACTORY->commandMessage(tr("No Entity found."));
else if (!cutCoord.valid)
- RS_DIALOGFACTORY->commandMessage(tr("Cutting point is invalid."));
+ DIALOGFACTORY->commandMessage(tr("Cutting point is invalid."));
else if (!cutEntity->isPointOnEntity(cutCoord))
- RS_DIALOGFACTORY->commandMessage(
+ DIALOGFACTORY->commandMessage(
tr("Cutting point is not on entity."));
else
{
switch (getStatus())
{
case ChooseCutEntity:
- RS_DIALOGFACTORY->updateMouseWidget(tr("Specify entity to cut"),
+ DIALOGFACTORY->updateMouseWidget(tr("Specify entity to cut"),
tr("Cancel"));
break;
case SetCutCoord:
- RS_DIALOGFACTORY->updateMouseWidget(tr("Specify cutting point"),
+ DIALOGFACTORY->updateMouseWidget(tr("Specify cutting point"),
tr("Back"));
break;
default:
- RS_DIALOGFACTORY->updateMouseWidget("", "");
+ DIALOGFACTORY->updateMouseWidget("", "");
break;
}
}
switch (getStatus())
{
case SetCutCoord:
- RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarSnap);
+ DIALOGFACTORY->requestToolBar(RS2::ToolBarSnap);
break;
case ChooseCutEntity:
default:
- RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarModify);
+ DIALOGFACTORY->requestToolBar(RS2::ToolBarModify);
break;
}
}
#include "actioninterface.h"
#include "vector.h"
-class RS_Entity;
+class Entity;
/**
* This action class can handle user events to divide entities.
};
public:
- ActionModifyCut(RS_EntityContainer & container, GraphicView & graphicView);
+ ActionModifyCut(EntityContainer & container, GraphicView & graphicView);
~ActionModifyCut();
virtual void init(int status = 0);
virtual void updateToolBar();
private:
- RS_Entity * cutEntity;
+ Entity * cutEntity;
Vector cutCoord;
};
#include "graphicview.h"
#include "modification.h"
-ActionModifyDelete::ActionModifyDelete(RS_EntityContainer & container,
+ActionModifyDelete::ActionModifyDelete(EntityContainer & container,
GraphicView & graphicView): ActionInterface("Delete Entities",
container, graphicView)
{
void ActionModifyDelete::trigger()
{
- RS_DEBUG->print("ActionModifyDelete::trigger()");
- RS_Modification m(*container, graphicView);
+ DEBUG->print("ActionModifyDelete::trigger()");
+ Modification m(*container, graphicView);
m.remove();
finish();
- if (RS_DIALOGFACTORY != NULL)
- RS_DIALOGFACTORY->updateSelectionWidget(container->countSelected());
+ if (DIALOGFACTORY != NULL)
+ DIALOGFACTORY->updateSelectionWidget(container->countSelected());
}
void ActionModifyDelete::updateMouseButtonHints()
{
- if (RS_DIALOGFACTORY != NULL)
+ if (DIALOGFACTORY != NULL)
{
switch (getStatus())
{
//case Acknowledge:
- // RS_DIALOGFACTORY->updateMouseWidget(tr("Acknowledge"),
+ // DIALOGFACTORY->updateMouseWidget(tr("Acknowledge"),
// tr("Cancel"));
// break;
default:
- RS_DIALOGFACTORY->updateMouseWidget("", "");
+ DIALOGFACTORY->updateMouseWidget("", "");
break;
}
}
void ActionModifyDelete::updateToolBar()
{
- if (RS_DIALOGFACTORY != NULL)
+ if (DIALOGFACTORY != NULL)
{
if (!isFinished())
- RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarModify);
+ DIALOGFACTORY->requestToolBar(RS2::ToolBarModify);
else
- RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarMain);
+ DIALOGFACTORY->requestToolBar(RS2::ToolBarMain);
}
}
};
public:
- ActionModifyDelete(RS_EntityContainer & container, GraphicView & graphicView);
+ ActionModifyDelete(EntityContainer & container, GraphicView & graphicView);
~ActionModifyDelete();
virtual void init(int status = 0);
#include "polyline.h"
#include "undo.h"
-ActionModifyDeleteFree::ActionModifyDeleteFree(RS_EntityContainer & container,
+ActionModifyDeleteFree::ActionModifyDeleteFree(EntityContainer & container,
GraphicView & graphicView):
ActionInterface("Delete Entities Freehand", container, graphicView)
{
{
if (e1 && e2)
{
- RS_EntityContainer * parent = e2->getParent();
+ EntityContainer * parent = e2->getParent();
if (parent)
{
#warning "!!! Old rendering path need upgrade !!!"
#if 0
// deletes whole polyline on screen:
- graphicView->deleteEntity((RS_Entity *)polyline);
+ graphicView->deleteEntity((Entity *)polyline);
#endif
// splits up the polyline in the container:
- RS_Polyline * pl1;
- RS_Polyline * pl2;
- RS_Modification m(*container);
+ Polyline * pl1;
+ Polyline * pl2;
+ Modification m(*container);
m.splitPolyline(*polyline, *e1, v1, *e2, v2, &pl1, &pl2);
if (document)
}
// draws the new polylines on the screen:
- graphicView->drawEntity((RS_Entity *)pl1);
- graphicView->drawEntity((RS_Entity *)pl2);
+ graphicView->drawEntity((Entity *)pl1);
+ graphicView->drawEntity((Entity *)pl2);
init();
- RS_DIALOGFACTORY->updateSelectionWidget(
+ DIALOGFACTORY->updateSelectionWidget(
container->countSelected());
}
else
- RS_DIALOGFACTORY->commandMessage(tr("Entities not in the same polyline."));
+ DIALOGFACTORY->commandMessage(tr("Entities not in the same polyline."));
}
else
- RS_DIALOGFACTORY->commandMessage(tr("Parent of second entity is not a polyline"));
+ DIALOGFACTORY->commandMessage(tr("Parent of second entity is not a polyline"));
}
else
- RS_DIALOGFACTORY->commandMessage(tr("Parent of second entity is NULL"));
+ DIALOGFACTORY->commandMessage(tr("Parent of second entity is NULL"));
}
else
- RS_DIALOGFACTORY->commandMessage(tr("One of the chosen entities is NULL"));
+ DIALOGFACTORY->commandMessage(tr("One of the chosen entities is NULL"));
}
void ActionModifyDeleteFree::mouseReleaseEvent(QMouseEvent * e)
if (e1)
{
- RS_EntityContainer * parent = e1->getParent();
+ EntityContainer * parent = e1->getParent();
if (parent)
{
if (parent->rtti() == RS2::EntityPolyline)
{
- polyline = (RS_Polyline *)parent;
+ polyline = (Polyline *)parent;
setStatus(1);
}
else
- RS_DIALOGFACTORY->commandMessage(
+ DIALOGFACTORY->commandMessage(
tr("Parent of first entity is not a polyline"));
}
else
- RS_DIALOGFACTORY->commandMessage(
+ DIALOGFACTORY->commandMessage(
tr("Parent of first entity is NULL"));
}
else
- RS_DIALOGFACTORY->commandMessage(
+ DIALOGFACTORY->commandMessage(
tr("First entity is NULL"));
break;
if (e2)
trigger();
else
- RS_DIALOGFACTORY->commandMessage(tr("Second entity is NULL"));
+ DIALOGFACTORY->commandMessage(tr("Second entity is NULL"));
break;
}
switch (getStatus())
{
case 0:
- RS_DIALOGFACTORY->updateMouseWidget(tr("Specify first break point "
+ DIALOGFACTORY->updateMouseWidget(tr("Specify first break point "
"on a polyline"), tr("Cancel"));
break;
case 1:
- RS_DIALOGFACTORY->updateMouseWidget(tr("Specify second break point "
+ DIALOGFACTORY->updateMouseWidget(tr("Specify second break point "
"on the same polyline"), tr("Back"));
break;
default:
- RS_DIALOGFACTORY->updateMouseWidget("", "");
+ DIALOGFACTORY->updateMouseWidget("", "");
break;
}
}
#include "actioninterface.h"
#include "vector.h"
-class RS_Entity;
-class RS_Polyline;
+class Entity;
+class Polyline;
/**
* This action class can handle user events to delete entities.
class ActionModifyDeleteFree: public ActionInterface
{
public:
- ActionModifyDeleteFree(RS_EntityContainer & container, GraphicView & graphicView);
+ ActionModifyDeleteFree(EntityContainer & container, GraphicView & graphicView);
~ActionModifyDeleteFree();
virtual void init(int status = 0);
virtual void updateMouseButtonHints();
private:
- RS_Polyline * polyline;
- RS_Entity * e1;
+ Polyline * polyline;
+ Entity * e1;
Vector v1;
- RS_Entity * e2;
+ Entity * e2;
Vector v2;
};
#include "graphicview.h"
ActionModifyDeleteQuick::ActionModifyDeleteQuick(
- RS_EntityContainer & container, GraphicView & graphicView):
+ EntityContainer & container, GraphicView & graphicView):
ActionInterface("Quick Delete Entities", container, graphicView)
{
en = NULL;
*/
void ActionModifyDeleteQuick::trigger()
{
- RS_DEBUG->print("ActionModifyDeleteQuick::trigger()");
+ DEBUG->print("ActionModifyDeleteQuick::trigger()");
if (en)
{
- RS_DEBUG->print("Entity found");
- RS_EntityContainer * parent = en->getParent();
+ DEBUG->print("Entity found");
+ EntityContainer * parent = en->getParent();
if (parent)
{
}
}
- RS_DIALOGFACTORY->updateSelectionWidget(container->countSelected());
+ DIALOGFACTORY->updateSelectionWidget(container->countSelected());
}
else
- RS_DEBUG->print("ActionModifyDeleteQuick::mousePressEvent:"
+ DEBUG->print("ActionModifyDeleteQuick::mousePressEvent:"
" Entity is NULL\n");
}
switch (getStatus())
{
case 0:
- RS_DIALOGFACTORY->updateMouseWidget(tr("Pick entity to delete"),
+ DIALOGFACTORY->updateMouseWidget(tr("Pick entity to delete"),
tr("Cancel"));
break;
default:
- RS_DIALOGFACTORY->updateMouseWidget("", "");
+ DIALOGFACTORY->updateMouseWidget("", "");
break;
}
}
#include "actioninterface.h"
-class RS_Entity;
+class Entity;
/**
* This action class can handle user events to delete entities
class ActionModifyDeleteQuick: public ActionInterface
{
public:
- ActionModifyDeleteQuick(RS_EntityContainer & container, GraphicView & graphicView);
+ ActionModifyDeleteQuick(EntityContainer & container, GraphicView & graphicView);
~ActionModifyDeleteQuick();
virtual void trigger();
virtual void updateMouseCursor();
private:
- RS_Entity * en;
+ Entity * en;
};
#endif // __ACTIONMODIFYDELETEQUICK_H__
/*
Program received signal SIGSEGV, Segmentation fault.
-0x080d0fd1 in PaintInterface::fillRect(int, int, int, int, RS_Color const&) ()
+0x080d0fd1 in PaintInterface::fillRect(int, int, int, int, Color const&) ()
(gdb) bt
-#0 0x080d0fd1 in PaintInterface::fillRect(int, int, int, int, RS_Color const&)
+#0 0x080d0fd1 in PaintInterface::fillRect(int, int, int, int, Color const&)
()
-#1 0x080cf523 in PaintInterface::drawHandle(Vector const&, RS_Color const&, int) ()
-#2 0x0822d7e0 in GraphicView::drawEntity(RS_Entity*, double, bool) ()
-#3 0x0822d9a0 in GraphicView::deleteEntity(RS_Entity*) ()
+#1 0x080cf523 in PaintInterface::drawHandle(Vector const&, Color const&, int) ()
+#2 0x0822d7e0 in GraphicView::drawEntity(Entity*, double, bool) ()
+#3 0x0822d9a0 in GraphicView::deleteEntity(Entity*) ()
#4 0x081334dc in ActionModifyEntity::trigger() ()
#5 0x081336ef in ActionModifyEntity::mouseReleaseEvent(QMouseEvent*) ()
-#6 0x08089d2a in RS_EventHandler::mouseReleaseEvent(QMouseEvent*) ()
+#6 0x08089d2a in EventHandler::mouseReleaseEvent(QMouseEvent*) ()
#7 0x0822a482 in GraphicView::mouseReleaseEvent(QMouseEvent*) ()
#8 0x081eb00a in QG_GraphicView::mouseReleaseEvent(QMouseEvent*) ()
#9 0xb77063c1 in QWidget::event(QEvent*) () from /usr/lib/qt4/libQtGui.so.4
#include "dialogfactory.h"
#include "graphicview.h"
-ActionModifyEntity::ActionModifyEntity(RS_EntityContainer & container,
+ActionModifyEntity::ActionModifyEntity(EntityContainer & container,
GraphicView & graphicView):
ActionInterface("Modify Entity", container, graphicView), en(NULL)
{
{
if (!en)
{
- RS_DEBUG->print("ActionModifyEntity::trigger: Entity is NULL\n");
+ DEBUG->print("ActionModifyEntity::trigger: Entity is NULL\n");
return;
}
- RS_Entity * clone = en->clone();
+ Entity * clone = en->clone();
- if (RS_DIALOGFACTORY->requestModifyEntityDialog(clone))
+ if (DIALOGFACTORY->requestModifyEntityDialog(clone))
{
container->addEntity(clone);
#warning "!!! Old rendering path need upgrade !!!"
document->endUndoCycle();
}
- RS_DIALOGFACTORY->updateSelectionWidget(container->countSelected());
+ DIALOGFACTORY->updateSelectionWidget(container->countSelected());
}
else
delete clone;
#include "actioninterface.h"
-class RS_Entity;
+class Entity;
/**
* This action class can handle user events to select entities.
class ActionModifyEntity: public ActionInterface
{
public:
- ActionModifyEntity(RS_EntityContainer & container, GraphicView & graphicView);
+ ActionModifyEntity(EntityContainer & container, GraphicView & graphicView);
~ActionModifyEntity();
virtual void trigger();
virtual void updateMouseCursor();
private:
- RS_Entity * en;
+ Entity * en;
};
#endif // __ACTIONMODIFYENTITY_H__
/**
* Constructor.
*/
-ActionModifyExplodeText::ActionModifyExplodeText(RS_EntityContainer & container,
+ActionModifyExplodeText::ActionModifyExplodeText(EntityContainer & container,
GraphicView & graphicView): ActionInterface("Blocks Explode",
container, graphicView)
{
void ActionModifyExplodeText::trigger()
{
- RS_Modification m(*container, graphicView);
+ Modification m(*container, graphicView);
m.explodeTextIntoLetters();
}
class ActionModifyExplodeText: public ActionInterface
{
public:
- ActionModifyExplodeText(RS_EntityContainer & container, GraphicView & graphicView);
+ ActionModifyExplodeText(EntityContainer & container, GraphicView & graphicView);
~ActionModifyExplodeText();
virtual RS2::ActionType rtti();
#include "dialogfactory.h"
#include "preview.h"
-ActionModifyMirror::ActionModifyMirror(RS_EntityContainer & container, GraphicView & graphicView):
+ActionModifyMirror::ActionModifyMirror(EntityContainer & container, GraphicView & graphicView):
ActionInterface("Mirror Entities", container, graphicView)
{
}
void ActionModifyMirror::trigger()
{
- RS_DEBUG->print("ActionModifyMirror::trigger()");
+ DEBUG->print("ActionModifyMirror::trigger()");
- RS_Modification m(*container, graphicView);
+ Modification m(*container, graphicView);
m.mirror(data);
- if (RS_DIALOGFACTORY)
- RS_DIALOGFACTORY->updateSelectionWidget(container->countSelected());
+ if (DIALOGFACTORY)
+ DIALOGFACTORY->updateSelectionWidget(container->countSelected());
}
void ActionModifyMirror::mouseMoveEvent(QMouseEvent * e)
{
- RS_DEBUG->print("ActionModifyMirror::mouseMoveEvent begin");
+ DEBUG->print("ActionModifyMirror::mouseMoveEvent begin");
if (getStatus() == SetAxisPoint1 || getStatus() == SetAxisPoint2)
{
clearPreview();
/* preview->addSelectionFrom(*container);
preview->mirror(axisPoint1, axisPoint2);
- preview->addEntity(new RS_Line(preview,RS_LineData(axisPoint1, axisPoint2)));*/
+ preview->addEntity(new Line(preview,LineData(axisPoint1, axisPoint2)));*/
drawPreview();
}
break;
}
}
- RS_DEBUG->print("ActionModifyMirror::mouseMoveEvent end");
+ DEBUG->print("ActionModifyMirror::mouseMoveEvent end");
}
void ActionModifyMirror::mouseReleaseEvent(QMouseEvent * e)
setStatus(ShowDialog);
graphicView->moveRelativeZero(mouse);
- if (RS_DIALOGFACTORY)
+ if (DIALOGFACTORY)
{
- if (RS_DIALOGFACTORY->requestMirrorDialog(data))
+ if (DIALOGFACTORY->requestMirrorDialog(data))
{
data.axisPoint1 = axisPoint1;
data.axisPoint2 = axisPoint2;
void ActionModifyMirror::updateMouseButtonHints()
{
- if (RS_DIALOGFACTORY)
+ if (DIALOGFACTORY)
{
switch (getStatus())
{
/*case Select:
- RS_DIALOGFACTORY->updateMouseWidget(tr("Pick entities to move"),
+ DIALOGFACTORY->updateMouseWidget(tr("Pick entities to move"),
tr("Cancel"));
break;*/
case SetAxisPoint1:
- RS_DIALOGFACTORY->updateMouseWidget(
+ DIALOGFACTORY->updateMouseWidget(
tr("Specify first point of mirror line"),
tr("Cancel"));
break;
case SetAxisPoint2:
- RS_DIALOGFACTORY->updateMouseWidget(
+ DIALOGFACTORY->updateMouseWidget(
tr("Specify second point of mirror line"),
tr("Back"));
break;
default:
- RS_DIALOGFACTORY->updateMouseWidget("", "");
+ DIALOGFACTORY->updateMouseWidget("", "");
break;
}
}
void ActionModifyMirror::updateToolBar()
{
- if (RS_DIALOGFACTORY != NULL)
+ if (DIALOGFACTORY != NULL)
{
switch (getStatus())
{
case SetAxisPoint1:
case SetAxisPoint2:
- RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarSnap);
+ DIALOGFACTORY->requestToolBar(RS2::ToolBarSnap);
break;
default:
- RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarModify);
+ DIALOGFACTORY->requestToolBar(RS2::ToolBarModify);
break;
}
}
};
public:
- ActionModifyMirror(RS_EntityContainer & container, GraphicView & graphicView);
+ ActionModifyMirror(EntityContainer & container, GraphicView & graphicView);
~ActionModifyMirror();
virtual void init(int status = 0);
virtual void updateToolBar();
private:
- RS_MirrorData data;
+ MirrorData data;
Vector axisPoint1;
Vector axisPoint2;
};
#include "dialogfactory.h"
#include "preview.h"
-ActionModifyMove::ActionModifyMove(RS_EntityContainer & container,
+ActionModifyMove::ActionModifyMove(EntityContainer & container,
GraphicView & graphicView):
ActionInterface("Move Entities", container, graphicView)
{
void ActionModifyMove::trigger()
{
- RS_DEBUG->print("ActionModifyMove::trigger()");
+ DEBUG->print("ActionModifyMove::trigger()");
- RS_Modification m(*container, graphicView);
+ Modification m(*container, graphicView);
m.move(data);
- RS_DIALOGFACTORY->updateSelectionWidget(container->countSelected());
+ DIALOGFACTORY->updateSelectionWidget(container->countSelected());
}
void ActionModifyMove::mouseMoveEvent(QMouseEvent * e)
{
- RS_DEBUG->print("ActionModifyMove::mouseMoveEvent begin");
+ DEBUG->print("ActionModifyMove::mouseMoveEvent begin");
if (getStatus() == SetReferencePoint
|| getStatus() == SetTargetPoint)
}
}
- RS_DEBUG->print("ActionModifyMove::mouseMoveEvent end");
+ DEBUG->print("ActionModifyMove::mouseMoveEvent end");
}
void ActionModifyMove::mouseReleaseEvent(QMouseEvent * e)
graphicView->moveRelativeZero(targetPoint);
setStatus(ShowDialog);
- if (RS_DIALOGFACTORY->requestMoveDialog(data))
+ if (DIALOGFACTORY->requestMoveDialog(data))
{
data.offset = targetPoint - referencePoint;
trigger();
switch (getStatus())
{
/*case Select:
- RS_DIALOGFACTORY->updateMouseWidget(tr("Pick entities to move"),
+ DIALOGFACTORY->updateMouseWidget(tr("Pick entities to move"),
tr("Cancel"));
break;*/
case SetReferencePoint:
- RS_DIALOGFACTORY->updateMouseWidget(tr("Specify reference point"),
+ DIALOGFACTORY->updateMouseWidget(tr("Specify reference point"),
tr("Cancel"));
break;
case SetTargetPoint:
- RS_DIALOGFACTORY->updateMouseWidget(tr("Specify target point"),
+ DIALOGFACTORY->updateMouseWidget(tr("Specify target point"),
tr("Back"));
break;
default:
- RS_DIALOGFACTORY->updateMouseWidget("", "");
+ DIALOGFACTORY->updateMouseWidget("", "");
break;
}
}
switch (getStatus())
{
/*case Select:
- RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarSelect);
+ DIALOGFACTORY->requestToolBar(RS2::ToolBarSelect);
break;*/
case SetReferencePoint:
case SetTargetPoint:
- RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarSnap);
+ DIALOGFACTORY->requestToolBar(RS2::ToolBarSnap);
break;
default:
- RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarModify);
+ DIALOGFACTORY->requestToolBar(RS2::ToolBarModify);
break;
}
}
};
public:
- ActionModifyMove(RS_EntityContainer & container, GraphicView & graphicView);
+ ActionModifyMove(EntityContainer & container, GraphicView & graphicView);
~ActionModifyMove();
virtual void init(int status = 0);
virtual void updateToolBar();
private:
- RS_MoveData data;
+ MoveData data;
Vector referencePoint;
Vector targetPoint;
};
#include "preview.h"
ActionModifyMoveRotate::ActionModifyMoveRotate(
- RS_EntityContainer & container, GraphicView & graphicView):
+ EntityContainer & container, GraphicView & graphicView):
ActionInterface("Move and Rotate Entities", container, graphicView)
{
}
void ActionModifyMoveRotate::trigger()
{
- RS_DEBUG->print("ActionModifyMoveRotate::trigger()");
+ DEBUG->print("ActionModifyMoveRotate::trigger()");
- RS_Modification m(*container, graphicView);
+ Modification m(*container, graphicView);
m.moveRotate(data);
finish();
- RS_DIALOGFACTORY->updateSelectionWidget(container->countSelected());
+ DIALOGFACTORY->updateSelectionWidget(container->countSelected());
}
void ActionModifyMoveRotate::mouseMoveEvent(QMouseEvent * e)
{
- RS_DEBUG->print("ActionModifyMoveRotate::mouseMoveEvent begin");
+ DEBUG->print("ActionModifyMoveRotate::mouseMoveEvent begin");
if (getStatus() == SetReferencePoint || getStatus() == SetTargetPoint)
{
}
}
- RS_DEBUG->print("ActionModifyMoveRotate::mouseMoveEvent end");
+ DEBUG->print("ActionModifyMoveRotate::mouseMoveEvent end");
}
void ActionModifyMoveRotate::mouseReleaseEvent(QMouseEvent * e)
setStatus(ShowDialog);
data.offset = targetPoint - data.referencePoint;
- if (RS_DIALOGFACTORY->requestMoveRotateDialog(data))
+ if (DIALOGFACTORY->requestMoveRotateDialog(data))
trigger();
//finish();
break;
}
}
-void ActionModifyMoveRotate::commandEvent(RS_CommandEvent * e)
+void ActionModifyMoveRotate::commandEvent(CommandEvent * e)
{
QString c = e->getCommand().toLower();
if (checkCommand("help", c))
{
- RS_DIALOGFACTORY->commandMessage(msgAvailableCommands() + getAvailableCommands().join(", "));
+ DIALOGFACTORY->commandMessage(msgAvailableCommands() + getAvailableCommands().join(", "));
return;
}
case SetAngle:
{
bool ok;
- double a = RS_Math::eval(c, &ok);
+ double a = Math::eval(c, &ok);
if (ok)
- data.angle = RS_Math::deg2rad(a);
+ data.angle = Math::deg2rad(a);
else
- RS_DIALOGFACTORY->commandMessage(tr("Not a valid expression"));
+ DIALOGFACTORY->commandMessage(tr("Not a valid expression"));
- RS_DIALOGFACTORY->requestOptions(this, true, true);
+ DIALOGFACTORY->requestOptions(this, true, true);
setStatus(lastStatus);
}
break;
ActionInterface::showOptions();
- RS_DIALOGFACTORY->requestOptions(this, true);
+ DIALOGFACTORY->requestOptions(this, true);
}
void ActionModifyMoveRotate::hideOptions()
ActionInterface::hideOptions();
- RS_DIALOGFACTORY->requestOptions(this, false);
+ DIALOGFACTORY->requestOptions(this, false);
}
void ActionModifyMoveRotate::updateMouseButtonHints()
switch (getStatus())
{
case SetReferencePoint:
- RS_DIALOGFACTORY->updateMouseWidget(tr("Specify reference point"), tr("Cancel"));
+ DIALOGFACTORY->updateMouseWidget(tr("Specify reference point"), tr("Cancel"));
break;
case SetTargetPoint:
- RS_DIALOGFACTORY->updateMouseWidget(tr("Specify target point"), tr("Back"));
+ DIALOGFACTORY->updateMouseWidget(tr("Specify target point"), tr("Back"));
break;
case SetAngle:
- RS_DIALOGFACTORY->updateMouseWidget(tr("Enter rotation angle:"), tr("Back"));
+ DIALOGFACTORY->updateMouseWidget(tr("Enter rotation angle:"), tr("Back"));
break;
default:
- RS_DIALOGFACTORY->updateMouseWidget("", "");
+ DIALOGFACTORY->updateMouseWidget("", "");
break;
}
}
{
case SetReferencePoint:
case SetTargetPoint:
- RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarSnap);
+ DIALOGFACTORY->requestToolBar(RS2::ToolBarSnap);
break;
default:
- RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarModify);
+ DIALOGFACTORY->requestToolBar(RS2::ToolBarModify);
break;
}
}
};
public:
- ActionModifyMoveRotate(RS_EntityContainer & container, GraphicView & graphicView);
+ ActionModifyMoveRotate(EntityContainer & container, GraphicView & graphicView);
~ActionModifyMoveRotate();
virtual RS2::ActionType rtti();
virtual void mouseMoveEvent(QMouseEvent * e);
virtual void mouseReleaseEvent(QMouseEvent * e);
virtual void coordinateEvent(Vector * e);
- virtual void commandEvent(RS_CommandEvent * e);
+ virtual void commandEvent(CommandEvent * e);
virtual QStringList getAvailableCommands();
virtual void hideOptions();
virtual void showOptions();
double getAngle();
private:
- RS_MoveRotateData data;
+ MoveRotateData data;
Vector targetPoint;
/** Last status before entering angle. */
#include "debug.h"
#include "dialogfactory.h"
-ActionModifyRotate::ActionModifyRotate(RS_EntityContainer & container, GraphicView & graphicView):
+ActionModifyRotate::ActionModifyRotate(EntityContainer & container, GraphicView & graphicView):
ActionInterface("Rotate Entities",
container, graphicView)
{
void ActionModifyRotate::trigger()
{
- RS_DEBUG->print("ActionModifyRotate::trigger()");
+ DEBUG->print("ActionModifyRotate::trigger()");
- RS_Modification m(*container, graphicView);
+ Modification m(*container, graphicView);
m.rotate(data);
- RS_DIALOGFACTORY->updateSelectionWidget(container->countSelected());
+ DIALOGFACTORY->updateSelectionWidget(container->countSelected());
}
void ActionModifyRotate::mouseMoveEvent(QMouseEvent * e)
{
- RS_DEBUG->print("ActionModifyRotate::mouseMoveEvent begin");
+ DEBUG->print("ActionModifyRotate::mouseMoveEvent begin");
if (getStatus() == SetReferencePoint)
{
}
}
- RS_DEBUG->print("ActionModifyRotate::mouseMoveEvent end");
+ DEBUG->print("ActionModifyRotate::mouseMoveEvent end");
}
void ActionModifyRotate::mouseReleaseEvent(QMouseEvent * e)
referencePoint = pos;
setStatus(ShowDialog);
- if (RS_DIALOGFACTORY->requestRotateDialog(data))
+ if (DIALOGFACTORY->requestRotateDialog(data))
{
data.center = referencePoint;
trigger();
switch (getStatus())
{
case SetReferencePoint:
- RS_DIALOGFACTORY->updateMouseWidget(tr("Specify reference point"),
+ DIALOGFACTORY->updateMouseWidget(tr("Specify reference point"),
tr("Back"));
break;
default:
- RS_DIALOGFACTORY->updateMouseWidget("", "");
+ DIALOGFACTORY->updateMouseWidget("", "");
break;
}
}
switch (getStatus())
{
case SetReferencePoint:
- RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarSnap);
+ DIALOGFACTORY->requestToolBar(RS2::ToolBarSnap);
break;
default:
- RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarModify);
+ DIALOGFACTORY->requestToolBar(RS2::ToolBarModify);
break;
}
}
};
public:
- ActionModifyRotate(RS_EntityContainer & container, GraphicView & graphicView);
+ ActionModifyRotate(EntityContainer & container, GraphicView & graphicView);
~ActionModifyRotate();
virtual void init(int status = 0);
virtual void updateToolBar();
private:
- RS_RotateData data;
+ RotateData data;
Vector referencePoint;
Vector targetPoint;
};
#include "dialogfactory.h"
ActionModifyRotate2::ActionModifyRotate2(
- RS_EntityContainer & container, GraphicView & graphicView):
+ EntityContainer & container, GraphicView & graphicView):
ActionInterface("Rotate Entities around two centers", container, graphicView)
{
}
void ActionModifyRotate2::trigger()
{
- RS_DEBUG->print("ActionModifyRotate2::trigger()");
+ DEBUG->print("ActionModifyRotate2::trigger()");
- RS_Modification m(*container, graphicView);
+ Modification m(*container, graphicView);
m.rotate2(data);
finish();
- RS_DIALOGFACTORY->updateSelectionWidget(container->countSelected());
+ DIALOGFACTORY->updateSelectionWidget(container->countSelected());
}
void ActionModifyRotate2::mouseMoveEvent(QMouseEvent * e)
{
- RS_DEBUG->print("ActionModifyRotate2::mouseMoveEvent begin");
+ DEBUG->print("ActionModifyRotate2::mouseMoveEvent begin");
if (getStatus() == SetReferencePoint1 || getStatus() == SetReferencePoint2)
{
}
}
- RS_DEBUG->print("ActionModifyRotate2::mouseMoveEvent end");
+ DEBUG->print("ActionModifyRotate2::mouseMoveEvent end");
}
void ActionModifyRotate2::mouseReleaseEvent(QMouseEvent * e)
data.center2 = pos;
setStatus(ShowDialog);
- if (RS_DIALOGFACTORY->requestRotate2Dialog(data))
+ if (DIALOGFACTORY->requestRotate2Dialog(data))
trigger();
//finish();
break;
}
}
-void ActionModifyRotate2::commandEvent(RS_CommandEvent * /*e*/)
+void ActionModifyRotate2::commandEvent(CommandEvent * /*e*/)
{
}
switch (getStatus())
{
case SetReferencePoint1:
- RS_DIALOGFACTORY->updateMouseWidget(tr("Specify absolute reference point"),
+ DIALOGFACTORY->updateMouseWidget(tr("Specify absolute reference point"),
tr("Cancel"));
break;
case SetReferencePoint2:
- RS_DIALOGFACTORY->updateMouseWidget(tr("Specify relative reference point"),
+ DIALOGFACTORY->updateMouseWidget(tr("Specify relative reference point"),
tr("Back"));
break;
default:
- RS_DIALOGFACTORY->updateMouseWidget("", "");
+ DIALOGFACTORY->updateMouseWidget("", "");
break;
}
}
{
case SetReferencePoint1:
case SetReferencePoint2:
- RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarSnap);
+ DIALOGFACTORY->requestToolBar(RS2::ToolBarSnap);
break;
default:
- RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarModify);
+ DIALOGFACTORY->requestToolBar(RS2::ToolBarModify);
break;
}
}
};
public:
- ActionModifyRotate2(RS_EntityContainer & container, GraphicView & graphicView);
+ ActionModifyRotate2(EntityContainer & container, GraphicView & graphicView);
~ActionModifyRotate2();
virtual void init(int status = 0);
virtual void mouseMoveEvent(QMouseEvent * e);
virtual void mouseReleaseEvent(QMouseEvent * e);
virtual void coordinateEvent(Vector * e);
- virtual void commandEvent(RS_CommandEvent * e);
+ virtual void commandEvent(CommandEvent * e);
virtual QStringList getAvailableCommands();
virtual void updateMouseButtonHints();
virtual void updateMouseCursor();
virtual void updateToolBar();
private:
- RS_Rotate2Data data;
+ Rotate2Data data;
};
#endif // __ACTIONMODIFYROTATE2_H__
#include "information.h"
#include "preview.h"
-ActionModifyRound::ActionModifyRound(RS_EntityContainer & container, GraphicView & graphicView):
+ActionModifyRound::ActionModifyRound(EntityContainer & container, GraphicView & graphicView):
ActionInterface("Round Entities", container, graphicView)
{
entity1 = NULL;
void ActionModifyRound::trigger()
{
- RS_DEBUG->print("ActionModifyRound::trigger()");
+ DEBUG->print("ActionModifyRound::trigger()");
if (entity1 != NULL && entity1->isAtomic()
&& entity2 != NULL && entity2->isAtomic())
{
deletePreview();
- RS_Modification m(*container, graphicView);
- m.round(coord2, coord1, (RS_AtomicEntity *)entity1, coord2,
- (RS_AtomicEntity *)entity2, data);
+ Modification m(*container, graphicView);
+ m.round(coord2, coord1, (AtomicEntity *)entity1, coord2,
+ (AtomicEntity *)entity2, data);
coord1 = Vector(false);
entity1 = NULL;
clearPreview();
- if (RS_DIALOGFACTORY != NULL)
- RS_DIALOGFACTORY->updateSelectionWidget(container->countSelected());
+ if (DIALOGFACTORY != NULL)
+ DIALOGFACTORY->updateSelectionWidget(container->countSelected());
}
}
void ActionModifyRound::mouseMoveEvent(QMouseEvent * e)
{
- RS_DEBUG->print("ActionModifyRound::mouseMoveEvent begin");
+ DEBUG->print("ActionModifyRound::mouseMoveEvent begin");
Vector mouse = graphicView->toGraph(e->x(), e->y());
- RS_Entity * se = catchEntity(e, RS2::ResolveAll);
+ Entity * se = catchEntity(e, RS2::ResolveAll);
switch (getStatus())
{
coord2 = mouse;
if (entity1 != NULL && entity2 != NULL && entity2->isAtomic()
- && RS_Information::isTrimmable(entity1, entity2))
+ && Information::isTrimmable(entity1, entity2))
{
deletePreview();
clearPreview();
-/* RS_Entity * tmp1 = entity1->clone();
- RS_Entity * tmp2 = entity2->clone();*/
+/* Entity * tmp1 = entity1->clone();
+ Entity * tmp2 = entity2->clone();*/
// tmp1->reparent(preview);
// tmp2->reparent(preview);
// preview->addEntity(tmp1);
/* bool trim = data.trim;
data.trim = false;
- RS_Modification m(*preview, NULL, false);
- m.round(coord2, coord1, (RS_AtomicEntity *)tmp1, coord2,
- (RS_AtomicEntity *)tmp2, data);
+ Modification m(*preview, NULL, false);
+ m.round(coord2, coord1, (AtomicEntity *)tmp1, coord2,
+ (AtomicEntity *)tmp2, data);
data.trim = trim;
preview->removeEntity(tmp1);
break;
}
- RS_DEBUG->print("ActionModifyRound::mouseMoveEvent end");
+ DEBUG->print("ActionModifyRound::mouseMoveEvent end");
}
void ActionModifyRound::mouseReleaseEvent(QMouseEvent * e)
{
Vector mouse = graphicView->toGraph(e->x(), e->y());
- RS_Entity * se = catchEntity(e, RS2::ResolveAll);
+ Entity * se = catchEntity(e, RS2::ResolveAll);
if (e->button() == Qt::LeftButton)
{
coord1 = mouse;
if (entity1 != NULL && entity1->isAtomic()
- && RS_Information::isTrimmable(entity1))
+ && Information::isTrimmable(entity1))
setStatus(SetEntity2);
break;
coord2 = mouse;
if (entity2 != NULL && entity2->isAtomic()
- && RS_Information::isTrimmable(entity1, entity2))
+ && Information::isTrimmable(entity1, entity2))
//setStatus(ChooseRounding);
trigger();
break;
}
}
-void ActionModifyRound::commandEvent(RS_CommandEvent * e)
+void ActionModifyRound::commandEvent(CommandEvent * e)
{
QString c = e->getCommand().toLower();
if (checkCommand("help", c))
{
- if (RS_DIALOGFACTORY != NULL)
- RS_DIALOGFACTORY->commandMessage(msgAvailableCommands()
+ if (DIALOGFACTORY != NULL)
+ DIALOGFACTORY->commandMessage(msgAvailableCommands()
+ getAvailableCommands().join(", "));
return;
}
*/
data.trim = !data.trim;
- if (RS_DIALOGFACTORY != NULL)
- RS_DIALOGFACTORY->requestOptions(this, true, true);
+ if (DIALOGFACTORY != NULL)
+ DIALOGFACTORY->requestOptions(this, true, true);
}
break;
case SetRadius: {
bool ok;
- double r = RS_Math::eval(c, &ok);
+ double r = Math::eval(c, &ok);
if (ok == true)
data.radius = r;
- else if (RS_DIALOGFACTORY != NULL)
- RS_DIALOGFACTORY->commandMessage(tr("Not a valid expression"));
+ else if (DIALOGFACTORY != NULL)
+ DIALOGFACTORY->commandMessage(tr("Not a valid expression"));
- if (RS_DIALOGFACTORY != NULL)
- RS_DIALOGFACTORY->requestOptions(this, true, true);
+ if (DIALOGFACTORY != NULL)
+ DIALOGFACTORY->requestOptions(this, true, true);
setStatus(lastStatus);
}
break;
} else if (c==cmdNo.toLower() || c==cmdNo2) {
data.trim = false;
} else {
- RS_DIALOGFACTORY->commandMessage(tr("Please enter 'Yes' "
+ DIALOGFACTORY->commandMessage(tr("Please enter 'Yes' "
"or 'No'"));
}
- RS_DIALOGFACTORY->requestOptions(this, true, true);
+ DIALOGFACTORY->requestOptions(this, true, true);
setStatus(lastStatus);
}
break;*/
{
ActionInterface::showOptions();
- if (RS_DIALOGFACTORY != NULL)
- RS_DIALOGFACTORY->requestOptions(this, true);
+ if (DIALOGFACTORY != NULL)
+ DIALOGFACTORY->requestOptions(this, true);
}
void ActionModifyRound::hideOptions()
{
ActionInterface::hideOptions();
- if (RS_DIALOGFACTORY != NULL)
- RS_DIALOGFACTORY->requestOptions(this, false);
+ if (DIALOGFACTORY != NULL)
+ DIALOGFACTORY->requestOptions(this, false);
}
void ActionModifyRound::updateMouseButtonHints()
{
- if (RS_DIALOGFACTORY != NULL)
+ if (DIALOGFACTORY != NULL)
{
switch (getStatus())
{
case SetEntity1:
- RS_DIALOGFACTORY->updateMouseWidget(tr("Specify first entity"),
+ DIALOGFACTORY->updateMouseWidget(tr("Specify first entity"),
tr("Back"));
break;
case SetEntity2:
- RS_DIALOGFACTORY->updateMouseWidget(tr("Specify second entity"),
+ DIALOGFACTORY->updateMouseWidget(tr("Specify second entity"),
tr("Back"));
break;
case SetRadius:
- RS_DIALOGFACTORY->updateMouseWidget(tr("Enter radius:"),
+ DIALOGFACTORY->updateMouseWidget(tr("Enter radius:"),
tr("Cancel"));
break;
/*case SetTrim:
- RS_DIALOGFACTORY->updateMouseWidget(tr("Trim on? (yes/no):"),
+ DIALOGFACTORY->updateMouseWidget(tr("Trim on? (yes/no):"),
"");
break;*/
default:
- RS_DIALOGFACTORY->updateMouseWidget("", "");
+ DIALOGFACTORY->updateMouseWidget("", "");
break;
}
}
void ActionModifyRound::updateToolBar()
{
- if (RS_DIALOGFACTORY != NULL)
- RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarModify);
+ if (DIALOGFACTORY != NULL)
+ DIALOGFACTORY->requestToolBar(RS2::ToolBarModify);
}
void ActionModifyRound::setRadius(double r)
#include "actioninterface.h"
#include "vector.h"
-class RS_Entity;
+class Entity;
/**
* This action class can handle user events to round corners.
};
public:
- ActionModifyRound(RS_EntityContainer & container, GraphicView & graphicView);
+ ActionModifyRound(EntityContainer & container, GraphicView & graphicView);
~ActionModifyRound();
virtual RS2::ActionType rtti();
virtual void trigger();
virtual void mouseMoveEvent(QMouseEvent * e);
virtual void mouseReleaseEvent(QMouseEvent * e);
- virtual void commandEvent(RS_CommandEvent * e);
+ virtual void commandEvent(CommandEvent * e);
virtual QStringList getAvailableCommands();
virtual void hideOptions();
virtual void showOptions();
private:
Vector coord1;
- RS_Entity * entity1;
+ Entity * entity1;
Vector coord2;
- RS_Entity * entity2;
- RS_RoundData data;
+ Entity * entity2;
+ RoundData data;
/** Last status before entering angle. */
Status lastStatus;
};
#include "debug.h"
#include "dialogfactory.h"
-ActionModifyScale::ActionModifyScale(RS_EntityContainer & container, GraphicView & graphicView):
+ActionModifyScale::ActionModifyScale(EntityContainer & container, GraphicView & graphicView):
ActionInterface("Scale Entities", container, graphicView)
{
}
void ActionModifyScale::trigger()
{
- RS_DEBUG->print("ActionModifyScale::trigger()");
+ DEBUG->print("ActionModifyScale::trigger()");
- RS_Modification m(*container, graphicView);
+ Modification m(*container, graphicView);
m.scale(data);
- RS_DIALOGFACTORY->updateSelectionWidget(container->countSelected());
+ DIALOGFACTORY->updateSelectionWidget(container->countSelected());
}
void ActionModifyScale::mouseMoveEvent(QMouseEvent * e)
{
- RS_DEBUG->print("ActionModifyScale::mouseMoveEvent begin");
+ DEBUG->print("ActionModifyScale::mouseMoveEvent begin");
if (getStatus() == SetReferencePoint)
{
}
}
- RS_DEBUG->print("ActionModifyScale::mouseMoveEvent end");
+ DEBUG->print("ActionModifyScale::mouseMoveEvent end");
}
void ActionModifyScale::mouseReleaseEvent(QMouseEvent * e)
case SetReferencePoint:
setStatus(ShowDialog);
- if (RS_DIALOGFACTORY->requestScaleDialog(data))
+ if (DIALOGFACTORY->requestScaleDialog(data))
{
data.referencePoint = referencePoint;
trigger();
switch (getStatus())
{
case SetReferencePoint:
- RS_DIALOGFACTORY->updateMouseWidget(tr("Specify reference point"), tr("Cancel"));
+ DIALOGFACTORY->updateMouseWidget(tr("Specify reference point"), tr("Cancel"));
break;
default:
- RS_DIALOGFACTORY->updateMouseWidget("", "");
+ DIALOGFACTORY->updateMouseWidget("", "");
break;
}
}
switch (getStatus())
{
case SetReferencePoint:
- RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarSnap);
+ DIALOGFACTORY->requestToolBar(RS2::ToolBarSnap);
break;
default:
- RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarModify);
+ DIALOGFACTORY->requestToolBar(RS2::ToolBarModify);
break;
}
}
};
public:
- ActionModifyScale(RS_EntityContainer & container, GraphicView & graphicView);
+ ActionModifyScale(EntityContainer & container, GraphicView & graphicView);
~ActionModifyScale();
virtual void init(int status = 0);
virtual void updateToolBar();
private:
- RS_ScaleData data;
+ ScaleData data;
Vector referencePoint;
Vector targetPoint;
};
#include "modification.h"
#include "preview.h"
-ActionModifyStretch::ActionModifyStretch(RS_EntityContainer & container,
+ActionModifyStretch::ActionModifyStretch(EntityContainer & container,
GraphicView & graphicView): ActionInterface("Stretch Entities",
container, graphicView)
{
void ActionModifyStretch::trigger()
{
- RS_DEBUG->print("ActionModifyStretch::trigger()");
+ DEBUG->print("ActionModifyStretch::trigger()");
deletePreview();
clearPreview();
deleteSnapper();
- RS_Modification m(*container, graphicView);
+ Modification m(*container, graphicView);
m.stretch(firstCorner, secondCorner, targetPoint - referencePoint);
drawSnapper();
setStatus(SetFirstCorner);
- RS_DIALOGFACTORY->updateSelectionWidget(container->countSelected());
+ DIALOGFACTORY->updateSelectionWidget(container->countSelected());
}
void ActionModifyStretch::mouseMoveEvent(QMouseEvent * e)
{
- RS_DEBUG->print("ActionModifyStretch::mouseMoveEvent begin");
+ DEBUG->print("ActionModifyStretch::mouseMoveEvent begin");
Vector mouse = snapPoint(e);
deletePreview();
clearPreview();
/* preview->addEntity(
- new RS_Line(preview, RS_LineData(Vector(firstCorner.x, firstCorner.y),
+ new Line(preview, LineData(Vector(firstCorner.x, firstCorner.y),
Vector(secondCorner.x, firstCorner.y))));
preview->addEntity(
- new RS_Line(preview, RS_LineData(Vector(secondCorner.x, firstCorner.y),
+ new Line(preview, LineData(Vector(secondCorner.x, firstCorner.y),
Vector(secondCorner.x, secondCorner.y))));
preview->addEntity(
- new RS_Line(preview, RS_LineData(Vector(secondCorner.x, secondCorner.y),
+ new Line(preview, LineData(Vector(secondCorner.x, secondCorner.y),
Vector(firstCorner.x, secondCorner.y))));
preview->addEntity(
- new RS_Line(preview, RS_LineData(Vector(firstCorner.x, secondCorner.y),
+ new Line(preview, LineData(Vector(firstCorner.x, secondCorner.y),
Vector(firstCorner.x, firstCorner.y))));*/
drawPreview();
}
break;
}
- RS_DEBUG->print("ActionModifyStretch::mouseMoveEvent end");
+ DEBUG->print("ActionModifyStretch::mouseMoveEvent end");
}
void ActionModifyStretch::mouseReleaseEvent(QMouseEvent * e)
switch (getStatus())
{
case SetFirstCorner:
- RS_DIALOGFACTORY->updateMouseWidget(tr("Specify first corner"),
+ DIALOGFACTORY->updateMouseWidget(tr("Specify first corner"),
tr("Cancel"));
break;
case SetSecondCorner:
- RS_DIALOGFACTORY->updateMouseWidget(tr("Specify second corner"),
+ DIALOGFACTORY->updateMouseWidget(tr("Specify second corner"),
tr("Back"));
break;
case SetReferencePoint:
- RS_DIALOGFACTORY->updateMouseWidget(tr("Specify reference point"),
+ DIALOGFACTORY->updateMouseWidget(tr("Specify reference point"),
tr("Back"));
break;
case SetTargetPoint:
- RS_DIALOGFACTORY->updateMouseWidget(tr("Specify target point"),
+ DIALOGFACTORY->updateMouseWidget(tr("Specify target point"),
tr("Back"));
break;
default:
- RS_DIALOGFACTORY->updateMouseWidget("", "");
+ DIALOGFACTORY->updateMouseWidget("", "");
break;
}
}
void ActionModifyStretch::updateToolBar()
{
if (!isFinished())
- RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarSnap);
+ DIALOGFACTORY->requestToolBar(RS2::ToolBarSnap);
else
- RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarModify);
+ DIALOGFACTORY->requestToolBar(RS2::ToolBarModify);
}
};
public:
- ActionModifyStretch(RS_EntityContainer & container, GraphicView & graphicView);
+ ActionModifyStretch(EntityContainer & container, GraphicView & graphicView);
~ActionModifyStretch();
virtual void init(int status = 0);
/**
* @param both Trim both entities.
*/
-ActionModifyTrim::ActionModifyTrim(RS_EntityContainer & container,
+ActionModifyTrim::ActionModifyTrim(EntityContainer & container,
GraphicView & graphicView, bool both): ActionInterface("Trim Entity",
container, graphicView)
{
void ActionModifyTrim::trigger()
{
- RS_DEBUG->print("ActionModifyTrim::trigger()");
+ DEBUG->print("ActionModifyTrim::trigger()");
if (trimEntity && trimEntity->isAtomic() && limitEntity)
{
- RS_Modification m(*container, graphicView);
- m.trim(trimCoord, (RS_AtomicEntity *)trimEntity,
+ Modification m(*container, graphicView);
+ m.trim(trimCoord, (AtomicEntity *)trimEntity,
limitCoord, limitEntity, both);
trimEntity = NULL;
else
setStatus(ChooseTrimEntity);
- RS_DIALOGFACTORY->updateSelectionWidget(container->countSelected());
+ DIALOGFACTORY->updateSelectionWidget(container->countSelected());
}
}
void ActionModifyTrim::mouseMoveEvent(QMouseEvent * e)
{
- RS_DEBUG->print("ActionModifyTrim::mouseMoveEvent begin");
+ DEBUG->print("ActionModifyTrim::mouseMoveEvent begin");
Vector mouse = graphicView->toGraph(e->x(), e->y());
- RS_Entity * se = catchEntity(e);
+ Entity * se = catchEntity(e);
switch (getStatus())
{
break;
}
- RS_DEBUG->print("ActionModifyTrim::mouseMoveEvent end");
+ DEBUG->print("ActionModifyTrim::mouseMoveEvent end");
}
void ActionModifyTrim::mouseReleaseEvent(QMouseEvent * e)
if (e->button() == Qt::LeftButton)
{
Vector mouse = graphicView->toGraph(e->x(), e->y());
- RS_Entity * se = catchEntity(e);
+ Entity * se = catchEntity(e);
switch (getStatus())
{
case ChooseLimitEntity:
if (both)
- RS_DIALOGFACTORY->updateMouseWidget(tr("Select first trim entity"),
+ DIALOGFACTORY->updateMouseWidget(tr("Select first trim entity"),
tr("Cancel"));
else
- RS_DIALOGFACTORY->updateMouseWidget(tr("Select limiting entity"),
+ DIALOGFACTORY->updateMouseWidget(tr("Select limiting entity"),
tr("Back"));
break;
case ChooseTrimEntity:
if (both)
- RS_DIALOGFACTORY->updateMouseWidget(tr("Select second trim entity"),
+ DIALOGFACTORY->updateMouseWidget(tr("Select second trim entity"),
tr("Cancel"));
else
- RS_DIALOGFACTORY->updateMouseWidget(tr("Select entity to trim"),
+ DIALOGFACTORY->updateMouseWidget(tr("Select entity to trim"),
tr("Back"));
break;
default:
- RS_DIALOGFACTORY->updateMouseWidget("", "");
+ DIALOGFACTORY->updateMouseWidget("", "");
break;
}
}
void ActionModifyTrim::updateToolBar()
{
- RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarModify);
+ DIALOGFACTORY->requestToolBar(RS2::ToolBarModify);
}
#include "actioninterface.h"
#include "vector.h"
-class RS_Entity;
+class Entity;
/**
* This action class can handle user events to trim entities.
};
public:
- ActionModifyTrim(RS_EntityContainer & container, GraphicView & graphicView, bool both = false);
+ ActionModifyTrim(EntityContainer & container, GraphicView & graphicView, bool both = false);
~ActionModifyTrim();
virtual void init(int status = 0);
virtual void updateToolBar();
private:
- RS_Entity * limitEntity;
+ Entity * limitEntity;
Vector limitCoord;
- RS_Entity * trimEntity;
+ Entity * trimEntity;
Vector trimCoord;
bool both;
};
#include "modification.h"
ActionModifyTrimAmount::ActionModifyTrimAmount(
- RS_EntityContainer & container, GraphicView & graphicView):
+ EntityContainer & container, GraphicView & graphicView):
ActionInterface("Trim Entity by a given amount",
container, graphicView)
{
void ActionModifyTrimAmount::trigger()
{
- RS_DEBUG->print("ActionModifyTrimAmount::trigger()");
+ DEBUG->print("ActionModifyTrimAmount::trigger()");
if (trimEntity != NULL && trimEntity->isAtomic())
{
- RS_Modification m(*container, graphicView);
- m.trimAmount(trimCoord, (RS_AtomicEntity *)trimEntity, distance);
+ Modification m(*container, graphicView);
+ m.trimAmount(trimCoord, (AtomicEntity *)trimEntity, distance);
trimEntity = NULL;
setStatus(ChooseTrimEntity);
- RS_DIALOGFACTORY->updateSelectionWidget(container->countSelected());
+ DIALOGFACTORY->updateSelectionWidget(container->countSelected());
}
}
else
{
if (trimEntity == NULL)
- RS_DIALOGFACTORY->commandMessage(
+ DIALOGFACTORY->commandMessage(
tr("No entity found. "));
else if (trimEntity->rtti() == RS2::EntityInsert)
- RS_DIALOGFACTORY->commandMessage(
+ DIALOGFACTORY->commandMessage(
tr("The chosen Entity is in a block. "
"Please edit the block."));
else
- RS_DIALOGFACTORY->commandMessage(
+ DIALOGFACTORY->commandMessage(
tr("The chosen Entity is not an atomic entity "
"or cannot be trimmed."));
}
}
}
-void ActionModifyTrimAmount::commandEvent(RS_CommandEvent * e)
+void ActionModifyTrimAmount::commandEvent(CommandEvent * e)
{
QString c = e->getCommand().toLower();
if (checkCommand("help", c))
{
- RS_DIALOGFACTORY->commandMessage(msgAvailableCommands()
+ DIALOGFACTORY->commandMessage(msgAvailableCommands()
+ getAvailableCommands().join(", "));
return;
}
{
case ChooseTrimEntity: {
bool ok;
- double d = RS_Math::eval(c, &ok);
+ double d = Math::eval(c, &ok);
if (ok == true)
distance = d;
else
- RS_DIALOGFACTORY->commandMessage(tr("Not a valid expression"));
- RS_DIALOGFACTORY->requestOptions(this, true, true);
+ DIALOGFACTORY->commandMessage(tr("Not a valid expression"));
+ DIALOGFACTORY->requestOptions(this, true, true);
setStatus(ChooseTrimEntity);
}
break;
{
ActionInterface::showOptions();
- RS_DIALOGFACTORY->requestOptions(this, true);
+ DIALOGFACTORY->requestOptions(this, true);
}
void ActionModifyTrimAmount::hideOptions()
{
ActionInterface::hideOptions();
- RS_DIALOGFACTORY->requestOptions(this, false);
+ DIALOGFACTORY->requestOptions(this, false);
}
void ActionModifyTrimAmount::updateMouseButtonHints()
switch (getStatus())
{
case ChooseTrimEntity:
- RS_DIALOGFACTORY->updateMouseWidget(
+ DIALOGFACTORY->updateMouseWidget(
tr("Select entity to trim or enter distance:"), tr("Back"));
break;
default:
- RS_DIALOGFACTORY->updateMouseWidget("", "");
+ DIALOGFACTORY->updateMouseWidget("", "");
break;
}
}
void ActionModifyTrimAmount::updateToolBar()
{
- RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarModify);
+ DIALOGFACTORY->requestToolBar(RS2::ToolBarModify);
}
double ActionModifyTrimAmount::getDistance()
#include "actioninterface.h"
#include "vector.h"
-class RS_Entity;
+class Entity;
/**
* This action class can handle user events to trim entities by a given
};
public:
- ActionModifyTrimAmount(RS_EntityContainer & container, GraphicView & graphicView);
+ ActionModifyTrimAmount(EntityContainer & container, GraphicView & graphicView);
~ActionModifyTrimAmount();
virtual RS2::ActionType rtti();
virtual void trigger();
//virtual void mouseMoveEvent(QMouseEvent* e);
virtual void mouseReleaseEvent(QMouseEvent * e);
- virtual void commandEvent(RS_CommandEvent * e);
+ virtual void commandEvent(CommandEvent * e);
virtual QStringList getAvailableCommands();
virtual void hideOptions();
virtual void showOptions();
void setDistance(double d);
private:
- RS_Entity * trimEntity;
+ Entity * trimEntity;
Vector trimCoord;
double distance;
};
#include "dialogfactory.h"
#include "graphicview.h"
-ActionOptionsDrawing::ActionOptionsDrawing(RS_EntityContainer & container, GraphicView & graphicView):
+ActionOptionsDrawing::ActionOptionsDrawing(EntityContainer & container, GraphicView & graphicView):
ActionInterface("Drawing Options", container, graphicView)
{
}
{
if (graphic)
{
- RS_DIALOGFACTORY->requestOptionsDrawingDialog(*graphic);
- RS_DIALOGFACTORY->updateCoordinateWidget(Vector(0.0, 0.0), Vector(0.0, 0.0), true);
+ DIALOGFACTORY->requestOptionsDrawingDialog(*graphic);
+ DIALOGFACTORY->updateCoordinateWidget(Vector(0.0, 0.0), Vector(0.0, 0.0), true);
graphicView->updateGrid();
graphicView->redraw();
}
class ActionOptionsDrawing: public ActionInterface
{
public:
- ActionOptionsDrawing(RS_EntityContainer & container, GraphicView & graphicView);
+ ActionOptionsDrawing(EntityContainer & container, GraphicView & graphicView);
~ActionOptionsDrawing();
virtual RS2::ActionType rtti();
/**
* Constructor.
*/
-ActionPrintPreview::ActionPrintPreview(RS_EntityContainer & container, GraphicView & graphicView):
+ActionPrintPreview::ActionPrintPreview(EntityContainer & container, GraphicView & graphicView):
ActionInterface("Print Preview", container, graphicView)
{
showOptions();
break;
default:
- RS_DIALOGFACTORY->requestPreviousMenu();
+ DIALOGFACTORY->requestPreviousMenu();
e->accept();
break;
}
{
}
-void ActionPrintPreview::commandEvent(RS_CommandEvent *)
+void ActionPrintPreview::commandEvent(CommandEvent *)
{
}
{
ActionInterface::showOptions();
- RS_DIALOGFACTORY->requestOptions(this, true);
+ DIALOGFACTORY->requestOptions(this, true);
}
void ActionPrintPreview::hideOptions()
{
ActionInterface::hideOptions();
- RS_DIALOGFACTORY->requestOptions(this, false);
+ DIALOGFACTORY->requestOptions(this, false);
}
void ActionPrintPreview::updateMouseButtonHints()
#ifndef __ACTIONPRINTPREVIEW_H__
#define __ACTIONPRINTPREVIEW_H__
-#include "rs.h"
+#include "enums.h"
#include "actioninterface.h"
#include "vector.h"
};
public:
- ActionPrintPreview(RS_EntityContainer & container, GraphicView & graphicView);
+ ActionPrintPreview(EntityContainer & container, GraphicView & graphicView);
~ActionPrintPreview();
virtual RS2::ActionType rtti();
virtual void mousePressEvent(QMouseEvent * e);
virtual void mouseReleaseEvent(QMouseEvent * e);
virtual void coordinateEvent(Vector * e);
- virtual void commandEvent(RS_CommandEvent * e);
+ virtual void commandEvent(CommandEvent * e);
virtual QStringList getAvailableCommands();
virtual void showOptions();
virtual void hideOptions();
#include "dialogfactory.h"
#include "graphicview.h"
-ActionSelect::ActionSelect(RS_EntityContainer & container, GraphicView & graphicView,
+ActionSelect::ActionSelect(EntityContainer & container, GraphicView & graphicView,
RS2::ActionType nextAction):
ActionInterface("Select Entities", container, graphicView)
{
void ActionSelect::updateToolBar()
{
- if (RS_DIALOGFACTORY)
+ if (DIALOGFACTORY)
{
if (!isFinished())
- RS_DIALOGFACTORY->requestToolBarSelect(this, nextAction);
+ DIALOGFACTORY->requestToolBarSelect(this, nextAction);
else
- RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarMain);
+ DIALOGFACTORY->requestToolBar(RS2::ToolBarMain);
}
}
class ActionSelect: public ActionInterface
{
public:
- ActionSelect(RS_EntityContainer & container, GraphicView & graphicView, RS2::ActionType nextAction);
+ ActionSelect(EntityContainer & container, GraphicView & graphicView, RS2::ActionType nextAction);
~ActionSelect();
void init(int status);
#include "dialogfactory.h"
#include "selection.h"
-ActionSelectAll::ActionSelectAll(RS_EntityContainer & container,
+ActionSelectAll::ActionSelectAll(EntityContainer & container,
GraphicView & graphicView, bool select):
ActionInterface("Select All Entities", container, graphicView)
{
void ActionSelectAll::trigger()
{
- RS_Selection s(*container, graphicView);
+ Selection s(*container, graphicView);
s.selectAll(select);
- RS_DIALOGFACTORY->updateSelectionWidget(container->countSelected());
+ DIALOGFACTORY->updateSelectionWidget(container->countSelected());
}
class ActionSelectAll: public ActionInterface
{
public:
- ActionSelectAll(RS_EntityContainer & container, GraphicView & graphicView, bool select);
+ ActionSelectAll(EntityContainer & container, GraphicView & graphicView, bool select);
~ActionSelectAll();
virtual RS2::ActionType rtti();
#include "graphicview.h"
ActionSelectBase::ActionSelectBase(const char * name,
- RS_EntityContainer & container, GraphicView & graphicView):
+ EntityContainer & container, GraphicView & graphicView):
ActionInterface(name, container, graphicView)
{
}
class ActionSelectBase: public ActionInterface
{
public:
- ActionSelectBase(const char * name, RS_EntityContainer & container, GraphicView & graphicView);
+ ActionSelectBase(const char * name, EntityContainer & container, GraphicView & graphicView);
~ActionSelectBase();
virtual void keyReleaseEvent(QKeyEvent * e);
#include "graphicview.h"
#include "selection.h"
-ActionSelectContour::ActionSelectContour(RS_EntityContainer & container,
+ActionSelectContour::ActionSelectContour(EntityContainer & container,
GraphicView & graphicView):
ActionInterface("Select Contours", container, graphicView)
{
{
if (en->isAtomic())
{
- RS_Selection s(*container, graphicView);
+ Selection s(*container, graphicView);
s.selectContour(en);
- if (RS_DIALOGFACTORY)
- RS_DIALOGFACTORY->updateSelectionWidget(container->countSelected());
+ if (DIALOGFACTORY)
+ DIALOGFACTORY->updateSelectionWidget(container->countSelected());
}
- else if (RS_DIALOGFACTORY)
- RS_DIALOGFACTORY->commandMessage(tr("Entity must be an Atomic Entity."));
+ else if (DIALOGFACTORY)
+ DIALOGFACTORY->commandMessage(tr("Entity must be an Atomic Entity."));
}
else
- RS_DEBUG->print("ActionSelectContour::trigger: Entity is NULL\n");
+ DEBUG->print("ActionSelectContour::trigger: Entity is NULL\n");
}
void ActionSelectContour::mouseReleaseEvent(QMouseEvent * e)
#include "actioninterface.h"
-class RS_Entity;
+class Entity;
/**
* This action class can handle user events to select contours.
class ActionSelectContour: public ActionInterface
{
public:
- ActionSelectContour(RS_EntityContainer & container, GraphicView & graphicView);
+ ActionSelectContour(EntityContainer & container, GraphicView & graphicView);
~ActionSelectContour();
virtual RS2::ActionType rtti();
virtual void updateMouseCursor();
private:
- RS_Entity * en;
+ Entity * en;
};
#endif // __ACTIONSELECTCONTOURS_H__
* @param select true: select window. false: deselect window
*/
ActionSelectIntersected::ActionSelectIntersected(
- RS_EntityContainer & container, GraphicView & graphicView, bool select):
+ EntityContainer & container, GraphicView & graphicView, bool select):
ActionInterface("Select Intersected", container, graphicView)
{
this->select = select;
if (graphicView->toGuiDX(v1.distanceTo(v2)) > 10)
{
deleteSnapper();
- RS_Selection s(*container, graphicView);
+ Selection s(*container, graphicView);
s.selectIntersected(v1, v2, select);
- if (RS_DIALOGFACTORY)
- RS_DIALOGFACTORY->updateSelectionWidget(container->countSelected());
+ if (DIALOGFACTORY)
+ DIALOGFACTORY->updateSelectionWidget(container->countSelected());
init();
}
v2 = snapPoint(e);
deletePreview();
clearPreview();
-// preview->addEntity(new RS_Line(preview, RS_LineData(Vector(v1.x, v1.y), Vector(v2.x, v2.y))));
+// preview->addEntity(new Line(preview, LineData(Vector(v1.x, v1.y), Vector(v2.x, v2.y))));
drawPreview();
}
}
}
}
- RS_DEBUG->print("ActionSelectIntersected::mousePressEvent(): %f %f",
+ DEBUG->print("ActionSelectIntersected::mousePressEvent(): %f %f",
v1.x, v1.y);
}
void ActionSelectIntersected::mouseReleaseEvent(QMouseEvent * e)
{
- RS_DEBUG->print("ActionSelectIntersected::mouseReleaseEvent()");
+ DEBUG->print("ActionSelectIntersected::mouseReleaseEvent()");
if (e->button() == Qt::RightButton)
{
void ActionSelectIntersected::updateMouseButtonHints()
{
- if (RS_DIALOGFACTORY != NULL)
+ if (DIALOGFACTORY != NULL)
{
switch (getStatus())
{
case SetPoint1:
- RS_DIALOGFACTORY->updateMouseWidget(tr("Choose first point of intersection line"), tr("Cancel"));
+ DIALOGFACTORY->updateMouseWidget(tr("Choose first point of intersection line"), tr("Cancel"));
break;
case SetPoint2:
- RS_DIALOGFACTORY->updateMouseWidget(tr("Choose second point of intersection line"), tr("Back"));
+ DIALOGFACTORY->updateMouseWidget(tr("Choose second point of intersection line"), tr("Back"));
break;
default:
- RS_DIALOGFACTORY->updateMouseWidget("", "");
+ DIALOGFACTORY->updateMouseWidget("", "");
break;
}
}
void ActionSelectIntersected::updateToolBar()
{
- if (RS_DIALOGFACTORY != NULL)
+ if (DIALOGFACTORY != NULL)
{
if (!isFinished())
- RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarSelect);
+ DIALOGFACTORY->requestToolBar(RS2::ToolBarSelect);
else
- RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarSelect);
+ DIALOGFACTORY->requestToolBar(RS2::ToolBarSelect);
}
}
};
public:
- ActionSelectIntersected(RS_EntityContainer & container, GraphicView & graphicView, bool select);
+ ActionSelectIntersected(EntityContainer & container, GraphicView & graphicView, bool select);
~ActionSelectIntersected();
virtual RS2::ActionType rtti();
#include "dialogfactory.h"
#include "selection.h"
-ActionSelectInvert::ActionSelectInvert(RS_EntityContainer & container,
+ActionSelectInvert::ActionSelectInvert(EntityContainer & container,
GraphicView & graphicView): ActionInterface("Invert Selection",
container, graphicView)
{
void ActionSelectInvert::trigger()
{
- RS_Selection s(*container, graphicView);
+ Selection s(*container, graphicView);
s.invertSelection();
- RS_DIALOGFACTORY->updateSelectionWidget(container->countSelected());
+ DIALOGFACTORY->updateSelectionWidget(container->countSelected());
}
class ActionSelectInvert: public ActionInterface
{
public:
- ActionSelectInvert(RS_EntityContainer & container, GraphicView & graphicView);
+ ActionSelectInvert(EntityContainer & container, GraphicView & graphicView);
~ActionSelectInvert();
virtual RS2::ActionType rtti();
#include "graphicview.h"
#include "selection.h"
-ActionSelectLayer::ActionSelectLayer(RS_EntityContainer & container, GraphicView & graphicView):
+ActionSelectLayer::ActionSelectLayer(EntityContainer & container, GraphicView & graphicView):
ActionInterface("Select Layers", container, graphicView)
{
en = NULL;
{
if (en)
{
- RS_Selection s(*container, graphicView);
+ Selection s(*container, graphicView);
s.selectLayer(en);
- if (RS_DIALOGFACTORY)
- RS_DIALOGFACTORY->updateSelectionWidget(container->countSelected());
+ if (DIALOGFACTORY)
+ DIALOGFACTORY->updateSelectionWidget(container->countSelected());
}
else
- RS_DEBUG->print("ActionSelectLayer::trigger: Entity is NULL\n");
+ DEBUG->print("ActionSelectLayer::trigger: Entity is NULL\n");
}
void ActionSelectLayer::mouseReleaseEvent(QMouseEvent * e)
#include "actioninterface.h"
-class RS_Entity;
+class Entity;
/**
* This action class can handle user events to select contours.
class ActionSelectLayer: public ActionInterface
{
public:
- ActionSelectLayer(RS_EntityContainer & container, GraphicView & graphicView);
+ ActionSelectLayer(EntityContainer & container, GraphicView & graphicView);
~ActionSelectLayer();
virtual RS2::ActionType rtti();
virtual void updateMouseCursor();
private:
- RS_Entity * en;
+ Entity * en;
};
#endif // __ACTIONSELECTLAYER_H__
#include "graphicview.h"
#include "selection.h"
-ActionSelectSingle::ActionSelectSingle(RS_EntityContainer & container, GraphicView & graphicView):
+ActionSelectSingle::ActionSelectSingle(EntityContainer & container, GraphicView & graphicView):
ActionInterface("Select Entities", container, graphicView)
{
en = NULL;
{
if (en != NULL)
{
- RS_Selection s(*container, graphicView);
+ Selection s(*container, graphicView);
s.selectSingle(en);
- RS_DIALOGFACTORY->updateSelectionWidget(container->countSelected());
+ DIALOGFACTORY->updateSelectionWidget(container->countSelected());
}
else
- RS_DEBUG->print("ActionSelectSingle::trigger: Entity is NULL\n");
+ DEBUG->print("ActionSelectSingle::trigger: Entity is NULL\n");
}
void ActionSelectSingle::keyPressEvent(QKeyEvent * e)
#include "actioninterface.h"
-class RS_Entity;
+class Entity;
/**
* This action class can handle user events to select entities.
class ActionSelectSingle: public ActionInterface
{
public:
- ActionSelectSingle(RS_EntityContainer & container, GraphicView & graphicView);
+ ActionSelectSingle(EntityContainer & container, GraphicView & graphicView);
~ActionSelectSingle();
virtual RS2::ActionType rtti();
virtual void updateMouseCursor();
private:
- RS_Entity * en;
+ Entity * en;
};
#endif // __ACTIONSELECTSINGLE_H__
*
* @param select true: select window. false: deselect window
*/
-ActionSelectWindow::ActionSelectWindow(RS_EntityContainer & container,
+ActionSelectWindow::ActionSelectWindow(EntityContainer & container,
GraphicView & graphicView, bool select):
ActionInterface("Select Window", container, graphicView)
{
{
deleteSnapper();
bool cross = (v2.y > v1.y);
- RS_Selection s(*container, graphicView);
+ Selection s(*container, graphicView);
s.selectWindow(v1, v2, select, cross);
- RS_DIALOGFACTORY->updateSelectionWidget(container->countSelected());
+ DIALOGFACTORY->updateSelectionWidget(container->countSelected());
init();
}
}
v2 = snapPoint(e);
deletePreview();
clearPreview();
-/* preview->addEntity(new RS_Line(preview,
- RS_LineData(Vector(v1.x, v1.y), Vector(v2.x, v1.y))));
- preview->addEntity(new RS_Line(preview,
- RS_LineData(Vector(v2.x, v1.y), Vector(v2.x, v2.y))));
- preview->addEntity(new RS_Line(preview,
- RS_LineData(Vector(v2.x, v2.y), Vector(v1.x, v2.y))));
- preview->addEntity(new RS_Line(preview,
- RS_LineData(Vector(v1.x, v2.y), Vector(v1.x, v1.y))));*/
+/* preview->addEntity(new Line(preview,
+ LineData(Vector(v1.x, v1.y), Vector(v2.x, v1.y))));
+ preview->addEntity(new Line(preview,
+ LineData(Vector(v2.x, v1.y), Vector(v2.x, v2.y))));
+ preview->addEntity(new Line(preview,
+ LineData(Vector(v2.x, v2.y), Vector(v1.x, v2.y))));
+ preview->addEntity(new Line(preview,
+ LineData(Vector(v1.x, v2.y), Vector(v1.x, v1.y))));*/
drawPreview();
}
}
}
}
- RS_DEBUG->print("ActionSelectWindow::mousePressEvent(): %f %f",
+ DEBUG->print("ActionSelectWindow::mousePressEvent(): %f %f",
v1.x, v1.y);
}
void ActionSelectWindow::mouseReleaseEvent(QMouseEvent * e)
{
- RS_DEBUG->print("ActionSelectWindow::mouseReleaseEvent()");
+ DEBUG->print("ActionSelectWindow::mouseReleaseEvent()");
if (e->button() == Qt::LeftButton)
{
switch (getStatus())
{
case SetCorner1:
- RS_DIALOGFACTORY->updateMouseWidget(tr("Choose first edge"), tr("Cancel"));
+ DIALOGFACTORY->updateMouseWidget(tr("Choose first edge"), tr("Cancel"));
break;
case SetCorner2:
- RS_DIALOGFACTORY->updateMouseWidget(tr("Choose second edge"), tr("Back"));
+ DIALOGFACTORY->updateMouseWidget(tr("Choose second edge"), tr("Back"));
break;
default:
- RS_DIALOGFACTORY->updateMouseWidget("", "");
+ DIALOGFACTORY->updateMouseWidget("", "");
break;
}
}
void ActionSelectWindow::updateToolBar()
{
if (!isFinished())
- RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarSelect);
+ DIALOGFACTORY->requestToolBar(RS2::ToolBarSelect);
else
- RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarSelect);
+ DIALOGFACTORY->requestToolBar(RS2::ToolBarSelect);
}
};
public:
- ActionSelectWindow(RS_EntityContainer & container, GraphicView & graphicView, bool select);
+ ActionSelectWindow(EntityContainer & container, GraphicView & graphicView, bool select);
~ActionSelectWindow();
virtual RS2::ActionType rtti();
#include "dialogfactory.h"
#include "graphicview.h"
-ActionSetRelativeZero::ActionSetRelativeZero(RS_EntityContainer & container,
+ActionSetRelativeZero::ActionSetRelativeZero(EntityContainer & container,
GraphicView & graphicView): ActionInterface("Set the relative Zero",
container, graphicView)
{
switch (getStatus())
{
case 0:
- RS_DIALOGFACTORY->updateMouseWidget(tr("Set relative Zero"), tr("Cancel"));
+ DIALOGFACTORY->updateMouseWidget(tr("Set relative Zero"), tr("Cancel"));
break;
default:
- RS_DIALOGFACTORY->updateMouseWidget("", "");
+ DIALOGFACTORY->updateMouseWidget("", "");
break;
}
}
void ActionSetRelativeZero::updateToolBar()
{
if (!isFinished())
- RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarSnap);
+ DIALOGFACTORY->requestToolBar(RS2::ToolBarSnap);
else
- RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarSnap);
+ DIALOGFACTORY->requestToolBar(RS2::ToolBarSnap);
}
class ActionSetRelativeZero: public ActionInterface
{
public:
- ActionSetRelativeZero(RS_EntityContainer & container, GraphicView & graphicView);
+ ActionSetRelativeZero(EntityContainer & container, GraphicView & graphicView);
~ActionSetRelativeZero();
virtual RS2::ActionType rtti();
*
* @param snapMode The new snap mode used from now on.
*/
-ActionSetSnapMode::ActionSetSnapMode(RS_EntityContainer & container, GraphicView & graphicView, RS2::SnapMode snapMode):
+ActionSetSnapMode::ActionSetSnapMode(EntityContainer & container, GraphicView & graphicView, RS2::SnapMode snapMode):
ActionInterface("Set Snap Mode", container, graphicView)
{
this->snapMode = snapMode;
#ifndef __ACTIONSETSNAPMODE_H__
#define __ACTIONSETSNAPMODE_H__
-#include "rs.h"
+#include "enums.h"
#include "actioninterface.h"
/**
class ActionSetSnapMode: public ActionInterface
{
public:
- ActionSetSnapMode(RS_EntityContainer & container, GraphicView & graphicView, RS2::SnapMode snapMode);
+ ActionSetSnapMode(EntityContainer & container, GraphicView & graphicView, RS2::SnapMode snapMode);
~ActionSetSnapMode();
virtual void init(int status = 0);
* @param set true: set additional snap mode / false: unset
*/
ActionSetSnapRestriction::ActionSetSnapRestriction(
- RS_EntityContainer & container, GraphicView & graphicView, RS2::SnapRestriction snapRes):
+ EntityContainer & container, GraphicView & graphicView, RS2::SnapRestriction snapRes):
ActionInterface("Set Additional Snap Mode", container, graphicView)
{
this->snapRes = snapRes;
#ifndef __ACTIONSETSNAPRESTRICTION_H__
#define __ACTIONSETSNAPRESTRICTION_H__
-#include "rs.h"
+#include "enums.h"
#include "actioninterface.h"
/**
class ActionSetSnapRestriction: public ActionInterface
{
public:
- ActionSetSnapRestriction(RS_EntityContainer & container, GraphicView & graphicView, RS2::SnapRestriction snapRes);
+ ActionSetSnapRestriction(EntityContainer & container, GraphicView & graphicView, RS2::SnapRestriction snapRes);
~ActionSetSnapRestriction();
virtual void init(int status = 0);
* @param both Trim both entities.
*/
ActionSnapIntersectionManual::ActionSnapIntersectionManual(
- RS_EntityContainer & container, GraphicView & graphicView):
+ EntityContainer & container, GraphicView & graphicView):
ActionInterface("Trim Entity", container, graphicView)
{
entity2 = NULL;
void ActionSnapIntersectionManual::trigger()
{
- RS_DEBUG->print("ActionSnapIntersectionManual::trigger()");
+ DEBUG->print("ActionSnapIntersectionManual::trigger()");
if (entity2 != NULL && entity2->isAtomic()
&& entity1 != NULL && entity1->isAtomic())
{
- VectorSolutions sol = RS_Information::getIntersection(entity1, entity2, false);
+ VectorSolutions sol = Information::getIntersection(entity1, entity2, false);
entity2 = NULL;
entity1 = NULL;
void ActionSnapIntersectionManual::mouseMoveEvent(QMouseEvent * e)
{
- RS_DEBUG->print("ActionSnapIntersectionManual::mouseMoveEvent begin");
+ DEBUG->print("ActionSnapIntersectionManual::mouseMoveEvent begin");
- RS_Entity * se = catchEntity(e);
+ Entity * se = catchEntity(e);
Vector mouse = graphicView->toGraph(e->x(), e->y());
switch (getStatus())
entity2 = se;
coord = mouse;
- VectorSolutions sol = RS_Information::getIntersection(entity1, entity2, false);
+ VectorSolutions sol = Information::getIntersection(entity1, entity2, false);
Vector ip = sol.getClosest(coord);
if (ip.valid)
{
deletePreview();
clearPreview();
-// preview->addEntity(new RS_Circle(preview, RS_CircleData(ip, graphicView->toGraphDX(4))));
+// preview->addEntity(new Circle(preview, CircleData(ip, graphicView->toGraphDX(4))));
drawPreview();
- RS_DIALOGFACTORY->updateCoordinateWidget(ip, ip - graphicView->getRelativeZero());
+ DIALOGFACTORY->updateCoordinateWidget(ip, ip - graphicView->getRelativeZero());
}
}
break;
break;
}
- RS_DEBUG->print("ActionSnapIntersectionManual::mouseMoveEvent end");
+ DEBUG->print("ActionSnapIntersectionManual::mouseMoveEvent end");
}
void ActionSnapIntersectionManual::mouseReleaseEvent(QMouseEvent * e)
if (e->button() == Qt::LeftButton)
{
Vector mouse = graphicView->toGraph(e->x(), e->y());
- RS_Entity * se = catchEntity(e);
+ Entity * se = catchEntity(e);
switch (getStatus())
{
switch (getStatus())
{
case ChooseEntity1:
- RS_DIALOGFACTORY->updateMouseWidget(tr("Select first entity"),
+ DIALOGFACTORY->updateMouseWidget(tr("Select first entity"),
tr("Back"));
break;
case ChooseEntity2:
- RS_DIALOGFACTORY->updateMouseWidget(tr("Select second entity"),
+ DIALOGFACTORY->updateMouseWidget(tr("Select second entity"),
tr("Back"));
break;
default:
- RS_DIALOGFACTORY->updateMouseWidget("", "");
+ DIALOGFACTORY->updateMouseWidget("", "");
break;
}
}
void ActionSnapIntersectionManual::updateToolBar()
{
- RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarSnap);
+ DIALOGFACTORY->requestToolBar(RS2::ToolBarSnap);
}
#include "actioninterface.h"
#include "vector.h"
-class RS_Entity;
+class Entity;
/**
* This action class can handle user events to trim entities.
};
public:
- ActionSnapIntersectionManual(RS_EntityContainer & container, GraphicView & graphicView);
+ ActionSnapIntersectionManual(EntityContainer & container, GraphicView & graphicView);
~ActionSnapIntersectionManual();
virtual void init(int status = 0);
virtual void updateToolBar();
private:
- RS_Entity * entity1;
- RS_Entity * entity2;
+ Entity * entity1;
+ Entity * entity2;
Vector coord;
};
* @param keepAspectRatio true: keep same zoom value for x/y.
* false: adjust both x and y individually
*/
-ActionZoomAuto::ActionZoomAuto(RS_EntityContainer & container,
+ActionZoomAuto::ActionZoomAuto(EntityContainer & container,
GraphicView & graphicView, bool keepAspectRatio):
ActionInterface("Auto zoom", container, graphicView)
{
class ActionZoomAuto: public ActionInterface
{
public:
- ActionZoomAuto(RS_EntityContainer & container, GraphicView & graphicView, bool keepAspectRatio = true);
+ ActionZoomAuto(EntityContainer & container, GraphicView & graphicView, bool keepAspectRatio = true);
~ActionZoomAuto();
virtual void init(int status = 0);
#include "graphicview.h"
-ActionZoomAutoY::ActionZoomAutoY(RS_EntityContainer & container, GraphicView & graphicView):
+ActionZoomAutoY::ActionZoomAutoY(EntityContainer & container, GraphicView & graphicView):
ActionInterface("Auto zoom Y", container, graphicView)
{
}
class ActionZoomAutoY: public ActionInterface
{
public:
- ActionZoomAutoY(RS_EntityContainer & container, GraphicView & graphicView);
+ ActionZoomAutoY(EntityContainer & container, GraphicView & graphicView);
~ActionZoomAutoY();
virtual void init(int status = 0);
* @param direction In for zooming in, Out for zooming out.
* @param axis Axis that are affected by the zoom (OnlyX, OnlyY or Both)
*/
-ActionZoomIn::ActionZoomIn(RS_EntityContainer & container, GraphicView & graphicView, RS2::ZoomDirection direction, RS2::Axis axis, const Vector & center):
+ActionZoomIn::ActionZoomIn(EntityContainer & container, GraphicView & graphicView, RS2::ZoomDirection direction, RS2::Axis axis, const Vector & center):
ActionInterface("Zoom in", container, graphicView)
{
this->direction = direction;
#ifndef __ACTIONZOOMIN_H__
#define __ACTIONZOOMIN_H__
-#include "rs.h"
+#include "enums.h"
#include "actioninterface.h"
#include "vector.h"
class ActionZoomIn: public ActionInterface
{
public:
- ActionZoomIn(RS_EntityContainer & container, GraphicView & graphicView, RS2::ZoomDirection direction = RS2::In, RS2::Axis axis = RS2::Both, const Vector & center = Vector(false));
+ ActionZoomIn(EntityContainer & container, GraphicView & graphicView, RS2::ZoomDirection direction = RS2::In, RS2::Axis axis = RS2::Both, const Vector & center = Vector(false));
~ActionZoomIn();
virtual void init(int status = 0);
#include "graphicview.h"
-ActionZoomPan::ActionZoomPan(RS_EntityContainer & container, GraphicView & graphicView):
+ActionZoomPan::ActionZoomPan(EntityContainer & container, GraphicView & graphicView):
ActionInterface("Zoom Pan", container, graphicView)
{
graphicView.snapper.SetVisible(false);
class ActionZoomPan: public ActionInterface
{
public:
- ActionZoomPan(RS_EntityContainer & container, GraphicView & graphicView);
+ ActionZoomPan(EntityContainer & container, GraphicView & graphicView);
~ActionZoomPan();
virtual void init(int status = 0);
/**
* Constructor.
*/
-ActionZoomPrevious::ActionZoomPrevious(RS_EntityContainer & container, GraphicView & graphicView):
+ActionZoomPrevious::ActionZoomPrevious(EntityContainer & container, GraphicView & graphicView):
ActionInterface("Previous zoom", container, graphicView)
{
}
class ActionZoomPrevious: public ActionInterface
{
public:
- ActionZoomPrevious(RS_EntityContainer & container, GraphicView & graphicView);
+ ActionZoomPrevious(EntityContainer & container, GraphicView & graphicView);
~ActionZoomPrevious();
virtual void init(int status = 0);
* @param keepAspectRatio true: keep same zoom value for x/y.
* false: adjust both x and y individually
*/
-ActionZoomRedraw::ActionZoomRedraw(RS_EntityContainer & container, GraphicView & graphicView):
+ActionZoomRedraw::ActionZoomRedraw(EntityContainer & container, GraphicView & graphicView):
ActionInterface("Redraw", container, graphicView)
{
}
class ActionZoomRedraw: public ActionInterface
{
public:
- ActionZoomRedraw(RS_EntityContainer & container, GraphicView & graphicView);
+ ActionZoomRedraw(EntityContainer & container, GraphicView & graphicView);
~ActionZoomRedraw();
virtual void init(int status = 0);
#include "graphicview.h"
-ActionZoomScroll::ActionZoomScroll(RS2::Direction direction, RS_EntityContainer & container, GraphicView & graphicView):
+ActionZoomScroll::ActionZoomScroll(RS2::Direction direction, EntityContainer & container, GraphicView & graphicView):
ActionInterface("Zoom scroll", container, graphicView)
{
this->direction = direction;
class ActionZoomScroll: public ActionInterface
{
public:
- ActionZoomScroll(RS2::Direction direction, RS_EntityContainer & container, GraphicView & graphicView);
+ ActionZoomScroll(RS2::Direction direction, EntityContainer & container, GraphicView & graphicView);
~ActionZoomScroll();
virtual void init(int status = 0);
* in x and y will stay the same. false Exactly the chosen
* area will be fit to the viewport.
*/
-ActionZoomWindow::ActionZoomWindow(RS_EntityContainer & container,
+ActionZoomWindow::ActionZoomWindow(EntityContainer & container,
GraphicView & graphicView, bool keepAspectRatio):
ActionInterface("Zoom Window", container, graphicView)
{
void ActionZoomWindow::init(int status)
{
- RS_DEBUG->print("ActionZoomWindow::init()");
+ DEBUG->print("ActionZoomWindow::init()");
ActionInterface::init(status);
v1 = v2 = Vector(false);
/* snapMode = RS2::SnapFree;
void ActionZoomWindow::trigger()
{
- RS_DEBUG->print("ActionZoomWindow::trigger()");
+ DEBUG->print("ActionZoomWindow::trigger()");
ActionInterface::trigger();
v2 = snapPoint(e);
deletePreview();
clearPreview();
-/* preview->addEntity(new RS_Line(preview,
- RS_LineData(Vector(v1.x, v1.y), Vector(v2.x, v1.y))));
- preview->addEntity(new RS_Line(preview,
- RS_LineData(Vector(v2.x, v1.y), Vector(v2.x, v2.y))));
- preview->addEntity(new RS_Line(preview,
- RS_LineData(Vector(v2.x, v2.y), Vector(v1.x, v2.y))));
- preview->addEntity(new RS_Line(preview,
- RS_LineData(Vector(v1.x, v2.y), Vector(v1.x, v1.y))));*/
+/* preview->addEntity(new Line(preview,
+ LineData(Vector(v1.x, v1.y), Vector(v2.x, v1.y))));
+ preview->addEntity(new Line(preview,
+ LineData(Vector(v2.x, v1.y), Vector(v2.x, v2.y))));
+ preview->addEntity(new Line(preview,
+ LineData(Vector(v2.x, v2.y), Vector(v1.x, v2.y))));
+ preview->addEntity(new Line(preview,
+ LineData(Vector(v1.x, v2.y), Vector(v1.x, v1.y))));*/
drawPreview();
}
}
}
}
- RS_DEBUG->print("ActionZoomWindow::mousePressEvent(): %f %f", v1.x, v1.y);
+ DEBUG->print("ActionZoomWindow::mousePressEvent(): %f %f", v1.x, v1.y);
}
void ActionZoomWindow::mouseReleaseEvent(QMouseEvent * e)
{
- RS_DEBUG->print("ActionZoomWindow::mouseReleaseEvent()");
+ DEBUG->print("ActionZoomWindow::mouseReleaseEvent()");
if (e->button() == Qt::RightButton)
{
void ActionZoomWindow::updateMouseButtonHints()
{
- RS_DEBUG->print("ActionZoomWindow::updateMouseButtonHints()");
+ DEBUG->print("ActionZoomWindow::updateMouseButtonHints()");
switch (getStatus())
{
case 0:
- RS_DIALOGFACTORY->updateMouseWidget(tr("Specify first edge"), tr("Cancel"));
+ DIALOGFACTORY->updateMouseWidget(tr("Specify first edge"), tr("Cancel"));
break;
case 1:
- RS_DIALOGFACTORY->updateMouseWidget(tr("Specify second edge"), tr("Back"));
+ DIALOGFACTORY->updateMouseWidget(tr("Specify second edge"), tr("Back"));
break;
default:
- RS_DIALOGFACTORY->updateMouseWidget("", "");
+ DIALOGFACTORY->updateMouseWidget("", "");
break;
}
}
class ActionZoomWindow: public ActionInterface
{
public:
- ActionZoomWindow(RS_EntityContainer & container, GraphicView & graphicView, bool keepAspectRatio = true);
+ ActionZoomWindow(EntityContainer & container, GraphicView & graphicView, bool keepAspectRatio = true);
~ActionZoomWindow();
virtual void init(int status = 0);
* @param graphicView Graphic view instance this action operates on. Please
* note that an action belongs to this view.
*/
-ActionInterface::ActionInterface(const char * name, RS_EntityContainer & ec,
+ActionInterface::ActionInterface(const char * name, EntityContainer & ec,
GraphicView & gv): graphicView(&gv), container(&ec)
{
- RS_DEBUG->print("ActionInterface::ActionInterface: Setting up action: \"%s\"", name);
+ DEBUG->print("ActionInterface::ActionInterface: Setting up action: \"%s\"", name);
this->name = name;
status = 0;
graphicView->snapper.SetVisible();
graphicView->preview.SetVisible();
- RS_DEBUG->print("ActionInterface::ActionInterface: Setting up action: \"%s\": OK", name);
+ DEBUG->print("ActionInterface::ActionInterface: Setting up action: \"%s\": OK", name);
}
/**
*/
void ActionInterface::init(int status/*= 0*/)
{
-// RS_Snapper::init();
+// Snapper::init();
setStatus(status);
if (status >= 0)
* This function can be overwritten by the implementing action.
* The default implementation does nothing.
*/
-void ActionInterface::commandEvent(RS_CommandEvent *)
+void ActionInterface::commandEvent(CommandEvent *)
{
}
*/
void ActionInterface::finish()
{
- RS_DEBUG->print("ActionInterface::finish");
+ DEBUG->print("ActionInterface::finish");
status = -1;
// graphicView->setMouseCursor(RS2::ArrowCursor);
//graphicView->requestToolBar(RS2::ToolBarMain);
//jlh: deleteSnapper();
hideOptions();
finished = true;
-// RS_Snapper::finish(); // Sets RS_Snapper::finished = true
+// Snapper::finish(); // Sets Snapper::finished = true
// I think this is where we want to update the screen...
// graphicView->redraw();
- RS_DEBUG->print("ActionInterface::finish: OK");
+ DEBUG->print("ActionInterface::finish: OK");
}
/**
// Maybe this is where we need to save the state of the snapper
// & preview objects???
// graphicView->setMouseCursor(RS2::ArrowCursor);
-// RS_Snapper::suspend();
+// Snapper::suspend();
}
/**
{
updateMouseCursor();
updateToolBar();
-// RS_Snapper::resume();
+// Snapper::resume();
}
/**
*/
void ActionInterface::hideOptions()
{
-// RS_Snapper::hideOptions();
+// Snapper::hideOptions();
}
/**
*/
void ActionInterface::showOptions()
{
-// RS_Snapper::showOptions();
+// Snapper::showOptions();
}
/**
- * Calls checkCommand() from the RS_COMMANDS module.
+ * Calls checkCommand() from the COMMANDS module.
*/
bool ActionInterface::checkCommand(const QString & cmd, const QString & str,
RS2::ActionType action)
{
- return RS_COMMANDS->checkCommand(cmd, str, action);
+ return COMMANDS->checkCommand(cmd, str, action);
}
/**
- * Calls command() from the RS_COMMANDS module.
+ * Calls command() from the COMMANDS module.
*/
QString ActionInterface::command(const QString & cmd)
{
- return RS_COMMANDS->command(cmd);
+ return COMMANDS->command(cmd);
}
/**
- * Calls msgAvailableCommands() from the RS_COMMANDS module.
+ * Calls msgAvailableCommands() from the COMMANDS module.
*/
QString ActionInterface::msgAvailableCommands()
{
- return RS_COMMANDS->msgAvailableCommands();
+ return COMMANDS->msgAvailableCommands();
}
// This is here to save some typing in all the action* classes derived from
return graphicView->snapper.snapPoint(e);
}
-RS_Entity * ActionInterface::catchEntity(QMouseEvent * e, RS2::ResolveLevel level/*= RS2::ResolveNone*/)
+Entity * ActionInterface::catchEntity(QMouseEvent * e, RS2::ResolveLevel level/*= RS2::ResolveNone*/)
{
return graphicView->snapper.catchEntity(e, level);
}
-RS_Entity * ActionInterface::catchEntity(Vector v, RS2::ResolveLevel level/*= RS2::ResolveNone*/)
+Entity * ActionInterface::catchEntity(Vector v, RS2::ResolveLevel level/*= RS2::ResolveNone*/)
{
return graphicView->snapper.catchEntity(v, level);
}
#define __ACTIONINTERFACE_H__
#include <QtGui>
-#include "rs.h"
+#include "enums.h"
-class RS_CommandEvent;
-class RS_Document;
+class CommandEvent;
+class Document;
class Drawing;
-class RS_Entity;
-class RS_EntityContainer;
+class Entity;
+class EntityContainer;
class GraphicView;
class Vector;
//mebbe... Well, that's what he says above. Though it would be just as easy to
//prefix a QObject::tr in front of translated strings...
public:
- ActionInterface(const char * name, RS_EntityContainer &,
+ ActionInterface(const char * name, EntityContainer &,
GraphicView &);
virtual ~ActionInterface();
virtual void keyPressEvent(QKeyEvent * e);
virtual void keyReleaseEvent(QKeyEvent * e);
virtual void coordinateEvent(Vector *);
- virtual void commandEvent(RS_CommandEvent *);
+ virtual void commandEvent(CommandEvent *);
virtual QStringList getAvailableCommands();
virtual void setStatus(int status);
virtual int getStatus();
QString msgAvailableCommands();
//built-in for now, we'll see how it goes...
Vector snapPoint(QMouseEvent *);
- RS_Entity * catchEntity(QMouseEvent *, RS2::ResolveLevel level = RS2::ResolveNone);
- RS_Entity * catchEntity(Vector, RS2::ResolveLevel level = RS2::ResolveNone);
+ Entity * catchEntity(QMouseEvent *, RS2::ResolveLevel level = RS2::ResolveNone);
+ Entity * catchEntity(Vector, RS2::ResolveLevel level = RS2::ResolveNone);
#warning "!!! The following functions are DEPRECATED and only in place to help with porting.. !!!"
void drawSnapper(void);
void deleteSnapper(void);
/**
* Pointer to the document (graphic or block) or NULL.
*/
- RS_Document * document;
+ Document * document;
/**
* Predecessor of this action or NULL.
ActionInterface * predecessor;
GraphicView * graphicView;
- RS_EntityContainer * container;
+ EntityContainer * container;
};
#endif // __ACTIONINTERFACE_H__
/**
* Default constructor.
*/
-RS_Arc::RS_Arc(RS_EntityContainer * parent, const RS_ArcData & d):
- RS_AtomicEntity(parent), data(d)
+Arc::Arc(EntityContainer * parent, const ArcData & d):
+ AtomicEntity(parent), data(d)
{
calculateEndpoints();
calculateBorders();
}
-/*virtual*/ RS_Arc::~RS_Arc()
+/*virtual*/ Arc::~Arc()
{
}
-/*virtual*/ RS_Entity * RS_Arc::clone()
+/*virtual*/ Entity * Arc::clone()
{
- RS_Arc * a = new RS_Arc(*this);
+ Arc * a = new Arc(*this);
a->initId();
return a;
}
/** @return RS2::EntityArc */
-/*virtual*/ RS2::EntityType RS_Arc::rtti() const
+/*virtual*/ RS2::EntityType Arc::rtti() const
{
return RS2::EntityArc;
}
/** @return true */
-/*virtual*/ bool RS_Arc::isEdge() const
+/*virtual*/ bool Arc::isEdge() const
{
return true;
}
/** @return Copy of data that defines the arc. **/
-RS_ArcData RS_Arc::getData() const
+ArcData Arc::getData() const
{
return data;
}
-/*virtual*/ VectorSolutions RS_Arc::getRefPoints()
+/*virtual*/ VectorSolutions Arc::getRefPoints()
{
VectorSolutions ret(startpoint, endpoint, data.center);
return ret;
}
/** Sets new arc parameters. **/
-void RS_Arc::setData(RS_ArcData d)
+void Arc::setData(ArcData d)
{
data = d;
}
/** @return The center point (x) of this arc */
-Vector RS_Arc::getCenter() const
+Vector Arc::getCenter() const
{
return data.center;
}
/** Sets new center. */
-void RS_Arc::setCenter(const Vector & c)
+void Arc::setCenter(const Vector & c)
{
data.center = c;
}
/** @return The radius of this arc */
-double RS_Arc::getRadius() const
+double Arc::getRadius() const
{
return data.radius;
}
/** Sets new radius. */
-void RS_Arc::setRadius(double r)
+void Arc::setRadius(double r)
{
data.radius = r;
}
/** @return The start angle of this arc */
-double RS_Arc::getAngle1() const
+double Arc::getAngle1() const
{
return data.angle1;
}
/** Sets new start angle. */
-void RS_Arc::setAngle1(double a1)
+void Arc::setAngle1(double a1)
{
data.angle1 = a1;
}
/** @return The end angle of this arc */
-double RS_Arc::getAngle2() const
+double Arc::getAngle2() const
{
return data.angle2;
}
/** Sets new end angle. */
-void RS_Arc::setAngle2(double a2)
+void Arc::setAngle2(double a2)
{
data.angle2 = a2;
}
* @return Direction 1. The angle at which the arc starts at
* the startpoint.
*/
-double RS_Arc::getDirection1() const
+double Arc::getDirection1() const
{
if (!data.reversed)
- return RS_Math::correctAngle(data.angle1 + M_PI / 2.0);
+ return Math::correctAngle(data.angle1 + M_PI / 2.0);
- return RS_Math::correctAngle(data.angle1 - M_PI / 2.0);
+ return Math::correctAngle(data.angle1 - M_PI / 2.0);
}
/**
* @return Direction 2. The angle at which the arc starts at
* the endpoint.
*/
-double RS_Arc::getDirection2() const
+double Arc::getDirection2() const
{
if (!data.reversed)
- return RS_Math::correctAngle(data.angle2 - M_PI / 2.0);
+ return Math::correctAngle(data.angle2 - M_PI / 2.0);
- return RS_Math::correctAngle(data.angle2 + M_PI / 2.0);
+ return Math::correctAngle(data.angle2 + M_PI / 2.0);
}
/**
* @retval true if the arc is reversed (clockwise),
* @retval false otherwise
*/
-bool RS_Arc::isReversed() const
+bool Arc::isReversed() const
{
return data.reversed;
}
/** sets the reversed status. */
-void RS_Arc::setReversed(bool r)
+void Arc::setReversed(bool r)
{
data.reversed = r;
}
/** @return Start point of the entity. */
-/*virtual*/ Vector RS_Arc::getStartpoint() const
+/*virtual*/ Vector Arc::getStartpoint() const
{
return startpoint;
}
/** @return End point of the entity. */
-/*virtual*/ Vector RS_Arc::getEndpoint() const
+/*virtual*/ Vector Arc::getEndpoint() const
{
return endpoint;
}
* @param p2 2nd point.
* @param p3 3rd point.
*/
-bool RS_Arc::createFrom3P(const Vector & p1, const Vector & p2, const Vector & p3)
+bool Arc::createFrom3P(const Vector & p1, const Vector & p2, const Vector & p3)
{
if (p1.distanceTo(p2) > RS_TOLERANCE
&& p2.distanceTo(p3) > RS_TOLERANCE
a2 = p2.angleTo(p3) + M_PI / 2.0;
dir2.setPolar(100.0, a2);
- RS_ConstructionLineData d1(mp1, mp1 + dir1);
- RS_ConstructionLineData d2(mp2, mp2 + dir2);
- RS_ConstructionLine midLine1(NULL, d1);
- RS_ConstructionLine midLine2(NULL, d2);
+ ConstructionLineData d1(mp1, mp1 + dir1);
+ ConstructionLineData d2(mp2, mp2 + dir2);
+ ConstructionLine midLine1(NULL, d1);
+ ConstructionLine midLine2(NULL, d2);
VectorSolutions sol =
- RS_Information::getIntersection(&midLine1, &midLine2);
+ Information::getIntersection(&midLine1, &midLine2);
data.center = sol.get(0);
data.radius = data.center.distanceTo(p3);
data.angle1 = data.center.angleTo(p1);
data.angle2 = data.center.angleTo(p3);
- data.reversed = RS_Math::isAngleBetween(data.center.angleTo(p2),
+ data.reversed = Math::isAngleBetween(data.center.angleTo(p2),
data.angle1, data.angle2, true);
if (sol.get(0).valid && data.radius < 1.0e14
}
else
{
- RS_DEBUG->print("RS_Arc::createFrom3P(): "
+ DEBUG->print("Arc::createFrom3P(): "
"Cannot create an arc with inf radius.");
return false;
}
}
else
{
- RS_DEBUG->print("RS_Arc::createFrom3P(): "
+ DEBUG->print("Arc::createFrom3P(): "
"Cannot create an arc with radius 0.0.");
return false;
}
* @retval true Successfully created arc
* @retval false Cannot creats arc (radius to small or endpoint to far away)
*/
-bool RS_Arc::createFrom2PDirectionRadius(const Vector & startPoint, const Vector & endPoint, double direction1, double radius)
+bool Arc::createFrom2PDirectionRadius(const Vector & startPoint, const Vector & endPoint, double direction1, double radius)
{
Vector ortho;
ortho.setPolar(radius, direction1 + M_PI / 2.0);
data.angle2 = data.center.angleTo(endPoint);
data.reversed = false;
- double diff = RS_Math::correctAngle(getDirection1() - direction1);
+ double diff = Math::correctAngle(getDirection1() - direction1);
if (fabs(diff - M_PI) < 1.0e-1)
data.reversed = true;
/**
* Creates an arc from its startpoint, endpoint and bulge.
*/
-bool RS_Arc::createFrom2PBulge(const Vector & startPoint, const Vector & endPoint, double bulge)
+bool Arc::createFrom2PBulge(const Vector & startPoint, const Vector & endPoint, double bulge)
{
data.reversed = (bulge < 0.0);
double alpha = atan(bulge) * 4.0;
// alpha can't be 0.0 at this point
data.radius = fabs(dist / sin(alpha / 2.0));
- double wu = fabs(RS_Math::pow(data.radius, 2.0) - RS_Math::pow(dist, 2.0));
+ double wu = fabs(Math::pow(data.radius, 2.0) - Math::pow(dist, 2.0));
double h = sqrt(wu);
double angle = startPoint.angleTo(endPoint);
/**
* Recalculates the endpoints using the angles and the radius.
*/
-void RS_Arc::calculateEndpoints()
+void Arc::calculateEndpoints()
{
startpoint.set(data.center.x + cos(data.angle1) * data.radius,
data.center.y + sin(data.angle1) * data.radius);
data.center.y + sin(data.angle2) * data.radius);
}
-void RS_Arc::calculateBorders()
+void Arc::calculateBorders()
{
double minX = std::min(startpoint.x, endpoint.x);
double minY = std::min(startpoint.y, endpoint.y);
maxV.set(maxX, maxY);
}
-Vector RS_Arc::getNearestEndpoint(const Vector & coord, double * dist)
+Vector Arc::getNearestEndpoint(const Vector & coord, double * dist)
{
double dist1, dist2;
Vector * nearerPoint;
return *nearerPoint;
}
-Vector RS_Arc::getNearestPointOnEntity(const Vector & coord, bool onEntity, double * dist, RS_Entity * * entity)
+Vector Arc::getNearestPointOnEntity(const Vector & coord, bool onEntity, double * dist, Entity * * entity)
{
Vector vec(false);
double angle = (coord - data.center).angle();
- if (onEntity == false || RS_Math::isAngleBetween(angle,
+ if (onEntity == false || Math::isAngleBetween(angle,
data.angle1, data.angle2, isReversed()))
{
vec.setPolar(data.radius, angle);
return vec;
}
-Vector RS_Arc::getNearestCenter(const Vector & coord, double * dist)
+Vector Arc::getNearestCenter(const Vector & coord, double * dist)
{
if (dist != NULL)
*dist = coord.distanceTo(data.center);
return data.center;
}
-Vector RS_Arc::getNearestMiddle(const Vector & coord, double * dist)
+Vector Arc::getNearestMiddle(const Vector & coord, double * dist)
{
Vector ret = getMiddlepoint();
return ret;
}
-Vector RS_Arc::getNearestDist(double distance, const Vector & coord, double * dist)
+Vector Arc::getNearestDist(double distance, const Vector & coord, double * dist)
{
if (data.radius < 1.0e-6)
{
return *nearerPoint;
}
-Vector RS_Arc::getNearestDist(double distance, bool startp)
+Vector Arc::getNearestDist(double distance, bool startp)
{
if (data.radius < 1.0e-6)
return Vector(false);
return p;
}
-double RS_Arc::getDistanceToPoint(const Vector & coord, RS_Entity * * entity, RS2::ResolveLevel, double)
+double Arc::getDistanceToPoint(const Vector & coord, Entity * * entity, RS2::ResolveLevel, double)
{
if (entity != NULL)
*entity = this;
if (dist < 1.0e-4)
return dist;
- if (RS_Math::isAngleBetween(data.center.angleTo(coord),
+ if (Math::isAngleBetween(data.center.angleTo(coord),
data.angle1, data.angle2,
isReversed()))
return RS_MAXDOUBLE;
}
-void RS_Arc::moveStartpoint(const Vector & pos)
+void Arc::moveStartpoint(const Vector & pos)
{
// polyline arcs: move point not angle:
//if (parent!=NULL && parent->rtti()==RS2::EntityPolyline) {
}*/
}
-void RS_Arc::moveEndpoint(const Vector & pos)
+void Arc::moveEndpoint(const Vector & pos)
{
// polyline arcs: move point not angle:
//if (parent!=NULL && parent->rtti()==RS2::EntityPolyline) {
}*/
}
-void RS_Arc::trimStartpoint(const Vector & pos)
+void Arc::trimStartpoint(const Vector & pos)
{
data.angle1 = data.center.angleTo(pos);
calculateEndpoints();
calculateBorders();
}
-void RS_Arc::trimEndpoint(const Vector & pos)
+void Arc::trimEndpoint(const Vector & pos)
{
data.angle2 = data.center.angleTo(pos);
calculateEndpoints();
calculateBorders();
}
-RS2::Ending RS_Arc::getTrimPoint(const Vector & coord, const Vector & trimPoint)
+RS2::Ending Arc::getTrimPoint(const Vector & coord, const Vector & trimPoint)
{
double angEl = data.center.angleTo(trimPoint);
double angM = data.center.angleTo(coord);
- if (RS_Math::getAngleDifference(angM, angEl) > M_PI)
+ if (Math::getAngleDifference(angM, angEl) > M_PI)
{
if (data.reversed)
return RS2::EndingEnd;
}
}
-void RS_Arc::reverse()
+void Arc::reverse()
{
double a = data.angle1;
data.angle1 = data.angle2;
calculateBorders();
}
-void RS_Arc::move(Vector offset)
+void Arc::move(Vector offset)
{
data.center.move(offset);
calculateEndpoints();
calculateBorders();
}
-void RS_Arc::rotate(Vector center, double angle)
+void Arc::rotate(Vector center, double angle)
{
- RS_DEBUG->print("RS_Arc::rotate");
+ DEBUG->print("Arc::rotate");
data.center.rotate(center, angle);
- data.angle1 = RS_Math::correctAngle(data.angle1 + angle);
- data.angle2 = RS_Math::correctAngle(data.angle2 + angle);
+ data.angle1 = Math::correctAngle(data.angle1 + angle);
+ data.angle2 = Math::correctAngle(data.angle2 + angle);
calculateEndpoints();
calculateBorders();
- RS_DEBUG->print("RS_Arc::rotate: OK");
+ DEBUG->print("Arc::rotate: OK");
}
-void RS_Arc::scale(Vector center, Vector factor)
+void Arc::scale(Vector center, Vector factor)
{
// negative scaling: mirroring
if (factor.x < 0.0)
calculateBorders();
}
-void RS_Arc::mirror(Vector axisPoint1, Vector axisPoint2)
+void Arc::mirror(Vector axisPoint1, Vector axisPoint2)
{
data.center.mirror(axisPoint1, axisPoint2);
data.reversed = (!data.reversed);
calculateBorders();
}
-void RS_Arc::moveRef(const Vector & ref, const Vector & offset)
+void Arc::moveRef(const Vector & ref, const Vector & offset)
{
if (ref.distanceTo(startpoint) < 1.0e-4)
moveStartpoint(startpoint + offset);
moveEndpoint(endpoint + offset);
}
-void RS_Arc::stretch(Vector firstCorner, Vector secondCorner, Vector offset)
+void Arc::stretch(Vector firstCorner, Vector secondCorner, Vector offset)
{
if (getMin().isInWindow(firstCorner, secondCorner)
&& getMax().isInWindow(firstCorner, secondCorner))
}
}
-void RS_Arc::draw(PaintInterface * painter, GraphicView * view, double /*patternOffset*/)
+void Arc::draw(PaintInterface * painter, GraphicView * view, double /*patternOffset*/)
{
if (painter == NULL || view == NULL)
return;
}
// Pattern:
- RS_LineTypePattern * pat;
+ LineTypePattern * pat;
if (isSelected())
pat = &patternSelected;
return;
// Pen to draw pattern is always solid:
- RS_Pen pen = painter->getPen();
+ Pen pen = painter->getPen();
pen.setLineType(RS2::SolidLine);
painter->setPen(pen);
/**
* @return Middle point of the entity.
*/
-Vector RS_Arc::getMiddlepoint() const
+Vector Arc::getMiddlepoint() const
{
double a;
Vector ret;
/**
* @return Angle length in rad.
*/
-double RS_Arc::getAngleLength() const
+double Arc::getAngleLength() const
{
double ret = 0.0;
/**
* @return Length of the arc.
*/
-double RS_Arc::getLength()
+double Arc::getLength()
{
return getAngleLength() * data.radius;
}
/**
* Gets the arc's bulge (tangens of angle length divided by 4).
*/
-double RS_Arc::getBulge() const
+double Arc::getBulge() const
{
double bulge = tan(fabs(getAngleLength()) / 4.0);
/**
* Dumps the point's data to stdout.
*/
-std::ostream & operator<<(std::ostream & os, const RS_Arc & a)
+std::ostream & operator<<(std::ostream & os, const Arc & a)
{
os << " Arc: " << a.data << "\n";
return os;
/**
* Holds the data that defines an arc.
*/
-class RS_ArcData
+class ArcData
{
public:
- RS_ArcData()
+ ArcData()
{
}
- RS_ArcData(const Vector & center, double radius, double angle1, double angle2, bool reversed)
+ ArcData(const Vector & center, double radius, double angle1, double angle2, bool reversed)
{
this->center = center;
this->radius = radius;
&& fabs(angle1 - angle2) > RS_TOLERANCE_ANGLE);
}
- friend std::ostream & operator<<(std::ostream & os, const RS_ArcData & ad)
+ friend std::ostream & operator<<(std::ostream & os, const ArcData & ad)
{
os << "(" << ad.center
<< "/" << ad.radius
*
* @author Andrew Mustun
*/
-class RS_Arc: public RS_AtomicEntity
+class Arc: public AtomicEntity
{
public:
- RS_Arc(RS_EntityContainer * parent, const RS_ArcData & d);
- virtual ~RS_Arc();
+ Arc(EntityContainer * parent, const ArcData & d);
+ virtual ~Arc();
- virtual RS_Entity * clone();
+ virtual Entity * clone();
virtual RS2::EntityType rtti() const;
virtual bool isEdge() const;
- RS_ArcData getData() const;
+ ArcData getData() const;
virtual VectorSolutions getRefPoints();
- void setData(RS_ArcData d);
+ void setData(ArcData d);
Vector getCenter() const;
void setCenter(const Vector & c);
double getRadius() const;
bool createFrom2PBulge(const Vector & startPoint, const Vector & endPoint, double bulge);
virtual Vector getNearestEndpoint(const Vector & coord, double * dist = NULL);
- virtual Vector getNearestPointOnEntity(const Vector & coord, bool onEntity = true, double * dist = NULL, RS_Entity ** entity = NULL);
+ virtual Vector getNearestPointOnEntity(const Vector & coord, bool onEntity = true, double * dist = NULL, Entity ** entity = NULL);
virtual Vector getNearestCenter(const Vector & coord, double * dist = NULL);
virtual Vector getNearestMiddle(const Vector & coord, double * dist = NULL);
virtual Vector getNearestDist(double distance, const Vector & coord, double * dist = NULL);
virtual Vector getNearestDist(double distance, bool startp);
- virtual double getDistanceToPoint(const Vector & coord, RS_Entity * * entity = NULL, RS2::ResolveLevel level = RS2::ResolveNone, double solidDist = RS_MAXDOUBLE);
+ virtual double getDistanceToPoint(const Vector & coord, Entity * * entity = NULL, RS2::ResolveLevel level = RS2::ResolveNone, double solidDist = RS_MAXDOUBLE);
virtual void move(Vector offset);
virtual void rotate(Vector center, double angle);
virtual void scale(Vector center, Vector factor);
virtual void draw(PaintInterface * painter, GraphicView * view, double patternOffset = 0.0);
- friend std::ostream & operator<<(std::ostream & os, const RS_Arc & a);
+ friend std::ostream & operator<<(std::ostream & os, const Arc & a);
virtual void calculateEndpoints();
virtual void calculateBorders();
protected:
- RS_ArcData data;
+ ArcData data;
/**
* Startpoint. This is redundant but stored for performance
/**
* Construtor.
*/
-RS_AtomicEntity::RS_AtomicEntity(RS_EntityContainer * parent/*= NULL*/): RS_Entity(parent)
+AtomicEntity::AtomicEntity(EntityContainer * parent/*= NULL*/): Entity(parent)
{
}
/**
* Destrutor.
*/
-/*virtual*/ RS_AtomicEntity::~RS_AtomicEntity()
+/*virtual*/ AtomicEntity::~AtomicEntity()
{
}
* @return false because entities made from subclasses are
* atomic entities.
*/
-/*virtual*/ bool RS_AtomicEntity::isContainer() const
+/*virtual*/ bool AtomicEntity::isContainer() const
{
return false;
}
* @return true because entities made from subclasses are
* atomic entities.
*/
-/*virtual*/ bool RS_AtomicEntity::isAtomic() const
+/*virtual*/ bool AtomicEntity::isAtomic() const
{
return true;
}
/**
* @return Always 1 for atomic entities.
*/
-/*virtual*/ unsigned long int RS_AtomicEntity::count()
+/*virtual*/ unsigned long int AtomicEntity::count()
{
return 1;
}
/**
* @return Always 1 for atomic entities.
*/
-/*virtual*/ unsigned long int RS_AtomicEntity::countDeep()
+/*virtual*/ unsigned long int AtomicEntity::countDeep()
{
return 1;
}
* Implementation must return the endpoint of the entity or
* an invalid vector if the entity has no endpoint.
*/
-/*virtual*/ Vector RS_AtomicEntity::getEndpoint() const
+/*virtual*/ Vector AtomicEntity::getEndpoint() const
{
return Vector(false);
}
* Implementation must return the startpoint of the entity or
* an invalid vector if the entity has no startpoint.
*/
-/*virtual*/ Vector RS_AtomicEntity::getStartpoint() const
+/*virtual*/ Vector AtomicEntity::getStartpoint() const
{
return Vector(false);
}
/**
* Implementation must return the angle in which direction the entity starts.
*/
-/*virtual*/ double RS_AtomicEntity::getDirection1() const
+/*virtual*/ double AtomicEntity::getDirection1() const
{
return 0.0;
}
/**
* Implementation must return the angle in which direction the entity starts the opposite way.
*/
-/*virtual*/ double RS_AtomicEntity::getDirection2() const
+/*virtual*/ double AtomicEntity::getDirection2() const
{
return 0.0;
}
/**
* (De-)selects startpoint.
*/
-/*virtual*/ void RS_AtomicEntity::setStartpointSelected(bool select)
+/*virtual*/ void AtomicEntity::setStartpointSelected(bool select)
{
if (select)
setFlag(RS2::FlagSelected1);
/**
* (De-)selects endpoint.
*/
-/*virtual*/ void RS_AtomicEntity::setEndpointSelected(bool select)
+/*virtual*/ void AtomicEntity::setEndpointSelected(bool select)
{
if (select)
setFlag(RS2::FlagSelected2);
/**
* @return True if the entities startpoint is selected.
*/
-bool RS_AtomicEntity::isStartpointSelected() const
+bool AtomicEntity::isStartpointSelected() const
{
return getFlag(RS2::FlagSelected1);
}
/**
* @return True if the entities endpoint is selected.
*/
-bool RS_AtomicEntity::isEndpointSelected() const
+bool AtomicEntity::isEndpointSelected() const
{
return getFlag(RS2::FlagSelected2);
}
* Implementation must move the startpoint of the entity to
* the given position.
*/
-/*virtual*/ void RS_AtomicEntity::moveStartpoint(const Vector & /*pos*/)
+/*virtual*/ void AtomicEntity::moveStartpoint(const Vector & /*pos*/)
{
}
* Implementation must move the endpoint of the entity to
* the given position.
*/
-/*virtual*/ void RS_AtomicEntity::moveEndpoint(const Vector & /*pos*/)
+/*virtual*/ void AtomicEntity::moveEndpoint(const Vector & /*pos*/)
{
}
* Implementation must trim the startpoint of the entity to
* the given position.
*/
-/*virtual*/ void RS_AtomicEntity::trimStartpoint(const Vector & pos)
+/*virtual*/ void AtomicEntity::trimStartpoint(const Vector & pos)
{
moveStartpoint(pos);
}
* Implementation must trim the endpoint of the entity to
* the given position.
*/
-/*virtual*/ void RS_AtomicEntity::trimEndpoint(const Vector & pos)
+/*virtual*/ void AtomicEntity::trimEndpoint(const Vector & pos)
{
moveEndpoint(pos);
}
* trim entity and 'trimPoint' is the point to which the entity will
* be trimmed.
*/
-/*virtual*/ RS2::Ending RS_AtomicEntity::getTrimPoint(const Vector & /*coord*/, const Vector & /*trimPoint*/)
+/*virtual*/ RS2::Ending AtomicEntity::getTrimPoint(const Vector & /*coord*/, const Vector & /*trimPoint*/)
{
return RS2::EndingNone;
}
-/*virtual*/ void RS_AtomicEntity::reverse()
+/*virtual*/ void AtomicEntity::reverse()
{
}
-/*virtual*/ void RS_AtomicEntity::moveSelectedRef(const Vector & ref, const Vector & offset)
+/*virtual*/ void AtomicEntity::moveSelectedRef(const Vector & ref, const Vector & offset)
{
if (isSelected())
moveRef(ref, offset);
*
* @author Andrew Mustun
*/
-class RS_AtomicEntity: public RS_Entity
+class AtomicEntity: public Entity
{
public:
- RS_AtomicEntity(RS_EntityContainer * parent = NULL);
- virtual ~RS_AtomicEntity();
+ AtomicEntity(EntityContainer * parent = NULL);
+ virtual ~AtomicEntity();
virtual bool isContainer() const;
virtual bool isAtomic() const;
virtual unsigned long int count();
* @param name The name of the block used as an identifier.
* @param basePoint Base point (offset) of the block.
*/
-RS_Block::RS_Block(RS_EntityContainer * parent, const RS_BlockData & d):
- RS_Document(parent), data(d)
+Block::Block(EntityContainer * parent, const BlockData & d):
+ Document(parent), data(d)
{
- pen = RS_Pen(RS_Color(128, 128, 128), RS2::Width01, RS2::SolidLine);
+ pen = Pen(Color(128, 128, 128), RS2::Width01, RS2::SolidLine);
}
-RS_Block::~RS_Block()
+Block::~Block()
{
}
-RS_Entity * RS_Block::clone()
+Entity * Block::clone()
{
- RS_Block * blk = new RS_Block(*this);
+ Block * blk = new Block(*this);
#warning "!!! Need to port setAutoDelete() behaviour from Qt3 to Qt4 !!!"
// blk->entities.setAutoDelete(entities.autoDelete());
blk->detach();
return blk;
}
-RS_LayerList * RS_Block::getLayerList()
+LayerList * Block::getLayerList()
{
Drawing * g = getGraphic();
- if (g != NULL)
+ if (g)
return g->getLayerList();
return NULL;
}
-RS_BlockList * RS_Block::getBlockList()
+BlockList * Block::getBlockList()
{
Drawing * g = getGraphic();
- if (g != NULL)
+ if (g)
return g->getBlockList();
return NULL;
}
-bool RS_Block::save()
+bool Block::save()
{
Drawing * g = getGraphic();
- if (g != NULL)
+ if (g)
return g->save();
return false;
}
-bool RS_Block::saveAs(const QString & filename, RS2::FormatType type)
+bool Block::saveAs(const QString & filename, RS2::FormatType type)
{
Drawing * g = getGraphic();
- if (g != NULL)
+ if (g)
return g->saveAs(filename, type);
return false;
/**
* Sets the parent documents modified status to 'm'.
*/
-void RS_Block::setModified(bool m)
+void Block::setModified(bool m)
{
Drawing * p = getGraphic();
}
/** @return RS2::EntityBlock */
-/*virtual*/ RS2::EntityType RS_Block::rtti() const
+/*virtual*/ RS2::EntityType Block::rtti() const
{
return RS2::EntityBlock;
}
/**
* @return Name of this block (the name is an Id for this block).
*/
-QString RS_Block::getName() const
+QString Block::getName() const
{
return data.name;
}
/**
* @return base point of this block.
*/
-Vector RS_Block::getBasePoint() const
+Vector Block::getBasePoint() const
{
return data.basePoint;
}
/**
- * Reimplementation from RS_Document. Does nothing.
+ * Reimplementation from Document. Does nothing.
*/
-/*virtual*/ void RS_Block::newDoc()
+/*virtual*/ void Block::newDoc()
{
// do nothing
}
/**
- * Reimplementation from RS_Document. Does nothing.
+ * Reimplementation from Document. Does nothing.
*/
-/*virtual*/ bool RS_Block::open(const QString &, RS2::FormatType)
+/*virtual*/ bool Block::open(const QString &, RS2::FormatType)
{
// do nothing
return false;
}
-/*friend*/ std::ostream & operator<<(std::ostream & os, const RS_Block & b)
+/*friend*/ std::ostream & operator<<(std::ostream & os, const Block & b)
{
os << " name: " << b.getName().toLatin1().data() << std::endl;
- os << " entities: " << (RS_EntityContainer &)b << std::endl;
+ os << " entities: " << (EntityContainer &)b << std::endl;
return os;
}
* sets a new name for the block. Only called by blocklist to
* assure that block names stay unique.
*/
-void RS_Block::setName(const QString & n)
+void Block::setName(const QString & n)
{
data.name = n;
}
* @retval true if this block is frozen (invisible)
* @retval false if this block isn't frozen (visible)
*/
-bool RS_Block::isFrozen() const
+bool Block::isFrozen() const
{
return data.frozen;
}
* Toggles the visibility of this block.
* Freezes the block if it's not frozen, thaws the block otherwise
*/
-void RS_Block::toggle()
+void Block::toggle()
{
data.frozen = !data.frozen;
}
*
* @param freeze true: freeze, false: defreeze
*/
-void RS_Block::freeze(bool freeze)
+void Block::freeze(bool freeze)
{
data.frozen = freeze;
}
/**
* Holds the data that defines a block.
*/
-class RS_BlockData
+class BlockData
{
public:
- RS_BlockData() {}
+ BlockData() {}
- RS_BlockData(const QString & name1, const Vector & basePoint1, bool frozen1):
+ BlockData(const QString & name1, const Vector & basePoint1, bool frozen1):
name(name1), basePoint(basePoint1), frozen(frozen1) {}
bool isValid()
* block. Note that although technically possible, a block should
* never be part of the entity tree of a graphic. Blocks are
* stored in a seperate list inside the graphic document (a block list).
- * The graphic can contain RS_Insert entities that refer to such
+ * The graphic can contain Insert entities that refer to such
* blocks.
*
* blocks are documents and can therefore be handled by graphic views.
*
* @author Andrew Mustun
*/
-class RS_Block: public RS_Document
+class Block: public Document
{
- friend class RS_BlockList;
+ friend class BlockList;
public:
- RS_Block(RS_EntityContainer * parent, const RS_BlockData & d);
- virtual ~RS_Block();
+ Block(EntityContainer * parent, const BlockData & d);
+ virtual ~Block();
- virtual RS_Entity * clone();
+ virtual Entity * clone();
virtual RS2::EntityType rtti() const;
QString getName() const;
Vector getBasePoint() const;
- virtual RS_LayerList * getLayerList();
- virtual RS_BlockList * getBlockList();
+ virtual LayerList * getLayerList();
+ virtual BlockList * getBlockList();
virtual void newDoc();
virtual bool save();
virtual bool saveAs(const QString & filename, RS2::FormatType type);
virtual bool open(const QString &, RS2::FormatType);
- friend std::ostream & operator<<(std::ostream & os, const RS_Block & b);
+ friend std::ostream & operator<<(std::ostream & os, const Block & b);
void setName(const QString & n);
bool isFrozen() const;
void toggle();
*/
//QString name;
//! Block data
- RS_BlockData data;
+ BlockData data;
};
#endif
* If so, the blocks will be deleted when the block
* list is deleted.
*/
-RS_BlockList::RS_BlockList(bool owner)
+BlockList::BlockList(bool owner)
{
this->owner = owner;
//blocks.setAutoDelete(owner);
setModified(false);
}
-/*virtual*/ RS_BlockList::~RS_BlockList()
+/*virtual*/ BlockList::~BlockList()
{
}
/**
* Removes all blocks in the blocklist.
*/
-void RS_BlockList::clear()
+void BlockList::clear()
{
blocks.clear();
setModified(true);
/**
* @return Number of blocks available.
*/
-uint RS_BlockList::count()
+uint BlockList::count()
{
return blocks.count();
}
/**
* @return Block at given position or NULL if i is out of range.
*/
-RS_Block * RS_BlockList::at(uint i)
+Block * BlockList::at(uint i)
{
return blocks.at(i);
}
* Activates the given block.
* Listeners are notified.
*/
-void RS_BlockList::activate(const QString & name)
+void BlockList::activate(const QString & name)
{
- RS_DEBUG->print("RS_BlockList::activateBlock");
+ DEBUG->print("BlockList::activateBlock");
activate(find(name));
}
* Activates the given block.
* Listeners are notified.
*/
-void RS_BlockList::activate(RS_Block * block)
+void BlockList::activate(Block * block)
{
- RS_DEBUG->print("RS_BlockList::activateBlock");
+ DEBUG->print("BlockList::activateBlock");
activeBlock = block;
/*
for (uint i=0; i<blockListListeners.count(); ++i) {
- RS_BlockListListener* l = blockListListeners.at(i);
+ BlockListListener* l = blockListListeners.at(i);
if (l!=NULL) {
l->blockActivated(activeBlock);
}
}
//! @return The active block of NULL if no block is activated.
-RS_Block * RS_BlockList::getActive()
+Block * BlockList::getActive()
{
return activeBlock;
}
*
* @return false: block already existed and was deleted.
*/
-bool RS_BlockList::add(RS_Block * block, bool notify)
+bool BlockList::add(Block * block, bool notify)
{
- RS_DEBUG->print("RS_BlockList::add()");
+ DEBUG->print("BlockList::add()");
if (block == NULL)
return false;
// check if block already exists:
- RS_Block * b = find(block->getName());
+ Block * b = find(block->getName());
if (b == NULL)
{
* used after adding a lot of blocks without auto-update or simply
* to force an update of GUI blocklists.
*/
-void RS_BlockList::addNotification()
+void BlockList::addNotification()
{
#if 0
for(int i=0; i<blockListListeners.count(); ++i)
{
- RS_BlockListListener * l = blockListListeners.at(i);
+ BlockListListener * l = blockListListeners.at(i);
l->blockAdded(NULL);
}
#endif
* Listeners are notified after the block was removed from
* the list but before it gets deleted.
*/
-void RS_BlockList::remove(RS_Block * block)
+void BlockList::remove(Block * block)
{
- RS_DEBUG->print("RS_BlockList::removeBlock()");
+ DEBUG->print("BlockList::removeBlock()");
// here the block is removed from the list but not deleted
// blocks.remove(block);
#if 0
for(int i=0; i<blockListListeners.count(); ++i)
{
- RS_BlockListListener * l = blockListListeners.at(i);
+ BlockListListener * l = blockListListeners.at(i);
l->blockRemoved(block);
}
#endif
* @retval true block was successfully renamed.
* @retval false block couldn't be renamed.
*/
-bool RS_BlockList::rename(RS_Block * block, const QString & name)
+bool BlockList::rename(Block * block, const QString & name)
{
if (block != NULL)
{
* Listeners are notified.
*/
/*
-void RS_BlockList::editBlock(RS_Block* block, const RS_Block& source) {
+void BlockList::editBlock(Block* block, const Block& source) {
*block = source;
for (uint i=0; i<blockListListeners.count(); ++i) {
- RS_BlockListListener* l = blockListListeners.at(i);
+ BlockListListener* l = blockListListeners.at(i);
l->blockEdited(block);
}
* @return Pointer to the block with the given name or
* \p NULL if no such block was found.
*/
-RS_Block * RS_BlockList::find(const QString & name)
+Block * BlockList::find(const QString & name)
{
- //RS_DEBUG->print("RS_BlockList::find");
+ //DEBUG->print("BlockList::find");
for(uint i=0; i<count(); i++)
{
- RS_Block * b = at(i);
+ Block * b = at(i);
if (b->getName() == name)
return b;
*
* @param suggestion Suggested name the new name will be based on.
*/
-QString RS_BlockList::newName(const QString & suggestion)
+QString BlockList::newName(const QString & suggestion)
{
QString name;
* Switches on / off the given block.
* Listeners are notified.
*/
-void RS_BlockList::toggle(const QString & name)
+void BlockList::toggle(const QString & name)
{
toggle(find(name));
}
* Switches on / off the given block.
* Listeners are notified.
*/
-void RS_BlockList::toggle(RS_Block * block)
+void BlockList::toggle(Block * block)
{
if (block == NULL)
return;
// Notify listeners:
for(int i=0; i<blockListListeners.count(); ++i)
{
- RS_BlockListListener * l = blockListListeners.at(i);
+ BlockListListener * l = blockListListeners.at(i);
l->blockToggled(block);
}
*
* @param freeze true: freeze, false: defreeze
*/
-void RS_BlockList::freezeAll(bool freeze)
+void BlockList::freezeAll(bool freeze)
{
for(uint l=0; l<count(); l++)
at(l)->freeze(freeze);
#if 0
for(int i=0; i<blockListListeners.count(); ++i)
{
- RS_BlockListListener * l = blockListListeners.at(i);
+ BlockListListener * l = blockListListeners.at(i);
l->blockToggled(NULL);
}
#endif
* Listeners are notified.
*/
/*
-void RS_BlockList::toggleBlock(const QString& name) {
- RS_Block* block = findBlock(name);
+void BlockList::toggleBlock(const QString& name) {
+ Block* block = findBlock(name);
block->toggle();
// Notify listeners:
for (uint i=0; i<blockListListeners.count(); ++i) {
- RS_BlockListListener* l = blockListListeners.at(i);
+ BlockListListener* l = blockListListeners.at(i);
l->blockToggled(block);
}
* are notified when the block list changes.
*/
#if 0
-void RS_BlockList::addListener(RS_BlockListListener * listener)
+void BlockList::addListener(BlockListListener * listener)
{
blockListListeners.append(listener);
}
/**
* removes a BlockListListener from the list of listeners.
*/
-void RS_BlockList::removeListener(RS_BlockListListener * listener)
+void BlockList::removeListener(BlockListListener * listener)
{
blockListListeners.removeAll(listener);
}
/**
* Sets the layer lists modified status to 'm'.
*/
-void RS_BlockList::setModified(bool m)
+void BlockList::setModified(bool m)
{
modified = m;
}
* @retval true The layer list has been modified.
* @retval false The layer list has not been modified.
*/
-/*virtual*/ bool RS_BlockList::isModified() const
+/*virtual*/ bool BlockList::isModified() const
{
return modified;
}
/**
* Dumps the blocks to stdout.
*/
-std::ostream & operator<<(std::ostream & os, RS_BlockList & b)
+std::ostream & operator<<(std::ostream & os, BlockList & b)
{
os << "Blocklist: \n";
for(uint i=0; i<b.count(); ++i)
{
- RS_Block * blk = b.at(i);
+ Block * blk = b.at(i);
os << *blk << "\n";
}
/**
* List of blocks.
*
- * @see RS_Block
+ * @see Block
*
* @author Andrew Mustun
*/
-class RS_BlockList
+class BlockList
{
public:
- RS_BlockList(bool owner = false);
- virtual ~RS_BlockList();
+ BlockList(bool owner = false);
+ virtual ~BlockList();
void clear();
uint count();
- RS_Block * at(uint i);
+ Block * at(uint i);
void activate(const QString & name);
- void activate(RS_Block * block);
- RS_Block * getActive();
- virtual bool add(RS_Block * block, bool notify = true);
+ void activate(Block * block);
+ Block * getActive();
+ virtual bool add(Block * block, bool notify = true);
virtual void addNotification();
- virtual void remove(RS_Block * block);
- virtual bool rename(RS_Block * block, const QString & name);
- //virtual void editBlock(RS_Block* block, const RS_Block& source);
- RS_Block * find(const QString & name);
+ virtual void remove(Block * block);
+ virtual bool rename(Block * block, const QString & name);
+ //virtual void editBlock(Block* block, const Block& source);
+ Block * find(const QString & name);
QString newName(const QString & suggestion = "");
void toggle(const QString & name);
- void toggle(RS_Block * block);
+ void toggle(Block * block);
void freezeAll(bool freeze);
-// void addListener(RS_BlockListListener * listener);
-// void removeListener(RS_BlockListListener * listener);
+// void addListener(BlockListListener * listener);
+// void removeListener(BlockListListener * listener);
void setModified(bool m);
virtual bool isModified() const;
- friend std::ostream & operator<<(std::ostream & os, RS_BlockList & b);
+ friend std::ostream & operator<<(std::ostream & os, BlockList & b);
private:
//! Is the list owning the blocks?
bool owner;
//! Blocks in the graphic
- QList<RS_Block *> blocks;
+ QList<Block *> blocks;
//! List of registered BlockListListeners
-// QList<RS_BlockListListener *> blockListListeners;
+// QList<BlockListListener *> blockListListeners;
//! Currently active block
- RS_Block * activeBlock;
+ Block * activeBlock;
/** Flag set if the layer list was modified and not yet saved. */
bool modified;
};
/**
* Default constructor.
*/
-RS_Circle::RS_Circle(RS_EntityContainer * parent, const RS_CircleData & d):
- RS_AtomicEntity(parent), data(d)
+Circle::Circle(EntityContainer * parent, const CircleData & d):
+ AtomicEntity(parent), data(d)
{
calculateBorders();
}
-/*virtual*/ RS_Circle::~RS_Circle()
+/*virtual*/ Circle::~Circle()
{
}
-/*virtual*/ RS_Entity * RS_Circle::clone()
+/*virtual*/ Entity * Circle::clone()
{
- RS_Circle * c = new RS_Circle(*this);
+ Circle * c = new Circle(*this);
c->initId();
return c;
}
/** @return RS2::EntityCircle */
-/*virtual*/ RS2::EntityType RS_Circle::rtti() const
+/*virtual*/ RS2::EntityType Circle::rtti() const
{
return RS2::EntityCircle;
}
/** @return true */
-/*virtual*/ bool RS_Circle::isEdge() const
+/*virtual*/ bool Circle::isEdge() const
{
return true;
}
/** @return Copy of data that defines the circle. **/
-RS_CircleData RS_Circle::getData()
+CircleData Circle::getData()
{
return data;
}
-VectorSolutions RS_Circle::getRefPoints()
+VectorSolutions Circle::getRefPoints()
{
Vector v1(data.radius, 0.0);
Vector v2(0.0, data.radius);
return ret;
}
-/*virtual*/ Vector RS_Circle::getStartpoint() const
+/*virtual*/ Vector Circle::getStartpoint() const
{
return data.center + Vector(data.radius, 0.0);
}
-/*virtual*/ Vector RS_Circle::getEndpoint() const
+/*virtual*/ Vector Circle::getEndpoint() const
{
return data.center + Vector(data.radius, 0.0);
}
* @return Direction 1. The angle at which the arc starts at
* the startpoint.
*/
-double RS_Circle::getDirection1() const
+double Circle::getDirection1() const
{
return M_PI / 2.0;
}
* @return Direction 2. The angle at which the arc starts at
* the endpoint.
*/
-double RS_Circle::getDirection2() const
+double Circle::getDirection2() const
{
return M_PI / 2.0 * 3.0;
}
/** @return The center point (x) of this arc */
-Vector RS_Circle::getCenter()
+Vector Circle::getCenter()
{
return data.center;
}
/** Sets new center. */
-void RS_Circle::setCenter(const Vector & c)
+void Circle::setCenter(const Vector & c)
{
data.center = c;
}
/** @return The radius of this arc */
-double RS_Circle::getRadius()
+double Circle::getRadius()
{
return data.radius;
}
/** Sets new radius. */
-void RS_Circle::setRadius(double r)
+void Circle::setRadius(double r)
{
data.radius = r;
}
-void RS_Circle::calculateBorders()
+void Circle::calculateBorders()
{
Vector r(data.radius, data.radius, 0.0);
minV = data.center - r;
/**
* @return Angle length in rad.
*/
-double RS_Circle::getAngleLength() const
+double Circle::getAngleLength() const
{
return 2 * M_PI;
}
/**
* @return Length of the circle which is the circumference.
*/
-double RS_Circle::getLength()
+double Circle::getLength()
{
return 2 * M_PI * data.radius;
}
* @param c Center.
* @param r Radius
*/
-bool RS_Circle::createFromCR(const Vector & c, double r)
+bool Circle::createFromCR(const Vector & c, double r)
{
if (fabs(r) > RS_TOLERANCE)
{
}
else
{
- RS_DEBUG->print(RS_Debug::D_WARNING, "RS_Circle::createFromCR(): "
+ DEBUG->print(Debug::D_WARNING, "Circle::createFromCR(): "
"Cannot create a circle with radius 0.0.");
return false;
}
* @param p1 1st point.
* @param p2 2nd point.
*/
-bool RS_Circle::createFrom2P(const Vector & p1, const Vector & p2)
+bool Circle::createFrom2P(const Vector & p1, const Vector & p2)
{
if (p1.distanceTo(p2) > RS_TOLERANCE)
{
}
else
{
- RS_DEBUG->print(RS_Debug::D_WARNING, "RS_Circle::createFrom2P(): "
+ DEBUG->print(Debug::D_WARNING, "Circle::createFrom2P(): "
"Cannot create a circle with radius 0.0.");
return false;
}
* @param p2 2nd point.
* @param p3 3rd point.
*/
-bool RS_Circle::createFrom3P(const Vector & p1, const Vector & p2, const Vector & p3)
+bool Circle::createFrom3P(const Vector & p1, const Vector & p2, const Vector & p3)
{
if (p1.distanceTo(p2) > RS_TOLERANCE
&& p2.distanceTo(p3) > RS_TOLERANCE
a2 = p2.angleTo(p3) + M_PI / 2.0;
dir2.setPolar(100.0, a2);
- RS_ConstructionLineData d1(mp1, mp1 + dir1);
- RS_ConstructionLineData d2(mp2, mp2 + dir2);
- RS_ConstructionLine midLine1(NULL, d1);
- RS_ConstructionLine midLine2(NULL, d2);
+ ConstructionLineData d1(mp1, mp1 + dir1);
+ ConstructionLineData d2(mp2, mp2 + dir2);
+ ConstructionLine midLine1(NULL, d1);
+ ConstructionLine midLine2(NULL, d2);
VectorSolutions sol =
- RS_Information::getIntersection(&midLine1, &midLine2);
+ Information::getIntersection(&midLine1, &midLine2);
data.center = sol.get(0);
data.radius = data.center.distanceTo(p3);
return true;
else
{
- RS_DEBUG->print(RS_Debug::D_WARNING, "RS_Circle::createFrom3P(): "
+ DEBUG->print(Debug::D_WARNING, "Circle::createFrom3P(): "
"Cannot create a circle with inf radius.");
return false;
}
}
else
{
- RS_DEBUG->print(RS_Debug::D_WARNING, "RS_Circle::createFrom3P(): "
+ DEBUG->print(Debug::D_WARNING, "Circle::createFrom3P(): "
"Cannot create a circle with radius 0.0.");
return false;
}
/**
* @return Always an invalid vector.
*/
-Vector RS_Circle::getNearestEndpoint(const Vector & /*coord*/, double * dist)
+Vector Circle::getNearestEndpoint(const Vector & /*coord*/, double * dist)
{
if (dist != NULL)
*dist = RS_MAXDOUBLE;
return Vector(false);
}
-Vector RS_Circle::getNearestPointOnEntity(const Vector & coord, bool /*onEntity*/, double * dist, RS_Entity ** entity)
+Vector Circle::getNearestPointOnEntity(const Vector & coord, bool /*onEntity*/, double * dist, Entity ** entity)
{
Vector vec(false);
return vec;
}
-Vector RS_Circle::getNearestCenter(const Vector & coord, double * dist)
+Vector Circle::getNearestCenter(const Vector & coord, double * dist)
{
if (dist != NULL)
*dist = coord.distanceTo(data.center);
return data.center;
}
-Vector RS_Circle::getNearestMiddle(const Vector & /*coord*/, double * dist)
+Vector Circle::getNearestMiddle(const Vector & /*coord*/, double * dist)
{
if (dist != NULL)
*dist = RS_MAXDOUBLE;
return Vector(false);
}
-Vector RS_Circle::getNearestDist(double /*distance*/, const Vector & /*coord*/, double * dist)
+Vector Circle::getNearestDist(double /*distance*/, const Vector & /*coord*/, double * dist)
{
if (dist != NULL)
*dist = RS_MAXDOUBLE;
return Vector(false);
}
-Vector RS_Circle::getNearestDist(double /*distance*/, bool /*startp*/)
+Vector Circle::getNearestDist(double /*distance*/, bool /*startp*/)
{
return Vector(false);
}
-double RS_Circle::getDistanceToPoint(const Vector & coord, RS_Entity * * entity, RS2::ResolveLevel, double)
+double Circle::getDistanceToPoint(const Vector & coord, Entity * * entity, RS2::ResolveLevel, double)
{
if (entity != NULL)
*entity = this;
return fabs((coord - data.center).magnitude() - data.radius);
}
-void RS_Circle::move(Vector offset)
+void Circle::move(Vector offset)
{
data.center.move(offset);
calculateBorders();
}
-void RS_Circle::rotate(Vector center, double angle)
+void Circle::rotate(Vector center, double angle)
{
data.center.rotate(center, angle);
calculateBorders();
}
-void RS_Circle::scale(Vector center, Vector factor)
+void Circle::scale(Vector center, Vector factor)
{
data.center.scale(center, factor);
data.radius *= factor.x;
calculateBorders();
}
-void RS_Circle::mirror(Vector axisPoint1, Vector axisPoint2)
+void Circle::mirror(Vector axisPoint1, Vector axisPoint2)
{
data.center.mirror(axisPoint1, axisPoint2);
calculateBorders();
}
-void RS_Circle::draw(PaintInterface * painter, GraphicView * view, double /*patternOffset*/)
+void Circle::draw(PaintInterface * painter, GraphicView * view, double /*patternOffset*/)
{
if (painter == NULL || view == NULL)
return;
}
// Pattern:
- RS_LineTypePattern * pat;
+ LineTypePattern * pat;
if (isSelected())
pat = &patternSelected;
return;
// Pen to draw pattern is always solid:
- RS_Pen pen = painter->getPen();
+ Pen pen = painter->getPen();
pen.setLineType(RS2::SolidLine);
painter->setPen(pen);
}
}
-void RS_Circle::moveRef(const Vector & ref, const Vector & offset)
+void Circle::moveRef(const Vector & ref, const Vector & offset)
{
Vector v1(data.radius, 0.0);
Vector v2(0.0, data.radius);
/**
* Dumps the circle's data to stdout.
*/
-std::ostream & operator<<(std::ostream & os, const RS_Circle & a)
+std::ostream & operator<<(std::ostream & os, const Circle & a)
{
os << " Circle: " << a.data << "\n";
return os;
}
-
/**
* Holds the data that defines a circle.
*/
-class RS_CircleData
+class CircleData
{
public:
- RS_CircleData()
+ CircleData()
{
}
- RS_CircleData(const Vector & center, double radius)
+ CircleData(const Vector & center, double radius)
{
this->center = center;
this->radius = radius;
return (center.valid && radius > RS_TOLERANCE);
}
- friend class RS_Circle;
+ friend class Circle;
- friend std::ostream & operator<<(std::ostream & os, const RS_CircleData & ad)
+ friend std::ostream & operator<<(std::ostream & os, const CircleData & ad)
{
os << "(" << ad.center << "/" << ad.radius << ")";
return os;
*
* @author Andrew Mustun
*/
-class RS_Circle: public RS_AtomicEntity
+class Circle: public AtomicEntity
{
public:
- RS_Circle(RS_EntityContainer * parent, const RS_CircleData & d);
- virtual ~RS_Circle();
+ Circle(EntityContainer * parent, const CircleData & d);
+ virtual ~Circle();
- virtual RS_Entity * clone();
+ virtual Entity * clone();
virtual RS2::EntityType rtti() const;
virtual bool isEdge() const;
- RS_CircleData getData();
+ CircleData getData();
virtual VectorSolutions getRefPoints();
virtual Vector getStartpoint() const;
virtual Vector getEndpoint() const;
bool createFrom3P(const Vector & p1, const Vector & p2, const Vector & p3);
virtual Vector getNearestEndpoint(const Vector & coord, double * dist = NULL);
virtual Vector getNearestPointOnEntity(const Vector & coord, bool onEntity = true,
- double * dist = NULL, RS_Entity ** entity = NULL);
+ double * dist = NULL, Entity ** entity = NULL);
virtual Vector getNearestCenter(const Vector & coord, double * dist = NULL);
virtual Vector getNearestMiddle(const Vector & coord, double * dist = NULL);
virtual Vector getNearestDist(double distance, const Vector & coord, double * dist = NULL);
virtual Vector getNearestDist(double distance, bool startp);
- virtual double getDistanceToPoint(const Vector & coord, RS_Entity ** entity = NULL, RS2::ResolveLevel level = RS2::ResolveNone, double solidDist = RS_MAXDOUBLE);
+ virtual double getDistanceToPoint(const Vector & coord, Entity ** entity = NULL, RS2::ResolveLevel level = RS2::ResolveNone, double solidDist = RS_MAXDOUBLE);
virtual void move(Vector offset);
virtual void rotate(Vector center, double angle);
virtual void moveRef(const Vector & ref, const Vector & offset);
virtual void draw(PaintInterface * painter, GraphicView * view, double patternOffset = 0.0);
- friend std::ostream & operator<<(std::ostream & os, const RS_Circle & a);
+ friend std::ostream & operator<<(std::ostream & os, const Circle & a);
virtual void calculateBorders();
protected:
- RS_CircleData data;
+ CircleData data;
};
#endif
// Who When What
// --- ---------- -----------------------------------------------------------
// JLH 05/28/2010 Added this text. :-)
+// JLH 09/09/2010 Removed implementation from header (where it DOESN'T
+// belong) and moved it here (where it DOES)
//
#include "clipboard.h"
+
#include "block.h"
#include "layer.h"
#include "entity.h"
-RS_Clipboard* RS_Clipboard::uniqueInstance = NULL;
-
-
+Clipboard * Clipboard::uniqueInstance = NULL;
-void RS_Clipboard::clear() {
+void Clipboard::clear()
+{
graphic.clear();
graphic.clearBlocks();
graphic.clearLayers();
graphic.clearVariables();
}
+void Clipboard::addBlock(Block * b)
+{
+ if (b)
+ graphic.addBlock(b, false);
+}
+bool Clipboard::hasBlock(const QString & name)
+{
+ return (graphic.findBlock(name) != NULL);
+}
+void Clipboard::addLayer(Layer * l)
+{
+ if (l)
+ graphic.addLayer(l);
+}
+bool Clipboard::hasLayer(const QString & name)
+{
+ return (graphic.findLayer(name) != NULL);
+}
-void RS_Clipboard::addBlock(RS_Block* b) {
- if (b!=NULL) {
- graphic.addBlock(b, false);
+void Clipboard::addEntity(Entity * e)
+{
+ if (e)
+ {
+ graphic.addEntity(e);
+ e->reparent(&graphic);
}
}
+/**
+ * Dumps the clipboard contents to stdout.
+ */
+std::ostream & operator<<(std::ostream & os, Clipboard & cb)
+{
+ os << "Clipboard: " << cb.graphic << "\n";
+ return os;
+}
-bool RS_Clipboard::hasBlock(const QString& name) {
- return (graphic.findBlock(name)!=NULL);
+Clipboard::Clipboard()
+{
}
+/**
+ * @return Instance to the unique clipboard object.
+ */
+/*static*/ Clipboard * Clipboard::instance()
+{
+ if (uniqueInstance == NULL)
+ uniqueInstance = new Clipboard();
-void RS_Clipboard::addLayer(RS_Layer* l) {
- if (l!=NULL) {
- //graphic.addLayer(l->clone());
- graphic.addLayer(l);
- }
+ return uniqueInstance;
}
+int Clipboard::countBlocks()
+{
+ return graphic.countBlocks();
+}
+Block * Clipboard::blockAt(int i)
+{
+ return graphic.blockAt(i);
+}
-bool RS_Clipboard::hasLayer(const QString& name) {
- return (graphic.findLayer(name)!=NULL);
+int Clipboard::countLayers()
+{
+ return graphic.countLayers();
}
+Layer * Clipboard::layerAt(int i)
+{
+ return graphic.layerAt(i);
+}
+uint Clipboard::count()
+{
+ return graphic.count();
+}
-void RS_Clipboard::addEntity(RS_Entity* e) {
- if (e!=NULL) {
- //graphic.addEntity(e->clone());
- graphic.addEntity(e);
- e->reparent(&graphic);
- }
+Entity * Clipboard::entityAt(uint i)
+{
+ return graphic.entityAt(i);
}
-/**
- * Dumps the clipboard contents to stdout.
- */
-std::ostream& operator << (std::ostream& os, RS_Clipboard& cb) {
- os << "Clipboard: " << cb.graphic << "\n";
+Entity * Clipboard::firstEntity()
+{
+ return graphic.firstEntity();
+}
- return os;
+Entity * Clipboard::nextEntity()
+{
+ return graphic.nextEntity();
}
+Drawing * Clipboard::getGraphic()
+{
+ return &graphic;
+}
#include <iostream>
#include "drawing.h"
-#define RS_CLIPBOARD RS_Clipboard::instance()
+#define CLIPBOARD Clipboard::instance()
-class RS_Block;
-class RS_Layer;
-class RS_Entity;
+class Block;
+class Layer;
+class Entity;
/**
* QCad internal clipboard. We don't use the system clipboard for
- * better portaility.
- * Implemented as singleton.
+ * better portability. Implemented as singleton.
*
+ * @author James Hammons
* @author Andrew Mustun
*/
-class RS_Clipboard {
-protected:
- RS_Clipboard() {
- }
-
-public:
- /**
- * @return Instance to the unique clipboard object.
- */
- static RS_Clipboard* instance() {
- if (uniqueInstance==NULL) {
- uniqueInstance = new RS_Clipboard();
- }
- return uniqueInstance;
- }
-
- void clear();
-
- void addBlock(RS_Block* b);
- bool hasBlock(const QString& name);
- int countBlocks() {
- return graphic.countBlocks();
- }
- RS_Block* blockAt(int i) {
- return graphic.blockAt(i);
- }
-
- void addLayer(RS_Layer* l);
- bool hasLayer(const QString& name);
- int countLayers() {
- return graphic.countLayers();
- }
- RS_Layer* layerAt(int i) {
- return graphic.layerAt(i);
- }
-
- void addEntity(RS_Entity* e);
-
- uint count() {
- return graphic.count();
- }
- RS_Entity* entityAt(uint i) {
- return graphic.entityAt(i);
- }
- RS_Entity* firstEntity() {
- return graphic.firstEntity();
- }
-
- RS_Entity* nextEntity() {
- return graphic.nextEntity();
- }
-
- Drawing* getGraphic() {
- return &graphic;
- }
-
- friend std::ostream& operator << (std::ostream& os, RS_Clipboard& cb);
-
-protected:
- static RS_Clipboard* uniqueInstance;
-
- Drawing graphic;
+class Clipboard
+{
+ protected:
+ Clipboard();
+
+ public:
+ static Clipboard * instance();
+
+ void clear();
+ void addBlock(Block * b);
+ bool hasBlock(const QString & name);
+ int countBlocks();
+ Block * blockAt(int i);
+ void addLayer(Layer* l);
+ bool hasLayer(const QString & name);
+ int countLayers();
+ Layer * layerAt(int i);
+ void addEntity(Entity * e);
+ uint count();
+ Entity * entityAt(uint i);
+ Entity * firstEntity();
+ Entity * nextEntity();
+ Drawing * getGraphic();
+
+ friend std::ostream & operator<<(std::ostream & os, Clipboard & cb);
+
+ protected:
+ static Clipboard * uniqueInstance;
+
+ Drawing graphic;
};
#endif
-
#include "color.h"
-#include "rs.h"
+#include "enums.h"
-RS_Color::RS_Color(): QColor(), RS_Flags()
+Color::Color(): QColor(), Flags()
{
}
-RS_Color::RS_Color(int r, int g, int b): QColor(r, g, b), RS_Flags()
+Color::Color(int r, int g, int b): QColor(r, g, b), Flags()
{
}
-RS_Color::RS_Color(const QColor & c): QColor(c), RS_Flags()
+Color::Color(const QColor & c): QColor(c), Flags()
{
}
-RS_Color::RS_Color(const RS_Color & c): QColor(c), RS_Flags()
+Color::Color(const Color & c): QColor(c), Flags()
{
setFlags(c.getFlags());
}
-RS_Color::RS_Color(unsigned int f): QColor(), RS_Flags(f)
+Color::Color(unsigned int f): QColor(), Flags(f)
{
}
/** @return A copy of this color without flags. */
-RS_Color RS_Color::stripFlags() const
+Color Color::stripFlags() const
{
- return RS_Color(red(), green(), blue());
+ return Color(red(), green(), blue());
}
/** @return true if the color is defined by layer. */
-bool RS_Color::isByLayer() const
+bool Color::isByLayer() const
{
return getFlag(RS2::FlagByLayer);
}
/** @return true if the color is defined by block. */
-bool RS_Color::isByBlock() const
+bool Color::isByBlock() const
{
return getFlag(RS2::FlagByBlock);
}
-RS_Color & RS_Color::operator=(const RS_Color & c)
+Color & Color::operator=(const Color & c)
{
setRgb(c.red(), c.green(), c.blue());
setFlags(c.getFlags());
return *this;
}
-bool RS_Color::operator==(const RS_Color & c) const
+bool Color::operator==(const Color & c) const
{
return (red() == c.red() && green() == c.green() && blue() == c.blue()
&& getFlags() == c.getFlags());
}
#if 0
-bool RS_Color::operator==(const QColor & c) const
+bool Color::operator==(const QColor & c) const
{
return (red() == c.red() && green() == c.green() && blue() == c.blue());
}
#endif
-/*friend*/ std::ostream & operator<<(std::ostream & os, const RS_Color & c)
+/*friend*/ std::ostream & operator<<(std::ostream & os, const Color & c)
{
os << " color: " << c.name().toLatin1().data()
<< " flags: " << (c.getFlag(RS2::FlagByLayer) ? "RS2::FlagByLayer " : "")
*
* @author Andrew Mustun
*/
-class RS_Color: public QColor, public RS_Flags
+class Color: public QColor, public Flags
{
public:
- RS_Color();
- RS_Color(int r, int g, int b);
- RS_Color(const QColor & c);
- RS_Color(const RS_Color & c);
- RS_Color(unsigned int f);
+ Color();
+ Color(int r, int g, int b);
+ Color(const QColor & c);
+ Color(const Color & c);
+ Color(unsigned int f);
- RS_Color stripFlags() const;
+ Color stripFlags() const;
bool isByLayer() const;
bool isByBlock() const;
- RS_Color & operator=(const RS_Color & c);
- bool operator==(const RS_Color & c) const;
+ Color & operator=(const Color & c);
+ bool operator==(const Color & c) const;
//no,can't bool operator==(const QColor & c) const;
- friend std::ostream & operator<<(std::ostream & os, const RS_Color & c);
+ friend std::ostream & operator<<(std::ostream & os, const Color & c);
};
#endif
*
* @param cmd the command that was triggered.
*/
-RS_CommandEvent::RS_CommandEvent(const QString & cmd)
+CommandEvent::CommandEvent(const QString & cmd)
{
this->cmd = cmd;
accepted = false;
* @return the command that was triggered, usually by
* the user.
*/
-QString RS_CommandEvent::getCommand()
+QString CommandEvent::getCommand()
{
return cmd;
}
/**
* Sets the event state to accepted.
*/
-void RS_CommandEvent::accept()
+void CommandEvent::accept()
{
accepted = true;
}
/**
* @return Whether the event was already accepted or not.
*/
-bool RS_CommandEvent::isAccepted()
+bool CommandEvent::isAccepted()
{
return accepted;
}
/**
* Command Events.
*/
-class RS_CommandEvent
+class CommandEvent
{
public:
- RS_CommandEvent(const QString & cmd);
+ CommandEvent(const QString & cmd);
QString getCommand();
void accept();
/**
* Constructor.
*/
-RS_ConstructionLine::RS_ConstructionLine(RS_EntityContainer * parent,
- const RS_ConstructionLineData & d): RS_AtomicEntity(parent), data(d)
+ConstructionLine::ConstructionLine(EntityContainer * parent,
+ const ConstructionLineData & d): AtomicEntity(parent), data(d)
{
calculateBorders();
}
/**
* Destructor.
*/
-RS_ConstructionLine::~RS_ConstructionLine()
+ConstructionLine::~ConstructionLine()
{
}
-RS_Entity * RS_ConstructionLine::clone()
+Entity * ConstructionLine::clone()
{
- RS_ConstructionLine * c = new RS_ConstructionLine(*this);
+ ConstructionLine * c = new ConstructionLine(*this);
c->initId();
return c;
}
/** @return RS2::EntityConstructionLine */
-/*virtual*/ RS2::EntityType RS_ConstructionLine::rtti() const
+/*virtual*/ RS2::EntityType ConstructionLine::rtti() const
{
return RS2::EntityConstructionLine;
}
* @todo
* @return Start point of the entity.
*/
-/*virtual*/ Vector RS_ConstructionLine::getStartpoint() const
+/*virtual*/ Vector ConstructionLine::getStartpoint() const
{
return Vector(false);
}
* @todo
* @return End point of the entity.
*/
-/*virtual*/ Vector RS_ConstructionLine::getEndpoint() const
+/*virtual*/ Vector ConstructionLine::getEndpoint() const
{
return Vector(false);
}
/** @return Copy of data that defines the line. */
-RS_ConstructionLineData RS_ConstructionLine::getData() const
+ConstructionLineData ConstructionLine::getData() const
{
return data;
}
/** @return First definition point. */
-Vector RS_ConstructionLine::getPoint1() const
+Vector ConstructionLine::getPoint1() const
{
return data.point1;
}
/** @return Second definition point. */
-Vector RS_ConstructionLine::getPoint2() const
+Vector ConstructionLine::getPoint2() const
{
return data.point2;
}
-void RS_ConstructionLine::calculateBorders()
+void ConstructionLine::calculateBorders()
{
minV = Vector::minimum(data.point1, data.point2);
maxV = Vector::maximum(data.point1, data.point2);
}
-Vector RS_ConstructionLine::getNearestEndpoint(const Vector & coord, double * dist)
+Vector ConstructionLine::getNearestEndpoint(const Vector & coord, double * dist)
{
double dist1, dist2;
Vector * nearerPoint;
return *nearerPoint;
}
-Vector RS_ConstructionLine::getNearestPointOnEntity(const Vector & coord,
- bool /*onEntity*/, double * /*dist*/, RS_Entity ** entity)
+Vector ConstructionLine::getNearestPointOnEntity(const Vector & coord,
+ bool /*onEntity*/, double * /*dist*/, Entity ** entity)
{
if (entity != NULL)
*entity = this;
return data.point1 + ba;
}
-Vector RS_ConstructionLine::getNearestCenter(const Vector & /*coord*/, double * dist)
+Vector ConstructionLine::getNearestCenter(const Vector & /*coord*/, double * dist)
{
if (dist != NULL)
*dist = RS_MAXDOUBLE;
return Vector(false);
}
-Vector RS_ConstructionLine::getNearestMiddle(const Vector & /*coord*/, double * dist)
+Vector ConstructionLine::getNearestMiddle(const Vector & /*coord*/, double * dist)
{
if (dist != NULL)
*dist = RS_MAXDOUBLE;
return Vector(false);
}
-Vector RS_ConstructionLine::getNearestDist(double /*distance*/, const Vector & /*coord*/,
+Vector ConstructionLine::getNearestDist(double /*distance*/, const Vector & /*coord*/,
double * dist)
{
if (dist != NULL)
return Vector(false);
}
-double RS_ConstructionLine::getDistanceToPoint(const Vector& coord,
- RS_Entity** entity,
+double ConstructionLine::getDistanceToPoint(const Vector& coord,
+ Entity** entity,
RS2::ResolveLevel /*level*/, double /*solidDist*/)
{
- RS_DEBUG->print("RS_ConstructionLine::getDistanceToPoint");
+ DEBUG->print("ConstructionLine::getDistanceToPoint");
if (entity != NULL)
*entity = this;
return dist;
// Orthogonal projection from both sides:
- Vector ba = ae * Vector::dotP(ae, ap) / RS_Math::pow(ae.magnitude(), 2);
- Vector be = ea * Vector::dotP(ea, ep) / RS_Math::pow(ea.magnitude(), 2);
+ Vector ba = ae * Vector::dotP(ae, ap) / Math::pow(ae.magnitude(), 2);
+ Vector be = ea * Vector::dotP(ea, ep) / Math::pow(ea.magnitude(), 2);
- RS_DEBUG->print("ba: %f", ba.magnitude());
- RS_DEBUG->print("ae: %f", ae.magnitude());
+ DEBUG->print("ba: %f", ba.magnitude());
+ DEBUG->print("ae: %f", ae.magnitude());
Vector cp = Vector::crossP(ap, ae);
dist = cp.magnitude() / ae.magnitude();
return dist;
}
-void RS_ConstructionLine::move(Vector offset)
+void ConstructionLine::move(Vector offset)
{
data.point1.move(offset);
data.point2.move(offset);
//calculateBorders();
}
-void RS_ConstructionLine::rotate(Vector center, double angle)
+void ConstructionLine::rotate(Vector center, double angle)
{
data.point1.rotate(center, angle);
data.point2.rotate(center, angle);
//calculateBorders();
}
-void RS_ConstructionLine::scale(Vector center, Vector factor)
+void ConstructionLine::scale(Vector center, Vector factor)
{
data.point1.scale(center, factor);
data.point2.scale(center, factor);
//calculateBorders();
}
-void RS_ConstructionLine::mirror(Vector axisPoint1, Vector axisPoint2)
+void ConstructionLine::mirror(Vector axisPoint1, Vector axisPoint2)
{
data.point1.mirror(axisPoint1, axisPoint2);
data.point2.mirror(axisPoint1, axisPoint2);
}
-/*virtual*/ void RS_ConstructionLine::draw(PaintInterface *, GraphicView *, double)
+/*virtual*/ void ConstructionLine::draw(PaintInterface *, GraphicView *, double)
{
}
/**
* Dumps the point's data to stdout.
*/
-std::ostream & operator<<(std::ostream & os, const RS_ConstructionLine & l)
+std::ostream & operator<<(std::ostream & os, const ConstructionLine & l)
{
os << " ConstructionLine: " << l.getData() << "\n";
return os;
* Holds the data that defines a construction line (a line
* which is not limited to both directions).
*/
-class RS_ConstructionLineData
+class ConstructionLineData
{
public:
/**
* Default constructor. Leaves the data object uninitialized.
*/
- RS_ConstructionLineData() {}
+ ConstructionLineData() {}
- RS_ConstructionLineData(const Vector & point1, const Vector & point2)
+ ConstructionLineData(const Vector & point1, const Vector & point2)
{
this->point1 = point1;
this->point2 = point2;
}
- friend class RS_ConstructionLine;
+ friend class ConstructionLine;
- friend std::ostream & operator<<(std::ostream & os, const RS_ConstructionLineData & ld)
+ friend std::ostream & operator<<(std::ostream & os, const ConstructionLineData & ld)
{
os << "(" << ld.point1 <<
"/" << ld.point2 <<
*
* @author Andrew Mustun
*/
-class RS_ConstructionLine: public RS_AtomicEntity
+class ConstructionLine: public AtomicEntity
{
public:
- RS_ConstructionLine(RS_EntityContainer * parent, const RS_ConstructionLineData & d);
- virtual ~RS_ConstructionLine();
+ ConstructionLine(EntityContainer * parent, const ConstructionLineData & d);
+ virtual ~ConstructionLine();
- virtual RS_Entity * clone();
+ virtual Entity * clone();
virtual RS2::EntityType rtti() const;
virtual Vector getStartpoint() const;
virtual Vector getEndpoint() const;
- RS_ConstructionLineData getData() const;
+ ConstructionLineData getData() const;
Vector getPoint1() const;
Vector getPoint2() const;
virtual Vector getNearestEndpoint(const Vector & coord, double * dist = NULL);
virtual Vector getNearestPointOnEntity(const Vector & coord,
- bool onEntity = true, double * dist = NULL, RS_Entity ** entity = NULL);
+ bool onEntity = true, double * dist = NULL, Entity ** entity = NULL);
virtual Vector getNearestCenter(const Vector & coord, double * dist = NULL);
virtual Vector getNearestMiddle(const Vector & coord, double * dist = NULL);
virtual Vector getNearestDist(double distance, const Vector & coord,
double * dist = NULL);
- virtual double getDistanceToPoint(const Vector & coord, RS_Entity ** entity = NULL,
+ virtual double getDistanceToPoint(const Vector & coord, Entity ** entity = NULL,
RS2::ResolveLevel level = RS2::ResolveNone, double solidDist = RS_MAXDOUBLE);
virtual void move(Vector offset);
virtual void rotate(Vector center, double angle);
virtual void draw(PaintInterface * /*painter*/, GraphicView * /*view*/,
double /*patternOffset*/);
- friend std::ostream & operator<<(std::ostream & os, const RS_ConstructionLine & l);
+ friend std::ostream & operator<<(std::ostream & os, const ConstructionLine & l);
virtual void calculateBorders();
protected:
- RS_ConstructionLineData data;
+ ConstructionLineData data;
};
#endif
* entities. Usually that's an Drawing entity but
* it can also be a polyline, text, ...
*/
-RS_Creation::RS_Creation(RS_EntityContainer * container, GraphicView * graphicView,
+Creation::Creation(EntityContainer * container, GraphicView * graphicView,
bool handleUndo)
{
this->container = container;
*
* @param p position
*/
-/*void RS_Creation::createPoint(const Vector& p) {
- entityContainer->addEntity(new RS_Point(entityContainer, p));
+/*void Creation::createPoint(const Vector& p) {
+ entityContainer->addEntity(new Point(entityContainer, p));
}*/
/**
* @param p1 start point
* @param p2 end point
*/
-/*void RS_Creation::createLine2P(const Vector& p1, const Vector& p2) {
- entityContainer->addEntity(new RS_Line(entityContainer,
- RS_LineData(p1, p2)));
+/*void Creation::createLine2P(const Vector& p1, const Vector& p2) {
+ entityContainer->addEntity(new Line(entityContainer,
+ LineData(p1, p2)));
}*/
/**
* @param p1 edge one
* @param p2 edge two
*/
-/*void RS_Creation::createRectangle(const Vector& e1, const Vector& e2) {
+/*void Creation::createRectangle(const Vector& e1, const Vector& e2) {
Vector e21(e2.x, e1.y);
Vector e12(e1.x, e2.y);
- entityContainer->addEntity(new RS_Line(entityContainer,
- RS_LineData(e1, e12)));
- entityContainer->addEntity(new RS_Line(entityContainer,
- RS_LineData(e12, e2)));
- entityContainer->addEntity(new RS_Line(entityContainer,
- RS_LineData(e2, e21)));
- entityContainer->addEntity(new RS_Line(entityContainer,
- RS_LineData(e21, e1)));
+ entityContainer->addEntity(new Line(entityContainer,
+ LineData(e1, e12)));
+ entityContainer->addEntity(new Line(entityContainer,
+ LineData(e12, e2)));
+ entityContainer->addEntity(new Line(entityContainer,
+ LineData(e2, e21)));
+ entityContainer->addEntity(new Line(entityContainer,
+ LineData(e21, e1)));
}*/
/**
*
* E.g.:<br>
* <code>
- * RS_Polyline *pl = creation.createPolyline(Vector(25.0, 55.0));<br>
+ * Polyline *pl = creation.createPolyline(Vector(25.0, 55.0));<br>
* pl->addVertex(Vector(50.0, 75.0));<br>
* </code>
*
* @param entities array of entities
* @param startPoint Start point of the polyline
*/
-/*RS_Polyline* RS_Creation::createPolyline(const Vector& startPoint) {
- RS_Polyline* pl = new RS_Polyline(entityContainer,
- RS_PolylineData(startPoint, Vector(0.0,0.0), 0));
+/*Polyline* Creation::createPolyline(const Vector& startPoint) {
+ Polyline* pl = new Polyline(entityContainer,
+ PolylineData(startPoint, Vector(0.0,0.0), 0));
entityContainer->addEntity(pl);
return pl;
}*/
* @return Pointer to the first created parallel or NULL if no
* parallel has been created.
*/
-RS_Entity * RS_Creation::createParallelThrough(const Vector & coord, int number, RS_Entity * e)
+Entity * Creation::createParallelThrough(const Vector & coord, int number, Entity * e)
{
if (e == NULL)
return NULL;
if (e->rtti() == RS2::EntityLine)
{
- RS_Line * l = (RS_Line *)e;
- RS_ConstructionLine cl(NULL, RS_ConstructionLineData(l->getStartpoint(),
+ Line * l = (Line *)e;
+ ConstructionLine cl(NULL, ConstructionLineData(l->getStartpoint(),
l->getEndpoint()));
dist = cl.getDistanceToPoint(coord);
}
* @return Pointer to the first created parallel or NULL if no
* parallel has been created.
*/
-RS_Entity* RS_Creation::createParallel(const Vector& coord,
+Entity* Creation::createParallel(const Vector& coord,
double distance, int number,
- RS_Entity* e) {
+ Entity* e) {
if (e==NULL) {
return NULL;
}
switch (e->rtti()) {
case RS2::EntityLine:
- return createParallelLine(coord, distance, number, (RS_Line*)e);
+ return createParallelLine(coord, distance, number, (Line*)e);
break;
case RS2::EntityArc:
- return createParallelArc(coord, distance, number, (RS_Arc*)e);
+ return createParallelArc(coord, distance, number, (Arc*)e);
break;
case RS2::EntityCircle:
- return createParallelCircle(coord, distance, number, (RS_Circle*)e);
+ return createParallelCircle(coord, distance, number, (Circle*)e);
break;
default:
* @return Pointer to the first created parallel or NULL if no
* parallel has been created.
*/
-RS_Line* RS_Creation::createParallelLine(const Vector& coord,
+Line* Creation::createParallelLine(const Vector& coord,
double distance, int number,
- RS_Line* e) {
+ Line* e) {
if (e==NULL) {
return NULL;
double ang = e->getAngle1() + M_PI/2.0;
Vector p1, p2;
- RS_LineData parallelData;
- RS_Line* ret = NULL;
+ LineData parallelData;
+ Line* ret = NULL;
if (document!=NULL && handleUndo) {
document->startUndoCycle();
p1 += e->getStartpoint();
p2.setPolar(distance*num, ang);
p2 += e->getEndpoint();
- RS_Line parallel1(NULL, RS_LineData(p1, p2));
+ Line parallel1(NULL, LineData(p1, p2));
// calculate 2nd parallel:
p1.setPolar(distance*num, ang+M_PI);
p1 += e->getStartpoint();
p2.setPolar(distance*num, ang+M_PI);
p2 += e->getEndpoint();
- RS_Line parallel2(NULL, RS_LineData(p1, p2));
+ Line parallel2(NULL, LineData(p1, p2));
double dist1 = parallel1.getDistanceToPoint(coord);
double dist2 = parallel2.getDistanceToPoint(coord);
}
- RS_Line* newLine = new RS_Line(container, parallelData);
+ Line* newLine = new Line(container, parallelData);
newLine->setLayerToActive();
newLine->setPenToActive();
if (ret==NULL) {
* @return Pointer to the first created parallel or NULL if no
* parallel has been created.
*/
-RS_Arc* RS_Creation::createParallelArc(const Vector& coord,
+Arc* Creation::createParallelArc(const Vector& coord,
double distance, int number,
- RS_Arc* e) {
+ Arc* e) {
if (e==NULL) {
return NULL;
}
- RS_ArcData parallelData;
- RS_Arc* ret = NULL;
+ ArcData parallelData;
+ Arc* ret = NULL;
bool inside = (e->getCenter().distanceTo(coord) < e->getRadius());
// calculate parallel:
bool ok = true;
- RS_Arc parallel1(NULL, e->getData());
+ Arc parallel1(NULL, e->getData());
parallel1.setRadius(e->getRadius() + distance*num);
if (parallel1.getRadius()<0.0) {
parallel1.setRadius(RS_MAXDOUBLE);
}
// calculate 2nd parallel:
- //RS_Arc parallel2(NULL, e->getData());
+ //Arc parallel2(NULL, e->getData());
//parallel2.setRadius(e->getRadius()+distance*num);
//double dist1 = parallel1.getDistanceToPoint(coord);
document->startUndoCycle();
}
- RS_Arc* newArc = new RS_Arc(container, parallelData);
+ Arc* newArc = new Arc(container, parallelData);
newArc->setLayerToActive();
newArc->setPenToActive();
if (ret==NULL) {
* @return Pointer to the first created parallel or NULL if no
* parallel has been created.
*/
-RS_Circle* RS_Creation::createParallelCircle(const Vector& coord,
+Circle* Creation::createParallelCircle(const Vector& coord,
double distance, int number,
- RS_Circle* e) {
+ Circle* e) {
if (e==NULL) {
return NULL;
}
- RS_CircleData parallelData;
- RS_Circle* ret = NULL;
+ CircleData parallelData;
+ Circle* ret = NULL;
bool inside = (e->getCenter().distanceTo(coord) < e->getRadius());
// calculate parallel:
bool ok = true;
- RS_Circle parallel1(NULL, e->getData());
+ Circle parallel1(NULL, e->getData());
parallel1.setRadius(e->getRadius() + distance*num);
if (parallel1.getRadius()<0.0) {
parallel1.setRadius(RS_MAXDOUBLE);
}
// calculate 2nd parallel:
- //RS_Circle parallel2(NULL, e->getData());
+ //Circle parallel2(NULL, e->getData());
//parallel2.setRadius(e->getRadius()+distance*num);
//double dist1 = parallel1.getDistanceToPoint(coord);
document->startUndoCycle();
}
- RS_Circle* newCircle = new RS_Circle(container, parallelData);
+ Circle* newCircle = new Circle(container, parallelData);
newCircle->setLayerToActive();
newCircle->setPenToActive();
if (ret==NULL) {
* @return Pointer to the first bisector created or NULL if no bisectors
* were created.
*/
-RS_Line * RS_Creation::createBisector(const Vector & coord1, const Vector & coord2,
- double length, int num, RS_Line * l1, RS_Line * l2)
+Line * Creation::createBisector(const Vector & coord1, const Vector & coord2,
+ double length, int num, Line * l1, Line * l2)
{
// check given entities:
if (!l1 || !l2 || l1->rtti() != RS2::EntityLine || l2->rtti() != RS2::EntityLine)
return NULL;
// intersection between entities:
- VectorSolutions sol = RS_Information::getIntersection(l1, l2, false);
+ VectorSolutions sol = Information::getIntersection(l1, l2, false);
Vector inters = sol.get(0);
if (!inters.valid)
double angle1 = inters.angleTo(l1->getNearestPointOnEntity(coord1));
double angle2 = inters.angleTo(l2->getNearestPointOnEntity(coord2));
- double angleDiff = RS_Math::getAngleDifference(angle1, angle2);
+ double angleDiff = Math::getAngleDifference(angle1, angle2);
if (angleDiff > M_PI)
angleDiff = angleDiff - 2 * M_PI;
- RS_Line * ret = NULL;
+ Line * ret = NULL;
if (document && handleUndo)
document->startUndoCycle();
double angle = angle1 + (angleDiff / (num + 1) * n);
Vector v;
v.setPolar(length, angle);
- RS_LineData d = RS_LineData(inters, inters + v);
- RS_Line * newLine = new RS_Line(container, d);
+ LineData d = LineData(inters, inters + v);
+ Line * newLine = new Line(container, d);
if (container)
{
* @param point Point.
* @param circle Circle, arc or ellipse entity.
*/
-RS_Line* RS_Creation::createTangent1(const Vector& coord,
+Line* Creation::createTangent1(const Vector& coord,
const Vector& point,
- RS_Entity* circle) {
- RS_Line* ret = NULL;
+ Entity* circle) {
+ Line* ret = NULL;
Vector circleCenter;
// check given entities:
}
if (circle->rtti()==RS2::EntityCircle) {
- circleCenter = ((RS_Circle*)circle)->getCenter();
+ circleCenter = ((Circle*)circle)->getCenter();
} else if (circle->rtti()==RS2::EntityArc) {
- circleCenter = ((RS_Arc*)circle)->getCenter();
+ circleCenter = ((Arc*)circle)->getCenter();
} else if (circle->rtti()==RS2::EntityEllipse) {
- circleCenter = ((RS_Ellipse*)circle)->getCenter();
+ circleCenter = ((Ellipse*)circle)->getCenter();
}
// the two tangent points:
Vector tCenter = (point + circleCenter)/2.0;
double tRadius = point.distanceTo(tCenter);
- RS_Circle tmp(NULL, RS_CircleData(tCenter, tRadius));
+ Circle tmp(NULL, CircleData(tCenter, tRadius));
// get the two intersection points which are the tangent points:
- sol = RS_Information::getIntersection(&tmp, circle, false);
+ sol = Information::getIntersection(&tmp, circle, false);
}
// calculate tangent points for ellipses:
else {
- RS_Ellipse* el = (RS_Ellipse*)circle;
+ Ellipse* el = (Ellipse*)circle;
sol.alloc(2);
//sol.set(0, circleCenter);
//sol.set(1, circleCenter);
}
// create all possible tangents:
- RS_Line* poss[2];
+ Line* poss[2];
- RS_LineData d;
+ LineData d;
- d = RS_LineData(sol.get(0), point);
- poss[0] = new RS_Line(NULL, d);
- d = RS_LineData(sol.get(1), point);
- poss[1] = new RS_Line(NULL, d);
+ d = LineData(sol.get(0), point);
+ poss[0] = new Line(NULL, d);
+ d = LineData(sol.get(1), point);
+ poss[1] = new Line(NULL, d);
// find closest tangent:
double minDist = RS_MAXDOUBLE;
// create the closest tangent:
if (idx!=-1) {
- RS_LineData d = poss[idx]->getData();
+ LineData d = poss[idx]->getData();
for (int i=0; i<2; ++i) {
delete poss[i];
document->startUndoCycle();
}
- ret = new RS_Line(container, d);
+ ret = new Line(container, d);
ret->setLayerToActive();
ret->setPenToActive();
if (container!=NULL) {
* @param circle1 1st circle or arc entity.
* @param circle2 2nd circle or arc entity.
*/
-RS_Line* RS_Creation::createTangent2(const Vector& coord,
- RS_Entity* circle1,
- RS_Entity* circle2) {
- RS_Line* ret = NULL;
+Line* Creation::createTangent2(const Vector& coord,
+ Entity* circle1,
+ Entity* circle2) {
+ Line* ret = NULL;
Vector circleCenter1;
Vector circleCenter2;
double circleRadius1 = 0.0;
}
if (circle1->rtti()==RS2::EntityCircle) {
- circleCenter1 = ((RS_Circle*)circle1)->getCenter();
- circleRadius1 = ((RS_Circle*)circle1)->getRadius();
+ circleCenter1 = ((Circle*)circle1)->getCenter();
+ circleRadius1 = ((Circle*)circle1)->getRadius();
} else if (circle1->rtti()==RS2::EntityArc) {
- circleCenter1 = ((RS_Arc*)circle1)->getCenter();
- circleRadius1 = ((RS_Arc*)circle1)->getRadius();
+ circleCenter1 = ((Arc*)circle1)->getCenter();
+ circleRadius1 = ((Arc*)circle1)->getRadius();
}
if (circle2->rtti()==RS2::EntityCircle) {
- circleCenter2 = ((RS_Circle*)circle2)->getCenter();
- circleRadius2 = ((RS_Circle*)circle2)->getRadius();
+ circleCenter2 = ((Circle*)circle2)->getCenter();
+ circleRadius2 = ((Circle*)circle2)->getRadius();
} else if (circle2->rtti()==RS2::EntityArc) {
- circleCenter2 = ((RS_Arc*)circle2)->getCenter();
- circleRadius2 = ((RS_Arc*)circle2)->getRadius();
+ circleCenter2 = ((Arc*)circle2)->getCenter();
+ circleRadius2 = ((Arc*)circle2)->getRadius();
}
// create all possible tangents:
- RS_Line* poss[4];
+ Line* poss[4];
for (int i=0; i<4; ++i) {
poss[i] = NULL;
}
- RS_LineData d;
+ LineData d;
double angle1 = circleCenter1.angleTo(circleCenter2);
double dist1 = circleCenter1.distanceTo(circleCenter2);
offs1.setPolar(circleRadius1, angt1);
offs2.setPolar(circleRadius2, angt1);
- d = RS_LineData(circleCenter1 + offs1,
+ d = LineData(circleCenter1 + offs1,
circleCenter2 + offs2);
- poss[0] = new RS_Line(NULL, d);
+ poss[0] = new Line(NULL, d);
offs1.setPolar(circleRadius1, angt2);
offs2.setPolar(circleRadius2, angt2);
- d = RS_LineData(circleCenter1 + offs1,
+ d = LineData(circleCenter1 + offs1,
circleCenter2 + offs2);
- poss[1] = new RS_Line(NULL, d);
+ poss[1] = new Line(NULL, d);
}
// inner tangents:
offs1.setPolar(circleRadius1, angt3);
offs2.setPolar(circleRadius2, angt3);
- d = RS_LineData(circleCenter1 - offs1,
+ d = LineData(circleCenter1 - offs1,
circleCenter2 + offs2);
- poss[2] = new RS_Line(NULL, d);
+ poss[2] = new Line(NULL, d);
offs1.setPolar(circleRadius1, angt4);
offs2.setPolar(circleRadius2, angt4);
- d = RS_LineData(circleCenter1 - offs1,
+ d = LineData(circleCenter1 - offs1,
circleCenter2 + offs2);
- poss[3] = new RS_Line(NULL, d);
+ poss[3] = new Line(NULL, d);
}
}
}
if (idx!=-1) {
- RS_LineData d = poss[idx]->getData();
+ LineData d = poss[idx]->getData();
for (int i=0; i<4; ++i) {
if (poss[i]!=NULL) {
delete poss[i];
document->startUndoCycle();
}
- ret = new RS_Line(container, d);
+ ret = new Line(container, d);
ret->setLayerToActive();
ret->setPenToActive();
if (container!=NULL) {
* @param angle Angle of the line relative to the angle of the basis entity.
* @param length Length of the line we're creating.
*/
-RS_Line* RS_Creation::createLineRelAngle(const Vector& coord,
- RS_Entity* entity,
+Line* Creation::createLineRelAngle(const Vector& coord,
+ Entity* entity,
double angle,
double length) {
switch (entity->rtti()) {
case RS2::EntityLine:
- a1 = ((RS_Line*)entity)->getAngle1();
+ a1 = ((Line*)entity)->getAngle1();
break;
case RS2::EntityArc:
- a1 = ((RS_Arc*)entity)->getCenter().angleTo(coord) + M_PI/2.0;
+ a1 = ((Arc*)entity)->getCenter().angleTo(coord) + M_PI/2.0;
break;
case RS2::EntityCircle:
- a1 = ((RS_Circle*)entity)->getCenter().angleTo(coord);
+ a1 = ((Circle*)entity)->getCenter().angleTo(coord);
break;
default:
// never reached
Vector v1;
v1.setPolar(length, a1);
- //RS_ConstructionLineData(coord-v1, coord+v1);
- RS_LineData d(coord-v1, coord+v1);
- RS_Line* ret;
+ //ConstructionLineData(coord-v1, coord+v1);
+ LineData d(coord-v1, coord+v1);
+ Line* ret;
if (document!=NULL && handleUndo) {
document->startUndoCycle();
}
- ret = new RS_Line(container, d);
+ ret = new Line(container, d);
ret->setLayerToActive();
ret->setPenToActive();
if (container!=NULL) {
* @param corner The first corner of the polygon
* @param number Number of edges / corners.
*/
-RS_Line* RS_Creation::createPolygon(const Vector& center,
+Line* Creation::createPolygon(const Vector& center,
const Vector& corner,
int number) {
return NULL;
}
- RS_Line* ret = NULL;
+ Line* ret = NULL;
if (document!=NULL && handleUndo) {
document->startUndoCycle();
Vector c1(false);
Vector c2 = corner;
- RS_Line* line;
+ Line* line;
for (int n=1; n<=number; ++n) {
c1 = c2;
c2 = c2.rotate(center, (M_PI*2)/number);
- line = new RS_Line(container, RS_LineData(c1, c2));
+ line = new Line(container, LineData(c1, c2));
line->setLayerToActive();
line->setPenToActive();
* @param corner2 The second corner of the polygon.
* @param number Number of edges / corners.
*/
-RS_Line* RS_Creation::createPolygon2(const Vector& corner1,
+Line* Creation::createPolygon2(const Vector& corner1,
const Vector& corner2,
int number) {
return NULL;
}
- RS_Line* ret = NULL;
+ Line* ret = NULL;
if (document!=NULL && handleUndo) {
document->startUndoCycle();
Vector c1(false);
Vector c2 = corner1;
Vector edge;
- RS_Line* line;
+ Line* line;
for (int n=1; n<=number; ++n) {
c1 = c2;
edge.setPolar(len, ang);
c2 = c1 + edge;
- line = new RS_Line(container, RS_LineData(c1, c2));
+ line = new Line(container, LineData(c1, c2));
line->setLayerToActive();
line->setPenToActive();
*
* @param data Insert data (position, block name, ..)
*/
-RS_Insert* RS_Creation::createInsert(RS_InsertData & data)
+Insert* Creation::createInsert(InsertData & data)
{
- RS_DEBUG->print("RS_Creation::createInsert");
+ DEBUG->print("Creation::createInsert");
if (document != NULL && handleUndo)
document->startUndoCycle();
- RS_Insert * ins = new RS_Insert(container, data);
+ Insert * ins = new Insert(container, data);
// inserts are also on layers
ins->setLayerToActive();
ins->setPenToActive();
if (graphicView != NULL)
graphicView->drawEntity(ins);
- RS_DEBUG->print("RS_Creation::createInsert: OK");
+ DEBUG->print("Creation::createInsert: OK");
return ins;
}
/**
* Creates an image with the given data.
*/
-RS_Image* RS_Creation::createImage(RS_ImageData& data) {
+Image* Creation::createImage(ImageData& data) {
if (document!=NULL && handleUndo) {
document->startUndoCycle();
}
- RS_Image* img = new RS_Image(container, data);
+ Image* img = new Image(container, data);
img->setLayerToActive();
img->setPenToActive();
img->update();
* @param name Block name
* @param remove true: remove existing entities, false: don't touch entities
*/
-RS_Block * RS_Creation::createBlock(const RS_BlockData & data,
+Block * Creation::createBlock(const BlockData & data,
const Vector & referencePoint, const bool remove)
{
// start undo cycle for the container if we're deleting the existing entities
document->startUndoCycle();
}
- RS_Block* block =
- new RS_Block(container,
- RS_BlockData(data.name, data.basePoint, data.frozen));
+ Block* block =
+ new Block(container,
+ BlockData(data.name, data.basePoint, data.frozen));
// copy entities into a block
- 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())
{
}
// add entity to block:
- RS_Entity * c = e->clone();
+ Entity * c = e->clone();
c->move(-referencePoint);
block->addEntity(c);
/**
* Inserts a library item from the given path into the drawing.
*/
-RS_Insert * RS_Creation::createLibraryInsert(RS_LibraryInsertData & data)
+Insert * Creation::createLibraryInsert(LibraryInsertData & data)
{
- RS_DEBUG->print("RS_Creation::createLibraryInsert");
+ DEBUG->print("Creation::createLibraryInsert");
Drawing g;
if (!g.open(data.file, RS2::FormatUnknown))
{
- RS_DEBUG->print(RS_Debug::D_WARNING, "RS_Creation::createLibraryInsert: Cannot open file: %s");
+ DEBUG->print(Debug::D_WARNING, "Creation::createLibraryInsert: Cannot open file: %s");
return NULL;
}
// unit conversion:
if (graphic != NULL)
{
- double uf = RS_Units::convert(1.0, g.getUnit(), graphic->getUnit());
+ double uf = Units::convert(1.0, g.getUnit(), graphic->getUnit());
g.scale(Vector(0.0, 0.0), Vector(uf, uf));
}
// QString s = QFileInfo(data.file).baseName(true);
QString s = QFileInfo(data.file).completeBaseName();
- RS_Modification m(*container, graphicView);
- m.paste(RS_PasteData(data.insertionPoint, data.factor, data.angle, true, s), &g);
+ Modification m(*container, graphicView);
+ m.paste(PasteData(data.insertionPoint, data.factor, data.angle, true, s), &g);
- RS_DEBUG->print("RS_Creation::createLibraryInsert: OK");
+ DEBUG->print("Creation::createLibraryInsert: OK");
return NULL;
}
#include <QtCore>
#include "vector.h"
-class RS_Arc;
-class RS_Block;
-class RS_BlockData;
-class RS_Circle;
-class RS_Document;
+class Arc;
+class Block;
+class BlockData;
+class Circle;
+class Document;
class Drawing;
-class RS_Entity;
-class RS_EntityContainer;
+class Entity;
+class EntityContainer;
class GraphicView;
-class RS_Image;
-class RS_ImageData;
-class RS_Insert;
-class RS_InsertData;
-class RS_Line;
+class Image;
+class ImageData;
+class Insert;
+class InsertData;
+class Line;
/**
* Data needed to insert library items.
*/
-struct RS_LibraryInsertData
+struct LibraryInsertData
{
QString file;
Vector insertionPoint;
*
* @author Andrew Mustun
*/
-class RS_Creation
+class Creation
{
public:
- RS_Creation(RS_EntityContainer * container, GraphicView * graphicView = NULL,
+ Creation(EntityContainer * container, GraphicView * graphicView = NULL,
bool handleUndo = true);
- RS_Entity * createParallelThrough(const Vector & coord, int number,
- RS_Entity * e);
+ Entity * createParallelThrough(const Vector & coord, int number,
+ Entity * e);
- RS_Entity * createParallel(const Vector & coord, double distance,
- int number, RS_Entity * e);
+ Entity * createParallel(const Vector & coord, double distance,
+ int number, Entity * e);
- RS_Line * createParallelLine(const Vector & coord, double distance, int number,
- RS_Line * e);
+ Line * createParallelLine(const Vector & coord, double distance, int number,
+ Line * e);
- RS_Arc * createParallelArc(const Vector & coord, double distance, int number,
- RS_Arc * e);
+ Arc * createParallelArc(const Vector & coord, double distance, int number,
+ Arc * e);
- RS_Circle * createParallelCircle(const Vector & coord, double distance, int number,
- RS_Circle * e);
+ Circle * createParallelCircle(const Vector & coord, double distance, int number,
+ Circle * e);
- RS_Line * createBisector(const Vector & coord1, const Vector & coord2, double length,
- int num, RS_Line * l1, RS_Line * l2);
+ Line * createBisector(const Vector & coord1, const Vector & coord2, double length,
+ int num, Line * l1, Line * l2);
- RS_Line * createTangent1(const Vector & coord, const Vector & point, RS_Entity * circle);
+ Line * createTangent1(const Vector & coord, const Vector & point, Entity * circle);
- RS_Line * createTangent2(const Vector & coord, RS_Entity * circle1, RS_Entity * circle2);
+ Line * createTangent2(const Vector & coord, Entity * circle1, Entity * circle2);
- RS_Line * createLineRelAngle(const Vector & coord, RS_Entity * entity,
+ Line * createLineRelAngle(const Vector & coord, Entity * entity,
double angle, double length);
- RS_Line * createPolygon(const Vector & center, const Vector & corner, int number);
+ Line * createPolygon(const Vector & center, const Vector & corner, int number);
- RS_Line * createPolygon2(const Vector & corner1, const Vector & corner2, int number);
+ Line * createPolygon2(const Vector & corner1, const Vector & corner2, int number);
- RS_Insert * createInsert(RS_InsertData & data);
+ Insert * createInsert(InsertData & data);
- RS_Image * createImage(RS_ImageData & data);
+ Image * createImage(ImageData & data);
- RS_Block * createBlock(const RS_BlockData & data, const Vector & referencePoint,
+ Block * createBlock(const BlockData & data, const Vector & referencePoint,
const bool remove);
- RS_Insert * createLibraryInsert(RS_LibraryInsertData & data);
+ Insert * createLibraryInsert(LibraryInsertData & data);
//void createPoint(const Vector& p);
//void createLine2P(const Vector& p1, const Vector& p2);
//void createRectangle(const Vector& e1, const Vector& e2);
- //RS_Polyline* createPolyline(const Vector& p);
+ //Polyline* createPolyline(const Vector& p);
protected:
- RS_EntityContainer * container;
+ EntityContainer * container;
Drawing * graphic;
- RS_Document * document;
+ Document * document;
GraphicView * graphicView;
bool handleUndo;
};
#include <stdarg.h>
#include "system.h"
-RS_Debug * RS_Debug::uniqueInstance = NULL;
+Debug * Debug::uniqueInstance = NULL;
/**
- * Gets the one and only RS_Debug instance
- * (creates a new one on first call only)
+ * Gets the one and only Debug instance (creates a new one on first call only)
*
- * @return Pointer to the single instance of this
- * singleton class
+ * @return Pointer to the single instance of this singleton class
*/
-RS_Debug * RS_Debug::instance()
+Debug * Debug::instance()
{
if (uniqueInstance == NULL)
{
nowStr = now.toString("yyyyMMdd_hhmmss");
QString fName = QString("debug_%1.log").arg(nowStr);
- uniqueInstance = new RS_Debug;
- //uniqueInstance->stream = fopen(fName.latin1(), "wt");
+ uniqueInstance = new Debug;
+// uniqueInstance->stream = fopen(fName.toAscii().data(), "wt");
// uniqueInstance->stream = stderr;
uniqueInstance->stream = stdout;
}
}
/**
- * Deletes the one and only RS_Debug instance.
+ * Deletes the one and only Debug instance.
*/
-void RS_Debug::deleteInstance()
+void Debug::deleteInstance()
{
- if (uniqueInstance != NULL)
+ if (uniqueInstance)
{
fclose(uniqueInstance->stream);
delete uniqueInstance;
/**
* Constructor for a point with default coordinates.
*/
-RS_Debug::RS_Debug()
+Debug::Debug()
{
debugLevel = D_DEBUGGING;
}
/**
* Sets the debugging level.
*/
-void RS_Debug::setLevel(RS_DebugLevel level)
+void Debug::setLevel(DebugLevel level)
{
debugLevel = level;
- print("RS_DEBUG: Warnings", D_WARNING);
- print("RS_DEBUG: Errors", D_ERROR);
- print("RS_DEBUG: Notice", D_NOTICE);
- print("RS_DEBUG: Informational", D_INFORMATIONAL);
- print("RS_DEBUG: Debugging", D_DEBUGGING);
+ print("DEBUG: Warnings", D_WARNING);
+ print("DEBUG: Errors", D_ERROR);
+ print("DEBUG: Notice", D_NOTICE);
+ print("DEBUG: Informational", D_INFORMATIONAL);
+ print("DEBUG: Debugging", D_DEBUGGING);
}
/**
* Gets the current debugging level.
*/
-RS_Debug::RS_DebugLevel RS_Debug::getLevel()
+Debug::DebugLevel Debug::getLevel()
{
return debugLevel;
}
/**
* Prints the given message to stdout.
*/
-void RS_Debug::print(const char * format ...)
+void Debug::print(const char * format ...)
{
if (debugLevel == D_DEBUGGING)
{
*
* @param level Debug level.
*/
-void RS_Debug::print(RS_DebugLevel level, const char * format ...)
+void Debug::print(DebugLevel level, const char * format ...)
{
if (debugLevel >= level)
{
/**
* Prints a time stamp in the format yyyyMMdd_hhmmss.
*/
-void RS_Debug::timestamp()
+void Debug::timestamp()
{
QDateTime now = QDateTime::currentDateTime();
QString nowStr = now.toString("yyyyMMdd_hh:mm:ss:zzz ");
- fprintf(stream, "%s", nowStr.toLatin1().data());
+ fprintf(stream, "%s", nowStr.toAscii().data());
fprintf(stream, "\n");
fflush(stream);
}
/**
* Prints the unicode for every character in the given string.
*/
-void RS_Debug::printUnicode(const QString & text)
+void Debug::printUnicode(const QString & text)
{
for(int i=0; i<(int)text.length(); i++)
- print("[%X] %c", text.at(i).unicode(), text.at(i).toLatin1());
+ print("[%X] %c", text.at(i).unicode(), text.at(i).toAscii());
}
-void RS_Debug::setStream(FILE * s)
+void Debug::setStream(FILE * s)
{
stream = s;
}
#include <stdio.h>
#include <QtCore>
-#define RS_DEBUG RS_Debug::instance()
+#define DEBUG Debug::instance()
/**
* Debugging facilities.
* @author James Hammons
* @author Andrew Mustun
*/
-class RS_Debug
+class Debug
{
public:
/**
* <li>D_DEBUGGING: very verbose
* </ul>
*/
- enum RS_DebugLevel { D_NOTHING,
- D_CRITICAL,
- D_ERROR,
- D_WARNING,
- D_NOTICE,
- D_INFORMATIONAL,
- D_DEBUGGING };
+ enum DebugLevel { D_NOTHING,
+ D_CRITICAL,
+ D_ERROR,
+ D_WARNING,
+ D_NOTICE,
+ D_INFORMATIONAL,
+ D_DEBUGGING };
private:
- RS_Debug();
+ Debug();
public:
- static RS_Debug * instance();
+ static Debug * instance();
static void deleteInstance();
- void setLevel(RS_DebugLevel level);
- RS_DebugLevel getLevel();
- void print(RS_DebugLevel level, const char * format ...);
+ void setLevel(DebugLevel level);
+ DebugLevel getLevel();
+ void print(DebugLevel level, const char * format ...);
void print(const char * format ...);
void printUnicode(const QString & text);
void timestamp();
void setStream(FILE * s);
private:
- static RS_Debug * uniqueInstance;
+ static Debug * uniqueInstance;
- RS_DebugLevel debugLevel;
+ DebugLevel debugLevel;
FILE * stream;
};
#include "debug.h"
-RS_DialogFactory * RS_DialogFactory::uniqueInstance = NULL;
+DialogFactory * DialogFactory::uniqueInstance = NULL;
/**
* Private constructor.
*/
-RS_DialogFactory::RS_DialogFactory()
+DialogFactory::DialogFactory()
{
- RS_DEBUG->print("RS_DialogFacgory::RS_DialogFactory");
+ DEBUG->print("DialogFacgory::DialogFactory");
factoryObject = NULL;
- RS_DEBUG->print("RS_DialogFacgory::RS_DialogFactory: OK");
+ DEBUG->print("DialogFacgory::DialogFactory: OK");
}
-/*virtual*/ RS_DialogFactory::~RS_DialogFactory()
+/*virtual*/ DialogFactory::~DialogFactory()
{
}
/**
* @return Instance to the unique font list.
*/
-RS_DialogFactory * RS_DialogFactory::instance()
+DialogFactory * DialogFactory::instance()
{
- RS_DEBUG->print("RS_DialogFactory::instance()");
+ DEBUG->print("DialogFactory::instance()");
if (uniqueInstance == NULL)
- uniqueInstance = new RS_DialogFactory();
+ uniqueInstance = new DialogFactory();
- RS_DEBUG->print("RS_DialogFactory::instance(): OK");
+ DEBUG->print("DialogFactory::instance(): OK");
return uniqueInstance;
}
/**
* Sets the real factory object that can create and show dialogs.
*/
-void RS_DialogFactory::setFactoryObject(RS_DialogFactoryInterface * fo)
+void DialogFactory::setFactoryObject(DialogFactoryInterface * fo)
{
- RS_DEBUG->print("RS_DialogFactory::setFactoryObject");
+ DEBUG->print("DialogFactory::setFactoryObject");
factoryObject = fo;
- RS_DEBUG->print("RS_DialogFactory::setFactoryObject: OK");
+ DEBUG->print("DialogFactory::setFactoryObject: OK");
}
/**
* @return Factory object. This is never NULL. If no factory
* object was set, the default adapter will be returned.
*/
-RS_DialogFactoryInterface * RS_DialogFactory::getFactoryObject()
+DialogFactoryInterface * DialogFactory::getFactoryObject()
{
- RS_DEBUG->print("RS_DialogFactory::getFactoryObject");
+ DEBUG->print("DialogFactory::getFactoryObject");
if (factoryObject != NULL)
{
- RS_DEBUG->print("RS_DialogFactory::getFactoryObject: returning factory object");
+ DEBUG->print("DialogFactory::getFactoryObject: returning factory object");
return factoryObject;
}
else
{
- RS_DEBUG->print("RS_DialogFactory::getFactoryObject: returning adapter");
+ DEBUG->print("DialogFactory::getFactoryObject: returning adapter");
return &factoryAdapter;
}
}
-void RS_DialogFactory::commandMessage(const QString & m)
+void DialogFactory::commandMessage(const QString & m)
{
- RS_DEBUG->print("RS_DialogFactory::commandMessage");
+ DEBUG->print("DialogFactory::commandMessage");
if (factoryObject != NULL)
factoryObject->commandMessage(m);
#include "dialogfactoryadapter.h"
-#define RS_DIALOGFACTORY RS_DialogFactory::instance()->getFactoryObject()
+#define DIALOGFACTORY DialogFactory::instance()->getFactoryObject()
-class RS_DialogFactoryInterface;
+class DialogFactoryInterface;
/**
* Interface for objects that can create and show dialogs.
*/
-class RS_DialogFactory
+class DialogFactory
{
private:
- RS_DialogFactory();
+ DialogFactory();
public:
- virtual ~RS_DialogFactory();
+ virtual ~DialogFactory();
- static RS_DialogFactory * instance();
+ static DialogFactory * instance();
- void setFactoryObject(RS_DialogFactoryInterface * fo);
- RS_DialogFactoryInterface * getFactoryObject();
+ void setFactoryObject(DialogFactoryInterface * fo);
+ DialogFactoryInterface * getFactoryObject();
void commandMessage(const QString & m);
private:
- RS_DialogFactoryInterface * factoryObject;
- RS_DialogFactoryAdapter factoryAdapter;
- static RS_DialogFactory * uniqueInstance;
+ DialogFactoryInterface * factoryObject;
+ DialogFactoryAdapter factoryAdapter;
+ static DialogFactory * uniqueInstance;
};
#endif // __DIALOGFACTORY_H__
#include "block.h"
#include "layer.h"
-class RS_BlockList;
-class RS_LayerList;
+class BlockList;
+class LayerList;
/**
* Adapter for dialog factory interface.
* Used when no factory object was set.
*/
-class RS_DialogFactoryAdapter: public RS_DialogFactoryInterface
+class DialogFactoryAdapter: public DialogFactoryInterface
{
public:
- RS_DialogFactoryAdapter() {}
- virtual ~RS_DialogFactoryAdapter() {}
+ DialogFactoryAdapter() {}
+ virtual ~DialogFactoryAdapter() {}
virtual void requestPreviousMenu() {}
virtual void requestWarningDialog(const QString &) {}
virtual GraphicView * requestNewDocument(const QString & = QString::null,
- RS_Document * = NULL) { return NULL; }
+ Document * = NULL) { return NULL; }
virtual void requestSimulationControls() {}
- virtual RS_Layer * requestNewLayerDialog(RS_LayerList * = NULL) { return NULL; }
- virtual RS_Layer * requestLayerRemovalDialog(RS_LayerList * = NULL) { return NULL; }
- virtual RS_Layer * requestEditLayerDialog(RS_LayerList * = NULL) { return NULL; }
- virtual RS_BlockData requestNewBlockDialog(RS_BlockList *) { return RS_BlockData(); }
- virtual RS_Block * requestBlockRemovalDialog(RS_BlockList *) { return NULL; }
- virtual RS_BlockData requestBlockAttributesDialog(RS_BlockList *) { return RS_BlockData(); }
- virtual void requestEditBlockWindow(RS_BlockList *) {}
- virtual void closeEditBlockWindow(RS_Block *) {}
+ virtual Layer * requestNewLayerDialog(LayerList * = NULL) { return NULL; }
+ virtual Layer * requestLayerRemovalDialog(LayerList * = NULL) { return NULL; }
+ virtual Layer * requestEditLayerDialog(LayerList * = NULL) { return NULL; }
+ virtual BlockData requestNewBlockDialog(BlockList *) { return BlockData(); }
+ virtual Block * requestBlockRemovalDialog(BlockList *) { return NULL; }
+ virtual BlockData requestBlockAttributesDialog(BlockList *) { return BlockData(); }
+ virtual void requestEditBlockWindow(BlockList *) {}
+ virtual void closeEditBlockWindow(Block *) {}
virtual QString requestImageOpenDialog() { return ""; }
virtual void requestOptions(ActionInterface *, bool, bool = false) {}
virtual void requestSnapDistOptions(double &, bool) {}
- virtual bool requestAttributesDialog(RS_AttributesData &, RS_LayerList &) { return false; }
- virtual bool requestMoveDialog(RS_MoveData &) { return false; }
- virtual bool requestRotateDialog(RS_RotateData &) { return false; }
- virtual bool requestScaleDialog(RS_ScaleData &) { return false; }
- virtual bool requestMirrorDialog(RS_MirrorData &) { return false; }
- virtual bool requestMoveRotateDialog(RS_MoveRotateData &) { return false; }
- virtual bool requestRotate2Dialog(RS_Rotate2Data &) { return false; }
+ virtual bool requestAttributesDialog(AttributesData &, LayerList &) { return false; }
+ virtual bool requestMoveDialog(MoveData &) { return false; }
+ virtual bool requestRotateDialog(RotateData &) { return false; }
+ virtual bool requestScaleDialog(ScaleData &) { return false; }
+ virtual bool requestMirrorDialog(MirrorData &) { return false; }
+ virtual bool requestMoveRotateDialog(MoveRotateData &) { return false; }
+ virtual bool requestRotate2Dialog(Rotate2Data &) { return false; }
virtual void requestToolBar(RS2::ToolBarId) {}
virtual void requestToolBarSelect(ActionInterface *, RS2::ActionType) {}
- virtual bool requestModifyEntityDialog(RS_Entity *) { return false; }
- virtual bool requestTextDialog(RS_Text *) { return false; }
- virtual bool requestHatchDialog(RS_Hatch *) { return false; }
+ virtual bool requestModifyEntityDialog(Entity *) { return false; }
+ virtual bool requestTextDialog(Text *) { return false; }
+ virtual bool requestHatchDialog(Hatch *) { return false; }
virtual void requestOptionsGeneralDialog() {}
virtual void requestOptionsDrawingDialog(Drawing &) {}
#ifdef RS_CAM
#define __DIALOGFACTORYINTERFACE_H__
#include <QtCore>
-#include "rs.h"
+#include "enums.h"
class ActionInterface;
-class RS_ArcData;
-class RS_AttributesData;
-class RS_BevelData;
-class RS_Block;
-class RS_BlockData;
-class RS_BlockList;
-class RS_CircleData;
-class RS_DimLinearData;
-class RS_DimensionData;
-class RS_Document;
+class ArcData;
+class AttributesData;
+class BevelData;
+class Block;
+class BlockData;
+class BlockList;
+class CircleData;
+class DimLinearData;
+class DimensionData;
+class Document;
class Drawing;
-class RS_Entity;
-class RS_EventHandler;
+class Entity;
+class EventHandler;
class GraphicView;
-class RS_Grid;
-class RS_Hatch;
-class RS_Insert;
-class RS_Layer;
-class RS_LayerList;
-class RS_MirrorData;
-class RS_MoveData;
-class RS_MoveRotateData;
-class RS_Painter;
-class RS_Rotate2Data;
-class RS_RotateData;
-class RS_RoundData;
-class RS_ScaleData;
-class RS_Solid;
-class RS_Text;
+class Grid;
+class Hatch;
+class Insert;
+class Layer;
+class LayerList;
+class MirrorData;
+class MoveData;
+class MoveRotateData;
+class Rotate2Data;
+class RotateData;
+class RoundData;
+class ScaleData;
+class Solid;
+class Text;
class Vector;
/**
* Interface for objects that can create and show dialogs.
*/
-class RS_DialogFactoryInterface
+class DialogFactoryInterface
{
public:
- RS_DialogFactoryInterface() {}
- virtual ~RS_DialogFactoryInterface() {}
+ DialogFactoryInterface() {}
+ virtual ~DialogFactoryInterface() {}
/**
* This virtual method must be overwritten and must show the previously
* is given.
*/
virtual GraphicView * requestNewDocument(const QString & fileName = QString::null,
- RS_Document * doc = NULL) = 0;
+ Document * doc = NULL) = 0;
/**
* This virtual method must be overwritten and must create or show
* to the newly created layer or NULL if the user
* cancels the dialog.
*/
- virtual RS_Layer * requestNewLayerDialog(RS_LayerList * layerList = NULL) = 0;
+ virtual Layer * requestNewLayerDialog(LayerList * layerList = NULL) = 0;
/**
* This virtual method must be overwritten and must provide
* to the layer which can ne removed or NULL if the user
* cancels the dialog.
*/
- virtual RS_Layer * requestLayerRemovalDialog(RS_LayerList * layerList = NULL) = 0;
+ virtual Layer * requestLayerRemovalDialog(LayerList * layerList = NULL) = 0;
/**
* This virtual method must be overwritten and must provide
* to the modified layer or NULL if the user
* cancels the dialog.
*/
- virtual RS_Layer * requestEditLayerDialog(RS_LayerList * layerList = NULL) = 0;
+ virtual Layer * requestEditLayerDialog(LayerList * layerList = NULL) = 0;
/**
* This virtual method must be overwritten and must provide
* to the newly created block or NULL if the user
* cancels the dialog.
*/
- virtual RS_BlockData requestNewBlockDialog(RS_BlockList * blockList) = 0;
+ virtual BlockData requestNewBlockDialog(BlockList * blockList) = 0;
/**
* This virtual method must be overwritten and must provide
* to the block which can be removed or NULL if the user
* cancels the dialog.
*/
- virtual RS_Block * requestBlockRemovalDialog(RS_BlockList * blockList) = 0;
+ virtual Block * requestBlockRemovalDialog(BlockList * blockList) = 0;
/**
* This virtual method must be overwritten and must provide
* to the block which was changed or NULL if the user
* cancels the dialog.
*/
- virtual RS_BlockData requestBlockAttributesDialog(RS_BlockList * blockList) = 0;
+ virtual BlockData requestBlockAttributesDialog(BlockList * blockList) = 0;
/**
* This virtual method must be overwritten and should provide
* a way to edit a block.
*/
- virtual void requestEditBlockWindow(RS_BlockList * blockList) = 0;
+ virtual void requestEditBlockWindow(BlockList * blockList) = 0;
- virtual void closeEditBlockWindow(RS_Block * block) = 0;
+ virtual void closeEditBlockWindow(Block * block) = 0;
/**
* This virtual method must be overwritten and must provide
* @param data Attribute data which can be directly changed
* by the presented widget.
*/
- virtual bool requestAttributesDialog(RS_AttributesData & data, RS_LayerList & layerList) = 0;
+ virtual bool requestAttributesDialog(AttributesData & data, LayerList & layerList) = 0;
/**
* This virtual method must be overwritten and must present
* @param data Move data which can be directly changed
* by the presented widget.
*/
- virtual bool requestMoveDialog(RS_MoveData & data) = 0;
+ virtual bool requestMoveDialog(MoveData & data) = 0;
/**
* This virtual method must be overwritten and must present
* @param data Rotation data which can be directly changed
* by the presented widget.
*/
- virtual bool requestRotateDialog(RS_RotateData & data) = 0;
+ virtual bool requestRotateDialog(RotateData & data) = 0;
/**
* This virtual method must be overwritten and must present
* @param data Scaling data which can be directly changed
* by the presented widget.
*/
- virtual bool requestScaleDialog(RS_ScaleData & data) = 0;
+ virtual bool requestScaleDialog(ScaleData & data) = 0;
/**
* This virtual method must be overwritten and must present
* @param data Mirror data which can be directly changed
* by the presented widget.
*/
- virtual bool requestMirrorDialog(RS_MirrorData & data) = 0;
+ virtual bool requestMirrorDialog(MirrorData & data) = 0;
/**
* This virtual method must be overwritten and must present
* @param data Move/rotate data which can be directly changed
* by the presented widget.
*/
- virtual bool requestMoveRotateDialog(RS_MoveRotateData & data) = 0;
+ virtual bool requestMoveRotateDialog(MoveRotateData & data) = 0;
/**
* This virtual method must be overwritten and must present
* @param data Rotate data which can be directly changed
* by the presented widget.
*/
- virtual bool requestRotate2Dialog(RS_Rotate2Data & data) = 0;
+ virtual bool requestRotate2Dialog(Rotate2Data & data) = 0;
/**
* This virtual method must be overwritten and must show
*
* @param entity Pointer to the entity.
*/
- virtual bool requestModifyEntityDialog(RS_Entity * entity) = 0;
+ virtual bool requestModifyEntityDialog(Entity * entity) = 0;
/**
* This virtual method must be overwritten and must present
*
* @param entity Pointer to the text entity.
*/
- virtual bool requestTextDialog(RS_Text * text) = 0;
+ virtual bool requestTextDialog(Text * text) = 0;
/**
* This virtual method must be overwritten and must present
*
* @param entity Pointer to the hatch entity.
*/
- virtual bool requestHatchDialog(RS_Hatch * hatch) = 0;
+ virtual bool requestHatchDialog(Hatch * hatch) = 0;
/**
* This virtual method must be overwritten and must present
* @para d Common dimension geometrical data.
* @para ed Extended geometrical data for aligned dimension.
*/
-RS_DimAligned::RS_DimAligned(RS_EntityContainer * parent, const RS_DimensionData & d,
- const RS_DimAlignedData & ed): RS_Dimension(parent, d), edata(ed)
+DimAligned::DimAligned(EntityContainer * parent, const DimensionData & d,
+ const DimAlignedData & ed): Dimension(parent, d), edata(ed)
{
calculateBorders();
}
-/*virtual*/ RS_DimAligned::~RS_DimAligned()
+/*virtual*/ DimAligned::~DimAligned()
{
}
-/*virtual*/ RS_Entity * RS_DimAligned::clone()
+/*virtual*/ Entity * DimAligned::clone()
{
- RS_DimAligned * d = new RS_DimAligned(*this);
+ DimAligned * d = new DimAligned(*this);
#warning "!!! Need to port setAutoDelete in QList/QMultiHash from Qt3 to Qt4 !!!"
// d->entities.setAutoDelete(entities.autoDelete());
d->initId();
}
/** @return RS2::EntityDimAligned */
-/*virtual*/ RS2::EntityType RS_DimAligned::rtti() const
+/*virtual*/ RS2::EntityType DimAligned::rtti() const
{
return RS2::EntityDimAligned;
}
* @return Copy of data that defines the aligned dimension.
* @see getData()
*/
-RS_DimAlignedData RS_DimAligned::getEData() const
+DimAlignedData DimAligned::getEData() const
{
return edata;
}
* Sets a new text. The entities representing the
* text are updated.
*/
-//void RS_DimAligned::setText(const QString& t) {
+//void DimAligned::setText(const QString& t) {
// data.text = t;
// update();
//}
-VectorSolutions RS_DimAligned::getRefPoints()
+VectorSolutions DimAligned::getRefPoints()
{
VectorSolutions ret(edata.extensionPoint1, edata.extensionPoint2,
data.definitionPoint, data.middleOfText);
* @return Automatically creted label for the default
* measurement of this dimension.
*/
-QString RS_DimAligned::getMeasuredLabel()
+QString DimAligned::getMeasuredLabel()
{
double dist = edata.extensionPoint1.distanceTo(edata.extensionPoint2);
Drawing * graphic = getGraphic();
if (graphic != NULL)
{
- ret = RS_Units::formatLinear(dist, graphic->getUnit(),
+ ret = Units::formatLinear(dist, graphic->getUnit(),
graphic->getLinearFormat(), graphic->getLinearPrecision());
}
else
*
* @param autoText Automatically reposition the text label
*/
-void RS_DimAligned::update(bool autoText)
+void DimAligned::update(bool autoText)
{
- RS_DEBUG->print("RS_DimAligned::update");
+ DEBUG->print("DimAligned::update");
clear();
double extLength = edata.extensionPoint2.distanceTo(data.definitionPoint);
Vector v1, v2, e1;
- RS_LineData ld;
- RS_Line * line;
+ LineData ld;
+ Line * line;
v1.setPolar(dimexo, extAngle);
v2.setPolar(dimexe, extAngle);
e1.setPolar(1.0, extAngle);
// Extension line 1:
- ld = RS_LineData(edata.extensionPoint1 + v1, edata.extensionPoint1 + e1 * extLength + v2);
- line = new RS_Line(this, ld);
+ ld = LineData(edata.extensionPoint1 + v1, edata.extensionPoint1 + e1 * extLength + v2);
+ line = new Line(this, ld);
//line->setLayerToActive();
//line->setPenToActive();
- line->setPen(RS_Pen(RS2::FlagInvalid));
+ line->setPen(Pen(RS2::FlagInvalid));
line->setLayer(NULL);
addEntity(line);
// Extension line 2:
- ld = RS_LineData(edata.extensionPoint2 + v1, edata.extensionPoint2 + e1 * extLength + v2);
- line = new RS_Line(this, ld);
+ ld = LineData(edata.extensionPoint2 + v1, edata.extensionPoint2 + e1 * extLength + v2);
+ line = new Line(this, ld);
//line->setLayerToActive();
//line->setPenToActive();
- line->setPen(RS_Pen(RS2::FlagInvalid));
+ line->setPen(Pen(RS2::FlagInvalid));
line->setLayer(NULL);
addEntity(line);
calculateBorders();
}
-Vector RS_DimAligned::getExtensionPoint1()
+Vector DimAligned::getExtensionPoint1()
{
return edata.extensionPoint1;
}
-Vector RS_DimAligned::getExtensionPoint2()
+Vector DimAligned::getExtensionPoint2()
{
return edata.extensionPoint2;
}
-bool RS_DimAligned::hasEndpointsWithinWindow(Vector v1, Vector v2)
+bool DimAligned::hasEndpointsWithinWindow(Vector v1, Vector v2)
{
return (edata.extensionPoint1.isInWindow(v1, v2)
|| edata.extensionPoint2.isInWindow(v1, v2));
}
-void RS_DimAligned::move(Vector offset)
+void DimAligned::move(Vector offset)
{
- RS_Dimension::move(offset);
+ Dimension::move(offset);
edata.extensionPoint1.move(offset);
edata.extensionPoint2.move(offset);
update();
}
-void RS_DimAligned::rotate(Vector center, double angle)
+void DimAligned::rotate(Vector center, double angle)
{
- RS_Dimension::rotate(center, angle);
+ Dimension::rotate(center, angle);
edata.extensionPoint1.rotate(center, angle);
edata.extensionPoint2.rotate(center, angle);
update();
}
-void RS_DimAligned::scale(Vector center, Vector factor)
+void DimAligned::scale(Vector center, Vector factor)
{
- RS_Dimension::scale(center, factor);
+ Dimension::scale(center, factor);
edata.extensionPoint1.scale(center, factor);
edata.extensionPoint2.scale(center, factor);
update();
}
-void RS_DimAligned::mirror(Vector axisPoint1, Vector axisPoint2)
+void DimAligned::mirror(Vector axisPoint1, Vector axisPoint2)
{
- RS_Dimension::mirror(axisPoint1, axisPoint2);
+ Dimension::mirror(axisPoint1, axisPoint2);
edata.extensionPoint1.mirror(axisPoint1, axisPoint2);
edata.extensionPoint2.mirror(axisPoint1, axisPoint2);
update();
}
-void RS_DimAligned::stretch(Vector firstCorner, Vector secondCorner, Vector offset)
+void DimAligned::stretch(Vector firstCorner, Vector secondCorner, Vector offset)
{
//e->calculateBorders();
if (getMin().isInWindow(firstCorner, secondCorner) && getMax().isInWindow(firstCorner, secondCorner))
double ang2 = edata.extensionPoint1.angleTo(edata.extensionPoint2) + M_PI / 2;
- double diff = RS_Math::getAngleDifference(ang1, ang2);
+ double diff = Math::getAngleDifference(ang1, ang2);
if (diff > M_PI)
{
if (fabs(diff) > M_PI / 2)
{
- ang2 = RS_Math::correctAngle(ang2 + M_PI);
+ ang2 = Math::correctAngle(ang2 + M_PI);
}
Vector v;
update(true);
}
-void RS_DimAligned::moveRef(const Vector & ref, const Vector & offset)
+void DimAligned::moveRef(const Vector & ref, const Vector & offset)
{
if (ref.distanceTo(data.definitionPoint) < 1.0e-4)
{
- RS_ConstructionLine l(NULL, RS_ConstructionLineData(edata.extensionPoint1,
+ ConstructionLine l(NULL, ConstructionLineData(edata.extensionPoint1,
edata.extensionPoint2));
double d = l.getDistanceToPoint(data.definitionPoint + offset);
double a = edata.extensionPoint2.angleTo(data.definitionPoint);
- double ad = RS_Math::getAngleDifference(a,
+ double ad = Math::getAngleDifference(a,
edata.extensionPoint2.angleTo(data.definitionPoint + offset));
if (fabs(ad) > M_PI / 2.0 && fabs(ad) < 3.0 / 2.0 * M_PI)
{
- a = RS_Math::correctAngle(a + M_PI);
+ a = Math::correctAngle(a + M_PI);
}
Vector v;
/**
* Dumps the point's data to stdout.
*/
-std::ostream & operator<<(std::ostream & os, const RS_DimAligned & d)
+std::ostream & operator<<(std::ostream & os, const DimAligned & d)
{
os << " DimAligned: " << d.getData() << "\n" << d.getEData() << "\n";
return os;
/**
* Holds the data that defines an aligned dimension entity.
*/
-class RS_DimAlignedData
+class DimAlignedData
{
public:
/**
* Default constructor. Leaves the data object uninitialized.
*/
- RS_DimAlignedData() {}
+ DimAlignedData() {}
/**
* Constructor with initialisation.
* @para extensionPoint2 Definition point. Startpoint of the
* second extension line.
*/
- RS_DimAlignedData(const Vector & extensionPoint1, const Vector & extensionPoint2)
+ DimAlignedData(const Vector & extensionPoint1, const Vector & extensionPoint2)
{
this->extensionPoint1 = extensionPoint1;
this->extensionPoint2 = extensionPoint2;
}
- friend class RS_DimAligned;
+ friend class DimAligned;
friend class ActionDimAligned;
- friend std::ostream & operator<<(std::ostream & os, const RS_DimAlignedData & dd)
+ friend std::ostream & operator<<(std::ostream & os, const DimAlignedData & dd)
{
os << "(" << dd.extensionPoint1 << "/" << dd.extensionPoint1 << ")";
return os;
*
* @author Andrew Mustun
*/
-class RS_DimAligned: public RS_Dimension
+class DimAligned: public Dimension
{
public:
- RS_DimAligned(RS_EntityContainer * parent, const RS_DimensionData & d, const RS_DimAlignedData & ed);
- virtual ~RS_DimAligned();
+ DimAligned(EntityContainer * parent, const DimensionData & d, const DimAlignedData & ed);
+ virtual ~DimAligned();
- virtual RS_Entity * clone();
+ virtual Entity * clone();
virtual RS2::EntityType rtti() const;
- RS_DimAlignedData getEData() const;
+ DimAlignedData getEData() const;
virtual VectorSolutions getRefPoints();
virtual QString getMeasuredLabel();
virtual void update(bool autoText = false);
virtual void stretch(Vector firstCorner, Vector secondCorner, Vector offset);
virtual void moveRef(const Vector & ref, const Vector & offset);
- friend std::ostream & operator<<(std::ostream & os, const RS_DimAligned & d);
+ friend std::ostream & operator<<(std::ostream & os, const DimAligned & d);
protected:
/** Extended data. */
- RS_DimAlignedData edata;
+ DimAlignedData edata;
};
#endif
* @para d Common dimension geometrical data.
* @para ed Extended geometrical data for angular dimension.
*/
-RS_DimAngular::RS_DimAngular(RS_EntityContainer * parent, const RS_DimensionData & d,
- const RS_DimAngularData & ed): RS_Dimension(parent, d), edata(ed)
+DimAngular::DimAngular(EntityContainer * parent, const DimensionData & d,
+ const DimAngularData & ed): Dimension(parent, d), edata(ed)
{
calculateBorders();
}
-/*virtual*/ RS_DimAngular::~RS_DimAngular()
+/*virtual*/ DimAngular::~DimAngular()
{
}
-/*virtual*/ RS_Entity * RS_DimAngular::clone()
+/*virtual*/ Entity * DimAngular::clone()
{
- RS_DimAngular * d = new RS_DimAngular(*this);
+ DimAngular * d = new DimAngular(*this);
#warning "!!! Need to deal with setAutoDelete() Qt3->Qt4 !!!"
// d->entities.setAutoDelete(entities.autoDelete());
d->initId();
}
/** @return RS2::EntityDimAngular */
-/*virtual*/ RS2::EntityType RS_DimAngular::rtti() const
+/*virtual*/ RS2::EntityType DimAngular::rtti() const
{
return RS2::EntityDimAngular;
}
* @return Copy of data that defines the angular dimension.
* @see getData()
*/
-RS_DimAngularData RS_DimAngular::getEData() const
+DimAngularData DimAngular::getEData() const
{
return edata;
}
* @return Automatically created label for the default
* measurement of this dimension.
*/
-QString RS_DimAngular::getMeasuredLabel()
+QString DimAngular::getMeasuredLabel()
{
QString ret;
int dimaunit = getGraphicVariableInt("$DIMAUNIT", 0);
int dimadec = getGraphicVariableInt("$DIMADEC", 0);
- ret = RS_Units::formatAngle(getAngle(),
- RS_FilterDXF::numberToAngleFormat(dimaunit),
+ ret = Units::formatAngle(getAngle(),
+ FilterDXF::numberToAngleFormat(dimaunit),
dimadec);
/*
ret = QString("%1%2")
- .arg(RS_Math::rad2deg(getAngle()))
+ .arg(Math::rad2deg(getAngle()))
.arg(RS_Char(0xB0));
*/
return ret;
/**
* @return Angle of the measured dimension.
*/
-double RS_DimAngular::getAngle() {
+double DimAngular::getAngle() {
double ang1 = 0.0;
double ang2 = 0.0;
bool reversed = false;
/**
* @return Center of the measured dimension.
*/
-Vector RS_DimAngular::getCenter() {
- RS_ConstructionLine l1(NULL, RS_ConstructionLineData(edata.definitionPoint1,
+Vector DimAngular::getCenter() {
+ ConstructionLine l1(NULL, ConstructionLineData(edata.definitionPoint1,
edata.definitionPoint2));
- RS_ConstructionLine l2(NULL, RS_ConstructionLineData(edata.definitionPoint3,
+ ConstructionLine l2(NULL, ConstructionLineData(edata.definitionPoint3,
data.definitionPoint));
- VectorSolutions vs = RS_Information::getIntersection(&l1, &l2, false);
+ VectorSolutions vs = Information::getIntersection(&l1, &l2, false);
return vs.get(0);
}
*
* @return true: on success
*/
-bool RS_DimAngular::getAngles(double& ang1, double& ang2, bool& reversed,
+bool DimAngular::getAngles(double& ang1, double& ang2, bool& reversed,
Vector& p1, Vector& p2) {
Vector center = getCenter();
// find out the angles this dimension refers to:
for (int f1=0; f1<=1 && !done; ++f1) {
- ang1 = RS_Math::correctAngle(
+ ang1 = Math::correctAngle(
edata.definitionPoint1.angleTo(edata.definitionPoint2) + f1*M_PI);
if (f1==0) {
p1 = edata.definitionPoint2;
p1 = edata.definitionPoint1;
}
for (int f2=0; f2<=1 && !done; ++f2) {
- ang2 = RS_Math::correctAngle(
+ ang2 = Math::correctAngle(
edata.definitionPoint3.angleTo(data.definitionPoint) + f2*M_PI);
if (f2==0) {
p2 = data.definitionPoint;
angDiff = ang1-ang2;
}
- ang1 = RS_Math::correctAngle(ang1);
- ang2 = RS_Math::correctAngle(ang2);
+ ang1 = Math::correctAngle(ang1);
+ ang2 = Math::correctAngle(ang2);
- if (RS_Math::isAngleBetween(ang, ang1, ang2, reversed) &&
+ if (Math::isAngleBetween(ang, ang1, ang2, reversed) &&
angDiff<=M_PI) {
done = true;
break;
*
* @param autoText Automatically reposition the text label
*/
-void RS_DimAngular::update(bool /*autoText*/) {
+void DimAngular::update(bool /*autoText*/) {
- RS_DEBUG->print("RS_DimAngular::update");
+ DEBUG->print("DimAngular::update");
clear();
double rad = edata.definitionPoint4.distanceTo(center);
- RS_Line* line;
+ Line* line;
Vector dir;
double len;
double dist;
dist = center.distanceTo(p1);
len = rad - dist + dimexe;
dir.setPolar(1.0, ang1);
- line = new RS_Line(this,
- RS_LineData(center + dir*dist + dir*dimexo,
+ line = new Line(this,
+ LineData(center + dir*dist + dir*dimexo,
center + dir*dist + dir*len));
- line->setPen(RS_Pen(RS2::FlagInvalid));
+ line->setPen(Pen(RS2::FlagInvalid));
line->setLayer(NULL);
addEntity(line);
dist = center.distanceTo(p2);
len = rad - dist + dimexe;
dir.setPolar(1.0, ang2);
- line = new RS_Line(this,
- RS_LineData(center + dir*dist + dir*dimexo,
+ line = new Line(this,
+ LineData(center + dir*dist + dir*dimexo,
center + dir*dist + dir*len));
- line->setPen(RS_Pen(RS2::FlagInvalid));
+ line->setPen(Pen(RS2::FlagInvalid));
line->setLayer(NULL);
addEntity(line);
// Create dimension line (arc):
- RS_Arc* arc = new RS_Arc(this,
- RS_ArcData(center,
+ Arc* arc = new Arc(this,
+ ArcData(center,
rad, ang1, ang2, reversed));
- arc->setPen(RS_Pen(RS2::FlagInvalid));
+ arc->setPen(Pen(RS2::FlagInvalid));
arc->setLayer(NULL);
addEntity(arc);
}
// Arrows:
- RS_SolidData sd;
- RS_Solid* arrow;
+ SolidData sd;
+ Solid* arrow;
// arrow 1
- arrow = new RS_Solid(this, sd);
+ arrow = new Solid(this, sd);
arrow->shapeArrow(arc->getStartpoint(),
arrowAngle1,
getArrowSize());
- arrow->setPen(RS_Pen(RS2::FlagInvalid));
+ arrow->setPen(Pen(RS2::FlagInvalid));
arrow->setLayer(NULL);
addEntity(arrow);
// arrow 2:
- arrow = new RS_Solid(this, sd);
+ arrow = new Solid(this, sd);
arrow->shapeArrow(arc->getEndpoint(),
arrowAngle2,
getArrowSize());
- arrow->setPen(RS_Pen(RS2::FlagInvalid));
+ arrow->setPen(Pen(RS2::FlagInvalid));
arrow->setLayer(NULL);
addEntity(arrow);
// text label:
- RS_TextData textData;
+ TextData textData;
Vector textPos = arc->getMiddlepoint();
Vector distV;
// move text away from dimension line:
textPos+=distV;
- textData = RS_TextData(textPos,
+ textData = TextData(textPos,
dimtxt, 30.0,
RS2::VAlignBottom,
RS2::HAlignCenter,
"standard",
textAngle);
- RS_Text* text = new RS_Text(this, textData);
+ Text* text = new Text(this, textData);
// move text to the side:
- text->setPen(RS_Pen(RS2::FlagInvalid));
+ text->setPen(Pen(RS2::FlagInvalid));
text->setLayer(NULL);
addEntity(text);
calculateBorders();
}
-Vector RS_DimAngular::getDefinitionPoint1()
+Vector DimAngular::getDefinitionPoint1()
{
return edata.definitionPoint1;
}
-Vector RS_DimAngular::getDefinitionPoint2()
+Vector DimAngular::getDefinitionPoint2()
{
return edata.definitionPoint2;
}
-Vector RS_DimAngular::getDefinitionPoint3()
+Vector DimAngular::getDefinitionPoint3()
{
return edata.definitionPoint3;
}
-Vector RS_DimAngular::getDefinitionPoint4()
+Vector DimAngular::getDefinitionPoint4()
{
return edata.definitionPoint4;
}
-void RS_DimAngular::move(Vector offset)
+void DimAngular::move(Vector offset)
{
- RS_Dimension::move(offset);
+ Dimension::move(offset);
edata.definitionPoint1.move(offset);
edata.definitionPoint2.move(offset);
-void RS_DimAngular::rotate(Vector center, double angle) {
- RS_Dimension::rotate(center, angle);
+void DimAngular::rotate(Vector center, double angle) {
+ Dimension::rotate(center, angle);
edata.definitionPoint1.rotate(center, angle);
edata.definitionPoint2.rotate(center, angle);
-void RS_DimAngular::scale(Vector center, Vector factor) {
- RS_Dimension::scale(center, factor);
+void DimAngular::scale(Vector center, Vector factor) {
+ Dimension::scale(center, factor);
edata.definitionPoint1.scale(center, factor);
edata.definitionPoint2.scale(center, factor);
-void RS_DimAngular::mirror(Vector axisPoint1, Vector axisPoint2) {
- RS_Dimension::mirror(axisPoint1, axisPoint2);
+void DimAngular::mirror(Vector axisPoint1, Vector axisPoint2) {
+ Dimension::mirror(axisPoint1, axisPoint2);
edata.definitionPoint1.mirror(axisPoint1, axisPoint2);
edata.definitionPoint2.mirror(axisPoint1, axisPoint2);
/**
* Dumps the point's data to stdout.
*/
-std::ostream& operator << (std::ostream& os, const RS_DimAngular& d) {
+std::ostream& operator << (std::ostream& os, const DimAngular& d) {
os << " DimAngular: " << d.getData() << "\n" << d.getEData() << "\n";
return os;
}
/**
* Holds the data that defines a angular dimension entity.
*/
-class RS_DimAngularData
+class DimAngularData
{
public:
/**
* Default constructor. Leaves the data object uninitialized.
*/
- RS_DimAngularData() {}
+ DimAngularData() {}
/**
* Constructor with initialisation.
* @param definitionPoint Definition point of the angular dimension.
* @param leader Leader length.
*/
- RS_DimAngularData(const Vector& definitionPoint1, const Vector& definitionPoint2,
+ DimAngularData(const Vector& definitionPoint1, const Vector& definitionPoint2,
const Vector& definitionPoint3, const Vector& definitionPoint4)
{
this->definitionPoint1 = definitionPoint1;
this->definitionPoint4 = definitionPoint4;
}
- friend std::ostream & operator<<(std::ostream& os, const RS_DimAngularData & dd)
+ friend std::ostream & operator<<(std::ostream& os, const DimAngularData & dd)
{
os << "(" << dd.definitionPoint1 << "/" << dd.definitionPoint2 << "/"
<< dd.definitionPoint3 << "/" << dd.definitionPoint3 << ")";
*
* @author Andrew Mustun
*/
-class RS_DimAngular: public RS_Dimension
+class DimAngular: public Dimension
{
public:
- RS_DimAngular(RS_EntityContainer * parent, const RS_DimensionData & d, const RS_DimAngularData & ed);
- virtual ~RS_DimAngular();
+ DimAngular(EntityContainer * parent, const DimensionData & d, const DimAngularData & ed);
+ virtual ~DimAngular();
- virtual RS_Entity * clone();
+ virtual Entity * clone();
virtual RS2::EntityType rtti() const;
- RS_DimAngularData getEData() const;
+ DimAngularData getEData() const;
virtual QString getMeasuredLabel();
double getAngle();
Vector getCenter();
virtual void scale(Vector center, Vector factor);
virtual void mirror(Vector axisPoint1, Vector axisPoint2);
- friend std::ostream & operator<<(std::ostream & os, const RS_DimAngular & d);
+ friend std::ostream & operator<<(std::ostream & os, const DimAngular & d);
protected:
/** Extended data. */
- RS_DimAngularData edata;
+ DimAngularData edata;
};
#endif
* @para d Common dimension geometrical data.
* @para ed Extended geometrical data for diametric dimension.
*/
-RS_DimDiametric::RS_DimDiametric(RS_EntityContainer * parent, const RS_DimensionData & d,
- const RS_DimDiametricData & ed): RS_Dimension(parent, d), edata(ed)
+DimDiametric::DimDiametric(EntityContainer * parent, const DimensionData & d,
+ const DimDiametricData & ed): Dimension(parent, d), edata(ed)
{
calculateBorders();
}
-/*virtual*/ RS_DimDiametric::~RS_DimDiametric()
+/*virtual*/ DimDiametric::~DimDiametric()
{
}
-/*virtual*/ RS_Entity * RS_DimDiametric::clone()
+/*virtual*/ Entity * DimDiametric::clone()
{
- RS_DimDiametric * d = new RS_DimDiametric(*this);
+ DimDiametric * d = new DimDiametric(*this);
#warning "!!! Need to deal with setAutoDelete() Qt3->Qt4 !!!"
// d->entities.setAutoDelete(entities.autoDelete());
d->initId();
}
/** @return RS2::EntityDimDiametric */
-/*virtual*/ RS2::EntityType RS_DimDiametric::rtti() const
+/*virtual*/ RS2::EntityType DimDiametric::rtti() const
{
return RS2::EntityDimDiametric;
}
* @return Copy of data that defines the diametric dimension.
* @see getData()
*/
-RS_DimDiametricData RS_DimDiametric::getEData() const
+DimDiametricData DimDiametric::getEData() const
{
return edata;
}
* @return Automatically created label for the default
* measurement of this dimension.
*/
-QString RS_DimDiametric::getMeasuredLabel()
+QString DimDiametric::getMeasuredLabel()
{
// Definitive dimension line:
double dist = data.definitionPoint.distanceTo(edata.definitionPoint);
QString ret;
if (graphic!=NULL) {
- ret = RS_Units::formatLinear(dist, graphic->getUnit(),
+ ret = Units::formatLinear(dist, graphic->getUnit(),
graphic->getLinearFormat(), graphic->getLinearPrecision());
}
else {
return ret;
}
-VectorSolutions RS_DimDiametric::getRefPoints()
+VectorSolutions DimDiametric::getRefPoints()
{
VectorSolutions ret(edata.definitionPoint, data.definitionPoint, data.middleOfText);
return ret;
*
* @param autoText Automatically reposition the text label
*/
-void RS_DimDiametric::update(bool autoText)
+void DimDiametric::update(bool autoText)
{
- RS_DEBUG->print("RS_DimDiametric::update");
+ DEBUG->print("DimDiametric::update");
clear();
if (isUndone())
calculateBorders();
}
-Vector RS_DimDiametric::getDefinitionPoint()
+Vector DimDiametric::getDefinitionPoint()
{
return edata.definitionPoint;
}
-double RS_DimDiametric::getLeader()
+double DimDiametric::getLeader()
{
return edata.leader;
}
-void RS_DimDiametric::move(Vector offset)
+void DimDiametric::move(Vector offset)
{
- RS_Dimension::move(offset);
+ Dimension::move(offset);
edata.definitionPoint.move(offset);
update();
}
-void RS_DimDiametric::rotate(Vector center, double angle)
+void DimDiametric::rotate(Vector center, double angle)
{
- RS_Dimension::rotate(center, angle);
+ Dimension::rotate(center, angle);
edata.definitionPoint.rotate(center, angle);
update();
}
-void RS_DimDiametric::scale(Vector center, Vector factor) {
- RS_Dimension::scale(center, factor);
+void DimDiametric::scale(Vector center, Vector factor) {
+ Dimension::scale(center, factor);
edata.definitionPoint.scale(center, factor);
edata.leader*=factor.x;
update();
}
-void RS_DimDiametric::mirror(Vector axisPoint1, Vector axisPoint2) {
- RS_Dimension::mirror(axisPoint1, axisPoint2);
+void DimDiametric::mirror(Vector axisPoint1, Vector axisPoint2) {
+ Dimension::mirror(axisPoint1, axisPoint2);
edata.definitionPoint.mirror(axisPoint1, axisPoint2);
update();
}
-void RS_DimDiametric::moveRef(const Vector& ref, const Vector& offset)
+void DimDiametric::moveRef(const Vector& ref, const Vector& offset)
{
if (ref.distanceTo(edata.definitionPoint)<1.0e-4) {
Vector c = (edata.definitionPoint + data.definitionPoint)/2.0;
/**
* Dumps the point's data to stdout.
*/
-std::ostream & operator<<(std::ostream & os, const RS_DimDiametric & d)
+std::ostream & operator<<(std::ostream & os, const DimDiametric & d)
{
os << " DimDiametric: " << d.getData() << "\n" << d.getEData() << "\n";
return os;
/**
* Holds the data that defines a diametric dimension entity.
*/
-class RS_DimDiametricData
+class DimDiametricData
{
public:
/**
* Default constructor. Leaves the data object uninitialized.
*/
- RS_DimDiametricData() {}
+ DimDiametricData() {}
/**
* Constructor with initialisation.
* @param definitionPoint Definition point of the diametric dimension.
* @param leader Leader length.
*/
- RS_DimDiametricData(const Vector& definitionPoint,
+ DimDiametricData(const Vector& definitionPoint,
double leader) {
this->definitionPoint = definitionPoint;
this->leader = leader;
}
- friend class RS_DimDiametric;
+ friend class DimDiametric;
//friend class RS_ActionDimDiametric;
- friend std::ostream & operator<<(std::ostream & os, const RS_DimDiametricData & dd)
+ friend std::ostream & operator<<(std::ostream & os, const DimDiametricData & dd)
{
os << "(" << dd.definitionPoint << "/" << dd.leader << ")";
return os;
*
* @author Andrew Mustun
*/
-class RS_DimDiametric: public RS_Dimension
+class DimDiametric: public Dimension
{
public:
- RS_DimDiametric(RS_EntityContainer * parent, const RS_DimensionData & d, const RS_DimDiametricData & ed);
- virtual ~RS_DimDiametric();
+ DimDiametric(EntityContainer * parent, const DimensionData & d, const DimDiametricData & ed);
+ virtual ~DimDiametric();
- virtual RS_Entity * clone();
+ virtual Entity * clone();
virtual RS2::EntityType rtti() const;
- RS_DimDiametricData getEData() const;
+ DimDiametricData getEData() const;
virtual VectorSolutions getRefPoints();
virtual QString getMeasuredLabel();
virtual void update(bool autoText=false);
virtual void mirror(Vector axisPoint1, Vector axisPoint2);
virtual void moveRef(const Vector & ref, const Vector & offset);
- friend std::ostream & operator<<(std::ostream & os, const RS_DimDiametric & d);
+ friend std::ostream & operator<<(std::ostream & os, const DimDiametric & d);
protected:
/** Extended data. */
- RS_DimDiametricData edata;
+ DimDiametricData edata;
};
#endif
/**
* Constructor.
*/
-RS_Dimension::RS_Dimension(RS_EntityContainer * parent, const RS_DimensionData & d):
- RS_EntityContainer(parent), data(d)
+Dimension::Dimension(EntityContainer * parent, const DimensionData & d):
+ EntityContainer(parent), data(d)
{
}
-/*virtual*/ RS_Dimension::~RS_Dimension()
+/*virtual*/ Dimension::~Dimension()
{
}
/** @return Copy of data that defines the dimension. */
-RS_DimensionData RS_Dimension::getData() const
+DimensionData Dimension::getData() const
{
return data;
}
-Vector RS_Dimension::getNearestRef(const Vector & coord, double * dist)
+Vector Dimension::getNearestRef(const Vector & coord, double * dist)
{
- return RS_Entity::getNearestRef(coord, dist);
+ return Entity::getNearestRef(coord, dist);
}
-Vector RS_Dimension::getNearestSelectedRef(const Vector & coord, double * dist)
+Vector Dimension::getNearestSelectedRef(const Vector & coord, double * dist)
{
- return RS_Entity::getNearestSelectedRef(coord, dist);
+ return Entity::getNearestSelectedRef(coord, dist);
}
/**
* label if appropriate.
* @see getMeasuredLabel
*/
-QString RS_Dimension::getLabel(bool resolve)
+QString Dimension::getLabel(bool resolve)
{
if (!resolve)
return data.text;
/**
* Sets a new text for the label.
*/
-void RS_Dimension::setLabel(const QString & l)
+void Dimension::setLabel(const QString & l)
{
data.text = l;
}
*
* @param forceAutoText Automatically reposition the text label.
*/
-void RS_Dimension::updateCreateDimensionLine(const Vector & p1,
+void Dimension::updateCreateDimensionLine(const Vector & p1,
const Vector & p2, bool arrow1, bool arrow2, bool forceAutoText)
{
#if 0
-printf("RS_Dimension::updateCreateDimensionLine()...\n");
+printf("Dimension::updateCreateDimensionLine()...\n");
#endif
// text height (DIMTXT)
double dimtxt = getTextHeight();
double arrowAngle1, arrowAngle2;
// Create dimension line:
- RS_Line * dimensionLine = new RS_Line(this, RS_LineData(p1, p2));
- dimensionLine->setPen(RS_Pen(RS2::FlagInvalid));
+ Line * dimensionLine = new Line(this, LineData(p1, p2));
+ dimensionLine->setPen(Pen(RS2::FlagInvalid));
dimensionLine->setLayer(NULL);
addEntity(dimensionLine);
}
// Arrows:
- RS_SolidData sd;
- RS_Solid * arrow;
+ SolidData sd;
+ Solid * arrow;
if (arrow1)
{
// arrow 1
- arrow = new RS_Solid(this, sd);
+ arrow = new Solid(this, sd);
arrow->shapeArrow(p1, arrowAngle1, getArrowSize());
- arrow->setPen(RS_Pen(RS2::FlagInvalid));
+ arrow->setPen(Pen(RS2::FlagInvalid));
arrow->setLayer(NULL);
addEntity(arrow);
}
if (arrow2)
{
// arrow 2:
- arrow = new RS_Solid(this, sd);
+ arrow = new Solid(this, sd);
arrow->shapeArrow(p2, arrowAngle2, getArrowSize());
- arrow->setPen(RS_Pen(RS2::FlagInvalid));
+ arrow->setPen(Pen(RS2::FlagInvalid));
arrow->setLayer(NULL);
addEntity(arrow);
}
// Text label:
- RS_TextData textData;
+ TextData textData;
Vector textPos;
double dimAngle1 = dimensionLine->getAngle1();
double textAngle;
bool corrected = false;
- textAngle = RS_Math::makeAngleReadable(dimAngle1, true, &corrected);
+ textAngle = Math::makeAngleReadable(dimAngle1, true, &corrected);
if (data.middleOfText.valid && !forceAutoText)
{
data.middleOfText = textPos;
}
- textData = RS_TextData(textPos, dimtxt, 30.0, RS2::VAlignMiddle, RS2::HAlignCenter,
+ textData = TextData(textPos, dimtxt, 30.0, RS2::VAlignMiddle, RS2::HAlignCenter,
RS2::LeftToRight, RS2::Exact, 1.0, getLabel(), "standard", textAngle);
#if 0
printf("--> %s\n", getLabel().toAscii().data());
#endif
- RS_Text * text = new RS_Text(this, textData);
+ Text * text = new Text(this, textData);
// move text to the side:
Vector distH;
text->move(distH);
}
- text->setPen(RS_Pen(RS2::FlagInvalid));
+ text->setPen(Pen(RS2::FlagInvalid));
text->setLayer(NULL);
addEntity(text);
}
-Vector RS_Dimension::getDefinitionPoint()
+Vector Dimension::getDefinitionPoint()
{
return data.definitionPoint;
}
-Vector RS_Dimension::getMiddleOfText()
+Vector Dimension::getMiddleOfText()
{
return data.middleOfText;
}
-RS2::VAlign RS_Dimension::getVAlign()
+RS2::VAlign Dimension::getVAlign()
{
return data.valign;
}
-RS2::HAlign RS_Dimension::getHAlign()
+RS2::HAlign Dimension::getHAlign()
{
return data.halign;
}
-RS2::TextLineSpacingStyle RS_Dimension::getLineSpacingStyle()
+RS2::TextLineSpacingStyle Dimension::getLineSpacingStyle()
{
return data.lineSpacingStyle;
}
-double RS_Dimension::getLineSpacingFactor()
+double Dimension::getLineSpacingFactor()
{
return data.lineSpacingFactor;
}
-QString RS_Dimension::getText()
+QString Dimension::getText()
{
return data.text;
}
-QString RS_Dimension::getStyle()
+QString Dimension::getStyle()
{
return data.style;
}
-double RS_Dimension::getAngle()
+double Dimension::getAngle()
{
return data.angle;
}
/**
* @return arrow size in drawing units.
*/
-double RS_Dimension::getArrowSize()
+double Dimension::getArrowSize()
{
return getGraphicVariable("$DIMASZ", 2.5, 40);
}
/**
* @return extension line overlength in drawing units.
*/
-double RS_Dimension::getExtensionLineExtension()
+double Dimension::getExtensionLineExtension()
{
return getGraphicVariable("$DIMEXE", 1.25, 40);
}
/**
* @return extension line offset from entities in drawing units.
*/
-double RS_Dimension::getExtensionLineOffset()
+double Dimension::getExtensionLineOffset()
{
return getGraphicVariable("$DIMEXO", 0.625, 40);
}
/**
* @return extension line gap to text in drawing units.
*/
-double RS_Dimension::getDimensionLineGap()
+double Dimension::getDimensionLineGap()
{
return getGraphicVariable("$DIMGAP", 0.625, 40);
}
/**
* @return Dimension lables text height.
*/
-double RS_Dimension::getTextHeight()
+double Dimension::getTextHeight()
{
return getGraphicVariable("$DIMTXT", 2.5, 40);
}
* If the variable is not found it is added with the given default
* value converted to the local unit.
*/
-double RS_Dimension::getGraphicVariable(const QString & key, double defMM, int code)
+double Dimension::getGraphicVariable(const QString & key, double defMM, int code)
{
double v = getGraphicVariableDouble(key, RS_MINDOUBLE);
if (v <= RS_MINDOUBLE)
{
- addGraphicVariable(key, RS_Units::convert(defMM, RS2::Millimeter, getGraphicUnit()),
+ addGraphicVariable(key, Units::convert(defMM, RS2::Millimeter, getGraphicUnit()),
code);
v = getGraphicVariableDouble(key, 1.0);
}
return v;
}
-/*virtual*/ double RS_Dimension::getLength()
+/*virtual*/ double Dimension::getLength()
{
return -1.0;
}
-void RS_Dimension::move(Vector offset)
+void Dimension::move(Vector offset)
{
data.definitionPoint.move(offset);
data.middleOfText.move(offset);
}
-void RS_Dimension::rotate(Vector center, double angle)
+void Dimension::rotate(Vector center, double angle)
{
data.definitionPoint.rotate(center, angle);
data.middleOfText.rotate(center, angle);
- data.angle = RS_Math::correctAngle(data.angle+angle);
+ data.angle = Math::correctAngle(data.angle+angle);
}
-void RS_Dimension::scale(Vector center, Vector factor)
+void Dimension::scale(Vector center, Vector factor)
{
data.definitionPoint.scale(center, factor);
data.middleOfText.scale(center, factor);
}
-void RS_Dimension::mirror(Vector axisPoint1, Vector axisPoint2)
+void Dimension::mirror(Vector axisPoint1, Vector axisPoint2)
{
data.definitionPoint.mirror(axisPoint1, axisPoint2);
data.middleOfText.mirror(axisPoint1, axisPoint2);
/**
* Holds the data that is common to all dimension entities.
*/
-class RS_DimensionData: public RS_Flags
+class DimensionData: public Flags
{
public:
/**
* Default constructor. Leaves the data object uninitialized.
*/
- RS_DimensionData() {}
+ DimensionData() {}
/**
* Constructor with initialisation.
* @param angle Rotation angle of dimension text away from
* default orientation.
*/
- RS_DimensionData(const Vector & definitionPoint,
+ DimensionData(const Vector & definitionPoint,
const Vector & middleOfText,
RS2::VAlign valign,
RS2::HAlign halign,
this->angle = angle;
}
- friend class RS_Dimension;
- friend class RS_DimAligned;
- friend class RS_DimLinear;
+ friend class Dimension;
+ friend class DimAligned;
+ friend class DimLinear;
friend class RS_ActionDimAligned;
friend class RS_ActionDimLinear;
- friend std::ostream & operator<<(std::ostream & os, const RS_DimensionData & dd)
+ friend std::ostream & operator<<(std::ostream & os, const DimensionData & dd)
{
os << "(" << dd.definitionPoint << ")";
return os;
*
* @author Andrew Mustun
*/
-class RS_Dimension: public RS_EntityContainer
+class Dimension: public EntityContainer
{
public:
- RS_Dimension(RS_EntityContainer * parent, const RS_DimensionData & d);
- virtual ~RS_Dimension();
+ Dimension(EntityContainer * parent, const DimensionData & d);
+ virtual ~Dimension();
- RS_DimensionData getData() const;
+ DimensionData getData() const;
Vector getNearestRef(const Vector & coord, double * dist);
Vector getNearestSelectedRef(const Vector & coord, double * dist);
QString getLabel(bool resolve = true);
protected:
/** Data common to all dimension entities. */
- RS_DimensionData data;
+ DimensionData data;
};
#endif
* @para d Common dimension geometrical data.
* @para ed Extended geometrical data for linear dimension.
*/
-RS_DimLinear::RS_DimLinear(RS_EntityContainer * parent, const RS_DimensionData & d,
- const RS_DimLinearData & ed): RS_Dimension(parent, d), edata(ed)
+DimLinear::DimLinear(EntityContainer * parent, const DimensionData & d,
+ const DimLinearData & ed): Dimension(parent, d), edata(ed)
{
calculateBorders();
}
-/*virtual*/ RS_DimLinear::~RS_DimLinear()
+/*virtual*/ DimLinear::~DimLinear()
{
}
-/*virtual*/ RS_Entity * RS_DimLinear::clone()
+/*virtual*/ Entity * DimLinear::clone()
{
- RS_DimLinear * d = new RS_DimLinear(*this);
+ DimLinear * d = new DimLinear(*this);
#warning "!!! Need to deal with setAutoDelete() Qt3->Qt4 !!!"
// d->entities.setAutoDelete(entities.autoDelete());
d->initId();
}
/** @return RS2::EntityDimLinear */
-/*virtual*/ RS2::EntityType RS_DimLinear::rtti() const
+/*virtual*/ RS2::EntityType DimLinear::rtti() const
{
return RS2::EntityDimLinear;
}
* @return Copy of data that defines the linear dimension.
* @see getData()
*/
-RS_DimLinearData RS_DimLinear::getEData() const
+DimLinearData DimLinear::getEData() const
{
return edata;
}
-VectorSolutions RS_DimLinear::getRefPoints()
+VectorSolutions DimLinear::getRefPoints()
{
VectorSolutions ret(edata.extensionPoint1, edata.extensionPoint2,
data.definitionPoint, data.middleOfText);
* @return Automatically created label for the default
* measurement of this dimension.
*/
-QString RS_DimLinear::getMeasuredLabel()
+QString DimLinear::getMeasuredLabel()
{
// direction of dimension line
Vector dirDim;
dirDim.setPolar(100.0, edata.angle);
// construction line for dimension line
- RS_ConstructionLine dimLine(NULL, RS_ConstructionLineData(data.definitionPoint,
+ ConstructionLine dimLine(NULL, ConstructionLineData(data.definitionPoint,
data.definitionPoint + dirDim));
Vector dimP1 = dimLine.getNearestPointOnEntity(edata.extensionPoint1);
QString ret;
if (graphic)
- ret = RS_Units::formatLinear(dist, graphic->getUnit(),
+ ret = Units::formatLinear(dist, graphic->getUnit(),
graphic->getLinearFormat(), graphic->getLinearPrecision());
else
ret = QString("%1").arg(dist);
//It's properly creating the label...
-//printf("RS_DimLinear::getMeasuredLabel: label=\"%s\"\n", ret.toAscii().data());
+//printf("DimLinear::getMeasuredLabel: label=\"%s\"\n", ret.toAscii().data());
return ret;
}
-bool RS_DimLinear::hasEndpointsWithinWindow(Vector v1, Vector v2)
+bool DimLinear::hasEndpointsWithinWindow(Vector v1, Vector v2)
{
return (edata.extensionPoint1.isInWindow(v1, v2)
|| edata.extensionPoint2.isInWindow(v1, v2));
*
* @param autoText Automatically reposition the text label
*/
-void RS_DimLinear::update(bool autoText)
+void DimLinear::update(bool autoText)
{
- RS_DEBUG->print("RS_DimLinear::update");
+ DEBUG->print("DimLinear::update");
clear();
// extension line extension (DIMEXE)
double dimexe = getExtensionLineExtension();
- RS_LineData ld;
+ LineData ld;
double extAngle = edata.angle + (M_PI / 2.0);
// direction of dimension line
dirExt.setPolar(100.0, extAngle);
// construction line for dimension line
- RS_ConstructionLine dimLine(NULL, RS_ConstructionLineData(data.definitionPoint,
+ ConstructionLine dimLine(NULL, ConstructionLineData(data.definitionPoint,
data.definitionPoint + dirDim));
Vector dimP1 = dimLine.getNearestPointOnEntity(edata.extensionPoint1);
// Definitive dimension line:
updateCreateDimensionLine(dimP1, dimP2, true, true, autoText);
/*
- ld = RS_LineData(data.definitionPoint, dimP1);
- RS_Line* dimensionLine = new RS_Line(this, ld);
+ ld = LineData(data.definitionPoint, dimP1);
+ Line* dimensionLine = new Line(this, ld);
addEntity(dimensionLine);
*/
Vector vDimexo1, vDimexe1, vDimexo2, vDimexe2;
}
// extension lines:
- ld = RS_LineData(edata.extensionPoint1 + vDimexo1, dimP1 + vDimexe1);
- RS_Line * line = new RS_Line(this, ld);
- line->setPen(RS_Pen(RS2::FlagInvalid));
+ ld = LineData(edata.extensionPoint1 + vDimexo1, dimP1 + vDimexe1);
+ Line * line = new Line(this, ld);
+ line->setPen(Pen(RS2::FlagInvalid));
line->setLayer(NULL);
addEntity(line);
- ld = RS_LineData(edata.extensionPoint2 + vDimexo2, dimP2 + vDimexe2);
+ ld = LineData(edata.extensionPoint2 + vDimexo2, dimP2 + vDimexe2);
//data.definitionPoint+vDimexe2);
- line = new RS_Line(this, ld);
- line->setPen(RS_Pen(RS2::FlagInvalid));
+ line = new Line(this, ld);
+ line->setPen(Pen(RS2::FlagInvalid));
line->setLayer(NULL);
addEntity(line);
calculateBorders();
}
-Vector RS_DimLinear::getExtensionPoint1()
+Vector DimLinear::getExtensionPoint1()
{
return edata.extensionPoint1;
}
-Vector RS_DimLinear::getExtensionPoint2()
+Vector DimLinear::getExtensionPoint2()
{
return edata.extensionPoint2;
}
-double RS_DimLinear::getAngle()
+double DimLinear::getAngle()
{
return edata.angle;
}
-void RS_DimLinear::setAngle(double a)
+void DimLinear::setAngle(double a)
{
- edata.angle = RS_Math::correctAngle(a);
+ edata.angle = Math::correctAngle(a);
}
-double RS_DimLinear::getOblique()
+double DimLinear::getOblique()
{
return edata.oblique;
}
-void RS_DimLinear::move(Vector offset)
+void DimLinear::move(Vector offset)
{
- RS_Dimension::move(offset);
+ Dimension::move(offset);
edata.extensionPoint1.move(offset);
edata.extensionPoint2.move(offset);
update();
}
-void RS_DimLinear::rotate(Vector center, double angle)
+void DimLinear::rotate(Vector center, double angle)
{
- RS_Dimension::rotate(center, angle);
+ Dimension::rotate(center, angle);
edata.extensionPoint1.rotate(center, angle);
edata.extensionPoint2.rotate(center, angle);
- edata.angle = RS_Math::correctAngle(edata.angle+angle);
+ edata.angle = Math::correctAngle(edata.angle+angle);
update();
}
-void RS_DimLinear::scale(Vector center, Vector factor)
+void DimLinear::scale(Vector center, Vector factor)
{
- RS_Dimension::scale(center, factor);
+ Dimension::scale(center, factor);
edata.extensionPoint1.scale(center, factor);
edata.extensionPoint2.scale(center, factor);
update();
}
-void RS_DimLinear::mirror(Vector axisPoint1, Vector axisPoint2)
+void DimLinear::mirror(Vector axisPoint1, Vector axisPoint2)
{
- RS_Dimension::mirror(axisPoint1, axisPoint2);
+ Dimension::mirror(axisPoint1, axisPoint2);
edata.extensionPoint1.mirror(axisPoint1, axisPoint2);
edata.extensionPoint2.mirror(axisPoint1, axisPoint2);
update();
}
-void RS_DimLinear::stretch(Vector firstCorner, Vector secondCorner, Vector offset)
+void DimLinear::stretch(Vector firstCorner, Vector secondCorner, Vector offset)
{
//e->calculateBorders();
if (getMin().isInWindow(firstCorner, secondCorner)
double ang2 = edata.extensionPoint1.angleTo(edata.extensionPoint2)
+ M_PI/2;
- double diff = RS_Math::getAngleDifference(ang1, ang2);
+ double diff = Math::getAngleDifference(ang1, ang2);
if (diff>M_PI) {
diff-=2*M_PI;
}
if (fabs(diff)>M_PI/2) {
- ang2 = RS_Math::correctAngle(ang2+M_PI);
+ ang2 = Math::correctAngle(ang2+M_PI);
}
Vector v;
update(true);
}
-void RS_DimLinear::moveRef(const Vector & ref, const Vector & offset)
+void DimLinear::moveRef(const Vector & ref, const Vector & offset)
{
if (ref.distanceTo(data.definitionPoint) < 1.0e-4)
{
/**
* Dumps the point's data to stdout.
*/
-std::ostream & operator<<(std::ostream & os, const RS_DimLinear & d)
+std::ostream & operator<<(std::ostream & os, const DimLinear & d)
{
os << " DimLinear: " << d.getData() << "\n" << d.getEData() << "\n";
return os;
/**
* Holds the data that defines a linear dimension entity.
*/
-class RS_DimLinearData
+class DimLinearData
{
public:
/**
* Default constructor. Leaves the data object uninitialized.
*/
- RS_DimLinearData() {}
+ DimLinearData() {}
/**
* Constructor with initialisation.
* @param angle Rotation angle in rad.
* @param oblique Oblique angle in rad.
*/
- RS_DimLinearData(const Vector & extensionPoint1,
+ DimLinearData(const Vector & extensionPoint1,
const Vector & extensionPoint2,
double angle, double oblique)
{
this->oblique = oblique;
}
- friend class RS_DimLinear;
+ friend class DimLinear;
friend class RS_ActionDimLinear;
- friend std::ostream & operator<<(std::ostream & os, const RS_DimLinearData & dd)
+ friend std::ostream & operator<<(std::ostream & os, const DimLinearData & dd)
{
os << "(" << dd.extensionPoint1 << "/" << dd.extensionPoint1 << ")";
return os;
*
* @author Andrew Mustun
*/
-class RS_DimLinear: public RS_Dimension
+class DimLinear: public Dimension
{
public:
- RS_DimLinear(RS_EntityContainer * parent, const RS_DimensionData & d, const RS_DimLinearData & ed);
- virtual ~RS_DimLinear();
+ DimLinear(EntityContainer * parent, const DimensionData & d, const DimLinearData & ed);
+ virtual ~DimLinear();
- virtual RS_Entity * clone();
+ virtual Entity * clone();
virtual RS2::EntityType rtti() const;
- RS_DimLinearData getEData() const;
+ DimLinearData getEData() const;
virtual VectorSolutions getRefPoints();
virtual QString getMeasuredLabel();
virtual void update(bool autoText = false);
virtual void stretch(Vector firstCorner, Vector secondCorner, Vector offset);
virtual void moveRef(const Vector & ref, const Vector & offset);
- friend std::ostream & operator<<(std::ostream & os, const RS_DimLinear & d);
+ friend std::ostream & operator<<(std::ostream & os, const DimLinear & d);
protected:
/** Extended data. */
- RS_DimLinearData edata;
+ DimLinearData edata;
};
#endif
* @para d Common dimension geometrical data.
* @para ed Extended geometrical data for radial dimension.
*/
-RS_DimRadial::RS_DimRadial(RS_EntityContainer * parent, const RS_DimensionData & d,
- const RS_DimRadialData & ed): RS_Dimension(parent, d), edata(ed)
+DimRadial::DimRadial(EntityContainer * parent, const DimensionData & d,
+ const DimRadialData & ed): Dimension(parent, d), edata(ed)
{
}
-/*virtual*/ RS_DimRadial::~RS_DimRadial()
+/*virtual*/ DimRadial::~DimRadial()
{
}
-/*virtual*/ RS_Entity * RS_DimRadial::clone()
+/*virtual*/ Entity * DimRadial::clone()
{
- RS_DimRadial * d = new RS_DimRadial(*this);
+ DimRadial * d = new DimRadial(*this);
#warning "!!! Need to deal with setAutoDelete() Qt3->Qt4 !!!"
// d->entities.setAutoDelete(entities.autoDelete());
d->initId();
}
/** @return RS2::EntityDimRadial */
-/*virtual*/ RS2::EntityType RS_DimRadial::rtti() const
+/*virtual*/ RS2::EntityType DimRadial::rtti() const
{
return RS2::EntityDimRadial;
}
* @return Copy of data that defines the radial dimension.
* @see getData()
*/
-RS_DimRadialData RS_DimRadial::getEData() const
+DimRadialData DimRadial::getEData() const
{
return edata;
}
* @return Automatically created label for the default
* measurement of this dimension.
*/
-QString RS_DimRadial::getMeasuredLabel()
+QString DimRadial::getMeasuredLabel()
{
// Definitive dimension line:
double dist = data.definitionPoint.distanceTo(edata.definitionPoint);
QString ret;
if (graphic!=NULL) {
- ret = RS_Units::formatLinear(dist, graphic->getUnit(),
+ ret = Units::formatLinear(dist, graphic->getUnit(),
graphic->getLinearFormat(), graphic->getLinearPrecision());
} else {
ret = QString("%1").arg(dist);
}
-VectorSolutions RS_DimRadial::getRefPoints() {
+VectorSolutions DimRadial::getRefPoints() {
VectorSolutions ret(edata.definitionPoint,
data.definitionPoint, data.middleOfText);
return ret;
*
* @param autoText Automatically reposition the text label
*/
-void RS_DimRadial::update(bool autoText)
+void DimRadial::update(bool autoText)
{
- RS_DEBUG->print("RS_DimRadial::update");
+ DEBUG->print("DimRadial::update");
clear();
// length of dimension line:
double length = p1.distanceTo(p2);
- RS_TextData textData;
+ TextData textData;
- textData = RS_TextData(Vector(0.0,0.0),
+ textData = TextData(Vector(0.0,0.0),
dimtxt, 30.0,
RS2::VAlignMiddle,
RS2::HAlignCenter,
"standard",
0.0);
- RS_Text* text = new RS_Text(this, textData);
+ Text* text = new Text(this, textData);
double textWidth = text->getSize().x;
// do we have to put the arrow / text outside of the arc?
}
// create arrow:
- RS_SolidData sd;
- RS_Solid* arrow;
+ SolidData sd;
+ Solid* arrow;
- arrow = new RS_Solid(this, sd);
+ arrow = new Solid(this, sd);
arrow->shapeArrow(p2,
arrowAngle,
getArrowSize());
- arrow->setPen(RS_Pen(RS2::FlagInvalid));
+ arrow->setPen(Pen(RS2::FlagInvalid));
arrow->setLayer(NULL);
addEntity(arrow);
p3 += p1;
// Create dimension line:
- RS_Line* dimensionLine = new RS_Line(this, RS_LineData(p1, p3));
- dimensionLine->setPen(RS_Pen(RS2::FlagInvalid));
+ Line* dimensionLine = new Line(this, LineData(p1, p3));
+ dimensionLine->setPen(Pen(RS2::FlagInvalid));
dimensionLine->setLayer(NULL);
addEntity(dimensionLine);
text->rotate(Vector(0.0,0.0), textAngle);
text->move(textPos);
- text->setPen(RS_Pen(RS2::FlagInvalid));
+ text->setPen(Pen(RS2::FlagInvalid));
text->setLayer(NULL);
addEntity(text);
calculateBorders();
}
-Vector RS_DimRadial::getDefinitionPoint()
+Vector DimRadial::getDefinitionPoint()
{
return edata.definitionPoint;
}
-double RS_DimRadial::getLeader()
+double DimRadial::getLeader()
{
return edata.leader;
}
-void RS_DimRadial::move(Vector offset)
+void DimRadial::move(Vector offset)
{
- RS_Dimension::move(offset);
+ Dimension::move(offset);
edata.definitionPoint.move(offset);
update();
}
-void RS_DimRadial::rotate(Vector center, double angle)
+void DimRadial::rotate(Vector center, double angle)
{
- RS_Dimension::rotate(center, angle);
+ Dimension::rotate(center, angle);
edata.definitionPoint.rotate(center, angle);
update();
-void RS_DimRadial::scale(Vector center, Vector factor) {
- RS_Dimension::scale(center, factor);
+void DimRadial::scale(Vector center, Vector factor) {
+ Dimension::scale(center, factor);
edata.definitionPoint.scale(center, factor);
edata.leader*=factor.x;
-void RS_DimRadial::mirror(Vector axisPoint1, Vector axisPoint2) {
- RS_Dimension::mirror(axisPoint1, axisPoint2);
+void DimRadial::mirror(Vector axisPoint1, Vector axisPoint2) {
+ Dimension::mirror(axisPoint1, axisPoint2);
edata.definitionPoint.mirror(axisPoint1, axisPoint2);
update();
}
-void RS_DimRadial::moveRef(const Vector& ref, const Vector& offset) {
+void DimRadial::moveRef(const Vector& ref, const Vector& offset) {
if (ref.distanceTo(edata.definitionPoint)<1.0e-4) {
double d = data.definitionPoint.distanceTo(edata.definitionPoint);
/**
* Dumps the point's data to stdout.
*/
-std::ostream& operator << (std::ostream& os, const RS_DimRadial& d) {
+std::ostream& operator << (std::ostream& os, const DimRadial& d) {
os << " DimRadial: " << d.getData() << "\n" << d.getEData() << "\n";
return os;
}
/**
* Holds the data that defines a radial dimension entity.
*/
-class RS_DimRadialData
+class DimRadialData
{
public:
/**
* Default constructor. Leaves the data object uninitialized.
*/
- RS_DimRadialData() {}
+ DimRadialData() {}
/**
* Constructor with initialisation.
* @param definitionPoint Definition point of the radial dimension.
* @param leader Leader length.
*/
- RS_DimRadialData(const Vector& definitionPoint,
+ DimRadialData(const Vector& definitionPoint,
double leader) {
this->definitionPoint = definitionPoint;
this->leader = leader;
}
- friend class RS_DimRadial;
+ friend class DimRadial;
//friend class RS_ActionDimRadial;
friend std::ostream& operator << (std::ostream& os,
- const RS_DimRadialData& dd) {
+ const DimRadialData& dd) {
os << "(" << dd.definitionPoint << "/" << dd.leader << ")";
return os;
}
*
* @author Andrew Mustun
*/
-class RS_DimRadial: public RS_Dimension
+class DimRadial: public Dimension
{
public:
- RS_DimRadial(RS_EntityContainer * parent, const RS_DimensionData & d, const RS_DimRadialData & ed);
- virtual ~RS_DimRadial();
+ DimRadial(EntityContainer * parent, const DimensionData & d, const DimRadialData & ed);
+ virtual ~DimRadial();
- virtual RS_Entity * clone();
+ virtual Entity * clone();
virtual RS2::EntityType rtti() const;
- RS_DimRadialData getEData() const;
+ DimRadialData getEData() const;
virtual VectorSolutions getRefPoints();
virtual QString getMeasuredLabel();
virtual void update(bool autoText = false);
virtual void mirror(Vector axisPoint1, Vector axisPoint2);
virtual void moveRef(const Vector& ref, const Vector& offset);
- friend std::ostream& operator << (std::ostream& os, const RS_DimRadial& d);
+ friend std::ostream& operator << (std::ostream& os, const DimRadial& d);
protected:
/** Extended data. */
- RS_DimRadialData edata;
+ DimRadialData edata;
};
#endif
* @param parent Parent of the document. Often that's NULL but
* for blocks it's the blocklist.
*/
-RS_Document::RS_Document(RS_EntityContainer * parent):
- RS_EntityContainer(parent), RS_Undo()
+Document::Document(EntityContainer * parent):
+ EntityContainer(parent), Undo()
{
- RS_DEBUG->print("RS_Document::RS_Document() ");
+ DEBUG->print("Document::Document() ");
filename = "";
formatType = RS2::FormatUnknown;
setModified(false);
- RS_Color col(RS2::FlagByLayer);
- activePen = RS_Pen(col, RS2::WidthByLayer, RS2::LineByLayer);
+ Color col(RS2::FlagByLayer);
+ activePen = Pen(col, RS2::WidthByLayer, RS2::LineByLayer);
}
-RS_Document::~RS_Document()
+Document::~Document()
{
}
/**
* @return true for all document entities (e.g. Graphics or Blocks).
*/
-bool RS_Document::isDocument() const
+bool Document::isDocument() const
{
return true;
}
/**
* Removes an entity from the entiy container. Implementation
- * from RS_Undo.
+ * from Undo.
*/
-void RS_Document::removeUndoable(RS_Undoable * u)
+void Document::removeUndoable(Undoable * u)
{
if (u != NULL && u->undoRtti() == RS2::UndoableEntity)
{
- removeEntity((RS_Entity *)u);
+ removeEntity((Entity *)u);
}
}
/**
* @return Currently active drawing pen.
*/
-RS_Pen RS_Document::getActivePen() const
+Pen Document::getActivePen() const
{
return activePen;
}
/**
* Sets the currently active drawing pen to p.
*/
-void RS_Document::setActivePen(RS_Pen p)
+void Document::setActivePen(Pen p)
{
activePen = p;
}
* @return File name of the document currently loaded.
* Note, that the default file name is empty.
*/
-QString RS_Document::getFilename() const
+QString Document::getFilename() const
{
return filename;
}
/**
* Sets file name for the document currently loaded.
*/
-void RS_Document::setFilename(const QString & fn)
+void Document::setFilename(const QString & fn)
{
filename = fn;
}
/**
* Sets the documents modified status to 'm'.
*/
-void RS_Document::setModified(bool m)
+void Document::setModified(bool m)
{
- //std::cout << "RS_Document::setModified: %d" << (int)m << std::endl;
+ //std::cout << "Document::setModified: %d" << (int)m << std::endl;
modified = m;
}
* @retval true The document has been modified since it was last saved.
* @retval false The document has not been modified since it was last saved.
*/
-bool RS_Document::isModified() const
+bool Document::isModified() const
{
return modified;
}
/**
* Overwritten to set modified flag before starting an undo cycle.
*/
-void RS_Document::startUndoCycle()
+void Document::startUndoCycle()
{
setModified(true);
- RS_Undo::startUndoCycle();
+ Undo::startUndoCycle();
}
#include "entitycontainer.h"
#include "undo.h"
-class RS_BlockList;
-class RS_LayerList;
+class BlockList;
+class LayerList;
/**
* Base class for documents. Documents can be either graphics or
*
* @author Andrew Mustun
*/
-class RS_Document: public RS_EntityContainer, public RS_Undo
+class Document: public EntityContainer, public Undo
{
public:
- RS_Document(RS_EntityContainer * parent = NULL);
- virtual ~RS_Document();
+ Document(EntityContainer * parent = NULL);
+ virtual ~Document();
- virtual RS_LayerList * getLayerList() = 0;
- virtual RS_BlockList * getBlockList() = 0;
+ virtual LayerList * getLayerList() = 0;
+ virtual BlockList * getBlockList() = 0;
virtual void newDoc() = 0;
virtual bool save() = 0;
virtual bool open(const QString &filename, RS2::FormatType type) = 0;
virtual bool isDocument() const;
- virtual void removeUndoable(RS_Undoable * u);
- RS_Pen getActivePen() const;
- void setActivePen(RS_Pen p);
+ virtual void removeUndoable(Undoable * u);
+ Pen getActivePen() const;
+ void setActivePen(Pen p);
QString getFilename() const;
void setFilename(const QString & fn);
virtual void setModified(bool m);
/** Flag set if the document was modified and not yet saved. */
bool modified;
/** Active pen. */
- RS_Pen activePen;
+ Pen activePen;
/** File name of the document or empty for a new document. */
QString filename;
/** Format type */
/**
* Default constructor.
*/
-Drawing::Drawing(RS_EntityContainer * parent): RS_Document(parent), layerList(),
+Drawing::Drawing(EntityContainer * parent): Document(parent), layerList(),
blockList(true)
#ifdef RS_CAM
, camData()
#endif
{
settings.beginGroup("Defaults");
- setUnit(RS_Units::stringToUnit(settings.value("Unit", "None").toString()));
+ setUnit(Units::stringToUnit(settings.value("Unit", "None").toString()));
settings.endGroup();
RS2::Unit unit = getUnit();
}
else
{
- addVariable("$DIMASZ", RS_Units::convert(2.5, RS2::Millimeter, unit), 40);
- addVariable("$DIMEXE", RS_Units::convert(1.25, RS2::Millimeter, unit), 40);
- addVariable("$DIMEXO", RS_Units::convert(0.625, RS2::Millimeter, unit), 40);
- addVariable("$DIMGAP", RS_Units::convert(0.625, RS2::Millimeter, unit), 40);
- addVariable("$DIMTXT", RS_Units::convert(2.5, RS2::Millimeter, unit), 40);
+ addVariable("$DIMASZ", Units::convert(2.5, RS2::Millimeter, unit), 40);
+ addVariable("$DIMEXE", Units::convert(1.25, RS2::Millimeter, unit), 40);
+ addVariable("$DIMEXO", Units::convert(0.625, RS2::Millimeter, unit), 40);
+ addVariable("$DIMGAP", Units::convert(0.625, RS2::Millimeter, unit), 40);
+ addVariable("$DIMTXT", Units::convert(2.5, RS2::Millimeter, unit), 40);
}
setModified(false);
/**
* Counts the entities on the given layer.
*/
-unsigned long int Drawing::countLayerEntities(RS_Layer * layer)
+unsigned long int Drawing::countLayerEntities(Layer * layer)
{
int c = 0;
if (layer != NULL)
{
- for(RS_Entity * t=firstEntity(RS2::ResolveNone); t!=NULL; t=nextEntity(RS2::ResolveNone))
+ for(Entity * t=firstEntity(RS2::ResolveNone); t!=NULL; t=nextEntity(RS2::ResolveNone))
{
if (t->getLayer()!=NULL && t->getLayer()->getName()==layer->getName())
{
return c;
}
-/*virtual*/ RS_LayerList * Drawing::getLayerList()
+/*virtual*/ LayerList * Drawing::getLayerList()
{
return &layerList;
}
-/*virtual*/ RS_BlockList * Drawing::getBlockList()
+/*virtual*/ BlockList * Drawing::getBlockList()
{
return &blockList;
}
*/
void Drawing::newDoc()
{
- RS_DEBUG->print("Drawing::newDoc");
+ DEBUG->print("Drawing::newDoc");
clear();
clearLayers();
clearBlocks();
- addLayer(new RS_Layer("0"));
- //addLayer(new RS_Layer("ByBlock"));
+ addLayer(new Layer("0"));
+ //addLayer(new Layer("ByBlock"));
setModified(false);
}
{
bool ret = false;
- RS_DEBUG->print("Drawing::save");
- RS_DEBUG->print(" file: %s", filename.toLatin1().data());
- RS_DEBUG->print(" format: %d", (int)formatType);
- RS_DEBUG->print(" export...");
- ret = RS_FILEIO->fileExport(*this, filename, formatType);
+ DEBUG->print("Drawing::save");
+ DEBUG->print(" file: %s", filename.toLatin1().data());
+ DEBUG->print(" format: %d", (int)formatType);
+ DEBUG->print(" export...");
+ ret = FILEIO->fileExport(*this, filename, formatType);
if (ret)
{
blockList.setModified(false);
}
- RS_DEBUG->print("Drawing::save ok");
+ DEBUG->print("Drawing::save ok");
return ret;
}
*/
bool Drawing::saveAs(const QString & filename, RS2::FormatType type)
{
- RS_DEBUG->print("Drawing::saveAs");
+ DEBUG->print("Drawing::saveAs");
this->filename = filename;
this->formatType = type;
*/
bool Drawing::open(const QString & filename, RS2::FormatType type)
{
- RS_DEBUG->print("Drawing::open(%s)", filename.toLatin1().data());
+ DEBUG->print("Drawing::open(%s)", filename.toLatin1().data());
bool ret = false;
this->filename = filename;
// clean all:
newDoc();
// import file:
- ret = RS_FILEIO->fileImport(*this, filename, type);
+ ret = FILEIO->fileImport(*this, filename, type);
setModified(false);
layerList.setModified(false);
blockList.setModified(false);
//cout << *((Drawing*)graphic);
//calculateBorders();
- RS_DEBUG->print("Drawing::open(%s): OK", filename.toLatin1().data());
+ DEBUG->print("Drawing::open(%s): OK", filename.toLatin1().data());
return ret;
}
return layerList.count();
}
-RS_Layer * Drawing::layerAt(uint i)
+Layer * Drawing::layerAt(uint i)
{
return layerList.at(i);
}
layerList.activate(name);
}
-void Drawing::activateLayer(RS_Layer * layer)
+void Drawing::activateLayer(Layer * layer)
{
layerList.activate(layer);
}
-RS_Layer * Drawing::getActiveLayer()
+Layer * Drawing::getActiveLayer()
{
return layerList.getActive();
}
-/*virtual*/ void Drawing::addLayer(RS_Layer * layer)
+/*virtual*/ void Drawing::addLayer(Layer * layer)
{
layerList.add(layer);
}
/**
* Removes the given layer and undoes all entities on it.
*/
-/*virtual*/ void Drawing::removeLayer(RS_Layer * layer)
+/*virtual*/ void Drawing::removeLayer(Layer * layer)
{
if (layer != NULL && layer->getName() != "0")
{
// remove all entities on that layer:
startUndoCycle();
- for(RS_Entity * e=firstEntity(RS2::ResolveNone); e!=NULL; e=nextEntity(RS2::ResolveNone))
+ for(Entity * e=firstEntity(RS2::ResolveNone); e!=NULL; e=nextEntity(RS2::ResolveNone))
{
if (e->getLayer() && e->getLayer()->getName() == layer->getName())
{
// remove all entities in blocks that are on that layer:
for(uint bi=0; bi<blockList.count(); bi++)
{
- RS_Block * blk = blockList.at(bi);
+ Block * blk = blockList.at(bi);
if (blk)
{
- for(RS_Entity * e=blk->firstEntity(RS2::ResolveNone); e!=NULL; e=blk->nextEntity(RS2::ResolveNone))
+ for(Entity * e=blk->firstEntity(RS2::ResolveNone); e!=NULL; e=blk->nextEntity(RS2::ResolveNone))
{
if (e->getLayer() != NULL && e->getLayer()->getName() == layer->getName())
{
}
}
-/*virtual*/ void Drawing::editLayer(RS_Layer * layer, const RS_Layer & source)
+/*virtual*/ void Drawing::editLayer(Layer * layer, const Layer & source)
{
layerList.edit(layer, source);
}
-RS_Layer * Drawing::findLayer(const QString & name)
+Layer * Drawing::findLayer(const QString & name)
{
return layerList.find(name);
}
layerList.toggle(name);
}
-void Drawing::toggleLayer(RS_Layer * layer)
+void Drawing::toggleLayer(Layer * layer)
{
layerList.toggle(layer);
}
-void Drawing::toggleLayerLock(RS_Layer * layer)
+void Drawing::toggleLayerLock(Layer * layer)
{
layerList.toggleLock(layer);
}
}
#if 0
-void Drawing::addLayerListListener(RS_LayerListListener * listener)
+void Drawing::addLayerListListener(LayerListListener * listener)
{
layerList.addListener(listener);
}
-void Drawing::removeLayerListListener(RS_LayerListListener * listener)
+void Drawing::removeLayerListListener(LayerListListener * listener)
{
layerList.removeListener(listener);
}
return blockList.count();
}
-RS_Block * Drawing::blockAt(uint i)
+Block * Drawing::blockAt(uint i)
{
return blockList.at(i);
}
blockList.activate(name);
}
-void Drawing::activateBlock(RS_Block * block)
+void Drawing::activateBlock(Block * block)
{
blockList.activate(block);
}
-RS_Block * Drawing::getActiveBlock()
+Block * Drawing::getActiveBlock()
{
return blockList.getActive();
}
-/*virtual*/ bool Drawing::addBlock(RS_Block * block, bool notify/*= true*/)
+/*virtual*/ bool Drawing::addBlock(Block * block, bool notify/*= true*/)
{
return blockList.add(block, notify);
}
blockList.addNotification();
}
-/*virtual*/ void Drawing::removeBlock(RS_Block * block)
+/*virtual*/ void Drawing::removeBlock(Block * block)
{
blockList.remove(block);
}
-RS_Block * Drawing::findBlock(const QString & name)
+Block * Drawing::findBlock(const QString & name)
{
return blockList.find(name);
}
blockList.toggle(name);
}
-void Drawing::toggleBlock(RS_Block * block)
+void Drawing::toggleBlock(Block * block)
{
blockList.toggle(block);
}
}
#if 0
-void Drawing::addBlockListListener(RS_BlockListListener * listener)
+void Drawing::addBlockListListener(BlockListListener * listener)
{
blockList.addListener(listener);
}
-void Drawing::removeBlockListListener(RS_BlockListListener * listener)
+void Drawing::removeBlockListListener(BlockListListener * listener)
{
blockList.removeListener(listener);
}
variableDict.remove(key);
}
-//Q3Dict<RS_Variable> & getVariableDict()
-QMultiHash<QString, RS_Variable *> & Drawing::getVariableDict()
+//Q3Dict<Variable> & getVariableDict()
+QMultiHash<QString, Variable *> & Drawing::getVariableDict()
{
return variableDict.getVariableDict();
}
*/
void Drawing::setUnit(RS2::Unit u)
{
- setPaperSize(RS_Units::convert(getPaperSize(), getUnit(), u));
+ setPaperSize(Units::convert(getPaperSize(), getUnit(), u));
addVariable("$INSUNITS", (int)u, 70);
//unit = u;
}
*/
Vector Drawing::getPaperSize()
{
- Vector def = RS_Units::convert(Vector(210.0, 297.0), RS2::Millimeter, getUnit());
+ Vector def = Units::convert(Vector(210.0, 297.0), RS2::Millimeter, getUnit());
Vector v1 = getVariableVector("$PLIMMIN", Vector(0.0, 0.0));
Vector v2 = getVariableVector("$PLIMMAX", def);
*/
RS2::PaperFormat Drawing::getPaperFormat(bool * landscape)
{
- Vector size = RS_Units::convert(getPaperSize(), getUnit(), RS2::Millimeter);
+ Vector size = Units::convert(getPaperSize(), getUnit(), RS2::Millimeter);
if (landscape != NULL)
*landscape = (size.x > size.y);
- return RS_Units::paperSizeToFormat(size);
+ return Units::paperSizeToFormat(size);
}
/**
*/
void Drawing::setPaperFormat(RS2::PaperFormat f, bool landscape)
{
- Vector size = RS_Units::paperFormatToSize(f);
+ Vector size = Units::paperFormatToSize(f);
if (landscape)
{
}
if (f != RS2::Custom)
- setPaperSize(RS_Units::convert(size, RS2::Millimeter, getUnit()));
+ setPaperSize(Units::convert(size, RS2::Millimeter, getUnit()));
}
/**
*/
void Drawing::fitToPage()
{
- double border = RS_Units::convert(25.0, RS2::Millimeter, getUnit());
+ double border = Units::convert(25.0, RS2::Millimeter, getUnit());
Vector ps = getPaperSize() - Vector(border, border);
Vector s = getSize();
double fx = RS_MAXDOUBLE;
double fy = RS_MAXDOUBLE;
//double factor = 1.0;
- //ps = RS_Units::convert(ps, getUnit(), RS2::Millimeter);
+ //ps = Units::convert(ps, getUnit(), RS2::Millimeter);
if (fabs(s.x) > 1.0e-6)
fx = ps.x / s.x;
os << "--- Drawing: \n";
os << "---" << *g.getLayerList() << "\n";
os << "---" << *g.getBlockList() << "\n";
- os << "---" << (RS_Undo &)g << "\n";
- os << "---" << (RS_EntityContainer &)g << "\n";
+ os << "---" << (Undo &)g << "\n";
+ os << "---" << (EntityContainer &)g << "\n";
return os;
}
*
* @author Andrew Mustun
*/
-class Drawing: public RS_Document
+class Drawing: public Document
{
public:
- Drawing(RS_EntityContainer * parent = NULL);
+ Drawing(EntityContainer * parent = NULL);
virtual ~Drawing();
virtual RS2::EntityType rtti() const;
- virtual unsigned long int countLayerEntities(RS_Layer * layer);
- virtual RS_LayerList * getLayerList();
- virtual RS_BlockList * getBlockList();
+ virtual unsigned long int countLayerEntities(Layer * layer);
+ virtual LayerList * getLayerList();
+ virtual BlockList * getBlockList();
virtual void newDoc();
virtual bool save();
virtual bool saveAs(const QString& filename, RS2::FormatType type);
// Wrappers for Layer functions:
void clearLayers();
uint countLayers() const;
- RS_Layer * layerAt(uint i);
+ Layer * layerAt(uint i);
void activateLayer(const QString & name);
- void activateLayer(RS_Layer * layer);
- RS_Layer * getActiveLayer();
- virtual void addLayer(RS_Layer * layer);
- virtual void removeLayer(RS_Layer * layer);
- virtual void editLayer(RS_Layer * layer, const RS_Layer & source);
- RS_Layer * findLayer(const QString & name);
+ void activateLayer(Layer * layer);
+ Layer * getActiveLayer();
+ virtual void addLayer(Layer * layer);
+ virtual void removeLayer(Layer * layer);
+ virtual void editLayer(Layer * layer, const Layer & source);
+ Layer * findLayer(const QString & name);
void toggleLayer(const QString & name);
- void toggleLayer(RS_Layer * layer);
- void toggleLayerLock(RS_Layer * layer);
+ void toggleLayer(Layer * layer);
+ void toggleLayerLock(Layer * layer);
void freezeAllLayers(bool freeze);
-// void addLayerListListener(RS_LayerListListener * listener);
-// void removeLayerListListener(RS_LayerListListener * listener);
+// void addLayerListListener(LayerListListener * listener);
+// void removeLayerListListener(LayerListListener * listener);
// Wrapper for block functions:
void clearBlocks();
uint countBlocks();
- RS_Block * blockAt(uint i);
+ Block * blockAt(uint i);
void activateBlock(const QString & name);
- void activateBlock(RS_Block * block);
- RS_Block * getActiveBlock();
- virtual bool addBlock(RS_Block * block, bool notify = true);
+ void activateBlock(Block * block);
+ Block * getActiveBlock();
+ virtual bool addBlock(Block * block, bool notify = true);
virtual void addBlockNotification();
- virtual void removeBlock(RS_Block * block);
- RS_Block * findBlock(const QString & name);
+ virtual void removeBlock(Block * block);
+ Block * findBlock(const QString & name);
QString newBlockName();
void toggleBlock(const QString & name);
- void toggleBlock(RS_Block * block);
+ void toggleBlock(Block * block);
void freezeAllBlocks(bool freeze);
-// void addBlockListListener(RS_BlockListListener * listener);
-// void removeBlockListListener(RS_BlockListListener * listener);
+// void addBlockListListener(BlockListListener * listener);
+// void removeBlockListListener(BlockListListener * listener);
// Wrappers for variable functions:
void clearVariables();
int getVariableInt(const QString & key, int def);
double getVariableDouble(const QString & key, double def);
void removeVariable(const QString & key);
- // Q3Dict<RS_Variable> & getVariableDict();
- QMultiHash<QString, RS_Variable *> & getVariableDict();
+ // Q3Dict<Variable> & getVariableDict();
+ QMultiHash<QString, Variable *> & getVariableDict();
RS2::LinearFormat getLinearFormat();
int getLinearPrecision();
friend std::ostream & operator<<(std::ostream & os, Drawing & g);
private:
- RS_LayerList layerList;
- RS_BlockList blockList;
- RS_VariableDict variableDict;
+ LayerList layerList;
+ BlockList blockList;
+ VariableDict variableDict;
#ifdef RS_CAM
RS_CamData camData;
#endif
/**
* Constructor.
*/
-RS_Ellipse::RS_Ellipse(RS_EntityContainer * parent, const RS_EllipseData & d):
- RS_AtomicEntity(parent), data(d)
+Ellipse::Ellipse(EntityContainer * parent, const EllipseData & d):
+ AtomicEntity(parent), data(d)
{
//calculateEndpoints();
calculateBorders();
}
-/*virtual*/ RS_Ellipse::~RS_Ellipse()
+/*virtual*/ Ellipse::~Ellipse()
{
}
-/*virtual*/ RS_Entity * RS_Ellipse::clone()
+/*virtual*/ Entity * Ellipse::clone()
{
- RS_Ellipse * e = new RS_Ellipse(*this);
+ Ellipse * e = new Ellipse(*this);
e->initId();
return e;
}
/** @return RS2::EntityEllipse */
-/*virtual*/ RS2::EntityType RS_Ellipse::rtti() const
+/*virtual*/ RS2::EntityType Ellipse::rtti() const
{
return RS2::EntityEllipse;
}
/**
* @return Start point of the entity.
*/
-/*virtual*/ Vector RS_Ellipse::getStartpoint() const
+/*virtual*/ Vector Ellipse::getStartpoint() const
{
Vector p;
p.set(data.center.x + cos(data.angle1) * getMajorRadius(),
/**
* @return End point of the entity.
*/
-/*virtual*/ Vector RS_Ellipse::getEndpoint() const
+/*virtual*/ Vector Ellipse::getEndpoint() const
{
Vector p;
p.set(data.center.x + cos(data.angle2) * getMajorRadius(),
return p;
}
-void RS_Ellipse::moveStartpoint(const Vector & pos)
+void Ellipse::moveStartpoint(const Vector & pos)
{
data.angle1 = getEllipseAngle(pos);
//data.angle1 = data.center.angleTo(pos);
calculateBorders();
}
-void RS_Ellipse::moveEndpoint(const Vector & pos)
+void Ellipse::moveEndpoint(const Vector & pos)
{
data.angle2 = getEllipseAngle(pos);
//data.angle2 = data.center.angleTo(pos);
calculateBorders();
}
-RS2::Ending RS_Ellipse::getTrimPoint(const Vector & coord, const Vector & trimPoint)
+RS2::Ending Ellipse::getTrimPoint(const Vector & coord, const Vector & trimPoint)
{
double angEl = getEllipseAngle(trimPoint);
double angM = getEllipseAngle(coord);
- if (RS_Math::getAngleDifference(angM, angEl) > M_PI)
+ if (Math::getAngleDifference(angM, angEl) > M_PI)
//if (data.reversed) {
// return RS2::EndingEnd;
//}
//}
}
-double RS_Ellipse::getEllipseAngle(const Vector & pos)
+double Ellipse::getEllipseAngle(const Vector & pos)
{
Vector m = pos;
m.rotate(data.center, -data.majorP.angle());
}
/** @return Copy of data that defines the ellipse. **/
-RS_EllipseData RS_Ellipse::getData()
+EllipseData Ellipse::getData()
{
return data;
}
-VectorSolutions RS_Ellipse::getRefPoints()
+VectorSolutions Ellipse::getRefPoints()
{
VectorSolutions ret(getStartpoint(), getEndpoint(), data.center);
return ret;
* @retval true if the arc is reversed (clockwise),
* @retval false otherwise
*/
-bool RS_Ellipse::isReversed() const
+bool Ellipse::isReversed() const
{
return data.reversed;
}
/** sets the reversed status. */
-void RS_Ellipse::setReversed(bool r)
+void Ellipse::setReversed(bool r)
{
data.reversed = r;
}
/** @return The rotation angle of this ellipse */
-double RS_Ellipse::getAngle() const
+double Ellipse::getAngle() const
{
return data.majorP.angle();
}
/** @return The start angle of this arc */
-double RS_Ellipse::getAngle1()
+double Ellipse::getAngle1()
{
return data.angle1;
}
/** Sets new start angle. */
-void RS_Ellipse::setAngle1(double a1)
+void Ellipse::setAngle1(double a1)
{
data.angle1 = a1;
}
/** @return The end angle of this arc */
-double RS_Ellipse::getAngle2()
+double Ellipse::getAngle2()
{
return data.angle2;
}
/** Sets new end angle. */
-void RS_Ellipse::setAngle2(double a2)
+void Ellipse::setAngle2(double a2)
{
data.angle2 = a2;
}
/** @return The center point (x) of this arc */
-Vector RS_Ellipse::getCenter()
+Vector Ellipse::getCenter()
{
return data.center;
}
/** Sets new center. */
-void RS_Ellipse::setCenter(const Vector & c)
+void Ellipse::setCenter(const Vector & c)
{
data.center = c;
}
/** @return The endpoint of the major axis (relative to center). */
-Vector RS_Ellipse::getMajorP()
+Vector Ellipse::getMajorP()
{
return data.majorP;
}
/** Sets new major point (relative to center). */
-void RS_Ellipse::setMajorP(const Vector & p)
+void Ellipse::setMajorP(const Vector & p)
{
data.majorP = p;
}
/** @return The ratio of minor to major axis */
-double RS_Ellipse::getRatio()
+double Ellipse::getRatio()
{
return data.ratio;
}
/** Sets new ratio. */
-void RS_Ellipse::setRatio(double r)
+void Ellipse::setRatio(double r)
{
data.ratio = r;
}
/**
* @return Angle length in rad.
*/
-/*virtual*/ double RS_Ellipse::getAngleLength() const
+/*virtual*/ double Ellipse::getAngleLength() const
{
if (isReversed())
return data.angle1 - data.angle2;
}
/** @return The major radius of this ellipse. Same as getRadius() */
-double RS_Ellipse::getMajorRadius() const
+double Ellipse::getMajorRadius() const
{
return data.majorP.magnitude();
}
/** @return The minor radius of this ellipse */
-double RS_Ellipse::getMinorRadius() const
+double Ellipse::getMinorRadius() const
{
return data.majorP.magnitude() * data.ratio;
}
* Recalculates the endpoints using the angles and the radius.
*/
/*
- void RS_Ellipse::calculateEndpoints() {
+ void Ellipse::calculateEndpoints() {
double angle = data.majorP.angle();
double radius1 = getMajorRadius();
double radius2 = getMinorRadius();
*
* @todo Fix that - the algorithm used is really bad / slow.
*/
-void RS_Ellipse::calculateBorders()
+void Ellipse::calculateBorders()
{
- RS_DEBUG->print("RS_Ellipse::calculateBorders");
+ DEBUG->print("Ellipse::calculateBorders");
double radius1 = getMajorRadius();
double radius2 = getMinorRadius();
a += 0.03;
}
- while (RS_Math::isAngleBetween(RS_Math::correctAngle(a), a1, a2, false)
+ while (Math::isAngleBetween(Math::correctAngle(a), a1, a2, false)
&& a < 4 * M_PI);
minV.set(minX, minY);
maxV.set(maxX, maxY);
- RS_DEBUG->print("RS_Ellipse::calculateBorders: OK");
+ DEBUG->print("Ellipse::calculateBorders: OK");
}
-Vector RS_Ellipse::getNearestEndpoint(const Vector & coord, double * dist)
+Vector Ellipse::getNearestEndpoint(const Vector & coord, double * dist)
{
double dist1, dist2;
Vector nearerPoint;
return nearerPoint;
}
-Vector RS_Ellipse::getNearestPointOnEntity(const Vector & coord, bool onEntity, double * dist, RS_Entity * * entity)
+Vector Ellipse::getNearestPointOnEntity(const Vector & coord, bool onEntity, double * dist, Entity * * entity)
{
- RS_DEBUG->print("RS_Ellipse::getNearestPointOnEntity");
+ DEBUG->print("Ellipse::getNearestPointOnEntity");
Vector ret(false);
for (i = 0; i < iMax; i++)
{
- RS_DEBUG->print("RS_Ellipse::getNearestPointOnEntity: i: %d", i);
+ DEBUG->print("Ellipse::getNearestPointOnEntity: i: %d", i);
double dTpASqr = dT + dA * dA;
double dTpBSqr = dT + dB * dB;
double dInvTpASqr = 1.0 / dTpASqr;
double dXDivASqr = dXDivA * dXDivA;
double dYDivBSqr = dYDivB * dYDivB;
double dF = dXDivASqr + dYDivBSqr - 1.0;
- RS_DEBUG->print("RS_Ellipse::getNearestPointOnEntity: dF: %f", dF);
+ DEBUG->print("Ellipse::getNearestPointOnEntity: dF: %f", dF);
if (fabs(dF) < dEpsilon)
{
rdX = dXDivA * dA;
rdY = dYDivB * dB;
riIFinal = i;
- RS_DEBUG->print("RS_Ellipse::getNearestPointOnEntity: rdX,rdY 1: %f,%f", rdX, rdY);
+ DEBUG->print("Ellipse::getNearestPointOnEntity: rdX,rdY 1: %f,%f", rdX, rdY);
break;
}
double dFDer = 2.0 * (dXDivASqr * dInvTpASqr + dYDivBSqr * dInvTpBSqr);
double dRatio = dF / dFDer;
- RS_DEBUG->print("RS_Ellipse::getNearestPointOnEntity: dRatio: %f", dRatio);
+ DEBUG->print("Ellipse::getNearestPointOnEntity: dRatio: %f", dRatio);
if (fabs(dRatio) < dEpsilon)
{
rdX = dXDivA * dA;
rdY = dYDivB * dB;
riIFinal = i;
- RS_DEBUG->print("RS_Ellipse::getNearestPointOnEntity: rdX,rdY 2: %f,%f", rdX, rdY);
+ DEBUG->print("Ellipse::getNearestPointOnEntity: rdX,rdY 2: %f,%f", rdX, rdY);
break;
}
dT += dRatio;
if (i == iMax)
{
// failed to converge:
- RS_DEBUG->print("RS_Ellipse::getNearestPointOnEntity: failed");
+ DEBUG->print("Ellipse::getNearestPointOnEntity: failed");
dDistance = RS_MAXDOUBLE;
}
else
double dDelta1 = rdY - dV;
dDistance = sqrt(dDelta0 * dDelta0 + dDelta1 * dDelta1);
ret = Vector(rdX, rdY);
- RS_DEBUG->print("RS_Ellipse::getNearestPointOnEntity: rdX,rdY 2: %f,%f", rdX, rdY);
- RS_DEBUG->print("RS_Ellipse::getNearestPointOnEntity: ret: %f,%f", ret.x, ret.y);
+ DEBUG->print("Ellipse::getNearestPointOnEntity: rdX,rdY 2: %f,%f", rdX, rdY);
+ DEBUG->print("Ellipse::getNearestPointOnEntity: ret: %f,%f", ret.x, ret.y);
}
if (dist != NULL)
double a2 = data.center.angleTo(getEndpoint());
double a = data.center.angleTo(ret);
- if (!RS_Math::isAngleBetween(a, a1, a2, data.reversed))
+ if (!Math::isAngleBetween(a, a1, a2, data.reversed))
ret = Vector(false);
}
}
* @retval true if the given point is on this entity.
* @retval false otherwise
*/
-bool RS_Ellipse::isPointOnEntity(const Vector & coord, double tolerance)
+bool Ellipse::isPointOnEntity(const Vector & coord, double tolerance)
{
double dist = getDistanceToPoint(coord, NULL, RS2::ResolveNone);
return (dist <= tolerance);
}
-Vector RS_Ellipse::getNearestCenter(const Vector & coord, double * dist)
+Vector Ellipse::getNearestCenter(const Vector & coord, double * dist)
{
if (dist != NULL)
*dist = coord.distanceTo(data.center);
/**
* @todo Implement this.
*/
-Vector RS_Ellipse::getNearestMiddle(const Vector & /*coord*/, double * dist)
+Vector Ellipse::getNearestMiddle(const Vector & /*coord*/, double * dist)
{
if (dist != NULL)
*dist = RS_MAXDOUBLE;
return Vector(false);
}
-Vector RS_Ellipse::getNearestDist(double /*distance*/, const Vector & /*coord*/, double * dist)
+Vector Ellipse::getNearestDist(double /*distance*/, const Vector & /*coord*/, double * dist)
{
if (dist != NULL)
*dist = RS_MAXDOUBLE;
return Vector(false);
}
-double RS_Ellipse::getDistanceToPoint(const Vector & coord, RS_Entity * * entity, RS2::ResolveLevel, double /*solidDist*/)
+double Ellipse::getDistanceToPoint(const Vector & coord, Entity * * entity, RS2::ResolveLevel, double /*solidDist*/)
{
double dist = RS_MAXDOUBLE;
getNearestPointOnEntity(coord, true, &dist, entity);
return dist;
}
-void RS_Ellipse::move(Vector offset)
+void Ellipse::move(Vector offset)
{
data.center.move(offset);
//calculateEndpoints();
calculateBorders();
}
-void RS_Ellipse::rotate(Vector center, double angle)
+void Ellipse::rotate(Vector center, double angle)
{
data.center.rotate(center, angle);
data.majorP.rotate(angle);
calculateBorders();
}
-void RS_Ellipse::scale(Vector center, Vector factor)
+void Ellipse::scale(Vector center, Vector factor)
{
data.center.scale(center, factor);
data.majorP.scale(factor);
/**
* @todo deal with angles correctly
*/
-void RS_Ellipse::mirror(Vector axisPoint1, Vector axisPoint2)
+void Ellipse::mirror(Vector axisPoint1, Vector axisPoint2)
{
Vector mp = data.center + data.majorP;
calculateBorders();
}
-void RS_Ellipse::moveRef(const Vector & ref, const Vector & offset)
+void Ellipse::moveRef(const Vector & ref, const Vector & offset)
{
Vector startpoint = getStartpoint();
Vector endpoint = getEndpoint();
moveEndpoint(endpoint + offset);
}
-void RS_Ellipse::draw(PaintInterface * painter, GraphicView * view, double /*patternOffset*/)
+void Ellipse::draw(PaintInterface * painter, GraphicView * view, double /*patternOffset*/)
{
if (!painter || !view)
return;
}
// Pattern:
- RS_LineTypePattern * pat;
+ LineTypePattern * pat;
if (isSelected())
pat = &patternSelected;
return;
// Pen to draw pattern is always solid:
- RS_Pen pen = painter->getPen();
+ Pen pen = painter->getPen();
pen.setLineType(RS2::SolidLine);
painter->setPen(pen);
do
{
- curR = sqrt(RS_Math::pow(getMinorRadius() * cos(curA), 2.0)
- + RS_Math::pow(getMajorRadius() * sin(curA), 2.0));
+ curR = sqrt(Math::pow(getMinorRadius() * cos(curA), 2.0)
+ + Math::pow(getMajorRadius() * sin(curA), 2.0));
if (curR > 1.0e-6)
{
/**
* Dumps the point's data to stdout.
*/
-std::ostream & operator<<(std::ostream & os, const RS_Ellipse & a)
+std::ostream & operator<<(std::ostream & os, const Ellipse & a)
{
os << " Ellipse: " << a.data << "\n";
return os;
/**
* Holds the data that defines an ellipse.
*/
-class RS_EllipseData
+class EllipseData
{
public:
- RS_EllipseData(const Vector & center, const Vector & majorP, double ratio, double angle1, double angle2, bool reversed)
+ EllipseData(const Vector & center, const Vector & majorP, double ratio, double angle1, double angle2, bool reversed)
{
this->center = center;
this->majorP = majorP;
this->reversed = reversed;
}
- friend class RS_Ellipse;
+ friend class Ellipse;
- friend std::ostream & operator<<(std::ostream & os, const RS_EllipseData & ed)
+ friend std::ostream & operator<<(std::ostream & os, const EllipseData & ed)
{
os << "(" << ed.center
<< "/" << ed.majorP
*
* @author Andrew Mustun
*/
-class RS_Ellipse: public RS_AtomicEntity
+class Ellipse: public AtomicEntity
{
public:
- RS_Ellipse(RS_EntityContainer * parent, const RS_EllipseData & d);
- virtual ~RS_Ellipse();
+ Ellipse(EntityContainer * parent, const EllipseData & d);
+ virtual ~Ellipse();
- virtual RS_Entity * clone();
+ virtual Entity * clone();
virtual RS2::EntityType rtti() const;
virtual Vector getStartpoint() const;
virtual Vector getEndpoint() const;
virtual void moveEndpoint(const Vector & pos);
virtual RS2::Ending getTrimPoint(const Vector & coord, const Vector & trimPoint);
double getEllipseAngle(const Vector & pos);
- RS_EllipseData getData();
+ EllipseData getData();
virtual VectorSolutions getRefPoints();
bool isReversed() const;
void setReversed(bool r);
double getMinorRadius() const;
virtual Vector getNearestEndpoint(const Vector & coord, double * dist = NULL);
- virtual Vector getNearestPointOnEntity(const Vector & coord, bool onEntity = true, double * dist = NULL, RS_Entity ** entity = NULL);
+ virtual Vector getNearestPointOnEntity(const Vector & coord, bool onEntity = true, double * dist = NULL, Entity ** entity = NULL);
virtual Vector getNearestCenter(const Vector & coord, double * dist = NULL);
virtual Vector getNearestMiddle(const Vector & coord, double * dist = NULL);
virtual Vector getNearestDist(double distance, const Vector & coord, double * dist = NULL);
- virtual double getDistanceToPoint(const Vector & coord, RS_Entity ** entity = NULL, RS2::ResolveLevel level = RS2::ResolveNone, double solidDist = RS_MAXDOUBLE);
+ virtual double getDistanceToPoint(const Vector & coord, Entity ** entity = NULL, RS2::ResolveLevel level = RS2::ResolveNone, double solidDist = RS_MAXDOUBLE);
virtual bool isPointOnEntity(const Vector & coord, double tolerance = RS_TOLERANCE);
virtual void move(Vector offset);
virtual void draw(PaintInterface * painter, GraphicView * view, double patternOffset = 0.0);
- friend std::ostream & operator<<(std::ostream & os, const RS_Ellipse & a);
+ friend std::ostream & operator<<(std::ostream & os, const Ellipse & a);
//virtual void calculateEndpoints();
virtual void calculateBorders();
protected:
- RS_EllipseData data;
+ EllipseData data;
};
#endif
* E.g. a line might have a graphic entity or
* a polyline entity as parent.
*/
-RS_Entity::RS_Entity(RS_EntityContainer * parent)
+Entity::Entity(EntityContainer * parent)
{
this->parent = parent;
init();
/**
* Copy constructor.
*/
-/*RS_Entity::RS_Entity(const RS_Entity& e) : RS_Flags(e.getFlags()) {
+/*Entity::Entity(const Entity& e) : Flags(e.getFlags()) {
cout << "copy constructor called\n";
init();
parent = e.parent;
/**
* Destructor.
*/
-RS_Entity::~RS_Entity()
+Entity::~Entity()
{
}
-/*virtual*/ void RS_Entity::reparent(RS_EntityContainer * parent)
+/*virtual*/ void Entity::reparent(EntityContainer * parent)
{
this->parent = parent;
}
/**
* Initialisation. Called from all constructors.
*/
-void RS_Entity::init()
+void Entity::init()
{
resetBorders();
setFlag(RS2::FlagVisible);
//layer = NULL;
- //pen = RS_Pen();
+ //pen = Pen();
updateEnabled = true;
setLayerToActive();
setPenToActive();
/**
* Gives this entity a new unique id.
*/
-void RS_Entity::initId()
+void Entity::initId()
{
static unsigned long int idCounter = 0;
id = idCounter++;
/**
* Resets the borders of this element.
*/
-void RS_Entity::resetBorders()
+void Entity::resetBorders()
{
// TODO: Check that. windoze XP crashes with MAXDOUBLE
double maxd = RS_MAXDOUBLE;
* Must be overwritten to return the rtti of this entity
* (e.g. RS2::EntityArc).
*/
-/*virtual*/ RS2::EntityType RS_Entity::rtti() const
+/*virtual*/ RS2::EntityType Entity::rtti() const
{
return RS2::EntityUnknown;
}
* Identify all entities as undoable entities.
* @return RS2::UndoableEntity
*/
-/*virtual*/ RS2::UndoableType RS_Entity::undoRtti()
+/*virtual*/ RS2::UndoableType Entity::undoRtti()
{
return RS2::UndoableEntity;
}
/**
* @return Unique Id of this entity.
*/
-unsigned long int RS_Entity::getId() const
+unsigned long int Entity::getId() const
{
return id;
}
* is a potential edge entity of a contour. By default
* this returns false.
*/
-/*virtual*/ bool RS_Entity::isEdge() const
+/*virtual*/ bool Entity::isEdge() const
{
return false;
}
* @return true for all document entities (e.g. Graphics or Blocks).
* false otherwise.
*/
-/*virtual*/ bool RS_Entity::isDocument() const
+/*virtual*/ bool Entity::isDocument() const
{
return false;
}
*
* @param select True to select, false to deselect.
*/
-bool RS_Entity::setSelected(bool select)
+bool Entity::setSelected(bool select)
{
// layer is locked:
if (select && isLocked())
/**
* Toggles select on this entity.
*/
-bool RS_Entity::toggleSelected()
+bool Entity::toggleSelected()
{
return setSelected(!isSelected());
//toggleFlag(RS2::FlagSelected);
* not be selected but one of its parents is selected. In that case
* this function returns false.
*/
-bool RS_Entity::isSelected() const
+bool Entity::isSelected() const
{
return getFlag(RS2::FlagSelected);
}
/**
* @return true if a parent entity of this entity is selected.
*/
-bool RS_Entity::isParentSelected()
+bool Entity::isParentSelected()
{
- RS_Entity * p = this;
+ Entity * p = this;
do
{
*
* @param on True to set, false to reset.
*/
-void RS_Entity::setProcessed(bool on)
+void Entity::setProcessed(bool on)
{
if (on)
setFlag(RS2::FlagProcessed);
/**
* @return True if the processed flag is set.
*/
-bool RS_Entity::isProcessed() const
+bool Entity::isProcessed() const
{
return getFlag(RS2::FlagProcessed);
}
* @param undone true: entity has become invisible.
* false: entity has become visible.
*/
-void RS_Entity::undoStateChanged(bool /*undone*/)
+void Entity::undoStateChanged(bool /*undone*/)
{
setSelected(false);
update();
/**
* @return true if this entity or any parent entities are undone.
*/
-bool RS_Entity::isUndone() const
+bool Entity::isUndone() const
{
if (parent == NULL)
- return RS_Undoable::isUndone();
+ return Undoable::isUndone();
- return RS_Undoable::isUndone() || parent->isUndone();
+ return Undoable::isUndone() || parent->isUndone();
}
/**
* @return True if the entity is in the given range.
*/
-bool RS_Entity::isInWindow(Vector v1, Vector v2)
+bool Entity::isInWindow(Vector v1, Vector v2)
{
double right, left, top, bottom;
* @retval true if the given point is on this entity.
* @retval false otherwise
*/
-bool RS_Entity::isPointOnEntity(const Vector & coord, double tolerance)
+bool Entity::isPointOnEntity(const Vector & coord, double tolerance)
{
double dist = getDistanceToPoint(coord, NULL, RS2::ResolveNone);
return (dist <= tolerance);
}
-/*virtual*/ bool RS_Entity::hasEndpointsWithinWindow(Vector /*v1*/, Vector /*v2*/)
+/*virtual*/ bool Entity::hasEndpointsWithinWindow(Vector /*v1*/, Vector /*v2*/)
{
return false;
}
* The Layer might also be NULL. In that case the layer visiblity
* is ignored.
*/
-/*virtual*/ bool RS_Entity::isVisible()
+/*virtual*/ bool Entity::isVisible()
{
if (!getFlag(RS2::FlagVisible))
return false;
if (isUndone())
return false;
- /*RS_EntityCotnainer* parent = getParent();
+ /*EntityCotnainer* parent = getParent();
if (parent!=NULL && parent->isUndone()) {
return false;
}*/
return false;
}
-/*virtual*/ void RS_Entity::setVisible(bool v)
+/*virtual*/ void Entity::setVisible(bool v)
{
if (v)
setFlag(RS2::FlagVisible);
* Sets the highlight status of the entity. Highlighted entities
* usually indicate a feedback to a user action.
*/
-void RS_Entity::setHighlighted(bool on)
+void Entity::setHighlighted(bool on)
{
if (on)
setFlag(RS2::FlagHighlighted);
/**
* @return true if the entity is highlighted.
*/
-bool RS_Entity::isHighlighted()
+bool Entity::isHighlighted()
{
return getFlag(RS2::FlagHighlighted);
}
/**
* @return true if the layer this entity is on is locked.
*/
-bool RS_Entity::isLocked()
+bool Entity::isLocked()
{
if (getLayer(true) != NULL && getLayer()->isLocked())
return true;
* Implementations must return the total length of the entity
* or a negative number if the entity has no length (e.g. a text or hatch).
*/
-/*virtual*/ double RS_Entity::getLength()
+/*virtual*/ double Entity::getLength()
{
return -1.0;
}
/**
* @return Parent of this entity or NULL if this is a root entity.
*/
-RS_EntityContainer * RS_Entity::getParent() const
+EntityContainer * Entity::getParent() const
{
return parent;
}
/**
* Reparents this entity.
*/
-void RS_Entity::setParent(RS_EntityContainer * p)
+void Entity::setParent(EntityContainer * p)
{
parent = p;
}
* or the parent's parent graphic or NULL if none of the parents
* are stored in a graphic.
*/
-Drawing * RS_Entity::getGraphic()
+Drawing * Entity::getGraphic()
{
if (rtti() == RS2::EntityGraphic)
return (Drawing *)this;
* or the parent's parent block or NULL if none of the parents
* are stored in a block.
*/
-RS_Block * RS_Entity::getBlock()
+Block * Entity::getBlock()
{
if (rtti() == RS2::EntityBlock)
- return (RS_Block *)this;
+ return (Block *)this;
else if (parent == NULL)
return NULL;
else
* or the parent's parent block or NULL if none of the parents
* are stored in a block.
*/
-RS_Insert * RS_Entity::getInsert()
+Insert * Entity::getInsert()
{
if (rtti() == RS2::EntityInsert)
- return (RS_Insert *)this;
+ return (Insert *)this;
else if (parent == NULL)
return NULL;
else
* or the parent's parent block or insert or NULL if none of the parents
* are stored in a block or insert.
*/
-RS_Entity * RS_Entity::getBlockOrInsert()
+Entity * Entity::getBlockOrInsert()
{
if (rtti() == RS2::EntityBlock || rtti() == RS2::EntityInsert)
return this;
* are stored in a document. Note that a document is usually
* either a Graphic or a Block.
*/
-RS_Document * RS_Entity::getDocument()
+Document * Entity::getDocument()
{
if (isDocument() == true)
- return (RS_Document *)this;
+ return (Document *)this;
else if (parent == NULL)
return NULL;
else
* temporary subentities. update() is called if the entity's
* paramters or undo state changed.
*/
-/*virtual*/ void RS_Entity::update()
+/*virtual*/ void Entity::update()
{
}
-/*virtual*/ void RS_Entity::setUpdateEnabled(bool on)
+/*virtual*/ void Entity::setUpdateEnabled(bool on)
{
updateEnabled = on;
}
* @return minimum coordinate of the entity.
* @see calculateBorders()
*/
-Vector RS_Entity::getMin() const
+Vector Entity::getMin() const
{
return minV;
}
* @return minimum coordinate of the entity.
* @see calculateBorders()
*/
-Vector RS_Entity::getMax() const
+Vector Entity::getMax() const
{
return maxV;
}
* @see getMin()
* @see getMax()
*/
-Vector RS_Entity::getSize() const
+Vector Entity::getSize() const
{
return maxV - minV;
}
* @param key Variable name (e.g. "$DIMASZ")
* @param val Default value
*/
-void RS_Entity::addGraphicVariable(const QString & key, double val, int code)
+void Entity::addGraphicVariable(const QString & key, double val, int code)
{
Drawing * graphic = getGraphic();
* @param key Variable name (e.g. "$DIMASZ")
* @param val Default value
*/
-void RS_Entity::addGraphicVariable(const QString & key, int val, int code)
+void Entity::addGraphicVariable(const QString & key, int val, int code)
{
Drawing * graphic = getGraphic();
* @param key Variable name (e.g. "$DIMASZ")
* @param val Default value
*/
-void RS_Entity::addGraphicVariable(const QString & key, const QString & val, int code)
+void Entity::addGraphicVariable(const QString & key, const QString & val, int code)
{
Drawing * graphic = getGraphic();
* @return value of variable or default value if the given variable
* doesn't exist.
*/
-double RS_Entity::getGraphicVariableDouble(const QString & key, double def)
+double Entity::getGraphicVariableDouble(const QString & key, double def)
{
Drawing * graphic = getGraphic();
double ret = def;
* @return value of variable or default value if the given variable
* doesn't exist.
*/
-int RS_Entity::getGraphicVariableInt(const QString & key, int def)
+int Entity::getGraphicVariableInt(const QString & key, int def)
{
Drawing * graphic = getGraphic();
int ret = def;
* @return value of variable or default value if the given variable
* doesn't exist.
*/
-QString RS_Entity::getGraphicVariableString(const QString & key, const QString & def)
+QString Entity::getGraphicVariableString(const QString & key, const QString & def)
{
Drawing * graphic = getGraphic();
QString ret = def;
* @return The unit the parent graphic works on or None if there's no
* parent graphic.
*/
-RS2::Unit RS_Entity::getGraphicUnit()
+RS2::Unit Entity::getGraphicUnit()
{
Drawing * graphic = getGraphic();
RS2::Unit ret = RS2::None;
/**
* Must be overwritten to get all reference points of the entity.
*/
-/*virtual*/ VectorSolutions RS_Entity::getRefPoints()
+/*virtual*/ VectorSolutions Entity::getRefPoints()
{
VectorSolutions ret;
return ret;
*
* @return The point with the given distance to the start- or endpoint.
*/
-/*virtual*/ Vector RS_Entity::getNearestDist(double /*distance*/, bool /*startp*/)
+/*virtual*/ Vector Entity::getNearestDist(double /*distance*/, bool /*startp*/)
{
return Vector(false);
}
*
* @return The closest point with the given distance to the endpoint.
*/
-/*virtual*/ Vector RS_Entity::getNearestRef(const Vector & coord, double * dist/*= NULL*/)
+/*virtual*/ Vector Entity::getNearestRef(const Vector & coord, double * dist/*= NULL*/)
{
VectorSolutions s = getRefPoints();
*
* @return The closest point with the given distance to the endpoint.
*/
-/*virtual*/ Vector RS_Entity::getNearestSelectedRef(const Vector & coord, double * dist/*= NULL*/)
+/*virtual*/ Vector Entity::getNearestSelectedRef(const Vector & coord, double * dist/*= NULL*/)
{
if (isSelected())
return getNearestRef(coord, dist);
* Acts like scale(Vector) but with equal factors.
* Equal to scale(center, Vector(factor, factor)).
*/
-/*virtual*/ void RS_Entity::scale(Vector center, double factor)
+/*virtual*/ void Entity::scale(Vector center, double factor)
{
scale(center, Vector(factor, factor));
}
* Implementations must drag the reference point(s) of all
* (sub-)entities that are very close to ref by offset.
*/
-/*virtual*/ void RS_Entity::moveRef(const Vector &/*ref*/, const Vector &/*offset*/)
+/*virtual*/ void Entity::moveRef(const Vector &/*ref*/, const Vector &/*offset*/)
{
return;
}
* Implementations must drag the reference point(s) of selected
* (sub-)entities that are very close to ref by offset.
*/
-/*virtual*/ void RS_Entity::moveSelectedRef(const Vector &/*ref*/, const Vector &/*offset*/)
+/*virtual*/ void Entity::moveSelectedRef(const Vector &/*ref*/, const Vector &/*offset*/)
{
return;
}
* layer NULL is returned. If all parents are on layer NULL, NULL
* is returned.
*/
-RS_Layer * RS_Entity::getLayer(bool resolve) const
+Layer * Entity::getLayer(bool resolve) const
{
if (resolve)
{
/**
* Sets the layer of this entity to the layer with the given name
*/
-void RS_Entity::setLayer(const QString & name)
+void Entity::setLayer(const QString & name)
{
Drawing * graphic = getGraphic();
/**
* Sets the layer of this entity to the layer given.
*/
-void RS_Entity::setLayer(RS_Layer * l)
+void Entity::setLayer(Layer * l)
{
layer = l;
}
* the graphic this entity is in. If this entity (and none
* of its parents) are in a graphic the layer is set to NULL.
*/
-void RS_Entity::setLayerToActive()
+void Entity::setLayerToActive()
{
Drawing * graphic = getGraphic();
*
* @return Pen for this entity.
*/
-RS_Pen RS_Entity::getPen(bool resolve) const
+Pen Entity::getPen(bool resolve) const
{
if (!resolve)
return pen;
else
{
- RS_Pen p = pen;
- RS_Layer * l = getLayer(true);
+ Pen p = pen;
+ Layer * l = getLayer(true);
// use parental attributes (e.g. vertex of a polyline, block
// entities when they are drawn in block documents):
* Sets the explicit pen for this entity or a pen with special
* attributes such as BY_LAYER, ..
*/
-void RS_Entity::setPen(const RS_Pen & pen)
+void Entity::setPen(const Pen & pen)
{
this->pen = pen;
}
* the graphic this entity is in. If this entity (and none
* of its parents) are in a graphic the pen is not changed.
*/
-void RS_Entity::setPenToActive()
+void Entity::setPenToActive()
{
- RS_Document * doc = getDocument();
+ Document * doc = getDocument();
if (doc != NULL)
pen = doc->getActivePen();
else
{
- //RS_DEBUG->print(RS_Debug::D_WARNING, "RS_Entity::setPenToActive(): "
+ //DEBUG->print(Debug::D_WARNING, "Entity::setPenToActive(): "
// "No document / active pen linked to this entity.");
}
//else {
- // pen = RS_Pen();
+ // pen = Pen();
//}
}
* by the given offset. This default implementation moves the
* whole entity if it is completely inside the given range.
*/
-void RS_Entity::stretch(Vector firstCorner, Vector secondCorner, Vector offset)
+void Entity::stretch(Vector firstCorner, Vector secondCorner, Vector offset)
{
//e->calculateBorders();
if (getMin().isInWindow(firstCorner, secondCorner)
* @return Factor for scaling the line styles considering the current
* paper scaling and the fact that styles are stored in Millimeter.
*/
-double RS_Entity::getStyleFactor(GraphicView * view)
+double Entity::getStyleFactor(GraphicView * view)
{
double styleFactor = 1.0;
{
unit = g->getUnit();
//double scale = g->getPaperScale();
- styleFactor = RS_Units::convert(1.0, RS2::Millimeter, unit);
+ styleFactor = Units::convert(1.0, RS2::Millimeter, unit);
// / scale;
}
}
}
- //RS_DEBUG->print("stylefactor: %f", styleFactor);
- //RS_DEBUG->print("viewfactor: %f", view->getFactor().x);
+ //DEBUG->print("stylefactor: %f", styleFactor);
+ //DEBUG->print("viewfactor: %f", view->getFactor().x);
if (styleFactor * view->getFactor().x < 0.2)
styleFactor = -1.0;
/**
* @return User defined variable connected to this entity.
*/
-QString * RS_Entity::getUserDefVar(QString key)
+QString * Entity::getUserDefVar(QString key)
{
// return (this->varList.find(key));
return (this->varList.value(key));
/**
* Add a user defined variable to this entity.
*/
-void RS_Entity::setUserDefVar(QString key, QString val)
+void Entity::setUserDefVar(QString key, QString val)
{
varList.insert(key, new QString(val));
}
/**
* Deletes the given user defined variable.
*/
-void RS_Entity::delUserDefVar(QString key)
+void Entity::delUserDefVar(QString key)
{
varList.remove(key);
}
/**
* @return A list of all keys connected to this entity.
*/
-QStringList RS_Entity::getAllKeys()
+QStringList Entity::getAllKeys()
{
QStringList keys;
// Q3DictIterator<QString> it(varList);
/**
* Dumps the elements data to stdout.
*/
-std::ostream & operator<<(std::ostream & os, RS_Entity & e)
+std::ostream & operator<<(std::ostream & os, Entity & e)
{
//os << "Warning: Virtual entity!\n";
//return os;
switch (e.rtti())
{
case RS2::EntityPoint:
- os << (RS_Point &)e;
+ os << (Point &)e;
break;
case RS2::EntityLine:
- os << (RS_Line &)e;
+ os << (Line &)e;
break;
case RS2::EntityPolyline:
- os << (RS_Polyline &)e;
+ os << (Polyline &)e;
break;
case RS2::EntityArc:
- os << (RS_Arc &)e;
+ os << (Arc &)e;
break;
case RS2::EntityCircle:
- os << (RS_Circle &)e;
+ os << (Circle &)e;
break;
case RS2::EntityEllipse:
- os << (RS_Ellipse &)e;
+ os << (Ellipse &)e;
break;
case RS2::EntityInsert:
- os << (RS_Insert &)e;
+ os << (Insert &)e;
break;
case RS2::EntityText:
- os << (RS_Text &)e;
+ os << (Text &)e;
break;
default:
#define __ENTITY_H__
#include <QtCore>
-#include "rs.h"
+#include "enums.h"
#include "layer.h"
#include "mathextra.h"
#include "pen.h"
#include "vector.h"
#include "vectorsolutions.h"
-class RS_Arc;
-class RS_Block;
-class RS_Circle;
-class RS_Document;
-class RS_EntityContainer;
+class Arc;
+class Block;
+class Circle;
+class Document;
+class EntityContainer;
class Drawing;
class GraphicView;
-class RS_Insert;
-class RS_Line;
-class RS_Point;
-class RS_Polyline;
-class RS_Text;
+class Insert;
+class Line;
+class Point;
+class Polyline;
+class Text;
class PaintInterface;
/**
*
* @author Andrew Mustun
*/
-class RS_Entity: public RS_Undoable
+class Entity: public Undoable
{
public:
- RS_Entity(RS_EntityContainer * parent = NULL);
- virtual ~RS_Entity();
+ Entity(EntityContainer * parent = NULL);
+ virtual ~Entity();
void init();
virtual void initId();
- virtual RS_Entity * clone() = 0;
- virtual void reparent(RS_EntityContainer * parent);
+ virtual Entity * clone() = 0;
+ virtual void reparent(EntityContainer * parent);
void resetBorders();
virtual RS2::EntityType rtti() const;
virtual RS2::UndoableType undoRtti();
virtual unsigned long int countDeep() = 0;
virtual double getLength();
- RS_EntityContainer * getParent() const;
- void setParent(RS_EntityContainer * p);
+ EntityContainer * getParent() const;
+ void setParent(EntityContainer * p);
Drawing * getGraphic();
- RS_Block * getBlock();
- RS_Insert * getInsert();
- RS_Entity * getBlockOrInsert();
- RS_Document * getDocument();
+ Block * getBlock();
+ Insert * getInsert();
+ Entity * getBlockOrInsert();
+ Document * getDocument();
void setLayer(const QString & name);
- void setLayer(RS_Layer * l);
+ void setLayer(Layer * l);
void setLayerToActive();
- RS_Layer * getLayer(bool resolve = true) const;
- void setPen(const RS_Pen & pen);
+ Layer * getLayer(bool resolve = true) const;
+ void setPen(const Pen & pen);
void setPenToActive();
- RS_Pen getPen(bool resolve = true) const;
+ Pen getPen(bool resolve = true) const;
/**
* Must be overwritten to return true if an entity type
* @return The closest coordinate.
*/
virtual Vector getNearestPointOnEntity(const Vector& /*coord*/,
- bool onEntity = true, double * dist = NULL, RS_Entity ** entity = NULL) = 0;
+ bool onEntity = true, double * dist = NULL, Entity ** entity = NULL) = 0;
/**
* Must be overwritten to get the (nearest) center point to the
*
* @return The measured distance between \p coord and the entity.
*/
- virtual double getDistanceToPoint(const Vector & coord, RS_Entity ** entity = NULL,
+ virtual double getDistanceToPoint(const Vector & coord, Entity ** entity = NULL,
RS2::ResolveLevel level = RS2::ResolveNone, double solidDist = RS_MAXDOUBLE) = 0;
virtual bool isPointOnEntity(const Vector & coord, double tolerance = RS_TOLERANCE);
void setUserDefVar(QString key, QString val);
void delUserDefVar(QString key);
- friend std::ostream & operator<<(std::ostream & os, RS_Entity & e);
+ friend std::ostream & operator<<(std::ostream & os, Entity & e);
/** Recalculates the borders of this entity. */
virtual void calculateBorders() = 0;
protected:
//! Entity's parent entity or NULL is this entity has no parent.
- RS_EntityContainer * parent;
+ EntityContainer * parent;
//! minimum coordinates
Vector minV;
//! maximum coordinates
Vector maxV;
//! Pointer to layer
- RS_Layer * layer;
+ Layer * layer;
//! Entity id
unsigned long int id;
//! pen (attributes) for this entity
- RS_Pen pen;
+ Pen pen;
//! auto updating enabled?
bool updateEnabled;
#include "graphicview.h"
#include "paintinterface.h"
-bool RS_EntityContainer::autoUpdateBorders = true;
+bool EntityContainer::autoUpdateBorders = true;
/**
* Default constructor.
*
* @param owner True if we own and also delete the entities.
*/
-RS_EntityContainer::RS_EntityContainer(RS_EntityContainer * parent/*= NULL*/, bool owner/*= true*/):
- RS_Entity(parent), entityIterator(entities)
+EntityContainer::EntityContainer(EntityContainer * parent/*= NULL*/, bool owner/*= true*/):
+ Entity(parent), entityIterator(entities)
//NOTE: This constructor may not be explicitly OR implicitly called, meaning that
// entityIterator will not get initialized!
{
#warning "!!! Need to deal with setAutoDelete() Qt3->Qt4 !!!"
// entities.setAutoDelete(owner);
- RS_DEBUG->print("RS_EntityContainer::RS_EntityContainer: owner: %d", (int)owner);
+ DEBUG->print("EntityContainer::EntityContainer: owner: %d", (int)owner);
subContainer = NULL;
//autoUpdateBorders = true;
}
* Copy constructor. Makes a deep copy of all entities.
*/
/*
-RS_EntityContainer::RS_EntityContainer(const RS_EntityContainer& ec)
- : RS_Entity(ec)
+EntityContainer::EntityContainer(const EntityContainer& ec)
+ : Entity(ec)
{
}
*/
/**
* Destructor.
*/
-RS_EntityContainer::~RS_EntityContainer()
+EntityContainer::~EntityContainer()
{
clear();
}
-RS_Entity * RS_EntityContainer::clone()
+Entity * EntityContainer::clone()
{
-// RS_DEBUG->print("RS_EntityContainer::clone: ori autoDel: %d", entities.autoDelete());
- RS_EntityContainer * ec = new RS_EntityContainer(*this);
+// DEBUG->print("EntityContainer::clone: ori autoDel: %d", entities.autoDelete());
+ EntityContainer * ec = new EntityContainer(*this);
#warning "!!! Need to deal with setAutoDelete() Qt3->Qt4 !!!"
// ec->entities.setAutoDelete(entities.autoDelete());
-// RS_DEBUG->print("RS_EntityContainer::clone: clone autoDel: %d", ec->entities.autoDelete());
+// DEBUG->print("EntityContainer::clone: clone autoDel: %d", ec->entities.autoDelete());
ec->detach();
ec->initId();
* Detaches shallow copies and creates deep copies of all subentities.
* This is called after cloning entity containers.
*/
-void RS_EntityContainer::detach()
+void EntityContainer::detach()
{
-// Q3PtrList<RS_Entity> tmp;
- QList<RS_Entity *> tmp;
+// Q3PtrList<Entity> tmp;
+ QList<Entity *> tmp;
#warning "!!! Need to deal with setAutoDelete() Qt3->Qt4 !!!"
// bool autoDel = entities.autoDelete();
-// RS_DEBUG->print("RS_EntityContainer::detach: autoDel: %d", (int)autoDel);
+// DEBUG->print("EntityContainer::detach: autoDel: %d", (int)autoDel);
// entities.setAutoDelete(false);
// make deep copies of all entities:
- for(RS_Entity * e=firstEntity(); e!=NULL; e=nextEntity())
+ for(Entity * e=firstEntity(); e!=NULL; e=nextEntity())
{
if (!e->getFlag(RS2::FlagTemp))
{
// entities.setAutoDelete(autoDel);
// point to new deep copies:
-// for(RS_Entity * e=tmp.first(); e!=NULL; e=tmp.next())
+// for(Entity * e=tmp.first(); e!=NULL; e=tmp.next())
for(int i=0; i<tmp.size(); i++)
{
- RS_Entity * e = tmp[i];
+ Entity * e = tmp[i];
entities.append(e);
e->reparent(this);
}
}
/** @return RS2::EntityContainer */
-/*virtual*/ RS2::EntityType RS_EntityContainer::rtti() const
+/*virtual*/ RS2::EntityType EntityContainer::rtti() const
{
return RS2::EntityContainer;
}
-void RS_EntityContainer::reparent(RS_EntityContainer * parent)
+void EntityContainer::reparent(EntityContainer * parent)
{
- RS_Entity::reparent(parent);
+ Entity::reparent(parent);
// All sub-entities:
- for(RS_Entity * e=firstEntity(RS2::ResolveNone); e!=NULL; e=nextEntity(RS2::ResolveNone))
+ for(Entity * e=firstEntity(RS2::ResolveNone); e!=NULL; e=nextEntity(RS2::ResolveNone))
{
e->reparent(parent);
}
* @return true: because entities made from this class
* and subclasses are containers for other entities.
*/
-/*virtual*/ bool RS_EntityContainer::isContainer() const
+/*virtual*/ bool EntityContainer::isContainer() const
{
return true;
}
* @return false: because entities made from this class
* and subclasses are containers for other entities.
*/
-/*virtual*/ bool RS_EntityContainer::isAtomic() const
+/*virtual*/ bool EntityContainer::isAtomic() const
{
return false;
}
* @param undone true: entity has become invisible.
* false: entity has become visible.
*/
-void RS_EntityContainer::undoStateChanged(bool undone)
+void EntityContainer::undoStateChanged(bool undone)
{
- RS_Entity::undoStateChanged(undone);
+ Entity::undoStateChanged(undone);
// ! don't pass on to subentities. undo list handles them
// All sub-entities:
- /*for (RS_Entity* e=firstEntity(RS2::ResolveNone);
+ /*for (Entity* e=firstEntity(RS2::ResolveNone);
e!=NULL;
e=nextEntity(RS2::ResolveNone)) {
e->setUndoState(undone);
}*/
}
-void RS_EntityContainer::setVisible(bool v)
+void EntityContainer::setVisible(bool v)
{
- RS_DEBUG->print("RS_EntityContainer::setVisible: %d", v);
- RS_Entity::setVisible(v);
+ DEBUG->print("EntityContainer::setVisible: %d", v);
+ Entity::setVisible(v);
// All sub-entities:
- for(RS_Entity * e=firstEntity(RS2::ResolveNone); e!=NULL; e=nextEntity(RS2::ResolveNone))
+ for(Entity * e=firstEntity(RS2::ResolveNone); e!=NULL; e=nextEntity(RS2::ResolveNone))
{
- RS_DEBUG->print("RS_EntityContainer::setVisible: subentity: %d", v);
+ DEBUG->print("EntityContainer::setVisible: subentity: %d", v);
e->setVisible(v);
}
}
/**
* @return Total length of all entities in this container.
*/
-double RS_EntityContainer::getLength()
+double EntityContainer::getLength()
{
double ret = 0.0;
- for(RS_Entity * e=firstEntity(RS2::ResolveNone); e!=NULL; e=nextEntity(RS2::ResolveNone))
+ for(Entity * e=firstEntity(RS2::ResolveNone); e!=NULL; e=nextEntity(RS2::ResolveNone))
{
if (e->isVisible())
{
/**
* Selects this entity.
*/
-bool RS_EntityContainer::setSelected(bool select)
+bool EntityContainer::setSelected(bool select)
{
// This entity's select:
- if (RS_Entity::setSelected(select))
+ if (Entity::setSelected(select))
{
// All sub-entity's select:
- for(RS_Entity * e=firstEntity(RS2::ResolveNone); e!=NULL; e=nextEntity(RS2::ResolveNone))
+ for(Entity * e=firstEntity(RS2::ResolveNone); e!=NULL; e=nextEntity(RS2::ResolveNone))
{
if (e->isVisible())
{
/**
* Toggles select on this entity.
*/
-bool RS_EntityContainer::toggleSelected()
+bool EntityContainer::toggleSelected()
{
// Toggle this entity's select:
- if (RS_Entity::toggleSelected())
+ if (Entity::toggleSelected())
{
// Toggle all sub-entity's select:
- /*for (RS_Entity* e=firstEntity(RS2::ResolveNone);
+ /*for (Entity* e=firstEntity(RS2::ResolveNone);
e!=NULL;
e=nextEntity(RS2::ResolveNone)) {
e->toggleSelected();
*
* @param select True to select, False to deselect the entities.
*/
-void RS_EntityContainer::selectWindow(Vector v1, Vector v2, bool select, bool cross)
+void EntityContainer::selectWindow(Vector v1, Vector v2, bool select, bool cross)
{
bool included;
- for(RS_Entity * e=firstEntity(RS2::ResolveNone); e!=NULL; e=nextEntity(RS2::ResolveNone))
+ for(Entity * e=firstEntity(RS2::ResolveNone); e!=NULL; e=nextEntity(RS2::ResolveNone))
{
included = false;
}
else if (cross == true)
{
- RS_Line l[] =
+ Line l[] =
{
- RS_Line(NULL, RS_LineData(v1, Vector(v2.x, v1.y))),
- RS_Line(NULL, RS_LineData(Vector(v2.x, v1.y), v2)),
- RS_Line(NULL, RS_LineData(v2, Vector(v1.x, v2.y))),
- RS_Line(NULL, RS_LineData(Vector(v1.x, v2.y), v1))
+ Line(NULL, LineData(v1, Vector(v2.x, v1.y))),
+ Line(NULL, LineData(Vector(v2.x, v1.y), v2)),
+ Line(NULL, LineData(v2, Vector(v1.x, v2.y))),
+ Line(NULL, LineData(Vector(v1.x, v2.y), v1))
};
VectorSolutions sol;
if (e->isContainer())
{
- RS_EntityContainer * ec = (RS_EntityContainer *)e;
+ EntityContainer * ec = (EntityContainer *)e;
- for(RS_Entity * se=ec->firstEntity(RS2::ResolveAll); se!=NULL && included==false;
+ for(Entity * se=ec->firstEntity(RS2::ResolveAll); se!=NULL && included==false;
se=ec->nextEntity(RS2::ResolveAll))
{
for(int i=0; i<4; ++i)
{
- sol = RS_Information::getIntersection(se, &l[i], true);
+ sol = Information::getIntersection(se, &l[i], true);
if (sol.hasValid())
{
{
for(int i=0; i<4; ++i)
{
- sol = RS_Information::getIntersection(e, &l[i], true);
+ sol = Information::getIntersection(e, &l[i], true);
if (sol.hasValid())
{
* Adds a entity to this container and updates the borders of this
* entity-container if autoUpdateBorders is true.
*/
-void RS_EntityContainer::addEntity(RS_Entity * entity)
+void EntityContainer::addEntity(Entity * entity)
{
/*
if (isDocument()) {
- RS_LayerList* lst = getDocument()->getLayerList();
+ LayerList* lst = getDocument()->getLayerList();
if (lst!=NULL) {
- RS_Layer* l = lst->getActive();
+ Layer* l = lst->getActive();
if (l!=NULL && l->isLocked()) {
return;
}
}
}
*/
-//printf("RS_EntityContainer::addEntity(): entity=%08X\n", entity);
+//printf("EntityContainer::addEntity(): entity=%08X\n", entity);
if (!entity)
return;
* Inserts a entity to this container at the given position and updates
* the borders of this entity-container if autoUpdateBorders is true.
*/
-void RS_EntityContainer::insertEntity(int index, RS_Entity * entity)
+void EntityContainer::insertEntity(int index, Entity * entity)
{
if (entity == NULL)
return;
* Replaces the entity at the given index with the given entity
* and updates the borders of this entity-container if autoUpdateBorders is true.
*/
-void RS_EntityContainer::replaceEntity(int index, RS_Entity * entity)
+void EntityContainer::replaceEntity(int index, Entity * entity)
{
if (entity == NULL)
return;
* Removes an entity from this container and updates the borders of
* this entity-container if autoUpdateBorders is true.
*/
-bool RS_EntityContainer::removeEntity(RS_Entity * entity)
+bool EntityContainer::removeEntity(Entity * entity)
{
// bool ret = entities.remove(entity);
bool ret = (bool)entities.removeAll(entity);
/**
* Erases all entities in this container and resets the borders..
*/
-void RS_EntityContainer::clear()
+void EntityContainer::clear()
{
entities.clear();
resetBorders();
/**
* Counts all entities (branches of the tree).
*/
-unsigned long int RS_EntityContainer::count()
+unsigned long int EntityContainer::count()
{
return entities.count();
}
/**
* Counts all entities (leaves of the tree).
*/
-unsigned long int RS_EntityContainer::countDeep()
+unsigned long int EntityContainer::countDeep()
{
unsigned long int c = 0;
- for(RS_Entity * t=firstEntity(RS2::ResolveNone); t!=NULL; t=nextEntity(RS2::ResolveNone))
+ for(Entity * t=firstEntity(RS2::ResolveNone); t!=NULL; t=nextEntity(RS2::ResolveNone))
{
c += t->countDeep();
}
/**
* Counts the selected entities in this container.
*/
-unsigned long int RS_EntityContainer::countSelected()
+unsigned long int EntityContainer::countSelected()
{
unsigned long int c = 0;
- for(RS_Entity * t=firstEntity(RS2::ResolveNone); t!=NULL; t=nextEntity(RS2::ResolveNone))
+ for(Entity * t=firstEntity(RS2::ResolveNone); t!=NULL; t=nextEntity(RS2::ResolveNone))
{
if (t->isSelected())
{
* Enables / disables automatic update of borders on entity removals
* and additions. By default this is turned on.
*/
-/*virtual*/ void RS_EntityContainer::setAutoUpdateBorders(bool enable)
+/*virtual*/ void EntityContainer::setAutoUpdateBorders(bool enable)
{
autoUpdateBorders = enable;
}
/**
* Adjusts the borders of this graphic (max/min values)
*/
-void RS_EntityContainer::adjustBorders(RS_Entity * entity)
+void EntityContainer::adjustBorders(Entity * entity)
{
- //RS_DEBUG->print("RS_EntityContainer::adjustBorders");
+ //DEBUG->print("EntityContainer::adjustBorders");
//resetBorders();
if (entity != NULL)
/**
* Recalculates the borders of this entity container.
*/
-void RS_EntityContainer::calculateBorders()
+void EntityContainer::calculateBorders()
{
- RS_DEBUG->print("RS_EntityContainer::calculateBorders");
+ DEBUG->print("EntityContainer::calculateBorders");
resetBorders();
- for(RS_Entity * e=firstEntity(RS2::ResolveNone); e!=NULL; e=nextEntity(RS2::ResolveNone))
+ for(Entity * e=firstEntity(RS2::ResolveNone); e!=NULL; e=nextEntity(RS2::ResolveNone))
{
- RS_Layer * layer = e->getLayer();
+ Layer * layer = e->getLayer();
- RS_DEBUG->print("RS_EntityContainer::calculateBorders: isVisible: %d", (int)e->isVisible());
+ DEBUG->print("EntityContainer::calculateBorders: isVisible: %d", (int)e->isVisible());
if (e->isVisible() && (layer == NULL || !layer->isFrozen()))
{
}
}
- RS_DEBUG->print("RS_EntityContainer::calculateBorders: size 1: %f,%f", getSize().x, getSize().y);
+ DEBUG->print("EntityContainer::calculateBorders: size 1: %f,%f", getSize().x, getSize().y);
// needed for correcting corrupt data (PLANS.dxf)
if (minV.x > maxV.x || minV.x > RS_MAXDOUBLE || maxV.x > RS_MAXDOUBLE
maxV.y = 0.0;
}
- RS_DEBUG->print("RS_EntityCotnainer::calculateBorders: size: %f,%f", getSize().x, getSize().y);
+ DEBUG->print("EntityCotnainer::calculateBorders: size: %f,%f", getSize().x, getSize().y);
- //RS_DEBUG->print(" borders: %f/%f %f/%f", minV.x, minV.y, maxV.x, maxV.y);
+ //DEBUG->print(" borders: %f/%f %f/%f", minV.x, minV.y, maxV.x, maxV.y);
//printf("borders: %lf/%lf %lf/%lf\n", minV.x, minV.y, maxV.x, maxV.y);
- //RS_Entity::calculateBorders();
+ //Entity::calculateBorders();
}
/**
* Recalculates the borders of this entity container including
* invisible entities.
*/
-void RS_EntityContainer::forcedCalculateBorders()
+void EntityContainer::forcedCalculateBorders()
{
- //RS_DEBUG->print("RS_EntityContainer::calculateBorders");
+ //DEBUG->print("EntityContainer::calculateBorders");
resetBorders();
- for(RS_Entity * e=firstEntity(RS2::ResolveNone); e!=NULL; e=nextEntity(RS2::ResolveNone))
+ for(Entity * e=firstEntity(RS2::ResolveNone); e!=NULL; e=nextEntity(RS2::ResolveNone))
{
- //RS_Layer* layer = e->getLayer();
+ //Layer* layer = e->getLayer();
if (e->isContainer())
{
- ((RS_EntityContainer *)e)->forcedCalculateBorders();
+ ((EntityContainer *)e)->forcedCalculateBorders();
}
else
{
maxV.y = 0.0;
}
- //RS_DEBUG->print(" borders: %f/%f %f/%f", minV.x, minV.y, maxV.x, maxV.y);
+ //DEBUG->print(" borders: %f/%f %f/%f", minV.x, minV.y, maxV.x, maxV.y);
//printf("borders: %lf/%lf %lf/%lf\n", minV.x, minV.y, maxV.x, maxV.y);
- //RS_Entity::calculateBorders();
+ //Entity::calculateBorders();
}
/**
* Updates all Dimension entities in this container and
* reposition their labels.
*/
-void RS_EntityContainer::updateDimensions()
+void EntityContainer::updateDimensions()
{
- RS_DEBUG->print("RS_EntityContainer::updateDimensions()");
+ DEBUG->print("EntityContainer::updateDimensions()");
- //for (RS_Entity* e=firstEntity(RS2::ResolveNone);
+ //for (Entity* e=firstEntity(RS2::ResolveNone);
// e!=NULL;
// e=nextEntity(RS2::ResolveNone)) {
#if 0
-// Q3PtrListIterator<RS_Entity> it = createIterator();
- QListIterator<RS_Entity *> it = createIterator();
-// return QListIterator<RS_Entity *>(entities);
+// Q3PtrListIterator<Entity> it = createIterator();
+ QListIterator<Entity *> it = createIterator();
+// return QListIterator<Entity *>(entities);
- RS_Entity * e;
+ Entity * e;
while ((e = it.current()) != NULL)
{
++it;
- if (RS_Information::isDimension(e->rtti()))
+ if (Information::isDimension(e->rtti()))
{
// update and reposition label:
- ((RS_Dimension *)e)->update(true);
+ ((Dimension *)e)->update(true);
}
else if (e->isContainer())
{
- ((RS_EntityContainer *)e)->updateDimensions();
+ ((EntityContainer *)e)->updateDimensions();
}
}
#else
for(int i=0; i<entities.size(); i++)
{
- RS_Entity * e = entities[i];
+ Entity * e = entities[i];
- if (RS_Information::isDimension(e->rtti()))
+ if (Information::isDimension(e->rtti()))
// update and reposition label:
- ((RS_Dimension *)e)->update(true);
+ ((Dimension *)e)->update(true);
else if (e->isContainer())
- ((RS_EntityContainer *)e)->updateDimensions();
+ ((EntityContainer *)e)->updateDimensions();
}
#endif
- RS_DEBUG->print("RS_EntityContainer::updateDimensions() OK");
+ DEBUG->print("EntityContainer::updateDimensions() OK");
}
/**
* Updates all Insert entities in this container.
*/
-void RS_EntityContainer::updateInserts()
+void EntityContainer::updateInserts()
{
- RS_DEBUG->print("RS_EntityContainer::updateInserts()");
+ DEBUG->print("EntityContainer::updateInserts()");
- //for (RS_Entity* e=firstEntity(RS2::ResolveNone);
+ //for (Entity* e=firstEntity(RS2::ResolveNone);
// e!=NULL;
// e=nextEntity(RS2::ResolveNone)) {
#if 0
- Q3PtrListIterator<RS_Entity> it = createIterator();
- RS_Entity * e;
+ Q3PtrListIterator<Entity> it = createIterator();
+ Entity * e;
while ((e = it.current()) != NULL)
{
//// Only update our own inserts and not inserts of inserts
if (e->rtti() == RS2::EntityInsert /*&& e->getParent()==this*/)
{
- ((RS_Insert *)e)->update();
+ ((Insert *)e)->update();
}
else if (e->isContainer() && e->rtti() != RS2::EntityHatch)
{
- ((RS_EntityContainer *)e)->updateInserts();
+ ((EntityContainer *)e)->updateInserts();
}
}
#else
for(int i=0; i<entities.size(); i++)
{
- RS_Entity * e = entities[i];
+ Entity * e = entities[i];
//// Only update our own inserts and not inserts of inserts
if (e->rtti() == RS2::EntityInsert /*&& e->getParent()==this*/)
- ((RS_Insert *)e)->update();
+ ((Insert *)e)->update();
else if (e->isContainer() && e->rtti() != RS2::EntityHatch)
- ((RS_EntityContainer *)e)->updateInserts();
+ ((EntityContainer *)e)->updateInserts();
}
#endif
- RS_DEBUG->print("RS_EntityContainer::updateInserts() OK");
+ DEBUG->print("EntityContainer::updateInserts() OK");
}
/**
* Renames all inserts with name 'oldName' to 'newName'. This is
* called after a block was rename to update the inserts.
*/
-void RS_EntityContainer::renameInserts(const QString& oldName, const QString& newName)
+void EntityContainer::renameInserts(const QString& oldName, const QString& newName)
{
- RS_DEBUG->print("RS_EntityContainer::renameInserts()");
+ DEBUG->print("EntityContainer::renameInserts()");
- //for (RS_Entity* e=firstEntity(RS2::ResolveNone);
+ //for (Entity* e=firstEntity(RS2::ResolveNone);
// e!=NULL;
// e=nextEntity(RS2::ResolveNone)) {
#if 0
- Q3PtrListIterator<RS_Entity> it = createIterator();
- RS_Entity* e;
+ Q3PtrListIterator<Entity> it = createIterator();
+ Entity* e;
while ( (e = it.current()) != NULL ) {
++it;
if (e->rtti()==RS2::EntityInsert) {
- RS_Insert* i = ((RS_Insert*)e);
+ Insert* i = ((Insert*)e);
if (i->getName()==oldName) {
i->setName(newName);
}
} else if (e->isContainer()) {
- ((RS_EntityContainer*)e)->renameInserts(oldName, newName);
+ ((EntityContainer*)e)->renameInserts(oldName, newName);
}
}
#else
for(int i=0; i<entities.size(); i++)
{
- RS_Entity * e = entities[i];
+ Entity * e = entities[i];
if (e->rtti() == RS2::EntityInsert)
{
- RS_Insert * i = ((RS_Insert *)e);
+ Insert * i = ((Insert *)e);
if (i->getName() == oldName)
i->setName(newName);
}
else if (e->isContainer())
- ((RS_EntityContainer *)e)->renameInserts(oldName, newName);
+ ((EntityContainer *)e)->renameInserts(oldName, newName);
}
#endif
- RS_DEBUG->print("RS_EntityContainer::renameInserts() OK");
+ DEBUG->print("EntityContainer::renameInserts() OK");
}
/**
* Updates all Spline entities in this container.
*/
-void RS_EntityContainer::updateSplines()
+void EntityContainer::updateSplines()
{
- RS_DEBUG->print("RS_EntityContainer::updateSplines()");
+ DEBUG->print("EntityContainer::updateSplines()");
- //for (RS_Entity* e=firstEntity(RS2::ResolveNone);
+ //for (Entity* e=firstEntity(RS2::ResolveNone);
// e!=NULL;
// e=nextEntity(RS2::ResolveNone)) {
#if 0
- Q3PtrListIterator<RS_Entity> it = createIterator();
- RS_Entity* e;
+ Q3PtrListIterator<Entity> it = createIterator();
+ Entity* e;
while ( (e = it.current()) != NULL ) {
++it;
//// Only update our own inserts and not inserts of inserts
if (e->rtti()==RS2::EntitySpline /*&& e->getParent()==this*/) {
- ((RS_Spline*)e)->update();
+ ((Spline*)e)->update();
} else if (e->isContainer() && e->rtti()!=RS2::EntityHatch) {
- ((RS_EntityContainer*)e)->updateSplines();
+ ((EntityContainer*)e)->updateSplines();
}
}
#else
for(int i=0; i<entities.size(); i++)
{
- RS_Entity * e = entities[i];
+ Entity * e = entities[i];
//// Only update our own inserts and not inserts of inserts
if (e->rtti() == RS2::EntitySpline /*&& e->getParent()==this*/)
- ((RS_Spline *)e)->update();
+ ((Spline *)e)->update();
else if (e->isContainer() && e->rtti() != RS2::EntityHatch)
- ((RS_EntityContainer *)e)->updateSplines();
+ ((EntityContainer *)e)->updateSplines();
}
#endif
- RS_DEBUG->print("RS_EntityContainer::updateSplines() OK");
+ DEBUG->print("EntityContainer::updateSplines() OK");
}
/**
* Updates the sub entities of this container.
*/
-void RS_EntityContainer::update()
+void EntityContainer::update()
{
- //for (RS_Entity* e=firstEntity(RS2::ResolveNone);
+ //for (Entity* e=firstEntity(RS2::ResolveNone);
// e!=NULL;
// e=nextEntity(RS2::ResolveNone)) {
#if 0
- Q3PtrListIterator<RS_Entity> it = createIterator();
- RS_Entity* e;
+ Q3PtrListIterator<Entity> it = createIterator();
+ Entity* e;
while ( (e = it.current()) != NULL ) {
++it;
e->update();
#else
for(int i=0; i<entities.size(); i++)
{
-// RS_Entity * e = entities[i];
+// Entity * e = entities[i];
// e->update();
entities[i]->update();
}
* Returns the first entity or NULL if this graphic is empty.
* @param level
*/
-RS_Entity * RS_EntityContainer::firstEntity(RS2::ResolveLevel level)
+Entity * EntityContainer::firstEntity(RS2::ResolveLevel level)
{
switch (level)
{
case RS2::ResolveAllButInserts:
{
subContainer = NULL;
-// RS_Entity * e = entities.first();
+// Entity * e = entities.first();
// entityIterator.toFront();
entityIterator = entities;
- RS_Entity * e = (entityIterator.hasNext() ? entityIterator.next() : NULL);
+ Entity * e = (entityIterator.hasNext() ? entityIterator.next() : NULL);
if (e != NULL && e->isContainer() && e->rtti() != RS2::EntityInsert)
{
- subContainer = (RS_EntityContainer *)e;
- e = ((RS_EntityContainer *)e)->firstEntity(level);
+ subContainer = (EntityContainer *)e;
+ e = ((EntityContainer *)e)->firstEntity(level);
// emtpy container:
if (e == NULL)
case RS2::ResolveAll:
{
subContainer = NULL;
-// RS_Entity * e = entities.first();
+// Entity * e = entities.first();
// entityIterator.toFront();
entityIterator = entities;
- RS_Entity * e = (entityIterator.hasNext() ? entityIterator.next() : NULL);
+ Entity * e = (entityIterator.hasNext() ? entityIterator.next() : NULL);
if (e != NULL && e->isContainer())
{
- subContainer = (RS_EntityContainer *)e;
- e = ((RS_EntityContainer *)e)->firstEntity(level);
+ subContainer = (EntityContainer *)e;
+ e = ((EntityContainer *)e)->firstEntity(level);
// emtpy container:
if (e == NULL)
* \li \p 1 (default) only Groups are resolved
* \li \p 2 all Entity Containers are resolved
*/
-RS_Entity * RS_EntityContainer::lastEntity(RS2::ResolveLevel level)
+Entity * EntityContainer::lastEntity(RS2::ResolveLevel level)
{
switch (level)
{
case RS2::ResolveAllButInserts:
{
-// RS_Entity * e = entities.last();
+// Entity * e = entities.last();
entityIterator = entities;
entityIterator.toBack();
- RS_Entity * e = (entityIterator.hasPrevious() ? entityIterator.previous() : NULL);
+ Entity * e = (entityIterator.hasPrevious() ? entityIterator.previous() : NULL);
subContainer = NULL;
if (e != NULL && e->isContainer() && e->rtti() != RS2::EntityInsert)
{
- subContainer = (RS_EntityContainer *)e;
- e = ((RS_EntityContainer *)e)->lastEntity(level);
+ subContainer = (EntityContainer *)e;
+ e = ((EntityContainer *)e)->lastEntity(level);
}
return e;
case RS2::ResolveAll:
{
-// RS_Entity * e = entities.last();
+// Entity * e = entities.last();
entityIterator = entities;
entityIterator.toBack();
- RS_Entity * e = (entityIterator.hasPrevious() ? entityIterator.previous() : NULL);
+ Entity * e = (entityIterator.hasPrevious() ? entityIterator.previous() : NULL);
subContainer = NULL;
if (e != NULL && e->isContainer())
{
- subContainer = (RS_EntityContainer *)e;
- e = ((RS_EntityContainer *)e)->lastEntity(level);
+ subContainer = (EntityContainer *)e;
+ e = ((EntityContainer *)e)->lastEntity(level);
}
return e;
* Returns the next entity or container or \p NULL if the last entity
* returned by \p next() was the last entity in the container.
*/
-RS_Entity * RS_EntityContainer::nextEntity(RS2::ResolveLevel level)
+Entity * EntityContainer::nextEntity(RS2::ResolveLevel level)
{
switch (level)
{
case RS2::ResolveAllButInserts:
{
- RS_Entity * e = NULL;
+ Entity * e = NULL;
if (subContainer != NULL)
{
if (e != NULL && e->isContainer() && e->rtti() != RS2::EntityInsert)
{
- subContainer = (RS_EntityContainer *)e;
- e = ((RS_EntityContainer *)e)->firstEntity(level);
+ subContainer = (EntityContainer *)e;
+ e = ((EntityContainer *)e)->firstEntity(level);
// emtpy container:
if (e == NULL)
case RS2::ResolveAll:
{
- RS_Entity * e = NULL;
+ Entity * e = NULL;
if (subContainer != NULL)
{
if (e != NULL && e->isContainer())
{
- subContainer = (RS_EntityContainer *)e;
- e = ((RS_EntityContainer *)e)->firstEntity(level);
+ subContainer = (EntityContainer *)e;
+ e = ((EntityContainer *)e)->firstEntity(level);
// emtpy container:
if (e == NULL)
* Returns the prev entity or container or \p NULL if the last entity
* returned by \p prev() was the first entity in the container.
*/
-RS_Entity * RS_EntityContainer::prevEntity(RS2::ResolveLevel level)
+Entity * EntityContainer::prevEntity(RS2::ResolveLevel level)
{
- RS_Entity * e = NULL;
+ Entity * e = NULL;
switch (level)
{
if (e != NULL && e->isContainer() && e->rtti() != RS2::EntityInsert)
{
- subContainer = (RS_EntityContainer *)e;
- e = ((RS_EntityContainer *)e)->lastEntity(level);
+ subContainer = (EntityContainer *)e;
+ e = ((EntityContainer *)e)->lastEntity(level);
// emtpy container:
if (e == NULL)
if (e != NULL && e->isContainer())
{
- subContainer = (RS_EntityContainer *)e;
- e = ((RS_EntityContainer *)e)->lastEntity(level);
+ subContainer = (EntityContainer *)e;
+ e = ((EntityContainer *)e)->lastEntity(level);
// emtpy container:
if (e == NULL)
/**
* @return Entity at the given index or NULL if the index is out of range.
*/
-RS_Entity * RS_EntityContainer::entityAt(uint index)
+Entity * EntityContainer::entityAt(uint index)
{
return entities.at(index);
}
/**
* @return Current index.
*/
-int RS_EntityContainer::entityAt()
+int EntityContainer::entityAt()
{
#warning "!!! Not sure how to convert this from Qt3 -> Qt4 !!! (it seems we can ignore this for now as nothing calls it)"
// return entities.at();
/**
* Finds the given entity and makes it the current entity if found.
*/
-int RS_EntityContainer::findEntity(RS_Entity * entity)
+int EntityContainer::findEntity(Entity * entity)
{
// return entities.find(entity);
/**
* @return The current entity.
*/
-RS_Entity * RS_EntityContainer::currentEntity()
+Entity * EntityContainer::currentEntity()
{
// return entities.current();
/**
* Returns the copy to a new iterator for traversing the entities.
*/
-//Q3PtrListIterator<RS_Entity> RS_EntityContainer::createIterator()
-QListIterator<RS_Entity *> RS_EntityContainer::createIterator()
+//Q3PtrListIterator<Entity> EntityContainer::createIterator()
+QListIterator<Entity *> EntityContainer::createIterator()
{
-// return Q3PtrListIterator<RS_Entity>(entities);
- return QListIterator<RS_Entity *>(entities);
+// return Q3PtrListIterator<Entity>(entities);
+ return QListIterator<Entity *>(entities);
}
#endif
-/*virtual*/ bool RS_EntityContainer::isEmpty()
+/*virtual*/ bool EntityContainer::isEmpty()
{
return (count() == 0);
}
* @return The point which is closest to 'coord'
* (one of the vertexes)
*/
-Vector RS_EntityContainer::getNearestEndpoint(const Vector & coord, double * dist)
+Vector EntityContainer::getNearestEndpoint(const Vector & coord, double * dist)
{
double minDist = RS_MAXDOUBLE; // minimum measured distance
double curDist; // currently measured distance
Vector closestPoint(false); // closest found endpoint
Vector point; // endpoint found
- //Q3PtrListIterator<RS_Entity> it = createIterator();
- //RS_Entity* en;
+ //Q3PtrListIterator<Entity> it = createIterator();
+ //Entity* en;
//while ( (en = it.current()) != NULL ) {
// ++it;
- for (RS_Entity* en = firstEntity();
+ for (Entity* en = firstEntity();
en != NULL;
en = nextEntity()) {
return closestPoint;
}
-Vector RS_EntityContainer::getNearestPointOnEntity(const Vector & coord,
- bool onEntity, double * dist, RS_Entity ** entity)
+Vector EntityContainer::getNearestPointOnEntity(const Vector & coord,
+ bool onEntity, double * dist, Entity ** entity)
{
Vector point(false);
- RS_Entity * e = getNearestEntity(coord, dist, RS2::ResolveNone);
+ Entity * e = getNearestEntity(coord, dist, RS2::ResolveNone);
if (e && e->isVisible())
point = e->getNearestPointOnEntity(coord, onEntity, dist, entity);
return point;
}
-Vector RS_EntityContainer::getNearestCenter(const Vector & coord, double * dist)
+Vector EntityContainer::getNearestCenter(const Vector & coord, double * dist)
{
Vector point(false);
- RS_Entity * closestEntity = getNearestEntity(coord, NULL, RS2::ResolveNone);
+ Entity * closestEntity = getNearestEntity(coord, NULL, RS2::ResolveNone);
if (closestEntity)
point = closestEntity->getNearestCenter(coord, dist);
return point;
}
-Vector RS_EntityContainer::getNearestMiddle(const Vector & coord, double * dist)
+Vector EntityContainer::getNearestMiddle(const Vector & coord, double * dist)
{
Vector point(false);
- RS_Entity * closestEntity = getNearestEntity(coord, NULL, RS2::ResolveNone);
+ Entity * closestEntity = getNearestEntity(coord, NULL, RS2::ResolveNone);
if (closestEntity)
point = closestEntity->getNearestMiddle(coord, dist);
return point;
}
-Vector RS_EntityContainer::getNearestDist(double distance, const Vector & coord,
+Vector EntityContainer::getNearestDist(double distance, const Vector & coord,
double * dist)
{
Vector point(false);
- RS_Entity * closestEntity = getNearestEntity(coord, NULL, RS2::ResolveNone);
+ Entity * closestEntity = getNearestEntity(coord, NULL, RS2::ResolveNone);
if (closestEntity)
point = closestEntity->getNearestDist(distance, coord, dist);
/**
* @return The intersection which is closest to 'coord'
*/
-Vector RS_EntityContainer::getNearestIntersection(const Vector & coord,
+Vector EntityContainer::getNearestIntersection(const Vector & coord,
double * dist)
{
double minDist = RS_MAXDOUBLE; // minimum measured distance
Vector closestPoint(false); // closest found endpoint
Vector point; // endpoint found
VectorSolutions sol;
- RS_Entity * closestEntity;
+ Entity * closestEntity;
closestEntity = getNearestEntity(coord, NULL, RS2::ResolveAll);
if (closestEntity)
{
- for(RS_Entity * en=firstEntity(RS2::ResolveAll); en!=NULL;
+ for(Entity * en=firstEntity(RS2::ResolveAll); en!=NULL;
en = nextEntity(RS2::ResolveAll))
{
if (en->isVisible() && en!=closestEntity)
{
- sol = RS_Information::getIntersection(closestEntity, en, true);
+ sol = Information::getIntersection(closestEntity, en, true);
for(int i=0; i<4; i++)
{
return closestPoint;
}
-Vector RS_EntityContainer::getNearestRef(const Vector & coord, double * dist)
+Vector EntityContainer::getNearestRef(const Vector & coord, double * dist)
{
double minDist = RS_MAXDOUBLE; // minimum measured distance
double curDist; // currently measured distance
Vector closestPoint(false); // closest found endpoint
Vector point; // endpoint found
- for(RS_Entity * en=firstEntity(); en!=NULL; en=nextEntity())
+ for(Entity * en=firstEntity(); en!=NULL; en=nextEntity())
{
if (en->isVisible())
{
return closestPoint;
}
-Vector RS_EntityContainer::getNearestSelectedRef(const Vector & coord,
+Vector EntityContainer::getNearestSelectedRef(const Vector & coord,
double * dist)
{
double minDist = RS_MAXDOUBLE; // minimum measured distance
Vector closestPoint(false); // closest found endpoint
Vector point; // endpoint found
- for(RS_Entity * en=firstEntity(); en!=NULL; en=nextEntity())
+ for(Entity * en=firstEntity(); en!=NULL; en=nextEntity())
{
if (en->isVisible() && en->isSelected() && !en->isParentSelected())
{
return closestPoint;
}
-double RS_EntityContainer::getDistanceToPoint(const Vector & coord,
- RS_Entity ** entity, RS2::ResolveLevel level, double solidDist)
+double EntityContainer::getDistanceToPoint(const Vector & coord,
+ Entity ** entity, RS2::ResolveLevel level, double solidDist)
{
- RS_DEBUG->print("RS_EntityContainer::getDistanceToPoint");
+ DEBUG->print("EntityContainer::getDistanceToPoint");
double minDist = RS_MAXDOUBLE; // minimum measured distance
double curDist; // currently measured distance
- RS_Entity * closestEntity = NULL; // closest entity found
- RS_Entity * subEntity = NULL;
+ Entity * closestEntity = NULL; // closest entity found
+ Entity * subEntity = NULL;
//int k=0;
- for(RS_Entity * e=firstEntity(level); e!=NULL; e=nextEntity(level))
+ for(Entity * e=firstEntity(level); e!=NULL; e=nextEntity(level))
{
if (e->isVisible())
{
- RS_DEBUG->print("entity: getDistanceToPoint");
- RS_DEBUG->print("entity: %d", e->rtti());
+ DEBUG->print("entity: getDistanceToPoint");
+ DEBUG->print("entity: %d", e->rtti());
curDist = e->getDistanceToPoint(coord, &subEntity, level, solidDist);
- RS_DEBUG->print("entity: getDistanceToPoint: OK");
+ DEBUG->print("entity: getDistanceToPoint: OK");
if (curDist<minDist)
{
if (entity)
*entity = closestEntity;
- RS_DEBUG->print("RS_EntityContainer::getDistanceToPoint: OK");
+ DEBUG->print("EntityContainer::getDistanceToPoint: OK");
return minDist;
}
-RS_Entity * RS_EntityContainer::getNearestEntity(const Vector & coord,
+Entity * EntityContainer::getNearestEntity(const Vector & coord,
double * dist, RS2::ResolveLevel level)
{
- RS_DEBUG->print("RS_EntityContainer::getNearestEntity");
- RS_Entity * e = NULL;
+ DEBUG->print("EntityContainer::getNearestEntity");
+ Entity * e = NULL;
// distance for points inside solids:
double solidDist = RS_MAXDOUBLE;
if (dist)
*dist = d;
- RS_DEBUG->print("RS_EntityContainer::getNearestEntity: OK");
+ DEBUG->print("EntityContainer::getNearestEntity: OK");
return e;
}
* @retval true all contours were closed
* @retval false at least one contour is not closed
*/
-bool RS_EntityContainer::optimizeContours()
+bool EntityContainer::optimizeContours()
{
- RS_DEBUG->print("RS_EntityContainer::optimizeContours");
+ DEBUG->print("EntityContainer::optimizeContours");
Vector current(false);
Vector start(false);
- RS_EntityContainer tmp;
+ EntityContainer tmp;
bool changed = false;
bool closed = true;
for(uint ci=0; ci<count(); ++ci)
{
- RS_Entity * e1=entityAt(ci);
+ Entity * e1=entityAt(ci);
if (e1 && e1->isEdge() && !e1->isContainer() && !e1->isProcessed())
{
- RS_AtomicEntity * ce = (RS_AtomicEntity *)e1;
+ AtomicEntity * ce = (AtomicEntity *)e1;
// next contour start:
ce->setProcessed(true);
done = true;
for(uint ei=0; ei<count(); ++ei)
{
- RS_Entity * e2=entityAt(ei);
+ Entity * e2=entityAt(ei);
if (e2 != NULL && e2->isEdge() && !e2->isContainer() &&
!e2->isProcessed())
{
- RS_AtomicEntity * e = (RS_AtomicEntity *)e2;
+ AtomicEntity * e = (AtomicEntity *)e2;
if (e->getStartpoint().distanceTo(current) < 1.0e-4)
{
else if (e->getEndpoint().distanceTo(current) < 1.0e-4)
{
e->setProcessed(true);
- RS_AtomicEntity * cl = (RS_AtomicEntity *)e->clone();
+ AtomicEntity * cl = (AtomicEntity *)e->clone();
cl->reverse();
tmp.addEntity(cl);
current = cl->getEndpoint();
{
done = true;
- for(RS_Entity * en=firstEntity(); en!=NULL; en=nextEntity())
+ for(Entity * en=firstEntity(); en!=NULL; en=nextEntity())
{
if (!en->isContainer())
{
while (!done);
// add new sorted entities:
- for(RS_Entity * en=tmp.firstEntity(); en!=NULL; en=tmp.nextEntity())
+ for(Entity * en=tmp.firstEntity(); en!=NULL; en=tmp.nextEntity())
{
en->setProcessed(false);
addEntity(en->clone());
}
- RS_DEBUG->print("RS_EntityContainer::optimizeContours: OK");
+ DEBUG->print("EntityContainer::optimizeContours: OK");
return closed;
}
-bool RS_EntityContainer::hasEndpointsWithinWindow(Vector v1, Vector v2)
+bool EntityContainer::hasEndpointsWithinWindow(Vector v1, Vector v2)
{
- for(RS_Entity * e=firstEntity(RS2::ResolveNone); e!=NULL; e=nextEntity(RS2::ResolveNone))
+ for(Entity * e=firstEntity(RS2::ResolveNone); e!=NULL; e=nextEntity(RS2::ResolveNone))
{
if (e->hasEndpointsWithinWindow(v1, v2))
return true;
return false;
}
-void RS_EntityContainer::move(Vector offset)
+void EntityContainer::move(Vector offset)
{
- for(RS_Entity * e=firstEntity(RS2::ResolveNone); e!=NULL; e=nextEntity(RS2::ResolveNone))
+ for(Entity * e=firstEntity(RS2::ResolveNone); e!=NULL; e=nextEntity(RS2::ResolveNone))
e->move(offset);
if (autoUpdateBorders)
calculateBorders();
}
-void RS_EntityContainer::rotate(Vector center, double angle)
+void EntityContainer::rotate(Vector center, double angle)
{
- for(RS_Entity * e=firstEntity(RS2::ResolveNone); e!=NULL; e=nextEntity(RS2::ResolveNone))
+ for(Entity * e=firstEntity(RS2::ResolveNone); e!=NULL; e=nextEntity(RS2::ResolveNone))
e->rotate(center, angle);
if (autoUpdateBorders)
calculateBorders();
}
-void RS_EntityContainer::scale(Vector center, Vector factor)
+void EntityContainer::scale(Vector center, Vector factor)
{
if (fabs(factor.x) > RS_TOLERANCE && fabs(factor.y) > RS_TOLERANCE)
{
- for(RS_Entity * e=firstEntity(RS2::ResolveNone); e!=NULL; e=nextEntity(RS2::ResolveNone))
+ for(Entity * e=firstEntity(RS2::ResolveNone); e!=NULL; e=nextEntity(RS2::ResolveNone))
e->scale(center, factor);
}
calculateBorders();
}
-void RS_EntityContainer::mirror(Vector axisPoint1, Vector axisPoint2)
+void EntityContainer::mirror(Vector axisPoint1, Vector axisPoint2)
{
if (axisPoint1.distanceTo(axisPoint2) > 1.0e-6)
{
- for(RS_Entity * e=firstEntity(RS2::ResolveNone); e!=NULL; e=nextEntity(RS2::ResolveNone))
+ for(Entity * e=firstEntity(RS2::ResolveNone); e!=NULL; e=nextEntity(RS2::ResolveNone))
e->mirror(axisPoint1, axisPoint2);
}
}
-void RS_EntityContainer::stretch(Vector firstCorner, Vector secondCorner,
+void EntityContainer::stretch(Vector firstCorner, Vector secondCorner,
Vector offset)
{
if (getMin().isInWindow(firstCorner, secondCorner) &&
}
else
{
- for(RS_Entity * e=firstEntity(RS2::ResolveNone); e!=NULL; e=nextEntity(RS2::ResolveNone))
+ for(Entity * e=firstEntity(RS2::ResolveNone); e!=NULL; e=nextEntity(RS2::ResolveNone))
e->stretch(firstCorner, secondCorner, offset);
}
- // some entitiycontainers might need an update (e.g. RS_Leader):
+ // some entitiycontainers might need an update (e.g. Leader):
update();
}
-void RS_EntityContainer::moveRef(const Vector & ref, const Vector & offset)
+void EntityContainer::moveRef(const Vector & ref, const Vector & offset)
{
- for(RS_Entity* e=firstEntity(RS2::ResolveNone); e!=NULL; e=nextEntity(RS2::ResolveNone))
+ for(Entity* e=firstEntity(RS2::ResolveNone); e!=NULL; e=nextEntity(RS2::ResolveNone))
e->moveRef(ref, offset);
if (autoUpdateBorders)
calculateBorders();
}
-void RS_EntityContainer::moveSelectedRef(const Vector & ref, const Vector & offset)
+void EntityContainer::moveSelectedRef(const Vector & ref, const Vector & offset)
{
- for(RS_Entity * e=firstEntity(RS2::ResolveNone); e!=NULL; e=nextEntity(RS2::ResolveNone))
+ for(Entity * e=firstEntity(RS2::ResolveNone); e!=NULL; e=nextEntity(RS2::ResolveNone))
e->moveSelectedRef(ref, offset);
if (autoUpdateBorders)
calculateBorders();
}
-void RS_EntityContainer::draw(PaintInterface * painter, GraphicView * view, double /*patternOffset*/)
+void EntityContainer::draw(PaintInterface * painter, GraphicView * view, double /*patternOffset*/)
{
if (!painter || !view)
return;
- for(RS_Entity * e=firstEntity(RS2::ResolveNone); e!=NULL; e=nextEntity(RS2::ResolveNone))
+ for(Entity * e=firstEntity(RS2::ResolveNone); e!=NULL; e=nextEntity(RS2::ResolveNone))
#if 0
{
if (e->rtti() == RS2::EntityText)
{
std::cout << "About to draw TEXT entity... "
- << "TEXT=\"" << ((RS_Text *)e)->getText().toAscii().data() << "\"" << std::endl;
+ << "TEXT=\"" << ((Text *)e)->getText().toAscii().data() << "\"" << std::endl;
}
//OK, we have text, but no insert entities at least none that are drawn...
//Ah! But with a standard text entity, it DOES have them!
else if (e->rtti() == RS2::EntityInsert)
{
std::cout << "About to draw INSERT entity... "
- << "INSERT=\"" << ((RS_Insert *)e)->getData().name.toAscii().data() << "\"" << std::endl;
+ << "INSERT=\"" << ((Insert *)e)->getData().name.toAscii().data() << "\"" << std::endl;
}
#endif
view->drawEntity(e);
/**
* Dumps the entities to stdout.
*/
-std::ostream & operator<<(std::ostream & os, RS_EntityContainer & ec)
+std::ostream & operator<<(std::ostream & os, EntityContainer & ec)
{
static int indent = 0;
char * tab = new char[indent * 2 + 1];
os << tab << "Borders[" << id << "]: "
<< ec.minV << " - " << ec.maxV << "\n";
//os << tab << "Unit[" << id << "]: "
- //<< RS_Units::unit2string (ec.unit) << "\n";
+ //<< Units::unit2string (ec.unit) << "\n";
if (ec.getLayer())
{
os << tab << "Layer[" << id << "]: "
os << "(# of entities in this = " << ec.entities.size() << ")\n";
for(int i=0; i<ec.entities.size(); i++)
{
- RS_Entity * t = ec.entities[i];
+ Entity * t = ec.entities[i];
s.sprintf("(Entity = $%08X, rtti = %d\n", t, t->rtti());
os << s.toAscii().data();
}
s.sprintf("(firstEntity = $%08X)\n", ec.firstEntity());
os << s.toAscii().data();
- for(RS_Entity * t=ec.firstEntity(); t!=NULL; t=ec.nextEntity())
+ for(Entity * t=ec.firstEntity(); t!=NULL; t=ec.nextEntity())
{
switch (t->rtti())
{
case RS2::EntityInsert:
- os << tab << *((RS_Insert *)t);
- os << tab << *((RS_Entity *)t);
- os << tab << *((RS_EntityContainer *)t);
+ os << tab << *((Insert *)t);
+ os << tab << *((Entity *)t);
+ os << tab << *((EntityContainer *)t);
break;
default:
if (t->isContainer())
- os << tab << *((RS_EntityContainer *)t);
+ os << tab << *((EntityContainer *)t);
else
os << tab << *t;
*
* @author Andrew Mustun
*/
-class RS_EntityContainer: public RS_Entity
+class EntityContainer: public Entity
{
public:
- RS_EntityContainer(RS_EntityContainer * parent = NULL, bool owner = true);
- //RS_EntityContainer(const RS_EntityContainer& ec);
- virtual ~RS_EntityContainer();
+ EntityContainer(EntityContainer * parent = NULL, bool owner = true);
+ //EntityContainer(const EntityContainer& ec);
+ virtual ~EntityContainer();
- virtual RS_Entity * clone();
+ virtual Entity * clone();
virtual void detach();
virtual RS2::EntityType rtti() const;
- void reparent(RS_EntityContainer * parent);
+ void reparent(EntityContainer * parent);
virtual bool isContainer() const;
virtual bool isAtomic() const;
virtual double getLength();
virtual void selectWindow(Vector v1, Vector v2, bool select = true, bool cross = false);
- virtual void addEntity(RS_Entity * entity);
- virtual void insertEntity(int index, RS_Entity * entity);
- virtual void replaceEntity(int index, RS_Entity * entity);
- virtual bool removeEntity(RS_Entity * entity);
- virtual RS_Entity * firstEntity(RS2::ResolveLevel level = RS2::ResolveNone);
- virtual RS_Entity * lastEntity(RS2::ResolveLevel level = RS2::ResolveNone);
- virtual RS_Entity * nextEntity(RS2::ResolveLevel level = RS2::ResolveNone);
- virtual RS_Entity * prevEntity(RS2::ResolveLevel level = RS2::ResolveNone);
- virtual RS_Entity * entityAt(uint index);
- virtual RS_Entity * currentEntity();
+ virtual void addEntity(Entity * entity);
+ virtual void insertEntity(int index, Entity * entity);
+ virtual void replaceEntity(int index, Entity * entity);
+ virtual bool removeEntity(Entity * entity);
+ virtual Entity * firstEntity(RS2::ResolveLevel level = RS2::ResolveNone);
+ virtual Entity * lastEntity(RS2::ResolveLevel level = RS2::ResolveNone);
+ virtual Entity * nextEntity(RS2::ResolveLevel level = RS2::ResolveNone);
+ virtual Entity * prevEntity(RS2::ResolveLevel level = RS2::ResolveNone);
+ virtual Entity * entityAt(uint index);
+ virtual Entity * currentEntity();
virtual int entityAt();
- virtual int findEntity(RS_Entity * entity);
+ virtual int findEntity(Entity * entity);
virtual void clear();
- // Q3PtrListIterator<RS_Entity> createIterator();
-// QListIterator<RS_Entity *> createIterator();
+ // Q3PtrListIterator<Entity> createIterator();
+// QListIterator<Entity *> createIterator();
virtual bool isEmpty();
virtual unsigned long int count();
virtual unsigned long int countDeep();
virtual unsigned long int countSelected();
virtual void setAutoUpdateBorders(bool enable);
- virtual void adjustBorders(RS_Entity * entity);
+ virtual void adjustBorders(Entity * entity);
virtual void calculateBorders();
virtual void forcedCalculateBorders();
virtual void updateDimensions();
virtual Vector getNearestEndpoint(const Vector & coord, double * dist = NULL);
- RS_Entity * getNearestEntity(const Vector & point, double * dist = NULL,
+ Entity * getNearestEntity(const Vector & point, double * dist = NULL,
RS2::ResolveLevel level = RS2::ResolveAll);
virtual Vector getNearestPointOnEntity(const Vector & coord, bool onEntity = true,
- double * dist = NULL, RS_Entity ** entity = NULL);
+ double * dist = NULL, Entity ** entity = NULL);
virtual Vector getNearestCenter(const Vector & coord, double * dist = NULL);
virtual Vector getNearestMiddle(const Vector & coord, double * dist = NULL);
virtual Vector getNearestRef(const Vector & coord, double * dist = NULL);
virtual Vector getNearestSelectedRef(const Vector & coord, double * dist = NULL);
- virtual double getDistanceToPoint(const Vector & coord, RS_Entity ** entity,
+ virtual double getDistanceToPoint(const Vector & coord, Entity ** entity,
RS2::ResolveLevel level = RS2::ResolveNone, double solidDist = RS_MAXDOUBLE);
virtual bool optimizeContours();
virtual void moveSelectedRef(const Vector & ref, const Vector & offset);
virtual void draw(PaintInterface * painter, GraphicView * view, double patternOffset = 0.0);
- friend std::ostream & operator<<(std::ostream & os, RS_EntityContainer & ec);
+ friend std::ostream & operator<<(std::ostream & os, EntityContainer & ec);
protected:
/** entities in the container */
- QList<RS_Entity *> entities;
+ QList<Entity *> entities;
/** sub container used only temporarly for iteration. */
- RS_EntityContainer * subContainer;
+ EntityContainer * subContainer;
/**
* Class variable:
static bool autoUpdateBorders;
private:
- QListIterator<RS_Entity *> entityIterator;
+ QListIterator<Entity *> entityIterator;
};
#endif // __ENTITYCONTAINER_H__
-#ifndef __RS_H__
-#define __RS_H__
+#ifndef __ENUMS_H__
+#define __ENUMS_H__
#include <QtGui>
#include <QPrinter>
* @author James Hammons
* @author Andrew Mustun
*/
+//change from RS2 to EN (for ENum)
class RS2
{
public:
};
/**
- * Variable types used by RS_VariableDict and RS_Variable.
+ * Variable types used by VariableDict and Variable.
*/
enum VariableType {
VariableString,
LineByBlock = -2 /**< Line type defined by block not entity */
};
- /**
- * Wrapper for Qt
- */
- static Qt::PenStyle rsToQtLineType(RS2::LineType t) {
- switch (t) {
- case NoPen:
- return Qt::NoPen;
- break;
- case SolidLine:
- return Qt::SolidLine;
- break;
- case DotLine:
- case DotLine2:
- case DotLineX2:
- return Qt::DotLine;
- break;
- case DashLine:
- case DashLine2:
- case DashLineX2:
- return Qt::DashLine;
- break;
- case DashDotLine:
- case DashDotLine2:
- case DashDotLineX2:
- return Qt::DashDotLine;
- break;
- case DivideLine:
- case DivideLine2:
- case DivideLineX2:
- return Qt::DashDotDotLine;
- break;
- case CenterLine:
- case CenterLine2:
- case CenterLineX2:
- return Qt::DashDotLine;
- break;
- case BorderLine:
- case BorderLine2:
- case BorderLineX2:
- return Qt::DashDotLine;
- break;
- case LineByLayer:
- case LineByBlock:
- default:
- return Qt::SolidLine;
- break;
- }
- return Qt::SolidLine;
- }
-
- /**
- * Wrapper for Qt.
- */
- static RS2::LineType qtToRsPenStyle(Qt::PenStyle s)
- {
- switch (s)
- {
- case Qt::NoPen:
- return NoPen;
- case Qt::SolidLine:
- return SolidLine;
- break;
- case Qt::DashLine:
- return DashLine;
- break;
- case Qt::DotLine:
- return DotLine;
- break;
- case Qt::DashDotLine:
- return DashDotLine;
- break;
- case Qt::DashDotDotLine:
- return DivideLine;
- break;
- default:
- return SolidLine;
- break;
- }
-
- return SolidLine;
- }
-
/**
* \brief Struct that stores a line type pattern (e.g. dash dot dot).
*/
WidthDefault = -3 /**< Line width defaults to the predefined line width. */
};
- /**
- * Wrapper for Qt
- */
- static LineWidth intToLineWidth(int w)
- {
- if (w == -3)
- {
- return WidthDefault;
- }
- else if (w == -2)
- {
- return WidthByBlock;
- }
- else if (w == -1)
- {
- return WidthByLayer;
- }
- else if (w < 3)
- {
- return Width00;
- }
- else if (w < 8)
- {
- return Width01;
- }
- else if (w < 12)
- {
- return Width02;
- }
- else if (w < 14)
- {
- return Width03;
- }
- else if (w < 17)
- {
- return Width04;
- }
- else if (w < 19)
- {
- return Width05;
- }
- else if (w < 23)
- {
- return Width06;
- }
- else if (w < 28)
- {
- return Width07;
- }
- else if (w < 33)
- {
- return Width08;
- }
- else if (w < 38)
- {
- return Width09;
- }
- else if (w < 46)
- {
- return Width10;
- }
- else if (w < 52)
- {
- return Width11;
- }
- else if (w < 57)
- {
- return Width12;
- }
- else if (w < 66)
- {
- return Width13;
- }
- else if (w < 76)
- {
- return Width14;
- }
- else if (w < 86)
- {
- return Width15;
- }
- else if (w < 96)
- {
- return Width16;
- }
- else if (w < 104)
- {
- return Width17;
- }
- else if (w < 114)
- {
- return Width18;
- }
- else if (w < 131)
- {
- return Width19;
- }
- else if (w < 150)
- {
- return Width20;
- }
- else if (w < 180)
- {
- return Width21;
- }
- else if (w < 206)
- {
- return Width22;
- }
- else
- {
- return Width23;
- }
- }
-
/**
* Enum of cursor types.
*/
MovingHandCursor /**< Moving hand - a little flat hand. */
};
- /**
- * Wrapper for Qt.
- */
- static Qt::CursorShape rsToQtCursorType(RS2::CursorType t)
- {
- switch (t)
- {
- case ArrowCursor:
- return Qt::ArrowCursor;
- break;
- case UpArrowCursor:
- return Qt::UpArrowCursor;
- break;
- case CrossCursor:
- return Qt::CrossCursor;
- break;
- case WaitCursor:
- return Qt::WaitCursor;
- break;
- case IbeamCursor:
- return Qt::IBeamCursor;
- break;
- case SizeVerCursor:
- return Qt::SizeVerCursor;
- break;
- case SizeHorCursor:
- return Qt::SizeHorCursor;
- break;
- case SizeBDiagCursor:
- return Qt::SizeBDiagCursor;
- break;
- case SizeFDiagCursor:
- return Qt::SizeFDiagCursor;
- break;
- case SizeAllCursor:
- return Qt::SizeAllCursor;
- break;
- case BlankCursor:
- return Qt::BlankCursor;
- break;
- case SplitVCursor:
- return Qt::SplitVCursor;
- break;
- case SplitHCursor:
- return Qt::SplitHCursor;
- break;
- case PointingHandCursor:
- return Qt::PointingHandCursor;
- break;
- case ForbiddenCursor:
- return Qt::ForbiddenCursor;
- break;
- case WhatsThisCursor:
- return Qt::WhatsThisCursor;
- break;
- default:
- return Qt::ArrowCursor;
- break;
- }
-
- return Qt::ArrowCursor;
- }
-
/**
* Paper formats.
*/
NPageSize
};
- /**
- * Wrapper for Qt.
- */
- static QPrinter::PageSize rsToQtPaperFormat(RS2::PaperFormat f)
- {
- QPrinter::PageSize ret;
-
- switch (f)
- {
- case Custom:
- ret = QPrinter::Custom;
- break;
- case Letter:
- ret = QPrinter::Letter;
- break;
- case Legal:
- ret = QPrinter::Legal;
- break;
- case Executive:
- ret = QPrinter::Executive;
- break;
- case A0:
- ret = QPrinter::A0;
- break;
- case A1:
- ret = QPrinter::A1;
- break;
- case A2:
- ret = QPrinter::A2;
- break;
- case A3:
- ret = QPrinter::A3;
- break;
- default:
- case A4:
- ret = QPrinter::A4;
- break;
- case A5:
- ret = QPrinter::A5;
- break;
- case A6:
- ret = QPrinter::A6;
- break;
- case A7:
- ret = QPrinter::A7;
- break;
- case A8:
- ret = QPrinter::A8;
- break;
- case A9:
- ret = QPrinter::A9;
- break;
- case B0:
- ret = QPrinter::B0;
- break;
- case B1:
- ret = QPrinter::B1;
- break;
- case B2:
- ret = QPrinter::B2;
- break;
- case B3:
- ret = QPrinter::B3;
- break;
- case B4:
- ret = QPrinter::B4;
- break;
- case B5:
- ret = QPrinter::B5;
- break;
- case B6:
- ret = QPrinter::B6;
- break;
- case B7:
- ret = QPrinter::B7;
- break;
- case B8:
- ret = QPrinter::B8;
- break;
- case B9:
- ret = QPrinter::B9;
- break;
- case B10:
- ret = QPrinter::B10;
- break;
- case C5E:
- ret = QPrinter::C5E;
- break;
- case Comm10E:
- ret = QPrinter::Comm10E;
- break;
- case DLE:
- ret = QPrinter::DLE;
- break;
- case Folio:
- ret = QPrinter::Folio;
- break;
- //case Ledger:
- // ret = QPrinter::Ledger;
- // break;
- case Tabloid:
- ret = QPrinter::Tabloid;
- break;
- case NPageSize:
- ret = QPrinter::NPageSize;
- break;
- }
-
- return ret;
- }
+ /**
+ * Wrappers for Qt (ICK)
+ */
+ static Qt::PenStyle rsToQtLineType(RS2::LineType t);
+ static RS2::LineType qtToRsPenStyle(Qt::PenStyle s);
+ static RS2::LineWidth intToLineWidth(int w);
+ static Qt::CursorShape rsToQtCursorType(RS2::CursorType t);
+ static QPrinter::PageSize rsToQtPaperFormat(RS2::PaperFormat f);
};
-#endif // __RS_H__
+#endif // __ENUMS_H__
/**
* Constructor.
*/
-RS_EventHandler::RS_EventHandler(GraphicView * graphicView)
+EventHandler::EventHandler(GraphicView * graphicView)
{
this->graphicView = graphicView;
actionIndex = -1;
/**
* Destructor.
*/
-RS_EventHandler::~RS_EventHandler()
+EventHandler::~EventHandler()
{
- RS_DEBUG->print("RS_EventHandler::~RS_EventHandler");
+ DEBUG->print("EventHandler::~EventHandler");
if (defaultAction != NULL)
{
killAllActions();
- RS_DEBUG->print("RS_EventHandler::~RS_EventHandler: Deleting all actions..");
+ DEBUG->print("EventHandler::~EventHandler: Deleting all actions..");
for(int i=0; i<RS_MAXACTIONS; ++i)
{
}
cleanUp();
- RS_DEBUG->print("RS_EventHandler::~RS_EventHandler: Deleting all actions..: OK");
- RS_DEBUG->print("RS_EventHandler::~RS_EventHandler: OK");
+ DEBUG->print("EventHandler::~EventHandler: Deleting all actions..: OK");
+ DEBUG->print("EventHandler::~EventHandler: OK");
}
/**
* Go back in current action.
*/
-void RS_EventHandler::back()
+void EventHandler::back()
{
QMouseEvent e(QEvent::MouseButtonRelease, QPoint(0, 0), Qt::RightButton, Qt::RightButton,
Qt::NoModifier);
/**
* Go enter pressed event for current action.
*/
-void RS_EventHandler::enter()
+void EventHandler::enter()
{
// QKeyEvent e(QEvent::KeyPress, Qt::Key_Enter, '\n', 0);
QKeyEvent e(QEvent::KeyPress, Qt::Key_Enter, Qt::NoModifier, "\n", false, 0);
/**
* Called by GraphicView
*/
-void RS_EventHandler::mousePressEvent(QMouseEvent * e)
+void EventHandler::mousePressEvent(QMouseEvent * e)
{
if (actionIndex >= 0 && currentActions[actionIndex] != NULL)
{
}
else
{
- RS_DEBUG->print("currently no action defined");
+ DEBUG->print("currently no action defined");
e->ignore();
}
}
/**
* Called by GraphicView
*/
-void RS_EventHandler::mouseReleaseEvent(QMouseEvent * e)
+void EventHandler::mouseReleaseEvent(QMouseEvent * e)
{
if (actionIndex >= 0 && currentActions[actionIndex] != NULL
&& !currentActions[actionIndex]->isFinished())
{
- RS_DEBUG->print("call action %s", currentActions[actionIndex]->getName().toLatin1().data());
+ DEBUG->print("call action %s", currentActions[actionIndex]->getName().toLatin1().data());
currentActions[actionIndex]->mouseReleaseEvent(e);
// Clean up actions - one might be finished now
/**
* Called by GraphicView
*/
-void RS_EventHandler::mouseMoveEvent(QMouseEvent * e)
+void EventHandler::mouseMoveEvent(QMouseEvent * e)
{
if (actionIndex >= 0 && currentActions[actionIndex]
&& !currentActions[actionIndex]->isFinished())
}
else
e->ignore();
- //RS_DEBUG->print("currently no action defined");
+ //DEBUG->print("currently no action defined");
}
}
/**
* Called by GraphicView
*/
-void RS_EventHandler::mouseLeaveEvent()
+void EventHandler::mouseLeaveEvent()
{
if (actionIndex >= 0 && currentActions[actionIndex]
&& !currentActions[actionIndex]->isFinished())
{
if (defaultAction)
defaultAction->suspend();
- //RS_DEBUG->print("currently no action defined");
+ //DEBUG->print("currently no action defined");
}
}
/**
* Called by GraphicView
*/
-void RS_EventHandler::mouseEnterEvent()
+void EventHandler::mouseEnterEvent()
{
if (actionIndex >= 0 && currentActions[actionIndex]
&& !currentActions[actionIndex]->isFinished())
/**
* Called by GraphicView
*/
-void RS_EventHandler::keyPressEvent(QKeyEvent * e)
+void EventHandler::keyPressEvent(QKeyEvent * e)
{
if (actionIndex >= 0 && currentActions[actionIndex]
&& !currentActions[actionIndex]->isFinished())
else
e->ignore();
- //RS_DEBUG->print("currently no action defined");
+ //DEBUG->print("currently no action defined");
}
}
/**
* Called by GraphicView
*/
-void RS_EventHandler::keyReleaseEvent(QKeyEvent * e)
+void EventHandler::keyReleaseEvent(QKeyEvent * e)
{
if (actionIndex >= 0 && currentActions[actionIndex]
&& !currentActions[actionIndex]->isFinished())
else
e->ignore();
- //RS_DEBUG->print("currently no action defined");
+ //DEBUG->print("currently no action defined");
}
}
/**
* Handles command line events.
*/
-void RS_EventHandler::commandEvent(RS_CommandEvent * e)
+void EventHandler::commandEvent(CommandEvent * e)
{
- RS_DEBUG->print("RS_EventHandler::commandEvent");
+ DEBUG->print("EventHandler::commandEvent");
QString cmd = e->getCommand();
if (coordinateInputEnabled)
&& !currentActions[actionIndex]->isFinished())
{
int commaPos = cmd.indexOf(',');
- RS_DEBUG->print("RS_EventHandler::commandEvent: 001");
+ DEBUG->print("EventHandler::commandEvent: 001");
bool ok1, ok2;
- RS_DEBUG->print("RS_EventHandler::commandEvent: 002");
- double x = RS_Math::eval(cmd.left(commaPos), &ok1);
- RS_DEBUG->print("RS_EventHandler::commandEvent: 003a");
- double y = RS_Math::eval(cmd.mid(commaPos + 1), &ok2);
- RS_DEBUG->print("RS_EventHandler::commandEvent: 004");
+ DEBUG->print("EventHandler::commandEvent: 002");
+ double x = Math::eval(cmd.left(commaPos), &ok1);
+ DEBUG->print("EventHandler::commandEvent: 003a");
+ double y = Math::eval(cmd.mid(commaPos + 1), &ok2);
+ DEBUG->print("EventHandler::commandEvent: 004");
if (ok1 && ok2)
{
-// RS_DEBUG->print("RS_EventHandler::commandEvent: 005");
-// RS_CoordinateEvent ce(Vector(x, y));
- RS_DEBUG->print("RS_EventHandler::commandEvent: 006");
+// DEBUG->print("EventHandler::commandEvent: 005");
+// CoordinateEvent ce(Vector(x, y));
+ DEBUG->print("EventHandler::commandEvent: 006");
// currentActions[actionIndex]->coordinateEvent(&ce);
Vector ce(x, y);
currentActions[actionIndex]->coordinateEvent(&ce);
}
else
{
- if (RS_DIALOGFACTORY != NULL)
- RS_DIALOGFACTORY->commandMessage("Expression Syntax Error");
+ if (DIALOGFACTORY != NULL)
+ DIALOGFACTORY->commandMessage("Expression Syntax Error");
}
e->accept();
{
int commaPos = cmd.indexOf(',');
bool ok1, ok2;
- double x = RS_Math::eval(cmd.mid(1, commaPos - 1), &ok1);
- double y = RS_Math::eval(cmd.mid(commaPos + 1), &ok2);
+ double x = Math::eval(cmd.mid(1, commaPos - 1), &ok1);
+ double y = Math::eval(cmd.mid(commaPos + 1), &ok2);
if (ok1 && ok2)
{
-// RS_CoordinateEvent ce(Vector(x,y) + graphicView->getRelativeZero());
+// CoordinateEvent ce(Vector(x,y) + graphicView->getRelativeZero());
// currentActions[actionIndex]->coordinateEvent(&ce);
Vector ce(Vector(x,y) + graphicView->getRelativeZero());
currentActions[actionIndex]->coordinateEvent(&ce);
}
else
{
- if (RS_DIALOGFACTORY != NULL)
- RS_DIALOGFACTORY->commandMessage("Expression Syntax Error");
+ if (DIALOGFACTORY != NULL)
+ DIALOGFACTORY->commandMessage("Expression Syntax Error");
}
e->accept();
{
int commaPos = cmd.indexOf('<');
bool ok1, ok2;
- double r = RS_Math::eval(cmd.left(commaPos), &ok1);
- double a = RS_Math::eval(cmd.mid(commaPos + 1), &ok2);
+ double r = Math::eval(cmd.left(commaPos), &ok1);
+ double a = Math::eval(cmd.mid(commaPos + 1), &ok2);
if (ok1 && ok2)
{
Vector pos;
- pos.setPolar(r,RS_Math::deg2rad(a));
-// RS_CoordinateEvent ce(pos);
+ pos.setPolar(r,Math::deg2rad(a));
+// CoordinateEvent ce(pos);
// currentActions[actionIndex]->coordinateEvent(&ce);
currentActions[actionIndex]->coordinateEvent(&pos);
}
else
{
- if (RS_DIALOGFACTORY != NULL)
- RS_DIALOGFACTORY->commandMessage("Expression Syntax Error");
+ if (DIALOGFACTORY != NULL)
+ DIALOGFACTORY->commandMessage("Expression Syntax Error");
}
e->accept();
// int commaPos = cmd.find('<');
int commaPos = cmd.indexOf('<');
bool ok1, ok2;
- double r = RS_Math::eval(cmd.mid(1, commaPos - 1), &ok1);
- double a = RS_Math::eval(cmd.mid(commaPos + 1), &ok2);
+ double r = Math::eval(cmd.mid(1, commaPos - 1), &ok1);
+ double a = Math::eval(cmd.mid(commaPos + 1), &ok2);
if (ok1 && ok2)
{
Vector pos;
- pos.setPolar(r,RS_Math::deg2rad(a));
-// RS_CoordinateEvent ce(pos + graphicView->getRelativeZero());
+ pos.setPolar(r,Math::deg2rad(a));
+// CoordinateEvent ce(pos + graphicView->getRelativeZero());
// currentActions[actionIndex]->coordinateEvent(&ce);
Vector ce(pos + graphicView->getRelativeZero());
currentActions[actionIndex]->coordinateEvent(&ce);
}
else
{
- if (RS_DIALOGFACTORY)
- RS_DIALOGFACTORY->commandMessage("Expression Syntax Error");
+ if (DIALOGFACTORY)
+ DIALOGFACTORY->commandMessage("Expression Syntax Error");
}
e->accept();
}
}
- RS_DEBUG->print("RS_EventHandler::commandEvent: OK");
+ DEBUG->print("EventHandler::commandEvent: OK");
}
/**
* Enables coordinate input in the command line.
*/
-void RS_EventHandler::enableCoordinateInput()
+void EventHandler::enableCoordinateInput()
{
coordinateInputEnabled = true;
}
/**
* Enables coordinate input in the command line.
*/
-void RS_EventHandler::disableCoordinateInput()
+void EventHandler::disableCoordinateInput()
{
coordinateInputEnabled = false;
}
/**
* @return Current action.
*/
-ActionInterface * RS_EventHandler::getCurrentAction()
+ActionInterface * EventHandler::getCurrentAction()
{
if (actionIndex >= 0 && currentActions[actionIndex]
&& !currentActions[actionIndex]->isFinished())
/**
* @return The current default action.
*/
-ActionInterface * RS_EventHandler::getDefaultAction()
+ActionInterface * EventHandler::getDefaultAction()
{
return defaultAction;
}
/**
* Sets the default action.
*/
-void RS_EventHandler::setDefaultAction(ActionInterface * action)
+void EventHandler::setDefaultAction(ActionInterface * action)
{
if (defaultAction)
{
/**
* Sets the current action.
*/
-void RS_EventHandler::setCurrentAction(ActionInterface * action)
+void EventHandler::setCurrentAction(ActionInterface * action)
{
- RS_DEBUG->print("RS_EventHandler::setCurrentAction");
+ DEBUG->print("EventHandler::setCurrentAction");
if (!action)
return;
// Set current action:
currentActions[actionIndex] = action;
- RS_DEBUG->print("RS_EventHandler::setCurrentAction: current action is: %s",
+ DEBUG->print("EventHandler::setCurrentAction: current action is: %s",
currentActions[actionIndex]->getName().toLatin1().data());
// Initialisation of our new action:
- RS_DEBUG->print("RS_EventHandler::setCurrentAction: init current action");
+ DEBUG->print("EventHandler::setCurrentAction: init current action");
action->init();
// ## new:
if (action->isFinished() == false)
{
- RS_DEBUG->print("RS_EventHandler::setCurrentAction: show options");
+ DEBUG->print("EventHandler::setCurrentAction: show options");
currentActions[actionIndex]->showOptions();
- RS_DEBUG->print("RS_EventHandler::setCurrentAction: set predecessor");
+ DEBUG->print("EventHandler::setCurrentAction: set predecessor");
action->setPredecessor(predecessor);
}
- RS_DEBUG->print("RS_EventHandler::setCurrentAction: cleaning up..");
+ DEBUG->print("EventHandler::setCurrentAction: cleaning up..");
cleanUp();
- RS_DEBUG->print("RS_EventHandler::setCurrentAction: debugging actions");
+ DEBUG->print("EventHandler::setCurrentAction: debugging actions");
debugActions();
- RS_DEBUG->print("GraphicView::setCurrentAction: OK");
+ DEBUG->print("GraphicView::setCurrentAction: OK");
}
/**
* Kills all running selection actions. Called when a selection action
* is launched to reduce confusion.
*/
-void RS_EventHandler::killSelectActions()
+void EventHandler::killSelectActions()
{
for(int c=0; c<RS_MAXACTIONS; ++c)
{
/**
* Kills all running actions. Called when a window is closed.
*/
-void RS_EventHandler::killAllActions()
+void EventHandler::killAllActions()
{
/*
for (int c=0; c<RS_MAXACTIONS; ++c) {
/**
* @return true if there is at least one action in the action stack.
*/
-bool RS_EventHandler::hasAction()
+bool EventHandler::hasAction()
{
if (actionIndex != -1 || defaultAction)
return true;
/**
* Garbage collector for actions.
*/
-void RS_EventHandler::cleanUp()
+void EventHandler::cleanUp()
{
- RS_DEBUG->print("RS_EventHandler::cleanUp");
+ DEBUG->print("EventHandler::cleanUp");
int o = 0; // old index
int n = 0; // new index
}
}
- RS_DEBUG->print("RS_EventHandler::cleanUp: OK");
+ DEBUG->print("EventHandler::cleanUp: OK");
}
/**
* Sets the snap mode for all currently active actions.
*/
-void RS_EventHandler::setSnapMode(RS2::SnapMode sm)
+void EventHandler::setSnapMode(RS2::SnapMode sm)
{
#if 0
for(int c=0; c<RS_MAXACTIONS; ++c)
/**
* Sets the snap restriction for all currently active actions.
*/
-void RS_EventHandler::setSnapRestriction(RS2::SnapRestriction sr)
+void EventHandler::setSnapRestriction(RS2::SnapRestriction sr)
{
#if 0
for(int c=0; c<RS_MAXACTIONS; ++c)
#endif
}
-void RS_EventHandler::debugActions()
+void EventHandler::debugActions()
{
- RS_DEBUG->print("---");
+ DEBUG->print("---");
for(int c=0; c<RS_MAXACTIONS; ++c)
{
if (c == actionIndex)
- RS_DEBUG->print("Current");
+ DEBUG->print("Current");
if (currentActions[c])
- RS_DEBUG->print("Action %03d: %s [%s]",
+ DEBUG->print("Action %03d: %s [%s]",
c, currentActions[c]->getName().toLatin1().data(),
currentActions[c]->isFinished() ? "finished" : "active");
else
- RS_DEBUG->print("Action %03d: NULL", c);
+ DEBUG->print("Action %03d: NULL", c);
}
}
#define __EVENTHANDLER_H__
#include <QtGui>
-#include "rs.h"
+#include "enums.h"
#define RS_MAXACTIONS 16
class ActionInterface;
-class RS_CommandEvent;
+class CommandEvent;
class GraphicView;
/**
* active. All events going from the view to the actions come over
* this class.
*/
-class RS_EventHandler
+class EventHandler
{
public:
- RS_EventHandler(GraphicView * graphicView);
- ~RS_EventHandler();
+ EventHandler(GraphicView * graphicView);
+ ~EventHandler();
void back();
void enter();
void mouseEnterEvent();
void keyPressEvent(QKeyEvent * e);
void keyReleaseEvent(QKeyEvent * e);
- void commandEvent(RS_CommandEvent * e);
+ void commandEvent(CommandEvent * e);
void enableCoordinateInput();
void disableCoordinateInput();
void setDefaultAction(ActionInterface * action);
#include "filterdxf1.h"
#include "filterinterface.h"
-RS_FileIO * RS_FileIO::uniqueInstance = NULL;
+FileIO * FileIO::uniqueInstance = NULL;
// Constructor
-RS_FileIO::RS_FileIO()
+FileIO::FileIO()
{
}
/**
* @return Instance to the unique import object.
*/
-/*static*/ RS_FileIO * RS_FileIO::instance()
+/*static*/ FileIO * FileIO::instance()
{
if (!uniqueInstance)
- uniqueInstance = new RS_FileIO();
+ uniqueInstance = new FileIO();
return uniqueInstance;
}
/**
* Registers a new import filter.
*/
-void RS_FileIO::registerFilter(RS_FilterInterface * f)
+void FileIO::registerFilter(FilterInterface * f)
{
filterList.append(f);
}
/**
* @return List of registered filters.
*/
-QList<RS_FilterInterface *> RS_FileIO::getFilterList()
+QList<FilterInterface *> FileIO::getFilterList()
{
return filterList;
}
/**
* @return Filter which can import the given file type.
*/
-RS_FilterInterface * RS_FileIO::getImportFilter(RS2::FormatType t)
+FilterInterface * FileIO::getImportFilter(RS2::FormatType t)
{
for(int i=0; i<filterList.size(); i++)
{
- RS_FilterInterface * f = filterList[i];
+ FilterInterface * f = filterList[i];
if (f->canImport(t))
return f;
/**
* @return Filter which can export the given file type.
*/
-RS_FilterInterface * RS_FileIO::getExportFilter(RS2::FormatType t)
+FilterInterface * FileIO::getExportFilter(RS2::FormatType t)
{
for(int i=0; i<filterList.size(); i++)
{
- RS_FilterInterface * f = filterList[i];
+ FilterInterface * f = filterList[i];
if (f->canExport(t))
return f;
* it can also be a polyline, text, ...
* @param file Path and name of the file to import.
*/
-bool RS_FileIO::fileImport(Drawing & graphic, const QString & file, RS2::FormatType type)
+bool FileIO::fileImport(Drawing & graphic, const QString & file, RS2::FormatType type)
{
- RS_DEBUG->print("Trying to import file '%s'...", file.toAscii().data());
+ DEBUG->print("Trying to import file '%s'...", file.toAscii().data());
- RS_FilterInterface * filter = NULL;
+ FilterInterface * filter = NULL;
RS2::FormatType t = (type == RS2::FormatUnknown ? detectFormat(file) : type);
filter = getImportFilter(t);
return filter->fileImport(graphic, file, t);
else
{
- RS_DEBUG->print(RS_Debug::D_WARNING, "RS_FileIO::fileImport: failed to import file: %s",
+ DEBUG->print(Debug::D_WARNING, "FileIO::fileImport: failed to import file: %s",
file.toAscii().data());
}
*
* @param file Path and name of the file to import.
*/
-bool RS_FileIO::fileExport(Drawing & graphic, const QString & file, RS2::FormatType type)
+bool FileIO::fileExport(Drawing & graphic, const QString & file, RS2::FormatType type)
{
- RS_DEBUG->print("RS_FileIO::fileExport");
+ DEBUG->print("FileIO::fileExport");
if (type == RS2::FormatUnknown)
{
type = RS2::FormatCXF;
}
- RS_FilterInterface * filter = getExportFilter(type);
+ FilterInterface * filter = getExportFilter(type);
if (filter)
return filter->fileExport(graphic, file, type);
- RS_DEBUG->print("RS_FileIO::fileExport: no filter found");
+ DEBUG->print("FileIO::fileExport: no filter found");
return false;
}
/**
* Detects and returns the file format of the given file.
*/
-RS2::FormatType RS_FileIO::detectFormat(const QString & file)
+RS2::FormatType FileIO::detectFormat(const QString & file)
{
RS2::FormatType type = RS2::FormatUnknown;
QFileInfo info(file);
if (!f.open(QIODevice::ReadOnly))
{
// Error opening file:
- RS_DEBUG->print(RS_Debug::D_WARNING,
- "RS_FileIO::detectFormat: Cannot open file: %s", file.toAscii().data());
+ DEBUG->print(Debug::D_WARNING,
+ "FileIO::detectFormat: Cannot open file: %s", file.toAscii().data());
type = RS2::FormatUnknown;
}
else
{
- RS_DEBUG->print("RS_FileIO::detectFormat: Successfully opened DXF file: %s",
+ DEBUG->print("FileIO::detectFormat: Successfully opened DXF file: %s",
file.toAscii().data());
QTextStream ts(&f);
#define __FILEIO_H__
#include <QtCore>
-#include "rs.h"
+#include "enums.h"
-#define RS_FILEIO RS_FileIO::instance()
+#define FILEIO FileIO::instance()
class Drawing;
-class RS_FilterInterface;
+class FilterInterface;
/**
* API Class for importing files.
* @author James Hammons
* @author Andrew Mustun
*/
-class RS_FileIO
+class FileIO
{
protected:
- RS_FileIO();
+ FileIO();
public:
- static RS_FileIO * instance();
- void registerFilter(RS_FilterInterface * f);
- QList<RS_FilterInterface *> getFilterList();
- RS_FilterInterface * getImportFilter(RS2::FormatType t);
- RS_FilterInterface * getExportFilter(RS2::FormatType t);
+ static FileIO * instance();
+ void registerFilter(FilterInterface * f);
+ QList<FilterInterface *> getFilterList();
+ FilterInterface * getImportFilter(RS2::FormatType t);
+ FilterInterface * getExportFilter(RS2::FormatType t);
bool fileImport(Drawing & graphic, const QString & file,
RS2::FormatType type = RS2::FormatUnknown);
bool fileExport(Drawing & graphic, const QString & file,
RS2::FormatType detectFormat(const QString & file);
protected:
- static RS_FileIO * uniqueInstance;
- QList<RS_FilterInterface *> filterList;
+ static FileIO * uniqueInstance;
+ QList<FilterInterface *> filterList;
};
#endif // __FILEIO_H__
/**
* Default constructor.
*/
-RS_FilterCXF::RS_FilterCXF(): RS_FilterInterface()
+FilterCXF::FilterCXF(): FilterInterface()
{
- RS_DEBUG->print("Setting up CXF filter...");
+ DEBUG->print("Setting up CXF filter...");
addImportFormat(RS2::FormatCXF);
addExportFormat(RS2::FormatCXF);
}
-RS_FilterCXF::~RS_FilterCXF()
+FilterCXF::~FilterCXF()
{
}
* will be created or the graphics from which the entities are
* taken to be stored in a file.
*/
-bool RS_FilterCXF::fileImport(Drawing & g, const QString & file, RS2::FormatType /*type*/)
+bool FilterCXF::fileImport(Drawing & g, const QString & file, RS2::FormatType /*type*/)
{
- RS_DEBUG->print("CXF Filter: importing file '%s'...", file.toLatin1().data());
+ DEBUG->print("CXF Filter: importing file '%s'...", file.toLatin1().data());
//this->graphic = &g;
bool success = false;
// Load font file as we normally do, but the font doesn't own the
// letters (we'll add them to the graphic instead. Hence 'false').
- RS_Font font(file, false);
+ Font font(file, false);
success = font.loadFont();
if (!success)
{
- RS_DEBUG->print(RS_Debug::D_WARNING, "Cannot open CXF file '%s'.", file.toLatin1().data());
+ DEBUG->print(Debug::D_WARNING, "Cannot open CXF file '%s'.", file.toLatin1().data());
return false;
}
if (!font.getEncoding().isEmpty())
g.addVariable("Encoding", font.getEncoding(), 0);
- RS_BlockList * letterList = font.getLetterList();
+ BlockList * letterList = font.getLetterList();
for(uint i=0; i<font.countLetters(); i++)
{
- RS_Block * ch = font.letterAt(i);
+ Block * ch = font.letterAt(i);
QString uCode;
uCode.setNum(ch->getName().at(0).unicode(), 16);
*
* @param file Full path to the CXF file that will be written.
*/
-bool RS_FilterCXF::fileExport(Drawing & g, const QString & file, RS2::FormatType /*type*/)
+bool FilterCXF::fileExport(Drawing & g, const QString & file, RS2::FormatType /*type*/)
{
- RS_DEBUG->print("CXF Filter: exporting file '%s'...", file.toAscii().data());
+ DEBUG->print("CXF Filter: exporting file '%s'...", file.toAscii().data());
// crashes under windoze xp:
//std::ofstream fout;
- RS_DEBUG->print("RS_FilterCXF::fileExport: open");
+ DEBUG->print("FilterCXF::fileExport: open");
//fout.open((const char*)file.local8Bit());
FILE * fp;
if ((fp = fopen((const char *)file.toLocal8Bit(), "wt")) != NULL)
{
- RS_DEBUG->print("RS_FilterCXF::fileExport: open: OK");
- RS_DEBUG->print("RS_FilterCXF::fileExport: header");
+ DEBUG->print("FilterCXF::fileExport: open: OK");
+ DEBUG->print("FilterCXF::fileExport: header");
// header:
fprintf(fp, "# Format: QCad II Font\n");
- fprintf(fp, "# Creator: %s\n", (const char *)RS_SYSTEM->getAppName().toLocal8Bit());
- fprintf(fp, "# Version: %s\n", (const char *)RS_SYSTEM->getAppVersion().toLocal8Bit());
+ fprintf(fp, "# Creator: %s\n", (const char *)SYSTEM->getAppName().toLocal8Bit());
+ fprintf(fp, "# Version: %s\n", (const char *)SYSTEM->getAppVersion().toLocal8Bit());
- RS_DEBUG->print("001");
+ DEBUG->print("001");
QString ns = g.getVariableString("Names", "");
if (!ns.isEmpty())
{
QStringList names = ns.split(',');
- RS_DEBUG->print("002");
+ DEBUG->print("002");
for(QStringList::Iterator it=names.begin(); it!=names.end(); ++it)
{
}
}
- RS_DEBUG->print("003");
+ DEBUG->print("003");
QString es = g.getVariableString("Encoding", "");
if (!es.isEmpty())
fprintf(fp, "# Encoding: %s\n", (const char *)es.toLocal8Bit());
- RS_DEBUG->print("004a");
+ DEBUG->print("004a");
fprintf(fp, "# LetterSpacing: %f\n", g.getVariableDouble("LetterSpacing", 3.0));
fprintf(fp, "# WordSpacing: %f\n", g.getVariableDouble("WordSpacing", 6.75));
fprintf(fp, "# LineSpacingFactor: %f\n", g.getVariableDouble("LineSpacingFactor", 1.0));
QString sa = g.getVariableString("Authors", "");
- RS_DEBUG->print("authors: %s", (const char *)sa.toLocal8Bit());
+ DEBUG->print("authors: %s", (const char *)sa.toLocal8Bit());
if (!sa.isEmpty())
{
QStringList authors = sa.split(',');
- RS_DEBUG->print("006");
- RS_DEBUG->print("count: %d", authors.count());
+ DEBUG->print("006");
+ DEBUG->print("count: %d", authors.count());
QString a;
for(QStringList::Iterator it2=authors.begin(); it2!=authors.end(); ++it2)
{
- RS_DEBUG->print("006a");
+ DEBUG->print("006a");
a = QString(*it2);
- RS_DEBUG->print("006b");
- RS_DEBUG->print("string is: %s", a.toAscii().data());
- RS_DEBUG->print("006b0");
+ DEBUG->print("006b");
+ DEBUG->print("string is: %s", a.toAscii().data());
+ DEBUG->print("006b0");
fprintf(fp, "# Author: ");
- RS_DEBUG->print("006b1");
+ DEBUG->print("006b1");
fprintf(fp, "%s\n", a.toAscii().data());
//fout << "# Author: " << a.ascii() << "\n";
}
- RS_DEBUG->print("007");
+ DEBUG->print("007");
}
- RS_DEBUG->print("RS_FilterCXF::fileExport: header: OK");
+ DEBUG->print("FilterCXF::fileExport: header: OK");
- RS_DEBUG->print("008");
+ DEBUG->print("008");
// iterate through blocks (=letters of font)
for(uint i=0; i<g.countBlocks(); ++i)
{
- RS_Block * blk = g.blockAt(i);
+ Block * blk = g.blockAt(i);
- RS_DEBUG->print("block: %d", i);
- RS_DEBUG->print("001");
+ DEBUG->print("block: %d", i);
+ DEBUG->print("001");
if (blk != NULL)
{
- RS_DEBUG->print("002");
- RS_DEBUG->print("002a: %s", (const char *)(blk->getName().toLocal8Bit()));
+ DEBUG->print("002");
+ DEBUG->print("002a: %s", (const char *)(blk->getName().toLocal8Bit()));
fprintf(fp, "\n%s\n", (const char *)(blk->getName().toLocal8Bit()));
// iterate through entities of this letter:
- for(RS_Entity * e=blk->firstEntity(RS2::ResolveAll); e!=NULL;
+ for(Entity * e=blk->firstEntity(RS2::ResolveAll); e!=NULL;
e=blk->nextEntity(RS2::ResolveAll))
{
if (!e->isUndone())
{
- RS_DEBUG->print("004");
+ DEBUG->print("004");
// lines:
if (e->rtti() == RS2::EntityLine)
{
- RS_Line * l = (RS_Line *)e;
+ Line * l = (Line *)e;
fprintf(fp, "L %f,%f,%f,%f\n", l->getStartpoint().x, l->getStartpoint().y,
l->getEndpoint().x, l->getEndpoint().y);
// arcs:
else if (e->rtti() == RS2::EntityArc)
{
- RS_Arc * a = (RS_Arc *)e;
+ Arc * a = (Arc *)e;
if (!a->isReversed())
{
}
}
- RS_DEBUG->print("005");
+ DEBUG->print("005");
}
- RS_DEBUG->print("006");
+ DEBUG->print("006");
}
- RS_DEBUG->print("007");
+ DEBUG->print("007");
}
//fout.close();
fclose(fp);
- RS_DEBUG->print("CXF Filter: exporting file: OK");
+ DEBUG->print("CXF Filter: exporting file: OK");
return true;
}
else
{
- RS_DEBUG->print("CXF Filter: exporting file failed");
+ DEBUG->print("CXF Filter: exporting file failed");
}
return false;
*
* @param value A double value. e.g. 2.700000
*/
-void RS_FilterCXF::stream(std::ofstream & fs, double value)
+void FilterCXF::stream(std::ofstream & fs, double value)
{
- fs << (const char *)RS_Utility::doubleToString(value).toAscii().data();
+ fs << (const char *)Utility::doubleToString(value).toAscii().data();
}
*
* @author Andrew Mustun
*/
-class RS_FilterCXF: public RS_FilterInterface
+class FilterCXF: public FilterInterface
{
public:
- RS_FilterCXF();
- ~RS_FilterCXF();
+ FilterCXF();
+ ~FilterCXF();
/**
* @return RS2::FormatCXF.
* Default constructor.
*
*/
-RS_FilterDXF::RS_FilterDXF(): RS_FilterInterface()
+FilterDXF::FilterDXF(): FilterInterface()
{
- RS_DEBUG->print("RS_FilterDXF::RS_FilterDXF()");
+ DEBUG->print("FilterDXF::FilterDXF()");
addImportFormat(RS2::FormatDXF);
addExportFormat(RS2::FormatDXF);
graphic = NULL;
//exportVersion = DL_Codes::VER_2002;
//systemVariables.setAutoDelete(true);
- RS_DEBUG->print("RS_FilterDXF::RS_FilterDXF(): OK");
+ DEBUG->print("FilterDXF::FilterDXF(): OK");
}
/**
* Destructor.
*/
-RS_FilterDXF::~RS_FilterDXF()
+FilterDXF::~FilterDXF()
{
- RS_DEBUG->print("RS_FilterDXF::~RS_FilterDXF()");
- RS_DEBUG->print("RS_FilterDXF::~RS_FilterDXF(): OK");
+ DEBUG->print("FilterDXF::~FilterDXF()");
+ DEBUG->print("FilterDXF::~FilterDXF(): OK");
}
/**
* will be created or the graphics from which the entities are
* taken to be stored in a file.
*/
-bool RS_FilterDXF::fileImport(Drawing & g, const QString & file, RS2::FormatType /*type*/)
+bool FilterDXF::fileImport(Drawing & g, const QString & file, RS2::FormatType /*type*/)
{
- RS_DEBUG->print("RS_FilterDXF::fileImport");
- //RS_DEBUG->timestamp();
+ DEBUG->print("FilterDXF::fileImport");
+ //DEBUG->timestamp();
- RS_DEBUG->print("DXF Filter: importing file '%s'...", (const char *)QFile::encodeName(file));
+ DEBUG->print("DXF Filter: importing file '%s'...", (const char *)QFile::encodeName(file));
graphic = &g;
currentContainer = graphic;
this->file = file;
- RS_DEBUG->print("graphic->countLayers(): %d", graphic->countLayers());
+ DEBUG->print("graphic->countLayers(): %d", graphic->countLayers());
//graphic->setAutoUpdateBorders(false);
- RS_DEBUG->print("RS_FilterDXF::fileImport: reading file");
+ DEBUG->print("FilterDXF::fileImport: reading file");
bool success = dxf.in((const char *)QFile::encodeName(file), this);
- RS_DEBUG->print("RS_FilterDXF::fileImport: reading file: OK");
+ DEBUG->print("FilterDXF::fileImport: reading file: OK");
//graphic->setAutoUpdateBorders(true);
if (!success)
{
- RS_DEBUG->print(RS_Debug::D_WARNING, "Cannot open DXF file '%s'.",
+ DEBUG->print(Debug::D_WARNING, "Cannot open DXF file '%s'.",
(const char *)QFile::encodeName(file));
return false;
}
- RS_DEBUG->print("RS_FilterDXF::fileImport: adding variables");
+ DEBUG->print("FilterDXF::fileImport: adding variables");
// add some variables that need to be there for DXF drawings:
if (graphic->getVariableString("$DIMSTYLE", "").isEmpty())
{
- RS_DEBUG->print("RS_FilterDXF::fileImport: adding DIMSTYLE");
+ DEBUG->print("FilterDXF::fileImport: adding DIMSTYLE");
graphic->addVariable("$DIMSTYLE", "Standard", 2);
- RS_DEBUG->print("RS_FilterDXF::fileImport: adding DIMSTYLE: OK");
+ DEBUG->print("FilterDXF::fileImport: adding DIMSTYLE: OK");
}
- RS_DEBUG->print("RS_FilterDXF::fileImport: adding variables: OK");
+ DEBUG->print("FilterDXF::fileImport: adding variables: OK");
- RS_DEBUG->print("RS_FilterDXF::fileImport: updating inserts");
+ DEBUG->print("FilterDXF::fileImport: updating inserts");
graphic->updateInserts();
- RS_DEBUG->print("RS_FilterDXF::fileImport: updating inserts: OK");
+ DEBUG->print("FilterDXF::fileImport: updating inserts: OK");
- RS_DEBUG->print("RS_FilterDXF::fileImport OK");
- //RS_DEBUG->timestamp();
+ DEBUG->print("FilterDXF::fileImport OK");
+ //DEBUG->timestamp();
return true;
}
/**
* Implementation of the method which handles layers.
*/
-void RS_FilterDXF::addLayer(const DL_LayerData& data) {
- RS_DEBUG->print("RS_FilterDXF::addLayer");
- RS_DEBUG->print(" adding layer: %s", data.name.c_str());
+void FilterDXF::addLayer(const DL_LayerData& data) {
+ DEBUG->print("FilterDXF::addLayer");
+ DEBUG->print(" adding layer: %s", data.name.c_str());
- RS_DEBUG->print("RS_FilterDXF::addLayer: creating layer");
- RS_Layer* layer = new RS_Layer(data.name.c_str());
- RS_DEBUG->print("RS_FilterDXF::addLayer: set pen");
+ DEBUG->print("FilterDXF::addLayer: creating layer");
+ Layer* layer = new Layer(data.name.c_str());
+ DEBUG->print("FilterDXF::addLayer: set pen");
layer->setPen(attributesToPen(attributes));
//layer->setFlags(data.flags&0x07);
- RS_DEBUG->print("RS_FilterDXF::addLayer: flags");
+ DEBUG->print("FilterDXF::addLayer: flags");
if (data.flags&0x01) {
layer->freeze(true);
}
layer->lock(true);
}
- RS_DEBUG->print("RS_FilterDXF::addLayer: add layer to graphic");
+ DEBUG->print("FilterDXF::addLayer: add layer to graphic");
graphic->addLayer(layer);
- RS_DEBUG->print("RS_FilterDXF::addLayer: OK");
+ DEBUG->print("FilterDXF::addLayer: OK");
}
/**
*
* @todo Adding blocks to blocks (stack for currentContainer)
*/
-void RS_FilterDXF::addBlock(const DL_BlockData & data)
+void FilterDXF::addBlock(const DL_BlockData & data)
{
- RS_DEBUG->print("RS_FilterDXF::addBlock");
- RS_DEBUG->print(" adding block: %s", data.name.c_str());
+ DEBUG->print("FilterDXF::addBlock");
+ DEBUG->print(" adding block: %s", data.name.c_str());
// Prevent special blocks (paper_space, model_space) from being added:
if (QString(data.name.c_str()).toLower() != "*paper_space0"
#ifndef RS_NO_COMPLEX_ENTITIES
if (QString(data.name.c_str()).startsWith("__CE"))
{
- RS_EntityContainer * ec = new RS_EntityContainer();
+ EntityContainer * ec = new EntityContainer();
ec->setLayer("0");
currentContainer = ec;
graphic->addEntity(ec);
{
#endif
Vector bp(data.bpx, data.bpy);
- RS_Block * block = new RS_Block(graphic, RS_BlockData(data.name.c_str(), bp, false));
+ Block * block = new Block(graphic, BlockData(data.name.c_str(), bp, false));
//block->setFlags(flags);
if (graphic->addBlock(block))
/**
* Implementation of the method which closes blocks.
*/
-void RS_FilterDXF::endBlock()
+void FilterDXF::endBlock()
{
currentContainer = graphic;
}
/**
* Implementation of the method which handles point entities.
*/
-void RS_FilterDXF::addPoint(const DL_PointData & data)
+void FilterDXF::addPoint(const DL_PointData & data)
{
Vector v(data.x, data.y);
- RS_Point * entity = new RS_Point(currentContainer, RS_PointData(v));
+ Point * entity = new Point(currentContainer, PointData(v));
setEntityAttributes(entity, attributes);
currentContainer->addEntity(entity);
}
/**
* Implementation of the method which handles line entities.
*/
-void RS_FilterDXF::addLine(const DL_LineData & data)
+void FilterDXF::addLine(const DL_LineData & data)
{
- RS_DEBUG->print("RS_FilterDXF::addLine");
+ DEBUG->print("FilterDXF::addLine");
Vector v1(data.x1, data.y1);
Vector v2(data.x2, data.y2);
- RS_DEBUG->print("RS_FilterDXF::addLine: create line");
+ DEBUG->print("FilterDXF::addLine: create line");
if (currentContainer == NULL)
- RS_DEBUG->print("RS_FilterDXF::addLine: currentContainer is NULL");
+ DEBUG->print("FilterDXF::addLine: currentContainer is NULL");
- RS_Line * entity = new RS_Line(currentContainer, RS_LineData(v1, v2));
- RS_DEBUG->print("RS_FilterDXF::addLine: set attributes");
+ Line * entity = new Line(currentContainer, LineData(v1, v2));
+ DEBUG->print("FilterDXF::addLine: set attributes");
setEntityAttributes(entity, attributes);
- RS_DEBUG->print("RS_FilterDXF::addLine: add entity");
+ DEBUG->print("FilterDXF::addLine: add entity");
currentContainer->addEntity(entity);
- RS_DEBUG->print("RS_FilterDXF::addLine: OK");
+ DEBUG->print("FilterDXF::addLine: OK");
}
/**
* @param angle1 Start angle in deg (!)
* @param angle2 End angle in deg (!)
*/
-void RS_FilterDXF::addArc(const DL_ArcData& data) {
- RS_DEBUG->print("RS_FilterDXF::addArc");
+void FilterDXF::addArc(const DL_ArcData& data) {
+ DEBUG->print("FilterDXF::addArc");
//printf("LINE (%12.6f, %12.6f, %12.6f) (%12.6f, %12.6f, %12.6f)\n",
// p1[0], p1[1], p1[2],
// p2[0], p2[1], p2[2]);
Vector v(data.cx, data.cy);
- RS_ArcData d(v, data.radius,
+ ArcData d(v, data.radius,
data.angle1/ARAD,
data.angle2/ARAD,
false);
- RS_Arc* entity = new RS_Arc(currentContainer, d);
+ Arc* entity = new Arc(currentContainer, d);
setEntityAttributes(entity, attributes);
currentContainer->addEntity(entity);
* @param angle1 Start angle in rad (!)
* @param angle2 End angle in rad (!)
*/
-void RS_FilterDXF::addEllipse(const DL_EllipseData& data) {
- RS_DEBUG->print("RS_FilterDXF::addEllipse");
+void FilterDXF::addEllipse(const DL_EllipseData& data) {
+ DEBUG->print("FilterDXF::addEllipse");
Vector v1(data.cx, data.cy);
Vector v2(data.mx, data.my);
- RS_EllipseData ed(v1, v2,
+ EllipseData ed(v1, v2,
data.ratio,
data.angle1,
data.angle2,
false);
- RS_Ellipse* entity = new RS_Ellipse(currentContainer, ed);
+ Ellipse* entity = new Ellipse(currentContainer, ed);
setEntityAttributes(entity, attributes);
currentContainer->addEntity(entity);
/**
* Implementation of the method which handles circle entities.
*/
-void RS_FilterDXF::addCircle(const DL_CircleData& data) {
- RS_DEBUG->print("RS_FilterDXF::addCircle");
+void FilterDXF::addCircle(const DL_CircleData& data) {
+ DEBUG->print("FilterDXF::addCircle");
//printf("LINE (%12.6f, %12.6f, %12.6f) (%12.6f, %12.6f, %12.6f)\n",
// p1[0], p1[1], p1[2],
// p2[0], p2[1], p2[2]);
Vector v(data.cx, data.cy);
- RS_CircleData d(v, data.radius);
- RS_Circle* entity = new RS_Circle(currentContainer, d);
+ CircleData d(v, data.radius);
+ Circle* entity = new Circle(currentContainer, d);
setEntityAttributes(entity, attributes);
currentContainer->addEntity(entity);
/**
* Implementation of the method which handles polyline entities.
*/
-void RS_FilterDXF::addPolyline(const DL_PolylineData& data) {
- RS_DEBUG->print("RS_FilterDXF::addPolyline");
- //RS_DEBUG->print("RS_FilterDXF::addPolyline()");
- RS_PolylineData d(Vector(false),
+void FilterDXF::addPolyline(const DL_PolylineData& data) {
+ DEBUG->print("FilterDXF::addPolyline");
+ //DEBUG->print("FilterDXF::addPolyline()");
+ PolylineData d(Vector(false),
Vector(false),
data.flags&0x1);
- polyline = new RS_Polyline(currentContainer, d);
+ polyline = new Polyline(currentContainer, d);
setEntityAttributes(polyline, attributes);
currentContainer->addEntity(polyline);
/**
* Implementation of the method which handles polyline vertices.
*/
-void RS_FilterDXF::addVertex(const DL_VertexData& data) {
- RS_DEBUG->print("RS_FilterDXF::addVertex(): %f/%f bulge: %f",
+void FilterDXF::addVertex(const DL_VertexData& data) {
+ DEBUG->print("FilterDXF::addVertex(): %f/%f bulge: %f",
data.x, data.y, data.bulge);
Vector v(data.x, data.y);
/**
* Implementation of the method which handles splines.
*/
-void RS_FilterDXF::addSpline(const DL_SplineData& data) {
- RS_DEBUG->print("RS_FilterDXF::addSpline: degree: %d", data.degree);
+void FilterDXF::addSpline(const DL_SplineData& data) {
+ DEBUG->print("FilterDXF::addSpline: degree: %d", data.degree);
if (data.degree>=1 && data.degree<=3) {
- RS_SplineData d(data.degree, ((data.flags&0x1)==0x1));
- spline = new RS_Spline(currentContainer, d);
+ SplineData d(data.degree, ((data.flags&0x1)==0x1));
+ spline = new Spline(currentContainer, d);
setEntityAttributes(spline, attributes);
currentContainer->addEntity(spline);
} else {
- RS_DEBUG->print(RS_Debug::D_WARNING,
- "RS_FilterDXF::addSpline: Invalid degree for spline: %d. "
+ DEBUG->print(Debug::D_WARNING,
+ "FilterDXF::addSpline: Invalid degree for spline: %d. "
"Accepted values are 1..3.", data.degree);
}
}
-/*virtual*/ void RS_FilterDXF::addKnot(const DL_KnotData &)
+/*virtual*/ void FilterDXF::addKnot(const DL_KnotData &)
{
}
/**
* Implementation of the method which handles spline control points.
*/
-void RS_FilterDXF::addControlPoint(const DL_ControlPointData & data)
+void FilterDXF::addControlPoint(const DL_ControlPointData & data)
{
- RS_DEBUG->print("RS_FilterDXF::addControlPoint: %f/%f", data.x, data.y);
+ DEBUG->print("FilterDXF::addControlPoint: %f/%f", data.x, data.y);
Vector v(data.x, data.y);
/**
* Implementation of the method which handles inserts.
*/
-void RS_FilterDXF::addInsert(const DL_InsertData & data)
+void FilterDXF::addInsert(const DL_InsertData & data)
{
- RS_DEBUG->print("RS_FilterDXF::addInsert");
+ DEBUG->print("FilterDXF::addInsert");
if (QString(data.name.c_str()).left(3) == "A$C")
return;
//cout << "Insert: " << name << " " << ip << " " << cols << "/" << rows << endl;
- RS_InsertData d(data.name.c_str(), ip, sc, data.angle / ARAD, data.cols, data.rows,
+ InsertData d(data.name.c_str(), ip, sc, data.angle / ARAD, data.cols, data.rows,
sp, NULL, RS2::NoUpdate);
- RS_Insert * entity = new RS_Insert(currentContainer, d);
+ Insert * entity = new Insert(currentContainer, d);
setEntityAttributes(entity, attributes);
- RS_DEBUG->print(" id: %d", entity->getId());
+ DEBUG->print(" id: %d", entity->getId());
//entity->update();
currentContainer->addEntity(entity);
}
-/*virtual*/ void RS_FilterDXF::addTrace(const DL_TraceData &)
+/*virtual*/ void FilterDXF::addTrace(const DL_TraceData &)
{
}
-/*virtual*/ void RS_FilterDXF::addSolid(const DL_SolidData &)
+/*virtual*/ void FilterDXF::addSolid(const DL_SolidData &)
{
}
* Implementation of the method which handles text
* chunks for MText entities.
*/
-void RS_FilterDXF::addMTextChunk(const char * text)
+void FilterDXF::addMTextChunk(const char * text)
{
- RS_DEBUG->print("RS_FilterDXF::addMTextChunk: %s", text);
+ DEBUG->print("FilterDXF::addMTextChunk: %s", text);
//mtext += text;
//mtext += QString::fromUtf8(text);
/*
QCString locallyEncoded = text;
- QString enc = RS_System::getEncoding(variables.getString("$DWGCODEPAGE", "ANSI_1252"));
+ QString enc = System::getEncoding(variables.getString("$DWGCODEPAGE", "ANSI_1252"));
QTextCodec *codec = QTextCodec::codecForName(enc); // get the codec for Japanese
if (codec!=NULL) {
mtext += codec->toUnicode(toNativeString(locallyEncoded));
* Implementation of the method which handles
* multi texts (MTEXT).
*/
-void RS_FilterDXF::addMText(const DL_MTextData & data)
+void FilterDXF::addMText(const DL_MTextData & data)
{
- RS_DEBUG->print("RS_FilterDXF::addMText: %s", data.text.c_str());
+ DEBUG->print("FilterDXF::addMText: %s", data.text.c_str());
Vector ip(data.ipx, data.ipy);
RS2::VAlign valign;
mtext += QString(data.text.c_str());
QString locallyEncoded = mtext;
- QString enc = RS_System::getEncoding(variables.getString("$DWGCODEPAGE", "ANSI_1252"));
+ QString enc = System::getEncoding(variables.getString("$DWGCODEPAGE", "ANSI_1252"));
// get the codec for Japanese
QTextCodec * codec = QTextCodec::codecForName(enc.toAscii());
sty = variables.getString("$TEXTSTYLE", "Standard");
}
- RS_DEBUG->print("Text as unicode:");
- RS_DEBUG->printUnicode(mtext);
+ DEBUG->print("Text as unicode:");
+ DEBUG->printUnicode(mtext);
- RS_TextData d(ip, data.height, data.width, valign, halign, dir, lss,
+ TextData d(ip, data.height, data.width, valign, halign, dir, lss,
data.lineSpacingFactor, mtext, sty, data.angle, RS2::NoUpdate);
- RS_Text * entity = new RS_Text(currentContainer, d);
+ Text * entity = new Text(currentContainer, d);
setEntityAttributes(entity, attributes);
entity->update();
* Implementation of the method which handles
* texts (TEXT).
*/
-void RS_FilterDXF::addText(const DL_TextData& data) {
- RS_DEBUG->print("RS_FilterDXF::addText");
+void FilterDXF::addText(const DL_TextData& data) {
+ DEBUG->print("FilterDXF::addText");
int attachmentPoint;
Vector refPoint;
double angle = data.angle;
* Implementation of the method which handles
* dimensions (DIMENSION).
*/
-RS_DimensionData RS_FilterDXF::convDimensionData(
+DimensionData FilterDXF::convDimensionData(
const DL_DimensionData& data) {
Vector defP(data.dpx, data.dpy);
sty = variables.getString("$DIMSTYLE", "Standard");
}
- RS_DEBUG->print("Text as unicode:");
- RS_DEBUG->printUnicode(t);
+ DEBUG->print("Text as unicode:");
+ DEBUG->printUnicode(t);
// data needed to add the actual dimension entity
- return RS_DimensionData(defP, midP,
+ return DimensionData(defP, midP,
valign, halign,
lss,
data.lineSpacingFactor,
* Implementation of the method which handles
* aligned dimensions (DIMENSION).
*/
-void RS_FilterDXF::addDimAlign(const DL_DimensionData& data,
+void FilterDXF::addDimAlign(const DL_DimensionData& data,
const DL_DimAlignedData& edata) {
- RS_DEBUG->print("RS_FilterDXF::addDimAligned");
+ DEBUG->print("FilterDXF::addDimAligned");
- RS_DimensionData dimensionData = convDimensionData(data);
+ DimensionData dimensionData = convDimensionData(data);
Vector ext1(edata.epx1, edata.epy1);
Vector ext2(edata.epx2, edata.epy2);
- RS_DimAlignedData d(ext1, ext2);
+ DimAlignedData d(ext1, ext2);
- RS_DimAligned* entity = new RS_DimAligned(currentContainer,
+ DimAligned* entity = new DimAligned(currentContainer,
dimensionData, d);
setEntityAttributes(entity, attributes);
entity->update();
* Implementation of the method which handles
* linear dimensions (DIMENSION).
*/
-void RS_FilterDXF::addDimLinear(const DL_DimensionData& data,
+void FilterDXF::addDimLinear(const DL_DimensionData& data,
const DL_DimLinearData& edata) {
- RS_DEBUG->print("RS_FilterDXF::addDimLinear");
+ DEBUG->print("FilterDXF::addDimLinear");
- RS_DimensionData dimensionData = convDimensionData(data);
+ DimensionData dimensionData = convDimensionData(data);
Vector dxt1(edata.dpx1, edata.dpy1);
Vector dxt2(edata.dpx2, edata.dpy2);
- RS_DimLinearData d(dxt1, dxt2, RS_Math::deg2rad(edata.angle),
- RS_Math::deg2rad(edata.oblique));
+ DimLinearData d(dxt1, dxt2, Math::deg2rad(edata.angle),
+ Math::deg2rad(edata.oblique));
- RS_DimLinear* entity = new RS_DimLinear(currentContainer,
+ DimLinear* entity = new DimLinear(currentContainer,
dimensionData, d);
setEntityAttributes(entity, attributes);
entity->update();
* Implementation of the method which handles
* radial dimensions (DIMENSION).
*/
-void RS_FilterDXF::addDimRadial(const DL_DimensionData& data,
+void FilterDXF::addDimRadial(const DL_DimensionData& data,
const DL_DimRadialData& edata) {
- RS_DEBUG->print("RS_FilterDXF::addDimRadial");
+ DEBUG->print("FilterDXF::addDimRadial");
- RS_DimensionData dimensionData = convDimensionData(data);
+ DimensionData dimensionData = convDimensionData(data);
Vector dp(edata.dpx, edata.dpy);
- RS_DimRadialData d(dp, edata.leader);
+ DimRadialData d(dp, edata.leader);
- RS_DimRadial* entity = new RS_DimRadial(currentContainer,
+ DimRadial* entity = new DimRadial(currentContainer,
dimensionData, d);
setEntityAttributes(entity, attributes);
* Implementation of the method which handles
* diametric dimensions (DIMENSION).
*/
-void RS_FilterDXF::addDimDiametric(const DL_DimensionData& data,
+void FilterDXF::addDimDiametric(const DL_DimensionData& data,
const DL_DimDiametricData& edata) {
- RS_DEBUG->print("RS_FilterDXF::addDimDiametric");
+ DEBUG->print("FilterDXF::addDimDiametric");
- RS_DimensionData dimensionData = convDimensionData(data);
+ DimensionData dimensionData = convDimensionData(data);
Vector dp(edata.dpx, edata.dpy);
- RS_DimDiametricData d(dp, edata.leader);
+ DimDiametricData d(dp, edata.leader);
- RS_DimDiametric* entity = new RS_DimDiametric(currentContainer,
+ DimDiametric* entity = new DimDiametric(currentContainer,
dimensionData, d);
setEntityAttributes(entity, attributes);
* Implementation of the method which handles
* angular dimensions (DIMENSION).
*/
-void RS_FilterDXF::addDimAngular(const DL_DimensionData& data,
+void FilterDXF::addDimAngular(const DL_DimensionData& data,
const DL_DimAngularData& edata) {
- RS_DEBUG->print("RS_FilterDXF::addDimAngular");
+ DEBUG->print("FilterDXF::addDimAngular");
- RS_DimensionData dimensionData = convDimensionData(data);
+ DimensionData dimensionData = convDimensionData(data);
Vector dp1(edata.dpx1, edata.dpy1);
Vector dp2(edata.dpx2, edata.dpy2);
Vector dp3(edata.dpx3, edata.dpy3);
Vector dp4(edata.dpx4, edata.dpy4);
- RS_DimAngularData d(dp1, dp2, dp3, dp4);
+ DimAngularData d(dp1, dp2, dp3, dp4);
- RS_DimAngular* entity = new RS_DimAngular(currentContainer,
+ DimAngular* entity = new DimAngular(currentContainer,
dimensionData, d);
setEntityAttributes(entity, attributes);
* Implementation of the method which handles
* angular dimensions (DIMENSION).
*/
-void RS_FilterDXF::addDimAngular3P(const DL_DimensionData& data,
+void FilterDXF::addDimAngular3P(const DL_DimensionData& data,
const DL_DimAngular3PData& edata) {
- RS_DEBUG->print("RS_FilterDXF::addDimAngular3P");
+ DEBUG->print("FilterDXF::addDimAngular3P");
- RS_DimensionData dimensionData = convDimensionData(data);
+ DimensionData dimensionData = convDimensionData(data);
Vector dp1(edata.dpx3, edata.dpy3);
Vector dp2(edata.dpx1, edata.dpy1);
Vector dp3(edata.dpx3, edata.dpy3);
Vector dp4 = dimensionData.definitionPoint;
dimensionData.definitionPoint = Vector(edata.dpx2, edata.dpy2);
- RS_DimAngularData d(dp1, dp2, dp3, dp4);
+ DimAngularData d(dp1, dp2, dp3, dp4);
- RS_DimAngular* entity = new RS_DimAngular(currentContainer,
+ DimAngular* entity = new DimAngular(currentContainer,
dimensionData, d);
setEntityAttributes(entity, attributes);
/**
* Implementation of the method which handles leader entities.
*/
-void RS_FilterDXF::addLeader(const DL_LeaderData& data) {
- RS_DEBUG->print("RS_FilterDXF::addDimLeader");
- //RS_DEBUG->print("RS_FilterDXF::addPolyline()");
- RS_LeaderData d(data.arrowHeadFlag==1);
- leader = new RS_Leader(currentContainer, d);
+void FilterDXF::addLeader(const DL_LeaderData& data) {
+ DEBUG->print("FilterDXF::addDimLeader");
+ //DEBUG->print("FilterDXF::addPolyline()");
+ LeaderData d(data.arrowHeadFlag==1);
+ leader = new Leader(currentContainer, d);
setEntityAttributes(leader, attributes);
currentContainer->addEntity(leader);
/**
* Implementation of the method which handles leader vertices.
*/
-void RS_FilterDXF::addLeaderVertex(const DL_LeaderVertexData& data) {
- RS_DEBUG->print("RS_FilterDXF::addLeaderVertex");
- //RS_DEBUG->print("RS_FilterDXF::addVertex() bulge: %f", bulge);
+void FilterDXF::addLeaderVertex(const DL_LeaderVertexData& data) {
+ DEBUG->print("FilterDXF::addLeaderVertex");
+ //DEBUG->print("FilterDXF::addVertex() bulge: %f", bulge);
Vector v(data.x, data.y);
/**
* Implementation of the method which handles hatch entities.
*/
-void RS_FilterDXF::addHatch(const DL_HatchData& data) {
- RS_DEBUG->print("RS_FilterDXF::addHatch()");
+void FilterDXF::addHatch(const DL_HatchData& data) {
+ DEBUG->print("FilterDXF::addHatch()");
- hatch = new RS_Hatch(currentContainer,
- RS_HatchData(data.solid,
+ hatch = new Hatch(currentContainer,
+ HatchData(data.solid,
data.scale,
data.angle,
QString(data.pattern.c_str())));
/**
* Implementation of the method which handles hatch loops.
*/
-void RS_FilterDXF::addHatchLoop(const DL_HatchLoopData& /*data*/) {
- RS_DEBUG->print("RS_FilterDXF::addHatchLoop()");
+void FilterDXF::addHatchLoop(const DL_HatchLoopData& /*data*/) {
+ DEBUG->print("FilterDXF::addHatchLoop()");
if (hatch!=NULL) {
- hatchLoop = new RS_EntityContainer(hatch);
+ hatchLoop = new EntityContainer(hatch);
hatchLoop->setLayer(NULL);
hatch->addEntity(hatchLoop);
}
/**
* Implementation of the method which handles hatch edge entities.
*/
-void RS_FilterDXF::addHatchEdge(const DL_HatchEdgeData& data) {
- RS_DEBUG->print("RS_FilterDXF::addHatchEdge()");
+void FilterDXF::addHatchEdge(const DL_HatchEdgeData& data) {
+ DEBUG->print("FilterDXF::addHatchEdge()");
if (hatchLoop!=NULL) {
- RS_Entity* e = NULL;
+ Entity* e = NULL;
switch (data.type) {
case 1:
- RS_DEBUG->print("RS_FilterDXF::addHatchEdge(): "
+ DEBUG->print("FilterDXF::addHatchEdge(): "
"line: %f,%f %f,%f",
data.x1, data.y1, data.x2, data.y2);
- e = new RS_Line(hatchLoop,
- RS_LineData(Vector(data.x1, data.y1),
+ e = new Line(hatchLoop,
+ LineData(Vector(data.x1, data.y1),
Vector(data.x2, data.y2)));
break;
case 2:
if (data.ccw && data.angle1<1.0e-6 && data.angle2>2*M_PI-1.0e-6) {
- e = new RS_Circle(hatchLoop,
- RS_CircleData(Vector(data.cx, data.cy),
+ e = new Circle(hatchLoop,
+ CircleData(Vector(data.cx, data.cy),
data.radius));
} else {
if (data.ccw) {
- e = new RS_Arc(
+ e = new Arc(
hatchLoop,
- RS_ArcData(Vector(data.cx, data.cy),
+ ArcData(Vector(data.cx, data.cy),
data.radius,
- RS_Math::correctAngle(data.angle1),
- RS_Math::correctAngle(data.angle2),
+ Math::correctAngle(data.angle1),
+ Math::correctAngle(data.angle2),
false));
} else {
- e = new RS_Arc(
+ e = new Arc(
hatchLoop,
- RS_ArcData(Vector(data.cx, data.cy),
+ ArcData(Vector(data.cx, data.cy),
data.radius,
- RS_Math::correctAngle(2*M_PI-data.angle1),
- RS_Math::correctAngle(2*M_PI-data.angle2),
+ Math::correctAngle(2*M_PI-data.angle1),
+ Math::correctAngle(2*M_PI-data.angle2),
true));
}
}
/**
* Implementation of the method which handles image entities.
*/
-void RS_FilterDXF::addImage(const DL_ImageData& data) {
- RS_DEBUG->print("RS_FilterDXF::addImage");
+void FilterDXF::addImage(const DL_ImageData& data) {
+ DEBUG->print("FilterDXF::addImage");
Vector ip(data.ipx, data.ipy);
Vector uv(data.ux, data.uy);
Vector vv(data.vx, data.vy);
Vector size(data.width, data.height);
- RS_Image* image =
- new RS_Image(
+ Image* image =
+ new Image(
currentContainer,
- RS_ImageData(QString(data.ref.c_str()).toInt(NULL, 16),
+ ImageData(QString(data.ref.c_str()).toInt(NULL, 16),
ip, uv, vv,
size,
QString(""),
/**
* Implementation of the method which links image entities to image files.
*/
-void RS_FilterDXF::linkImage(const DL_ImageDefData & data)
+void FilterDXF::linkImage(const DL_ImageDefData & data)
{
- RS_DEBUG->print("RS_FilterDXF::linkImage");
+ DEBUG->print("FilterDXF::linkImage");
int handle = QString(data.ref.c_str()).toInt(NULL, 16);
QString sfile(data.file.c_str());
// first: absolute path:
if (!fiBitmap.exists())
{
- RS_DEBUG->print("File %s doesn't exist.", (const char *)QFile::encodeName(sfile));
+ DEBUG->print("File %s doesn't exist.", (const char *)QFile::encodeName(sfile));
// try relative path:
// QString f1 = fiDxf.dirPath(true) + "/" + sfile;
QString f1 = fiDxf.absolutePath() + "/" + sfile;
sfile = f1;
else
{
- RS_DEBUG->print("File %s doesn't exist.", (const char *)QFile::encodeName(f1));
+ DEBUG->print("File %s doesn't exist.", (const char *)QFile::encodeName(f1));
// try drawing path:
// QString f2 = fiDxf.dirPath(true) + "/" + fiBitmap.fileName();
QString f2 = fiDxf.absolutePath() + "/" + fiBitmap.fileName();
}
else
{
- RS_DEBUG->print("File %s doesn't exist.", (const char *)QFile::encodeName(f2));
+ DEBUG->print("File %s doesn't exist.", (const char *)QFile::encodeName(f2));
}
}
}
// Also link images in subcontainers (e.g. inserts):
- for(RS_Entity * e=graphic->firstEntity(RS2::ResolveNone); e!=NULL;
+ for(Entity * e=graphic->firstEntity(RS2::ResolveNone); e!=NULL;
e=graphic->nextEntity(RS2::ResolveNone))
{
if (e->rtti() == RS2::EntityImage)
{
- RS_Image * img = (RS_Image *)e;
+ Image * img = (Image *)e;
if (img->getHandle() == handle)
{
img->setFile(sfile);
- RS_DEBUG->print("image found: %s", (const char *)QFile::encodeName(img->getFile()));
+ DEBUG->print("image found: %s", (const char *)QFile::encodeName(img->getFile()));
img->update();
}
}
// update images in blocks:
for(uint i=0; i<graphic->countBlocks(); ++i)
{
- RS_Block * b = graphic->blockAt(i);
+ Block * b = graphic->blockAt(i);
- for(RS_Entity * e=b->firstEntity(RS2::ResolveNone); e!=NULL; e=b->nextEntity(RS2::ResolveNone))
+ for(Entity * e=b->firstEntity(RS2::ResolveNone); e!=NULL; e=b->nextEntity(RS2::ResolveNone))
{
if (e->rtti() == RS2::EntityImage)
{
- RS_Image * img = (RS_Image *)e;
+ Image * img = (Image *)e;
if (img->getHandle() == handle)
{
img->setFile(sfile);
- RS_DEBUG->print("image in block found: %s",
+ DEBUG->print("image in block found: %s",
(const char*)QFile::encodeName(img->getFile()));
img->update();
}
}
}
- RS_DEBUG->print("linking image: OK");
+ DEBUG->print("linking image: OK");
}
/**
* Finishes a hatch entity.
*/
-void RS_FilterDXF::endEntity()
+void FilterDXF::endEntity()
{
- RS_DEBUG->print("RS_FilterDXF::endEntity");
+ DEBUG->print("FilterDXF::endEntity");
if (hatch != NULL)
{
- RS_DEBUG->print("hatch->update()");
+ DEBUG->print("hatch->update()");
if (hatch->validate())
hatch->update();
else
{
graphic->removeEntity(hatch);
- RS_DEBUG->print(RS_Debug::D_ERROR, "RS_FilterDXF::endEntity(): updating hatch failed: invalid hatch area");
+ DEBUG->print(Debug::D_ERROR, "FilterDXF::endEntity(): updating hatch failed: invalid hatch area");
}
hatch = NULL;
}
}
-/*virtual*/ void RS_FilterDXF::endSequence()
+/*virtual*/ void FilterDXF::endSequence()
{
}
/**
* Sets a vector variable from the DXF file.
*/
-void RS_FilterDXF::setVariableVector(const char * key, double v1, double v2, double v3, int code)
+void FilterDXF::setVariableVector(const char * key, double v1, double v2, double v3, int code)
{
- RS_DEBUG->print("RS_FilterDXF::setVariableVector");
+ DEBUG->print("FilterDXF::setVariableVector");
// update document's variable list:
if (currentContainer->rtti() == RS2::EntityGraphic)
/**
* Sets a string variable from the DXF file.
*/
-void RS_FilterDXF::setVariableString(const char * key, const char * value, int code)
+void FilterDXF::setVariableString(const char * key, const char * value, int code)
{
- RS_DEBUG->print("RS_FilterDXF::setVariableString");
+ DEBUG->print("FilterDXF::setVariableString");
// update local DXF variable list:
variables.add(QString(key), QString(value), code);
/**
* Sets an int variable from the DXF file.
*/
-void RS_FilterDXF::setVariableInt(const char* key, int value, int code) {
- RS_DEBUG->print("RS_FilterDXF::setVariableInt");
+void FilterDXF::setVariableInt(const char* key, int value, int code) {
+ DEBUG->print("FilterDXF::setVariableInt");
// update document's variable list:
if (currentContainer->rtti()==RS2::EntityGraphic) {
/**
* Sets a double variable from the DXF file.
*/
-void RS_FilterDXF::setVariableDouble(const char* key, double value, int code) {
- RS_DEBUG->print("RS_FilterDXF::setVariableDouble");
+void FilterDXF::setVariableDouble(const char* key, double value, int code) {
+ DEBUG->print("FilterDXF::setVariableDouble");
// update document's variable list:
if (currentContainer->rtti() == RS2::EntityGraphic)
*
* @param file Full path to the DXF file that will be written.
*/
-bool RS_FilterDXF::fileExport(Drawing & g, const QString & file, RS2::FormatType type)
+bool FilterDXF::fileExport(Drawing & g, const QString & file, RS2::FormatType type)
{
- RS_DEBUG->print("RS_FilterDXF::fileExport: exporting file '%s'...",
+ DEBUG->print("FilterDXF::fileExport: exporting file '%s'...",
(const char *)QFile::encodeName(file));
- RS_DEBUG->print("RS_FilterDXF::fileExport: file type '%d'", (int)type);
+ DEBUG->print("FilterDXF::fileExport: file type '%d'", (int)type);
this->graphic = &g;
if (QFileInfo(path).isWritable() == false)
{
- RS_DEBUG->print("RS_FilterDXF::fileExport: can't write file: no permission");
+ DEBUG->print("FilterDXF::fileExport: can't write file: no permission");
return false;
}
//
if (dw == NULL)
{
- RS_DEBUG->print("RS_FilterDXF::fileExport: can't write file");
+ DEBUG->print("FilterDXF::fileExport: can't write file");
return false;
}
// Header
- RS_DEBUG->print("writing headers...");
+ DEBUG->print("writing headers...");
dxf.writeHeader(*dw);
// Variables
- RS_DEBUG->print("writing variables...");
+ DEBUG->print("writing variables...");
writeVariables(*dw);
// Section TABLES
- RS_DEBUG->print("writing tables...");
+ DEBUG->print("writing tables...");
dw->sectionTables();
// VPORT:
dxf.writeVPort(*dw);
// Line types:
- RS_DEBUG->print("writing line types...");
+ DEBUG->print("writing line types...");
int numLT = (int)RS2::BorderLineX2 - (int)RS2::LineByBlock;
if (type == RS2::FormatDXF12)
dw->tableEnd();
// Layers:
- RS_DEBUG->print("writing layers...");
+ DEBUG->print("writing layers...");
dw->tableLayers(graphic->countLayers());
for(uint i=0; i<graphic->countLayers(); ++i)
{
- RS_Layer * l = graphic->layerAt(i);
+ Layer * l = graphic->layerAt(i);
writeLayer(*dw, l);
}
dw->tableEnd();
// STYLE:
- RS_DEBUG->print("writing styles...");
+ DEBUG->print("writing styles...");
dxf.writeStyle(*dw);
// VIEW:
- RS_DEBUG->print("writing views...");
+ DEBUG->print("writing views...");
dxf.writeView(*dw);
// UCS:
- RS_DEBUG->print("writing ucs...");
+ DEBUG->print("writing ucs...");
dxf.writeUcs(*dw);
// Appid:
- RS_DEBUG->print("writing appid...");
+ DEBUG->print("writing appid...");
dw->tableAppid(1);
writeAppid(*dw, "ACAD");
dw->tableEnd();
// DIMSTYLE:
- RS_DEBUG->print("writing dim styles...");
+ DEBUG->print("writing dim styles...");
dxf.writeDimStyle(*dw,
graphic->getVariableDouble("$DIMASZ", 2.5),
graphic->getVariableDouble("$DIMEXE", 1.25),
// BLOCK_RECORD:
if (type == RS2::FormatDXF)
{
- RS_DEBUG->print("writing block records...");
+ DEBUG->print("writing block records...");
dxf.writeBlockRecord(*dw);
for(uint i=0; i<graphic->countBlocks(); ++i)
{
- RS_Block * blk = graphic->blockAt(i);
+ Block * blk = graphic->blockAt(i);
dxf.writeBlockRecord(*dw, std::string((const char *)blk->getName().toLocal8Bit()));
/*
// v2.0.4.9..:
}
// end of tables:
- RS_DEBUG->print("writing end of section TABLES...");
+ DEBUG->print("writing end of section TABLES...");
dw->sectionEnd();
// Section BLOCKS:
- RS_DEBUG->print("writing blocks...");
+ DEBUG->print("writing blocks...");
dw->sectionBlocks();
if (type == RS2::FormatDXF)
{
- RS_Block b1(graphic, RS_BlockData("*Model_Space", Vector(0.0, 0.0), false));
+ Block b1(graphic, BlockData("*Model_Space", Vector(0.0, 0.0), false));
writeBlock(*dw, &b1);
- RS_Block b2(graphic, RS_BlockData("*Paper_Space", Vector(0.0, 0.0), false));
+ Block b2(graphic, BlockData("*Paper_Space", Vector(0.0, 0.0), false));
writeBlock(*dw, &b2);
- RS_Block b3(graphic, RS_BlockData("*Paper_Space0", Vector(0.0, 0.0), false));
+ Block b3(graphic, BlockData("*Paper_Space0", Vector(0.0, 0.0), false));
writeBlock(*dw, &b3);
}
for(uint i=0; i<graphic->countBlocks(); ++i)
{
- RS_Block * blk = graphic->blockAt(i);
+ Block * blk = graphic->blockAt(i);
// Save block if it's not a model or paper space:
// Careful: other blocks with * / $ exist
dw->sectionEnd();
// Section ENTITIES:
- RS_DEBUG->print("writing section ENTITIES...");
+ DEBUG->print("writing section ENTITIES...");
dw->sectionEntities();
- for(RS_Entity * e=graphic->firstEntity(RS2::ResolveNone); e!=NULL;
+ for(Entity * e=graphic->firstEntity(RS2::ResolveNone); e!=NULL;
e=graphic->nextEntity(RS2::ResolveNone))
{
writeEntity(*dw, e);
}
- RS_DEBUG->print("writing end of section ENTITIES...");
+ DEBUG->print("writing end of section ENTITIES...");
dw->sectionEnd();
if (type == RS2::FormatDXF)
{
- RS_DEBUG->print("writing section OBJECTS...");
+ DEBUG->print("writing section OBJECTS...");
dxf.writeObjects(*dw);
// IMAGEDEF's from images in entities and images in blocks
for(uint i=0; i<graphic->countBlocks(); ++i)
{
- RS_Block * block = graphic->blockAt(i);
+ Block * block = graphic->blockAt(i);
- for(RS_Entity * e=block->firstEntity(RS2::ResolveAll); e!=NULL;
+ for(Entity * e=block->firstEntity(RS2::ResolveAll); e!=NULL;
e=block->nextEntity(RS2::ResolveAll))
{
if (e->rtti() == RS2::EntityImage)
{
- RS_Image * img = ((RS_Image *)e);
+ Image * img = ((Image *)e);
if (written.contains(file) == 0 && img->getHandle() != 0)
{
}
}
- for(RS_Entity * e=graphic->firstEntity(RS2::ResolveNone); e!=NULL;
+ for(Entity * e=graphic->firstEntity(RS2::ResolveNone); e!=NULL;
e=graphic->nextEntity(RS2::ResolveNone))
{
if (e->rtti() == RS2::EntityImage)
{
- RS_Image * img = ((RS_Image *)e);
+ Image * img = ((Image *)e);
if (written.contains(file) == 0 && img->getHandle() != 0)
{
}
}
}
- RS_DEBUG->print("writing end of section OBJECTS...");
+ DEBUG->print("writing end of section OBJECTS...");
dxf.writeObjectsEnd(*dw);
}
- RS_DEBUG->print("writing EOF...");
+ DEBUG->print("writing EOF...");
dw->dxfEOF();
- RS_DEBUG->print("close..");
+ DEBUG->print("close..");
dw->close();
delete dw;
// check if file was actually written (strange world of windoze xp):
if (QFileInfo(file).exists() == false)
{
- RS_DEBUG->print("RS_FilterDXF::fileExport: file could not be written");
+ DEBUG->print("FilterDXF::fileExport: file could not be written");
return false;
}
/**
* Writes all known variable settings to the DXF file.
*/
-void RS_FilterDXF::writeVariables(DL_WriterA & dw)
+void FilterDXF::writeVariables(DL_WriterA & dw)
{
-// Q3DictIterator<RS_Variable> it(graphic->getVariableDict());
- QHashIterator<QString, RS_Variable *> it(graphic->getVariableDict());
+// Q3DictIterator<Variable> it(graphic->getVariableDict());
+ QHashIterator<QString, Variable *> it(graphic->getVariableDict());
// for (; it.current(); ++it)
while (it.hasNext())
*
* @todo Add support for unicode layer names
*/
-void RS_FilterDXF::writeLayer(DL_WriterA & dw, RS_Layer * l)
+void FilterDXF::writeLayer(DL_WriterA & dw, Layer * l)
{
if (l == NULL)
{
- RS_DEBUG->print(RS_Debug::D_WARNING, "RS_FilterDXF::writeLayer: layer is NULL");
+ DEBUG->print(Debug::D_WARNING, "FilterDXF::writeLayer: layer is NULL");
return;
}
- RS_DEBUG->print("RS_FilterDXF::writeLayer %s", l->getName().toLatin1().data());
+ DEBUG->print("FilterDXF::writeLayer %s", l->getName().toLatin1().data());
dxf.writeLayer(dw, DL_LayerData((const char *)l->getName().toLocal8Bit(),
l->isFrozen() + (l->isLocked() << 2)), DL_Attributes(std::string(""),
colorToNumber(l->getPen().getColor()), widthToNumber(l->getPen().getWidth()),
(const char *)lineTypeToName(l->getPen().getLineType()).toLocal8Bit()));
- RS_DEBUG->print("RS_FilterDXF::writeLayer end");
+ DEBUG->print("FilterDXF::writeLayer end");
}
/**
* Writes a line type to the DXF file.
*/
-void RS_FilterDXF::writeLineType(DL_WriterA & dw, RS2::LineType t)
+void FilterDXF::writeLineType(DL_WriterA & dw, RS2::LineType t)
{
dxf.writeLineType(dw, DL_LineTypeData((const char *)lineTypeToName(t).toLocal8Bit(), 0));
}
*
* @param appid Application ID (e.g. "QCad").
*/
-void RS_FilterDXF::writeAppid(DL_WriterA& dw, const char* appid) {
+void FilterDXF::writeAppid(DL_WriterA& dw, const char* appid) {
dxf.writeAppid(dw, appid);
}
/**
* Writes a block (just the definition, not the entities in it).
*/
-void RS_FilterDXF::writeBlock(DL_WriterA& dw, RS_Block* blk) {
+void FilterDXF::writeBlock(DL_WriterA& dw, Block* blk) {
if (blk==NULL) {
- RS_DEBUG->print(RS_Debug::D_WARNING,
- "RS_FilterDXF::writeBlock: Block is NULL");
+ DEBUG->print(Debug::D_WARNING,
+ "FilterDXF::writeBlock: Block is NULL");
return;
}
- RS_DEBUG->print("writing block: %s", (const char*)blk->getName().toLocal8Bit());
+ DEBUG->print("writing block: %s", (const char*)blk->getName().toLocal8Bit());
dxf.writeBlock(dw,
DL_BlockData((const char*)blk->getName().toLocal8Bit(), 0,
blk->getBasePoint().x,
blk->getBasePoint().y,
blk->getBasePoint().z));
- for (RS_Entity* e=blk->firstEntity(RS2::ResolveNone);
+ for (Entity* e=blk->firstEntity(RS2::ResolveNone);
e!=NULL;
e=blk->nextEntity(RS2::ResolveNone)) {
writeEntity(dw, e);
/**
* Writes the given entity to the DXF file.
*/
-void RS_FilterDXF::writeEntity(DL_WriterA& dw, RS_Entity* e) {
+void FilterDXF::writeEntity(DL_WriterA& dw, Entity* e) {
writeEntity(dw, e, getEntityAttributes(e));
}
/**
* Writes the given entity to the DXF file.
*/
-void RS_FilterDXF::writeEntity(DL_WriterA& dw, RS_Entity* e,
+void FilterDXF::writeEntity(DL_WriterA& dw, Entity* e,
const DL_Attributes& attrib) {
if (e==NULL || e->getFlag(RS2::FlagUndone)) {
return;
}
- RS_DEBUG->print("writing Entity");
+ DEBUG->print("writing Entity");
switch (e->rtti()) {
case RS2::EntityPoint:
- writePoint(dw, (RS_Point*)e, attrib);
+ writePoint(dw, (Point*)e, attrib);
break;
case RS2::EntityLine:
- writeLine(dw, (RS_Line*)e, attrib);
+ writeLine(dw, (Line*)e, attrib);
break;
case RS2::EntityPolyline:
- writePolyline(dw, (RS_Polyline*)e, attrib);
+ writePolyline(dw, (Polyline*)e, attrib);
break;
case RS2::EntitySpline:
- writeSpline(dw, (RS_Spline*)e, attrib);
+ writeSpline(dw, (Spline*)e, attrib);
break;
case RS2::EntityVertex:
break;
case RS2::EntityCircle:
- writeCircle(dw, (RS_Circle*)e, attrib);
+ writeCircle(dw, (Circle*)e, attrib);
break;
case RS2::EntityArc:
- writeArc(dw, (RS_Arc*)e, attrib);
+ writeArc(dw, (Arc*)e, attrib);
break;
case RS2::EntityEllipse:
- writeEllipse(dw, (RS_Ellipse*)e, attrib);
+ writeEllipse(dw, (Ellipse*)e, attrib);
break;
case RS2::EntityInsert:
- writeInsert(dw, (RS_Insert*)e, attrib);
+ writeInsert(dw, (Insert*)e, attrib);
break;
case RS2::EntityText:
- writeText(dw, (RS_Text*)e, attrib);
+ writeText(dw, (Text*)e, attrib);
break;
case RS2::EntityDimAligned:
case RS2::EntityDimLinear:
case RS2::EntityDimRadial:
case RS2::EntityDimDiametric:
- writeDimension(dw, (RS_Dimension*)e, attrib);
+ writeDimension(dw, (Dimension*)e, attrib);
break;
case RS2::EntityDimLeader:
- writeLeader(dw, (RS_Leader*)e, attrib);
+ writeLeader(dw, (Leader*)e, attrib);
break;
case RS2::EntityHatch:
- writeHatch(dw, (RS_Hatch*)e, attrib);
+ writeHatch(dw, (Hatch*)e, attrib);
break;
case RS2::EntityImage:
- writeImage(dw, (RS_Image*)e, attrib);
+ writeImage(dw, (Image*)e, attrib);
break;
case RS2::EntitySolid:
- writeSolid(dw, (RS_Solid*)e, attrib);
+ writeSolid(dw, (Solid*)e, attrib);
break;
#ifndef RS_NO_COMPLEX_ENTITIES
case RS2::EntityContainer:
- writeEntityContainer(dw, (RS_EntityContainer*)e, attrib);
+ writeEntityContainer(dw, (EntityContainer*)e, attrib);
break;
#endif
/**
* Writes the given Point entity to the file.
*/
-void RS_FilterDXF::writePoint(DL_WriterA& dw, RS_Point* p,
+void FilterDXF::writePoint(DL_WriterA& dw, Point* p,
const DL_Attributes& attrib) {
dxf.writePoint(
dw,
/**
* Writes the given Line( entity to the file.
*/
-void RS_FilterDXF::writeLine(DL_WriterA& dw, RS_Line* l,
+void FilterDXF::writeLine(DL_WriterA& dw, Line* l,
const DL_Attributes& attrib) {
dxf.writeLine(
dw,
/**
* Writes the given polyline entity to the file.
*/
-void RS_FilterDXF::writePolyline(DL_WriterA& dw,
- RS_Polyline* l,
+void FilterDXF::writePolyline(DL_WriterA& dw,
+ Polyline* l,
const DL_Attributes& attrib) {
int count = l->count();
l->isClosed()*0x1),
attrib);
bool first = true;
- RS_Entity* nextEntity = 0;
- RS_AtomicEntity* ae = NULL;
- RS_Entity* lastEntity = l->lastEntity(RS2::ResolveNone);
- for (RS_Entity* v=l->firstEntity(RS2::ResolveNone);
+ Entity* nextEntity = 0;
+ AtomicEntity* ae = NULL;
+ Entity* lastEntity = l->lastEntity(RS2::ResolveNone);
+ for (Entity* v=l->firstEntity(RS2::ResolveNone);
v!=NULL;
v=nextEntity) {
continue;
}
- ae = (RS_AtomicEntity*)v;
+ ae = (AtomicEntity*)v;
double bulge=0.0;
// Write vertex:
if (first) {
if (v->rtti()==RS2::EntityArc) {
- bulge = ((RS_Arc*)v)->getBulge();
+ bulge = ((Arc*)v)->getBulge();
}
dxf.writeVertex(dw,
DL_VertexData(ae->getStartpoint().x,
//if (dxf.getVersion()==VER_R12) {
if (nextEntity!=NULL) {
if (nextEntity->rtti()==RS2::EntityArc) {
- bulge = ((RS_Arc*)nextEntity)->getBulge();
+ bulge = ((Arc*)nextEntity)->getBulge();
}
else {
bulge = 0.0;
}
/*} else {
if (v->rtti()==RS2::EntityArc) {
- bulge = ((RS_Arc*)v)->getBulge();
+ bulge = ((Arc*)v)->getBulge();
}
}*/
/**
* Writes the given spline entity to the file.
*/
-void RS_FilterDXF::writeSpline(DL_WriterA & dw, RS_Spline * s, const DL_Attributes & attrib)
+void FilterDXF::writeSpline(DL_WriterA & dw, Spline * s, const DL_Attributes & attrib)
{
// split spline into atomic entities for DXF R12:
if (dxf.getVersion() == VER_R12)
if (s->getNumberOfControlPoints() < s->getDegree() + 1)
{
- RS_DEBUG->print(RS_Debug::D_ERROR, "RS_FilterDXF::writeSpline: "
+ DEBUG->print(Debug::D_ERROR, "FilterDXF::writeSpline: "
"Discarding spline: not enough control points given.");
return;
}
/**
* Writes the given circle entity to the file.
*/
-void RS_FilterDXF::writeCircle(DL_WriterA& dw, RS_Circle* c,
+void FilterDXF::writeCircle(DL_WriterA& dw, Circle* c,
const DL_Attributes& attrib) {
dxf.writeCircle(
dw,
-void RS_FilterDXF::writeArc(DL_WriterA& dw, RS_Arc* a,
+void FilterDXF::writeArc(DL_WriterA& dw, Arc* a,
const DL_Attributes& attrib) {
double a1, a2;
if (a->isReversed()) {
}
-void RS_FilterDXF::writeEllipse(DL_WriterA& dw, RS_Ellipse* s,
+void FilterDXF::writeEllipse(DL_WriterA& dw, Ellipse* s,
const DL_Attributes& attrib) {
if (s->isReversed()) {
dxf.writeEllipse(
}
}
-void RS_FilterDXF::writeInsert(DL_WriterA & dw, RS_Insert * i, const DL_Attributes & attrib)
+void FilterDXF::writeInsert(DL_WriterA & dw, Insert * i, const DL_Attributes & attrib)
{
dxf.writeInsert(dw, DL_InsertData(i->getName().toLatin1().data(),
i->getInsertionPoint().x, i->getInsertionPoint().y, 0.0,
attrib);
}
-void RS_FilterDXF::writeText(DL_WriterA & dw, RS_Text * t, const DL_Attributes & attrib)
+void FilterDXF::writeText(DL_WriterA & dw, Text * t, const DL_Attributes & attrib)
{
if (dxf.getVersion()==VER_R12)
{
-void RS_FilterDXF::writeDimension(DL_WriterA& dw, RS_Dimension* d,
+void FilterDXF::writeDimension(DL_WriterA& dw, Dimension* d,
const DL_Attributes& attrib) {
// split hatch into atomic entities:
d->getAngle());
if (d->rtti()==RS2::EntityDimAligned) {
- RS_DimAligned* da = (RS_DimAligned*)d;
+ DimAligned* da = (DimAligned*)d;
DL_DimAlignedData dimAlignedData(da->getExtensionPoint1().x,
da->getExtensionPoint1().y,
dxf.writeDimAligned(dw, dimData, dimAlignedData, attrib);
} else if (d->rtti()==RS2::EntityDimLinear) {
- RS_DimLinear* dl = (RS_DimLinear*)d;
+ DimLinear* dl = (DimLinear*)d;
DL_DimLinearData dimLinearData(dl->getExtensionPoint1().x,
dl->getExtensionPoint1().y,
dxf.writeDimLinear(dw, dimData, dimLinearData, attrib);
} else if (d->rtti()==RS2::EntityDimRadial) {
- RS_DimRadial* dr = (RS_DimRadial*)d;
+ DimRadial* dr = (DimRadial*)d;
DL_DimRadialData dimRadialData(dr->getDefinitionPoint().x,
dr->getDefinitionPoint().y,
dxf.writeDimRadial(dw, dimData, dimRadialData, attrib);
} else if (d->rtti()==RS2::EntityDimDiametric) {
- RS_DimDiametric* dr = (RS_DimDiametric*)d;
+ DimDiametric* dr = (DimDiametric*)d;
DL_DimDiametricData dimDiametricData(dr->getDefinitionPoint().x,
dr->getDefinitionPoint().y,
dxf.writeDimDiametric(dw, dimData, dimDiametricData, attrib);
} else if (d->rtti()==RS2::EntityDimAngular) {
- RS_DimAngular* da = (RS_DimAngular*)d;
+ DimAngular* da = (DimAngular*)d;
DL_DimAngularData dimAngularData(da->getDefinitionPoint1().x,
da->getDefinitionPoint1().y,
}
-void RS_FilterDXF::writeLeader(DL_WriterA& dw, RS_Leader* l,
+void FilterDXF::writeLeader(DL_WriterA& dw, Leader* l,
const DL_Attributes& attrib) {
if (l->count()>0) {
dxf.writeLeader(
l->count()),
attrib);
bool first = true;
- for (RS_Entity* v=l->firstEntity(RS2::ResolveNone);
+ for (Entity* v=l->firstEntity(RS2::ResolveNone);
v!=NULL;
v=l->nextEntity(RS2::ResolveNone)) {
// Write line verties:
if (v->rtti()==RS2::EntityLine) {
- RS_Line* l = (RS_Line*)v;
+ Line* l = (Line*)v;
if (first) {
dxf.writeLeaderVertex(
dw,
}
}
} else {
- RS_DEBUG->print(RS_Debug::D_WARNING,
+ DEBUG->print(Debug::D_WARNING,
"dropping leader with no vertices");
}
}
-void RS_FilterDXF::writeHatch(DL_WriterA& dw, RS_Hatch* h,
+void FilterDXF::writeHatch(DL_WriterA& dw, Hatch* h,
const DL_Attributes& attrib) {
// split hatch into atomic entities:
bool writeIt = true;
if (h->countLoops()>0) {
// check if all of the loops contain entities:
- for (RS_Entity* l=h->firstEntity(RS2::ResolveNone);
+ for (Entity* l=h->firstEntity(RS2::ResolveNone);
l!=NULL;
l=h->nextEntity(RS2::ResolveNone)) {
}
if (!writeIt) {
- RS_DEBUG->print(RS_Debug::D_WARNING,
- "RS_FilterDXF::writeHatch: Dropping Hatch");
+ DEBUG->print(Debug::D_WARNING,
+ "FilterDXF::writeHatch: Dropping Hatch");
} else {
DL_HatchData data(h->countLoops(),
h->isSolid(),
(const char*)h->getPattern().toLocal8Bit());
dxf.writeHatch1(dw, data, attrib);
- for (RS_Entity* l=h->firstEntity(RS2::ResolveNone);
+ for (Entity* l=h->firstEntity(RS2::ResolveNone);
l!=NULL;
l=h->nextEntity(RS2::ResolveNone)) {
// Write hatch loops:
if (l->isContainer() && !l->getFlag(RS2::FlagTemp)) {
- RS_EntityContainer* loop = (RS_EntityContainer*)l;
+ EntityContainer* loop = (EntityContainer*)l;
DL_HatchLoopData lData(loop->count());
dxf.writeHatchLoop1(dw, lData);
- for (RS_Entity* ed=loop->firstEntity(RS2::ResolveNone);
+ for (Entity* ed=loop->firstEntity(RS2::ResolveNone);
ed!=NULL;
ed=loop->nextEntity(RS2::ResolveNone)) {
// Write hatch loop edges:
if (ed->rtti()==RS2::EntityLine) {
- RS_Line* ln = (RS_Line*)ed;
+ Line* ln = (Line*)ed;
dxf.writeHatchEdge(
dw,
DL_HatchEdgeData(ln->getStartpoint().x,
ln->getEndpoint().x,
ln->getEndpoint().y));
} else if (ed->rtti()==RS2::EntityArc) {
- RS_Arc* ar = (RS_Arc*)ed;
+ Arc* ar = (Arc*)ed;
if (!ar->isReversed()) {
dxf.writeHatchEdge(
dw,
false));
}
} else if (ed->rtti()==RS2::EntityCircle) {
- RS_Circle* ci = (RS_Circle*)ed;
+ Circle* ci = (Circle*)ed;
dxf.writeHatchEdge(
dw,
DL_HatchEdgeData(ci->getCenter().x,
-void RS_FilterDXF::writeSolid(DL_WriterA& dw, RS_Solid* s,
+void FilterDXF::writeSolid(DL_WriterA& dw, Solid* s,
const DL_Attributes& attrib) {
// split solid into line entities:
}
-void RS_FilterDXF::writeImage(DL_WriterA& dw, RS_Image* i,
+void FilterDXF::writeImage(DL_WriterA& dw, Image* i,
const DL_Attributes& attrib) {
int handle = dxf.writeImage(
dw,
-void RS_FilterDXF::writeEntityContainer(DL_WriterA& dw, RS_EntityContainer* con,
+void FilterDXF::writeEntityContainer(DL_WriterA& dw, EntityContainer* con,
const DL_Attributes& /*attrib*/) {
QString blkName;
blkName = "__CE";
dw.dxfString(0, "ENDTAB");
//Block creation
- RS_BlockData blkdata(blkName, Vector(0,0), false);
+ BlockData blkdata(blkName, Vector(0,0), false);
- RS_Block* blk = new RS_Block(graphic, blkdata);
+ Block* blk = new Block(graphic, blkdata);
- for (RS_Entity* e1 = con->firstEntity(); e1 != NULL;
+ for (Entity* e1 = con->firstEntity(); e1 != NULL;
e1 = con->nextEntity() ) {
blk->addEntity(e1);
}
/**
* Writes the atomic entities of the given cotnainer to the file.
*/
-void RS_FilterDXF::writeAtomicEntities(DL_WriterA& dw, RS_EntityContainer* c,
+void FilterDXF::writeAtomicEntities(DL_WriterA& dw, EntityContainer* c,
const DL_Attributes& attrib,
RS2::ResolveLevel level) {
- for (RS_Entity* e=c->firstEntity(level);
+ for (Entity* e=c->firstEntity(level);
e!=NULL;
e=c->nextEntity(level)) {
/**
* Writes an IMAGEDEF object into an OBJECT section.
*/
-void RS_FilterDXF::writeImageDef(DL_WriterA& dw, RS_Image* i) {
+void FilterDXF::writeImageDef(DL_WriterA& dw, Image* i) {
if (i==NULL || i->getFlag(RS2::FlagUndone)) {
return;
}
* Sets the entities attributes according to the attributes
* that come from a DXF file.
*/
-void RS_FilterDXF::setEntityAttributes(RS_Entity* entity,
+void FilterDXF::setEntityAttributes(Entity* entity,
const DL_Attributes& attrib) {
- RS_DEBUG->print("RS_FilterDXF::setEntityAttributes");
+ DEBUG->print("FilterDXF::setEntityAttributes");
- RS_Pen pen;
+ Pen pen;
pen.setColor(Qt::black);
pen.setLineType(RS2::SolidLine);
pen.setWidth(numberToWidth(attrib.getWidth()));
entity->setPen(pen);
- RS_DEBUG->print("RS_FilterDXF::setEntityAttributes: OK");
+ DEBUG->print("FilterDXF::setEntityAttributes: OK");
}
/**
* Gets the entities attributes as a DL_Attributes object.
*/
-DL_Attributes RS_FilterDXF::getEntityAttributes(RS_Entity * entity)
+DL_Attributes FilterDXF::getEntityAttributes(Entity * entity)
{
// Layer:
- RS_Layer * layer = entity->getLayer();
+ Layer * layer = entity->getLayer();
QString layerName;
if (layer != NULL)
else
layerName = "NULL";
- RS_Pen pen = entity->getPen(false);
+ Pen pen = entity->getPen(false);
// Color:
int color = colorToNumber(pen.getColor());
/**
* @return Pen with the same attributes as 'attrib'.
*/
-RS_Pen RS_FilterDXF::attributesToPen(const DL_Attributes & attrib) const
+Pen FilterDXF::attributesToPen(const DL_Attributes & attrib) const
{
/*
printf("converting Color %d to %s\n",
attrib.getColor(), numberToColor(attrib.getColor()).name().toLatin1());
*/
- RS_Pen pen(numberToColor(attrib.getColor()),
+ Pen pen(numberToColor(attrib.getColor()),
numberToWidth(attrib.getWidth()),
nameToLineType(attrib.getLineType().c_str()));
return pen;
/**
- * Converts a color index (num) into a RS_Color object.
+ * Converts a color index (num) into a Color object.
* Please refer to the dxflib documentation for details.
*
* @param num Color number.
* @param comp Compatibility with older QCad versions (1.5.3 and older)
*/
-RS_Color RS_FilterDXF::numberToColor(int num, bool comp) {
+Color FilterDXF::numberToColor(int num, bool comp) {
// Compatibility with QCad 1.5.3 and older:
if (comp) {
switch(num) {
}
} else {
if (num==0) {
- return RS_Color(RS2::FlagByBlock);
+ return Color(RS2::FlagByBlock);
} else if (num==256) {
- return RS_Color(RS2::FlagByLayer);
+ return Color(RS2::FlagByLayer);
} else if (num<=255 && num>=0) {
- return RS_Color((int)(dxfColors[num][0]*255),
+ return Color((int)(dxfColors[num][0]*255),
(int)(dxfColors[num][1]*255),
(int)(dxfColors[num][2]*255));
} else {
- RS_DEBUG->print(RS_Debug::D_WARNING,
- "RS_FilterDXF::numberToColor: Invalid color number given.");
- return RS_Color(RS2::FlagByLayer);
+ DEBUG->print(Debug::D_WARNING,
+ "FilterDXF::numberToColor: Invalid color number given.");
+ return Color(RS2::FlagByLayer);
}
}
- return RS_Color();
+ return Color();
}
* Converts a color into a color number in the DXF palette.
* The color that fits best is chosen.
*/
-int RS_FilterDXF::colorToNumber(const RS_Color& col) {
+int FilterDXF::colorToNumber(const Color& col) {
//printf("Searching color for %s\n", col.name().toLatin1());
* Converts a line type name (e.g. "CONTINUOUS") into a RS2::LineType
* object.
*/
-RS2::LineType RS_FilterDXF::nameToLineType(const QString & name)
+RS2::LineType FilterDXF::nameToLineType(const QString & name)
{
QString uName = name.toUpper();
}
/**
- * Converts a RS_LineType into a name for a line type.
+ * Converts a LineType into a name for a line type.
*/
-QString RS_FilterDXF::lineTypeToName(RS2::LineType lineType)
+QString FilterDXF::lineTypeToName(RS2::LineType lineType)
{
// Standard linetypes for QCad II / AutoCAD
switch (lineType)
/**
- * Converts a RS_LineType into a name for a line type.
+ * Converts a LineType into a name for a line type.
*/
-/*QString RS_FilterDXF::lineTypeToDescription(RS2::LineType lineType) {
+/*QString FilterDXF::lineTypeToDescription(RS2::LineType lineType) {
// Standard linetypes for QCad II / AutoCAD
switch (lineType) {
/**
* Converts a line width number (e.g. 1) into a RS2::LineWidth.
*/
-RS2::LineWidth RS_FilterDXF::numberToWidth(int num) {
+RS2::LineWidth FilterDXF::numberToWidth(int num) {
switch (num) {
case -1:
return RS2::WidthByLayer;
/**
* Converts a RS2::LineWidth into an int width.
*/
-int RS_FilterDXF::widthToNumber(RS2::LineWidth width) {
+int FilterDXF::widthToNumber(RS2::LineWidth width) {
switch (width) {
case RS2::WidthByLayer:
return -1;
* - %%%d for a degree sign
* - %%%p for a plus/minus sign
*/
-QString RS_FilterDXF::toDxfString(const QString & string)
+QString FilterDXF::toDxfString(const QString & string)
{
/*
QString res = string;
/**
* Converts a DXF encoded string into a native Unicode string.
*/
-QString RS_FilterDXF::toNativeString(const QString & string)
+QString FilterDXF::toNativeString(const QString & string)
{
QString res = string;
// Line feed:
res = res.replace("}", "");
res = res.replace("#curly#", "}");
- RS_DEBUG->print("RS_FilterDXF::toNativeString:");
- RS_DEBUG->printUnicode(res);
+ DEBUG->print("FilterDXF::toNativeString:");
+ DEBUG->printUnicode(res);
return res;
}
*
* @ret Matching AngleFormat enum value.
*/
-RS2::AngleFormat RS_FilterDXF::numberToAngleFormat(int num) {
+RS2::AngleFormat FilterDXF::numberToAngleFormat(int num) {
RS2::AngleFormat af;
/**
* Converts AngleFormat enum to DXF number.
*/
-int RS_FilterDXF::angleFormatToNumber(RS2::AngleFormat af) {
+int FilterDXF::angleFormatToNumber(RS2::AngleFormat af) {
int num;
/**
* converts a DXF unit setting (e.g. INSUNITS) to a unit enum.
*/
-RS2::Unit RS_FilterDXF::numberToUnit(int num) {
+RS2::Unit FilterDXF::numberToUnit(int num) {
switch (num) {
default:
case 0:
/**
* Converst a unit enum into a DXF unit number e.g. for INSUNITS.
*/
-int RS_FilterDXF::unitToNumber(RS2::Unit unit) {
+int FilterDXF::unitToNumber(RS2::Unit unit) {
switch (unit) {
default:
case RS2::None:
/**
* Checks if the given variable is two-dimensional (e.g. $LIMMIN).
*/
-bool RS_FilterDXF::isVariableTwoDimensional(const QString& var) {
+bool FilterDXF::isVariableTwoDimensional(const QString& var) {
if (var=="$LIMMIN" ||
var=="$LIMMAX" ||
var=="$PLIMMIN" ||
*
* @author Andrew Mustun
*/
-class RS_FilterDXF: public RS_FilterInterface, DL_CreationInterface
+class FilterDXF: public FilterInterface, DL_CreationInterface
{
public:
- RS_FilterDXF();
- ~RS_FilterDXF();
+ FilterDXF();
+ ~FilterDXF();
/**
* @return RS2::FormatDXF.
virtual void addMText(const DL_MTextData & data);
virtual void addText(const DL_TextData & data);
//virtual void addDimension(const DL_DimensionData& data);
- RS_DimensionData convDimensionData(const DL_DimensionData & data);
+ DimensionData convDimensionData(const DL_DimensionData & data);
virtual void addDimAlign(const DL_DimensionData & data, const DL_DimAlignedData & edata);
virtual void addDimLinear(const DL_DimensionData & data, const DL_DimLinearData & edata);
virtual void addDimRadial(const DL_DimensionData & data, const DL_DimRadialData & edata);
virtual bool fileExport(Drawing & g, const QString & file, RS2::FormatType type);
void writeVariables(DL_WriterA & dw);
- void writeLayer(DL_WriterA & dw, RS_Layer * l);
+ void writeLayer(DL_WriterA & dw, Layer * l);
void writeLineType(DL_WriterA & dw, RS2::LineType t);
void writeAppid(DL_WriterA & dw, const char * appid);
- void writeBlock(DL_WriterA & dw, RS_Block * blk);
- void writeEntity(DL_WriterA & dw, RS_Entity * e);
- void writeEntity(DL_WriterA & dw, RS_Entity * e, const DL_Attributes & attrib);
- void writePoint(DL_WriterA & dw, RS_Point * p, const DL_Attributes & attrib);
- void writeLine(DL_WriterA & dw, RS_Line * l, const DL_Attributes & attrib);
- void writePolyline(DL_WriterA & dw, RS_Polyline * l, const DL_Attributes & attrib);
- void writeSpline(DL_WriterA & dw, RS_Spline * s, const DL_Attributes & attrib);
- void writeCircle(DL_WriterA & dw, RS_Circle * c, const DL_Attributes & attrib);
- void writeArc(DL_WriterA & dw, RS_Arc * a, const DL_Attributes & attrib);
- void writeEllipse(DL_WriterA & dw, RS_Ellipse * s, const DL_Attributes & attrib);
- void writeInsert(DL_WriterA & dw, RS_Insert * i, const DL_Attributes & attrib);
- void writeText(DL_WriterA & dw, RS_Text * t, const DL_Attributes & attrib);
- void writeDimension(DL_WriterA & dw, RS_Dimension * d, const DL_Attributes & attrib);
- void writeLeader(DL_WriterA & dw, RS_Leader * l, const DL_Attributes & attrib);
- void writeHatch(DL_WriterA & dw, RS_Hatch * h, const DL_Attributes & attrib);
- void writeSolid(DL_WriterA & dw, RS_Solid * s, const DL_Attributes & attrib);
- void writeImage(DL_WriterA & dw, RS_Image * i, const DL_Attributes & attrib);
- void writeEntityContainer(DL_WriterA & dw, RS_EntityContainer * con,
+ void writeBlock(DL_WriterA & dw, Block * blk);
+ void writeEntity(DL_WriterA & dw, Entity * e);
+ void writeEntity(DL_WriterA & dw, Entity * e, const DL_Attributes & attrib);
+ void writePoint(DL_WriterA & dw, Point * p, const DL_Attributes & attrib);
+ void writeLine(DL_WriterA & dw, Line * l, const DL_Attributes & attrib);
+ void writePolyline(DL_WriterA & dw, Polyline * l, const DL_Attributes & attrib);
+ void writeSpline(DL_WriterA & dw, Spline * s, const DL_Attributes & attrib);
+ void writeCircle(DL_WriterA & dw, Circle * c, const DL_Attributes & attrib);
+ void writeArc(DL_WriterA & dw, Arc * a, const DL_Attributes & attrib);
+ void writeEllipse(DL_WriterA & dw, Ellipse * s, const DL_Attributes & attrib);
+ void writeInsert(DL_WriterA & dw, Insert * i, const DL_Attributes & attrib);
+ void writeText(DL_WriterA & dw, Text * t, const DL_Attributes & attrib);
+ void writeDimension(DL_WriterA & dw, Dimension * d, const DL_Attributes & attrib);
+ void writeLeader(DL_WriterA & dw, Leader * l, const DL_Attributes & attrib);
+ void writeHatch(DL_WriterA & dw, Hatch * h, const DL_Attributes & attrib);
+ void writeSolid(DL_WriterA & dw, Solid * s, const DL_Attributes & attrib);
+ void writeImage(DL_WriterA & dw, Image * i, const DL_Attributes & attrib);
+ void writeEntityContainer(DL_WriterA & dw, EntityContainer * con,
const DL_Attributes & attrib);
- void writeAtomicEntities(DL_WriterA & dw, RS_EntityContainer * c,
+ void writeAtomicEntities(DL_WriterA & dw, EntityContainer * c,
const DL_Attributes & attrib, RS2::ResolveLevel level);
- void writeImageDef(DL_WriterA & dw, RS_Image * i);
+ void writeImageDef(DL_WriterA & dw, Image * i);
- void setEntityAttributes(RS_Entity * entity, const DL_Attributes& attrib);
- DL_Attributes getEntityAttributes(RS_Entity * entity);
+ void setEntityAttributes(Entity * entity, const DL_Attributes& attrib);
+ DL_Attributes getEntityAttributes(Entity * entity);
static QString toDxfString(const QString & string);
static QString toNativeString(const QString & string);
public:
- RS_Pen attributesToPen(const DL_Attributes & attrib) const;
+ Pen attributesToPen(const DL_Attributes & attrib) const;
- static RS_Color numberToColor(int num, bool comp = false);
- static int colorToNumber(const RS_Color & col);
+ static Color numberToColor(int num, bool comp = false);
+ static int colorToNumber(const Color & col);
static RS2::LineType nameToLineType(const QString& name);
static QString lineTypeToName(RS2::LineType lineType);
/** string for concatinating text parts of MTEXT entities. */
QString mtext;
/** Pointer to current polyline entity we're adding vertices to. */
- RS_Polyline * polyline;
+ Polyline * polyline;
/** Pointer to current spline entity we're adding control points to. */
- RS_Spline * spline;
+ Spline * spline;
/** Pointer to current leader entity we're adding vertices to. */
- RS_Leader * leader;
+ Leader * leader;
/** Pointer to current entity container (either block or graphic) */
- RS_EntityContainer * currentContainer;
+ EntityContainer * currentContainer;
/** Pointer to current hatch or NULL. */
- RS_Hatch * hatch;
+ Hatch * hatch;
/** Pointer to current hatch loop or NULL. */
- RS_EntityContainer * hatchLoop;
+ EntityContainer * hatchLoop;
DL_Dxf dxf;
- RS_VariableDict variables;
+ VariableDict variables;
};
#endif // __FILTERDXF_H__
/**
* Default constructor.
*/
-RS_FilterDXF1::RS_FilterDXF1(): RS_FilterInterface()
+FilterDXF1::FilterDXF1(): FilterInterface()
{
- RS_DEBUG->print("Setting up DXF 1 filter...");
+ DEBUG->print("Setting up DXF 1 filter...");
graphic = NULL;
addImportFormat(RS2::FormatDXF1);
}
* will be created or the graphics from which the entities are
* taken to be stored in a file.
*/
-bool RS_FilterDXF1::fileImport(Drawing& g, const QString& file, RS2::FormatType /*type*/)
+bool FilterDXF1::fileImport(Drawing& g, const QString& file, RS2::FormatType /*type*/)
{
- RS_DEBUG->print("DXF1 Filter: importing file '%s'...", file.toLatin1().data());
+ DEBUG->print("DXF1 Filter: importing file '%s'...", file.toLatin1().data());
this->graphic = &g;
/**
* Reads a dxf1 file from buffer.
*/
-bool RS_FilterDXF1::readFromBuffer()
+bool FilterDXF1::readFromBuffer()
{
- RS_DEBUG->print("\nDXF: Read from buffer");
+ DEBUG->print("\nDXF: Read from buffer");
bool ret; // returned value
QString dxfLine; // A line in the dxf file
QString lastLayer; // Last used layer name (test adding only
// if the new layer!=lastLayer)
//int currentLayerNum=0; // Current layer number
- RS_Layer * currentLayer = 0; // Pointer to current layer
+ Layer * currentLayer = 0; // Pointer to current layer
//QList<RGraphic> blockList; // List of blocks
//blockList.setAutoDelete( true );
//bool oldColorNumbers=false; // use old color numbers (qcad<1.5.3)
- RS_Pen pen;
+ Pen pen;
///if(!add) graphic->clearLayers();
//graphic->addLayer(DEF_DEFAULTLAYER);
- //RS_DEBUG->print( "\nDefault layer added" );
+ //DEBUG->print( "\nDefault layer added" );
// Loaded graphics without unit information: load as unit less:
//graphic->setUnit( None );
- RS_DEBUG->print("\nUnit set");
+ DEBUG->print("\nUnit set");
resetBufP();
if (fBuf)
{
- RS_DEBUG->print("\nBuffer OK");
- RS_DEBUG->print("\nBuffer: ");
- RS_DEBUG->print(fBuf);
+ DEBUG->print("\nBuffer OK");
+ DEBUG->print("\nBuffer: ");
+ DEBUG->print(fBuf);
do
{
dxfLine = getBufLine();
- pen = RS_Pen(RS_Color(RS2::FlagByLayer), RS2::WidthByLayer, RS2::LineByLayer);
+ pen = Pen(Color(RS2::FlagByLayer), RS2::WidthByLayer, RS2::LineByLayer);
- RS_DEBUG->print("\ndxfLine: ");
- RS_DEBUG->print(dxfLine.toAscii().data());
+ DEBUG->print("\ndxfLine: ");
+ DEBUG->print(dxfLine.toAscii().data());
// $-Setting in the header of DXF found
//
if (!dxfLine.isEmpty())
{
graphic->addVariable("$DIMADEC", dxfLine, 70);
- //graphic->setAngleDimensionExactness( RS_Math::pow(0.1, dxfLine.toInt()) );
+ //graphic->setAngleDimensionExactness( Math::pow(0.1, dxfLine.toInt()) );
}
}
}
if (dxfLine=="(null)" || dxfLine=="default") {
dxfLine = "0";
}
- graphic->addLayer(new RS_Layer(dxfLine));
+ graphic->addLayer(new Layer(dxfLine));
graphic->activateLayer(dxfLine);
currentLayer = graphic->getActiveLayer();
lastLayer=dxfLine;
case 6: // style
//if(currentLayer)
//currentLayer->setStyle( graphic->nameToStyle(dxfLine) );
- pen.setLineType(RS_FilterDXF::nameToLineType(dxfLine));
+ pen.setLineType(FilterDXF::nameToLineType(dxfLine));
break;
case 39: // Thickness
//if(currentLayer) currentLayer->setWidth(dxfLine.toInt());
- pen.setWidth(RS_FilterDXF::numberToWidth(dxfLine.toInt()));
+ pen.setWidth(FilterDXF::numberToWidth(dxfLine.toInt()));
break;
case 62: // Color
- pen.setColor(RS_FilterDXF::numberToColor(dxfLine.toInt()));
+ pen.setColor(FilterDXF::numberToColor(dxfLine.toInt()));
//if(currentLayer) {
// currentLayer->setColor( graphic->numberToColor(dxfLine.toInt(), !oldColorNumbers));
//}
if(!dxfLine.isEmpty()) {
switch(code) {
case 6: // style
- pen.setLineType(RS_FilterDXF::nameToLineType(dxfLine));
+ pen.setLineType(FilterDXF::nameToLineType(dxfLine));
break;
case 8: // Layer
//if(dxfLine!=lastLayer) {
vy1 = dxfLine.toDouble();
break;
case 39: // Thickness
- pen.setWidth(RS_FilterDXF::numberToWidth(dxfLine.toInt()));
+ pen.setWidth(FilterDXF::numberToWidth(dxfLine.toInt()));
break;
case 62: // Color
- pen.setColor(RS_FilterDXF::numberToColor(dxfLine.toInt()));
+ pen.setColor(FilterDXF::numberToColor(dxfLine.toInt()));
break;
default:
break;
while(!dxfCode.isEmpty() && code != 0);
graphic->setActivePen(pen);
- graphic->addEntity(new RS_Point(graphic,
- RS_PointData(Vector(vx1, vy1))));
+ graphic->addEntity(new Point(graphic,
+ PointData(Vector(vx1, vy1))));
}
// -----
if(!dxfLine.isEmpty()) {
switch(code) {
case 6: // style
- pen.setLineType(RS_FilterDXF::nameToLineType(dxfLine));
+ pen.setLineType(FilterDXF::nameToLineType(dxfLine));
break;
case 8: // Layer
//if(dxfLine!=lastLayer) {
vy2 = dxfLine.toDouble();
break;
case 39: // Thickness
- pen.setWidth(RS_FilterDXF::numberToWidth(dxfLine.toInt()));
+ pen.setWidth(FilterDXF::numberToWidth(dxfLine.toInt()));
break;
case 62: // Color
- pen.setColor(RS_FilterDXF::numberToColor(dxfLine.toInt()));
+ pen.setColor(FilterDXF::numberToColor(dxfLine.toInt()));
break;
default:
break;
//if(!mtCompFloat(vx1, vx2) || !mtCompFloat(vy1, vy2)) {
//graphic->addLine(vx1, vy1, vx2, vy2, currentLayerNum, add);
graphic->setActivePen(pen);
- graphic->addEntity(new RS_Line(graphic,
- RS_LineData(Vector(vx1, vy1), Vector(vx2, vy2))));
+ graphic->addEntity(new Line(graphic,
+ LineData(Vector(vx1, vy1), Vector(vx2, vy2))));
//}
}
if(!dxfLine.isEmpty()) {
switch(code) {
case 6: // style
- pen.setLineType(RS_FilterDXF::nameToLineType(dxfLine));
+ pen.setLineType(FilterDXF::nameToLineType(dxfLine));
break;
case 8: // Layer
//if(dxfLine!=lastLayer) {
break;
case 50: // Start Angle
dxfLine.replace( QRegExp(","), "." );
- va1 = RS_Math::correctAngle(dxfLine.toDouble()/ARAD);
+ va1 = Math::correctAngle(dxfLine.toDouble()/ARAD);
break;
case 51: // End Angle
dxfLine.replace( QRegExp(","), "." );
- va2 = RS_Math::correctAngle(dxfLine.toDouble()/ARAD);
+ va2 = Math::correctAngle(dxfLine.toDouble()/ARAD);
break;
case 39: // Thickness
- pen.setWidth(RS_FilterDXF::numberToWidth(dxfLine.toInt()));
+ pen.setWidth(FilterDXF::numberToWidth(dxfLine.toInt()));
break;
case 62: // Color
- pen.setColor(RS_FilterDXF::numberToColor(dxfLine.toInt()));
+ pen.setColor(FilterDXF::numberToColor(dxfLine.toInt()));
break;
default:
break;
// graphic->addArc(vcx, vcy, vcr, va1, va2, false, currentLayerNum, add);
//}
graphic->setActivePen(pen);
- graphic->addEntity(new RS_Arc(graphic,
- RS_ArcData(Vector(vcx, vcy),
+ graphic->addEntity(new Arc(graphic,
+ ArcData(Vector(vcx, vcy),
vcr, va1, va2, false)));
}
if(!dxfLine.isEmpty()) {
switch(code) {
case 6: // style
- pen.setLineType(RS_FilterDXF::nameToLineType(dxfLine));
+ pen.setLineType(FilterDXF::nameToLineType(dxfLine));
break;
case 8: // Layer
//if(dxfLine!=lastLayer) {
vcr = dxfLine.toDouble();
break;
case 39: // Thickness
- pen.setWidth(RS_FilterDXF::numberToWidth(dxfLine.toInt()));
+ pen.setWidth(FilterDXF::numberToWidth(dxfLine.toInt()));
break;
case 62: // Color
- pen.setColor(RS_FilterDXF::numberToColor(dxfLine.toInt()));
+ pen.setColor(FilterDXF::numberToColor(dxfLine.toInt()));
break;
default:
break;
graphic->addCircle(vcx, vcy, vcr, 0.0, 360.0, false, currentLayerNum, add);
}*/
graphic->setActivePen(pen);
- graphic->addEntity(new RS_Circle(graphic,
- RS_CircleData(Vector(vcx, vcy),
+ graphic->addEntity(new Circle(graphic,
+ CircleData(Vector(vcx, vcy),
vcr)));
}
break;
case 6: // style
- pen.setLineType(RS_FilterDXF::nameToLineType(dxfLine));
+ pen.setLineType(FilterDXF::nameToLineType(dxfLine));
break;
case 7:
}
break;
case 39: // Thickness
- pen.setWidth(RS_FilterDXF::numberToWidth(dxfLine.toInt()));
+ pen.setWidth(FilterDXF::numberToWidth(dxfLine.toInt()));
break;
case 62: // Color
- pen.setColor(RS_FilterDXF::numberToColor(dxfLine.toInt()));
+ pen.setColor(FilterDXF::numberToColor(dxfLine.toInt()));
break;
default:
break;
}
graphic->addEntity(
- new RS_Text(graphic,
- RS_TextData(
+ new Text(graphic,
+ TextData(
Vector(vx1, vy1),
vheight,
100.0,
strDecodeDxfString(dimText);
break;
case 6: // style
- pen.setLineType(RS_FilterDXF::nameToLineType(dxfLine));
+ pen.setLineType(FilterDXF::nameToLineType(dxfLine));
break;
case 8: // Layer
//if(dxfLine!=lastLayer) {
typ = dxfLine.toInt();
break;
case 39: // Thickness
- pen.setWidth(RS_FilterDXF::numberToWidth(dxfLine.toInt()));
+ pen.setWidth(FilterDXF::numberToWidth(dxfLine.toInt()));
break;
case 62: // Color
- pen.setColor(RS_FilterDXF::numberToColor(dxfLine.toInt()));
+ pen.setColor(FilterDXF::numberToColor(dxfLine.toInt()));
break;
default:
switch(typ) {
// Horiz. / vert.:
case 0: {
- RS_DimLinear* d =
- new RS_DimLinear(
+ DimLinear* d =
+ new DimLinear(
graphic,
- RS_DimensionData(
+ DimensionData(
Vector(v10, v20),
Vector(0.0, 0.0),
RS2::VAlignBottom,
"ISO-25",
0.0
),
- RS_DimLinearData(
+ DimLinearData(
Vector(v13, v23),
Vector(v14, v24),
v50/ARAD,
defP.setPolar(dist, angle);
defP+=Vector(v14, v24);
- RS_DimAligned* d =
- new RS_DimAligned(
+ DimAligned* d =
+ new DimAligned(
graphic,
- RS_DimensionData(
+ DimensionData(
defP,
Vector(0.0, 0.0),
RS2::VAlignBottom,
"ISO-25",
0.0
),
- RS_DimAlignedData(
+ DimAlignedData(
Vector(v13, v23),
Vector(v14, v24)
)
// Angle:
case 2: {
- RS_Line tl1(NULL,
- RS_LineData(Vector(v13, v23),
+ Line tl1(NULL,
+ LineData(Vector(v13, v23),
Vector(v14, v24)));
- RS_Line tl2(NULL,
- RS_LineData(Vector(v10, v20),
+ Line tl2(NULL,
+ LineData(Vector(v10, v20),
Vector(v15, v25)));
VectorSolutions s;
//bool inters=false;
//tmpEl1.getIntersection(&tmpEl2,
// &inters, &vcx, &vcy, 0,0,0,0, false);
- s = RS_Information::getIntersection(
+ s = Information::getIntersection(
&tl1, &tl2, false);
if (s.get(0).valid) {
*/
//Vector dp4;
//dp4.setPolar();
- RS_DimAngular* d =
- new RS_DimAngular(
+ DimAngular* d =
+ new DimAngular(
graphic,
- RS_DimensionData(
+ DimensionData(
Vector(v10, v20),
Vector(0.0, 0.0),
RS2::VAlignBottom,
"ISO-25",
0.0
),
- RS_DimAngularData(
+ DimAngularData(
Vector(v13, v23),
Vector(vcx, vcy),
Vector(vcx, vcy),
.angleTo(Vector(v15, v25));
Vector v2;
v2.setPolar(v40, ang);
- RS_DimRadial* d =
- new RS_DimRadial(
+ DimRadial* d =
+ new DimRadial(
graphic,
- RS_DimensionData(
+ DimensionData(
Vector(v10, v20),
Vector(0.0, 0.0),
RS2::VAlignBottom,
"ISO-25",
0.0
),
- RS_DimRadialData(
+ DimRadialData(
Vector(v10, v20) + v2,
0.0
)
.angleTo(Vector(v15, v25));
Vector v2;
v2.setPolar(v40, ang);
- RS_DimDiametric* d =
- new RS_DimDiametric(
+ DimDiametric* d =
+ new DimDiametric(
graphic,
- RS_DimensionData(
+ DimensionData(
Vector(v10, v20),
Vector(0.0, 0.0),
RS2::VAlignBottom,
"ISO-25",
0.0
),
- RS_DimDiametricData(
+ DimDiametricData(
Vector(v10, v20) + v2,
0.0
)
d->update();
graphic->addEntity(d);
*/
- RS_LeaderData data(true);
- RS_Leader* d =
- new RS_Leader(graphic, data);
+ LeaderData data(true);
+ Leader* d =
+ new Leader(graphic, data);
d->addVertex(Vector(v14, v24));
d->addVertex(Vector(v10, v20));
d->update();
patternName = dxfLine;
break;
case 6: // style
- pen.setLineType(RS_FilterDXF::nameToLineType(dxfLine));
+ pen.setLineType(FilterDXF::nameToLineType(dxfLine));
break;
case 8: // Layer
// if(dxfLine!=lastLayer) {
break;
case 39: // Thickness
- pen.setWidth(RS_FilterDXF::numberToWidth(dxfLine.toInt()));
+ pen.setWidth(FilterDXF::numberToWidth(dxfLine.toInt()));
break;
case 62: // Color
- pen.setColor(RS_FilterDXF::numberToColor(dxfLine.toInt()));
+ pen.setColor(FilterDXF::numberToColor(dxfLine.toInt()));
break;
case 91: // Number of boundary paths (loops)
//numPaths=dxfLine.toInt();
* Resets the whole object
* (base class too)
*/
-void RS_FilterDXF1::reset()
+void FilterDXF1::reset()
{
file.reset();
/**
* Reset buffer pointer to the beginning of the buffer:
*/
-void RS_FilterDXF1::resetBufP()
+void FilterDXF1::resetBufP()
{
fBufP = 0;
}
/**
* Set buffer pointer to the given index:
*/
-void RS_FilterDXF1::setBufP(int _fBufP)
+void FilterDXF1::setBufP(int _fBufP)
{
if (_fBufP < (int)fSize)
fBufP = _fBufP;
/**
* delete buffer:
*/
-void RS_FilterDXF1::delBuffer()
+void FilterDXF1::delBuffer()
{
if (fBuf)
{
/**
* Remove any 13-characters in the buffer:
*/
-void RS_FilterDXF1::dos2unix()
+void FilterDXF1::dos2unix()
{
char * src = fBuf, * dst = fBuf;
// return: -Null-string: end of buffer
// -String which is the next line in buffer
//
-QString RS_FilterDXF1::getBufLine()
+QString FilterDXF1::getBufLine()
{
char * ret;
QString str;
// return: -Null-string: end of buffer
// -String which is the next line in buffer
//
-char * RS_FilterDXF1::getBufLineCh()
+char * FilterDXF1::getBufLineCh()
{
char * ret;
// Copy buffer from a given string:
//
-void RS_FilterDXF1::copyBufFrom(const char * _buf)
+void FilterDXF1::copyBufFrom(const char * _buf)
{
if (_buf)
{
// return: true: line found
// false: end of buffer
//
-bool RS_FilterDXF1::gotoBufLine(char * _lstr)
+bool FilterDXF1::gotoBufLine(char * _lstr)
{
QString l;
// false: end of buffer
//
//
-bool RS_FilterDXF1::gotoBufLineString(char * _lstr)
+bool FilterDXF1::gotoBufLineString(char * _lstr)
{
QString l;
// Replace bynary Bytes (<32) by an other (given) byte:
//
-void RS_FilterDXF1::replaceBinaryBytesBy(char _c)
+void FilterDXF1::replaceBinaryBytesBy(char _c)
{
int bc;
// Separate buffer (change chars sc1 and sc2 in '\0'
//
-void RS_FilterDXF1::separateBuf(char _c1,
+void FilterDXF1::separateBuf(char _c1,
char _c2,
char _c3,
char _c4)
// remove comment between '_fc' and '_lc'
// comments get replaced by '\0'
//
-void RS_FilterDXF1::removeComment(char _fc, char _lc)
+void FilterDXF1::removeComment(char _fc, char _lc)
{
bool rem = false; // Are we removing currrently?
int bc; // counter
// return: true: successful
// false: file not found
//
-bool RS_FilterDXF1::readFileInBuffer(char * _name, int _bNum)
+bool FilterDXF1::readFileInBuffer(char * _name, int _bNum)
{
// file.setName(_name);
file.setFileName(_name);
// return: true: successful
// false: file not found
//
-bool RS_FilterDXF1::readFileInBuffer(int _bNum)
+bool FilterDXF1::readFileInBuffer(int _bNum)
{
fPointer = fopen(name.toAscii().data(), "rb");
// Decode a DXF string to the C-convention (special character \P is a \n)
//
-void RS_FilterDXF1::strDecodeDxfString(QString & str)
+void FilterDXF1::strDecodeDxfString(QString & str)
{
if (str.isEmpty())
return;
// return: true: values are equal
// false: values are not equal
//
-bool RS_FilterDXF1::mtCompFloat(double _v1, double _v2, double _tol)
+bool FilterDXF1::mtCompFloat(double _v1, double _v2, double _tol)
{
double delta = _v2 - _v1;
*
* @author Andrew Mustun
*/
-class RS_FilterDXF1 : public RS_FilterInterface
+class FilterDXF1 : public FilterInterface
{
public:
- RS_FilterDXF1();
- ~RS_FilterDXF1() {}
+ FilterDXF1();
+ ~FilterDXF1() {}
/**
* @return RS2::FormatDXF1.
virtual bool fileExport(Drawing& /*g*/, const QString& /*file*/,
RS2::FormatType /*type*/) {
- RS_DEBUG->print(RS_Debug::D_WARNING,
+ DEBUG->print(Debug::D_WARNING,
"Exporting of QCad 1.x file not implemented");
return false;
}
/**
* Constructor.
*/
-RS_FilterInterface::RS_FilterInterface()
+FilterInterface::FilterInterface()
{
- //std::cout << "RS_FilterInterface\n";
+ //std::cout << "FilterInterface\n";
//graphic = NULL;
}
/**
* Destructor.
*/
-/*virtual*/ RS_FilterInterface::~RS_FilterInterface()
+/*virtual*/ FilterInterface::~FilterInterface()
{
}
* @retval true if the filter can import the file type
* @retval false otherwise.
*/
-/*virtual*/ bool RS_FilterInterface::canImport(RS2::FormatType t)
+/*virtual*/ bool FilterInterface::canImport(RS2::FormatType t)
{
// return !(importFormats.find(t) == importFormats.end());
return (importFormats.indexOf(t) != -1);
* @return true if the filter can export the file type,
* false otherwise.
*/
-/*virtual*/ bool RS_FilterInterface::canExport(RS2::FormatType t)
+/*virtual*/ bool FilterInterface::canExport(RS2::FormatType t)
{
// return !(exportFormats.find(t) == exportFormats.end());
return (exportFormats.indexOf(t) != -1);
/**
* Adds a file extension which can be imported by this filter.
*/
-void RS_FilterInterface::addImportFormat(RS2::FormatType type)
+void FilterInterface::addImportFormat(RS2::FormatType type)
{
- RS_DEBUG->print("Filter can import %d", (int)type);
+ DEBUG->print("Filter can import %d", (int)type);
importFormats += type;
}
/**
* Adds a file extension which can be exported by this filter.
*/
-void RS_FilterInterface::addExportFormat(RS2::FormatType type)
+void FilterInterface::addExportFormat(RS2::FormatType type)
{
- RS_DEBUG->print("Filter can export %d", (int)type);
+ DEBUG->print("Filter can export %d", (int)type);
exportFormats += type;
}
/**
* This is the interface that must be implemented for all
- * format filter classes. The RS_FileIO class
+ * format filter classes. The FileIO class
* uses the methods defined in here to interact with the format
* filter classes.
*
* @author Andrew Mustun
*/
-class RS_FilterInterface
+class FilterInterface
{
public:
/**
* Constructor.
*/
- RS_FilterInterface();
- virtual ~RS_FilterInterface();
+ FilterInterface();
+ virtual ~FilterInterface();
virtual bool canImport(RS2::FormatType t);
virtual bool canExport(RS2::FormatType t);
#include "flags.h"
/** Default constructor. Resets all flags to 0. */
-RS_Flags::RS_Flags()
+Flags::Flags()
{
flags = 0;
}
/** Constructor with initialisation to the given flags. */
-RS_Flags::RS_Flags(unsigned int f)
+Flags::Flags(unsigned int f)
{
flags = f;
}
-/*virtual*/ RS_Flags::~RS_Flags()
+/*virtual*/ Flags::~Flags()
{
}
-unsigned int RS_Flags::getFlags() const
+unsigned int Flags::getFlags() const
{
return flags;
}
-void RS_Flags::resetFlags()
+void Flags::resetFlags()
{
flags = 0;
}
-void RS_Flags::setFlags(unsigned int f)
+void Flags::setFlags(unsigned int f)
{
flags = f;
}
-void RS_Flags::setFlag(unsigned int f)
+void Flags::setFlag(unsigned int f)
{
flags = flags | f;
}
-void RS_Flags::delFlag(unsigned int f)
+void Flags::delFlag(unsigned int f)
{
flags = flags & (~f);
}
-void RS_Flags::toggleFlag(unsigned int f)
+void Flags::toggleFlag(unsigned int f)
{
flags = flags ^ f;
}
-bool RS_Flags::getFlag(unsigned int f) const
+bool Flags::getFlag(unsigned int f) const
{
return (flags & f ? true : false);
}
*
* @author Andrew Mustun
*/
-class RS_Flags
+class Flags
{
public:
- RS_Flags();
- RS_Flags(unsigned int f);
- virtual ~RS_Flags();
+ Flags();
+ Flags(unsigned int f);
+ virtual ~Flags();
unsigned int getFlags() const;
void resetFlags();
* @param owner true if the font owns the letters (blocks). Otherwise
* the letters will be deleted when the font is deleted.
*/
-RS_Font::RS_Font(const QString & fn, bool owner): letterList(owner), fileName(fn),
+Font::Font(const QString & fn, bool owner): letterList(owner), fileName(fn),
encoding(""), loaded(false), letterSpacing(3.0), wordSpacing(6.75),
lineSpacingFactor(1.0)
{
}
/** @return the fileName of this font. */
-QString RS_Font::getFileName() const
+QString Font::getFileName() const
{
return fileName;
}
/** @return the encoding of this font. */
-QString RS_Font::getEncoding() const
+QString Font::getEncoding() const
{
return encoding;
}
/** @return the alternative names of this font. */
-const QStringList & RS_Font::getNames() const
+const QStringList & Font::getNames() const
{
return names;
}
/** @return the author(s) of this font. */
-const QStringList & RS_Font::getAuthors() const
+const QStringList & Font::getAuthors() const
{
return authors;
}
/** @return Default letter spacing for this font */
-double RS_Font::getLetterSpacing()
+double Font::getLetterSpacing()
{
return letterSpacing;
}
/** @return Default word spacing for this font */
-double RS_Font::getWordSpacing()
+double Font::getWordSpacing()
{
return wordSpacing;
}
/** @return Default line spacing factor for this font */
-double RS_Font::getLineSpacingFactor()
+double Font::getLineSpacingFactor()
{
return lineSpacingFactor;
}
* @retval true font was already loaded or is loaded now.
* @retval false font could not be loaded.
*/
-bool RS_Font::loadFont()
+bool Font::loadFont()
{
- RS_DEBUG->print("RS_Font::loadFont");
+ DEBUG->print("Font::loadFont");
if (loaded)
return true;
// Search for the appropriate font if we have only the name of the font:
if (!fileName.toLower().contains(".cxf"))
{
- QStringList fonts = RS_SYSTEM->getFontList();
+ QStringList fonts = SYSTEM->getFontList();
QFileInfo file;
for(QStringList::Iterator it=fonts.begin(); it!=fonts.end(); it++)
// No font paths found:
if (path.isEmpty())
{
- RS_DEBUG->print(RS_Debug::D_WARNING, "RS_Font::loadFont: No fonts available.");
+ DEBUG->print(Debug::D_WARNING, "Font::loadFont: No fonts available.");
return false;
}
if (!file.open(QIODevice::ReadOnly | QIODevice::Text))
{
- RS_DEBUG->print(RS_Debug::D_WARNING, "RS_Font::loadFont: Cannot open font file: %s",
+ DEBUG->print(Debug::D_WARNING, "Font::loadFont: Cannot open font file: %s",
path.toAscii().data());
return false;
}
- RS_DEBUG->print("RS_Font::loadFont: Successfully opened font file: %s", path.toAscii().data());
+ DEBUG->print("Font::loadFont: Successfully opened font file: %s", path.toAscii().data());
QTextStream ts(&file);
file.close();
loaded = true;
- RS_DEBUG->print("RS_Font::loadFont OK");
+ DEBUG->print("Font::loadFont OK");
return true;
}
-void RS_Font::ParseIdentifier(QTextStream & ts, QString line)
+void Font::ParseIdentifier(QTextStream & ts, QString line)
{
QStringList list = line.mid(1).split(":");
QString identifier = "", value = "";
}
}
-void RS_Font::ParseCharacter(QTextStream & ts, QString line)
+void Font::ParseCharacter(QTextStream & ts, QString line)
{
// Unicode character:
QChar ch;
}
// Create new letter:
- RS_FontChar * letter = new RS_FontChar(NULL, ch, Vector(0.0, 0.0));
+ FontChar * letter = new FontChar(NULL, ch, Vector(0.0, 0.0));
// Read entities of this letter:
line = ts.readLine();
double x2 = (*it2++).toDouble();
double y2 = (*it2).toDouble();
- RS_LineData ld(Vector(x1, y1), Vector(x2, y2));
- RS_Line * line = new RS_Line(letter, ld);
- line->setPen(RS_Pen(RS2::FlagInvalid));
+ LineData ld(Vector(x1, y1), Vector(x2, y2));
+ Line * line = new Line(letter, ld);
+ line->setPen(Pen(RS2::FlagInvalid));
line->setLayer(NULL);
letter->addEntity(line);
}
double a2 = (*it2).toDouble() / ARAD;
bool reversed = (line.at(1) == 'R');
- RS_ArcData ad(Vector(cx, cy), r, a1, a2, reversed);
- RS_Arc * arc = new RS_Arc(letter, ad);
- arc->setPen(RS_Pen(RS2::FlagInvalid));
+ ArcData ad(Vector(cx, cy), r, a1, a2, reversed);
+ Arc * arc = new Arc(letter, ad);
+ arc->setPen(Pen(RS2::FlagInvalid));
arc->setLayer(NULL);
letter->addEntity(arc);
}
}
// Wrappers for block list (letters) functions
-RS_BlockList * RS_Font::getLetterList()
+BlockList * Font::getLetterList()
{
return &letterList;
}
-RS_Block * RS_Font::findLetter(const QString & name)
+Block * Font::findLetter(const QString & name)
{
return letterList.find(name);
}
-uint RS_Font::countLetters()
+uint Font::countLetters()
{
return letterList.count();
}
-RS_Block * RS_Font::letterAt(uint i)
+Block * Font::letterAt(uint i)
{
return letterList.at(i);
}
/**
* Dumps the fonts data to stdout.
*/
-std::ostream & operator<<(std::ostream & os, const RS_Font & f)
+std::ostream & operator<<(std::ostream & os, const Font & f)
{
os << " Font file name: " << f.getFileName().toLatin1().data() << "\n";
- //<< (RS_BlockList&)f << "\n";
+ //<< (BlockList&)f << "\n";
return os;
}
*
* @author Andrew Mustun
*/
-class RS_Font
+class Font
{
- friend class RS_FontList;
+ friend class FontList;
public:
- RS_Font(const QString & name, bool owner = true);
+ Font(const QString & name, bool owner = true);
QString getFileName() const;
QString getEncoding() const;
bool loadFont();
// Wrappers for block list (letters) functions
- RS_BlockList * getLetterList();
- RS_Block * findLetter(const QString & name);
+ BlockList * getLetterList();
+ Block * findLetter(const QString & name);
uint countLetters();
- RS_Block * letterAt(uint i);
+ Block * letterAt(uint i);
- friend std::ostream & operator<<(std::ostream & os, const RS_Font & l);
+ friend std::ostream & operator<<(std::ostream & os, const Font & l);
#if 1
private:
private:
//! block list (letters)
- RS_BlockList letterList;
+ BlockList letterList;
//! Font file name
QString fileName;
//! Font encoding (see docu for QTextCodec)
*
* @author Andrew Mustun
*/
-class RS_FontChar: public RS_Block
+class FontChar: public Block
{
public:
/**
* an identifier.
* @param basePoint Base point (offset) of the letter (usually 0/0).
*/
- RS_FontChar(RS_EntityContainer * parent, const QString & name, Vector basePoint):
- RS_Block(parent, RS_BlockData(name, basePoint, false)) {}
+ FontChar(EntityContainer * parent, const QString & name, Vector basePoint):
+ Block(parent, BlockData(name, basePoint, false)) {}
- virtual ~RS_FontChar() {}
+ virtual ~FontChar() {}
/** @return RS2::EntityFontChar */
virtual RS2::EntityType rtti() const
return RS2::EntityFontChar;
}
- /*friend std::ostream& operator << (std::ostream& os, const RS_FontChar& b) {
+ /*friend std::ostream& operator << (std::ostream& os, const FontChar& b) {
os << " name: " << b.getName().latin1() << "\n";
- os << " entities: " << (RS_EntityContainer&)b << "\n";
+ os << " entities: " << (EntityContainer&)b << "\n";
return os;
}*/
protected:
//[DONE] #warning "!!! NEED TO FIX ITERATORS IN THIS CLASS !!!"
-RS_FontList * RS_FontList::uniqueInstance = NULL;
+FontList * FontList::uniqueInstance = NULL;
/**
* Default constructor.
*/
-RS_FontList::RS_FontList(): fontIterator(fonts)
+FontList::FontList(): fontIterator(fonts)
{
//Dealt with here...
//#warning "!!! Need to deal with setAutoDelete() Qt3->Qt4 !!!"
//fontListListeners.setAutoDelete(false);
}
-/*static*/ RS_FontList * RS_FontList::instance()
+/*static*/ FontList * FontList::instance()
{
if (uniqueInstance == NULL)
- uniqueInstance = new RS_FontList();
+ uniqueInstance = new FontList();
return uniqueInstance;
}
-RS_FontList::~RS_FontList()
+FontList::~FontList()
{
clearFonts();
}
/**
- * Initializes the font list by creating empty RS_Font
+ * Initializes the font list by creating empty Font
* objects, one for each font that could be found.
*/
-void RS_FontList::init()
+void FontList::init()
{
- RS_DEBUG->print("RS_FontList::initFonts");
+ DEBUG->print("FontList::initFonts");
- QStringList list = RS_SYSTEM->getFontList();
+ QStringList list = SYSTEM->getFontList();
// Q3Dict<char> added; //used to remeber added fonts (avoid duplication)
QMultiHash<QString, char *> added; //used to remeber added fonts (avoid duplication)
for(QStringList::Iterator it=list.begin(); it!=list.end(); ++it)
{
- RS_DEBUG->print("font: %s:", (*it).toLatin1().data());
-//printf("RS_FontList::init(): font: %s:\n", (*it).toLatin1().data());
+ DEBUG->print("font: %s:", (*it).toLatin1().data());
+//printf("FontList::init(): font: %s:\n", (*it).toLatin1().data());
QFileInfo fi(*it);
// if (!added[fi.baseName()])
if (added.value(fi.baseName()) == 0)
{
- RS_Font * font = new RS_Font(fi.baseName());
+ Font * font = new Font(fi.baseName());
fonts.append(font);
added.insert(fi.baseName(), (char *)1);
}
- RS_DEBUG->print("base: %s", fi.baseName().toLatin1().data());
+ DEBUG->print("base: %s", fi.baseName().toLatin1().data());
}
}
/**
* Removes all fonts in the fontlist.
*/
-void RS_FontList::clearFonts()
+void FontList::clearFonts()
{
// fonts.clear();
while (!fonts.isEmpty())
delete fonts.takeFirst();
}
-int RS_FontList::countFonts()
+int FontList::countFonts()
{
return fonts.count();
}
* Listeners are notified after the font was removed from
* the list but before it gets deleted.
*/
-void RS_FontList::removeFont(RS_Font * font)
+void FontList::removeFont(Font * font)
{
- RS_DEBUG->print("RS_FontList::removeFont()");
+ DEBUG->print("FontList::removeFont()");
// here the font is removed from the list but not deleted
// fonts.remove(font);
delete fonts.takeAt(i);
//for (uint i=0; i<fontListListeners.count(); ++i) {
- // RS_FontListListener* l = fontListListeners.at(i);
+ // FontListListener* l = fontListListeners.at(i);
// l->fontRemoved(font);
//}
}
* \p NULL if no such font was found. The font will be loaded into
* memory if it's not already.
*/
-RS_Font * RS_FontList::requestFont(const QString & name)
+Font * FontList::requestFont(const QString & name)
{
- RS_DEBUG->print("RS_FontList::requestFont %s", name.toLatin1().data());
+ DEBUG->print("FontList::requestFont %s", name.toLatin1().data());
QString name2 = name.toLower();
- RS_Font * foundFont = NULL;
+ Font * foundFont = NULL;
// QCad 1 compatibility:
if (name2.contains('#') && name2.contains('_'))
// name2 = name2.left(name2.find('#'));
name2 = name2.left(name2.indexOf('#'));
- RS_DEBUG->print("name2: %s", name2.toLatin1().data());
+ DEBUG->print("name2: %s", name2.toLatin1().data());
// Search our list of available fonts:
-// for(RS_Font * f=fonts.first(); f!=NULL; f=fonts.next())
+// for(Font * f=fonts.first(); f!=NULL; f=fonts.next())
for(int i=0; i<fonts.size(); i++)
{
- RS_Font * f = fonts[i];
+ Font * f = fonts[i];
if (f->getFileName() == name2)
{
}
//! @return First font of the list.
-RS_Font * RS_FontList::firstFont()
+Font * FontList::firstFont()
{
// return fonts.first();
// fontIterator.toFront();
* @return Next font from the list after
* calling firstFont() or nextFont().
*/
-RS_Font * RS_FontList::nextFont()
+Font * FontList::nextFont()
{
// return fonts.next();
// return fontIterator.next();
/**
* Dumps the fonts to stdout.
*/
-std::ostream & operator<<(std::ostream & os, RS_FontList & l)
+std::ostream & operator<<(std::ostream & os, FontList & l)
{
os << "Fontlist: \n";
- for(RS_Font * f=l.firstFont(); f!=NULL; f=l.nextFont())
+ for(Font * f=l.firstFont(); f!=NULL; f=l.nextFont())
os << *f << "\n";
return os;
#include <QtCore>
-#define RS_FONTLIST RS_FontList::instance()
+#define FONTLIST FontList::instance()
-class RS_Font;
+class Font;
/**
* The global list of fonts. This is implemented as a singleton.
- * Use RS_FontList::instance() to get a pointer to the object.
+ * Use FontList::instance() to get a pointer to the object.
*
* @author James Hammons
* @author Andrew Mustun
*/
-class RS_FontList
+class FontList
{
protected:
- RS_FontList();
+ FontList();
public:
/**
* @return Instance to the unique font list.
*/
- static RS_FontList * instance();
+ static FontList * instance();
- virtual ~RS_FontList();
+ virtual ~FontList();
void init();
void clearFonts();
int countFonts();
- virtual void removeFont(RS_Font * font);
- RS_Font * requestFont(const QString & name);
- RS_Font * firstFont();
- RS_Font * nextFont();
+ virtual void removeFont(Font * font);
+ Font * requestFont(const QString & name);
+ Font * firstFont();
+ Font * nextFont();
- friend std::ostream & operator<<(std::ostream & os, RS_FontList & l);
+ friend std::ostream & operator<<(std::ostream & os, FontList & l);
protected:
- static RS_FontList * uniqueInstance;
+ static FontList * uniqueInstance;
private:
//! fonts in the graphic
- QList<RS_Font *> fonts;
- QListIterator<RS_Font *> fontIterator;
+ QList<Font *> fonts;
+ QListIterator<Font *> fontIterator;
};
#endif // __FONTLIST_H__
#include "drawing.h"
#include "graphicview.h"
-//#include "graphicview.h"
#include "settings.h"
#include "units.h"
#include "vector.h"
#warning "!!! Clean out all references to RS_GraphicView here and in header !!!"
-#if 0
/**
* Constructor.
*/
-RS_Grid::RS_Grid(RS_GraphicView * gv): graphicView(gv), pt(NULL), number(0),
- metaX(NULL), numMetaX(0), metaY(NULL), numMetaY(0)
-{
-}
-#endif
-
-/**
- * Constructor II.
- */
-RS_Grid::RS_Grid(GraphicView * gv): graphicView(gv), pt(NULL), number(0),
+Grid::Grid(GraphicView * gv): graphicView(gv), pt(NULL), number(0),
metaX(NULL), numMetaX(0), metaY(NULL), numMetaY(0)
{
}
/**
* Destructor.
*/
-RS_Grid::~RS_Grid()
+Grid::~Grid()
{
if (pt != NULL)
delete[] pt;
/**
* Updates the grid point array.
*/
-void RS_Grid::update()
+void Grid::update()
{
- RS_DEBUG->print("RS_Grid::update");
+ DEBUG->print("Grid::update");
if (!graphicView->isGridOn())
return;
numMetaX = 0;
numMetaY = 0;
- RS_DEBUG->print("RS_Grid::update: 001");
+ DEBUG->print("Grid::update: 001");
// find out unit:
RS2::Unit unit = RS2::None;
Vector gridWidth;
Vector metaGridWidth;
- RS_DEBUG->print("RS_Grid::update: 002");
+ DEBUG->print("Grid::update: 002");
// init grid spacing:
// metric grid:
- if (RS_Units::isMetric(unit) || unit == RS2::None
+ if (Units::isMetric(unit) || unit == RS2::None
|| format == RS2::Decimal || format == RS2::Engineering)
{
if (userGrid.x > 0.0)
else
gridWidth.y = 0.000001;
- RS_DEBUG->print("RS_Grid::update: 003");
+ DEBUG->print("Grid::update: 003");
// auto scale grid
if (scaleGrid)
metaGridWidth.x = gridWidth.x * 10;
metaGridWidth.y = gridWidth.y * 10;
- RS_DEBUG->print("RS_Grid::update: 004");
+ DEBUG->print("Grid::update: 004");
}
// imperial grid:
else
{
- RS_DEBUG->print("RS_Grid::update: 005");
+ DEBUG->print("Grid::update: 005");
if (userGrid.x > 0.0)
gridWidth.x = userGrid.x;
else
gridWidth.y = 1.0 / 1024.0;
- RS_DEBUG->print("RS_Grid::update: 006");
+ DEBUG->print("Grid::update: 006");
if (unit == RS2::Inch)
{
- RS_DEBUG->print("RS_Grid::update: 007");
+ DEBUG->print("Grid::update: 007");
// auto scale grid
if (scaleGrid)
{
while (graphicView->toGuiDX(gridWidth.x) < minGridSpacing)
{
- if (RS_Math::round(gridWidth.x) >= 36)
+ if (Math::round(gridWidth.x) >= 36)
{
gridWidth.x *= 2;
}
- else if (RS_Math::round(gridWidth.x) >= 12)
+ else if (Math::round(gridWidth.x) >= 12)
{
gridWidth.x *= 3;
}
- else if (RS_Math::round(gridWidth.x) >= 4)
+ else if (Math::round(gridWidth.x) >= 4)
{
gridWidth.x *= 3;
}
- else if (RS_Math::round(gridWidth.x) >= 1)
+ else if (Math::round(gridWidth.x) >= 1)
{
gridWidth.x *= 2;
}
while (graphicView->toGuiDY(gridWidth.y) < minGridSpacing)
{
- if (RS_Math::round(gridWidth.y) >= 36)
+ if (Math::round(gridWidth.y) >= 36)
{
gridWidth.y *= 2;
}
- else if (RS_Math::round(gridWidth.y) >= 12)
+ else if (Math::round(gridWidth.y) >= 12)
{
gridWidth.y *= 3;
}
- else if (RS_Math::round(gridWidth.y) >= 4)
+ else if (Math::round(gridWidth.y) >= 4)
{
gridWidth.y *= 3;
}
- else if (RS_Math::round(gridWidth.y) >= 1)
+ else if (Math::round(gridWidth.y) >= 1)
{
gridWidth.y *= 2;
}
}
}
- RS_DEBUG->print("RS_Grid::update: 008");
+ DEBUG->print("Grid::update: 008");
// metagrid X shows inches..
metaGridWidth.x = 1.0;
}
}
- RS_DEBUG->print("RS_Grid::update: 009");
+ DEBUG->print("Grid::update: 009");
// metagrid Y shows inches..
metaGridWidth.y = 1.0;
}
}
- RS_DEBUG->print("RS_Grid::update: 010");
+ DEBUG->print("Grid::update: 010");
}
else
{
- RS_DEBUG->print("RS_Grid::update: 011");
+ DEBUG->print("Grid::update: 011");
if (scaleGrid)
{
metaGridWidth.y = -1.0;
}
- RS_DEBUG->print("RS_Grid::update: 012");
+ DEBUG->print("Grid::update: 012");
}
//gridWidth.y = gridWidth.x;
//metaGridWidth.y = metaGridWidth.x;
}
- RS_DEBUG->print("RS_Grid::update: 013");
+ DEBUG->print("Grid::update: 013");
// for grid info:
spacing = gridWidth.x;
bottom -= gridWidth.y;
// calculate number of visible grid points
- int numberX = (RS_Math::round((right-left) / gridWidth.x) + 1);
- int numberY = (RS_Math::round((top-bottom) / gridWidth.y) + 1);
+ int numberX = (Math::round((right-left) / gridWidth.x) + 1);
+ int numberY = (Math::round((top-bottom) / gridWidth.y) + 1);
number = numberX * numberY;
- RS_DEBUG->print("RS_Grid::update: 014");
+ DEBUG->print("Grid::update: 014");
// create grid array:
if (number > 0 && number < 1000000)
pt = NULL;
}
- RS_DEBUG->print("RS_Grid::update: 015");
+ DEBUG->print("Grid::update: 015");
}
// find meta grid boundaries
mbottom -= metaGridWidth.y;
// calculate number of visible meta grid lines:
- numMetaX = (RS_Math::round((mright - mleft) / metaGridWidth.x) + 1);
- numMetaY = (RS_Math::round((mtop - mbottom) / metaGridWidth.y) + 1);
+ numMetaX = (Math::round((mright - mleft) / metaGridWidth.x) + 1);
+ numMetaY = (Math::round((mtop - mbottom) / metaGridWidth.y) + 1);
if (numMetaX > 0 && numMetaY > 0)
{
}
}
- RS_DEBUG->print("RS_Grid::update: OK");
+ DEBUG->print("Grid::update: OK");
}
/**
* @return Array of all visible grid points.
*/
-Vector * RS_Grid::getPoints()
+Vector * Grid::getPoints()
{
return pt;
}
/**
* @return Number of visible grid points.
*/
-int RS_Grid::count()
+int Grid::count()
{
return number;
}
/**
* @return Grid info for status widget.
*/
-QString RS_Grid::getInfo()
+QString Grid::getInfo()
{
return QString("%1 / %2").arg(spacing).arg(metaSpacing);
}
/**
* @return Meta grid positions in X.
*/
-double * RS_Grid::getMetaX()
+double * Grid::getMetaX()
{
return metaX;
}
/**
* @return Number of visible meta grid lines in X.
*/
-int RS_Grid::countMetaX()
+int Grid::countMetaX()
{
return numMetaX;
}
/**
* @return Meta grid positions in Y.
*/
-double * RS_Grid::getMetaY()
+double * Grid::getMetaY()
{
return metaY;
}
/**
* @return Number of visible meta grid lines in Y.
*/
-int RS_Grid::countMetaY()
+int Grid::countMetaY()
{
return numMetaY;
}
*
* @author Andrew Mustun
*/
-class RS_Grid
+class Grid
{
public:
-// RS_Grid(RS_GraphicView *);
- RS_Grid(GraphicView *);
- ~RS_Grid();
+// Grid(RS_GraphicView *);
+ Grid(GraphicView *);
+ ~Grid();
void update();
/**
* Constructor.
*/
-RS_Hatch::RS_Hatch(RS_EntityContainer * parent, const RS_HatchData & d):
- RS_EntityContainer(parent), data(d)
+Hatch::Hatch(EntityContainer * parent, const HatchData & d):
+ EntityContainer(parent), data(d)
{
hatch = NULL;
updateRunning = false;
needOptimization = true;
}
-/*virtual*/ RS_Hatch::~RS_Hatch()
+/*virtual*/ Hatch::~Hatch()
{
}
-RS_Entity * RS_Hatch::clone()
+Entity * Hatch::clone()
{
- RS_Hatch * t = new RS_Hatch(*this);
+ Hatch * t = new Hatch(*this);
#warning "!!! Need to deal with setAutoDelete() Qt3->Qt4 !!!"
// t->entities.setAutoDelete(entities.autoDelete());
t->initId();
}
/** @return RS2::EntityHatch */
-/*virtual*/ RS2::EntityType RS_Hatch::rtti() const
+/*virtual*/ RS2::EntityType Hatch::rtti() const
{
return RS2::EntityHatch;
}
* @return true: if this is a hatch with lines (hatch pattern),
* false: if this is filled with a solid color.
*/
-/*virtual*/ bool RS_Hatch::isContainer() const
+/*virtual*/ bool Hatch::isContainer() const
{
if (isSolid())
return false;
}
/** @return Copy of data that defines the hatch. */
-RS_HatchData RS_Hatch::getData() const
+HatchData Hatch::getData() const
{
return data;
}
/**
* Validates the hatch.
*/
-bool RS_Hatch::validate()
+bool Hatch::validate()
{
bool ret = true;
// loops:
- for(RS_Entity * l=firstEntity(RS2::ResolveNone); l!=NULL; l=nextEntity(RS2::ResolveNone))
+ for(Entity * l=firstEntity(RS2::ResolveNone); l!=NULL; l=nextEntity(RS2::ResolveNone))
{
if (l->rtti() == RS2::EntityContainer)
{
- RS_EntityContainer * loop = (RS_EntityContainer *)l;
+ EntityContainer * loop = (EntityContainer *)l;
ret = loop->optimizeContours() && ret;
}
}
/**
* @return Number of loops.
*/
-int RS_Hatch::countLoops()
+int Hatch::countLoops()
{
if (data.solid)
return count();
}
/** @return true if this is a solid fill. false if it is a pattern hatch. */
-bool RS_Hatch::isSolid() const
+bool Hatch::isSolid() const
{
return data.solid;
}
-void RS_Hatch::setSolid(bool solid)
+void Hatch::setSolid(bool solid)
{
data.solid = solid;
}
-QString RS_Hatch::getPattern()
+QString Hatch::getPattern()
{
return data.pattern;
}
-void RS_Hatch::setPattern(const QString & pattern)
+void Hatch::setPattern(const QString & pattern)
{
data.pattern = pattern;
}
-double RS_Hatch::getScale()
+double Hatch::getScale()
{
return data.scale;
}
-void RS_Hatch::setScale(double scale)
+void Hatch::setScale(double scale)
{
data.scale = scale;
}
-double RS_Hatch::getAngle()
+double Hatch::getAngle()
{
return data.angle;
}
-void RS_Hatch::setAngle(double angle)
+void Hatch::setAngle(double angle)
{
data.angle = angle;
}
/**
* Recalculates the borders of this hatch.
*/
-void RS_Hatch::calculateBorders()
+void Hatch::calculateBorders()
{
- RS_DEBUG->print("RS_Hatch::calculateBorders");
+ DEBUG->print("Hatch::calculateBorders");
activateContour(true);
- RS_EntityContainer::calculateBorders();
+ EntityContainer::calculateBorders();
- RS_DEBUG->print("RS_Hatch::calculateBorders: size: %f,%f", getSize().x, getSize().y);
+ DEBUG->print("Hatch::calculateBorders: size: %f,%f", getSize().x, getSize().y);
activateContour(false);
}
* Updates the Hatch. Called when the
* hatch or it's data, position, alignment, .. changes.
*/
-void RS_Hatch::update()
+void Hatch::update()
{
- RS_DEBUG->print("RS_Hatch::update");
- RS_DEBUG->print("RS_Hatch::update: contour has %d loops", count());
+ DEBUG->print("Hatch::update");
+ DEBUG->print("Hatch::update: contour has %d loops", count());
if (updateRunning)
return;
if (data.solid == true)
return;
- RS_DEBUG->print("RS_Hatch::update");
+ DEBUG->print("Hatch::update");
updateRunning = true;
// delete old hatch:
if (!validate())
{
- RS_DEBUG->print(RS_Debug::D_WARNING, "RS_Hatch::update: invalid contour in hatch found");
+ DEBUG->print(Debug::D_WARNING, "Hatch::update: invalid contour in hatch found");
updateRunning = false;
return;
}
// search pattern:
- RS_DEBUG->print("RS_Hatch::update: requesting pattern");
- RS_Pattern * pat = RS_PATTERNLIST->requestPattern(data.pattern);
+ DEBUG->print("Hatch::update: requesting pattern");
+ Pattern * pat = PATTERNLIST->requestPattern(data.pattern);
if (pat == NULL)
{
updateRunning = false;
- RS_DEBUG->print("RS_Hatch::update: requesting pattern: not found");
+ DEBUG->print("Hatch::update: requesting pattern: not found");
return;
}
- RS_DEBUG->print("RS_Hatch::update: requesting pattern: OK");
+ DEBUG->print("Hatch::update: requesting pattern: OK");
- RS_DEBUG->print("RS_Hatch::update: cloning pattern");
- pat = (RS_Pattern*)pat->clone();
- RS_DEBUG->print("RS_Hatch::update: cloning pattern: OK");
+ DEBUG->print("Hatch::update: cloning pattern");
+ pat = (Pattern*)pat->clone();
+ DEBUG->print("Hatch::update: cloning pattern: OK");
// scale pattern
- RS_DEBUG->print("RS_Hatch::update: scaling pattern");
+ DEBUG->print("Hatch::update: scaling pattern");
pat->scale(Vector(0.0,0.0), Vector(data.scale, data.scale));
pat->calculateBorders();
forcedCalculateBorders();
- RS_DEBUG->print("RS_Hatch::update: scaling pattern: OK");
+ DEBUG->print("Hatch::update: scaling pattern: OK");
// find out how many pattern-instances we need in x/y:
int px1, py1, px2, py2;
double f;
- RS_Hatch * copy = (RS_Hatch *)this->clone();
+ Hatch * copy = (Hatch *)this->clone();
copy->rotate(Vector(0.0, 0.0), -data.angle);
copy->forcedCalculateBorders();
Vector cPos = getMin();
Vector cSize = getSize();
- RS_DEBUG->print("RS_Hatch::update: pattern size: %f/%f", pSize.x, pSize.y);
- RS_DEBUG->print("RS_Hatch::update: contour size: %f/%f", cSize.x, cSize.y);
+ DEBUG->print("Hatch::update: pattern size: %f/%f", pSize.x, pSize.y);
+ DEBUG->print("Hatch::update: contour size: %f/%f", cSize.x, cSize.y);
if (cSize.x < 1.0e-6 || cSize.y < 1.0e-6 || pSize.x < 1.0e-6 || pSize.y < 1.0e-6
|| cSize.x > RS_MAXDOUBLE - 1 || cSize.y > RS_MAXDOUBLE - 1
delete pat;
delete copy;
updateRunning = false;
- RS_DEBUG->print("RS_Hatch::update: contour size or pattern size too small");
+ DEBUG->print("Hatch::update: contour size or pattern size too small");
return;
}
// avoid huge memory consumption:
else if (cSize.x / pSize.x > 100 || cSize.y / pSize.y > 100)
{
- RS_DEBUG->print("RS_Hatch::update: contour size too large or pattern size too small");
+ DEBUG->print("Hatch::update: contour size too large or pattern size too small");
return;
}
f = copy->getMax().y/pat->getSize().y;
py2 = (int)ceil(f) - 1;
- RS_EntityContainer tmp; // container for untrimmed lines
+ EntityContainer tmp; // container for untrimmed lines
// adding array of patterns to tmp:
- RS_DEBUG->print("RS_Hatch::update: creating pattern carpet");
+ DEBUG->print("Hatch::update: creating pattern carpet");
for(int px=px1; px<=px2; px++)
{
for(int py=py1; py<=py2; py++)
{
- for(RS_Entity * e=pat->firstEntity(); e!=NULL; e=pat->nextEntity())
+ for(Entity * e=pat->firstEntity(); e!=NULL; e=pat->nextEntity())
{
- RS_Entity * te = e->clone();
+ Entity * te = e->clone();
te->rotate(Vector(0.0, 0.0), data.angle);
Vector v1, v2;
v1.setPolar(px * pSize.x, data.angle);
delete pat;
pat = NULL;
- RS_DEBUG->print("RS_Hatch::update: creating pattern carpet: OK");
+ DEBUG->print("Hatch::update: creating pattern carpet: OK");
- RS_DEBUG->print("RS_Hatch::update: cutting pattern carpet");
+ DEBUG->print("Hatch::update: cutting pattern carpet");
// cut pattern to contour shape:
- RS_EntityContainer tmp2; // container for small cut lines
- RS_Line * line = NULL;
- RS_Arc * arc = NULL;
- RS_Circle * circle = NULL;
+ EntityContainer tmp2; // container for small cut lines
+ Line * line = NULL;
+ Arc * arc = NULL;
+ Circle * circle = NULL;
- for(RS_Entity * e=tmp.firstEntity(); e!=NULL; e=tmp.nextEntity())
+ for(Entity * e=tmp.firstEntity(); e!=NULL; e=tmp.nextEntity())
{
Vector startPoint;
Vector endPoint;
if (e->rtti() == RS2::EntityLine)
{
- line = (RS_Line *)e;
+ line = (Line *)e;
arc = NULL;
circle = NULL;
startPoint = line->getStartpoint();
}
else if (e->rtti() == RS2::EntityArc)
{
- arc = (RS_Arc *)e;
+ arc = (Arc *)e;
line = NULL;
circle = NULL;
startPoint = arc->getStartpoint();
}
else if (e->rtti() == RS2::EntityCircle)
{
- circle = (RS_Circle *)e;
+ circle = (Circle *)e;
line = NULL;
arc = NULL;
startPoint = circle->getCenter() + Vector(circle->getRadius(), 0.0);
// is.setAutoDelete(true);
is.append(new Vector(startPoint));
- for(RS_Entity * loop=firstEntity(); loop!=NULL; loop=nextEntity())
+ for(Entity * loop=firstEntity(); loop!=NULL; loop=nextEntity())
{
if (loop->isContainer())
{
- for(RS_Entity * p=((RS_EntityContainer *)loop)->firstEntity(); p!=NULL; p=((RS_EntityContainer*)loop)->nextEntity())
+ for(Entity * p=((EntityContainer *)loop)->firstEntity(); p!=NULL; p=((EntityContainer*)loop)->nextEntity())
{
- VectorSolutions sol = RS_Information::getIntersection(e, p, true);
+ VectorSolutions sol = Information::getIntersection(e, p, true);
for(int i=0; i<=1; ++i)
{
if (sol.get(i).valid)
{
is.append(new Vector(sol.get(i)));
- RS_DEBUG->print(" pattern line intersection: %f/%f", sol.get(i).x, sol.get(i).y);
+ DEBUG->print(" pattern line intersection: %f/%f", sol.get(i).x, sol.get(i).y);
}
}
}
{
if (line != NULL)
{
- tmp2.addEntity(new RS_Line(&tmp2, RS_LineData(*v1, *v2)));
+ tmp2.addEntity(new Line(&tmp2, LineData(*v1, *v2)));
}
else if (arc != NULL || circle != NULL)
{
- tmp2.addEntity(new RS_Arc(&tmp2, RS_ArcData(center, center.distanceTo(*v1),
+ tmp2.addEntity(new Arc(&tmp2, ArcData(center, center.distanceTo(*v1),
center.angleTo(*v1), center.angleTo(*v2), reversed)));
}
}
}
// updating hatch / adding entities that are inside
- RS_DEBUG->print("RS_Hatch::update: cutting pattern carpet: OK");
+ DEBUG->print("Hatch::update: cutting pattern carpet: OK");
// the hatch pattern entities:
- hatch = new RS_EntityContainer(this);
- hatch->setPen(RS_Pen(RS2::FlagInvalid));
+ hatch = new EntityContainer(this);
+ hatch->setPen(Pen(RS2::FlagInvalid));
hatch->setLayer(NULL);
hatch->setFlag(RS2::FlagTemp);
//calculateBorders();
- for(RS_Entity * e=tmp2.firstEntity(); e!=NULL; e=tmp2.nextEntity())
+ for(Entity * e=tmp2.firstEntity(); e!=NULL; e=tmp2.nextEntity())
{
Vector middlePoint;
Vector middlePoint2;
if (e->rtti() == RS2::EntityLine)
{
- RS_Line * line = (RS_Line *)e;
+ Line * line = (Line *)e;
middlePoint = line->getMiddlepoint();
middlePoint2 = line->getNearestDist(line->getLength() / 2.1, line->getStartpoint());
}
else if (e->rtti() == RS2::EntityArc)
{
- RS_Arc * arc = (RS_Arc *)e;
+ Arc * arc = (Arc *)e;
middlePoint = arc->getMiddlepoint();
middlePoint2 = arc->getNearestDist(arc->getLength() / 2.1, arc->getStartpoint());
}
{
bool onContour = false;
- if (RS_Information::isPointInsideContour(middlePoint, this, &onContour)
- || RS_Information::isPointInsideContour(middlePoint2, this))
+ if (Information::isPointInsideContour(middlePoint, this, &onContour)
+ || Information::isPointInsideContour(middlePoint2, this))
{
- RS_Entity * te = e->clone();
- te->setPen(RS_Pen(RS2::FlagInvalid));
+ Entity * te = e->clone();
+ te->setPen(Pen(RS2::FlagInvalid));
te->setLayer(NULL);
te->reparent(hatch);
hatch->addEntity(te);
updateRunning = false;
- RS_DEBUG->print("RS_Hatch::update: OK");
+ DEBUG->print("Hatch::update: OK");
}
/**
* Activates of deactivates the hatch boundary.
*/
-void RS_Hatch::activateContour(bool on)
+void Hatch::activateContour(bool on)
{
- RS_DEBUG->print("RS_Hatch::activateContour: %d", (int)on);
+ DEBUG->print("Hatch::activateContour: %d", (int)on);
- for(RS_Entity * e=firstEntity(); e!=NULL; e=nextEntity())
+ for(Entity * e=firstEntity(); e!=NULL; e=nextEntity())
{
if (!e->isUndone())
{
if (!e->getFlag(RS2::FlagTemp))
{
- RS_DEBUG->print("RS_Hatch::activateContour: set visible");
+ DEBUG->print("Hatch::activateContour: set visible");
e->setVisible(on);
}
else
{
- RS_DEBUG->print("RS_Hatch::activateContour: entity temp");
+ DEBUG->print("Hatch::activateContour: entity temp");
}
}
else
{
- RS_DEBUG->print("RS_Hatch::activateContour: entity undone");
+ DEBUG->print("Hatch::activateContour: entity undone");
}
}
- RS_DEBUG->print("RS_Hatch::activateContour: OK");
+ DEBUG->print("Hatch::activateContour: OK");
}
/**
* Overrides drawing of subentities. This is only ever called for solid fills.
*/
-void RS_Hatch::draw(PaintInterface * painter, GraphicView * view, double /*patternOffset*/)
+void Hatch::draw(PaintInterface * painter, GraphicView * view, double /*patternOffset*/)
{
if (!data.solid)
{
- for(RS_Entity * se=firstEntity(); se!=NULL; se = nextEntity())
+ for(Entity * se=firstEntity(); se!=NULL; se = nextEntity())
view->drawEntity(se);
return;
// loops:
if (needOptimization == true)
{
- for(RS_Entity * l=firstEntity(RS2::ResolveNone); l!=NULL; l=nextEntity(RS2::ResolveNone))
+ for(Entity * l=firstEntity(RS2::ResolveNone); l!=NULL; l=nextEntity(RS2::ResolveNone))
{
if (l->rtti() == RS2::EntityContainer)
{
- RS_EntityContainer * loop = (RS_EntityContainer *)l;
+ EntityContainer * loop = (EntityContainer *)l;
loop->optimizeContours();
}
}
}
// loops:
- for(RS_Entity * l=firstEntity(RS2::ResolveNone); l!=NULL; l=nextEntity(RS2::ResolveNone))
+ for(Entity * l=firstEntity(RS2::ResolveNone); l!=NULL; l=nextEntity(RS2::ResolveNone))
{
l->setLayer(getLayer());
if (l->rtti() == RS2::EntityContainer)
{
- RS_EntityContainer * loop = (RS_EntityContainer *)l;
+ EntityContainer * loop = (EntityContainer *)l;
// edges:
- for(RS_Entity * e=loop->firstEntity(RS2::ResolveNone); e!=NULL; e=loop->nextEntity(RS2::ResolveNone))
+ for(Entity * e=loop->firstEntity(RS2::ResolveNone); e!=NULL; e=loop->nextEntity(RS2::ResolveNone))
{
e->setLayer(getLayer());
{
case RS2::EntityLine:
{
- RS_Line * line = (RS_Line *)e;
+ Line * line = (Line *)e;
- int x1 = RS_Math::round(view->toGuiX(line->getStartpoint().x));
- int y1 = RS_Math::round(view->toGuiY(line->getStartpoint().y));
- int x2 = RS_Math::round(view->toGuiX(line->getEndpoint().x));
- int y2 = RS_Math::round(view->toGuiY(line->getEndpoint().y));
+ int x1 = Math::round(view->toGuiX(line->getStartpoint().x));
+ int y1 = Math::round(view->toGuiY(line->getStartpoint().y));
+ int x2 = Math::round(view->toGuiX(line->getEndpoint().x));
+ int y2 = Math::round(view->toGuiY(line->getEndpoint().y));
if (lastValid && (lastX != x1 || lastY != y1))
{
case RS2::EntityArc:
{
- RS_Arc * arc = (RS_Arc *)e;
+ Arc * arc = (Arc *)e;
- int x1 = RS_Math::round(view->toGuiX(arc->getStartpoint().x));
- int y1 = RS_Math::round(view->toGuiY(arc->getStartpoint().y));
- int x2 = RS_Math::round(view->toGuiX(arc->getEndpoint().x));
- int y2 = RS_Math::round(view->toGuiY(arc->getEndpoint().y));
+ int x1 = Math::round(view->toGuiX(arc->getStartpoint().x));
+ int y1 = Math::round(view->toGuiY(arc->getStartpoint().y));
+ int x2 = Math::round(view->toGuiX(arc->getEndpoint().x));
+ int y2 = Math::round(view->toGuiY(arc->getEndpoint().y));
if (lastValid && (lastX != x1 || lastY != y1))
{
case RS2::EntityCircle:
{
- RS_Circle * circle = (RS_Circle *)e;
+ Circle * circle = (Circle *)e;
- int x1 = RS_Math::round(view->toGuiX(circle->getCenter().x + circle->getRadius()));
- int y1 = RS_Math::round(view->toGuiY(circle->getCenter().y));
+ int x1 = Math::round(view->toGuiX(circle->getCenter().x + circle->getRadius()));
+ int y1 = Math::round(view->toGuiY(circle->getCenter().y));
int x2 = x1;
int y2 = y1;
painter->drawPolygon(pa);
}
-/*virtual*/ double RS_Hatch::getLength()
+/*virtual*/ double Hatch::getLength()
{
return -1.0;
}
-double RS_Hatch::getDistanceToPoint(const Vector & coord, RS_Entity ** entity,
+double Hatch::getDistanceToPoint(const Vector & coord, Entity ** entity,
RS2::ResolveLevel level, double solidDist)
{
if (data.solid == true)
bool onContour;
- if (RS_Information::isPointInsideContour(coord, this, &onContour))
+ if (Information::isPointInsideContour(coord, this, &onContour))
// distance is the snap range:
return solidDist;
}
else
{
- return RS_EntityContainer::getDistanceToPoint(coord, entity, level, solidDist);
+ return EntityContainer::getDistanceToPoint(coord, entity, level, solidDist);
}
}
-void RS_Hatch::move(Vector offset)
+void Hatch::move(Vector offset)
{
- RS_EntityContainer::move(offset);
+ EntityContainer::move(offset);
update();
}
-void RS_Hatch::rotate(Vector center, double angle)
+void Hatch::rotate(Vector center, double angle)
{
- RS_EntityContainer::rotate(center, angle);
- data.angle = RS_Math::correctAngle(data.angle + angle);
+ EntityContainer::rotate(center, angle);
+ data.angle = Math::correctAngle(data.angle + angle);
update();
}
-void RS_Hatch::scale(Vector center, Vector factor)
+void Hatch::scale(Vector center, Vector factor)
{
- RS_EntityContainer::scale(center, factor);
+ EntityContainer::scale(center, factor);
data.scale *= factor.x;
update();
}
-void RS_Hatch::mirror(Vector axisPoint1, Vector axisPoint2)
+void Hatch::mirror(Vector axisPoint1, Vector axisPoint2)
{
- RS_EntityContainer::mirror(axisPoint1, axisPoint2);
+ EntityContainer::mirror(axisPoint1, axisPoint2);
double ang = axisPoint1.angleTo(axisPoint2);
- data.angle = RS_Math::correctAngle(data.angle + ang*2.0);
+ data.angle = Math::correctAngle(data.angle + ang*2.0);
update();
}
-void RS_Hatch::stretch(Vector firstCorner, Vector secondCorner, Vector offset)
+void Hatch::stretch(Vector firstCorner, Vector secondCorner, Vector offset)
{
- RS_EntityContainer::stretch(firstCorner, secondCorner, offset);
+ EntityContainer::stretch(firstCorner, secondCorner, offset);
update();
}
/**
* Dumps the point's data to stdout.
*/
-std::ostream & operator<<(std::ostream & os, const RS_Hatch & p)
+std::ostream & operator<<(std::ostream & os, const Hatch & p)
{
os << " Hatch: " << p.getData() << "\n";
return os;
/**
* Holds the data that defines a hatch entity.
*/
-class RS_HatchData
+class HatchData
{
public:
/**
* Default constructor. Leaves the data object uninitialized.
*/
- RS_HatchData() {}
+ HatchData() {}
/**
* @param solid true: solid fill, false: pattern.
* @param scale Pattern scale or spacing.
* @param pattern Pattern name.
*/
- RS_HatchData(bool solid, double scale, double angle, const QString & pattern)
+ HatchData(bool solid, double scale, double angle, const QString & pattern)
{
this->solid = solid;
this->scale = scale;
//std::cout << "RS_H__atchData: " << pattern.latin1() << "\n";
}
- friend std::ostream & operator<<(std::ostream & os, const RS_HatchData & td)
+ friend std::ostream & operator<<(std::ostream & os, const HatchData & td)
{
os << "(" << td.pattern.toAscii().data() << ")";
return os;
* @author James Hammons
* @author Andrew Mustun
*/
-class RS_Hatch: public RS_EntityContainer
+class Hatch: public EntityContainer
{
public:
- RS_Hatch(RS_EntityContainer * parent, const RS_HatchData & d);
- virtual ~RS_Hatch();
+ Hatch(EntityContainer * parent, const HatchData & d);
+ virtual ~Hatch();
- virtual RS_Entity * clone();
+ virtual Entity * clone();
virtual RS2::EntityType rtti() const;
virtual bool isContainer() const;
- RS_HatchData getData() const;
+ HatchData getData() const;
bool validate();
int countLoops();
void activateContour(bool on);
virtual void draw(PaintInterface * painter, GraphicView * view, double patternOffset = 0.0);
virtual double getLength();
- virtual double getDistanceToPoint(const Vector & coord, RS_Entity ** entity = NULL,
+ virtual double getDistanceToPoint(const Vector & coord, Entity ** entity = NULL,
RS2::ResolveLevel level = RS2::ResolveNone, double solidDist = RS_MAXDOUBLE);
virtual void move(Vector offset);
virtual void rotate(Vector center, double angle);
virtual void mirror(Vector axisPoint1, Vector axisPoint2);
virtual void stretch(Vector firstCorner, Vector secondCorner, Vector offset);
- friend std::ostream & operator<<(std::ostream & os, const RS_Hatch & p);
+ friend std::ostream & operator<<(std::ostream & os, const Hatch & p);
protected:
- RS_HatchData data;
- RS_EntityContainer * hatch;
+ HatchData data;
+ EntityContainer * hatch;
bool updateRunning;
bool needOptimization;
};
/**
* Constructor.
*/
-RS_Image::RS_Image(RS_EntityContainer * parent, const RS_ImageData & d):
- RS_AtomicEntity(parent), data(d)
+Image::Image(EntityContainer * parent, const ImageData & d):
+ AtomicEntity(parent), data(d)
{
update();
calculateBorders();
/**
* Destructor.
*/
-RS_Image::~RS_Image()
+Image::~Image()
{
/*if (img!=NULL) {
delete[] img;
}*/
}
-RS_Entity * RS_Image::clone()
+Entity * Image::clone()
{
- RS_Image * i = new RS_Image(*this);
+ Image * i = new Image(*this);
i->setHandle(getHandle());
i->initId();
i->update();
}
/** @return RS2::EntityImage */
-/*virtual*/ RS2::EntityType RS_Image::rtti() const
+/*virtual*/ RS2::EntityType Image::rtti() const
{
return RS2::EntityImage;
}
-void RS_Image::update()
+void Image::update()
{
- RS_DEBUG->print("RS_Image::update");
+ DEBUG->print("Image::update");
// the whole image:
//QImage image = QImage(data.file);
if (!img.isNull())
data.size = Vector(img.width(), img.height());
- RS_DEBUG->print("RS_Image::update: OK");
+ DEBUG->print("Image::update: OK");
/*
// number of small images:
}
/** @return Copy of data that defines the image. */
-RS_ImageData RS_Image::getData() const
+ImageData Image::getData() const
{
return data;
}
/** @return Insertion point of the entity */
-/*virtual*/ Vector RS_Image::getInsertionPoint() const
+/*virtual*/ Vector Image::getInsertionPoint() const
{
return data.insertionPoint;
}
/** Sets the insertion point for the image. */
-void RS_Image::setInsertionPoint(Vector ip)
+void Image::setInsertionPoint(Vector ip)
{
data.insertionPoint = ip;
calculateBorders();
}
/** @return File name of the image. */
-QString RS_Image::getFile() const
+QString Image::getFile() const
{
return data.file;
}
/** Sets the file name of the image. */
-void RS_Image::setFile(const QString & file)
+void Image::setFile(const QString & file)
{
data.file = file;
}
/** @return u Vector. Points along bottom, 1 pixel long. */
-Vector RS_Image::getUVector() const
+Vector Image::getUVector() const
{
return data.uVector;
}
/** @return v Vector. Points along left, 1 pixel long. */
-Vector RS_Image::getVVector() const
+Vector Image::getVVector() const
{
return data.vVector;
}
/** @return Width of image in pixels. */
-int RS_Image::getWidth() const
+int Image::getWidth() const
{
return (int)data.size.x;
}
/** @return Height of image in pixels. */
-int RS_Image::getHeight() const
+int Image::getHeight() const
{
return (int)data.size.y;
}
/** @return Brightness. */
-int RS_Image::getBrightness() const
+int Image::getBrightness() const
{
return data.brightness;
}
/** @return Contrast. */
-int RS_Image::getContrast() const
+int Image::getContrast() const
{
return data.contrast;
}
/** @return Fade. */
-int RS_Image::getFade() const
+int Image::getFade() const
{
return data.fade;
}
/** @return Image definition handle. */
-int RS_Image::getHandle() const
+int Image::getHandle() const
{
return data.handle;
}
/** Sets the image definition handle. */
-void RS_Image::setHandle(int h)
+void Image::setHandle(int h)
{
data.handle = h;
}
/** @return The four corners. **/
-VectorSolutions RS_Image::getCorners()
+VectorSolutions Image::getCorners()
{
VectorSolutions sol(4);
sol.set(0, data.insertionPoint);
sol.set(1,
- data.insertionPoint + data.uVector * RS_Math::round(data.size.x));
+ data.insertionPoint + data.uVector * Math::round(data.size.x));
sol.set(3,
- data.insertionPoint + data.vVector * RS_Math::round(data.size.y));
- sol.set(2, sol.get(3) + data.uVector * RS_Math::round(data.size.x));
+ data.insertionPoint + data.vVector * Math::round(data.size.y));
+ sol.set(2, sol.get(3) + data.uVector * Math::round(data.size.x));
return sol;
}
/**
* @return image with in graphic units.
*/
-double RS_Image::getImageWidth()
+double Image::getImageWidth()
{
return data.size.x * data.uVector.magnitude();
}
/**
* @return image height in graphic units.
*/
-double RS_Image::getImageHeight()
+double Image::getImageHeight()
{
return data.size.y * data.vVector.magnitude();
}
-void RS_Image::calculateBorders()
+void Image::calculateBorders()
{
resetBorders();
VectorSolutions sol = getCorners();
}
}
-Vector RS_Image::getNearestEndpoint(const Vector & coord, double * dist)
+Vector Image::getNearestEndpoint(const Vector & coord, double * dist)
{
VectorSolutions corners = getCorners();
return corners.getClosest(coord, dist);
}
-Vector RS_Image::getNearestPointOnEntity(const Vector & coord, bool onEntity, double * dist, RS_Entity * * entity)
+Vector Image::getNearestPointOnEntity(const Vector & coord, bool onEntity, double * dist, Entity * * entity)
{
if (entity != NULL)
*entity = this;
VectorSolutions corners = getCorners();
VectorSolutions points(4);
- RS_Line l[] = {
- RS_Line(NULL, RS_LineData(corners.get(0), corners.get(1))),
- RS_Line(NULL, RS_LineData(corners.get(1), corners.get(2))),
- RS_Line(NULL, RS_LineData(corners.get(2), corners.get(3))),
- RS_Line(NULL, RS_LineData(corners.get(3), corners.get(0)))
+ Line l[] = {
+ Line(NULL, LineData(corners.get(0), corners.get(1))),
+ Line(NULL, LineData(corners.get(1), corners.get(2))),
+ Line(NULL, LineData(corners.get(2), corners.get(3))),
+ Line(NULL, LineData(corners.get(3), corners.get(0)))
};
for (int i = 0; i < 4; ++i)
return points.getClosest(coord, dist);
}
-Vector RS_Image::getNearestCenter(const Vector & coord, double * dist)
+Vector Image::getNearestCenter(const Vector & coord, double * dist)
{
VectorSolutions points(4);
VectorSolutions corners = getCorners();
return points.getClosest(coord, dist);
}
-Vector RS_Image::getNearestMiddle(const Vector & coord, double * dist)
+Vector Image::getNearestMiddle(const Vector & coord, double * dist)
{
return getNearestCenter(coord, dist);
}
-Vector RS_Image::getNearestDist(double distance, const Vector & coord, double * dist)
+Vector Image::getNearestDist(double distance, const Vector & coord, double * dist)
{
VectorSolutions corners = getCorners();
VectorSolutions points(4);
- RS_Line l[] =
+ Line l[] =
{
- RS_Line(NULL, RS_LineData(corners.get(0), corners.get(1))),
- RS_Line(NULL, RS_LineData(corners.get(1), corners.get(2))),
- RS_Line(NULL, RS_LineData(corners.get(2), corners.get(3))),
- RS_Line(NULL, RS_LineData(corners.get(3), corners.get(0)))
+ Line(NULL, LineData(corners.get(0), corners.get(1))),
+ Line(NULL, LineData(corners.get(1), corners.get(2))),
+ Line(NULL, LineData(corners.get(2), corners.get(3))),
+ Line(NULL, LineData(corners.get(3), corners.get(0)))
};
for (int i = 0; i < 4; ++i)
return points.getClosest(coord, dist);
}
-double RS_Image::getDistanceToPoint(const Vector & coord, RS_Entity * * entity, RS2::ResolveLevel /*level*/, double /*solidDist*/)
+double Image::getDistanceToPoint(const Vector & coord, Entity * * entity, RS2::ResolveLevel /*level*/, double /*solidDist*/)
{
if (entity != NULL)
*entity = this;
double dist;
double minDist = RS_MAXDOUBLE;
- RS_Line l[] =
+ Line l[] =
{
- RS_Line(NULL, RS_LineData(corners.get(0), corners.get(1))),
- RS_Line(NULL, RS_LineData(corners.get(1), corners.get(2))),
- RS_Line(NULL, RS_LineData(corners.get(2), corners.get(3))),
- RS_Line(NULL, RS_LineData(corners.get(3), corners.get(0)))
+ Line(NULL, LineData(corners.get(0), corners.get(1))),
+ Line(NULL, LineData(corners.get(1), corners.get(2))),
+ Line(NULL, LineData(corners.get(2), corners.get(3))),
+ Line(NULL, LineData(corners.get(3), corners.get(0)))
};
for (int i = 0; i < 4; ++i)
return minDist;
}
-/*virtual*/ double RS_Image::getLength()
+/*virtual*/ double Image::getLength()
{
return -1.0;
}
-void RS_Image::move(Vector offset)
+void Image::move(Vector offset)
{
data.insertionPoint.move(offset);
calculateBorders();
}
-void RS_Image::rotate(Vector center, double angle)
+void Image::rotate(Vector center, double angle)
{
data.insertionPoint.rotate(center, angle);
data.uVector.rotate(angle);
calculateBorders();
}
-void RS_Image::scale(Vector center, Vector factor)
+void Image::scale(Vector center, Vector factor)
{
data.insertionPoint.scale(center, factor);
data.uVector.scale(factor);
calculateBorders();
}
-void RS_Image::mirror(Vector axisPoint1, Vector axisPoint2)
+void Image::mirror(Vector axisPoint1, Vector axisPoint2)
{
data.insertionPoint.mirror(axisPoint1, axisPoint2);
data.uVector.mirror(Vector(0.0, 0.0), axisPoint2 - axisPoint1);
calculateBorders();
}
-void RS_Image::draw(PaintInterface * painter, GraphicView * view, double /*patternOffset*/)
+void Image::draw(PaintInterface * painter, GraphicView * view, double /*patternOffset*/)
{
if (painter == NULL || view == NULL || img.isNull())
return;
/**
* Dumps the point's data to stdout.
*/
-std::ostream & operator<<(std::ostream & os, const RS_Image & i)
+std::ostream & operator<<(std::ostream & os, const Image & i)
{
os << " Image: " << i.getData() << "\n";
return os;
/**
* Holds the data that defines a line.
*/
-class RS_ImageData
+class ImageData
{
public:
/**
* Default constructor. Leaves the data object uninitialized.
*/
- RS_ImageData()
+ ImageData()
{
}
- RS_ImageData(int handle, const Vector & insertionPoint, const Vector & uVector, const Vector & vVector, const Vector & size, const QString & file, int brightness, int contrast, int fade)
+ ImageData(int handle, const Vector & insertionPoint, const Vector & uVector, const Vector & vVector, const Vector & size, const QString & file, int brightness, int contrast, int fade)
{
this->handle = handle;
this->insertionPoint = insertionPoint;
this->fade = fade;
}
- friend std::ostream & operator<<(std::ostream & os, const RS_ImageData & ld)
+ friend std::ostream & operator<<(std::ostream & os, const ImageData & ld)
{
os << "(" << ld.insertionPoint << ")";
return os;
*
* @author Andrew Mustun
*/
-class RS_Image: public RS_AtomicEntity
+class Image: public AtomicEntity
{
public:
- RS_Image(RS_EntityContainer * parent, const RS_ImageData & d);
- virtual ~RS_Image();
+ Image(EntityContainer * parent, const ImageData & d);
+ virtual ~Image();
- virtual RS_Entity * clone();
+ virtual Entity * clone();
virtual RS2::EntityType rtti() const;
virtual void update();
- RS_ImageData getData() const;
+ ImageData getData() const;
virtual Vector getInsertionPoint() const;
void setInsertionPoint(Vector ip);
QString getFile() const;
double getImageHeight();
virtual Vector getNearestEndpoint(const Vector & coord, double * dist = NULL);
- virtual Vector getNearestPointOnEntity(const Vector & coord, bool onEntity = true, double * dist = NULL, RS_Entity * * entity = NULL);
+ virtual Vector getNearestPointOnEntity(const Vector & coord, bool onEntity = true, double * dist = NULL, Entity * * entity = NULL);
virtual Vector getNearestCenter(const Vector & coord, double * dist = NULL);
virtual Vector getNearestMiddle(const Vector & coord, double * dist = NULL);
virtual Vector getNearestDist(double distance, const Vector & coord, double * dist = NULL);
- virtual double getDistanceToPoint(const Vector & coord, RS_Entity * * entity = NULL, RS2::ResolveLevel level = RS2::ResolveNone, double solidDist = RS_MAXDOUBLE);
+ virtual double getDistanceToPoint(const Vector & coord, Entity * * entity = NULL, RS2::ResolveLevel level = RS2::ResolveNone, double solidDist = RS_MAXDOUBLE);
virtual double getLength();
virtual void move(Vector offset);
virtual void rotate(Vector center, double angle);
/*virtual void stretch(Vector firstCorner,Vector secondCorner, Vector offset);*/
virtual void draw(PaintInterface * painter, GraphicView * view, double patternOffset = 0.0);
- friend std::ostream & operator<<(std::ostream & os, const RS_Image & l);
+ friend std::ostream & operator<<(std::ostream & os, const Image & l);
virtual void calculateBorders();
protected:
- RS_ImageData data;
+ ImageData data;
QImage img;
};
/**
* Constructor.
*/
-RS_InfoArea::RS_InfoArea()
+InfoArea::InfoArea()
{
}
/**
* Destructor.
*/
-RS_InfoArea::~RS_InfoArea()
+InfoArea::~InfoArea()
{
}
*
* @param p co-ordinate of the point
*/
-void RS_InfoArea::addPoint(const Vector & p)
+void InfoArea::addPoint(const Vector & p)
{
if (thePoints.empty())
baseY = p.y;
/**
* Resets the points.
*/
-void RS_InfoArea::reset()
+void InfoArea::reset()
{
thePoints.clear();
area = 0.0;
/**
* Closes the polygon if it is not closed already.
*/
-void RS_InfoArea::close()
+void InfoArea::close()
{
if (isValid() && isClosed() == false)
{
thePoints.append(thePoints.first());
- RS_DEBUG->print("RS_InfoArea::close: closed");
+ DEBUG->print("InfoArea::close: closed");
}
}
* identical)
* @retval false Otherwise.
*/
-bool RS_InfoArea::isClosed()
+bool InfoArea::isClosed()
{
return (thePoints.first().distanceTo(thePoints.last()) < 1.0e-4);
}
* @retval true If the area is defined (i.e. there are at least 3 points)
* @retval false If there are only two or less points.
*/
-bool RS_InfoArea::isValid()
+bool InfoArea::isValid()
{
- RS_DEBUG->print("RS_InfoArea::isValid: count: %d", thePoints.count());
+ DEBUG->print("InfoArea::isValid: count: %d", thePoints.count());
return (thePoints.count() > 2);
}
/**
* Calculates the area and the circumference of the area.
*/
-void RS_InfoArea::calculate()
+void InfoArea::calculate()
{
area = 0.0;
circumference = 0.0;
area = fabs(area);
}
-double RS_InfoArea::getArea()
+double InfoArea::getArea()
{
return area;
}
-double RS_InfoArea::getCircumference()
+double InfoArea::getCircumference()
{
return circumference;
}
-int RS_InfoArea::count()
+int InfoArea::count()
{
return thePoints.count();
}
* @param p1 first point
* @param p2 second point
*/
-double RS_InfoArea::calcSubArea(const Vector & p1, const Vector & p2)
+double InfoArea::calcSubArea(const Vector & p1, const Vector & p2)
{
double width = p2.x - p1.x;
double height = (p1.y - baseY) + (p2.y - baseY);
\param _p2 second point
*/
/*double
-RS_InfoArea::calcDistance(Vector *_p1, Vector *_p2)
+InfoArea::calcDistance(Vector *_p1, Vector *_p2)
{
return mtGetDistance(_p1->getX(), _p1->getY(), _p2->getX(), _p2->getY());
}*/
*
* @author Andrew Mustun
*/
-class RS_InfoArea
+class InfoArea
{
public:
- RS_InfoArea();
- ~RS_InfoArea();
+ InfoArea();
+ ~InfoArea();
void reset();
void addPoint(const Vector & p);
* entities. Usually that's an Drawing entity but
* it can also be a polyline, text, ...
*/
-RS_Information::RS_Information(RS_EntityContainer& container)
+Information::Information(EntityContainer& container)
{
this->container = &container;
}
* @return true: if the entity is a dimensioning enity.
* false: otherwise
*/
-bool RS_Information::isDimension(RS2::EntityType type)
+bool Information::isDimension(RS2::EntityType type)
{
if (type == RS2::EntityDimAligned || type == RS2::EntityDimLinear
|| type == RS2::EntityDimRadial || type == RS2::EntityDimDiametric
* @retval true the entity can be trimmed.
* i.e. it is in a graphic or in a polyline.
*/
-bool RS_Information::isTrimmable(RS_Entity * e)
+bool Information::isTrimmable(Entity * e)
{
if (e)
{
* @retval true the two entities can be trimmed to each other;
* i.e. they are in a graphic or in the same polyline.
*/
-bool RS_Information::isTrimmable(RS_Entity * e1, RS_Entity * e2)
+bool Information::isTrimmable(Entity * e1, Entity * e2)
{
if (e1 && e2)
{
&& e1->getParent()==e2->getParent())
{
// in the same polyline
- RS_EntityContainer * pl = e1->getParent();
+ EntityContainer * pl = e1->getParent();
int idx1 = pl->findEntity(e1);
int idx2 = pl->findEntity(e2);
- RS_DEBUG->print("RS_Information::isTrimmable: idx1: %d, idx2: %d", idx1, idx2);
+ DEBUG->print("Information::isTrimmable: idx1: %d, idx2: %d", idx1, idx2);
if (abs(idx1 - idx2) == 1 || abs(idx1 - idx2) == pl->count() - 1)
{
* if there are no elements at all in this graphics
* container.
*/
-Vector RS_Information::getNearestEndpoint(const Vector & coord, double * dist) const
+Vector Information::getNearestEndpoint(const Vector & coord, double * dist) const
{
return container->getNearestEndpoint(coord, dist);
}
* if there are no elements at all in this graphics
* container.
*/
-Vector RS_Information::getNearestPointOnEntity(const Vector & coord,
- bool onEntity, double * dist, RS_Entity ** entity) const
+Vector Information::getNearestPointOnEntity(const Vector & coord,
+ bool onEntity, double * dist, Entity ** entity) const
{
return container->getNearestPointOnEntity(coord, onEntity, dist, entity);
}
* @return the entity found or NULL if there are no elements
* at all in this graphics container.
*/
-RS_Entity * RS_Information::getNearestEntity(const Vector & coord,
+Entity * Information::getNearestEntity(const Vector & coord,
double * dist, RS2::ResolveLevel level) const
{
return container->getNearestEntity(coord, dist, level);
* @return All intersections of the two entities. The tangent flag in
* VectorSolutions is set if one intersection is a tangent point.
*/
-VectorSolutions RS_Information::getIntersection(RS_Entity * e1,
- RS_Entity * e2, bool onEntities)
+VectorSolutions Information::getIntersection(Entity * e1,
+ Entity * e2, bool onEntities)
{
VectorSolutions ret;
double tol = 1.0e-4;
{
if (e2->rtti() == RS2::EntityEllipse)
{
- RS_Entity * tmp = e1;
+ Entity * tmp = e1;
e1 = e2;
e2 = tmp;
}
if (e2->rtti() == RS2::EntityLine)
{
- RS_Ellipse * ellipse = (RS_Ellipse *)e1;
- ret = getIntersectionLineEllipse((RS_Line *)e2, ellipse);
+ Ellipse * ellipse = (Ellipse *)e1;
+ ret = getIntersectionLineEllipse((Line *)e2, ellipse);
tol = 1.0e-1;
}
// ellipse / arc, ellipse / ellipse: not supported:
}
else
{
- RS_Entity * te1 = e1;
- RS_Entity * te2 = e2;
+ Entity * te1 = e1;
+ Entity * te2 = e2;
// entity copies - so we only have to deal with lines and arcs
- RS_Line l1(NULL, RS_LineData(Vector(0.0, 0.0), Vector(0.0, 0.0)));
- RS_Line l2(NULL, RS_LineData(Vector(0.0, 0.0), Vector(0.0, 0.0)));
+ Line l1(NULL, LineData(Vector(0.0, 0.0), Vector(0.0, 0.0)));
+ Line l2(NULL, LineData(Vector(0.0, 0.0), Vector(0.0, 0.0)));
- RS_Arc a1(NULL, RS_ArcData(Vector(0.0, 0.0), 1.0, 0.0, 2 * M_PI, false));
- RS_Arc a2(NULL, RS_ArcData(Vector(0.0, 0.0), 1.0, 0.0, 2 * M_PI, false));
+ Arc a1(NULL, ArcData(Vector(0.0, 0.0), 1.0, 0.0, 2 * M_PI, false));
+ Arc a2(NULL, ArcData(Vector(0.0, 0.0), 1.0, 0.0, 2 * M_PI, false));
// convert construction lines to lines:
if (e1->rtti() == RS2::EntityConstructionLine)
{
- RS_ConstructionLine * cl = (RS_ConstructionLine *)e1;
+ ConstructionLine * cl = (ConstructionLine *)e1;
l1.setStartpoint(cl->getPoint1());
l1.setEndpoint(cl->getPoint2());
te1 = &l1;
if (e2->rtti() == RS2::EntityConstructionLine)
{
- RS_ConstructionLine * cl = (RS_ConstructionLine *)e2;
+ ConstructionLine * cl = (ConstructionLine *)e2;
l2.setStartpoint(cl->getPoint1());
l2.setEndpoint(cl->getPoint2());
te2 = &l2;
// convert circles to arcs:
if (e1->rtti() == RS2::EntityCircle)
{
- RS_Circle * c = (RS_Circle *)e1;
- RS_ArcData data(c->getCenter(), c->getRadius(), 0.0, 2 * M_PI, false);
+ Circle * c = (Circle *)e1;
+ ArcData data(c->getCenter(), c->getRadius(), 0.0, 2 * M_PI, false);
a1.setData(data);
te1 = &a1;
}
if (e2->rtti() == RS2::EntityCircle)
{
- RS_Circle * c = (RS_Circle *)e2;
- RS_ArcData data(c->getCenter(), c->getRadius(), 0.0, 2 * M_PI, false);
+ Circle * c = (Circle *)e2;
+ ArcData data(c->getCenter(), c->getRadius(), 0.0, 2 * M_PI, false);
a2.setData(data);
te2 = &a2;
}
//else
if (te1->rtti() == RS2::EntityLine && te2->rtti() == RS2::EntityLine)
{
- RS_Line * line1 = (RS_Line *)te1;
- RS_Line * line2 = (RS_Line *)te2;
+ Line * line1 = (Line *)te1;
+ Line * line2 = (Line *)te2;
ret = getIntersectionLineLine(line1, line2);
}
// line / arc:
//
else if (te1->rtti() == RS2::EntityLine && te2->rtti() == RS2::EntityArc)
{
- RS_Line * line = (RS_Line *)te1;
- RS_Arc * arc = (RS_Arc *)te2;
+ Line * line = (Line *)te1;
+ Arc * arc = (Arc *)te2;
ret = getIntersectionLineArc(line, arc);
}
// arc / line:
//
else if (te1->rtti() == RS2::EntityArc && te2->rtti() == RS2::EntityLine)
{
- RS_Arc * arc = (RS_Arc *)te1;
- RS_Line * line = (RS_Line *)te2;
+ Arc * arc = (Arc *)te1;
+ Line * line = (Line *)te2;
ret = getIntersectionLineArc(line, arc);
}
// arc / arc:
//
else if (te1->rtti() == RS2::EntityArc && te2->rtti() == RS2::EntityArc)
{
- RS_Arc * arc1 = (RS_Arc *)te1;
- RS_Arc * arc2 = (RS_Arc *)te2;
+ Arc * arc1 = (Arc *)te1;
+ Arc * arc2 = (Arc *)te2;
ret = getIntersectionArcArc(arc1, arc2);
}
else
{
- RS_DEBUG->print("RS_Information::getIntersection:: Unsupported entity type.");
+ DEBUG->print("Information::getIntersection:: Unsupported entity type.");
}
}
/**
* @return Intersection between two lines.
*/
-VectorSolutions RS_Information::getIntersectionLineLine(RS_Line * e1, RS_Line * e2)
+VectorSolutions Information::getIntersectionLineLine(Line * e1, Line * e2)
{
VectorSolutions ret;
/**
* @return One or two intersection points between given entities.
*/
-VectorSolutions RS_Information::getIntersectionLineArc(RS_Line * line, RS_Arc * arc)
+VectorSolutions Information::getIntersectionLineArc(Line * line, Arc * arc)
{
VectorSolutions ret;
Vector delta = p - c;
// root term:
- double term = RS_Math::pow(Vector::dotP(d, delta), 2.0)
- - RS_Math::pow(d.magnitude(), 2.0)
- * (RS_Math::pow(delta.magnitude(), 2.0) - RS_Math::pow(r, 2.0));
+ double term = Math::pow(Vector::dotP(d, delta), 2.0)
+ - Math::pow(d.magnitude(), 2.0)
+ * (Math::pow(delta.magnitude(), 2.0) - Math::pow(r, 2.0));
// no intersection:
if (term<0.0) {
// one or two intersections:
else {
double t1 = (- Vector::dotP(d, delta) + sqrt(term))
- / RS_Math::pow(d.magnitude(), 2.0);
+ / Math::pow(d.magnitude(), 2.0);
double t2;
bool tangent = false;
// two intersections
else {
t2 = (-Vector::dotP(d, delta) - sqrt(term))
- / RS_Math::pow(d.magnitude(), 2.0);
+ / Math::pow(d.magnitude(), 2.0);
}
Vector sol1;
/**
* @return One or two intersection points between given entities.
*/
-VectorSolutions RS_Information::getIntersectionArcArc(RS_Arc * e1, RS_Arc * e2)
+VectorSolutions Information::getIntersectionArcArc(Arc * e1, Arc * e2)
{
VectorSolutions ret;
double s, t1, t2, term;
- s = 1.0/2.0 * ((r1*r1 - r2*r2)/(RS_Math::pow(u.magnitude(), 2.0)) + 1.0);
+ s = 1.0/2.0 * ((r1*r1 - r2*r2)/(Math::pow(u.magnitude(), 2.0)) + 1.0);
- term = (r1*r1)/(RS_Math::pow(u.magnitude(), 2.0)) - s*s;
+ term = (r1*r1)/(Math::pow(u.magnitude(), 2.0)) - s*s;
// no intersection:
if (term<0.0) {
/**
* @return One or two intersection points between given entities.
*/
-VectorSolutions RS_Information::getIntersectionLineEllipse(RS_Line * line, RS_Ellipse * ellipse)
+VectorSolutions Information::getIntersectionLineEllipse(Line * line, Ellipse * ellipse)
{
VectorSolutions ret;
double d = b*b - a*c;
if (d < 0) {
- RS_DEBUG->print("RS_Information::getIntersectionLineEllipse: outside 0");
+ DEBUG->print("Information::getIntersectionLineEllipse: outside 0");
} else if ( d > 0 ) {
double root = sqrt(d);
double t_a = (-b - root) / a;
/*if ( (t_a < 0 || 1 < t_a) && (t_b < 0 || 1 < t_b) ) {
if ( (t_a < 0 && t_b < 0) || (t_a > 1 && t_b > 1) ) {
- RS_DEBUG->print("RS_Information::getIntersectionLineEllipse: outside 1");
+ DEBUG->print("Information::getIntersectionLineEllipse: outside 1");
}
else {
- RS_DEBUG->print("RS_Information::getIntersectionLineEllipse: inside 1");
+ DEBUG->print("Information::getIntersectionLineEllipse: inside 1");
}
} else {*/
- RS_DEBUG->print("RS_Information::getIntersectionLineEllipse: intersection 1");
+ DEBUG->print("Information::getIntersectionLineEllipse: intersection 1");
Vector ret1(false);
Vector ret2(false);
//if ( 0 <= t_a && t_a <= 1 ) {
- //RS_DEBUG->print("RS_Information::getIntersectionLineEllipse: 0<=t_a<=1");
+ //DEBUG->print("Information::getIntersectionLineEllipse: 0<=t_a<=1");
ret1 = a1.lerp(a2, t_a);
- RS_DEBUG->print("RS_Information::getIntersectionLineEllipse: ret1: %f/%f", ret1.x, ret1.y);
+ DEBUG->print("Information::getIntersectionLineEllipse: ret1: %f/%f", ret1.x, ret1.y);
//}
//if ( 0 <= t_b && t_b <= 1 ) {
- //RS_DEBUG->print("RS_Information::getIntersectionLineEllipse: 0<=t_b<=1");
+ //DEBUG->print("Information::getIntersectionLineEllipse: 0<=t_b<=1");
ret2 = a1.lerp(a2, t_b);
- RS_DEBUG->print("RS_Information::getIntersectionLineEllipse: ret2: %f/%f", ret2.x, ret2.y);
+ DEBUG->print("Information::getIntersectionLineEllipse: ret2: %f/%f", ret2.x, ret2.y);
//}
if (ret1.valid && ret2.valid) {
ret = VectorSolutions(ret1, ret2);
} else {
double t = -b/a;
if ( 0 <= t && t <= 1 ) {
- RS_DEBUG->print("RS_Information::getIntersectionLineEllipse: 0<=t<=1");
- RS_DEBUG->print("RS_Information::getIntersectionLineEllipse: intersection 2");
+ DEBUG->print("Information::getIntersectionLineEllipse: 0<=t<=1");
+ DEBUG->print("Information::getIntersectionLineEllipse: intersection 2");
ret = VectorSolutions(a1.lerp(a2, t));
- RS_DEBUG->print("RS_Information::getIntersectionLineEllipse: ret1: %f/%f", ret.get(0).x, ret.get(0).y);
+ DEBUG->print("Information::getIntersectionLineEllipse: ret1: %f/%f", ret.get(0).x, ret.get(0).y);
} else {
- RS_DEBUG->print("RS_Information::getIntersectionLineEllipse: outside 2");
+ DEBUG->print("Information::getIntersectionLineEllipse: outside 2");
}
}
/*
- RS_Arc* arc = new RS_Arc(NULL,
- RS_ArcData(ellipse->getCenter(),
+ Arc* arc = new Arc(NULL,
+ ArcData(ellipse->getCenter(),
ellipse->getMajorRadius(),
ellipse->getAngle1(),
ellipse->getAngle2(),
false));
- RS_Line* other = (RS_Line*)line->clone();
+ Line* other = (Line*)line->clone();
double angle = ellipse->getAngle();
//double ratio = ellipse->getRatio();
* @param onContour Will be set to true if the given point it exactly
* on the contour.
*/
-bool RS_Information::isPointInsideContour(const Vector & point,
- RS_EntityContainer * contour, bool * onContour)
+bool Information::isPointInsideContour(const Vector & point,
+ EntityContainer * contour, bool * onContour)
{
if (contour==NULL) {
- RS_DEBUG->print(RS_Debug::D_WARNING,
- "RS_Information::isPointInsideContour: contour is NULL");
+ DEBUG->print(Debug::D_WARNING,
+ "Information::isPointInsideContour: contour is NULL");
return false;
}
// create ray:
Vector v;
v.setPolar(width*10.0, rayAngle);
- RS_Line ray(NULL, RS_LineData(point, point+v));
+ Line ray(NULL, LineData(point, point+v));
counter = 0;
VectorSolutions sol;
if (onContour)
*onContour = false;
- for(RS_Entity * e=contour->firstEntity(RS2::ResolveAll); e!=NULL;
+ for(Entity * e=contour->firstEntity(RS2::ResolveAll); e!=NULL;
e=contour->nextEntity(RS2::ResolveAll))
{
// intersection(s) from ray with contour entity:
- sol = RS_Information::getIntersection(&ray, e, true);
+ sol = Information::getIntersection(&ray, e, true);
for(int i=0; i<=1; ++i)
{
{
if (e->rtti() == RS2::EntityLine)
{
- RS_Line * line = (RS_Line *)e;
+ Line * line = (Line *)e;
// ray goes through startpoint of line:
if (p.distanceTo(line->getStartpoint()) < 1.0e-4)
{
- if (RS_Math::correctAngle(line->getAngle1()) < M_PI)
+ if (Math::correctAngle(line->getAngle1()) < M_PI)
{
counter++;
sure = false;
// ray goes through endpoint of line:
else if (p.distanceTo(line->getEndpoint()) < 1.0e-4)
{
- if (RS_Math::correctAngle(line->getAngle2()) < M_PI)
+ if (Math::correctAngle(line->getAngle2()) < M_PI)
{
counter++;
sure = false;
}
else if (e->rtti() == RS2::EntityArc)
{
- RS_Arc * arc = (RS_Arc *)e;
+ Arc * arc = (Arc *)e;
if (p.distanceTo(arc->getStartpoint()) < 1.0e-4)
{
*
* @author Andrew Mustun
*/
-class RS_Information
+class Information
{
public:
- RS_Information(RS_EntityContainer & entityContainer);
+ Information(EntityContainer & entityContainer);
static bool isDimension(RS2::EntityType type);
- static bool isTrimmable(RS_Entity * e);
- static bool isTrimmable(RS_Entity * e1, RS_Entity * e2);
+ static bool isTrimmable(Entity * e);
+ static bool isTrimmable(Entity * e1, Entity * e2);
Vector getNearestEndpoint(const Vector & point, double * dist = NULL) const;
Vector getNearestPointOnEntity(const Vector & point, bool onEntity = true,
- double * dist = NULL, RS_Entity ** entity = NULL) const;
- RS_Entity * getNearestEntity(const Vector & point, double * dist = NULL,
+ double * dist = NULL, Entity ** entity = NULL) const;
+ Entity * getNearestEntity(const Vector & point, double * dist = NULL,
RS2::ResolveLevel level = RS2::ResolveAll) const;
- static VectorSolutions getIntersection(RS_Entity * e1, RS_Entity * e2, bool onEntities = false);
- static VectorSolutions getIntersectionLineLine(RS_Line * e1, RS_Line * e2);
- static VectorSolutions getIntersectionLineArc(RS_Line * line, RS_Arc * arc);
- static VectorSolutions getIntersectionArcArc(RS_Arc * e1, RS_Arc * e2);
- static VectorSolutions getIntersectionLineEllipse(RS_Line * line, RS_Ellipse * ellipse);
- static bool isPointInsideContour(const Vector & point, RS_EntityContainer * contour,
+ static VectorSolutions getIntersection(Entity * e1, Entity * e2, bool onEntities = false);
+ static VectorSolutions getIntersectionLineLine(Line * e1, Line * e2);
+ static VectorSolutions getIntersectionLineArc(Line * line, Arc * arc);
+ static VectorSolutions getIntersectionArcArc(Arc * e1, Arc * e2);
+ static VectorSolutions getIntersectionLineEllipse(Line * line, Ellipse * ellipse);
+ static bool isPointInsideContour(const Vector & point, EntityContainer * contour,
bool * onContour = NULL);
protected:
- RS_EntityContainer * container;
+ EntityContainer * container;
};
#endif
/**
* @param parent The graphic this block belongs to.
*/
-RS_Insert::RS_Insert(RS_EntityContainer * parent, const RS_InsertData & d):
- RS_EntityContainer(parent), data(d)
+Insert::Insert(EntityContainer * parent, const InsertData & d):
+ EntityContainer(parent), data(d)
{
block = NULL;
/**
* Destructor.
*/
-RS_Insert::~RS_Insert()
+Insert::~Insert()
{
}
-/*virtual*/ RS_Entity * RS_Insert::clone()
+/*virtual*/ Entity * Insert::clone()
{
- RS_Insert * i = new RS_Insert(*this);
+ Insert * i = new Insert(*this);
#warning "!!! Need to deal with setAutoDelete() Qt3->Qt4 !!!"
// i->entities.setAutoDelete(entities.autoDelete());
i->initId();
}
/** @return RS2::EntityInsert */
-/*virtual*/ RS2::EntityType RS_Insert::rtti() const
+/*virtual*/ RS2::EntityType Insert::rtti() const
{
return RS2::EntityInsert;
}
/** @return Copy of data that defines the insert. **/
-RS_InsertData RS_Insert::getData() const
+InsertData Insert::getData() const
{
return data;
}
/**
* Reimplementation of reparent. Invalidates block cache pointer.
*/
-/*virtual*/ void RS_Insert::reparent(RS_EntityContainer * parent)
+/*virtual*/ void Insert::reparent(EntityContainer * parent)
{
- RS_Entity::reparent(parent);
+ Entity::reparent(parent);
block = NULL;
}
* from the blockSource if one was supplied and otherwise from
* the closest parent graphic.
*/
-RS_Block * RS_Insert::getBlockForInsert()
+Block * Insert::getBlockForInsert()
{
if (block)
return block;
- RS_BlockList * blkList;
+ BlockList * blkList;
if (!data.blockSource)
{
blkList = data.blockSource;
}
- RS_Block * blk = NULL;
+ Block * blk = NULL;
if (blkList)
blk = blkList->find(data.name);
* Updates the entity buffer of this insert entity. This method
* needs to be called whenever the block this insert is based on changes.
*/
-void RS_Insert::update()
+void Insert::update()
{
- RS_DEBUG->print("RS_Insert::update");
- RS_DEBUG->print("RS_Insert::update: name: %s", data.name.toLatin1().data());
- RS_DEBUG->print("RS_Insert::update: insertionPoint: %f/%f",
+ DEBUG->print("Insert::update");
+ DEBUG->print("Insert::update: name: %s", data.name.toLatin1().data());
+ DEBUG->print("Insert::update: insertionPoint: %f/%f",
data.insertionPoint.x, data.insertionPoint.y);
if (!updateEnabled)
return;
clear();
- RS_Block * blk = getBlockForInsert();
+ Block * blk = getBlockForInsert();
if (!blk)
{
- RS_DEBUG->print("RS_Insert::update: Block is NULL");
+ DEBUG->print("Insert::update: Block is NULL");
return;
}
if (isUndone())
{
- RS_DEBUG->print("RS_Insert::update: Insert is in undo list");
+ DEBUG->print("Insert::update: Insert is in undo list");
return;
}
if (fabs(data.scaleFactor.x) < 1.0e-6 || fabs(data.scaleFactor.y) < 1.0e-6)
{
- RS_DEBUG->print("RS_Insert::update: scale factor is 0");
+ DEBUG->print("Insert::update: scale factor is 0");
return;
}
- RS_Pen tmpPen;
+ Pen tmpPen;
- /*Q3PtrListIterator<RS_Entity> it = createIterator();
- RS_Entity* e;
+ /*Q3PtrListIterator<Entity> it = createIterator();
+ Entity* e;
while ( (e = it.current()) != NULL ) {
++it;*/
- RS_DEBUG->print("RS_Insert::update: cols: %d, rows: %d", data.cols, data.rows);
- RS_DEBUG->print("RS_Insert::update: block has %d entities", blk->count());
+ DEBUG->print("Insert::update: cols: %d, rows: %d", data.cols, data.rows);
+ DEBUG->print("Insert::update: block has %d entities", blk->count());
- for(RS_Entity * e=blk->firstEntity(); e!=NULL; e=blk->nextEntity())
+ for(Entity * e=blk->firstEntity(); e!=NULL; e=blk->nextEntity())
{
for(int c=0; c<data.cols; ++c)
{
- RS_DEBUG->print("RS_Insert::update: col %d", c);
+ DEBUG->print("Insert::update: col %d", c);
for(int r=0; r<data.rows; ++r)
{
- RS_DEBUG->print("RS_Insert::update: row %d", r);
+ DEBUG->print("Insert::update: row %d", r);
if (e->rtti() == RS2::EntityInsert && data.updateMode != RS2::PreviewUpdate)
{
- RS_DEBUG->print("RS_Insert::update: updating sub-insert");
- ((RS_Insert *)e)->update();
+ DEBUG->print("Insert::update: updating sub-insert");
+ ((Insert *)e)->update();
}
- RS_DEBUG->print("RS_Insert::update: cloning entity");
+ DEBUG->print("Insert::update: cloning entity");
- RS_Entity * ne = e->clone();
+ Entity * ne = e->clone();
ne->initId();
ne->setUpdateEnabled(false);
ne->setParent(this);
ne->setVisible(getFlag(RS2::FlagVisible));
- RS_DEBUG->print("RS_Insert::update: transforming entity");
+ DEBUG->print("Insert::update: transforming entity");
// Move:
- RS_DEBUG->print("RS_Insert::update: move 1");
+ DEBUG->print("Insert::update: move 1");
if (fabs(data.scaleFactor.x) > 1.0e-6 && fabs(data.scaleFactor.y) > 1.0e-6)
{
ne->move(data.insertionPoint + Vector(data.spacing.x / data.scaleFactor.x * c, data.spacing.y / data.scaleFactor.y * r));
}
// Move because of block base point:
- RS_DEBUG->print("RS_Insert::update: move 2");
+ DEBUG->print("Insert::update: move 2");
ne->move(blk->getBasePoint() * -1);
// Scale:
- RS_DEBUG->print("RS_Insert::update: scale");
+ DEBUG->print("Insert::update: scale");
ne->scale(data.insertionPoint, data.scaleFactor);
// Rotate:
- RS_DEBUG->print("RS_Insert::update: rotate");
+ DEBUG->print("Insert::update: rotate");
ne->rotate(data.insertionPoint, data.angle);
// Select:
ne->setSelected(isSelected());
tmpPen = ne->getPen(false);
// color from block (free floating):
- if (tmpPen.getColor() == RS_Color(RS2::FlagByBlock))
+ if (tmpPen.getColor() == Color(RS2::FlagByBlock))
tmpPen.setColor(getPen().getColor());
// line width from block (free floating):
if (data.updateMode != RS2::PreviewUpdate)
{
- RS_DEBUG->print("RS_Insert::update: updating new entity");
+ DEBUG->print("Insert::update: updating new entity");
ne->update();
}
- RS_DEBUG->print("RS_Insert::update: adding new entity");
+ DEBUG->print("Insert::update: adding new entity");
addEntity(ne);
}
}
calculateBorders();
- RS_DEBUG->print("RS_Insert::update: OK");
+ DEBUG->print("Insert::update: OK");
}
-QString RS_Insert::getName() const
+QString Insert::getName() const
{
return data.name;
}
-void RS_Insert::setName(const QString & newName)
+void Insert::setName(const QString & newName)
{
data.name = newName;
update();
}
-Vector RS_Insert::getInsertionPoint() const
+Vector Insert::getInsertionPoint() const
{
return data.insertionPoint;
}
-void RS_Insert::setInsertionPoint(const Vector & i)
+void Insert::setInsertionPoint(const Vector & i)
{
data.insertionPoint = i;
}
-Vector RS_Insert::getScale() const
+Vector Insert::getScale() const
{
return data.scaleFactor;
}
-void RS_Insert::setScale(const Vector & s)
+void Insert::setScale(const Vector & s)
{
data.scaleFactor = s;
}
-double RS_Insert::getAngle() const
+double Insert::getAngle() const
{
return data.angle;
}
-void RS_Insert::setAngle(double a)
+void Insert::setAngle(double a)
{
data.angle = a;
}
-int RS_Insert::getCols() const
+int Insert::getCols() const
{
return data.cols;
}
-void RS_Insert::setCols(int c)
+void Insert::setCols(int c)
{
data.cols = c;
}
-int RS_Insert::getRows() const
+int Insert::getRows() const
{
return data.rows;
}
-void RS_Insert::setRows(int r)
+void Insert::setRows(int r)
{
data.rows = r;
}
-Vector RS_Insert::getSpacing() const
+Vector Insert::getSpacing() const
{
return data.spacing;
}
-void RS_Insert::setSpacing(const Vector & s)
+void Insert::setSpacing(const Vector & s)
{
data.spacing = s;
}
/**
- * Is this insert visible? (re-implementation from RS_Entity)
+ * Is this insert visible? (re-implementation from Entity)
*
* @return true Only if the entity and the block and the layer it is on
* are visible.
* The Block might also be NULL. In that case the block visiblity
* is ignored.
*/
-bool RS_Insert::isVisible()
+bool Insert::isVisible()
{
- RS_Block * blk = getBlockForInsert();
+ Block * blk = getBlockForInsert();
if (blk != NULL)
{
}
}
- return RS_Entity::isVisible();
+ return Entity::isVisible();
}
-VectorSolutions RS_Insert::getRefPoints()
+VectorSolutions Insert::getRefPoints()
{
VectorSolutions ret(data.insertionPoint);
return ret;
}
-Vector RS_Insert::getNearestRef(const Vector & coord, double * dist)
+Vector Insert::getNearestRef(const Vector & coord, double * dist)
{
return getRefPoints().getClosest(coord, dist);
}
-void RS_Insert::move(Vector offset)
+void Insert::move(Vector offset)
{
- RS_DEBUG->print("RS_Insert::move: offset: %f/%f",
+ DEBUG->print("Insert::move: offset: %f/%f",
offset.x, offset.y);
- RS_DEBUG->print("RS_Insert::move1: insertionPoint: %f/%f",
+ DEBUG->print("Insert::move1: insertionPoint: %f/%f",
data.insertionPoint.x, data.insertionPoint.y);
data.insertionPoint.move(offset);
- RS_DEBUG->print("RS_Insert::move2: insertionPoint: %f/%f",
+ DEBUG->print("Insert::move2: insertionPoint: %f/%f",
data.insertionPoint.x, data.insertionPoint.y);
update();
}
-void RS_Insert::rotate(Vector center, double angle)
+void Insert::rotate(Vector center, double angle)
{
- RS_DEBUG->print("RS_Insert::rotate1: insertionPoint: %f/%f "
+ DEBUG->print("Insert::rotate1: insertionPoint: %f/%f "
"/ center: %f/%f",
data.insertionPoint.x, data.insertionPoint.y,
center.x, center.y);
data.insertionPoint.rotate(center, angle);
- data.angle = RS_Math::correctAngle(data.angle + angle);
- RS_DEBUG->print("RS_Insert::rotate2: insertionPoint: %f/%f",
+ data.angle = Math::correctAngle(data.angle + angle);
+ DEBUG->print("Insert::rotate2: insertionPoint: %f/%f",
data.insertionPoint.x, data.insertionPoint.y);
update();
}
-void RS_Insert::scale(Vector center, Vector factor)
+void Insert::scale(Vector center, Vector factor)
{
- RS_DEBUG->print("RS_Insert::scale1: insertionPoint: %f/%f",
+ DEBUG->print("Insert::scale1: insertionPoint: %f/%f",
data.insertionPoint.x, data.insertionPoint.y);
data.insertionPoint.scale(center, factor);
data.scaleFactor.scale(Vector(0.0, 0.0), factor);
data.spacing.scale(Vector(0.0, 0.0), factor);
- RS_DEBUG->print("RS_Insert::scale2: insertionPoint: %f/%f",
+ DEBUG->print("Insert::scale2: insertionPoint: %f/%f",
data.insertionPoint.x, data.insertionPoint.y);
update();
}
-void RS_Insert::mirror(Vector axisPoint1, Vector axisPoint2)
+void Insert::mirror(Vector axisPoint1, Vector axisPoint2)
{
data.insertionPoint.mirror(axisPoint1, axisPoint2);
update();
}
-std::ostream & operator<<(std::ostream & os, const RS_Insert & i)
+std::ostream & operator<<(std::ostream & os, const Insert & i)
{
os << " Insert: " << i.getData() << std::endl;
return os;
/**
* Holds the data that defines an insert.
*/
-class RS_InsertData
+class InsertData
{
public:
/**
* Default constructor.
*/
- RS_InsertData() {}
+ InsertData() {}
/**
* @param name The name of the block used as an identifier.
* @param spacing Spacing between rows and cols.
* @param blockSource Source for the block to insert if other than parent.
* Normally blocks are requested from the entity's parent but the
- * block can also come from another resource. RS_Text uses that
+ * block can also come from another resource. Text uses that
* to share the blocks (letters) from a font.
* @param updateMode RS2::Update will update the insert entity instantly
* RS2::NoUpdate will not update the insert. You can update
* often the case since you might want to adjust attributes
* after creating an insert entity.
*/
- RS_InsertData(const QString & name, Vector insertionPoint, Vector scaleFactor,
- double angle, int cols, int rows, Vector spacing, RS_BlockList * blockSource = NULL,
+ InsertData(const QString & name, Vector insertionPoint, Vector scaleFactor,
+ double angle, int cols, int rows, Vector spacing, BlockList * blockSource = NULL,
RS2::UpdateMode updateMode = RS2::Update)
{
this->name = name;
this->updateMode = updateMode;
}
- friend class RS_Insert;
+ friend class Insert;
- friend std::ostream & operator<<(std::ostream & os, const RS_InsertData & d)
+ friend std::ostream & operator<<(std::ostream & os, const InsertData & d)
{
os << "(" << d.name.toLatin1().data() << ")";
return os;
double angle;
int cols, rows;
Vector spacing;
- RS_BlockList * blockSource;
+ BlockList * blockSource;
RS2::UpdateMode updateMode;
};
*
* @author Andrew Mustun
*/
-class RS_Insert: public RS_EntityContainer
+class Insert: public EntityContainer
{
public:
- RS_Insert(RS_EntityContainer * parent, const RS_InsertData & d);
- virtual ~RS_Insert();
+ Insert(EntityContainer * parent, const InsertData & d);
+ virtual ~Insert();
- virtual RS_Entity * clone();
+ virtual Entity * clone();
virtual RS2::EntityType rtti() const;
- RS_InsertData getData() const;
- virtual void reparent(RS_EntityContainer * parent);
+ InsertData getData() const;
+ virtual void reparent(EntityContainer * parent);
- RS_Block * getBlockForInsert();
+ Block * getBlockForInsert();
virtual void update();
QString getName() const;
virtual void scale(Vector center, Vector factor);
virtual void mirror(Vector axisPoint1, Vector axisPoint2);
- friend std::ostream & operator<<(std::ostream & os, const RS_Insert & i);
+ friend std::ostream & operator<<(std::ostream & os, const Insert & i);
protected:
- RS_InsertData data;
- RS_Block * block;
+ InsertData data;
+ Block * block;
};
#endif
/**
* Constructor.
*/
-RS_Layer::RS_Layer(const QString & name)
+Layer::Layer(const QString & name)
{
setName(name);
data.locked = false;
}
-RS_Layer * RS_Layer::clone()
+Layer * Layer::clone()
{
- return new RS_Layer(*this);
+ return new Layer(*this);
}
/** sets a new name for this layer. */
-void RS_Layer::setName(const QString & name)
+void Layer::setName(const QString & name)
{
data.name = name;
}
/** @return the name of this layer. */
-QString RS_Layer::getName() const
+QString Layer::getName() const
{
return data.name;
}
/** sets the default pen for this layer. */
-void RS_Layer::setPen(const RS_Pen & pen)
+void Layer::setPen(const Pen & pen)
{
data.pen = pen;
}
/** @return default pen for this layer. */
-RS_Pen RS_Layer::getPen() const
+Pen Layer::getPen() const
{
return data.pen;
}
* @retval true if this layer is frozen (invisible)
* @retval false if this layer isn't frozen (visible)
*/
-bool RS_Layer::isFrozen() const
+bool Layer::isFrozen() const
{
return data.frozen;
//getFlag(RS2::FlagFrozen);
* @retval true the layer has been converted already
* @retval false the layer still needs to be converted
*/
-bool RS_Layer::isConverted() const
+bool Layer::isConverted() const
{
return data.converted;
}
/**
* Sets the converted flag
*/
-void RS_Layer::setConverted(bool c)
+void Layer::setConverted(bool c)
{
data.converted = c;
}
* Toggles the visibility of this layer.
* Freezes the layer if it's not frozen, thaws the layer otherwise
*/
-void RS_Layer::toggle()
+void Layer::toggle()
{
//toggleFlag(RS2::FlagFrozen);
data.frozen = !data.frozen;
*
* @param freeze true: freeze, false: defreeze
*/
-void RS_Layer::freeze(bool freeze)
+void Layer::freeze(bool freeze)
{
data.frozen = freeze;
/*if (freeze) {
/**
* Toggles the lock of this layer.
*/
-void RS_Layer::toggleLock()
+void Layer::toggleLock()
{
//toggleFlag(RS2::FlagFrozen);
data.locked = !data.locked;
*
* @param l true: lock, false: unlock
*/
-void RS_Layer::lock(bool l)
+void Layer::lock(bool l)
{
data.locked = l;
}
/**
* return the LOCK state of the Layer
*/
-bool RS_Layer::isLocked()
+bool Layer::isLocked()
{
return data.locked;
}
* Copies all attributes (pen) and the name of the layer.
*/
/*
-RS_Layer & RS_Layer::operator=(const RS_Layer & l)
+Layer & Layer::operator=(const Layer & l)
{
setName(l.getName());
setPen(l.getPen());
/**
* Dumps the layers data to stdout.
*/
-std::ostream & operator<<(std::ostream & os, const RS_Layer & l)
+std::ostream & operator<<(std::ostream & os, const Layer & l)
{
os << " name: " << l.getName().toLatin1().data()
<< " pen: " << l.getPen()
/**
* Holds the data that defines a layer.
*/
-class RS_LayerData
+class LayerData
{
public:
- RS_LayerData() {}
+ LayerData() {}
- RS_LayerData(const QString & name, const RS_Pen & pen, bool frozen, bool locked)
+ LayerData(const QString & name, const Pen & pen, bool frozen, bool locked)
{
this->name = name;
this->pen = pen;
QString name;
//! default pen for this layer
- RS_Pen pen;
+ Pen pen;
//! Frozen flag
bool frozen;
*
* @author Andrew Mustun
*/
-class RS_Layer
+class Layer
{
public:
- explicit RS_Layer(const QString & name);
- //RS_Layer(const char* name);
+ explicit Layer(const QString & name);
+ //Layer(const char* name);
- RS_Layer * clone();
+ Layer * clone();
void setName(const QString & name);
QString getName() const;
- void setPen(const RS_Pen & pen);
- RS_Pen getPen() const;
+ void setPen(const Pen & pen);
+ Pen getPen() const;
bool isFrozen() const;
bool isConverted() const;
void setConverted(bool c);
void toggleLock();
void lock(bool l);
bool isLocked();
- //RS_Layer & operator=(const RS_Layer & l);
+ //Layer & operator=(const Layer & l);
- friend std::ostream & operator<<(std::ostream & os, const RS_Layer & l);
+ friend std::ostream & operator<<(std::ostream & os, const Layer & l);
- //friend class RS_LayerList;
+ //friend class LayerList;
private:
//! Layer data
- RS_LayerData data;
+ LayerData data;
};
#endif
/**
* Default constructor.
*/
-RS_LayerList::RS_LayerList()
+LayerList::LayerList()
{
// Good news, we don't have to screw with this shit
// layers.setAutoDelete(false);
setModified(false);
}
-/*virtual*/ RS_LayerList::~RS_LayerList()
+/*virtual*/ LayerList::~LayerList()
{
}
/**
* Removes all layers in the layerlist.
*/
-void RS_LayerList::clear()
+void LayerList::clear()
{
layers.clear();
setModified(true);
/**
* @return Number of layers in the list.
*/
-uint RS_LayerList::count() const
+uint LayerList::count() const
{
return layers.count();
}
/**
* @return Layer at given position or NULL if i is out of range.
*/
-RS_Layer * RS_LayerList::at(uint i)
+Layer * LayerList::at(uint i)
{
return layers.at(i);
}
*
* @param notify Notify listeners.
*/
-void RS_LayerList::activate(const QString & name, bool notify)
+void LayerList::activate(const QString & name, bool notify)
{
- RS_DEBUG->print("RS_LayerList::activate: %s, notify: %d begin", name.toLatin1().data(), notify);
+ DEBUG->print("LayerList::activate: %s, notify: %d begin", name.toLatin1().data(), notify);
activate(find(name), notify);
/*
if (activeLayer==NULL) {
- RS_DEBUG->print("activeLayer is NULL");
+ DEBUG->print("activeLayer is NULL");
} else {
- RS_DEBUG->print("activeLayer is %s", activeLayer->getName().latin1());
+ DEBUG->print("activeLayer is %s", activeLayer->getName().latin1());
}
*/
- RS_DEBUG->print("RS_LayerList::activate: %s end", name.toLatin1().data());
+ DEBUG->print("LayerList::activate: %s end", name.toLatin1().data());
}
/**
*
* @param notify Notify listeners.
*/
-void RS_LayerList::activate(RS_Layer * layer, bool notify)
+void LayerList::activate(Layer * layer, bool notify)
{
- RS_DEBUG->print("RS_LayerList::activate notify: %d begin", notify);
+ DEBUG->print("LayerList::activate notify: %d begin", notify);
/*if (layer!=NULL) {
- RS_DEBUG->print("RS_LayerList::activate: %s",
+ DEBUG->print("LayerList::activate: %s",
layer->getName().latin1());
} else {
- RS_DEBUG->print("RS_LayerList::activate: NULL");
+ DEBUG->print("LayerList::activate: NULL");
}*/
activeLayer = layer;
{
for(int i=0; i<layerListListeners.count(); ++i)
{
- RS_LayerListListener * l = layerListListeners.at(i);
+ LayerListListener * l = layerListListeners.at(i);
l->layerActivated(activeLayer);
- RS_DEBUG->print("RS_LayerList::activate listener notified");
+ DEBUG->print("LayerList::activate listener notified");
}
}
#endif
- RS_DEBUG->print("RS_LayerList::activate end");
+ DEBUG->print("LayerList::activate end");
}
//! @return The active layer of NULL if no layer is activated.
-RS_Layer * RS_LayerList::getActive()
+Layer * LayerList::getActive()
{
return activeLayer;
}
*
* Listeners are notified.
*/
-void RS_LayerList::add(RS_Layer * layer)
+void LayerList::add(Layer * layer)
{
- RS_DEBUG->print("RS_LayerList::addLayer()");
+ DEBUG->print("LayerList::addLayer()");
if (layer == NULL)
return;
// check if layer already exists:
- RS_Layer * l = find(layer->getName());
+ Layer * l = find(layer->getName());
if (l == NULL)
{
// notify listeners
for(int i=0; i<layerListListeners.count(); ++i)
{
- RS_LayerListListener * l = layerListListeners.at(i);
+ LayerListListener * l = layerListListeners.at(i);
l->layerAdded(layer);
}
#endif
* Listeners are notified after the layer was removed from
* the list but before it gets deleted.
*/
-void RS_LayerList::remove(RS_Layer * layer)
+void LayerList::remove(Layer * layer)
{
- RS_DEBUG->print("RS_LayerList::removeLayer()");
+ DEBUG->print("LayerList::removeLayer()");
if (layer == NULL)
return;
#if 0
for(int i=0; i<layerListListeners.count(); ++i)
{
- RS_LayerListListener * l = layerListListeners.at(i);
+ LayerListListener * l = layerListListeners.at(i);
l->layerRemoved(layer);
}
#endif
* are copied from layer 'source'.
* Listeners are notified.
*/
-void RS_LayerList::edit(RS_Layer * layer, const RS_Layer & source)
+void LayerList::edit(Layer * layer, const Layer & source)
{
if (!layer)
return;
#if 0
for(int i=0; i<layerListListeners.count(); ++i)
{
- RS_LayerListListener * l = layerListListeners.at(i);
+ LayerListListener * l = layerListListeners.at(i);
l->layerEdited(layer);
}
#endif
* @return Pointer to the layer with the given name or
* \p NULL if no such layer was found.
*/
-RS_Layer * RS_LayerList::find(const QString & name)
+Layer * LayerList::find(const QString & name)
{
- //RS_DEBUG->print("RS_LayerList::find begin");
+ //DEBUG->print("LayerList::find begin");
- RS_Layer * ret = NULL;
+ Layer * ret = NULL;
for(int i=0; i<layers.size(); i++)
{
- RS_Layer * l = layers[i];
+ Layer * l = layers[i];
if (l->getName() == name)
ret = l;
}
- //RS_DEBUG->print("RS_LayerList::find end");
+ //DEBUG->print("LayerList::find end");
return ret;
}
* @return Index of the given layer in the layer list or -1 if the layer
* was not found.
*/
-int RS_LayerList::getIndex(const QString & name)
+int LayerList::getIndex(const QString & name)
{
#if 0
- //RS_DEBUG->print("RS_LayerList::find begin");
+ //DEBUG->print("LayerList::find begin");
int ret = -1;
int i = 0;
- for(RS_Layer * l=layers.first(); l!=NULL; l=layers.next())
+ for(Layer * l=layers.first(); l!=NULL; l=layers.next())
{
if (l->getName() == name)
{
i++;
}
- //RS_DEBUG->print("RS_LayerList::find end");
+ //DEBUG->print("LayerList::find end");
return ret;
#else
for(int i=0; i<layers.size(); i++)
{
- RS_Layer * l = layers[i];
+ Layer * l = layers[i];
if (l->getName() == name)
return i;
* @return Index of the given layer in the layer list or -1 if the layer
* was not found.
*/
-int RS_LayerList::getIndex(RS_Layer * layer)
+int LayerList::getIndex(Layer * layer)
{
#if 0
- //RS_DEBUG->print("RS_LayerList::find begin");
+ //DEBUG->print("LayerList::find begin");
int ret = -1;
int i = 0;
- for(RS_Layer* l=layers.first(); l!=NULL; l=layers.next())
+ for(Layer* l=layers.first(); l!=NULL; l=layers.next())
{
if (l == layer)
{
i++;
}
- //RS_DEBUG->print("RS_LayerList::find end");
+ //DEBUG->print("LayerList::find end");
return ret;
#else
* Switches on / off the given layer.
* Listeners are notified.
*/
-void RS_LayerList::toggle(const QString & name)
+void LayerList::toggle(const QString & name)
{
toggle(find(name));
}
* Switches on / off the given layer.
* Listeners are notified.
*/
-void RS_LayerList::toggle(RS_Layer * layer)
+void LayerList::toggle(Layer * layer)
{
if (!layer)
return;
// Notify listeners:
for(int i=0; i < layerListListeners.count(); ++i)
{
- RS_LayerListListener * l = layerListListeners.at(i);
+ LayerListListener * l = layerListListeners.at(i);
l->layerToggled(layer);
}
#endif
* Locks or unlocks the given layer.
* Listeners are notified.
*/
-void RS_LayerList::toggleLock(RS_Layer * layer)
+void LayerList::toggleLock(Layer * layer)
{
if (!layer)
return;
// Notify listeners:
for(int i=0; i<layerListListeners.count(); ++i)
{
- RS_LayerListListener * l = layerListListeners.at(i);
+ LayerListListener * l = layerListListeners.at(i);
l->layerToggled(layer);
}
#endif
*
* @param freeze true: freeze, false: defreeze
*/
-void RS_LayerList::freezeAll(bool freeze)
+void LayerList::freezeAll(bool freeze)
{
for(uint l=0; l<count(); l++)
at(l)->freeze(freeze);
#if 0
for(int i=0; i<layerListListeners.count(); ++i)
{
- RS_LayerListListener * l = layerListListeners.at(i);
+ LayerListListener * l = layerListListeners.at(i);
l->layerToggled(NULL);
}
#endif
*
* Typical listeners are: layer list widgets, pen toolbar, graphic view
*/
-void RS_LayerList::addListener(RS_LayerListListener * listener)
+void LayerList::addListener(LayerListListener * listener)
{
layerListListeners.append(listener);
}
/**
* removes a LayerListListener from the list of listeners.
*/
-void RS_LayerList::removeListener(RS_LayerListListener * listener)
+void LayerList::removeListener(LayerListListener * listener)
{
// layerListListeners.remove(listener);
/**
* Sets the layer lists modified status to 'm'.
*/
-void RS_LayerList::setModified(bool m)
+void LayerList::setModified(bool m)
{
modified = m;
}
* @retval true The layer list has been modified.
* @retval false The layer list has not been modified.
*/
-/*virtual*/ bool RS_LayerList::isModified() const
+/*virtual*/ bool LayerList::isModified() const
{
return modified;
}
/**
* Dumps the layers to stdout.
*/
-std::ostream & operator<<(std::ostream & os, RS_LayerList & l)
+std::ostream & operator<<(std::ostream & os, LayerList & l)
{
os << "Layerlist: \n";
#include <iostream>
#include <QtCore>
-class RS_Layer;
-//class RS_LayerListListener;
+class Layer;
+//class LayerListListener;
/**
* A list of layers.
*
* @author Andrew Mustun
*/
-class RS_LayerList
+class LayerList
{
public:
- RS_LayerList();
- virtual ~RS_LayerList();
+ LayerList();
+ virtual ~LayerList();
void clear();
uint count() const;
- RS_Layer * at(uint i);
+ Layer * at(uint i);
void activate(const QString & name, bool notify = false);
- void activate(RS_Layer * layer, bool notify = false);
- RS_Layer * getActive();
- virtual void add(RS_Layer * layer);
- virtual void remove(RS_Layer * layer);
- virtual void edit(RS_Layer * layer, const RS_Layer & source);
- RS_Layer * find(const QString & name);
+ void activate(Layer * layer, bool notify = false);
+ Layer * getActive();
+ virtual void add(Layer * layer);
+ virtual void remove(Layer * layer);
+ virtual void edit(Layer * layer, const Layer & source);
+ Layer * find(const QString & name);
int getIndex(const QString & name);
- int getIndex(RS_Layer * layer);
+ int getIndex(Layer * layer);
void toggle(const QString & name);
- void toggle(RS_Layer * layer);
- void toggleLock(RS_Layer * layer);
+ void toggle(Layer * layer);
+ void toggleLock(Layer * layer);
void freezeAll(bool freeze);
-// void addListener(RS_LayerListListener * listener);
-// void removeListener(RS_LayerListListener * listener);
+// void addListener(LayerListListener * listener);
+// void removeListener(LayerListListener * listener);
void setModified(bool m);
virtual bool isModified() const;
- friend std::ostream & operator<<(std::ostream & os, RS_LayerList & l);
+ friend std::ostream & operator<<(std::ostream & os, LayerList & l);
private:
//! layers in the graphic
- QList<RS_Layer *> layers;
+ QList<Layer *> layers;
//! List of registered LayerListListeners
-// QList<RS_LayerListListener *> layerListListeners;
+// QList<LayerListListener *> layerListListeners;
//! Currently active layer
- RS_Layer * activeLayer;
+ Layer * activeLayer;
/** Flag set if the layer list was modified and not yet saved. */
bool modified;
};
/**
* Constructor.
*/
-RS_Leader::RS_Leader(RS_EntityContainer * parent): RS_EntityContainer(parent)
+Leader::Leader(EntityContainer * parent): EntityContainer(parent)
{
empty = true;
}
* Constructor.
* @param d Leader data
*/
-RS_Leader::RS_Leader(RS_EntityContainer * parent, const RS_LeaderData & d):
- RS_EntityContainer(parent), data(d)
+Leader::Leader(EntityContainer * parent, const LeaderData & d):
+ EntityContainer(parent), data(d)
{
empty = true;
}
/**
* Destructor
*/
-RS_Leader::~RS_Leader()
+Leader::~Leader()
{
}
-/*virtual*/ RS_Entity * RS_Leader::clone()
+/*virtual*/ Entity * Leader::clone()
{
- RS_Leader * p = new RS_Leader(*this);
+ Leader * p = new Leader(*this);
#warning "!!! Need to deal with setAutoDelete() Qt3->Qt4 !!!"
// p->entities.setAutoDelete(entities.autoDelete());
p->initId();
}
/** @return RS2::EntityDimLeader */
-/*virtual*/ RS2::EntityType RS_Leader::rtti() const
+/*virtual*/ RS2::EntityType Leader::rtti() const
{
return RS2::EntityDimLeader;
}
/**
* Implementation of update. Updates the arrow.
*/
-void RS_Leader::update()
+void Leader::update()
{
// find and delete arrow:
- for(RS_Entity * e=firstEntity(); e!=NULL; e=nextEntity())
+ for(Entity * e=firstEntity(); e!=NULL; e=nextEntity())
{
if (e->rtti() == RS2::EntitySolid)
{
return;
}
- RS_Entity * fe = firstEntity();
+ Entity * fe = firstEntity();
if (fe != NULL && fe->isAtomic())
{
- Vector p1 = ((RS_AtomicEntity *)fe)->getStartpoint();
- Vector p2 = ((RS_AtomicEntity *)fe)->getEndpoint();
+ Vector p1 = ((AtomicEntity *)fe)->getStartpoint();
+ Vector p2 = ((AtomicEntity *)fe)->getEndpoint();
// first entity must be the line which gets the arrow:
if (hasArrowHead())
{
- RS_Solid * s = new RS_Solid(this, RS_SolidData());
+ Solid * s = new Solid(this, SolidData());
s->shapeArrow(p1, p2.angleTo(p1), getGraphicVariableDouble("$DIMASZ", 2.5));
- s->setPen(RS_Pen(RS2::FlagInvalid));
+ s->setPen(Pen(RS2::FlagInvalid));
s->setLayer(NULL);
- RS_EntityContainer::addEntity(s);
+ EntityContainer::addEntity(s);
}
}
}
/** @return Copy of data that defines the leader. */
-RS_LeaderData RS_Leader::getData() const
+LeaderData Leader::getData() const
{
return data;
}
/** @return true: if this leader has an arrow at the beginning. */
-bool RS_Leader::hasArrowHead()
+bool Leader::hasArrowHead()
{
return data.arrowHead;
}
* @return Pointer to the entity that was addded or NULL if this
* was the first vertex added.
*/
-RS_Entity * RS_Leader::addVertex(const Vector & v)
+Entity * Leader::addVertex(const Vector & v)
{
- RS_Entity * entity = NULL;
+ Entity * entity = NULL;
static Vector last = Vector(false);
if (empty)
else
{
// add line to the leader:
- entity = new RS_Line(this, RS_LineData(last, v));
- entity->setPen(RS_Pen(RS2::FlagInvalid));
+ entity = new Line(this, LineData(last, v));
+ entity->setPen(Pen(RS2::FlagInvalid));
entity->setLayer(NULL);
- RS_EntityContainer::addEntity(entity);
+ EntityContainer::addEntity(entity);
if (count() == 1 && hasArrowHead())
update();
*
* To add entities use addVertex() instead.
*/
-void RS_Leader::addEntity(RS_Entity * entity)
+void Leader::addEntity(Entity * entity)
{
- RS_DEBUG->print(RS_Debug::D_WARNING, "RS_Leader::addEntity: should never be called");
+ DEBUG->print(Debug::D_WARNING, "Leader::addEntity: should never be called");
if (entity == NULL)
return;
delete entity;
}
-/*virtual*/ double RS_Leader::getLength()
+/*virtual*/ double Leader::getLength()
{
return -1.0;
}
-void RS_Leader::move(Vector offset)
+void Leader::move(Vector offset)
{
- RS_EntityContainer::move(offset);
+ EntityContainer::move(offset);
update();
}
-void RS_Leader::rotate(Vector center, double angle)
+void Leader::rotate(Vector center, double angle)
{
- RS_EntityContainer::rotate(center, angle);
+ EntityContainer::rotate(center, angle);
update();
}
-void RS_Leader::scale(Vector center, Vector factor)
+void Leader::scale(Vector center, Vector factor)
{
- RS_EntityContainer::scale(center, factor);
+ EntityContainer::scale(center, factor);
update();
}
-void RS_Leader::mirror(Vector axisPoint1, Vector axisPoint2)
+void Leader::mirror(Vector axisPoint1, Vector axisPoint2)
{
- RS_EntityContainer::mirror(axisPoint1, axisPoint2);
+ EntityContainer::mirror(axisPoint1, axisPoint2);
update();
}
-void RS_Leader::stretch(Vector firstCorner, Vector secondCorner, Vector offset)
+void Leader::stretch(Vector firstCorner, Vector secondCorner, Vector offset)
{
- RS_EntityContainer::stretch(firstCorner, secondCorner, offset);
+ EntityContainer::stretch(firstCorner, secondCorner, offset);
update();
}
/**
* Dumps the leader's data to stdout.
*/
-std::ostream & operator<<(std::ostream & os, const RS_Leader & l)
+std::ostream & operator<<(std::ostream & os, const Leader & l)
{
os << " Leader: " << l.getData() << " {\n";
- os << (RS_EntityContainer &)l;
+ os << (EntityContainer &)l;
os << "\n}\n";
return os;
/**
* Holds the data that defines a leader.
*/
-class RS_LeaderData
+class LeaderData
{
public:
- RS_LeaderData() {}
- RS_LeaderData(bool arrowHeadFlag)
+ LeaderData() {}
+ LeaderData(bool arrowHeadFlag)
{
arrowHead = arrowHeadFlag;
}
- friend std::ostream & operator<<(std::ostream & os, const RS_LeaderData & /*ld*/)
+ friend std::ostream & operator<<(std::ostream & os, const LeaderData & /*ld*/)
{
os << "(Leader)";
return os;
*
* @author Andrew Mustun
*/
-class RS_Leader: public RS_EntityContainer
+class Leader: public EntityContainer
{
public:
- RS_Leader(RS_EntityContainer * parent = NULL);
- RS_Leader(RS_EntityContainer * parent, const RS_LeaderData & d);
- virtual ~RS_Leader();
+ Leader(EntityContainer * parent = NULL);
+ Leader(EntityContainer * parent, const LeaderData & d);
+ virtual ~Leader();
- virtual RS_Entity * clone();
+ virtual Entity * clone();
virtual RS2::EntityType rtti() const;
virtual void update();
- RS_LeaderData getData() const;
+ LeaderData getData() const;
bool hasArrowHead();
- virtual RS_Entity * addVertex(const Vector & v);
- virtual void addEntity(RS_Entity * entity);
+ virtual Entity * addVertex(const Vector & v);
+ virtual void addEntity(Entity * entity);
virtual double getLength();
virtual void move(Vector offset);
virtual void rotate(Vector center, double angle);
virtual void mirror(Vector axisPoint1, Vector axisPoint2);
virtual void stretch(Vector firstCorner, Vector secondCorner, Vector offset);
- friend std::ostream & operator<<(std::ostream & os, const RS_Leader & l);
+ friend std::ostream & operator<<(std::ostream & os, const Leader & l);
protected:
- RS_LeaderData data;
+ LeaderData data;
bool empty;
};
/**
* Constructor.
*/
-RS_Line::RS_Line(RS_EntityContainer * parent, const RS_LineData & d):
- RS_AtomicEntity(parent), data(d)
+Line::Line(EntityContainer * parent, const LineData & d):
+ AtomicEntity(parent), data(d)
{
calculateBorders();
}
/**
* Destructor.
*/
-RS_Line::~RS_Line()
+Line::~Line()
{
}
-RS_Entity * RS_Line::clone()
+Entity * Line::clone()
{
- RS_Line * l = new RS_Line(*this);
+ Line * l = new Line(*this);
l->initId();
return l;
}
-void RS_Line::calculateBorders()
+void Line::calculateBorders()
{
minV = Vector::minimum(data.startpoint, data.endpoint);
maxV = Vector::maximum(data.startpoint, data.endpoint);
}
/** @return RS2::EntityLine */
-RS2::EntityType RS_Line::rtti() const
+RS2::EntityType Line::rtti() const
{
return RS2::EntityLine;
}
/** @return true */
-bool RS_Line::isEdge() const
+bool Line::isEdge() const
{
return true;
}
/** @return Copy of data that defines the line. */
-RS_LineData RS_Line::getData() const
+LineData Line::getData() const
{
return data;
}
-VectorSolutions RS_Line::getRefPoints()
+VectorSolutions Line::getRefPoints()
{
VectorSolutions ret(data.startpoint, data.endpoint);
return ret;
}
/** @return Start point of the entity */
-Vector RS_Line::getStartpoint() const
+Vector Line::getStartpoint() const
{
return data.startpoint;
}
/** @return End point of the entity */
-Vector RS_Line::getEndpoint() const
+Vector Line::getEndpoint() const
{
return data.endpoint;
}
/** Sets the startpoint */
-void RS_Line::setStartpoint(Vector s)
+void Line::setStartpoint(Vector s)
{
data.startpoint = s;
calculateBorders();
}
/** Sets the endpoint */
-void RS_Line::setEndpoint(Vector e)
+void Line::setEndpoint(Vector e)
{
data.endpoint = e;
calculateBorders();
* @return Direction 1. The angle at which the line starts at
* the startpoint.
*/
-double RS_Line::getDirection1() const
+double Line::getDirection1() const
{
return getAngle1();
}
* @return Direction 2. The angle at which the line starts at
* the endpoint.
*/
-double RS_Line::getDirection2() const
+double Line::getDirection2() const
{
return getAngle2();
}
-Vector RS_Line::getNearestEndpoint(const Vector & coord, double * dist)
+Vector Line::getNearestEndpoint(const Vector & coord, double * dist)
{
double dist1, dist2;
Vector * nearerPoint;
return *nearerPoint;
}
-Vector RS_Line::getNearestPointOnEntity(const Vector & coord,
- bool onEntity, double * dist, RS_Entity ** entity)
+Vector Line::getNearestPointOnEntity(const Vector & coord,
+ bool onEntity, double * dist, Entity ** entity)
{
if (entity != NULL)
*entity = this;
}
}
-Vector RS_Line::getNearestCenter(const Vector & coord, double * dist)
+Vector Line::getNearestCenter(const Vector & coord, double * dist)
{
Vector p = (data.startpoint + data.endpoint) / 2.0;
return p;
}
-Vector RS_Line::getNearestMiddle(const Vector & coord, double * dist)
+Vector Line::getNearestMiddle(const Vector & coord, double * dist)
{
return getNearestCenter(coord, dist);
}
-Vector RS_Line::getNearestDist(double distance, const Vector & coord, double * dist)
+Vector Line::getNearestDist(double distance, const Vector & coord, double * dist)
{
double a1 = getAngle1();
return *nearerPoint;
}
-Vector RS_Line::getNearestDist(double distance, bool startp)
+Vector Line::getNearestDist(double distance, bool startp)
{
double a1 = getAngle1();
return ret;
}
-/*Vector RS_Line::getNearestRef(const Vector& coord, double* dist)
+/*Vector Line::getNearestRef(const Vector& coord, double* dist)
{
double d1, d2, d;
Vector p;
return p;
}*/
-double RS_Line::getDistanceToPoint(const Vector & coord, RS_Entity ** entity,
+double Line::getDistanceToPoint(const Vector & coord, Entity ** entity,
RS2::ResolveLevel /*level*/, double /*solidDist*/)
{
- RS_DEBUG->print("RS_Line::getDistanceToPoint");
+ DEBUG->print("Line::getDistanceToPoint");
if (entity != NULL)
*entity = this;
if (dist < 1.0e-4)
{
- RS_DEBUG->print("RS_Line::getDistanceToPoint: OK1");
+ DEBUG->print("Line::getDistanceToPoint: OK1");
return dist;
}
if (dist < 1.0e-4)
{
- RS_DEBUG->print("RS_Line::getDistanceToPoint: OK2");
+ DEBUG->print("Line::getDistanceToPoint: OK2");
return dist;
}
if (ae.magnitude() < 1.0e-6 || ea.magnitude() < 1.0e-6)
{
- RS_DEBUG->print("RS_Line::getDistanceToPoint: OK2a");
+ DEBUG->print("Line::getDistanceToPoint: OK2a");
return dist;
}
// Orthogonal projection from both sides:
- Vector ba = ae * Vector::dotP(ae, ap) / RS_Math::pow(ae.magnitude(), 2);
- Vector be = ea * Vector::dotP(ea, ep) / RS_Math::pow(ea.magnitude(), 2);
+ Vector ba = ae * Vector::dotP(ae, ap) / Math::pow(ae.magnitude(), 2);
+ Vector be = ea * Vector::dotP(ea, ep) / Math::pow(ea.magnitude(), 2);
// Check if the projection is outside this line:
if (ba.magnitude() > ae.magnitude() || be.magnitude() > ea.magnitude())
{
// return distance to endpoint
getNearestEndpoint(coord, &dist);
- RS_DEBUG->print("RS_Line::getDistanceToPoint: OK3");
+ DEBUG->print("Line::getDistanceToPoint: OK3");
return dist;
}
- //RS_DEBUG->print("ba: %f", ba.magnitude());
- //RS_DEBUG->print("ae: %f", ae.magnitude());
+ //DEBUG->print("ba: %f", ba.magnitude());
+ //DEBUG->print("ae: %f", ae.magnitude());
Vector cp = Vector::crossP(ap, ae);
dist = cp.magnitude() / ae.magnitude();
- RS_DEBUG->print("RS_Line::getDistanceToPoint: OK4");
+ DEBUG->print("Line::getDistanceToPoint: OK4");
return dist;
}
-void RS_Line::moveStartpoint(const Vector & pos)
+void Line::moveStartpoint(const Vector & pos)
{
data.startpoint = pos;
calculateBorders();
}
-void RS_Line::moveEndpoint(const Vector & pos)
+void Line::moveEndpoint(const Vector & pos)
{
data.endpoint = pos;
calculateBorders();
}
-RS2::Ending RS_Line::getTrimPoint(const Vector & coord, const Vector & trimPoint)
+RS2::Ending Line::getTrimPoint(const Vector & coord, const Vector & trimPoint)
{
double angEl = getAngle1();
double angM = trimPoint.angleTo(coord);
return RS2::EndingEnd;
}
-void RS_Line::reverse()
+void Line::reverse()
{
Vector v = data.startpoint;
data.startpoint = data.endpoint;
}
/** @return the center point of the line. */
-Vector RS_Line::getMiddlepoint()
+Vector Line::getMiddlepoint()
{
return (data.startpoint + data.endpoint) / 2.0;
}
/** Sets the y coordinate of the startpoint */
-void RS_Line::setStartpointY(double val)
+void Line::setStartpointY(double val)
{
data.startpoint.y = val;
calculateBorders();
}
/** Sets the y coordinate of the endpoint */
-void RS_Line::setEndpointY(double val)
+void Line::setEndpointY(double val)
{
data.endpoint.y = val;
calculateBorders();
/**
* @return The length of the line.
*/
-double RS_Line::getLength()
+double Line::getLength()
{
return data.startpoint.distanceTo(data.endpoint);
}
/**
* @return The angle of the line (from start to endpoint).
*/
-double RS_Line::getAngle1() const
+double Line::getAngle1() const
{
return data.startpoint.angleTo(data.endpoint);
}
/**
* @return The angle of the line (from end to startpoint).
*/
-double RS_Line::getAngle2() const
+double Line::getAngle2() const
{
return data.endpoint.angleTo(data.startpoint);
}
-bool RS_Line::hasEndpointsWithinWindow(Vector v1, Vector v2)
+bool Line::hasEndpointsWithinWindow(Vector v1, Vector v2)
{
if (data.startpoint.isInWindow(v1, v2) || data.endpoint.isInWindow(v1, v2))
return true;
return false;
}
-void RS_Line::move(Vector offset)
+void Line::move(Vector offset)
{
- RS_DEBUG->print("RS_Line::move1: sp: %f/%f, ep: %f/%f",
+ DEBUG->print("Line::move1: sp: %f/%f, ep: %f/%f",
data.startpoint.x, data.startpoint.y, data.endpoint.x, data.endpoint.y);
- RS_DEBUG->print("RS_Line::move1: offset: %f/%f", offset.x, offset.y);
+ DEBUG->print("Line::move1: offset: %f/%f", offset.x, offset.y);
data.startpoint.move(offset);
data.endpoint.move(offset);
calculateBorders();
- RS_DEBUG->print("RS_Line::move2: sp: %f/%f, ep: %f/%f",
+ DEBUG->print("Line::move2: sp: %f/%f, ep: %f/%f",
data.startpoint.x, data.startpoint.y, data.endpoint.x, data.endpoint.y);
}
-void RS_Line::rotate(Vector center, double angle)
+void Line::rotate(Vector center, double angle)
{
- RS_DEBUG->print("RS_Line::rotate");
- RS_DEBUG->print("RS_Line::rotate1: sp: %f/%f, ep: %f/%f",
+ DEBUG->print("Line::rotate");
+ DEBUG->print("Line::rotate1: sp: %f/%f, ep: %f/%f",
data.startpoint.x, data.startpoint.y, data.endpoint.x, data.endpoint.y);
data.startpoint.rotate(center, angle);
data.endpoint.rotate(center, angle);
- RS_DEBUG->print("RS_Line::rotate2: sp: %f/%f, ep: %f/%f",
+ DEBUG->print("Line::rotate2: sp: %f/%f, ep: %f/%f",
data.startpoint.x, data.startpoint.y, data.endpoint.x, data.endpoint.y);
calculateBorders();
- RS_DEBUG->print("RS_Line::rotate: OK");
+ DEBUG->print("Line::rotate: OK");
}
-void RS_Line::scale(Vector center, Vector factor)
+void Line::scale(Vector center, Vector factor)
{
- RS_DEBUG->print("RS_Line::scale1: sp: %f/%f, ep: %f/%f",
+ DEBUG->print("Line::scale1: sp: %f/%f, ep: %f/%f",
data.startpoint.x, data.startpoint.y, data.endpoint.x, data.endpoint.y);
data.startpoint.scale(center, factor);
data.endpoint.scale(center, factor);
- RS_DEBUG->print("RS_Line::scale2: sp: %f/%f, ep: %f/%f",
+ DEBUG->print("Line::scale2: sp: %f/%f, ep: %f/%f",
data.startpoint.x, data.startpoint.y, data.endpoint.x, data.endpoint.y);
calculateBorders();
}
-void RS_Line::mirror(Vector axisPoint1, Vector axisPoint2)
+void Line::mirror(Vector axisPoint1, Vector axisPoint2)
{
data.startpoint.mirror(axisPoint1, axisPoint2);
data.endpoint.mirror(axisPoint1, axisPoint2);
/**
* Stretches the given range of the entity by the given offset.
*/
-void RS_Line::stretch(Vector firstCorner, Vector secondCorner, Vector offset)
+void Line::stretch(Vector firstCorner, Vector secondCorner, Vector offset)
{
if (getStartpoint().isInWindow(firstCorner, secondCorner))
moveStartpoint(getStartpoint() + offset);
moveEndpoint(getEndpoint() + offset);
}
-void RS_Line::moveRef(const Vector& ref, const Vector& offset)
+void Line::moveRef(const Vector& ref, const Vector& offset)
{
if (ref.distanceTo(data.startpoint)<1.0e-4) {
moveStartpoint(data.startpoint+offset);
}
}
-void RS_Line::draw(PaintInterface * painter, GraphicView * view, double patternOffset)
+void Line::draw(PaintInterface * painter, GraphicView * view, double patternOffset)
{
if (!painter || !view)
//{
-//printf("RS_Line::draw(): Bailing out!!! painter=%08X, view=%08X\n", painter, view);
+//printf("Line::draw(): Bailing out!!! painter=%08X, view=%08X\n", painter, view);
return;
//}
|| view->getDrawingMode() == RS2::ModePreview
|| styleFactor < 0.0)
{
-//printf("RS_Line::draw(): Drawing line...\n");
+//printf("Line::draw(): Drawing line...\n");
painter->drawLine(view->toGui(getStartpoint()), view->toGui(getEndpoint()));
return;
}
// Pattern:
#if 0
- RS_LineTypePattern * pat;
+ LineTypePattern * pat;
if (isSelected())
pat = &patternSelected;
else
pat = view->getPattern(getPen().getLineType());
#else
- RS_LineTypePattern * pat = (isSelected() ? &patternSelected : view->getPattern(getPen().getLineType()));
+ LineTypePattern * pat = (isSelected() ? &patternSelected : view->getPattern(getPen().getLineType()));
#endif
if (!pat)
{
-//printf("RS_Line::draw(): Pattern == NULL!\n");
- RS_DEBUG->print(RS_Debug::D_WARNING, "RS_Line::draw: Invalid line pattern");
+//printf("Line::draw(): Pattern == NULL!\n");
+ DEBUG->print(Debug::D_WARNING, "Line::draw: Invalid line pattern");
return;
}
-//printf("RS_Line::draw(): Drawing a patterned line...(?)\n");
+//printf("Line::draw(): Drawing a patterned line...(?)\n");
// Pen to draw pattern is always solid:
- RS_Pen pen = painter->getPen();
+ Pen pen = painter->getPen();
pen.setLineType(RS2::SolidLine);
painter->setPen(pen);
//if (patternOffset<0.0) {
// patternOffset+=patternSegmentLength;
//}
- //RS_DEBUG->print("pattern. offset: %f", patternOffset);
+ //DEBUG->print("pattern. offset: %f", patternOffset);
Vector patternOffsetVec;
patternOffsetVec.setPolar(patternOffset, angle);
curP += dp[i];
tot += fabs(pat->pattern[i] * styleFactor);
- //RS_DEBUG->print("pattern. tot: %f", tot);
+ //DEBUG->print("pattern. tot: %f", tot);
i++;
/**
* Dumps the point's data to stdout.
*/
-std::ostream & operator<<(std::ostream & os, const RS_Line & l)
+std::ostream & operator<<(std::ostream & os, const Line & l)
{
os << " Line: " << l.getData() << "\n";
return os;
/**
* Holds the data that defines a line.
*/
-class RS_LineData
+class LineData
{
public:
/**
* Default constructor. Leaves the data object uninitialized.
*/
- RS_LineData() {}
+ LineData() {}
+ LineData(const Vector & start, const Vector & end): startpoint(start), endpoint(end) {}
- RS_LineData(const Vector & start, const Vector & end): startpoint(start), endpoint(end)
- {
-// this->startpoint = startpoint;
-// this->endpoint = endpoint;
- }
-
- friend class RS_Line;
- friend class RS_ActionDrawLine;
+ friend class Line;
+ friend class ActionDrawLine;
- friend std::ostream & operator<<(std::ostream & os, const RS_LineData & ld)
+ friend std::ostream & operator<<(std::ostream & os, const LineData & ld)
{
os << "(" << ld.startpoint << "/" << ld.endpoint << ")";
return os;
*
* @author Andrew Mustun
*/
-class RS_Line: public RS_AtomicEntity
+class Line: public AtomicEntity
{
public:
- //RS_Line(RS_EntityContainer* parent);
- //RS_Line(const RS_Line& l);
- RS_Line(RS_EntityContainer * parent, const RS_LineData & d);
- virtual ~RS_Line();
+ Line(EntityContainer * parent, const LineData & d);
+ virtual ~Line();
- virtual RS_Entity * clone();
+ virtual Entity * clone();
virtual RS2::EntityType rtti() const;
virtual bool isEdge() const;
- RS_LineData getData() const;
+ LineData getData() const;
virtual VectorSolutions getRefPoints();
virtual Vector getStartpoint() const;
virtual Vector getNearestEndpoint(const Vector & coord, double * dist = NULL);
virtual Vector getNearestPointOnEntity(const Vector & coord,
- bool onEntity = true, double * dist = NULL, RS_Entity ** entity = NULL);
+ bool onEntity = true, double * dist = NULL, Entity ** entity = NULL);
virtual Vector getNearestCenter(const Vector & coord, double * dist = NULL);
virtual Vector getNearestMiddle(const Vector & coord, double * dist = NULL);
virtual Vector getNearestDist(double distance, const Vector & coord, double * dist = NULL);
virtual Vector getNearestDist(double distance, bool startp);
//virtual Vector getNearestRef(const Vector& coord, double* dist = NULL);
virtual double getDistanceToPoint(const Vector & coord,
- RS_Entity ** entity = NULL, RS2::ResolveLevel level = RS2::ResolveNone,
+ Entity ** entity = NULL, RS2::ResolveLevel level = RS2::ResolveNone,
double solidDist = RS_MAXDOUBLE);
virtual void move(Vector offset);
virtual void moveRef(const Vector & ref, const Vector & offset);
virtual void draw(PaintInterface * painter, GraphicView * view, double patternOffset = 0.0);
- friend std::ostream & operator<<(std::ostream & os, const RS_Line & l);
+ friend std::ostream & operator<<(std::ostream & os, const Line & l);
virtual void calculateBorders();
protected:
- RS_LineData data;
+ LineData data;
};
#endif
#include "linetypepattern.h"
-RS_LineTypePattern::RS_LineTypePattern(int count ...)
+LineTypePattern::LineTypePattern(int count ...)
{
va_list ap;
int i = 0;
va_end(ap);
}
-RS_LineTypePattern::~RS_LineTypePattern()
+LineTypePattern::~LineTypePattern()
{
delete[] pattern;
}
/**
* Stores a line type pattern.
*/
-class RS_LineTypePattern
+class LineTypePattern
{
public:
- RS_LineTypePattern(int count ...);
- ~RS_LineTypePattern();
+ LineTypePattern(int count ...);
+ ~LineTypePattern();
public:
double * pattern;
};
// Create line patterns
-static RS_LineTypePattern patternSolidLine(1, 10.0);
+static LineTypePattern patternSolidLine(1, 10.0);
-static RS_LineTypePattern patternDotLine(2, 0.1, -6.2);
-static RS_LineTypePattern patternDotLine2(2, 0.1, -3.1);
-static RS_LineTypePattern patternDotLineX2(2, 0.1, -12.4);
+static LineTypePattern patternDotLine(2, 0.1, -6.2);
+static LineTypePattern patternDotLine2(2, 0.1, -3.1);
+static LineTypePattern patternDotLineX2(2, 0.1, -12.4);
-static RS_LineTypePattern patternDashLine(2, 12.0, -6.0);
-static RS_LineTypePattern patternDashLine2(2, 6.0, -3.0);
-static RS_LineTypePattern patternDashLineX2(2, 24.0, -12.0);
+static LineTypePattern patternDashLine(2, 12.0, -6.0);
+static LineTypePattern patternDashLine2(2, 6.0, -3.0);
+static LineTypePattern patternDashLineX2(2, 24.0, -12.0);
-static RS_LineTypePattern patternDashDotLine(4, 12.0, -5.95, 0.1, -5.95);
-static RS_LineTypePattern patternDashDotLine2(4, 6.0, -2.95, 0.1, -2.95);
-static RS_LineTypePattern patternDashDotLineX2(4, 24.0, -11.95, 0.1, -11.95);
+static LineTypePattern patternDashDotLine(4, 12.0, -5.95, 0.1, -5.95);
+static LineTypePattern patternDashDotLine2(4, 6.0, -2.95, 0.1, -2.95);
+static LineTypePattern patternDashDotLineX2(4, 24.0, -11.95, 0.1, -11.95);
-static RS_LineTypePattern patternDivideLine(
+static LineTypePattern patternDivideLine(
6, 12.0, -5.9, 0.15, -5.9, 0.15, -5.9);
-static RS_LineTypePattern patternDivideLine2(
+static LineTypePattern patternDivideLine2(
6, 6.0, -2.9, 0.15, -2.9, 0.15, -2.9);
-static RS_LineTypePattern patternDivideLineX2(
+static LineTypePattern patternDivideLineX2(
6, 24.0, -11.9, 0.15, -11.9, 0.15, -11.9);
-static RS_LineTypePattern patternCenterLine(4, 32.0, -6.0, 6.0, -6.0);
-static RS_LineTypePattern patternCenterLine2(4, 16.0, -3.0, 3.0, -3.0);
-static RS_LineTypePattern patternCenterLineX2(4, 64.0, -12.0, 12.0, -12.0);
+static LineTypePattern patternCenterLine(4, 32.0, -6.0, 6.0, -6.0);
+static LineTypePattern patternCenterLine2(4, 16.0, -3.0, 3.0, -3.0);
+static LineTypePattern patternCenterLineX2(4, 64.0, -12.0, 12.0, -12.0);
-static RS_LineTypePattern patternBorderLine(
+static LineTypePattern patternBorderLine(
6, 12.0, -6.0, 12.0, -5.95, 0.1, -5.95);
-static RS_LineTypePattern patternBorderLine2(
+static LineTypePattern patternBorderLine2(
6, 6.0, -3.0, 6.0, -2.95, 0.1, -2.95);
-static RS_LineTypePattern patternBorderLineX2(
+static LineTypePattern patternBorderLineX2(
6, 24.0, -12.0, 24.0, -11.95, 0.1, -11.95);
-static RS_LineTypePattern patternBlockLine(2, 0.5, -0.5);
-static RS_LineTypePattern patternSelected(2, 1.0, -3.0);
+static LineTypePattern patternBlockLine(2, 0.5, -0.5);
+static LineTypePattern patternSelected(2, 1.0, -3.0);
#endif
#define __MAINWINDOWINTERFACE_H__
class GraphicView;
-class RS_Document;
+class Document;
/**
* Interface for main application windows.
*/
-class RS_MainWindowInterface
+class MainWindowInterface
{
public:
- RS_MainWindowInterface() {}
- virtual ~RS_MainWindowInterface() {}
+ MainWindowInterface() {}
+ virtual ~MainWindowInterface() {}
virtual GraphicView * getGraphicView() = 0;
- virtual RS_Document * getDocument() = 0;
+ virtual Document * getDocument() = 0;
- virtual void createNewDocument(const QString & fileName = QString::null, RS_Document * doc = NULL) = 0;
+ virtual void createNewDocument(const QString & fileName = QString::null, Document * doc = NULL) = 0;
virtual void showSimulationControls() = 0;
};
/**
* Rounds the given double to the next int.
*/
-int RS_Math::round(double v)
+int Math::round(double v)
{
return (v - floor(v) < 0.5 ? (int)floor(v) : (int)ceil(v));
}
/**
* Save pow function
*/
-double RS_Math::pow(double x, double y)
+double Math::pow(double x, double y)
{
errno = 0;
double ret = ::pow(x, y);
if (errno == EDOM)
{
- RS_DEBUG->print(RS_Debug::D_ERROR, "RS_Math::pow: EDOM in pow");
+ DEBUG->print(Debug::D_ERROR, "Math::pow: EDOM in pow");
ret = 0.0;
}
else if (errno == ERANGE)
{
- RS_DEBUG->print(RS_Debug::D_WARNING, "RS_Math::pow: ERANGE in pow");
+ DEBUG->print(Debug::D_WARNING, "Math::pow: ERANGE in pow");
ret = 0.0;
}
/**
* Converts radians to degrees.
*/
-double RS_Math::rad2deg(double a)
+double Math::rad2deg(double a)
{
return (a / (2.0 * M_PI) * 360.0);
}
/**
* Converts degrees to radians.
*/
-double RS_Math::deg2rad(double a)
+double Math::deg2rad(double a)
{
return ((a / 360.0) * (2.0 * M_PI));
}
/**
* Converts radians to gradians.
*/
-double RS_Math::rad2gra(double a)
+double Math::rad2gra(double a)
{
return (a / (2.0 * M_PI) * 400.0);
}
/**
* Finds greatest common divider using Euclid's algorithm.
*/
-int RS_Math::findGCD(int a, int b)
+int Math::findGCD(int a, int b)
{
while (b != 0)
{
* @param reversed true for clockwise testing. false for ccw testing.
* @return true if the angle a is between a1 and a2.
*/
-bool RS_Math::isAngleBetween(double a, double a1, double a2, bool reversed)
+bool Math::isAngleBetween(double a, double a1, double a2, bool reversed)
{
bool ret = false;
ret = true;
}
- //RS_DEBUG->print("angle %f is %sbetween %f and %f",
+ //DEBUG->print("angle %f is %sbetween %f and %f",
// a, ret ? "" : "not ", a1, a2);
return ret;
}
/**
* Corrects the given angle to the range of 0-2*Pi.
*/
-double RS_Math::correctAngle(double a)
+double Math::correctAngle(double a)
{
while (a > 2 * M_PI)
a -= 2 * M_PI;
* @return The angle that needs to be added to a1 to reach a2.
* Always positive and less than 2*pi.
*/
-double RS_Math::getAngleDifference(double a1, double a2)
+double Math::getAngleDifference(double a1, double a2)
{
double ret;
* @return The given angle or the given angle+PI, depending which on
* is readable from the bottom or right.
*/
-double RS_Math::makeAngleReadable(double angle, bool readable, bool * corrected)
+double Math::makeAngleReadable(double angle, bool readable, bool * corrected)
{
double ret;
bool cor = isAngleReadable(angle) ^ readable;
* @return true: if the given angle is in a range that is readable
* for texts created with that angle.
*/
-bool RS_Math::isAngleReadable(double angle)
+bool Math::isAngleReadable(double angle)
{
if (angle > M_PI /2.0 * 3.0 + 0.001 || angle < M_PI / 2.0 + 0.001)
return true;
* @param tol Tolerance in rad.
* @retval true The two angles point in the same direction.
*/
-bool RS_Math::isSameDirection(double dir1, double dir2, double tol)
+bool Math::isSameDirection(double dir1, double dir2, double tol)
{
double diff = fabs(dir1 - dir2);
/**
* Compares two double values with a tolerance.
*/
-bool RS_Math::cmpDouble(double v1, double v2, double tol)
+bool Math::cmpDouble(double v1, double v2, double tol)
{
return (fabs(v2 - v1) < tol);
}
* Evaluates a mathematical expression and returns the result.
* If an error occured, the given default value 'def' will be returned.
*/
-double RS_Math::eval(const QString & expr, double def)
+double Math::eval(const QString & expr, double def)
{
bool ok;
- double res = RS_Math::eval(expr, &ok);
+ double res = Math::eval(expr, &ok);
if (!ok)
return def;
* Evaluates a mathematical expression and returns the result.
* If an error occured, ok will be set to false (if ok isn't NULL).
*/
-double RS_Math::eval(const QString & expr, bool * ok)
+double Math::eval(const QString & expr, bool * ok)
{
if (expr.isEmpty())
{
* @param prec Precision e.g. a precision of 1 would mean that a
* value of 2.12030 will be converted to "2.1". 2.000 is always just "2").
*/
-QString RS_Math::doubleToString(double value, double prec)
+QString Math::doubleToString(double value, double prec)
{
if (prec < 1.0e-12)
{
- std::cerr << "RS_Math::doubleToString: invalid precision\n";
+ std::cerr << "Math::doubleToString: invalid precision\n";
return "";
}
QString ret;
- int num = RS_Math::round(value / prec);
+ int num = Math::round(value / prec);
- QString exaStr = RS_Math::doubleToString(prec, 10);
+ QString exaStr = Math::doubleToString(prec, 10);
int dotPos = exaStr.indexOf('.');
if (dotPos == -1)
- ret.sprintf("%d", RS_Math::round(num * prec));
+ ret.sprintf("%d", Math::round(num * prec));
else
{
int digits = exaStr.length() - dotPos - 1;
- ret = RS_Math::doubleToString(num * prec, digits);
+ ret = Math::doubleToString(num * prec, digits);
}
return ret;
* @param value The double value
* @param prec Precision
*/
-QString RS_Math::doubleToString(double value, int prec)
+QString Math::doubleToString(double value, int prec)
{
QString valStr;
/**
* Performs some testing for the math class.
*/
-void RS_Math::test()
+void Math::test()
{
- std::cout << "RS_Math::test: doubleToString:\n";
+ std::cout << "Math::test: doubleToString:\n";
double v = 0.1;
- QString s = RS_Math::doubleToString(v, 0.1);
+ QString s = Math::doubleToString(v, 0.1);
assert(s == "0.1");
- s = RS_Math::doubleToString(v, 0.01);
+ s = Math::doubleToString(v, 0.01);
assert(s == "0.1");
- s = RS_Math::doubleToString(v, 0.0);
+ s = Math::doubleToString(v, 0.0);
assert(s == "0");
v = 0.01;
- s = RS_Math::doubleToString(v, 0.1);
+ s = Math::doubleToString(v, 0.1);
assert(s == "0");
- s = RS_Math::doubleToString(v, 0.01);
+ s = Math::doubleToString(v, 0.01);
assert(s == "0.01");
- s = RS_Math::doubleToString(v, 0.0);
+ s = Math::doubleToString(v, 0.0);
assert(s == "0");
v = 0.001;
- s = RS_Math::doubleToString(v, 0.1);
+ s = Math::doubleToString(v, 0.1);
assert(s == "0");
- s = RS_Math::doubleToString(v, 0.01);
+ s = Math::doubleToString(v, 0.01);
assert(s == "0");
- s = RS_Math::doubleToString(v, 0.001);
+ s = Math::doubleToString(v, 0.001);
assert(s == "0.001");
- s = RS_Math::doubleToString(v, 0.0);
+ s = Math::doubleToString(v, 0.0);
assert(s == "0");
- std::cout << "RS_Math::test: complete\n";
+ std::cout << "Math::test: complete\n";
}
/**
* Math functions.
*/
-class RS_Math
+class Math
{
-public:
- static int round(double v);
- static double pow(double x, double y);
- static double rad2deg(double a);
- static double deg2rad(double a);
- static double rad2gra(double a);
- static int findGCD(int a, int b);
- static bool isAngleBetween(double a, double a1, double a2, bool reversed);
- static double correctAngle(double a);
- static double getAngleDifference(double a1, double a2);
- static double makeAngleReadable(double angle, bool readable = true, bool * corrected = NULL);
- static bool isAngleReadable(double angle);
- static bool isSameDirection(double dir1, double dir2, double tol);
- static double eval(const QString & expr, double def = 0.0);
- static bool cmpDouble(double v1, double v2, double tol = 0.001);
- static double eval(const QString & expr, bool * ok);
- static QString doubleToString(double value, double prec);
- static QString doubleToString(double value, int prec);
+ public:
+ static int round(double v);
+ static double pow(double x, double y);
+ static double rad2deg(double a);
+ static double deg2rad(double a);
+ static double rad2gra(double a);
+ static int findGCD(int a, int b);
+ static bool isAngleBetween(double a, double a1, double a2, bool reversed);
+ static double correctAngle(double a);
+ static double getAngleDifference(double a1, double a2);
+ static double makeAngleReadable(double angle, bool readable = true, bool * corrected = NULL);
+ static bool isAngleReadable(double angle);
+ static bool isSameDirection(double dir1, double dir2, double tol);
+ static double eval(const QString & expr, double def = 0.0);
+ static bool cmpDouble(double v1, double v2, double tol = 0.001);
+ static double eval(const QString & expr, bool * ok);
+ static QString doubleToString(double value, double prec);
+ static QString doubleToString(double value, int prec);
- static void test();
+ static void test();
};
#endif // __MATHEXTRA_H__
* 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);
/**
* Holds the data needed for move modifications.
*/
-class RS_MoveData
+class MoveData
{
public:
int number;
/**
* Holds the data needed for rotation modifications.
*/
-class RS_RotateData
+class RotateData
{
public:
int number;
/**
* Holds the data needed for scale modifications.
*/
-class RS_ScaleData
+class ScaleData
{
public:
int number;
/**
* Holds the data needed for mirror modifications.
*/
-class RS_MirrorData
+class MirrorData
{
public:
bool copy;
/**
* Holds the data needed for move/rotate modifications.
*/
-class RS_MoveRotateData
+class MoveRotateData
{
public:
int number;
/**
* Holds the data needed for rotation around two centers modifications.
*/
-class RS_Rotate2Data
+class Rotate2Data
{
public:
int number;
/**
* Holds the data needed for beveling modifications.
*/
-class RS_BevelData
+class BevelData
{
public:
double length1;
/**
* Holds the data needed for rounding modifications.
*/
-class RS_RoundData
+class RoundData
{
public:
double radius;
/**
* Holds the data needed for moving reference points.
*/
-class RS_MoveRefData
+class MoveRefData
{
public:
Vector ref;
/**
* Holds the data needed for changing attributes.
*/
-class RS_AttributesData
+class AttributesData
{
public:
QString layer;
- RS_Pen pen;
+ Pen pen;
bool changeLayer;
bool changeColor;
bool changeLineType;
/**
* Holds the data needed for pasting.
*/
-class RS_PasteData
+class PasteData
{
public:
- RS_PasteData(Vector insertionPoint, double factor, double angle,
+ PasteData(Vector insertionPoint, double factor, double angle,
bool asInsert, const QString & blockName)
{
this->insertionPoint = insertionPoint;
*
* @author Andrew Mustun
*/
-class RS_Modification
+class Modification
{
public:
- RS_Modification(RS_EntityContainer & entityContainer,
+ Modification(EntityContainer & entityContainer,
GraphicView * graphicView = NULL, bool handleUndo = true);
void remove();
- bool changeAttributes(RS_AttributesData& data);
+ bool changeAttributes(AttributesData& data);
void copy(const Vector & ref, const bool cut);
private:
- void copyEntity(RS_Entity * e, const Vector & ref, const bool cut);
+ void copyEntity(Entity * e, const Vector & ref, const bool cut);
public:
- void copyLayers(RS_Entity * e);
- void copyBlocks(RS_Entity * e);
- void paste(const RS_PasteData & data, Drawing * source = NULL);
-
- bool move(RS_MoveData & data);
- bool rotate(RS_RotateData & data);
- bool scale(RS_ScaleData & data);
- bool mirror(RS_MirrorData & data);
- bool moveRotate(RS_MoveRotateData & data);
- bool rotate2(RS_Rotate2Data & data);
-
- bool trim(const Vector & trimCoord, RS_AtomicEntity * trimEntity,
- const Vector & limitCoord, RS_Entity * limitEntity,
+ void copyLayers(Entity * e);
+ void copyBlocks(Entity * e);
+ void paste(const PasteData & data, Drawing * source = NULL);
+
+ bool move(MoveData & data);
+ bool rotate(RotateData & data);
+ bool scale(ScaleData & data);
+ bool mirror(MirrorData & data);
+ bool moveRotate(MoveRotateData & data);
+ bool rotate2(Rotate2Data & data);
+
+ bool trim(const Vector & trimCoord, AtomicEntity * trimEntity,
+ const Vector & limitCoord, Entity * limitEntity,
bool both);
- bool trimAmount(const Vector & trimCoord, RS_AtomicEntity * trimEntity,
+ bool trimAmount(const Vector & trimCoord, AtomicEntity * trimEntity,
double dist);
- bool cut(const Vector& cutCoord, RS_AtomicEntity* cutEntity);
+ bool cut(const Vector& cutCoord, AtomicEntity* cutEntity);
bool stretch(const Vector & firstCorner, const Vector & secondCorner,
const Vector & offset);
- bool bevel(const Vector & coord1, RS_AtomicEntity * entity1,
- const Vector & coord2, RS_AtomicEntity * entity2,
- RS_BevelData & data);
- bool round(const Vector & coord, const Vector & coord1, RS_AtomicEntity * entity1,
- const Vector & coord2, RS_AtomicEntity * entity2, RS_RoundData & data);
+ bool bevel(const Vector & coord1, AtomicEntity * entity1,
+ const Vector & coord2, AtomicEntity * entity2,
+ BevelData & data);
+ bool round(const Vector & coord, const Vector & coord1, AtomicEntity * entity1,
+ const Vector & coord2, AtomicEntity * entity2, RoundData & data);
bool explode();
bool explodeTextIntoLetters();
- bool explodeTextIntoLetters(RS_Text * text, QList<RS_Entity *> & addList);
- bool moveRef(RS_MoveRefData & data);
-
- bool splitPolyline(RS_Polyline & polyline, RS_Entity & e1, Vector v1,
- RS_Entity & e2, Vector v2, RS_Polyline ** polyline1, RS_Polyline ** polyline2) const;
- RS_Polyline * addPolylineNode(RS_Polyline& polyline,
- const RS_AtomicEntity& segment, const Vector& node);
- RS_Polyline * deletePolylineNode(RS_Polyline& polyline, const Vector& node);
- RS_Polyline * deletePolylineNodesBetween(RS_Polyline & polyline, RS_AtomicEntity & segment,
+ bool explodeTextIntoLetters(Text * text, QList<Entity *> & addList);
+ bool moveRef(MoveRefData & data);
+
+ bool splitPolyline(Polyline & polyline, Entity & e1, Vector v1,
+ Entity & e2, Vector v2, Polyline ** polyline1, Polyline ** polyline2) const;
+ Polyline * addPolylineNode(Polyline& polyline,
+ const AtomicEntity& segment, const Vector& node);
+ Polyline * deletePolylineNode(Polyline& polyline, const Vector& node);
+ Polyline * deletePolylineNodesBetween(Polyline & polyline, AtomicEntity & segment,
const Vector& node1, const Vector & node2);
- RS_Polyline * polylineTrim(RS_Polyline & polyline,
- RS_AtomicEntity & segment1, RS_AtomicEntity & segment2);
+ Polyline * polylineTrim(Polyline & polyline,
+ AtomicEntity & segment1, AtomicEntity & segment2);
private:
void deselectOriginals(bool remove);
- void addNewEntities(QList<RS_Entity *> & addList);
+ void addNewEntities(QList<Entity *> & addList);
protected:
- RS_EntityContainer * container;
+ EntityContainer * container;
Drawing * graphic;
- RS_Document * document;
+ Document * document;
GraphicView * graphicView;
bool handleUndo;
};
{
if (radius < 1.0e-6)
{
- RS_DEBUG->print(RS_Debug::D_WARNING, "PaintInterface::createArc: invalid radius: %f", radius);
+ DEBUG->print(Debug::D_WARNING, "PaintInterface::createArc: invalid radius: %f", radius);
return;
}
drawLine(Vector(p1.x, p2.y), Vector(p1.x, p1.y));
}
-void PaintInterface::drawHandle(const Vector & p, const RS_Color & c, int size)
+void PaintInterface::drawHandle(const Vector & p, const Color & c, int size)
{
if (size < 0)
size = 2;
int PaintInterface::toScreenX(double x)
{
- return RS_Math::round(offset.x + x);
+ return Math::round(offset.x + x);
}
int PaintInterface::toScreenY(double y)
{
- return RS_Math::round(offset.y + y);
+ return Math::round(offset.y + y);
}
/**
*/
void PaintInterface::drawArcMac(const Vector& cp, double radius, double a1, double a2, bool reversed)
{
- RS_DEBUG->print("PaintInterface::drawArcMac");
+ DEBUG->print("PaintInterface::drawArcMac");
if (radius <= 0.5)
drawGridPoint(cp);
else
if (drawingMode == RS2::ModeXOR && radius < 500)
{
// This is _very_ slow for large arcs:
- painter->drawEllipse(toScreenX(cp.x - radius), toScreenY(cp.y - radius), RS_Math::round(2.0 * radius), RS_Math::round(2.0 * radius));
+ painter->drawEllipse(toScreenX(cp.x - radius), toScreenY(cp.y - radius), Math::round(2.0 * radius), Math::round(2.0 * radius));
}
else
{
#endif
}
#else
-// painter->drawEllipse(toScreenX(cp.x - radius), toScreenY(cp.y - radius), RS_Math::round(2.0 * radius), RS_Math::round(2.0 * radius));
+// painter->drawEllipse(toScreenX(cp.x - radius), toScreenY(cp.y - radius), Math::round(2.0 * radius), Math::round(2.0 * radius));
painter->drawEllipse(QPointF(cp.x, cp.y), radius, radius);
#endif
}
QMatrix wm;
wm.translate(pos.x, pos.y);
wm.scale(factor.x, factor.y);
- wm.rotate(RS_Math::rad2deg(-angle));
+ wm.rotate(Math::rad2deg(-angle));
painter->setWorldMatrix(wm);
if (fabs(angle) < 1.0e-4)
painter->restore();
}
-void PaintInterface::fillRect(int x1, int y1, int w, int h, const RS_Color & col)
+void PaintInterface::fillRect(int x1, int y1, int w, int h, const Color & col)
{
painter->fillRect(x1, y1, w, h, col);
}
void PaintInterface::setPreviewPen()
{
- setPen(RS_Color(0, 255, 255));
+ setPen(Color(0, 255, 255));
}
-RS_Pen PaintInterface::getPen()
+Pen PaintInterface::getPen()
{
return lpen;
}
-void PaintInterface::setPen(const RS_Pen & pen)
+void PaintInterface::setPen(const Pen & pen)
{
lpen = pen;
if (drawingMode == RS2::ModeBW)
- lpen.setColor(RS_Color(0, 0, 0));
+ lpen.setColor(Color(0, 0, 0));
- QPen p(lpen.getColor(), RS_Math::round(lpen.getScreenWidth()), RS2::rsToQtLineType(lpen.getLineType()));
+ QPen p(lpen.getColor(), Math::round(lpen.getScreenWidth()), RS2::rsToQtLineType(lpen.getLineType()));
p.setJoinStyle(Qt::RoundJoin);
p.setCapStyle(Qt::RoundCap);
painter->setPen(p);
}
-void PaintInterface::setPen(const RS_Color & color)
+void PaintInterface::setPen(const Color & color)
{
if (drawingMode == RS2::ModeBW)
{
- lpen.setColor(RS_Color(0, 0, 0));
- painter->setPen(RS_Color(0, 0, 0));
+ lpen.setColor(Color(0, 0, 0));
+ painter->setPen(Color(0, 0, 0));
}
else
{
void PaintInterface::disablePen(void)
{
- lpen = RS_Pen(RS2::FlagInvalid);
+ lpen = Pen(RS2::FlagInvalid);
painter->setPen(Qt::NoPen);
}
-void PaintInterface::setBrush(const RS_Color & color)
+void PaintInterface::setBrush(const Color & color)
{
if (drawingMode == RS2::ModeBW)
painter->setBrush(QColor(0, 0, 0));
void PaintInterface::disableBrush(void)
{
-// lpen = RS_Pen(RS2::FlagInvalid);
+// lpen = Pen(RS2::FlagInvalid);
painter->setBrush(Qt::NoBrush);
}
#define ____PAINTINTERFACE_H____
#include <QtGui>
-#include "rs.h"
+#include "enums.h"
#include "vector.h"
#include "color.h"
#include "pen.h"
double angle, double angle1, double angle2, bool reversed);
void drawImg(QImage & img, const Vector & pos,
double angle, const Vector & factor, int sx, int sy, int sw, int sh);
- void fillRect(int x1, int y1, int w, int h, const RS_Color & col);
+ void fillRect(int x1, int y1, int w, int h, const Color & col);
void fillTriangle(const Vector & p1, const Vector & p2, const Vector & p3);
- void drawHandle(const Vector & p, const RS_Color & c, int size = -1);
+ void drawHandle(const Vector & p, const Color & c, int size = -1);
void setPreviewPen();
- RS_Pen getPen();
- void setPen(const RS_Pen & pen);
- void setPen(const RS_Color & color);
+ Pen getPen();
+ void setPen(const Pen & pen);
+ void setPen(const Color & color);
void setPen(int r, int g, int b);
void disablePen();
- void setBrush(const RS_Color & color);
+ void setBrush(const Color & color);
void disableBrush();
void drawPolygon(const QPolygon & p);
void erase();
* A fixed offset added to all entities drawn (useful for previews).
*/
Vector offset;
- RS_Pen lpen;
+ Pen lpen;
};
#endif // __PAINTINTERFACE_H____
*
* @param fileName File name of a DXF file defining the pattern
*/
-RS_Pattern::RS_Pattern(const QString & fileName): RS_EntityContainer(NULL)
+Pattern::Pattern(const QString & fileName): EntityContainer(NULL)
{
- RS_DEBUG->print("RS_Pattern::RS_Pattern() ");
+ DEBUG->print("Pattern::Pattern() ");
this->fileName = fileName;
loaded = false;
* @param name Pattern name.
*
*/
-/*RS_Pattern::RS_Pattern(const QString& fileName, const QString& name)
- : RS_EntityContainer(NULL) {
+/*Pattern::Pattern(const QString& fileName, const QString& name)
+ : EntityContainer(NULL) {
this->fileName = fileName;
this->name = name;
loaded = false;
}*/
-RS_Pattern::~RS_Pattern()
+Pattern::~Pattern()
{
}
* @param filename File name of the pattern file (without path and
* extension or full path.
*/
-bool RS_Pattern::loadPattern()
+bool Pattern::loadPattern()
{
if (loaded)
return true;
- RS_DEBUG->print("RS_Pattern::loadPattern");
+ DEBUG->print("Pattern::loadPattern");
QString path;
// Search for the appropriate pattern if we have only the name of the pattern:
if (!fileName.toLower().contains(".dxf"))
{
- QStringList patterns = RS_SYSTEM->getPatternList();
+ QStringList patterns = SYSTEM->getPatternList();
QFileInfo file;
for(QStringList::Iterator it=patterns.begin(); it!=patterns.end(); it++)
if (QFileInfo(*it).baseName().toLower() == fileName.toLower())
{
path = *it;
- RS_DEBUG->print("Pattern found: %s", path.toLatin1().data());
+ DEBUG->print("Pattern found: %s", path.toLatin1().data());
break;
}
}
// No pattern paths found:
if (path.isEmpty())
{
- RS_DEBUG->print("No pattern \"%s\"available.", fileName.toLatin1().data());
+ DEBUG->print("No pattern \"%s\"available.", fileName.toLatin1().data());
return false;
}
Drawing * gr = new Drawing();
// TODO: Find out why the new dxf filter doesn't work for patterns:
- RS_FILEIO->fileImport(*gr, path, RS2::FormatDXF1);
+ FILEIO->fileImport(*gr, path, RS2::FormatDXF1);
- for(RS_Entity * e=gr->firstEntity(); e!=NULL; e=gr->nextEntity())
+ for(Entity * e=gr->firstEntity(); e!=NULL; e=gr->nextEntity())
{
if (e->rtti() == RS2::EntityLine || e->rtti() == RS2::EntityArc)
{
- RS_Layer * l = e->getLayer();
- RS_Entity * cl = e->clone();
+ Layer * l = e->getLayer();
+ Entity * cl = e->clone();
cl->reparent(this);
if (l != NULL)
delete gr;
loaded = true;
- RS_DEBUG->print("RS_Pattern::loadPattern: OK");
+ DEBUG->print("Pattern::loadPattern: OK");
return true;
}
/** @return the fileName of this pattern. */
-QString RS_Pattern::getFileName() const
+QString Pattern::getFileName() const
{
return fileName;
}
#include "entitycontainer.h"
-class RS_PatternList;
+class PatternList;
/**
- * Patterns are used for hatches. They are stored in a RS_PatternList.
- * Use RS_PatternList to access a pattern.
+ * Patterns are used for hatches. They are stored in a PatternList.
+ * Use PatternList to access a pattern.
*
* @author Andrew Mustun
*/
-class RS_Pattern: public RS_EntityContainer
+class Pattern: public EntityContainer
{
public:
- RS_Pattern(const QString & fileName);
- virtual ~RS_Pattern();
+ Pattern(const QString & fileName);
+ virtual ~Pattern();
virtual bool loadPattern();
QString getFileName() const;
#include "system.h"
-RS_PatternList * RS_PatternList::uniqueInstance = NULL;
+PatternList * PatternList::uniqueInstance = NULL;
/**
* Default constructor.
*/
-RS_PatternList::RS_PatternList(): patternIterator(patterns)
+PatternList::PatternList(): patternIterator(patterns)
{
#warning "!!! Need to deal with setAutoDelete() Qt3->Qt4 !!!"
// patterns.setAutoDelete(true);
//patternListListeners.setAutoDelete(false);
}
-/*virtual*/ RS_PatternList::~RS_PatternList()
+/*virtual*/ PatternList::~PatternList()
{
}
/**
* @return Instance to the unique pattern list.
*/
-/*static*/ RS_PatternList * RS_PatternList::instance()
+/*static*/ PatternList * PatternList::instance()
{
if (uniqueInstance == NULL)
- uniqueInstance = new RS_PatternList();
+ uniqueInstance = new PatternList();
return uniqueInstance;
}
/**
- * Initializes the pattern list by creating empty RS_Pattern
+ * Initializes the pattern list by creating empty Pattern
* objects, one for each pattern that could be found.
*/
-void RS_PatternList::init()
+void PatternList::init()
{
- RS_DEBUG->print("RS_PatternList::initPatterns");
+ DEBUG->print("PatternList::initPatterns");
- QStringList list = RS_SYSTEM->getPatternList();
- RS_Pattern * pattern;
+ QStringList list = SYSTEM->getPatternList();
+ Pattern * pattern;
patterns.clear();
for(QStringList::Iterator it=list.begin(); it!=list.end(); ++it)
{
- RS_DEBUG->print("pattern: %s:", (*it).toLatin1().data());
+ DEBUG->print("pattern: %s:", (*it).toLatin1().data());
QFileInfo fi(*it);
- pattern = new RS_Pattern(fi.baseName().toLower());
+ pattern = new Pattern(fi.baseName().toLower());
patterns.append(pattern);
- RS_DEBUG->print("base: %s", pattern->getFileName().toLatin1().data());
+ DEBUG->print("base: %s", pattern->getFileName().toLatin1().data());
}
}
/**
* Removes all patterns in the patternlist.
*/
-void RS_PatternList::clearPatterns()
+void PatternList::clearPatterns()
{
patterns.clear();
}
-int RS_PatternList::countPatterns()
+int PatternList::countPatterns()
{
return patterns.count();
}
* Listeners are notified after the pattern was removed from
* the list but before it gets deleted.
*/
-void RS_PatternList::removePattern(RS_Pattern * pattern)
+void PatternList::removePattern(Pattern * pattern)
{
- RS_DEBUG->print("RS_PatternList::removePattern()");
+ DEBUG->print("PatternList::removePattern()");
// here the pattern is removed from the list but not deleted
// patterns.remove(pattern);
delete patterns.takeAt(i);
//for (uint i=0; i<patternListListeners.count(); ++i) {
- // RS_PatternListListener* l = patternListListeners.at(i);
+ // PatternListListener* l = patternListListeners.at(i);
// l->patternRemoved(pattern);
//}
}
* \p NULL if no such pattern was found. The pattern will be loaded into
* memory if it's not already.
*/
-RS_Pattern * RS_PatternList::requestPattern(const QString & name)
+Pattern * PatternList::requestPattern(const QString & name)
{
- RS_DEBUG->print("RS_PatternList::requestPattern %s", name.toLatin1().data());
+ DEBUG->print("PatternList::requestPattern %s", name.toLatin1().data());
QString name2 = name.toLower();
- RS_Pattern * foundPattern = NULL;
+ Pattern * foundPattern = NULL;
- RS_DEBUG->print("name2: %s", name2.toLatin1().data());
+ DEBUG->print("name2: %s", name2.toLatin1().data());
// Search our list of available patterns:
-// for(RS_Pattern * p=patterns.first(); p!=NULL; p=patterns.next())
+// for(Pattern * p=patterns.first(); p!=NULL; p=patterns.next())
for(int i=0; i<patterns.size(); i++)
{
- RS_Pattern * p = patterns[i];
+ Pattern * p = patterns[i];
if (p->getFileName() == name2)
{
}
//! @return First pattern of the list.
-RS_Pattern * RS_PatternList::firstPattern()
+Pattern * PatternList::firstPattern()
{
patternIterator.toFront();
return patternIterator.next();
* @return Next pattern from the list after
* calling firstPattern() or nextPattern().
*/
-RS_Pattern * RS_PatternList::nextPattern()
+Pattern * PatternList::nextPattern()
{
return patternIterator.next();
}
-bool RS_PatternList::contains(const QString & name)
+bool PatternList::contains(const QString & name)
{
QString name2 = name.toLower();
// Search our list of available patterns:
-// for(RS_Pattern * p=patterns.first(); p!=NULL; p=patterns.next())
+// for(Pattern * p=patterns.first(); p!=NULL; p=patterns.next())
for(int i=0; i<patterns.size(); i++)
{
- RS_Pattern * p = patterns[i];
+ Pattern * p = patterns[i];
if (p->getFileName() == name2)
return true;
/**
* Dumps the patterns to stdout.
*/
-std::ostream & operator<<(std::ostream & os, RS_PatternList & l)
+std::ostream & operator<<(std::ostream & os, PatternList & l)
{
os << "Patternlist: \n";
- for(RS_Pattern * p=l.firstPattern(); p!=NULL; p=l.nextPattern())
+ for(Pattern * p=l.firstPattern(); p!=NULL; p=l.nextPattern())
os << *p << "\n";
return os;
#include "pattern.h"
#include "entity.h"
-#define RS_PATTERNLIST RS_PatternList::instance()
+#define PATTERNLIST PatternList::instance()
/**
* The global list of patterns. This is implemented as a singleton.
- * Use RS_PatternList::instance() to get a pointer to the object.
+ * Use PatternList::instance() to get a pointer to the object.
*
* @author James Hammons
* @author Andrew Mustun
*/
-class RS_PatternList
+class PatternList
{
protected:
- RS_PatternList();
+ PatternList();
public:
- virtual ~RS_PatternList();
+ virtual ~PatternList();
- static RS_PatternList * instance();
+ static PatternList * instance();
void init();
void clearPatterns();
int countPatterns();
- virtual void removePattern(RS_Pattern * pattern);
- RS_Pattern * requestPattern(const QString & name);
- RS_Pattern * firstPattern();
- RS_Pattern * nextPattern();
+ virtual void removePattern(Pattern * pattern);
+ Pattern * requestPattern(const QString & name);
+ Pattern * firstPattern();
+ Pattern * nextPattern();
bool contains(const QString & name);
- friend std::ostream & operator<<(std::ostream & os, RS_PatternList & l);
+ friend std::ostream & operator<<(std::ostream & os, PatternList & l);
protected:
- static RS_PatternList * uniqueInstance;
+ static PatternList * uniqueInstance;
private:
//! patterns in the graphic
- QList<RS_Pattern *> patterns;
- QListIterator<RS_Pattern *> patternIterator;
+ QList<Pattern *> patterns;
+ QListIterator<Pattern *> patternIterator;
};
#endif // __PATTERNLIST_H__
/**
* Creates a default pen (black, solid, width 0).
*/
-RS_Pen::RS_Pen(): RS_Flags()
+Pen::Pen(): Flags()
{
- setColor(RS_Color(0, 0, 0));
+ setColor(Color(0, 0, 0));
setWidth(RS2::Width00);
setLineType(RS2::SolidLine);
setScreenWidth(0);
/**
* Creates a pen with the given attributes.
*/
-RS_Pen::RS_Pen(const RS_Color & c, RS2::LineWidth w, RS2::LineType t): RS_Flags()
+Pen::Pen(const Color & c, RS2::LineWidth w, RS2::LineType t): Flags()
{
setColor(c);
setWidth(w);
*
* e.g.:
* <pre>
- * RS_Pen p(RS2::FlagInvalid);
+ * Pen p(RS2::FlagInvalid);
* </pre>
*/
-RS_Pen::RS_Pen(unsigned int f): RS_Flags(f)
+Pen::Pen(unsigned int f): Flags(f)
{
- setColor(RS_Color(0, 0, 0));
+ setColor(Color(0, 0, 0));
setWidth(RS2::Width00);
setLineType(RS2::SolidLine);
setScreenWidth(0);
}
-/*virtual*/ RS_Pen::~RS_Pen()
+/*virtual*/ Pen::~Pen()
{
}
-RS2::LineType RS_Pen::getLineType() const
+RS2::LineType Pen::getLineType() const
{
return lineType;
}
-void RS_Pen::setLineType(RS2::LineType t)
+void Pen::setLineType(RS2::LineType t)
{
lineType = t;
}
-RS2::LineWidth RS_Pen::getWidth() const
+RS2::LineWidth Pen::getWidth() const
{
return width;
}
-void RS_Pen::setWidth(RS2::LineWidth w)
+void Pen::setWidth(RS2::LineWidth w)
{
width = w;
}
-double RS_Pen::getScreenWidth() const
+double Pen::getScreenWidth() const
{
return screenWidth;
}
-void RS_Pen::setScreenWidth(double w)
+void Pen::setScreenWidth(double w)
{
screenWidth = w;
}
-const RS_Color & RS_Pen::getColor() const
+const Color & Pen::getColor() const
{
return color;
}
-void RS_Pen::setColor(const RS_Color & c)
+void Pen::setColor(const Color & c)
{
color = c;
}
-bool RS_Pen::isValid()
+bool Pen::isValid()
{
return !getFlag(RS2::FlagInvalid);
}
-bool RS_Pen::operator==(const RS_Pen & p) const
+bool Pen::operator==(const Pen & p) const
{
return (lineType == p.lineType && width == p.width && color == p.color);
}
-bool RS_Pen::operator!=(const RS_Pen & p) const
+bool Pen::operator!=(const Pen & p) const
{
return !(*this == p);
}
-/*friend*/ std::ostream & operator<<(std::ostream & os, const RS_Pen & p)
+/*friend*/ std::ostream & operator<<(std::ostream & os, const Pen & p)
{
//os << "style: " << p.style << std::endl;
os << " pen color: " << p.getColor()
#ifndef __PEN_H__
#define __PEN_H__
-#include "rs.h"
+#include "enums.h"
#include "color.h"
#include "flags.h"
* @author James Hammons
* @author Andrew Mustun
*/
-class RS_Pen: public RS_Flags
+class Pen: public Flags
{
public:
- RS_Pen();
- RS_Pen(const RS_Color & c, RS2::LineWidth w, RS2::LineType t);
- RS_Pen(unsigned int f);
- virtual ~RS_Pen();
+ Pen();
+ Pen(const Color & c, RS2::LineWidth w, RS2::LineType t);
+ Pen(unsigned int f);
+ virtual ~Pen();
RS2::LineType getLineType() const;
void setLineType(RS2::LineType t);
void setWidth(RS2::LineWidth w);
double getScreenWidth() const;
void setScreenWidth(double w);
- const RS_Color & getColor() const;
- void setColor(const RS_Color & c);
+ const Color & getColor() const;
+ void setColor(const Color & c);
bool isValid();
- bool operator==(const RS_Pen & p) const;
- bool operator!=(const RS_Pen & p) const;
+ bool operator==(const Pen & p) const;
+ bool operator!=(const Pen & p) const;
- friend std::ostream & operator<<(std::ostream & os, const RS_Pen & p);
+ friend std::ostream & operator<<(std::ostream & os, const Pen & p);
protected:
RS2::LineType lineType;
RS2::LineWidth width;
double screenWidth;
- RS_Color color;
+ Color color;
};
#endif
/**
* Default constructor.
*/
-RS_Point::RS_Point(RS_EntityContainer * parent, const RS_PointData & d):
- RS_AtomicEntity(parent), data(d)
+Point::Point(EntityContainer * parent, const PointData & d):
+ AtomicEntity(parent), data(d)
{
calculateBorders();
}
-/*virtual*/ RS_Entity * RS_Point::clone()
+/*virtual*/ Entity * Point::clone()
{
- RS_Point * p = new RS_Point(*this);
+ Point * p = new Point(*this);
p->initId();
return p;
}
/** @return RS_ENTITY_POINT */
-/*virtual*/ RS2::EntityType RS_Point::rtti() const
+/*virtual*/ RS2::EntityType Point::rtti() const
{
return RS2::EntityPoint;
}
/**
* @return Start point of the entity.
*/
-/*virtual*/ Vector RS_Point::getStartpoint() const
+/*virtual*/ Vector Point::getStartpoint() const
{
return data.pos;
}
/**
* @return End point of the entity.
*/
-/*virtual*/ Vector RS_Point::getEndpoint() const
+/*virtual*/ Vector Point::getEndpoint() const
{
return data.pos;
}
/** @return Copy of data that defines the point. */
-RS_PointData RS_Point::getData() const
+PointData Point::getData() const
{
return data;
}
/** @return Position of the point */
-Vector RS_Point::getPos()
+Vector Point::getPos()
{
return data.pos;
}
/** Sets a new position for this point. */
-void RS_Point::setPos(const Vector & pos)
+void Point::setPos(const Vector & pos)
{
data.pos = pos;
}
-void RS_Point::calculateBorders()
+void Point::calculateBorders()
{
minV = maxV = data.pos;
}
-VectorSolutions RS_Point::getRefPoints()
+VectorSolutions Point::getRefPoints()
{
VectorSolutions ret(data.pos);
return ret;
}
-Vector RS_Point::getNearestEndpoint(const Vector & coord, double * dist)
+Vector Point::getNearestEndpoint(const Vector & coord, double * dist)
{
if (dist != NULL)
*dist = data.pos.distanceTo(coord);
return data.pos;
}
-Vector RS_Point::getNearestPointOnEntity(const Vector & coord,
- bool /*onEntity*/, double * dist, RS_Entity ** entity)
+Vector Point::getNearestPointOnEntity(const Vector & coord,
+ bool /*onEntity*/, double * dist, Entity ** entity)
{
if (dist != NULL)
*dist = data.pos.distanceTo(coord);
return data.pos;
}
-Vector RS_Point::getNearestCenter(const Vector & coord, double * dist)
+Vector Point::getNearestCenter(const Vector & coord, double * dist)
{
if (dist != NULL)
*dist = data.pos.distanceTo(coord);
return data.pos;
}
-Vector RS_Point::getNearestMiddle(const Vector & coord, double * dist)
+Vector Point::getNearestMiddle(const Vector & coord, double * dist)
{
if (dist != NULL)
*dist = data.pos.distanceTo(coord);
return data.pos;
}
-Vector RS_Point::getNearestDist(double /*distance*/, const Vector & /*coord*/, double * dist)
+Vector Point::getNearestDist(double /*distance*/, const Vector & /*coord*/, double * dist)
{
if (dist != NULL)
*dist = RS_MAXDOUBLE;
return Vector(false);
}
-double RS_Point::getDistanceToPoint(const Vector & coord, RS_Entity ** entity,
+double Point::getDistanceToPoint(const Vector & coord, Entity ** entity,
RS2::ResolveLevel /*level*/, double /*solidDist*/)
{
if (entity != NULL)
return data.pos.distanceTo(coord);
}
-void RS_Point::moveStartpoint(const Vector & pos)
+void Point::moveStartpoint(const Vector & pos)
{
data.pos = pos;
calculateBorders();
}
-void RS_Point::move(Vector offset)
+void Point::move(Vector offset)
{
data.pos.move(offset);
calculateBorders();
}
-void RS_Point::rotate(Vector center, double angle)
+void Point::rotate(Vector center, double angle)
{
data.pos.rotate(center, angle);
calculateBorders();
}
-void RS_Point::scale(Vector center, Vector factor)
+void Point::scale(Vector center, Vector factor)
{
data.pos.scale(center, factor);
calculateBorders();
}
-void RS_Point::mirror(Vector axisPoint1, Vector axisPoint2)
+void Point::mirror(Vector axisPoint1, Vector axisPoint2)
{
data.pos.mirror(axisPoint1, axisPoint2);
calculateBorders();
}
-void RS_Point::draw(PaintInterface * painter, GraphicView * view, double /*patternOffset*/)
+void Point::draw(PaintInterface * painter, GraphicView * view, double /*patternOffset*/)
{
if (painter == NULL || view == NULL)
return;
/**
* Dumps the point's data to stdout.
*/
-std::ostream & operator<<(std::ostream & os, const RS_Point & p)
+std::ostream & operator<<(std::ostream & os, const Point & p)
{
os << " Point: " << p.getData() << "\n";
return os;
/**
* Holds the data that defines a point.
*/
-class RS_PointData
+class PointData
{
public:
- RS_PointData(const Vector & pos)
+ PointData(const Vector & pos)
{
this->pos = pos;
}
- friend std::ostream & operator<<(std::ostream & os, const RS_PointData & pd)
+ friend std::ostream & operator<<(std::ostream & os, const PointData & pd)
{
os << "(" << pd.pos << ")";
return os;
*
* @author Andrew Mustun
*/
-class RS_Point: public RS_AtomicEntity
+class Point: public AtomicEntity
{
public:
- RS_Point(RS_EntityContainer * parent, const RS_PointData & d);
+ Point(EntityContainer * parent, const PointData & d);
- virtual RS_Entity * clone();
+ virtual Entity * clone();
virtual RS2::EntityType rtti() const;
virtual Vector getStartpoint() const;
virtual Vector getEndpoint() const;
virtual void moveStartpoint(const Vector & pos);
- RS_PointData getData() const;
+ PointData getData() const;
virtual VectorSolutions getRefPoints();
Vector getPos();
void setPos(const Vector & pos);
virtual Vector getNearestEndpoint(const Vector & coord, double * dist = NULL);
virtual Vector getNearestPointOnEntity(const Vector & coord,
- bool onEntity = true, double * dist = NULL, RS_Entity ** entity = NULL);
+ bool onEntity = true, double * dist = NULL, Entity ** entity = NULL);
virtual Vector getNearestCenter(const Vector & coord, double * dist = NULL);
virtual Vector getNearestMiddle(const Vector & coord, double * dist = NULL);
virtual Vector getNearestDist(double distance, const Vector & coord, double * dist = NULL);
- virtual double getDistanceToPoint(const Vector& coord, RS_Entity ** entity = NULL,
+ virtual double getDistanceToPoint(const Vector& coord, Entity ** entity = NULL,
RS2::ResolveLevel level = RS2::ResolveNone, double solidDist = RS_MAXDOUBLE);
virtual void move(Vector offset);
virtual void mirror(Vector axisPoint1, Vector axisPoint2);
virtual void draw(PaintInterface * painter, GraphicView * view, double patternOffset = 0.0);
- friend std::ostream & operator<<(std::ostream & os, const RS_Point & p);
+ friend std::ostream & operator<<(std::ostream & os, const Point & p);
/** Recalculates the borders of this entity. */
virtual void calculateBorders();
protected:
- RS_PointData data;
+ PointData data;
//Vector point;
};
/**
* Constructor.
*/
-RS_Polyline::RS_Polyline(RS_EntityContainer * parent): RS_EntityContainer(parent),
+Polyline::Polyline(EntityContainer * parent): EntityContainer(parent),
closingEntity(NULL), nextBulge(0.0)
{
}
* Constructor.
* @param d Polyline data
*/
-RS_Polyline::RS_Polyline(RS_EntityContainer* parent, const RS_PolylineData& d):
- RS_EntityContainer(parent), data(d)
+Polyline::Polyline(EntityContainer* parent, const PolylineData& d):
+ EntityContainer(parent), data(d)
{
closingEntity = NULL;
nextBulge = 0.0;
/**
* Destructor
*/
-RS_Polyline::~RS_Polyline()
+Polyline::~Polyline()
{
}
-/*virtual*/ RS_Entity * RS_Polyline::clone()
+/*virtual*/ Entity * Polyline::clone()
{
- RS_Polyline * p = new RS_Polyline(*this);
+ Polyline * p = new Polyline(*this);
#warning "!!! Need to deal with setAutoDelete() Qt3->Qt4 !!!"
// p->entities.setAutoDelete(entities.autoDelete());
p->initId();
}
/** @return RS2::EntityPolyline */
-/*virtual*/ RS2::EntityType RS_Polyline::rtti() const
+/*virtual*/ RS2::EntityType Polyline::rtti() const
{
return RS2::EntityPolyline;
}
/** @return Copy of data that defines the polyline. */
-RS_PolylineData RS_Polyline::getData() const
+PolylineData Polyline::getData() const
{
return data;
}
/** sets a new start point of the polyline */
-void RS_Polyline::setStartpoint(Vector & v)
+void Polyline::setStartpoint(Vector & v)
{
data.startpoint = v;
}
/** @return Start point of the entity */
-Vector RS_Polyline::getStartpoint()
+Vector Polyline::getStartpoint()
{
return data.startpoint;
}
/** sets a new end point of the polyline */
-void RS_Polyline::setEndpoint(Vector & v)
+void Polyline::setEndpoint(Vector & v)
{
data.endpoint = v;
}
/** @return End point of the entity */
-Vector RS_Polyline::getEndpoint()
+Vector Polyline::getEndpoint()
{
return data.endpoint;
}
/**
* Removes the last vertex of this polyline.
*/
-void RS_Polyline::removeLastVertex()
+void Polyline::removeLastVertex()
{
- RS_Entity * last = lastEntity();
+ Entity * last = lastEntity();
if (last != NULL)
{
if (last != NULL)
{
if (last->isAtomic())
- data.endpoint = ((RS_AtomicEntity*)last)->getEndpoint();
+ data.endpoint = ((AtomicEntity*)last)->getEndpoint();
else
- RS_DEBUG->print(RS_Debug::D_WARNING, "RS_Polyline::removeLastVertex: "
+ DEBUG->print(Debug::D_WARNING, "Polyline::removeLastVertex: "
"polyline contains non-atomic entity");
}
}
* @return Pointer to the entity that was addded or NULL if this
* was the first vertex added.
*/
-RS_Entity * RS_Polyline::addVertex(const Vector & v, double bulge, bool prepend)
+Entity * Polyline::addVertex(const Vector & v, double bulge, bool prepend)
{
- RS_Entity * entity = NULL;
+ Entity * entity = NULL;
//static double nextBulge = 0.0;
// very first vertex:
entity = createVertex(v, nextBulge, prepend);
if (entity!=NULL) {
if (prepend==false) {
- RS_EntityContainer::addEntity(entity);
+ EntityContainer::addEntity(entity);
data.endpoint = v;
}
else {
- RS_EntityContainer::insertEntity(0, entity);
+ EntityContainer::insertEntity(0, entity);
data.startpoint = v;
}
}
* @return Pointer to the entity that was created or NULL if this
* was the first vertex added.
*/
-RS_Entity* RS_Polyline::createVertex(const Vector& v, double bulge, bool prepend) {
+Entity* Polyline::createVertex(const Vector& v, double bulge, bool prepend) {
- RS_Entity* entity=NULL;
+ Entity* entity=NULL;
- RS_DEBUG->print("RS_Polyline::createVertex: %f/%f to %f/%f bulge: %f",
+ DEBUG->print("Polyline::createVertex: %f/%f to %f/%f bulge: %f",
data.endpoint.x, data.endpoint.y, v.x, v.y, bulge);
// create line for the polyline:
if (fabs(bulge)<RS_TOLERANCE) {
if (prepend==false) {
- entity = new RS_Line(this, RS_LineData(data.endpoint, v));
+ entity = new Line(this, LineData(data.endpoint, v));
}
else {
- entity = new RS_Line(this, RS_LineData(v, data.startpoint));
+ entity = new Line(this, LineData(v, data.startpoint));
}
entity->setSelected(isSelected());
- entity->setPen(RS_Pen(RS2::FlagInvalid));
+ entity->setPen(Pen(RS2::FlagInvalid));
entity->setLayer(NULL);
- //RS_EntityContainer::addEntity(entity);
+ //EntityContainer::addEntity(entity);
//data.endpoint = v;
}
// alpha can't be 0.0 at this point
radius = fabs(dist / sin(alpha/2.0));
- double wu = fabs(RS_Math::pow(radius, 2.0) - RS_Math::pow(dist, 2.0));
+ double wu = fabs(Math::pow(radius, 2.0) - Math::pow(dist, 2.0));
double h = sqrt(wu);
if (bulge>0.0) {
a2 = center.angleTo(data.startpoint);
}
- RS_ArcData d(center, radius,
+ ArcData d(center, radius,
a1, a2,
reversed);
- entity = new RS_Arc(this, d);
+ entity = new Arc(this, d);
entity->setSelected(isSelected());
- entity->setPen(RS_Pen(RS2::FlagInvalid));
+ entity->setPen(Pen(RS2::FlagInvalid));
entity->setLayer(NULL);
}
/**
* Ends polyline and adds the last entity if the polyline is closed
*/
-void RS_Polyline::endPolyline()
+void Polyline::endPolyline()
{
- RS_DEBUG->print("RS_Polyline::endPolyline");
+ DEBUG->print("Polyline::endPolyline");
if (isClosed())
{
- RS_DEBUG->print("RS_Polyline::endPolyline: adding closing entity");
+ DEBUG->print("Polyline::endPolyline: adding closing entity");
// remove old closing entity:
if (closingEntity!=NULL)
closingEntity = createVertex(data.startpoint, nextBulge);
if (closingEntity!=NULL)
{
- RS_EntityContainer::addEntity(closingEntity);
+ EntityContainer::addEntity(closingEntity);
//data.endpoint = data.startpoint;
}
}
/**
* @return The bulge of the closing entity.
*/
-double RS_Polyline::getClosingBulge()
+double Polyline::getClosingBulge()
{
if (isClosed()) {
- RS_Entity* e = lastEntity();
+ Entity* e = lastEntity();
if (e!=NULL && e->rtti()==RS2::EntityArc) {
- return ((RS_Arc*)e)->getBulge();
+ return ((Arc*)e)->getBulge();
}
}
/**
* Sets the polylines start and endpoint to match the first and last vertex.
*/
-void RS_Polyline::updateEndpoints()
+void Polyline::updateEndpoints()
{
- RS_Entity * e1 = firstEntity();
+ Entity * e1 = firstEntity();
if (e1 != NULL && e1->isAtomic())
{
- Vector v = ((RS_AtomicEntity *)e1)->getStartpoint();
+ Vector v = ((AtomicEntity *)e1)->getStartpoint();
setStartpoint(v);
}
- RS_Entity * e2 = lastEntity();
+ Entity * e2 = lastEntity();
if (isClosed())
{
if (e2 != NULL && e2->isAtomic())
{
- Vector v = ((RS_AtomicEntity *)e2)->getEndpoint();
+ Vector v = ((AtomicEntity *)e2)->getEndpoint();
setEndpoint(v);
}
}
/** @return true if the polyline is closed. false otherwise */
-bool RS_Polyline::isClosed() const
+bool Polyline::isClosed() const
{
return data.getFlag(RS2::FlagClosed);
}
-void RS_Polyline::setClosed(bool cl)
+void Polyline::setClosed(bool cl)
{
if (cl)
data.setFlag(RS2::FlagClosed);
*
* To add entities use addVertex() or addSegment() instead.
*/
-void RS_Polyline::addEntity(RS_Entity * entity)
+void Polyline::addEntity(Entity * entity)
{
- RS_DEBUG->print(RS_Debug::D_WARNING, "RS_Polyline::addEntity: should never be called");
+ DEBUG->print(Debug::D_WARNING, "Polyline::addEntity: should never be called");
if (entity == NULL)
return;
delete entity;
}
-/*virtual*/ void RS_Polyline::setNextBulge(double bulge)
+/*virtual*/ void Polyline::setNextBulge(double bulge)
{
nextBulge = bulge;
}
/**
* Adds a segment to the polyline.
*/
-/*void RS_Polyline::addSegment(RS_Entity* entity) {
- RS_EntityContainer::addEntity(entity);
+/*void Polyline::addSegment(Entity* entity) {
+ EntityContainer::addEntity(entity);
// TODO: reorder and check polyline
}*/
-VectorSolutions RS_Polyline::getRefPoints()
+VectorSolutions Polyline::getRefPoints()
{
VectorSolutions ret(count()+1);
ret.set(0, data.startpoint);
i++;
- for (RS_Entity* e=firstEntity(RS2::ResolveNone);
+ for (Entity* e=firstEntity(RS2::ResolveNone);
e!=NULL;
e = nextEntity(RS2::ResolveNone), i++) {
if (e->isAtomic()) {
- ret.set(i, ((RS_AtomicEntity*)e)->getEndpoint());
+ ret.set(i, ((AtomicEntity*)e)->getEndpoint());
}
}
return ret;
}
-Vector RS_Polyline::getNearestRef(const Vector& coord,
+Vector Polyline::getNearestRef(const Vector& coord,
double* dist) {
- return RS_Entity::getNearestRef(coord, dist);
+ return Entity::getNearestRef(coord, dist);
}
-Vector RS_Polyline::getNearestSelectedRef(const Vector& coord,
+Vector Polyline::getNearestSelectedRef(const Vector& coord,
double* dist) {
- return RS_Entity::getNearestSelectedRef(coord, dist);
+ return Entity::getNearestSelectedRef(coord, dist);
}
/*
-void RS_Polyline::reorder() {
+void Polyline::reorder() {
// current point:
Vector cp;
-void RS_Polyline::move(Vector offset) {
- RS_EntityContainer::move(offset);
+void Polyline::move(Vector offset) {
+ EntityContainer::move(offset);
data.startpoint.move(offset);
data.endpoint.move(offset);
}
-void RS_Polyline::rotate(Vector center, double angle) {
- RS_EntityContainer::rotate(center, angle);
+void Polyline::rotate(Vector center, double angle) {
+ EntityContainer::rotate(center, angle);
data.startpoint.rotate(center, angle);
data.endpoint.rotate(center, angle);
}
-void RS_Polyline::scale(Vector center, Vector factor) {
- RS_EntityContainer::scale(center, factor);
+void Polyline::scale(Vector center, Vector factor) {
+ EntityContainer::scale(center, factor);
data.startpoint.scale(center, factor);
data.endpoint.scale(center, factor);
}
-void RS_Polyline::mirror(Vector axisPoint1, Vector axisPoint2) {
- RS_EntityContainer::mirror(axisPoint1, axisPoint2);
+void Polyline::mirror(Vector axisPoint1, Vector axisPoint2) {
+ EntityContainer::mirror(axisPoint1, axisPoint2);
data.startpoint.mirror(axisPoint1, axisPoint2);
data.endpoint.mirror(axisPoint1, axisPoint2);
}
-void RS_Polyline::moveRef(const Vector & ref, const Vector & offset)
+void Polyline::moveRef(const Vector & ref, const Vector & offset)
{
- RS_EntityContainer::moveRef(ref, offset);
+ EntityContainer::moveRef(ref, offset);
if (ref.distanceTo(data.startpoint) < 1.0e-4)
data.startpoint.move(offset);
//update();
}
-void RS_Polyline::stretch(Vector firstCorner, Vector secondCorner, Vector offset)
+void Polyline::stretch(Vector firstCorner, Vector secondCorner, Vector offset)
{
if (data.startpoint.isInWindow(firstCorner, secondCorner))
data.startpoint.move(offset);
if (data.endpoint.isInWindow(firstCorner, secondCorner))
data.endpoint.move(offset);
- RS_EntityContainer::stretch(firstCorner, secondCorner, offset);
+ EntityContainer::stretch(firstCorner, secondCorner, offset);
}
/**
* Slightly optimized drawing for polylines.
*/
-void RS_Polyline::draw(PaintInterface * painter, GraphicView * view, double /*patternOffset*/)
+void Polyline::draw(PaintInterface * painter, GraphicView * view, double /*patternOffset*/)
{
if (!painter || !view)
return;
// draw first entity and set correct pen:
- RS_Entity * e = firstEntity(RS2::ResolveNone);
+ Entity * e = firstEntity(RS2::ResolveNone);
view->drawEntity(e);
// draw subsequent entities with same pen:
- for(RS_Entity * e=nextEntity(RS2::ResolveNone); e!=NULL; e = nextEntity(RS2::ResolveNone))
+ for(Entity * e=nextEntity(RS2::ResolveNone); e!=NULL; e = nextEntity(RS2::ResolveNone))
view->drawEntityPlain(e);
}
/**
* Dumps the point's data to stdout.
*/
-std::ostream & operator<<(std::ostream & os, const RS_Polyline & l)
+std::ostream & operator<<(std::ostream & os, const Polyline & l)
{
os << " Polyline: " << l.getData() << " {\n";
- os << (RS_EntityContainer &)l;
+ os << (EntityContainer &)l;
os << "\n}\n";
return os;
/**
* Holds the data that defines a polyline.
*/
-class RS_PolylineData: public RS_Flags
+class PolylineData: public Flags
{
public:
- RS_PolylineData()
+ PolylineData()
{
startpoint = endpoint = Vector(false);
}
- RS_PolylineData(const Vector & startpoint, const Vector & endpoint, bool closed)
+ PolylineData(const Vector & startpoint, const Vector & endpoint, bool closed)
{
this->startpoint = startpoint;
this->endpoint = endpoint;
- if (closed == true)
+ if (closed)
setFlag(RS2::FlagClosed);
}
- friend class RS_Polyline;
+ friend class Polyline;
- friend std::ostream & operator<<(std::ostream & os, const RS_PolylineData & pd)
+ friend std::ostream & operator<<(std::ostream & os, const PolylineData & pd)
{
os << "(" << pd.startpoint << "/" << pd.endpoint << ")";
return os;
*
* @author Andrew Mustun
*/
-class RS_Polyline: public RS_EntityContainer
+class Polyline: public EntityContainer
{
public:
- RS_Polyline(RS_EntityContainer * parent = NULL);
- RS_Polyline(RS_EntityContainer * parent, const RS_PolylineData & d);
- virtual ~RS_Polyline();
+ Polyline(EntityContainer * parent = NULL);
+ Polyline(EntityContainer * parent, const PolylineData & d);
+ virtual ~Polyline();
- virtual RS_Entity * clone();
+ virtual Entity * clone();
virtual RS2::EntityType rtti() const;
- RS_PolylineData getData() const;
+ PolylineData getData() const;
void setStartpoint(Vector & v);
Vector getStartpoint();
void setEndpoint(Vector & v);
virtual VectorSolutions getRefPoints();
virtual Vector getNearestRef(const Vector & coord, double * dist = NULL);
virtual Vector getNearestSelectedRef(const Vector & coord, double * dist = NULL);
- virtual RS_Entity * addVertex(const Vector & v, double bulge = 0.0, bool prepend = false);
+ virtual Entity * addVertex(const Vector & v, double bulge = 0.0, bool prepend = false);
virtual void setNextBulge(double bulge);
- virtual void addEntity(RS_Entity * entity);
- //virtual void addSegment(RS_Entity* entity);
+ virtual void addEntity(Entity * entity);
+ //virtual void addSegment(Entity* entity);
virtual void removeLastVertex();
virtual void endPolyline();
//virtual void reorder();
virtual void stretch(Vector firstCorner, Vector secondCorner, Vector offset);
virtual void draw(PaintInterface * painter, GraphicView * view, double patternOffset = 0.0);
- friend std::ostream & operator<<(std::ostream & os, const RS_Polyline & l);
+ friend std::ostream & operator<<(std::ostream & os, const Polyline & l);
protected:
- virtual RS_Entity * createVertex(const Vector & v, double bulge = 0.0, bool prepend = false);
+ virtual Entity * createVertex(const Vector & v, double bulge = 0.0, bool prepend = false);
protected:
- RS_PolylineData data;
- RS_Entity * closingEntity;
+ PolylineData data;
+ Entity * closingEntity;
double nextBulge;
};
/**
* Constructor.
*/
-RS_Preview::RS_Preview(RS_EntityContainer * parent): RS_EntityContainer(parent),
+Preview::Preview(EntityContainer * parent): EntityContainer(parent),
visible(false)
{
settings.beginGroup("Appearance");
/**
* Destructor.
*/
-RS_Preview::~RS_Preview()
+Preview::~Preview()
{
}
* Adds an entity to this preview and removes any attributes / layer
* connectsions before that.
*/
-void RS_Preview::addEntity(RS_Entity * entity)
+void Preview::addEntity(Entity * entity)
{
if (entity == NULL || entity->isUndone())
return;
Vector min = entity->getMin();
Vector max = entity->getMax();
- RS_Line * l1 = new RS_Line(this, RS_LineData(Vector(min.x, min.y), Vector(max.x, min.y)));
- RS_Line * l2 = new RS_Line(this, RS_LineData(Vector(max.x, min.y), Vector(max.x, max.y)));
- RS_Line * l3 = new RS_Line(this, RS_LineData(Vector(max.x, max.y), Vector(min.x, max.y)));
- RS_Line * l4 = new RS_Line(this, RS_LineData(Vector(min.x, max.y), Vector(min.x, min.y)));
+ Line * l1 = new Line(this, LineData(Vector(min.x, min.y), Vector(max.x, min.y)));
+ Line * l2 = new Line(this, LineData(Vector(max.x, min.y), Vector(max.x, max.y)));
+ Line * l3 = new Line(this, LineData(Vector(max.x, max.y), Vector(min.x, max.y)));
+ Line * l4 = new Line(this, LineData(Vector(min.x, max.y), Vector(min.x, min.y)));
- RS_EntityContainer::addEntity(l1);
- RS_EntityContainer::addEntity(l2);
- RS_EntityContainer::addEntity(l3);
- RS_EntityContainer::addEntity(l4);
+ EntityContainer::addEntity(l1);
+ EntityContainer::addEntity(l2);
+ EntityContainer::addEntity(l3);
+ EntityContainer::addEntity(l4);
delete entity;
entity = NULL;
entity->setLayer(NULL);
entity->setSelected(false);
entity->reparent(this);
- entity->setPen(RS_Pen(RS_Color(255, 255, 255), RS2::Width00, RS2::SolidLine));
- RS_EntityContainer::addEntity(entity);
+ entity->setPen(Pen(Color(255, 255, 255), RS2::Width00, RS2::SolidLine));
+ EntityContainer::addEntity(entity);
}
}
/**
* Clones the given entity and adds the clone to the preview.
*/
-void RS_Preview::addCloneOf(RS_Entity * entity)
+void Preview::addCloneOf(Entity * entity)
{
if (!entity)
return;
- RS_Entity * clone = entity->clone();
+ Entity * clone = entity->clone();
addEntity(clone);
}
/**
* Adds all entities from 'container' to the preview (unselected).
*/
-void RS_Preview::addAllFrom(RS_EntityContainer & container)
+void Preview::addAllFrom(EntityContainer & container)
{
int c = 0;
- for(RS_Entity * e=container.firstEntity(); e!=NULL; e=container.nextEntity())
+ for(Entity * e=container.firstEntity(); e!=NULL; e=container.nextEntity())
{
if (c < maxEntities)
{
- RS_Entity * clone = e->clone();
+ Entity * clone = e->clone();
clone->setSelected(false);
clone->reparent(this);
/**
* Adds all selected entities from 'container' to the preview (unselected).
*/
-void RS_Preview::addSelectionFrom(RS_EntityContainer & container)
+void Preview::addSelectionFrom(EntityContainer & container)
{
int c = 0;
- for(RS_Entity * e=container.firstEntity(); e!=NULL; e=container.nextEntity())
+ for(Entity * e=container.firstEntity(); e!=NULL; e=container.nextEntity())
{
if (e->isSelected() && c < maxEntities)
{
- RS_Entity * clone = e->clone();
+ Entity * clone = e->clone();
clone->setSelected(false);
clone->reparent(this);
* Adds all entities in the given range and those which have endpoints in the
* given range to the preview.
*/
-void RS_Preview::addStretchablesFrom(RS_EntityContainer & container, const Vector & v1,
+void Preview::addStretchablesFrom(EntityContainer & container, const Vector & v1,
const Vector & v2)
{
int c = 0;
- for(RS_Entity * e=container.firstEntity(); e!=NULL; e=container.nextEntity())
+ for(Entity * e=container.firstEntity(); e!=NULL; e=container.nextEntity())
{
if (e->isVisible() && e->rtti() != RS2::EntityHatch && (e->isInWindow(v1, v2)
|| e->hasEndpointsWithinWindow(v1, v2)) && c < maxEntities)
{
- RS_Entity * clone = e->clone();
+ Entity * clone = e->clone();
//clone->setSelected(false);
clone->reparent(this);
}
}
-void RS_Preview::SetOffset(Vector v)
+void Preview::SetOffset(Vector v)
{
offset = v;
}
-Vector RS_Preview::Offset(void)
+Vector Preview::Offset(void)
{
return offset;
}
-void RS_Preview::SetVisible(bool visibility/*= true*/)
+void Preview::SetVisible(bool visibility/*= true*/)
{
visible = visibility;
}
-bool RS_Preview::Visible(void)
+bool Preview::Visible(void)
{
return visible;
}
-void RS_Preview::Draw(GraphicView * view, PaintInterface * painter)
+void Preview::Draw(GraphicView * view, PaintInterface * painter)
{
if (isEmpty())
return;
- painter->setPen(RS_Pen(RS_Color(60, 255, 80), RS2::Width00, RS2::SolidLine));
+ painter->setPen(Pen(Color(60, 255, 80), RS2::Width00, RS2::SolidLine));
painter->setOffset(offset);
// We have to traverse the container ourselves, because RS_Container::draw()
// uses drawEntity() instead of drawEntityPlain()...
- for(RS_Entity * e=firstEntity(RS2::ResolveNone); e!=NULL; e=nextEntity(RS2::ResolveNone))
+ for(Entity * e=firstEntity(RS2::ResolveNone); e!=NULL; e=nextEntity(RS2::ResolveNone))
view->drawEntityPlain(e);
painter->setOffset(Vector(0, 0));
#include "entitycontainer.h"
#include "vector.h"
-class RS_Entity;
+class Entity;
class PaintInterface;
/**
- * This class supports previewing. The RS_Snapper class uses
- * an instance of RS_Preview to preview entities, ranges,
+ * This class supports previewing. The Snapper class uses
+ * an instance of Preview to preview entities, ranges,
* lines, arcs, ... on the fly.
*
* @author Andrew Mustun
*/
-class RS_Preview: public RS_EntityContainer
+class Preview: public EntityContainer
{
public:
- RS_Preview(RS_EntityContainer * parent = NULL);
- ~RS_Preview();
+ Preview(EntityContainer * parent = NULL);
+ ~Preview();
- virtual void addEntity(RS_Entity * entity);
- void addCloneOf(RS_Entity * entity);
- virtual void addSelectionFrom(RS_EntityContainer & container);
- virtual void addAllFrom(RS_EntityContainer & container);
- virtual void addStretchablesFrom(RS_EntityContainer & container,
+ virtual void addEntity(Entity * entity);
+ void addCloneOf(Entity * entity);
+ virtual void addSelectionFrom(EntityContainer & container);
+ virtual void addAllFrom(EntityContainer & container);
+ virtual void addStretchablesFrom(EntityContainer & container,
const Vector & v1, const Vector & v2);
void SetOffset(Vector);
+++ /dev/null
-// python.cpp
-//
-// Part of the Architektonas Project
-// Originally part of QCad Community Edition by Andrew Mustun
-// Extensively rewritten and refactored by James L. Hammons
-// Portions copyright (C) 2001-2003 RibbonSoft
-// Copyright (C) 2010 Underground Software
-// See the README and GPLv2 files for licensing and warranty information
-//
-// JLH = James L. Hammons <jlhamm@acm.org>
-//
-// Who When What
-// --- ---------- -----------------------------------------------------------
-// JLH 06/02/2010 Added this text. :-)
-//
-
-#include "python.h"
-
-#ifdef RS_OPT_PYTHON
-
-//
-// This is exported from the Boost::Python library declarations
-// that are declared inside rs_python_wrappers.cpp.
-//
-extern "C" void initqcad();
-
-/**
- * The unique instance of the Python scripting engine
- */
-RS_Python* RS_Python::uniqueInstance = NULL;
-
-/**
- * Constructor
- */
-RS_Python::RS_Python()
-{
- graphic = NULL;
- Py_Initialize();
- initqcad();
-}
-
-/**
- * Gets the one and only RS_Python instance
- * (creates a new one on first call only)
- *
- * @return Pointer to the single instance of this
- * singleton class
- */
-RS_Python* RS_Python::instance() {
- if(uniqueInstance==NULL) {
- uniqueInstance = new RS_Python;
- }
- return uniqueInstance;
-}
-
-
-/**
- * Launches the given script.
- */
-int RS_Python::launch(const QString& script) {
- PyObject *modname, *mod, *mdict, *func, *rslt;
- //Py_SetProgramName(argv[0]);
-
- modname = PyString_FromString(script);
- mod = PyImport_Import(modname);
- if (mod) {
- //printf( "mod\n");
- mdict = PyModule_GetDict(mod);
-
- // Borrowed reference to start function
- func = PyDict_GetItemString(mdict, "start");
- if (func) {
- //printf( "func\n");
- if (PyCallable_Check(func)) {
- //printf("calling..\n");
- rslt = PyObject_CallFunction(func, "(s)", "noparam");
- //printf("calling ok\n");
- if (rslt) {
- // The result value is currently not used
- Py_XDECREF(rslt);
- } else
- {
- // Give user some feed back what went wrong
- printf("*** PYTHON RUNTIME ERROR ***\n");
- PyErr_Print();
- }
- }
- } else {
- printf("no such function: start\n");
- }
- Py_XDECREF(mod);
- } else {
- printf("*** ERROR LOADING SCRIPT '%s' ***\n", script.latin1());
- PyErr_Print();
- }
- Py_XDECREF(modname);
- //Py_Finalize();
- return 0;
-}
-
-#endif
+++ /dev/null
-#ifndef __PYTHON_H__
-#define __PYTHON_H__
-
-#ifdef RS_OPT_PYTHON
-
-#include "Python.h"
-
-#include "drawing.h"
-
-#define __PYTHON RS_Python::instance()
-
-/**
- * Python scripting support.
- *
- * OBSOLETE
- *
- * @author Andrew Mustun
- */
-class RS_Python {
-private:
- RS_Python();
-
-public:
- static RS_Python* instance();
-
- void setGraphic(Drawing* g) {
- graphic = g;
- }
-
- Drawing* getGraphic() {
- return graphic;
- }
-
- int launch(const QString& script);
-
-private:
- static RS_Python* uniqueInstance;
- Drawing* graphic;
-};
-
-#endif
-
-#endif
+++ /dev/null
-/***************************************************************************
-** $Id
-**
-** Python language bindings for QCad II
-**
-** Copyright (C) 2003 Markus Meyer <meyer@mesw.de>
-**
-** Permission to copy, use, modify, sell and distribute this file is granted
-** provided this copyright notice is not removed or altered.
-** This software is provided "as is" without express or implied
-** warranty, and with no claim as to its suitability for any purpose.
-**
-***************************************************************************/
-
-/**
- * TODO:
- * - Complete block support
- * - Support for hatches, dimensions, text, solids
- * - Support for user interactions
- * - Support for more than one document
- */
-#ifdef RS_OPT_PYTHON
-
-#include <boost/python.hpp>
-using namespace boost::python;
-
-#include "python_wrappers.h"
-#include "python.h"
-
-#include "rs.h"
-#include "arc.h"
-#include "atomicentity.h"
-#include "block.h"
-#include "blocklist.h"
-#include "circle.h"
-#include "color.h"
-#include "constructionline.h"
-#include "document.h"
-#include "ellipse.h"
-#include "entitycontainer.h"
-#include "entity.h"
-#include "flags.h"
-#include "drawing.h"
-#include "image.h"
-#include "insert.h"
-#include "layer.h"
-#include "layerlist.h"
-#include "line.h"
-#include "pen.h"
-#include "point.h"
-#include "polyline.h"
-#include "vector.h"
-
-/* Global root functions */
-Drawing* currentGraphic() { return RS_PYTHON->getGraphic(); }
-
- /* more to be added later (access to global properties, all documents,
- creation of new documents, ... */
-
-/* To/From Python string conversion logic for string management */
-namespace QString_Python_Conversions {
- namespace {
- struct QString_to_python_str
- {
- static PyObject* convert(QString const& s)
- {
- return boost::python::incref(boost::python::object((const char*)s).ptr());
- }
- };
-
- struct QString_from_python_str
- {
- QString_from_python_str()
- {
- boost::python::converter::registry::push_back(
- &convertible,
- &construct,
- boost::python::type_id<QString>());
- }
-
- static void* convertible(PyObject* obj_ptr)
- {
- if (!PyString_Check(obj_ptr)) return 0;
- return obj_ptr;
- }
-
- static void construct(
- PyObject* obj_ptr,
- boost::python::converter::rvalue_from_python_stage1_data* data)
- {
- const char* value = PyString_AsString(obj_ptr);
- if (!value)
- boost::python::throw_error_already_set();
- void* storage = (
- (boost::python::converter::rvalue_from_python_storage<QString>*)
- data)->storage.bytes;
- new (storage) QString(value);
- data->convertible = storage;
- }
- };
-
- void registerConversions()
- {
- using namespace boost::python;
-
- boost::python::to_python_converter<
- QString, QString_to_python_str>();
-
- QString_from_python_str();
- }
- }
-}
-
-/* Transfer of ownership is done by using auto pointers */
-/* These are the helper functions needed for this mechanism */
-
-#define TRANSFER_OWNERSHIP_FUNCTION(fname, container, addfunc, entity) \
- void fname(container& cont, std::auto_ptr<entity> obj) \
- { cont.addfunc(obj.get()); obj.release(); }
-
-TRANSFER_OWNERSHIP_FUNCTION(Drawing_addLayer, Drawing, addLayer, RS_Layer)
-TRANSFER_OWNERSHIP_FUNCTION(RS_LayerList_add, RS_LayerList, add, RS_Layer)
-
-#define ADDVERTEX_FUNCTION(fname, entity) \
- TRANSFER_OWNERSHIP_FUNCTION(fname, RS_EntityContainer, addEntity, entity)
-
-ADDVERTEX_FUNCTION(RS_EntityContainer_addArc, RS_Arc)
-ADDVERTEX_FUNCTION(RS_EntityContainer_addBlock, RS_Block)
-ADDVERTEX_FUNCTION(RS_EntityContainer_addCircle, RS_Circle)
-ADDVERTEX_FUNCTION(RS_EntityContainer_addConstructionLine, RS_ConstructionLine)
-ADDVERTEX_FUNCTION(RS_EntityContainer_addEllipse, RS_Ellipse)
-ADDVERTEX_FUNCTION(RS_EntityContainer_addImage, RS_Image)
-ADDVERTEX_FUNCTION(RS_EntityContainer_addLine, RS_Line)
-ADDVERTEX_FUNCTION(RS_EntityContainer_addPoint, RS_Point)
-ADDVERTEX_FUNCTION(RS_EntityContainer_addPolyline, RS_Polyline)
-
-/* Overloaded functions helpers */
-void (RS_LayerList::*RS_LayerList_activate_string)(const QString&) = &RS_LayerList::activate;
-void (RS_LayerList::*RS_LayerList_activate_layer)(RS_Layer*) = &RS_LayerList::activate;
-void (RS_LayerList::*RS_LayerList_toggle_string)(const QString&) = &RS_LayerList::toggle;
-void (RS_LayerList::*RS_LayerList_toggle_layer)(const QString&) = &RS_LayerList::toggle;
-void (Drawing::*Drawing_toggleLayer_string)(const QString&) = &Drawing::toggleLayer;
-void (Drawing::*Drawing_toggleLayer_layer)(RS_Layer*) = &Drawing::toggleLayer;
-void (RS_Entity::*RS_Entity_setLayer_string)(const QString&) = &RS_Entity::setLayer;
-void (RS_Entity::*RS_Entity_setLayer_layer)(RS_Layer*) = &RS_Entity::setLayer;
-
-/**
- * The main python module
- */
-
-BOOST_PYTHON_MODULE(qcad)
-{
- /* Initialization code */
- QString_Python_Conversions::registerConversions();
-
- /* Unbound functions */
-
- def("currentGraphic", currentGraphic, return_value_policy<reference_existing_object>());
-
- /* Enums */
- enum_<RS2::Flags>("Flag")
- .value("Undone", RS2::FlagUndone)
- .value("Visible", RS2::FlagVisible)
- .value("ByLayer", RS2::FlagByLayer)
- .value("ByBlock", RS2::FlagByBlock)
- .value("Frozen", RS2::FlagFrozen)
- .value("DefFrozen", RS2::FlagDefFrozen)
- .value("Locked", RS2::FlagLocked)
- .value("Invalid", RS2::FlagInvalid)
- .value("Selected", RS2::FlagSelected)
- .value("Closed", RS2::FlagClosed)
- .value("Temp", RS2::FlagTemp)
- .value("Processed", RS2::FlagProcessed)
- .value("Selected1", RS2::FlagSelected1)
- .value("Selected2", RS2::FlagSelected2)
- ;
-
- enum_<RS2::VariableType>("VariableType")
- .value("String", RS2::VariableString)
- .value("Int", RS2::VariableInt)
- .value("Double", RS2::VariableDouble)
- .value("Vector", RS2::VariableVector)
- .value("Void", RS2::VariableVoid)
- ;
-
- enum_<RS2::EntityType>("EntityType")
- .value("Unknown", RS2::EntityUnknown)
- .value("Container", RS2::EntityContainer)
- .value("Block", RS2::EntityBlock)
- .value("FontChar", RS2::EntityFontChar)
- .value("Insert", RS2::EntityInsert)
- .value("Graphic", RS2::EntityGraphic)
- .value("Point", RS2::EntityPoint)
- .value("Line", RS2::EntityLine)
- .value("Polyline", RS2::EntityPolyline)
- .value("Vertex", RS2::EntityVertex)
- .value("Arc", RS2::EntityArc)
- .value("Circle", RS2::EntityCircle)
- .value("Ellipse", RS2::EntityEllipse)
- .value("Solid", RS2::EntitySolid)
- .value("ConstructionLine", RS2::EntityConstructionLine)
- .value("Text", RS2::EntityText)
- .value("DimAligned", RS2::EntityDimAligned)
- .value("DimLinear", RS2::EntityDimLinear)
- .value("DimRadial", RS2::EntityDimRadial)
- .value("DimDiametric", RS2::EntityDimDiametric)
- .value("DimAngular", RS2::EntityDimAngular)
- .value("DimLeader", RS2::EntityDimLeader)
- .value("Hatch", RS2::EntityHatch)
- .value("Image", RS2::EntityImage)
- ;
-
- enum_<RS2::LineType>("LineType")
- .value("NoPen", RS2::NoPen)
- .value("SolidLine", RS2::SolidLine)
- .value("DotLine", RS2::DotLine)
- .value("DotLine2", RS2::DotLine2)
- .value("DotLineX2", RS2::DotLineX2)
- .value("DashLine", RS2::DashLine)
- .value("DashLine2", RS2::DashLine2)
- .value("DashLineX2", RS2::DashLineX2)
- .value("DashDotLine", RS2::DashDotLine)
- .value("DashDotLine2", RS2::DashDotLine2)
- .value("DashDotLineX2", RS2::DashDotLineX2)
- .value("DivideLine", RS2::DivideLine)
- .value("DivideLine2", RS2::DivideLine2)
- .value("DivideLineX2", RS2::DivideLineX2)
- .value("CenterLine", RS2::CenterLine)
- .value("CenterLine2", RS2::CenterLine2)
- .value("CenterLineX2", RS2::CenterLineX2)
- .value("BorderLine", RS2::BorderLine)
- .value("BorderLine2", RS2::BorderLine2)
- .value("BorderLineX2", RS2::BorderLineX2)
- .value("ByLayer", RS2::LineByLayer)
- .value("ByBlock", RS2::LineByBlock)
- ;
-
- enum_<RS2::LineWidth>("LineWidth")
- .value("Width00", RS2::Width00)
- .value("Width01", RS2::Width01)
- .value("Width02", RS2::Width02)
- .value("Width03", RS2::Width03)
- .value("Width04", RS2::Width04)
- .value("Width05", RS2::Width05)
- .value("Width06", RS2::Width06)
- .value("Width07", RS2::Width07)
- .value("Width08", RS2::Width08)
- .value("Width09", RS2::Width09)
- .value("Width10", RS2::Width10)
- .value("Width11", RS2::Width11)
- .value("Width12", RS2::Width12)
- .value("Width13", RS2::Width13)
- .value("Width14", RS2::Width14)
- .value("Width15", RS2::Width15)
- .value("Width16", RS2::Width16)
- .value("Width17", RS2::Width17)
- .value("Width18", RS2::Width18)
- .value("Width19", RS2::Width19)
- .value("Width20", RS2::Width20)
- .value("Width21", RS2::Width21)
- .value("Width22", RS2::Width22)
- .value("Width23", RS2::Width23)
- .value("ByLayer", RS2::WidthByLayer)
- .value("ByBlock", RS2::WidthByBlock)
- .value("Default", RS2::WidthDefault)
- ;
-
- /* "Small" classes */
-
- class_<RS_Flags>("Flags")
- .def(init<int>())
- .add_property("flags", &RS_Flags::getFlags, &RS_Flags::setFlags)
- .def("resetFlags", &RS_Flags::resetFlags)
- .def("setFlag", &RS_Flags::setFlag)
- .def("delFlag", &RS_Flags::delFlag)
- .def("toggleFlag", &RS_Flags::toggleFlag)
- .def("getFlag", &RS_Flags::getFlag)
- ;
-
- class_<RS_Color, bases<RS_Flags> >("Color")
- .def(init<int, int, int>())
- .def(init<int>())
- .def("stripFlags", &RS_Color::stripFlags)
- .add_property("byLayer", &RS_Color::isByLayer)
- .add_property("byBlock", &RS_Color::isByBlock)
- ;
-
- class_<RS_Vector>("Vector")
- .def(init<double, double, optional<double> >())
- .def("set", &RS_Vector::set)
- .def("setPolar", &RS_Vector::setPolar)
- .def("distanceTo", &RS_Vector::distanceTo)
- .def("angle", &RS_Vector::angle)
- .def("angleTo", &RS_Vector::angleTo)
- .def("magnitude", &RS_Vector::magnitude)
- .def("move", &RS_Vector::move)
- .def_readwrite("x", &RS_Vector::x)
- .def_readwrite("y", &RS_Vector::y)
- .def_readwrite("z", &RS_Vector::z)
- .def_readwrite("valid", &RS_Vector::valid)
- ;
-
- class_<RS_Pen, bases<RS_Flags> >("Pen")
- .def(init<const RS_Color&, RS2::LineWidth, RS2::LineType>())
- .add_property("lineType", &RS_Pen::getLineType, &RS_Pen::setLineType)
- .add_property("width", &RS_Pen::getWidth, &RS_Pen::setWidth)
- .add_property("screenWidth", &RS_Pen::getScreenWidth, &RS_Pen::setScreenWidth)
- .add_property("color", make_function(&RS_Pen::getColor, return_value_policy<reference_existing_object>()), &RS_Pen::setColor)
- .add_property("valid", &RS_Pen::isValid)
- ;
-
- /* Common stuff */
-
- class_<RS_EntityContainer>("EntityContainer", init<RS_EntityContainer*, optional<bool> >())
- /* Wrapper functions for ownership transfer */
- .def("addEntity", RS_EntityContainer_addArc)
- .def("addEntity", RS_EntityContainer_addBlock)
- .def("addEntity", RS_EntityContainer_addCircle)
- .def("addEntity", RS_EntityContainer_addConstructionLine)
- .def("addEntity", RS_EntityContainer_addEllipse)
- .def("addEntity", RS_EntityContainer_addImage)
- .def("addEntity", RS_EntityContainer_addLine)
- .def("addEntity", RS_EntityContainer_addPoint)
- .def("addEntity", RS_EntityContainer_addPolyline)
-
- /** Owner-Containers will automatically delete entities upon removing,
- * so no problem here. Other containers are not allowed in Python at the moment.
- */
- .def("removeEntity", &RS_EntityContainer::removeEntity)
-
- /* Standard wrappers */
- .def("clear", &RS_EntityContainer::clear)
- .add_property("empty", &RS_EntityContainer::isEmpty)
- .def("entityAt", &RS_EntityContainer::entityAt, return_value_policy<reference_existing_object>())
-
- /* Iterators */
- .def("firstEntity", &RS_EntityContainer::firstEntity, return_value_policy<reference_existing_object>())
- .def("lastEntity", &RS_EntityContainer::lastEntity, return_value_policy<reference_existing_object>())
- .def("nextEntity", &RS_EntityContainer::nextEntity, return_value_policy<reference_existing_object>())
- ;
-
- class_<RS_LayerData>("LayerData")
- .def(init<const QString&, const RS_Pen&, bool>())
- .def_readwrite("name", &RS_LayerData::name)
- .def_readwrite("pen", &RS_LayerData::pen)
- .def_readwrite("frozen", &RS_LayerData::frozen)
- ;
-
- class_<RS_Layer, std::auto_ptr<RS_Layer> >("Layer", init<const QString&>())
- .add_property("name", &RS_Layer::getName, &RS_Layer::setName)
- .add_property("pen", &RS_Layer::getPen, &RS_Layer::setPen)
- .add_property("frozen", &RS_Layer::isFrozen, &RS_Layer::freeze)
- .add_property("toggle", &RS_Layer::toggle)
- ;
-
- class_<RS_LayerList>("LayerList")
- .def("clear", &RS_LayerList::clear)
- .def("count", &RS_LayerList::count)
- .def("at", &RS_LayerList::at, return_value_policy<reference_existing_object>())
- .add_property("active", make_function(&RS_LayerList::getActive, return_value_policy<reference_existing_object>()),
- RS_LayerList_activate_layer)
- .def("activate", RS_LayerList_activate_string)
- .def("activate", RS_LayerList_activate_layer)
- .def("add", RS_LayerList_add)
- .def("remove", &RS_LayerList::remove)
- .def("edit", &RS_LayerList::edit)
- .def("find", &RS_LayerList::find, return_value_policy<reference_existing_object>())
- .def("toggle", RS_LayerList_toggle_string)
- .def("toggle", RS_LayerList_toggle_layer)
- .def("freezeAll", &RS_LayerList::freezeAll)
- ;
-
- class_<RS_Document, bases<RS_EntityContainer>, boost::noncopyable >("Document", no_init)
- .add_property("layerList", make_function(&RS_Document::getLayerList, return_value_policy<reference_existing_object>()))
- .add_property("blockList", make_function(&RS_Document::getBlockList, return_value_policy<reference_existing_object>()))
- .def("newDoc", &RS_Document::newDoc)
- .def("save", &RS_Document::save)
- .def("saveAs", &RS_Document::saveAs)
- .def("open", &RS_Document::open)
- .add_property("modified", &RS_Document::isModified)
- .add_property("activePen", &RS_Document::getActivePen, &RS_Document::setActivePen)
- .add_property("filename", &RS_Document::getFilename)
- ;
-
- class_<Drawing, bases<RS_Document> >("Graphic", init<RS_EntityContainer*>())
- .def("count", &Drawing::count)
- .def("findLayer", &Drawing::findLayer, return_value_policy<reference_existing_object>())
- .def("editLayer", &Drawing::editLayer)
- .def("addLayer", Drawing_addLayer)
- .def("removeLayer", &Drawing::removeLayer)
- .def("toggleLayer", Drawing_toggleLayer_string)
- .def("toggleLayer", Drawing_toggleLayer_layer)
- .def("clearLayers", &Drawing::clearLayers)
- .def("freezeAllLayers", &Drawing::freezeAllLayers)
- ;
-
- /* Entity types */
-
- class_<RS_Entity, boost::noncopyable>("Entity", no_init)
- .def("init", &RS_Entity::init)
- .def("initId", &RS_Entity::initId)
- .def("clone", &RS_Entity::clone, return_value_policy<reference_existing_object>())
- .def("reparent", &RS_Entity::reparent)
- .def("resetBorders", &RS_Entity::resetBorders)
- .add_property("id", &RS_Entity::getId)
- .add_property("count", &RS_Entity::count)
- .add_property("parent", make_function(&RS_Entity::getParent, return_value_policy<reference_existing_object>()), &RS_Entity::setParent)
- .add_property("graphic", make_function(&RS_Entity::getGraphic, return_value_policy<reference_existing_object>()))
- .add_property("block", make_function(&RS_Entity::getBlock, return_value_policy<reference_existing_object>()))
- .add_property("insert", make_function(&RS_Entity::getInsert, return_value_policy<reference_existing_object>()))
- .add_property("blockOrInsert", make_function(&RS_Entity::getBlockOrInsert, return_value_policy<reference_existing_object>()))
- .add_property("document", make_function(&RS_Entity::getDocument, return_value_policy<reference_existing_object>()))
- .add_property("layer", make_function(&RS_Entity::getLayer, return_value_policy<reference_existing_object>()),
- RS_Entity_setLayer_layer)
- .def("setLayer", RS_Entity_setLayer_string)
- .def("setLayer", RS_Entity_setLayer_layer)
- .def("setLayerToActive", &RS_Entity::setLayerToActive)
- .add_property("isContainer", &RS_Entity::isContainer)
- .add_property("isAtomic", &RS_Entity::isAtomic)
- .add_property("isEdge", &RS_Entity::isEdge)
- .add_property("isDocument", &RS_Entity::isDocument)
- .add_property("selected", &RS_Entity::isSelected, &RS_Entity::setSelected)
- .def("toggleSelected", &RS_Entity::toggleSelected)
- .add_property("processed", &RS_Entity::isProcessed, &RS_Entity::setProcessed)
- .add_property("visible", &RS_Entity::isVisible, &RS_Entity::setVisible)
- .add_property("min", &RS_Entity::getMin)
- .add_property("max", &RS_Entity::getMax)
- .add_property("size", &RS_Entity::getSize)
- .def("move", &RS_Entity::move)
- .def("rotate", &RS_Entity::rotate)
- .def("calculateBorders", &RS_Entity::calculateBorders)
- ;
-
- class_<RS_AtomicEntity, bases<RS_Entity>, boost::noncopyable>("AtomicEntity", no_init)
- .add_property("startpointSelected", &RS_AtomicEntity::isStartpointSelected)
- .add_property("endpointSelected", &RS_AtomicEntity::isEndpointSelected)
- .def("moveStartpoint", &RS_AtomicEntity::moveStartpoint)
- .def("moveEndpoint", &RS_AtomicEntity::moveEndpoint)
- .add_property("trimPoint", &RS_AtomicEntity::getTrimPoint)
- .def("reverse", &RS_AtomicEntity::reverse)
- ;
-
- /* Entities Data */
-
- class_<RS_ArcData>("ArcData")
- .def(init<RS_Vector&, double, double, double, bool>())
- .def("reset", &RS_ArcData::reset)
- .add_property("valid", &RS_ArcData::isValid)
- .def_readwrite("center", &RS_ArcData::center)
- .def_readwrite("radius", &RS_ArcData::radius)
- .def_readwrite("angle1", &RS_ArcData::angle1)
- .def_readwrite("angle2", &RS_ArcData::angle2)
- .def_readwrite("reversed", &RS_ArcData::reversed)
- ;
-
- class_<RS_BlockData>("BlockData")
- .def(init<QString&, const RS_Vector&, bool>())
- .add_property("valid", &RS_BlockData::isValid)
- .def_readwrite("name", &RS_BlockData::name)
- .def_readwrite("basePoint", &RS_BlockData::basePoint)
- .def_readwrite("frozen", &RS_BlockData::frozen)
- ;
-
- class_<RS_CircleData>("CircleData")
- .def(init<RS_Vector&, double>())
- .def("reset", &RS_CircleData::reset)
- .add_property("valid", &RS_CircleData::isValid)
- .def_readwrite("center", &RS_CircleData::center)
- .def_readwrite("radius", &RS_CircleData::radius)
- ;
-
- class_<RS_ConstructionLineData>("ConstructionLineData")
- .def(init<RS_Vector&, RS_Vector&>())
- ;
-
- class_<RS_EllipseData>("EllipseData", init<const RS_Vector&, const RS_Vector&, double, double, double, bool>())
- ;
-
- class_<RS_ImageData>("ImageData")
- .def(init<int, const RS_Vector&, const RS_Vector&, const RS_Vector&, const RS_Vector&, const QString&, int, int, int>())
- .def_readwrite("handle", &RS_ImageData::handle)
- .def_readwrite("insertionPoint", &RS_ImageData::insertionPoint)
- .def_readwrite("uVector", &RS_ImageData::uVector)
- .def_readwrite("vVector", &RS_ImageData::vVector)
- .def_readwrite("size", &RS_ImageData::size)
- .def_readwrite("file", &RS_ImageData::file)
- .def_readwrite("brightness", &RS_ImageData::brightness)
- .def_readwrite("contrast", &RS_ImageData::contrast)
- .def_readwrite("fade", &RS_ImageData::fade)
- ;
-
- class_<RS_LineData>("LineData")
- .def(init<RS_Vector&, RS_Vector&>())
- .def_readwrite("startpoint", &RS_LineData::startpoint)
- .def_readwrite("endpoint", &RS_LineData::endpoint)
- ;
-
- class_<RS_PointData>("PointData", init<const RS_Vector&>())
- ;
-
- class_<RS_PolylineData>("PolylineData")
- .def(init<const RS_Vector&, const RS_Vector&, bool>())
- ;
-
- /* Entities */
-
- class_<RS_Arc, bases<RS_AtomicEntity>, std::auto_ptr<RS_Arc> >("Arc", init<RS_EntityContainer*, RS_ArcData&>())
- .add_property("data", &RS_Arc::getData, &RS_Arc::setData)
- .add_property("center", &RS_Arc::getCenter, &RS_Arc::setCenter)
- .add_property("radius", &RS_Arc::getRadius, &RS_Arc::setRadius)
- .add_property("angle1", &RS_Arc::getAngle1, &RS_Arc::setAngle1)
- .add_property("angle2", &RS_Arc::getAngle2, &RS_Arc::setAngle2)
- .add_property("direction1", &RS_Arc::getDirection1)
- .add_property("direction2", &RS_Arc::getDirection2)
- .add_property("reversed", &RS_Arc::isReversed, &RS_Arc::setReversed)
- .add_property("middlepoint", &RS_Arc::getMiddlepoint)
- .add_property("angleLength", &RS_Arc::getAngleLength)
- .add_property("length", &RS_Arc::getLength)
- .add_property("bulge", &RS_Arc::getBulge)
- .def("createFrom3P", &RS_Arc::createFrom3P)
- ;
-
- class_<RS_Block, bases<RS_Document>, std::auto_ptr<RS_Block> >("Block", init<RS_EntityContainer*, const RS_BlockData&>())
- .add_property("name", &RS_Block::getName, &RS_Block::setName)
- .add_property("basePoint", &RS_Block::getBasePoint)
- .add_property("frozen", &RS_Block::isFrozen, &RS_Block::freeze)
- .def("toggle", &RS_Block::toggle)
- ;
-
- class_<RS_Circle, bases<RS_AtomicEntity>, std::auto_ptr<RS_Circle> >("Circle", init<RS_EntityContainer*, const RS_CircleData&>())
- .add_property("data", &RS_Circle::getData)
- .add_property("center", &RS_Circle::getCenter, &RS_Circle::setCenter)
- .add_property("radius", &RS_Circle::getRadius, &RS_Circle::setRadius)
- .add_property("angleLength", &RS_Circle::getAngleLength)
- .def("createFromCR", &RS_Circle::createFromCR)
- .def("createFrom2P", &RS_Circle::createFrom2P)
- .def("createFrom3P", &RS_Circle::createFrom3P)
- ;
-
- class_<RS_ConstructionLine, bases<RS_AtomicEntity>, std::auto_ptr<RS_ConstructionLine> >
- ("ConstructionLine", init<RS_EntityContainer*, const RS_ConstructionLineData&>())
- .add_property("data", &RS_ConstructionLine::getData)
- .add_property("point1", &RS_ConstructionLine::getPoint1)
- .add_property("point2", &RS_ConstructionLine::getPoint2)
- ;
-
- class_<RS_Ellipse, bases<RS_AtomicEntity>, std::auto_ptr<RS_Ellipse> >
- ("Ellipse", init<RS_EntityContainer*, const RS_EllipseData&>())
- .add_property("data", &RS_Ellipse::getData)
- .add_property("reversed", &RS_Ellipse::isReversed, &RS_Ellipse::setReversed)
- .add_property("angle", &RS_Ellipse::getAngle)
- .add_property("angle1", &RS_Ellipse::getAngle1, &RS_Ellipse::setAngle1)
- .add_property("angle2", &RS_Ellipse::getAngle2, &RS_Ellipse::setAngle2)
- .add_property("center", &RS_Ellipse::getCenter, &RS_Ellipse::setCenter)
- .add_property("majorP", &RS_Ellipse::getMajorP, &RS_Ellipse::setMajorP)
- .add_property("ratio", &RS_Ellipse::getRatio, &RS_Ellipse::setRatio)
- .add_property("majorRadius", &RS_Ellipse::getMajorRadius)
- .add_property("minorRadius", &RS_Ellipse::getMinorRadius)
- ;
-
- class_<RS_Image, bases<RS_AtomicEntity>, std::auto_ptr<RS_Image> >
- ("Image", init<RS_EntityContainer*, const RS_ImageData&>())
- .add_property("data", &RS_Image::getData)
- .add_property("insertionPoint", &RS_Image::getInsertionPoint, &RS_Image::setInsertionPoint)
- .add_property("file", &RS_Image::getFile, &RS_Image::setFile)
- .add_property("uVector", &RS_Image::getUVector)
- .add_property("vVector", &RS_Image::getVVector)
- .add_property("width", &RS_Image::getWidth)
- .add_property("height", &RS_Image::getHeight)
- .add_property("brightness", &RS_Image::getBrightness)
- .add_property("contrast", &RS_Image::getContrast)
- .add_property("fade", &RS_Image::getFade)
- .add_property("handle", &RS_Image::getHandle, &RS_Image::setHandle)
- .add_property("imageWidth", &RS_Image::getImageWidth)
- .add_property("imageHeight", &RS_Image::getImageHeight)
- ;
-
- class_<RS_Line, bases<RS_AtomicEntity>, std::auto_ptr<RS_Line> >
- ("Line", init<RS_EntityContainer*, const RS_LineData&>())
- .add_property("data", &RS_Line::getData)
- .add_property("startpoint", &RS_Line::getStartpoint, &RS_Line::setStartpoint)
- .add_property("endpoint", &RS_Line::getEndpoint, &RS_Line::setEndpoint)
- ;
-
- class_<RS_Point, bases<RS_AtomicEntity>, std::auto_ptr<RS_Point> >
- ("Point", init<RS_EntityContainer*, const RS_PointData&>())
- .add_property("pos", &RS_Point::getPos, &RS_Point::setPos)
- ;
-
- class_<RS_Polyline, bases<RS_EntityContainer>, std::auto_ptr<RS_Polyline> >
- ("Polyline", init<RS_EntityContainer*, const RS_PolylineData&>())
- .def(init<RS_EntityContainer*>())
- .add_property("startpoint", &RS_Polyline::getStartpoint, &RS_Polyline::setStartpoint)
- .add_property("endpoint", &RS_Polyline::getEndpoint)
- .add_property("closed", &RS_Polyline::isClosed)
- .def("addVertex", &RS_Polyline::addVertex, return_value_policy<reference_existing_object>())
- .def("createVertex", &RS_Polyline::createVertex, return_value_policy<reference_existing_object>())
- .def("endPolyline", &RS_Polyline::endPolyline)
- ;
-}
-
-#endif
+++ /dev/null
-/**
- * This function is automatically exported by the Boost::Python
- * libraries. It adds the QCad scripting module to the environment
- *
- * OBSOLETE
- */
-#ifdef RS_OPT_PYTHON
-extern "C" void initqcad();
-#endif
-
/**
* Constructor.
*/
-RS_Script::RS_Script(const QString & name, const QString & /*path*/)
+Script::Script(const QString & name, const QString & /*path*/)
{
this->name = name;
}
/** @return the name of this script. */
-QString RS_Script::getName() const
+QString Script::getName() const
{
return name;
}
/** @return the full path and file name of this script. */
-QString RS_Script::getPath() const
+QString Script::getPath() const
{
return path;
}
#include <QtCore>
+#warning "!!! THIS CLASS IS OBSOLETE !!!"
/**
* Class for representing a script. This is implemented as a QString
* containing the script name.
*
* @author Andrew Mustun
*/
-class RS_Script
+class Script
{
public:
- RS_Script(const QString & name, const QString & path);
- //RS_Script(const char* name);
+ Script(const QString & name, const QString & path);
+ //Script(const char* name);
QString getName() const;
QString getPath() const;
#include "system.h"
-RS_ScriptList * RS_ScriptList::uniqueInstance = NULL;
+ScriptList * ScriptList::uniqueInstance = NULL;
/**
* Default constructor.
*/
-RS_ScriptList::RS_ScriptList(): scriptIterator(scripts)
+ScriptList::ScriptList(): scriptIterator(scripts)
{
//Should be dealt with...
//#warning "!!! Need to deal with setAutoDelete() Qt3->Qt4 !!!"
//activeScript = NULL;
}
-/*virtual*/ RS_ScriptList::~RS_ScriptList()
+/*virtual*/ ScriptList::~ScriptList()
{
while (!scripts.isEmpty())
delete scripts.takeFirst();
/**
* @return Instance to the unique script list.
*/
-/*static*/ RS_ScriptList * RS_ScriptList::instance()
+/*static*/ ScriptList * ScriptList::instance()
{
if (uniqueInstance == NULL)
- uniqueInstance = new RS_ScriptList();
+ uniqueInstance = new ScriptList();
return uniqueInstance;
}
/**
- * Initializes the script list by creating RS_Script
+ * Initializes the script list by creating Script
* objects, one for each script that could be found.
*/
-void RS_ScriptList::init()
+void ScriptList::init()
{
- RS_DEBUG->print("RS_ScriptList::initScripts");
+ DEBUG->print("ScriptList::initScripts");
scripts.clear();
- QStringList list = RS_SYSTEM->getScriptList();
- RS_Script * script;
+ QStringList list = SYSTEM->getScriptList();
+ Script * script;
for(QStringList::Iterator it=list.begin(); it!=list.end(); ++it)
{
- RS_DEBUG->print("script: %s:", (*it).toLatin1().data());
+ DEBUG->print("script: %s:", (*it).toLatin1().data());
QFileInfo fi(*it);
- script = new RS_Script(fi.baseName(), fi.absoluteFilePath());
+ script = new Script(fi.baseName(), fi.absoluteFilePath());
scripts.append(script);
- RS_DEBUG->print("base: %s", fi.baseName().toLatin1().data());
- RS_DEBUG->print("path: %s", fi.absoluteFilePath().toLatin1().data());
+ DEBUG->print("base: %s", fi.baseName().toLatin1().data());
+ DEBUG->print("path: %s", fi.absoluteFilePath().toLatin1().data());
}
- //RS_Script* f = new RS_Script("normal");
+ //Script* f = new Script("normal");
//scripts.append(f);
}
/**
* Removes all scripts in the scriptlist.
*/
-void RS_ScriptList::clearScripts()
+void ScriptList::clearScripts()
{
scripts.clear();
}
-int RS_ScriptList::countScripts()
+int ScriptList::countScripts()
{
return scripts.count();
}
* Listeners are notified after the script was removed from
* the list but before it gets deleted.
*/
-void RS_ScriptList::removeScript(RS_Script * script)
+void ScriptList::removeScript(Script * script)
{
- RS_DEBUG->print("RS_ScriptList::removeScript()");
+ DEBUG->print("ScriptList::removeScript()");
// here the script is removed from the list but not deleted
// scripts.remove(script);
delete scripts.takeAt(i);
//for (uint i=0; i<scriptListListeners.count(); ++i) {
- // RS_ScriptListListener* l = scriptListListeners.at(i);
+ // ScriptListListener* l = scriptListListeners.at(i);
// l->scriptRemoved(script);
//}
* \p NULL if no such script was found. The script will be loaded into
* memory if it's not already.
*/
-RS_Script * RS_ScriptList::requestScript(const QString & name)
+Script * ScriptList::requestScript(const QString & name)
{
- RS_DEBUG->print("RS_ScriptList::requestScript %s", name.toLatin1().data());
+ DEBUG->print("ScriptList::requestScript %s", name.toLatin1().data());
QString name2 = name.toLower();
- RS_Script * foundScript = NULL;
+ Script * foundScript = NULL;
- RS_DEBUG->print("name2: %s", name2.toLatin1().data());
+ DEBUG->print("name2: %s", name2.toLatin1().data());
// Search our list of available scripts:
-// for(RS_Script * s=scripts.first(); s!=NULL; s=scripts.next())
+// for(Script * s=scripts.first(); s!=NULL; s=scripts.next())
for(int i=0; i<scripts.size(); i++)
{
- RS_Script * s = scripts[i];
+ Script * s = scripts[i];
if (s->getName() == name2)
{
}
//! @return First script of the list.
-RS_Script * RS_ScriptList::firstScript()
+Script * ScriptList::firstScript()
{
// return scripts.first();
scriptIterator.toFront();
/** @return Next script from the list after
* calling firstScript() or nextScript().
*/
-RS_Script * RS_ScriptList::nextScript()
+Script * ScriptList::nextScript()
{
// return scripts.next();
return scriptIterator.next();
* @return Pointer to the script with the given name or
* \p NULL if no such script was found.
*/
-//RS_Script* RS_ScriptList::loadScript(const QString& name) {
+//Script* ScriptList::loadScript(const QString& name) {
//}
/**
* Tests the script list and its ability to load scripts.
*/
-bool RS_ScriptList::test()
+bool ScriptList::test()
{
- //RS_ScriptList* l = RS_ScriptList::instance();
+ //ScriptList* l = ScriptList::instance();
- //std::cout << "RS_ScriptList: " << *l << std::endl;
+ //std::cout << "ScriptList: " << *l << std::endl;
return true;
}
#include <QtCore>
#include "script.h"
-#define RS_SCRIPTLIST RS_ScriptList::instance()
+#define SCRIPTLIST ScriptList::instance()
#warning "!!! THIS CLASS IS OBSOLETE !!!"
/**
* The global list of scripts. This is implemented as a singleton.
- * Use RS_ScriptList::instance() to get a pointer to the object.
+ * Use ScriptList::instance() to get a pointer to the object.
*
* OBSOLETE
*
* @author Andrew Mustun
*/
-class RS_ScriptList
+class ScriptList
{
protected:
- RS_ScriptList();
+ ScriptList();
public:
- virtual ~RS_ScriptList();
+ virtual ~ScriptList();
- static RS_ScriptList * instance();
+ static ScriptList * instance();
void init();
void clearScripts();
int countScripts();
- virtual void removeScript(RS_Script * script);
- RS_Script * requestScript(const QString & name);
- RS_Script * firstScript();
- RS_Script * nextScript();
+ virtual void removeScript(Script * script);
+ Script * requestScript(const QString & name);
+ Script * firstScript();
+ Script * nextScript();
static bool test();
protected:
- static RS_ScriptList * uniqueInstance;
+ static ScriptList * uniqueInstance;
private:
//! all scripts available
- QList<RS_Script *> scripts;
- QListIterator<RS_Script *> scriptIterator;
+ QList<Script *> scripts;
+ QListIterator<Script *> scriptIterator;
};
#endif // __SCRIPTLIST_H__
* entities. Usually that's an Drawing entity but
* it can also be a polyline, text, ...
*/
-RS_Selection::RS_Selection(RS_EntityContainer & container, GraphicView * graphicView)
+Selection::Selection(EntityContainer & container, GraphicView * graphicView)
{
this->container = &container;
this->graphicView = graphicView;
/**
* Selects or deselects the given entitiy.
*/
-void RS_Selection::selectSingle(RS_Entity * e)
+void Selection::selectSingle(Entity * e)
{
if (e && (e->getLayer() == NULL || e->getLayer()->isLocked() == false))
{
//Most likely because while the painter is valid, the QPainter is not...
//[WAS]#warning "!!! This is causing a segfault in the draw code !!!"
- if (graphicView != NULL)
+ if (graphicView)
// graphicView->drawEntity(e);
graphicView->redraw();
}
/**
* Selects all entities on visible layers.
*/
-void RS_Selection::selectAll(bool select)
+void Selection::selectAll(bool select)
{
- if (graphicView != NULL)
+ if (graphicView)
{
//graphicView->deleteEntity(container);
}
//container->setSelected(select);
- 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->isVisible())
e->setSelected(select);
}
- if (graphicView!=NULL)
- //graphicView->drawEntity(container);
+ if (graphicView)
graphicView->redraw();
}
-void RS_Selection::deselectAll()
+void Selection::deselectAll()
{
selectAll(false);
}
/**
* Selects all entities on visible layers.
*/
-void RS_Selection::invertSelection()
+void Selection::invertSelection()
{
if (graphicView != NULL)
{
//graphicView->deleteEntity(container);
}
- 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->isVisible())
e->toggleSelected();
* @param v2 Second corner of the window to select.
* @param select true: select, false: deselect
*/
-void RS_Selection::selectWindow(const Vector & v1, const Vector & v2, bool select, bool cross)
+void Selection::selectWindow(const Vector & v1, const Vector & v2, bool select, bool cross)
{
//if (graphicView!=NULL) {
// graphicView->drawWindow(v1, v2, true);
graphicView->redraw();
}
-void RS_Selection::deselectWindow(const Vector & v1, const Vector & v2)
+void Selection::deselectWindow(const Vector & v1, const Vector & v2)
{
selectWindow(v1, v2, false);
}
* @param v2 Endpoint of line.
* @param select true: select, false: deselect
*/
-void RS_Selection::selectIntersected(const Vector & v1, const Vector & v2, bool select)
+void Selection::selectIntersected(const Vector & v1, const Vector & v2, bool select)
{
- RS_Line line(NULL, RS_LineData(v1, v2));
+ Line line(NULL, LineData(v1, v2));
bool inters;
- 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->isVisible())
{
// select containers / groups:
if (e->isContainer())
{
- RS_EntityContainer * ec = (RS_EntityContainer *)e;
+ EntityContainer * ec = (EntityContainer *)e;
- for(RS_Entity * e2=ec->firstEntity(RS2::ResolveAll); e2!=NULL;
+ for(Entity * e2=ec->firstEntity(RS2::ResolveAll); e2!=NULL;
e2=ec->nextEntity(RS2::ResolveAll))
{
- VectorSolutions sol = RS_Information::getIntersection(&line, e2, true);
+ VectorSolutions sol = Information::getIntersection(&line, e2, true);
if (sol.hasValid())
inters = true;
}
else
{
- VectorSolutions sol = RS_Information::getIntersection(&line, e, true);
+ VectorSolutions sol = Information::getIntersection(&line, e, true);
if (sol.hasValid())
inters = true;
}
}
-void RS_Selection::deselectIntersected(const Vector & v1, const Vector & v2)
+void Selection::deselectIntersected(const Vector & v1, const Vector & v2)
{
selectIntersected(v1, v2, false);
}
*
* @param e The entity where the algorithm starts. Must be an atomic entity.
*/
-void RS_Selection::selectContour(RS_Entity * e)
+void Selection::selectContour(Entity * e)
{
if (!e || !e->isAtomic())
return;
bool select = !e->isSelected();
- RS_AtomicEntity * ae = (RS_AtomicEntity *)e;
+ AtomicEntity * ae = (AtomicEntity *)e;
Vector p1 = ae->getStartpoint();
Vector p2 = ae->getEndpoint();
bool found = false;
{
found = false;
- for(RS_Entity * en=container->firstEntity(); en!=NULL;
+ for(Entity * en=container->firstEntity(); en!=NULL;
en=container->nextEntity())
{
//for (uint i=0; i<container->count(); ++i) {
- //RS_Entity* en = container->entityAt(i);
+ //Entity* en = container->entityAt(i);
if (en!=NULL && en->isVisible() &&
en->isAtomic() && en->isSelected()!=select &&
(en->getLayer()==NULL || en->getLayer()->isLocked()==false))
{
- ae = (RS_AtomicEntity *)en;
+ ae = (AtomicEntity *)en;
bool doit = false;
// startpoint connects to 1st point
/**
* Selects all entities on the given layer.
*/
-void RS_Selection::selectLayer(RS_Entity * e)
+void Selection::selectLayer(Entity * e)
{
if (e == NULL)
return;
bool select = !e->isSelected();
- RS_Layer * layer = e->getLayer(true);
+ Layer * layer = e->getLayer(true);
if (layer == NULL)
return;
/**
* Selects all entities on the given layer.
*/
-void RS_Selection::selectLayer(const QString & layerName, bool select)
+void Selection::selectLayer(const QString & layerName, bool select)
{
- for(RS_Entity * en=container->firstEntity(); en!=NULL; en=container->nextEntity())
+ for(Entity * en=container->firstEntity(); en!=NULL; en=container->nextEntity())
{
if (en != NULL && en->isVisible() && en->isSelected() != select
&& (en->getLayer() == NULL || en->getLayer()->isLocked() == false))
{
- RS_Layer * l = en->getLayer(true);
+ Layer * l = en->getLayer(true);
if (l != NULL && l->getName() == layerName)
{
}
}
-void RS_Selection::deselectLayer(QString & layerName)
+void Selection::deselectLayer(QString & layerName)
{
selectLayer(layerName, false);
}
*
* @author Andrew Mustun
*/
-class RS_Selection
+class Selection
{
public:
- RS_Selection(RS_EntityContainer & entityContainer,
+ Selection(EntityContainer & entityContainer,
GraphicView * graphicView = NULL);
- void selectSingle(RS_Entity * e);
+ void selectSingle(Entity * e);
void selectAll(bool select = true);
void deselectAll();
void invertSelection();
void selectIntersected(const Vector & v1, const Vector & v2,
bool select = true);
void deselectIntersected(const Vector & v1, const Vector & v2);
- void selectContour(RS_Entity * e);
- void selectLayer(RS_Entity * e);
+ void selectContour(Entity * e);
+ void selectLayer(Entity * e);
void selectLayer(const QString & layerName, bool select = true);
void deselectLayer(QString & layerName);
protected:
- RS_EntityContainer * container;
+ EntityContainer * container;
Drawing * graphic;
GraphicView * graphicView;
};
+++ /dev/null
-// simplepython.cpp
-//
-// Part of the Architektonas Project
-// Originally part of QCad Community Edition by Andrew Mustun
-// Extensively rewritten and refactored by James L. Hammons
-// Portions copyright (C) 2001-2003 RibbonSoft
-// Copyright (C) 2010 Underground Software
-// See the README and GPLv2 files for licensing and warranty information
-//
-// JLH = James L. Hammons <jlhamm@acm.org>
-//
-// Who When What
-// --- ---------- -----------------------------------------------------------
-// JLH 06/02/2010 Added this text. :-)
-//
-
-#ifdef RS_OPT_SIMPLEPYTHON
-#include "simplepython.h"
-
-
-RS_SimplePython* RS_SimplePython::uniqueInstance = NULL;
-
-
-/**
- * Gets the one and only RS_SimplePython instance
- * (creates a new one on first call only)
- *
- * @return Pointer to the single instance of this
- * singleton class
- */
-RS_SimplePython* RS_SimplePython::instance() {
- if(uniqueInstance==NULL) {
- uniqueInstance = new RS_SimplePython;
- }
- return uniqueInstance;
-}
-
-
-/**
- * Launches the given script.
- */
-int RS_SimplePython::launch(const QString& script) {
- long answer;
- PyObject *modname, *mod, *mdict, *func, *rslt;
- //Py_SetProgramName(argv[0]);
- Py_Initialize();
- init_pyextension();
- modname = PyString_FromString(script);
- mod = PyImport_Import(modname);
- if (mod) {
- //printf( "mod\n");
- mdict = PyModule_GetDict(mod);
-
- // Borrowed reference to start function
- func = PyDict_GetItemString(mdict, "start");
- if (func) {
- //printf( "func\n");
- if (PyCallable_Check(func)) {
- //printf("calling..\n");
- rslt = PyObject_CallFunction(func, "(s)", "noparam");
- //printf("calling ok\n");
- if (rslt) {
- //printf("c: rslt\n");
- answer = PyInt_AsLong(rslt);
- //printf("c: answer is: %ld\n", answer);
- Py_XDECREF(rslt);
- }
- }
- } else {
- printf("no such function: start\n");
- }
- Py_XDECREF(mod);
- } else {
- printf("no such module: %s\n", script.latin1());
- }
- Py_XDECREF(modname);
- Py_Finalize();
- return 0;
-}
-
-
-/**
- * A test method exposed to Python
- */
-long inc(long i) {
- printf("c: inc called\n");
- printf("c: parameter from python: %ld\n", i);
- return ++i;
-}
-
-/**
- * The magic that exposes inc(). A wrapper function.
- */
-static PyObject *py_inc(PyObject* /*self*/, PyObject* args) {
- long i;
- printf("c: py_inc called\n");
- if (!PyArg_ParseTuple(args, "l", &i))
- return NULL;
- return Py_BuildValue("l", inc(i));
-}
-
-/**
- * Adds a line to the current graphic document.
- */
-void rsPyAddLine(double x1, double y1, double x2, double y2) {
- //printf("c: addLine called\n");
- //printf("c: parameter from python: %f\n", x1);
-
- Drawing* graphic = RS_SIMPLEPYTHON->getGraphic();
- if (graphic!=NULL) {
- graphic->addEntity(new RS_Line(graphic,
- RS_LineData(RS_Vector(x1, y1),
- RS_Vector(x2, y2))));
- } else {
- std::cerr << "rsPyAddLine: No graphic object set.\n";
- }
-}
-
-/**
- * Python wrapper.
- */
-static PyObject *py_rsPyAddLine(PyObject* /*self*/, PyObject* args) {
- double x1, y1, x2, y2;
- //printf("c: py_rsPyAddLine called\n");
- if (!PyArg_ParseTuple(args, "dddd", &x1, &y1, &x2, &y2)) {
- return NULL;
- }
- rsPyAddLine(x1, y1, x2, y2);
- return Py_BuildValue("d", 1);
-}
-
-/**
- * The qcadlib module's function table.
- */
-static PyMethodDef rsQCadMethods[] =
- {
- {"inc", py_inc, 1,
- "a silly example method"},
- {"rsPyAddLine", py_rsPyAddLine, 1,
- "adds a line to the current document"},
- {NULL, NULL} /* sentinel */
- };
-
-/**
- * Python will call this when the qcadlib module is imported.
- */
-void init_pyextension() {
- printf("c: adding module: qcad\n");
- PyImport_AddModule("qcad");
- Py_InitModule("qcad", rsQCadMethods);
- printf("c: module qcad: OK\n");
-}
-
-#endif
+++ /dev/null
-#ifndef __SIMPLEPYTHON_H__
-#define __SIMPLEPYTHON_H__
-
-#ifdef RS_OPT_SIMPLEPYTHON
-
-#include "Python.h"
-
-#include "drawing.h"
-
-#define __SIMPLEPYTHON RS_SimplePython::instance()
-
-/**
- * Python scripting support.
- *
- * OBSOLETE
- *
- * @author Andrew Mustun
- */
-class RS_SimplePython
-{
- private:
- RS_SimplePython()
- {
- graphic = NULL;
- }
-
- public:
- static RS_SimplePython * instance();
-
- void setGraphic(Drawing* g)
- {
- graphic = g;
- }
-
- Drawing * getGraphic()
- {
- return graphic;
- }
-
- int launch(const QString& script);
-
- private:
- static RS_SimplePython * uniqueInstance;
-
- Drawing * graphic;
-};
-
-/**
- * Global method needed by the python lib for initialisation.
- */
-void init_pyextension();
-
-/**
- * Test method.
- */
-long inc(long i);
-
-/**
- * Adds a line to the current graphic document.
- */
-void rsPyAddLine(double x1, double y1, double x2, double y2);
-
-#endif
-
-#endif
/**
* Constructor.
*/
-RS_Snapper::RS_Snapper(RS_EntityContainer & c, GraphicView & gv):
+Snapper::Snapper(EntityContainer & c, GraphicView & gv):
container(&c), graphicView(&gv), finished(false)
{
init();
}
-RS_Snapper::RS_Snapper(void):
+Snapper::Snapper(void):
container(NULL), graphicView(NULL), finished(false)
{
init();
/**
* Destructor.
*/
-RS_Snapper::~RS_Snapper()
+Snapper::~Snapper()
{
}
/**
* Initialize (called by all constructors)
*/
-void RS_Snapper::init()
+void Snapper::init()
{
if (graphicView)
{
snapRange = 20;
}
-void RS_Snapper::finish()
+void Snapper::finish()
{
finished = true;
}
//bleh
-void RS_Snapper::SetContainer(RS_EntityContainer * c)
+void Snapper::SetContainer(EntityContainer * c)
{
container = c;
}
//bleh
-void RS_Snapper::SetGraphicView(GraphicView * v)
+void Snapper::SetGraphicView(GraphicView * v)
{
graphicView = v;
}
* is the entity whos end point was caught. If the snap mode didn't require an
* entity (e.g. free, grid) this method will return NULL.
*/
-RS_Entity * RS_Snapper::getKeyEntity()
+Entity * Snapper::getKeyEntity()
{
return keyEntity;
}
/** Sets a new snap mode. */
-void RS_Snapper::setSnapMode(RS2::SnapMode snapMode)
+void Snapper::setSnapMode(RS2::SnapMode snapMode)
{
this->snapMode = snapMode;
}
/** Sets a new snap restriction. */
-void RS_Snapper::setSnapRestriction(RS2::SnapRestriction snapRes)
+void Snapper::setSnapRestriction(RS2::SnapRestriction snapRes)
{
this->snapRes = snapRes;
}
-RS2::SnapMode RS_Snapper::getSnapMode(void)
+RS2::SnapMode Snapper::getSnapMode(void)
{
return snapMode;
}
-RS2::SnapRestriction RS_Snapper::getSnapRestriction(void)
+RS2::SnapRestriction Snapper::getSnapRestriction(void)
{
return snapRes;
}
*
* @see catchEntity()
*/
-void RS_Snapper::setSnapRange(int r)
+void Snapper::setSnapRange(int r)
{
snapRange = r;
}
* @param e A mouse event.
* @return The coordinates of the point or an invalid vector.
*/
-Vector RS_Snapper::snapPoint(QMouseEvent * e)
+Vector Snapper::snapPoint(QMouseEvent * e)
{
- RS_DEBUG->print("RS_Snapper::snapPoint");
+ DEBUG->print("Snapper::snapPoint");
snapSpot = Vector(false);
if (!e)
{
- RS_DEBUG->print(RS_Debug::D_WARNING, "RS_Snapper::snapPoint: event is NULL");
+ DEBUG->print(Debug::D_WARNING, "Snapper::snapPoint: event is NULL");
return snapSpot;
}
break;
}
- if (RS_DIALOGFACTORY)
- RS_DIALOGFACTORY->updateCoordinateWidget(snapCoord, snapCoord - graphicView->getRelativeZero());
+ if (DIALOGFACTORY)
+ DIALOGFACTORY->updateCoordinateWidget(snapCoord, snapCoord - graphicView->getRelativeZero());
- RS_DEBUG->print("RS_Snapper::snapPoint: OK");
+ DEBUG->print("Snapper::snapPoint: OK");
return snapCoord;
}
* @param coord The mouse coordinate.
* @return The coordinates of the point or an invalid vector.
*/
-Vector RS_Snapper::snapFree(Vector coord)
+Vector Snapper::snapFree(Vector coord)
{
keyEntity = NULL;
return coord;
* @param coord The mouse coordinate.
* @return The coordinates of the point or an invalid vector.
*/
-Vector RS_Snapper::snapEndpoint(Vector coord)
+Vector Snapper::snapEndpoint(Vector coord)
{
Vector vec(false);
vec = container->getNearestEndpoint(coord, NULL);
* @param coord The mouse coordinate.
* @return The coordinates of the point or an invalid vector.
*/
-Vector RS_Snapper::snapGrid(Vector coord)
+Vector Snapper::snapGrid(Vector coord)
{
- RS_DEBUG->print("RS_Snapper::snapGrid begin");
+ DEBUG->print("Snapper::snapGrid begin");
Vector vec(false);
double dist = 0.0;
- RS_Grid * grid = graphicView->getGrid();
+ Grid * grid = graphicView->getGrid();
- RS_DEBUG->print("RS_Snapper::snapGrid 001");
+ DEBUG->print("Snapper::snapGrid 001");
if (grid)
{
- RS_DEBUG->print("RS_Snapper::snapGrid 002");
+ DEBUG->print("Snapper::snapGrid 002");
Vector * pts = grid->getPoints();
- RS_DEBUG->print("RS_Snapper::snapGrid 003");
+ DEBUG->print("Snapper::snapGrid 003");
int closest = -1;
dist = 32000.00;
- RS_DEBUG->print("RS_Snapper::snapGrid 004");
+ DEBUG->print("Snapper::snapGrid 004");
for(int i=0; i<grid->count(); ++i)
{
}
}
- RS_DEBUG->print("RS_Snapper::snapGrid 005");
+ DEBUG->print("Snapper::snapGrid 005");
if (closest >= 0)
vec = pts[closest];
- RS_DEBUG->print("RS_Snapper::snapGrid 006");
+ DEBUG->print("Snapper::snapGrid 006");
}
keyEntity = NULL;
- RS_DEBUG->print("RS_Snapper::snapGrid end");
+ DEBUG->print("Snapper::snapGrid end");
return vec;
}
* @param coord The mouse coordinate.
* @return The coordinates of the point or an invalid vector.
*/
-Vector RS_Snapper::snapOnEntity(Vector coord)
+Vector Snapper::snapOnEntity(Vector coord)
{
Vector vec(false);
vec = container->getNearestPointOnEntity(coord, true, NULL, &keyEntity);
* @param coord The mouse coordinate.
* @return The coordinates of the point or an invalid vector.
*/
-Vector RS_Snapper::snapCenter(Vector coord)
+Vector Snapper::snapCenter(Vector coord)
{
Vector vec(false);
vec = container->getNearestCenter(coord, NULL);
* @param coord The mouse coordinate.
* @return The coordinates of the point or an invalid vector.
*/
-Vector RS_Snapper::snapMiddle(Vector coord)
+Vector Snapper::snapMiddle(Vector coord)
{
Vector vec(false);
vec = container->getNearestMiddle(coord, NULL);
* @param coord The mouse coordinate.
* @return The coordinates of the point or an invalid vector.
*/
-Vector RS_Snapper::snapDist(Vector coord)
+Vector Snapper::snapDist(Vector coord)
{
Vector vec(false);
vec = container->getNearestDist(distance, coord, NULL);
* @param coord The mouse coordinate.
* @return The coordinates of the point or an invalid vector.
*/
-Vector RS_Snapper::snapIntersection(Vector coord)
+Vector Snapper::snapIntersection(Vector coord)
{
Vector vec(false);
vec = container->getNearestIntersection(coord, NULL);
* @param coord The uncorrected coordinates.
* @return The corrected coordinates.
*/
-Vector RS_Snapper::restrictOrthogonal(Vector coord)
+Vector Snapper::restrictOrthogonal(Vector coord)
{
Vector rz = graphicView->getRelativeZero();
Vector ret(coord);
* @param coord The uncorrected coordinates.
* @return The corrected coordinates.
*/
-Vector RS_Snapper::restrictHorizontal(Vector coord)
+Vector Snapper::restrictHorizontal(Vector coord)
{
Vector rz = graphicView->getRelativeZero();
* @param coord The uncorrected coordinates.
* @return The corrected coordinates.
*/
-Vector RS_Snapper::restrictVertical(Vector coord)
+Vector Snapper::restrictVertical(Vector coord)
{
Vector rz = graphicView->getRelativeZero();
* container
* @return Pointer to the entity or NULL.
*/
-RS_Entity * RS_Snapper::catchEntity(const Vector & pos, RS2::ResolveLevel level)
+Entity * Snapper::catchEntity(const Vector & pos, RS2::ResolveLevel level)
{
- RS_DEBUG->print("RS_Snapper::catchEntity");
+ DEBUG->print("Snapper::catchEntity");
// set default distance for points inside solids
double dist = graphicView->toGraphDX(snapRange) * 0.9;
- RS_Entity * entity = container->getNearestEntity(pos, &dist, level);
+ Entity * entity = container->getNearestEntity(pos, &dist, level);
int idx = -1;
if (entity && dist <= graphicView->toGraphDX(snapRange))
{
// highlight:
- RS_DEBUG->print("RS_Snapper::catchEntity: found: %d", idx);
+ DEBUG->print("Snapper::catchEntity: found: %d", idx);
return entity;
}
else
{
- RS_DEBUG->print("RS_Snapper::catchEntity: not found");
+ DEBUG->print("Snapper::catchEntity: not found");
return NULL;
}
- RS_DEBUG->print("RS_Snapper::catchEntity: OK");
+ DEBUG->print("Snapper::catchEntity: OK");
}
/**
* container
* @return Pointer to the entity or NULL.
*/
-RS_Entity * RS_Snapper::catchEntity(QMouseEvent * e, RS2::ResolveLevel level)
+Entity * Snapper::catchEntity(QMouseEvent * e, RS2::ResolveLevel level)
{
return catchEntity(Vector(graphicView->toGraphX(e->x()),
graphicView->toGraphY(e->y())), level);
/**
* Suspends this snapper while another action takes place.
*/
-/*virtual*/ void RS_Snapper::suspend()
+/*virtual*/ void Snapper::suspend()
{
#warning "!!! This may need to have SetVisibility() called !!!"
// deleteSnapper();
/**
* Resumes this snapper after it has been suspended.
*/
-/*virtual*/ void RS_Snapper::resume()
+/*virtual*/ void Snapper::resume()
{
#warning "!!! This may need to have SetVisibility() called !!!"
// drawSnapper();
/**
* Hides the snapper options.
*/
-/*virtual*/ void RS_Snapper::hideOptions()
+/*virtual*/ void Snapper::hideOptions()
{
- if (snapMode == RS2::SnapDist && RS_DIALOGFACTORY)
- RS_DIALOGFACTORY->requestSnapDistOptions(distance, false);
+ if (snapMode == RS2::SnapDist && DIALOGFACTORY)
+ DIALOGFACTORY->requestSnapDistOptions(distance, false);
}
/**
* Shows the snapper options.
*/
-/*virtual*/ void RS_Snapper::showOptions()
+/*virtual*/ void Snapper::showOptions()
{
- if (snapMode == RS2::SnapDist && RS_DIALOGFACTORY)
- RS_DIALOGFACTORY->requestSnapDistOptions(distance, true);
+ if (snapMode == RS2::SnapDist && DIALOGFACTORY)
+ DIALOGFACTORY->requestSnapDistOptions(distance, true);
}
-void RS_Snapper::SetVisible(bool visibility/*= true*/)
+void Snapper::SetVisible(bool visibility/*= true*/)
{
visible = visibility;
}
-bool RS_Snapper::Visible(void)
+bool Snapper::Visible(void)
{
return visible;
}
Further inspection seems to rule this out as they are pretty well coupled to the
GraphicView class... What to do?
*/
-void RS_Snapper::Draw(GraphicView * view, PaintInterface * painter)
+void Snapper::Draw(GraphicView * view, PaintInterface * painter)
{
if (finished || !snapSpot.valid || !snapCoord.valid)
return;
// if (snapCoord.valid)
// {
// Snap point (need to make sure the brush is NULL!)
-// painter->setPen(RS_Pen(RS_Color(0, 127, 255), RS2::Width00, RS2::DashLine));
- painter->setPen(RS_Pen(RS_Color(255, 127, 0), RS2::Width00, RS2::DashLine));
+// painter->setPen(Pen(Color(0, 127, 255), RS2::Width00, RS2::DashLine));
+ painter->setPen(Pen(Color(255, 127, 0), RS2::Width00, RS2::DashLine));
painter->drawCircle(view->toGui(snapCoord), 4);
// Crosshairs
if (showCrosshairs)
{
- painter->setPen(RS_Pen(RS_Color(0, 255, 255), RS2::Width00, RS2::DashLine));
+ painter->setPen(Pen(Color(0, 255, 255), RS2::Width00, RS2::DashLine));
painter->drawLine(Vector(0, view->toGuiY(snapCoord.y)),
Vector(view->getWidth(), view->toGuiY(snapCoord.y)));
painter->drawLine(Vector(view->toGuiX(snapCoord.x), 0),
#define __SNAPPER_H__
#include <QtCore>
-#include "rs.h"
+#include "enums.h"
#include "vector.h"
-class RS_Entity;
-class RS_EntityContainer;
+class Entity;
+class EntityContainer;
class GraphicView;
class PaintInterface;
*
* @author Andrew Mustun
*/
-class RS_Snapper
+class Snapper
{
public:
- RS_Snapper(RS_EntityContainer & container, GraphicView & graphicView);
- RS_Snapper();
- virtual ~RS_Snapper();
+ Snapper(EntityContainer & container, GraphicView & graphicView);
+ Snapper();
+ virtual ~Snapper();
void init();
void finish();
- void SetContainer(RS_EntityContainer *);
+ void SetContainer(EntityContainer *);
void SetGraphicView(GraphicView *);
- RS_Entity * getKeyEntity();
+ Entity * getKeyEntity();
void setSnapMode(RS2::SnapMode snapMode);
void setSnapRestriction(RS2::SnapRestriction snapRes);
RS2::SnapMode getSnapMode(void);
Vector restrictHorizontal(Vector coord);
Vector restrictVertical(Vector coord);
- RS_Entity * catchEntity(const Vector & pos, RS2::ResolveLevel level = RS2::ResolveNone);
- RS_Entity * catchEntity(QMouseEvent * e, RS2::ResolveLevel level = RS2::ResolveNone);
+ Entity * catchEntity(const Vector & pos, RS2::ResolveLevel level = RS2::ResolveNone);
+ Entity * catchEntity(QMouseEvent * e, RS2::ResolveLevel level = RS2::ResolveNone);
virtual void suspend();
virtual void resume();
// void xorSnapper();
protected:
- RS_EntityContainer * container;
+ EntityContainer * container;
GraphicView * graphicView;
- RS_Entity * keyEntity;
+ Entity * keyEntity;
Vector snapCoord;
Vector snapSpot;
RS2::SnapMode snapMode;
/**
* Default constructor.
*/
-RS_Solid::RS_Solid(RS_EntityContainer * parent, const RS_SolidData & d):
- RS_AtomicEntity(parent), data(d)
+Solid::Solid(EntityContainer * parent, const SolidData & d):
+ AtomicEntity(parent), data(d)
{
calculateBorders();
}
-/*virtual*/ RS_Entity * RS_Solid::clone()
+/*virtual*/ Entity * Solid::clone()
{
- RS_Solid * s = new RS_Solid(*this);
+ Solid * s = new Solid(*this);
s->initId();
return s;
}
/** @return RS_ENTITY_POINT */
-/*virtual*/ RS2::EntityType RS_Solid::rtti() const
+/*virtual*/ RS2::EntityType Solid::rtti() const
{
return RS2::EntitySolid;
}
/**
* @return Start point of the entity.
*/
-/*virtual*/ Vector RS_Solid::getStartpoint() const
+/*virtual*/ Vector Solid::getStartpoint() const
{
return Vector(false);
}
/**
* @return End point of the entity.
*/
-/*virtual*/ Vector RS_Solid::getEndpoint() const
+/*virtual*/ Vector Solid::getEndpoint() const
{
return Vector(false);
}
/** @return Copy of data that defines the point. */
-RS_SolidData RS_Solid::getData() const
+SolidData Solid::getData() const
{
return data;
}
/** @return true if this is a triangle. */
-bool RS_Solid::isTriangle()
+bool Solid::isTriangle()
{
return !data.corner[3].valid;
}
/**
* @return Corner number 'num'.
*/
-Vector RS_Solid::getCorner(int num)
+Vector Solid::getCorner(int num)
{
if (num >= 0 && num < 4)
return data.corner[num];
else
{
- RS_DEBUG->print("Illegal corner requested from Solid", RS_Debug::D_WARNING);
+ DEBUG->print("Illegal corner requested from Solid", Debug::D_WARNING);
return Vector(false);
}
}
* @param angle Direction of the arrow.
* @param arrowSize Size of arrow (length).
*/
-void RS_Solid::shapeArrow(const Vector & point, double angle, double arrowSize)
+void Solid::shapeArrow(const Vector & point, double angle, double arrowSize)
{
double cosv1, sinv1, cosv2, sinv2;
double arrowSide = arrowSize / cos(0.165);
calculateBorders();
}
-void RS_Solid::calculateBorders()
+void Solid::calculateBorders()
{
resetBorders();
}
}
-Vector RS_Solid::getNearestEndpoint(const Vector & coord, double * dist)
+Vector Solid::getNearestEndpoint(const Vector & coord, double * dist)
{
double minDist = RS_MAXDOUBLE;
double curDist;
/**
* @todo Implement this.
*/
-Vector RS_Solid::getNearestPointOnEntity(const Vector & /*coord*/, bool /*onEntity*/,
- double * /*dist*/, RS_Entity ** /*entity*/)
+Vector Solid::getNearestPointOnEntity(const Vector & /*coord*/, bool /*onEntity*/,
+ double * /*dist*/, Entity ** /*entity*/)
{
Vector ret(false);
return ret;
}
-Vector RS_Solid::getNearestCenter(const Vector & /*coord*/, double * dist)
+Vector Solid::getNearestCenter(const Vector & /*coord*/, double * dist)
{
if (dist)
*dist = RS_MAXDOUBLE;
return Vector(false);
}
-Vector RS_Solid::getNearestMiddle(const Vector & /*coord*/, double * dist)
+Vector Solid::getNearestMiddle(const Vector & /*coord*/, double * dist)
{
if (dist)
*dist = RS_MAXDOUBLE;
return Vector(false);
}
-Vector RS_Solid::getNearestDist(double /*distance*/, const Vector & /*coord*/, double * dist)
+Vector Solid::getNearestDist(double /*distance*/, const Vector & /*coord*/, double * dist)
{
if (dist)
*dist = RS_MAXDOUBLE;
*
* @todo implement
*/
-double RS_Solid::getDistanceToPoint(const Vector & /*coord*/, RS_Entity ** /*entity*/,
+double Solid::getDistanceToPoint(const Vector & /*coord*/, Entity ** /*entity*/,
RS2::ResolveLevel /*level*/, double /*solidDist*/)
{
return RS_MAXDOUBLE;
}
-void RS_Solid::move(Vector offset)
+void Solid::move(Vector offset)
{
for(int i=0; i<4; ++i)
data.corner[i].move(offset);
calculateBorders();
}
-void RS_Solid::rotate(Vector center, double angle)
+void Solid::rotate(Vector center, double angle)
{
for(int i=0; i<4; ++i)
data.corner[i].rotate(center, angle);
calculateBorders();
}
-void RS_Solid::scale(Vector center, Vector factor)
+void Solid::scale(Vector center, Vector factor)
{
for(int i=0; i<4; ++i)
data.corner[i].scale(center, factor);
calculateBorders();
}
-void RS_Solid::mirror(Vector axisPoint1, Vector axisPoint2)
+void Solid::mirror(Vector axisPoint1, Vector axisPoint2)
{
for(int i=0; i<4; ++i)
data.corner[i].mirror(axisPoint1, axisPoint2);
calculateBorders();
}
-void RS_Solid::draw(PaintInterface * painter, GraphicView * view, double /*patternOffset*/)
+void Solid::draw(PaintInterface * painter, GraphicView * view, double /*patternOffset*/)
{
if (!painter || !view)
return;
- RS_SolidData d = getData();
+ SolidData d = getData();
if (isTriangle())
painter->fillTriangle(view->toGui(getCorner(0)), view->toGui(getCorner(1)),
/**
* Dumps the point's data to stdout.
*/
-std::ostream & operator<<(std::ostream & os, const RS_Solid & p)
+std::ostream & operator<<(std::ostream & os, const Solid & p)
{
os << " Solid: " << p.getData() << "\n";
return os;
/**
* Holds the data that defines a solid.
*/
-class RS_SolidData
+class SolidData
{
public:
/**
* Default constructor. Leaves the data object uninitialized.
*/
- RS_SolidData()
+ SolidData()
{
for(int i=0; i<4; ++i)
corner[i] = Vector(false);
/**
* Constructor for a solid with 3 corners.
*/
- RS_SolidData(const Vector & corner1, const Vector & corner2, const Vector & corner3)
+ SolidData(const Vector & corner1, const Vector & corner2, const Vector & corner3)
{
corner[0] = corner1;
corner[1] = corner2;
/**
* Constructor for a solid with 4 corners.
*/
- RS_SolidData(const Vector & corner1, const Vector & corner2, const Vector & corner3, const Vector & corner4)
+ SolidData(const Vector & corner1, const Vector & corner2, const Vector & corner3, const Vector & corner4)
{
corner[0] = corner1;
corner[1] = corner2;
corner[3] = corner4;
}
- friend class RS_Solid;
+ friend class Solid;
- friend std::ostream & operator<<(std::ostream & os, const RS_SolidData & pd)
+ friend std::ostream & operator<<(std::ostream & os, const SolidData & pd)
{
os << "(";
*
* @author Andrew Mustun
*/
-class RS_Solid: public RS_AtomicEntity
+class Solid: public AtomicEntity
{
public:
- RS_Solid(RS_EntityContainer * parent, const RS_SolidData & d);
+ Solid(EntityContainer * parent, const SolidData & d);
- virtual RS_Entity * clone();
+ virtual Entity * clone();
virtual RS2::EntityType rtti() const;
virtual Vector getStartpoint() const;
virtual Vector getEndpoint() const;
- RS_SolidData getData() const;
+ SolidData getData() const;
bool isTriangle();
Vector getCorner(int num);
void shapeArrow(const Vector & point, double angle, double arrowSize);
virtual Vector getNearestEndpoint(const Vector & coord, double * dist = NULL);
virtual Vector getNearestPointOnEntity(const Vector & coord, bool onEntity = true,
- double * dist = NULL, RS_Entity ** entity = NULL);
+ double * dist = NULL, Entity ** entity = NULL);
virtual Vector getNearestCenter(const Vector & coord, double * dist = NULL);
virtual Vector getNearestMiddle(const Vector & coord, double * dist = NULL);
virtual Vector getNearestDist(double distance, const Vector & coord, double * dist = NULL);
- virtual double getDistanceToPoint(const Vector & coord, RS_Entity ** entity = NULL,
+ virtual double getDistanceToPoint(const Vector & coord, Entity ** entity = NULL,
RS2::ResolveLevel level = RS2::ResolveNone, double solidDist = RS_MAXDOUBLE);
virtual void move(Vector offset);
virtual void rotate(Vector center, double angle);
virtual void mirror(Vector axisPoint1, Vector axisPoint2);
virtual void draw(PaintInterface * painter, GraphicView * view, double patternOffset = 0.0);
- friend std::ostream & operator<<(std::ostream & os, const RS_Solid & p);
+ friend std::ostream & operator<<(std::ostream & os, const Solid & p);
/** Recalculates the borders of this entity. */
virtual void calculateBorders ();
protected:
- RS_SolidData data;
+ SolidData data;
};
#endif
/**
* Constructor.
*/
-RS_Spline::RS_Spline(RS_EntityContainer * parent, const RS_SplineData & d):
- RS_EntityContainer(parent), data(d)
+Spline::Spline(EntityContainer * parent, const SplineData & d):
+ EntityContainer(parent), data(d)
{
calculateBorders();
}
/**
* Destructor.
*/
-RS_Spline::~RS_Spline()
+Spline::~Spline()
{
}
-RS_Entity * RS_Spline::clone()
+Entity * Spline::clone()
{
- RS_Spline * l = new RS_Spline(*this);
+ Spline * l = new Spline(*this);
#warning "!!! Need to deal with setAutoDelete() Qt3->Qt4 !!!"
// l->entities.setAutoDelete(entities.autoDelete());
l->initId();
}
/** @return RS2::EntitySpline */
-/*virtual*/ RS2::EntityType RS_Spline::rtti() const
+/*virtual*/ RS2::EntityType Spline::rtti() const
{
return RS2::EntitySpline;
}
/** @return false */
-/*virtual*/ bool RS_Spline::isEdge() const
+/*virtual*/ bool Spline::isEdge() const
{
return false;
}
/** @return Copy of data that defines the spline. */
-RS_SplineData RS_Spline::getData() const
+SplineData Spline::getData() const
{
return data;
}
/** Sets the splines degree (1-3). */
-void RS_Spline::setDegree(int deg)
+void Spline::setDegree(int deg)
{
if (deg >= 1 && deg <= 3)
data.degree = deg;
}
/** @return Degree of this spline curve (1-3).*/
-int RS_Spline::getDegree()
+int Spline::getDegree()
{
return data.degree;
}
/** @return 0. */
-int RS_Spline::getNumberOfKnots()
+int Spline::getNumberOfKnots()
{
return 0;
}
/** @return Number of control points. */
-int RS_Spline::getNumberOfControlPoints()
+int Spline::getNumberOfControlPoints()
{
return data.controlPoints.count();
}
* @retval true if the spline is closed.
* @retval false otherwise.
*/
-bool RS_Spline::isClosed()
+bool Spline::isClosed()
{
return data.closed;
}
/**
* Sets the closed falg of this spline.
*/
-void RS_Spline::setClosed(bool c)
+void Spline::setClosed(bool c)
{
data.closed = c;
update();
}
-void RS_Spline::calculateBorders()
+void Spline::calculateBorders()
{
/*minV = Vector::minimum(data.startpoint, data.endpoint);
maxV = Vector::maximum(data.startpoint, data.endpoint);
*/
}
-VectorSolutions RS_Spline::getRefPoints()
+VectorSolutions Spline::getRefPoints()
{
VectorSolutions ret(data.controlPoints.count());
return ret;
}
-Vector RS_Spline::getNearestRef(const Vector & coord, double * dist)
+Vector Spline::getNearestRef(const Vector & coord, double * dist)
{
//return getRefPoints().getClosest(coord, dist);
- return RS_Entity::getNearestRef(coord, dist);
+ return Entity::getNearestRef(coord, dist);
}
-Vector RS_Spline::getNearestSelectedRef(const Vector & coord, double * dist)
+Vector Spline::getNearestSelectedRef(const Vector & coord, double * dist)
{
//return getRefPoints().getClosest(coord, dist);
- return RS_Entity::getNearestSelectedRef(coord, dist);
+ return Entity::getNearestSelectedRef(coord, dist);
}
/**
* Updates the internal polygon of this spline. Called when the
* spline or it's data, position, .. changes.
*/
-void RS_Spline::update()
+void Spline::update()
{
- RS_DEBUG->print("RS_Spline::update");
+ DEBUG->print("Spline::update");
clear();
if (data.degree < 1 || data.degree > 3)
{
- RS_DEBUG->print("RS_Spline::update: invalid degree: %d", data.degree);
+ DEBUG->print("Spline::update: invalid degree: %d", data.degree);
return;
}
if (data.controlPoints.count() < (uint)data.degree + 1)
{
- RS_DEBUG->print("RS_Spline::update: not enough control points");
+ DEBUG->print("Spline::update: not enough control points");
return;
}
b[i + 1] = (*it).y;
b[i + 2] = 0.0;
- RS_DEBUG->print("RS_Spline::update: b[%d]: %f/%f", i, b[i], b[i + 1]);
+ DEBUG->print("Spline::update: b[%d]: %f/%f", i, b[i], b[i + 1]);
i += 3;
}
{
if (prev.valid)
{
- RS_Line * line = new RS_Line(this, RS_LineData(prev, Vector(p[i], p[i + 1])));
+ Line * line = new Line(this, LineData(prev, Vector(p[i], p[i + 1])));
line->setLayer(NULL);
- line->setPen(RS_Pen(RS2::FlagInvalid));
+ line->setPen(Pen(RS2::FlagInvalid));
addEntity(line);
}
delete[] p;
}
-Vector RS_Spline::getNearestEndpoint(const Vector & coord, double * dist)
+Vector Spline::getNearestEndpoint(const Vector & coord, double * dist)
{
double minDist = RS_MAXDOUBLE;
double d;
}
/*
-// The default implementation of RS_EntityContainer is inaccurate but
+// The default implementation of EntityContainer is inaccurate but
// has to do for now..
-Vector RS_Spline::getNearestPointOnEntity(const Vector& coord,
- bool onEntity, double* dist, RS_Entity** entity) {
+Vector Spline::getNearestPointOnEntity(const Vector& coord,
+ bool onEntity, double* dist, Entity** entity) {
}
*/
-Vector RS_Spline::getNearestCenter(const Vector & /*coord*/, double * dist)
+Vector Spline::getNearestCenter(const Vector & /*coord*/, double * dist)
{
if (dist != NULL)
*dist = RS_MAXDOUBLE;
return Vector(false);
}
-Vector RS_Spline::getNearestMiddle(const Vector & /*coord*/, double * dist)
+Vector Spline::getNearestMiddle(const Vector & /*coord*/, double * dist)
{
if (dist!=NULL)
*dist = RS_MAXDOUBLE;
return Vector(false);
}
-Vector RS_Spline::getNearestDist(double /*distance*/, const Vector & /*coord*/, double * dist)
+Vector Spline::getNearestDist(double /*distance*/, const Vector & /*coord*/, double * dist)
{
if (dist != NULL)
*dist = RS_MAXDOUBLE;
return Vector(false);
}
-void RS_Spline::move(Vector offset)
+void Spline::move(Vector offset)
{
// Q3ValueList<Vector>::iterator it;
QList<Vector>::iterator it;
update();
}
-void RS_Spline::rotate(Vector center, double angle)
+void Spline::rotate(Vector center, double angle)
{
// Q3ValueList<Vector>::iterator it;
QList<Vector>::iterator it;
update();
}
-void RS_Spline::scale(Vector center, Vector factor)
+void Spline::scale(Vector center, Vector factor)
{
// Q3ValueList<Vector>::iterator it;
QList<Vector>::iterator it;
update();
}
-void RS_Spline::mirror(Vector axisPoint1, Vector axisPoint2)
+void Spline::mirror(Vector axisPoint1, Vector axisPoint2)
{
// Q3ValueList<Vector>::iterator it;
QList<Vector>::iterator it;
update();
}
-void RS_Spline::moveRef(const Vector & ref, const Vector & offset)
+void Spline::moveRef(const Vector & ref, const Vector & offset)
{
// Q3ValueList<Vector>::iterator it;
QList<Vector>::iterator it;
update();
}
-void RS_Spline::draw(PaintInterface * painter, GraphicView * view, double /*patternOffset*/)
+void Spline::draw(PaintInterface * painter, GraphicView * view, double /*patternOffset*/)
{
if (painter == NULL || view == NULL)
return;
- RS_Entity * e = firstEntity(RS2::ResolveNone);
+ Entity * e = firstEntity(RS2::ResolveNone);
double offset = 0.0;
if (e != NULL)
{
view->drawEntity(e);
offset += e->getLength();
- //RS_DEBUG->print("offset: %f\nlength was: %f", offset, e->getLength());
+ //DEBUG->print("offset: %f\nlength was: %f", offset, e->getLength());
}
- for (RS_Entity * e=nextEntity(RS2::ResolveNone); e!=NULL; e = nextEntity(RS2::ResolveNone))
+ for (Entity * e=nextEntity(RS2::ResolveNone); e!=NULL; e = nextEntity(RS2::ResolveNone))
{
view->drawEntityPlain(e, -offset);
offset += e->getLength();
- //RS_DEBUG->print("offset: %f\nlength was: %f", offset, e->getLength());
+ //DEBUG->print("offset: %f\nlength was: %f", offset, e->getLength());
}
}
* Todo: draw the spline, user patterns.
*/
/*
-void RS_Spline::draw(RS_Painter* painter, GraphicView* view) {
+void Spline::draw(RS_Painter* painter, GraphicView* view) {
if (painter==NULL || view==NULL) {
return;
}
b[i+1] = (*it).y;
b[i+2] = 0.0;
- RS_DEBUG->print("RS_Spline::draw: b[%d]: %f/%f", i, b[i], b[i+1]);
+ DEBUG->print("Spline::draw: b[%d]: %f/%f", i, b[i], b[i+1]);
i+=3;
}
/**
* @return The reference points of the spline.
*/
-//Q3ValueList<Vector> RS_Spline::getControlPoints()
-QList<Vector> RS_Spline::getControlPoints()
+//Q3ValueList<Vector> Spline::getControlPoints()
+QList<Vector> Spline::getControlPoints()
{
return data.controlPoints;
}
/**
* Appends the given point to the control points.
*/
-void RS_Spline::addControlPoint(const Vector & v)
+void Spline::addControlPoint(const Vector & v)
{
data.controlPoints.append(v);
}
/**
* Removes the control point that was last added.
*/
-void RS_Spline::removeLastControlPoint()
+void Spline::removeLastControlPoint()
{
data.controlPoints.pop_back();
}
* Generates B-Spline open knot vector with multiplicity
* equal to the order at the ends.
*/
-void RS_Spline::knot(int num, int order, int knotVector[])
+void Spline::knot(int num, int order, int knotVector[])
{
knotVector[1] = 0;
/**
* Generates rational B-spline basis functions for an open knot vector.
*/
-void RS_Spline::rbasis(int c, double t, int npts, int x[], double h[], double r[])
+void Spline::rbasis(int c, double t, int npts, int x[], double h[], double r[])
{
int nplusc;
int i, k;
/**
* Generates a rational B-spline curve using a uniform open knot vector.
*/
-void RS_Spline::rbspline(int npts, int k, int p1, double b[], double h[], double p[])
+void Spline::rbspline(int npts, int k, int p1, double b[], double h[], double p[])
{
int i, j, icount, jcount;
int i1;
delete[] nbasis;
}
-void RS_Spline::knotu(int num, int order, int knotVector[])
+void Spline::knotu(int num, int order, int knotVector[])
{
int nplusc = num + order;
int nplus2 = num + 2;
knotVector[i] = i - 1;
}
-void RS_Spline::rbsplinu(int npts, int k, int p1, double b[], double h[], double p[])
+void Spline::rbsplinu(int npts, int k, int p1, double b[], double h[], double p[])
{
int i, j, icount, jcount;
int i1;
/**
* Dumps the spline's data to stdout.
*/
-std::ostream & operator<<(std::ostream & os, const RS_Spline & l)
+std::ostream & operator<<(std::ostream & os, const Spline & l)
{
os << " Spline: " << l.getData() << "\n";
return os;
/**
* Holds the data that defines a line.
*/
-class RS_SplineData
+class SplineData
{
public:
/**
* Default constructor. Leaves the data object uninitialized.
*/
- RS_SplineData() {}
+ SplineData() {}
- RS_SplineData(int degree, bool closed)
+ SplineData(int degree, bool closed)
{
this->degree = degree;
this->closed = closed;
}
- friend std::ostream & operator<<(std::ostream & os, const RS_SplineData & ld)
+ friend std::ostream & operator<<(std::ostream & os, const SplineData & ld)
{
os << "( degree: " << ld.degree << " closed: " << ld.closed << ")";
return os;
*
* @author Andrew Mustun
*/
-class RS_Spline: public RS_EntityContainer
+class Spline: public EntityContainer
{
public:
- RS_Spline(RS_EntityContainer * parent, const RS_SplineData & d);
- virtual ~RS_Spline();
+ Spline(EntityContainer * parent, const SplineData & d);
+ virtual ~Spline();
- virtual RS_Entity * clone();
+ virtual Entity * clone();
virtual RS2::EntityType rtti() const;
virtual bool isEdge() const;
- RS_SplineData getData() const;
+ SplineData getData() const;
void setDegree(int deg);
int getDegree();
int getNumberOfKnots();
virtual void draw(PaintInterface * painter, GraphicView * view, double patternOffset = 0.0);
QList<Vector> getControlPoints();
- friend std::ostream & operator<<(std::ostream & os, const RS_Spline & l);
+ friend std::ostream & operator<<(std::ostream & os, const Spline & l);
virtual void calculateBorders();
static void rbsplinu(int npts, int k, int p1, double b[], double h[], double p[]);
protected:
- RS_SplineData data;
+ SplineData data;
};
#endif
* @param w Width
* @param h Height
*/
-RS_StaticGraphicView::RS_StaticGraphicView(int w, int h, PaintInterface * p): /*painter(p),*/ width(w), height(h)
+StaticGraphicView::StaticGraphicView(int w, int h, PaintInterface * p): /*painter(p),*/ width(w), height(h)
{
//#warning "!!! PaintInterface * p passed in constructor is IGNORED !!!"
//Not strictly true: it sets painter down below there...
- setBackground(RS_Color(255, 255, 255));
+ setBackground(Color(255, 255, 255));
painter = p;
setBorders(5, 5, 5, 5);
}
/**
* Destructor
*/
-RS_StaticGraphicView::~RS_StaticGraphicView()
+StaticGraphicView::~StaticGraphicView()
{
}
/**
* @return width of widget.
*/
-int RS_StaticGraphicView::getWidth()
+int StaticGraphicView::getWidth()
{
return width;
}
/**
* @return height of widget.
*/
-int RS_StaticGraphicView::getHeight()
+int StaticGraphicView::getHeight()
{
return height;
}
/**
* Handles paint events by redrawing the graphic in this view.
*/
-void RS_StaticGraphicView::paint()
+void StaticGraphicView::paint()
{
- RS_DEBUG->print("RS_StaticGraphicView::paint begin");
+ DEBUG->print("StaticGraphicView::paint begin");
drawIt();
- RS_DEBUG->print("RS_StaticGraphicView::paint end");
+ DEBUG->print("StaticGraphicView::paint end");
}
-/*virtual*/ void RS_StaticGraphicView::redraw()
+/*virtual*/ void StaticGraphicView::redraw()
{
}
-/*virtual*/ void RS_StaticGraphicView::adjustOffsetControls()
+/*virtual*/ void StaticGraphicView::adjustOffsetControls()
{
}
-/*virtual*/ void RS_StaticGraphicView::adjustZoomControls()
+/*virtual*/ void StaticGraphicView::adjustZoomControls()
{
}
-/*virtual*/ void RS_StaticGraphicView::setMouseCursor(RS2::CursorType)
+/*virtual*/ void StaticGraphicView::setMouseCursor(RS2::CursorType)
{
}
-/*virtual*/ void RS_StaticGraphicView::emulateMouseMoveEvent()
+/*virtual*/ void StaticGraphicView::emulateMouseMoveEvent()
{
}
-/*virtual*/ void RS_StaticGraphicView::updateGridStatusWidget(const QString &)
+/*virtual*/ void StaticGraphicView::updateGridStatusWidget(const QString &)
{
}
* This is an implementation of a graphic viewer with a fixed size
* for drawing onto fixed devices (such as bitmaps).
*/
-class RS_StaticGraphicView: public GraphicView
+class StaticGraphicView: public GraphicView
{
public:
- RS_StaticGraphicView(int w, int h, PaintInterface * p);
- virtual ~RS_StaticGraphicView();
+ StaticGraphicView(int w, int h, PaintInterface * p);
+ virtual ~StaticGraphicView();
virtual int getWidth();
virtual int getHeight();
#include <QTranslator>
#include "settings.h"
-RS_System * RS_System::uniqueInstance = NULL;
+System * System::uniqueInstance = NULL;
// Constructor
-RS_System::RS_System()
+System::System()
{
initialized = false;
}
/**
* @return Instance to the unique system object.
*/
-/*static*/ RS_System * RS_System::instance()
+/*static*/ System * System::instance()
{
if (uniqueInstance == NULL)
- uniqueInstance = new RS_System();
+ uniqueInstance = new System();
return uniqueInstance;
}
/**
* Initializes the system.
*
- * @param appName Application name (e.g. "QCad II")
+ * @param appName Application name (e.g. "Architektonas")
* @param appVersion Application version (e.g. "1.2.3")
* @param appDirName Application directory name used for
* subdirectories in /usr, /etc ~/.
* @param appDir Absolute application directory (e.g. /opt/qcad)
* defaults to current directory.
*/
-void RS_System::init(const QString & appName, const QString & appVersion,
+void System::init(const QString & appName, const QString & appVersion,
const QString & appDirName, const QString & appDir)
{
this->appName = appName;
this->appDir = appDir;
}
- RS_DEBUG->print("RS_System::init: System %s initialized.", appName.toLatin1().data());
- RS_DEBUG->print("RS_System::init: App dir: %s", appDir.toLatin1().data());
+ DEBUG->print("System::init: System %s initialized.", appName.toLatin1().data());
+ DEBUG->print("System::init: App dir: %s", appDir.toLatin1().data());
initialized = true;
initLanguageList();
/**
* Initializes the list of available translations.
*/
-void RS_System::initLanguageList()
+void System::initLanguageList()
{
- RS_DEBUG->print("RS_System::initLanguageList");
+ DEBUG->print("System::initLanguageList");
QStringList lst = getFileList("qm", "qm");
settings.beginGroup("Paths");
for(QStringList::Iterator it=lst.begin(); it!=lst.end(); ++it)
{
- RS_DEBUG->print("RS_System::initLanguageList: qm file: %s", (*it).toLatin1().data());
+ DEBUG->print("System::initLanguageList: qm file: %s", (*it).toLatin1().data());
// int i1 = (*it).findRev('_');
int i1 = (*it).lastIndexOf('_');
// if (languageList.find(l) == languageList.end())
if (languageList.indexOf(l) == -1)
{
- RS_DEBUG->print("RS_System::initLanguageList: append language: %s", l.toLatin1().data());
+ DEBUG->print("System::initLanguageList: append language: %s", l.toLatin1().data());
languageList.append(l);
}
}
- RS_DEBUG->print("RS_System::initLanguageList: OK");
+ DEBUG->print("System::initLanguageList: OK");
}
/**
* Loads a different translation for the application GUI.
*/
-void RS_System::loadTranslation(const QString & lang, const QString & langCmd)
+void System::loadTranslation(const QString & lang, const QString & langCmd)
{
static QTranslator * tQt = NULL;
static QTranslator * tQCad = NULL;
* Checks if the system has been initialized and prints a warning
* otherwise to stderr.
*/
-bool RS_System::checkInit()
+bool System::checkInit()
{
if (!initialized)
{
- RS_DEBUG->print(RS_Debug::D_WARNING, "RS_System::checkInit: System not initialized.\n"
- "Use RS_SYSTEM->init(appname, appdirname) to do so.");
+ DEBUG->print(Debug::D_WARNING, "System::checkInit: System not initialized.\n"
+ "Use SYSTEM->init(appname, appdirname) to do so.");
}
return initialized;
/**
* Creates all given directories in the user's home.
*/
-bool RS_System::createHomePath(const QString & p)
+bool System::createHomePath(const QString & p)
{
QDir dr;
// if (created.isEmpty() || QFileInfo(created).isDir() || dr.mkdir(created, true))
if (created.isEmpty() || QFileInfo(created).isDir() || dr.mkdir(created))
{
- RS_DEBUG->print("RS_System::createHomePath: Created directory '%s'",
+ DEBUG->print("System::createHomePath: Created directory '%s'",
created.toLatin1().data());
}
else
{
- RS_DEBUG->print(RS_Debug::D_ERROR, "RS_System::createHomePath: Cannot create directory '%s'",
+ DEBUG->print(Debug::D_ERROR, "System::createHomePath: Cannot create directory '%s'",
created.toLatin1().data());
return false;
}
/**
* @return Users home directory.
*/
-QString RS_System::getHomeDir()
+QString System::getHomeDir()
{
// return QDir::homeDirPath();
return QDir::homePath();
/**
* @return Current directory.
*/
-QString RS_System::getCurrentDir()
+QString System::getCurrentDir()
{
// return QDir::currentDirPath();
return QDir::currentPath();
/**
* @return Application directory.
*/
-QString RS_System::getAppDir()
+QString System::getAppDir()
{
return appDir;
}
/**
* @return A list of absolute paths to all font files found.
*/
-QStringList RS_System::getFontList()
+QStringList System::getFontList()
{
QStringList ret = getFileList("fonts", "cxf");
return ret;
/**
* @return A list of absolute paths to all hatch pattern files found.
*/
-QStringList RS_System::getPatternList()
+QStringList System::getPatternList()
{
QStringList ret = getFileList("patterns", "dxf");
return ret;
/**
* @return A list of absolute paths to all script files found.
*/
-QStringList RS_System::getScriptList()
+QStringList System::getScriptList()
{
QStringList ret = getFileList("scripts/qsa", "qs");
return ret;
/**
* @return A list of absolute paths to all machine configuration files found.
*/
-QStringList RS_System::getMachineList()
+QStringList System::getMachineList()
{
QStringList ret = getFileList("machines", "cxm");
return ret;
/**
* @return Absolute path to the documentation.
*/
-QString RS_System::getDocPath()
+QString System::getDocPath()
{
QStringList lst = getDirectoryList("doc");
return lst.first();
/**
* @return The application name.
*/
-QString RS_System::getAppName()
+QString System::getAppName()
{
return appName;
}
/**
* @return The application version.
*/
-QString RS_System::getAppVersion()
+QString System::getAppVersion()
{
return appVersion;
}
*
* @return List of the absolute paths of the files found.
*/
-QStringList RS_System::getFileList(const QString & subDirectory, const QString & fileExtension)
+QStringList System::getFileList(const QString & subDirectory, const QString & fileExtension)
{
checkInit();
* @return List of all directories in subdirectory 'subDirectory' in
* all possible QCad directories.
*/
-QStringList RS_System::getDirectoryList(const QString & subDirectory)
+QStringList System::getDirectoryList(const QString & subDirectory)
{
QStringList dirList;
QStringList ret;
- RS_DEBUG->print("RS_System::getDirectoryList: Paths:");
+ DEBUG->print("System::getDirectoryList: Paths:");
for(QStringList::Iterator it=dirList.begin(); it!=dirList.end(); ++it)
{
if (QFileInfo(*it).isDir())
{
ret += (*it);
- RS_DEBUG->print((*it).toLatin1().data());
+ DEBUG->print((*it).toLatin1().data());
//printf("System: *it=\"%s\"\n", (*it).toAscii().data());
}
}
return ret;
}
-QStringList RS_System::getLanguageList()
+QStringList System::getLanguageList()
{
return languageList;
}
*
* Supported languages: http://ftp.ics.uci.edu/pub/ietf/http/related/iso639.txt
*/
-QString RS_System::languageToSymbol(const QString& lang)
+QString System::languageToSymbol(const QString& lang)
{
QString l = lang.toLower();
* Converst a language two-letter-code into a readable string
* (e.g. 'de' to Deutsch)
*/
-QString RS_System::symbolToLanguage(const QString & symb)
+QString System::symbolToLanguage(const QString & symb)
{
QString l = symb.toLower();
/**
* Tries to convert the given encoding string to an encoding Qt knows.
*/
-QString RS_System::getEncoding(const QString & str)
+QString System::getEncoding(const QString & str)
{
QString l=str.toLower();
*/
static QMap<QString, QString> loc_map;
-QString RS_System::localeToISO(const QString & locale)
+QString System::localeToISO(const QString & locale)
{
if (loc_map.isEmpty())
{
#include <QtCore>
#include "debug.h"
-#define RS_SYSTEM RS_System::instance()
+#define SYSTEM System::instance()
/**
* Class for some system methods such as file system operations.
* @author James Hammons
* @author Andrew Mustun
*/
-class RS_System
+class System
{
protected:
- RS_System();
+ System();
public:
- static RS_System * instance();
+ static System * instance();
void init(const QString & appName, const QString & appVersion,
const QString & appDirName, const QString & appDir = "");
void initLanguageList();
static QString localeToISO(const QString & locale);
protected:
- static RS_System * uniqueInstance;
+ static System * uniqueInstance;
QString appName;
QString appVersion;
/**
* Constructor.
*/
-RS_Text::RS_Text(RS_EntityContainer * parent, const RS_TextData & d): RS_EntityContainer(parent), data(d)
+Text::Text(EntityContainer * parent, const TextData & d): EntityContainer(parent), data(d)
{
usedTextHeight = 0.0;
usedTextWidth = 0.0;
setText(data.text);
}
-/*virtual*/ RS_Text::~RS_Text()
+/*virtual*/ Text::~Text()
{
}
-/*virtual*/ RS_Entity * RS_Text::clone()
+/*virtual*/ Entity * Text::clone()
{
- RS_Text * t = new RS_Text(*this);
+ Text * t = new Text(*this);
#warning "!!! Need to deal with setAutoDelete() Qt3->Qt4 !!!"
// t->entities.setAutoDelete(entities.autoDelete());
t->initId();
}
/** @return RS2::EntityText */
-/*virtual*/ RS2::EntityType RS_Text::rtti() const
+/*virtual*/ RS2::EntityType Text::rtti() const
{
return RS2::EntityText;
}
/** @return Copy of data that defines the text. */
-RS_TextData RS_Text::getData() const
+TextData Text::getData() const
{
return data;
}
/**
* @return Number of lines in this text entity.
*/
-int RS_Text::getNumberOfLines()
+int Text::getNumberOfLines()
{
int c = 1;
* text or it's data, position, alignment, .. changes.
* This method also updates the usedTextWidth / usedTextHeight property.
*/
-void RS_Text::update()
+void Text::update()
{
#if 0
-printf("RS_Text::update(): ");
+printf("Text::update(): ");
#endif
- RS_DEBUG->print("RS_Text::update");
+ DEBUG->print("Text::update");
clear();
#if 0
#if 0
printf("data.style=\"%s\", ", data.style.toAscii().data());
#endif
- RS_Font * font = RS_FONTLIST->requestFont(data.style);
+ Font * font = FONTLIST->requestFont(data.style);
#if 0
printf("font=%08X\n", (unsigned int)font);
// Every single text line gets stored in this entity container
// so we can move the whole line around easely:
- RS_EntityContainer * oneLine = new RS_EntityContainer(this);
+ EntityContainer * oneLine = new EntityContainer(this);
// First every text line is created with
// alignement: top left
case 0x0A:
// line feed:
updateAddLine(oneLine, lineCounter++);
- oneLine = new RS_EntityContainer(this);
+ oneLine = new EntityContainer(this);
letterPos = Vector(0.0, -9.0);
break;
{
case 'P':
updateAddLine(oneLine, lineCounter++);
- oneLine = new RS_EntityContainer(this);
+ oneLine = new EntityContainer(this);
letterPos = Vector(0.0, -9.0);
break;
}
// add texts:
- RS_Text * upper = new RS_Text(oneLine,
- RS_TextData(letterPos + Vector(0.0, 9.0), 4.0, 100.0,
+ Text * upper = new Text(oneLine,
+ TextData(letterPos + Vector(0.0, 9.0), 4.0, 100.0,
RS2::VAlignTop, RS2::HAlignLeft, RS2::LeftToRight,
RS2::Exact, 1.0, up, data.style, 0.0, RS2::Update));
upper->setLayer(NULL);
- upper->setPen(RS_Pen(RS2::FlagInvalid));
+ upper->setPen(Pen(RS2::FlagInvalid));
oneLine->addEntity(upper);
- RS_Text * lower = new RS_Text(oneLine,
- RS_TextData(letterPos+Vector(0.0, 4.0), 4.0, 100.0,
+ Text * lower = new Text(oneLine,
+ TextData(letterPos+Vector(0.0, 4.0), 4.0, 100.0,
RS2::VAlignTop, RS2::HAlignLeft, RS2::LeftToRight,
RS2::Exact, 1.0, dw, data.style, 0.0, RS2::Update));
lower->setLayer(NULL);
- lower->setPen(RS_Pen(RS2::FlagInvalid));
+ lower->setPen(Pen(RS2::FlagInvalid));
oneLine->addEntity(lower);
// move cursor:
//We ain't getting here:
/*
About to draw TEXT entity... TEXT="107.25"
-RS_Dimension::updateCreateDimensionLine()...
+Dimension::updateCreateDimensionLine()...
--> 107.25
-RS_Text::update(): isUndone=false, font=094C1020
+Text::update(): isUndone=false, font=094C1020
--> default: pos=0, char=0031
--> default: pos=1, char=0030
--> default: pos=2, char=0037
--> default: pos=5, char=0035
*/
//printf(" char=%s\n", QString(data.text.at(i)).toAscii().data());
- RS_DEBUG->print("RS_Text::update: insert a letter at pos: %f/%f", letterPos.x, letterPos.y);
- RS_InsertData d(QString(data.text.at(i)), letterPos, Vector(1.0, 1.0),
+ DEBUG->print("Text::update: insert a letter at pos: %f/%f", letterPos.x, letterPos.y);
+ InsertData d(QString(data.text.at(i)), letterPos, Vector(1.0, 1.0),
0.0, 1, 1, Vector(0.0, 0.0), font->getLetterList(), RS2::NoUpdate);
- RS_Insert * letter = new RS_Insert(this, d);
- letter->setPen(RS_Pen(RS2::FlagInvalid));
+ Insert * letter = new Insert(this, d);
+ letter->setPen(Pen(RS2::FlagInvalid));
letter->setLayer(NULL);
letter->update();
letter->forcedCalculateBorders();
usedTextHeight -= data.height * data.lineSpacingFactor * 1.6 - data.height;
forcedCalculateBorders();
- RS_DEBUG->print("RS_Text::update: OK");
+ DEBUG->print("Text::update: OK");
}
/**
* @param textLine The text line.
* @param lineCounter Line number.
*/
-void RS_Text::updateAddLine(RS_EntityContainer* textLine, int lineCounter)
+void Text::updateAddLine(EntityContainer* textLine, int lineCounter)
{
- RS_DEBUG->print("RS_Text::updateAddLine: width: %f", textLine->getSize().x);
+ DEBUG->print("Text::updateAddLine: width: %f", textLine->getSize().x);
//textLine->forcedCalculateBorders();
- //RS_DEBUG->print("RS_Text::updateAddLine: width 2: %f", textLine->getSize().x);
+ //DEBUG->print("Text::updateAddLine: width 2: %f", textLine->getSize().x);
// Move to correct line position:
textLine->move(Vector(0.0, -9.0 * lineCounter * data.lineSpacingFactor * 1.6));
textLine->forcedCalculateBorders();
Vector textSize = textLine->getSize();
- RS_DEBUG->print("RS_Text::updateAddLine: width 2: %f", textSize.x);
+ DEBUG->print("Text::updateAddLine: width 2: %f", textSize.x);
// Horizontal Align:
switch (data.halign)
{
case RS2::HAlignCenter:
- RS_DEBUG->print("RS_Text::updateAddLine: move by: %f", -textSize.x / 2.0);
+ DEBUG->print("Text::updateAddLine: move by: %f", -textSize.x / 2.0);
textLine->move(Vector(-textSize.x / 2.0, 0.0));
break;
// Move:
textLine->move(data.insertionPoint);
- textLine->setPen(RS_Pen(RS2::FlagInvalid));
+ textLine->setPen(Pen(RS2::FlagInvalid));
textLine->setLayer(NULL);
textLine->forcedCalculateBorders();
addEntity(textLine);
}
-Vector RS_Text::getInsertionPoint()
+Vector Text::getInsertionPoint()
{
return data.insertionPoint;
}
-double RS_Text::getHeight()
+double Text::getHeight()
{
return data.height;
}
-void RS_Text::setHeight(double h)
+void Text::setHeight(double h)
{
data.height = h;
}
-double RS_Text::getWidth()
+double Text::getWidth()
{
return data.width;
}
*
* @param a 1: top left ... 9: bottom right
*/
-void RS_Text::setAlignment(int a)
+void Text::setAlignment(int a)
{
switch (a % 3)
{
*
* @return 1: top left ... 9: bottom right
*/
-int RS_Text::getAlignment()
+int Text::getAlignment()
{
if (data.valign == RS2::VAlignTop)
{
return 1;
}
-RS2::VAlign RS_Text::getVAlign()
+RS2::VAlign Text::getVAlign()
{
return data.valign;
}
-void RS_Text::setVAlign(RS2::VAlign va)
+void Text::setVAlign(RS2::VAlign va)
{
data.valign = va;
}
-RS2::HAlign RS_Text::getHAlign()
+RS2::HAlign Text::getHAlign()
{
return data.halign;
}
-void RS_Text::setHAlign(RS2::HAlign ha)
+void Text::setHAlign(RS2::HAlign ha)
{
data.halign = ha;
}
-RS2::TextDrawingDirection RS_Text::getDrawingDirection()
+RS2::TextDrawingDirection Text::getDrawingDirection()
{
return data.drawingDirection;
}
-RS2::TextLineSpacingStyle RS_Text::getLineSpacingStyle()
+RS2::TextLineSpacingStyle Text::getLineSpacingStyle()
{
return data.lineSpacingStyle;
}
-void RS_Text::setLineSpacingFactor(double f)
+void Text::setLineSpacingFactor(double f)
{
data.lineSpacingFactor = f;
}
-double RS_Text::getLineSpacingFactor()
+double Text::getLineSpacingFactor()
{
return data.lineSpacingFactor;
}
* Sets a new text. The entities representing the
* text are updated.
*/
-void RS_Text::setText(const QString & t)
+void Text::setText(const QString & t)
{
data.text = t;
}
}
-QString RS_Text::getText()
+QString Text::getText()
{
return data.text;
}
-void RS_Text::setStyle(const QString & s)
+void Text::setStyle(const QString & s)
{
data.style = s;
}
-QString RS_Text::getStyle()
+QString Text::getStyle()
{
return data.style;
}
-void RS_Text::setAngle(double a)
+void Text::setAngle(double a)
{
data.angle = a;
}
-double RS_Text::getAngle()
+double Text::getAngle()
{
return data.angle;
}
-double RS_Text::getUsedTextWidth()
+double Text::getUsedTextWidth()
{
return usedTextWidth;
}
-double RS_Text::getUsedTextHeight()
+double Text::getUsedTextHeight()
{
return usedTextHeight;
}
-/*virtual*/ double RS_Text::getLength()
+/*virtual*/ double Text::getLength()
{
return -1.0;
}
-VectorSolutions RS_Text::getRefPoints()
+VectorSolutions Text::getRefPoints()
{
VectorSolutions ret(data.insertionPoint);
return ret;
}
-Vector RS_Text::getNearestRef(const Vector & coord, double * dist)
+Vector Text::getNearestRef(const Vector & coord, double * dist)
{
- return RS_Entity::getNearestRef(coord, dist);
+ return Entity::getNearestRef(coord, dist);
}
-void RS_Text::move(Vector offset)
+void Text::move(Vector offset)
{
data.insertionPoint.move(offset);
update();
}
-void RS_Text::rotate(Vector center, double angle)
+void Text::rotate(Vector center, double angle)
{
data.insertionPoint.rotate(center, angle);
- data.angle = RS_Math::correctAngle(data.angle + angle);
+ data.angle = Math::correctAngle(data.angle + angle);
update();
}
-void RS_Text::scale(Vector center, Vector factor)
+void Text::scale(Vector center, Vector factor)
{
data.insertionPoint.scale(center, factor);
data.width *= factor.x;
update();
}
-void RS_Text::mirror(Vector axisPoint1, Vector axisPoint2)
+void Text::mirror(Vector axisPoint1, Vector axisPoint2)
{
data.insertionPoint.mirror(axisPoint1, axisPoint2);
//double ang = axisPoint1.angleTo(axisPoint2);
- bool readable = RS_Math::isAngleReadable(data.angle);
+ bool readable = Math::isAngleReadable(data.angle);
Vector vec;
vec.setPolar(1.0, data.angle);
data.angle = vec.angle();
bool corr;
- data.angle = RS_Math::makeAngleReadable(data.angle, readable, &corr);
+ data.angle = Math::makeAngleReadable(data.angle, readable, &corr);
if (corr)
{
update();
}
-bool RS_Text::hasEndpointsWithinWindow(Vector /*v1*/, Vector /*v2*/)
+bool Text::hasEndpointsWithinWindow(Vector /*v1*/, Vector /*v2*/)
{
return false;
}
* Implementations must stretch the given range of the entity
* by the given offset.
*/
-void RS_Text::stretch(Vector firstCorner, Vector secondCorner, Vector offset)
+void Text::stretch(Vector firstCorner, Vector secondCorner, Vector offset)
{
if (getMin().isInWindow(firstCorner, secondCorner)
&& getMax().isInWindow(firstCorner, secondCorner))
/**
* Dumps the point's data to stdout.
*/
-std::ostream & operator<<(std::ostream & os, const RS_Text & p)
+std::ostream & operator<<(std::ostream & os, const Text & p)
{
os << " Text: " << p.getData() << "\n";
return os;
/**
* Holds the data that defines a text entity.
*/
-class RS_TextData
+class TextData
{
public:
/**
* Default constructor. Leaves the data object uninitialized.
*/
- RS_TextData() {}
+ TextData() {}
/**
* Constructor with initialisation.
* often the case since you might want to adjust attributes
* after creating a text entity.
*/
- RS_TextData(const Vector & insertionPoint, double height, double width,
+ TextData(const Vector & insertionPoint, double height, double width,
RS2::VAlign valign, RS2::HAlign halign, RS2::TextDrawingDirection drawingDirection,
RS2::TextLineSpacingStyle lineSpacingStyle, double lineSpacingFactor,
const QString& text, const QString & style, double angle,
this->updateMode = updateMode;
}
- friend class RS_Text;
+ friend class Text;
- friend std::ostream & operator<<(std::ostream & os, const RS_TextData & td)
+ friend std::ostream & operator<<(std::ostream & os, const TextData & td)
{
os << "(" << td.text.toLatin1().data() << ")";
return os;
*
* @author Andrew Mustun
*/
-class RS_Text: public RS_EntityContainer
+class Text: public EntityContainer
{
public:
- RS_Text(RS_EntityContainer * parent, const RS_TextData & d);
- virtual ~RS_Text();
+ Text(EntityContainer * parent, const TextData & d);
+ virtual ~Text();
- virtual RS_Entity * clone();
+ virtual Entity * clone();
virtual RS2::EntityType rtti() const;
- RS_TextData getData() const;
+ TextData getData() const;
void update();
- void updateAddLine(RS_EntityContainer * textLine, int lineCounter);
+ void updateAddLine(EntityContainer * textLine, int lineCounter);
int getNumberOfLines();
Vector getInsertionPoint();
virtual bool hasEndpointsWithinWindow(Vector v1, Vector v2);
virtual void stretch(Vector firstCorner, Vector secondCorner, Vector offset);
- friend std::ostream & operator<<(std::ostream & os, const RS_Text & p);
+ friend std::ostream & operator<<(std::ostream & os, const Text & p);
protected:
- RS_TextData data;
+ TextData data;
/**
* Text width used by the current contents of this text entity.
* This property is updated by the update method.
/**
* Default constructor.
*/
-RS_Undo::RS_Undo()
+Undo::Undo()
{
#warning "!!! Need to deal with setAutoDelete() Qt3->Qt4 !!!"
// undoList.setAutoDelete(true);
currentCycle = NULL;
}
-/*virtual*/ RS_Undo::~RS_Undo()
+/*virtual*/ Undo::~Undo()
{
while (!undoList.isEmpty())
delete undoList.takeFirst();
/**
* @return Number of Cycles that can be undone.
*/
-int RS_Undo::countUndoCycles()
+int Undo::countUndoCycles()
{
- RS_DEBUG->print("RS_Undo::countUndoCycles");
+ DEBUG->print("Undo::countUndoCycles");
return undoPointer + 1;
}
/**
* @return Number of Cycles that can be redone.
*/
-int RS_Undo::countRedoCycles()
+int Undo::countRedoCycles()
{
- RS_DEBUG->print("RS_Undo::countRedoCycles");
+ DEBUG->print("Undo::countRedoCycles");
return (int)undoList.count() - 1 - undoPointer;
}
* All Cycles after the new one are removed and the Undoabels
* on them deleted.
*/
-void RS_Undo::addUndoCycle(RS_UndoCycle * i)
+void Undo::addUndoCycle(UndoCycle * i)
{
- RS_DEBUG->print("RS_Undo::addUndoCycle");
+ DEBUG->print("Undo::addUndoCycle");
undoList.insert(++undoPointer, i);
- RS_DEBUG->print("RS_Undo::addUndoCycle: ok");
+ DEBUG->print("Undo::addUndoCycle: ok");
}
/**
* Starts a new cycle for one undo step. Every undoable that is
* added after calling this method goes into this cycle.
*/
-void RS_Undo::startUndoCycle()
+void Undo::startUndoCycle()
{
- RS_DEBUG->print("RS_Undo::startUndoCycle");
+ DEBUG->print("Undo::startUndoCycle");
// definitely delete Undo Cycles and all Undoables in them
// that cannot be redone now:
while ((int)undoList.count() > undoPointer + 1 && (int)undoList.count() > 0)
{
- RS_UndoCycle * l = undoList.last();
+ UndoCycle * l = undoList.last();
if (l != NULL)
{
- RS_Undoable * u = NULL;
+ Undoable * u = NULL;
bool done = false;
do
if (u != NULL)
{
// Remove the pointer from _all_ cycles:
-// for(RS_UndoCycle * l2=undoList.first(); l2!=NULL; l2=undoList.next())
+// for(UndoCycle * l2=undoList.first(); l2!=NULL; l2=undoList.next())
// l2->removeUndoable(u);
for(int i=0; i<undoList.size(); i++)
undoList[i]->removeUndoable(u);
undoList.removeLast();
}
- currentCycle = new RS_UndoCycle();
+ currentCycle = new UndoCycle();
}
/**
* Adds an undoable to the current undo cycle.
*/
-void RS_Undo::addUndoable(RS_Undoable * u)
+void Undo::addUndoable(Undoable * u)
{
- RS_DEBUG->print("RS_Undo::addUndoable");
+ DEBUG->print("Undo::addUndoable");
if (currentCycle != NULL)
{
}
else
{
- RS_DEBUG->print(RS_Debug::D_WARNING, "RS_Undo::addUndoable(): No undo cycle active.");
+ DEBUG->print(Debug::D_WARNING, "Undo::addUndoable(): No undo cycle active.");
}
}
/**
* Ends the current undo cycle.
*/
-void RS_Undo::endUndoCycle()
+void Undo::endUndoCycle()
{
addUndoCycle(currentCycle);
currentCycle = NULL;
/**
* Undoes the last undo cycle.
*/
-void RS_Undo::undo()
+void Undo::undo()
{
- RS_DEBUG->print("RS_Undo::undo");
+ DEBUG->print("Undo::undo");
if (undoPointer >= 0)
{
- RS_UndoCycle * i = undoList.at(undoPointer);
+ UndoCycle * i = undoList.at(undoPointer);
if (i != NULL)
{
-// for(RS_Undoable * u=i->undoables.first(); u!=NULL; u=i->undoables.next())
+// for(Undoable * u=i->undoables.first(); u!=NULL; u=i->undoables.next())
// u->changeUndoState();
for(int j=0; j<i->undoables.size(); j++)
i->undoables[j]->changeUndoState();
/**
* Redoes the undo cycle which was at last undone.
*/
-void RS_Undo::redo()
+void Undo::redo()
{
- RS_DEBUG->print("RS_Undo::redo");
+ DEBUG->print("Undo::redo");
if (undoPointer + 1 < (int)undoList.count())
{
undoPointer++;
- RS_UndoCycle * i = undoList.at(undoPointer);
+ UndoCycle * i = undoList.at(undoPointer);
if (i != NULL)
{
-// for(RS_Undoable * u=i->undoables.first(); u!=NULL; u=i->undoables.next())
+// for(Undoable * u=i->undoables.first(); u!=NULL; u=i->undoables.next())
// u->changeUndoState();
for(int j=0; j<i->undoables.size(); j++)
i->undoables[j]->changeUndoState();
* @return The undo item that is next if we're about to undo
* or NULL.
*/
-RS_UndoCycle * RS_Undo::getUndoCycle()
+UndoCycle * Undo::getUndoCycle()
{
- RS_UndoCycle * ret = NULL;
+ UndoCycle * ret = NULL;
- RS_DEBUG->print("RS_Undo::getUndoCycle");
+ DEBUG->print("Undo::getUndoCycle");
if (undoPointer >= 0 && undoPointer < (int)undoList.count())
ret = undoList.at(undoPointer);
- RS_DEBUG->print("RS_Undo::getUndoCycle: OK");
+ DEBUG->print("Undo::getUndoCycle: OK");
return ret;
}
* @return The redo item that is next if we're about to redo
* or NULL.
*/
-RS_UndoCycle * RS_Undo::getRedoCycle()
+UndoCycle * Undo::getRedoCycle()
{
- RS_DEBUG->print("RS_Undo::getRedoCycle");
+ DEBUG->print("Undo::getRedoCycle");
if (undoPointer + 1 >= 0 && undoPointer + 1 < (int)undoList.count())
return undoList.at(undoPointer + 1);
/**
* Dumps the undo list to stdout.
*/
-std::ostream & operator<<(std::ostream & os, RS_Undo & l)
+std::ostream & operator<<(std::ostream & os, Undo & l)
{
os << "Undo List: " << "\n";
os << " Pointer is at: " << l.undoPointer << "\n";
-// for(RS_UndoCycle * i=l.undoList.first(); i!=NULL; i=l.undoList.next())
+// for(UndoCycle * i=l.undoList.first(); i!=NULL; i=l.undoList.next())
for(int j=0; j<l.undoList.size(); j++)
{
- RS_UndoCycle * i = l.undoList[j];
+ UndoCycle * i = l.undoList[j];
// if (l.undoList.at() == l.undoPointer)
if (j == l.undoPointer)
/**
* Testing Undoables, Undo Cycles and the Undo container.
*/
-/*static*/ bool RS_Undo::test()
+/*static*/ bool Undo::test()
{
int i, k;
- RS_UndoStub undo;
- //RS_UndoCycle * c1;
- RS_Undoable * u1;
+ UndoStub undo;
+ //UndoCycle * c1;
+ Undoable * u1;
- std::cout << "Testing RS_Undo\n";
+ std::cout << "Testing Undo\n";
std::cout << " Adding 500 cycles..";
// Add 500 Undo Cycles with i Undoables in every Cycle
for(i=1; i<=500; ++i)
{
- //c1 = new RS_UndoCycle();
+ //c1 = new UndoCycle();
undo.startUndoCycle();
for(k=1; k<=i; ++k)
{
- u1 = new RS_Undoable();
+ u1 = new Undoable();
//c1->
undo.addUndoable(u1);
}
for(i=1; i<=10; ++i)
{
- //c1 = new RS_UndoCycle();
+ //c1 = new UndoCycle();
undo.startUndoCycle();
for(k=1; k<=10; ++k)
{
- u1 = new RS_Undoable();
+ u1 = new Undoable();
//c1->addUndoable(u1);
undo.addUndoable(u1);
}
for(i=1; i<=1; ++i)
{
- //c1 = new RS_UndoCycle();
+ //c1 = new UndoCycle();
undo.startUndoCycle();
for(k=1; k<=10; ++k)
{
- u1 = new RS_Undoable();
+ u1 = new Undoable();
//c1->addUndoable(u1);
undo.addUndoable(u1);
}
/**
* Undo / redo functionality. The internal undo list consists of
- * RS_UndoCycle entries.
+ * UndoCycle entries.
*
- * @see RS_UndoCycle
+ * @see UndoCycle
* @author Andrew Mustun
*/
-class RS_Undo
+class Undo
{
public:
- RS_Undo();
- virtual ~RS_Undo();
+ Undo();
+ virtual ~Undo();
- void addUndoCycle(RS_UndoCycle * i);
+ void addUndoCycle(UndoCycle * i);
virtual void undo();
virtual void redo();
- virtual RS_UndoCycle * getUndoCycle();
- virtual RS_UndoCycle * getRedoCycle();
+ virtual UndoCycle * getUndoCycle();
+ virtual UndoCycle * getRedoCycle();
virtual int countUndoCycles();
virtual int countRedoCycles();
virtual void startUndoCycle();
- virtual void addUndoable(RS_Undoable * u);
+ virtual void addUndoable(Undoable * u);
virtual void endUndoCycle();
/**
* the given Undoable (unrecoverable). This method is called
* for Undoables that are no longer in the undo buffer.
*/
- virtual void removeUndoable(RS_Undoable * u) = 0;
+ virtual void removeUndoable(Undoable * u) = 0;
- friend std::ostream & operator<<(std::ostream & os, RS_Undo & a);
+ friend std::ostream & operator<<(std::ostream & os, Undo & a);
#ifdef RS_TEST
static bool test(void);
protected:
//! List of undo list items. every item is something that can be undone.
-// Q3PtrList<RS_UndoCycle> undoList;
- QList<RS_UndoCycle *> undoList;
+// Q3PtrList<UndoCycle> undoList;
+ QList<UndoCycle *> undoList;
/**
* Index that points to the current position in the undo list.
/**
* Current undo cycle.
*/
- RS_UndoCycle * currentCycle;
+ UndoCycle * currentCycle;
};
#ifdef RS_TEST
/**
- * Stub for testing the RS_Undo class.
+ * Stub for testing the Undo class.
*/
-class RS_UndoStub : public RS_Undo
+class UndoStub : public Undo
{
- virtual void removeUndoable(RS_Undoable * u)
+ virtual void removeUndoable(Undoable * u)
{
delete u;
u = NULL;
/**
* Default constructor.
*/
-RS_Undoable::RS_Undoable()
+Undoable::Undoable()
{
cycle = NULL;
}
* Destructor. Makes sure that this undoable is removed from
* its undo cycle before it is deleted.
*/
-RS_Undoable::~RS_Undoable()
+Undoable::~Undoable()
{
if (cycle != NULL)
cycle->removeUndoable(this);
* Note that this is voluntarily. The default implementation
* returns RS2::UndoableUnknown.
*/
-/*virtual*/ RS2::UndoableType RS_Undoable::undoRtti()
+/*virtual*/ RS2::UndoableType Undoable::undoRtti()
{
return RS2::UndoableUnknown;
}
* make sure the entity can remove itself from the cycle before
* being deleted.
*/
-void RS_Undoable::setUndoCycle(RS_UndoCycle * cycle)
+void Undoable::setUndoCycle(UndoCycle * cycle)
{
this->cycle = cycle;
}
* The undoable thing gets activated if it was undone and
* deactivated otherwise.
*/
-void RS_Undoable::changeUndoState()
+void Undoable::changeUndoState()
{
toggleFlag(RS2::FlagUndone);
undoStateChanged(isUndone());
/**
* Undoes or redoes an undoable.
*/
-void RS_Undoable::setUndoState(bool undone)
+void Undoable::setUndoState(bool undone)
{
if (undone)
setFlag(RS2::FlagUndone);
/**
* Is this entity in the Undo memory and not active?
*/
-bool RS_Undoable::isUndone() const
+bool Undoable::isUndone() const
{
return getFlag(RS2::FlagUndone);
}
* Can be overwriten by the implementing class to be notified
* when the undo state changes (the undoable becomes visible / invisible).
*/
-/*virtual*/ void RS_Undoable::undoStateChanged(bool /*undone*/)
+/*virtual*/ void Undoable::undoStateChanged(bool /*undone*/)
{
}
#ifndef __UNDOABLE_H__
#define __UNDOABLE_H__
-#include "rs.h"
+#include "enums.h"
#include "flags.h"
-class RS_UndoCycle;
+class UndoCycle;
/**
* Base class for something that can be added and deleted and every
* addition and deletion can be undone.
*
- * @see RS_Undo
+ * @see Undo
* @author Andrew Mustun
*/
-class RS_Undoable: public RS_Flags
+class Undoable: public Flags
{
public:
- RS_Undoable();
- virtual ~RS_Undoable();
+ Undoable();
+ virtual ~Undoable();
virtual RS2::UndoableType undoRtti();
- virtual void setUndoCycle(RS_UndoCycle * cycle);
+ virtual void setUndoCycle(UndoCycle * cycle);
virtual void changeUndoState();
virtual void setUndoState(bool undone);
virtual bool isUndone() const;
virtual void undoStateChanged(bool /*undone*/);
- //friend std::ostream& operator << (std::ostream& os, RS_Undoable& a);
+ //friend std::ostream& operator << (std::ostream& os, Undoable& a);
private:
- RS_UndoCycle * cycle;
+ UndoCycle * cycle;
};
#endif
/**
* @param type Type of undo item.
*/
-RS_UndoCycle::RS_UndoCycle(/*RS2::UndoType type*/): undoableIterator(undoables)
+UndoCycle::UndoCycle(/*RS2::UndoType type*/): undoableIterator(undoables)
{
//this->type = type;
// Good, we don't have to worry about this...
* Adds an Undoable to this Undo Cycle. Every Cycle can contain one or
* more Undoables.
*/
-void RS_UndoCycle::addUndoable(RS_Undoable * u)
+void UndoCycle::addUndoable(Undoable * u)
{
undoables.append(u);
}
/**
* Removes an undoable from the list.
*/
-void RS_UndoCycle::removeUndoable(RS_Undoable * u)
+void UndoCycle::removeUndoable(Undoable * u)
{
// undoables.remove(u);
int i = undoables.indexOf(u);
/**
* Iteration through undoable elements in this item.
*/
-RS_Undoable * RS_UndoCycle::getFirstUndoable()
+Undoable * UndoCycle::getFirstUndoable()
{
// return undoables.first();
undoableIterator.toFront();
/**
* Iteration through undoable elements in this item.
*/
-RS_Undoable * RS_UndoCycle::getNextUndoable()
+Undoable * UndoCycle::getNextUndoable()
{
// return undoables.next();
return undoableIterator.next();
}
-/*friend*/ std::ostream & operator<<(std::ostream & os, RS_UndoCycle & i)
+/*friend*/ std::ostream & operator<<(std::ostream & os, UndoCycle & i)
{
os << " Undo item: " << "\n";
//os << " Type: ";
}*/
os << " Undoable ids: ";
- for(RS_Undoable * u=i.getFirstUndoable(); u!=NULL; u=i.getNextUndoable())
+ for(Undoable * u=i.getFirstUndoable(); u!=NULL; u=i.getNextUndoable())
{
if (u->undoRtti() == RS2::UndoableEntity)
{
- RS_Entity * e = (RS_Entity *)u;
+ Entity * e = (Entity *)u;
os << e->getId() << (u->isUndone() ? "*" : "") << " ";
}
else
#include <iostream>
#include <QtCore>
-class RS_Undoable;
+class Undoable;
/**
* An Undo Cycle represents an action that was triggered and can
* the action. Undoables are entities in a container that can be
* created and deleted.
*
- * Undo Cycles are stored within classes derrived from RS_Undo.
+ * Undo Cycles are stored within classes derrived from Undo.
*
- * @see RS_Undoable
- * @see RS_Undo
+ * @see Undoable
+ * @see Undo
*
* @author Andrew Mustun
*/
-class RS_UndoCycle
+class UndoCycle
{
- friend class RS_Undo;
+ friend class Undo;
public:
- RS_UndoCycle(/*RS2::UndoType type*/);
- void addUndoable(RS_Undoable * u);
- void removeUndoable(RS_Undoable * u);
- RS_Undoable * getFirstUndoable();
- RS_Undoable * getNextUndoable();
- friend std::ostream & operator<<(std::ostream & os, RS_UndoCycle & i);
+ UndoCycle(/*RS2::UndoType type*/);
+ void addUndoable(Undoable * u);
+ void removeUndoable(Undoable * u);
+ Undoable * getFirstUndoable();
+ Undoable * getNextUndoable();
+ friend std::ostream & operator<<(std::ostream & os, UndoCycle & i);
private:
//! Undo type:
//RS2::UndoType type;
//! List of entity id's that were affected by this action
-// Q3PtrList<RS_Undoable> undoables;
- QList<RS_Undoable *> undoables;
- QListIterator<RS_Undoable *> undoableIterator;
+// Q3PtrList<Undoable> undoables;
+ QList<Undoable *> undoables;
+ QListIterator<Undoable *> undoableIterator;
};
#endif
/**
* Converts a DXF integer () to a Unit enum.
*/
-RS2::Unit RS_Units::dxfint2unit(int dxfint)
+RS2::Unit Units::dxfint2unit(int dxfint)
{
return (RS2::Unit)dxfint;
/**
* @return a short string representing the given unit (e.g. "mm")
*/
-QString RS_Units::unitToSign(RS2::Unit u)
+QString Units::unitToSign(RS2::Unit u)
{
QString ret = "";
* @return a string representing the given unit (e.g. "Millimeter").
* translated if @a t is true (the default).
*/
-QString RS_Units::unitToString(RS2::Unit u, bool t)
+QString Units::unitToString(RS2::Unit u, bool t)
{
QString ret = "";
/**
* Converts a string into a unit enum.
*/
-RS2::Unit RS_Units::stringToUnit(const QString & u)
+RS2::Unit Units::stringToUnit(const QString & u)
{
RS2::Unit ret = RS2::None;
/**
* @return true: the unit is metric, false: the unit is imperial.
*/
-bool RS_Units::isMetric(RS2::Unit u)
+bool Units::isMetric(RS2::Unit u)
{
if (u == RS2::Millimeter || u == RS2::Centimeter || u == RS2::Meter
|| u == RS2::Kilometer || u == RS2::Angstrom || u == RS2::Nanometer
/**
* @return factor to convert the given unit to Millimeters.
*/
-double RS_Units::getFactorToMM(RS2::Unit u)
+double Units::getFactorToMM(RS2::Unit u)
{
double ret = 1.0;
/**
* Converts the given value 'val' from unit 'src' to unit 'dest'.
*/
-double RS_Units::convert(double val, RS2::Unit src, RS2::Unit dest)
+double Units::convert(double val, RS2::Unit src, RS2::Unit dest)
{
if (getFactorToMM(dest) > 0.0)
{
}
else
{
- RS_DEBUG->print(RS_Debug::D_WARNING, "RS_Units::convert: invalid factor");
+ DEBUG->print(Debug::D_WARNING, "Units::convert: invalid factor");
return val;
}
}
/**
* Converts the given vector 'val' from unit 'src' to unit 'dest'.
*/
-Vector RS_Units::convert(const Vector val, RS2::Unit src, RS2::Unit dest)
+Vector Units::convert(const Vector val, RS2::Unit src, RS2::Unit dest)
{
return Vector(convert(val.x, src, dest), convert(val.y, src, dest), convert(val.z, src, dest));
}
* @param prec Precisision of the value (e.g. 0.001 or 1/128 = 0.0078125)
& @param showUnit Append unit to the value.
*/
-QString RS_Units::formatLinear(double length, RS2::Unit unit, RS2::LinearFormat format,
+QString Units::formatLinear(double length, RS2::Unit unit, RS2::LinearFormat format,
int prec, bool showUnit)
{
QString ret;
break;
default:
- RS_DEBUG->print(RS_Debug::D_WARNING,
- "RS_Units::formatLinear: Unknown format");
+ DEBUG->print(Debug::D_WARNING,
+ "Units::formatLinear: Unknown format");
ret = "";
break;
}
* @param prec Precisision of the value (e.g. 0.001 or 1/128 = 0.0078125)
& @param showUnit Append unit to the value.
*/
-QString RS_Units::formatScientific(double length, RS2::Unit unit, int prec, bool showUnit)
+QString Units::formatScientific(double length, RS2::Unit unit, int prec, bool showUnit)
{
QString ret;
* @param prec Precisision of the value (e.g. 0.001)
& @param showUnit Append unit to the value.
*/
-QString RS_Units::formatDecimal(double length, RS2::Unit unit, int prec, bool showUnit)
+QString Units::formatDecimal(double length, RS2::Unit unit, int prec, bool showUnit)
{
QString ret;
if (showUnit)
unitString = unitToSign(unit);
- ret = RS_Math::doubleToString(length, prec);
+ ret = Math::doubleToString(length, prec);
if (showUnit)
ret += unitString;
* @param prec Precisision of the value (e.g. 0.001 or 1/128 = 0.0078125)
& @param showUnit Append unit to the value.
*/
-QString RS_Units::formatEngineering(double length, RS2::Unit /*unit*/, int prec, bool /*showUnit*/)
+QString Units::formatEngineering(double length, RS2::Unit /*unit*/, int prec, bool /*showUnit*/)
{
QString ret;
int feet = (int)floor(fabs(length) / 12);
double inches = fabs(length) - feet * 12;
- QString sInches = RS_Math::doubleToString(inches, prec);
+ QString sInches = Math::doubleToString(inches, prec);
if (sInches == "12")
{
* @param prec Precisision of the value (e.g. 0.001 or 1/128 = 0.0078125)
& @param showUnit Append unit to the value.
*/
-QString RS_Units::formatArchitectural(double length, RS2::Unit /*unit*/, int prec, bool showUnit)
+QString Units::formatArchitectural(double length, RS2::Unit /*unit*/, int prec, bool showUnit)
{
QString ret;
bool neg = (length < 0.0);
* @param prec Precisision of the value (e.g. 0.001 or 1/128 = 0.0078125)
& @param showUnit Append unit to the value.
*/
-QString RS_Units::formatFractional(double length, RS2::Unit /*unit*/, int prec, bool /*showUnit*/)
+QString Units::formatFractional(double length, RS2::Unit /*unit*/, int prec, bool /*showUnit*/)
{
QString ret;
num = (int)floor(length);
- denominator = (int)RS_Math::pow(2, prec);
- nominator = RS_Math::round((length - num) * denominator);
+ denominator = (int)Math::pow(2, prec);
+ nominator = Math::round((length - num) * denominator);
// fraction rounds up to 1:
if (nominator == denominator)
// Simplify the fraction
if (nominator != 0 && denominator != 0)
{
- int gcd = RS_Math::findGCD(nominator, denominator);
+ int gcd = Math::findGCD(nominator, denominator);
if (gcd != 0)
{
}
else
{
- RS_DEBUG->print(RS_Debug::D_WARNING, "RS_Units::formatFractional: invalid gcd");
+ DEBUG->print(Debug::D_WARNING, "Units::formatFractional: invalid gcd");
nominator = 0;
denominator = 0;
}
*
* @ret String with the formatted angle.
*/
-QString RS_Units::formatAngle(double angle, RS2::AngleFormat format, int prec)
+QString Units::formatAngle(double angle, RS2::AngleFormat format, int prec)
{
QString ret;
double value;
{
case RS2::DegreesDecimal:
case RS2::DegreesMinutesSeconds:
- value = RS_Math::rad2deg(angle);
+ value = Math::rad2deg(angle);
break;
case RS2::Radians:
value = angle;
break;
case RS2::Gradians:
- value = RS_Math::rad2gra(angle);
+ value = Math::rad2gra(angle);
break;
default:
- RS_DEBUG->print(RS_Debug::D_WARNING, "RS_Units::formatAngle: Unknown Angle Unit");
+ DEBUG->print(Debug::D_WARNING, "Units::formatAngle: Unknown Angle Unit");
return "";
break;
}
case RS2::DegreesDecimal:
case RS2::Radians:
case RS2::Gradians:
- ret = RS_Math::doubleToString(value, prec);
+ ret = Math::doubleToString(value, prec);
if (format == RS2::DegreesDecimal)
ret += QChar(0xB0);
vMinutes = (int)floor((value - vDegrees) * 60.0);
vSeconds = (value - vDegrees - (vMinutes / 60.0)) * 3600.0;
- seconds = RS_Math::doubleToString(vSeconds, (prec > 1 ? prec - 2 : 0));
+ seconds = Math::doubleToString(vSeconds, (prec > 1 ? prec - 2 : 0));
if (seconds == "60")
{
/**
* @return Size of the given paper format.
*/
-Vector RS_Units::paperFormatToSize(RS2::PaperFormat p)
+Vector Units::paperFormatToSize(RS2::PaperFormat p)
{
Vector ret(false);
* Gets the paper format which matches the given size. If no
* format matches, RS2::Custom is returned.
*/
-RS2::PaperFormat RS_Units::paperSizeToFormat(const Vector s)
+RS2::PaperFormat Units::paperSizeToFormat(const Vector s)
{
Vector ts1;
Vector ts2;
for(int i=(int)RS2::Custom; i<=(int)RS2::NPageSize; ++i)
{
- ts1 = RS_Units::paperFormatToSize((RS2::PaperFormat)i);
+ ts1 = Units::paperFormatToSize((RS2::PaperFormat)i);
ts2 = Vector(ts1.y, ts1.x);
if (ts1.distanceTo(s) < 1.0e-4 || ts2.distanceTo(s) < 1.0e-4)
/**
* Converts a paper format to a string (e.g. for a combobox).
*/
-QString RS_Units::paperFormatToString(RS2::PaperFormat p)
+QString Units::paperFormatToString(RS2::PaperFormat p)
{
QString ret = "";
/**
* Converts a string to a paper format.
*/
-RS2::PaperFormat RS_Units::stringToPaperFormat(const QString & p)
+RS2::PaperFormat Units::stringToPaperFormat(const QString & p)
{
QString ls = p.toLower();
RS2::PaperFormat ret = RS2::Custom;
/**
* Performs some testing for the math class.
*/
-void RS_Units::test()
+void Units::test()
{
QString s;
double v;
/*
- std::cout << "RS_Units::test: formatLinear (decimal):\n";
+ std::cout << "Units::test: formatLinear (decimal):\n";
v = 0.1;
- s = RS_Units::formatLinear(v, RS2::Millimeter, RS2::Decimal,
+ s = Units::formatLinear(v, RS2::Millimeter, RS2::Decimal,
3, false);
std::cout << "s: " << s << "\n";
assert(s=="0.1");
v = 0.01;
- s = RS_Units::formatLinear(v, RS2::Millimeter, RS2::Decimal,
+ s = Units::formatLinear(v, RS2::Millimeter, RS2::Decimal,
3, false);
std::cout << "s: " << s << "\n";
assert(s=="0.01");
v = 0.001;
- s = RS_Units::formatLinear(v, RS2::Millimeter, RS2::Decimal,
+ s = Units::formatLinear(v, RS2::Millimeter, RS2::Decimal,
3, false);
std::cout << "s: " << s << "\n";
assert(s=="0.001");
v = 0.009;
- s = RS_Units::formatLinear(v, RS2::Millimeter, RS2::Decimal,
+ s = Units::formatLinear(v, RS2::Millimeter, RS2::Decimal,
2, false);
std::cout << "s: " << s << "\n";
assert(s=="0.01");
v = 0.005;
- s = RS_Units::formatLinear(v, RS2::Millimeter, RS2::Decimal,
+ s = Units::formatLinear(v, RS2::Millimeter, RS2::Decimal,
2, false);
std::cout << "s: " << s << "\n";
assert(s=="0.01");
v = 0.0049999;
- s = RS_Units::formatLinear(v, RS2::Millimeter, RS2::Decimal,
+ s = Units::formatLinear(v, RS2::Millimeter, RS2::Decimal,
2, false);
std::cout << "s: " << s << "\n";
assert(s=="0");
v = 0.1;
- s = RS_Units::formatLinear(v, RS2::Millimeter, RS2::Decimal,
+ s = Units::formatLinear(v, RS2::Millimeter, RS2::Decimal,
4, true);
std::cout << "s: " << s << "\n";
assert(s=="0.1mm");
- std::cout << "RS_Units::test: formatLinear (fractional):\n";
+ std::cout << "Units::test: formatLinear (fractional):\n";
v = 1.2;
- s = RS_Units::formatLinear(v, RS2::Inch, RS2::Fractional,
+ s = Units::formatLinear(v, RS2::Inch, RS2::Fractional,
6, false);
std::cout << "s: " << s << "\n";
assert(s=="1 13/64");
v = 1.2;
- s = RS_Units::formatLinear(v, RS2::Inch, RS2::Fractional,
+ s = Units::formatLinear(v, RS2::Inch, RS2::Fractional,
8, false);
std::cout << "s: " << s << "\n";
assert(s=="1 51/256");
v = 0.2;
- s = RS_Units::formatLinear(v, RS2::Inch, RS2::Fractional,
+ s = Units::formatLinear(v, RS2::Inch, RS2::Fractional,
8, false);
std::cout << "s: " << s << "\n";
assert(s=="51/256");
v = 4.5;
- s = RS_Units::formatLinear(v, RS2::Inch, RS2::Fractional,
+ s = Units::formatLinear(v, RS2::Inch, RS2::Fractional,
6, true);
std::cout << "s: " << s << "\n";
assert(s=="4 1/2");
v = 0.001;
- s = RS_Units::formatLinear(v, RS2::Inch, RS2::Fractional,
+ s = Units::formatLinear(v, RS2::Inch, RS2::Fractional,
0, false);
std::cout << "s: " << s << "\n";
assert(s=="0");
v = 0.01;
- s = RS_Units::formatLinear(v, RS2::Inch, RS2::Fractional,
+ s = Units::formatLinear(v, RS2::Inch, RS2::Fractional,
8, false);
std::cout << "s: " << s << "\n";
assert(s=="3/256");
v = 0.0078125;
- s = RS_Units::formatLinear(v, RS2::Inch, RS2::Fractional,
+ s = Units::formatLinear(v, RS2::Inch, RS2::Fractional,
8, false);
std::cout << "s: " << s << "\n";
assert(s=="1/128");
v = 0.001;
- s = RS_Units::formatLinear(v, RS2::Inch, RS2::Fractional,
+ s = Units::formatLinear(v, RS2::Inch, RS2::Fractional,
8, false);
std::cout << "s: " << s << "\n";
assert(s=="0");
v = 9.9999;
- s = RS_Units::formatLinear(v, RS2::Inch, RS2::Fractional,
+ s = Units::formatLinear(v, RS2::Inch, RS2::Fractional,
6, false);
std::cout << "s: " << s << "\n";
assert(s=="10");
{
for(int prec=0; prec<=6; ++prec)
{
- s = RS_Units::formatLinear(v, RS2::Inch, RS2::Architectural, prec, true);
+ s = Units::formatLinear(v, RS2::Inch, RS2::Architectural, prec, true);
std::cout << "prec: " << prec << " v: " << v << " s: " << s.toAscii().data() << "\n";
}
}
/*for (v=0.0; v<10.0; v+=0.001) {
- s = RS_Units::formatLinear(v, RS2::Foot, RS2::Fractional,
+ s = Units::formatLinear(v, RS2::Foot, RS2::Fractional,
1.0/128.0, true);
std::cout << "v: " << v << " s: " << s << "\n";
}*/
/*
- std::cout << "RS_Units::test: formatLinear (scientific):\n";
+ std::cout << "Units::test: formatLinear (scientific):\n";
v = 0.001;
- s = RS_Units::formatLinear(v, RS2::Millimeter, RS2::Scientific,
+ s = Units::formatLinear(v, RS2::Millimeter, RS2::Scientific,
0.0001, false);
std::cout << "s: " << s << "\n";
assert(s=="1.0e-3");
/*
- std::cout << "RS_Units::test: formatAngle (deg / decimal):\n";
+ std::cout << "Units::test: formatAngle (deg / decimal):\n";
v = 0.0261799;
- s = RS_Units::formatAngle(v, RS2::DegreesDecimal, 2);
+ s = Units::formatAngle(v, RS2::DegreesDecimal, 2);
std::cout << "s: " << s << "\n";
assert(s=="1.5�");
v = 0;
- s = RS_Units::formatAngle(v, RS2::DegreesDecimal, 2);
+ s = Units::formatAngle(v, RS2::DegreesDecimal, 2);
std::cout << "s: " << s << "\n";
assert(s=="0�");
v = 1.5707963;
- s = RS_Units::formatAngle(v, RS2::DegreesDecimal, 2);
+ s = Units::formatAngle(v, RS2::DegreesDecimal, 2);
std::cout << "s: " << s << "\n";
assert(s=="90�");
- std::cout << "RS_Units::test: formatAngle (deg / d/m/s):\n";
+ std::cout << "Units::test: formatAngle (deg / d/m/s):\n";
v = 0.0260926;
- s = RS_Units::formatAngle(v, RS2::DegreesMinutesSeconds, 1);
+ s = Units::formatAngle(v, RS2::DegreesMinutesSeconds, 1);
std::cout << "s: " << s << "\n";
assert(s=="1� 29' 42\"");
v = 0.0261799;
- s = RS_Units::formatAngle(v, RS2::DegreesMinutesSeconds, 1);
+ s = Units::formatAngle(v, RS2::DegreesMinutesSeconds, 1);
std::cout << "s: " << s << "\n";
assert(s=="1� 30' 0\"");
*/
#define __UNITS_H__
#include <QtCore>
-#include "rs.h"
+#include "enums.h"
#include "vector.h"
/**
*
* @author Andrew Mustun
*/
-class RS_Units
+class Units
{
public:
//static char* unit2sign(RS2::Unit unit);
* Converts a double to a string cutting away unnecessary 0's.
* e.g. 2.70000 -> 2.7
*/
-QString RS_Utility::doubleToString(double value, int precision/*= 6*/)
+QString Utility::doubleToString(double value, int precision/*= 6*/)
{
QString ret;
*
* @author Andrew Mustun
*/
-class RS_Utility
+class Utility
{
public:
static QString doubleToString(double value, int precision = 6);
// We probably could replace all this crap with QVariant...
#include "variable.h"
-RS_Variable::RS_Variable()
+Variable::Variable()
{
type = RS2::VariableVoid;
code = 0;
}
-RS_Variable::RS_Variable(const Vector & v, int c)
+Variable::Variable(const Vector & v, int c)
{
setVector(v);
code = c;
}
-RS_Variable::RS_Variable(const QString & v, int c)
+Variable::Variable(const QString & v, int c)
{
setString(v);
code = c;
}
-RS_Variable::RS_Variable(int v, int c)
+Variable::Variable(int v, int c)
{
setInt(v);
code = c;
}
-RS_Variable::RS_Variable(double v, int c)
+Variable::Variable(double v, int c)
{
setDouble(v);
code = c;
}
-/*virtual*/ RS_Variable::~RS_Variable()
+/*virtual*/ Variable::~Variable()
{
}
-void RS_Variable::setString(const QString & str)
+void Variable::setString(const QString & str)
{
contents.s = str;
type = RS2::VariableString;
}
-void RS_Variable::setInt(int i)
+void Variable::setInt(int i)
{
contents.i = i;
type = RS2::VariableInt;
}
-void RS_Variable::setDouble(double d)
+void Variable::setDouble(double d)
{
contents.d = d;
type = RS2::VariableDouble;
}
-void RS_Variable::setVector(const Vector & v)
+void Variable::setVector(const Vector & v)
{
contents.v = v;
type = RS2::VariableVector;
}
-QString RS_Variable::getString()
+QString Variable::getString()
{
return contents.s;
}
-int RS_Variable::getInt()
+int Variable::getInt()
{
return contents.i;
}
-double RS_Variable::getDouble()
+double Variable::getDouble()
{
return contents.d;
}
-Vector RS_Variable::getVector()
+Vector Variable::getVector()
{
return contents.v;
}
-RS2::VariableType RS_Variable::getType()
+RS2::VariableType Variable::getType()
{
return type;
}
-int RS_Variable::getCode()
+int Variable::getCode()
{
return code;
}
#define __VARIABLE_H__
#include <QtCore>
-#include "rs.h"
+#include "enums.h"
#include "vector.h"
#include "debug.h"
*
* @author Andrew Mustun
*/
-class RS_Variable
+class Variable
{
public:
typedef struct {
int i;
double d;
Vector v;
- } RS_VariableContents;
+ } VariableContents;
- RS_Variable();
- RS_Variable(const Vector & v, int c);
- RS_Variable(const QString & v, int c);
- RS_Variable(int v, int c);
- RS_Variable(double v, int c);
- virtual ~RS_Variable();
+ Variable();
+ Variable(const Vector & v, int c);
+ Variable(const QString & v, int c);
+ Variable(int v, int c);
+ Variable(double v, int c);
+ virtual ~Variable();
void setString(const QString & str);
void setInt(int i);
RS2::VariableType getType();
int getCode();
- //friend std::ostream& operator << (std::ostream& os, RS_Variable& v);
+ //friend std::ostream& operator << (std::ostream& os, Variable& v);
private:
- RS_VariableContents contents;
+ VariableContents contents;
RS2::VariableType type;
int code;
};
/**
* Constructor.
*/
-RS_VariableDict::RS_VariableDict()
+VariableDict::VariableDict()
{
#warning "!!! Need to deal with setAutoDelete() Qt3->Qt4 !!!"
// variables.setAutoDelete(true);
}
-/*virtual*/ RS_VariableDict::~RS_VariableDict()
+/*virtual*/ VariableDict::~VariableDict()
{
}
/**
* Removes all variables in the blocklist.
*/
-void RS_VariableDict::clear()
+void VariableDict::clear()
{
variables.clear();
}
/**
* @return Number of variables available.
*/
-int RS_VariableDict::count()
+int VariableDict::count()
{
return variables.count();
}
* Activates the given block.
* Listeners are notified.
*/
-//void RS_VariableDict::activateBlock(const QString& name) {
+//void VariableDict::activateBlock(const QString& name) {
// activateBlock(findBlock(name));
//}
* Activates the given block.
* Listeners are notified.
*/
-/*void RS_VariableDict::activateBlock(RS_Block* block) {
+/*void VariableDict::activateBlock(Block* block) {
activeBlock = block;
for (uint i=0; i<blockListListeners.count(); ++i) {
- RS_VariableDictListener* l = blockListListeners.at(i);
+ VariableDictListener* l = blockListListeners.at(i);
l->blockActivated(activeBlock);
}
* Adds a variable to the variable dictionary. If a variable with the
* same name already exists, is will be overwritten.
*/
-void RS_VariableDict::add(const QString & key, const QString & value, int code)
+void VariableDict::add(const QString & key, const QString & value, int code)
{
- RS_DEBUG->print("RS_VariableDict::addVariable()");
+ DEBUG->print("VariableDict::addVariable()");
if (key.isEmpty())
{
- RS_DEBUG->print("RS_VariableDict::addVariable(): No empty keys allowed.", RS_Debug::D_WARNING);
+ DEBUG->print("VariableDict::addVariable(): No empty keys allowed.", Debug::D_WARNING);
return;
}
- variables.replace(key, new RS_Variable(value, code));
+ variables.replace(key, new Variable(value, code));
}
/**
* Adds a variable to the variable dictionary. If a variable with the
* same name already exists, is will be overwritten.
*/
-void RS_VariableDict::add(const QString & key, int value, int code)
+void VariableDict::add(const QString & key, int value, int code)
{
- RS_DEBUG->print("RS_VariableDict::addVariable()");
+ DEBUG->print("VariableDict::addVariable()");
if (key.isEmpty())
{
- RS_DEBUG->print("RS_VariableDict::addVariable(): No empty keys allowed.", RS_Debug::D_WARNING);
+ DEBUG->print("VariableDict::addVariable(): No empty keys allowed.", Debug::D_WARNING);
return;
}
- variables.replace(key, new RS_Variable(value, code));
+ variables.replace(key, new Variable(value, code));
}
/**
* Adds a variable to the variable dictionary. If a variable with the
* same name already exists, is will be overwritten.
*/
-void RS_VariableDict::add(const QString & key, double value, int code)
+void VariableDict::add(const QString & key, double value, int code)
{
- RS_DEBUG->print("RS_VariableDict::addVariable()");
+ DEBUG->print("VariableDict::addVariable()");
if (key.isEmpty())
{
- RS_DEBUG->print("RS_VariableDict::addVariable(): No empty keys allowed.", RS_Debug::D_WARNING);
+ DEBUG->print("VariableDict::addVariable(): No empty keys allowed.", Debug::D_WARNING);
return;
}
- variables.replace(key, new RS_Variable(value, code));
+ variables.replace(key, new Variable(value, code));
}
/**
* Adds a variable to the variable dictionary. If a variable with the
* same name already exists, is will be overwritten.
*/
-void RS_VariableDict::add(const QString & key, const Vector & value, int code)
+void VariableDict::add(const QString & key, const Vector & value, int code)
{
- RS_DEBUG->print("RS_VariableDict::addVariable()");
+ DEBUG->print("VariableDict::addVariable()");
if (key.isEmpty())
{
- RS_DEBUG->print("RS_VariableDict::addVariable(): No empty keys allowed.", RS_Debug::D_WARNING);
+ DEBUG->print("VariableDict::addVariable(): No empty keys allowed.", Debug::D_WARNING);
return;
}
- variables.replace(key, new RS_Variable(value, code));
+ variables.replace(key, new Variable(value, code));
}
/**
* @return The value for the given variable or the given default value
* if the variable couldn't be found.
*/
-Vector RS_VariableDict::getVector(const QString & key, const Vector & def)
+Vector VariableDict::getVector(const QString & key, const Vector & def)
{
Vector ret;
-// RS_Variable * ptr = variables.find(key);
- RS_Variable * ptr = variables.value(key);
+// Variable * ptr = variables.find(key);
+ Variable * ptr = variables.value(key);
if (ptr == NULL || ptr->getType() != RS2::VariableVector)
ret = def;
* @return The value for the given variable or the given default value
* if the variable couldn't be found.
*/
-QString RS_VariableDict::getString(const QString & key, const QString & def)
+QString VariableDict::getString(const QString & key, const QString & def)
{
QString ret;
- RS_DEBUG->print("RS_VariableDict::getString: 001");
- RS_DEBUG->print("RS_VariableDict::getString: key: '%s'", key.toLatin1().data());
+ DEBUG->print("VariableDict::getString: 001");
+ DEBUG->print("VariableDict::getString: key: '%s'", key.toLatin1().data());
-// RS_Variable * ptr = variables.find(key);
- RS_Variable * ptr = variables.value(key);
- RS_DEBUG->print("RS_VariableDict::getString: 002");
+// Variable * ptr = variables.find(key);
+ Variable * ptr = variables.value(key);
+ DEBUG->print("VariableDict::getString: 002");
if (ptr == NULL)
{
- RS_DEBUG->print("RS_VariableDict::getString: 003");
+ DEBUG->print("VariableDict::getString: 003");
ret = def;
}
else if (ptr->getType() != RS2::VariableString)
{
- RS_DEBUG->print("RS_VariableDict::getString: 004");
+ DEBUG->print("VariableDict::getString: 004");
ret = def;
}
else
{
- RS_DEBUG->print("RS_VariableDict::getString: 005");
+ DEBUG->print("VariableDict::getString: 005");
ret = ptr->getString();
}
- RS_DEBUG->print("RS_VariableDict::getString: 006");
+ DEBUG->print("VariableDict::getString: 006");
return ret;
}
* @return The value for the given variable or the given default value
* if the variable couldn't be found.
*/
-int RS_VariableDict::getInt(const QString & key, int def)
+int VariableDict::getInt(const QString & key, int def)
{
int ret;
-// RS_Variable * ptr = variables.find(key);
- RS_Variable * ptr = variables.value(key);
+// Variable * ptr = variables.find(key);
+ Variable * ptr = variables.value(key);
if (ptr == NULL || ptr->getType() != RS2::VariableInt)
ret = def;
* @return The value for the given variable or the given default value
* if the variable couldn't be found.
*/
-double RS_VariableDict::getDouble(const QString & key, double def)
+double VariableDict::getDouble(const QString & key, double def)
{
double ret;
-// RS_Variable * ptr = variables.find(key);
- RS_Variable * ptr = variables.value(key);
+// Variable * ptr = variables.find(key);
+ Variable * ptr = variables.value(key);
if (ptr == NULL || ptr->getType() != RS2::VariableDouble)
ret = def;
* used after adding a lot of variables without auto-update.
*/
/*
-void RS_VariableDict::addBlockNotification() {
+void VariableDict::addBlockNotification() {
for (uint i=0; i<blockListListeners.count(); ++i) {
- RS_VariableDictListener* l = blockListListeners.at(i);
+ VariableDictListener* l = blockListListeners.at(i);
l->blockAdded(NULL);
}
}
* TODO: Listeners are notified after the block was removed from
* the list but before it gets deleted.
*/
-void RS_VariableDict::remove(const QString & key)
+void VariableDict::remove(const QString & key)
{
- RS_DEBUG->print("RS_VariableDict::removeVariable()");
+ DEBUG->print("VariableDict::removeVariable()");
// here the block is removed from the list but not deleted
variables.remove(key);
}
-//Q3Dict<RS_Variable> & RS_VariableDict::getVariableDict()
-QMultiHash<QString, RS_Variable *> & RS_VariableDict::getVariableDict()
+//Q3Dict<Variable> & VariableDict::getVariableDict()
+QMultiHash<QString, Variable *> & VariableDict::getVariableDict()
{
return variables;
}
/**
* Dumps the variables to stdout.
*/
-std::ostream & operator<<(std::ostream & os, RS_VariableDict & d)
+std::ostream & operator<<(std::ostream & os, VariableDict & d)
{
os << "Variables: \n";
-// Q3DictIterator<RS_Variable> it(d.variables);
- QHashIterator<QString, RS_Variable *> it(d.variables);
+// Q3DictIterator<Variable> it(d.variables);
+ QHashIterator<QString, Variable *> it(d.variables);
while (it.hasNext())
{
*
* @author Andrew Mustun
*/
-class RS_VariableDict
+class VariableDict
{
public:
- RS_VariableDict();
- virtual ~RS_VariableDict();
+ VariableDict();
+ virtual ~VariableDict();
void clear();
int count();
double getDouble(const QString & key, double def);
virtual void remove(const QString & key);
-// Q3Dict<RS_Variable> & getVariableDict();
- QMultiHash<QString, RS_Variable *> & getVariableDict();
+// Q3Dict<Variable> & getVariableDict();
+ QMultiHash<QString, Variable *> & getVariableDict();
- //void addVariableDictListener(RS_VariableDictListener* listener);
+ //void addVariableDictListener(VariableDictListener* listener);
- friend std::ostream & operator<<(std::ostream & os, RS_VariableDict & v);
+ friend std::ostream & operator<<(std::ostream & os, VariableDict & v);
private:
//! Variables for the graphic
-// Q3Dict<RS_Variable> variables;
- QMultiHash<QString, RS_Variable *> variables;
+// Q3Dict<Variable> variables;
+ QMultiHash<QString, Variable *> variables;
};
#endif
#include "vector.h"
-#include "rs.h" // For RS_MIN/MAXDOUBLE (!)
+#include "enums.h" // For RS_MIN/MAXDOUBLE (!)
#include "debug.h"
#include "mathextra.h"
*/
Vector::Vector()
{
- //RS_DEBUG->print("Vector::Vector");
+ //DEBUG->print("Vector::Vector");
set(0.0, 0.0, 0.0);
}
*/
Vector::Vector(double vx, double vy, double vz)
{
- //RS_DEBUG->print("Vector::Vector");
+ //DEBUG->print("Vector::Vector");
set(vx, vy, vz);
}
*/
Vector::Vector(bool valid)
{
- //RS_DEBUG->print("Vector::Vector");
+ //DEBUG->print("Vector::Vector");
set(0.0, 0.0, 0.0);
this->valid = valid;
}
*/
Vector::~Vector()
{
- //RS_DEBUG->print("Vector::~Vector");
+ //DEBUG->print("Vector::~Vector");
}
/**
if (m > 1.0e-6)
{
double dp = dotP(*this, Vector(1.0, 0.0));
- RS_DEBUG->print("Vector::angle: dp/m: %f/%f", dp, m);
+ DEBUG->print("Vector::angle: dp/m: %f/%f", dp, m);
if (dp / m >= 1.0)
ret = 0.0;
}
else
{
- ret = sqrt(RS_Math::pow(x, 2) + RS_Math::pow(y, 2) + RS_Math::pow(z, 2));
+ ret = sqrt(Math::pow(x, 2) + Math::pow(y, 2) + Math::pow(z, 2));
}
return ret;
*/
Vector Vector::rotate(double ang)
{
- RS_DEBUG->print("Vector::rotate: angle: %f", ang);
+ DEBUG->print("Vector::rotate: angle: %f", ang);
double r = magnitude();
- RS_DEBUG->print("Vector::rotate: r: %f", r);
+ DEBUG->print("Vector::rotate: r: %f", r);
double a = angle() + ang;
- RS_DEBUG->print("Vector::rotate: a: %f", a);
+ DEBUG->print("Vector::rotate: a: %f", a);
x = cos(a) * r;
y = sin(a) * r;
- RS_DEBUG->print("Vector::rotate: x/y: %f/%f", x, y);
+ DEBUG->print("Vector::rotate: x/y: %f/%f", x, y);
return *this;
}
Vector Vector::mirror(Vector axisPoint1, Vector axisPoint2)
{
/*
- RS_ConstructionLine axis(NULL,
- RS_ConstructionLineData(axisPoint1, axisPoint2));
+ ConstructionLine axis(NULL,
+ ConstructionLineData(axisPoint1, axisPoint2));
Vector xp = axis.getNearestPointOnEntity(*this);
xp = xp - (*this);
#include "vectorsolutions.h"
-#include "rs.h" // For RS_MIN/MAXDOUBLE (!)
+#include "enums.h" // For RS_MIN/MAXDOUBLE (!)
#include "mathextra.h"
/**
}
else
{
- RS_DEBUG->print(RS_Debug::D_ERROR, "QG_ArcOptions::setAction: wrong action type");
+ DEBUG->print(Debug::D_ERROR, "QG_ArcOptions::setAction: wrong action type");
action = NULL;
}
}
}
else
{
- RS_DEBUG->print(RS_Debug::D_ERROR,
+ DEBUG->print(Debug::D_ERROR,
"ArcTangentialOptions::setAction: wrong action type");
action = NULL;
}
rbNeg->setChecked(reversed);
}*/
-/*void ArcTangentialOptions::setData(RS_ArcData* d) {
+/*void ArcTangentialOptions::setData(ArcData* d) {
data = d;
updateDirection(false);
}*/
void ArcTangentialOptions::updateRadius(const QString & s)
{
if (action != NULL)
- action->setRadius(RS_Math::eval(s));
+ action->setRadius(Math::eval(s));
}
#include "beveloptions.h"
-#include "rs.h"
+#include "enums.h"
#include "actioninterface.h"
#include "actionmodifybevel.h"
#include "debug.h"
}
else
{
- RS_DEBUG->print(RS_Debug::D_ERROR, "BevelOptions::setAction: wrong action type");
+ DEBUG->print(Debug::D_ERROR, "BevelOptions::setAction: wrong action type");
action = NULL;
}
}
if (action != NULL)
{
action->setTrim(cbTrim->isChecked());
- action->setLength1(RS_Math::eval(leLength1->text()));
- action->setLength2(RS_Math::eval(leLength2->text()));
+ action->setLength1(Math::eval(leLength1->text()));
+ action->setLength2(Math::eval(leLength2->text()));
}
}
{
}
-void BlockDialog::setBlockList(RS_BlockList * l)
+void BlockDialog::setBlockList(BlockList * l)
{
- RS_DEBUG->print("BlockDialog::setBlockList");
+ DEBUG->print("BlockDialog::setBlockList");
blockList = l;
if (blockList != NULL)
{
- RS_Block * block = blockList->getActive();
+ Block * block = blockList->getActive();
if (block != NULL)
ui.leName->setText(block->getName());
else
- RS_DEBUG->print(RS_Debug::D_ERROR, "BlockDialog::setBlockList: No block active.");
+ DEBUG->print(Debug::D_ERROR, "BlockDialog::setBlockList: No block active.");
}
}
-RS_BlockData BlockDialog::getBlockData()
+BlockData BlockDialog::getBlockData()
{
/*if (blockList!=NULL) {
- RS_Block* block = blockList->getActive();
+ Block* block = blockList->getActive();
if (block!=NULL) {
return blockList->rename(block, leName->text().latin1());
}
return false;*/
- return RS_BlockData(ui.leName->text(), Vector(0.0, 0.0), false);
+ return BlockData(ui.leName->text(), Vector(0.0, 0.0), false);
}
void BlockDialog::validate()
#include "ui_blockdialog.h"
#include "block.h"
-class RS_BlockList;
+class BlockList;
class BlockDialog : public QDialog
{
BlockDialog(QWidget * parent = 0, Qt::WindowFlags flags = 0);
~BlockDialog();
- RS_BlockData getBlockData();
+ BlockData getBlockData();
public slots:
- void setBlockList(RS_BlockList * l);
+ void setBlockList(BlockList * l);
void validate();
void cancel();
protected:
- RS_BlockList * blockList;
+ BlockList * blockList;
private:
Ui::BlockDialog ui;
#include "cadtoolbarselect.h"
#include "cadtoolbarsnap.h"
#include "cadtoolbarsplines.h"
-#include "rs.h"
+#include "enums.h"
CadToolBar::CadToolBar(QWidget * parent/*= 0*/, Qt::WindowFlags flags/*= 0*/):
QWidget(parent, flags), actionHandler(NULL), currentTb(NULL), tbSplines(NULL),
#include "circleoptions.h"
-#include "rs.h"
+#include "enums.h"
#include "actioninterface.h"
#include "actiondrawcirclecr.h"
#include "debug.h"
}
else
{
- RS_DEBUG->print(RS_Debug::D_ERROR,
+ DEBUG->print(Debug::D_ERROR,
"CircleOptions::setAction: wrong action type");
action = NULL;
}
void CircleOptions::updateRadius(const QString & r)
{
if (action != NULL)
- action->setRadius(RS_Math::eval(r));
+ action->setRadius(Math::eval(r));
}
choice = actionHandler->getAvailableCommands();
if (choice.count() == 0)
- choice = RS_COMMANDS->complete(typed);
+ choice = COMMANDS->complete(typed);
for(QStringList::Iterator it=choice.begin(); it!=choice.end(); ++it)
{
#include "units.h"
CoordinateWidget::CoordinateWidget(QWidget * parent/*= 0*/, Qt::WindowFlags flags/*= 0*/):
- QWidget(parent, flags)//, actionHandler(NULL), cadToolBar(NULL)
+ QWidget(parent, flags)
{
ui.setupUi(this);
str.sprintf("%.4f / %.4f", v.x, v.y);
lCoord1->setText(str);
- double ang = RS_Math::rad2deg(v.angle());
+ double ang = Math::rad2deg(v.angle());
double rad = v.magnitude();
str.sprintf("%.4f < %.4f", rad, ang);
lCoord1b->setText(str);
str.sprintf("@%.4f / %.4f", v.x, v.y);
lCoord2->setText(str);
- double ang = RS_Math::rad2deg(v.angle());
+ double ang = Math::rad2deg(v.angle());
double rad = v.magnitude();
str.sprintf("@%.4f < %.4f", rad, ang);
lCoord2b->setText(str);
}
// abs / rel coordinates:
- QString absX = RS_Units::formatLinear(x, graphic->getUnit(), format, prec);
- QString absY = RS_Units::formatLinear(y, graphic->getUnit(), format, prec);
- QString relX = RS_Units::formatLinear(rx, graphic->getUnit(), format, prec);
- QString relY = RS_Units::formatLinear(ry, graphic->getUnit(), format, prec);
+ QString absX = Units::formatLinear(x, graphic->getUnit(), format, prec);
+ QString absY = Units::formatLinear(y, graphic->getUnit(), format, prec);
+ QString relX = Units::formatLinear(rx, graphic->getUnit(), format, prec);
+ QString relY = Units::formatLinear(ry, graphic->getUnit(), format, prec);
ui.lCoord1->setText(absX + ", " + absY);
ui.lCoord2->setText(relX + ", " + relY);
// polar coordinates:
Vector v = Vector(x, y);
- QString rStr = RS_Units::formatLinear(v.magnitude(), graphic->getUnit(), format, prec);
- QString aStr = RS_Units::formatAngle(v.angle(), aformat, aprec);
+ QString rStr = Units::formatLinear(v.magnitude(), graphic->getUnit(), format, prec);
+ QString aStr = Units::formatAngle(v.angle(), aformat, aprec);
// U+2221 = Measured angle
QString str = rStr + " " + QChar(0x2221) + aStr;
ui.lCoord1b->setText(str);
v = Vector(rx, ry);
- rStr = RS_Units::formatLinear(v.magnitude(), graphic->getUnit(), format, prec);
- aStr = RS_Units::formatAngle(v.angle(), aformat, aprec);
+ rStr = Units::formatLinear(v.magnitude(), graphic->getUnit(), format, prec);
+ aStr = Units::formatAngle(v.angle(), aformat, aprec);
str = rStr + " " + QChar(0x2221) + aStr;
ui.lCoord2b->setText(str);
}
#define __COORDINATEWIDGET_H__
#include "ui_coordinatewidget.h"
-#include "rs.h"
+#include "enums.h"
class Drawing;
class Vector;
QString sa;
if (update)
- sa = QString("%1").arg(RS_Math::rad2deg(action->getAngle()));
+ sa = QString("%1").arg(Math::rad2deg(action->getAngle()));
else
{
settings.beginGroup("Dimension");
}
else
{
- RS_DEBUG->print(RS_Debug::D_ERROR, "DimLinearOptions::setAction: wrong action type");
+ DEBUG->print(Debug::D_ERROR, "DimLinearOptions::setAction: wrong action type");
action = NULL;
}
}
void DimLinearOptions::updateAngle(const QString & a)
{
if (action != NULL)
- action->setAngle(RS_Math::deg2rad(RS_Math::eval(a)));
+ action->setAngle(Math::deg2rad(Math::eval(a)));
}
void DimLinearOptions::setHor()
}
else
{
- RS_DEBUG->print(RS_Debug::D_ERROR, "DimensionOptions::setAction: wrong action type");
+ DEBUG->print(Debug::D_ERROR, "DimensionOptions::setAction: wrong action type");
action = NULL;
}
}
{
}
-void DlgArc::setArc(RS_Arc & a)
+void DlgArc::setArc(Arc & a)
{
arc = &a;
//pen = arc->getPen();
if (graphic != NULL)
ui.cbLayer->init(*(graphic->getLayerList()), false, false);
- RS_Layer * lay = arc->getLayer(false);
+ Layer * lay = arc->getLayer(false);
if (lay != NULL)
ui.cbLayer->setLayer(*lay);
ui.leCenterY->setText(s);
s.setNum(arc->getRadius());
ui.leRadius->setText(s);
- s.setNum(RS_Math::rad2deg(arc->getAngle1()));
+ s.setNum(Math::rad2deg(arc->getAngle1()));
ui.leAngle1->setText(s);
- s.setNum(RS_Math::rad2deg(arc->getAngle2()));
+ s.setNum(Math::rad2deg(arc->getAngle2()));
ui.leAngle2->setText(s);
ui.cbReversed->setChecked(arc->isReversed());
}
void DlgArc::updateArc()
{
- arc->setCenter(Vector(RS_Math::eval(ui.leCenterX->text()),
- RS_Math::eval(ui.leCenterY->text())));
- arc->setRadius(RS_Math::eval(ui.leRadius->text()));
- arc->setAngle1(RS_Math::deg2rad(RS_Math::eval(ui.leAngle1->text())));
- arc->setAngle2(RS_Math::deg2rad(RS_Math::eval(ui.leAngle2->text())));
+ arc->setCenter(Vector(Math::eval(ui.leCenterX->text()),
+ Math::eval(ui.leCenterY->text())));
+ arc->setRadius(Math::eval(ui.leRadius->text()));
+ arc->setAngle1(Math::deg2rad(Math::eval(ui.leAngle1->text())));
+ arc->setAngle2(Math::deg2rad(Math::eval(ui.leAngle2->text())));
arc->setReversed(ui.cbReversed->isChecked());
arc->setPen(ui.wPen->getPen());
arc->setLayer(ui.cbLayer->currentText());
#include "ui_dlgarc.h"
-class RS_Arc;
+class Arc;
class DlgArc: public QDialog
{
~DlgArc();
public slots:
- void setArc(RS_Arc & a);
+ void setArc(Arc & a);
void updateArc();
private:
- RS_Arc * arc;
+ Arc * arc;
private:
Ui::DlgArc ui;
{
}
-void DlgAttributes::setData(RS_AttributesData * data, RS_LayerList & layerList)
+void DlgAttributes::setData(AttributesData * data, LayerList & layerList)
{
this->data = data;
ui.cbLayer->init(layerList, false, true);
//}
//cbLayer->setLayer(data->layer);
- //RS_Layer* lay = line->getLayer(false);
+ //Layer* lay = line->getLayer(false);
//if (lay!=NULL) {
// cbLayer->setLayer(*lay);
//}
#include "ui_dlgattributes.h"
#include "pen.h"
-class RS_AttributesData;
-class RS_LayerList;
+class AttributesData;
+class LayerList;
class DlgAttributes: public QDialog
{
~DlgAttributes();
public slots:
- void setData(RS_AttributesData * data, RS_LayerList & layerList);
+ void setData(AttributesData * data, LayerList & layerList);
void updateData();
private:
- RS_Pen pen;
- RS_AttributesData * data;
+ Pen pen;
+ AttributesData * data;
private:
Ui::DlgAttributes ui;
{
}
-void DlgCircle::setCircle(RS_Circle & c)
+void DlgCircle::setCircle(Circle & c)
{
circle = &c;
//pen = circle->getPen();
if (graphic != NULL)
ui.cbLayer->init(*(graphic->getLayerList()), false, false);
- RS_Layer * lay = circle->getLayer(false);
+ Layer * lay = circle->getLayer(false);
if (lay != NULL)
ui.cbLayer->setLayer(*lay);
void DlgCircle::updateCircle()
{
- circle->setCenter(Vector(RS_Math::eval(ui.leCenterX->text()),
- RS_Math::eval(ui.leCenterY->text())));
- circle->setRadius(RS_Math::eval(ui.leRadius->text()));
+ circle->setCenter(Vector(Math::eval(ui.leCenterX->text()),
+ Math::eval(ui.leCenterY->text())));
+ circle->setRadius(Math::eval(ui.leRadius->text()));
circle->setPen(ui.wPen->getPen());
circle->setLayer(ui.cbLayer->currentText());
circle->calculateBorders();
#include "ui_dlgcircle.h"
-class RS_Circle;
+class Circle;
class DlgCircle: public QDialog
{
~DlgCircle();
public slots:
- void setCircle(RS_Circle & c);
+ void setCircle(Circle & c);
void updateCircle();
private:
- RS_Circle * circle;
+ Circle * circle;
private:
Ui::DlgCircle ui;
{
}
-void DlgDimension::setDim(RS_Dimension & d)
+void DlgDimension::setDim(Dimension & d)
{
dim = &d;
ui.wPen->setPen(dim->getPen(false), true, false, "Pen");
if (graphic)
ui.cbLayer->init(*(graphic->getLayerList()), false, false);
- RS_Layer * lay = dim->getLayer(false);
+ Layer * lay = dim->getLayer(false);
if (lay)
ui.cbLayer->setLayer(*lay);
#include "ui_dlgdimension.h"
-class RS_Dimension;
+class Dimension;
class DlgDimension: public QDialog
{
~DlgDimension();
public slots:
- void setDim(RS_Dimension & d);
+ void setDim(Dimension & d);
void updateDim();
private:
- RS_Dimension * dim;
+ Dimension * dim;
private:
Ui::DlgDimension ui;
{
}
-void DlgDimLinear::setDim(RS_DimLinear & d)
+void DlgDimLinear::setDim(DimLinear & d)
{
dim = &d;
ui.wPen->setPen(dim->getPen(false), true, false, "Pen");
if (graphic)
ui.cbLayer->init(*(graphic->getLayerList()), false, false);
- RS_Layer * lay = dim->getLayer(false);
+ Layer * lay = dim->getLayer(false);
if (lay)
ui.cbLayer->setLayer(*lay);
ui.wLabel->setLabel(dim->getLabel(false));
- ui.leAngle->setText(QString("%1").arg(RS_Math::rad2deg(dim->getAngle())));
+ ui.leAngle->setText(QString("%1").arg(Math::rad2deg(dim->getAngle())));
}
void DlgDimLinear::updateDim()
{
dim->setLabel(ui.wLabel->getLabel());
- dim->setAngle(RS_Math::deg2rad(RS_Math::eval(ui.leAngle->text(), 0.0)));
+ dim->setAngle(Math::deg2rad(Math::eval(ui.leAngle->text(), 0.0)));
}
#include "ui_dlgdimlinear.h"
-class RS_DimLinear;
+class DimLinear;
class DlgDimLinear: public QDialog
{
~DlgDimLinear();
public slots:
- void setDim(RS_DimLinear & d);
+ void setDim(DimLinear & d);
void updateDim();
private:
- RS_DimLinear * dim;
+ DimLinear * dim;
private:
Ui::DlgDimLinear ui;
{
}
-void DlgEllipse::setEllipse(RS_Ellipse & e)
+void DlgEllipse::setEllipse(Ellipse & e)
{
ellipse = &e;
//pen = ellipse->getPen();
if (graphic != NULL)
ui.cbLayer->init(*(graphic->getLayerList()), false, false);
- RS_Layer * lay = ellipse->getLayer(false);
+ Layer * lay = ellipse->getLayer(false);
if (lay != NULL)
ui.cbLayer->setLayer(*lay);
ui.leMajor->setText(s);
s.setNum(ellipse->getMajorP().magnitude() * ellipse->getRatio());
ui.leMinor->setText(s);
- s.setNum(RS_Math::rad2deg(ellipse->getMajorP().angle()));
+ s.setNum(Math::rad2deg(ellipse->getMajorP().angle()));
ui.leRotation->setText(s);
- s.setNum(RS_Math::rad2deg(ellipse->getAngle1()));
+ s.setNum(Math::rad2deg(ellipse->getAngle1()));
ui.leAngle1->setText(s);
- s.setNum(RS_Math::rad2deg(ellipse->getAngle2()));
+ s.setNum(Math::rad2deg(ellipse->getAngle2()));
ui.leAngle2->setText(s);
ui.cbReversed->setChecked(ellipse->isReversed());
}
void DlgEllipse::updateEllipse()
{
- ellipse->setCenter(Vector(RS_Math::eval(ui.leCenterX->text()),
- RS_Math::eval(ui.leCenterY->text())));
+ ellipse->setCenter(Vector(Math::eval(ui.leCenterX->text()),
+ Math::eval(ui.leCenterY->text())));
Vector v;
- v.setPolar(RS_Math::eval(ui.leMajor->text()),
- RS_Math::deg2rad(RS_Math::eval(ui.leRotation->text())));
+ v.setPolar(Math::eval(ui.leMajor->text()),
+ Math::deg2rad(Math::eval(ui.leRotation->text())));
ellipse->setMajorP(v);
- if (RS_Math::eval(ui.leMajor->text()) > 1.0e-6)
- ellipse->setRatio(RS_Math::eval(ui.leMinor->text()) / RS_Math::eval(ui.leMajor->text()));
+ if (Math::eval(ui.leMajor->text()) > 1.0e-6)
+ ellipse->setRatio(Math::eval(ui.leMinor->text()) / Math::eval(ui.leMajor->text()));
else
ellipse->setRatio(1.0);
- ellipse->setAngle1(RS_Math::deg2rad(RS_Math::eval(ui.leAngle1->text())));
- ellipse->setAngle2(RS_Math::deg2rad(RS_Math::eval(ui.leAngle2->text())));
+ ellipse->setAngle1(Math::deg2rad(Math::eval(ui.leAngle1->text())));
+ ellipse->setAngle2(Math::deg2rad(Math::eval(ui.leAngle2->text())));
ellipse->setReversed(ui.cbReversed->isChecked());
ellipse->setPen(ui.wPen->getPen());
ellipse->setLayer(ui.cbLayer->currentText());
#include "ui_dlgellipse.h"
-class RS_Ellipse;
+class Ellipse;
class DlgEllipse: public QDialog
{
~DlgEllipse();
public slots:
- void setEllipse(RS_Ellipse & e);
+ void setEllipse(Ellipse & e);
void updateEllipse();
private:
- RS_Ellipse * ellipse;
+ Ellipse * ellipse;
private:
Ui::DlgEllipse ui;
hatch = NULL;
isNew = false;
- preview = new RS_EntityContainer();
+ preview = new EntityContainer();
ui.gvPreview->setContainer(preview);
ui.gvPreview->setBorders(15, 15, 15, 15);
ui.gvPreview->zoomAuto();
}
-void DlgHatch::setHatch(RS_Hatch & h, bool isNew)
+void DlgHatch::setHatch(Hatch & h, bool isNew)
{
hatch = &h;
this->isNew = isNew;
QString s;
s.setNum(hatch->getScale());
ui.leScale->setText(s);
- s.setNum(RS_Math::rad2deg(hatch->getAngle()));
+ s.setNum(Math::rad2deg(hatch->getAngle()));
ui.leAngle->setText(s);
}
}
hatch->setSolid(ui.cbSolid->isChecked());
hatch->setPattern(ui.cbPattern->currentText());
- hatch->setScale(RS_Math::eval(ui.leScale->text()));
- hatch->setAngle(RS_Math::deg2rad(RS_Math::eval(ui.leAngle->text())));
+ hatch->setScale(Math::eval(ui.leScale->text()));
+ hatch->setAngle(Math::deg2rad(Math::eval(ui.leAngle->text())));
}
void DlgHatch::setPattern(const QString & p)
{
- if (!RS_PATTERNLIST->contains(p))
+ if (!PATTERNLIST->contains(p))
// ui.cbPattern->insertItem(p);
ui.cbPattern->addItem(p);
updatePreview(NULL);
}
-void DlgHatch::updatePreview(RS_Pattern *)
+void DlgHatch::updatePreview(Pattern *)
{
if (!preview)
return;
QString patName = ui.cbPattern->currentText();
bool isSolid = ui.cbSolid->isChecked();
double prevSize;
- //double scale = RS_Math::eval(leScale->text(), 1.0);
- double angle = RS_Math::deg2rad(RS_Math::eval(ui.leAngle->text(), 0.0));
+ //double scale = Math::eval(leScale->text(), 1.0);
+ double angle = Math::deg2rad(Math::eval(ui.leAngle->text(), 0.0));
if (pattern != NULL)
prevSize = pattern->getSize().x * 10;
preview->clear();
- RS_Hatch * prevHatch = new RS_Hatch(preview, RS_HatchData(isSolid, 0.2, angle, patName));
+ Hatch * prevHatch = new Hatch(preview, HatchData(isSolid, 0.2, angle, patName));
prevHatch->setPen(hatch->getPen());
- RS_EntityContainer * loop = new RS_EntityContainer(prevHatch);
- loop->setPen(RS_Pen(RS2::FlagInvalid));
- loop->addEntity(new RS_Line(loop, RS_LineData(Vector(0.0, 0.0), Vector(10.0, 0.0))));
- loop->addEntity(new RS_Line(loop, RS_LineData(Vector(10.0, 0.0), Vector(10.0, 10.0))));
- loop->addEntity(new RS_Line(loop, RS_LineData(Vector(10.0, 10.0), Vector(0.0, 10.0))));
- loop->addEntity(new RS_Line(loop, RS_LineData(Vector(0.0, 10.0), Vector(0.0, 0.0))));
+ EntityContainer * loop = new EntityContainer(prevHatch);
+ loop->setPen(Pen(RS2::FlagInvalid));
+ loop->addEntity(new Line(loop, LineData(Vector(0.0, 0.0), Vector(10.0, 0.0))));
+ loop->addEntity(new Line(loop, LineData(Vector(10.0, 0.0), Vector(10.0, 10.0))));
+ loop->addEntity(new Line(loop, LineData(Vector(10.0, 10.0), Vector(0.0, 10.0))));
+ loop->addEntity(new Line(loop, LineData(Vector(0.0, 10.0), Vector(0.0, 0.0))));
prevHatch->addEntity(loop);
preview->addEntity(prevHatch);
#include "ui_dlghatch.h"
-class RS_EntityContainer;
-class RS_Pattern;
-class RS_Hatch;
+class EntityContainer;
+class Pattern;
+class Hatch;
class DlgHatch: public QDialog
{
public slots:
void polish();
void showEvent(QShowEvent * e);
- void setHatch(RS_Hatch & h, bool isNew);
+ void setHatch(Hatch & h, bool isNew);
void updateHatch();
void setPattern(const QString & p);
void resizeEvent(QResizeEvent *);
void updatePreview();
- void updatePreview(RS_Pattern *);
+ void updatePreview(Pattern *);
private:
- RS_EntityContainer * preview;
+ EntityContainer * preview;
bool isNew;
- RS_Pattern * pattern;
- RS_Hatch * hatch;
+ Pattern * pattern;
+ Hatch * hatch;
private:
Ui::DlgHatch ui;
{
updateEnabled = false;
bool ok = false;
- double res = RS_Math::eval(ui.cbResolution->currentText(), &ok);
+ double res = Math::eval(ui.cbResolution->currentText(), &ok);
if (!ok)
res = 1.0;
- int w = RS_Math::round(res * graphicSize.x);
- int h = RS_Math::round(res * graphicSize.y);
+ int w = Math::round(res * graphicSize.x);
+ int h = Math::round(res * graphicSize.y);
ui.leWidth->setText(QString("%1").arg(w));
ui.leHeight->setText(QString("%1").arg(h));
updateEnabled = true;
QSize ImageOptionsDialog::getSize()
{
- return QSize(RS_Math::round(RS_Math::eval(ui.leWidth->text())),
- RS_Math::round(RS_Math::eval(ui.leHeight->text())));
+ return QSize(Math::round(Math::eval(ui.leWidth->text())),
+ Math::round(Math::eval(ui.leHeight->text())));
}
bool ImageOptionsDialog::isBackgroundBlack()
#include "dlginitial.h"
-#include "rs.h"
+#include "enums.h"
#include "settings.h"
#include "system.h"
#include "units.h"
ui.setupUi(this);
// Fill combobox with languages:
- QStringList languageList = RS_SYSTEM->getLanguageList();
+ QStringList languageList = SYSTEM->getLanguageList();
for(QStringList::Iterator it=languageList.begin(); it!=languageList.end(); it++)
{
- QString l = RS_SYSTEM->symbolToLanguage(*it);
+ QString l = SYSTEM->symbolToLanguage(*it);
// ui.cbLanguage->insertItem(l);
// ui.cbLanguageCmd->insertItem(l);
ui.cbLanguage->addItem(l);
// units:
for(int i=RS2::None; i<RS2::LastUnit; i++)
-// ui.cbUnit->insertItem(RS_Units::unitToString((RS2::Unit)i));
- ui.cbUnit->addItem(RS_Units::unitToString((RS2::Unit)i));
+// ui.cbUnit->insertItem(Units::unitToString((RS2::Unit)i));
+ ui.cbUnit->addItem(Units::unitToString((RS2::Unit)i));
// ui.cbUnit->setCurrentText("Millimeter");
// ui.cbLanguage->setCurrentText("English");
void DlgInitial::ok()
{
settings.beginGroup("Appearance");
- settings.setValue("Language", RS_SYSTEM->languageToSymbol(ui.cbLanguage->currentText()));
- settings.setValue("LanguageCmd", RS_SYSTEM->languageToSymbol(ui.cbLanguageCmd->currentText()));
+ settings.setValue("Language", SYSTEM->languageToSymbol(ui.cbLanguage->currentText()));
+ settings.setValue("LanguageCmd", SYSTEM->languageToSymbol(ui.cbLanguageCmd->currentText()));
settings.endGroup();
settings.beginGroup("Defaults");
{
}
-void DlgInsert::setInsert(RS_Insert & i)
+void DlgInsert::setInsert(Insert & i)
{
insert = &i;
//pen = insert->getPen();
if (graphic)
ui.cbLayer->init(*(graphic->getLayerList()), false, false);
- RS_Layer * lay = insert->getLayer(false);
+ Layer * lay = insert->getLayer(false);
if (lay)
ui.cbLayer->setLayer(*lay);
ui.leInsertionPointY->setText(s);
s.setNum(insert->getScale().x);
ui.leScale->setText(s);
- s.setNum(RS_Math::rad2deg(insert->getAngle()));
+ s.setNum(Math::rad2deg(insert->getAngle()));
ui.leAngle->setText(s);
s.setNum(insert->getRows());
ui.leRows->setText(s);
void DlgInsert::updateInsert()
{
- insert->setInsertionPoint(Vector(RS_Math::eval(ui.leInsertionPointX->text()),
- RS_Math::eval(ui.leInsertionPointY->text())));
- insert->setScale(Vector(RS_Math::eval(ui.leScale->text()),
- RS_Math::eval(ui.leScale->text())));
- insert->setAngle(RS_Math::deg2rad(RS_Math::eval(ui.leAngle->text())));
- insert->setRows(RS_Math::round(RS_Math::eval(ui.leRows->text())));
- insert->setCols(RS_Math::round(RS_Math::eval(ui.leCols->text())));
- insert->setSpacing(Vector(RS_Math::eval(ui.leRowSpacing->text()),
- RS_Math::eval(ui.leColSpacing->text())));
+ insert->setInsertionPoint(Vector(Math::eval(ui.leInsertionPointX->text()),
+ Math::eval(ui.leInsertionPointY->text())));
+ insert->setScale(Vector(Math::eval(ui.leScale->text()),
+ Math::eval(ui.leScale->text())));
+ insert->setAngle(Math::deg2rad(Math::eval(ui.leAngle->text())));
+ insert->setRows(Math::round(Math::eval(ui.leRows->text())));
+ insert->setCols(Math::round(Math::eval(ui.leCols->text())));
+ insert->setSpacing(Vector(Math::eval(ui.leRowSpacing->text()),
+ Math::eval(ui.leColSpacing->text())));
insert->setPen(ui.wPen->getPen());
insert->setLayer(ui.cbLayer->currentText());
}
#include "ui_dlginsert.h"
-class RS_Insert;
+class Insert;
class DlgInsert: public QDialog
{
~DlgInsert();
public slots:
- void setInsert(RS_Insert & i);
+ void setInsert(Insert & i);
void updateInsert();
private:
- RS_Insert * insert;
+ Insert * insert;
private:
Ui::DlgInsert ui;
{
}
-void DlgLine::setLine(RS_Line & l)
+void DlgLine::setLine(Line & l)
{
line = &l;
//pen = line->getPen();
if (graphic)
ui.cbLayer->init(*(graphic->getLayerList()), false, false);
- RS_Layer * lay = line->getLayer(false);
+ Layer * lay = line->getLayer(false);
if (lay)
ui.cbLayer->setLayer(*lay);
void DlgLine::updateLine()
{
- line->setStartpoint(Vector(RS_Math::eval(ui.leStartX->text()),
- RS_Math::eval(ui.leStartY->text())));
- line->setEndpoint(Vector(RS_Math::eval(ui.leEndX->text()),
- RS_Math::eval(ui.leEndY->text())));
+ line->setStartpoint(Vector(Math::eval(ui.leStartX->text()),
+ Math::eval(ui.leStartY->text())));
+ line->setEndpoint(Vector(Math::eval(ui.leEndX->text()),
+ Math::eval(ui.leEndY->text())));
line->setPen(ui.wPen->getPen());
line->setLayer(ui.cbLayer->currentText());
}
#include "ui_dlgline.h"
-class RS_Line;
+class Line;
class DlgLine: public QDialog
{
~DlgLine();
public slots:
- void setLine(RS_Line & l);
+ void setLine(Line & l);
void updateLine();
private:
- RS_Line * line;
+ Line * line;
private:
Ui::DlgLine ui;
settings.endGroup();
}
-void DlgMirror::setData(RS_MirrorData * d)
+void DlgMirror::setData(MirrorData * d)
{
data = d;
}
#include "ui_dlgmirror.h"
-class RS_MirrorData;
+class MirrorData;
class DlgMirror: public QDialog
{
~DlgMirror();
public slots:
- void setData(RS_MirrorData * d);
+ void setData(MirrorData * d);
void updateData();
private:
- RS_MirrorData * data;
+ MirrorData * data;
QString copies;
int numberMode;
bool useCurrentLayer;
settings.endGroup();
}
-void DlgMove::setData(RS_MoveData * d)
+void DlgMove::setData(MoveData * d)
{
data = d;
}
#include "ui_dlgmove.h"
-class RS_MoveData;
+class MoveData;
class DlgMove: public QDialog
{
~DlgMove();
public slots:
- void setData(RS_MoveData * d);
+ void setData(MoveData * d);
void updateData();
private:
bool useCurrentLayer;
int numberMode;
QString copies;
- RS_MoveData * data;
+ MoveData * data;
private:
Ui::DlgMove ui;
settings.endGroup();
}
-void DlgMoveRotate::setData(RS_MoveRotateData * d)
+void DlgMoveRotate::setData(MoveRotateData * d)
{
data = d;
- ui.leAngle->setText(QString("%1").arg(RS_Math::rad2deg(data->angle)));
+ ui.leAngle->setText(QString("%1").arg(Math::rad2deg(data->angle)));
}
void DlgMoveRotate::updateData()
else
data->number = ui.leNumber->text().toInt();
- data->angle = RS_Math::deg2rad(RS_Math::eval(ui.leAngle->text()));
+ data->angle = Math::deg2rad(Math::eval(ui.leAngle->text()));
data->useCurrentAttributes = ui.cbCurrentAttributes->isChecked();
data->useCurrentLayer = ui.cbCurrentLayer->isChecked();
}
#include "ui_dlgmoverotate.h"
-class RS_MoveRotateData;
+class MoveRotateData;
class DlgMoveRotate: public QDialog
{
~DlgMoveRotate();
public slots:
- void setData(RS_MoveRotateData * d);
+ void setData(MoveRotateData * d);
void updateData();
private:
bool useCurrentLayer;
int numberMode;
QString copies;
- RS_MoveRotateData * data;
+ MoveRotateData * data;
QString angle;
private:
#include "dlgoptionsdrawing.h"
-#include "rs.h"
+#include "enums.h"
#include "debug.h"
#include "filterdxf.h"
#include "drawing.h"
// Main drawing unit:
for(int i=RS2::None; i<RS2::LastUnit; i++)
-// ui.cbUnit->insertItem(RS_Units::unitToString((RS2::Unit)i));
- ui.cbUnit->addItem(RS_Units::unitToString((RS2::Unit)i));
+// ui.cbUnit->insertItem(Units::unitToString((RS2::Unit)i));
+ ui.cbUnit->addItem(Units::unitToString((RS2::Unit)i));
// init units combobox:
QStringList unitList;
// Paper format:
for(int i=RS2::Custom; i<=RS2::NPageSize; i++)
-// ui.cbPaperFormat->insertItem(RS_Units::paperFormatToString((RS2::PaperFormat)i));
- ui.cbPaperFormat->addItem(RS_Units::paperFormatToString((RS2::PaperFormat)i));
+// ui.cbPaperFormat->insertItem(Units::paperFormatToString((RS2::PaperFormat)i));
+ ui.cbPaperFormat->addItem(Units::paperFormatToString((RS2::PaperFormat)i));
// Encodings:
/*
// main drawing unit:
int insunits = graphic->getVariableInt("$INSUNITS", 0);
-// ui.cbUnit->setCurrentText(RS_Units::unitToString(RS_FilterDXF::numberToUnit(insunits)));
+// ui.cbUnit->setCurrentText(Units::unitToString(FilterDXF::numberToUnit(insunits)));
ui.cbUnit->setItemText(ui.cbUnit->currentIndex(),
- RS_Units::unitToString(RS_FilterDXF::numberToUnit(insunits)));
+ Units::unitToString(FilterDXF::numberToUnit(insunits)));
// units / length format:
int lunits = graphic->getVariableInt("$LUNITS", 2);
// paper format:
bool landscape;
RS2::PaperFormat format = graphic->getPaperFormat(&landscape);
- RS_DEBUG->print("DlgOptionsDrawing::setGraphic: paper format is: %d", (int)format);
+ DEBUG->print("DlgOptionsDrawing::setGraphic: paper format is: %d", (int)format);
// ui.cbPaperFormat->setCurrentItem((int)format);
ui.cbPaperFormat->setCurrentIndex((int)format);
// dimension text height:
RS2::Unit unit = (RS2::Unit)ui.cbUnit->currentIndex();
- double dimtxt = graphic->getVariableDouble("$DIMTXT", RS_Units::convert(2.5, RS2::Millimeter, unit));
+ double dimtxt = graphic->getVariableDouble("$DIMTXT", Units::convert(2.5, RS2::Millimeter, unit));
// ui.cbDimTextHeight->setCurrentText(QString("%1").arg(dimtxt));
ui.cbDimTextHeight->setItemText(ui.cbDimTextHeight->currentIndex(), QString("%1").arg(dimtxt));
// dimension extension line extension:
- double dimexe = graphic->getVariableDouble("$DIMEXE", RS_Units::convert(1.25, RS2::Millimeter, unit));
+ double dimexe = graphic->getVariableDouble("$DIMEXE", Units::convert(1.25, RS2::Millimeter, unit));
// ui.cbDimExe->setCurrentText(QString("%1").arg(dimexe));
ui.cbDimExe->setItemText(ui.cbDimExe->currentIndex(), QString("%1").arg(dimexe));
// dimension extension line offset:
- double dimexo = graphic->getVariableDouble("$DIMEXO", RS_Units::convert(0.625, RS2::Millimeter, unit));
+ double dimexo = graphic->getVariableDouble("$DIMEXO", Units::convert(0.625, RS2::Millimeter, unit));
// ui.cbDimExo->setCurrentText(QString("%1").arg(dimexo));
ui.cbDimExo->setItemText(ui.cbDimExo->currentIndex(), QString("%1").arg(dimexo));
// dimension line gap:
- double dimgap = graphic->getVariableDouble("$DIMGAP", RS_Units::convert(0.625, RS2::Millimeter, unit));
+ double dimgap = graphic->getVariableDouble("$DIMGAP", Units::convert(0.625, RS2::Millimeter, unit));
// ui.cbDimGap->setCurrentText(QString("%1").arg(dimgap));
ui.cbDimGap->setItemText(ui.cbDimGap->currentIndex(), QString("%1").arg(dimgap));
// dimension arrow size:
- double dimasz = graphic->getVariableDouble("$DIMASZ", RS_Units::convert(2.5, RS2::Millimeter, unit));
+ double dimasz = graphic->getVariableDouble("$DIMASZ", Units::convert(2.5, RS2::Millimeter, unit));
// ui.cbDimAsz->setCurrentText(QString("%1").arg(dimasz));
ui.cbDimAsz->setItemText(ui.cbDimAsz->currentIndex(), QString("%1").arg(dimasz));
// ui.cbSplineSegs->setCurrentText(QString("%1").arg(splinesegs));
ui.cbSplineSegs->setItemText(ui.cbSplineSegs->currentIndex(), QString("%1").arg(splinesegs));
- RS_DEBUG->print("DlgOptionsDrawing::setGraphic: splinesegs is: %d", splinesegs);
+ DEBUG->print("DlgOptionsDrawing::setGraphic: splinesegs is: %d", splinesegs);
// encoding:
/*
QString encoding = graphic->getVariableString("$DWGCODEPAGE",
"ANSI_1252");
- encoding=RS_System::getEncoding(encoding);
+ encoding=System::getEncoding(encoding);
cbEncoding->setCurrentText(encoding);
*/
if (f == RS2::Engineering || f == RS2::Architectural)
{
- if (RS_Units::stringToUnit(ui.cbUnit->currentText()) != RS2::Inch)
+ if (Units::stringToUnit(ui.cbUnit->currentText()) != RS2::Inch)
{
QMessageBox::warning( this, tr("Options"),
tr("For the length formats 'Engineering' and 'Architectural', the unit must be set to Inch."), QMessageBox::Ok, Qt::NoButton);
// custom paper size:
if ((RS2::PaperFormat)ui.cbPaperFormat->currentIndex() == RS2::Custom)
{
- graphic->setPaperSize(Vector(RS_Math::eval(ui.lePaperWidth->text()),
- RS_Math::eval(ui.lePaperHeight->text())));
+ graphic->setPaperSize(Vector(Math::eval(ui.lePaperWidth->text()),
+ Math::eval(ui.lePaperHeight->text())));
}
// grid:
graphic->addVariable("$GRIDUNIT", spacing, 10);
// dim:
- graphic->addVariable("$DIMTXT", RS_Math::eval(ui.cbDimTextHeight->currentText()), 40);
- graphic->addVariable("$DIMEXE", RS_Math::eval(ui.cbDimExe->currentText()), 40);
- graphic->addVariable("$DIMEXO", RS_Math::eval(ui.cbDimExo->currentText()), 40);
- graphic->addVariable("$DIMGAP", RS_Math::eval(ui.cbDimGap->currentText()), 40);
- graphic->addVariable("$DIMASZ", RS_Math::eval(ui.cbDimAsz->currentText()), 40);
+ graphic->addVariable("$DIMTXT", Math::eval(ui.cbDimTextHeight->currentText()), 40);
+ graphic->addVariable("$DIMEXE", Math::eval(ui.cbDimExe->currentText()), 40);
+ graphic->addVariable("$DIMEXO", Math::eval(ui.cbDimExo->currentText()), 40);
+ graphic->addVariable("$DIMGAP", Math::eval(ui.cbDimGap->currentText()), 40);
+ graphic->addVariable("$DIMASZ", Math::eval(ui.cbDimAsz->currentText()), 40);
// splines:
- graphic->addVariable("$SPLINESEGS", (int)RS_Math::eval(ui.cbSplineSegs->currentText()), 70);
+ graphic->addVariable("$SPLINESEGS", (int)Math::eval(ui.cbSplineSegs->currentText()), 70);
- RS_DEBUG->print("DlgOptionsDrawing::validate: splinesegs is: %s",
+ DEBUG->print("DlgOptionsDrawing::validate: splinesegs is: %s",
ui.cbSplineSegs->currentText().toLatin1().data());
// update all dimension and spline entities in the graphic to match the new settings:
break;
default:
- RS_DEBUG->print(RS_Debug::D_ERROR,
+ DEBUG->print(Debug::D_ERROR,
"DlgOptionsDrawing::updateLengthPrecision: error");
break;
}
void DlgOptionsDrawing::updatePreview()
{
QString prev;
- prev = RS_Units::formatLinear(14.43112351,
+ prev = Units::formatLinear(14.43112351,
(RS2::Unit)ui.cbUnit->currentIndex(),
(RS2::LinearFormat)(ui.cbLengthFormat->currentIndex()),
ui.cbLengthPrecision->currentIndex());
ui.lLinear->setText(prev);
- prev = RS_Units::formatAngle(0.5327714,
+ prev = Units::formatAngle(0.5327714,
(RS2::AngleFormat)ui.cbAngleFormat->currentIndex(),
ui.cbAnglePrecision->currentIndex());
ui.lAngular->setText(prev);
}
else
{
- Vector s = RS_Units::paperFormatToSize(format);
+ Vector s = Units::paperFormatToSize(format);
ui.lePaperWidth->setText(QString("%1").arg(s.x));
ui.lePaperHeight->setText(QString("%1").arg(s.y));
}
void DlgOptionsDrawing::updateUnitLabels()
{
RS2::Unit u = (RS2::Unit)ui.cbUnit->currentIndex();
- QString sign = RS_Units::unitToSign(u);
+ QString sign = Units::unitToSign(u);
ui.lDimUnit1->setText(sign);
ui.lDimUnit2->setText(sign);
ui.lDimUnit3->setText(sign);
#include "dlgoptionsgeneral.h"
-#include "rs.h"
+#include "enums.h"
#include "debug.h"
#include "settings.h"
#include "system.h"
Widget9Layout->addMultiCellWidget(bgGraphicView, 0, 2, 0, 0); //use empty space as well
#endif
// Fill combobox with languages:
- QStringList languageList = RS_SYSTEM->getLanguageList();
+ QStringList languageList = SYSTEM->getLanguageList();
languageList.prepend("en");
for(QStringList::Iterator it=languageList.begin(); it!=languageList.end(); it++)
{
- RS_DEBUG->print("DlgOptionsGeneral::init: adding %s to combobox", (*it).toLatin1().data());
+ DEBUG->print("DlgOptionsGeneral::init: adding %s to combobox", (*it).toLatin1().data());
- QString l = RS_SYSTEM->symbolToLanguage(*it);
+ QString l = SYSTEM->symbolToLanguage(*it);
if (l.isEmpty() == false)
{
- RS_DEBUG->print("DlgOptionsGeneral::init: %s", l.toLatin1().data());
+ DEBUG->print("DlgOptionsGeneral::init: %s", l.toLatin1().data());
ui.cbLanguage->addItem(l);
ui.cbLanguageCmd->addItem(l);
}
def_lang = QC_PREDEFINED_LOCALE;
#endif
QString lang = settings.value("Language", def_lang).toString();
-// ui.cbLanguage->setCurrentText(RS_SYSTEM->symbolToLanguage(lang));
- ui.cbLanguage->setItemText(ui.cbLanguage->currentIndex(), RS_SYSTEM->symbolToLanguage(lang));
+// ui.cbLanguage->setCurrentText(SYSTEM->symbolToLanguage(lang));
+ ui.cbLanguage->setItemText(ui.cbLanguage->currentIndex(), SYSTEM->symbolToLanguage(lang));
QString langCmd = settings.value("LanguageCmd", def_lang).toString();
-// ui.cbLanguageCmd->setCurrentText(RS_SYSTEM->symbolToLanguage(langCmd));
- ui.cbLanguageCmd->setItemText(ui.cbLanguageCmd->currentIndex(), RS_SYSTEM->symbolToLanguage(langCmd));
+// ui.cbLanguageCmd->setCurrentText(SYSTEM->symbolToLanguage(langCmd));
+ ui.cbLanguageCmd->setItemText(ui.cbLanguageCmd->currentIndex(), SYSTEM->symbolToLanguage(langCmd));
// graphic view:
// crosshairs:
for(int i=RS2::None; i<RS2::LastUnit; i++)
{
if (i != (int)RS2::None)
- ui.cbUnit->addItem(RS_Units::unitToString((RS2::Unit)i));
+ ui.cbUnit->addItem(Units::unitToString((RS2::Unit)i));
}
//should be [DONE]
// cbUnit->listBox()->sort();
//#endif
ui.cbUnit->setInsertPolicy(QComboBox::InsertAtBottom);
- ui.cbUnit->addItem(RS_Units::unitToString(RS2::None), 0);
+ ui.cbUnit->addItem(Units::unitToString(RS2::None), 0);
QString def_unit = "Millimeter";
#ifdef QC_PREDEFINED_UNIT
void DlgOptionsGeneral::ok()
{
- //RS_SYSTEM->loadTranslation(cbLanguage->currentText());
+ //SYSTEM->loadTranslation(cbLanguage->currentText());
settings.beginGroup("Appearance");
- settings.setValue("Language", RS_SYSTEM->languageToSymbol(ui.cbLanguage->currentText()));
- settings.setValue("LanguageCmd", RS_SYSTEM->languageToSymbol(ui.cbLanguageCmd->currentText()));
+ settings.setValue("Language", SYSTEM->languageToSymbol(ui.cbLanguage->currentText()));
+ settings.setValue("LanguageCmd", SYSTEM->languageToSymbol(ui.cbLanguageCmd->currentText()));
settings.setValue("ShowCrosshairs", ui.cbShowCrosshairs->isChecked());
settings.setValue("ScaleGrid", ui.cbScaleGrid->isChecked());
settings.setValue("MinGridSpacing", ui.cbMinGridSpacing->currentText());
settings.endGroup();
settings.beginGroup("Defaults");
- settings.setValue("Unit", RS_Units::unitToString(RS_Units::stringToUnit(ui.cbUnit->currentText()), false/*untr.*/));
+ settings.setValue("Unit", Units::unitToString(Units::stringToUnit(ui.cbUnit->currentText()), false/*untr.*/));
settings.endGroup();
if (restartNeeded == true)
{
}
-void DlgPoint::setPoint(RS_Point & p)
+void DlgPoint::setPoint(Point & p)
{
point = &p;
if (graphic)
ui.cbLayer->init(*(graphic->getLayerList()), false, false);
- RS_Layer * lay = point->getLayer(false);
+ Layer * lay = point->getLayer(false);
if (lay)
ui.cbLayer->setLayer(*lay);
void DlgPoint::updatePoint()
{
- point->setPos(Vector(RS_Math::eval(ui.lePosX->text()),
- RS_Math::eval(ui.lePosY->text())));
+ point->setPos(Vector(Math::eval(ui.lePosX->text()),
+ Math::eval(ui.lePosY->text())));
point->setPen(ui.wPen->getPen());
point->setLayer(ui.cbLayer->currentText());
}
#include "ui_dlgpoint.h"
#include "pen.h"
-class RS_Point;
+class Point;
class DlgPoint: public QDialog
{
~DlgPoint();
public slots:
- void setPoint(RS_Point & p);
+ void setPoint(Point & p);
void updatePoint();
private:
- RS_Pen pen;
- RS_Point * point;
+ Pen pen;
+ Point * point;
private:
Ui::DlgPoint ui;
settings.endGroup();
}
-void DlgRotate::setData(RS_RotateData * d)
+void DlgRotate::setData(RotateData * d)
{
data = d;
}
else
data->number = ui.leNumber->text().toInt();
- data->angle = RS_Math::deg2rad(RS_Math::eval(ui.leAngle->text()));
+ data->angle = Math::deg2rad(Math::eval(ui.leAngle->text()));
data->useCurrentAttributes = ui.cbCurrentAttributes->isChecked();
data->useCurrentLayer = ui.cbCurrentLayer->isChecked();
}
#include "ui_dlgrotate.h"
-class RS_RotateData;
+class RotateData;
class DlgRotate: public QDialog
{
~DlgRotate();
public slots:
- void setData(RS_RotateData * d);
+ void setData(RotateData * d);
void updateData();
private:
bool useCurrentLayer;
int numberMode;
QString copies;
- RS_RotateData * data;
+ RotateData * data;
QString angle;
private:
settings.endGroup();
}
-void DlgRotate2::setData(RS_Rotate2Data * d)
+void DlgRotate2::setData(Rotate2Data * d)
{
data = d;
- //leAngle1->setText(QString("%1").arg(RS_Math::rad2deg(data->angle1)));
- //leAngle2->setText(QString("%1").arg(RS_Math::rad2deg(data->angle2)));
+ //leAngle1->setText(QString("%1").arg(Math::rad2deg(data->angle1)));
+ //leAngle2->setText(QString("%1").arg(Math::rad2deg(data->angle2)));
}
void DlgRotate2::updateData()
else
data->number = ui.leNumber->text().toInt();
- data->angle1 = RS_Math::deg2rad(RS_Math::eval(ui.leAngle1->text()));
- data->angle2 = RS_Math::deg2rad(RS_Math::eval(ui.leAngle2->text()));
+ data->angle1 = Math::deg2rad(Math::eval(ui.leAngle1->text()));
+ data->angle2 = Math::deg2rad(Math::eval(ui.leAngle2->text()));
data->useCurrentAttributes = ui.cbCurrentAttributes->isChecked();
data->useCurrentLayer = ui.cbCurrentLayer->isChecked();
}
#include "ui_dlgrotate2.h"
-class RS_Rotate2Data;
+class Rotate2Data;
class DlgRotate2: public QDialog
{
~DlgRotate2();
public slots:
- void setData(RS_Rotate2Data * d);
+ void setData(Rotate2Data * d);
void updateData();
protected:
bool useCurrentLayer;
int numberMode;
QString copies;
- RS_Rotate2Data * data;
+ Rotate2Data * data;
QString angle1;
private:
settings.endGroup();
}
-void DlgScale::setData(RS_ScaleData * d)
+void DlgScale::setData(ScaleData * d)
{
data = d;
}
else
data->number = ui.leNumber->text().toInt();
- data->factor = RS_Math::eval(ui.leFactor->text());
+ data->factor = Math::eval(ui.leFactor->text());
data->useCurrentAttributes = ui.cbCurrentAttributes->isChecked();
data->useCurrentLayer = ui.cbCurrentLayer->isChecked();
}
#include "ui_dlgscale.h"
-class RS_ScaleData;
+class ScaleData;
class DlgScale: public QDialog
{
~DlgScale();
public slots:
- void setData(RS_ScaleData * d);
+ void setData(ScaleData * d);
void updateData();
private:
QString factor;
- RS_ScaleData * data;
+ ScaleData * data;
QString copies;
int numberMode;
bool useCurrentLayer;
{
}
-void DlgSpline::setSpline(RS_Spline & e)
+void DlgSpline::setSpline(Spline & e)
{
spline = &e;
//pen = spline->getPen();
ui.wPen->setPen(spline->getPen(false), true, false, "Pen");
Drawing * graphic = spline->getGraphic();
- RS_Layer * lay = spline->getLayer(false);
+ Layer * lay = spline->getLayer(false);
if (graphic)
ui.cbLayer->init(*(graphic->getLayerList()), false, false);
void DlgSpline::updateSpline()
{
- spline->setDegree(RS_Math::round(RS_Math::eval(ui.cbDegree->currentText())));
+ spline->setDegree(Math::round(Math::eval(ui.cbDegree->currentText())));
spline->setClosed(ui.cbClosed->isChecked());
spline->setPen(ui.wPen->getPen());
spline->setLayer(ui.cbLayer->currentText());
#include "ui_dlgspline.h"
-class RS_Spline;
+class Spline;
class DlgSpline: public QDialog
{
~DlgSpline();
public slots:
- void setSpline(RS_Spline & e);
+ void setSpline(Spline & e);
void updateSpline();
private:
- RS_Spline * spline;
+ Spline * spline;
private:
Ui::DlgSpline ui;
/**
* Sets the text entity represented by this dialog.
*/
-void DlgText::setText(RS_Text & t, bool isNew)
+void DlgText::setText(Text & t, bool isNew)
{
text = &t;
this->isNew = isNew;
{
settings.beginGroup("Draw");
//default font depending on locale
-// Q3CString iso = RS_System::localeToISO( QTextCodec::locale() );
-// QString iso = RS_System::localeToISO(QTextCodec::locale());
- QString iso = RS_System::localeToISO(QLocale::system().name());
+// Q3CString iso = System::localeToISO( QTextCodec::locale() );
+// QString iso = System::localeToISO(QTextCodec::locale());
+ QString iso = System::localeToISO(QLocale::system().name());
if (iso == "ISO8859-1")
fon = settings.value("TextFont", "normallatin1").toString();
str = text->getText();
//QString shape = settings.value("/TextShape", "0");
- angle = QString("%1").arg(RS_Math::rad2deg(text->getAngle()));
+ angle = QString("%1").arg(Math::rad2deg(text->getAngle()));
}
ui.cbDefault->setChecked(def == "1");
{
text->setStyle(ui.cbFont->currentText());
text->setHeight(ui.leHeight->text().toDouble());
-// text->setText(RS_FilterDXF::toNativeString(ui.teText->text()));
- text->setText(RS_FilterDXF::toNativeString(ui.teText->toPlainText()));
+// text->setText(FilterDXF::toNativeString(ui.teText->text()));
+ text->setText(FilterDXF::toNativeString(ui.teText->toPlainText()));
//text->setLetterSpacing(leLetterSpacing.toDouble());
text->setLineSpacingFactor(ui.leLineSpacingFactor->text().toDouble());
text->setAlignment(getAlignment());
- text->setAngle(RS_Math::deg2rad(ui.leAngle->text().toDouble()));
+ text->setAngle(Math::deg2rad(ui.leAngle->text().toDouble()));
}
}
#include "ui_dlgtext.h"
-class RS_Text;
-class RS_Font;
+class Text;
+class Font;
class DlgText: public QDialog
{
public slots:
void updateUniCharComboBox(int);
- void setText(RS_Text & t, bool isNew);
+ void setText(Text & t, bool isNew);
void updateText();
void setAlignmentTL();
void setAlignmentTC();
private:
bool isNew;
- RS_Text * text;
- RS_Font * font;
+ Text * text;
+ Font * font;
private:
Ui::DlgText ui;
#include "imageoptions.h"
-#include "rs.h"
+#include "enums.h"
#include "actiondrawimage.h"
#include "actioninterface.h"
#include "debug.h"
if (update)
{
- sAngle = QString("%1").arg(RS_Math::rad2deg(action->getAngle()));
+ sAngle = QString("%1").arg(Math::rad2deg(action->getAngle()));
sFactor = QString("%1").arg(action->getFactor());
}
else
}
else
{
- RS_DEBUG->print(RS_Debug::D_ERROR, "ImageOptions::setAction: wrong action type");
+ DEBUG->print(Debug::D_ERROR, "ImageOptions::setAction: wrong action type");
action = NULL;
}
}
{
if (action != NULL)
{
- action->setAngle(RS_Math::deg2rad(RS_Math::eval(ui.leAngle->text())));
- action->setFactor(RS_Math::eval(ui.leFactor->text()));
+ action->setAngle(Math::deg2rad(Math::eval(ui.leAngle->text())));
+ action->setFactor(Math::eval(ui.leFactor->text()));
}
}
if (update)
{
- sAngle = QString("%1").arg(RS_Math::rad2deg(action->getAngle()));
+ sAngle = QString("%1").arg(Math::rad2deg(action->getAngle()));
sFactor = QString("%1").arg(action->getFactor());
sColumns = QString("%1").arg(action->getColumns());
sRows = QString("%1").arg(action->getRows());
}
else
{
- RS_DEBUG->print(RS_Debug::D_ERROR, "InsertOptions::setAction: wrong action type");
+ DEBUG->print(Debug::D_ERROR, "InsertOptions::setAction: wrong action type");
action = NULL;
}
}
{
if (action != NULL)
{
- action->setAngle(RS_Math::deg2rad(RS_Math::eval(leAngle->text())));
- action->setFactor(RS_Math::eval(leFactor->text()));
+ action->setAngle(Math::deg2rad(Math::eval(leAngle->text())));
+ action->setFactor(Math::eval(leFactor->text()));
action->setColumns(sbColumns->value());
action->setRows(sbRows->value());
- action->setColumnSpacing(RS_Math::eval(leColumnSpacing->text()));
- action->setRowSpacing(RS_Math::eval(leRowSpacing->text()));
+ action->setColumnSpacing(Math::eval(leColumnSpacing->text()));
+ action->setRowSpacing(Math::eval(leRowSpacing->text()));
}
}
{
}
-void LayerDialog::setLayer(RS_Layer * l)
+void LayerDialog::setLayer(Layer * l)
{
layer = l;
layerName = layer->getName();
ui.leName->setEnabled(false);
}
-void LayerDialog::setLayerList(RS_LayerList * ll)
+void LayerDialog::setLayerList(LayerList * ll)
{
layerList = ll;
}
layer->setPen(ui.wPen->getPen());
#if 0
//OK, the problem is the color widget is misreporting the color that's been set.
-RS_Color c = ui.wPen->getPen().getColor();
+Color c = ui.wPen->getPen().getColor();
printf("LayerDialog::updateLayer() -> selected pen is %u, %u, %u\n", c.red(), c.green(), c.blue());
std::cout << ui.wPen->getPen();
-RS_Pen p = layer->getPen();
+Pen p = layer->getPen();
c = p.getColor();
printf("LayerDialog::updateLayer() -> selected pen is %u, %u, %u\n", c.red(), c.green(), c.blue());
std::cout << ui.wPen->getPen();
{
if (layerList && (!editLayer || layerName != ui.leName->text()))
{
- RS_Layer * l = layerList->find(ui.leName->text().toLatin1());
+ Layer * l = layerList->find(ui.leName->text().toLatin1());
if (l)
{
#include "ui_layerdialog.h"
-class RS_Layer;
-class RS_LayerList;
+class Layer;
+class LayerList;
class LayerDialog: public QDialog
{
~LayerDialog();
public slots:
- void setLayer(RS_Layer * l);
- void setLayerList(RS_LayerList * ll);
+ void setLayer(Layer * l);
+ void setLayerList(LayerList * ll);
void setEditLayer(bool el);
void updateLayer();
void validate();
protected:
- RS_Layer * layer;
- RS_LayerList * layerList;
+ Layer * layer;
+ LayerList * layerList;
QString layerName;
bool editLayer;
if (update)
{
- sAngle = QString("%1").arg(RS_Math::rad2deg(action->getAngle()));
+ sAngle = QString("%1").arg(Math::rad2deg(action->getAngle()));
sFactor = QString("%1").arg(action->getFactor());
}
else
}
else
{
- RS_DEBUG->print(RS_Debug::D_ERROR, "LibraryInsertOptions::setAction: wrong action type");
+ DEBUG->print(Debug::D_ERROR, "LibraryInsertOptions::setAction: wrong action type");
action = NULL;
}
}
{
if (action != NULL)
{
- action->setAngle(RS_Math::deg2rad(RS_Math::eval(leAngle->text())));
- action->setFactor(RS_Math::eval(leFactor->text()));
+ action->setAngle(Math::deg2rad(Math::eval(leAngle->text())));
+ action->setFactor(Math::eval(leFactor->text()));
}
}
ui.setupUi(this);
ui.lvDirectory->setColumnCount(1);
- QStringList directoryList = RS_SYSTEM->getDirectoryList("library");
+ QStringList directoryList = SYSTEM->getDirectoryList("library");
#if 0
std::cout << "directorySize = " << directoryList.size() << std::endl;
}
else
{
- RS_DEBUG->print(RS_Debug::D_ERROR, "LibraryWidget::insert:"
+ DEBUG->print(Debug::D_ERROR, "LibraryWidget::insert:"
"Cannot create action ActionLibraryInsert");
}
}
}
else
{
- RS_DEBUG->print(RS_Debug::D_ERROR,
+ DEBUG->print(Debug::D_ERROR,
"LibraryWidget::insert: Can't read file: '%s'", dxfPath.toLatin1().data());
}
}
ui.ivPreview->clear();
// List of all directories that contain part libraries:
- QStringList directoryList = RS_SYSTEM->getDirectoryList("library");
+ QStringList directoryList = SYSTEM->getDirectoryList("library");
QStringList::Iterator it;
QDir itemDir;
QStringList itemPathList;
if (item)
{
// List of all directories that contain part libraries:
- QStringList directoryList = RS_SYSTEM->getDirectoryList("library");
+ QStringList directoryList = SYSTEM->getDirectoryList("library");
QStringList::Iterator it;
QDir itemDir;
QString LibraryWidget::getPathToPixmap(const QString & dir, const QString & dxfFile,
const QString & dxfPath)
{
- RS_DEBUG->print("LibraryWidget::getPathToPixmap: dir: '%s' dxfFile: '%s' dxfPath: '%s'",
+ DEBUG->print("LibraryWidget::getPathToPixmap: dir: '%s' dxfFile: '%s' dxfPath: '%s'",
dir.toLatin1().data(), dxfFile.toLatin1().data(), dxfPath.toLatin1().data());
// List of all directories that contain part libraries:
- QStringList directoryList = RS_SYSTEM->getDirectoryList("library");
- directoryList.prepend(RS_SYSTEM->getHomeDir() + "/.architektonas/library");
+ QStringList directoryList = SYSTEM->getDirectoryList("library");
+ directoryList.prepend(SYSTEM->getHomeDir() + "/.architektonas/library");
QStringList::Iterator it;
QFileInfo fiDxf(dxfPath);
{
itemDir = (*it) + dir;
pngPath = itemDir + "/" + fiDxf.completeBaseName() + ".png";
- RS_DEBUG->print("LibraryWidget::getPathToPixmap: checking: '%s'",
+ DEBUG->print("LibraryWidget::getPathToPixmap: checking: '%s'",
pngPath.toLatin1().data());
QFileInfo fiPng(pngPath);
// the thumbnail exists:
if (fiPng.isFile())
{
- RS_DEBUG->print("LibraryWidget::getPathToPixmap: dxf date: %s, png date: %s",
+ DEBUG->print("LibraryWidget::getPathToPixmap: dxf date: %s, png date: %s",
fiDxf.lastModified().toString().toLatin1().data(), fiPng.lastModified().toString().toLatin1().data());
if (fiPng.lastModified() > fiDxf.lastModified())
{
- RS_DEBUG->print("LibraryWidget::getPathToPixmap: thumbnail found: '%s'",
+ DEBUG->print("LibraryWidget::getPathToPixmap: thumbnail found: '%s'",
pngPath.toLatin1().data());
return pngPath;
}
else
{
- RS_DEBUG->print("LibraryWidget::getPathToPixmap: thumbnail needs to be updated: '%s'",
+ DEBUG->print("LibraryWidget::getPathToPixmap: thumbnail needs to be updated: '%s'",
pngPath.toLatin1().data());
}
}
// The thumbnail must be created in the user's home.
// So, create all directories needed:
- RS_SYSTEM->createHomePath("/.architektonas/library" + dir);
- QString d = RS_SYSTEM->getHomeDir() + "/.architektonas/library" + dir;
+ SYSTEM->createHomePath("/.architektonas/library" + dir);
+ QString d = SYSTEM->getHomeDir() + "/.architektonas/library" + dir;
pngPath = d + "/" + fiDxf.completeBaseName() + ".png";
QPixmap buffer(128, 128);
qpntr.setBackground(Qt::white);
qpntr.eraseRect(0, 0, 128, 128);
- RS_StaticGraphicView view(128, 128, painter);
+ StaticGraphicView view(128, 128, painter);
Drawing drawing;
if (drawing.open(dxfPath, RS2::FormatUnknown))
{
- RS_Color black(0, 0, 0);
+ Color black(0, 0, 0);
// Set all pens in the drawing to BLACK
- for(RS_Entity * e=drawing.firstEntity(RS2::ResolveAll); e!=NULL; e=drawing.nextEntity(RS2::ResolveAll))
+ for(Entity * e=drawing.firstEntity(RS2::ResolveAll); e!=NULL; e=drawing.nextEntity(RS2::ResolveAll))
{
- RS_Pen pen = e->getPen();
+ Pen pen = e->getPen();
pen.setColor(black);
e->setPen(pen);
}
if (!writer.write(image))
{
- RS_DEBUG->print(RS_Debug::D_ERROR,
+ DEBUG->print(Debug::D_ERROR,
"LibraryWidget::getPathToPixmap: Cannot write thumbnail: '%s'",
pngPath.toLatin1().data());
pngPath = "";
}
else
{
- RS_DEBUG->print(RS_Debug::D_ERROR, "LibraryWidget::getPathToPixmap: Cannot open file: '%s'", dxfPath.toLatin1().data());
+ DEBUG->print(Debug::D_ERROR, "LibraryWidget::getPathToPixmap: Cannot open file: '%s'", dxfPath.toLatin1().data());
}
delete painter;
settings.beginGroup("Draw");
if (!action->hasFixedAngle())
- settings.setValue("LineAngleAngle", RS_Math::rad2deg(action->getAngle()));
+ settings.setValue("LineAngleAngle", Math::rad2deg(action->getAngle()));
settings.setValue("LineAngleLength", action->getLength());
settings.setValue("LineAngleSnapPoint", action->getSnapPoint());
// settings from action:
if (update)
{
- sa = QString("%1").arg(RS_Math::rad2deg(action->getAngle()));
+ sa = QString("%1").arg(Math::rad2deg(action->getAngle()));
sl = QString("%1").arg(action->getLength());
sp = action->getSnapPoint();
}
}
else
{
- RS_DEBUG->print(RS_Debug::D_ERROR, "LineAngleOptions::setAction: wrong action type");
+ DEBUG->print(Debug::D_ERROR, "LineAngleOptions::setAction: wrong action type");
this->action = NULL;
}
}
void LineAngleOptions::updateAngle(const QString & a)
{
if (action && !action->hasFixedAngle())
- action->setAngle(RS_Math::deg2rad(RS_Math::eval(a)));
+ action->setAngle(Math::deg2rad(Math::eval(a)));
}
void LineAngleOptions::updateLength(const QString & l)
{
if (action)
- action->setLength(RS_Math::eval(l));
+ action->setLength(Math::eval(l));
}
void LineAngleOptions::updateSnapPoint(int sp)
}
else
{
- RS_DEBUG->print(RS_Debug::D_ERROR, "LineBisectorOptions::setAction: wrong action type");
+ DEBUG->print(Debug::D_ERROR, "LineBisectorOptions::setAction: wrong action type");
action = NULL;
}
}
void LineBisectorOptions::updateLength(const QString & l)
{
if (action != NULL)
- action->setLength(RS_Math::eval(l));
+ action->setLength(Math::eval(l));
}
void LineBisectorOptions::updateNumber(int n)
#include "lineoptions.h"
-#include "rs.h"
+#include "enums.h"
#include "actiondrawline.h"
#include "actioninterface.h"
#include "debug.h"
}
else
{
- RS_DEBUG->print(RS_Debug::D_ERROR, "QG_LineOptions::setAction: wrong action type");
+ DEBUG->print(Debug::D_ERROR, "QG_LineOptions::setAction: wrong action type");
action = NULL;
}
}
}
else
{
- RS_DEBUG->print(RS_Debug::D_ERROR, "LineParallelOptions::setAction: wrong action type");
+ DEBUG->print(Debug::D_ERROR, "LineParallelOptions::setAction: wrong action type");
action = NULL;
}
}
void LineParallelOptions::updateDist(const QString & d)
{
if (action != NULL)
- action->setDistance(RS_Math::eval(d));
+ action->setDistance(Math::eval(d));
}
void LineParallelOptions::updateNumber(int n)
}
else
{
- RS_DEBUG->print(RS_Debug::D_ERROR, "LineParallelThroughOptions::setAction: wrong action type");
+ DEBUG->print(Debug::D_ERROR, "LineParallelThroughOptions::setAction: wrong action type");
action = NULL;
}
}
}
else
{
- RS_DEBUG->print(RS_Debug::D_ERROR, "LinePolygon2Options::setAction: wrong action type");
+ DEBUG->print(Debug::D_ERROR, "LinePolygon2Options::setAction: wrong action type");
action = NULL;
}
}
}
else
{
- RS_DEBUG->print(RS_Debug::D_ERROR, "LinePolygonOptions::setAction: wrong action type");
+ DEBUG->print(Debug::D_ERROR, "LinePolygonOptions::setAction: wrong action type");
action = NULL;
}
}
settings.beginGroup("Draw");
if (!action->hasFixedAngle())
- settings.value("LineRelAngleAngle", RS_Math::rad2deg(action->getAngle()));
+ settings.value("LineRelAngleAngle", Math::rad2deg(action->getAngle()));
settings.value("LineRelAngleLength", action->getLength());
settings.endGroup();
// settings from action:
if (update)
{
- sa = QString("%1").arg(RS_Math::rad2deg(action->getAngle()));
+ sa = QString("%1").arg(Math::rad2deg(action->getAngle()));
sl = QString("%1").arg(action->getLength());
}
// settings from config file:
if (!action->hasFixedAngle())
sa = settings.value("LineRelAngleAngle", "30.0").toString();
else
- sa = QString("%1").arg(RS_Math::rad2deg(action->getAngle()));
+ sa = QString("%1").arg(Math::rad2deg(action->getAngle()));
sl = settings.value("LineRelAngleLength", "10.0").toString();
settings.endGroup();
}
else
{
- RS_DEBUG->print(RS_Debug::D_ERROR,
+ DEBUG->print(Debug::D_ERROR,
"LineRelAngleOptions::setAction: wrong action type");
this->action = NULL;
}
void LineRelAngleOptions::updateAngle(const QString & a)
{
if (action != NULL && !action->hasFixedAngle())
- action->setAngle(RS_Math::deg2rad(RS_Math::eval(a)));
+ action->setAngle(Math::deg2rad(Math::eval(a)));
}
void LineRelAngleOptions::updateLength(const QString & l)
{
if (action != NULL)
- action->setLength(RS_Math::eval(l));
+ action->setLength(Math::eval(l));
}
QString sa;
if (update)
- sa = QString("%1").arg(RS_Math::rad2deg(action->getAngle()));
+ sa = QString("%1").arg(Math::rad2deg(action->getAngle()));
else
{
settings.beginGroup("Modify");
sa = settings.value("MoveRotate", "30").toString();
settings.endGroup();
- action->setAngle(RS_Math::deg2rad(sa.toDouble()));
+ action->setAngle(Math::deg2rad(sa.toDouble()));
}
leAngle->setText(sa);
}
else
{
- RS_DEBUG->print(RS_Debug::D_ERROR, "CircleOptions::setAction: wrong action type");
+ DEBUG->print(Debug::D_ERROR, "CircleOptions::setAction: wrong action type");
action = NULL;
}
}
void MoveRotateOptions::updateAngle(const QString & a)
{
if (action != NULL)
- action->setAngle(RS_Math::deg2rad(RS_Math::eval(a)));
+ action->setAngle(Math::deg2rad(Math::eval(a)));
}
#include "printpreviewoptions.h"
-#include "rs.h"
+#include "enums.h"
#include "actioninterface.h"
#include "actionprintpreview.h"
#include "debug.h"
QString sAngle;
QString sFactor;
if (update) {
- sAngle = QString("%1").arg(RS_Math::rad2deg(action->getAngle()));
+ sAngle = QString("%1").arg(Math::rad2deg(action->getAngle()));
sFactor = QString("%1").arg(action->getFactor());
} else {
RS_SETTINGS->beginGroup("/PrintPreview");
}
else
{
- RS_DEBUG->print(RS_Debug::D_ERROR, "QG_PrintPreviewOptions::setAction: wrong action type");
+ DEBUG->print(Debug::D_ERROR, "QG_PrintPreviewOptions::setAction: wrong action type");
action = NULL;
}
}
if (action != NULL)
{
/*
- action->setAngle(RS_Math::deg2rad(RS_Math::eval(leAngle->text())));
- action->setFactor(RS_Math::eval(leFactor->text()));
+ action->setAngle(Math::deg2rad(Math::eval(leAngle->text())));
+ action->setFactor(Math::eval(leFactor->text()));
*/
}
}
else
{
bool ok = false;
- double f = RS_Math::eval(s, &ok);
+ double f = Math::eval(s, &ok);
if (ok)
action->setScale(f);
}
else
{
- RS_DEBUG->print(RS_Debug::D_ERROR, "LineParallelOptions::setAction: wrong action type");
+ DEBUG->print(Debug::D_ERROR, "LineParallelOptions::setAction: wrong action type");
action = NULL;
}
}
if (action != NULL)
{
action->setTrim(cbTrim->isChecked());
- action->setRadius(RS_Math::eval(leRadius->text()));
+ action->setRadius(Math::eval(leRadius->text()));
}
}
void SnapDistOptions::updateDist(const QString & d)
{
if (dist)
- *dist = RS_Math::eval(d, 1.0);
+ *dist = Math::eval(d, 1.0);
}
}
else
{
- RS_DEBUG->print(RS_Debug::D_ERROR, "SplineOptions::setAction: wrong action type");
+ DEBUG->print(Debug::D_ERROR, "SplineOptions::setAction: wrong action type");
action = NULL;
}
}
if (update)
{
st = action->getText();
- sa = QString("%1").arg(RS_Math::rad2deg(action->getAngle()));
+ sa = QString("%1").arg(Math::rad2deg(action->getAngle()));
}
else
{
}
else
{
- RS_DEBUG->print(RS_Debug::D_ERROR, "TextOptions::setAction: wrong action type");
+ DEBUG->print(Debug::D_ERROR, "TextOptions::setAction: wrong action type");
action = NULL;
}
}
void TextOptions::updateAngle()
{
if (action != NULL)
- action->setAngle(RS_Math::deg2rad(RS_Math::eval(ui.leAngle->text())));
+ action->setAngle(Math::deg2rad(Math::eval(ui.leAngle->text())));
}
}
else
{
- RS_DEBUG->print(RS_Debug::D_ERROR, "ModifyTrimAmountOptions::setAction: wrong action type");
+ DEBUG->print(Debug::D_ERROR, "ModifyTrimAmountOptions::setAction: wrong action type");
this->action = NULL;
}
}
void TrimAmountOptions::updateDist(const QString & d)
{
if (action != NULL)
- action->setDistance(RS_Math::eval(d, 1.0));
+ action->setDistance(Math::eval(d, 1.0));
}
{
}
-void WidgetPen::setPen(RS_Pen pen, bool showByLayer, bool showUnchanged, const QString & title)
+void WidgetPen::setPen(Pen pen, bool showByLayer, bool showUnchanged, const QString & title)
{
ui.cbColor->init(showByLayer, showUnchanged);
ui.cbWidth->init(showByLayer, showUnchanged);
ui.bgPen->setTitle(title);
}
-RS_Pen WidgetPen::getPen()
+Pen WidgetPen::getPen()
{
- RS_Pen pen;
+ Pen pen;
pen.setColor(ui.cbColor->getColor());
pen.setWidth(ui.cbWidth->getWidth());
bool isWidthUnchanged();
public slots:
- void setPen(RS_Pen pen, bool showByLayer, bool showUnchanged, const QString & title);
- RS_Pen getPen();
+ void setPen(Pen pen, bool showByLayer, bool showUnchanged, const QString & title);
+ Pen getPen();
private:
Ui::WidgetPen ui;
// Q3MainWindow(0, "", Qt::WDestructiveClose), QG_MainWindowInterface()
QMainWindow((QWidget *)NULL/*,this is not a Qt::WindowFlags --> Qt::WA_DeleteOnClose*/), QG_MainWindowInterface()
{
- RS_DEBUG->print("ApplicationWindow::ApplicationWindow");
+ DEBUG->print("ApplicationWindow::ApplicationWindow");
appWindow = this;
//no assistant = NULL;
workspace = NULL;
- RS_DEBUG->print("ApplicationWindow::ApplicationWindow: setting icon");
+ DEBUG->print("ApplicationWindow::ApplicationWindow: setting icon");
// setIcon(qPixmapFromMimeSource(QC_APP_ICON));
// setWindowIcon(qPixmapFromMimeSource(QC_APP_ICON));
setWindowIcon(QIcon(":/res/" QC_APP_ICON));
CreateQtActions(this);
- RS_DEBUG->print("ApplicationWindow::ApplicationWindow: creating action handler");
+ DEBUG->print("ApplicationWindow::ApplicationWindow: creating action handler");
actionHandler = new ActionHandler(this);
- RS_DEBUG->print("ApplicationWindow::ApplicationWindow: creating action handler: OK");
+ DEBUG->print("ApplicationWindow::ApplicationWindow: creating action handler: OK");
-#ifdef RS_SCRIPTING
- RS_DEBUG->print("ApplicationWindow::ApplicationWindow: creating scripter");
+#ifdef SCRIPTING
+ DEBUG->print("ApplicationWindow::ApplicationWindow: creating scripter");
scripter = new QS_Scripter(this, this);
- RS_DEBUG->print("ApplicationWindow::ApplicationWindow: creating scripter: OK");
+ DEBUG->print("ApplicationWindow::ApplicationWindow: creating scripter: OK");
#endif
- RS_DEBUG->print("ApplicationWindow::ApplicationWindow: init view");
+ DEBUG->print("ApplicationWindow::ApplicationWindow: init view");
initView();
- RS_DEBUG->print("ApplicationWindow::ApplicationWindow: init toolbar");
+ DEBUG->print("ApplicationWindow::ApplicationWindow: init toolbar");
initToolBar();
- RS_DEBUG->print("ApplicationWindow::ApplicationWindow: init actions");
+ DEBUG->print("ApplicationWindow::ApplicationWindow: init actions");
initActions();
- RS_DEBUG->print("ApplicationWindow::ApplicationWindow: init menu bar");
+ DEBUG->print("ApplicationWindow::ApplicationWindow: init menu bar");
initMenuBar();
- RS_DEBUG->print("ApplicationWindow::ApplicationWindow: init status bar");
+ DEBUG->print("ApplicationWindow::ApplicationWindow: init status bar");
initStatusBar();
- RS_DEBUG->print("ApplicationWindow::ApplicationWindow: creating dialogFactory");
+ DEBUG->print("ApplicationWindow::ApplicationWindow: creating dialogFactory");
dialogFactory = new QC_DialogFactory(this, optionWidget);
- RS_DEBUG->print("ApplicationWindow::ApplicationWindow: creating dialogFactory: OK");
- RS_DEBUG->print("setting dialog factory object");
+ DEBUG->print("ApplicationWindow::ApplicationWindow: creating dialogFactory: OK");
+ DEBUG->print("setting dialog factory object");
- if (RS_DialogFactory::instance() == NULL)
- RS_DEBUG->print("no RS_DialogFactory instance");
+ if (DialogFactory::instance() == NULL)
+ DEBUG->print("no DialogFactory instance");
else
- RS_DEBUG->print("got RS_DialogFactory instance");
+ DEBUG->print("got DialogFactory instance");
- RS_DialogFactory::instance()->setFactoryObject(dialogFactory);
- RS_DEBUG->print("setting dialog factory object: OK");
+ DialogFactory::instance()->setFactoryObject(dialogFactory);
+ DEBUG->print("setting dialog factory object: OK");
- RS_DEBUG->print("ApplicationWindow::ApplicationWindow: init settings");
+ DEBUG->print("ApplicationWindow::ApplicationWindow: init settings");
initSettings();
- RS_DEBUG->print("ApplicationWindow::ApplicationWindow: init MDI");
+ DEBUG->print("ApplicationWindow::ApplicationWindow: init MDI");
initMDI();
// Disable menu and toolbar items
*/
ApplicationWindow::~ApplicationWindow()
{
- RS_DEBUG->print("ApplicationWindow::~ApplicationWindow");
-#ifdef RS_SCRIPTING
- RS_DEBUG->print("ApplicationWindow::~ApplicationWindow: deleting scripter");
+ DEBUG->print("ApplicationWindow::~ApplicationWindow");
+#ifdef SCRIPTING
+ DEBUG->print("ApplicationWindow::~ApplicationWindow: deleting scripter");
delete scripter;
- RS_DEBUG->print("ApplicationWindow::~ApplicationWindow: deleting scripter: OK");
+ DEBUG->print("ApplicationWindow::~ApplicationWindow: deleting scripter: OK");
#endif
- RS_DEBUG->print("ApplicationWindow::~ApplicationWindow: deleting action handler");
+ DEBUG->print("ApplicationWindow::~ApplicationWindow: deleting action handler");
delete actionHandler;
- RS_DEBUG->print("ApplicationWindow::~ApplicationWindow: deleting action handler: OK");
+ DEBUG->print("ApplicationWindow::~ApplicationWindow: deleting action handler: OK");
- RS_DEBUG->print("ApplicationWindow::~ApplicationWindow: deleting dialog factory");
+ DEBUG->print("ApplicationWindow::~ApplicationWindow: deleting dialog factory");
delete dialogFactory;
- RS_DEBUG->print("ApplicationWindow::~ApplicationWindow: deleting dialog factory: OK");
+ DEBUG->print("ApplicationWindow::~ApplicationWindow: deleting dialog factory: OK");
-//no RS_DEBUG->print("ApplicationWindow::~ApplicationWindow: "
+//no DEBUG->print("ApplicationWindow::~ApplicationWindow: "
// "deleting assistant..");
// if (assistant!=NULL) {
// delete assistant;
// }
-// RS_DEBUG->print("ApplicationWindow::~ApplicationWindow: "
+// DEBUG->print("ApplicationWindow::~ApplicationWindow: "
// "deleting assistant: OK");
- RS_DEBUG->print("ApplicationWindow::~ApplicationWindow: OK");
+ DEBUG->print("ApplicationWindow::~ApplicationWindow: OK");
}
/**
*/
void ApplicationWindow::slotRunScript()
{
- RS_DEBUG->print("ApplicationWindow::slotRunScript");
+ DEBUG->print("ApplicationWindow::slotRunScript");
const QObject * s = sender();
if (s != NULL)
{
QString script = ((QAction *)s)->text();
- RS_DEBUG->print("ApplicationWindow::slotRunScript: %s", script.toLatin1().data());
+ DEBUG->print("ApplicationWindow::slotRunScript: %s", script.toLatin1().data());
slotRunScript(script);
}
}
*/
void ApplicationWindow::slotRunScript(const QString & name)
{
-#ifdef RS_SCRIPTING
- RS_DEBUG->print("ApplicationWindow::slotRunScript");
+#ifdef SCRIPTING
+ DEBUG->print("ApplicationWindow::slotRunScript");
if (scripter == NULL)
{
- RS_DEBUG->print(RS_Debug::D_WARNING, "ApplicationWindow::slotRunScript: scripter not initialized");
+ DEBUG->print(Debug::D_WARNING, "ApplicationWindow::slotRunScript: scripter not initialized");
return;
}
statusBar()->showMessage(tr("Running script '%1'").arg(name), 2000);
- QStringList scriptList = RS_SYSTEM->getScriptList();
- scriptList.append(RS_SYSTEM->getHomeDir() + "/.architektonas/" + name);
+ QStringList scriptList = SYSTEM->getScriptList();
+ scriptList.append(SYSTEM->getHomeDir() + "/.architektonas/" + name);
for (QStringList::Iterator it = scriptList.begin(); it!=scriptList.end(); ++it)
{
- RS_DEBUG->print("ApplicationWindow::slotRunScript: checking script '%s'", (*it).toLatin1().data();
+ DEBUG->print("ApplicationWindow::slotRunScript: checking script '%s'", (*it).toLatin1().data();
QFileInfo fi(*it);
if (fi.exists() && fi.fileName() == name)
{
- RS_DEBUG->print("ApplicationWindow::slotRunScript: running '%s'", (*it).toLatin1().data());
+ DEBUG->print("ApplicationWindow::slotRunScript: running '%s'", (*it).toLatin1().data());
scripter->runScript(*it, "main");
}
}
if (s != NULL)
{
QString block = ((QAction *)s)->text();
- RS_DEBUG->print("ApplicationWindow::slotInsertBlock: %s", block.toLatin1().data());
+ DEBUG->print("ApplicationWindow::slotInsertBlock: %s", block.toLatin1().data());
slotInsertBlock(block);
}
}
*/
void ApplicationWindow::slotInsertBlock(const QString & name)
{
- RS_DEBUG->print("ApplicationWindow::slotInsertBlock: '%s'", name.toLatin1().data());
+ DEBUG->print("ApplicationWindow::slotInsertBlock: '%s'", name.toLatin1().data());
statusBar()->showMessage(tr("Inserting block '%1'").arg(name), 2000);
GraphicView * graphicView = getGraphicView();
- RS_Document * document = getDocument();
+ Document * document = getDocument();
if (graphicView && document)
{
*/
void ApplicationWindow::closeEvent(QCloseEvent * /*ce*/)
{
- RS_DEBUG->print("ApplicationWindow::closeEvent()");
+ DEBUG->print("ApplicationWindow::closeEvent()");
slotFileQuit();
- RS_DEBUG->print("ApplicationWindow::closeEvent(): OK");
+ DEBUG->print("ApplicationWindow::closeEvent(): OK");
}
/**
*/
void ApplicationWindow::initMDI()
{
- RS_DEBUG->print("ApplicationWindow::initMDI() begin");
+ DEBUG->print("ApplicationWindow::initMDI() begin");
/* Could use QVBoxLayout instead of Q3VBox, but do we even need to? */
// Q3VBox * vb = new Q3VBox(this);
// workspace->setScrollBarsEnabled(true);
// setCentralWidget(vb);
setCentralWidget(workspace);//JLH:hmm. (Yes, it works! \o/)
- RS_DEBUG->print("ApplicationWindow::initMDI(): workspace=%08X", workspace);
+ DEBUG->print("ApplicationWindow::initMDI(): workspace=%08X", workspace);
//#warning "Object::connect: No such signal QMdiArea::windowActivated(QWidget *)"
// connect(workspace, SIGNAL(windowActivated(QWidget *)), this, SLOT(slotWindowActivated(QWidget *)));
connect(workspace, SIGNAL(subWindowActivated(QMdiSubWindow *)), this,
SLOT(slotWindowActivated(QMdiSubWindow *)));
- RS_DEBUG->print("ApplicationWindow::initMDI() end");
+ DEBUG->print("ApplicationWindow::initMDI() end");
}
/**
*/
void ApplicationWindow::initActions()
{
- RS_DEBUG->print("ApplicationWindow::initActions()");
+ DEBUG->print("ApplicationWindow::initActions()");
//
// File actions:
addToolBar(Qt::TopToolBarArea, (QToolBar *)penToolBar); // hmm.
addToolBar(Qt::TopToolBarArea, optionWidget);
-#ifdef RS_SCRIPTING
+#ifdef SCRIPTING
// Scripts menu:
//
scriptMenu = new QMenu(this);
*/
void ApplicationWindow::initMenuBar()
{
- RS_DEBUG->print("ApplicationWindow::initMenuBar()");
+ DEBUG->print("ApplicationWindow::initMenuBar()");
// menuBar entry windowsMenu
windowsMenu = new QMenu(tr("&Window"), this);
testMenu->addAction(testResize1024);//testResize1024->addTo(testMenu);
// menuBar configuration
-#ifdef RS_SCRIPTING
+#ifdef SCRIPTING
// menuBar()->insertItem(tr("&Scripts"), scriptMenu);
menuBar()->addMenu(scriptMenu);
#endif
*/
void ApplicationWindow::initToolBar()
{
- RS_DEBUG->print("ApplicationWindow::initToolBar()");
+ DEBUG->print("ApplicationWindow::initToolBar()");
// fileToolBar = new Q3ToolBar(this, "File Operations");
fileToolBar = addToolBar(tr("File Operations"));
penToolBar = new PenToolBar(this, "Pen Selection");
penToolBar->setObjectName("pen");
- connect(penToolBar, SIGNAL(penChanged(RS_Pen)), this, SLOT(slotPenChanged(RS_Pen)));
+ connect(penToolBar, SIGNAL(penChanged(Pen)), this, SLOT(slotPenChanged(Pen)));
// optionWidget = new Q3ToolBar(this, "Tool Options");
//addToolBarBreak() does nothing...
*/
void ApplicationWindow::initStatusBar()
{
- RS_DEBUG->print("ApplicationWindow::initStatusBar()");
+ DEBUG->print("ApplicationWindow::initStatusBar()");
statusBar()->setMinimumHeight(32);
coordinateWidget = new CoordinateWidget(statusBar());//, "coordinates");
*/
void ApplicationWindow::initSettings()
{
- RS_DEBUG->print("ApplicationWindow::initSettings()");
+ DEBUG->print("ApplicationWindow::initSettings()");
settings.beginGroup("RecentFiles");
for(int i=0; i<recentFiles->Maximum(); ++i)
*/
void ApplicationWindow::storeSettings()
{
- RS_DEBUG->print("ApplicationWindow::storeSettings()");
+ DEBUG->print("ApplicationWindow::storeSettings()");
settings.beginGroup("RecentFiles");
settings.setValue("DockWindows", saveState());
settings.endGroup();
- RS_DEBUG->print("ApplicationWindow::storeSettings(): OK");
+ DEBUG->print("ApplicationWindow::storeSettings(): OK");
}
/**
*/
void ApplicationWindow::initView()
{
- RS_DEBUG->print("ApplicationWindow::initView()");
+ DEBUG->print("ApplicationWindow::initView()");
- RS_DEBUG->print("init view..");
+ DEBUG->print("init view..");
QDockWidget * dw;
layerWidget = NULL;
blockWidget = NULL;
#endif
#ifdef RS_CAM
- RS_DEBUG->print(" simulation widget..");
+ DEBUG->print(" simulation widget..");
dw = new QDockWidget(QDockWidget::InDock, this, "Simulation");
simulationControls = new RS_SimulationControls(dw, "Simulation");
simulationControls->setFocusPolicy(Qt::NoFocus);
//simulationDockWindow->hide();
#endif
- RS_DEBUG->print(" layer widget..");
+ DEBUG->print(" layer widget..");
// dw = new QDockWidget(QDockWidget::InDock, this, "Layer");
dw = new QDockWidget(tr("Layer List"), this);
dw->setObjectName("layer");
addDockWidget(Qt::RightDockWidgetArea, dw);
layerDockWindow = dw;
- RS_DEBUG->print(" block widget..");
+ DEBUG->print(" block widget..");
// dw = new QDockWidget(QDockWidget::InDock, this, "Block");
dw = new QDockWidget(tr("Block List"), this);
dw->setObjectName("block");
addDockWidget(Qt::RightDockWidgetArea, dw);
blockDockWindow = dw;
- RS_DEBUG->print(" library widget..");
+ DEBUG->print(" library widget..");
// dw = new QDockWidget(QDockWidget::OutsideDock, this, "Library");
dw = new QDockWidget(tr("Library Browser"), this);
dw->setObjectName("library");
libraryDockWindow = dw;
// libraryDockWindow->hide();
- RS_DEBUG->print(" command widget..");
+ DEBUG->print(" command widget..");
// dw = new QDockWidget(QDockWidget::InDock, this, "Command");
dw = new QDockWidget(tr("Command line"), this);
dw->setObjectName("command");
commandDockWindow = dw;
addDockWidget(Qt::BottomDockWidgetArea, dw);
- RS_DEBUG->print(" done");
+ DEBUG->print(" done");
}
/**
*/
void ApplicationWindow::slotWindowActivated(QMdiSubWindow * /*w*/)
{
- RS_DEBUG->print("ApplicationWindow::slotWindowActivated begin");
+ DEBUG->print("ApplicationWindow::slotWindowActivated begin");
//the following does: return (MDIWindow *)workspace->activeSubWindow();
//which means the subwindow is NOT being activated!!!
MDIWindow * m = getMDIWindow();
- RS_DEBUG->print(/*RS_Debug::D_CRITICAL,*/ "ApplicationWindow::slotWindowActivated m=%08X", m);
+ DEBUG->print(/*Debug::D_CRITICAL,*/ "ApplicationWindow::slotWindowActivated m=%08X", m);
if (m)
- RS_DEBUG->print(/*RS_Debug::D_CRITICAL,*/ "ApplicationWindow::slotWindowActivated m->getDoc=%08X", m->getDocument());
+ DEBUG->print(/*Debug::D_CRITICAL,*/ "ApplicationWindow::slotWindowActivated m->getDoc=%08X", m->getDocument());
if (m && m->getDocument())
{
//m->setWindowState(WindowMaximized);
- RS_DEBUG->print("ApplicationWindow::slotWindowActivated: document: %d", m->getDocument()->getId());
+ DEBUG->print("ApplicationWindow::slotWindowActivated: document: %d", m->getDocument()->getId());
bool showByBlock = m->getDocument()->rtti() == RS2::EntityBlock;
layerWidget->setLayerList(m->getDocument()->getLayerList(), showByBlock);
// Disable/Enable menu and toolbar items
emit windowsChanged(m != NULL && m->getDocument() != NULL);
- RS_DEBUG->print("ApplicationWindow::slotWindowActivated end");
+ DEBUG->print("ApplicationWindow::slotWindowActivated end");
}
/**
*/
void ApplicationWindow::slotWindowsMenuAboutToShow()
{
- RS_DEBUG->print("ApplicationWindow::slotWindowsMenuAboutToShow");
+ DEBUG->print("ApplicationWindow::slotWindowsMenuAboutToShow");
windowsMenu->clear();
#if 0
*/
void ApplicationWindow::slotWindowsMenuActivated(QAction * id)
{
- RS_DEBUG->print("ApplicationWindow::slotWindowsMenuActivated");
+ DEBUG->print("ApplicationWindow::slotWindowsMenuActivated");
// QMdiSubWindow * w = workspace->subWindowList().at(id);
QMdiSubWindow * w = workspace->subWindowList().at(id->data().toInt());
*/
void ApplicationWindow::slotTileHorizontal()
{
- RS_DEBUG->print("ApplicationWindow::slotTileHorizontal");
+ DEBUG->print("ApplicationWindow::slotTileHorizontal");
#if 0
// primitive horizontal tiling
void ApplicationWindow::slotCamExportAuto() {
printf("CAM export..\n");
- RS_Document* d = getDocument();
+ Document* d = getDocument();
if (d!=NULL) {
Drawing* graphic = (Drawing*)d;
* Called when something changed in the pen tool bar
* (e.g. color, width, style).
*/
-void ApplicationWindow::slotPenChanged(RS_Pen pen)
+void ApplicationWindow::slotPenChanged(Pen pen)
{
- RS_DEBUG->print("ApplicationWindow::slotPenChanged() begin");
- RS_DEBUG->print("Setting active pen...");
+ DEBUG->print("ApplicationWindow::slotPenChanged() begin");
+ DEBUG->print("Setting active pen...");
MDIWindow * m = getMDIWindow();
if (m != NULL)
m->slotPenChanged(pen);
- RS_DEBUG->print("ApplicationWindow::slotPenChanged() end");
+ DEBUG->print("ApplicationWindow::slotPenChanged() end");
}
/**
* Creates a new MDI window with the given document or a new
* document if 'doc' is NULL.
*/
-MDIWindow * ApplicationWindow::slotFileNew(RS_Document * doc)
+MDIWindow * ApplicationWindow::slotFileNew(Document * doc)
{
- RS_DEBUG->print("ApplicationWindow::slotFileNew() begin");
+ DEBUG->print("ApplicationWindow::slotFileNew() begin");
static int id = 0;
id++;
statusBar()->showMessage(tr("Creating new file..."));
#warning "QWidget::setMinimumSize: (/QMdi::ControlLabel) Negative sizes (-1,-1) are not possible"
- RS_DEBUG->print(" creating MDI window");
+ DEBUG->print(" creating MDI window");
// MDIWindow * w = new MDIWindow(doc, workspace, 0, Qt::WA_DeleteOnClose);
MDIWindow * w = new MDIWindow(doc, workspace, 0, Qt::SubWindow);
w->setAttribute(Qt::WA_DeleteOnClose);
connect(w, SIGNAL(signalClosing()), this, SLOT(slotFileClosing()));
if (w->getDocument()->rtti() == RS2::EntityBlock)
-// w->setCaption(tr("Block '%1'").arg(((RS_Block *)(w->getDocument()))->getName()));
- w->setWindowTitle(tr("Block '%1'").arg(((RS_Block *)(w->getDocument()))->getName()));
+// w->setCaption(tr("Block '%1'").arg(((Block *)(w->getDocument()))->getName()));
+ w->setWindowTitle(tr("Block '%1'").arg(((Block *)(w->getDocument()))->getName()));
else
// w->setCaption(tr("unnamed document %1").arg(id));
w->setWindowTitle(tr("unnamed document %1").arg(id));
w->setWindowIcon(QIcon(":/res/document.png"));
// only graphics offer block lists, blocks don't
- RS_DEBUG->print(" adding listeners");
+ DEBUG->print(" adding listeners");
Drawing * graphic = w->getDocument()->getGraphic();
#if 0
QG_DIALOGFACTORY->setMainWindow(this);
#if 1 //bugfix for Qt3->4 conversion
- RS_DEBUG->print(/*RS_Debug::D_CRITICAL,*/ "ApplicationWindow::slotFileNew: adding window to workspace...");
+ DEBUG->print(/*Debug::D_CRITICAL,*/ "ApplicationWindow::slotFileNew: adding window to workspace...");
// workspace->addWindow(w);
workspace->addSubWindow(w);
#endif
- RS_DEBUG->print(" showing MDI window");
+ DEBUG->print(" showing MDI window");
#if 0
#warning "w->showMaximized() doesn't seem to do anything here..."
slotWindowActivated(w);
statusBar()->showMessage(tr("New Drawing created."), 2000);
- RS_DEBUG->print("ApplicationWindow::slotFileNew() OK");
+ DEBUG->print("ApplicationWindow::slotFileNew() OK");
setFocus();
return w;
*/
void ApplicationWindow::slotFileOpen()
{
- RS_DEBUG->print("ApplicationWindow::slotFileOpen()");
+ DEBUG->print("ApplicationWindow::slotFileOpen()");
- RS_DEBUG->print("ApplicationWindow::slotFileOpen() 001");
+ DEBUG->print("ApplicationWindow::slotFileOpen() 001");
RS2::FormatType type = RS2::FormatUnknown;
- RS_DEBUG->print("ApplicationWindow::slotFileOpen() 002");
+ DEBUG->print("ApplicationWindow::slotFileOpen() 002");
QString fileName = FileDialog::getOpenFileName(this, &type);
- RS_DEBUG->print("ApplicationWindow::slotFileOpen() 003");
+ DEBUG->print("ApplicationWindow::slotFileOpen() 003");
slotFileOpen(fileName, type);
- RS_DEBUG->print("ApplicationWindow::slotFileOpen(): OK");
+ DEBUG->print("ApplicationWindow::slotFileOpen(): OK");
}
/**
void ApplicationWindow::slotFileOpenRecent(void)
{
#if 0
- RS_DEBUG->print("ApplicationWindow::slotFileOpenRecent()");
+ DEBUG->print("ApplicationWindow::slotFileOpenRecent()");
statusBar()->showMessage(tr("Opening recent file..."));
QString fileName = recentFiles->get(id);
*/
void ApplicationWindow::slotFileOpen(const QString & fileName, RS2::FormatType type)
{
- RS_DEBUG->print("ApplicationWindow::slotFileOpen(..)");
+ DEBUG->print("ApplicationWindow::slotFileOpen(..)");
QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
if (!fileName.isEmpty())
{
- RS_DEBUG->print("ApplicationWindow::slotFileOpen: creating new doc window");
+ DEBUG->print("ApplicationWindow::slotFileOpen: creating new doc window");
// Create new document window:
MDIWindow * w = slotFileNew();
- RS_DEBUG->print("ApplicationWindow::slotFileOpen: linking layer list");
+ DEBUG->print("ApplicationWindow::slotFileOpen: linking layer list");
// link the layer widget to the new document:
layerWidget->setLayerList(w->getDocument()->getLayerList(), false);
// link the block widget to the new document:
// link the layer widget to the new document:
simulationControls->setGraphicView(w->getGraphicView());
#endif
- RS_DEBUG->print("ApplicationWindow::slotFileOpen: open file");
+ DEBUG->print("ApplicationWindow::slotFileOpen: open file");
// Open the file in the new view:
if (!w->slotFileOpen(fileName, type))
return;
}
- RS_DEBUG->print("ApplicationWindow::slotFileOpen: open file: OK");
- RS_DEBUG->print("ApplicationWindow::slotFileOpen: update recent file menu: 1");
+ DEBUG->print("ApplicationWindow::slotFileOpen: open file: OK");
+ DEBUG->print("ApplicationWindow::slotFileOpen: update recent file menu: 1");
// update recent files menu:
if (type == RS2::FormatDXF1)
else
recentFiles->add(fileName);
- RS_DEBUG->print("ApplicationWindow::slotFileOpen: update recent file menu: 2");
+ DEBUG->print("ApplicationWindow::slotFileOpen: update recent file menu: 2");
recentFiles->UpdateGUI();
- RS_DEBUG->print("ApplicationWindow::slotFileOpen: update recent file menu: OK");
- RS_DEBUG->print("ApplicationWindow::slotFileOpen: set caption");
+ DEBUG->print("ApplicationWindow::slotFileOpen: update recent file menu: OK");
+ DEBUG->print("ApplicationWindow::slotFileOpen: set caption");
// update caption:
w->setWindowTitle(fileName);
- RS_DEBUG->print("ApplicationWindow::slotFileOpen: set caption: OK");
- RS_DEBUG->print("ApplicationWindow::slotFileOpen: update coordinate widget");
+ DEBUG->print("ApplicationWindow::slotFileOpen: set caption: OK");
+ DEBUG->print("ApplicationWindow::slotFileOpen: update coordinate widget");
// update coordinate widget format:
- RS_DIALOGFACTORY->updateCoordinateWidget(Vector(0.0, 0.0), Vector(0.0, 0.0), true);
- RS_DEBUG->print("ApplicationWindow::slotFileOpen: update coordinate widget: OK");
+ DIALOGFACTORY->updateCoordinateWidget(Vector(0.0, 0.0), Vector(0.0, 0.0), true);
+ DEBUG->print("ApplicationWindow::slotFileOpen: update coordinate widget: OK");
// Update the layer and block widgets (document just loaded may have some)
layerWidget->update();
blockWidget->update();
}
QApplication::restoreOverrideCursor();
- RS_DEBUG->print("ApplicationWindow::slotFileOpen(..) OK");
+ DEBUG->print("ApplicationWindow::slotFileOpen(..) OK");
}
/**
*/
void ApplicationWindow::slotFileSave()
{
- RS_DEBUG->print("ApplicationWindow::slotFileSave()");
+ DEBUG->print("ApplicationWindow::slotFileSave()");
statusBar()->showMessage(tr("Saving drawing..."));
*/
void ApplicationWindow::slotFileSaveAs()
{
- RS_DEBUG->print("ApplicationWindow::slotFileSaveAs()");
+ DEBUG->print("ApplicationWindow::slotFileSaveAs()");
statusBar()->showMessage(tr("Saving drawing under new filename..."));
*/
void ApplicationWindow::slotFileExport()
{
- RS_DEBUG->print("ApplicationWindow::slotFileExport()");
+ DEBUG->print("ApplicationWindow::slotFileExport()");
statusBar()->showMessage(tr("Exporting drawing..."));
MDIWindow * w = getMDIWindow();
QString fn;
// read default settings:
settings.beginGroup("Paths");
- QString defDir = settings.value("ExportImage", RS_SYSTEM->getHomeDir()).toString();
+ QString defDir = settings.value("ExportImage", SYSTEM->getHomeDir()).toString();
QString defFilter = settings.value("ExportImageFilter", "Portable Network Graphic (*.png)").toString();
settings.endGroup();
if (!w)
{
- RS_DEBUG->print(RS_Debug::D_WARNING, "ApplicationWindow::slotFileExport: no window opened");
+ DEBUG->print(Debug::D_WARNING, "ApplicationWindow::slotFileExport: no window opened");
return false;
}
if (!graphic)
{
- RS_DEBUG->print(RS_Debug::D_WARNING, "ApplicationWindow::slotFileExport: no graphic");
+ DEBUG->print(Debug::D_WARNING, "ApplicationWindow::slotFileExport: no graphic");
return false;
}
// black background:
if (black)
-// painter->setBackgroundColor(RS_Color(0, 0, 0));
-// qpntr.setBackgroundColor(RS_Color(0, 0, 0));
+// painter->setBackgroundColor(Color(0, 0, 0));
+// qpntr.setBackgroundColor(Color(0, 0, 0));
qpntr.setBackground(QBrush(QColor(0, 0, 0)));
// white background:
else
-// painter->setBackgroundColor(RS_Color(255, 255, 255));
-// qpntr.setBackgroundColor(RS_Color(255, 255, 255));
+// painter->setBackgroundColor(Color(255, 255, 255));
+// qpntr.setBackgroundColor(Color(255, 255, 255));
qpntr.setBackground(QBrush(QColor(255, 255, 255)));
// black/white:
// painter->eraseRect(0, 0, size.width(), size.height());
qpntr.eraseRect(0, 0, size.width(), size.height());
- RS_StaticGraphicView gv(size.width(), size.height(), painter);
+ StaticGraphicView gv(size.width(), size.height(), painter);
if (black)
- gv.setBackground(RS_Color(0, 0, 0));
+ gv.setBackground(Color(0, 0, 0));
else
- gv.setBackground(RS_Color(255, 255, 255));
+ gv.setBackground(Color(255, 255, 255));
gv.setContainer(graphic);
gv.zoomAuto(false);
*/
void ApplicationWindow::slotFileClose()
{
- RS_DEBUG->print("ApplicationWindow::slotFileClose()");
+ DEBUG->print("ApplicationWindow::slotFileClose()");
MDIWindow * m = getMDIWindow();
*/
void ApplicationWindow::slotFileClosing()
{
- RS_DEBUG->print("ApplicationWindow::slotFileClosing()");
+ DEBUG->print("ApplicationWindow::slotFileClosing()");
- RS_DEBUG->print("detaching lists");
+ DEBUG->print("detaching lists");
layerWidget->setLayerList(NULL, false);
blockWidget->setBlockList(NULL);
coordinateWidget->setGraphic(NULL);
*/
void ApplicationWindow::slotFilePrint()
{
- RS_DEBUG->print("ApplicationWindow::slotFilePrint()");
+ DEBUG->print("ApplicationWindow::slotFilePrint()");
MDIWindow * w = getMDIWindow();
if (w == NULL)
{
- RS_DEBUG->print(RS_Debug::D_WARNING, "ApplicationWindow::slotFilePrint: no window opened");
+ DEBUG->print(Debug::D_WARNING, "ApplicationWindow::slotFilePrint: no window opened");
return;
}
if (graphic == NULL)
{
- RS_DEBUG->print(RS_Debug::D_WARNING, "ApplicationWindow::slotFilePrint: no graphic");
+ DEBUG->print(Debug::D_WARNING, "ApplicationWindow::slotFilePrint: no graphic");
return;
}
PaintInterface * painter = new PaintInterface(&qpntr);
painter->setDrawingMode(w->getGraphicView()->getDrawingMode());
-// RS_StaticGraphicView gv(metr.width(), metr.height(), painter);
- RS_StaticGraphicView gv(printer->width(), printer->height(), painter);
+// StaticGraphicView gv(metr.width(), metr.height(), painter);
+ StaticGraphicView gv(printer->width(), printer->height(), painter);
gv.setPrinting(true);
gv.setBorders(0, 0, 0, 0);
-// double fx = (double)metr.width() / metr.widthMM() * RS_Units::getFactorToMM(graphic->getUnit());
-// double fy = (double)metr.height() / metr.heightMM() * RS_Units::getFactorToMM(graphic->getUnit());
- double fx = (double)printer->width() / printer->widthMM() * RS_Units::getFactorToMM(graphic->getUnit());
- double fy = (double)printer->height() / printer->heightMM() * RS_Units::getFactorToMM(graphic->getUnit());
+// double fx = (double)metr.width() / metr.widthMM() * Units::getFactorToMM(graphic->getUnit());
+// double fy = (double)metr.height() / metr.heightMM() * Units::getFactorToMM(graphic->getUnit());
+ double fx = (double)printer->width() / printer->widthMM() * Units::getFactorToMM(graphic->getUnit());
+ double fy = (double)printer->height() / printer->heightMM() * Units::getFactorToMM(graphic->getUnit());
double f = (fx + fy) / 2;
double scale = graphic->getPaperScale();
*/
void ApplicationWindow::slotFilePrintPreview(bool on)
{
- RS_DEBUG->print("ApplicationWindow::slotFilePrintPreview()");
+ DEBUG->print("ApplicationWindow::slotFilePrintPreview()");
- RS_DEBUG->print(" creating MDI window");
+ DEBUG->print(" creating MDI window");
MDIWindow * parent = getMDIWindow();
if (!parent)
{
- RS_DEBUG->print(RS_Debug::D_WARNING, "ApplicationWindow::slotFilePrintPreview: no window opened");
+ DEBUG->print(Debug::D_WARNING, "ApplicationWindow::slotFilePrintPreview: no window opened");
return;
}
// close print preview:
if (!on)
{
- RS_DEBUG->print("ApplicationWindow::slotFilePrintPreview(): off");
+ DEBUG->print("ApplicationWindow::slotFilePrintPreview(): off");
if (parent->getGraphicView()->isPrintPreview())
{
- RS_DEBUG->print("ApplicationWindow::slotFilePrintPreview(): close");
+ DEBUG->print("ApplicationWindow::slotFilePrintPreview(): close");
slotFileClose();
}
}
if (ppv != NULL)
{
- RS_DEBUG->print("ApplicationWindow::slotFilePrintPreview(): show existing");
+ DEBUG->print("ApplicationWindow::slotFilePrintPreview(): show existing");
slotWindowActivated(ppv);
ppv->showNormal();
}
{
if (!parent->getGraphicView()->isPrintPreview())
{
- RS_DEBUG->print("ApplicationWindow::slotFilePrintPreview(): create");
+ DEBUG->print("ApplicationWindow::slotFilePrintPreview(): create");
MDIWindow * w = new MDIWindow(parent->getDocument(), workspace, 0, Qt::SubWindow);
w->setAttribute(Qt::WA_DeleteOnClose);
// w->setWindowIcon(qPixmapFromMimeSource("document.png"));
w->setWindowIcon(QIcon(":/res/document.png"));
w->getGraphicView()->setPrintPreview(true);
- w->getGraphicView()->setBackground(RS_Color(255, 255, 255));
+ w->getGraphicView()->setBackground(Color(255, 255, 255));
w->getGraphicView()->setDefaultAction(new ActionPrintPreview(*w->getDocument(), *w->getGraphicView()));
// only graphics offer block lists, blocks don't
- RS_DEBUG->print(" adding listeners");
+ DEBUG->print(" adding listeners");
Drawing * graphic = w->getDocument()->getGraphic();
if (graphic)
// Link the graphic view to the command widget:
QG_DIALOGFACTORY->setCommandWidget(commandWidget);
- RS_DEBUG->print(" showing MDI window");
+ DEBUG->print(" showing MDI window");
if (workspace->subWindowList().isEmpty())
w->showMaximized();
*/
void ApplicationWindow::slotFileQuit()
{
- RS_DEBUG->print("ApplicationWindow::slotFileQuit()");
+ DEBUG->print("ApplicationWindow::slotFileQuit()");
statusBar()->showMessage(tr("Exiting application..."));
*/
void ApplicationWindow::slotViewGrid(bool toggle)
{
- RS_DEBUG->print("ApplicationWindow::slotViewGrid()");
+ DEBUG->print("ApplicationWindow::slotViewGrid()");
MDIWindow * m = getMDIWindow();
updateGrids();
redrawAll();
- RS_DEBUG->print("ApplicationWindow::slotViewGrid() OK");
+ DEBUG->print("ApplicationWindow::slotViewGrid() OK");
}
/**
*/
void ApplicationWindow::slotViewDraft(bool toggle)
{
- RS_DEBUG->print("ApplicationWindow::slotViewDraft()");
+ DEBUG->print("ApplicationWindow::slotViewDraft()");
/*MDIWindow* m = getMDIWindow();
if (m!=NULL) {
*/
void ApplicationWindow::slotViewStatusBar(bool showSB)
{
- RS_DEBUG->print("ApplicationWindow::slotViewStatusBar()");
+ DEBUG->print("ApplicationWindow::slotViewStatusBar()");
if (showSB)
statusBar()->show();
* @param toggle true: show, false: hide.
*/
/*void ApplicationWindow::slotViewLayerList(bool toggle) {
- RS_DEBUG->print("ApplicationWindow::slotViewLayerList()");
+ DEBUG->print("ApplicationWindow::slotViewLayerList()");
if (toggle==false) {
layerDockWindow->hide();
*/
/*
void ApplicationWindow::slotViewBlockList(bool toggle) {
- RS_DEBUG->print("ApplicationWindow::slotViewBlockList()");
+ DEBUG->print("ApplicationWindow::slotViewBlockList()");
if (toggle==false) {
blockDockWindow->hide();
*/
/*
void ApplicationWindow::slotViewCommandLine(bool toggle) {
- RS_DEBUG->print("ApplicationWindow::slotViewCommandLine()");
+ DEBUG->print("ApplicationWindow::slotViewCommandLine()");
if (toggle==false) {
commandDockWindow->hide();
*/
/*
void ApplicationWindow::slotViewOptionToolbar(bool toggle) {
- RS_DEBUG->print("ApplicationWindow::slotViewOptionToolbar()");
+ DEBUG->print("ApplicationWindow::slotViewOptionToolbar()");
if (toggle==false) {
optionWidget->hide();
*/
/*
void ApplicationWindow::slotBlocksEdit() {
- RS_DEBUG->print("ApplicationWindow::slotBlocksEdit()");
+ DEBUG->print("ApplicationWindow::slotBlocksEdit()");
MDIWindow* parent = getMDIWindow();
if (parent!=NULL) {
- RS_BlockList* blist = blockWidget->getBlockList();
+ BlockList* blist = blockWidget->getBlockList();
if (blist!=NULL) {
- RS_Block* blk = blist->getActiveBlock();
+ Block* blk = blist->getActiveBlock();
if (blk!=NULL) {
MDIWindow* w = slotFileNew(blk);
// the parent needs a pointer to the block window and
*/
void ApplicationWindow::slotOptionsGeneral()
{
- RS_DIALOGFACTORY->requestOptionsGeneralDialog();
+ DIALOGFACTORY->requestOptionsGeneralDialog();
// update background color of all open drawings:
settings.beginGroup("Appearance");
*/
void ApplicationWindow::slotScriptOpenIDE()
{
-#ifdef RS_SCRIPTING
+#ifdef SCRIPTING
scripter->openIDE();
#endif
}
*/
void ApplicationWindow::slotScriptRun()
{
-#ifdef RS_SCRIPTING
+#ifdef SCRIPTING
scripter->runScript();
#endif
}
*/
void ApplicationWindow::slotHelpAbout()
{
- RS_DEBUG->print("ApplicationWindow::slotHelpAbout()");
+ DEBUG->print("ApplicationWindow::slotHelpAbout()");
QStringList modules;
#ifdef RS_CAM
modules += "CAM";
#endif
-#ifdef RS_SCRIPTING
+#ifdef SCRIPTING
modules += "Scripting";
#endif
{
#warning "No help system ported to Qt4... !!! FIX !!!"
#if 0
- RS_DEBUG->print("ApplicationWindow::slotHelpManual()");
+ DEBUG->print("ApplicationWindow::slotHelpManual()");
if (assistant == NULL)
{
- RS_DEBUG->print("ApplicationWindow::slotHelpManual(): appdir: %s", RS_SYSTEM->getAppDir().toLatin1().data());
- RS_DEBUG->print("ApplicationWindow::slotHelpManual(): appdir: %s", RS_SYSTEM->getAppDir().toLatin1().data());
- assistant = new QAssistantClient(RS_SYSTEM->getAppDir()+"/bin", this);
+ DEBUG->print("ApplicationWindow::slotHelpManual(): appdir: %s", SYSTEM->getAppDir().toLatin1().data());
+ DEBUG->print("ApplicationWindow::slotHelpManual(): appdir: %s", SYSTEM->getAppDir().toLatin1().data());
+ assistant = new QAssistantClient(SYSTEM->getAppDir()+"/bin", this);
connect(assistant, SIGNAL(error(const QString&)), this, SLOT(slotError(const QString&)));
QStringList args;
args << "-profile";
- args << QDir::convertSeparators(RS_SYSTEM->getDocPath() + "/qcaddoc.adp");
+ args << QDir::convertSeparators(SYSTEM->getDocPath() + "/qcaddoc.adp");
// args << QString("doc") + QDir::separator() + QString("qcaddoc.adp");
#if QT_VERSION>=0x030200
/**
* Testing function.
*/
-void ApplicationWindow::slotTestDumpEntities(RS_EntityContainer * d)
+void ApplicationWindow::slotTestDumpEntities(EntityContainer * d)
{
- RS_DEBUG->print("ApplicationWindow::slotTestDumpEntities()");
+ DEBUG->print("ApplicationWindow::slotTestDumpEntities()");
static int level = 0;
std::ofstream dumpFile;
dumpFile << "<body>\n";
}
- for (RS_Entity* e=d->firstEntity();
+ for (Entity* e=d->firstEntity();
e!=NULL;
e=d->nextEntity())
{
{
case RS2::EntityPoint:
{
- RS_Point* p = (RS_Point*)e;
+ Point* p = (Point*)e;
dumpFile
<< "<table><tr><td>"
<< "<b>Point:</b>"
case RS2::EntityLine:
{
- RS_Line* l = (RS_Line*)e;
+ Line* l = (Line*)e;
dumpFile
<< "<table><tr><td>"
<< "<b>Line:</b>"
break;
case RS2::EntityArc: {
- RS_Arc* a = (RS_Arc*)e;
+ Arc* a = (Arc*)e;
dumpFile
<< "<table><tr><td>"
<< "<b>Arc:</b>"
break;
case RS2::EntityCircle: {
- RS_Circle* c = (RS_Circle*)e;
+ Circle* c = (Circle*)e;
dumpFile
<< "<table><tr><td>"
<< "<b>Circle:</b>"
break;
case RS2::EntityDimAligned: {
- RS_DimAligned* d = (RS_DimAligned*)e;
+ DimAligned* d = (DimAligned*)e;
dumpFile
<< "<table><tr><td>"
<< "<b>Dimension / Aligned:</b>"
case RS2::EntityDimLinear:
{
- RS_DimLinear* d = (RS_DimLinear*)e;
+ DimLinear* d = (DimLinear*)e;
dumpFile
<< "<table><tr><td>"
<< "<b>Dimension / Linear:</b>"
break;
case RS2::EntityInsert: {
- RS_Insert* i = (RS_Insert*)e;
+ Insert* i = (Insert*)e;
dumpFile
<< "<table><tr><td>"
<< "<b>Insert:</b>"
break;
case RS2::EntityText: {
- RS_Text* t = (RS_Text*)e;
+ Text* t = (Text*)e;
dumpFile
<< "<table><tr><td>"
<< "<b>Text:</b>"
break;
case RS2::EntityHatch: {
- RS_Hatch* h = (RS_Hatch*)e;
+ Hatch* h = (Hatch*)e;
dumpFile
<< "<table><tr><td>"
<< "<b>Hatch:</b>"
}
if (e->isContainer() || e->rtti()==RS2::EntityHatch) {
- RS_EntityContainer* ec = (RS_EntityContainer*)e;
+ EntityContainer* ec = (EntityContainer*)e;
dumpFile << "<table><tr><td valign=\"top\"> Contents:</td><td>\n";
dumpFile.close();
slotTestDumpEntities(ec);
*/
void ApplicationWindow::slotTestDumpUndo()
{
- RS_DEBUG->print("ApplicationWindow::slotTestDumpUndo()");
+ DEBUG->print("ApplicationWindow::slotTestDumpUndo()");
- RS_Document * d = getDocument();
+ Document * d = getDocument();
if (d != NULL)
{
- std::cout << *(RS_Undo*)d;
+ std::cout << *(Undo*)d;
std::cout << std::endl;
}
}
*/
void ApplicationWindow::slotTestUpdateInserts()
{
- RS_DEBUG->print("ApplicationWindow::slotTestUpdateInserts()");
+ DEBUG->print("ApplicationWindow::slotTestUpdateInserts()");
- RS_Document * d = getDocument();
+ Document * d = getDocument();
if (d != NULL)
d->updateInserts();
*/
void ApplicationWindow::slotTestDrawFreehand()
{
- RS_DEBUG->print("ApplicationWindow::slotTestDrawFreehand()");
+ DEBUG->print("ApplicationWindow::slotTestDrawFreehand()");
//Drawing* g = document->getMarking();
/*
*/
void ApplicationWindow::slotTestInsertBlock()
{
- RS_DEBUG->print("ApplicationWindow::slotTestInsertBlock()");
+ DEBUG->print("ApplicationWindow::slotTestInsertBlock()");
- RS_Document * d = getDocument();
+ Document * d = getDocument();
if (d != NULL && d->rtti() == RS2::EntityGraphic)
{
if (graphic == NULL)
return;
- graphic->addLayer(new RS_Layer("default"));
- RS_Block * block = new RS_Block(graphic, RS_BlockData("debugblock", Vector(0.0, 0.0), true));
+ graphic->addLayer(new Layer("default"));
+ Block * block = new Block(graphic, BlockData("debugblock", Vector(0.0, 0.0), true));
- RS_Line * line;
- RS_Arc * arc;
- RS_Circle * circle;
+ Line * line;
+ Arc * arc;
+ Circle * circle;
// Add one red line:
- line = new RS_Line(block, RS_LineData(Vector(0.0, 0.0), Vector(50.0, 0.0)));
+ line = new Line(block, LineData(Vector(0.0, 0.0), Vector(50.0, 0.0)));
line->setLayerToActive();
- line->setPen(RS_Pen(RS_Color(255, 0, 0), RS2::Width01, RS2::SolidLine));
+ line->setPen(Pen(Color(255, 0, 0), RS2::Width01, RS2::SolidLine));
block->addEntity(line);
// Add one line with attributes from block:
- line = new RS_Line(block, RS_LineData(Vector(50.0, 0.0), Vector(50.0, 50.0)));
- line->setPen(RS_Pen(RS_Color(RS2::FlagByBlock), RS2::WidthByBlock, RS2::LineByBlock));
+ line = new Line(block, LineData(Vector(50.0, 0.0), Vector(50.0, 50.0)));
+ line->setPen(Pen(Color(RS2::FlagByBlock), RS2::WidthByBlock, RS2::LineByBlock));
block->addEntity(line);
// Add one arc with attributes from block:
- RS_ArcData d(Vector(50.0, 0.0), 50.0, M_PI / 2.0, M_PI, false);
- arc = new RS_Arc(block, d);
- arc->setPen(RS_Pen(RS_Color(RS2::FlagByBlock), RS2::WidthByBlock, RS2::LineByBlock));
+ ArcData d(Vector(50.0, 0.0), 50.0, M_PI / 2.0, M_PI, false);
+ arc = new Arc(block, d);
+ arc->setPen(Pen(Color(RS2::FlagByBlock), RS2::WidthByBlock, RS2::LineByBlock));
block->addEntity(arc);
// Add one blue circle:
- RS_CircleData circleData(Vector(20.0, 15.0), 12.5);
- circle = new RS_Circle(block, circleData);
+ CircleData circleData(Vector(20.0, 15.0), 12.5);
+ circle = new Circle(block, circleData);
circle->setLayerToActive();
- circle->setPen(RS_Pen(RS_Color(0, 0, 255), RS2::Width01, RS2::SolidLine));
+ circle->setPen(Pen(Color(0, 0, 255), RS2::Width01, RS2::SolidLine));
block->addEntity(circle);
graphic->addBlock(block);
- RS_Insert * ins;
- RS_InsertData insData("debugblock", Vector(0.0, 0.0), Vector(1.0, 1.0), 0.0, 1, 1, Vector(0.0, 0.0), NULL, RS2::NoUpdate);
+ Insert * ins;
+ InsertData insData("debugblock", Vector(0.0, 0.0), Vector(1.0, 1.0), 0.0, 1, 1, Vector(0.0, 0.0), NULL, RS2::NoUpdate);
// insert one magenta instance of the block (original):
- ins = new RS_Insert(graphic, insData);
+ ins = new Insert(graphic, insData);
ins->setLayerToActive();
- ins->setPen(RS_Pen(RS_Color(255, 0, 255), RS2::Width02, RS2::SolidLine));
+ ins->setPen(Pen(Color(255, 0, 255), RS2::Width02, RS2::SolidLine));
ins->update();
graphic->addEntity(ins);
// insert one green instance of the block (rotate):
- insData = RS_InsertData("debugblock", Vector(-50.0, 20.0), Vector(1.0, 1.0), 30.0 / ARAD, 1, 1, Vector(0.0, 0.0), NULL, RS2::NoUpdate);
- ins = new RS_Insert(graphic, insData);
+ insData = InsertData("debugblock", Vector(-50.0, 20.0), Vector(1.0, 1.0), 30.0 / ARAD, 1, 1, Vector(0.0, 0.0), NULL, RS2::NoUpdate);
+ ins = new Insert(graphic, insData);
ins->setLayerToActive();
- ins->setPen(RS_Pen(RS_Color(0, 255, 0), RS2::Width02, RS2::SolidLine));
+ ins->setPen(Pen(Color(0, 255, 0), RS2::Width02, RS2::SolidLine));
ins->update();
graphic->addEntity(ins);
// insert one cyan instance of the block (move):
- insData = RS_InsertData("debugblock", Vector(10.0, 20.0), Vector(1.0, 1.0), 0.0, 1, 1, Vector(0.0, 0.0), NULL, RS2::NoUpdate);
- ins = new RS_Insert(graphic, insData);
+ insData = InsertData("debugblock", Vector(10.0, 20.0), Vector(1.0, 1.0), 0.0, 1, 1, Vector(0.0, 0.0), NULL, RS2::NoUpdate);
+ ins = new Insert(graphic, insData);
ins->setLayerToActive();
- ins->setPen(RS_Pen(RS_Color(0, 255, 255), RS2::Width02, RS2::SolidLine));
+ ins->setPen(Pen(Color(0, 255, 255), RS2::Width02, RS2::SolidLine));
ins->update();
graphic->addEntity(ins);
// insert one blue instance of the block:
for(double a=0.0; a<360.0; a+=45.0)
{
- insData = RS_InsertData("debugblock", Vector(60.0, 0.0), Vector(2.0 / 5, 2.0 / 5), a/ARAD, 1, 1, Vector(0.0, 0.0), NULL, RS2::NoUpdate);
- ins = new RS_Insert(graphic, insData);
+ insData = InsertData("debugblock", Vector(60.0, 0.0), Vector(2.0 / 5, 2.0 / 5), a/ARAD, 1, 1, Vector(0.0, 0.0), NULL, RS2::NoUpdate);
+ ins = new Insert(graphic, insData);
ins->setLayerToActive();
- ins->setPen(RS_Pen(RS_Color(0, 0, 255), RS2::Width05, RS2::SolidLine));
+ ins->setPen(Pen(Color(0, 0, 255), RS2::Width05, RS2::SolidLine));
ins->update();
graphic->addEntity(ins);
}
// insert an array of yellow instances of the block:
- insData = RS_InsertData("debugblock", Vector(-100.0, -100.0), Vector(0.2, 0.2), M_PI / 6.0, 6, 4, Vector(100.0, 100.0), NULL, RS2::NoUpdate);
- ins = new RS_Insert(graphic, insData);
+ insData = InsertData("debugblock", Vector(-100.0, -100.0), Vector(0.2, 0.2), M_PI / 6.0, 6, 4, Vector(100.0, 100.0), NULL, RS2::NoUpdate);
+ ins = new Insert(graphic, insData);
ins->setLayerToActive();
- ins->setPen(RS_Pen(RS_Color(255, 255, 0), RS2::Width01, RS2::SolidLine));
+ ins->setPen(Pen(Color(255, 255, 0), RS2::Width01, RS2::SolidLine));
ins->update();
graphic->addEntity(ins);
*/
void ApplicationWindow::slotTestInsertEllipse()
{
- RS_DEBUG->print("ApplicationWindow::slotTestInsertEllipse()");
+ DEBUG->print("ApplicationWindow::slotTestInsertEllipse()");
- RS_Document * d = getDocument();
+ Document * d = getDocument();
if (d != NULL)
{
if (graphic == NULL)
return;
- RS_Ellipse * ellipse;
- RS_Line * line;
+ Ellipse * ellipse;
+ Line * line;
for (double a=0.0; a<2*M_PI; a+=0.1)
{
v.setPolar(50.0, a);
double xp = 1000.0*a;
- RS_EllipseData ellipseData(Vector(xp, 0.0), v, 0.5, 0.0, 2 * M_PI, false);
- ellipse = new RS_Ellipse(graphic, ellipseData);
+ EllipseData ellipseData(Vector(xp, 0.0), v, 0.5, 0.0, 2 * M_PI, false);
+ ellipse = new Ellipse(graphic, ellipseData);
- ellipse->setPen(RS_Pen(RS_Color(255, 0, 255), RS2::Width01, RS2::SolidLine));
+ ellipse->setPen(Pen(Color(255, 0, 255), RS2::Width01, RS2::SolidLine));
graphic->addEntity(ellipse);
- //graphic->addEntity(new RS_Point(graphic, ellipse->getMax()));
- //graphic->addEntity(new RS_Point(graphic, ellipse->getMin()));
+ //graphic->addEntity(new Point(graphic, ellipse->getMax()));
+ //graphic->addEntity(new Point(graphic, ellipse->getMin()));
- line = new RS_Line(graphic, RS_LineData(Vector(xp, 0.0), Vector(xp, 0.0) + v));
- line->setPen(RS_Pen(RS_Color(128, 128, 128), RS2::Width01, RS2::SolidLine));
+ line = new Line(graphic, LineData(Vector(xp, 0.0), Vector(xp, 0.0) + v));
+ line->setPen(Pen(Color(128, 128, 128), RS2::Width01, RS2::SolidLine));
graphic->addEntity(line);
/*
for (double mx=-60.0; mx<60.0; mx+=1.0) {
//for (double mx=0.0; mx<1.0; mx+=2.5) {
VectorSolutions sol = ellipse->mapX(xp + mx);
- //graphic->addEntity(new RS_Point(graphic,
+ //graphic->addEntity(new Point(graphic,
// sol.vector2 + Vector(a*500.0, 0.0)));
- //graphic->addEntity(new RS_Point(graphic,
+ //graphic->addEntity(new Point(graphic,
// sol.vector3 + Vector(a*500.0, 0.0)));
- //graphic->addEntity(new RS_Point(graphic,
+ //graphic->addEntity(new Point(graphic,
// sol.vector4 + Vector(a*500.0, 0.0)));
- line = new RS_Line(graphic,
- RS_LineData(Vector(xp+mx,-50.0),
+ line = new Line(graphic,
+ LineData(Vector(xp+mx,-50.0),
Vector(xp+mx,50.0)));
- line->setPen(RS_Pen(RS_Color(60, 60, 60),
+ line->setPen(Pen(Color(60, 60, 60),
RS2::Width01,
RS2::SolidLine));
graphic->addEntity(line);
- graphic->addEntity(new RS_Point(graphic,
+ graphic->addEntity(new Point(graphic,
sol.get(0)));
}
*/
for (x=-250.0; x<=250.0; x+=50.0) {
Vector v(x, y);
- ellipse = new RS_Ellipse(graphic,
+ ellipse = new Ellipse(graphic,
v,
Vector((x/5+50.0)/2.0, 0.0),
fabs(x/y),
0.0, 2*M_PI,
false);
- ellipse->setPen(RS_Pen(RS_Color(255, 255, 0),
+ ellipse->setPen(Pen(Color(255, 255, 0),
RS2::Width01,
RS2::DashDotLine));
graphic->addEntity(ellipse);
- graphic->addEntity(new RS_Point(graphic, ellipse->getMax()));
- graphic->addEntity(new RS_Point(graphic, ellipse->getMin()));
+ graphic->addEntity(new Point(graphic, ellipse->getMax()));
+ graphic->addEntity(new Point(graphic, ellipse->getMin()));
- ellipse = new RS_Ellipse(graphic,
+ ellipse = new Ellipse(graphic,
v + Vector(750.0, 0.0),
Vector((x/5+50.0)/2.0, 0.0),
fabs(x/y),
true);
graphic->addEntity(ellipse);
- graphic->addEntity(new RS_Point(graphic, ellipse->getMax()));
- graphic->addEntity(new RS_Point(graphic, ellipse->getMin()));
+ graphic->addEntity(new Point(graphic, ellipse->getMax()));
+ graphic->addEntity(new Point(graphic, ellipse->getMin()));
}
}
*/
// different rotation angles:
double rot;
for (rot=0.0; rot<=2*M_PI+0.1; rot+=(M_PI/8)) {
- ellipse = new RS_Ellipse(graphic,
+ ellipse = new Ellipse(graphic,
Vector(rot*200, 500.0),
Vector(50.0, 0.0).rotate(rot),
0.3,
0.0, 2*M_PI,
false);
graphic->addEntity(ellipse);
- graphic->addEntity(new RS_Point(graphic, ellipse->getMax()));
- graphic->addEntity(new RS_Point(graphic, ellipse->getMin()));
+ graphic->addEntity(new Point(graphic, ellipse->getMax()));
+ graphic->addEntity(new Point(graphic, ellipse->getMin()));
}
for (rot=0.0; rot<=2*M_PI+0.1; rot+=(M_PI/8)) {
for (a1=0.0; a1<=2*M_PI+0.1; a1+=(M_PI/8)) {
for (a2=a1+M_PI/8; a2<=2*M_PI+a1+0.1; a2+=(M_PI/8)) {
- ellipse = new RS_Ellipse(graphic,
+ ellipse = new Ellipse(graphic,
Vector(-500.0-a1*200.0-5000.0*rot,
500.0-a2*200.0),
Vector(50.0, 0.0).rotate(rot),
a1, a2,
false);
graphic->addEntity(ellipse);
- graphic->addEntity(new RS_Point(graphic, ellipse->getMax()));
- graphic->addEntity(new RS_Point(graphic, ellipse->getMin()));
+ graphic->addEntity(new Point(graphic, ellipse->getMax()));
+ graphic->addEntity(new Point(graphic, ellipse->getMin()));
}
}
}
*/
void ApplicationWindow::slotTestInsertText()
{
- RS_DEBUG->print("ApplicationWindow::slotTestInsertText()");
+ DEBUG->print("ApplicationWindow::slotTestInsertText()");
- RS_Document * d = getDocument();
+ Document * d = getDocument();
if (d != NULL)
{
if (graphic == NULL)
return;
- RS_Text * text;
- RS_TextData textData;
+ Text * text;
+ TextData textData;
- textData = RS_TextData(Vector(10.0, 10.0), 10.0, 100.0, RS2::VAlignTop, RS2::HAlignLeft, RS2::LeftToRight, RS2::Exact, 1.0, "Andrew", "normal", 0.0);
- text = new RS_Text(graphic, textData);
+ textData = TextData(Vector(10.0, 10.0), 10.0, 100.0, RS2::VAlignTop, RS2::HAlignLeft, RS2::LeftToRight, RS2::Exact, 1.0, "Andrew", "normal", 0.0);
+ text = new Text(graphic, textData);
text->setLayerToActive();
- text->setPen(RS_Pen(RS_Color(255, 0, 0), RS2::Width01, RS2::SolidLine));
+ text->setPen(Pen(Color(255, 0, 0), RS2::Width01, RS2::SolidLine));
graphic->addEntity(text);
/*
for (x=-250.0; x<=250.0; x+=50.0) {
Vector v(x, y);
- textData = RS_TextData(v,
+ textData = TextData(v,
10.0, 100.0,
RS2::VAlignTop,
RS2::HAlignLeft,
"normal",
0.0);
- text = new RS_Text(graphic, textData);
+ text = new Text(graphic, textData);
text->setLayerToActive();
- text->setPen(RS_Pen(RS_Color(255, 0, 0),
+ text->setPen(Pen(Color(255, 0, 0),
RS2::Width01,
RS2::SolidLine));
graphic->addEntity(text);
}
}
- RS_Line* line;
+ Line* line;
for (x=0.0; x<M_PI*2.0; x+=0.2) {
Vector v(600.0+cos(x)*50.0, 0.0+sin(x)*50.0);
- line = new RS_Line(graphic,
- RS_LineData(Vector(600.0,0.0),
+ line = new Line(graphic,
+ LineData(Vector(600.0,0.0),
v));
line->setLayerToActive();
line->setPenToActive();
graphic->addEntity(line);
- textData = RS_TextData(v,
+ textData = TextData(v,
5.0, 50.0,
RS2::VAlignTop,
RS2::HAlignLeft,
"normal",
x);
- text = new RS_Text(graphic, textData);
+ text = new Text(graphic, textData);
text->setLayerToActive();
- text->setPen(RS_Pen(RS_Color(255, 0, 0),
+ text->setPen(Pen(Color(255, 0, 0),
RS2::Width01,
RS2::SolidLine));
graphic->addEntity(text);
}
- RS_SolidData solidData = RS_SolidData(Vector(5.0, 10.0),
+ SolidData solidData = SolidData(Vector(5.0, 10.0),
Vector(25.0, 15.0),
Vector(15.0, 30.0));
- RS_Solid* s = new RS_Solid(graphic, solidData);
+ Solid* s = new Solid(graphic, solidData);
s->setLayerToActive();
- s->setPen(RS_Pen(RS_Color(255, 255, 0),
+ s->setPen(Pen(Color(255, 255, 0),
RS2::Width01,
RS2::SolidLine));
graphic->addEntity(s);
*/
void ApplicationWindow::slotTestInsertImage()
{
- RS_DEBUG->print("ApplicationWindow::slotTestInsertImage()");
+ DEBUG->print("ApplicationWindow::slotTestInsertImage()");
- RS_Document * d = getDocument();
+ Document * d = getDocument();
if (d != NULL)
{
if (graphic == NULL)
return;
- RS_Image * image;
- RS_ImageData imageData;
+ Image * image;
+ ImageData imageData;
- imageData = RS_ImageData(0, Vector(50.0, 30.0), Vector(0.5, 0.5), Vector(-0.5, 0.5), Vector(640, 480), "/home/andrew/data/image.png", 50, 50, 0);
- image = new RS_Image(graphic, imageData);
+ imageData = ImageData(0, Vector(50.0, 30.0), Vector(0.5, 0.5), Vector(-0.5, 0.5), Vector(640, 480), "/home/andrew/data/image.png", 50, 50, 0);
+ image = new Image(graphic, imageData);
image->setLayerToActive();
- image->setPen(RS_Pen(RS_Color(255, 0, 0), RS2::Width01, RS2::SolidLine));
+ image->setPen(Pen(Color(255, 0, 0), RS2::Width01, RS2::SolidLine));
graphic->addEntity(image);
}
}
*/
void ApplicationWindow::slotTestUnicode()
{
- RS_DEBUG->print("ApplicationWindow::slotTestUnicode()");
+ DEBUG->print("ApplicationWindow::slotTestUnicode()");
slotFileOpen("./fonts/unicode.cxf", RS2::FormatCXF);
- RS_Document* d = getDocument();
+ Document* d = getDocument();
if (d!=NULL) {
Drawing* graphic = (Drawing*)d;
if (graphic==NULL) {
return;
}
- RS_Insert* ins;
+ Insert* ins;
int col;
int row;
strCode = "[" + strCode + "] " + uCode;
if (graphic->findBlock(strCode)!=NULL) {
- RS_InsertData d(strCode,
+ InsertData d(strCode,
Vector(col/0x10*20.0,row*20.0),
Vector(1.0,1.0), 0.0,
1, 1, Vector(0.0, 0.0),
NULL, RS2::NoUpdate);
- ins = new RS_Insert(graphic, d);
+ ins = new Insert(graphic, d);
ins->setLayerToActive();
- ins->setPen(RS_Pen(RS_Color(255, 255, 255),
+ ins->setPen(Pen(Color(255, 255, 255),
RS2::Width01,
RS2::SolidLine));
ins->update();
*/
void ApplicationWindow::slotTestMath01()
{
- RS_DEBUG->print("ApplicationWindow::slotTestMath01()");
+ DEBUG->print("ApplicationWindow::slotTestMath01()");
- RS_Document* d = getDocument();
+ Document* d = getDocument();
if (d!=NULL) {
Drawing* graphic = (Drawing*)d;
if (graphic==NULL) {
}
// axis
- graphic->addEntity(new RS_Line(graphic,
- RS_LineData(Vector(0.0,0.0),
+ graphic->addEntity(new Line(graphic,
+ LineData(Vector(0.0,0.0),
Vector(2*M_PI,0.0))));
- graphic->addEntity(new RS_Line(graphic,
- RS_LineData(Vector(0.0,-1.0),
+ graphic->addEntity(new Line(graphic,
+ LineData(Vector(0.0,-1.0),
Vector(0.0,1.0))));
// cos
double x_0 = 60.0/ARAD;
for (a=0.01; a<2*M_PI; a+=0.01) {
// cos curve:
- RS_Line* line = new RS_Line(graphic,
- RS_LineData(Vector(a-0.01, cos(a-0.01)),
+ Line* line = new Line(graphic,
+ LineData(Vector(a-0.01, cos(a-0.01)),
Vector(a, cos(a))));
graphic->addEntity(line);
// tangent:
- graphic->addEntity(new RS_Line(graphic,
- RS_LineData(Vector(a-0.01,cos(x_0)-sin(x_0)*(a-0.01-x_0)),
+ graphic->addEntity(new Line(graphic,
+ LineData(Vector(a-0.01,cos(x_0)-sin(x_0)*(a-0.01-x_0)),
Vector(a,cos(x_0)-sin(x_0)*(a-x_0)))));
}
// 59.0 deg
- graphic->addEntity(new RS_Line(graphic,
- RS_LineData(Vector(x,0.0),
+ graphic->addEntity(new Line(graphic,
+ LineData(Vector(x,0.0),
Vector(x,1.0))));
// 60.0 deg
- graphic->addEntity(new RS_Line(graphic,
- RS_LineData(Vector(x_0,0.0),
+ graphic->addEntity(new Line(graphic,
+ LineData(Vector(x_0,0.0),
Vector(x_0,1.0))));
// tangent
- //graphic->addEntity(new RS_Line(graphic,
+ //graphic->addEntity(new Line(graphic,
// Vector(0.0,cos(x_0)-sin(x_0)*(0.0-x_0)),
// Vector(6.0,cos(x_0)-sin(x_0)*(6.0-x_0))));
*/
void ApplicationWindow::slotTestResize640()
{
- RS_DEBUG->print("ApplicationWindow::slotTestResize640()");
+ DEBUG->print("ApplicationWindow::slotTestResize640()");
resize(640, 480);
}
*/
void ApplicationWindow::slotTestResize800()
{
- RS_DEBUG->print("ApplicationWindow::slotTestResize800()");
+ DEBUG->print("ApplicationWindow::slotTestResize800()");
resize(800, 600);
}
*/
void ApplicationWindow::slotTestResize1024()
{
- RS_DEBUG->print("ApplicationWindow::slotTestResize1024()");
+ DEBUG->print("ApplicationWindow::slotTestResize1024()");
resize(1024, 768);
}
*/
bool ApplicationWindow::queryExit(bool force)
{
- RS_DEBUG->print("ApplicationWindow::queryExit()");
+ DEBUG->print("ApplicationWindow::queryExit()");
bool succ = true;
if (succ)
storeSettings();
- RS_DEBUG->print("ApplicationWindow::queryExit(): OK");
+ DEBUG->print("ApplicationWindow::queryExit(): OK");
return succ;
}
*/
MDIWindow * ApplicationWindow::getMDIWindow()
{
- RS_DEBUG->print(/*RS_Debug::D_CRITICAL,*/ "ApplicationWindow::getMDIWindow: workspace=%08X", workspace);
+ DEBUG->print(/*Debug::D_CRITICAL,*/ "ApplicationWindow::getMDIWindow: workspace=%08X", workspace);
if (workspace)
{
- RS_DEBUG->print("ApplicationWindow::getMDIWindow: activeSubWindow=%08X", workspace->activeSubWindow());
+ DEBUG->print("ApplicationWindow::getMDIWindow: activeSubWindow=%08X", workspace->activeSubWindow());
return (MDIWindow *)workspace->activeSubWindow();
}
- RS_DEBUG->print("ApplicationWindow::getMDIWindow: activeSubWindow=??? (workspace == NULL)");
+ DEBUG->print("ApplicationWindow::getMDIWindow: activeSubWindow=??? (workspace == NULL)");
return NULL;
}
/**
- * Implementation from RS_MainWindowInterface (and QS_ScripterHostInterface).
+ * Implementation from MainWindowInterface (and QS_ScripterHostInterface).
*
* @return Pointer to the graphic view of the currently active document
* window or NULL if no window is available.
}
/**
- * Implementation from RS_MainWindowInterface (and QS_ScripterHostInterface).
+ * Implementation from MainWindowInterface (and QS_ScripterHostInterface).
*
* @return Pointer to the graphic document of the currently active document
* window or NULL if no window is available.
*/
-/*virtual*/ RS_Document * ApplicationWindow::getDocument()
+/*virtual*/ Document * ApplicationWindow::getDocument()
{
MDIWindow * m = getMDIWindow();
}
/**
- * Creates a new document. Implementation from RS_MainWindowInterface.
+ * Creates a new document. Implementation from MainWindowInterface.
*/
/*virtual*/ void ApplicationWindow::createNewDocument(const QString & fileName/*= QString::null*/,
- RS_Document * doc/*= NULL*/)
+ Document * doc/*= NULL*/)
{
slotFileNew(doc);
#endif
}
-#ifdef RS_SCRIPTING
+#ifdef SCRIPTING
/**
* @return Pointer to the qsa object.
*/
#include "commandwidget.h"
#include "librarywidget.h"
-#ifdef RS_SCRIPTING
+#ifdef SCRIPTING
#include "qs_scripter.h"
#include <qsproject.h>
#endif
void slotTileHorizontal();
void slotTileVertical();
- void slotPenChanged(RS_Pen p);
+ void slotPenChanged(Pen p);
/** generates a new document for a graphic. */
- MDIWindow * slotFileNew(RS_Document * doc = NULL);
+ MDIWindow * slotFileNew(Document * doc = NULL);
/** opens a document */
void slotFileOpen();
/**
void slotHelpManual();
/** dumps entities to file */
- void slotTestDumpEntities(RS_EntityContainer * d = NULL);
+ void slotTestDumpEntities(EntityContainer * d = NULL);
/** dumps undo info to stdout */
void slotTestDumpUndo();
/** updates all inserts */
QMdiArea * getWorkspace();
MDIWindow * getMDIWindow();
virtual GraphicView * getGraphicView();
- virtual RS_Document * getDocument();
- virtual void createNewDocument(const QString & fileName = QString::null, RS_Document * doc = NULL);
+ virtual Document * getDocument();
+ virtual void createNewDocument(const QString & fileName = QString::null, Document * doc = NULL);
virtual QMainWindow * GetMainWindow();
virtual ActionHandler * getActionHandler();
virtual void showSimulationControls();
/**
* @return Pointer to the qsa object.
*/
-#ifdef RS_SCRIPTING
+#ifdef SCRIPTING
QSProject * getQSAProject();
#endif
/** Action handler. */
ActionHandler * actionHandler;
-#ifdef RS_SCRIPTING
+#ifdef SCRIPTING
/** Scripting interface. */
QS_Scripter * scripter;
#endif
// if (*it.current() == ret)
if (*it.value() == ret)
{
- if (RS_DialogFactory::instance() != NULL)
+ if (DialogFactory::instance() != NULL)
{
- //if (RS_DIALOGFACTORY!=NULL) {
- RS_DEBUG->print("Commands::cmdToAction: commandMessage");
- //RS_DIALOGFACTORY->commandMessage(tr("Command: %1")
+ //if (DIALOGFACTORY!=NULL) {
+ DEBUG->print("Commands::cmdToAction: commandMessage");
+ //DIALOGFACTORY->commandMessage(tr("Command: %1")
// .arg(full));
- RS_DialogFactory::instance()->commandMessage(tr("Command: %1").arg(full));
- RS_DEBUG->print("Commands::cmdToAction: commandMessage: ok");
+ DialogFactory::instance()->commandMessage(tr("Command: %1").arg(full));
+ DEBUG->print("Commands::cmdToAction: commandMessage: ok");
//}
}
else
- RS_DEBUG->print("Commands::cmdToAction: dialog factory instance is NULL");
+ DEBUG->print("Commands::cmdToAction: dialog factory instance is NULL");
break;
}
else if (cmd == "undo")
return tr("undo");
-// RS_DEBUG->print(RS_Debug::D_WARNING, "Commands::command: command '%s' unknown", cmd.latin1());
- RS_DEBUG->print(RS_Debug::D_WARNING, "Commands::command: command '%s' unknown", cmd.toLatin1().data());
+// DEBUG->print(Debug::D_WARNING, "Commands::command: command '%s' unknown", cmd.latin1());
+ DEBUG->print(Debug::D_WARNING, "Commands::command: command '%s' unknown", cmd.toLatin1().data());
return "";
}
#define __COMMANDS_H__
#include <QtCore>
-#include "rs.h"
+#include "enums.h"
-#define RS_COMMANDS Commands::instance()
+#define COMMANDS Commands::instance()
/**
* Class which holds all commands for the command line. This
previousOffsetX = 0;
previousOffsetY = 0;
container = NULL;
- eventHandler = new RS_EventHandler(this);
+ eventHandler = new EventHandler(this);
gridColor = Qt::gray;
- metaGridColor = RS_Color(64, 64, 64);
- grid = new RS_Grid(this);
+ metaGridColor = Color(64, 64, 64);
+ grid = new Grid(this);
updateEnabled = 0;
zoomFrozen = false;
draftMode = false;
* Sets the background color. Note that applying the background
* color for the widget is up to the implementing class.
*/
-void GraphicView::setBackground(const RS_Color & bg)
+void GraphicView::setBackground(const Color & bg)
{
background = bg;
// bright background:
if (bg.red() + bg.green() + bg.blue() > 380)
// foreground = Qt::black;
- foreground = RS_Color(0, 0, 0);
+ foreground = Color(0, 0, 0);
else
// foreground = Qt::white;
- foreground = RS_Color(255, 255, 255);
+ foreground = Color(255, 255, 255);
}
/**
* @return Current background color.
*/
-RS_Color GraphicView::getBackground()
+Color GraphicView::getBackground()
{
return background;
}
/**
* @return Current foreground color.
*/
-RS_Color GraphicView::getForeground()
+Color GraphicView::getForeground()
{
return foreground;
}
/**
* Sets the grid color.
*/
-void GraphicView::setGridColor(const RS_Color & c)
+void GraphicView::setGridColor(const Color & c)
{
gridColor = c;
}
/**
* Sets the meta grid color.
*/
-void GraphicView::setMetaGridColor(const RS_Color & c)
+void GraphicView::setMetaGridColor(const Color & c)
{
metaGridColor = c;
}
/**
* Sets the selection color.
*/
-void GraphicView::setSelectedColor(const RS_Color & c)
+void GraphicView::setSelectedColor(const Color & c)
{
selectedColor = c;
}
/**
* Sets the highlight color.
*/
-void GraphicView::setHighlightedColor(const RS_Color & c)
+void GraphicView::setHighlightedColor(const Color & c)
{
highlightedColor = c;
}
{
}
-RS_EntityContainer * GraphicView::getContainer()
+EntityContainer * GraphicView::getContainer()
{
return container;
}
* Sets the pointer to the graphic which contains the entities
* which are visualized by this widget.
*/
-void GraphicView::setContainer(RS_EntityContainer * container)
+void GraphicView::setContainer(EntityContainer * container)
{
this->container = container;
}
*/
void GraphicView::setCurrentAction(ActionInterface * action)
{
- RS_DEBUG->print("GraphicView::setCurrentAction");
+ DEBUG->print("GraphicView::setCurrentAction");
if (eventHandler)
eventHandler->setCurrentAction(action);
- RS_DEBUG->print("GraphicView::setCurrentAction: OK");
+ DEBUG->print("GraphicView::setCurrentAction: OK");
}
/**
{
if (eventHandler && eventHandler->hasAction())
eventHandler->back();
- else if (RS_DIALOGFACTORY)
- RS_DIALOGFACTORY->requestPreviousMenu();
+ else if (DIALOGFACTORY)
+ DIALOGFACTORY->requestPreviousMenu();
}
/**
*/
void GraphicView::mouseReleaseEvent(QMouseEvent * e)
{
- RS_DEBUG->print("GraphicView::mouseReleaseEvent");
+ DEBUG->print("GraphicView::mouseReleaseEvent");
if (!eventHandler)
return;
e->accept();
}
- RS_DEBUG->print("GraphicView::mouseReleaseEvent: OK");
+ DEBUG->print("GraphicView::mouseReleaseEvent: OK");
}
/**
*/
void GraphicView::mouseMoveEvent(QMouseEvent * e)
{
- RS_DEBUG->print("GraphicView::mouseMoveEvent begin");
+ DEBUG->print("GraphicView::mouseMoveEvent begin");
Drawing * graphic = NULL;
if (container->rtti() == RS2::EntityGraphic)
graphic = (Drawing *)container;
- RS_DEBUG->print("GraphicView::mouseMoveEvent 001");
+ DEBUG->print("GraphicView::mouseMoveEvent 001");
if (e)
{
my = e->y();
}
- RS_DEBUG->print("GraphicView::mouseMoveEvent 002");
+ DEBUG->print("GraphicView::mouseMoveEvent 002");
if (eventHandler)
eventHandler->mouseMoveEvent(e);
- RS_DEBUG->print("GraphicView::mouseMoveEvent 003");
+ DEBUG->print("GraphicView::mouseMoveEvent 003");
if (!eventHandler || !eventHandler->hasAction() && graphic)
{
Vector mouse = toGraph(Vector(mx, my));
Vector relMouse = mouse - getRelativeZero();
- if (RS_DIALOGFACTORY)
- RS_DIALOGFACTORY->updateCoordinateWidget(mouse, relMouse);
+ if (DIALOGFACTORY)
+ DIALOGFACTORY->updateCoordinateWidget(mouse, relMouse);
}
- RS_DEBUG->print("GraphicView::mouseMoveEvent end");
+ DEBUG->print("GraphicView::mouseMoveEvent end");
}
/**
/**
* Called by the actual GUI class which implements a command line.
*/
-void GraphicView::commandEvent(RS_CommandEvent * e)
+void GraphicView::commandEvent(CommandEvent * e)
{
if (eventHandler)
eventHandler->commandEvent(e);
{
if (f < 1.0e-6)
{
- RS_DEBUG->print(RS_Debug::D_WARNING, "GraphicView::zoomIn: invalid factor");
+ DEBUG->print(Debug::D_WARNING, "GraphicView::zoomIn: invalid factor");
return;
}
{
if (f < 1.0e-6)
{
- RS_DEBUG->print(RS_Debug::D_WARNING,
+ DEBUG->print(Debug::D_WARNING,
"GraphicView::zoomOut: invalid factor");
return;
}
{
if (f < 1.0e-6)
{
- RS_DEBUG->print(RS_Debug::D_WARNING,
+ DEBUG->print(Debug::D_WARNING,
"GraphicView::zoomOutX: invalid factor");
return;
}
{
if (f < 1.0e-6)
{
- RS_DEBUG->print(RS_Debug::D_WARNING, "GraphicView::zoomOutY: invalid factor");
+ DEBUG->print(Debug::D_WARNING, "GraphicView::zoomOutY: invalid factor");
return;
}
*/
void GraphicView::zoomAuto(bool axis, bool keepAspectRatio)
{
- RS_DEBUG->print("GraphicView::zoomAuto");
+ DEBUG->print("GraphicView::zoomAuto");
if (simulationRunning)
return;
else
fy = 1.0;
- RS_DEBUG->print("f: %f/%f", fx, fy);
+ DEBUG->print("f: %f/%f", fx, fy);
if (keepAspectRatio)
fx = fy = std::min(fx, fy);
- RS_DEBUG->print("f: %f/%f", fx, fy);
+ DEBUG->print("f: %f/%f", fx, fy);
if (fx < RS_TOLERANCE)
fx = fy = 1.0;
setFactorX(fx);
setFactorY(fy);
- RS_DEBUG->print("f: %f/%f", fx, fy);
+ DEBUG->print("f: %f/%f", fx, fy);
- RS_DEBUG->print("adjustOffsetControls");
+ DEBUG->print("adjustOffsetControls");
adjustOffsetControls();
- RS_DEBUG->print("adjustZoomControls");
+ DEBUG->print("adjustZoomControls");
adjustZoomControls();
- RS_DEBUG->print("centerOffsetX");
+ DEBUG->print("centerOffsetX");
centerOffsetX();
- RS_DEBUG->print("centerOffsetY");
+ DEBUG->print("centerOffsetY");
centerOffsetY();
- RS_DEBUG->print("updateGrid");
+ DEBUG->print("updateGrid");
updateGrid();
redraw();
}
- RS_DEBUG->print("GraphicView::zoomAuto OK");
+ DEBUG->print("GraphicView::zoomAuto OK");
}
/**
*/
void GraphicView::zoomPrevious()
{
- RS_DEBUG->print("GraphicView::zoomPrevious");
+ DEBUG->print("GraphicView::zoomPrevious");
if (simulationRunning)
return;
double maxY = RS_MINDOUBLE;
bool noChange = false;
- for(RS_Entity * e=container->firstEntity(RS2::ResolveNone);
+ for(Entity * e=container->firstEntity(RS2::ResolveNone);
e!=NULL; e = container->nextEntity(RS2::ResolveNone))
{
if (e->rtti() == RS2::EntityLine)
{
- RS_Line * l = (RS_Line *)e;
+ Line * l = (Line *)e;
double x1, x2;
x1 = toGuiX(l->getStartpoint().x);
x2 = toGuiX(l->getEndpoint().x);
updateGrid();
}
- RS_DEBUG->print("Auto zoom y ok");
+ DEBUG->print("Auto zoom y ok");
}
}
*/
void GraphicView::zoomPage()
{
- RS_DEBUG->print("GraphicView::zoomPage");
+ DEBUG->print("GraphicView::zoomPage");
if (container == NULL)
return;
else
fy = 1.0;
- RS_DEBUG->print("f: %f/%f", fx, fy);
+ DEBUG->print("f: %f/%f", fx, fy);
fx = fy = std::min(fx, fy);
- RS_DEBUG->print("f: %f/%f", fx, fy);
+ DEBUG->print("f: %f/%f", fx, fy);
if (fx < RS_TOLERANCE)
fx = fy = 1.0;
setFactorX(fx);
setFactorY(fy);
- RS_DEBUG->print("f: %f/%f", fx, fy);
+ DEBUG->print("f: %f/%f", fx, fy);
centerOffsetX();
centerOffsetY();
*/
void GraphicView::drawWindow(Vector v1, Vector v2)
{
- RS_DEBUG->print("GraphicView::drawWindow() begin");
+ DEBUG->print("GraphicView::drawWindow() begin");
if (simulationRunning)
return;
if (container)
{
- for(RS_Entity * se=container->firstEntity(RS2::ResolveNone); se!=NULL;
+ for(Entity * se=container->firstEntity(RS2::ResolveNone); se!=NULL;
se=container->nextEntity(RS2::ResolveNone))
{
if (se->isInWindow(v1, v2))
}
}
- RS_DEBUG->print("GraphicView::drawWindow() end");
+ DEBUG->print("GraphicView::drawWindow() end");
}
/**
drawMetaGrid();
// drawing entities:
-//#warning "!!! This looks like a bug, no match for 'drawEntity(RS_Entity *, bool) !!!"
+//#warning "!!! This looks like a bug, no match for 'drawEntity(Entity *, bool) !!!"
// and indeed it *is* a bug... true is converted to 1.0 here. Dumb, dumb, dumb.
drawEntity(container);//, true);
* Sets the pen of the painter object to the suitable pen for the given
* entity.
*/
-void GraphicView::setPenForEntity(RS_Entity * e)
+void GraphicView::setPenForEntity(Entity * e)
{
if (drawingMode == RS2::ModePreview /*|| draftMode==true*/)
return;
// set color of entity
// Getting pen from entity (or layer)
- RS_Pen pen = e->getPen(true);
+ Pen pen = e->getPen(true);
int w = pen.getWidth();
if (graphic)
{
- uf = RS_Units::convert(1.0, RS2::Millimeter, graphic->getUnit());
+ uf = Units::convert(1.0, RS2::Millimeter, graphic->getUnit());
if ((isPrinting() || isPrintPreview()) && graphic->getPaperScale() > 1.0e-6)
wf = 1.0 / graphic->getPaperScale();
}
// prevent drawing with 1-width which is slow:
- if (RS_Math::round(pen.getScreenWidth()) == 1)
+ if (Math::round(pen.getScreenWidth()) == 1)
pen.setScreenWidth(0.0);
// prevent background color on background drawing:
if (e->isSelected())
{
pen.setLineType(RS2::DotLine);
- //pen.setColor(RS_Color(0xa5,0x47,0x47));
+ //pen.setColor(Color(0xa5,0x47,0x47));
pen.setColor(selectedColor);
}
// this entity is highlighted:
if (e->isHighlighted())
{
- //pen.setColor(RS_Color(0x73, 0x93, 0x73));
+ //pen.setColor(Color(0x73, 0x93, 0x73));
pen.setColor(highlightedColor);
}
* lines e.g. in splines).
* @param db Double buffering on (recommended) / off
*/
-void GraphicView::drawEntity(RS_Entity * e, double patternOffset, bool db)
+void GraphicView::drawEntity(Entity * e, double patternOffset, bool db)
{
- //RS_DEBUG->print("GraphicView::drawEntity() begin");
+ //DEBUG->print("GraphicView::drawEntity() begin");
// update is diabled:
if (!isUpdateEnabled())
//}
//drawRecursion++;
- //RS_DEBUG->print("recursion 1: %d", drawRecursion);
+ //DEBUG->print("recursion 1: %d", drawRecursion);
// set pen (color):
setPenForEntity(e);
- //RS_DEBUG->print("draw plain");
+ //DEBUG->print("draw plain");
if (draftMode)
{
// large texts as rectangles:
if (e->rtti() == RS2::EntityText)
{
- if (toGuiDX(((RS_Text *)e)->getHeight()) < 4 || e->countDeep() > 100)
+ if (toGuiDX(((Text *)e)->getHeight()) < 4 || e->countDeep() > 100)
painter->drawRect(toGui(e->getMin()), toGui(e->getMax()));
else
drawEntityPlain(e, patternOffset);
for(int i=0; i<s.getNumber(); ++i)
{
int sz = -1;
- RS_Color col = RS_Color(0, 0, 255);
+ Color col = Color(0, 0, 255);
if (e->rtti() == RS2::EntityPolyline)
{
{
sz = 4;
// col = QColor(0, 64, 255);
- col = RS_Color(0, 64, 255);
+ col = Color(0, 64, 255);
}
else
{
sz = 3;
// col = QColor(0, 0, 128);
- col = RS_Color(0, 0, 128);
+ col = Color(0, 0, 128);
}
}
}
}
}
- //RS_DEBUG->print("draw plain OK");
- //RS_DEBUG->print("GraphicView::drawEntity() end");
+ //DEBUG->print("draw plain OK");
+ //DEBUG->print("GraphicView::drawEntity() end");
}
/**
* Draws an entity.
* The painter must be initialized and all the attributes (pen) must be set.
*/
-void GraphicView::drawEntityPlain(RS_Entity * e, double patternOffset/*= 0.0*/)
+void GraphicView::drawEntityPlain(Entity * e, double patternOffset/*= 0.0*/)
{
//Problems can still occur here when passing in a deleted object... It won't be
//NULL, but it will cause a segfault here...
drawGrid();
// drawing entities:
- RS_Pen pen(foreground, RS2::Width00, RS2::SolidLine);
+ Pen pen(foreground, RS2::Width00, RS2::SolidLine);
simulateEntity(container, pen);
// drawing zero points:
*
* @param smooth If true, the entity will be drawn slowly (pixel by pixel).
*/
-void GraphicView::simulateEntity(RS_Entity * e, const RS_Pen & pen)
+void GraphicView::simulateEntity(Entity * e, const Pen & pen)
{
if (!painter || !e)
return;
if (e->isContainer())
{
- RS_EntityContainer * ec = (RS_EntityContainer *)e;
+ EntityContainer * ec = (EntityContainer *)e;
- for(RS_Entity * en=ec->firstEntity(RS2::ResolveNone);
+ for(Entity * en=ec->firstEntity(RS2::ResolveNone);
en!=NULL; en=ec->nextEntity(RS2::ResolveNone))
{
if (en->isVisible() && en->isUndone() == false)
// draw rapid move:
if (en->isAtomic() && simulationRapid)
{
- Vector sp = ((RS_AtomicEntity *)en)->getStartpoint();
+ Vector sp = ((AtomicEntity *)en)->getStartpoint();
if (sp.distanceTo(simulationLast) > 1.0e-4)
{
- RS_Pen rpen(RS_Color(0, 0, 255), RS2::Width00, RS2::SolidLine);
- RS_Line rapidLine(NULL, RS_LineData(simulationLast, sp));
+ Pen rpen(Color(0, 0, 255), RS2::Width00, RS2::SolidLine);
+ Line rapidLine(NULL, LineData(simulationLast, sp));
simulateEntity(&rapidLine, rpen);
}
}
if (en->isHighlighted())
{
- RS_Pen hpen(highlightedColor, RS2::Width00, RS2::SolidLine);
+ Pen hpen(highlightedColor, RS2::Width00, RS2::SolidLine);
simulateEntity(en, hpen);
}
else
simulateEntity(en, pen);
if (en->isAtomic())
- simulationLast = ((RS_AtomicEntity *)en)->getEndpoint();
+ simulationLast = ((AtomicEntity *)en)->getEndpoint();
if (!simulationSmooth)
simulationDelay(true);
{
case RS2::EntityLine:
{
- RS_Line * line = (RS_Line *)e;
+ Line * line = (Line *)e;
drawLineSmooth(toGui(line->getStartpoint()), toGui(line->getEndpoint()), pen);
//simulationSpeed);
}
case RS2::EntityArc:
{
- RS_Arc * arc = (RS_Arc *)e;
+ Arc * arc = (Arc *)e;
drawArcSmooth(toGui(arc->getCenter()), toGuiDX(arc->getRadius()),
arc->getAngle1(), arc->getAngle2(), arc->isReversed(), pen);
}
case RS2::EntityCircle:
{
- RS_Circle * circle = (RS_Circle *)e;
+ Circle * circle = (Circle *)e;
drawArcSmooth(toGui(circle->getCenter()), toGuiDX(circle->getRadius()),
0.0, 2.0 * M_PI, false, pen);
}
/**
* Draws a line slowly from (x1, y1) to (x2, y2). This is used for simulation only.
*/
-void GraphicView::drawLineSmooth(const Vector & p1, const Vector & p2, const RS_Pen & pen)
+void GraphicView::drawLineSmooth(const Vector & p1, const Vector & p2, const Pen & pen)
{
double alpha = p1.angleTo(p2);
double xStep, yStep;
bool xIsOne;
- if (RS_Math::cmpDouble(alpha, 0.0) || RS_Math::cmpDouble(alpha, 2 * M_PI))
+ if (Math::cmpDouble(alpha, 0.0) || Math::cmpDouble(alpha, 2 * M_PI))
{
xStep = 1.0;
yStep = 0.0;
xIsOne = true;
}
- else if (RS_Math::cmpDouble(alpha, M_PI / 2.0))
+ else if (Math::cmpDouble(alpha, M_PI / 2.0))
{
xStep = 0.0;
yStep = 1.0;
xIsOne = false;
}
- else if (RS_Math::cmpDouble(alpha, M_PI))
+ else if (Math::cmpDouble(alpha, M_PI))
{
xStep = -1.0;
yStep = 0.0;
xIsOne = true;
}
- else if (RS_Math::cmpDouble(alpha, M_PI / 2.0 * 3.0))
+ else if (Math::cmpDouble(alpha, M_PI / 2.0 * 3.0))
{
xStep = 0.0;
yStep = -1.0;
}
void GraphicView::drawArcSmooth(const Vector & center, double radius, double a1, double a2, bool rev,
- const RS_Pen & pen)
+ const Pen & pen)
{
if (radius <= 1.4)
{
}
else
{
- int ix1 = RS_Math::round(center.x + cos(a1) * radius);
- int iy1 = RS_Math::round(center.y - sin(a1) * radius);
- int ix2 = RS_Math::round(center.x + cos(a2) * radius);
- int iy2 = RS_Math::round(center.y - sin(a2) * radius);
+ int ix1 = Math::round(center.x + cos(a1) * radius);
+ int iy1 = Math::round(center.y - sin(a1) * radius);
+ int ix2 = Math::round(center.x + cos(a2) * radius);
+ int iy2 = Math::round(center.y - sin(a2) * radius);
int k2x = 0; // Next point on circle
int k2y = 0; //
int k1x = ix1; // Prev point on circle
for(a=a1+aStep; a<=a2cp; a+=aStep)
{
- k2x = RS_Math::round(center.x+cos(a)*radius);
- k2y = RS_Math::round(center.y-sin(a)*radius);
+ k2x = Math::round(center.x+cos(a)*radius);
+ k2y = Math::round(center.y-sin(a)*radius);
painter->setPen(pen);
if ((k2x >= 0 && k2x <= painter->getWidth()
for(a=a1-aStep; a>=a2cp; a-=aStep)
{
- k2x = RS_Math::round(center.x + cos(a) * radius);
- k2y = RS_Math::round(center.y - sin(a) * radius);
+ k2x = Math::round(center.x + cos(a) * radius);
+ k2y = Math::round(center.y - sin(a) * radius);
painter->setPen(pen);
if ((k2x >=0 && k2x <= painter->getWidth()
* @return Pointer to the static pattern struct that belongs to the
* given pattern type or NULL.
*/
-RS_LineTypePattern * GraphicView::getPattern(RS2::LineType t)
+LineTypePattern * GraphicView::getPattern(RS2::LineType t)
{
switch (t)
{
int zr = 20;
-// RS_Pen p(Qt::red, RS2::Width00, RS2::SolidLine);
+// Pen p(Qt::red, RS2::Width00, RS2::SolidLine);
//Using Qt::red doesn't seem to work here...
-//It's because Qt colors and RS_Color are not 100% compatible...
- RS_Pen p(RS_Color(255, 0, 0), RS2::Width00, RS2::SolidLine);
+//It's because Qt colors and Color are not 100% compatible...
+ Pen p(Color(255, 0, 0), RS2::Width00, RS2::SolidLine);
painter->setPen(p);
painter->drawLine(Vector(toGuiX(0.0) - zr, toGuiY(0.0)),
#endif
//Using Qt::red doesn't seem to work here...
- RS_Pen p(RS_Color(255, 0, 0), RS2::Width00, RS2::SolidLine);
+ Pen p(Color(255, 0, 0), RS2::Width00, RS2::SolidLine);
painter->setPen(p);
//This doesn't work--this is NOT a QPainter!
// painter->setBrush(Qt::NoBrush);
return;
// draw paper:
- painter->setPen(RS_Pen(Qt::gray));
+ painter->setPen(Pen(Qt::gray));
Vector pinsbase = graphic->getPaperInsertionBase();
Vector size = graphic->getPaperSize();
Vector v2 = toGui((size - pinsbase) / scale);
// gray background:
- painter->fillRect(0,0, getWidth(), getHeight(), RS_Color(200, 200, 200));
+ painter->fillRect(0,0, getWidth(), getHeight(), Color(200, 200, 200));
// shadow
painter->fillRect((int)(v1.x) + 6, (int)(v1.y) + 6,
- (int)((v2.x - v1.x)), (int)((v2.y - v1.y)), RS_Color(64, 64, 64));
+ (int)((v2.x - v1.x)), (int)((v2.y - v1.y)), Color(64, 64, 64));
// border:
painter->fillRect((int)(v1.x), (int)(v1.y),
- (int)((v2.x - v1.x)), (int)((v2.y - v1.y)), RS_Color(64, 64, 64));
+ (int)((v2.x - v1.x)), (int)((v2.y - v1.y)), Color(64, 64, 64));
// paper
painter->fillRect((int)(v1.x) + 1, (int)(v1.y) - 1,
- (int)((v2.x - v1.x)) - 2, (int)((v2.y - v1.y)) + 2, RS_Color(255, 255, 255));
+ (int)((v2.x - v1.x)) - 2, (int)((v2.y - v1.y)) + 2, Color(255, 255, 255));
}
/**
if (!painter)
return;
- RS_Pen pen(metaGridColor, RS2::Width00, RS2::DotLine);
+ Pen pen(metaGridColor, RS2::Width00, RS2::DotLine);
painter->setPen(pen);
// draw meta grid:
grid->update();
}
-RS_Grid * GraphicView::getGrid()
+Grid * GraphicView::getGrid()
{
return grid;
}
eventHandler->setSnapMode(sm);
//OK, the above sets the snap mode in the snapper that's derived from
- //the RS_ActionInterface and RS_Snapper. So the following should fix
+ //the RS_ActionInterface and Snapper. So the following should fix
//us up, hm notwithstanding. [and it does. :-)]
//hm.
snapper.setSnapMode(sm);
*/
Vector GraphicView::toGraph(Vector v)
{
- return Vector(toGraphX(RS_Math::round(v.x)), toGraphY(RS_Math::round(v.y)), 0.0);
+ return Vector(toGraphX(Math::round(v.x)), toGraphY(Math::round(v.y)), 0.0);
}
/**
setRelativeZero(pos);
}
-RS_EventHandler * GraphicView::getEventHandler()
+EventHandler * GraphicView::getEventHandler()
{
return eventHandler;
}
#define __GRAPHICVIEW_H__
#include <QtGui>
-#include "rs.h"
+#include "enums.h"
#include "color.h"
#include "preview.h"
#include "snapper.h"
#include "vector.h"
class ActionInterface;
-class RS_CommandEvent;
+class CommandEvent;
class Drawing;
class PaintInterface;
-class RS_Entity;
-class RS_EntityContainer;
-class RS_EventHandler;
-class RS_Grid;
-class RS_LineTypePattern;
-class RS_Pen;
+class Entity;
+class EntityContainer;
+class EventHandler;
+class Grid;
+class LineTypePattern;
+class Pen;
class GraphicView
{
called whenever the view changed */
virtual void adjustZoomControls();
- virtual void setBackground(const RS_Color & bg);
- RS_Color getBackground();
- RS_Color getForeground();
- void setGridColor(const RS_Color & c);
- void setMetaGridColor(const RS_Color & c);
- void setSelectedColor(const RS_Color & c);
- void setHighlightedColor(const RS_Color & c);
+ virtual void setBackground(const Color & bg);
+ Color getBackground();
+ Color getForeground();
+ void setGridColor(const Color & c);
+ void setMetaGridColor(const Color & c);
+ void setSelectedColor(const Color & c);
+ void setHighlightedColor(const Color & c);
virtual void setMouseCursor(RS2::CursorType /*c*/);
- void setContainer(RS_EntityContainer * container);
- RS_EntityContainer * getContainer();
+ void setContainer(EntityContainer * container);
+ EntityContainer * getContainer();
void setFactor(double f);
void setFactorX(double f);
void setFactorY(double f);
void mouseEnterEvent();
void keyPressEvent(QKeyEvent * e);
void keyReleaseEvent(QKeyEvent * e);
- void commandEvent(RS_CommandEvent * e);
+ void commandEvent(CommandEvent * e);
void enableCoordinateInput();
void disableCoordinateInput();
virtual void drawWindow(Vector v1, Vector v2);
virtual void drawIt();
- virtual void drawEntity(RS_Entity * e, double patternOffset = 0.0, bool db = false);
- virtual void drawEntityPlain(RS_Entity * e, double patternOffset = 0.0);
- virtual void setPenForEntity(RS_Entity * e);
+ virtual void drawEntity(Entity * e, double patternOffset = 0.0, bool db = false);
+ virtual void drawEntityPlain(Entity * e, double patternOffset = 0.0);
+ virtual void setPenForEntity(Entity * e);
void simulateIt();
- void simulateEntity(RS_Entity * e, const RS_Pen & pen);
- void drawLineSmooth(const Vector & p1, const Vector & p2, const RS_Pen & pen);
+ void simulateEntity(Entity * e, const Pen & pen);
+ void drawLineSmooth(const Vector & p1, const Vector & p2, const Pen & pen);
void drawArcSmooth(const Vector & center, double radius,
- double a1, double a2, bool rev, const RS_Pen & pen);
+ double a1, double a2, bool rev, const Pen & pen);
void simulationDelay(bool step = false);
- virtual RS_LineTypePattern * getPattern(RS2::LineType t);
+ virtual LineTypePattern * getPattern(RS2::LineType t);
virtual void drawAbsoluteZero();
virtual void drawRelativeZero();
virtual void drawGrid();
virtual void drawMetaGrid();
virtual void updateGrid();
- RS_Grid * getGrid();
+ Grid * getGrid();
virtual void updateGridStatusWidget(const QString & /*text*/);
void setDefaultSnapMode(RS2::SnapMode sm);
void setRelativeZero(const Vector & pos);
void moveRelativeZero(const Vector & pos);
- RS_EventHandler * getEventHandler();
+ EventHandler * getEventHandler();
void setPrintPreview(bool pv);
bool isPrintPreview();
void setPrinting(bool p);
bool getSimulationRapid();
protected:
- RS_EntityContainer * container;
- RS_EventHandler * eventHandler;
+ EntityContainer * container;
+ EventHandler * eventHandler;
int mx; //!< Last known mouse cursor position
int my; //!< Last known mouse cursor position
PaintInterface * painter;
- RS_Color background; //! background color (any color)
- RS_Color foreground; //! foreground color (black or white)
- RS_Color gridColor; //! grid color
- RS_Color metaGridColor; //! meta grid color
- RS_Color selectedColor; //! selected color
- RS_Color highlightedColor; //! highlighted color
- RS_Grid * grid; //! Grid
+ Color background; //! background color (any color)
+ Color foreground; //! foreground color (black or white)
+ Color gridColor; //! grid color
+ Color metaGridColor; //! meta grid color
+ Color selectedColor; //! selected color
+ Color highlightedColor; //! highlighted color
+ Grid * grid; //! Grid
/**
* Current default snap mode for this graphic view. Used for new
* actions.
public://for now
// We use this here instead of deriving ActionInterface from it because
// this makes more sense.
- RS_Snapper snapper;
- RS_Preview preview;
+ Snapper snapper;
+ Preview preview;
//QG
protected:
virtual void redraw();
virtual void adjustOffsetControls();
virtual void adjustZoomControls();
- virtual void setBackground(const RS_Color & bg);
+ virtual void setBackground(const Color & bg);
virtual void setMouseCursor(RS2::CursorType c);
virtual void updateGridStatusWidget(const QString & text);
QSplashScreen * splash = 0;
-#ifdef RS_SCRIPTING
+#ifdef SCRIPTING
#include <qsproject.h>
#endif
// Init compiled-in resources
Q_INIT_RESOURCE(architektonas);
- RS_DEBUG->setLevel(RS_Debug::D_WARNING);
- RS_DEBUG->print("param 0: %s", argv[0]);
+ DEBUG->setLevel(Debug::D_WARNING);
+ DEBUG->print("param 0: %s", argv[0]);
// avoid . / , confusion on German environments
setlocale(LC_ALL, "C");
for(int i=0; i<app.argc(); i++)
if (QString("--debug") == app.argv()[i])
- RS_DEBUG->setLevel(RS_Debug::D_DEBUGGING);
+ DEBUG->setLevel(Debug::D_DEBUGGING);
QFileInfo prgInfo(QFile::decodeName(argv[0]));
QString prgDir(prgInfo.absolutePath());
-//fail RS_SYSTEM->init(QC_APPNAME, QC_VERSION, QC_APPDIR, prgDir);
-// RS_SYSTEM->init("Architektonas", QC_VERSION, "qcad", prgDir);
- RS_SYSTEM->init("Architektonas", QC_VERSION, "architektonas", prgDir);
+//fail SYSTEM->init(QC_APPNAME, QC_VERSION, QC_APPDIR, prgDir);
+// SYSTEM->init("Architektonas", QC_VERSION, "qcad", prgDir);
+ SYSTEM->init("Architektonas", QC_VERSION, "architektonas", prgDir);
- RS_FILEIO->registerFilter(new RS_FilterCXF());
- RS_FILEIO->registerFilter(new RS_FilterDXF());
- RS_FILEIO->registerFilter(new RS_FilterDXF1());
+ FILEIO->registerFilter(new FilterCXF());
+ FILEIO->registerFilter(new FilterDXF());
+ FILEIO->registerFilter(new FilterDXF1());
#ifdef RS_OPT_CAM
- RS_FILEIO->registerFilter(new RS_FilterCAM());
+ FILEIO->registerFilter(new FilterCAM());
#endif
// parse command line arguments that might not need a launched program:
// show initial config dialog:
if (unit == "Invalid")
{
- RS_DEBUG->print("main: show initial config dialog..");
+ DEBUG->print("main: show initial config dialog..");
DlgInitial di(NULL);
di.setText("<font size=\"+1\"><b>Welcome to Architektonas</b></font>"
"<br>"
settings.endGroup();
}
- RS_DEBUG->print("main: show initial config dialog: OK");
+ DEBUG->print("main: show initial config dialog: OK");
}
#ifdef QSPLASHSCREEN_H
- RS_DEBUG->print("main: splashscreen..");
+ DEBUG->print("main: splashscreen..");
//# ifdef QC_CUSTOM_SPLASH
// QPixmap * pixmap = new QPixmap(qPixmapFromMimeSource(QC_CUSTOM_SPLASH));
splash->show();
splash->message(app.tr("Loading.."),
Qt::AlignRight|Qt::AlignBottom, QC_SPLASH_TXTCOL);
- RS_DEBUG->print("main: splashscreen: OK");
+ DEBUG->print("main: splashscreen: OK");
*/
#endif
- RS_DEBUG->print("main: init fontlist..");
- RS_FONTLIST->init();
- RS_DEBUG->print("main: init fontlist: OK");
+ DEBUG->print("main: init fontlist..");
+ FONTLIST->init();
+ DEBUG->print("main: init fontlist: OK");
- RS_DEBUG->print("main: init patternlist..");
- RS_PATTERNLIST->init();
- RS_DEBUG->print("main: init patternlist: OK");
+ DEBUG->print("main: init patternlist..");
+ PATTERNLIST->init();
+ DEBUG->print("main: init patternlist: OK");
- RS_DEBUG->print("main: init scriptlist..");
- RS_SCRIPTLIST->init();
- RS_DEBUG->print("main: init scriptlist: OK");
+ DEBUG->print("main: init scriptlist..");
+ SCRIPTLIST->init();
+ DEBUG->print("main: init scriptlist: OK");
- RS_DEBUG->print("main: loading translation..");
+ DEBUG->print("main: loading translation..");
settings.beginGroup("Appearance");
#ifdef QC_PREDEFINED_LOCALE
lang = settings.value("Language", "").toString();
#endif
settings.endGroup();
- RS_SYSTEM->loadTranslation(lang, langCmd);
- RS_DEBUG->print("main: loading translation: OK");
+ SYSTEM->loadTranslation(lang, langCmd);
+ DEBUG->print("main: loading translation: OK");
#ifdef QSPLASHSCREEN_H
splash = new QSplashScreen(*pixmap);
splash->show();
// splash->message(QObject::tr("Loading.."), Qt::AlignRight | Qt::AlignBottom, QC_SPLASH_TXTCOL);
splash->showMessage(QObject::tr("Loading..."), Qt::AlignRight | Qt::AlignBottom, QC_SPLASH_TXTCOL);
- RS_DEBUG->print("main: splashscreen: OK");
+ DEBUG->print("main: splashscreen: OK");
#endif
//QApplication::setStyle(new QWindowsStyle());
#endif
#ifdef QC_BUILTIN_STYLE //js:
- RS_DEBUG->print("main: applying built in style..");
+ DEBUG->print("main: applying built in style..");
applyBuiltinStyle();
#endif
- RS_DEBUG->print("main: creating main window..");
+ DEBUG->print("main: creating main window..");
ApplicationWindow * appWin = new ApplicationWindow();
- RS_DEBUG->print("main: setting caption");
+ DEBUG->print("main: setting caption");
appWin->setWindowTitle("Architektonas");
- RS_DEBUG->print("main: show main window");
+ DEBUG->print("main: show main window");
appWin->show();
- RS_DEBUG->print("main: set focus");
+ DEBUG->print("main: set focus");
appWin->setFocus();
- RS_DEBUG->print("main: creating main window: OK");
+ DEBUG->print("main: creating main window: OK");
#ifdef QSPLASHSCREEN_H
if (splash)
{
- RS_DEBUG->print("main: updating splash..");
+ DEBUG->print("main: updating splash..");
// splash->message(QObject::tr("Loading Library Paths.."),
splash->showMessage(QObject::tr("Loading Library Paths.."),
Qt::AlignRight | Qt::AlignBottom, QC_SPLASH_TXTCOL);
- RS_DEBUG->print("main: processing events");
+ DEBUG->print("main: processing events");
qApp->processEvents();
- RS_DEBUG->print("main: updating splash: OK");
+ DEBUG->print("main: updating splash: OK");
}
#endif
// loading files:
- RS_DEBUG->print("main: loading files..");
+ DEBUG->print("main: loading files..");
bool files_loaded = false;
for(QStringList::Iterator it=fileList.begin(); it!=fileList.end(); ++it)
files_loaded = true;
}
- RS_DEBUG->print("main: loading files: OK");
+ DEBUG->print("main: loading files: OK");
//none of this demo shit
//#ifdef RS_DEMO
//setlocale(LC_NUMERIC, "C");
setlocale(LC_ALL, "C");
- RS_DEBUG->print("main: app.exec()");
+ DEBUG->print("main: app.exec()");
if (!files_loaded)
appWin->slotFileNew();
delete appWin;
- RS_DEBUG->print("main: finished");
+ DEBUG->print("main: finished");
return r;
}
*/
QStringList handleArgs(int argc, char * argv[])
{
- RS_DEBUG->print("main: handling args..");
+ DEBUG->print("main: handling args..");
QStringList ret;
bool doexit = false;
machine = QString(argv[i]);
else
{
- RS_DEBUG->print(RS_Debug::D_WARNING, "No machine configuration given after --convert. Aborting..");
+ DEBUG->print(Debug::D_WARNING, "No machine configuration given after --convert. Aborting..");
exit(1);
}
input = QString(argv[i]);
else
{
- RS_DEBUG->print(RS_Debug::D_WARNING, "No input given after --convert. Aborting..");
+ DEBUG->print(Debug::D_WARNING, "No input given after --convert. Aborting..");
exit(1);
}
output = QString(argv[i]);
else
{
- RS_DEBUG->print(RS_Debug::D_WARNING, "No output given after --convert. Aborting..");
+ DEBUG->print(Debug::D_WARNING, "No output given after --convert. Aborting..");
exit(1);
}
}
// auto cam convert
if (machine.isEmpty() == false && input.isEmpty() == false && output.isEmpty() == false)
{
- RS_FilterCAM fc;
+ FilterCAM fc;
Drawing gr;
- RS_FILEIO->fileImport(gr, input, RS2::FormatUnknown);
+ FILEIO->fileImport(gr, input, RS2::FormatUnknown);
RS_CamDialog dlg(gr, NULL);
dlg.activateMachineGenerator(machine);
dlg.externalOK();
if (doexit)
exit(0);
- RS_DEBUG->print("main: handling args: OK");
+ DEBUG->print("main: handling args: OK");
return ret;
}
* document shall be created for this window.
* @param parent Parent widget. Usually a workspace.
*/
-MDIWindow::MDIWindow(RS_Document * doc, QWidget * parent, const char * name/*= NULL*/,
+MDIWindow::MDIWindow(Document * doc, QWidget * parent, const char * name/*= NULL*/,
Qt::WindowFlags wflags/*= Qt::WDestructiveClose*/):
QMdiSubWindow(parent, Qt::SubWindow), owner(false), forceClosing(false)
#warning "!!! wflags is ignored !!!"
*/
void MDIWindow::addChildWindow(MDIWindow * w)
{
- RS_DEBUG->print("RS_MDIWindow::addChildWindow()");
+ DEBUG->print("RS_MDIWindow::addChildWindow()");
childWindows.append(w);
w->setParentWindow(this);
- RS_DEBUG->print("children: %d", childWindows.count());
+ DEBUG->print("children: %d", childWindows.count());
}
/**
*/
void MDIWindow::removeChildWindow(MDIWindow * w)
{
- RS_DEBUG->print("RS_MDIWindow::removeChildWindow()");
+ DEBUG->print("RS_MDIWindow::removeChildWindow()");
// bool suc = childWindows.remove(w);
bool suc = childWindows.removeOne(w);
- RS_DEBUG->print("successfully removed child window: %d", (int)suc);
+ DEBUG->print("successfully removed child window: %d", (int)suc);
- RS_DEBUG->print("children: %d", childWindows.count());
+ DEBUG->print("children: %d", childWindows.count());
}
/**
// since it's still available in the parent drawing after closing.
if (isBlock)
{
- RS_DEBUG->print(" closing block");
+ DEBUG->print(" closing block");
// tell parent window we're not here anymore.
if (parentWindow)
{
- RS_DEBUG->print(" notifying parent about closing this window");
+ DEBUG->print(" notifying parent about closing this window");
parentWindow->removeChildWindow(this);
}
// This is a graphic document. ask user for closing.
else if (!ask || slotFileClose(force))
{
- RS_DEBUG->print(" closing graphic");
+ DEBUG->print(" closing graphic");
// close all child windows:
bool done;
*/
void MDIWindow::closeEvent(QCloseEvent * ce)
{
- RS_DEBUG->print("MDIWindow::closeEvent begin");
+ DEBUG->print("MDIWindow::closeEvent begin");
if (closeMDI(false, !forceClosing))
ce->accept();
else
ce->ignore();
- RS_DEBUG->print("MDIWindow::closeEvent end");
+ DEBUG->print("MDIWindow::closeEvent end");
}
/**
* @param container Entity container to be used as document or NULL
* if a new document should be created.
*/
-void MDIWindow::initDoc(RS_Document * doc)
+void MDIWindow::initDoc(Document * doc)
{
- RS_DEBUG->print("MDIWindow::initDoc()");
+ DEBUG->print("MDIWindow::initDoc()");
if (!doc)
{
*/
void MDIWindow::initView()
{
- RS_DEBUG->print("MDIWindow::initView()");
+ DEBUG->print("MDIWindow::initView()");
// graphicView = new QC_GraphicView(document, this);
graphicView = new QG_GraphicView(document, this);
* Called when the current pen (color, style, width) has changed.
* Sets the active pen for the document in this MDI window.
*/
-void MDIWindow::slotPenChanged(RS_Pen pen)
+void MDIWindow::slotPenChanged(Pen pen)
{
- RS_DEBUG->print("MDIWindow::slotPenChanged() begin");
+ DEBUG->print("MDIWindow::slotPenChanged() begin");
if (document)
document->setActivePen(pen);
- RS_DEBUG->print("MDIWindow::slotPenChanged() end");
+ DEBUG->print("MDIWindow::slotPenChanged() end");
}
/**
*/
void MDIWindow::slotFileNew()
{
- RS_DEBUG->print("MDIWindow::slotFileNew begin");
+ DEBUG->print("MDIWindow::slotFileNew begin");
if (document && graphicView)
{
graphicView->redraw();
}
- RS_DEBUG->print("MDIWindow::slotFileNew end");
+ DEBUG->print("MDIWindow::slotFileNew end");
}
/**
*/
bool MDIWindow::slotFileOpen(const QString & fileName, RS2::FormatType type)
{
- RS_DEBUG->print("MDIWindow::slotFileOpen");
+ DEBUG->print("MDIWindow::slotFileOpen");
bool ret = false;
if (document != NULL && !fileName.isEmpty())
//QString message=tr("Loaded document: ")+fileName;
//statusBar()->message(message, 2000);
- RS_DEBUG->print("MDIWindow::slotFileOpen: autoZoom");
+ DEBUG->print("MDIWindow::slotFileOpen: autoZoom");
graphicView->zoomAuto(false);
- RS_DEBUG->print("MDIWindow::slotFileOpen: autoZoom: OK");
+ DEBUG->print("MDIWindow::slotFileOpen: autoZoom: OK");
}
else
{
- RS_DEBUG->print("MDIWindow::slotFileOpen: failed");
+ DEBUG->print("MDIWindow::slotFileOpen: failed");
}
}
else
{
- RS_DEBUG->print("MDIWindow::slotFileOpen: cancelled");
+ DEBUG->print("MDIWindow::slotFileOpen: cancelled");
//statusBar()->message(tr("Opening aborted"), 2000);
}
- RS_DEBUG->print("MDIWindow::slotFileOpen: OK");
+ DEBUG->print("MDIWindow::slotFileOpen: OK");
return ret;
}
*/
bool MDIWindow::slotFileSave(bool & cancelled)
{
- RS_DEBUG->print("MDIWindow::slotFileSave()");
+ DEBUG->print("MDIWindow::slotFileSave()");
bool ret = false;
cancelled = false;
*/
bool MDIWindow::slotFileSaveAs(bool & cancelled)
{
- RS_DEBUG->print("MDIWindow::slotFileSaveAs");
+ DEBUG->print("MDIWindow::slotFileSaveAs");
bool ret = false;
cancelled = false;
RS2::FormatType t = RS2::FormatDXF;
*/
bool MDIWindow::slotFileClose(bool force)
{
- RS_DEBUG->print("MDIWindow::slotFileClose()");
+ DEBUG->print("MDIWindow::slotFileClose()");
bool succ = true;
int exit = 0;
void MDIWindow::slotFilePrint()
{
- RS_DEBUG->print("MDIWindow::slotFilePrint");
+ DEBUG->print("MDIWindow::slotFilePrint");
//statusBar()->message(tr("Printing..."));
QPrinter printer;
}
/** @return Pointer to document */
-RS_Document * MDIWindow::getDocument()
+Document * MDIWindow::getDocument()
{
return document;
}
}
/** @return Pointer to current event handler */
-RS_EventHandler * MDIWindow::getEventHandler()
+EventHandler * MDIWindow::getEventHandler()
{
if (graphicView)
return graphicView->getEventHandler();
*/
void MDIWindow::setParentWindow(MDIWindow * p)
{
- RS_DEBUG->print("setParentWindow");
+ DEBUG->print("setParentWindow");
parentWindow = p;
}
#include "layerwidget.h"
#include "pentoolbar.h"
-class RS_EventHandler;
+class EventHandler;
class QG_GraphicView;
/**
Q_OBJECT
public:
- MDIWindow(RS_Document * doc, QWidget * parent, const char * name = NULL,
+ MDIWindow(Document * doc, QWidget * parent, const char * name = NULL,
Qt::WindowFlags wflags = Qt::SubWindow);
~MDIWindow();
- void initDoc(RS_Document * doc = NULL);
+ void initDoc(Document * doc = NULL);
void initView();
public slots:
- void slotPenChanged(RS_Pen p);
+ void slotPenChanged(Pen p);
void slotFileNew();
bool slotFileOpen(const QString & fileName, RS2::FormatType type);
bool slotFileSave(bool & cancelled);
public:
QG_GraphicView * getGraphicView();
- RS_Document * getDocument();
+ Document * getDocument();
Drawing * getGraphic();
- RS_EventHandler * getEventHandler();
+ EventHandler * getEventHandler();
void addChildWindow(MDIWindow * w);
void removeChildWindow(MDIWindow * w);
MDIWindow * getPrintPreview();
//let's see if we can get rid of this...
QG_GraphicView * graphicView;
/** Document */
- RS_Document * document;
+ Document * document;
/** Does the window own the document? */
bool owner;
/**
/**
* Provides a new window for editing the active block.
*/
-void QC_DialogFactory::requestEditBlockWindow(RS_BlockList * blockList)
+void QC_DialogFactory::requestEditBlockWindow(BlockList * blockList)
{
- RS_DEBUG->print("QC_DialogFactory::requestEditBlockWindow()");
+ DEBUG->print("QC_DialogFactory::requestEditBlockWindow()");
ApplicationWindow * appWindow = ApplicationWindow::getAppWindow();
MDIWindow * parent = appWindow->getMDIWindow();
if (parent && blockList)
{
- RS_Block * block = blockList->getActive();
+ Block * block = blockList->getActive();
if (block)
{
/**
* Closes all windows that are editing the given block.
*/
-void QC_DialogFactory::closeEditBlockWindow(RS_Block * block)
+void QC_DialogFactory::closeEditBlockWindow(Block * block)
{
- RS_DEBUG->print("QC_DialogFactory::closeEditBlockWindow");
+ DEBUG->print("QC_DialogFactory::closeEditBlockWindow");
ApplicationWindow * appWindow = ApplicationWindow::getAppWindow();
QMdiArea * workspace = appWindow->getWorkspace();
if (workspace)
{
- RS_DEBUG->print("QC_DialogFactory::closeEditBlockWindow: workspace found");
+ DEBUG->print("QC_DialogFactory::closeEditBlockWindow: workspace found");
QList<QMdiSubWindow *> windows = workspace->subWindowList();
for(int i=0; i<windows.count(); i++)
{
- RS_DEBUG->print("QC_DialogFactory::closeEditBlockWindow: window: %d", i);
+ DEBUG->print("QC_DialogFactory::closeEditBlockWindow: window: %d", i);
MDIWindow * m = (MDIWindow *)windows.at(i);
if (m)
{
- RS_DEBUG->print("QC_DialogFactory::closeEditBlockWindow: got mdi");
+ DEBUG->print("QC_DialogFactory::closeEditBlockWindow: got mdi");
if (m->getDocument() == block)
{
- RS_DEBUG->print("QC_DialogFactory::closeEditBlockWindow: closing mdi");
+ DEBUG->print("QC_DialogFactory::closeEditBlockWindow: closing mdi");
//m->closeMDI(true, false);
// m->close(true);
m->close();
appWindow->slotWindowActivated(NULL);
- RS_DEBUG->print("QC_DialogFactory::closeEditBlockWindow: OK");
+ DEBUG->print("QC_DialogFactory::closeEditBlockWindow: OK");
}
QC_DialogFactory(QWidget * parent, QToolBar * ow);
virtual ~QC_DialogFactory();
- virtual void requestEditBlockWindow(RS_BlockList * blockList = NULL);
- virtual void closeEditBlockWindow(RS_Block * block = NULL);
+ virtual void requestEditBlockWindow(BlockList * blockList = NULL);
+ virtual void closeEditBlockWindow(Block * block = NULL);
};
#endif
*/
ActionHandler::ActionHandler(QG_MainWindowInterface * mw)
{
- RS_DEBUG->print("ActionHandler::ActionHandler");
+ DEBUG->print("ActionHandler::ActionHandler");
mainWindow = mw;
snapFree = NULL;
restrictVertical = NULL;
lockRelativeZero = NULL;
- RS_DEBUG->print("ActionHandler::ActionHandler: OK");
+ DEBUG->print("ActionHandler::ActionHandler: OK");
}
/**
*/
ActionHandler::~ActionHandler()
{
- RS_DEBUG->print("ActionHandler::~ActionHandler");
- RS_DEBUG->print("ActionHandler::~ActionHandler: OK");
+ DEBUG->print("ActionHandler::~ActionHandler");
+ DEBUG->print("ActionHandler::~ActionHandler: OK");
}
/**
ActionInterface * ActionHandler::setCurrentAction(ActionInterface * action)
{
GraphicView * gv = mainWindow->getGraphicView();
- RS_Document * doc = mainWindow->getDocument();
+ Document * doc = mainWindow->getDocument();
// only global options are allowed without a document:
if (gv == NULL || doc == NULL)
*/
ActionInterface * ActionHandler::setCurrentAction(RS2::ActionType id)
{
- RS_DEBUG->print("ActionHandler::setCurrentAction()");
+ DEBUG->print("ActionHandler::setCurrentAction()");
GraphicView * gv = mainWindow->getGraphicView();
- RS_Document * doc = mainWindow->getDocument();
+ Document * doc = mainWindow->getDocument();
ActionInterface * a = NULL;
// only global options are allowed without a document:
if (gv == NULL || doc == NULL)
{
- RS_DEBUG->print(RS_Debug::D_WARNING,
+ DEBUG->print(Debug::D_WARNING,
"ActionHandler::setCurrentAction: graphic view or document is NULL");
return NULL;
}
#endif
default:
- RS_DEBUG->print(RS_Debug::D_WARNING,
+ DEBUG->print(Debug::D_WARNING,
"ActionHandler::setCurrentAction(): No such action found.");
break;
}
if (a)
gv->setCurrentAction(a);
- RS_DEBUG->print("ActionHandler::setCurrentAction(): OK");
+ DEBUG->print("ActionHandler::setCurrentAction(): OK");
return a;
}
// it might be intended to launch a new keycode
//if (!e.isAccepted()) {
// keycode for new action:
- RS2::ActionType type = RS_COMMANDS->keycodeToAction(code);
+ RS2::ActionType type = COMMANDS->keycodeToAction(code);
if (type != RS2::ActionNone)
{
// some actions require special handling (GUI update):
*/
bool ActionHandler::command(const QString & cmd)
{
- RS_DEBUG->print("ActionHandler::command: %s", cmd.toLatin1().data());
+ DEBUG->print("ActionHandler::command: %s", cmd.toLatin1().data());
QString c = cmd.toLower();
if (c == "\n")
if (gv)
gv->back();
- RS_DEBUG->print("ActionHandler::command: back");
+ DEBUG->print("ActionHandler::command: back");
return true;
}
// pass command on to running action:
- RS_CommandEvent e(cmd);
+ CommandEvent e(cmd);
GraphicView * gv = mainWindow->getGraphicView();
if (gv)
{
- RS_DEBUG->print("ActionHandler::command: trigger command event in graphic view");
+ DEBUG->print("ActionHandler::command: trigger command event in graphic view");
gv->commandEvent(&e);
}
// it might be intended to launch a new command
if (!e.isAccepted())
{
- RS_DEBUG->print("ActionHandler::command: convert cmd to action type");
+ DEBUG->print("ActionHandler::command: convert cmd to action type");
// command for new action:
- RS2::ActionType type = RS_COMMANDS->cmdToAction(cmd);
+ RS2::ActionType type = COMMANDS->cmdToAction(cmd);
if (type != RS2::ActionNone)
{
- RS_DEBUG->print("ActionHandler::command: setting current action");
+ DEBUG->print("ActionHandler::command: setting current action");
setCurrentAction(type);
- RS_DEBUG->print("ActionHandler::command: current action set");
+ DEBUG->print("ActionHandler::command: current action set");
return true;
}
}
- RS_DEBUG->print("ActionHandler::command: current action not set");
+ DEBUG->print("ActionHandler::command: current action not set");
return false;
}
#define __ACTIONHANDLER_H__
#include <QtGui>
-#include "rs.h"
+#include "enums.h"
class QG_MainWindowInterface;
class CadToolBarSnap;
delete listBox;
}
-void BlockWidget::setBlockList(RS_BlockList * blockList)
+void BlockWidget::setBlockList(BlockList * blockList)
{
this->blockList = blockList;
update();
}
-RS_BlockList * BlockWidget::getBlockList()
+BlockList * BlockWidget::getBlockList()
{
return blockList;
}
*/
void BlockWidget::update()
{
- RS_DEBUG->print("BlockWidget::update()");
+ DEBUG->print("BlockWidget::update()");
#warning "!!!"
// int yPos = listBox->contentsY();
- RS_Block * activeBlock = NULL;
+ Block * activeBlock = NULL;
if (blockList)
activeBlock = blockList->getActive();
if (!blockList)
{
- RS_DEBUG->print("BlockWidget::update(): blockList is NULL");
+ DEBUG->print("BlockWidget::update(): blockList is NULL");
return;
}
for(uint i=0; i<blockList->count(); ++i)
{
- RS_Block * blk = blockList->at(i);
+ Block * blk = blockList->at(i);
if (!blk->isFrozen())
// listBox->insertItem(pxmVisible, blk->getName());
// listBox->sort();
listBox->sortItems(Qt::AscendingOrder);
- RS_Block * b = lastBlock;
+ Block * b = lastBlock;
highlightBlock(activeBlock);
lastBlock = b;
#warning "!!!"
//highlightBlock(blockList->getActiveBlock());
//listBox->setContentsPos(0, yPos);
- RS_DEBUG->print("BlockWidget::update() done");
+ DEBUG->print("BlockWidget::update() done");
}
/**
* Highlights (activates) the given block and makes it
* the active block in the blocklist.
*/
-void BlockWidget::highlightBlock(RS_Block * block)
+void BlockWidget::highlightBlock(Block * block)
{
- RS_DEBUG->print("BlockWidget::highlightBlock()");
+ DEBUG->print("BlockWidget::highlightBlock()");
if (!block || !listBox)
return;
}
}
-/*virtual*/ void BlockWidget::blockAdded(RS_Block *)
+/*virtual*/ void BlockWidget::blockAdded(Block *)
{
update();
}
-/*virtual*/ void BlockWidget::blockEdited(RS_Block *)
+/*virtual*/ void BlockWidget::blockEdited(Block *)
{
update();
}
-/*virtual*/ void BlockWidget::blockRemoved(RS_Block *)
+/*virtual*/ void BlockWidget::blockRemoved(Block *)
{
update();
}
-/*virtual*/ void BlockWidget::blockToggled(RS_Block *)
+/*virtual*/ void BlockWidget::blockToggled(Block *)
{
update();
}
*/
/*
void BlockWidget::slotToggleView(QListBoxItem* item) {
- RS_DEBUG->print("BlockWidget::slotToggleView()");
+ DEBUG->print("BlockWidget::slotToggleView()");
if (item==NULL || blockList==NULL) {
return;
}
int index = listBox->index(item);
- RS_Block* block = blockList->find(item->text());
+ Block* block = blockList->find(item->text());
if (block!=NULL) {
blockList->toggleBlock(item->text());
void BlockWidget::slotActivated(void)
{
QString blockName = listBox->currentItem()->text();
- RS_DEBUG->print("BlockWidget::slotActivated(): %s", blockName.toLatin1().data());
+ DEBUG->print("BlockWidget::slotActivated(): %s", blockName.toLatin1().data());
if (!blockList)
return;
void BlockWidget::slotMouseButtonClicked(QListWidgetItem * item)
{
QPoint p = mapFromGlobal(QCursor::pos());
- RS_Block * b = lastBlock;
+ Block * b = lastBlock;
//This is crap. We need to fix this so it's not so shitty.
if (p.x() < 23)
#include <QtGui>
-class RS_Block;
-class RS_BlockList;
+class Block;
+class BlockList;
class ActionHandler;
/**
const char * name = 0, Qt::WFlags f = 0);
~BlockWidget();
- void setBlockList(RS_BlockList * blockList);
- RS_BlockList * getBlockList();
+ void setBlockList(BlockList * blockList);
+ BlockList * getBlockList();
void update();
- void highlightBlock(RS_Block * block);
+ void highlightBlock(Block * block);
- virtual void blockAdded(RS_Block *);
- virtual void blockEdited(RS_Block *);
- virtual void blockRemoved(RS_Block *);
- virtual void blockToggled(RS_Block *);
+ virtual void blockAdded(Block *);
+ virtual void blockEdited(Block *);
+ virtual void blockRemoved(Block *);
+ virtual void blockToggled(Block *);
signals:
void escape();
virtual void keyPressEvent(QKeyEvent * e);
private:
- RS_BlockList * blockList;
+ BlockList * blockList;
// Q3ListBox * listBox;
QListWidget * listBox;
- RS_Block * lastBlock;
+ Block * lastBlock;
QPixmap pxmVisible;
QPixmap pxmHidden;
QPixmap pxmAdd;
#include "colorbox.h"
-#include "rs.h"
+#include "enums.h"
/**
* Default Constructor. You must call init manually if you choose
{
}
-RS_Color ColorBox::getColor()
+Color ColorBox::getColor()
{
return currentColor;
}
/**
* Sets the color shown in the combobox to the given color.
*/
-void ColorBox::setColor(const RS_Color & color)
+void ColorBox::setColor(const Color & color)
{
//#warning "!!! Color is being misreported here !!!"
/*
-And fuck. Probably because the operator== in RS_Color doesn't know how to
+And fuck. Probably because the operator== in Color doesn't know how to
convert between Qt:: style colors and RGB. Either way, have to fix this shit
-Look at Red: Have to convert them all to RS_Color...
+Look at Red: Have to convert them all to Color...
*/
currentColor = color;
setCurrentIndex(0);
else if (color.isByBlock() && showByLayer)
setCurrentIndex(1);
- else if (color == RS_Color(255, 0, 0)) //Qt::red)
+ else if (color == Color(255, 0, 0)) //Qt::red)
setCurrentIndex(0 + (int)showByLayer * 2 + (int)showUnchanged);
- else if (color == RS_Color(255, 255, 0)) //Qt::yellow)
+ else if (color == Color(255, 255, 0)) //Qt::yellow)
setCurrentIndex(1 + (int)showByLayer * 2 + (int)showUnchanged);
- else if (color == RS_Color(0, 255, 0)) //Qt::green)
+ else if (color == Color(0, 255, 0)) //Qt::green)
setCurrentIndex(2 + (int)showByLayer * 2 + (int)showUnchanged);
- else if (color == RS_Color(0, 255, 255)) //Qt::cyan)
+ else if (color == Color(0, 255, 255)) //Qt::cyan)
setCurrentIndex(3 + (int)showByLayer * 2 + (int)showUnchanged);
- else if (color == RS_Color(0, 0, 255)) //Qt::blue)
+ else if (color == Color(0, 0, 255)) //Qt::blue)
setCurrentIndex(4 + (int)showByLayer * 2 + (int)showUnchanged);
- else if (color == RS_Color(255, 0, 255)) //Qt::magenta)
+ else if (color == Color(255, 0, 255)) //Qt::magenta)
setCurrentIndex(5 + (int)showByLayer * 2 + (int)showUnchanged);
// else if (color == Qt::white || color == Qt::black)
- else if (color == RS_Color(255, 255, 255) || color == RS_Color(0, 0, 0))
+ else if (color == Color(255, 255, 255) || color == Color(0, 0, 0))
setCurrentIndex(6 + (int)showByLayer * 2 + (int)showUnchanged);
- else if (color == RS_Color(127, 127, 127)) //Qt::gray)
+ else if (color == Color(127, 127, 127)) //Qt::gray)
setCurrentIndex(7 + (int)showByLayer * 2 + (int)showUnchanged);
- else if (color == RS_Color(191, 191, 191))
+ else if (color == Color(191, 191, 191))
setCurrentIndex(8 + (int)showByLayer * 2 + (int)showUnchanged);
else
setCurrentIndex(9 + (int)showByLayer * 2 + (int)showUnchanged);
* Sets the color of the pixmap next to the "By Layer" item
* to the given color.
*/
-void ColorBox::setLayerColor(const RS_Color & color)
+void ColorBox::setLayerColor(const Color & color)
{
if (showByLayer)
{
switch (index - (int)showUnchanged)
{
case 0:
- currentColor = RS_Color(RS2::FlagByLayer);
+ currentColor = Color(RS2::FlagByLayer);
break;
case 1:
- currentColor = RS_Color(RS2::FlagByBlock);
+ currentColor = Color(RS2::FlagByBlock);
break;
default:
break;
QWidget * parent = 0, const char * name = 0);
virtual ~ColorBox();
- RS_Color getColor();
- void setColor(const RS_Color & color);
- void setLayerColor(const RS_Color & color);
+ Color getColor();
+ void setColor(const Color & color);
+ void setLayerColor(const Color & color);
void init(bool showByLayer, bool showUnchanged);
bool isUnchanged();
void slotColorChanged(int index);
signals:
- void colorChanged(const RS_Color & color);
+ void colorChanged(const Color & color);
private:
- RS_Color currentColor;
+ Color currentColor;
bool showByLayer;
bool showUnchanged;
bool unchanged;
{
// read default settings:
settings.beginGroup("Paths");
- QString defDir = settings.value("/Save", RS_SYSTEM->getHomeDir()).toString();
+ QString defDir = settings.value("/Save", SYSTEM->getHomeDir()).toString();
QString defFilter = settings.value("/SaveFilter", "Drawing Exchange DXF 2000 (*.dxf)").toString();
//QString defFilter = "Drawing Exchange (*.dxf)";
settings.endGroup();
*/
QString FileDialog::getOpenFileName(QWidget * parent, RS2::FormatType * type)
{
- RS_DEBUG->print("FileDialog::getOpenFileName");
+ DEBUG->print("FileDialog::getOpenFileName");
// read default settings:
settings.beginGroup("/Paths");
- QString defDir = settings.value("/Open", RS_SYSTEM->getHomeDir()).toString();
+ QString defDir = settings.value("/Open", SYSTEM->getHomeDir()).toString();
//QString defFilter = RS_SETTINGS->readEntry("/OpenFilter",
// "Drawing Exchange (*.dxf *.DXF)");
QString defFilter = "Drawing Exchange (*.dxf *.DXF)";
settings.endGroup();
- RS_DEBUG->print("defDir: %s", defDir.toLatin1().data());
- RS_DEBUG->print("defFilter: %s", defFilter.toLatin1().data());
+ DEBUG->print("defDir: %s", defDir.toLatin1().data());
+ DEBUG->print("defFilter: %s", defFilter.toLatin1().data());
QString fDxf(QObject::tr("Drawing Exchange %1").arg("(*.dxf *.DXF)"));
QString fDxf1(QObject::tr("QCad 1.x file %1").arg("(*.dxf *.DXF)"));
QString fCxf(QObject::tr("Font %1").arg("(*.cxf)"));
- RS_DEBUG->print("fDxf: %s", fDxf.toLatin1().data());
- RS_DEBUG->print("fDxf1: %s", fDxf1.toLatin1().data());
- RS_DEBUG->print("fCxf: %s", fCxf.toLatin1().data());
+ DEBUG->print("fDxf: %s", fDxf.toLatin1().data());
+ DEBUG->print("fDxf1: %s", fDxf1.toLatin1().data());
+ DEBUG->print("fCxf: %s", fCxf.toLatin1().data());
QString fn = "";
bool cancel = false;
settings.endGroup();
}
- RS_DEBUG->print("FileDialog::getOpenFileName: fileName: %s", fn.toLatin1().data());
- RS_DEBUG->print("FileDialog::getOpenFileName: OK");
+ DEBUG->print("FileDialog::getOpenFileName: fileName: %s", fn.toLatin1().data());
+ DEBUG->print("FileDialog::getOpenFileName: OK");
delete prev;
delete gr;
#define __FILEDIALOG_H__
#include <QtGui>
-#include "rs.h"
+#include "enums.h"
/**
* File Open / Save dialogs.
{
QStringList fonts;
- for(RS_Font * f=RS_FONTLIST->firstFont(); f!=NULL; f=RS_FONTLIST->nextFont())
+ for(Font * f=FONTLIST->firstFont(); f!=NULL; f=FONTLIST->nextFont())
fonts.append(f->getFileName());
fonts.sort();
slotFontChanged(currentIndex());
}
-RS_Font * FontBox::getFont()
+Font * FontBox::getFont()
{
return currentFont;
}
*/
void FontBox::setFont(const QString & fName)
{
- RS_DEBUG->print("FontBox::setFont %s\n", fName.toLatin1().data());
+ DEBUG->print("FontBox::setFont %s\n", fName.toLatin1().data());
// setCurrentText(fName);
setItemText(currentIndex(), fName);
// slotFontChanged(currentItem());
*/
void FontBox::slotFontChanged(int index)
{
- RS_DEBUG->print("FontBox::slotFontChanged %d\n", index);
- currentFont = RS_FONTLIST->requestFont(currentText());
+ DEBUG->print("FontBox::slotFontChanged %d\n", index);
+ currentFont = FONTLIST->requestFont(currentText());
if (currentFont != NULL)
- RS_DEBUG->print("Current font is (%d): %s\n", index, currentFont->getFileName().toLatin1().data());
+ DEBUG->print("Current font is (%d): %s\n", index, currentFont->getFileName().toLatin1().data());
emit fontChanged(currentFont);
}
#include <QtGui>
-class RS_Font;
+class Font;
/**
* A combobox for choosing a font name.
virtual ~FontBox();
void init();
- RS_Font * getFont();
+ Font * getFont();
void setFont(const QString & fName);
private slots:
void slotFontChanged(int index);
signals:
- void fontChanged(RS_Font * font);
+ void fontChanged(Font * font);
private:
- RS_Font * currentFont;
+ Font * currentFont;
};
#endif // __FONTBOX_H__
{
}
-RS_Layer * LayerBox::getLayer()
+Layer * LayerBox::getLayer()
{
return currentLayer;
}
* available.
* @param showByBlock true: Show attribute ByBlock.
*/
-void LayerBox::init(RS_LayerList & layerList, bool showByBlock, bool showUnchanged)
+void LayerBox::init(LayerList & layerList, bool showByBlock, bool showUnchanged)
{
this->showByBlock = showByBlock;
this->showUnchanged = showUnchanged;
for(uint i=0; i<layerList.count(); ++i)
{
- RS_Layer * lay = layerList.at(i);
+ Layer * lay = layerList.at(i);
if (lay != NULL && (lay->getName() != "ByBlock" || showByBlock))
// insertItem(lay->getName());
/**
* Sets the layer shown in the combobox to the given layer.
*/
-void LayerBox::setLayer(RS_Layer & layer)
+void LayerBox::setLayer(Layer & layer)
{
currentLayer = &layer;
#include <QtGui>
-class RS_Layer;
-class RS_LayerList;
+class Layer;
+class LayerList;
/**
* A combobox for choosing a layer.
LayerBox(QWidget * parent = 0, const char * name = 0);
virtual ~LayerBox();
- RS_Layer * getLayer();
- void setLayer(RS_Layer & layer);
+ Layer * getLayer();
+ void setLayer(Layer & layer);
void setLayer(QString & layer);
- void init(RS_LayerList & layerList, bool showByBlock, bool showUnchanged);
+ void init(LayerList & layerList, bool showByBlock, bool showUnchanged);
bool isUnchanged();
private slots:
void slotLayerChanged(int index);
signals:
- void layerChanged(RS_Layer * layer);
+ void layerChanged(Layer * layer);
private:
- RS_LayerList * layerList;
- RS_Layer * currentLayer;
+ LayerList * layerList;
+ Layer * currentLayer;
bool showByBlock;
bool showUnchanged;
bool unchanged;
* it exists.
* false: don't show special layer "ByBlock"
*/
-void LayerWidget::setLayerList(RS_LayerList * layerList, bool showByBlock)
+void LayerWidget::setLayerList(LayerList * layerList, bool showByBlock)
{
this->layerList = layerList;
this->showByBlock = showByBlock;
*/
void LayerWidget::update()
{
- RS_DEBUG->print("LayerWidget::update() begin");
+ DEBUG->print("LayerWidget::update() begin");
#warning "!!!"
// int yPos = listBox->contentsY();
- RS_Layer * activeLayer = NULL;
+ Layer * activeLayer = NULL;
if (layerList)
activeLayer = layerList->getActive();
- RS_DEBUG->print("LayerWidget::update() clearing listBox");
+ DEBUG->print("LayerWidget::update() clearing listBox");
listBox->clear();
if (!layerList)
{
- RS_DEBUG->print("LayerWidget::update() abort");
+ DEBUG->print("LayerWidget::update() abort");
return;
}
- RS_DEBUG->print("LayerWidget::update() filling in layers");
+ DEBUG->print("LayerWidget::update() filling in layers");
for(uint i=0; i<layerList->count(); ++i)
{
- RS_Layer * layer = layerList->at(i);
+ Layer * layer = layerList->at(i);
// hide layer "ByBlock"?
if (showByBlock || layer->getName() != "ByBlock")
}
}
- RS_DEBUG->print("LayerWidget::update() sorting");
+ DEBUG->print("LayerWidget::update() sorting");
// listBox->sort();
listBox->sortItems(Qt::AscendingOrder);
- RS_DEBUG->print("LayerWidget::update() reactivating current layer");
+ DEBUG->print("LayerWidget::update() reactivating current layer");
- RS_Layer * l = lastLayer;
+ Layer * l = lastLayer;
highlightLayer(activeLayer);
lastLayer = l;
#warning "!!!"
// listBox->setContentsPos(0, yPos);
- RS_DEBUG->print("LayerWidget::update() end");
+ DEBUG->print("LayerWidget::update() end");
}
/**
* Highlights (activates) the given layer and makes it
* the active layer in the layerlist.
*/
-void LayerWidget::highlightLayer(RS_Layer * layer)
+void LayerWidget::highlightLayer(Layer * layer)
{
- RS_DEBUG->print("LayerWidget::highlightLayer() begin");
+ DEBUG->print("LayerWidget::highlightLayer() begin");
if (!layer || !layerList)
{
- RS_DEBUG->print("LayerWidget::highlightLayer() abort");
+ DEBUG->print("LayerWidget::highlightLayer() abort");
return;
}
QString name = layer->getName();
highlightLayer(name);
- RS_DEBUG->print("LayerWidget::highlightLayer() end");
+ DEBUG->print("LayerWidget::highlightLayer() end");
}
/**
*/
void LayerWidget::highlightLayer(const QString & name)
{
- RS_DEBUG->print("LayerWidget::highlightLayer(name) begin");
+ DEBUG->print("LayerWidget::highlightLayer(name) begin");
if (!layerList)
{
- RS_DEBUG->print("LayerWidget::highlightLayer(name) abort");
+ DEBUG->print("LayerWidget::highlightLayer(name) abort");
return;
}
}
}
- RS_DEBUG->print("LayerWidget::highlightLayer(name) end");
+ DEBUG->print("LayerWidget::highlightLayer(name) end");
}
-void LayerWidget::layerActivated(RS_Layer * layer)
+void LayerWidget::layerActivated(Layer * layer)
{
highlightLayer(layer);
}
-void LayerWidget::layerAdded(RS_Layer * layer)
+void LayerWidget::layerAdded(Layer * layer)
{
update();
highlightLayer(layer);
}
-void LayerWidget::layerEdited(RS_Layer *)
+void LayerWidget::layerEdited(Layer *)
{
update();
}
-void LayerWidget::layerRemoved(RS_Layer *)
+void LayerWidget::layerRemoved(Layer *)
{
update();
highlightLayer(layerList->at(0));
}
-void LayerWidget::layerToggled(RS_Layer *)
+void LayerWidget::layerToggled(Layer *)
{
update();
}
void LayerWidget::slotActivated(void)
{
QString layerName = listBox->currentItem()->text();
- RS_DEBUG->print("LayerWidget::slotActivated(): %s", layerName.toLatin1().data());
+ DEBUG->print("LayerWidget::slotActivated(): %s", layerName.toLatin1().data());
if (!layerList)
return;
//void LayerWidget::slotMouseButtonClicked(int /*button*/, Q3ListBoxItem * item, const QPoint & pos)
void LayerWidget::slotMouseButtonClicked(QListWidgetItem * item)
{
- RS_DEBUG->print("LayerWidget::slotMouseButtonClicked()");
+ DEBUG->print("LayerWidget::slotMouseButtonClicked()");
QPoint p = mapFromGlobal(QCursor::pos());
// only change state / no activation
- RS_Layer * l = lastLayer;
+ Layer * l = lastLayer;
#warning "!!! Bad implementation of lock/freeze functionality !!!"
//This is crap.
#include <QtGui>
class ActionHandler;
-class RS_Layer;
-class RS_LayerList;
+class Layer;
+class LayerList;
/**
* This is the Qt implementation of a widget which can view a
const char * name = 0, Qt::WindowFlags f = 0);
~LayerWidget();
- void setLayerList(RS_LayerList *, bool showByBlock);
+ void setLayerList(LayerList *, bool showByBlock);
void update();
- void highlightLayer(RS_Layer *);
+ void highlightLayer(Layer *);
void highlightLayer(const QString &);
- void layerActivated(RS_Layer *);
- void layerAdded(RS_Layer *);
- void layerEdited(RS_Layer *);
- void layerRemoved(RS_Layer *);
- void layerToggled(RS_Layer *);
+ void layerActivated(Layer *);
+ void layerAdded(Layer *);
+ void layerEdited(Layer *);
+ void layerRemoved(Layer *);
+ void layerToggled(Layer *);
signals:
void escape();
virtual void keyPressEvent(QKeyEvent *);
private:
- RS_LayerList * layerList;
+ LayerList * layerList;
bool showByBlock;
// Q3ListBox * listBox;
QListWidget * listBox;
- RS_Layer * lastLayer;
+ Layer * lastLayer;
QPixmap pxmLayerStatus00;
QPixmap pxmLayerStatus01;
QPixmap pxmLayerStatus10;
*/
void LineTypeBox::setLineType(RS2::LineType t)
{
- RS_DEBUG->print("LineTypeBox::setLineType %d\n", (int)t);
+ DEBUG->print("LineTypeBox::setLineType %d\n", (int)t);
int offset = (int)showByLayer * 2 + (int)showUnchanged;
if (showByLayer)
setCurrentIndex(0 + (int)showUnchanged);
else
- RS_DEBUG->print(RS_Debug::D_WARNING, "LineTypeBox::setLineType: "
+ DEBUG->print(Debug::D_WARNING, "LineTypeBox::setLineType: "
"Combobox doesn't support linetype BYLAYER");
break;
case RS2::LineByBlock:
if (showByLayer)
setCurrentIndex(1 + (int)showUnchanged);
else
- RS_DEBUG->print(RS_Debug::D_WARNING, "LineTypeBox::setLineType: "
+ DEBUG->print(Debug::D_WARNING, "LineTypeBox::setLineType: "
"Combobox doesn't support linetype BYBLOCK");
break;
*/
void LineTypeBox::slotLineTypeChanged(int index)
{
- RS_DEBUG->print("LineTypeBox::slotLineTypeChanged %d\n", index);
+ DEBUG->print("LineTypeBox::slotLineTypeChanged %d\n", index);
unchanged = false;
else
currentLineType = (RS2::LineType)(index - (int)showByLayer * 2 - (int)showUnchanged);
- RS_DEBUG->print("Current linetype is (%d): %d\n", index, currentLineType);
+ DEBUG->print("Current linetype is (%d): %d\n", index, currentLineType);
emit lineTypeChanged(currentLineType);
}
#define __LINETYPEBOX_H__
#include <QtGui>
-#include "rs.h"
+#include "enums.h"
/**
* A combobox for choosing a line type.
{
QStringList patterns;
- for(RS_Pattern * f=RS_PATTERNLIST->firstPattern(); f!=NULL; f=RS_PATTERNLIST->nextPattern())
+ for(Pattern * f=PATTERNLIST->firstPattern(); f!=NULL; f=PATTERNLIST->nextPattern())
patterns.append(f->getFileName());
patterns.sort();
slotPatternChanged(currentIndex());
}
-RS_Pattern * PatternBox::getPattern()
+Pattern * PatternBox::getPattern()
{
return currentPattern;
}
*/
void PatternBox::setPattern(const QString & pName)
{
- RS_DEBUG->print("PatternBox::setPattern %s\n", pName.toLatin1().data());
+ DEBUG->print("PatternBox::setPattern %s\n", pName.toLatin1().data());
// setCurrentText(pName);
setItemText(currentIndex(), pName);
slotPatternChanged(currentIndex());
*/
void PatternBox::slotPatternChanged(int index)
{
- RS_DEBUG->print("PatternBox::slotPatternChanged %d\n", index);
- currentPattern = RS_PATTERNLIST->requestPattern(currentText());
+ DEBUG->print("PatternBox::slotPatternChanged %d\n", index);
+ currentPattern = PATTERNLIST->requestPattern(currentText());
if (currentPattern!=NULL)
- RS_DEBUG->print("Current pattern is (%d): %s\n", index, currentPattern->getFileName().toLatin1().data());
+ DEBUG->print("Current pattern is (%d): %s\n", index, currentPattern->getFileName().toLatin1().data());
emit patternChanged(currentPattern);
}
#include <QtGui>
-class RS_Pattern;
+class Pattern;
/**
* A combobox for choosing a pattern name.
virtual ~PatternBox();
void init();
- RS_Pattern * getPattern();
+ Pattern * getPattern();
void setPattern(const QString & pName);
private slots:
void slotPatternChanged(int index);
signals:
- void patternChanged(RS_Pattern * pattern);
+ void patternChanged(Pattern * pattern);
private:
- RS_Pattern * currentPattern;
+ Pattern * currentPattern;
};
#endif // __PATTERNBOX_H__
widthBox->setMinimumWidth(80);
lineTypeBox->setMinimumWidth(80);
- connect(colorBox, SIGNAL(colorChanged(const RS_Color &)), this,
- SLOT(slotColorChanged(const RS_Color &)));
+ connect(colorBox, SIGNAL(colorChanged(const Color &)), this,
+ SLOT(slotColorChanged(const Color &)));
connect(widthBox, SIGNAL(widthChanged(RS2::LineWidth)), this,
SLOT(slotWidthChanged(RS2::LineWidth)));
connect(lineTypeBox, SIGNAL(lineTypeChanged(RS2::LineType)), this,
delete lineTypeBox;
}
-RS_Pen PenToolBar::getPen()
+Pen PenToolBar::getPen()
{
return currentPen;
}
* Called by the layer list if this object was added as a listener
* to a layer list.
*/
-void PenToolBar::layerActivated(RS_Layer * l)
+void PenToolBar::layerActivated(Layer * l)
{
//printf("PenToolBar::layerActivated\n");
* Called by the layer list (if this object was previously
* added as a listener to a layer list).
*/
-void PenToolBar::layerEdited(RS_Layer *)
+void PenToolBar::layerEdited(Layer *)
{
}
/**
* Called when the color was changed by the user.
*/
-void PenToolBar::slotColorChanged(const RS_Color & color)
+void PenToolBar::slotColorChanged(const Color & color)
{
currentPen.setColor(color);
//printf(" color changed\n");
class ColorBox;
class WidthBox;
class LineTypeBox;
-class RS_Layer;
+class Layer;
/**
* A toolbar that offers all widgets for choosing a pen.
*/
-class PenToolBar: public QToolBar//, public RS_LayerListListener
+class PenToolBar: public QToolBar//, public LayerListListener
{
Q_OBJECT
PenToolBar(QMainWindow * parent = NULL, const char * name = NULL);
virtual ~PenToolBar();
- RS_Pen getPen();
+ Pen getPen();
- // Methods from RS_LayerListListener Interface:
- virtual void layerActivated(RS_Layer *);
- virtual void layerEdited(RS_Layer *);
+ // Methods from LayerListListener Interface:
+ virtual void layerActivated(Layer *);
+ virtual void layerEdited(Layer *);
public slots:
- void slotColorChanged(const RS_Color & color);
+ void slotColorChanged(const Color & color);
void slotWidthChanged(RS2::LineWidth w);
void slotLineTypeChanged(RS2::LineType w);
signals:
- void penChanged(RS_Pen);
+ void penChanged(Pen);
private:
- RS_Pen currentPen;
+ Pen currentPen;
ColorBox * colorBox;
WidthBox * widthBox;
LineTypeBox * lineTypeBox;
*/
//QG_DialogFactory::QG_DialogFactory(QWidget * parent, QWidget * ow):
QG_DialogFactory::QG_DialogFactory(QWidget * parent, QToolBar * ow):
- RS_DialogFactoryInterface()
+ DialogFactoryInterface()
{
- RS_DEBUG->print("QG_DialogFactory::QG_DialogFactory");
+ DEBUG->print("QG_DialogFactory::QG_DialogFactory");
this->parent = parent;
setOptionWidget(ow);
cadToolBar = NULL;
commandWidget = NULL;
mainWindow = NULL;
- RS_DEBUG->print("QG_DialogFactory::QG_DialogFactory: OK");
+ DEBUG->print("QG_DialogFactory::QG_DialogFactory: OK");
}
/**
*/
QG_DialogFactory::~QG_DialogFactory()
{
- RS_DEBUG->print("QG_DialogFactory::~QG_DialogFactory");
- RS_DEBUG->print("QG_DialogFactory::~QG_DialogFactory: OK");
+ DEBUG->print("QG_DialogFactory::~QG_DialogFactory");
+ DEBUG->print("QG_DialogFactory::~QG_DialogFactory: OK");
}
/**
///*virtual*/ void QG_DialogFactory::setOptionWidget(QWidget * ow)
/*virtual*/ void QG_DialogFactory::setOptionWidget(QToolBar * ow)
{
- RS_DEBUG->print("QG_DialogFactory::setOptionWidget");
+ DEBUG->print("QG_DialogFactory::setOptionWidget");
optionWidget = ow;
- RS_DEBUG->print("QG_DialogFactory::setOptionWidget: OK");
+ DEBUG->print("QG_DialogFactory::setOptionWidget: OK");
}
/**
/**
* Requests a new document from the main window.
*/
-GraphicView * QG_DialogFactory::requestNewDocument(const QString & fileName, RS_Document * doc)
+GraphicView * QG_DialogFactory::requestNewDocument(const QString & fileName, Document * doc)
{
if (mainWindow != NULL)
{
* @return a pointer to the newly created layer that
* should be added.
*/
-RS_Layer * QG_DialogFactory::requestNewLayerDialog(RS_LayerList * layerList)
+Layer * QG_DialogFactory::requestNewLayerDialog(LayerList * layerList)
{
- RS_Layer * layer = NULL;
+ Layer * layer = NULL;
QString layer_name = "noname";
int i = 2;
}
// Layer for parameter livery
- layer = new RS_Layer(layer_name);
+ layer = new Layer(layer_name);
// QG_LayerDialog dlg(parent, "Layer Dialog");
LayerDialog dlg(parent);
*
* @return a pointer to the layer that should be removed.
*/
-RS_Layer * QG_DialogFactory::requestLayerRemovalDialog(RS_LayerList * layerList)
+Layer * QG_DialogFactory::requestLayerRemovalDialog(LayerList * layerList)
{
- RS_Layer * layer = NULL;
+ Layer * layer = NULL;
if (layerList == NULL)
{
- RS_DEBUG->print(RS_Debug::D_WARNING,
+ DEBUG->print(Debug::D_WARNING,
"QG_DialogFactory::requestLayerRemovalDialog(): layerList is NULL");
return NULL;
/*
if (layerList==NULL) {
if (container!=NULL && container->rtti()==RS2::EntityGraphic) {
- layerList = (RS_LayerList*)container;
+ layerList = (LayerList*)container;
} else {
return NULL;
}
* @return A pointer to a new layer with the changed attributes
* or NULL if the dialog was cancelled.
*/
-RS_Layer * QG_DialogFactory::requestEditLayerDialog(RS_LayerList * layerList)
+Layer * QG_DialogFactory::requestEditLayerDialog(LayerList * layerList)
{
- RS_DEBUG->print("QG_DialogFactory::requestEditLayerDialog");
- RS_Layer * layer = NULL;
+ DEBUG->print("QG_DialogFactory::requestEditLayerDialog");
+ Layer * layer = NULL;
if (!layerList)
{
- RS_DEBUG->print(RS_Debug::D_WARNING, "QG_DialogFactory::requestEditLayerDialog(): "
+ DEBUG->print(Debug::D_WARNING, "QG_DialogFactory::requestEditLayerDialog(): "
"layerList is NULL");
return NULL;
}
// Layer for parameter livery
if (layerList->getActive())
{
- layer = new RS_Layer(*layerList->getActive());
+ layer = new Layer(*layerList->getActive());
// QG_LayerDialog dlg(parent, QMessageBox::tr("Layer Dialog"));
LayerDialog dlg(parent);
* @return a pointer to the newly created block that
* should be added.
*/
-RS_BlockData QG_DialogFactory::requestNewBlockDialog(RS_BlockList * blockList)
+BlockData QG_DialogFactory::requestNewBlockDialog(BlockList * blockList)
{
- //RS_Block* block = NULL;
- RS_BlockData ret;
- ret = RS_BlockData("", Vector(false), false);
+ //Block* block = NULL;
+ BlockData ret;
+ ret = BlockData("", Vector(false), false);
if (blockList == NULL)
{
- RS_DEBUG->print(RS_Debug::D_WARNING, "QG_DialogFactory::requestNewBlockDialog(): "
+ DEBUG->print(Debug::D_WARNING, "QG_DialogFactory::requestNewBlockDialog(): "
"blockList is NULL");
return ret;
}
// Block for parameter livery
- //block = new RS_Block(container, "noname", Vector(0.0,0.0));
+ //block = new Block(container, "noname", Vector(0.0,0.0));
BlockDialog dlg(parent);
dlg.setBlockList(blockList);
*
* @return a pointer to the modified block or NULL on cancellation.
*/
-RS_BlockData QG_DialogFactory::requestBlockAttributesDialog(RS_BlockList * blockList)
+BlockData QG_DialogFactory::requestBlockAttributesDialog(BlockList * blockList)
{
- //RS_Block* block = NULL;
- RS_BlockData ret;
- ret = RS_BlockData("", Vector(false), false);
+ //Block* block = NULL;
+ BlockData ret;
+ ret = BlockData("", Vector(false), false);
if (blockList == NULL)
{
- RS_DEBUG->print(RS_Debug::D_WARNING, "QG_DialogFactory::requestBlockAttributesDialog(): "
+ DEBUG->print(Debug::D_WARNING, "QG_DialogFactory::requestBlockAttributesDialog(): "
"blockList is NULL");
return ret;
}
/*
if (blockList==NULL) {
if (container!=NULL && container->rtti()==RS2::EntityGraphic) {
- blockList = (RS_BlockList*)container;
+ blockList = (BlockList*)container;
} else {
return NULL;
}
ret = dlg.getBlockData();
}
//else {
- // ret = RS_BlockData("", Vector(false));
+ // ret = BlockData("", Vector(false));
//}
return ret;
}
-/*virtual*/ void QG_DialogFactory::requestEditBlockWindow(RS_BlockList * /*blockList*/)
+/*virtual*/ void QG_DialogFactory::requestEditBlockWindow(BlockList * /*blockList*/)
{
}
-/*virtual*/ void QG_DialogFactory::closeEditBlockWindow(RS_Block * /*blockList*/)
+/*virtual*/ void QG_DialogFactory::closeEditBlockWindow(Block * /*blockList*/)
{
}
*
* @return a pointer to the block that should be removed.
*/
-RS_Block * QG_DialogFactory::requestBlockRemovalDialog(RS_BlockList * blockList)
+Block * QG_DialogFactory::requestBlockRemovalDialog(BlockList * blockList)
{
- RS_Block * block = NULL;
+ Block * block = NULL;
if (blockList == NULL)
{
- RS_DEBUG->print(RS_Debug::D_WARNING, "QG_DialogFactory::requestBlockRemovalDialog(): "
+ DEBUG->print(Debug::D_WARNING, "QG_DialogFactory::requestBlockRemovalDialog(): "
"blockList is NULL");
return NULL;
}
// read default settings:
RS_SETTINGS->beginGroup("/Paths");
QString defDir = RS_SETTINGS->readEntry("/Save",
- RS_SYSTEM->getHomeDir());
+ SYSTEM->getHomeDir());
QString defFilter = RS_SETTINGS->readEntry("/SaveFilter",
"Drawing Exchange (*.dxf)");
RS_SETTINGS->endGroup();
// read default settings:
settings.beginGroup("Paths");
- QString defDir = settings.value("OpenImage", RS_SYSTEM->getHomeDir()).toString();
+ QString defDir = settings.value("OpenImage", SYSTEM->getHomeDir()).toString();
QString defFilter = settings.value("ImageFilter", "Portable Network Graphic (*.png)").toString();
settings.endGroup();
void QG_DialogFactory::requestOptions(ActionInterface * action, bool on, bool update)
{
- RS_DEBUG->print("QG_DialogFactory::requestOptions");
+ DEBUG->print("QG_DialogFactory::requestOptions");
if (action == NULL)
{
- RS_DEBUG->print(RS_Debug::D_WARNING, "QG_DialogFactory::requestOptions: action is NULL");
+ DEBUG->print(Debug::D_WARNING, "QG_DialogFactory::requestOptions: action is NULL");
return;
}
break;
case RS2::ActionDrawLine:
- RS_DEBUG->print("QG_DialogFactory::requestOptions: line");
+ DEBUG->print("QG_DialogFactory::requestOptions: line");
requestLineOptions(action, on);
- RS_DEBUG->print("QG_DialogFactory::requestOptions: line: OK");
+ DEBUG->print("QG_DialogFactory::requestOptions: line: OK");
break;
case RS2::ActionDrawPolyline:
break;
}
- RS_DEBUG->print("QG_DialogFactory::requestOptions: OK");
+ DEBUG->print("QG_DialogFactory::requestOptions: OK");
}
/**
toolWidget->setAction(action);
}
- RS_DEBUG->print("QG_DialogFactory::requestLineOptions: OK");
+ DEBUG->print("QG_DialogFactory::requestLineOptions: OK");
}
/**
* Shows a dialog to edit the attributes of the given dimension entity.
*/
/*
-bool QG_DialogFactory::requestDimAlignedDialog(RS_DimAligned* dim) {
+bool QG_DialogFactory::requestDimAlignedDialog(DimAligned* dim) {
if (dim==NULL) {
return false;
}
/**
* Shows attributes options dialog presenting the given data.
*/
-bool QG_DialogFactory::requestAttributesDialog(RS_AttributesData & data, RS_LayerList & layerList)
+bool QG_DialogFactory::requestAttributesDialog(AttributesData & data, LayerList & layerList)
{
DlgAttributes dlg(parent);
dlg.setData(&data, layerList);
/**
* Shows move options dialog presenting the given data.
*/
-bool QG_DialogFactory::requestMoveDialog(RS_MoveData & data)
+bool QG_DialogFactory::requestMoveDialog(MoveData & data)
{
DlgMove dlg(parent);
dlg.setData(&data);
/**
* Shows rotate options dialog presenting the given data.
*/
-bool QG_DialogFactory::requestRotateDialog(RS_RotateData & data)
+bool QG_DialogFactory::requestRotateDialog(RotateData & data)
{
DlgRotate dlg(parent);
dlg.setData(&data);
/**
* Shows scale options dialog presenting the given data.
*/
-bool QG_DialogFactory::requestScaleDialog(RS_ScaleData & data)
+bool QG_DialogFactory::requestScaleDialog(ScaleData & data)
{
DlgScale dlg(parent);
dlg.setData(&data);
/**
* Shows mirror options dialog presenting the given data.
*/
-bool QG_DialogFactory::requestMirrorDialog(RS_MirrorData & data)
+bool QG_DialogFactory::requestMirrorDialog(MirrorData & data)
{
DlgMirror dlg(parent);
dlg.setData(&data);
/**
* Shows move/rotate options dialog presenting the given data.
*/
-bool QG_DialogFactory::requestMoveRotateDialog(RS_MoveRotateData & data)
+bool QG_DialogFactory::requestMoveRotateDialog(MoveRotateData & data)
{
DlgMoveRotate dlg(parent);
dlg.setData(&data);
/**
* Shows rotate around two centers options dialog presenting the given data.
*/
-bool QG_DialogFactory::requestRotate2Dialog(RS_Rotate2Data & data)
+bool QG_DialogFactory::requestRotate2Dialog(Rotate2Data & data)
{
DlgRotate2 dlg(parent);
dlg.setData(&data);
/**
* Shows a dialog to edit the given entity.
*/
-bool QG_DialogFactory::requestModifyEntityDialog(RS_Entity * entity)
+bool QG_DialogFactory::requestModifyEntityDialog(Entity * entity)
{
if (entity == NULL)
return false;
case RS2::EntityPoint:
{
DlgPoint dlg(parent);
- dlg.setPoint(*((RS_Point *)entity));
+ dlg.setPoint(*((Point *)entity));
if (dlg.exec())
{
case RS2::EntityLine:
{
DlgLine dlg(parent);
- dlg.setLine(*((RS_Line *)entity));
+ dlg.setLine(*((Line *)entity));
if (dlg.exec())
{
case RS2::EntityArc:
{
DlgArc dlg(parent);
- dlg.setArc(*((RS_Arc *)entity));
+ dlg.setArc(*((Arc *)entity));
if (dlg.exec())
{
case RS2::EntityCircle:
{
DlgCircle dlg(parent);
- dlg.setCircle(*((RS_Circle *)entity));
+ dlg.setCircle(*((Circle *)entity));
if (dlg.exec())
{
case RS2::EntityEllipse:
{
DlgEllipse dlg(parent);
- dlg.setEllipse(*((RS_Ellipse *)entity));
+ dlg.setEllipse(*((Ellipse *)entity));
if (dlg.exec())
{
case RS2::EntitySpline:
{
DlgSpline dlg(parent);
- dlg.setSpline(*((RS_Spline *)entity));
+ dlg.setSpline(*((Spline *)entity));
if (dlg.exec())
{
case RS2::EntityInsert:
{
DlgInsert dlg(parent);
- dlg.setInsert(*((RS_Insert *)entity));
+ dlg.setInsert(*((Insert *)entity));
if (dlg.exec())
{
case RS2::EntityDimRadial:
{
DlgDimension dlg(parent);
- dlg.setDim(*((RS_Dimension *)entity));
+ dlg.setDim(*((Dimension *)entity));
if (dlg.exec())
{
dlg.updateDim();
ret = true;
- ((RS_Dimension *)entity)->update(true);
+ ((Dimension *)entity)->update(true);
}
}
break;
case RS2::EntityDimLinear:
{
DlgDimLinear dlg(parent);
- dlg.setDim(*((RS_DimLinear *)entity));
+ dlg.setDim(*((DimLinear *)entity));
if (dlg.exec())
{
dlg.updateDim();
ret = true;
- ((RS_DimLinear *)entity)->update(true);
+ ((DimLinear *)entity)->update(true);
}
}
break;
case RS2::EntityText:
{
DlgText dlg(parent);
- dlg.setText(*((RS_Text *)entity), false);
+ dlg.setText(*((Text *)entity), false);
if (dlg.exec())
{
dlg.updateText();
ret = true;
- ((RS_Text *)entity)->update();
+ ((Text *)entity)->update();
}
}
break;
case RS2::EntityHatch:
{
DlgHatch dlg(parent);
- dlg.setHatch(*((RS_Hatch *)entity), false);
+ dlg.setHatch(*((Hatch *)entity), false);
if (dlg.exec())
{
dlg.updateHatch();
ret = true;
- ((RS_Hatch *)entity)->update();
+ ((Hatch *)entity)->update();
}
}
break;
}
/*
-bool QG_DialogFactory::requestDimAlignedDialog(RS_DimAligned* dim) {
+bool QG_DialogFactory::requestDimAlignedDialog(DimAligned* dim) {
return false;
}
*/
/**
* Shows a dialog to edit the attributes of the given text entity.
*/
-bool QG_DialogFactory::requestTextDialog(RS_Text * text)
+bool QG_DialogFactory::requestTextDialog(Text * text)
{
if (text == NULL)
return false;
/**
* Shows a dialog to edit pattern / hatch attributes of the given entity.
*/
-bool QG_DialogFactory::requestHatchDialog(RS_Hatch * hatch)
+bool QG_DialogFactory::requestHatchDialog(Hatch * hatch)
{
if (hatch == NULL)
return false;
- RS_PATTERNLIST->init();
+ PATTERNLIST->init();
DlgHatch dlg(parent);
dlg.setHatch(*hatch, true);
*/
bool QG_DialogFactory::requestCamOptionsDialog(Drawing& graphic)
{
- RS_DEBUG->print("QG_DialogFactory::requestCamOptionsDialog");
+ DEBUG->print("QG_DialogFactory::requestCamOptionsDialog");
RS_CamDialog dlg(graphic, parent);
- RS_DEBUG->print("QG_DialogFactory::requestCamOptionsDialog: exec");
+ DEBUG->print("QG_DialogFactory::requestCamOptionsDialog: exec");
if (dlg.exec())
{
- RS_DEBUG->print("QG_DialogFactory::requestCamOptionsDialog: OK");
+ DEBUG->print("QG_DialogFactory::requestCamOptionsDialog: OK");
return true;
}
- RS_DEBUG->print("QG_DialogFactory::requestCamOptionsDialog: Cancel");
+ DEBUG->print("QG_DialogFactory::requestCamOptionsDialog: Cancel");
return false;
}
#endif
*/
void QG_DialogFactory::commandMessage(const QString& message)
{
- RS_DEBUG->print("QG_DialogFactory::commandMessage");
+ DEBUG->print("QG_DialogFactory::commandMessage");
if (commandWidget != NULL)
commandWidget->appendHistory(message);
- RS_DEBUG->print("QG_DialogFactory::commandMessage: OK");
+ DEBUG->print("QG_DialogFactory::commandMessage: OK");
}
/*virtual*/ bool QG_DialogFactory::isAdapter()
class CadToolBar;
class CommandWidget;
class CoordinateWidget;
-class RS_Document;
+class Document;
class GraphicView;
class QG_MainWindowInterface;
class MouseWidget;
class SelectionWidget;
-#define QG_DIALOGFACTORY (RS_DialogFactory::instance()->getFactoryObject()->isAdapter() == false ? ((QG_DialogFactory *)RS_DialogFactory::instance()->getFactoryObject()) : NULL)
+#define QG_DIALOGFACTORY (DialogFactory::instance()->getFactoryObject()->isAdapter() == false ? ((QG_DialogFactory *)DialogFactory::instance()->getFactoryObject()) : NULL)
// !A_WIDGET
/**
* This is the Qt implementation of a widget which can create and
* show dialogs.
*/
-class QG_DialogFactory: public RS_DialogFactoryInterface
+class QG_DialogFactory: public DialogFactoryInterface
{
public:
QG_DialogFactory(QWidget * parent, QToolBar * ow);
virtual void requestWarningDialog(const QString& warning);
virtual GraphicView * requestNewDocument(const QString & fileName = QString::null,
- RS_Document * doc = NULL);
+ Document * doc = NULL);
virtual void requestSimulationControls();
- virtual RS_Layer * requestNewLayerDialog(RS_LayerList * layerList = NULL);
- virtual RS_Layer * requestLayerRemovalDialog(RS_LayerList * layerList = NULL);
- virtual RS_Layer * requestEditLayerDialog(RS_LayerList * layerList = NULL);
+ virtual Layer * requestNewLayerDialog(LayerList * layerList = NULL);
+ virtual Layer * requestLayerRemovalDialog(LayerList * layerList = NULL);
+ virtual Layer * requestEditLayerDialog(LayerList * layerList = NULL);
- virtual RS_BlockData requestNewBlockDialog(RS_BlockList * blockList);
- virtual RS_Block * requestBlockRemovalDialog(RS_BlockList * blockList);
- virtual RS_BlockData requestBlockAttributesDialog(RS_BlockList * blockList);
- virtual void requestEditBlockWindow(RS_BlockList * /*blockList*/);
- virtual void closeEditBlockWindow(RS_Block * /*blockList*/);
+ virtual BlockData requestNewBlockDialog(BlockList * blockList);
+ virtual Block * requestBlockRemovalDialog(BlockList * blockList);
+ virtual BlockData requestBlockAttributesDialog(BlockList * blockList);
+ virtual void requestEditBlockWindow(BlockList * /*blockList*/);
+ virtual void closeEditBlockWindow(Block * /*blockList*/);
//virtual QString requestFileSaveAsDialog();
//virtual QString requestFileOpenDialog();
virtual void requestToolBar(RS2::ToolBarId id);
virtual void requestToolBarSelect(ActionInterface * selectAction, RS2::ActionType nextAction);
- virtual bool requestAttributesDialog(RS_AttributesData & data, RS_LayerList & layerList);
- virtual bool requestMoveDialog(RS_MoveData & data);
- virtual bool requestRotateDialog(RS_RotateData & data);
- virtual bool requestScaleDialog(RS_ScaleData & data);
- virtual bool requestMirrorDialog(RS_MirrorData & data);
- virtual bool requestMoveRotateDialog(RS_MoveRotateData & data);
- virtual bool requestRotate2Dialog(RS_Rotate2Data & data);
-
- virtual bool requestModifyEntityDialog(RS_Entity * entity);
- virtual bool requestTextDialog(RS_Text * text);
- virtual bool requestHatchDialog(RS_Hatch * hatch);
+ virtual bool requestAttributesDialog(AttributesData & data, LayerList & layerList);
+ virtual bool requestMoveDialog(MoveData & data);
+ virtual bool requestRotateDialog(RotateData & data);
+ virtual bool requestScaleDialog(ScaleData & data);
+ virtual bool requestMirrorDialog(MirrorData & data);
+ virtual bool requestMoveRotateDialog(MoveRotateData & data);
+ virtual bool requestRotate2Dialog(Rotate2Data & data);
+
+ virtual bool requestModifyEntityDialog(Entity * entity);
+ virtual bool requestTextDialog(Text * text);
+ virtual bool requestHatchDialog(Hatch * hatch);
#ifdef RS_CAM
virtual bool requestCamOptionsDialog(Drawing & graphic);
QG_GraphicView::QG_GraphicView(QWidget * parent, const char */*name*/, Qt::WindowFlags f):
QWidget(parent, f), GraphicView()//, refCount(0)
{
- RS_DEBUG->print("QG_GraphicView::QG_GraphicView(parent, name, flags)...");
+ DEBUG->print("QG_GraphicView::QG_GraphicView(parent, name, flags)...");
CommonInitialization();
}
/**
* Constructor II.
*/
-QG_GraphicView::QG_GraphicView(RS_Document * doc, QWidget * parent)
+QG_GraphicView::QG_GraphicView(Document * doc, QWidget * parent)
{
// QG_GraphicView(parent, "graphicview");
CommonInitialization();
- RS_DEBUG->print("QG_GraphicView::QG_GraphicView(doc, parent)...");
+ DEBUG->print("QG_GraphicView::QG_GraphicView(doc, parent)...");
//document = doc;
- RS_DEBUG->print(" Setting Container...");
+ DEBUG->print(" Setting Container...");
if (doc)
setContainer(doc);
- RS_DEBUG->print(" container set.");
+ DEBUG->print(" container set.");
setFactorX(4.0);
setFactorY(4.0);
setOffset(50, 50);
//hrm.
painter = NULL;
- RS_DEBUG->print("--> Setting up layout...");
+ DEBUG->print("--> Setting up layout...");
QGridLayout * layout = new QGridLayout(this);
layout->setColumnStretch(0, 1);
layout->setColumnStretch(1, 0);
A non-zero alignment indicates that the widget should not grow to fill the available space but should be sized according to sizeHint().
*/
- RS_DEBUG->print("--> Creating hScrollBar...");
+ DEBUG->print("--> Creating hScrollBar...");
// hScrollBar = new QG_ScrollBar(Qt::Horizontal, this);
hScrollBar = new QScrollBar(Qt::Horizontal, this);
// hScrollBar->setLineStep(50);
// layout->addRowSpacing(1, hScrollBar->sizeHint().height());
layout->addItem(new QSpacerItem(0, hScrollBar->sizeHint().height()), 1, 0);
- RS_DEBUG->print("--> Creating vScrollBar...");
+ DEBUG->print("--> Creating vScrollBar...");
// vScrollBar = new QG_ScrollBar(Qt::Vertical, this);
vScrollBar = new QScrollBar(Qt::Vertical, this);
// vScrollBar->setLineStep(50);
/**
* Changes the current background color of this view.
*/
-void QG_GraphicView::setBackground(const RS_Color & bg)
+void QG_GraphicView::setBackground(const Color & bg)
{
GraphicView::setBackground(bg);
*/
void QG_GraphicView::redraw()
{
- RS_DEBUG->print("QG_GraphicView::redraw begin 1");
+ DEBUG->print("QG_GraphicView::redraw begin 1");
if (simulationRunning)
return;
if (!running)
{
running = true;
- RS_DEBUG->print("QG_GraphicView::redraw begin 2");
+ DEBUG->print("QG_GraphicView::redraw begin 2");
/*
This is the only place in the entire codebase that a proper update is
// repaint(false);
update();
- RS_DEBUG->print("QG_GraphicView::redraw end 2");
+ DEBUG->print("QG_GraphicView::redraw end 2");
running = false;
}
- RS_DEBUG->print("QG_GraphicView::redraw end 1");
+ DEBUG->print("QG_GraphicView::redraw end 1");
}
void QG_GraphicView::resizeEvent(QResizeEvent * /*e*/)
{
- RS_DEBUG->print("QG_GraphicView::resizeEvent begin");
+ DEBUG->print("QG_GraphicView::resizeEvent begin");
adjustOffsetControls();
adjustZoomControls();
updateGrid();
- RS_DEBUG->print("QG_GraphicView::resizeEvent end");
+ DEBUG->print("QG_GraphicView::resizeEvent end");
}
/*
And so... We remove it.
*/
#if 0
-// Next three methods from RS_LayerListListener Interface:
-void QG_GraphicView::layerEdited(RS_Layer *)
+// Next three methods from LayerListListener Interface:
+void QG_GraphicView::layerEdited(Layer *)
{
redraw();
}
-void QG_GraphicView::layerRemoved(RS_Layer *)
+void QG_GraphicView::layerRemoved(Layer *)
{
redraw();
}
-void QG_GraphicView::layerToggled(RS_Layer *)
+void QG_GraphicView::layerToggled(Layer *)
{
redraw();
}
void QG_GraphicView::mouseReleaseEvent(QMouseEvent * e)
{
- RS_DEBUG->print("QG_GraphicView::mouseReleaseEvent");
+ DEBUG->print("QG_GraphicView::mouseReleaseEvent");
GraphicView::mouseReleaseEvent(e);
//QWidget::mouseReleaseEvent(e);
{
if (QG_DIALOGFACTORY && QG_DIALOGFACTORY->getCadToolBar())
{
- RS_DEBUG->print("QG_GraphicView::mouseReleaseEvent: fwd to cadtoolbar");
+ DEBUG->print("QG_GraphicView::mouseReleaseEvent: fwd to cadtoolbar");
QG_DIALOGFACTORY->getCadToolBar()->mouseReleaseEvent(e);
}
}
- RS_DEBUG->print("QG_GraphicView::mouseReleaseEvent: OK");
+ DEBUG->print("QG_GraphicView::mouseReleaseEvent: OK");
}
void QG_GraphicView::mouseMoveEvent(QMouseEvent * e)
*/
void QG_GraphicView::wheelEvent(QWheelEvent * e)
{
- //RS_DEBUG->print("wheel: %d", e->delta());
+ //DEBUG->print("wheel: %d", e->delta());
//printf("state: %d\n", e->state());
//printf("ctrl: %d\n", Qt::ControlButton);
running = true;
- RS_DEBUG->print("QG_GraphicView::adjustOffsetControls() begin");
+ DEBUG->print("QG_GraphicView::adjustOffsetControls() begin");
if (!container || !hScrollBar || !vScrollBar)
return;
slotHScrolled(-ox);
slotVScrolled(oy);
- RS_DEBUG->print("H min: %d / max: %d / step: %d / value: %d\n",
+ DEBUG->print("H min: %d / max: %d / step: %d / value: %d\n",
hScrollBar->minimum(), hScrollBar->maximum(), hScrollBar->pageStep(), ox);
- RS_DEBUG->print("V min: %d / max: %d / step: %d / value: %d\n",
+ DEBUG->print("V min: %d / max: %d / step: %d / value: %d\n",
vScrollBar->minimum(), vScrollBar->maximum(), vScrollBar->pageStep(), oy);
enableUpdate();
- RS_DEBUG->print("QG_GraphicView::adjustOffsetControls() end");
+ DEBUG->print("QG_GraphicView::adjustOffsetControls() end");
running = false;
}
//static int running = false;
//if (!running) {
//running = true;
- ////RS_DEBUG->print("value x: %d\n", value);
+ ////DEBUG->print("value x: %d\n", value);
if (hScrollBar->maximum() == hScrollBar->minimum())
centerOffsetX();
else
//static int running = false;
//if (!running) {
//running = true;
- ////RS_DEBUG->print("value y: %d\n", value);
+ ////DEBUG->print("value y: %d\n", value);
if (vScrollBar->maximum() == vScrollBar->minimum())
centerOffsetY();
else
*/
void QG_GraphicView::paintEvent(QPaintEvent *)
{
- RS_DEBUG->print("QG_GraphicView::paintEvent begin");
+ DEBUG->print("QG_GraphicView::paintEvent begin");
if (simulationRunning)
return;
delete painter;
painter = NULL;
- RS_DEBUG->print("QG_GraphicView::paintEvent end");
+ DEBUG->print("QG_GraphicView::paintEvent end");
}
#include <QtGui>
#include "graphicview.h"
-class RS_Document;
+class Document;
class PaintInterface;
-class RS_Preview;
+class Preview;
/**
* This is the Qt implementation of a widget which can view a
public:
QG_GraphicView(QWidget * parent = 0, const char * name = 0, Qt::WindowFlags f = 0);
- QG_GraphicView(RS_Document * doc, QWidget * parent = 0);
+ QG_GraphicView(Document * doc, QWidget * parent = 0);
virtual ~QG_GraphicView();
virtual int getWidth();
virtual void redraw();
virtual void adjustOffsetControls();
virtual void adjustZoomControls();
- virtual void setBackground(const RS_Color & bg);
+ virtual void setBackground(const Color & bg);
virtual void setMouseCursor(RS2::CursorType c);
virtual void updateGridStatusWidget(const QString & text);
// This is just crap. Why have a klunky listener interface when we have slots/signals???
// That's what I thought!!!
- // Methods from RS_LayerListListener Interface:
-// virtual void layerEdited(RS_Layer *);
-// virtual void layerRemoved(RS_Layer *);
-// virtual void layerToggled(RS_Layer *);
+ // Methods from LayerListListener Interface:
+// virtual void layerEdited(Layer *);
+// virtual void layerRemoved(Layer *);
+// virtual void layerToggled(Layer *);
protected:
virtual void emulateMouseMoveEvent();
/**
* Interface for main application windows.
*/
-class QG_MainWindowInterface: public RS_MainWindowInterface
+class QG_MainWindowInterface: public MainWindowInterface
{
public:
QG_MainWindowInterface() {}
*/
void RecentFiles::add(const QString & filename)
{
- RS_DEBUG->print("RecentFiles::add");
+ DEBUG->print("RecentFiles::add");
// Is the file already in the list? Bail out if so...
if (files.indexOf(filename) != -1)
if ((int)files.count() > number)
files.pop_front();
- RS_DEBUG->print("RecentFiles::add: OK");
+ DEBUG->print("RecentFiles::add: OK");
}
/**
*/
void WidthBox::setWidth(RS2::LineWidth w)
{
- RS_DEBUG->print("WidthBox::setWidth %d\n", (int)w);
+ DEBUG->print("WidthBox::setWidth %d\n", (int)w);
int offset = (int)showByLayer * 2 + (int)showUnchanged;
switch (w)
if (showByLayer)
setCurrentIndex(0 + (int)showUnchanged);
else
- RS_DEBUG->print(RS_Debug::D_WARNING, "WidthBox::setWidth: Unsupported width.");
+ DEBUG->print(Debug::D_WARNING, "WidthBox::setWidth: Unsupported width.");
break;
case RS2::WidthByBlock:
if (showByLayer)
setCurrentIndex(1 + (int)showUnchanged);
else
- RS_DEBUG->print(RS_Debug::D_WARNING, "WidthBox::setWidth: Unsupported width.");
+ DEBUG->print(Debug::D_WARNING, "WidthBox::setWidth: Unsupported width.");
break;
case RS2::WidthDefault:
setCurrentIndex(0 + offset);
*/
void WidthBox::slotWidthChanged(int index)
{
- RS_DEBUG->print("WidthBox::slotWidthChanged %d\n", index);
+ DEBUG->print("WidthBox::slotWidthChanged %d\n", index);
bool done = false;
//currentWidth = (RS2::LineWidth)(currentText().left(4).toDouble()*100);
//}
- RS_DEBUG->print("Current width is (%d): %d\n", index, ((int)currentWidth));
+ DEBUG->print("Current width is (%d): %d\n", index, ((int)currentWidth));
emit widthChanged(currentWidth);
}
#define __WIDTHBOX_H__
#include <QtGui>
-#include "rs.h"
+#include "enums.h"
/**
* A combobox for choosing a line width.