diff --git a/artwork/Dials/defaultset/attitude-gradient.svg b/artwork/Dials/defaultset/attitude-gradient.svg
index c38906be6..6d48d4e70 100644
--- a/artwork/Dials/defaultset/attitude-gradient.svg
+++ b/artwork/Dials/defaultset/attitude-gradient.svg
@@ -265,7 +265,8 @@
y1="404.6904"
x2="376.34192"
y2="671.56238"
- gradientUnits="userSpaceOnUse" />
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="translate(1.5e-4,-2.3946118)" />
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="translate(1.5e-4,-1.6053882)" />
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(1.0190102,0,0,1,-2.8723168,-4)" />
+
+
-
-
+ id="g2887" />
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+ d="m 227.84948,501.93786 305,0"
+ style="fill:none;stroke:#e4e4e4;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;display:inline" />
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -459,9 +509,9 @@
id="needle3"
inkscape:label="#g3785">
+ style="fill:none;stroke:none" />
diff --git a/artwork/Dials/defaultset/gps-status.svg b/artwork/Dials/defaultset/gps-status.svg
new file mode 100644
index 000000000..ae5dee5b9
--- /dev/null
+++ b/artwork/Dials/defaultset/gps-status.svg
@@ -0,0 +1,1087 @@
+
+
+
+
diff --git a/artwork/Dials/defaultset/speed.svg b/artwork/Dials/defaultset/speed.svg
index cb2cee6d4..42dce12e7 100644
--- a/artwork/Dials/defaultset/speed.svg
+++ b/artwork/Dials/defaultset/speed.svg
@@ -196,11 +196,11 @@
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
- inkscape:zoom="0.98994949"
- inkscape:cx="-55.197873"
- inkscape:cy="116.44881"
+ inkscape:zoom="1.4"
+ inkscape:cx="137.33411"
+ inkscape:cy="142.1631"
inkscape:document-units="px"
- inkscape:current-layer="g2932"
+ inkscape:current-layer="background"
showgrid="false"
inkscape:window-width="1280"
inkscape:window-height="744"
@@ -685,23 +685,23 @@
inkscape:transform-center-y="-56.72097" />
diff --git a/artwork/Dials/dials-master-linear-vertical.svg b/artwork/Dials/dials-master-linear-vertical.svg
index cb37af711..b7d15b7ff 100644
--- a/artwork/Dials/dials-master-linear-vertical.svg
+++ b/artwork/Dials/dials-master-linear-vertical.svg
@@ -232,11 +232,11 @@
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
- inkscape:zoom="1.4"
- inkscape:cx="16.246188"
- inkscape:cy="181.15104"
+ inkscape:zoom="3.959798"
+ inkscape:cx="31.903552"
+ inkscape:cy="291.76274"
inkscape:document-units="px"
- inkscape:current-layer="background"
+ inkscape:current-layer="layer6"
showgrid="false"
inkscape:window-width="1280"
inkscape:window-height="744"
@@ -393,7 +393,7 @@
transform="translate(-129.62194,129.52019)">
diff --git a/artwork/Dials/simpledial-vertical.svg b/artwork/Dials/simpledial-vertical.svg
index f7c09a326..9a9b443f1 100644
--- a/artwork/Dials/simpledial-vertical.svg
+++ b/artwork/Dials/simpledial-vertical.svg
@@ -264,7 +264,7 @@
image/svg+xml
-
+
Edouard Lafargue
@@ -322,7 +322,8 @@
+ inkscape:label="#g4388"
+ transform="translate(-2,-6)">
+ style="fill:none;stroke:#453e3e;stroke-width:5.28399992;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" />
+ transform="translate(217.93242,361.4652)">
+ transform="translate(2,136)">
setPlainText(nfield1);
- UAVObjectField* field = obj1->getField(nfield1);
- double v = field->getDouble();
- setIndex(v);
- QString s;
- s.sprintf("%.0f",v);
- if (fieldValue)
- fieldValue->setPlainText(s);
+ updateIndex(obj1);
} else {
std::cout << "Error: Object is unknown (" << object1.toStdString() << ") this should not happen." << std::endl;
@@ -95,17 +89,34 @@ void LineardialGadgetWidget::connectInput(QString object1, QString nfield1) {
/*!
\brief Called by the UAVObject which got updated
+
+ Updates the numeric value and/or the icon if the dial wants this.
*/
void LineardialGadgetWidget::updateIndex(UAVObject *object1) {
// Double check that the field exists:
UAVObjectField* field = object1->getField(field1);
if (field) {
- double v = field->getDouble();
- setIndex(v);
QString s;
- s.sprintf("%.0f",v);
+ if (field->isNumeric()) {
+ double v = field->getDouble();
+ setIndex(v);
+ s.sprintf("%.0f",v);
+ }
+ if (field->isText()) {
+ s = field->getValue().toString();
+ if (fieldSymbol) {
+ // If we defined a symbol, we will look for a matching
+ // SVG element to display:
+ if (m_renderer->elementExists("symbol-" + s)) {
+ fieldSymbol->setElementId("symbol-" + s);
+ } else {
+ fieldSymbol->setElementId("symbol");
+ }
+ }
+ }
if (fieldValue)
fieldValue->setPlainText(s);
+
if (index && !dialTimer.isActive())
dialTimer.start();
} else {
@@ -113,8 +124,11 @@ void LineardialGadgetWidget::updateIndex(UAVObject *object1) {
}
}
-/*
- * Should be called after the min/max ranges have been set
+/*!
+ \brief Setup dial using its master SVG template.
+
+ Should only be called after the min/max ranges have been set.
+
*/
void LineardialGadgetWidget::setDialFile(QString dfn)
{
@@ -141,17 +155,14 @@ void LineardialGadgetWidget::setDialFile(QString dfn)
red = new QGraphicsSvgItem();
red->setSharedRenderer(m_renderer);
red->setElementId("red");
- //l_scene->addItem(red);
red->setParentItem(background);
yellow = new QGraphicsSvgItem();
yellow->setSharedRenderer(m_renderer);
yellow->setElementId("yellow");
- //l_scene->addItem(yellow);
yellow->setParentItem(background);
green = new QGraphicsSvgItem();
green->setSharedRenderer(m_renderer);
green->setElementId("green");
- //l_scene->addItem(green);
green->setParentItem(background);
// In order to properly render the Green/Yellow/Red graphs, we need to find out
// the starting location of the bargraph rendering area:
@@ -230,13 +241,12 @@ void LineardialGadgetWidget::setDialFile(QString dfn)
index->setSharedRenderer(m_renderer);
index->setElementId("needle");
index->setTransform(matrix,false);
- //l_scene->addItem(index);
index->setParentItem(background);
} else {
index = NULL;
}
- // Check whether the dial wants display field name:
+ // Check whether the dial wants display its field name:
if (m_renderer->elementExists("field")) {
QMatrix textMatrix = m_renderer->matrixForElement("field");
qreal startX = textMatrix.mapRect(m_renderer->boundsOnElement("field")).x();
@@ -246,11 +256,11 @@ void LineardialGadgetWidget::setDialFile(QString dfn)
fieldName = new QGraphicsTextItem("0.00");
fieldName->setDefaultTextColor(QColor("White"));
fieldName->setTransform(matrix,false);
- //l_scene->addItem(fieldName);
fieldName->setParentItem(background);
} else {
fieldName = NULL;
}
+
// Check whether the dial wants display the numeric value:
if (m_renderer->elementExists("value")) {
QMatrix textMatrix = m_renderer->matrixForElement("value");
@@ -261,12 +271,28 @@ void LineardialGadgetWidget::setDialFile(QString dfn)
fieldValue = new QGraphicsTextItem("00");
fieldValue->setDefaultTextColor(QColor("White"));
fieldValue->setTransform(matrix,false);
- //l_scene->addItem(fieldValue);
fieldValue->setParentItem(background);
} else {
fieldValue = NULL;
}
+ // Check whether the dial wants to display the value as a
+ // symbol (only works for text values):
+ if (m_renderer->elementExists("symbol")) {
+ QMatrix textMatrix = m_renderer->matrixForElement("symbol");
+ qreal startX = textMatrix.mapRect(m_renderer->boundsOnElement("symbol")).x();
+ qreal startY = textMatrix.mapRect(m_renderer->boundsOnElement("symbol")).y();
+ QTransform matrix;
+ matrix.translate(startX,startY);
+ fieldSymbol = new QGraphicsSvgItem();
+ fieldSymbol->setElementId("symbol");
+ fieldSymbol->setSharedRenderer(m_renderer);
+ fieldSymbol->setTransform(matrix,false);
+ fieldSymbol->setParentItem(background);
+ } else {
+ fieldSymbol = NULL;
+ }
+
if (m_renderer->elementExists("foreground")) {
foreground = new QGraphicsSvgItem();
foreground->setSharedRenderer(m_renderer);
@@ -340,6 +366,10 @@ void LineardialGadgetWidget::setIndex(double value) {
// approaching the target.
void LineardialGadgetWidget::moveIndex()
{
+ if (!index) { // Safeguard
+ dialTimer.stop();
+ return;
+ }
if ((abs((indexValue-indexTarget)*10) > 3)) {
indexValue += (indexTarget - indexValue)/5;
} else {
diff --git a/ground/src/plugins/lineardial/lineardialgadgetwidget.h b/ground/src/plugins/lineardial/lineardialgadgetwidget.h
index 2d1f12fc3..efbd13662 100644
--- a/ground/src/plugins/lineardial/lineardialgadgetwidget.h
+++ b/ground/src/plugins/lineardial/lineardialgadgetwidget.h
@@ -77,6 +77,7 @@ private:
QGraphicsSvgItem *green;
QGraphicsSvgItem *yellow;
QGraphicsSvgItem *red;
+ QGraphicsSvgItem *fieldSymbol;
QGraphicsTextItem *fieldName;
QGraphicsTextItem *fieldValue;