Browse Source

Added text (component id) to cone/circle symbol symbolizing pose data from that component in 3D view.

QGC4.4
Lionel Heng 13 years ago
parent
commit
c529ff516a
  1. 24
      src/ui/map3D/Pixhawk3DWidget.cc

24
src/ui/map3D/Pixhawk3DWidget.cc

@ -38,6 +38,7 @@ @@ -38,6 +38,7 @@
#include <osgDB/ReadFile>
#include <osg/LineWidth>
#include <osg/ShapeDrawable>
#include <osgText/Text>
#include "../MainWindow.h"
#include "PixhawkCheetahGeode.h"
@ -236,6 +237,29 @@ Pixhawk3DWidget::localPositionChanged(UASInterface* uas, int component, @@ -236,6 +237,29 @@ Pixhawk3DWidget::localPositionChanged(UASInterface* uas, int component,
geode->addDrawable(sd);
group->addChild(geode);
// text indicates component id
osg::ref_ptr<osgText::Text> text = new osgText::Text;
text->setFont(m3DWidget->font());
text->setText(QString::number(component).toStdString().c_str());
text->setColor(color);
text->setCharacterSize(0.3f);
text->setAxisAlignment(osgText::Text::XY_PLANE);
text->setAlignment(osgText::Text::CENTER_CENTER);
text->setPosition(osg::Vec3(0.0, -0.8, 0.0));
sd = new osg::ShapeDrawable;
osg::ref_ptr<osg::Box> textBox =
new osg::Box(osg::Vec3(0.0, -0.8, -0.01), 0.7, 0.4, 0.01);
sd->setShape(textBox);
sd->getOrCreateStateSet()->setMode(GL_BLEND, osg::StateAttribute::ON);
sd->setColor(osg::Vec4(0.0, 0.0, 0.0, 1.0));
geode = new osg::Geode;
geode->addDrawable(text);
geode->addDrawable(sd);
group->addChild(geode);
pat = new osg::PositionAttitudeTransform;
pat->addChild(group);
systemData.orientationNode()->addChild(pat);

Loading…
Cancel
Save