From ea742954eecfd78819b8a2c71bcb0d771b1193b7 Mon Sep 17 00:00:00 2001 From: Kate Alhola Date: Wed, 11 Apr 2012 14:57:13 +0300 Subject: [PATCH 1/1] Sync repository --- mardrone/ardrone_plainqml.qml | 244 ++++++++++++++++++++++++++++++++++ mardrone/gauges/gauge.cpp | 17 +++ mardrone/gauges/gauge.h | 62 +++++++-- mardrone/gauges/gaugearc.cpp | 97 ++++++++++++++ mardrone/gauges/gaugearc.h | 20 +++ mardrone/gauges/gaugehorizon.cpp | 8 +- mardrone/gauges/gaugehorizon.h | 4 + mardrone/gauges/gaugehsi.cpp | 101 ++++++++++++++ mardrone/gauges/gaugehsi.h | 20 +++ mardrone/gauges/gaugelabel.cpp | 4 +- mardrone/gauges/gaugeplugin.cpp | 35 +++++ mardrone/gauges/gauges.pro | 20 +++ mardrone/gauges/gaugetape.cpp | 37 ++++-- mardrone/gauges/moc_gauge.cpp | 185 ++++++++++++++++++++++++++ mardrone/gauges/moc_gaugearc.cpp | 81 +++++++++++ mardrone/gauges/moc_gaugehorizon.cpp | 123 +++++++++++++++++ mardrone/gauges/moc_gaugehsi.cpp | 81 +++++++++++ mardrone/gauges/moc_gaugelabel.cpp | 81 +++++++++++ mardrone/gauges/moc_gaugetape.cpp | 81 +++++++++++ 19 files changed, 1269 insertions(+), 32 deletions(-) create mode 100644 mardrone/ardrone_plainqml.qml create mode 100644 mardrone/gauges/gaugearc.cpp create mode 100644 mardrone/gauges/gaugearc.h create mode 100644 mardrone/gauges/gaugehsi.cpp create mode 100644 mardrone/gauges/gaugehsi.h create mode 100644 mardrone/gauges/gaugeplugin.cpp create mode 100644 mardrone/gauges/gauges.pro create mode 100644 mardrone/gauges/moc_gauge.cpp create mode 100644 mardrone/gauges/moc_gaugearc.cpp create mode 100644 mardrone/gauges/moc_gaugehorizon.cpp create mode 100644 mardrone/gauges/moc_gaugehsi.cpp create mode 100644 mardrone/gauges/moc_gaugelabel.cpp create mode 100644 mardrone/gauges/moc_gaugetape.cpp diff --git a/mardrone/ardrone_plainqml.qml b/mardrone/ardrone_plainqml.qml new file mode 100644 index 0000000..b9a27f5 --- /dev/null +++ b/mardrone/ardrone_plainqml.qml @@ -0,0 +1,244 @@ +import QtQuick 1.0 +import Drone 1.0 +//import gauges 1.0 +import JoyStick 1.0 + +Rectangle { + id:mainWindow + width:1024 + height:745 + + DroneControl { + id:drone + } + JoyStick { + id:js + onElevatorChanged:{if(drone.confUseJoyStick) drone.pitch=elevator;} + onAileronChanged: {if(drone.confUseJoyStick) drone.roll=-1.0*aileron;} + onThrotleChanged: {if(drone.confUseJoyStick) drone.vVelocity=throtle;} + onRudderChanged: {if(drone.confUseJoyStick) drone.yaw=rudder;} + + } + // id:mainPage + property bool connectingBoxVisible:true + //onEntered:(mainWindow.fullscreen=true) + + state:"Landscape" + DroneVideo { + y:0 + x:0 + // anchors.horizontalCenter:parent.horizontalCenter + width:drone.confFullScreen? parent.width:640 ;height:480*width/640; + } + + EfisPFD { + id:hudPDF + y:0 + x:100 + visible:drone.confShowHorizon + roll:drone.droneRoll + pitch:drone.dronePitch + ias:drone.droneSpeed + alt:drone.droneAltitude + indicatorColor:"#00FF00" + skyColor:"#00000000" + groundColor:"#00000000" +// value:lj.xv +// value2:lj.yv + width:640;height:480; + } + + + Text { + y:50 + // visible:drone.confUseAccel + color: "#00FF00" + id: droneCtrlValues + font.pixelSize:25 + text: "cmd:pitch=" + drone.pitch.toFixed(2) + " roll= " + drone.roll.toFixed(2) + " yaw=" + drone.yaw.toFixed(2) + " vv= " + drone.vVelocity.toFixed(2) + } + + Text { + y:70 + visible:drone.confShowDebug + color: "#00FF00" + id: droneNavData + font.pixelSize:25 + text: "pitch=" + drone.dronePitch.toFixed(2) + " roll= " + drone.droneRoll.toFixed(2) + "yaw=" + drone.droneYaw.toFixed(2) + " alt= " + drone.droneAltitude.toFixed(2) + } + + Text { + y:100 + visible:drone.confShowDebug + color: "#00FF00" + id: droneStatus + font.pixelSize:20 + text: drone.decodedStatus + } + /* + Button { + y:150;x:0 + height: 50 + width: 50 + z:2 // This is visible even connecting to drone + iconSource: "gear32x32.png" + onClicked:{ //mainWindow.fullscreen = false ; + pageStack.push(dialogComponent); + } + } +*/ + JoyStickIndicator { + x:200;y:350 + visible:drone.confShowJSIndicators&js.haveJoyStick&drone.confUseJoyStick + border.width:1 + color:"transparent" + width:100;height:100 + xvalue:js.axis4 + yvalue:js.axis3 + Text { + anchors.bottom: parent.bottom + font.pixelSize: 10 + text:" rudder" + } + Text { + x:-10;y:50 + rotation:90 + font.pixelSize: 10 + text:"Throtle" + } + } + + + JoyStickIndicator { + x:500;y:350 + visible:drone.confShowJSIndicators&js.haveJoyStick&drone.confUseJoyStick + border.width:1 + color:"transparent" + width:100;height:100 + xvalue:js.axis1 + yvalue:js.axis2 + Text { + anchors.bottom: parent.bottom + font.pixelSize: 10 + text:" Aileron" + } + Text { + x:-15;y:50 + rotation:90 + font.pixelSize: 10 + text:"Elevator" + } + } + + JoyStickTouch { + id:lj + width:200;height:200; + + visible: !drone.confUseAccel & !drone.confUseJoyStick + anchors.left:parent.left + anchors.bottom:parent.bottom + anchors.margins:10 + // joyBackground: "" + onYvChanged:{drone.vVelocity=-1*yv/200.0;} + onXvChanged:{drone.yaw=xv/200.0;} + onPressedChanged: { drone.ctrlActive=pressed;} + } + + JoyStickTouch { + visible: !drone.confUseJoyStick + id:rj + + // joyBackground: "" + anchors.right:parent.right + anchors.bottom:parent.bottom + width:200;height:200; + anchors.margins:10 + onYvChanged:{drone.pitch=yv/200.0;} + onXvChanged:{drone.roll=xv/200.0;} + } + + Row { + spacing: 5 + anchors.right:parent.right + anchors.rightMargin: 10 + y:100 + height:100 + BarGauge { + val:drone.pwm_motor1; + max: 255 + height:100 + } + BarGauge { + val:drone.pwm_motor2; + max: 255 + height:100 + } + BarGauge { + val:drone.pwm_motor3; + max: 255 + height:100 + } + BarGauge { + val:drone.pwm_motor4; + max: 255 + height:100 + } + BarGauge { + val:drone.droneVBat + max: 100 + height:100 + } + } +/* + Button { + x:400 + width:60 + id:flyButton + anchors.bottom:parent.bottom + anchors.margins:15 + text:"Fly"; + checkable:true + onClicked:{drone.fly=checked; + // mainWindow.fullsecreen=checked; + } + } + Button { + x:500 + width:140 + id:emergencyButton + anchors.bottom:parent.bottom + + anchors.margins:15 + text:"Energency"; + checkable:true + onClicked:{drone.emergency=checked;} + } +*/ +/* + Connections { + target:drone + onConnectedChanged:{ + console.log("Connected to drone"); + connectingDialog.accept();} + } + QueryDialog { + id:connectingDialog + message:"Connecting to Drone "+ drone.confDroneIp + acceptButtonText:"OK" + Component.onCompleted: { + console.log("ConectionDialog Opened"); + if(!drone.connected) open(); } + } + } // Main page + } + + Component.onCompleted: { + if (mainpageComponent.status != Component.Ready) + // pageStack.push(mainpageComponent); + // else + console.log("Error loading component:", mainpageComponent.errorString()); + dialogComponent = Qt.createComponent("ConfigDialog.qml"); + + } + */ + } diff --git a/mardrone/gauges/gauge.cpp b/mardrone/gauges/gauge.cpp index f555f99..01f4f50 100644 --- a/mardrone/gauges/gauge.cpp +++ b/mardrone/gauges/gauge.cpp @@ -10,6 +10,12 @@ Gauge::Gauge(QGraphicsItem *parent) : m_textSize=20; m_tickMinor=0; m_scale=1.0; + m_tickLength=10; + m_highPosition=0; + m_lowPosition=180; + m_lineWidth=1; + m_backColor=QColor("black"); + m_needleImage=NULL; } #if 1 void Gauge::paint(QPainter *painter, @@ -26,6 +32,17 @@ void Gauge::setValue(float val_) m_value=val_; update(boundingRect()); // Value updated, schedule redtaw }; + +void Gauge::propChanged() +{ + update(boundingRect()); // Value updated, schedule redtaw +} + + +bool Gauge::testOption(QString a){ + return m_options.contains(a); + +}; float Gauge::value() { return m_value; diff --git a/mardrone/gauges/gauge.h b/mardrone/gauges/gauge.h index 6bc10c9..04001fd 100644 --- a/mardrone/gauges/gauge.h +++ b/mardrone/gauges/gauge.h @@ -9,6 +9,8 @@ #define RIGHT 2 #define DOWN 3 #define LEFT 4 +#define COMPASS_UP 5 + #define SCROLL 0x10 #define SCROLL_UP 0x11 @@ -21,6 +23,7 @@ class Gauge : public QGraphicsWidget Q_OBJECT Q_PROPERTY(QString name READ name WRITE setName) Q_PROPERTY(QString format READ format WRITE setFormat) + Q_PROPERTY(QString options READ options WRITE setOptions) Q_PROPERTY(QFont font READ getFont WRITE setFont) Q_PROPERTY(QColor color READ getColor WRITE setColor) Q_PROPERTY(QColor backColor READ getBackColor WRITE setBackColor) @@ -35,7 +38,12 @@ class Gauge : public QGraphicsWidget Q_PROPERTY(float highRed READ highRed WRITE setHighRed) Q_PROPERTY(float tickIncrement READ tickIncrement WRITE setTickIncrement) Q_PROPERTY(float tickSpacing READ tickSpacing WRITE setTickSpacing) + Q_PROPERTY(float tickLength READ tickLength WRITE setTickLength) + Q_PROPERTY(float lineWidth READ lineWidth WRITE setLineWidth) + Q_PROPERTY(float lowPosition READ lowPosition WRITE setLowPosition) + Q_PROPERTY(float highPosition READ highPosition WRITE setHighPosition) Q_PROPERTY(int tickMinor READ tickMinor WRITE setTickMinor) + Q_PROPERTY(QImage* needleImage READ needleImage WRITE setNeedleImage ) public: explicit Gauge(QGraphicsItem *parent = 0); @@ -45,11 +53,21 @@ public: QRectF boundingRect() const; + bool testOption(QString a); + + void propChanged(); + + + QImage *needleImage() { return m_needleImage; } + void setNeedleImage(QImage *needle) { m_needleImage=needle ;}; + QString name() const { return m_name;}; - void setName(const QString &name_) {m_name=name_;} + void setName(const QString &name_) {m_name=name_;propChanged();} + QString options() const { return m_options;}; + void setOptions(const QString &options_) {m_options=options_;propChanged();} QString format() const { return m_format;}; - void setFormat(const QString &name_) {m_format=name_;} - void setGaugeStyle(int val_) { m_style=val_;}; + void setFormat(const QString &name_) {m_format=name_;propChanged();} + void setGaugeStyle(int val_) { m_style=val_;propChanged();}; int gaugeStyle() {return m_style;}; void setValue(float val_); float value(); @@ -57,28 +75,38 @@ public: float value2(); void setDisplayScale(float val_) { m_scale=val_;update(boundingRect());}; float displayScale() {return m_scale;}; - void setLow(float val_) { m_low=val_;}; + void setLow(float val_) { m_low=val_;propChanged();}; float low() {return m_low;}; - void setHigh(float val_) { m_high=val_;}; + void setHigh(float val_) { m_high=val_;propChanged();}; float high() {return m_high;}; - void setLowRed(float val_) { m_lowred=val_;}; + void setLowRed(float val_) { m_lowred=val_;propChanged();}; float lowRed() {return m_lowred;}; - void setHighRed(float val_) { m_highred=val_;}; + void setHighRed(float val_) { m_highred=val_;propChanged();}; float highRed() {return m_highred;}; - void setTickIncrement(float val_) { m_tickIncrement=val_;}; + void setTickIncrement(float val_) { m_tickIncrement=val_;propChanged();}; float tickIncrement() {return m_tickIncrement;}; - void setTickSpacing(float val_) { m_tickSpacing=val_;}; + void setTickSpacing(float val_) { m_tickSpacing=val_;propChanged();}; float tickSpacing() {return m_tickSpacing;}; - void setTickMinor(int val_) { m_tickMinor=val_;}; + + void setTickLength(float val_) { m_tickLength=val_;propChanged();}; + float tickLength() {return m_tickLength;}; + void setLineWidth(float val_) { m_lineWidth=val_;propChanged();}; + float lineWidth() {return m_lineWidth;}; + float lowPosition() {return m_lowPosition;}; + void setLowPosition(float val_) { m_lowPosition=val_;propChanged();}; + float highPosition() {return m_highPosition;}; + void setHighPosition(float val_) { m_highPosition=val_;propChanged();}; + + void setTickMinor(int val_) { m_tickMinor=val_;propChanged();}; float tickMinor() {return m_tickMinor;}; - void setFont(QFont val_) { m_font=val_;}; + void setFont(QFont val_) { m_font=val_;propChanged();}; QFont getFont() {return m_font;}; - void setColor(QColor val_) { m_color=val_;}; + void setColor(QColor val_) { m_color=val_;propChanged();}; QColor getColor() {return m_color;}; - void setBackColor(QColor val_) { m_backColor=val_;}; + void setBackColor(QColor val_) { m_backColor=val_;propChanged();}; QColor getBackColor() {return m_backColor;}; - void setBorderColor(QColor val_) { m_borderColor=val_;}; + void setBorderColor(QColor val_) { m_borderColor=val_;propChanged();}; QColor getBorderColor() {return m_borderColor;}; signals: @@ -86,6 +114,7 @@ public slots: public: QString m_name; QString m_format; + QString m_options; // Free format options string int m_tickIncrement; // Tick increment int m_tickSpacing; // Tick spacing int m_tickMinor; // Ninor, non labeled ticks @@ -99,11 +128,16 @@ public: float m_lowyellow; // low yellow limit float m_highyellow; // higest yellow limit float m_highred; + float m_tickLength; + float m_highPosition; + float m_lowPosition; + float m_lineWidth; int m_textSize; QFont m_font; QColor m_color; QColor m_backColor; QColor m_borderColor; + QImage *m_needleImage; }; #endif // GAUGE_H diff --git a/mardrone/gauges/gaugearc.cpp b/mardrone/gauges/gaugearc.cpp new file mode 100644 index 0000000..3886d17 --- /dev/null +++ b/mardrone/gauges/gaugearc.cpp @@ -0,0 +1,97 @@ +#include "gaugearc.h" + +#include "gaugetape.h" +#include +#include +#include + +GaugeArc::GaugeArc(QGraphicsItem *parent) : + Gauge(parent) +{ + QPainterPath scale; + int xo=size().width()/2; + int yo=size().height()/2; + +#define DR 3.141592653/180.0 +#if 0 + for (i = 0; i < 5; i++) { + fixo+=QLine(xo+arc0*cos(alpha*DR),yo-arc0*sin(alpha*DR),xo+arc1*cos(alpha*DR),yo-arc1*sin(alpha*DR)); + + scale.moveTo(xo+arc0*cos(alpha*DR),yo-arc0*sin(alpha*DR)); + scale.lineTo(xo+arc1*cos(alpha*DR),yo-arc1*sin(alpha*DR)); + + fixo+=QLine(xo+arc0*cos(alpha*DR),yo-arc0*sin(alpha*DR),xo+arc1*cos(alpha*DR),yo-arc1*sin(alpha*DR)); + }; +#endif +} + + +void GaugeArc::paintArcScale(QPainter *painter,int width,int height) +{ + float alpha; + int xo=(width/2); + int yo=(height/2); + int arcsize=xo-5; + painter->setTransform(QTransform().scale(m_scale,m_scale)); + QTransform savematrix= painter->transform (); + QPen pen(m_color); + pen.setWidth(m_lineWidth); + + QPen nopen(Qt::NoPen); + QBrush cbrush(m_color); + QBrush nbrush(Qt::NoBrush); + QBrush backBrush(m_backColor); + // QBrush cbrush(m_color); + painter->setBrush(cbrush); + alpha=m_lowPosition; + int val=m_low; + painter->setFont(m_font); + QFontMetrics fm(m_font); + QPolygon needle; + + painter->setTransform(QTransform().translate(xo+scenePos().x()/m_scale, yo+scenePos().y()/m_scale),true); + painter->setBrush(backBrush); + painter->setPen(nopen); + painter->drawChord(QRect(-xo,-xo,2*xo,2*xo),0,360*16); + painter->setBrush(cbrush); + painter->setPen(pen); + qDebug() << "paintArcScale" << m_lowPosition << m_highPosition; + while(alpha<=(m_highPositionsetTransform(savematrix); + painter->setTransform(QTransform().translate(xo+scenePos().x()/m_scale, yo+scenePos().y()/m_scale),true); + painter->drawArc(-arcsize,-arcsize,2*arcsize,2*arcsize,(int(m_lowPosition+270)%360)*-16,(int(m_highPosition+270)%360)*-16); + QPoint labelP=QPoint(0,-xo+15); + labelP=rotT.map(labelP); + QPoint lineInP=QPoint(0,-xo+2); + lineInP=rotT.map(lineInP); + QPoint lineOutP=QPoint(0,-xo+12); + lineOutP=rotT.map(lineOutP); + QPoint labelPo=QPoint(labelWidth*((-1-sin(3.1415926/180*alpha))/2),labelHeight*((1+cos(3.1415926/180*alpha))/2)); + QPoint labelPd=labelP+labelPo; + // qDebug() << alpha << labelP << labelPd << labelPo << labelWidth << labelHeight; + painter->drawText(labelPd,label); + painter->drawLine(lineInP,lineOutP); + alpha+=m_tickSpacing; + val+=m_tickIncrement; + } + needle+=QPoint(-5,0); + needle+=QPoint(0,-xo); + needle+=QPoint(5,0); + needle+=QPoint(-5,0); + painter->setTransform(QTransform().rotate(m_lowPosition+(m_value*1.0*m_tickSpacing/m_tickIncrement)),true); + painter->drawPolygon(needle); +} + +void GaugeArc::paint(QPainter *painter,const QStyleOptionGraphicsItem *option, + QWidget *widget) +{ + paintArcScale(painter,size().width(),size().height()); + // paintNeedle(painter,val,size().width(),size().height()); +}; + diff --git a/mardrone/gauges/gaugearc.h b/mardrone/gauges/gaugearc.h new file mode 100644 index 0000000..338cc51 --- /dev/null +++ b/mardrone/gauges/gaugearc.h @@ -0,0 +1,20 @@ +#ifndef GAUGEARC_H +#define GAUGEARC_H + + +#include "gauge.h" + + +class GaugeArc : public Gauge +{ + Q_OBJECT +public: + explicit GaugeArc(QGraphicsItem *parent = 0); + void paint(QPainter *painter,const QStyleOptionGraphicsItem *option, + QWidget *widget); + void paintArcScale(QPainter *painter,int width,int height); + + QVector fixo; +}; + +#endif // GAUGEARC_H diff --git a/mardrone/gauges/gaugehorizon.cpp b/mardrone/gauges/gaugehorizon.cpp index 6b8a7ae..02977ed 100644 --- a/mardrone/gauges/gaugehorizon.cpp +++ b/mardrone/gauges/gaugehorizon.cpp @@ -30,12 +30,12 @@ GaugeHorizon::GaugeHorizon(QGraphicsItem *parent) : m_horizonSkyColor=QColor("darkBlue"); m_horizonGroundColor=QColor("darkRed"); + m_ypos=0; + int xo=size().width()/2; int yo=size().height()/2; #define DR 3.141592653/180.0 - - int arcTable[]={30,45,60,70,80}; int i = 0; @@ -93,7 +93,9 @@ void GaugeHorizon::drawHorizon(QPainter *painter, float roll, float pitch) painter->save(); xo=(size().width()/2)/m_scale; - yo=(size().height()/2)/m_scale; + if(m_ypos) yo=m_ypos/m_scale; + else yo=(size().height()/2)/m_scale; + painter->setClipRect(QRect(0,0, size().width(),size().height())); painter->setTransform(QTransform().scale(m_scale,m_scale)); QTransform savematrix= painter->transform (); diff --git a/mardrone/gauges/gaugehorizon.h b/mardrone/gauges/gaugehorizon.h index 74a9102..66d3251 100644 --- a/mardrone/gauges/gaugehorizon.h +++ b/mardrone/gauges/gaugehorizon.h @@ -8,6 +8,8 @@ class GaugeHorizon : public Gauge Q_PROPERTY(QColor horizonGroundColor READ getHorizonGroundColor WRITE setHorizonGroundColor) Q_PROPERTY(QColor horizonSkyColor READ getHorizonSkyColor WRITE setHorizonSkyColor) Q_PROPERTY(QColor horizonLineColor READ getHorizonLineColor WRITE setHorizonLineColor) + Q_PROPERTY(int yPosition READ yPosition WRITE setYPosition) + public: explicit GaugeHorizon(QGraphicsItem *parent = 0); void paint(QPainter *painter,const QStyleOptionGraphicsItem *option, @@ -19,10 +21,12 @@ public: QColor getHorizonLineColor() {return m_horizonLineColor;}; void setHorizonGroundColor(QColor val_) { m_horizonGroundColor=val_;}; QColor getHorizonGroundColor() {return m_horizonGroundColor;}; + void setYPosition(int y) { m_ypos=y;} int yPosition(){ return m_ypos;}; private: QColor m_horizonLineColor; QColor m_horizonSkyColor; QColor m_horizonGroundColor; + int m_ypos; QVector fixo; QPolygon plane,planel,planer; QPolygon zeroTriangle; diff --git a/mardrone/gauges/gaugehsi.cpp b/mardrone/gauges/gaugehsi.cpp new file mode 100644 index 0000000..9c6661b --- /dev/null +++ b/mardrone/gauges/gaugehsi.cpp @@ -0,0 +1,101 @@ +#include "gaugehsi.h" + +GaugeHSI::GaugeHSI(QGraphicsItem *parent) : + Gauge(parent) +{ +} + +void GaugeHSI::paintHSI(QPainter *painter,int width,int height) +{ + float alpha; + int xo=(width/2)/m_scale; + int yo=(height/2)/m_scale; + painter->setTransform(QTransform().scale(m_scale,m_scale)); + QTransform savematrix= painter->transform (); + QPen pen(m_color); + pen.setWidth(1); + painter->setPen(pen); + QBrush cbrush(m_color); + painter->setBrush(cbrush); + + + QPen nopen(Qt::NoPen); + QBrush nbrush(Qt::NoBrush); + QBrush backBrush(m_backColor); + + alpha=0; + painter->setFont(m_font); + QFontMetrics fm(m_font); + QPolygon zeroTriangle; + QPolygon zeroPlane; + + zeroPlane+=QPoint(-2,0); + zeroPlane+=QPoint(-20,0); + zeroPlane+=QPoint(-20,-2); + zeroPlane+=QPoint(-2,-4); + zeroPlane+=QPoint(0,-14); + zeroPlane+=QPoint(2,-4); + zeroPlane+=QPoint(20,-2); + zeroPlane+=QPoint(20,0); + zeroPlane+=QPoint(2,0); + zeroPlane+=QPoint(2,15); + zeroPlane+=QPoint(10,15); + zeroPlane+=QPoint(10,18); + zeroPlane+=QPoint(-10,18); + zeroPlane+=QPoint(-10,15); + zeroPlane+=QPoint(-2,15); + + zeroTriangle+=QPoint(0,-xo+10); + zeroTriangle+=QPoint(-5,-xo); + zeroTriangle+=QPoint(5,-xo); + zeroTriangle+=QPoint(0,-xo+10); + + + + painter->setTransform(QTransform().translate(xo+scenePos().x()/m_scale, yo+scenePos().y()/m_scale),true); + painter->setBrush(backBrush); + painter->setPen(nopen); + painter->drawChord(QRect(-xo,-xo,2*xo,2*xo),0,360*16); + painter->setBrush(cbrush); + painter->setPen(pen); + + painter->drawPolygon(zeroTriangle); + painter->drawPolygon(zeroPlane); + + while(alpha<360) { + QString label; + painter->setTransform(savematrix); + painter->setTransform(QTransform().translate(xo+scenePos().x()/m_scale, yo+scenePos().y()/m_scale).rotate(alpha+m_value),true); + label=QString("%1").arg(alpha/10); + if(alpha==0) label=" N"; + if(alpha==90) label=" E"; + if(alpha==180) label=" S"; + if(alpha==270) label=" W"; + int labelWidth=fm.width(label); + int labelHeight=fm.height(); + painter->drawText(labelWidth/-2,-xo+10+labelHeight,label); + painter->drawLine(0,xo-2,0,xo-12); + painter->setTransform(savematrix); + painter->setTransform(QTransform().translate(xo+scenePos().x()/m_scale, yo+scenePos().y()/m_scale).rotate(alpha+m_value+10),true); + painter->drawLine(0,xo-2,0,xo-7); + painter->setTransform(savematrix); + painter->setTransform(QTransform().translate(xo+scenePos().x()/m_scale, yo+scenePos().y()/m_scale).rotate(alpha+m_value+20),true); + painter->drawLine(0,xo-2,0,xo-7); + painter->setTransform(savematrix); + painter->setTransform(QTransform().translate(xo+scenePos().x()/m_scale, yo+scenePos().y()/m_scale).rotate(alpha+m_value+5),true); + painter->drawLine(0,xo-2,0,xo-7); + painter->setTransform(savematrix); + painter->setTransform(QTransform().translate(xo+scenePos().x()/m_scale, yo+scenePos().y()/m_scale).rotate(alpha+m_value+15),true); + painter->drawLine(0,xo-2,0,xo-7); + painter->setTransform(savematrix); + painter->setTransform(QTransform().translate(xo+scenePos().x()/m_scale, yo+scenePos().y()/m_scale).rotate(alpha+m_value+25),true); + painter->drawLine(0,xo-2,0,xo-7); + alpha+=m_tickIncrement; + } +} + +void GaugeHSI::paint(QPainter *painter,const QStyleOptionGraphicsItem *option, + QWidget *widget) +{ + paintHSI(painter,size().width(),size().height()); +}; diff --git a/mardrone/gauges/gaugehsi.h b/mardrone/gauges/gaugehsi.h new file mode 100644 index 0000000..b7b726a --- /dev/null +++ b/mardrone/gauges/gaugehsi.h @@ -0,0 +1,20 @@ +#ifndef GAUGEHSI_H +#define GAUGEHSI_H +#include + +class GaugeHSI : public Gauge +{ + Q_OBJECT +public: + explicit GaugeHSI(QGraphicsItem *parent = 0); + void paint(QPainter *painter,const QStyleOptionGraphicsItem *option, + QWidget *widget); + void paintHSI(QPainter *painter,int width,int height); + +signals: + +public slots: + +}; + +#endif // GAUGEHSI_H diff --git a/mardrone/gauges/gaugelabel.cpp b/mardrone/gauges/gaugelabel.cpp index 0ae3b2b..3a62383 100644 --- a/mardrone/gauges/gaugelabel.cpp +++ b/mardrone/gauges/gaugelabel.cpp @@ -143,8 +143,8 @@ void GaugeLabel::drawFrame(QPainter *painter,int style,int hsplit,int vsplit) if (style&SCROLL) { - painter->setClipRect(QRect(xplace+width-hsplit,yplace, width+10, height)); - painter->setClipRect(QRect(xplace-5,yplace+vsplit, width+10, height-2*vsplit),Qt::UniteClip); + painter->setClipRect(QRect(xplace+width-hsplit,yplace, width+10, height+1)); + painter->setClipRect(QRect(xplace-5,yplace+vsplit, width+10, height-2*vsplit+1),Qt::UniteClip); // painter->drawRect(QRect(xplace-5,yplace, width+10, height)); } diff --git a/mardrone/gauges/gaugeplugin.cpp b/mardrone/gauges/gaugeplugin.cpp new file mode 100644 index 0000000..f62d6f5 --- /dev/null +++ b/mardrone/gauges/gaugeplugin.cpp @@ -0,0 +1,35 @@ +#include +#include +#include "gauge.h" +#include "gaugearc.h" +#include "gaugehorizon.h" +#include "gaugehsi.h" +#include "gaugelabel.h" +#include "gaugetape.h" + +#include + +class GaugeQmlModule : public QDeclarativeExtensionPlugin +{ + Q_OBJECT +public: + virtual void registerTypes(const char *uri) + { + Q_ASSERT(QString(uri)==QString("gauges")); + qmlRegisterType("gauges", 1, 0, "GaugeTape"); + qmlRegisterType("gauges", 1, 0, "GaugeLabel"); + qmlRegisterType("gauges", 1, 0, "GaugeHorizon"); + qmlRegisterType("gauges", 1, 0, "GaugeArc"); + qmlRegisterType("gauges", 1, 0, "GaugeHSI"); + } + /* void initializeEngine(QQmlEngine *engine, const char *uri) + { + Q_UNUSED(uri); + QQmlContext *context = engine->rootContext(); + context->setContextProperty(QLatin1String("Gauges"), new Qt3DNamespace); + }*/ +}; + +#include "gaugeplugin.moc" + +Q_EXPORT_PLUGIN2(gaugeqmlplugin, GaugeQmlModule); diff --git a/mardrone/gauges/gauges.pro b/mardrone/gauges/gauges.pro new file mode 100644 index 0000000..b5f5e23 --- /dev/null +++ b/mardrone/gauges/gauges.pro @@ -0,0 +1,20 @@ +TEMPLATE = lib +TARGET = gauges +CONFIG += qt plugin +QT += declarative + +SOURCES = gauge.cpp \ + gaugearc.cpp \ + gaugehorizon.cpp \ + gaugehsi.cpp \ + gaugelabel.cpp \ + gaugetape.cpp \ + gaugeplugin.cpp + +HEADERS = gauge.h \ + gaugearc.h \ + gaugehorizon.h \ + gaugehsi.h \ + gaugelabel.h \ + gaugetape.h + diff --git a/mardrone/gauges/gaugetape.cpp b/mardrone/gauges/gaugetape.cpp index 039026a..ebd3f40 100644 --- a/mardrone/gauges/gaugetape.cpp +++ b/mardrone/gauges/gaugetape.cpp @@ -24,7 +24,7 @@ void GaugeTape::paint(QPainter *painter,const QStyleOptionGraphicsItem *option, int w=size().width(); int xd; int yd; - int th=10; + int th=m_tickLength; // int y = pgs->y; // int x = pgs->x; char s[80]; @@ -43,7 +43,7 @@ void GaugeTape::paint(QPainter *painter,const QStyleOptionGraphicsItem *option, QFontMetrics fm(m_font); int fontHeight=fm.ascent(); - if (m_style == UP) { + if ((m_style == UP) || (m_style == COMPASS_UP)) { xd = 1; yd = 0; } @@ -70,7 +70,7 @@ void GaugeTape::paint(QPainter *painter,const QStyleOptionGraphicsItem *option, // float low = floor(m_value - ((h * m_tickIncrement)/(m_tickSpacing * 2))/m_tickIncrement)*m_tickIncrement; // Lowest value to display float vof = floor(m_value / m_tickIncrement) * m_tickIncrement; // Value rounded to lover tick increment float tmod= fmod (m_value,m_tickIncrement) * m_tickSpacing/m_tickIncrement; // Modulus as pixels - ntic=ceil(h/(m_tickSpacing)); + ntic=ceil((yd?h:w)/(m_tickSpacing)); float low=vof-(ntic/2)*m_tickIncrement; // fval = (m_value - ((tin + 1) * m_tickIncrement)) - (m_value%m_tickIncrement); // t = h - tin * m_tickSpacing - ((m_value%m_tickIncrement) * tpix/m_tickIncrement); @@ -80,20 +80,29 @@ void GaugeTape::paint(QPainter *painter,const QStyleOptionGraphicsItem *option, v = low; int vpix=tmod+(ntic+1)*m_tickSpacing; - if(yd) { - QBrush brush(m_backColor); - painter->setBrush(brush); + + QBrush bbrush(m_backColor); + painter->setBrush(bbrush); painter->drawRect(0,0, w,h); - painter->drawLine(0,h/2,w,h/2); + if(yd) painter->drawLine(0,h/2,w,h/2); + else painter->drawLine(w/2,0,w/2,h); painter->setClipRect(QRect(0,0,w,h)); - } + //qDebug() << "m_value=" << m_value << " vof=" << vof << " low=" << low << " vpix=" << vpix << " ntic=" << ntic << " tmod=" <0) { - - sprintf(s,"%3.0f",v); + int vv=v; + if(m_style == COMPASS_UP) { + vv=(vv+360)%360; + sprintf(s,"%3d",vv); + if(vv==0) strcpy(s," N"); + if(vv==90) strcpy(s," E"); + if(vv==180) strcpy(s," S"); + if(vv==270) strcpy(s," W"); + } else + sprintf(s,"%3.0f",v); v+=m_tickIncrement; vpix-=m_tickSpacing; i++; @@ -103,9 +112,11 @@ void GaugeTape::paint(QPainter *painter,const QStyleOptionGraphicsItem *option, painter->drawLine(0,vpix,th,vpix); for(i=0;idrawLine(0,vpix+i*(m_tickSpacing/m_tickMinor),th/2,vpix+i*(m_tickSpacing/m_tickMinor)); } - else painter->drawText(QPoint(vpix-20,30),s); - - // printf("t=%d v=%d x=%d y=%d %s\n",t,v,x+20,y+t,s); + else { + painter->drawText(QPoint(w-vpix-20,fontHeight+th),s); + painter->drawLine(w-vpix,th,w-vpix,0); + for(i=0;idrawLine(w-(vpix+i*(m_tickSpacing/m_tickMinor)),th/2,w-(vpix+i*(m_tickSpacing/m_tickMinor)),0); + } } painter->restore(); // Restore and remove clicping rectabgle diff --git a/mardrone/gauges/moc_gauge.cpp b/mardrone/gauges/moc_gauge.cpp new file mode 100644 index 0000000..a60eade --- /dev/null +++ b/mardrone/gauges/moc_gauge.cpp @@ -0,0 +1,185 @@ +/**************************************************************************** +** Meta object code from reading C++ file 'gauge.h' +** +** Created: Tue Apr 10 12:16:12 2012 +** by: The Qt Meta Object Compiler version 63 (Qt 4.8.0) +** +** WARNING! All changes made in this file will be lost! +*****************************************************************************/ + +#include "gauge.h" +#if !defined(Q_MOC_OUTPUT_REVISION) +#error "The header file 'gauge.h' doesn't include ." +#elif Q_MOC_OUTPUT_REVISION != 63 +#error "This file was generated using the moc from 4.8.0. It" +#error "cannot be used with the include files from this version of Qt." +#error "(The moc has changed too much.)" +#endif + +QT_BEGIN_MOC_NAMESPACE +static const uint qt_meta_data_Gauge[] = { + + // content: + 6, // revision + 0, // classname + 0, 0, // classinfo + 0, 0, // methods + 23, 14, // properties + 0, 0, // enums/sets + 0, 0, // constructors + 0, // flags + 0, // signalCount + + // properties: name, type, flags + 14, 6, 0x0a095103, + 19, 6, 0x0a095103, + 26, 6, 0x0a095103, + 40, 34, 0x40095103, + 52, 45, 0x43095103, + 58, 45, 0x43095103, + 68, 45, 0x43095103, + 84, 80, 0x02095103, + 101, 95, 0x87095103, + 108, 95, 0x87095103, + 114, 95, 0x87095103, + 127, 95, 0x87095103, + 131, 95, 0x87095103, + 136, 95, 0x87095103, + 143, 95, 0x87095103, + 151, 95, 0x87095103, + 165, 95, 0x87095103, + 177, 95, 0x87095103, + 188, 95, 0x87095103, + 198, 95, 0x87095103, + 210, 95, 0x87095103, + 223, 80, 0x02095103, + 241, 233, 0x0009510b, + + 0 // eod +}; + +static const char qt_meta_stringdata_Gauge[] = { + "Gauge\0QString\0name\0format\0options\0" + "QFont\0font\0QColor\0color\0backColor\0" + "borderColor\0int\0gaugeStyle\0float\0" + "value2\0value\0displayScale\0low\0high\0" + "lowRed\0highRed\0tickIncrement\0tickSpacing\0" + "tickLength\0lineWidth\0lowPosition\0" + "highPosition\0tickMinor\0QImage*\0" + "needleImage\0" +}; + +void Gauge::qt_static_metacall(QObject *_o, QMetaObject::Call _c, int _id, void **_a) +{ + Q_UNUSED(_o); + Q_UNUSED(_id); + Q_UNUSED(_c); + Q_UNUSED(_a); +} + +const QMetaObjectExtraData Gauge::staticMetaObjectExtraData = { + 0, qt_static_metacall +}; + +const QMetaObject Gauge::staticMetaObject = { + { &QGraphicsWidget::staticMetaObject, qt_meta_stringdata_Gauge, + qt_meta_data_Gauge, &staticMetaObjectExtraData } +}; + +#ifdef Q_NO_DATA_RELOCATION +const QMetaObject &Gauge::getStaticMetaObject() { return staticMetaObject; } +#endif //Q_NO_DATA_RELOCATION + +const QMetaObject *Gauge::metaObject() const +{ + return QObject::d_ptr->metaObject ? QObject::d_ptr->metaObject : &staticMetaObject; +} + +void *Gauge::qt_metacast(const char *_clname) +{ + if (!_clname) return 0; + if (!strcmp(_clname, qt_meta_stringdata_Gauge)) + return static_cast(const_cast< Gauge*>(this)); + return QGraphicsWidget::qt_metacast(_clname); +} + +int Gauge::qt_metacall(QMetaObject::Call _c, int _id, void **_a) +{ + _id = QGraphicsWidget::qt_metacall(_c, _id, _a); + if (_id < 0) + return _id; + +#ifndef QT_NO_PROPERTIES + if (_c == QMetaObject::ReadProperty) { + void *_v = _a[0]; + switch (_id) { + case 0: *reinterpret_cast< QString*>(_v) = name(); break; + case 1: *reinterpret_cast< QString*>(_v) = format(); break; + case 2: *reinterpret_cast< QString*>(_v) = options(); break; + case 3: *reinterpret_cast< QFont*>(_v) = getFont(); break; + case 4: *reinterpret_cast< QColor*>(_v) = getColor(); break; + case 5: *reinterpret_cast< QColor*>(_v) = getBackColor(); break; + case 6: *reinterpret_cast< QColor*>(_v) = getBorderColor(); break; + case 7: *reinterpret_cast< int*>(_v) = gaugeStyle(); break; + case 8: *reinterpret_cast< float*>(_v) = value2(); break; + case 9: *reinterpret_cast< float*>(_v) = value(); break; + case 10: *reinterpret_cast< float*>(_v) = displayScale(); break; + case 11: *reinterpret_cast< float*>(_v) = low(); break; + case 12: *reinterpret_cast< float*>(_v) = high(); break; + case 13: *reinterpret_cast< float*>(_v) = lowRed(); break; + case 14: *reinterpret_cast< float*>(_v) = highRed(); break; + case 15: *reinterpret_cast< float*>(_v) = tickIncrement(); break; + case 16: *reinterpret_cast< float*>(_v) = tickSpacing(); break; + case 17: *reinterpret_cast< float*>(_v) = tickLength(); break; + case 18: *reinterpret_cast< float*>(_v) = lineWidth(); break; + case 19: *reinterpret_cast< float*>(_v) = lowPosition(); break; + case 20: *reinterpret_cast< float*>(_v) = highPosition(); break; + case 21: *reinterpret_cast< int*>(_v) = tickMinor(); break; + case 22: *reinterpret_cast< QImage**>(_v) = needleImage(); break; + } + _id -= 23; + } else if (_c == QMetaObject::WriteProperty) { + void *_v = _a[0]; + switch (_id) { + case 0: setName(*reinterpret_cast< QString*>(_v)); break; + case 1: setFormat(*reinterpret_cast< QString*>(_v)); break; + case 2: setOptions(*reinterpret_cast< QString*>(_v)); break; + case 3: setFont(*reinterpret_cast< QFont*>(_v)); break; + case 4: setColor(*reinterpret_cast< QColor*>(_v)); break; + case 5: setBackColor(*reinterpret_cast< QColor*>(_v)); break; + case 6: setBorderColor(*reinterpret_cast< QColor*>(_v)); break; + case 7: setGaugeStyle(*reinterpret_cast< int*>(_v)); break; + case 8: setValue2(*reinterpret_cast< float*>(_v)); break; + case 9: setValue(*reinterpret_cast< float*>(_v)); break; + case 10: setDisplayScale(*reinterpret_cast< float*>(_v)); break; + case 11: setLow(*reinterpret_cast< float*>(_v)); break; + case 12: setHigh(*reinterpret_cast< float*>(_v)); break; + case 13: setLowRed(*reinterpret_cast< float*>(_v)); break; + case 14: setHighRed(*reinterpret_cast< float*>(_v)); break; + case 15: setTickIncrement(*reinterpret_cast< float*>(_v)); break; + case 16: setTickSpacing(*reinterpret_cast< float*>(_v)); break; + case 17: setTickLength(*reinterpret_cast< float*>(_v)); break; + case 18: setLineWidth(*reinterpret_cast< float*>(_v)); break; + case 19: setLowPosition(*reinterpret_cast< float*>(_v)); break; + case 20: setHighPosition(*reinterpret_cast< float*>(_v)); break; + case 21: setTickMinor(*reinterpret_cast< int*>(_v)); break; + case 22: setNeedleImage(*reinterpret_cast< QImage**>(_v)); break; + } + _id -= 23; + } else if (_c == QMetaObject::ResetProperty) { + _id -= 23; + } else if (_c == QMetaObject::QueryPropertyDesignable) { + _id -= 23; + } else if (_c == QMetaObject::QueryPropertyScriptable) { + _id -= 23; + } else if (_c == QMetaObject::QueryPropertyStored) { + _id -= 23; + } else if (_c == QMetaObject::QueryPropertyEditable) { + _id -= 23; + } else if (_c == QMetaObject::QueryPropertyUser) { + _id -= 23; + } +#endif // QT_NO_PROPERTIES + return _id; +} +QT_END_MOC_NAMESPACE diff --git a/mardrone/gauges/moc_gaugearc.cpp b/mardrone/gauges/moc_gaugearc.cpp new file mode 100644 index 0000000..1c35966 --- /dev/null +++ b/mardrone/gauges/moc_gaugearc.cpp @@ -0,0 +1,81 @@ +/**************************************************************************** +** Meta object code from reading C++ file 'gaugearc.h' +** +** Created: Tue Apr 10 12:16:13 2012 +** by: The Qt Meta Object Compiler version 63 (Qt 4.8.0) +** +** WARNING! All changes made in this file will be lost! +*****************************************************************************/ + +#include "gaugearc.h" +#if !defined(Q_MOC_OUTPUT_REVISION) +#error "The header file 'gaugearc.h' doesn't include ." +#elif Q_MOC_OUTPUT_REVISION != 63 +#error "This file was generated using the moc from 4.8.0. It" +#error "cannot be used with the include files from this version of Qt." +#error "(The moc has changed too much.)" +#endif + +QT_BEGIN_MOC_NAMESPACE +static const uint qt_meta_data_GaugeArc[] = { + + // content: + 6, // revision + 0, // classname + 0, 0, // classinfo + 0, 0, // methods + 0, 0, // properties + 0, 0, // enums/sets + 0, 0, // constructors + 0, // flags + 0, // signalCount + + 0 // eod +}; + +static const char qt_meta_stringdata_GaugeArc[] = { + "GaugeArc\0" +}; + +void GaugeArc::qt_static_metacall(QObject *_o, QMetaObject::Call _c, int _id, void **_a) +{ + Q_UNUSED(_o); + Q_UNUSED(_id); + Q_UNUSED(_c); + Q_UNUSED(_a); +} + +const QMetaObjectExtraData GaugeArc::staticMetaObjectExtraData = { + 0, qt_static_metacall +}; + +const QMetaObject GaugeArc::staticMetaObject = { + { &Gauge::staticMetaObject, qt_meta_stringdata_GaugeArc, + qt_meta_data_GaugeArc, &staticMetaObjectExtraData } +}; + +#ifdef Q_NO_DATA_RELOCATION +const QMetaObject &GaugeArc::getStaticMetaObject() { return staticMetaObject; } +#endif //Q_NO_DATA_RELOCATION + +const QMetaObject *GaugeArc::metaObject() const +{ + return QObject::d_ptr->metaObject ? QObject::d_ptr->metaObject : &staticMetaObject; +} + +void *GaugeArc::qt_metacast(const char *_clname) +{ + if (!_clname) return 0; + if (!strcmp(_clname, qt_meta_stringdata_GaugeArc)) + return static_cast(const_cast< GaugeArc*>(this)); + return Gauge::qt_metacast(_clname); +} + +int GaugeArc::qt_metacall(QMetaObject::Call _c, int _id, void **_a) +{ + _id = Gauge::qt_metacall(_c, _id, _a); + if (_id < 0) + return _id; + return _id; +} +QT_END_MOC_NAMESPACE diff --git a/mardrone/gauges/moc_gaugehorizon.cpp b/mardrone/gauges/moc_gaugehorizon.cpp new file mode 100644 index 0000000..9136242 --- /dev/null +++ b/mardrone/gauges/moc_gaugehorizon.cpp @@ -0,0 +1,123 @@ +/**************************************************************************** +** Meta object code from reading C++ file 'gaugehorizon.h' +** +** Created: Tue Apr 10 12:16:15 2012 +** by: The Qt Meta Object Compiler version 63 (Qt 4.8.0) +** +** WARNING! All changes made in this file will be lost! +*****************************************************************************/ + +#include "gaugehorizon.h" +#if !defined(Q_MOC_OUTPUT_REVISION) +#error "The header file 'gaugehorizon.h' doesn't include ." +#elif Q_MOC_OUTPUT_REVISION != 63 +#error "This file was generated using the moc from 4.8.0. It" +#error "cannot be used with the include files from this version of Qt." +#error "(The moc has changed too much.)" +#endif + +QT_BEGIN_MOC_NAMESPACE +static const uint qt_meta_data_GaugeHorizon[] = { + + // content: + 6, // revision + 0, // classname + 0, 0, // classinfo + 0, 0, // methods + 4, 14, // properties + 0, 0, // enums/sets + 0, 0, // constructors + 0, // flags + 0, // signalCount + + // properties: name, type, flags + 20, 13, 0x43095103, + 39, 13, 0x43095103, + 55, 13, 0x43095103, + 76, 72, 0x02095103, + + 0 // eod +}; + +static const char qt_meta_stringdata_GaugeHorizon[] = { + "GaugeHorizon\0QColor\0horizonGroundColor\0" + "horizonSkyColor\0horizonLineColor\0int\0" + "yPosition\0" +}; + +void GaugeHorizon::qt_static_metacall(QObject *_o, QMetaObject::Call _c, int _id, void **_a) +{ + Q_UNUSED(_o); + Q_UNUSED(_id); + Q_UNUSED(_c); + Q_UNUSED(_a); +} + +const QMetaObjectExtraData GaugeHorizon::staticMetaObjectExtraData = { + 0, qt_static_metacall +}; + +const QMetaObject GaugeHorizon::staticMetaObject = { + { &Gauge::staticMetaObject, qt_meta_stringdata_GaugeHorizon, + qt_meta_data_GaugeHorizon, &staticMetaObjectExtraData } +}; + +#ifdef Q_NO_DATA_RELOCATION +const QMetaObject &GaugeHorizon::getStaticMetaObject() { return staticMetaObject; } +#endif //Q_NO_DATA_RELOCATION + +const QMetaObject *GaugeHorizon::metaObject() const +{ + return QObject::d_ptr->metaObject ? QObject::d_ptr->metaObject : &staticMetaObject; +} + +void *GaugeHorizon::qt_metacast(const char *_clname) +{ + if (!_clname) return 0; + if (!strcmp(_clname, qt_meta_stringdata_GaugeHorizon)) + return static_cast(const_cast< GaugeHorizon*>(this)); + return Gauge::qt_metacast(_clname); +} + +int GaugeHorizon::qt_metacall(QMetaObject::Call _c, int _id, void **_a) +{ + _id = Gauge::qt_metacall(_c, _id, _a); + if (_id < 0) + return _id; + +#ifndef QT_NO_PROPERTIES + if (_c == QMetaObject::ReadProperty) { + void *_v = _a[0]; + switch (_id) { + case 0: *reinterpret_cast< QColor*>(_v) = getHorizonGroundColor(); break; + case 1: *reinterpret_cast< QColor*>(_v) = getHorizonSkyColor(); break; + case 2: *reinterpret_cast< QColor*>(_v) = getHorizonLineColor(); break; + case 3: *reinterpret_cast< int*>(_v) = yPosition(); break; + } + _id -= 4; + } else if (_c == QMetaObject::WriteProperty) { + void *_v = _a[0]; + switch (_id) { + case 0: setHorizonGroundColor(*reinterpret_cast< QColor*>(_v)); break; + case 1: setHorizonSkyColor(*reinterpret_cast< QColor*>(_v)); break; + case 2: setHorizonLineColor(*reinterpret_cast< QColor*>(_v)); break; + case 3: setYPosition(*reinterpret_cast< int*>(_v)); break; + } + _id -= 4; + } else if (_c == QMetaObject::ResetProperty) { + _id -= 4; + } else if (_c == QMetaObject::QueryPropertyDesignable) { + _id -= 4; + } else if (_c == QMetaObject::QueryPropertyScriptable) { + _id -= 4; + } else if (_c == QMetaObject::QueryPropertyStored) { + _id -= 4; + } else if (_c == QMetaObject::QueryPropertyEditable) { + _id -= 4; + } else if (_c == QMetaObject::QueryPropertyUser) { + _id -= 4; + } +#endif // QT_NO_PROPERTIES + return _id; +} +QT_END_MOC_NAMESPACE diff --git a/mardrone/gauges/moc_gaugehsi.cpp b/mardrone/gauges/moc_gaugehsi.cpp new file mode 100644 index 0000000..de7527b --- /dev/null +++ b/mardrone/gauges/moc_gaugehsi.cpp @@ -0,0 +1,81 @@ +/**************************************************************************** +** Meta object code from reading C++ file 'gaugehsi.h' +** +** Created: Tue Apr 10 12:16:16 2012 +** by: The Qt Meta Object Compiler version 63 (Qt 4.8.0) +** +** WARNING! All changes made in this file will be lost! +*****************************************************************************/ + +#include "gaugehsi.h" +#if !defined(Q_MOC_OUTPUT_REVISION) +#error "The header file 'gaugehsi.h' doesn't include ." +#elif Q_MOC_OUTPUT_REVISION != 63 +#error "This file was generated using the moc from 4.8.0. It" +#error "cannot be used with the include files from this version of Qt." +#error "(The moc has changed too much.)" +#endif + +QT_BEGIN_MOC_NAMESPACE +static const uint qt_meta_data_GaugeHSI[] = { + + // content: + 6, // revision + 0, // classname + 0, 0, // classinfo + 0, 0, // methods + 0, 0, // properties + 0, 0, // enums/sets + 0, 0, // constructors + 0, // flags + 0, // signalCount + + 0 // eod +}; + +static const char qt_meta_stringdata_GaugeHSI[] = { + "GaugeHSI\0" +}; + +void GaugeHSI::qt_static_metacall(QObject *_o, QMetaObject::Call _c, int _id, void **_a) +{ + Q_UNUSED(_o); + Q_UNUSED(_id); + Q_UNUSED(_c); + Q_UNUSED(_a); +} + +const QMetaObjectExtraData GaugeHSI::staticMetaObjectExtraData = { + 0, qt_static_metacall +}; + +const QMetaObject GaugeHSI::staticMetaObject = { + { &Gauge::staticMetaObject, qt_meta_stringdata_GaugeHSI, + qt_meta_data_GaugeHSI, &staticMetaObjectExtraData } +}; + +#ifdef Q_NO_DATA_RELOCATION +const QMetaObject &GaugeHSI::getStaticMetaObject() { return staticMetaObject; } +#endif //Q_NO_DATA_RELOCATION + +const QMetaObject *GaugeHSI::metaObject() const +{ + return QObject::d_ptr->metaObject ? QObject::d_ptr->metaObject : &staticMetaObject; +} + +void *GaugeHSI::qt_metacast(const char *_clname) +{ + if (!_clname) return 0; + if (!strcmp(_clname, qt_meta_stringdata_GaugeHSI)) + return static_cast(const_cast< GaugeHSI*>(this)); + return Gauge::qt_metacast(_clname); +} + +int GaugeHSI::qt_metacall(QMetaObject::Call _c, int _id, void **_a) +{ + _id = Gauge::qt_metacall(_c, _id, _a); + if (_id < 0) + return _id; + return _id; +} +QT_END_MOC_NAMESPACE diff --git a/mardrone/gauges/moc_gaugelabel.cpp b/mardrone/gauges/moc_gaugelabel.cpp new file mode 100644 index 0000000..20eb986 --- /dev/null +++ b/mardrone/gauges/moc_gaugelabel.cpp @@ -0,0 +1,81 @@ +/**************************************************************************** +** Meta object code from reading C++ file 'gaugelabel.h' +** +** Created: Tue Apr 10 12:16:17 2012 +** by: The Qt Meta Object Compiler version 63 (Qt 4.8.0) +** +** WARNING! All changes made in this file will be lost! +*****************************************************************************/ + +#include "gaugelabel.h" +#if !defined(Q_MOC_OUTPUT_REVISION) +#error "The header file 'gaugelabel.h' doesn't include ." +#elif Q_MOC_OUTPUT_REVISION != 63 +#error "This file was generated using the moc from 4.8.0. It" +#error "cannot be used with the include files from this version of Qt." +#error "(The moc has changed too much.)" +#endif + +QT_BEGIN_MOC_NAMESPACE +static const uint qt_meta_data_GaugeLabel[] = { + + // content: + 6, // revision + 0, // classname + 0, 0, // classinfo + 0, 0, // methods + 0, 0, // properties + 0, 0, // enums/sets + 0, 0, // constructors + 0, // flags + 0, // signalCount + + 0 // eod +}; + +static const char qt_meta_stringdata_GaugeLabel[] = { + "GaugeLabel\0" +}; + +void GaugeLabel::qt_static_metacall(QObject *_o, QMetaObject::Call _c, int _id, void **_a) +{ + Q_UNUSED(_o); + Q_UNUSED(_id); + Q_UNUSED(_c); + Q_UNUSED(_a); +} + +const QMetaObjectExtraData GaugeLabel::staticMetaObjectExtraData = { + 0, qt_static_metacall +}; + +const QMetaObject GaugeLabel::staticMetaObject = { + { &Gauge::staticMetaObject, qt_meta_stringdata_GaugeLabel, + qt_meta_data_GaugeLabel, &staticMetaObjectExtraData } +}; + +#ifdef Q_NO_DATA_RELOCATION +const QMetaObject &GaugeLabel::getStaticMetaObject() { return staticMetaObject; } +#endif //Q_NO_DATA_RELOCATION + +const QMetaObject *GaugeLabel::metaObject() const +{ + return QObject::d_ptr->metaObject ? QObject::d_ptr->metaObject : &staticMetaObject; +} + +void *GaugeLabel::qt_metacast(const char *_clname) +{ + if (!_clname) return 0; + if (!strcmp(_clname, qt_meta_stringdata_GaugeLabel)) + return static_cast(const_cast< GaugeLabel*>(this)); + return Gauge::qt_metacast(_clname); +} + +int GaugeLabel::qt_metacall(QMetaObject::Call _c, int _id, void **_a) +{ + _id = Gauge::qt_metacall(_c, _id, _a); + if (_id < 0) + return _id; + return _id; +} +QT_END_MOC_NAMESPACE diff --git a/mardrone/gauges/moc_gaugetape.cpp b/mardrone/gauges/moc_gaugetape.cpp new file mode 100644 index 0000000..f9d3f5b --- /dev/null +++ b/mardrone/gauges/moc_gaugetape.cpp @@ -0,0 +1,81 @@ +/**************************************************************************** +** Meta object code from reading C++ file 'gaugetape.h' +** +** Created: Tue Apr 10 12:16:19 2012 +** by: The Qt Meta Object Compiler version 63 (Qt 4.8.0) +** +** WARNING! All changes made in this file will be lost! +*****************************************************************************/ + +#include "gaugetape.h" +#if !defined(Q_MOC_OUTPUT_REVISION) +#error "The header file 'gaugetape.h' doesn't include ." +#elif Q_MOC_OUTPUT_REVISION != 63 +#error "This file was generated using the moc from 4.8.0. It" +#error "cannot be used with the include files from this version of Qt." +#error "(The moc has changed too much.)" +#endif + +QT_BEGIN_MOC_NAMESPACE +static const uint qt_meta_data_GaugeTape[] = { + + // content: + 6, // revision + 0, // classname + 0, 0, // classinfo + 0, 0, // methods + 0, 0, // properties + 0, 0, // enums/sets + 0, 0, // constructors + 0, // flags + 0, // signalCount + + 0 // eod +}; + +static const char qt_meta_stringdata_GaugeTape[] = { + "GaugeTape\0" +}; + +void GaugeTape::qt_static_metacall(QObject *_o, QMetaObject::Call _c, int _id, void **_a) +{ + Q_UNUSED(_o); + Q_UNUSED(_id); + Q_UNUSED(_c); + Q_UNUSED(_a); +} + +const QMetaObjectExtraData GaugeTape::staticMetaObjectExtraData = { + 0, qt_static_metacall +}; + +const QMetaObject GaugeTape::staticMetaObject = { + { &Gauge::staticMetaObject, qt_meta_stringdata_GaugeTape, + qt_meta_data_GaugeTape, &staticMetaObjectExtraData } +}; + +#ifdef Q_NO_DATA_RELOCATION +const QMetaObject &GaugeTape::getStaticMetaObject() { return staticMetaObject; } +#endif //Q_NO_DATA_RELOCATION + +const QMetaObject *GaugeTape::metaObject() const +{ + return QObject::d_ptr->metaObject ? QObject::d_ptr->metaObject : &staticMetaObject; +} + +void *GaugeTape::qt_metacast(const char *_clname) +{ + if (!_clname) return 0; + if (!strcmp(_clname, qt_meta_stringdata_GaugeTape)) + return static_cast(const_cast< GaugeTape*>(this)); + return Gauge::qt_metacast(_clname); +} + +int GaugeTape::qt_metacall(QMetaObject::Call _c, int _id, void **_a) +{ + _id = Gauge::qt_metacall(_c, _id, _a); + if (_id < 0) + return _id; + return _id; +} +QT_END_MOC_NAMESPACE -- 1.7.9.5