]> Shamusworld >> Repos - architektonas/blob - src/base/rs_leader.h
Initial import
[architektonas] / src / base / rs_leader.h
1 /****************************************************************************
2 ** $Id: rs_leader.h 2367 2005-04-04 16:57:36Z andrew $
3 **
4 ** Copyright (C) 2001-2003 RibbonSoft. All rights reserved.
5 **
6 ** This file is part of the qcadlib Library project.
7 **
8 ** This file may be distributed and/or modified under the terms of the
9 ** GNU General Public License version 2 as published by the Free Software
10 ** Foundation and appearing in the file LICENSE.GPL included in the
11 ** packaging of this file.
12 **
13 ** Licensees holding valid qcadlib Professional Edition licenses may use
14 ** this file in accordance with the qcadlib Commercial License
15 ** Agreement provided with the Software.
16 **
17 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
18 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
19 **
20 ** See http://www.ribbonsoft.com for further details.
21 **
22 ** Contact info@ribbonsoft.com if any conditions of this licensing are
23 ** not clear to you.
24 **
25 **********************************************************************/
26
27 #ifndef RS_LEADER_H
28 #define RS_LEADER_H
29
30 #include "rs_entity.h"
31 #include "rs_entitycontainer.h"
32
33 /**
34  * Holds the data that defines a leader.
35  */
36 class RS_LeaderData
37 {
38         public:
39                 RS_LeaderData() {}
40                 RS_LeaderData(bool arrowHeadFlag)
41                 {
42                         arrowHead = arrowHeadFlag;
43                 }
44
45                 friend std::ostream & operator<<(std::ostream & os, const RS_LeaderData & /*ld*/)
46                 {
47                         os << "(Leader)";
48                         return os;
49                 }
50
51                 /** true: leader has an arrow head. false: no arrow. */
52                 bool arrowHead;
53 };
54
55 /**
56  * Class for a leader entity (kind of a polyline arrow).
57  *
58  * @author Andrew Mustun
59  */
60 class RS_Leader: public RS_EntityContainer
61 {
62         public:
63                 RS_Leader(RS_EntityContainer * parent = NULL);
64                 RS_Leader(RS_EntityContainer * parent, const RS_LeaderData & d);
65                 virtual ~RS_Leader();
66
67                 virtual RS_Entity * clone();
68                 virtual RS2::EntityType rtti() const;
69                 virtual void update();
70                 RS_LeaderData getData() const;
71                 bool hasArrowHead();
72                 virtual RS_Entity * addVertex(const Vector & v);
73                 virtual void addEntity(RS_Entity * entity);
74                 virtual double getLength();
75                 virtual void move(Vector offset);
76                 virtual void rotate(Vector center, double angle);
77                 virtual void scale(Vector center, Vector factor);
78                 virtual void mirror(Vector axisPoint1, Vector axisPoint2);
79                 virtual void stretch(Vector firstCorner, Vector secondCorner, Vector offset);
80
81                 friend std::ostream & operator<<(std::ostream & os, const RS_Leader & l);
82
83         protected:
84                 RS_LeaderData data;
85                 bool empty;
86 };
87
88 #endif