Seamly2D
Code documentation
VDrawTool Class Referenceabstract

The VDrawTool abstract class for all draw tool. More...

#include <vdrawtool.h>

Inheritance diagram for VDrawTool:
Collaboration diagram for VDrawTool:

Public Slots

virtual void ShowTool (quint32 id, bool enable)
 ShowTool highlight tool. More...
 
virtual void activeBlockChanged (const QString &newName)
 activeBlockChanged disable or enable context menu after change active draft block. More...
 
void blockNameChanged (const QString &oldName, const QString &newName)
 blockNameChanged save new name active draft block. More...
 
virtual void EnableToolMove (bool move)
 
virtual void Disable (bool disable, const QString &draftBlockName)=0
 
virtual void piecesMode (bool mode)
 
- Public Slots inherited from VInteractiveTool
void FullUpdateFromGuiOk (int result)
 FullUpdateFromGuiOk refresh tool data after change in options. More...
 
void FullUpdateFromGuiApply ()
 FullUpdateFromGuiApply refresh tool data after change in options but do not delete dialog. More...
 
- Public Slots inherited from VAbstractTool
virtual void FullUpdateFromFile ()=0
 FullUpdateFromFile update tool data form file. More...
 
virtual void AllowHover (bool enabled)=0
 
virtual void AllowSelecting (bool enabled)=0
 
virtual void ToolSelectionType (const SelectionType &type)
 

Signals

void ChangedToolSelection (bool selected, quint32 object, quint32 tool)
 
- Signals inherited from VAbstractTool
void toolHasChanges ()
 toolHasChanges emit if tool create change that need save. More...
 
void chosenTool (quint32 id, SceneObject type)
 chosenTool emit if object was clicked. More...
 
void LiteUpdateTree (const Document &parse)
 FullUpdateTree emit if need reparse pattern file. More...
 
void ToolTip (const QString &toolTip)
 

Public Member Functions

 VDrawTool (VAbstractPattern *doc, VContainer *data, quint32 id, QObject *parent=nullptr)
 VDrawTool constructor. More...
 
virtual ~VDrawTool () Q_DECL_EQ_DEFAULT
 
QString getLineType () const
 
virtual void setLineType (const QString &value)
 
QString getLineWeight () const
 
virtual void setLineWeight (const QString &value)
 
virtual bool isPointNameVisible (quint32 id) const
 
- Public Member Functions inherited from VInteractiveTool
 VInteractiveTool (VAbstractPattern *doc, VContainer *data, quint32 id, QObject *parent=nullptr)
 
virtual ~VInteractiveTool () Q_DECL_EQ_DEFAULT
 
void DialogLinkDestroy ()
 
- Public Member Functions inherited from VAbstractTool
 VAbstractTool (VAbstractPattern *doc, VContainer *data, quint32 id, QObject *parent=nullptr)
 VAbstractTool container. More...
 
virtual ~VAbstractTool () Q_DECL_OVERRIDE
 
quint32 getId () const
 getId return object id. More...
 
const VContainergetData () const
 getData return pointer to data container. More...
 
QMap< QString, quint32 > PointsList () const
 
virtual QString getTagName () const =0
 
virtual void ShowVisualization (bool show)=0
 
virtual void setPointNamePosition (quint32 id, const QPointF &pos)
 
virtual void setPointNameVisiblity (quint32 id, bool visible)
 
- Public Member Functions inherited from VDataTool
 VDataTool (VContainer *data, QObject *parent=nullptr)
 VDataTool constructor. More...
 
virtual ~VDataTool () Q_DECL_EQ_DEFAULT
 
VContainer getData () const
 getData return data container. More...
 
void setData (const VContainer *value)
 setData set data container. More...
 
virtual quint32 referens () const
 referens return count of referens. More...
 
virtual void incrementReferens ()
 incrementReferens increment referens. More...
 
virtual void decrementReferens ()
 decrementReferens decrement referens. More...
 
virtual void GroupVisibility (quint32 object, bool visible)=0
 

Protected Types

enum class  RemoveOption : bool { Disable = false , Enable = true }
 
enum class  Referens : bool { Follow = true , Ignore = false }
 

Protected Slots

virtual void showContextMenu (QGraphicsSceneContextMenuEvent *event, quint32 id=NULL_ID)=0
 

Protected Member Functions

void AddToCalculation (const QDomElement &domElement)
 typeLine line weight. More...
 
void addDependence (QList< quint32 > &list, quint32 objectId) const
 
virtual void SaveDialog (QDomElement &domElement)=0
 SaveDialog save options into file after change in dialog. More...
 
virtual void SaveDialogChange () Q_DECL_FINAL
 
virtual void AddToFile () Q_DECL_OVERRIDE
 AddToFile add tag with Information about tool into file. More...
 
void SaveOption (QSharedPointer< VGObject > &obj)
 
virtual void SaveOptions (QDomElement &tag, QSharedPointer< VGObject > &obj)
 
virtual QString makeToolTip () const
 
bool CorrectDisable (bool disable, const QString &draftBlockName) const
 
void ReadAttributes ()
 
virtual void ReadToolAttributes (const QDomElement &domElement)=0
 
virtual void updatePointNameVisibility (quint32 id, bool visible)
 
template<typename Dialog >
void ContextMenu (QGraphicsSceneContextMenuEvent *event, quint32 itemId=NULL_ID, const RemoveOption &showRemove=RemoveOption::Enable, const Referens &ref=Referens::Follow)
 ContextMenu show context menu for tool. More...
 
template<typename Item >
void ShowItem (Item *item, quint32 id, bool enable)
 ShowItem highlight tool. More...
 
template<typename T >
QString ObjectName (quint32 id) const
 ObjectName get object (point, curve, arc) name. More...
 
- Protected Member Functions inherited from VInteractiveTool
virtual void setDialog ()
 setDialog set dialog when user want change tool option. More...
 
- Protected Member Functions inherited from VAbstractTool
virtual void RefreshDataInFile ()
 RefreshDataInFile refresh attributes in file. If attributes don't exist create them. More...
 
virtual void RemoveReferens ()
 RemoveReferens decrement value of reference. More...
 
virtual void deleteTool (bool ask=true)
 deleteTool full delete object form scene and file. More...
 
template<typename T >
void AddVisualization ()
 
virtual void SetVisualization ()=0
 
virtual void ToolCreation (const Source &typeCreation)
 

Static Protected Member Functions

template<typename T >
static void InitDrawToolConnections (VMainGraphicsScene *scene, T *tool)
 
- Static Protected Member Functions inherited from VAbstractTool
static int ConfirmDeletion ()
 
static QDomElement AddSANode (VAbstractPattern *doc, const QString &tagName, const VPieceNode &node)
 
static void AddNode (VAbstractPattern *doc, QDomElement &domElement, const VPieceNode &node)
 
static QVector< VPieceNodePrepareNodes (const VPiecePath &path, VMainGraphicsScene *scene, VAbstractPattern *doc, VContainer *data)
 
static quint32 PrepareNode (const VPieceNode &node, VMainGraphicsScene *scene, VAbstractPattern *doc, VContainer *data)
 

Protected Attributes

QString activeBlockName
 
QString m_lineType
 activeBlockName name of tool's pattern peace. More...
 
QString m_lineWeight
 typeLine line type. More...
 
- Protected Attributes inherited from VInteractiveTool
QSharedPointer< DialogToolm_dialog
 m_dialog tool's dialog options. More...
 
- Protected Attributes inherited from VAbstractTool
VAbstractPatterndoc
 doc dom document container More...
 
const quint32 m_id
 id object id. More...
 
QPointer< Visualizationvis
 
SelectionType selectionType
 
- Protected Attributes inherited from VDataTool
VContainer data
 data container with data More...
 
quint32 _referens
 _referens keep count tools what use this tool. If value more than 1 you can't delete tool. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from VAbstractTool
static qreal CheckFormula (const quint32 &toolId, QString &formula, VContainer *data)
 CheckFormula check formula. More...
 
static const QStringList Colors ()
 
static QMap< QString, QString > ColorsList ()
 
static QMap< QString, QString > supportColorsList ()
 
static QMap< QString, QString > backgroundColorsList ()
 
static QPixmap createColorIcon (const int w, const int h, const QString &color)
 
static const QStringList fills ()
 
static void AddRecord (const quint32 id, const Tool &toolType, VAbstractPattern *doc)
 AddRecord add record about tool in history. More...
 
static void AddNodes (VAbstractPattern *doc, QDomElement &domElement, const VPiecePath &path)
 
static void AddNodes (VAbstractPattern *doc, QDomElement &domElement, const VPiece &piece)
 
template<typename T >
static quint32 CreateNode (VContainer *data, quint32 id)
 CreateNode create new node for detail. More...
 
- Static Public Attributes inherited from VAbstractTool
static bool m_suppressContextMenu = false
 
static const QString AttrInUse = QStringLiteral("inUse")
 

Detailed Description

The VDrawTool abstract class for all draw tool.

Definition at line 67 of file vdrawtool.h.

Member Enumeration Documentation

◆ Referens

enum VDrawTool::Referens : bool
strongprotected
Enumerator
Follow 
Ignore 

Definition at line 99 of file vdrawtool.h.

◆ RemoveOption

enum VDrawTool::RemoveOption : bool
strongprotected
Enumerator
Disable 
Enable 

Definition at line 98 of file vdrawtool.h.

Constructor & Destructor Documentation

◆ VDrawTool()

VDrawTool::VDrawTool ( VAbstractPattern doc,
VContainer data,
quint32  id,
QObject *  parent = nullptr 
)

VDrawTool constructor.

Parameters
docdom document container.
datacontainer with variables.
idobject id in container.

Definition at line 62 of file vdrawtool.cpp.

References activeBlockChanged(), VAbstractPattern::activeDraftBlockChanged(), blockNameChanged(), VAbstractPattern::draftBlockNameChanged(), VAbstractPattern::ShowTool(), and ShowTool().

◆ ~VDrawTool()

virtual VDrawTool::~VDrawTool ( )
virtual

Member Function Documentation

◆ activeBlockChanged

void VDrawTool::activeBlockChanged ( const QString &  newName)
virtualslot

activeBlockChanged disable or enable context menu after change active draft block.

Parameters
newNamenew name active draft block.

Definition at line 90 of file vdrawtool.cpp.

References activeBlockName, and Disable().

Referenced by VDrawTool().

◆ addDependence()

void VDrawTool::addDependence ( QList< quint32 > &  list,
quint32  objectId 
) const
protected

Definition at line 237 of file vdrawtool.cpp.

References VDataTool::data, VContainer::GetGObject(), and NULL_ID.

◆ AddToCalculation()

void VDrawTool::AddToCalculation ( const QDomElement &  domElement)
protected

typeLine line weight.

AddToCalculation add tool to calculation tag in pattern file.

Parameters
domElementtag in xml tree.

Definition at line 229 of file vdrawtool.cpp.

References AddToCalc, VAbstractTool::doc, VAbstractPattern::NeedFullParsing(), VUndoCommand::NeedFullParsing(), and qApp.

Referenced by VAbstractOperation::AddToFile(), VToolDoublePoint::AddToFile(), AddToFile(), and VToolLine::AddToFile().

◆ AddToFile()

void VDrawTool::AddToFile ( )
protectedvirtual

AddToFile add tag with Information about tool into file.

Implements VAbstractTool.

Reimplemented in VToolLine, VToolBasePoint, VToolDoublePoint, and VAbstractOperation.

Definition at line 133 of file vdrawtool.cpp.

References AddToCalculation(), VDataTool::data, VAbstractTool::doc, VContainer::GetGObject(), VAbstractTool::getTagName(), VAbstractTool::m_id, and SaveOptions().

◆ blockNameChanged

void VDrawTool::blockNameChanged ( const QString &  oldName,
const QString &  newName 
)
slot

blockNameChanged save new name active draft block.

Parameters
oldNameold name.
newNamenew name active draft block. new name.

Definition at line 101 of file vdrawtool.cpp.

References activeBlockName.

Referenced by VDrawTool().

◆ ChangedToolSelection

void VDrawTool::ChangedToolSelection ( bool  selected,
quint32  object,
quint32  tool 
)
signal

◆ ContextMenu()

◆ CorrectDisable()

bool VDrawTool::CorrectDisable ( bool  disable,
const QString &  draftBlockName 
) const
protected

◆ Disable

virtual void VDrawTool::Disable ( bool  disable,
const QString &  draftBlockName 
)
pure virtualslot

Referenced by activeBlockChanged().

◆ EnableToolMove

void VDrawTool::EnableToolMove ( bool  move)
virtualslot

Definition at line 211 of file vdrawtool.cpp.

◆ getLineType()

◆ getLineWeight()

◆ InitDrawToolConnections()

◆ isPointNameVisible()

bool VDrawTool::isPointNameVisible ( quint32  id) const
virtual

Reimplemented in VToolSinglePoint, VToolDoublePoint, and VAbstractOperation.

Definition at line 277 of file vdrawtool.cpp.

Referenced by ContextMenu().

◆ makeToolTip()

◆ ObjectName()

template<typename T >
QString VDrawTool::ObjectName ( quint32  id) const
protected

ObjectName get object (point, curve, arc) name.

Parameters
idobject id in container.

Definition at line 347 of file vdrawtool.h.

References VDataTool::data, VException::DetailedInformation(), VExceptionBadId::ErrorMessage(), and VContainer::GeometricObject().

◆ piecesMode

void VDrawTool::piecesMode ( bool  mode)
virtualslot

Definition at line 218 of file vdrawtool.cpp.

◆ ReadAttributes()

◆ ReadToolAttributes()

◆ SaveDialog()

◆ SaveDialogChange()

◆ SaveOption()

void VDrawTool::SaveOption ( QSharedPointer< VGObject > &  obj)
protected

Definition at line 142 of file vdrawtool.cpp.

References VAbstractTool::doc, VDomDocument::elementById(), VAbstractTool::getTagName(), VAbstractPattern::LiteParseTree(), VAbstractTool::m_id, VUndoCommand::NeedLiteParsing(), qApp, SaveOptions(), and SaveToolOptions.

Referenced by VToolLinePoint::SetAngle(), VToolArc::setArc(), VToolPointFromArcAndTangent::SetArcId(), VToolPointOfContact::setArcRadius(), VToolTriangle::SetAxisP1Id(), VToolTriangle::SetAxisP2Id(), VToolMirrorByAxis::setAxisType(), VToolTrueDarts::SetBaseLineP1Id(), VToolTrueDarts::SetBaseLineP2Id(), VToolLinePoint::SetBasePointId(), VToolBasePoint::SetBasePointPos(), VToolArc::setCenter(), VToolArcWithLength::setCenter(), VToolEllipticalArc::setCenter(), VToolPointOfContact::setCenter(), IntersectCircleTangentTool::SetCircleCenterId(), IntersectCircleTangentTool::SetCircleRadius(), IntersectCirclesTool::setCirclesCrossPoint(), IntersectCircleTangentTool::setCirclesCrossPoint(), VToolPointFromArcAndTangent::setCirclesCrossPoint(), VToolPointOfIntersectionArcs::setCirclesCrossPoint(), VToolCut::setCurveCutId(), VToolCurveIntersectAxis::setCurveId(), VToolTrueDarts::SetDartP1Id(), VToolTrueDarts::SetDartP2Id(), VToolTrueDarts::SetDartP3Id(), VToolPointOfIntersectionArcs::SetFirstArcId(), IntersectCirclesTool::SetFirstCircleCenterId(), IntersectCirclesTool::SetFirstCircleRadius(), VToolPointOfIntersectionCurves::SetFirstCurveId(), VToolMirrorByLine::setFirstLinePointId(), VToolLine::SetFirstPoint(), DoubleLinePointTool::setFirstPointId(), VToolBisector::SetFirstPointId(), VToolLineIntersectAxis::SetFirstPointId(), VToolPointOfContact::SetFirstPointId(), VToolTriangle::SetFirstPointId(), VToolCut::SetFormula(), VToolMove::SetFormulaAngle(), VToolRotation::SetFormulaAngle(), VToolCurveIntersectAxis::SetFormulaAngle(), VToolEndLine::SetFormulaAngle(), VToolLineIntersectAxis::SetFormulaAngle(), VToolArc::SetFormulaF1(), VToolArcWithLength::SetFormulaF1(), VToolEllipticalArc::SetFormulaF1(), VToolArc::SetFormulaF2(), VToolEllipticalArc::SetFormulaF2(), VToolMove::SetFormulaLength(), VToolArcWithLength::SetFormulaLength(), VToolLinePoint::SetFormulaLength(), VToolArc::SetFormulaRadius(), VToolArcWithLength::SetFormulaRadius(), VToolEllipticalArc::SetFormulaRadius1(), VToolEllipticalArc::SetFormulaRadius2(), VToolMove::setFormulaRotation(), VToolEllipticalArc::SetFormulaRotationAngle(), VToolPointOfIntersectionCurves::SetHCrossPoint(), VAbstractSpline::setLineColor(), DoubleLinePointTool::setLineColor(), VToolLinePoint::setLineColor(), VToolLine::setLineColor(), setLineType(), VToolLine::setLineType(), VAbstractSpline::setLineWeight(), setLineWeight(), VToolLine::setLineWeight(), VToolMirrorByAxis::setOriginPointId(), VToolMove::setOriginPointId(), VToolRotation::setOriginPointId(), VToolLineIntersect::SetP1Line1(), VToolLineIntersect::SetP1Line2(), VToolHeight::SetP1LineId(), VToolShoulderPoint::SetP2Line(), VToolLineIntersect::SetP2Line1(), VToolLineIntersect::SetP2Line2(), VToolHeight::SetP2LineId(), VAbstractSpline::SetPenStyle(), VAbstractPoint::SetPointName(), VToolShoulderPoint::setPShoulder(), VToolPointOfIntersectionArcs::SetSecondArcId(), IntersectCirclesTool::SetSecondCircleCenterId(), IntersectCirclesTool::SetSecondCircleRadius(), VToolPointOfIntersectionCurves::SetSecondCurveId(), VToolMirrorByLine::setSecondLinePointId(), VToolLine::SetSecondPoint(), DoubleLinePointTool::setSecondPointId(), VToolAlongLine::SetSecondPointId(), VToolLineIntersectAxis::SetSecondPointId(), VToolNormal::SetSecondPointId(), VToolPointOfContact::SetSecondPointId(), VToolTriangle::SetSecondPointId(), VToolCubicBezier::setSpline(), VToolSpline::setSpline(), VToolCubicBezierPath::setSplinePath(), VToolSplinePath::setSplinePath(), VAbstractOperation::setSuffix(), IntersectCircleTangentTool::SetTangentPointId(), VToolPointFromArcAndTangent::SetTangentPointId(), VToolBisector::SetThirdPointId(), and VToolPointOfIntersectionCurves::SetVCrossPoint().

◆ SaveOptions()

◆ setLineType()

◆ setLineWeight()

◆ showContextMenu

virtual void VDrawTool::showContextMenu ( QGraphicsSceneContextMenuEvent *  event,
quint32  id = NULL_ID 
)
protectedpure virtualslot

◆ ShowItem()

template<typename Item >
void VDrawTool::ShowItem ( Item item,
quint32  id,
bool  enable 
)
protected

ShowItem highlight tool.

Parameters
itemtool.
idobject id in container.
enableenable or disable highlight.

Definition at line 332 of file vdrawtool.h.

References SCASSERT, and VAbstractTool::ShowVisualization().

Referenced by VAbstractSpline::ShowTool(), VAbstractPoint::ShowTool(), and VToolLine::ShowTool().

◆ ShowTool

void VDrawTool::ShowTool ( quint32  id,
bool  enable 
)
virtualslot

ShowTool highlight tool.

Parameters
idobject id in container.
enableenable or disable highlight.

Reimplemented in VAbstractSpline.

Definition at line 79 of file vdrawtool.cpp.

Referenced by VDrawTool().

◆ updatePointNameVisibility()

void VDrawTool::updatePointNameVisibility ( quint32  id,
bool  visible 
)
protectedvirtual

Reimplemented in VToolSinglePoint, and VToolDoublePoint.

Definition at line 204 of file vdrawtool.cpp.

Referenced by ContextMenu().

Member Data Documentation

◆ activeBlockName

QString VDrawTool::activeBlockName
protected

◆ m_lineType

QString VDrawTool::m_lineType
protected

activeBlockName name of tool's pattern peace.

Definition at line 103 of file vdrawtool.h.

Referenced by DoubleLinePointTool::DoubleLinePointTool(), getLineType(), DoubleLinePointTool::paint(), VToolLinePoint::paint(), VToolLine::paint(), PointIntersectXYTool::ReadToolAttributes(), VToolAlongLine::ReadToolAttributes(), VToolBisector::ReadToolAttributes(), VToolCurveIntersectAxis::ReadToolAttributes(), VToolEndLine::ReadToolAttributes(), VToolHeight::ReadToolAttributes(), VToolLineIntersectAxis::ReadToolAttributes(), VToolNormal::ReadToolAttributes(), VToolShoulderPoint::ReadToolAttributes(), VToolLine::ReadToolAttributes(), DoubleLinePointTool::SaveOptions(), VToolLinePoint::SaveOptions(), VToolLine::SaveOptions(), PointIntersectXYTool::setDialog(), VToolAlongLine::setDialog(), VToolBisector::setDialog(), VToolCurveIntersectAxis::setDialog(), VToolEndLine::setDialog(), VToolHeight::setDialog(), VToolLineIntersectAxis::setDialog(), VToolNormal::setDialog(), VToolShoulderPoint::setDialog(), VToolLine::setDialog(), setLineType(), VToolLine::setLineType(), PointIntersectXYTool::SetVisualization(), VToolAlongLine::SetVisualization(), VToolBisector::SetVisualization(), VToolCurveIntersectAxis::SetVisualization(), VToolEndLine::SetVisualization(), VToolHeight::SetVisualization(), VToolLineIntersectAxis::SetVisualization(), VToolNormal::SetVisualization(), VToolShoulderPoint::SetVisualization(), VToolLine::SetVisualization(), VToolLine::VToolLine(), and VToolLinePoint::VToolLinePoint().

◆ m_lineWeight

QString VDrawTool::m_lineWeight
protected

typeLine line type.

Definition at line 104 of file vdrawtool.h.

Referenced by DoubleLinePointTool::DoubleLinePointTool(), getLineWeight(), DoubleLinePointTool::hoverEnterEvent(), VToolLinePoint::hoverEnterEvent(), DoubleLinePointTool::hoverLeaveEvent(), VToolLinePoint::hoverLeaveEvent(), DoubleLinePointTool::paint(), VToolLinePoint::paint(), VToolLine::paint(), PointIntersectXYTool::ReadToolAttributes(), VToolAlongLine::ReadToolAttributes(), VToolBisector::ReadToolAttributes(), VToolCurveIntersectAxis::ReadToolAttributes(), VToolEndLine::ReadToolAttributes(), VToolHeight::ReadToolAttributes(), VToolLineIntersectAxis::ReadToolAttributes(), VToolNormal::ReadToolAttributes(), VToolShoulderPoint::ReadToolAttributes(), VToolLine::ReadToolAttributes(), DoubleLinePointTool::RefreshGeometry(), VToolLinePoint::RefreshGeometry(), DoubleLinePointTool::SaveOptions(), VToolLinePoint::SaveOptions(), VToolLine::SaveOptions(), PointIntersectXYTool::setDialog(), VToolAlongLine::setDialog(), VToolBisector::setDialog(), VToolCurveIntersectAxis::setDialog(), VToolEndLine::setDialog(), VToolHeight::setDialog(), VToolLineIntersectAxis::setDialog(), VToolNormal::setDialog(), VToolLine::setDialog(), setLineWeight(), VToolLine::setLineWeight(), PointIntersectXYTool::SetVisualization(), VToolAlongLine::SetVisualization(), VToolBisector::SetVisualization(), VToolCurveIntersectAxis::SetVisualization(), VToolEndLine::SetVisualization(), VToolHeight::SetVisualization(), VToolLineIntersectAxis::SetVisualization(), VToolNormal::SetVisualization(), VToolShoulderPoint::SetVisualization(), VToolLine::SetVisualization(), VToolLine::VToolLine(), and VToolLinePoint::VToolLinePoint().


The documentation for this class was generated from the following files: