C++ main module for gpm Package  1.0
GPMG_ShowGraphDrawPanel.h
Go to the documentation of this file.
1 #ifndef GPMG_ShowGraphDrawPanel_H
2 #define GPMG_ShowGraphDrawPanel_H
3 
4 #include "GPMG_DrawPanel.h"
5 
6 #include "GPM_ModelGraph.h"
7 #include "GPMG_Project.h"
8 
9 
17  SP_OBJECT(GPMG_ShowGraphDrawPanel);
18 
19  // ATTRIBUTES
20 public:
21 
22 private:
23 
24 
25 
26 
27  // ASSOCIATIONS
28 
29  SP::GPM_ModelGraph mGraph;
30 
31 
32 
33  // METHODS
34 protected:
35  // CONSTRUCTORS
39 
40 
41  // DESTRUCTORS
45  virtual ~GPMG_ShowGraphDrawPanel(void);
46 
47 
48 
49 
50 public:
51  // NEW
54  static inline SP::GPMG_ShowGraphDrawPanel New() {
55  SP::GPMG_ShowGraphDrawPanel p(new GPMG_ShowGraphDrawPanel(),
56  GPMG_ShowGraphDrawPanel::Delete());
57  p->setThis(p);
58  return p;
59  };
60 
61  virtual void toDoAfterThisSetting() {
63  }
64 
65  // SET
66 protected:
67  void initAttributes();
68 
69 public:
72  void showGraph(GPM_ModelGraph& graph,const tBoolean& isForce);
73 
74  // SPECIALIZED Popup Menu Methods
75 
78  virtual void createPopupMenus();
79 
82  virtual void popupMenuClicked(const tString& name,
83  const int& x,const int& y);
84 
87  virtual GUI_AlonePopupMenu* getPopupMenu(const int& x,const int& y,GUI2D_Item* item);
88 
89 
90 
93  virtual tFlag getGraphType(const GPM_Graph* graph) const {
95  }
96 
97  // GET
98 
99 
100  // OTHERS
101 public:
102 
103  // SAVER & LOADER methods
104 
107  virtual void loadFromUIClass(const UI_Class& mclass);
110  virtual void saveToUIClass(UI_Class& mclass) const;
111 
112 
113 protected:
114 
115  // DRAW methods
116 
119  virtual tBoolean paintElements();
120 
123  virtual void computeVertexBounds(double& xMin,double& yMin,double& xMax,double& yMax) const;
126  virtual void computeNodesScale() {
127  double minValue=REAL_INFINITY;
128  double maxValue=-REAL_INFINITY;
129  if (mGraph.get()!=null)
130  GPMG_DrawPanel::computeNodesScale(*mGraph.get(),minValue,maxValue);
131  }
134  virtual void computePortsScale() {
135  double minValue=REAL_INFINITY;
136  double maxValue=-REAL_INFINITY;
137  if (mGraph.get()!=null)
138  GPMG_DrawPanel::computePortsScale(*mGraph.get(),minValue,maxValue);
139  }
142  virtual void computeEdgesScale() {
143  double minValue=REAL_INFINITY;
144  double maxValue=-REAL_INFINITY;
145  if (mGraph.get()!=null)
146  GPMG_DrawPanel::computeEdgesScale(*mGraph.get(),minValue,maxValue);
147  }
148 
149 
150 
151 
152 
153 private:
154 
155 
158  void drawGraph();
159 
160 
161 
164  void drawVertices(const tReal& xmin,
165  const tReal& xmax,
166  const tReal& ymin,
167  const tReal& ymax);
168 
171  void drawEdges(const tReal& xmin,
172  const tReal& xmax,
173  const tReal& ymin,
174  const tReal& ymax,
175  const tReal& width);
176 
177 
178 };
179 #endif
void showGraph(GPM_ModelGraph &graph, const tBoolean &isForce)
show the graph
Definition: GPMG_ShowGraphDrawPanel.cpp:84
virtual ~GPMG_ShowGraphDrawPanel(void)
destroy a GPMG_ShowGraphDrawPanel
Definition: GPMG_ShowGraphDrawPanel.cpp:24
static const tFlag INIT_GRAPH
Definition: GPMG_Project.h:36
virtual GUI_AlonePopupMenu * getPopupMenu(const int &x, const int &y, GUI2D_Item *item)
get the popup menu
Definition: GPMG_ShowGraphDrawPanel.cpp:424
virtual void loadFromUIClass(const UI_Class &mclass)
how to load the object from a Meta Model class
Definition: GPMG_ShowGraphDrawPanel.cpp:495
this class describes a Graph Draw Panel.
Definition: GPMG_DrawPanel.h:15
This class describes a model graph.
Definition: GPM_ModelGraph.h:21
#define tBoolean
Definition: types.h:35
virtual void computePortsScale()=0
compute the port scale
GPMG_ShowGraphDrawPanel()
build a GPMG_ShowGraphDrawPanel
Definition: GPMG_ShowGraphDrawPanel.cpp:18
#define null
Definition: types.h:13
virtual void toDoAfterThisSetting()
method called after thi ssetting
Definition: GPMG_ShowGraphDrawPanel.h:61
virtual void computeEdgesScale()
compute the edge scale
Definition: GPMG_ShowGraphDrawPanel.h:142
virtual tFlag getGraphType(const GPM_Graph *graph) const
return the graph type of the graph
Definition: GPMG_ShowGraphDrawPanel.h:93
virtual void computePortsScale()
compute the port scale
Definition: GPMG_ShowGraphDrawPanel.h:134
virtual void computeVertexBounds(double &xMin, double &yMin, double &xMax, double &yMax) const
recompute the vertex bounds
Definition: GPMG_ShowGraphDrawPanel.cpp:34
virtual void toDoAfterThisSetting()
method called after thi ssetting
Definition: GPMG_DrawPanel.h:117
virtual void computeNodesScale()
compute the node scale
Definition: GPMG_ShowGraphDrawPanel.h:126
#define REAL_INFINITY
Definition: types.h:57
void initAttributes()
init attributes of the draw panel
Definition: GPMG_ShowGraphDrawPanel.cpp:29
this class describes a Graph Draw Panel.
Definition: GPMG_ShowGraphDrawPanel.h:16
virtual void createPopupMenus()
create popup menus
Definition: GPMG_ShowGraphDrawPanel.cpp:402
virtual tBoolean paintElements()
paint the element in the drawing area
Definition: GPMG_ShowGraphDrawPanel.cpp:144
#define tString
Definition: types.h:36
virtual void computeNodesScale()=0
compute the node scale
virtual void computeEdgesScale()=0
compute the edges scale
virtual void popupMenuClicked(const tString &name, const int &x, const int &y)
method called when ab item of a popup menu is clicked on component
Definition: GPMG_ShowGraphDrawPanel.cpp:475
This class describes a graph which is a list of nodes & ports.
Definition: GPM_Graph.h:19
#define tReal
Definition: types.h:18
DEFINE_SPTR(GPMG_ShowGraphDrawPanel)
virtual void saveToUIClass(UI_Class &mclass) const
how to save the object from a mate model class
Definition: GPMG_ShowGraphDrawPanel.cpp:500
static SP::GPMG_ShowGraphDrawPanel New()
create a 2D plotter panel
Definition: GPMG_ShowGraphDrawPanel.h:54
#define tFlag
Definition: types.h:14