Commit 95b4d3bb authored by roangel's avatar roangel
Browse files

now figure center comes from svg. Need to beautify it with inkscape

parent 4e08c9c9
......@@ -260,6 +260,7 @@ set(MY_CPP_SOURCES_GUI # compilation of sources
${MY_GUI_LIB_PATH_SRC}/crazyFly.cpp
${MY_GUI_LIB_PATH_SRC}/CFLinker.cpp
${MY_GUI_LIB_PATH_SRC}/channelLUT.cpp
${MY_GUI_LIB_PATH_SRC}/centerMarker.cpp
)
# StudentGUI -- Add sources here
......
......@@ -12,5 +12,6 @@
<file>images/drone_fixed_07.svg</file>
<file>images/drone_fixed_08.svg</file>
<file>images/drone_fixed_09.svg</file>
<file>images/center_rect.svg</file>
</qresource>
</RCC>
......@@ -9,9 +9,9 @@
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="210mm"
height="297mm"
viewBox="0 0 744.09448819 1052.3622047"
width="151.66655mm"
height="151.66655mm"
viewBox="0 0 537.40116 537.40116"
id="svg2"
version="1.1"
inkscape:version="0.91 r13725"
......@@ -26,8 +26,8 @@
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="0.98994949"
inkscape:cx="299.90787"
inkscape:cy="691.68435"
inkscape:cx="149.39514"
inkscape:cy="309.84671"
inkscape:document-units="px"
inkscape:current-layer="layer1"
showgrid="false"
......@@ -35,7 +35,11 @@
inkscape:window-height="1056"
inkscape:window-x="65"
inkscape:window-y="24"
inkscape:window-maximized="1" />
inkscape:window-maximized="1"
fit-margin-top="0"
fit-margin-left="0"
fit-margin-right="0"
fit-margin-bottom="0" />
<metadata
id="metadata7">
<rdf:RDF>
......@@ -51,12 +55,13 @@
<g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1">
id="layer1"
transform="translate(0,-133.12338)">
<circle
style="fill:#000000;fill-opacity:1"
id="path4136"
cx="346.48233"
cy="324.04221"
r="47.477169" />
cx="268.70059"
cy="401.82397"
r="268.70059" />
</g>
</svg>
#ifndef CENTER_MARKER_H
#define CENTER_MARKER_H
#include "globalDefinitions.h"
#include <QGraphicsSvgItem>
#include <QSvgRenderer>
#define DIAMETER 100 * FROM_MILIMETERS_TO_UNITS
class centerMarker : public QGraphicsSvgItem
{
public:
explicit centerMarker(QString filename, QGraphicsItem * parent = 0);
~centerMarker();
QRectF boundingRect() const;
void paint(QPainter * painter,
const QStyleOptionGraphicsItem * option,
QWidget * widget);
private:
qreal m_diameter;
};
#endif
......@@ -68,5 +68,4 @@ private:
int m_assigned_cf_zone_index;
};
#endif
......@@ -3,8 +3,8 @@
#include <QGraphicsSimpleTextItem>
#include "myGraphicsRectItem.h"
#include "centerMarker.h"
class crazyFlyZone : public myGraphicsRectItem
{
......@@ -31,7 +31,7 @@ protected:
private:
int _index;
QGraphicsSimpleTextItem* label;
QGraphicsEllipseItem* m_center_marker;
centerMarker* m_center_marker;
// stuff for linking
bool m_linked;
......
#include "centerMarker.h"
#include <QPen>
#include <QBrush>
centerMarker::centerMarker(QString filename, QGraphicsItem * parent)
: QGraphicsSvgItem(filename, parent)
{
m_diameter = DIAMETER;
}
centerMarker::~centerMarker()
{
}
QRectF centerMarker::boundingRect() const
{
return QRectF(-m_diameter/2, -m_diameter/2, m_diameter, m_diameter);
}
void centerMarker::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
{
this->renderer()->render(painter,this->boundingRect());
}
......@@ -23,7 +23,8 @@ void crazyFlyZone::updateLabel(QString string)
void crazyFlyZone::createCenterMarker()
{
qreal diameter = 0.1 * FROM_METERS_TO_UNITS;
m_center_marker = new QGraphicsEllipseItem(QRectF(-diameter/2, -diameter/2, diameter, diameter), this);
// m_center_marker = new QGraphicsEllipseItem(QRectF(-diameter/2, -diameter/2, diameter, diameter), this);
m_center_marker = new centerMarker(":/images/center_rect.svg", this);
updateCenterMarker();
m_center_marker->setZValue(10); //max z value, always on top of things
}
......
5,cfTwo,0/69/2M,0,-0.251699,-1.96387,-0.2,0.0792386,-1.54593,2
5,PPS_CF04,0/24/2M,0,-0.885221,-0.268794,-0.2,0.379322,0.827822,2
Supports Markdown
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