Read attribute color from file.

--HG--
branch : feature
This commit is contained in:
Roman Telezhynskyi 2015-02-07 13:17:31 +02:00
parent 5da451a5ce
commit c595df7517
28 changed files with 232 additions and 182 deletions

View File

@ -50,9 +50,9 @@ const QString VToolAlongLine::ToolType = QStringLiteral("alongLine");
*/
VToolAlongLine::VToolAlongLine(VPattern *doc, VContainer *data, quint32 id, const QString &formula,
const quint32 &firstPointId, const quint32 &secondPointId,
const QString &typeLine, const Source &typeCreation,
const QString &typeLine, const QString &lineColor, const Source &typeCreation,
QGraphicsItem *parent)
:VToolLinePoint(doc, data, id, typeLine, formula, firstPointId, 0, parent), secondPointId(secondPointId)
:VToolLinePoint(doc, data, id, typeLine, lineColor, formula, firstPointId, 0, parent), secondPointId(secondPointId)
{
if (typeCreation == Source::FromGui)
@ -261,10 +261,11 @@ VToolAlongLine* VToolAlongLine::Create(DialogTool *dialog, VMainGraphicsScene *s
const quint32 firstPointId = dialogTool->GetFirstPointId();
const quint32 secondPointId = dialogTool->GetSecondPointId();
const QString typeLine = dialogTool->GetTypeLine();
const QString lineColor = dialogTool->GetLineColor();
const QString pointName = dialogTool->getPointName();
VToolAlongLine *point=nullptr;
point = Create(0, pointName, typeLine, formula, firstPointId, secondPointId, 5, 10, scene, doc, data,
Document::FullParse, Source::FromGui);
point = Create(0, pointName, typeLine, lineColor, formula, firstPointId, secondPointId, 5, 10, scene, doc, data,
Document::FullParse, Source::FromGui);
if (point != nullptr)
{
point->dialog=dialogTool;
@ -290,9 +291,10 @@ VToolAlongLine* VToolAlongLine::Create(DialogTool *dialog, VMainGraphicsScene *s
* @param typeCreation way we create this tool.
*/
VToolAlongLine* VToolAlongLine::Create(const quint32 _id, const QString &pointName, const QString &typeLine,
QString &formula, const quint32 &firstPointId, const quint32 &secondPointId,
const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VPattern *doc,
VContainer *data, const Document &parse, const Source &typeCreation)
const QString &lineColor, QString &formula, const quint32 &firstPointId,
const quint32 &secondPointId, const qreal &mx, const qreal &my,
VMainGraphicsScene *scene, VPattern *doc, VContainer *data,
const Document &parse, const Source &typeCreation)
{
const QSharedPointer<VPointF> firstPoint = data->GeometricObject<VPointF>(firstPointId);
const QSharedPointer<VPointF> secondPoint = data->GeometricObject<VPointF>(secondPointId);
@ -320,8 +322,8 @@ VToolAlongLine* VToolAlongLine::Create(const quint32 _id, const QString &pointNa
VDrawTool::AddRecord(id, Tool::AlongLine, doc);
if (parse == Document::FullParse)
{
VToolAlongLine *point = new VToolAlongLine(doc, data, id, formula, firstPointId,
secondPointId, typeLine, typeCreation);
VToolAlongLine *point = new VToolAlongLine(doc, data, id, formula, firstPointId, secondPointId, typeLine,
lineColor, typeCreation);
scene->addItem(point);
connect(point, &VToolAlongLine::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem);
connect(scene, &VMainGraphicsScene::NewFactor, point, &VToolAlongLine::SetFactor);

View File

@ -40,14 +40,15 @@ class VToolAlongLine : public VToolLinePoint
public:
VToolAlongLine(VPattern *doc, VContainer *data, quint32 id, const QString &formula, const quint32 &firstPointId,
const quint32 &secondPointId, const QString &typeLine, const Source &typeCreation,
QGraphicsItem * parent = nullptr);
const quint32 &secondPointId, const QString &typeLine, const QString &lineColor,
const Source &typeCreation, QGraphicsItem * parent = nullptr);
virtual void setDialog();
static VToolAlongLine* Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, VContainer *data);
static VToolAlongLine* Create(const quint32 _id, const QString &pointName, const QString &typeLine,
QString &formula, const quint32 &firstPointId, const quint32 &secondPointId,
const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VPattern *doc,
VContainer *data, const Document &parse, const Source &typeCreation);
const QString &lineColor, QString &formula, const quint32 &firstPointId,
const quint32 &secondPointId, const qreal &mx, const qreal &my,
VMainGraphicsScene *scene, VPattern *doc, VContainer *data, const Document &parse,
const Source &typeCreation);
static const QString ToolType;
virtual int type() const {return Type;}
enum { Type = UserType + static_cast<int>(Tool::AlongLine)};

View File

@ -47,10 +47,12 @@ const QString VToolArc::ToolType = QStringLiteral("simple");
* @param typeCreation way we create this tool.
* @param parent parent object
*/
VToolArc::VToolArc(VPattern *doc, VContainer *data, quint32 id, const Source &typeCreation, QGraphicsItem *parent)
VToolArc::VToolArc(VPattern *doc, VContainer *data, quint32 id, const QString &color, const Source &typeCreation,
QGraphicsItem *parent)
:VAbstractSpline(doc, data, id, parent)
{
sceneType = SceneObject::Arc;
lineColor = color;
this->setPath(ToolPath());
this->setPen(QPen(Qt::black, qApp->toPixel(qApp->widthHairLine())/factor));
@ -102,8 +104,9 @@ VToolArc* VToolArc::Create(DialogTool *dialog, VMainGraphicsScene *scene, VPatte
QString radius = dialogTool->GetRadius();
QString f1 = dialogTool->GetF1();
QString f2 = dialogTool->GetF2();
const QString color = dialogTool->GetColor();
VToolArc* point = nullptr;
point=Create(0, center, radius, f1, f2, scene, doc, data, Document::FullParse, Source::FromGui);
point=Create(0, center, radius, f1, f2, color, scene, doc, data, Document::FullParse, Source::FromGui);
if (point != nullptr)
{
point->dialog=dialogTool;
@ -126,8 +129,8 @@ VToolArc* VToolArc::Create(DialogTool *dialog, VMainGraphicsScene *scene, VPatte
* @param typeCreation way we create this tool.
*/
VToolArc* VToolArc::Create(const quint32 _id, const quint32 &center, QString &radius, QString &f1, QString &f2,
VMainGraphicsScene *scene, VPattern *doc, VContainer *data, const Document &parse,
const Source &typeCreation)
const QString &color, VMainGraphicsScene *scene, VPattern *doc, VContainer *data,
const Document &parse, const Source &typeCreation)
{
qreal calcRadius = 0, calcF1 = 0, calcF2 = 0;
@ -156,7 +159,7 @@ VToolArc* VToolArc::Create(const quint32 _id, const quint32 &center, QString &ra
VDrawTool::AddRecord(id, Tool::Arc, doc);
if (parse == Document::FullParse)
{
VToolArc *toolArc = new VToolArc(doc, data, id, typeCreation);
VToolArc *toolArc = new VToolArc(doc, data, id, color, typeCreation);
scene->addItem(toolArc);
connect(toolArc, &VToolArc::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem);
connect(scene, &VMainGraphicsScene::NewFactor, toolArc, &VToolArc::SetFactor);

View File

@ -40,12 +40,13 @@ class VToolArc :public VAbstractSpline
{
Q_OBJECT
public:
VToolArc(VPattern *doc, VContainer *data, quint32 id, const Source &typeCreation, QGraphicsItem * parent = nullptr);
VToolArc(VPattern *doc, VContainer *data, quint32 id, const QString &color, const Source &typeCreation,
QGraphicsItem * parent = nullptr);
virtual void setDialog();
static VToolArc* Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, VContainer *data);
static VToolArc* Create(const quint32 _id, const quint32 &center, QString &radius, QString &f1, QString &f2,
VMainGraphicsScene *scene, VPattern *doc, VContainer *data, const Document &parse,
const Source &typeCreation);
const QString &color, VMainGraphicsScene *scene, VPattern *doc, VContainer *data,
const Document &parse, const Source &typeCreation);
static const QString TagName;
static const QString ToolType;
virtual int type() const {return Type;}

View File

@ -49,9 +49,10 @@ const QString VToolBisector::ToolType = QStringLiteral("bisector");
* @param parent parent object.
*/
VToolBisector::VToolBisector(VPattern *doc, VContainer *data, const quint32 &id, const QString &typeLine,
const QString &formula, const quint32 &firstPointId, const quint32 &secondPointId,
const quint32 &thirdPointId, const Source &typeCreation, QGraphicsItem *parent)
:VToolLinePoint(doc, data, id, typeLine, formula, secondPointId, 0, parent), firstPointId(NULL_ID),
const QString &lineColor, const QString &formula, const quint32 &firstPointId,
const quint32 &secondPointId, const quint32 &thirdPointId, const Source &typeCreation,
QGraphicsItem *parent)
:VToolLinePoint(doc, data, id, typeLine, lineColor, formula, secondPointId, 0, parent), firstPointId(NULL_ID),
thirdPointId(NULL_ID)
{
this->firstPointId = firstPointId;
@ -140,10 +141,11 @@ VToolBisector* VToolBisector::Create(DialogTool *dialog, VMainGraphicsScene *sce
const quint32 secondPointId = dialogTool->GetSecondPointId();
const quint32 thirdPointId = dialogTool->GetThirdPointId();
const QString typeLine = dialogTool->GetTypeLine();
const QString lineColor = dialogTool->GetLineColor();
const QString pointName = dialogTool->getPointName();
VToolBisector *point = nullptr;
point=Create(0, formula, firstPointId, secondPointId, thirdPointId, typeLine, pointName, 5, 10, scene, doc, data,
Document::FullParse, Source::FromGui);
point=Create(0, formula, firstPointId, secondPointId, thirdPointId, typeLine, lineColor, pointName, 5, 10, scene,
doc, data, Document::FullParse, Source::FromGui);
if (point != nullptr)
{
point->dialog=dialogTool;
@ -170,10 +172,10 @@ VToolBisector* VToolBisector::Create(DialogTool *dialog, VMainGraphicsScene *sce
* @param typeCreation way we create this tool.
*/
VToolBisector* VToolBisector::Create(const quint32 _id, QString &formula, const quint32 &firstPointId,
const quint32 &secondPointId, const quint32 &thirdPointId, const QString &typeLine,
const QString &pointName, const qreal &mx, const qreal &my,
VMainGraphicsScene *scene, VPattern *doc, VContainer *data,
const Document &parse, const Source &typeCreation)
const quint32 &secondPointId, const quint32 &thirdPointId, const QString &typeLine,
const QString &lineColor, const QString &pointName, const qreal &mx,
const qreal &my, VMainGraphicsScene *scene, VPattern *doc, VContainer *data,
const Document &parse, const Source &typeCreation)
{
const QSharedPointer<VPointF> firstPoint = data->GeometricObject<VPointF>(firstPointId);
const QSharedPointer<VPointF> secondPoint = data->GeometricObject<VPointF>(secondPointId);
@ -201,8 +203,8 @@ VToolBisector* VToolBisector::Create(const quint32 _id, QString &formula, const
VDrawTool::AddRecord(id, Tool::Bisector, doc);
if (parse == Document::FullParse)
{
VToolBisector *point = new VToolBisector(doc, data, id, typeLine, formula, firstPointId, secondPointId,
thirdPointId, typeCreation);
VToolBisector *point = new VToolBisector(doc, data, id, typeLine, lineColor, formula, firstPointId,
secondPointId, thirdPointId, typeCreation);
scene->addItem(point);
connect(point, &VToolPoint::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem);
connect(scene, &VMainGraphicsScene::NewFactor, point, &VToolBisector::SetFactor);

View File

@ -39,9 +39,9 @@ class VToolBisector : public VToolLinePoint
Q_OBJECT
public:
VToolBisector(VPattern *doc, VContainer *data, const quint32 &id, const QString &typeLine, const QString &formula,
const quint32 &firstPointId, const quint32 &secondPointId, const quint32 &thirdPointId,
const Source &typeCreation, QGraphicsItem * parent = nullptr);
VToolBisector(VPattern *doc, VContainer *data, const quint32 &id, const QString &typeLine, const QString &lineColor,
const QString &formula, const quint32 &firstPointId, const quint32 &secondPointId,
const quint32 &thirdPointId, const Source &typeCreation, QGraphicsItem * parent = nullptr);
static qreal BisectorAngle(const QPointF &firstPoint, const QPointF &secondPoint, const QPointF &thirdPoint);
static QPointF FindPoint(const QPointF &firstPoint, const QPointF &secondPoint, const QPointF &thirdPoint,
const qreal& length);
@ -49,8 +49,8 @@ public:
static VToolBisector* Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, VContainer *data);
static VToolBisector* Create(const quint32 _id, QString &formula, const quint32 &firstPointId,
const quint32 &secondPointId, const quint32 &thirdPointId, const QString &typeLine,
const QString &pointName, const qreal &mx, const qreal &my, VMainGraphicsScene *scene,
VPattern *doc, VContainer *data, const Document &parse,
const QString &lineColor, const QString &pointName, const qreal &mx, const qreal &my,
VMainGraphicsScene *scene, VPattern *doc, VContainer *data, const Document &parse,
const Source &typeCreation);
static const QString ToolType;
virtual int type() const {return Type;}

View File

@ -38,10 +38,11 @@ const QString VToolCurveIntersectAxis::ToolType = QStringLiteral("curveIntersect
//---------------------------------------------------------------------------------------------------------------------
VToolCurveIntersectAxis::VToolCurveIntersectAxis(VPattern *doc, VContainer *data, const quint32 &id,
const QString &typeLine, const QString &formulaAngle,
const quint32 &basePointId, const quint32 &curveId,
const Source &typeCreation, QGraphicsItem *parent)
:VToolLinePoint(doc, data, id, typeLine, QString(), basePointId, 0, parent), formulaAngle(formulaAngle),
const QString &typeLine, const QString &lineColor,
const QString &formulaAngle, const quint32 &basePointId,
const quint32 &curveId, const Source &typeCreation,
QGraphicsItem *parent)
:VToolLinePoint(doc, data, id, typeLine, lineColor, QString(), basePointId, 0, parent), formulaAngle(formulaAngle),
curveId(curveId)
{
if (typeCreation == Source::FromGui)
@ -83,12 +84,13 @@ VToolCurveIntersectAxis *VToolCurveIntersectAxis::Create(DialogTool *dialog, VMa
SCASSERT(dialogTool);
const QString pointName = dialogTool->getPointName();
const QString typeLine = dialogTool->GetTypeLine();
const QString lineColor = dialogTool->GetLineColor();
QString formulaAngle = dialogTool->GetAngle();
const quint32 basePointId = dialogTool->GetBasePointId();
const quint32 curveId = dialogTool->getCurveId();
VToolCurveIntersectAxis *point = nullptr;
point=Create(0, pointName, typeLine, formulaAngle, basePointId, curveId, 5, 10, scene, doc, data,
point=Create(0, pointName, typeLine, lineColor, formulaAngle, basePointId, curveId, 5, 10, scene, doc, data,
Document::FullParse, Source::FromGui);
if (point != nullptr)
{
@ -99,9 +101,9 @@ VToolCurveIntersectAxis *VToolCurveIntersectAxis::Create(DialogTool *dialog, VMa
//---------------------------------------------------------------------------------------------------------------------
VToolCurveIntersectAxis *VToolCurveIntersectAxis::Create(const quint32 _id, const QString &pointName,
const QString &typeLine, QString &formulaAngle,
const quint32 &basePointId, const quint32 &curveId,
const qreal &mx, const qreal &my,
const QString &typeLine, const QString &lineColor,
QString &formulaAngle, const quint32 &basePointId,
const quint32 &curveId, const qreal &mx, const qreal &my,
VMainGraphicsScene *scene, VPattern *doc, VContainer *data,
const Document &parse, const Source &typeCreation)
{
@ -128,8 +130,8 @@ VToolCurveIntersectAxis *VToolCurveIntersectAxis::Create(const quint32 _id, cons
VDrawTool::AddRecord(id, Tool::CurveIntersectAxis, doc);
if (parse == Document::FullParse)
{
VToolCurveIntersectAxis *point = new VToolCurveIntersectAxis(doc, data, id, typeLine, formulaAngle, basePointId,
curveId, typeCreation);
VToolCurveIntersectAxis *point = new VToolCurveIntersectAxis(doc, data, id, typeLine, lineColor, formulaAngle,
basePointId, curveId, typeCreation);
scene->addItem(point);
connect(point, &VToolPoint::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem);
connect(scene, &VMainGraphicsScene::NewFactor, point, &VToolCurveIntersectAxis::SetFactor);

View File

@ -36,17 +36,18 @@ class VToolCurveIntersectAxis : public VToolLinePoint
Q_OBJECT
public:
VToolCurveIntersectAxis(VPattern *doc, VContainer *data, const quint32 &id, const QString &typeLine,
const QString &formulaAngle, const quint32 &basePointId, const quint32 &curveId,
const Source &typeCreation, QGraphicsItem * parent = nullptr);
const QString &lineColor, const QString &formulaAngle, const quint32 &basePointId,
const quint32 &curveId, const Source &typeCreation, QGraphicsItem * parent = nullptr);
virtual ~VToolCurveIntersectAxis();
virtual void setDialog();
static VToolCurveIntersectAxis *Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc,
VContainer *data);
static VToolCurveIntersectAxis *Create(const quint32 _id, const QString &pointName, const QString &typeLine,
QString &formulaAngle, const quint32 &basePointId, const quint32 &curveId,
const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VPattern *doc,
VContainer *data, const Document &parse, const Source &typeCreation);
const QString &lineColor, QString &formulaAngle, const quint32 &basePointId,
const quint32 &curveId, const qreal &mx, const qreal &my,
VMainGraphicsScene *scene, VPattern *doc, VContainer *data,
const Document &parse, const Source &typeCreation);
static QPointF FindPoint(const QPointF &point, qreal angle, const QSharedPointer<VAbstractCurve> &curve);

View File

@ -50,9 +50,10 @@ const QString VToolEndLine::ToolType = QStringLiteral("endLine");
* @param parent parent object.
*/
VToolEndLine::VToolEndLine(VPattern *doc, VContainer *data, const quint32 &id, const QString &typeLine,
const QString &formulaLength, const QString &formulaAngle, const quint32 &basePointId,
const Source &typeCreation, QGraphicsItem *parent)
:VToolLinePoint(doc, data, id, typeLine, formulaLength, basePointId, 0, parent), formulaAngle(formulaAngle)
const QString &lineColor, const QString &formulaLength, const QString &formulaAngle,
const quint32 &basePointId, const Source &typeCreation, QGraphicsItem *parent)
:VToolLinePoint(doc, data, id, typeLine, lineColor, formulaLength, basePointId, 0, parent),
formulaAngle(formulaAngle)
{
if (typeCreation == Source::FromGui)
{
@ -103,12 +104,13 @@ VToolEndLine* VToolEndLine::Create(DialogTool *dialog, VMainGraphicsScene *scene
SCASSERT(dialogTool);
const QString pointName = dialogTool->getPointName();
const QString typeLine = dialogTool->GetTypeLine();
const QString lineColor = dialogTool->GetLineColor();
QString formulaLength = dialogTool->GetFormula();
QString formulaAngle = dialogTool->GetAngle();
const quint32 basePointId = dialogTool->GetBasePointId();
VToolEndLine *point = nullptr;
point=Create(0, pointName, typeLine, formulaLength, formulaAngle, basePointId, 5, 10, scene, doc, data,
point=Create(0, pointName, typeLine, lineColor, formulaLength, formulaAngle, basePointId, 5, 10, scene, doc, data,
Document::FullParse, Source::FromGui);
if (point != nullptr)
{
@ -123,6 +125,7 @@ VToolEndLine* VToolEndLine::Create(DialogTool *dialog, VMainGraphicsScene *scene
* @param _id tool id, 0 if tool doesn't exist yet.
* @param pointName point name.
* @param typeLine line type.
* @param lineColor line color.
* @param formulaLength string with formula length of line.
* @param formulaAngle formula angle of line.
* @param basePointId id first point of line.
@ -136,9 +139,10 @@ VToolEndLine* VToolEndLine::Create(DialogTool *dialog, VMainGraphicsScene *scene
* @return the created tool
*/
VToolEndLine* VToolEndLine::Create(const quint32 _id, const QString &pointName, const QString &typeLine,
QString &formulaLength, QString &formulaAngle, const quint32 &basePointId,
const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VPattern *doc,
VContainer *data, const Document &parse, const Source &typeCreation)
const QString &lineColor, QString &formulaLength, QString &formulaAngle,
const quint32 &basePointId, const qreal &mx, const qreal &my,
VMainGraphicsScene *scene, VPattern *doc, VContainer *data, const Document &parse,
const Source &typeCreation)
{
const QSharedPointer<VPointF> basePoint = data->GeometricObject<VPointF>(basePointId);
QLineF line = QLineF(basePoint->toQPointF(), QPointF(basePoint->x()+100, basePoint->y()));
@ -163,8 +167,8 @@ VToolEndLine* VToolEndLine::Create(const quint32 _id, const QString &pointName,
VDrawTool::AddRecord(id, Tool::EndLine, doc);
if (parse == Document::FullParse)
{
VToolEndLine *point = new VToolEndLine(doc, data, id, typeLine, formulaLength, formulaAngle, basePointId,
typeCreation);
VToolEndLine *point = new VToolEndLine(doc, data, id, typeLine, lineColor, formulaLength, formulaAngle,
basePointId, typeCreation);
scene->addItem(point);
connect(point, &VToolPoint::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem);
connect(scene, &VMainGraphicsScene::NewFactor, point, &VToolEndLine::SetFactor);

View File

@ -39,16 +39,17 @@ class VToolEndLine : public VToolLinePoint
Q_OBJECT
public:
VToolEndLine(VPattern *doc, VContainer *data, const quint32 &id, const QString &typeLine,
VToolEndLine(VPattern *doc, VContainer *data, const quint32 &id, const QString &typeLine, const QString &lineColor,
const QString &formulaLength, const QString &formulaAngle, const quint32 &basePointId,
const Source &typeCreation, QGraphicsItem * parent = nullptr);
virtual ~VToolEndLine();
virtual void setDialog();
static VToolEndLine *Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, VContainer *data);
static VToolEndLine *Create(const quint32 _id, const QString &pointName, const QString &typeLine,
QString &formulaLength, QString &formulaAngle, const quint32 &basePointId,
const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VPattern *doc,
VContainer *data, const Document &parse, const Source &typeCreation);
const QString &lineColor, QString &formulaLength, QString &formulaAngle,
const quint32 &basePointId, const qreal &mx, const qreal &my,
VMainGraphicsScene *scene, VPattern *doc, VContainer *data, const Document &parse,
const Source &typeCreation);
static const QString ToolType;
virtual int type() const {return Type;}
enum { Type = UserType + static_cast<int>(Tool::EndLine)};

View File

@ -47,9 +47,10 @@ const QString VToolHeight::ToolType = QStringLiteral("height");
* @param parent parent object.
*/
VToolHeight::VToolHeight(VPattern *doc, VContainer *data, const quint32 &id, const QString &typeLine,
const quint32 &basePointId, const quint32 &p1LineId, const quint32 &p2LineId,
const Source &typeCreation, QGraphicsItem * parent)
:VToolLinePoint(doc, data, id, typeLine, QString(), basePointId, 0, parent), p1LineId(p1LineId), p2LineId(p2LineId)
const QString &lineColor, const quint32 &basePointId, const quint32 &p1LineId,
const quint32 &p2LineId, const Source &typeCreation, QGraphicsItem * parent)
:VToolLinePoint(doc, data, id, typeLine, lineColor, QString(), basePointId, 0, parent), p1LineId(p1LineId),
p2LineId(p2LineId)
{
ignoreFullUpdate = true;
if (typeCreation == Source::FromGui)
@ -97,12 +98,13 @@ VToolHeight* VToolHeight::Create(DialogTool *dialog, VMainGraphicsScene *scene,
disconnect(doc, &VPattern::FullUpdateFromFile, dialogTool, &DialogHeight::UpdateList);
const QString pointName = dialogTool->getPointName();
const QString typeLine = dialogTool->GetTypeLine();
const QString lineColor = dialogTool->GetLineColor();
const quint32 basePointId = dialogTool->GetBasePointId();
const quint32 p1LineId = dialogTool->GetP1LineId();
const quint32 p2LineId = dialogTool->GetP2LineId();
VToolHeight *point = nullptr;
point = Create(0, pointName, typeLine, basePointId, p1LineId, p2LineId, 5, 10, scene, doc, data,
point = Create(0, pointName, typeLine, lineColor, basePointId, p1LineId, p2LineId, 5, 10, scene, doc, data,
Document::FullParse, Source::FromGui);
if (point != nullptr)
{
@ -130,9 +132,9 @@ VToolHeight* VToolHeight::Create(DialogTool *dialog, VMainGraphicsScene *scene,
* @return the created tool
*/
VToolHeight* VToolHeight::Create(const quint32 _id, const QString &pointName, const QString &typeLine,
const quint32 &basePointId, const quint32 &p1LineId, const quint32 &p2LineId,
const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VPattern *doc,
VContainer *data, const Document &parse, const Source &typeCreation)
const QString &lineColor, const quint32 &basePointId, const quint32 &p1LineId,
const quint32 &p2LineId, const qreal &mx, const qreal &my, VMainGraphicsScene *scene,
VPattern *doc, VContainer *data, const Document &parse, const Source &typeCreation)
{
const QSharedPointer<VPointF> basePoint = data->GeometricObject<VPointF>(basePointId);
const QSharedPointer<VPointF> p1Line = data->GeometricObject<VPointF>(p1LineId);
@ -161,7 +163,7 @@ VToolHeight* VToolHeight::Create(const quint32 _id, const QString &pointName, co
VDrawTool::AddRecord(id, Tool::Height, doc);
if (parse == Document::FullParse)
{
VToolHeight *point = new VToolHeight(doc, data, id, typeLine, basePointId, p1LineId, p2LineId,
VToolHeight *point = new VToolHeight(doc, data, id, typeLine, lineColor, basePointId, p1LineId, p2LineId,
typeCreation);
scene->addItem(point);
connect(point, &VToolPoint::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem);

View File

@ -39,15 +39,15 @@ class VToolHeight: public VToolLinePoint
Q_OBJECT
public:
VToolHeight(VPattern *doc, VContainer *data, const quint32 &id, const QString &typeLine, const quint32 &basePointId,
const quint32 &p1LineId, const quint32 &p2LineId, const Source &typeCreation,
QGraphicsItem * parent = nullptr);
VToolHeight(VPattern *doc, VContainer *data, const quint32 &id, const QString &typeLine, const QString &lineColor,
const quint32 &basePointId, const quint32 &p1LineId, const quint32 &p2LineId,
const Source &typeCreation, QGraphicsItem * parent = nullptr);
virtual void setDialog();
static VToolHeight *Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, VContainer *data);
static VToolHeight *Create(const quint32 _id, const QString &pointName, const QString &typeLine,
const quint32 &basePointId, const quint32 &p1LineId, const quint32 &p2LineId,
const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VPattern *doc,
VContainer *data, const Document &parse, const Source &typeCreation);
const QString &lineColor, const quint32 &basePointId, const quint32 &p1LineId,
const quint32 &p2LineId, const qreal &mx, const qreal &my, VMainGraphicsScene *scene,
VPattern *doc, VContainer *data, const Document &parse, const Source &typeCreation);
static QPointF FindPoint(const QLineF &line, const QPointF &point);
static const QString ToolType;
virtual int type() const {return Type;}

View File

@ -48,10 +48,12 @@ const QString VToolLine::TagName = QStringLiteral("line");
* @param parent parent object.
*/
VToolLine::VToolLine(VPattern *doc, VContainer *data, quint32 id, quint32 firstPoint, quint32 secondPoint,
const QString &typeLine, const Source &typeCreation, QGraphicsItem *parent)
const QString &typeLine, const QString &lineColor, const Source &typeCreation,
QGraphicsItem *parent)
:VDrawTool(doc, data, id), QGraphicsLineItem(parent), firstPoint(firstPoint), secondPoint(secondPoint)
{
this->typeLine = typeLine;
this->lineColor = lineColor;
ignoreFullUpdate = true;
//Line
const QSharedPointer<VPointF> first = data->GeometricObject<VPointF>(firstPoint);
@ -104,9 +106,11 @@ VToolLine *VToolLine::Create(DialogTool *dialog, VMainGraphicsScene *scene, VPat
const quint32 firstPoint = dialogTool->GetFirstPoint();
const quint32 secondPoint = dialogTool->GetSecondPoint();
const QString typeLine = dialogTool->GetTypeLine();
const QString lineColor = dialogTool->GetLineColor();
VToolLine *line = nullptr;
line = Create(0, firstPoint, secondPoint, typeLine, scene, doc, data, Document::FullParse, Source::FromGui);
line = Create(0, firstPoint, secondPoint, typeLine, lineColor, scene, doc, data, Document::FullParse,
Source::FromGui);
if (line != nullptr)
{
line->dialog=dialogTool;
@ -128,8 +132,8 @@ VToolLine *VToolLine::Create(DialogTool *dialog, VMainGraphicsScene *scene, VPat
* @param typeCreation way we create this tool.
*/
VToolLine * VToolLine::Create(const quint32 &_id, const quint32 &firstPoint, const quint32 &secondPoint,
const QString &typeLine, VMainGraphicsScene *scene, VPattern *doc, VContainer *data,
const Document &parse, const Source &typeCreation)
const QString &typeLine, const QString &lineColor, VMainGraphicsScene *scene,
VPattern *doc, VContainer *data, const Document &parse, const Source &typeCreation)
{
SCASSERT(scene != nullptr);
SCASSERT(doc != nullptr);
@ -152,7 +156,7 @@ VToolLine * VToolLine::Create(const quint32 &_id, const quint32 &firstPoint, con
VDrawTool::AddRecord(id, Tool::Line, doc);
if (parse == Document::FullParse)
{
VToolLine *line = new VToolLine(doc, data, id, firstPoint, secondPoint, typeLine, typeCreation);
VToolLine *line = new VToolLine(doc, data, id, firstPoint, secondPoint, typeLine, lineColor, typeCreation);
scene->addItem(line);
connect(line, &VToolLine::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem);
connect(scene, &VMainGraphicsScene::NewFactor, line, &VToolLine::SetFactor);
@ -485,6 +489,6 @@ void VToolLine::RefreshGeometry()
const QSharedPointer<VPointF> first = VAbstractTool::data.GeometricObject<VPointF>(firstPoint);
const QSharedPointer<VPointF> second = VAbstractTool::data.GeometricObject<VPointF>(secondPoint);
this->setLine(QLineF(first->toQPointF(), second->toQPointF()));
this->setPen(QPen(CorrectColor(baseColor), qApp->toPixel(qApp->widthHairLine())/factor,
this->setPen(QPen(CorrectColor(lineColor), qApp->toPixel(qApp->widthHairLine())/factor,
LineStyleToPenStyle(typeLine)));
}

View File

@ -40,12 +40,13 @@ class VToolLine: public VDrawTool, public QGraphicsLineItem
Q_OBJECT
public:
VToolLine(VPattern *doc, VContainer *data, quint32 id, quint32 firstPoint, quint32 secondPoint,
const QString &typeLine, const Source &typeCreation, QGraphicsItem * parent = nullptr);
const QString &typeLine, const QString &lineColor, const Source &typeCreation,
QGraphicsItem * parent = nullptr);
virtual void setDialog();
static VToolLine *Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, VContainer *data);
static VToolLine *Create(const quint32 &_id, const quint32 &firstPoint, const quint32 &secondPoint,
const QString &typeLine, VMainGraphicsScene *scene, VPattern *doc, VContainer *data,
const Document &parse, const Source &typeCreation);
const QString &typeLine, const QString &lineColor, VMainGraphicsScene *scene,
VPattern *doc, VContainer *data, const Document &parse, const Source &typeCreation);
static const QString TagName;
virtual void paint(QPainter * painter, const QStyleOptionGraphicsItem * option, QWidget * widget = 0);
virtual int type() const {return Type;}

View File

@ -38,11 +38,11 @@ const QString VToolLineIntersectAxis::ToolType = QStringLiteral("lineIntersectAx
//---------------------------------------------------------------------------------------------------------------------
VToolLineIntersectAxis::VToolLineIntersectAxis(VPattern *doc, VContainer *data, const quint32 &id,
const QString &typeLine, const QString &formulaAngle,
const quint32 &basePointId, const quint32 &firstPointId,
const quint32 &secondPointId, const Source &typeCreation,
QGraphicsItem *parent)
:VToolLinePoint(doc, data, id, typeLine, QString(), basePointId, 0, parent), formulaAngle(formulaAngle),
const QString &typeLine, const QString &lineColor,
const QString &formulaAngle, const quint32 &basePointId,
const quint32 &firstPointId, const quint32 &secondPointId,
const Source &typeCreation, QGraphicsItem *parent)
:VToolLinePoint(doc, data, id, typeLine, lineColor, QString(), basePointId, 0, parent), formulaAngle(formulaAngle),
firstPointId(firstPointId), secondPointId(secondPointId)
{
if (typeCreation == Source::FromGui)
@ -85,14 +85,15 @@ VToolLineIntersectAxis *VToolLineIntersectAxis::Create(DialogTool *dialog, VMain
SCASSERT(dialogTool);
const QString pointName = dialogTool->getPointName();
const QString typeLine = dialogTool->GetTypeLine();
const QString lineColor = dialogTool->GetLineColor();
QString formulaAngle = dialogTool->GetAngle();
const quint32 basePointId = dialogTool->GetBasePointId();
const quint32 firstPointId = dialogTool->GetFirstPointId();
const quint32 secondPointId = dialogTool->GetSecondPointId();
VToolLineIntersectAxis *point = nullptr;
point=Create(0, pointName, typeLine, formulaAngle, basePointId, firstPointId, secondPointId, 5, 10, scene, doc,
data, Document::FullParse, Source::FromGui);
point=Create(0, pointName, typeLine, lineColor, formulaAngle, basePointId, firstPointId, secondPointId, 5, 10,
scene, doc, data, Document::FullParse, Source::FromGui);
if (point != nullptr)
{
point->dialog=dialogTool;
@ -102,11 +103,12 @@ VToolLineIntersectAxis *VToolLineIntersectAxis::Create(DialogTool *dialog, VMain
//---------------------------------------------------------------------------------------------------------------------
VToolLineIntersectAxis *VToolLineIntersectAxis::Create(const quint32 _id, const QString &pointName,
const QString &typeLine, QString &formulaAngle,
const quint32 &basePointId, const quint32 &firstPointId,
const quint32 &secondPointId, const qreal &mx, const qreal &my,
VMainGraphicsScene *scene, VPattern *doc, VContainer *data,
const Document &parse, const Source &typeCreation)
const QString &typeLine, const QString &lineColor,
QString &formulaAngle, const quint32 &basePointId,
const quint32 &firstPointId, const quint32 &secondPointId,
const qreal &mx, const qreal &my, VMainGraphicsScene *scene,
VPattern *doc, VContainer *data, const Document &parse,
const Source &typeCreation)
{
const QSharedPointer<VPointF> basePoint = data->GeometricObject<VPointF>(basePointId);
QLineF axis = QLineF(basePoint->toQPointF(), QPointF(basePoint->x()+100, basePoint->y()));
@ -139,7 +141,7 @@ VToolLineIntersectAxis *VToolLineIntersectAxis::Create(const quint32 _id, const
VDrawTool::AddRecord(id, Tool::LineIntersectAxis, doc);
if (parse == Document::FullParse)
{
VToolLineIntersectAxis *point = new VToolLineIntersectAxis(doc, data, id, typeLine, formulaAngle,
VToolLineIntersectAxis *point = new VToolLineIntersectAxis(doc, data, id, typeLine, lineColor, formulaAngle,
basePointId, firstPointId, secondPointId,
typeCreation);
scene->addItem(point);

View File

@ -36,15 +36,16 @@ class VToolLineIntersectAxis : public VToolLinePoint
Q_OBJECT
public:
VToolLineIntersectAxis(VPattern *doc, VContainer *data, const quint32 &id, const QString &typeLine,
const QString &formulaAngle, const quint32 &basePointId, const quint32 &firstPointId,
const quint32 &secondPointId, const Source &typeCreation, QGraphicsItem * parent = nullptr);
const QString &lineColor, const QString &formulaAngle, const quint32 &basePointId,
const quint32 &firstPointId, const quint32 &secondPointId, const Source &typeCreation,
QGraphicsItem * parent = nullptr);
virtual ~VToolLineIntersectAxis();
virtual void setDialog();
static VToolLineIntersectAxis *Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc,
VContainer *data);
static VToolLineIntersectAxis *Create(const quint32 _id, const QString &pointName, const QString &typeLine,
QString &formulaAngle, const quint32 &basePointId,
const QString &lineColor, QString &formulaAngle, const quint32 &basePointId,
const quint32 &firstPointId, const quint32 &secondPointId,
const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VPattern *doc,
VContainer *data, const Document &parse, const Source &typeCreation);

View File

@ -36,18 +36,20 @@
* @param data container with variables.
* @param id object id in container.
* @param typeLine line type.
* @param lineColor line color.
* @param formula string with length formula.
* @param basePointId id base line point.
* @param angle line angle.
* @param parent parent object.
*/
VToolLinePoint::VToolLinePoint(VPattern *doc, VContainer *data, const quint32 &id,
const QString &typeLine, const QString &formula, const quint32 &basePointId,
VToolLinePoint::VToolLinePoint(VPattern *doc, VContainer *data, const quint32 &id, const QString &typeLine,
const QString &lineColor, const QString &formula, const quint32 &basePointId,
const qreal &angle, QGraphicsItem *parent)
:VToolPoint(doc, data, id, parent), formulaLength(formula), angle(angle), basePointId(basePointId),
:VToolPoint(doc, data, id, parent), formulaLength(formula), angle(angle), basePointId(basePointId),
mainLine(nullptr)
{
this->typeLine = typeLine;
this->lineColor = lineColor;
Q_ASSERT_X(basePointId > 0, Q_FUNC_INFO, "basePointId <= 0");
QPointF point1 = data->GeometricObject<VPointF>(basePointId)->toQPointF();
QPointF point2 = data->GeometricObject<VPointF>(id)->toQPointF();

View File

@ -39,7 +39,7 @@ class VToolLinePoint : public VToolPoint
{
Q_OBJECT
public:
VToolLinePoint(VPattern *doc, VContainer *data, const quint32 &id, const QString &typeLine, const QString &formula,
VToolLinePoint(VPattern *doc, VContainer *data, const quint32 &id, const QString &typeLine, const QString &lineColor, const QString &formula,
const quint32 &basePointId, const qreal &angle, QGraphicsItem * parent = nullptr);
virtual ~VToolLinePoint();
virtual int type() const {return Type;}

View File

@ -49,9 +49,10 @@ const QString VToolNormal::ToolType = QStringLiteral("normal");
* @param parent parent object.
*/
VToolNormal::VToolNormal(VPattern *doc, VContainer *data, const quint32 &id, const QString &typeLine,
const QString &formula, const qreal &angle, const quint32 &firstPointId,
const quint32 &secondPointId, const Source &typeCreation, QGraphicsItem *parent)
:VToolLinePoint(doc, data, id, typeLine, formula, firstPointId, angle, parent),
const QString &lineColor, const QString &formula, const qreal &angle,
const quint32 &firstPointId, const quint32 &secondPointId, const Source &typeCreation,
QGraphicsItem *parent)
:VToolLinePoint(doc, data, id, typeLine, lineColor, formula, firstPointId, angle, parent),
secondPointId(secondPointId)
{
@ -100,11 +101,12 @@ VToolNormal* VToolNormal::Create(DialogTool *dialog, VMainGraphicsScene *scene,
const quint32 firstPointId = dialogTool->GetFirstPointId();
const quint32 secondPointId = dialogTool->GetSecondPointId();
const QString typeLine = dialogTool->GetTypeLine();
const QString lineColor = dialogTool->GetLineColor();
const QString pointName = dialogTool->getPointName();
const qreal angle = dialogTool->GetAngle();
VToolNormal *point = nullptr;
point=Create(0, formula, firstPointId, secondPointId, typeLine, pointName, angle, 5, 10, scene, doc, data,
Document::FullParse, Source::FromGui);
point=Create(0, formula, firstPointId, secondPointId, typeLine, lineColor, pointName, angle, 5, 10, scene, doc,
data, Document::FullParse, Source::FromGui);
if (point != nullptr)
{
point->dialog=dialogTool;
@ -131,10 +133,10 @@ VToolNormal* VToolNormal::Create(DialogTool *dialog, VMainGraphicsScene *scene,
* @param typeCreation way we create this tool.
*/
VToolNormal* VToolNormal::Create(const quint32 _id, QString &formula, const quint32 &firstPointId,
const quint32 &secondPointId, const QString &typeLine, const QString &pointName,
const qreal angle, const qreal &mx, const qreal &my, VMainGraphicsScene *scene,
VPattern *doc, VContainer *data, const Document &parse,
const Source &typeCreation)
const quint32 &secondPointId, const QString &typeLine, const QString &lineColor,
const QString &pointName, const qreal angle, const qreal &mx, const qreal &my,
VMainGraphicsScene *scene, VPattern *doc, VContainer *data, const Document &parse,
const Source &typeCreation)
{
const QSharedPointer<VPointF> firstPoint = data->GeometricObject<VPointF>(firstPointId);
const QSharedPointer<VPointF> secondPoint = data->GeometricObject<VPointF>(secondPointId);
@ -161,8 +163,8 @@ VToolNormal* VToolNormal::Create(const quint32 _id, QString &formula, const quin
VDrawTool::AddRecord(id, Tool::Normal, doc);
if (parse == Document::FullParse)
{
VToolNormal *point = new VToolNormal(doc, data, id, typeLine, formula, angle,
firstPointId, secondPointId, typeCreation);
VToolNormal *point = new VToolNormal(doc, data, id, typeLine, lineColor, formula, angle, firstPointId,
secondPointId, typeCreation);
scene->addItem(point);
connect(point, &VToolNormal::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem);
connect(scene, &VMainGraphicsScene::NewFactor, point, &VToolNormal::SetFactor);

View File

@ -38,15 +38,16 @@ class VToolNormal : public VToolLinePoint
{
Q_OBJECT
public:
VToolNormal(VPattern *doc, VContainer *data, const quint32 &id, const QString &typeLine, const QString &formula,
const qreal &angle, const quint32 &firstPointId, const quint32 &secondPointId,
VToolNormal(VPattern *doc, VContainer *data, const quint32 &id, const QString &typeLine, const QString &lineColor,
const QString &formula, const qreal &angle, const quint32 &firstPointId, const quint32 &secondPointId,
const Source &typeCreation, QGraphicsItem * parent = nullptr);
virtual void setDialog();
static VToolNormal* Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, VContainer *data);
static VToolNormal* Create(const quint32 _id, QString &formula, const quint32 &firstPointId,
const quint32 &secondPointId, const QString &typeLine, const QString &pointName,
const qreal angle, const qreal &mx, const qreal &my, VMainGraphicsScene *scene,
VPattern *doc, VContainer *data, const Document &parse, const Source &typeCreation);
const quint32 &secondPointId, const QString &typeLine, const QString &lineColor,
const QString &pointName, const qreal angle, const qreal &mx, const qreal &my,
VMainGraphicsScene *scene, VPattern *doc, VContainer *data, const Document &parse,
const Source &typeCreation);
static QPointF FindPoint(const QPointF &firstPoint, const QPointF &secondPoint, const qreal &length,
const qreal &angle = 0);
static const QString ToolType;

View File

@ -49,10 +49,11 @@ const QString VToolShoulderPoint::ToolType = QStringLiteral("shoulder");
* @param parent parent object.
*/
VToolShoulderPoint::VToolShoulderPoint(VPattern *doc, VContainer *data, const quint32 &id, const QString &typeLine,
const QString &formula, const quint32 &p1Line, const quint32 &p2Line,
const quint32 &pShoulder, const Source &typeCreation,
const QString &lineColor, const QString &formula, const quint32 &p1Line,
const quint32 &p2Line, const quint32 &pShoulder, const Source &typeCreation,
QGraphicsItem * parent)
:VToolLinePoint(doc, data, id, typeLine, formula, p1Line, 0, parent), p2Line(p2Line), pShoulder(pShoulder)
:VToolLinePoint(doc, data, id, typeLine, lineColor, formula, p1Line, 0, parent), p2Line(p2Line),
pShoulder(pShoulder)
{
if (typeCreation == Source::FromGui)
{
@ -140,10 +141,11 @@ VToolShoulderPoint* VToolShoulderPoint::Create(DialogTool *dialog, VMainGraphics
const quint32 p2Line = dialogTool->GetP2Line();
const quint32 pShoulder = dialogTool->GetP3();
const QString typeLine = dialogTool->GetTypeLine();
const QString lineColor = dialogTool->GetLineColor();
const QString pointName = dialogTool->getPointName();
VToolShoulderPoint * point = nullptr;
point=Create(0, formula, p1Line, p2Line, pShoulder, typeLine, pointName, 5, 10, scene, doc, data,
Document::FullParse, Source::FromGui);
point=Create(0, formula, p1Line, p2Line, pShoulder, typeLine, lineColor, pointName, 5, 10, scene, doc, data,
Document::FullParse, Source::FromGui);
if (point != nullptr)
{
point->dialog=dialogTool;
@ -171,7 +173,7 @@ VToolShoulderPoint* VToolShoulderPoint::Create(DialogTool *dialog, VMainGraphics
* @return the created tool
*/
VToolShoulderPoint* VToolShoulderPoint::Create(const quint32 _id, QString &formula, const quint32 &p1Line,
const quint32 &p2Line, const quint32 &pShoulder, const QString &typeLine,
const quint32 &p2Line, const quint32 &pShoulder, const QString &typeLine, const QString &lineColor,
const QString &pointName, const qreal &mx, const qreal &my,
VMainGraphicsScene *scene, VPattern *doc, VContainer *data,
const Document &parse, const Source &typeCreation)
@ -204,7 +206,7 @@ VToolShoulderPoint* VToolShoulderPoint::Create(const quint32 _id, QString &formu
VDrawTool::AddRecord(id, Tool::ShoulderPoint, doc);
if (parse == Document::FullParse)
{
VToolShoulderPoint *point = new VToolShoulderPoint(doc, data, id, typeLine, formula,
VToolShoulderPoint *point = new VToolShoulderPoint(doc, data, id, typeLine, lineColor, formula,
p1Line, p2Line, pShoulder,
typeCreation);
scene->addItem(point);

View File

@ -40,16 +40,17 @@ class VToolShoulderPoint : public VToolLinePoint
Q_OBJECT
public:
VToolShoulderPoint(VPattern *doc, VContainer *data, const quint32 &id, const QString &typeLine,
const QString &formula, const quint32 &p1Line, const quint32 &p2Line, const quint32 &pShoulder,
const Source &typeCreation, QGraphicsItem * parent = nullptr);
const QString &lineColor, const QString &formula, const quint32 &p1Line, const quint32 &p2Line,
const quint32 &pShoulder, const Source &typeCreation, QGraphicsItem * parent = nullptr);
virtual void setDialog();
static QPointF FindPoint(const QPointF &p1Line, const QPointF &p2Line, const QPointF &pShoulder,
const qreal &length);
static VToolShoulderPoint* Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, VContainer *data);
static VToolShoulderPoint* Create(const quint32 _id, QString &formula, const quint32 &p1Line, const quint32 &p2Line,
const quint32 &pShoulder, const QString &typeLine, const QString &pointName,
const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VPattern *doc,
VContainer *data, const Document &parse, const Source &typeCreation);
const quint32 &pShoulder, const QString &typeLine, const QString &lineColor,
const QString &pointName, const qreal &mx, const qreal &my,
VMainGraphicsScene *scene, VPattern *doc, VContainer *data, const Document &parse,
const Source &typeCreation);
static const QString ToolType;
virtual int type() const {return Type;}
enum { Type = UserType + static_cast<int>(Tool::ShoulderPoint) };

View File

@ -43,11 +43,12 @@ const QString VToolSpline::ToolType = QStringLiteral("simple");
* @param typeCreation way we create this tool.
* @param parent parent object.
*/
VToolSpline::VToolSpline(VPattern *doc, VContainer *data, quint32 id, const Source &typeCreation,
VToolSpline::VToolSpline(VPattern *doc, VContainer *data, quint32 id, const QString color, const Source &typeCreation,
QGraphicsItem *parent)
:VAbstractSpline(doc, data, id, parent)
{
sceneType = SceneObject::Spline;
lineColor = color;
this->setPen(QPen(Qt::black, qApp->toPixel(qApp->widthHairLine())/factor));
this->setFlag(QGraphicsItem::ItemIsSelectable, true);
@ -129,8 +130,9 @@ VToolSpline* VToolSpline::Create(DialogTool *dialog, VMainGraphicsScene *scene,
const qreal angle1 = dialogTool->GetAngle1();
const qreal angle2 = dialogTool->GetAngle2();
const qreal kCurve = dialogTool->GetKCurve();
const QString color = dialogTool->GetColor();
VToolSpline *spl = nullptr;
spl = Create(0, p1, p4, kAsm1, kAsm2, angle1, angle2, kCurve, scene, doc, data, Document::FullParse,
spl = Create(0, p1, p4, kAsm1, kAsm2, angle1, angle2, kCurve, color, scene, doc, data, Document::FullParse,
Source::FromGui);
if (spl != nullptr)
{
@ -159,7 +161,7 @@ VToolSpline* VToolSpline::Create(DialogTool *dialog, VMainGraphicsScene *scene,
*/
VToolSpline* VToolSpline::Create(const quint32 _id, const quint32 &p1, const quint32 &p4, const qreal &kAsm1,
const qreal kAsm2, const qreal &angle1, const qreal &angle2, const qreal &kCurve,
VMainGraphicsScene *scene, VPattern *doc, VContainer *data,
const QString &color, VMainGraphicsScene *scene, VPattern *doc, VContainer *data,
const Document &parse, const Source &typeCreation)
{
VPointF point1 = *data->GeometricObject<VPointF>(p1);
@ -183,7 +185,7 @@ VToolSpline* VToolSpline::Create(const quint32 _id, const quint32 &p1, const qui
VDrawTool::AddRecord(id, Tool::Spline, doc);
if (parse == Document::FullParse)
{
VToolSpline *spl = new VToolSpline(doc, data, id, typeCreation);
VToolSpline *spl = new VToolSpline(doc, data, id, color, typeCreation);
scene->addItem(spl);
connect(spl, &VToolSpline::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem);
connect(scene, &VMainGraphicsScene::NewFactor, spl, &VToolSpline::SetFactor);
@ -359,7 +361,7 @@ void VToolSpline::SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj)
*/
void VToolSpline::RefreshGeometry()
{
this->setPen(QPen(CorrectColor(baseColor), qApp->toPixel(qApp->widthHairLine())/factor));
this->setPen(QPen(CorrectColor(lineColor), qApp->toPixel(qApp->widthHairLine())/factor));
if (isHovered)
{
this->setPath(ToolPath(PathDirection::Show));

View File

@ -38,14 +38,14 @@ class VToolSpline:public VAbstractSpline
{
Q_OBJECT
public:
VToolSpline (VPattern *doc, VContainer *data, quint32 id, const Source &typeCreation,
VToolSpline (VPattern *doc, VContainer *data, quint32 id, const QString color, const Source &typeCreation,
QGraphicsItem * parent = nullptr );
virtual ~VToolSpline();
virtual void setDialog();
static VToolSpline *Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, VContainer *data);
static VToolSpline *Create(const quint32 _id, const quint32 &p1, const quint32 &p4, const qreal &kAsm1,
const qreal kAsm2, const qreal &angle1, const qreal &angle2, const qreal &kCurve,
VMainGraphicsScene *scene, VPattern *doc, VContainer *data,
const QString &color, VMainGraphicsScene *scene, VPattern *doc, VContainer *data,
const Document &parse, const Source &typeCreation);
static const QString ToolType;
virtual int type() const {return Type;}

View File

@ -42,8 +42,8 @@ const QString VToolSplinePath::ToolType = QStringLiteral("path");
* @param typeCreation way we create this tool.
* @param parent parent object.
*/
VToolSplinePath::VToolSplinePath(VPattern *doc, VContainer *data, quint32 id, const Source &typeCreation,
QGraphicsItem *parent)
VToolSplinePath::VToolSplinePath(VPattern *doc, VContainer *data, quint32 id, const QString &color,
const Source &typeCreation, QGraphicsItem *parent)
:VAbstractSpline(doc, data, id, parent)
{
sceneType = SceneObject::SplinePath;
@ -115,12 +115,13 @@ VToolSplinePath* VToolSplinePath::Create(DialogTool *dialog, VMainGraphicsScene
DialogSplinePath *dialogTool = qobject_cast<DialogSplinePath*>(dialog);
SCASSERT(dialogTool != nullptr);
VSplinePath *path = new VSplinePath(dialogTool->GetPath());
const QString color = dialogTool->GetColor();
for (qint32 i = 0; i < path->CountPoint(); ++i)
{
doc->IncrementReferens((*path)[i].P().id());
}
VToolSplinePath* spl = nullptr;
spl = Create(0, path, scene, doc, data, Document::FullParse, Source::FromGui);
spl = Create(0, path, color, scene, doc, data, Document::FullParse, Source::FromGui);
if (spl != nullptr)
{
spl->dialog=dialogTool;
@ -139,8 +140,9 @@ VToolSplinePath* VToolSplinePath::Create(DialogTool *dialog, VMainGraphicsScene
* @param parse parser file mode.
* @param typeCreation way we create this tool.
*/
VToolSplinePath* VToolSplinePath::Create(const quint32 _id, VSplinePath *path, VMainGraphicsScene *scene, VPattern *doc,
VContainer *data, const Document &parse, const Source &typeCreation)
VToolSplinePath* VToolSplinePath::Create(const quint32 _id, VSplinePath *path, const QString &color,
VMainGraphicsScene *scene, VPattern *doc, VContainer *data,
const Document &parse, const Source &typeCreation)
{
quint32 id = _id;
if (typeCreation == Source::FromGui)
@ -160,7 +162,7 @@ VToolSplinePath* VToolSplinePath::Create(const quint32 _id, VSplinePath *path, V
VDrawTool::AddRecord(id, Tool::SplinePath, doc);
if (parse == Document::FullParse)
{
VToolSplinePath *spl = new VToolSplinePath(doc, data, id, typeCreation);
VToolSplinePath *spl = new VToolSplinePath(doc, data, id, color, typeCreation);
scene->addItem(spl);
connect(spl, &VToolSplinePath::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem);
connect(scene, &VMainGraphicsScene::NewFactor, spl, &VToolSplinePath::SetFactor);
@ -426,7 +428,7 @@ void VToolSplinePath::RefreshGeometry()
{
this->setPath(ToolPath());
}
this->setPen(QPen(CorrectColor(lineColor), qApp->toPixel(qApp->widthHairLine())/factor));
const QSharedPointer<VSplinePath> splPath = VAbstractTool::data.GeometricObject<VSplinePath>(id);
for (qint32 i = 1; i<=splPath->Count(); ++i)
{

View File

@ -38,12 +38,13 @@ class VToolSplinePath:public VAbstractSpline
{
Q_OBJECT
public:
VToolSplinePath(VPattern *doc, VContainer *data, quint32 id, const Source &typeCreation,
VToolSplinePath(VPattern *doc, VContainer *data, quint32 id, const QString &color, const Source &typeCreation,
QGraphicsItem * parent = nullptr);
virtual void setDialog();
static VToolSplinePath *Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, VContainer *data);
static VToolSplinePath *Create(const quint32 _id, VSplinePath *path, VMainGraphicsScene *scene, VPattern *doc,
VContainer *data, const Document &parse, const Source &typeCreation);
static VToolSplinePath *Create(const quint32 _id, VSplinePath *path, const QString &color,
VMainGraphicsScene *scene, VPattern *doc, VContainer *data, const Document &parse,
const Source &typeCreation);
static const QString ToolType;
static void UpdatePathPoint(VPattern *doc, QDomNode& node, const VSplinePath &path);
virtual int type() const {return Type;}

View File

@ -1088,10 +1088,11 @@ void VPattern::ParseDetails(const QDomElement &domElement, const Document &parse
//---------------------------------------------------------------------------------------------------------------------
void VPattern::PointsCommonAttributes(const QDomElement &domElement, quint32 &id, QString &name, qreal &mx, qreal &my,
QString &typeLine)
QString &typeLine, QString &lineColor)
{
PointsCommonAttributes(domElement, id, name, mx, my);
typeLine = GetParametrString(domElement, VAbstractTool::AttrTypeLine, VAbstractTool::TypeLineLine);
lineColor = GetParametrString(domElement, VAbstractTool::AttrLineColor, VAbstractTool::ColorBlack);
}
//---------------------------------------------------------------------------------------------------------------------
@ -1129,6 +1130,7 @@ void VPattern::ParsePointElement(VMainGraphicsScene *scene, QDomElement &domElem
qreal mx = 0;
qreal my = 0;
QString typeLine;
QString lineColor;
QStringList points = QStringList() << VToolSinglePoint::ToolType << VToolEndLine::ToolType
<< VToolAlongLine::ToolType << VToolShoulderPoint::ToolType
@ -1178,7 +1180,7 @@ void VPattern::ParsePointElement(VMainGraphicsScene *scene, QDomElement &domElem
case 1: //VToolEndLine::ToolType
try
{
PointsCommonAttributes(domElement, id, name, mx, my, typeLine);
PointsCommonAttributes(domElement, id, name, mx, my, typeLine, lineColor);
const QString formula = GetParametrString(domElement, VAbstractTool::AttrLength, "100.0");
QString f = formula;//need for saving fixed formula;
@ -1188,8 +1190,8 @@ void VPattern::ParsePointElement(VMainGraphicsScene *scene, QDomElement &domElem
const QString angle = GetParametrString(domElement, VAbstractTool::AttrAngle, "0.0");
QString angleFix = angle;
VToolEndLine::Create(id, name, typeLine, f, angleFix, basePointId, mx, my, scene, this, data, parse,
Source::FromFile);
VToolEndLine::Create(id, name, typeLine, lineColor, f, angleFix, basePointId, mx, my, scene, this, data,
parse, Source::FromFile);
//Rewrite attribute formula. Need for situation when we have wrong formula.
if (f != formula || angleFix != angle)
{
@ -1214,14 +1216,14 @@ void VPattern::ParsePointElement(VMainGraphicsScene *scene, QDomElement &domElem
case 2: //VToolAlongLine::ToolType
try
{
PointsCommonAttributes(domElement, id, name, mx, my, typeLine);
PointsCommonAttributes(domElement, id, name, mx, my, typeLine, lineColor);
const QString formula = GetParametrString(domElement, VAbstractTool::AttrLength, "100.0");
QString f = formula;//need for saving fixed formula;
const quint32 firstPointId = GetParametrUInt(domElement, VAbstractTool::AttrFirstPoint, NULL_ID_STR);
const quint32 secondPointId = GetParametrUInt(domElement, VAbstractTool::AttrSecondPoint, NULL_ID_STR);
VToolAlongLine::Create(id, name, typeLine, f, firstPointId, secondPointId, mx, my, scene, this,
data, parse, Source::FromFile);
VToolAlongLine::Create(id, name, typeLine, lineColor, f, firstPointId, secondPointId, mx, my, scene,
this, data, parse, Source::FromFile);
//Rewrite attribute formula. Need for situation when we have wrong formula.
if (f != formula)
{
@ -1245,15 +1247,15 @@ void VPattern::ParsePointElement(VMainGraphicsScene *scene, QDomElement &domElem
case 3: //VToolShoulderPoint::ToolType
try
{
PointsCommonAttributes(domElement, id, name, mx, my, typeLine);
PointsCommonAttributes(domElement, id, name, mx, my, typeLine, lineColor);
const QString formula = GetParametrString(domElement, VAbstractTool::AttrLength, "100.0");
QString f = formula;//need for saving fixed formula;
const quint32 p1Line = GetParametrUInt(domElement, VAbstractTool::AttrP1Line, NULL_ID_STR);
const quint32 p2Line = GetParametrUInt(domElement, VAbstractTool::AttrP2Line, NULL_ID_STR);
const quint32 pShoulder = GetParametrUInt(domElement, VAbstractTool::AttrPShoulder, NULL_ID_STR);
VToolShoulderPoint::Create(id, f, p1Line, p2Line, pShoulder, typeLine, name, mx, my, scene, this,
data, parse, Source::FromFile);
VToolShoulderPoint::Create(id, f, p1Line, p2Line, pShoulder, typeLine, lineColor, name, mx, my, scene,
this, data, parse, Source::FromFile);
//Rewrite attribute formula. Need for situation when we have wrong formula.
if (f != formula)
{
@ -1277,14 +1279,14 @@ void VPattern::ParsePointElement(VMainGraphicsScene *scene, QDomElement &domElem
case 4: //VToolNormal::ToolType
try
{
PointsCommonAttributes(domElement, id, name, mx, my, typeLine);
PointsCommonAttributes(domElement, id, name, mx, my, typeLine, lineColor);
const QString formula = GetParametrString(domElement, VAbstractTool::AttrLength, "100.0");
QString f = formula;//need for saving fixed formula;
const quint32 firstPointId = GetParametrUInt(domElement, VAbstractTool::AttrFirstPoint, NULL_ID_STR);
const quint32 secondPointId = GetParametrUInt(domElement, VAbstractTool::AttrSecondPoint, NULL_ID_STR);
const qreal angle = GetParametrDouble(domElement, VAbstractTool::AttrAngle, "0.0");
VToolNormal::Create(id, f, firstPointId, secondPointId, typeLine, name, angle, mx, my, scene,
VToolNormal::Create(id, f, firstPointId, secondPointId, typeLine, lineColor, name, angle, mx, my, scene,
this, data, parse, Source::FromFile);
//Rewrite attribute formula. Need for situation when we have wrong formula.
if (f != formula)
@ -1309,7 +1311,7 @@ void VPattern::ParsePointElement(VMainGraphicsScene *scene, QDomElement &domElem
case 5: //VToolBisector::ToolType
try
{
PointsCommonAttributes(domElement, id, name, mx, my, typeLine);
PointsCommonAttributes(domElement, id, name, mx, my, typeLine, lineColor);
const QString formula = GetParametrString(domElement, VAbstractTool::AttrLength, "100.0");
QString f = formula;//need for saving fixed formula;
const quint32 firstPointId = GetParametrUInt(domElement, VAbstractTool::AttrFirstPoint, NULL_ID_STR);
@ -1317,7 +1319,7 @@ void VPattern::ParsePointElement(VMainGraphicsScene *scene, QDomElement &domElem
const quint32 thirdPointId = GetParametrUInt(domElement, VAbstractTool::AttrThirdPoint, NULL_ID_STR);
VToolBisector::Create(id, f, firstPointId, secondPointId, thirdPointId,
typeLine, name, mx, my, scene, this, data, parse, Source::FromFile);
typeLine, lineColor, name, mx, my, scene, this, data, parse, Source::FromFile);
//Rewrite attribute formula. Need for situation when we have wrong formula.
if (f != formula)
{
@ -1410,12 +1412,12 @@ void VPattern::ParsePointElement(VMainGraphicsScene *scene, QDomElement &domElem
case 9: //VToolHeight::ToolType
try
{
PointsCommonAttributes(domElement, id, name, mx, my, typeLine);
PointsCommonAttributes(domElement, id, name, mx, my, typeLine, lineColor);
const quint32 basePointId = GetParametrUInt(domElement, VAbstractTool::AttrBasePoint, NULL_ID_STR);
const quint32 p1LineId = GetParametrUInt(domElement, VAbstractTool::AttrP1Line, NULL_ID_STR);
const quint32 p2LineId = GetParametrUInt(domElement, VAbstractTool::AttrP2Line, NULL_ID_STR);
VToolHeight::Create(id, name, typeLine, basePointId, p1LineId, p2LineId,
VToolHeight::Create(id, name, typeLine, lineColor, basePointId, p1LineId, p2LineId,
mx, my, scene, this, data, parse, Source::FromFile);
}
catch (const VExceptionBadId &e)
@ -1553,7 +1555,7 @@ void VPattern::ParsePointElement(VMainGraphicsScene *scene, QDomElement &domElem
case 15: //VToolLineIntersectAxis::ToolType
try
{
PointsCommonAttributes(domElement, id, name, mx, my, typeLine);
PointsCommonAttributes(domElement, id, name, mx, my, typeLine, lineColor);
const quint32 basePointId = GetParametrUInt(domElement, VAbstractTool::AttrBasePoint, NULL_ID_STR);
const quint32 firstPointId = GetParametrUInt(domElement, VAbstractTool::AttrP1Line, NULL_ID_STR);
@ -1562,8 +1564,8 @@ void VPattern::ParsePointElement(VMainGraphicsScene *scene, QDomElement &domElem
const QString angle = GetParametrString(domElement, VAbstractTool::AttrAngle, "0.0");
QString angleFix = angle;
VToolLineIntersectAxis::Create(id, name, typeLine, angleFix, basePointId, firstPointId, secondPointId,
mx, my, scene, this, data, parse, Source::FromFile);
VToolLineIntersectAxis::Create(id, name, typeLine, lineColor, angleFix, basePointId, firstPointId,
secondPointId, mx, my, scene, this, data, parse, Source::FromFile);
//Rewrite attribute formula. Need for situation when we have wrong formula.
if (angleFix != angle)
{
@ -1589,15 +1591,15 @@ void VPattern::ParsePointElement(VMainGraphicsScene *scene, QDomElement &domElem
case 16: //VToolCurveIntersectAxis::ToolType
try
{
PointsCommonAttributes(domElement, id, name, mx, my, typeLine);
PointsCommonAttributes(domElement, id, name, mx, my, typeLine, lineColor);
const quint32 basePointId = GetParametrUInt(domElement, VAbstractTool::AttrBasePoint, NULL_ID_STR);
const quint32 curveId = GetParametrUInt(domElement, VAbstractTool::AttrCurve, NULL_ID_STR);
const QString angle = GetParametrString(domElement, VAbstractTool::AttrAngle, "0.0");
QString angleFix = angle;
VToolCurveIntersectAxis::Create(id, name, typeLine, angleFix, basePointId, curveId, mx, my, scene, this,
data, parse, Source::FromFile);
VToolCurveIntersectAxis::Create(id, name, typeLine, lineColor, angleFix, basePointId, curveId, mx, my,
scene, this, data, parse, Source::FromFile);
//Rewrite attribute formula. Need for situation when we have wrong formula.
if (angleFix != angle)
{
@ -1646,8 +1648,10 @@ void VPattern::ParseLineElement(VMainGraphicsScene *scene, const QDomElement &do
const quint32 secondPoint = GetParametrUInt(domElement, VAbstractTool::AttrSecondPoint, NULL_ID_STR);
const QString typeLine = GetParametrString(domElement, VAbstractTool::AttrTypeLine,
VAbstractTool::TypeLineLine);
const QString lineColor = GetParametrString(domElement, VAbstractTool::AttrLineColor,
VAbstractTool::ColorBlack);
VToolLine::Create(id, firstPoint, secondPoint, typeLine, scene, this, data, parse, Source::FromFile);
VToolLine::Create(id, firstPoint, secondPoint, typeLine, lineColor, scene, this, data, parse, Source::FromFile);
}
catch (const VExceptionBadId &e)
{
@ -1855,9 +1859,11 @@ void VPattern::ParseSplineElement(VMainGraphicsScene *scene, const QDomElement &
const qreal kAsm1 = GetParametrDouble(domElement, VAbstractTool::AttrKAsm1, "1.0");
const qreal kAsm2 = GetParametrDouble(domElement, VAbstractTool::AttrKAsm2, "1.0");
const qreal kCurve = GetParametrDouble(domElement, VAbstractTool::AttrKCurve, "1.0");
const QString color = GetParametrString(domElement, VAbstractTool::AttrColor,
VAbstractTool::ColorBlack);
VToolSpline::Create(id, point1, point4, kAsm1, kAsm2, angle1, angle2, kCurve, scene, this, data, parse,
Source::FromFile);
VToolSpline::Create(id, point1, point4, kAsm1, kAsm2, angle1, angle2, kCurve, color, scene, this, data,
parse, Source::FromFile);
}
catch (const VExceptionBadId &e)
{
@ -1872,6 +1878,8 @@ void VPattern::ParseSplineElement(VMainGraphicsScene *scene, const QDomElement &
{
ToolsCommonAttributes(domElement, id);
const qreal kCurve = GetParametrDouble(domElement, VAbstractTool::AttrKCurve, "1.0");
const QString color = GetParametrString(domElement, VAbstractTool::AttrColor,
VAbstractTool::ColorBlack);
VSplinePath *path = new VSplinePath(kCurve);
const QDomNodeList nodeList = domElement.childNodes();
@ -1902,7 +1910,7 @@ void VPattern::ParseSplineElement(VMainGraphicsScene *scene, const QDomElement &
}
}
VToolSplinePath::Create(id, path, scene, this, data, parse, Source::FromFile);
VToolSplinePath::Create(id, path, color, scene, this, data, parse, Source::FromFile);
}
catch (const VExceptionBadId &e)
{
@ -1984,8 +1992,10 @@ void VPattern::ParseArcElement(VMainGraphicsScene *scene, QDomElement &domElemen
QString f1Fix = f1;//need for saving fixed formula;
const QString f2 = GetParametrString(domElement, VAbstractTool::AttrAngle2, "270");
QString f2Fix = f2;//need for saving fixed formula;
const QString color = GetParametrString(domElement, VAbstractTool::AttrColor,
VAbstractTool::ColorBlack);
VToolArc::Create(id, center, r, f1Fix, f2Fix, scene, this, data, parse, Source::FromFile);
VToolArc::Create(id, center, r, f1Fix, f2Fix, color, scene, this, data, parse, Source::FromFile);
//Rewrite attribute formula. Need for situation when we have wrong formula.
if (r != radius || f1Fix != f1 || f2Fix != f2)
{

View File

@ -267,7 +267,7 @@ private:
void UpdateMeasurements();
void ToolsCommonAttributes(const QDomElement &domElement, quint32 &id);
void PointsCommonAttributes(const QDomElement &domElement, quint32 &id, QString &name, qreal &mx,
qreal &my, QString &typeLine);
qreal &my, QString &typeLine, QString &lineColor);
void PointsCommonAttributes(const QDomElement &domElement, quint32 &id, QString &name, qreal &mx,
qreal &my);
void PointsCommonAttributes(const QDomElement &domElement, quint32 &id, qreal &mx, qreal &my);