Empty branches are always unscrolled after import, relinking to scrolled branch doesn't open branch, starting DBUS implementation
1 #ifndef LINKABLEMAPOBJ_H
2 #define LINKABLEMAPOBJ_H
6 #include "headingobj.h"
7 #include "flagrowobj.h"
16 /*! \brief This class adds links to MapObj
18 The links are connecting the branches (BranchObj) and images (FloatImageObj) in the map.
21 class LinkableMapObj:public QObject, public MapObj {
22 Q_OBJECT // FIXME-3 really needed here?
24 /*! Orientation of an object depends on the position relative to the parent */
26 UndefinedOrientation, //!< Undefined
27 LeftOfCenter, //!< Object is left of center
28 RightOfCenter //!< Object is right of center
31 /*! Various drawing styles for links */
33 UndefinedStyle, //!< Undefined
34 Line, //!< Straight line
36 PolyLine, //!< Polygon (thick line)
37 PolyParabel //!< Thick parabel
40 /*! Vertical position of link in object */
42 Middle, //!< Link is drawn in the middle of object
43 Bottom //!< Link is drawn at bottom of object
46 /*! Hint if link should use the default link color or the color of heading */
48 DefaultColor, //!< Link uses the default color
49 HeadingColor //!< Link uses the color of heading
53 LinkableMapObj (QGraphicsScene*);
54 LinkableMapObj (LinkableMapObj*);
56 virtual void delLink();
58 virtual void copy (LinkableMapObj*);
60 virtual void setTreeItem(TreeItem *);
61 virtual TreeItem* getTreeItem() const;
63 void setChildObj (LinkableMapObj*);
64 virtual void setParObj (LinkableMapObj*);
65 virtual void setParObjTmp (LinkableMapObj*,QPointF,int); // Only for moving Obj around
66 virtual void unsetParObjTmp(); // reuse original ParObj
67 virtual bool hasParObjTmp();
69 virtual void setUseRelPos (const bool&);
70 virtual void setRelPos(); // set relPos to current parentPos
71 virtual void setRelPos(const QPointF&);
72 virtual QPointF getRelPos();
74 virtual qreal getTopPad();
75 virtual qreal getLeftPad();
76 virtual qreal getRightPad();
77 Style getDefLinkStyle();
78 void setLinkStyle(Style);
81 void setHideLinkUnselected();
82 void setLinkPos (Position);
83 Position getLinkPos ();
85 virtual void setLinkColor(); // sets color according to colorhint, overloaded
86 virtual void setLinkColor(QColor);
87 QColor getLinkColor();
88 virtual void setVisibility (bool);
89 virtual void setOrientation();
90 virtual void updateVisibility(); //! hides/unhides link depending on selection
92 /*! update parPos, childPos
94 redraw link with given style */
95 virtual void updateLinkGeometry();
97 LinkableMapObj* getChildObj(); // returns pointer to fromObj
98 LinkableMapObj* getParObj(); // returns pointer to toObj
99 virtual void setDockPos()=0; // sets childPos and parPos
100 QPointF getChildPos(); // returns pos where children dock
101 QPointF getParPos(); // returns pos where parents dock
102 Orientation getOrientation(); // get orientation
103 virtual QPointF getRandPos(); // make randomised position
105 virtual void reposition();
106 virtual void requestReposition(); // do reposition after next user event
107 virtual void forceReposition(); // to force a reposition now (outside
108 // of mapeditor e.g. in noteeditor
109 virtual bool repositionRequested();
111 virtual void calcBBoxSizeWithChildren()=0;// calc size of BBox including children recursivly
114 void parabel(QPolygonF &,double,double,double,double); // Create Parabel connecting two points
118 bool link2ParPos; // While moving around, sometimes link to parent
120 Orientation orientation;
121 qreal linkwidth; // width of a link
122 QRectF bboxTotal; // bounding box including children
124 LinkableMapObj* parObj;
125 LinkableMapObj* parObjTmpBuf; // temporary buffer the original parent
126 qreal bottomlineY; // vertical offset of dockpos to pos
128 int thickness_start; // for StylePoly*
129 Style style; // Current style
130 Position linkpos; // Link at bottom of object or middle of height
131 QColor linkcolor; // Link color
133 QGraphicsLineItem* l; // line style
134 QGraphicsPolygonItem* p; // poly styles
135 int arcsegs; // arc: number of segments
136 QList <QGraphicsLineItem*> segment; // a part of e.g. the parabel
137 QPolygonF pa0; // For drawing of PolyParabel and PolyLine
138 QPolygonF pa1; // For drawing of PolyParabel
139 QPolygonF pa2; // For drawing of PolyParabel
140 QGraphicsLineItem* bottomline; // on bottom of BBox
141 bool repositionRequest; //
143 qreal topPad, botPad,
144 leftPad, rightPad; // padding within bbox
146 QPointF relPos; // position relative to childPos of parent
149 TreeItem *treeItem; // Crossrefence to treemodel