CGM Objects Library
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Pages
ElementList.h
1 // ElementList.h: interface for the CElementList class.
2 //
5 
6 #if !defined(LST_ELEMENTLIST_H__INCLUDED)
7 #define LST_ELEMENTLIST_H__INCLUDED
8 
9 #pragma once
10 
11 #include <vector>
12 #include "Utility/DPoint.h"
13 
14 
15 namespace Larson
16 {
17  class CCgmBaseObj;
18  class CAppStruct;
19  class CDrawBase;
20  class CMatrix;
21  class CSegment;
22 
24 
25  class PicElement
26  {
27  public:
28  enum PicElementType {
29  Null = 0,
30  Graphical = 1,
31  AppStruct = 2,
32  Segment = 3
33  };
36  { type = Graphical; data.pObj = NULL; flags = 0; };
39  { type = Graphical, data.pObj = pObj; flags = 0; };
41  { type = AppStruct, data.pAppStruct = pAppStruct; flags = 0; };
42  PicElement(CSegment* pSegment)
43  { type = Segment, data.pSegment = pSegment; flags = 0; };
45  virtual ~PicElement();
46 
47  void operator=( const PicElement& a );
48  bool operator==( const PicElement& a ) const;
49  PicElement Clone();
50  void Draw(CDrawBase* pDB);
51  DRect GetBounds(bool locus = false) const;
52  bool HitTest(DPoint point, double margin) const;
53  void TransformBy(CMatrix* pXF);
54 
55  enum PicElementType type;
56  union {
63  } data;
64  // application defined flags, e.g. Locked, Selected...
65  unsigned char flags;
66  };
67 
70  {
71  public:
73  CElementList();
74  virtual ~CElementList();
75 
77  void add(CCgmBaseObj* pObj);
79  void add(CAppStruct* pAppStruct);
81  void add(CSegment* pSegment);
83  void add(PicElement& elem);
85  int find(PicElement& elem);
87  bool erase(int index);
89  bool insert(int index, PicElement& elem);
90 
92  std::vector<PicElement> m_elements;
95 
96  int m_growSize;
97  };
98 }
99 
100 #endif // LST_ELEMENTLIST_H__INCLUDED
101 
virtual ~PicElement()
Deconstructor.
Definition: ElementList.cpp:106
PicElement – Picture element list container, each list element will be pointer to a Graphical Element...
Definition: ElementList.h:25
CSegment – Segment class- a segment is a list of picture elements.
Definition: Segment.h:7
PicElement()
Constructor for empty element.
Definition: ElementList.h:35
void add(CCgmBaseObj *pObj)
add graphical element
Definition: ElementList.cpp:45
CElementList * m_pParent
pointer to owner of this element list
Definition: ElementList.h:94
PicElement(CCgmBaseObj *pObj)
Constructor.
Definition: ElementList.h:38
CSegment * pSegment
pointer to local segment
Definition: ElementList.h:62
CCgmBaseObj * pObj
pointer to graphical element
Definition: ElementList.h:58
CElementList – Picture elements list.
Definition: ElementList.h:69
CAppStruct * pAppStruct
pointer to APS
Definition: ElementList.h:60
CCgmBaseObj – graphical element container base class.
Definition: CgmObj.h:121
CAppStruct – Application Structure (APS) container class.
Definition: AppStruct.h:23
bool erase(int index)
erase element at specified index in elements list
Definition: ElementList.cpp:82
int find(PicElement &elem)
find element in list
Definition: ElementList.cpp:70
CElementList()
Constructor.
Definition: ElementList.cpp:15
std::vector< PicElement > m_elements
elements list
Definition: ElementList.h:92
bool insert(int index, PicElement &elem)
insert element in elements list
Definition: ElementList.cpp:93