branchobj.h
author insilmaril
Wed, 09 Sep 2009 12:57:06 +0000
changeset 793 cac93797c580
parent 792 7d67be709091
child 795 6b0a5f4923d3
permissions -rw-r--r--
more fixes for collision detection
     1 #ifndef BRANCHOBJ_H
     2 #define BRANCHOBJ_H
     3 
     4 #include "floatimageobj.h"
     5 #include "linkablemapobj.h"
     6 #include "ornamentedobj.h"
     7 #include "xlinkobj.h"
     8 
     9 bool isAbove(BranchObj*,BranchObj*);
    10 
    11 /*! \brief A branch visible in the map */
    12 
    13 /////////////////////////////////////////////////////////////////////////////
    14 class BranchObj:public OrnamentedObj {
    15 public:
    16 	/*! New branches will get use same color for heading as parent */
    17 	enum BranchModification {NewBranch, MovedBranch};
    18 
    19     BranchObj (QGraphicsScene*,TreeItem *ti=NULL);
    20     ~BranchObj ();
    21 	bool operator< ( const BranchObj & );
    22 	bool operator== ( const BranchObj & );
    23     virtual void init ();
    24     virtual void copy (BranchObj*);
    25     void clear();
    26 
    27     virtual void setParObjTmp (LinkableMapObj*,QPointF,int);// Only for moving Obj around
    28 	virtual void unsetParObjTmp();			// reuse original ParObj
    29 
    30 	virtual void setVisibility(bool,int);	// set visibility
    31     virtual void setVisibility(bool);	    // set vis. for w
    32 	virtual void setLinkColor();			// set the color of link
    33 
    34 	virtual void updateContentSize();
    35 	virtual void positionContents();
    36     virtual void move (double x,double y);
    37     virtual void move (QPointF);
    38     virtual void moveBy (double x,double y);
    39     virtual void moveBy (QPointF);
    40     virtual void positionBBox();
    41     virtual void calcBBoxSize();
    42 	virtual void setDockPos();
    43     
    44     virtual void updateData();	//! Update represantatio of heading, flags, etc.
    45 
    46 protected:	
    47 	virtual void savePosInAngle();					// write pos in angle for resorting			
    48 public:	
    49 	virtual void setDefAttr (BranchModification);	// set default attributes (font, size, ...)
    50 
    51     virtual void sortChildren();
    52     virtual void alignRelativeTo(const QPointF, bool alignSelf=false );
    53 	virtual void reposition();
    54 	virtual void unsetAllRepositionRequests();
    55 
    56 	virtual QPolygonF shape();				//!< Returns arbitrary bounding polygon
    57 	virtual QRectF getTotalBBox();			// return BBox including children			
    58 	virtual QRectF getBBoxSizeWithChildren();	// return size of BBox including children  
    59 	virtual ConvexPolygon getBoundingPolygon();
    60 	virtual void calcBBoxSizeWithChildren();	// calc size of  BBox including children recursivly
    61 
    62 	virtual QString getSelectString();
    63 	virtual void setAnimation(const AnimPoint &ap);
    64 	virtual bool animate();
    65 
    66 protected:
    67 	QList<XLinkObj*> xlink;			// xlinks to other branches
    68 
    69 	AnimPoint anim;
    70 
    71 public:	
    72 	float angle;					// used in mainbranch to reorder mainbranches
    73 };
    74 
    75 
    76 #endif
    77