28 plotManager(plotManager),
29 plot_bgcolor(default_plot_bgcolor),
30 plot_size(default_plot_size),
31 plot_minval(default_plot_minval),
32 plot_maxval(default_plot_maxval),
33 plot_autorescale(options->check(
"autorescale")),
34 plot_realtime(options->check(
"realtime")),
35 plot_triggermode(options->check(
"triggermode")),
36 plot_title(default_plot_title),
39 graph_localport(default_portscope_localport),
40 graph_title(default_graph_title),
41 graph_color(default_graph_color),
42 graph_type(default_graph_type),
43 graph_size(default_graph_size)
45 if (!options->
check(
"remote")) {
46 qDebug(
"Missing \"remote\" argument. Will wait for external connection");
48 graph_remote = QString(
"%1").arg(options->
find(
"remote").
toString().c_str());
49 plot_title = graph_remote;
52 if (options->
check(
"carrier")) {
55 if (options->
check(
"no-persistent")) {
57 }
else if (options->
check(
"persistent")) {
61 if (!options->
check(
"index")) {
62 qWarning() <<
"Missing \"index\" argument. Will use index = 0";
67 if (options->
check(
"plot_title")) {
68 plot_title = QString(
"%1").arg(options->
find(
"plot_title").
toString().c_str());
71 if (options->
check(
"min")) {
75 if (options->
check(
"max")) {
79 if (options->
check(
"size")) {
83 if (options->
check(
"bgcolor")) {
84 plot_bgcolor = QString(
"%1").arg(options->
find(
"bgcolor").
asString().c_str());
88 Q_UNUSED(plot_realtime);
91 Q_UNUSED(plot_triggermode);
93 Plotter *plotter = plotManager->
addPlot(plot_title, 0, 0, 1, 1, plot_minval, plot_maxval, plot_size, plot_bgcolor, plot_autorescale);
96 if (!indexValue.
isList()) {
98 graph_index = indexValue.
asInt32();
100 if (options->
check(
"graph_title")) {
102 qCritical(R
"("graph_title" and "index" arguments should have the same number of elements)");
106 graph_title = QString(
"%1").arg(options->
find(
"graph_title").
toString().c_str());
109 if (options->
check(
"color")) {
111 qCritical(R
"("color" and "index" arguments should have the same number of elements)");
115 graph_color = QString(
"%1").arg(options->
find(
"color").
toString().c_str());
118 if (options->
check(
"type")) {
120 qCritical(R
"("type" and "index" arguments should have the same number of elements)");
124 graph_type = QString(
"%1").arg(options->
find(
"type").
toString().c_str());
127 if (options->
check(
"graph_size")) {
129 qCritical(R
"("graph_size" and "index" arguments should have the same number of elements)");
133 graph_size = options->
find(
"graph_size").
asInt32();
138 Graph *graph = plotter->
addGraph(graph_remote, graph_localport,graph_index, graph_title, graph_color, graph_type, graph_size);
147 if (options->
check(
"graph_title")) {
149 if (!titlesValue.
isList()) {
150 qCritical(R
"("graph_title" and "index" arguments should have the same number of elements)");
154 titles = *titlesValue.
asList();
155 if (titles.
size() != indexes.
size()) {
156 qCritical(R
"("graph_title" and "index" arguments should have the same number of elements)");
164 if (options->
check(
"color")) {
166 if (!colorsValue.
isList()) {
167 qCritical(R
"("color" and "index" arguments should have the same number of elements)");
171 colors = *colorsValue.
asList();
172 if (colors.
size() != indexes.
size()) {
173 qCritical(R
"("color" and "index" arguments should have the same number of elements)");
181 if (options->
check(
"type")) {
183 if (!typesValue.
isList()) {
184 qCritical(R
"("type" and "index" arguments should have the same number of elements)");
188 types = *typesValue.
asList();
189 if (types.
size() != indexes.
size()) {
190 qCritical(R
"("type" and "index" arguments should have the same number of elements)");
198 if (options->
check(
"graph_size")) {
200 if (!sizesValue.
isList()) {
201 qCritical(R
"("graph_size" and "index" arguments should have the same number of elements)");
205 sizes = *sizesValue.
asList();
206 if (sizes.
size() != indexes.
size()) {
207 qCritical(R
"("graph_size" and "index" arguments should have the same number of elements)");
215 for (
size_t i = 0; i < indexes.
size(); i++) {
219 graph_title = QString(
"%1").arg(titles.
get(i).
asString().data());
223 graph_color = QString(
"%1").arg(colors.
get(i).
asString().data());
227 graph_type = QString(
"%1").arg(types.
get(i).
asString().data());
235 Graph *graph = plotter->
addGraph( graph_remote, graph_localport,graph_index, graph_title, graph_color, graph_type, graph_size);
Base Class for the Loaders.
bool portscope_persistent
QString portscope_carrier
const int default_graph_size
Class representing a Graph.
void init(QString remotePortName, QString localPortName, QString carrier, bool persistent)
The Manager of the plotters.
Plotter * addPlot(const QString &title, int gridx, int gridy, int hspan, int vspan, float minval, float maxval, int size, const QString &bgcolor, bool autorescale)
Adds a new Plotter.
Class representing a Plotter.
Graph * addGraph(QString remotePort, QString localPort, int index, QString title, QString color, QString type, int size, double graph_y_scale=1.0)
Add a Graph to the current Plotter.
SimpleLoader(yarp::os::ResourceFinder *options, PlotManager *plotManager, bool *ok, QObject *parent=0)
A simple collection of objects that can be described and transmitted in a portable way.
static Bottle & getNullBottle()
A special Bottle with no content.
size_type size() const
Gets the number of elements in the bottle.
Value & get(size_type index) const
Reads a Value v from a certain part of the list.
bool isNull() const override
Checks if the object is invalid.
Helper class for finding config files and other external resources.
bool check(const std::string &key) const override
Check if there exists a property of the given name.
Value & find(const std::string &key) const override
Gets a value corresponding to a given keyword.
A single value (typically within a Bottle).
virtual yarp::conf::float64_t asFloat64() const
Get 64-bit floating point value.
virtual std::int32_t asInt32() const
Get 32-bit integer value.
virtual bool isList() const
Checks if value is a list.
virtual Bottle * asList() const
Get list value.
std::string toString() const override
Return a standard text representation of the content of the object.
virtual std::string asString() const
Get string value.