54 #include "../../../undocommands/label/moveoperationlabel.h"
55 #include "../../../undocommands/label/showoperationpointname.h"
56 #include "../vgeometry/vpointf.h"
66 ids.reserve(source.size());
107 item->setVisible(visible);
113 item->setVisible(visible);
152 point->setShowPointName(visible);
188 point->setMx(pos.x());
189 point->setMy(pos.y());
192 if (QGraphicsScene *sc = scene())
239 const QDomNodeList nodeList = domElement.childNodes();
240 for (qint32 i = 0; i < nodeList.size(); ++i)
242 const QDomElement dataElement = nodeList.at(i).toElement();
243 if (not dataElement.isNull() && dataElement.tagName() ==
TagSource)
246 const QDomNodeList srcList = dataElement.childNodes();
247 for (qint32 j = 0; j < srcList.size(); ++j)
249 const QDomElement element = srcList.at(j).toElement();
250 if (not element.isNull())
262 if (not dataElement.isNull() && dataElement.tagName() ==
TagDestination)
265 const QDomNodeList srcList = dataElement.childNodes();
266 for (qint32 j = 0; j < srcList.size(); ++j)
268 const QDomElement element = srcList.at(j).toElement();
269 if (not element.isNull())
293 VSimplePoint *item = qobject_cast<VSimplePoint *>(i.value());
300 VSimpleCurve *item = qobject_cast<VSimpleCurve *>(i.value());
318 VSimplePoint *item = qobject_cast<VSimplePoint *>(i.value());
320 item->setAcceptHoverEvents(enabled);
324 VSimpleCurve *item = qobject_cast<VSimpleCurve *>(i.value());
326 item->setAcceptHoverEvents(enabled);
340 VSimplePoint *item = qobject_cast<VSimplePoint *>(i.value());
342 item->setFlag(QGraphicsItem::ItemIsSelectable, enabled);
346 VSimpleCurve *item = qobject_cast<VSimpleCurve *>(i.value());
348 item->setFlag(QGraphicsItem::ItemIsSelectable, enabled);
362 VSimplePoint *item = qobject_cast<VSimplePoint *>(i.value());
378 VSimplePoint *item = qobject_cast<VSimplePoint *>(i.value());
380 item->setAcceptHoverEvents(enabled);
394 VSimplePoint *item = qobject_cast<VSimplePoint *>(i.value());
396 item->setFlag(QGraphicsItem::ItemIsSelectable, enabled);
410 VSimplePoint *item = qobject_cast<VSimplePoint *>(i.value());
426 VSimplePoint *item = qobject_cast<VSimplePoint *>(i.value());
495 VSimplePoint *item = qobject_cast<VSimplePoint *>(i.value());
514 VSimplePoint *item = qobject_cast<VSimplePoint *>(i.value());
520 VSimpleCurve *item = qobject_cast<VSimpleCurve *>(i.value());
522 item->setEnabled(enabled);
550 QGraphicsItem *parent)
552 , QGraphicsLineItem(parent)
555 , destination(destination)
592 for (
auto sourceItem : qAsConst(
source))
594 QDomElement item =
doc->createElement(
TagItem);
599 tagObjects.appendChild(item);
601 tag.appendChild(tagObjects);
606 QDomElement item =
doc->createElement(
TagItem);
617 tagObjects.appendChild(item);
619 tag.appendChild(tagObjects);
627 curve->setParentItem(
this);
628 curve->SetType(curveType);
653 VSimpleCurve *item = qobject_cast<VSimpleCurve *>(i.value());
657 item->setAcceptHoverEvents(enabled);
672 VSimpleCurve *item = qobject_cast<VSimpleCurve *>(i.value());
676 item->setFlag(QGraphicsItem::ItemIsSelectable, enabled);
691 Q_STATIC_ASSERT_X(
static_cast<int>(
GOType::Unknown) == 7,
"Not all objects were handled.");
694 QT_WARNING_DISABLE_GCC(
"-Wswitch-default")
695 switch(
static_cast<GOType>(object->getType()))
700 point->setParentItem(
this);
709 this, [
this](QGraphicsSceneContextMenuEvent * event, quint32
id)
749 const QString toolTipStr = QString(
"<table>"
750 "<tr> <td><b>%1:</b> %2</td> </tr>"
762 const QString toolTipStr = QString(
"<table>"
763 "<tr> <td><b> %1:</b> %2</td> </tr>"
764 "<tr> <td><b>%3:</b> %4 %5</td> </tr>"
770 .arg(
qApp->fromPixel(curve->GetLength()))
void AllowArcSelecting(bool enabled)
virtual void AllowHover(bool enabled) Q_DECL_OVERRIDE
virtual void FullUpdateFromFile() Q_DECL_OVERRIDE
virtual void SaveOptions(QDomElement &tag, QSharedPointer< VGObject > &obj) Q_DECL_OVERRIDE
virtual void ToolSelectionType(const SelectionType &type) Q_DECL_OVERRIDE
QMap< quint32, VAbstractSimple * > operatedObjects
VAbstractOperation(VAbstractPattern *doc, VContainer *data, quint32 id, const QString &suffix, const QVector< SourceItem > &source, const QVector< DestinationItem > &destination, QGraphicsItem *parent=nullptr)
void updatePointNamePosition(quint32 id, const QPointF &pos)
virtual void setPointNamePosition(quint32 id, const QPointF &pos) Q_DECL_OVERRIDE
void AllowElArcSelecting(bool enabled)
QVector< SourceItem > source
virtual void AddToFile() Q_DECL_OVERRIDE
AddToFile add tag with Information about tool into file.
static const QString TagDestination
virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) Q_DECL_OVERRIDE
void pointNamePositionChanged(const QPointF &pos, quint32 labelId)
void AllowArcHover(bool enabled)
static const QString TagItem
void SaveSourceDestination(QDomElement &tag)
void AllowPointLabelSelecting(bool enabled)
void AllowPointSelecting(bool enabled)
static void ExtractData(const QDomElement &domElement, QVector< SourceItem > &source, QVector< DestinationItem > &destination)
void AllowCurveSelecting(bool enabled, GOType type)
virtual void AllowSelecting(bool enabled) Q_DECL_OVERRIDE
virtual void Disable(bool disable, const QString &draftBlockName) Q_DECL_OVERRIDE
void ObjectSelected(bool selected, quint32 objId)
void AllowSplinePathHover(bool enabled)
void InitOperatedObjects()
virtual void ReadToolAttributes(const QDomElement &domElement) Q_DECL_OVERRIDE
void setSuffix(const QString &suffix)
void AllowPointLabelHover(bool enabled)
virtual void GroupVisibility(quint32 object, bool visible) Q_DECL_OVERRIDE
void AllowSplineHover(bool enabled)
QString complexPointToolTip(quint32 itemId) const
void AllowPointHover(bool enabled)
virtual void EnableToolMove(bool move) Q_DECL_OVERRIDE
QVector< DestinationItem > destination
static const QString TagSource
virtual void setPointNameVisiblity(quint32 id, bool visible) Q_DECL_OVERRIDE
void AllowSplinePathSelecting(bool enabled)
virtual void updatePointNameVisibility(quint32 id, bool visible) Q_DECL_OVERRIDE
virtual bool isPointNameVisible(quint32 id) const Q_DECL_OVERRIDE
QString complexCurveToolTip(quint32 itemId) const
void AllowCurveHover(bool enabled, GOType type)
virtual QString getTagName() const Q_DECL_OVERRIDE
void AllowSplineSelecting(bool enabled)
void InitCurve(quint32 id, VContainer *data, GOType curveType, SceneObject sceneType)
void AllowElArcHover(bool enabled)
static const QString TagOperation
void showContextMenu(QGraphicsSceneContextMenuEvent *event, quint32 id=null_id)
void SetType(const GOType &value)
The VContainer class container of all variables.
const QSharedPointer< VGObject > GetGObject(quint32 id) const
GetGObject returns a point by id.
const QSharedPointer< T > GeometricObject(const quint32 &id) const
static const QSharedPointer< VGObject > GetFakeGObject(quint32 id)
static QString GetParametrString(const QDomElement &domElement, const QString &name, const QString &defValue=QString())
Returns the string value of the given attribute. RENAME: see above.
static quint32 GetParametrUInt(const QDomElement &domElement, const QString &name, const QString &defValue)
Returns the long long value of the given attribute. RENAME: GetParameterLongLong?
static QString GetParametrEmptyString(const QDomElement &domElement, const QString &name)
static bool getParameterBool(const QDomElement &domElement, const QString &name, const QString &defValue)
static qreal GetParametrDouble(const QDomElement &domElement, const QString &name, const QString &defValue)
Returns the double value of the given attribute.
void SetAttribute(QDomElement &domElement, const QString &name, const T &value) const
SetAttribute set attribute in pattern file. Replace "," by ".".
static void RemoveAllChildren(QDomElement &domElement)
RemoveAllChildren remove all children from file.
static void NewSceneRect(QGraphicsScene *sc, QGraphicsView *view, QGraphicsItem *item=nullptr)
NewSceneRect calculate scene rect what contains all items and doesn't less that size of scene view.
The VPointF class keep data of point.
virtual void refreshPointGeometry(const VPointF &point)
void RefreshGeometry(const QSharedPointer< VAbstractCurve > &curve)
void Selected(bool selected, quint32 id)
void Choosed(quint32 id)
Choosed send id when clicked.
void nameChangedPosition(const QPointF &pos, quint32 id)
void SetEnabled(bool enabled)
void EnableToolMove(bool move)
void Choosed(quint32 id)
Choosed send id when clicked.
void allowTextHover(bool enabled)
void allowTextSelectable(bool enabled)
void Selected(bool selected, quint32 id)
virtual void ToolSelectionType(const SelectionType &type) Q_DECL_OVERRIDE
QString UnitsToStr(const Unit &unit, const bool translate)
UnitsToStr translate unit to string.
static Q_REQUIRED_RESULT bool VFuzzyComparePossibleNulls(double p1, double p2)
const QString AttrLineType
const QString LineTypeSolidLine
const QString AttrShowPointName
const QString AttrIdObject
QVector< quint32 > sourceToObjects(const QVector< SourceItem > &source)