#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);
}