OpenTwin 0.1
OpenTwin
 
Loading...
Searching...
No Matches
ot::GraphicsShapeItemCfg Class Reference

#include "GraphicsShapeItemCfg.h"

Inheritance diagram for ot::GraphicsShapeItemCfg:
ot::GraphicsItemCfg ot::Serializable

Public Member Functions

 GraphicsShapeItemCfg ()
 
virtual ~GraphicsShapeItemCfg ()
 
virtual GraphicsItemCfgcreateCopy (void) const override
 Creates a copy of this item.
 
virtual void addToJsonObject (JsonValue &_object, JsonAllocator &_allocator) const override
 Add the object contents to the provided JSON object.
 
virtual void setFromJsonObject (const ConstJsonObject &_object) override
 Will set the object contents from the provided JSON object.
 
virtual std::string getFactoryKey (void) const override
 Returns the key that is used to create an instance of this class in the simple factory.
 
void setOutlinePath (const Path2DF &_path)
 Set the outline path.
 
Path2DFgetOutlinePath (void)
 Outline path reference.
 
const Path2DFgetOutlinePath (void) const
 Outline path const reference.
 
void setBackgroundPainter (Painter2D *_painter)
 Set the background painter. The item takes ownership of the painter.
 
const Painter2DgetBackgroundPainter (void) const
 Background painter.
 
Painter2DtakeBackgroundPainter (void)
 Returns the current background painter and replaces it with the default background painter. The caller takes ownership of the returned painter.
 
void setOutline (const OutlineF &_outline)
 Set the outline.
 
const OutlineFgetOutline (void) const
 Outlin.
 
void setOutlinePainter (Painter2D *_painter)
 Set the outline painter. The item takes ownership of the painter.
 
const Painter2DgetOutlinePainter (void) const
 Outline painter.
 
void setOutlineWidth (double _w)
 Set the outline width.
 
double getOutlineWidth (void) const
 Outline width.
 
void setFillShape (bool _fill)
 Sets the fill shape.
 
bool getFillShape (void) const
 If fill shape is enabled the shape will be filled, otherwise only the outline will be drawn.
 
- Public Member Functions inherited from ot::GraphicsItemCfg
 GraphicsItemCfg ()
 GraphicsItemFlags.
 
virtual ~GraphicsItemCfg ()
 
void setName (const std::string &_name)
 Set item name.
 
const std::string & getName (void) const
 Item name.
 
void setTitle (const std::string &_title)
 Set item title The item title will be displayed to the user when needed.
 
const std::string & getTitle (void) const
 Item title The item title will be displayed to the user when needed.
 
void setToolTip (const std::string &_toolTip)
 Set ToolTip.
 
const std::string & getToolTip (void) const
 ToolTip that will be displayed to the user when he hovers over the item. If the root item in a graphics item hierarchy has a tool tip set, child items may be enabled to forward the tooltip request (see GraphicsItemFlags)
 
void setPosition (double _x, double _y)
 Set item position If the item is the root item, the position is the scene position. If the item is a child item, the position is the local position (default: 0.0; 0.0).
 
void setPosition (const Point2DD &_pos)
 Set item position If the item is the root item, the position is the scene position. If the item is a child item, the position is the local position (default: 0.0; 0.0).
 
const Point2DDgetPosition (void) const
 Item position If the item is the root item, the position is the scene position. If the item is a child item, the position is the local position (default: 0.0; 0.0).
 
void setAdditionalTriggerDistance (double _d)
 
void setAdditionalTriggerDistance (double _left, double _top, double _right, double _bottom)
 
void setAdditionalTriggerDistance (const MarginsD &_d)
 Sets the additional trigger distance. The additional trigger distance will expand/shrink the imaginary bounding rect of the item when checking for mouse press, mouse hover, and other events.
 
const MarginsDgetAdditionalTriggerDistance (void) const
 
void setMinimumSize (double _width, double _height)
 Sets the item minimum size.
 
void setMinimumSize (const Size2DD &_size)
 Sets the item minimum size.
 
const Size2DDgetMinimumSize (void) const
 Item minimum size. If the graphics item is resized (e.g. via layout) then it may not shrink below the minimum size.
 
void setMaximumSize (double _width, double _height)
 Sets the item maximum size.
 
void setMaximumSize (const Size2DD &_size)
 Sets the item maximum size.
 
const Size2DDgetMaximumSize (void) const
 Item maximum size. If the graphics item is resized (e.g. via layout) then it may not brow above the maximum size.
 
void setFixedSize (double _width, double _height)
 Sets the items minimum and maximum size.
 
void setFixedSize (const Size2DD &_size)
 Sets the items minimum and maximum size.
 
void setMargins (double _left, double _top, double _right, double _bottom)
 Set item margins.
 
void setMargins (const MarginsD &_margins)
 Set item margins.
 
const MarginsDgetMargins (void) const
 Item margins.
 
void setGraphicsItemFlag (GraphicsItemFlag _flag, bool _active=true)
 
void setGraphicsItemFlags (const GraphicsItemFlags &_flags)
 
const GraphicsItemFlagsgetGraphicsItemFlags (void) const
 
void setAlignment (Alignment _align)
 Set the item alignment.
 
Alignment getAlignment (void) const
 Current item alignment. The alignment only has an effect if the item is nested.
 
void setUid (const UID &_uid)
 Set item UID.
 
const ot::UIDgetUid (void) const
 Item UID. The item UID is used to uniquely identify an item in a GraphicsScene. The must never exist two items with the same UID.
 
void setSizePolicy (SizePolicy _policy)
 Set item size policy.
 
SizePolicy getSizePolicy (void) const
 Current item size policy. The item size policy is used for nested items.
 
void setConnectionDirection (ConnectionDirection _direction)
 Set the item connection direction.
 
ConnectionDirection getConnectionDirection (void) const
 Current item connection direction. This has only an effect if GraphicsItemFlag::ItemIsConnectable is set.
 
void addStringMapEntry (const std::string &_key, const std::string &_value)
 Adds the provided entry to the string map. If an entry for the same key already exists it will be replaced.
 
void setStringMap (const std::map< std::string, std::string > &_map)
 Sets the string map.
 
const std::map< std::string, std::string > & getStringMap (void) const
 The string map may be used to reference a value via a key in a complex graphics item. For example a text item with enabled reference mode will use the string map to set its text when created in the frontend.
 
std::string getStringForKey (const std::string &_key) const
 Returns the string set for the given key in the string map. Returns the string "#<_key>" if the value was not found.
 
void setTransform (const Transform &_transform)
 Set the item transform.
 
const TransformgetTransform (void) const
 Get the item transform.
 
virtual void copyConfigDataToItem (GraphicsItemCfg *_target) const
 Will copy the current config to the provided item configuration. This method may be called when creating a graphics item copy.
 
- Public Member Functions inherited from ot::Serializable
 Serializable ()
 
virtual ~Serializable ()
 
virtual void addToJsonObject (ot::JsonValue &_object, ot::JsonAllocator &_allocator) const =0
 Add the object contents to the provided JSON object.
 

Additional Inherited Members

- Public Types inherited from ot::GraphicsItemCfg
enum  GraphicsItemFlag {
  NoFlags = 0x0000 , ItemIsMoveable = 0x0001 , ItemIsSelectable = 0x0002 , ItemIsConnectable = 0x0004 ,
  ItemSnapsToGridTopLeft = 0x0010 , ItemSnapsToGridCenter = 0x0020 , ItemForwardsTooltip = 0x0100 , ItemUserTransformEnabled = 0x0200 ,
  ItemIgnoresParentTransform = 0x0400 , ItemHandlesState = 0x1000 , ItemForwardsState = 0x2000
}
 GraphicsItemFlag. More...
 
typedef Flags< GraphicsItemFlagGraphicsItemFlags
 

Constructor & Destructor Documentation

◆ GraphicsShapeItemCfg()

ot::GraphicsShapeItemCfg::GraphicsShapeItemCfg ( )

◆ ~GraphicsShapeItemCfg()

ot::GraphicsShapeItemCfg::~GraphicsShapeItemCfg ( )
virtual

Member Function Documentation

◆ addToJsonObject()

void ot::GraphicsShapeItemCfg::addToJsonObject ( JsonValue & _object,
JsonAllocator & _allocator ) const
overridevirtual

Add the object contents to the provided JSON object.

Parameters
_documentThe JSON document (used to get the allocator)
_objectThe JSON object to add the contents to

Reimplemented from ot::GraphicsItemCfg.

◆ createCopy()

ot::GraphicsItemCfg * ot::GraphicsShapeItemCfg::createCopy ( void ) const
overridevirtual

Creates a copy of this item.

Implements ot::GraphicsItemCfg.

◆ getBackgroundPainter()

const Painter2D * ot::GraphicsShapeItemCfg::getBackgroundPainter ( void ) const
inline

Background painter.

◆ getFactoryKey()

virtual std::string ot::GraphicsShapeItemCfg::getFactoryKey ( void ) const
inlineoverridevirtual

Returns the key that is used to create an instance of this class in the simple factory.

Implements ot::GraphicsItemCfg.

◆ getFillShape()

bool ot::GraphicsShapeItemCfg::getFillShape ( void ) const
inline

If fill shape is enabled the shape will be filled, otherwise only the outline will be drawn.

◆ getOutline()

const OutlineF & ot::GraphicsShapeItemCfg::getOutline ( void ) const
inline

Outlin.

◆ getOutlinePainter()

const Painter2D * ot::GraphicsShapeItemCfg::getOutlinePainter ( void ) const
inline

Outline painter.

◆ getOutlinePath() [1/2]

Path2DF & ot::GraphicsShapeItemCfg::getOutlinePath ( void )
inline

Outline path reference.

◆ getOutlinePath() [2/2]

const Path2DF & ot::GraphicsShapeItemCfg::getOutlinePath ( void ) const
inline

Outline path const reference.

◆ getOutlineWidth()

double ot::GraphicsShapeItemCfg::getOutlineWidth ( void ) const
inline

Outline width.

◆ setBackgroundPainter()

void ot::GraphicsShapeItemCfg::setBackgroundPainter ( Painter2D * _painter)

Set the background painter. The item takes ownership of the painter.

Parameters
_painterPainter to set.

◆ setFillShape()

void ot::GraphicsShapeItemCfg::setFillShape ( bool _fill)
inline

Sets the fill shape.

See also
getFillShape

◆ setFromJsonObject()

void ot::GraphicsShapeItemCfg::setFromJsonObject ( const ConstJsonObject & _object)
overridevirtual

Will set the object contents from the provided JSON object.

Parameters
_objectThe JSON object containing the information
Exceptions
Willthrow an exception if the provided object is not valid (members missing or invalid types)

Reimplemented from ot::GraphicsItemCfg.

◆ setOutline()

void ot::GraphicsShapeItemCfg::setOutline ( const OutlineF & _outline)
inline

Set the outline.

Parameters
_outlineOutline to set.

◆ setOutlinePainter()

void ot::GraphicsShapeItemCfg::setOutlinePainter ( Painter2D * _painter)
inline

Set the outline painter. The item takes ownership of the painter.

◆ setOutlinePath()

void ot::GraphicsShapeItemCfg::setOutlinePath ( const Path2DF & _path)
inline

Set the outline path.

Parameters
_pathOutline path to set.

◆ setOutlineWidth()

void ot::GraphicsShapeItemCfg::setOutlineWidth ( double _w)
inline

Set the outline width.

Parameters
_wWidth to set.

◆ takeBackgroundPainter()

ot::Painter2D * ot::GraphicsShapeItemCfg::takeBackgroundPainter ( void )

Returns the current background painter and replaces it with the default background painter. The caller takes ownership of the returned painter.


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