1 // rs_actiondimension.cpp
3 // Part of the Architektonas Project
4 // Originally part of QCad Community Edition by Andrew Mustun
5 // Extensively rewritten and refactored by James L. Hammons
6 // (C) 2010 Underground Software
8 // JLH = James L. Hammons <jlhamm@acm.org>
11 // --- ---------- -----------------------------------------------------------
12 // JLH 06/03/2010 Added this text. :-)
15 #include "rs_actiondimension.h"
17 #include "rs_dialogfactory.h"
18 #include "graphicview.h"
20 RS_ActionDimension::RS_ActionDimension(const char * name, RS_EntityContainer & container, GraphicView & graphicView):
21 RS_PreviewActionInterface(name, container, graphicView)
26 RS_ActionDimension::~RS_ActionDimension()
30 void RS_ActionDimension::reset()
32 data = RS_DimensionData(Vector(false), Vector(false), RS2::VAlignMiddle,
33 RS2::HAlignCenter, RS2::Exact, 1.0, "", "Standard", 0.0);
37 void RS_ActionDimension::init(int status)
39 RS_PreviewActionInterface::init(status);
42 void RS_ActionDimension::hideOptions()
44 RS_ActionInterface::hideOptions();
46 if (RS_DIALOGFACTORY != NULL)
47 RS_DIALOGFACTORY->requestOptions(this, false);
50 void RS_ActionDimension::showOptions()
52 RS_ActionInterface::showOptions();
54 if (RS_DIALOGFACTORY != NULL)
55 RS_DIALOGFACTORY->requestOptions(this, true, true);
58 void RS_ActionDimension::updateMouseCursor()
60 graphicView->setMouseCursor(RS2::CadCursor);
63 void RS_ActionDimension::updateToolBar()
65 if (RS_DIALOGFACTORY != NULL)
68 RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarSnap);
70 RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarDim);
74 QString RS_ActionDimension::getText()
76 if (!data.text.isEmpty())
81 if (l.isEmpty() && (diameter || !tol1.isEmpty() || !tol2.isEmpty()))
85 l = QChar(0x2205) + l;
87 if (!tol1.isEmpty() || !tol2.isEmpty())
88 l += QString("\\S%1\\%2;").arg(tol1).arg(tol2);
93 void RS_ActionDimension::setText(const QString & t)
98 QString RS_ActionDimension::getLabel()
103 void RS_ActionDimension::setLabel(const QString & t)
108 QString RS_ActionDimension::getTol1()
113 void RS_ActionDimension::setTol1(const QString & t)
118 QString RS_ActionDimension::getTol2()
123 void RS_ActionDimension::setTol2(const QString & t)
128 bool RS_ActionDimension::getDiameter()
133 void RS_ActionDimension::setDiameter(bool d)
138 /*static*/ bool RS_ActionDimension::isDimensionAction(RS2::ActionType type)
140 return (type == RS2::ActionDimAligned
141 || type == RS2::ActionDimLinear
142 || type == RS2::ActionDimAngular
143 || type == RS2::ActionDimDiametric
144 || type == RS2::ActionDimRadial);