To receive notifications about scheduled maintenance, please subscribe to the mailing-list gitlab-operations@sympa.ethz.ch. You can subscribe to the mailing-list at https://sympa.ethz.ch

Commit cb0f4a6b authored by tiagos's avatar tiagos
Browse files

Anchors are plotted in the scene

parent a73bab51
......@@ -285,6 +285,7 @@ set(MY_CPP_SOURCES_GUI # compilation of sources
${MY_GUI_LIB_PATH_SRC}/marker.cpp
${MY_GUI_LIB_PATH_SRC}/rosNodeThread.cpp
${MY_GUI_LIB_PATH_SRC}/crazyFly.cpp
${MY_GUI_LIB_PATH_SRC}/UWBMarker.cpp
${MY_GUI_LIB_PATH_SRC}/CFLinker.cpp
${MY_GUI_LIB_PATH_SRC}/channelLUT.cpp
${MY_GUI_LIB_PATH_SRC}/centerMarker.cpp
......
......@@ -13,5 +13,6 @@
<file>images/drone_fixed_08.svg</file>
<file>images/drone_fixed_09.svg</file>
<file>images/center_rect.svg</file>
<file>images/anchor.svg</file>
</qresource>
</RCC>
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- Generator: Adobe Illustrator 18.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" id="Capa_1" x="0px" y="0px" viewBox="0 0 201.203 201.203" style="enable-background:new 0 0 201.203 201.203;" xml:space="preserve" width="512px" height="512px">
<g>
<path d="M52.01,12.806c2.929-2.929,2.929-7.678-0.001-10.607c-2.928-2.928-7.677-2.929-10.606,0.001 C8.775,34.831,8.775,87.922,41.401,120.55c1.465,1.465,3.384,2.197,5.304,2.197c1.919,0,3.839-0.732,5.303-2.196 c2.93-2.929,2.93-7.678,0.001-10.606C25.229,83.164,25.23,39.588,52.01,12.806z" fill="#D80027"/>
<path d="M159.76,2.196c-2.93-2.928-7.678-2.928-10.607,0c-2.929,2.93-2.929,7.678,0,10.607 c12.975,12.974,20.119,30.223,20.118,48.57c0,18.348-7.146,35.597-20.121,48.57c-2.93,2.929-2.93,7.678-0.001,10.606 c1.465,1.465,3.384,2.197,5.304,2.197c1.919,0,3.839-0.732,5.303-2.196c15.809-15.807,24.516-36.823,24.516-59.178 C184.272,39.02,175.567,18.003,159.76,2.196z" fill="#D80027"/>
<path d="M61.606,100.349c1.465,1.465,3.384,2.197,5.304,2.197c1.919,0,3.839-0.732,5.303-2.196c2.93-2.929,2.93-7.678,0.001-10.606 c-15.641-15.643-15.641-41.096,0-56.738c2.929-2.929,2.929-7.678-0.001-10.607c-2.93-2.93-7.679-2.929-10.606,0.001 C40.119,43.89,40.119,78.859,61.606,100.349z" fill="#D80027"/>
<path d="M128.949,100.35c1.464,1.464,3.384,2.196,5.303,2.196c1.919,0,3.839-0.732,5.304-2.197 C149.966,89.938,155.7,76.095,155.7,61.373c0-14.724-5.733-28.565-16.146-38.976c-2.928-2.928-7.677-2.929-10.606,0.001 c-2.929,2.929-2.929,7.678,0.001,10.606c7.578,7.577,11.751,17.651,11.751,28.368s-4.174,20.792-11.752,28.371 C126.019,92.672,126.019,97.421,128.949,100.35z" fill="#D80027"/>
<path d="M100.579,80.421c10.523,0,19.049-8.529,19.049-19.049c0-10.52-8.525-19.047-19.049-19.047 c-10.521,0-19.049,8.527-19.049,19.047C81.531,71.892,90.058,80.421,100.579,80.421z" fill="#D80027"/>
<path d="M107.713,91.008c-1.002-3.093-3.883-5.188-7.135-5.188c-3.252,0-6.133,2.096-7.135,5.188L60.928,191.389 c-1.276,3.94,0.883,8.17,4.823,9.446c0.769,0.249,1.547,0.367,2.313,0.367c3.163,0,6.105-2.018,7.133-5.19l3.962-12.231h42.839 l3.962,12.231c1.276,3.94,5.504,6.099,9.446,4.823c3.94-1.276,6.1-5.506,4.823-9.446L107.713,91.008z M100.579,117.658 l6.279,19.385H94.299L100.579,117.658z M84.019,168.781l5.422-16.738h22.276l5.422,16.738H84.019z" fill="#D80027"/>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
</svg>
#ifndef UWBMARKER_H
#define UWBMARKER_H
#include <QGraphicsSvgItem>
#include <QSvgRenderer>
#include "globalDefinitions.h"
#include "d_fall_pps/UWBAnchor.h"
using namespace d_fall_pps;
#define ANCHOR_HEIGHT 200 * FROM_MILIMETERS_TO_UNITS * 1.2
#define ANCHOR_WIDTH 200 * FROM_MILIMETERS_TO_UNITS * 1.2
#define ANCHOR_OPACITY 0.7
class UWBMarker : public QGraphicsSvgItem
{
public:
explicit UWBMarker(const UWBAnchor* const anchor, QString filename, QGraphicsItem* parent = 0);
~UWBMarker();
void updateMarker(const UWBAnchor* const anchor);
QRectF boundingRect() const;
void paint(QPainter * painter, const QStyleOptionGraphicsItem * option, QWidget * widget);
private:
// info for plotting anchor
qreal m_width;
qreal m_height;
qreal m_x;
qreal m_y;
qreal m_z;
};
#endif
\ No newline at end of file
#include "UWBMarker.h"
#include <stdio.h>
UWBMarker::UWBMarker(const UWBAnchor* const anchor, QString filename, QGraphicsItem* parent) : QGraphicsSvgItem(filename)
{
updateMarker(anchor);
m_width = ANCHOR_WIDTH;
m_height = ANCHOR_HEIGHT;
}
UWBMarker::~UWBMarker()
{}
void UWBMarker::updateMarker(const UWBAnchor* const anchor)
{
m_x = anchor->x /10;
m_y = anchor->y /10;
m_z = anchor->z /10;
this->setPos(m_x * FROM_METERS_TO_UNITS, -m_y * FROM_METERS_TO_UNITS);
this->setOpacity(ANCHOR_OPACITY);
}
QRectF UWBMarker::boundingRect() const
{
// return QRectF(-original_width/2, -original_height/2, original_width, original_height);
return QRectF(-m_width/2, -m_height/2, m_width, m_height);
}
void UWBMarker::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
{
this->renderer()->render(painter,this->boundingRect());
}
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment