ddt 1.2.1
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | Protected Attributes | List of all members
DdtGraphicalElement Class Referenceabstract

#include <ddtGraphicalElement.hpp>

Inheritance diagram for DdtGraphicalElement:
DdtGraphicalElementCompass DdtGraphicalElementCross DdtGraphicalElementEllipse DdtGraphicalElementImage DdtGraphicalElementLine DdtGraphicalElementPickMarker DdtGraphicalElementRectangle DdtGraphicalElementRefLine DdtGraphicalElementSlit DdtGraphicalElementStatRectangle DdtGraphicalElementText

Public Member Functions

virtual void DrawElement (QPainter *painter)=0
 

Public Attributes

const int LIGHTER_FACTOR = 200
 
const int SCALE_DIFFERENCE_FACTOR = 20
 

Protected Attributes

DdtGraphicalElementProperties element_properties
 
DdtOverlayType element_type
 
QPointF location
 
QPointF drag_start
 
qreal corner_size
 
bool is_hovering
 
QString object_name
 
QString element_name
 
 DdtGraphicalElement (DdtGraphicalElementProperties const &element_properties, const QString obj_name="", const QString elem_name="")
 
virtual ~DdtGraphicalElement ()
 
virtual QRectF boundingRect () const override
 
virtual QRectF RotateBoundingBox (QRectF const &original_bounding_box) const
 
void paint (QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override
 
void DrawBoundingBox (QPainter *painter) const
 
void EditElementProperties (const DdtGraphicalElementProperties &properties)
 
virtual void HighlightSelectedElement (QPainter *painter) const
 
virtual bool IsHidden ()
 
virtual float ScaleThreshold ()
 
virtual void SetShowFlag (bool show)
 
virtual DdtOverlayType GetType ()
 
virtual QString GetTypeString ()
 
virtual QString GetTag ()
 
virtual void SetTransform (QTransform const &transform)
 
void SetIsEditable (const bool editable)
 
void SetItemIsSelected (const bool is_selected)
 
void SetIsHovering (const bool item_is_hovering)
 
bool GetIsEditable () const
 
bool GetItemIsSelected () const
 
QString GetObjectName () const
 
QString GetElementName () const
 
bool GetIsHovering () const
 
const DdtGraphicalElementPropertiesGetElementProperties ()
 
void mouseMoveEvent (QGraphicsSceneMouseEvent *const event) override
 
void mousePressEvent (QGraphicsSceneMouseEvent *const event) override
 
bool HandleEvent (PointGrabber *const corner, QEvent *const event) const
 

Detailed Description

Base class for the graphical elements

Constructor & Destructor Documentation

◆ DdtGraphicalElement()

DdtGraphicalElement::DdtGraphicalElement ( DdtGraphicalElementProperties const & element_properties,
const QString obj_name = "",
const QString elem_name = "" )
explicit

Constructor

Parameters
element_propertiesDDT graphical element properties object.
obj_nameThe name of the overlay object this element belongs to (used for file-based overlay)
elem_nameThe name of this element (used for file-based overlay)

◆ ~DdtGraphicalElement()

DdtGraphicalElement::~DdtGraphicalElement ( )
virtualdefault

Destructor

Member Function Documentation

◆ boundingRect()

QRectF DdtGraphicalElement::boundingRect ( ) const
overridevirtual

◆ DrawBoundingBox()

void DdtGraphicalElement::DrawBoundingBox ( QPainter * painter) const

Method to draw the surounding bounding box

◆ DrawElement()

virtual void DdtGraphicalElement::DrawElement ( QPainter * painter)
pure virtual

◆ EditElementProperties()

void DdtGraphicalElement::EditElementProperties ( const DdtGraphicalElementProperties & properties)

Change selected graphical elememt properties

◆ GetElementName()

QString DdtGraphicalElement::GetElementName ( ) const

Returns the name of this overlay element

Returns
Name of this overlay element

◆ GetElementProperties()

const DdtGraphicalElementProperties & DdtGraphicalElement::GetElementProperties ( )

Returns the Element Properties of respective graphical element

Returns
properties Properties of the overlay element

◆ GetIsEditable()

bool DdtGraphicalElement::GetIsEditable ( ) const

Returns if this element is editable

Returns
is_editable

◆ GetIsHovering()

bool DdtGraphicalElement::GetIsHovering ( ) const

Return if this element is hovering

Returns
is_hovering flag

◆ GetItemIsSelected()

bool DdtGraphicalElement::GetItemIsSelected ( ) const

Returns if this element is selected

Returns
item_is_selected

◆ GetObjectName()

QString DdtGraphicalElement::GetObjectName ( ) const

Returns the name of the overlay object this element belongs to

Returns
Name of the overlay object

◆ GetTag()

QString DdtGraphicalElement::GetTag ( )
virtual

Getter for tags

◆ GetType()

DdtOverlayType DdtGraphicalElement::GetType ( )
virtual

Getter of element type

◆ GetTypeString()

QString DdtGraphicalElement::GetTypeString ( )
virtual

Getter of element type string representation

◆ HandleEvent()

bool DdtGraphicalElement::HandleEvent ( PointGrabber *const corner,
QEvent *const event ) const
protected

◆ HighlightSelectedElement()

void DdtGraphicalElement::HighlightSelectedElement ( QPainter * painter) const
virtual

Highlights a selected element

◆ IsHidden()

bool DdtGraphicalElement::IsHidden ( )
virtual

Checks if the graphical element shall be hidden

◆ mouseMoveEvent()

void DdtGraphicalElement::mouseMoveEvent ( QGraphicsSceneMouseEvent *const event)
overrideprotected

◆ mousePressEvent()

void DdtGraphicalElement::mousePressEvent ( QGraphicsSceneMouseEvent *const event)
overrideprotected

◆ paint()

void DdtGraphicalElement::paint ( QPainter * painter,
const QStyleOptionGraphicsItem * option,
QWidget * widget )
override

Method used to paint the graphics item

Parameters
painterPointer to the painter painting the graphics item
optionPointer to the style options
widgetPointer to the parent widget

◆ RotateBoundingBox()

QRectF DdtGraphicalElement::RotateBoundingBox ( QRectF const & original_bounding_box) const
virtual

Rotate the bounding box for rotated elements

Parameters
original_bounding_boxThe un-rotated bounding box
Returns
The rotated bounding box

◆ ScaleThreshold()

float DdtGraphicalElement::ScaleThreshold ( )
virtual

Check the threshold scale value for this graphical element

◆ SetIsEditable()

void DdtGraphicalElement::SetIsEditable ( const bool editable)

Setter for is_editable

◆ SetIsHovering()

void DdtGraphicalElement::SetIsHovering ( const bool item_is_hovering)

Setter for item is_hovering

◆ SetItemIsSelected()

void DdtGraphicalElement::SetItemIsSelected ( const bool is_selected)

Setter for item_is_selected

◆ SetShowFlag()

void DdtGraphicalElement::SetShowFlag ( bool show)
virtual

Set show flag

◆ SetTransform()

void DdtGraphicalElement::SetTransform ( QTransform const & transform)
virtual

This method is foreseen to get reimplemented by text items only. Text items need to consider the views shearing and scaling factors for their selection rectangle.

Parameters
transformThe views transformation

Member Data Documentation

◆ corner_size

qreal DdtGraphicalElement::corner_size
protected

Size of the corners.

◆ drag_start

QPointF DdtGraphicalElement::drag_start
protected

Start point when dragging the mouse.

◆ element_name

QString DdtGraphicalElement::element_name
protected

Name of this element.

◆ element_properties

DdtGraphicalElementProperties DdtGraphicalElement::element_properties
protected

Element properties

◆ element_type

DdtOverlayType DdtGraphicalElement::element_type
protected

Type of overlay element

◆ is_hovering

bool DdtGraphicalElement::is_hovering
protected

Flag showing if the mouse is hovering over this element

◆ LIGHTER_FACTOR

const int DdtGraphicalElement::LIGHTER_FACTOR = 200

Factor for making the pen colour lighter.

◆ location

QPointF DdtGraphicalElement::location
protected

Location of a moved graphical element.

◆ object_name

QString DdtGraphicalElement::object_name
protected

◆ SCALE_DIFFERENCE_FACTOR

const int DdtGraphicalElement::SCALE_DIFFERENCE_FACTOR = 20

Factor for calculating the scale difference between current scale and object line width. Should be the max scale defined.


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