1 #ifndef GPMG_DrawPanel_H
2 #define GPMG_DrawPanel_H
4 #include "GUI2D_DrawPanel.h"
61 SP::CORE_Color mEdgeDrawingColor;
65 SP::CORE_Color mSelectedObjectColor;
68 int mToNodeEdgeMenuIndex,mToPortEdgeMenuIndex,mEdgeMenuIndex;
71 static const tFlag EDGE;
72 static const tFlag EDGE_TO_NODE;
73 static const tFlag EDGE_TO_PORT;
74 tFlag mAddingEdgeType;
77 SP::CORE_Color mBlackColor;
83 SP::CORE_Object mPopupObject;
86 SP::GPM_Vertex mSourceVertex;
90 SP::GPM_Vertex mSelectedVertex;
91 SP::GPM_Edge mSelectedEdge;
118 GUI2D_DrawPanel::toDoAfterThisSetting();
121 eraseAllExceptLastDrawingBoxes();
171 mSelectedVertex.reset();
179 mSelectedEdge.reset();
203 mNodeStateNameToShow=name;
210 mPortStateNameToShow=name;
217 mEdgeStateNameToShow=name;
225 mAreVerticesClickabled=v;
226 mAreEdgesClickabled=v;
235 return mNodeStateNameToShow;
240 return mPortStateNameToShow;
245 return mEdgeStateNameToShow;
260 return mToNodeEdgeMenuIndex;
265 return mToPortEdgeMenuIndex;
270 return mEdgeMenuIndex;
293 return *mSelectedObjectColor.get();
298 return mSelectedVertex.get();
303 return mSelectedEdge.get();
308 return !isPopupMenuPrinted();
313 return mAreNodesShown;
318 return mArePortsShown;
323 return mAreEdgesShown;
340 const int& x,
const int& y);
344 virtual GUI_AlonePopupMenu*
getPopupMenu(
const int& x,
const int& y,GUI2D_Item* item);
379 virtual void computeVertexBounds(
double& xMin,
double& yMin,
double& xMax,
double& yMax)
const=0;
434 virtual SP::GPM_Edge
addEdge(SP::GPM_Vertex source,SP::GPM_Vertex target);
455 void addEdgeToPort(SP::GPM_Vertex source,SP::GPM_Port target);
458 void addEdgeToNode(SP::GPM_Vertex source,SP::GPM_Node target);
virtual void objectIsClickedOn(SP::CORE_Object item)
method called when the object is double clicked on
Definition: GPMG_DrawPanel.cpp:468
int getTau() const
get Tau
Definition: GPMG_DrawPanel.h:275
DEFINE_SPTR(GPMG_DrawPanel)
int getToPortEdgeMenuIndex() const
get the index of the menu item
Definition: GPMG_DrawPanel.h:264
SP::CORE_Object getPopupObject()
get the popup object
Definition: GPMG_DrawPanel.h:253
virtual void computeVertexBounds(double &xMin, double &yMin, double &xMax, double &yMax) const =0
recompute the vertex bounds
GPMG_DrawPanel()
build a GPMG_DrawPanel
Definition: GPMG_DrawPanel.cpp:33
SP::GPM_Vertex addNode(const tReal &x, const tReal &y, GPM_PortGraph &graph)
add port in graph
Definition: GPMG_DrawPanel.cpp:774
void setEdgeVariableNameToShow(const tString &name)
set edge variable name to show
Definition: GPMG_DrawPanel.h:216
virtual void createPopupMenus()
create popup menus
Definition: GPMG_DrawPanel.cpp:559
void addEdgeToPort(SP::GPM_Vertex source, SP::GPM_Port target)
draw an edge between source & target vertices from graph
Definition: GPMG_DrawPanel.cpp:915
this class describes a Graph Draw Panel.
Definition: GPMG_DrawPanel.h:15
int getEdgeMenuIndex() const
get the index of the menu item
Definition: GPMG_DrawPanel.h:269
virtual void saveToUIClass(UI_Class &mclass) const
how to save the object from a mate model class
Definition: GPMG_DrawPanel.cpp:944
SP::GPM_Vertex addPort(const tReal &x, const tReal &y, GPM_PortGraph &graph)
add port in graph
Definition: GPMG_DrawPanel.cpp:753
static const tFlag Z
Definition: GPMG_DrawPanel.h:25
tString getNodeStateNameToShow() const
get the node state to show
Definition: GPMG_DrawPanel.h:234
void setEdgeWidth(const int &v)
set the vertex width
Definition: GPMG_DrawPanel.h:193
void setSelectedVertex(SP::GPM_Vertex obj)
set the selected vertex
Definition: GPMG_DrawPanel.h:160
virtual void mouseHasChanged(SP::GUI_Mouse mouse)
method called when the mouse changed
Definition: GPMG_DrawPanel.cpp:496
static const tFlag X
Definition: GPMG_DrawPanel.h:23
#define tBoolean
Definition: types.h:35
virtual SP::GPM_Edge addEdge(SP::GPM_Vertex source, SP::GPM_Vertex target)
add an edge between source & target vertices into graph
Definition: GPMG_DrawPanel.cpp:796
virtual void computePortsScale()=0
compute the port scale
static const tFlag PORT_COLOR_SCALE
Definition: GPMG_DrawPanel.h:27
void drawVertex(GPM_Node &node, const CORE_Color &color, const tString &label, const tReal &Cx, const tReal &Cy, const tReal &w, const tReal &h)
draw a node with color & label at (Cx,Cy) with size (w,h)
Definition: GPMG_DrawPanel.cpp:384
virtual tBoolean paintElements()
paint the element in the drawing area
Definition: GPMG_DrawPanel.cpp:368
tString getEdgeStateNameToShow() const
get the port state to show
Definition: GPMG_DrawPanel.h:244
virtual ~GPMG_DrawPanel(void)
destroy a GPMG_DrawPanel
Definition: GPMG_DrawPanel.cpp:45
void getCoordinates(const GPM_PortGraph &graph, GPM_Vertex &vertex, tReal &x, tReal &y)
get the coordinates of the vertex from graph in (x,y)
Definition: GPMG_DrawPanel.cpp:290
This class describes a node.
Definition: GPM_Vertex.h:16
This class describes a port.
Definition: GPM_Port.h:16
void getProjection(tFlag &projX, tFlag &projY) const
get project
Definition: GPMG_DrawPanel.h:285
virtual void objectIsMovedTo(SP::CORE_Object item, const tReal &x, const tReal &y)
method called when the object is moved to
Definition: GPMG_DrawPanel.cpp:484
void setPortVariableNameToShow(const tString &name)
set port variable name to show
Definition: GPMG_DrawPanel.h:209
void setAreObjectsClickabled(const tBoolean &v)
set if the object are clickabled
Definition: GPMG_DrawPanel.h:224
void setIsReadOnly(const tBoolean &isReadOnly)
set is read only
Definition: GPMG_DrawPanel.cpp:131
virtual void toDoAfterThisSetting()
method called after thi ssetting
Definition: GPMG_DrawPanel.h:117
void drawEdge(GPM_Edge *edge, const CORE_Color &color, const tString &label, const tReal &Sx, const tReal &Sy, const tReal &Tx, const tReal &Ty, const tReal &width)
draw an edge with color & label from (Sx,Sy)->(Tx,Ty)
Definition: GPMG_DrawPanel.cpp:438
void setArePortsShown(const tBoolean &v)
set if the ports are shown
Definition: GPMG_DrawPanel.h:146
void setNodeVariableNameToShow(const tString &name)
set node variable name to show
Definition: GPMG_DrawPanel.h:202
void resetSelectedEdge()
reset the selected edge object
Definition: GPMG_DrawPanel.h:178
This class describes a edge.
Definition: GPM_Edge.h:15
CORE_Color & getSelectedObjectColor() const
get the selected object color
Definition: GPMG_DrawPanel.h:292
void setSelectedEdge(SP::GPM_Edge obj)
set the selected edge
Definition: GPMG_DrawPanel.h:165
void addEdgeToNode(SP::GPM_Vertex source, SP::GPM_Node target)
draw an edge between source & target vertices from graph
Definition: GPMG_DrawPanel.cpp:853
virtual GUI_AlonePopupMenu * getPopupMenu(const int &x, const int &y, GUI2D_Item *item)
get the popup menu
Definition: GPMG_DrawPanel.cpp:622
static const tFlag NODE_COLOR_SCALE
Definition: GPMG_DrawPanel.h:26
void resetSelectedVertex()
reset the selected vertex object
Definition: GPMG_DrawPanel.h:170
tBoolean areNodesShown() const
get if the nodes are shown
Definition: GPMG_DrawPanel.h:312
virtual tFlag getGraphType(const GPM_Graph *graph) const =0
return the graph type of the graph
GPM_Vertex * getSelectedVertex() const
get the selected vertex object
Definition: GPMG_DrawPanel.h:297
virtual void computeBoundingBox(GUI2D_Box &box) const
compute the bounding box of the object to see
Definition: GPMG_DrawPanel.cpp:155
int getEdgeWidth() const
get edge width
Definition: GPMG_DrawPanel.h:280
#define tString
Definition: types.h:36
virtual void computeNodesScale()=0
compute the node scale
tBoolean areEdgesShown() const
get if the edges are shown
Definition: GPMG_DrawPanel.h:322
This class describes a graph which is a list of vertices, ports & edges.
Definition: GPM_PortGraph.h:22
virtual void computeEdgesScale()=0
compute the edges scale
tString getPortStateNameToShow() const
get the port state to show
Definition: GPMG_DrawPanel.h:239
virtual void loadFromUIClass(const UI_Class &mclass)
how to load the object from a Meta Model class
Definition: GPMG_DrawPanel.cpp:925
this class describes color
Definition: CORE_Color.h:28
virtual void deleteVertex(GPM_Vertex &vertex)
delete a vertex
Definition: GPMG_DrawPanel.cpp:828
void setAreNodesShown(const tBoolean &v)
set if the nodes are shown
Definition: GPMG_DrawPanel.h:141
virtual void initAttributes()
init attributes of the draw panel
Definition: GPMG_DrawPanel.cpp:50
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_DrawPanel.cpp:683
void setVertexSize(const int &v)
set the vertex size
Definition: GPMG_DrawPanel.h:186
tBoolean isReadOnly() const
return true if the read only mode is on
Definition: GPMG_DrawPanel.h:307
static const tFlag EDGE_COLOR_SCALE
Definition: GPMG_DrawPanel.h:28
static const tFlag Y
Definition: GPMG_DrawPanel.h:24
This class describes a graph which is a list of nodes & ports.
Definition: GPM_Graph.h:19
virtual void setIsMovingEnabled(const tBoolean &v)
set zoom selection enabled
Definition: GPMG_DrawPanel.cpp:114
#define tReal
Definition: types.h:18
virtual void deleteEdge(GPM_Edge &edge)
delete an edge
Definition: GPMG_DrawPanel.cpp:840
tBoolean arePortsShown() const
get if the ports are shown
Definition: GPMG_DrawPanel.h:317
GPM_Edge * getSelectedEdge() const
get the selected edge object
Definition: GPMG_DrawPanel.h:302
int getToNodeEdgeMenuIndex() const
get the index of the menu item
Definition: GPMG_DrawPanel.h:259
void setAreEdgesShown(const tBoolean &v)
set if the edges are shown
Definition: GPMG_DrawPanel.h:151
This class describes a node.
Definition: GPM_Node.h:14
#define tFlag
Definition: types.h:14