hpp-plot 6.0.0
Plotting tools for HPP
Loading...
Searching...
No Matches
hpp-manipulation-graph.hh
Go to the documentation of this file.
1// BSD 2-Clause License
2
3// Copyright (c) 2015 - 2018, hpp-plot
4// Authors: Heidy Dallard, Joseph Mirabel
5// All rights reserved.
6
7// Redistribution and use in source and binary forms, with or without
8// modification, are permitted provided that the following conditions
9// are met:
10
11// * Redistributions of source code must retain the above copyright
12// notice, this list of conditions and the following disclaimer.
13
14// * Redistributions in binary form must reproduce the above copyright
15// notice, this list of conditions and the following disclaimer in
16// the documentation and/or other materials provided with the
17// distribution.
18
19// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
22// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
23// COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
24// INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
25// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
26// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
28// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
30// OF THE POSSIBILITY OF SUCH DAMAGE.
31
32#ifndef HPP_PLOT_HPP_MANIPULATION_GRAPH_HH
33#define HPP_PLOT_HPP_MANIPULATION_GRAPH_HH
34
35#include <QAction>
36#include <QPushButton>
37#include <hpp/corbaserver/manipulation/client.hh>
39
40namespace hpp {
41namespace corbaServer {
42namespace manipulation {
43class Client;
44}
45} // namespace corbaServer
46namespace plot {
47class HppManipulationGraphWidget;
48
49class GraphAction : public QAction {
50 Q_OBJECT
51
52 public:
54
55 signals:
56 void activated(hpp::ID id);
57
58 private slots:
59 void transferSignal();
60
61 private:
63};
64
66 Q_OBJECT
67
68 public:
69 HppManipulationGraphWidget(corbaServer::manipulation::Client* hpp_,
70 QWidget* parent);
71
73
76
77 void client(corbaServer::manipulation::Client* hpp);
78
79 bool selectionID(hpp::ID& id);
80 void showEdge(const hpp::ID& edgeId);
81 const std::string& graphName() const { return graphName_; }
82
83 protected:
84 void fillScene();
85
86 public slots:
87 void updateStatistics();
88 void showNodeOfConfiguration(const hpp::floatSeq& cfg);
89 void displayNodeConstraint(hpp::ID id);
90 void displayEdgeConstraint(hpp::ID id);
91 void displayEdgeTargetConstraint(hpp::ID id);
92
93 protected slots:
94 virtual void nodeContextMenu(QGVNode* node);
95 virtual void nodeDoubleClick(QGVNode* node);
96 virtual void edgeContextMenu(QGVEdge* edge);
97 virtual void edgeDoubleClick(QGVEdge* edge);
98
99 void selectionChanged();
100
101 private slots:
102 void startStopUpdateStats(bool start);
103
104 private:
105 corbaServer::manipulation::Client* manip_;
106
107 struct GraphInfo {
108 ::hpp::ID id;
109 QString constraintStr;
110 } graphInfo_;
111 struct NodeInfo {
112 ::hpp::ID id;
113 QString constraintStr;
114 QGVNode* node;
115
116 ::hpp::ConfigProjStat configStat, pathStat;
117 ::CORBA::Long freq;
118 ::hpp::intSeq_var freqPerCC;
119 NodeInfo();
120 };
121 struct EdgeInfo {
122 ::hpp::ID id;
123 QString name, containingNodeName;
124 ::CORBA::Long weight;
125 QString constraintStr;
126 QString shortStr;
127 QGVEdge* edge;
128
129 ::hpp::ConfigProjStat configStat, pathStat;
130 ::hpp::Names_t_var errors;
131 ::hpp::intSeq_var freqs;
132
133 EdgeInfo();
134 };
135
136 void updateWeight(EdgeInfo& ei, bool get = true);
137 void updateWeight(EdgeInfo& ei, const ::CORBA::Long w);
138
139 QString getConstraints(hpp::ID id);
140
141 std::string graphName_;
142 QList<GraphAction*> nodeContextMenuActions_;
143 QList<GraphAction*> edgeContextMenuActions_;
144 QMap<QGVNode*, NodeInfo> nodeInfos_;
145 QMap<QGVEdge*, EdgeInfo> edgeInfos_;
146 QMap<hpp::ID, QGVNode*> nodes_;
147 QMap<hpp::ID, QGVEdge*> edges_;
148
149 QPushButton *showWaypoints_, *statButton_;
150 QTimer* updateStatsTimer_;
151
152 hpp::ID currentId_, showNodeId_, showEdgeId_;
153};
154} // namespace plot
155} // namespace hpp
156
157#endif // HPP_PLOT_HPP_MANIPULATION_GRAPH_HH
Definition hpp-manipulation-graph.hh:49
void activated(hpp::ID id)
Definition moc_hpp-manipulation-graph.cpp:139
Definition graph-widget.hh:54
Definition hpp-manipulation-graph.hh:65
void showEdge(const hpp::ID &edgeId)
Definition hpp-manipulation-graph.cc:351
virtual void nodeContextMenu(QGVNode *node)
Definition hpp-manipulation-graph.cc:368
~HppManipulationGraphWidget()
Definition hpp-manipulation-graph.cc:103
virtual void nodeDoubleClick(QGVNode *node)
Definition hpp-manipulation-graph.cc:382
void fillScene()
Definition hpp-manipulation-graph.cc:127
bool selectionID(hpp::ID &id)
Definition hpp-manipulation-graph.cc:122
virtual void edgeContextMenu(QGVEdge *edge)
Definition hpp-manipulation-graph.cc:411
virtual void edgeDoubleClick(QGVEdge *edge)
Definition hpp-manipulation-graph.cc:425
void selectionChanged()
Definition hpp-manipulation-graph.cc:437
void addNodeContextMenuAction(GraphAction *action)
Definition hpp-manipulation-graph.cc:109
void client(corbaServer::manipulation::Client *hpp)
Definition hpp-manipulation-graph.cc:117
void showNodeOfConfiguration(const hpp::floatSeq &cfg)
Definition hpp-manipulation-graph.cc:321
void displayNodeConstraint(hpp::ID id)
Definition hpp-manipulation-graph.cc:387
void displayEdgeTargetConstraint(hpp::ID id)
Definition hpp-manipulation-graph.cc:403
const std::string & graphName() const
Definition hpp-manipulation-graph.hh:81
void addEdgeContextMenuAction(GraphAction *action)
Definition hpp-manipulation-graph.cc:113
void updateStatistics()
Definition hpp-manipulation-graph.cc:263
void displayEdgeConstraint(hpp::ID id)
Definition hpp-manipulation-graph.cc:395
Definition graph-widget.hh:43