59 #include "../core/vapplication.h"
60 #include "../ifc/ifcdef.h"
61 #include "../vgeometry/vcubicbezier.h"
62 #include "../vgeometry/vcubicbezierpath.h"
63 #include "../vmisc/def.h"
64 #include "../vmisc/vabstractapplication.h"
65 #include "../vpatterndb/vcontainer.h"
66 #include "../vpatterndb/vformula.h"
67 #include "../vpropertyexplorer/vproperties.h"
68 #include "../vtools/tools/drawTools/drawtools.h"
69 #include "../vwidgets/vmaingraphicsview.h"
70 #include "../vwidgets/vgraphicssimpletextitem.h"
71 #include "../vwidgets/vcontrolpointspline.h"
72 #include "../vwidgets/vsimplepoint.h"
73 #include "../vwidgets/vsimplecurve.h"
74 #include "../vwidgets/vcurvepathitem.h"
76 #include <QDockWidget>
77 #include <QHBoxLayout>
79 #include <QRegularExpression>
85 , propertyModel(nullptr)
87 , currentItem(nullptr)
88 , propertyToId(
QMap<
VPE::VProperty *, QString>())
89 , idToProperty(
QMap<QString,
VPE::VProperty *>())
93 formView->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
95 QScrollArea *scroll =
new QScrollArea(parent);
96 scroll->setWidgetResizable(
true);
99 parent->setWidget(scroll);
120 switch (item->type())
499 qApp->getSceneView()->update();
507 if (item->isEnabled()==
false)
526 if (previousTool !=
nullptr)
544 const QString &attrName)
557 itemName->
setValue(
qApp->TrVars()->VarToUser(tool->name()));
588 itemSuffix->
setValue(tool->Suffix());
598 lineName->setValue(tr(
"Line_") + tool->FirstPointName() +
"_" + tool->SecondPointName());
599 lineName->setReadOnly(readOnly);
606 const QString &firstPoint,
const QString &secondPoint,
612 arcName->setValue(prefix + firstPoint +
"_" + secondPoint);
613 arcName->setReadOnly(readOnly);
619 const QString &propertyAttribute)
622 itemParentPoint->setValue(pointName);
640 itemProperty->
setLiterals(QStringList()<< tr(
"First point") << tr(
"Second point"));
641 itemProperty->
setValue(
static_cast<int>(tool->GetCrossCirclesPoint())-1);
650 itemProperty->setLiterals(QStringList()<< tr(
"Highest point") << tr(
"Lowest point"));
651 itemProperty->setValue(
static_cast<int>(tool->GetVCrossPoint())-1);
660 itemProperty->setLiterals(QStringList()<< tr(
"Leftmost point") << tr(
"Rightmost point"));
661 itemProperty->setValue(
static_cast<int>(tool->GetHCrossPoint())-1);
670 itemProperty->setLiterals(QStringList()<< tr(
"Vertical axis") << tr(
"Horizontal axis"));
671 itemProperty->setValue(
static_cast<int>(tool->getAxisType())-1);
691 qWarning()<<
"Can't find line type" << tool->getLineType()<<
"in list";
706 qWarning()<<
"Can't find line type" << tool->getLineType()<<
"in list";
721 qWarning()<<
"Can't find line weight" << tool->getLineWeight()<<
"in list";
723 lineWeightProperty->
setValue(index);
736 qWarning()<<
"Can't find line color" << tool->getLineColor()<<
"in list";
745 const QString &propertyName,
const QString &
id,
GOType objType)
753 qWarning()<<
"Can't find point" << pointName <<
"in list";
762 quint32 toolId = tool->getId();
766 for (qint32 i = 0; i < history.size(); ++i)
769 quint32 recId = record.
getId();
777 for (qint32 j = 0; j < list.size(); ++j)
779 quint32
id = list.at(j);
781 qApp->getCurrentDocument()->getActiveDraftBlockName());
784 if (objs->contains(
id))
787 objects.insert(
id, obj);
798 QVector<quint32> list =
qApp->getCurrentDocument()->getOpItems(recId, QStringLiteral(
"destination"));
799 for (qint32 j = 0; j < list.size(); ++j)
801 quint32
id = list.at(j);
803 qApp->getCurrentDocument()->getActiveDraftBlockName());
806 if (objs->contains(
id))
809 objects.insert(
id, obj);
817 if (objs->contains(recId))
820 objects.insert(recId, obj);
835 for (i = objects.constBegin(); i != objects.constEnd(); ++i)
848 if (obj->getType() == objType)
850 map.insert(obj->name(), i.key());
857 map.insert(obj->name(), i.key());
864 map.insert(obj->name(), i.key());
877 map.insert(obj->name(), i.key());
891 map.insert(
"Center point",
NULL_ID);
902 if (name == tool->name())
908 if (name.isEmpty() ||
VContainer::IsUnique(name) ==
false || rx.match(name).hasMatch() ==
false)
919 qWarning()<<
"Can't cast item";
929 if (name == tool->nameP1())
935 if (name.isEmpty() ||
VContainer::IsUnique(name) ==
false || rx.match(name).hasMatch() ==
false)
941 tool->setNameP1(name);
946 qWarning()<<
"Can't cast item";
956 if (name == tool->nameP2())
962 if (name.isEmpty() ||
VContainer::IsUnique(name) ==
false || rx.match(name).hasMatch() ==
false)
968 tool->setNameP2(name);
973 qWarning()<<
"Can't cast item";
983 if (suffix == item->Suffix())
988 if (suffix.isEmpty())
996 for (
int i=0; i < uniqueNames.size(); ++i)
998 const QString name = uniqueNames.at(i) + suffix;
1006 item->setSuffix(suffix);
1010 qWarning()<<
"Can't cast item";
1015 template<
class Type>
1019 const int val = value.toInt(&ok);
1021 auto cross =
static_cast<Type
>(1);
1028 cross =
static_cast<Type
>(val+1);
1039 template<
class Tool>
1044 tool->setCirclesCrossPoint(getCrossPoint<CrossCirclesPoint>(value));
1048 qWarning()<<
"Can't cast item";
1053 template<
class Tool>
1058 tool->SetVCrossPoint(getCrossPoint<VCrossCurvesPoint>(value));
1062 qWarning()<<
"Can't cast item";
1067 template<
class Tool>
1072 tool->SetHCrossPoint(getCrossPoint<HCrossCurvesPoint>(value));
1076 qWarning()<<
"Can't cast item";
1081 template<
class Tool>
1086 tool->setAxisType(getCrossPoint<AxisType>(value));
1090 qWarning()<<
"Can't cast item";
1115 setPointName<VToolBasePoint>(value.toString());
1121 qWarning()<<
"Unknown property type. id = "<<id;
1139 setPointName<VToolEndLine>(value.toString());
1160 qWarning()<<
"Unknown property type. id = "<<id;
1178 setPointName<VToolAlongLine>(value.toString());
1199 qWarning()<<
"Unknown property type. id = "<<id;
1242 qWarning()<<
"Unknown property type. id = "<<id;
1284 qWarning()<<
"Unknown property type. id = "<<id;
1302 setPointName<VToolBisector>(value.toString());
1326 qWarning()<<
"Unknown property type. id = "<<id;
1344 setPointName1<VToolTrueDarts>(value.toString());
1347 setPointName2<VToolTrueDarts>(value.toString());
1365 qWarning()<<
"Unknown property type. id = "<<id;
1383 setPointName<VToolCutArc>(value.toString());
1392 qWarning()<<
"Unknown property type. id = "<<id;
1410 setPointName<VToolCutSpline>(value.toString());
1419 qWarning()<<
"Unknown property type. id = "<<id;
1437 setPointName<VToolCutSplinePath>(value.toString());
1446 qWarning()<<
"Unknown property type. id = "<<id;
1464 setPointName<VToolHeight>(value.toString());
1485 qWarning()<<
"Unknown property type. id = "<<id;
1518 qWarning()<<
"Unknown property type. id = "<<id;
1536 setPointName<VToolLineIntersect>(value.toString());
1551 qWarning()<<
"Unknown property type. id = "<<id;
1572 setPointName<VToolNormal>(value.toString());
1593 qWarning()<<
"Unknown property type. id = "<<id;
1614 setPointName<VToolPointOfContact>(value.toString());
1626 qWarning()<<
"Unknown property type. id = "<<id;
1644 setPointName<PointIntersectXYTool>(value.toString());
1662 qWarning()<<
"Unknown property type. id = "<<id;
1680 setPointName<VToolPointOfIntersectionArcs>(value.toString());
1685 setCirclesCrossPoint<VToolPointOfIntersectionArcs>(value);
1695 qWarning()<<
"Unknown property type. id = "<<id;
1713 setPointName<IntersectCirclesTool>(value.toString());
1718 setCirclesCrossPoint<IntersectCirclesTool>(value);
1734 qWarning()<<
"Unknown property type. id = "<<id;
1752 setPointName<VToolPointOfIntersectionCurves>(value.toString());
1757 setCurveVCrossPoint<VToolPointOfIntersectionCurves>(value);
1763 setCurveHCrossPoint<VToolPointOfIntersectionCurves>(value);
1773 qWarning()<<
"Unknown property type. id = "<<id;
1791 setPointName<IntersectCircleTangentTool>(value.toString());
1799 setCirclesCrossPoint<IntersectCircleTangentTool>(value);
1809 qWarning()<<
"Unknown property type. id = "<<id;
1827 setPointName<VToolPointFromArcAndTangent>(value.toString());
1832 setCirclesCrossPoint<VToolPointFromArcAndTangent>(value);
1842 qWarning()<<
"Unknown property type. id = "<<id;
1863 setPointName<VToolShoulderPoint>(value.toString());
1884 qWarning()<<
"Unknown property type. id = "<<id;
1958 qWarning()<<
"Unknown property type. id = "<<id;
1993 spline.SetP1(point);
1998 spline.SetP2(point);
2003 spline.SetP3(point);
2008 spline.SetP4(point);
2012 qWarning()<<
"Unknown property type. id = "<<id;
2042 qWarning()<<
"Unknown property type. id = "<<id;
2072 qWarning()<<
"Unknown property type. id = "<<id;
2090 setPointName<VToolTriangle>(value.toString());
2105 qWarning()<<
"Unknown property type. id = "<<id;
2123 setPointName<VToolLineIntersectAxis>(value.toString());
2147 qWarning()<<
"Unknown property type. id = "<<id;
2165 setPointName<VToolCurveIntersectAxis>(value.toString());
2186 qWarning()<<
"Unknown property type. id = "<<id;
2204 setOperationSuffix<VToolRotation>(value.toString());
2213 qWarning()<<
"Unknown property type. id = "<<id;
2234 setOperationSuffix<VToolMove>(value.toString());
2246 qWarning()<<
"Unknown property type. id = "<<id;
2264 setOperationSuffix<VToolMirrorByLine>(value.toString());
2273 qWarning()<<
"Unknown property type. id = "<<id;
2293 setAxisType<VToolMirrorByAxis>(value);
2297 setOperationSuffix<VToolMirrorByAxis>(value.toString());
2303 qWarning()<<
"Unknown property type. id = "<<id;
2351 qWarning()<<
"Unknown property type. id = "<<id;
2359 VToolBasePoint *tool = qgraphicsitem_cast<VToolBasePoint *>(item);
2361 formView->setTitle(tr(
"Base point"));
2368 addProperty(itemCoordinates, QLatin1String(
"Coordinates"));
2374 VToolEndLine *tool = qgraphicsitem_cast<VToolEndLine *>(item);
2376 formView->setTitle(tr(
"Point - Length and Angle"));
2395 VToolAlongLine *tool = qgraphicsitem_cast<VToolAlongLine *>(item);
2397 formView->setTitle(tr(
"Point - On Line"));
2416 VToolArc *tool = qgraphicsitem_cast<VToolArc *>(item);
2418 formView->setTitle(tr(
"Arc - Radius and Angles"));
2440 formView->setTitle(tr(
"Arc - Radius and Length"));
2460 VToolBisector *tool = qgraphicsitem_cast<VToolBisector *>(item);
2462 formView->setTitle(tr(
"Point - On Bisector"));
2482 VToolTrueDarts *tool = qgraphicsitem_cast<VToolTrueDarts *>(item);
2484 formView->setTitle(tr(
"True darts"));
2499 VToolCutArc *tool = qgraphicsitem_cast<VToolCutArc *>(item);
2501 formView->setTitle(tr(
"Point - On Arc"));
2514 VToolCutSpline *tool = qgraphicsitem_cast<VToolCutSpline *>(item);
2516 formView->setTitle(tr(
"Point - On Curve"));
2531 formView->setTitle(tr(
"Point - On Spline"));
2544 VToolHeight *tool = qgraphicsitem_cast<VToolHeight *>(item);
2546 formView->setTitle(tr(
"Point - Intersect Line and Perpendicular"));
2563 VToolLine *tool = qgraphicsitem_cast<VToolLine *>(item);
2583 formView->setTitle(tr(
"Point - Intersect Lines"));
2598 VToolNormal *tool = qgraphicsitem_cast<VToolNormal *>(item);
2600 formView->setTitle(tr(
"Point - On Perpendicular"));
2628 formView->setTitle(tr(
"Point - Intersect Arc and Line"));
2645 formView->setTitle(tr(
"Point - Intersect XY"));
2663 formView->setTitle(tr(
"Point - Intersect Arcs"));
2677 formView->setTitle(tr(
"Point - Intersect Circles"));
2698 formView->setTitle(tr(
"Point - Intersect Curves"));
2713 formView->setTitle(tr(
"Point - Intersect Circle and Tangent"));
2730 formView->setTitle(tr(
"Point - Intersect Arc and Tangent"));
2744 formView->setTitle(tr(
"Point - Length to Line"));
2764 VToolSpline *tool = qgraphicsitem_cast<VToolSpline *>(item);
2768 formView->setTitle(tr(
"Curve - Interactive"));
2814 formView->setTitle(tr(
"Curve - Fixed"));
2836 formView->setTitle(tr(
"Spline - Interactive"));
2852 formView->setTitle(tr(
"Spline - Fixed"));
2864 VToolTriangle *tool = qgraphicsitem_cast<VToolTriangle *>(item);
2867 formView->setTitle(tr(
"Point - Intersect Axis and Triangle"));
2881 formView->setTitle(tr(
"Point - Intersect Line and Axis"));
2903 formView->setTitle(tr(
"Point - Intersect Curve and Axis"));
2923 VToolRotation *tool = qgraphicsitem_cast<VToolRotation *>(item);
2925 formView->setTitle(tr(
"Rotation"));
2938 VToolMove *tool = qgraphicsitem_cast<VToolMove *>(item);
2957 formView->setTitle(tr(
"Mirror by Line"));
2972 formView->setTitle(tr(
"Mirror by Axis"));
2985 formView->setTitle(tr(
"Arc - Elliptical"));
3039 QVariant valueFormula;
3043 QVariant valueAngle;
3081 QVariant valueFormula;
3092 QVariant valueRadius;
3096 QVariant valueFirstAngle;
3100 QVariant valueSecondAngle;
3133 QVariant valueRadius;
3137 QVariant valueFirstAngle;
3141 QVariant valueLength;
3174 QVariant valueFormula;
3260 QVariant valueFormula;
3278 QVariant valueFormula;
3296 QVariant valueFormula;
3413 QVariant valueFormula;
3454 QVariant valueFormula;
3637 QVariant valueFormula;
3701 angle1.setValue(angle1F);
3709 length1.setValue(length1F);
3717 angle2.setValue(angle2F);
3725 length2.setValue(length2F);
3766 spl.GetP1().name());
3772 spl.GetP2().name());
3778 spl.GetP3().name());
3784 spl.GetP4().name());
3903 QVariant valueAngle;
3941 QVariant valueAngle;
3952 QVariant valueAngle;
3969 QVariant valueAngle;
3973 QVariant valueLength;
3977 QVariant valueRotation;
4028 QVariant valueFormulaRadius1;
4032 QVariant valueFormulaRadius2;
4036 QVariant valueFormulaF1;
4040 QVariant valueFormulaF2;
4044 QVariant valueFormulaRotationAngle;
4073 static QStringList attr = QStringList() <<
AttrName
4074 << QLatin1String(
"Coordinates")
void setLineColor(const QString &value)
void SetPenStyle(const QString &value)
QString getLineColor() const
void setLineWeight(const QString &value)
setLineWeight set line weight of the spline
QString GetPenStyle() const
QString getLineWeight() const
getLineWeight return line weight of the spline
The VContainer class container of all variables.
static bool IsUnique(const QString &name)
const QSharedPointer< VGObject > GetGObject(quint32 id) const
GetGObject returns a point by id.
const QSharedPointer< T > GeometricObject(const quint32 &id) const
static QStringList AllUniqueNames()
const QHash< quint32, QSharedPointer< VGObject > > * DataGObjects() const
data container with datagObjects return container of gObjects
virtual QString name() const
name return name graphical object.
Class for holding a double property.
virtual void setSetting(const QString &key, const QVariant &value)
Sets the settings. Available settings:
static int indexOfLineType(const QMap< QString, QString > &styles, const QString &style)
virtual void setValue(const QVariant &value) Q_DECL_OVERRIDE
Sets the value of the property.
virtual void setLineTypes(const QMap< QString, QString > &styles)
Sets the line styles.
virtual void setValue(const QVariant &value) Q_DECL_OVERRIDE
Sets the value of the property.
virtual void setLineWeights(const QMap< QString, QString > &weights)
Sets the line styles.
static int indexOfLineWeight(const QMap< QString, QString > &lineWeights, const QString &weight)
virtual void setValue(const QVariant &value) Q_DECL_OVERRIDE
Sets the value of the property.
virtual void setLiterals(const QStringList &literals)
Sets the enumeration literals.
Class for holding a string property.
virtual void setValue(const QVariant &value) Q_DECL_OVERRIDE
Sets the value of the property.
static int indexOfColor(const QMap< QString, QString > &colors, const QString &color)
virtual void setColors(const QMap< QString, QString > &colors)
Sets the colors.
static int indexOfObject(const QMap< QString, quint32 > &objects, const QString &object)
virtual void setValue(const QVariant &value) Q_DECL_OVERRIDE
Sets the value of the property.
void setObjectsList(const QMap< QString, quint32 > &objects)
Sets the objects list.
virtual void setValue(const QVariant &value) Q_DECL_OVERRIDE
Sets the value of the property.
This is the base model for managing all the properties and passing them to the view.
virtual bool addProperty(VProperty *property, const QString &id, const QString &parentid=QString(), bool emitsignals=true)
Adds the property to the model and attaches it to the parentid.
virtual void clear(bool emit_signals=true)
Clears the model, deletes the property set managed by this model.
void onDataChangedByEditor(VProperty *property)
This signal is being emitted, when the setData method is being called.
virtual void setValue(const QVariant &value)
Sets the value of the property.
virtual VProperty * getParent() const
Gets the parent of this property.
Class for holding a string property.
void setReadOnly(bool readOnly)
void setClearButtonEnable(bool value)
The VPointF class keep data of point.
VSpline class that implements the spline.
virtual VPointF GetP4() const Q_DECL_OVERRIDE
GetP4 return last spline point.
QString GetC1LengthFormula() const
virtual VPointF GetP1() const Q_DECL_OVERRIDE
GetP1 return first spline point.
QString GetStartAngleFormula() const
QString GetEndAngleFormula() const
QString GetC2LengthFormula() const
const QString degreeSymbol
QString UnitsToStr(const Unit &unit, const bool translate)
UnitsToStr translate unit to string.
const QString AttrBasePoint
const QString AttrC1Radius
const QString AttrPShoulder
const QString AttrLineType
const QString AttrSecondPoint
const QString AttrC2Radius
const QString AttrFirstPoint
const QString AttrLineWeight
const QString AttrP1Line1
const QString AttrPenStyle
const QString AttrSecondArc
const QString AttrFirstArc
const QString AttrRadius2
const QString AttrAxisType
const QString AttrC1Center
const QString AttrCrossPoint
QMap< QString, QString > lineTypeList()
const QString AttrTangent
const QString AttrLength2
QMap< QString, QString > curveLineTypeList()
const QString AttrRotationAngle
const QString LineTypeNone
const QString AttrRadius1
const QString AttrObjName
const QString AttrHCrossPoint
const QString AttrLength1
const QString AttrC2Center
const QString AttrThirdPoint
const QString AttrVCrossPoint
const QString AttrCRadius
const QString AttrLineColor
const QString AttrP2Line2
const QString AttrP1Line2
const QString AttrP2Line1
const QString AttrCCenter
QMap< QString, QString > lineWeightList()