CGM Objects Library
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Pages
AppStruct.h
1 // AppStruct.h: interface for the CAppStruct class.
2 //
5 
6 #if !defined(AFX_APSTRUCT_H__8AF11CB5_DF71_4FAB_B7AD_58FBFA0D308F__INCLUDED_)
7 #define AFX_APSTRUCT_H__8AF11CB5_DF71_4FAB_B7AD_58FBFA0D308F__INCLUDED_
8 
9 #pragma once
10 
11 #include "Matrix.h"
12 #include <string>
13 #include "Utility/wstring.h"
14 
15 
16 namespace Larson
17 {
18 
19  class CDrawBase;
20  class CCgmObjects;
21 
23  class CAppStruct : public CElementList
24  {
25 
26  #define APS_OFF 1
27  #define APS_ON 2
28  #define APS_INHERIT 3
29 
30  public:
31  typedef struct
32  {
33  long dataType; // 0= string, 1= integer, 2= real, 3=vdc
34  long nValues;
35  double* pDValues; // list of double values for data types integer, real & vdc
36  wchar_t** pSValues; // list of string values
37  } CGMI_SDR;
38 
40  typedef struct
41  {
42  long type; // 1=rectangle, 2=ellipse, 3=polygon, 4=polybezier
43  long nPoints;
44  DPoint *points;
45  } gRegion;
46 
48  typedef struct
49  {
50  std::wstring destination;
51  std::wstring title;
52  std::wstring behavior;
53  } LinkURI;
54 
56  CAppStruct(std::wstring id, std::wstring type, CCgmObjects* pOwner);
57  virtual ~CAppStruct();
58  void operator=( const CAppStruct& a );
59 
61  DRect GetBounds(bool locus = false) const;
63  DRect GetBoundsList(vector<PicElement> const& elList, bool locus = false) const;
65  void Draw(CDrawBase *pDB, bool showRegions = false, bool exportAps = false);
67  void TransformBy(CMatrix* pXF);
71  bool HitTest(DPoint point, double margin) const;
73  void AddName(std::wstring name);
75  void RemoveRegions();
77  void RemoveRegion(int index);
79  void AddStringAttr(std::wstring type, std::wstring str);
81  void RemoveCustomAttrs();
83  void AddLinkURI(std::wstring dest, std::wstring title, std::wstring behavior);
85  long AddRegion(long type, DPoint *points, long nPoints);
87  void Restore(CAppStruct* pAppStruct);
89  CAppStruct* Clone();
91  void AssignAutoId(int& autoAPSIdNumber);
92 
94  std::wstring m_id;
96  std::wstring m_content;
98  std::wstring m_layerDesc;
100  std::wstring m_layerName;
102  std::vector<LinkURI> m_linkURIs;
104  std::vector<std::wstring> m_names;
110  std::wstring m_screenTip;
112  std::wstring m_type;
113  DPoint m_viewContext[2];
118 
122  typedef struct {
123  std::wstring type; // APS attribute type
124  vector<CGMI_SDR> SDRList;// SDR list
125  } customAttr;
126  vector<customAttr> m_custom;
127 
132 
133  private:
134  void DrawList(vector<PicElement> &elList, CDrawBase *pDB, bool showRegions = false, bool exportAps = false);
135  bool HitTestList(vector<PicElement> const& elList, DPoint point, double margin) const;
136  void TransformByList(vector<PicElement> &elList, CMatrix* pXF);
137  bool RectangleTest(DPoint pts[4]);
138 
139  protected:
140  };
141 };
142 
143 #endif // !defined(AFX_APSTRUCT_H__8AF11CB5_DF71_4FAB_B7AD_58FBFA0D308F__INCLUDED_)
std::wstring m_layerDesc
APS Layer Description Attribute.
Definition: AppStruct.h:98
std::wstring m_id
APS ID.
Definition: AppStruct.h:94
void AddStringAttr(std::wstring type, std::wstring str)
add custom APS string attribute
Definition: AppStruct.cpp:496
long AddRegion(long type, DPoint *points, long nPoints)
add APS Region attribute and return zero-based index the region added
Definition: AppStruct.cpp:52
long m_visibility
APS Visibility Attribute.
Definition: AppStruct.h:117
long m_inheritance
inheritance flag;
Definition: AppStruct.h:120
CElementList * RegionsToObjList() const
Transform APS contents by specfied matrix.
Definition: AppStruct.cpp:516
CAppStruct(std::wstring id, std::wstring type, CCgmObjects *pOwner)
Constructor.
Definition: AppStruct.cpp:28
void AddLinkURI(std::wstring dest, std::wstring title, std::wstring behavior)
add APS linkURI attribute
Definition: AppStruct.cpp:79
DRect GetBounds(bool locus=false) const
Get APS bounds.
Definition: AppStruct.cpp:646
void RemoveCustomAttrs()
remove all custom attributes
Definition: AppStruct.cpp:411
CAppStruct * Clone()
make a copy of this object
Definition: AppStruct.cpp:720
std::wstring m_content
APS Content Attribute.
Definition: AppStruct.h:96
void Restore(CAppStruct *pAppStruct)
restore the contents of this object from a copy
Definition: AppStruct.cpp:484
long m_nRegions
number of Region Attribute(s)
Definition: AppStruct.h:108
std::wstring m_type
APS type; grobject, layer,...
Definition: AppStruct.h:112
Custom APS Attribute (non-standard, not defined by a profile)
Definition: AppStruct.h:122
void RemoveRegion(int index)
Remove APS Region by index.
Definition: AppStruct.cpp:463
std::vector< std::wstring > m_names
APS Name Attribute(s)
Definition: AppStruct.h:104
void AddName(std::wstring name)
add APS Name attribute
Definition: AppStruct.cpp:491
CElementList – Picture elements list.
Definition: ElementList.h:69
DRect GetBoundsList(vector< PicElement > const &elList, bool locus=false) const
Get APS bounds in elList.
Definition: AppStruct.cpp:686
gRegion * m_regions
APS Region Attribute(s)
Definition: AppStruct.h:106
CDrawBase – drawing base class from which all output specific draw classes are derived.
Definition: DrawBase.h:19
APS Region attribute structure.
Definition: AppStruct.h:40
void Draw(CDrawBase *pDB, bool showRegions=false, bool exportAps=false)
Draw APS contents.
Definition: AppStruct.cpp:90
std::vector< LinkURI > m_linkURIs
APS linkURI Attribute(s)
Definition: AppStruct.h:102
void RemoveRegions()
Remove all APS Region attributes.
Definition: AppStruct.cpp:450
CMatrix * m_pXForm
local transform matrix for this APS
Definition: AppStruct.h:131
CAppStruct – Application Structure (APS) container class.
Definition: AppStruct.h:23
long m_interactivity
APS Interactivity Attribute.
Definition: AppStruct.h:115
CMatrix – transform matrix class.
Definition: Matrix.h:16
bool HitTest(DPoint point, double margin) const
true if point touches this a region or element in this APS within margin
Definition: AppStruct.cpp:244
void AssignAutoId(int &autoAPSIdNumber)
generate a sequential id
Definition: AppStruct.cpp:798
std::wstring m_screenTip
APS ScreenTip Attribute(s)
Definition: AppStruct.h:110
std::wstring m_layerName
APS Layer Name Attribute.
Definition: AppStruct.h:100
CCgmObjects * m_pOwner
pointer to owner of this APS
Definition: AppStruct.h:129
CCgmObjects – CGM Picture container.
Definition: CgmObjects.h:472
void TransformBy(CMatrix *pXF)
Transform APS contents by specfied matrix.
Definition: AppStruct.cpp:345