1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-01-17 02:52:12 +01:00

OP-60 : Working version of analog dial with horizontal/vertical option, and up to three needles. First try at attitude indicator dial in artwork/Dials/defaultset/attitude.svg

git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@773 ebee16cc-31ac-478f-84a7-5cbb03baadba
This commit is contained in:
edouard 2010-06-14 20:10:37 +00:00 committed by edouard
parent e94befbc1c
commit 2465307431
11 changed files with 1823 additions and 449 deletions

View File

@ -12,3 +12,6 @@ extracts directory:
TODO: ideally, extracting the layers from the master SVG should be automated, but for now we are doing it manually.
defaultset directory:
This directory contains dials which are ready for use in the GCS.

View File

@ -0,0 +1,509 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="304.01532"
height="289.8732"
id="svg10068"
version="1.1"
inkscape:version="0.47 r22583"
sodipodi:docname="attitude-4thtry.svg"
inkscape:export-filename="H:\Documents\Hobbies\W433\My Gauges\heading-001.png"
inkscape:export-xdpi="103.61"
inkscape:export-ydpi="103.61"
style="display:inline">
<defs
id="defs10070">
<marker
inkscape:stockid="Arrow2Sstart"
orient="auto"
refY="0"
refX="0"
id="Arrow2Sstart"
style="overflow:visible">
<path
id="path4640"
style="font-size:12px;fill-rule:evenodd;stroke-width:0.625;stroke-linejoin:round"
d="M 8.7185878,4.0337352 -2.2072895,0.01601326 8.7185884,-4.0017078 c -1.7454984,2.3720609 -1.7354408,5.6174519 -6e-7,8.035443 z"
transform="matrix(0.3,0,0,0.3,-0.69,0)" />
</marker>
<inkscape:perspective
sodipodi:type="inkscape:persp3d"
inkscape:vp_x="0 : 526.18109 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_z="744.09448 : 526.18109 : 1"
inkscape:persp3d-origin="372.04724 : 350.78739 : 1"
id="perspective10076" />
<inkscape:perspective
id="perspective9987"
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
inkscape:vp_z="1 : 0.5 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_x="0 : 0.5 : 1"
sodipodi:type="inkscape:persp3d" />
<inkscape:perspective
id="perspective10250"
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
inkscape:vp_z="1 : 0.5 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_x="0 : 0.5 : 1"
sodipodi:type="inkscape:persp3d" />
<inkscape:perspective
id="perspective10279"
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
inkscape:vp_z="1 : 0.5 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_x="0 : 0.5 : 1"
sodipodi:type="inkscape:persp3d" />
<inkscape:perspective
id="perspective10517"
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
inkscape:vp_z="1 : 0.5 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_x="0 : 0.5 : 1"
sodipodi:type="inkscape:persp3d" />
<inkscape:perspective
id="perspective11202"
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
inkscape:vp_z="1 : 0.5 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_x="0 : 0.5 : 1"
sodipodi:type="inkscape:persp3d" />
<inkscape:perspective
id="perspective3720"
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
inkscape:vp_z="1 : 0.5 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_x="0 : 0.5 : 1"
sodipodi:type="inkscape:persp3d" />
<inkscape:perspective
id="perspective3735"
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
inkscape:vp_z="1 : 0.5 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_x="0 : 0.5 : 1"
sodipodi:type="inkscape:persp3d" />
<inkscape:perspective
id="perspective3757"
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
inkscape:vp_z="1 : 0.5 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_x="0 : 0.5 : 1"
sodipodi:type="inkscape:persp3d" />
<inkscape:perspective
id="perspective3828"
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
inkscape:vp_z="1 : 0.5 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_x="0 : 0.5 : 1"
sodipodi:type="inkscape:persp3d" />
<inkscape:perspective
id="perspective3889"
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
inkscape:vp_z="1 : 0.5 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_x="0 : 0.5 : 1"
sodipodi:type="inkscape:persp3d" />
<inkscape:perspective
id="perspective3925"
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
inkscape:vp_z="1 : 0.5 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_x="0 : 0.5 : 1"
sodipodi:type="inkscape:persp3d" />
<inkscape:perspective
id="perspective3968"
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
inkscape:vp_z="1 : 0.5 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_x="0 : 0.5 : 1"
sodipodi:type="inkscape:persp3d" />
<inkscape:perspective
id="perspective3982"
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
inkscape:vp_z="1 : 0.5 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_x="0 : 0.5 : 1"
sodipodi:type="inkscape:persp3d" />
<inkscape:perspective
id="perspective4682"
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
inkscape:vp_z="1 : 0.5 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_x="0 : 0.5 : 1"
sodipodi:type="inkscape:persp3d" />
<inkscape:perspective
id="perspective3347"
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
inkscape:vp_z="1 : 0.5 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_x="0 : 0.5 : 1"
sodipodi:type="inkscape:persp3d" />
<inkscape:perspective
id="perspective5659"
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
inkscape:vp_z="1 : 0.5 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_x="0 : 0.5 : 1"
sodipodi:type="inkscape:persp3d" />
<inkscape:perspective
id="perspective5719"
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
inkscape:vp_z="1 : 0.5 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_x="0 : 0.5 : 1"
sodipodi:type="inkscape:persp3d" />
<inkscape:perspective
id="perspective5810"
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
inkscape:vp_z="1 : 0.5 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_x="0 : 0.5 : 1"
sodipodi:type="inkscape:persp3d" />
<inkscape:perspective
id="perspective3546"
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
inkscape:vp_z="1 : 0.5 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_x="0 : 0.5 : 1"
sodipodi:type="inkscape:persp3d" />
<inkscape:perspective
id="perspective4328"
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
inkscape:vp_z="1 : 0.5 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_x="0 : 0.5 : 1"
sodipodi:type="inkscape:persp3d" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient8928"
id="linearGradient5318"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(2.2532936,0,0,2.206809,446.89077,-285.33499)"
x1="-29.837337"
y1="285.0596"
x2="-29.837337"
y2="342.60553" />
<linearGradient
id="linearGradient8928">
<stop
style="stop-color:#ffffff;stop-opacity:0.89156628;"
offset="0"
id="stop8930" />
<stop
style="stop-color:#ffffff;stop-opacity:0;"
offset="1"
id="stop8932" />
</linearGradient>
<linearGradient
y2="342.60553"
x2="-29.837337"
y1="285.0596"
x1="-29.837337"
gradientTransform="matrix(2.2300513,0,0,2.206809,217.88644,-653.85766)"
gradientUnits="userSpaceOnUse"
id="linearGradient4337"
xlink:href="#linearGradient8928"
inkscape:collect="always" />
<inkscape:perspective
id="perspective4367"
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
inkscape:vp_z="1 : 0.5 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_x="0 : 0.5 : 1"
sodipodi:type="inkscape:persp3d" />
<inkscape:perspective
id="perspective3691"
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
inkscape:vp_z="1 : 0.5 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_x="0 : 0.5 : 1"
sodipodi:type="inkscape:persp3d" />
<inkscape:perspective
id="perspective3726"
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
inkscape:vp_z="1 : 0.5 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_x="0 : 0.5 : 1"
sodipodi:type="inkscape:persp3d" />
</defs>
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="0.9899495"
inkscape:cx="145.87853"
inkscape:cy="206.64106"
inkscape:document-units="px"
inkscape:current-layer="layer2"
showgrid="false"
inkscape:window-width="1280"
inkscape:window-height="744"
inkscape:window-x="-4"
inkscape:window-y="-4"
inkscape:window-maximized="1"
inkscape:object-paths="true"
showguides="true"
inkscape:guide-bbox="true"
inkscape:snap-to-guides="false"
inkscape:snap-grids="false"
inkscape:snap-global="false" />
<metadata
id="metadata10073">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
<dc:creator>
<cc:Agent>
<dc:title>Edouard Lafargue</dc:title>
</cc:Agent>
</dc:creator>
</cc:Work>
</rdf:RDF>
</metadata>
<g
inkscape:groupmode="layer"
id="layer5"
inkscape:label="Attitude Background (rotating)"
style="display:inline"
transform="translate(-228.56377,-366.85416)">
<g
id="needle"
inkscape:label="#g3042">
<g
id="g2887">
<rect
ry="0"
y="511.65222"
x="227.84949"
height="291.89099"
width="305.71429"
id="rect3724"
style="fill:#a56a33;fill-opacity:1;stroke:none" />
<rect
style="fill:#6589e2;fill-opacity:1;stroke:none"
id="rect2942"
width="305.71429"
height="291.89099"
x="227.84949"
y="220.55035"
ry="0" />
</g>
<g
id="g2891"
transform="translate(0,-2.7650825)">
<path
id="path3777"
d="m 361.8629,495.97025 35.35534,0"
style="fill:none;stroke:#fff5f5;stroke-width:4;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;display:inline" />
<path
style="fill:none;stroke:#fff5f5;stroke-width:4.53458357;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;display:inline"
d="m 350.34381,458.15569 58.39352,0"
id="path3867" />
<path
style="fill:none;stroke:#fff5f5;stroke-width:4;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;display:inline"
d="m 361.86289,533.78481 35.35535,0"
id="path3869" />
<path
id="path3871"
d="m 349.16743,571.59938 60.74627,0"
style="fill:none;stroke:#fff5f5;stroke-width:4.27190733;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;display:inline" />
<path
style="fill:none;stroke:#fff5f5;stroke-width:2.50706863;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;display:inline"
d="m 365.65168,478.06297 27.77778,0"
id="path2897" />
<path
id="path2899"
d="m 366.06514,553.43828 26.95085,0"
style="fill:none;stroke:#fff5f5;stroke-width:2.64286137;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;display:inline" />
</g>
<text
xml:space="preserve"
style="font-size:40px;font-style:normal;font-weight:normal;fill:#ffffff;fill-opacity:1;stroke:none;font-family:Bitstream Vera Sans"
x="409.38107"
y="536.45831"
id="text2901"><tspan
sodipodi:role="line"
id="tspan2903"
x="409.38107"
y="536.45831"
style="font-size:16px;font-weight:bold;fill:#ffffff;fill-opacity:1;font-family:Arial;-inkscape-font-specification:Arial Bold">5</tspan></text>
<text
xml:space="preserve"
style="font-size:40px;font-style:normal;font-weight:normal;fill:#ffffff;fill-opacity:1;stroke:none;display:inline;font-family:Bitstream Vera Sans"
x="424.01147"
y="573.42535"
id="text2901-1"><tspan
sodipodi:role="line"
id="tspan2903-7"
x="424.01147"
y="573.42535"
style="font-size:16px;font-weight:bold;fill:#ffffff;fill-opacity:1;font-family:Arial;-inkscape-font-specification:Arial Bold">15</tspan></text>
<text
id="text3708"
y="498.45831"
x="409.38107"
style="font-size:40px;font-style:normal;font-weight:normal;fill:#ffffff;fill-opacity:1;stroke:none;font-family:Bitstream Vera Sans"
xml:space="preserve"><tspan
style="font-size:16px;font-weight:bold;fill:#ffffff;fill-opacity:1;font-family:Arial;-inkscape-font-specification:Arial Bold"
y="498.45831"
x="409.38107"
id="tspan3710"
sodipodi:role="line">5</tspan></text>
<text
id="text3712"
y="461.42535"
x="424.01147"
style="font-size:40px;font-style:normal;font-weight:normal;fill:#ffffff;fill-opacity:1;stroke:none;display:inline;font-family:Bitstream Vera Sans"
xml:space="preserve"><tspan
style="font-size:16px;font-weight:bold;fill:#ffffff;fill-opacity:1;font-family:Arial;-inkscape-font-specification:Arial Bold"
y="461.42535"
x="424.01147"
id="tspan3714"
sodipodi:role="line">15</tspan></text>
</g>
</g>
<g
inkscape:groupmode="layer"
id="layer2"
inkscape:label="needle3"
style="display:inline">
<g
id="needle3"
inkscape:label="#g3785">
<path
sodipodi:nodetypes="cccssccsc"
id="path3746"
d="M 151.09375,11.875 C 77.730977,11.874997 18.250003,71.355977 18.25,144.71875 l 18,0 c 0.01699,-63.027495 53.124787,-114.125003 116.15625,-114.125 63.04194,3e-6 116.15625,51.114309 116.15625,114.15625 0,0.0343 -3.99997,0.0595 -4,0.0937 l 19.375,0 c 3e-5,-0.0399 0,-0.0851 0,-0.125 0,-73.362773 -59.48097,-132.843747 -132.84375,-132.84375 z"
style="fill:#6589e2;fill-opacity:1;stroke:none" />
<rect
y="-0.040580746"
x="-1.0101526"
height="289.91379"
width="307.08636"
id="rect3805"
style="fill:none;stroke:none" />
<g
id="g3762"
style="display:inline"
transform="translate(-228.56377,-366.85416)">
<path
inkscape:transform-center-y="-124.79982"
id="path3736"
d="m 380.57142,378.25504 0,17.67857"
style="fill:none;stroke:#ffffff;stroke-width:12;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;display:inline" />
<path
inkscape:transform-center-x="-21.671261"
style="fill:none;stroke:#ffffff;stroke-width:6;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;display:inline"
d="m 403.77761,380.28532 -3.06985,17.40999"
id="path3756"
inkscape:transform-center-y="-122.90383" />
<path
inkscape:transform-center-y="-117.27347"
id="path3758"
d="m 426.27869,386.31447 -6.04643,16.61241"
style="fill:none;stroke:#ffffff;stroke-width:6;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;display:inline"
inkscape:transform-center-x="-42.684053" />
<path
inkscape:transform-center-x="-62.399913"
style="fill:none;stroke:#ffffff;stroke-width:12;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;display:inline"
d="m 447.39098,396.15929 -8.83929,15.31008"
id="path3760"
inkscape:transform-center-y="-108.07981" />
<path
inkscape:transform-center-x="21.671261"
style="fill:none;stroke:#ffffff;stroke-width:6;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;display:inline"
d="m 357.36523,380.28532 3.06985,17.40999"
id="path3762"
inkscape:transform-center-y="-122.90383" />
<path
inkscape:transform-center-y="-117.27347"
id="path3764"
d="m 334.86415,386.31447 6.04643,16.61241"
style="fill:none;stroke:#ffffff;stroke-width:6;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;display:inline"
inkscape:transform-center-x="42.684052" />
<path
inkscape:transform-center-x="62.39991"
style="fill:none;stroke:#ffffff;stroke-width:12;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;display:inline"
d="m 313.75187,396.15929 8.83928,15.31008"
id="path3766"
inkscape:transform-center-y="-108.07981" />
<path
inkscape:transform-center-x="108.07981"
style="fill:none;stroke:#ffffff;stroke-width:12;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;display:inline"
d="m 264.83656,445.07459 15.31009,8.83929"
id="path3788"
inkscape:transform-center-y="-62.39991" />
<path
inkscape:transform-center-x="-108.07981"
style="fill:none;stroke:#ffffff;stroke-width:12;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;display:inline"
d="m 496.30628,445.07459 -15.31009,8.83929"
id="path3790"
inkscape:transform-center-y="-62.39991" />
</g>
</g>
</g>
<g
inkscape:groupmode="layer"
id="layer6"
inkscape:label="Foreground"
style="display:inline"
transform="translate(-228.56377,-366.85416)">
<g
style="display:inline"
id="foreground"
inkscape:label="#g5367">
<g
id="g4687"
style="display:inline">
<path
id="rect2936"
transform="translate(228.56377,366.85416)"
d="m 23.1875,2.09375 c -11.679256,0 -21.09375,9.414494 -21.09375,21.09375 l 0,243.5 c 0,11.67926 9.414494,21.09375 21.09375,21.09375 l 257.65625,0 c 11.67926,0 21.0625,-9.41449 21.0625,-21.09375 l 0,-243.5 c 0,-11.679256 -9.38324,-21.09375 -21.0625,-21.09375 l -257.65625,0 z M 152,7.5625 c 75.87329,0 137.375,61.501705 137.375,137.375 0,75.87329 -61.50171,137.375 -137.375,137.375 -75.873295,0 -137.375,-61.50171 -137.375,-137.375 C 14.625,69.064205 76.126705,7.5625 152,7.5625 z"
style="fill:#453e3e;fill-opacity:1;stroke:#000000;stroke-width:4.19884777;stroke-miterlimit:10;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0" />
</g>
<g
id="g3876">
<path
style="fill:none;stroke:#f17f07;stroke-width:7;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:5;stroke-opacity:1;stroke-dasharray:none"
d="m 298.72122,511.59023 61.11423,0 9.12157,9.12158 13.46461,-7.77379"
id="path3775"
sodipodi:nodetypes="cc" />
<path
sodipodi:type="arc"
style="fill:#ff6600;fill-opacity:1;stroke:#f17f07;stroke-width:5;stroke-linecap:round;stroke-miterlimit:5;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0"
id="path3781"
sodipodi:cx="347.49246"
sodipodi:cy="461.42294"
sodipodi:rx="3.0304577"
sodipodi:ry="3.0304577"
d="m 350.52292,461.42294 a 3.0304577,3.0304577 0 1 1 -6.06092,0 3.0304577,3.0304577 0 1 1 6.06092,0 z"
transform="translate(33.07896,50.167284)" />
<path
sodipodi:nodetypes="cc"
id="path3723"
d="m 462.42163,511.59023 -61.11423,0 -9.12158,9.12158 -13.46461,-7.77379"
style="fill:none;stroke:#f17f07;stroke-width:7;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:5;stroke-opacity:1;stroke-dasharray:none" />
</g>
<path
id="path3779"
d="m 370.42474,377.15541 20.29336,0.0329 -10.36931,19.46879 -9.92405,-19.50168 z"
style="fill:#ff251b;fill-opacity:1;stroke:#ff251b;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;display:inline" />
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 21 KiB

View File

@ -0,0 +1,397 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="60.184925"
height="318.58304"
id="svg10068"
version="1.1"
inkscape:version="0.47 r22583"
sodipodi:docname="simpledial-vertical.svg"
inkscape:export-filename="H:\Documents\Hobbies\W433\My Gauges\vbat-001.png"
inkscape:export-xdpi="103.61"
inkscape:export-ydpi="103.61"
style="display:inline">
<defs
id="defs10070">
<marker
inkscape:stockid="Arrow2Sstart"
orient="auto"
refY="0"
refX="0"
id="Arrow2Sstart"
style="overflow:visible">
<path
id="path4640"
style="font-size:12px;fill-rule:evenodd;stroke-width:0.625;stroke-linejoin:round"
d="M 8.7185878,4.0337352 -2.2072895,0.01601326 8.7185884,-4.0017078 c -1.7454984,2.3720609 -1.7354408,5.6174519 -6e-7,8.035443 z"
transform="matrix(0.3,0,0,0.3,-0.69,0)" />
</marker>
<inkscape:perspective
sodipodi:type="inkscape:persp3d"
inkscape:vp_x="0 : 526.18109 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_z="744.09448 : 526.18109 : 1"
inkscape:persp3d-origin="372.04724 : 350.78739 : 1"
id="perspective10076" />
<inkscape:perspective
id="perspective9987"
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
inkscape:vp_z="1 : 0.5 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_x="0 : 0.5 : 1"
sodipodi:type="inkscape:persp3d" />
<inkscape:perspective
id="perspective10250"
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
inkscape:vp_z="1 : 0.5 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_x="0 : 0.5 : 1"
sodipodi:type="inkscape:persp3d" />
<inkscape:perspective
id="perspective10279"
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
inkscape:vp_z="1 : 0.5 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_x="0 : 0.5 : 1"
sodipodi:type="inkscape:persp3d" />
<inkscape:perspective
id="perspective10517"
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
inkscape:vp_z="1 : 0.5 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_x="0 : 0.5 : 1"
sodipodi:type="inkscape:persp3d" />
<inkscape:perspective
id="perspective11202"
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
inkscape:vp_z="1 : 0.5 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_x="0 : 0.5 : 1"
sodipodi:type="inkscape:persp3d" />
<inkscape:perspective
id="perspective3720"
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
inkscape:vp_z="1 : 0.5 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_x="0 : 0.5 : 1"
sodipodi:type="inkscape:persp3d" />
<inkscape:perspective
id="perspective3735"
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
inkscape:vp_z="1 : 0.5 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_x="0 : 0.5 : 1"
sodipodi:type="inkscape:persp3d" />
<inkscape:perspective
id="perspective3757"
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
inkscape:vp_z="1 : 0.5 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_x="0 : 0.5 : 1"
sodipodi:type="inkscape:persp3d" />
<inkscape:perspective
id="perspective3828"
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
inkscape:vp_z="1 : 0.5 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_x="0 : 0.5 : 1"
sodipodi:type="inkscape:persp3d" />
<inkscape:perspective
id="perspective3889"
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
inkscape:vp_z="1 : 0.5 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_x="0 : 0.5 : 1"
sodipodi:type="inkscape:persp3d" />
<inkscape:perspective
id="perspective3925"
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
inkscape:vp_z="1 : 0.5 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_x="0 : 0.5 : 1"
sodipodi:type="inkscape:persp3d" />
<inkscape:perspective
id="perspective3968"
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
inkscape:vp_z="1 : 0.5 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_x="0 : 0.5 : 1"
sodipodi:type="inkscape:persp3d" />
<inkscape:perspective
id="perspective3982"
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
inkscape:vp_z="1 : 0.5 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_x="0 : 0.5 : 1"
sodipodi:type="inkscape:persp3d" />
<inkscape:perspective
id="perspective4682"
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
inkscape:vp_z="1 : 0.5 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_x="0 : 0.5 : 1"
sodipodi:type="inkscape:persp3d" />
<inkscape:perspective
id="perspective3347"
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
inkscape:vp_z="1 : 0.5 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_x="0 : 0.5 : 1"
sodipodi:type="inkscape:persp3d" />
<inkscape:perspective
id="perspective5659"
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
inkscape:vp_z="1 : 0.5 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_x="0 : 0.5 : 1"
sodipodi:type="inkscape:persp3d" />
<inkscape:perspective
id="perspective5719"
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
inkscape:vp_z="1 : 0.5 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_x="0 : 0.5 : 1"
sodipodi:type="inkscape:persp3d" />
<inkscape:perspective
id="perspective5810"
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
inkscape:vp_z="1 : 0.5 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_x="0 : 0.5 : 1"
sodipodi:type="inkscape:persp3d" />
<inkscape:perspective
id="perspective3546"
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
inkscape:vp_z="1 : 0.5 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_x="0 : 0.5 : 1"
sodipodi:type="inkscape:persp3d" />
<inkscape:perspective
id="perspective4328"
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
inkscape:vp_z="1 : 0.5 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_x="0 : 0.5 : 1"
sodipodi:type="inkscape:persp3d" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient8928"
id="linearGradient5318"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(2.2532936,0,0,2.206809,446.89077,-285.33499)"
x1="-29.837337"
y1="285.0596"
x2="-29.837337"
y2="342.60553" />
<linearGradient
id="linearGradient8928">
<stop
style="stop-color:#ffffff;stop-opacity:0.89156628;"
offset="0"
id="stop8930" />
<stop
style="stop-color:#ffffff;stop-opacity:0;"
offset="1"
id="stop8932" />
</linearGradient>
<inkscape:perspective
id="perspective4367"
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
inkscape:vp_z="1 : 0.5 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_x="0 : 0.5 : 1"
sodipodi:type="inkscape:persp3d" />
<inkscape:perspective
id="perspective4402"
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
inkscape:vp_z="1 : 0.5 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_x="0 : 0.5 : 1"
sodipodi:type="inkscape:persp3d" />
<inkscape:perspective
id="perspective2940"
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
inkscape:vp_z="1 : 0.5 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_x="0 : 0.5 : 1"
sodipodi:type="inkscape:persp3d" />
<inkscape:perspective
id="perspective4360"
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
inkscape:vp_z="1 : 0.5 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_x="0 : 0.5 : 1"
sodipodi:type="inkscape:persp3d" />
</defs>
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="11.2"
inkscape:cx="8.930196"
inkscape:cy="288.71418"
inkscape:document-units="px"
inkscape:current-layer="g2932"
showgrid="false"
inkscape:window-width="1280"
inkscape:window-height="744"
inkscape:window-x="-4"
inkscape:window-y="1020"
inkscape:window-maximized="1"
inkscape:object-paths="true"
showguides="true"
inkscape:guide-bbox="true"
inkscape:snap-to-guides="false"
inkscape:snap-grids="false"
inkscape:snap-global="false" />
<metadata
id="metadata10073">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
<dc:creator>
<cc:Agent>
<dc:title>Edouard Lafargue</dc:title>
</cc:Agent>
</dc:creator>
</cc:Work>
</rdf:RDF>
</metadata>
<g
style="display:inline"
inkscape:label="Dark background"
id="g2932"
inkscape:groupmode="layer"
transform="translate(-359.06525,-238.21351)">
<g
id="background"
inkscape:label="#g8543"
transform="matrix(0,-1,1,0,-8.719326,769.86218)"
style="stroke:none">
<rect
style="fill:#453e3e;fill-opacity:1;stroke:none"
id="rect2936"
width="318.58304"
height="60.184925"
x="213.06563"
y="367.78458"
ry="0"
inkscape:export-filename="H:\Documents\Hobbies\W433\g9905.png"
inkscape:export-xdpi="88.809998"
inkscape:export-ydpi="88.809998" />
<rect
style="fill:#918e8e;fill-opacity:1;stroke:none"
id="bargraph"
width="260.53882"
height="3.7181232"
x="240.83774"
y="396.01797"
ry="0.27438346"
inkscape:export-filename="H:\Documents\Hobbies\W433\g9905.png"
inkscape:export-xdpi="88.809998"
inkscape:export-ydpi="88.809998"
inkscape:label="#rect4388" />
<path
style="fill:none;stroke:none"
d="m 235.16159,369.8139 1.13642,0.12627"
id="field"
sodipodi:nodetypes="cc"
inkscape:label="#path2930" />
<path
style="fill:none;stroke:none;display:inline"
d="m 527.7298,373.8139 1.13642,0.12627"
id="value"
sodipodi:nodetypes="cc"
inkscape:label="#path2930" />
</g>
<g
id="needle"
inkscape:label="#g4388">
<path
inkscape:label="#path4350"
id="sdfsdf"
d="m 364.83103,277.81314 49.76939,0"
style="fill:none;stroke:#fffafa;stroke-width:4.81130123;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;display:inline" />
<path
id="path4374"
d="m 364.45044,277.90243 3.93294,0"
style="fill:none;stroke:#453e3e;stroke-width:5.284;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" />
</g>
</g>
<g
inkscape:groupmode="layer"
id="layer5"
inkscape:label="Green Zone"
style="display:inline"
transform="translate(-131.62194,127.52019)">
<rect
inkscape:label="#rect5741"
style="fill:#04b629;fill-opacity:1;stroke:none;display:inline"
id="green"
width="260.53882"
height="3.5510054"
x="-163.97397"
y="159.9389"
ry="0.26205078"
inkscape:export-filename="H:\Documents\Hobbies\W433\g9905.png"
inkscape:export-xdpi="88.809998"
inkscape:export-ydpi="88.809998"
transform="matrix(0,-1,1,0,0,0)" />
</g>
<g
inkscape:groupmode="layer"
id="layer4"
inkscape:label="Yellow Zone"
style="display:inline"
transform="translate(-131.62194,127.52019)">
<rect
inkscape:export-ydpi="88.809998"
inkscape:export-xdpi="88.809998"
inkscape:export-filename="H:\Documents\Hobbies\W433\g9905.png"
ry="0.26205078"
y="159.9389"
x="-163.97397"
height="3.5510054"
width="260.53882"
id="yellow"
style="fill:#f1b907;fill-opacity:1;stroke:none;display:inline"
inkscape:label="#rect5741"
transform="matrix(0,-1,1,0,0,0)" />
</g>
<g
inkscape:groupmode="layer"
id="layer3"
inkscape:label="Red zone"
style="display:inline"
transform="translate(-131.62194,127.52019)">
<rect
inkscape:label="#rect5741"
style="fill:#cf0e0e;fill-opacity:1;stroke:none;display:inline"
id="red"
width="260.53882"
height="3.5510054"
x="-164.0755"
y="159.9389"
ry="0.26205078"
inkscape:export-filename="H:\Documents\Hobbies\W433\g9905.png"
inkscape:export-xdpi="88.809998"
inkscape:export-ydpi="88.809998"
transform="matrix(0,-1,1,0,0,0)" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 13 KiB

View File

@ -49,7 +49,8 @@ void AirspeedGadget::loadConfiguration(IUAVGadgetConfiguration* config)
{
AirspeedGadgetConfiguration *m = qobject_cast<AirspeedGadgetConfiguration*>(config);
m_widget->setDialFile(m->dialFile(), m->dialBackground(), m->dialForeground(), m->dialNeedle1(),
m->dialNeedle2(),m->getN1Move(), m->getN2Move());
m->dialNeedle2(),m->dialNeedle3(),m->getN1Move(), m->getN2Move(),
m->getN3Move());
m_widget->setN1Min(m->getN1Min());
m_widget->setN1Max(m->getN1Max());
@ -57,6 +58,11 @@ void AirspeedGadget::loadConfiguration(IUAVGadgetConfiguration* config)
m_widget->setN2Min(m->getN2Min());
m_widget->setN2Max(m->getN2Max());
m_widget->setN2Factor(m->getN2Factor());
m_widget->setN3Min(m->getN3Min());
m_widget->setN3Max(m->getN3Max());
m_widget->setN3Factor(m->getN3Factor());
m_widget->connectNeedles(m->getN1DataObject(),m->getN1ObjField(),
m->getN2DataObject(),m->getN2ObjField());
m->getN2DataObject(),m->getN2ObjField(),
m->getN3DataObject(),m->getN3ObjField()
);
}

View File

@ -39,14 +39,19 @@ AirspeedGadgetConfiguration::AirspeedGadgetConfiguration(QString classId, const
dialForegroundID("foreground"),
dialNeedleID1("needle"),
dialNeedleID2("needle2"),
dialNeedleID3("needle3"),
needle1MinValue(0),
needle1MaxValue(100),
needle2MinValue(0),
needle2MaxValue(100),
needle3MinValue(0),
needle3MaxValue(100),
needle1Factor(1),
needle2Factor(1),
needle3Factor(1),
needle1Move("Rotate"),
needle2Move("Rotate")
needle2Move("Rotate"),
needle3Move("Rotate")
{
//if a saved configuration exists load it
if (state.count() > 0) {
@ -58,18 +63,25 @@ AirspeedGadgetConfiguration::AirspeedGadgetConfiguration(QString classId, const
stream >> dialForegroundID;
stream >> dialNeedleID1;
stream >> dialNeedleID2;
stream >> dialNeedleID3;
stream >> needle1MinValue;
stream >> needle1MaxValue;
stream >> needle2MinValue;
stream >> needle2MaxValue;
stream >> needle3MinValue;
stream >> needle3MaxValue;
stream >> needle1DataObject;
stream >> needle1ObjectField;
stream >> needle2DataObject;
stream >> needle2ObjectField;
stream >> needle3DataObject;
stream >> needle3ObjectField;
stream >> needle1Factor;
stream >> needle2Factor;
stream >> needle3Factor;
stream >> needle1Move;
stream >> needle2Move;
stream >> needle3Move;
}
}
/**
@ -95,18 +107,25 @@ QByteArray AirspeedGadgetConfiguration::saveState() const
stream << dialForegroundID;
stream << dialNeedleID1;
stream << dialNeedleID2;
stream << dialNeedleID3;
stream << needle1MinValue;
stream << needle1MaxValue;
stream << needle2MinValue;
stream << needle2MaxValue;
stream << needle3MinValue;
stream << needle3MaxValue;
stream << needle1DataObject;
stream << needle1ObjectField;
stream << needle2DataObject;
stream << needle2ObjectField;
stream << needle3DataObject;
stream << needle3ObjectField;
stream << needle1Factor;
stream << needle2Factor;
stream << needle3Factor;
stream << needle1Move;
stream << needle2Move;
stream << needle3Move;
return bytes;
}

View File

@ -47,18 +47,25 @@ public:
void setDialForegroundID(QString elementID) { dialForegroundID = elementID;}
void setDialNeedleID1(QString elementID) { dialNeedleID1 = elementID;}
void setDialNeedleID2(QString elementID) { dialNeedleID2 = elementID;}
void setDialNeedleID3(QString elementID) { dialNeedleID3 = elementID;}
void setN1Min(double val) { needle1MinValue = val;}
void setN2Min(double val) { needle2MinValue = val;}
void setN3Min(double val) { needle3MinValue = val;}
void setN1Max(double val) { needle1MaxValue = val;}
void setN2Max(double val) { needle2MaxValue = val;}
void setN3Max(double val) { needle3MaxValue = val;}
void setN1Factor(double val) { needle1Factor = val;}
void setN2Factor(double val) { needle2Factor = val;}
void setN3Factor(double val) { needle3Factor = val;}
void setN1DataObject(QString text) {needle1DataObject = text; }
void setN2DataObject(QString text){ needle2DataObject = text; }
void setN3DataObject(QString text){ needle3DataObject = text; }
void setN1ObjField(QString text) { needle1ObjectField = text; }
void setN2ObjField(QString text) { needle2ObjectField = text; }
void setN3ObjField(QString text) { needle3ObjectField = text; }
void setN1Move( QString move) { needle1Move = move; }
void setN2Move( QString move) { needle2Move = move; }
void setN3Move( QString move) { needle3Move = move; }
//get dial configuration functions
QString dialFile() {return m_defaultDial;}
@ -66,18 +73,25 @@ public:
QString dialForeground() {return dialForegroundID;}
QString dialNeedle1() {return dialNeedleID1;}
QString dialNeedle2() {return dialNeedleID2;}
QString dialNeedle3() {return dialNeedleID3;}
double getN1Min() { return needle1MinValue;}
double getN2Min() { return needle2MinValue;}
double getN3Min() { return needle3MinValue;}
double getN1Max() { return needle1MaxValue;}
double getN2Max() { return needle2MaxValue;}
double getN3Max() { return needle3MaxValue;}
double getN1Factor() { return needle1Factor;}
double getN2Factor() { return needle2Factor;}
double getN3Factor() { return needle3Factor;}
QString getN1DataObject() { return needle1DataObject; }
QString getN2DataObject() { return needle2DataObject; }
QString getN3DataObject() { return needle3DataObject; }
QString getN1ObjField() { return needle1ObjectField; }
QString getN2ObjField() { return needle2ObjectField; }
QString getN3ObjField() { return needle3ObjectField; }
QString getN1Move() { return needle1Move; }
QString getN2Move() { return needle2Move; }
QString getN3Move() { return needle3Move; }
QByteArray saveState() const;
IUAVGadgetConfiguration *clone();
@ -88,23 +102,30 @@ private:
QString dialForegroundID; // ... of the foreground
QString dialNeedleID1; // ... and the first needle
QString dialNeedleID2; // ... and the second
QString dialNeedleID3; // ... and the third
// Note: MinValue not used at the moment!
double needle1MinValue; // Value corresponding to a 0 degree angle;
double needle1MaxValue; // Value corresponding to a 360 degree angle;
double needle2MinValue;
double needle2MaxValue;
double needle3MinValue;
double needle3MaxValue;
double needle1Factor;
double needle2Factor;
double needle3Factor;
QString needle1DataObject;
QString needle1ObjectField;
QString needle2DataObject;
QString needle2ObjectField;
QString needle3DataObject;
QString needle3ObjectField;
// How the two dials move:
QString needle1Move;
QString needle2Move;
QString needle3Move;
};
#endif // AIRSPEEDGADGETCONFIGURATION_H

View File

@ -61,6 +61,7 @@ QWidget *AirspeedGadgetOptionsPage::createPage(QWidget *parent)
foreach (UAVDataObject* obj, list) {
options_page->uavObject1->addItem(obj->getName());
options_page->uavObject2->addItem(obj->getName());
options_page->uavObject3->addItem(obj->getName());
}
}
@ -73,20 +74,29 @@ QWidget *AirspeedGadgetOptionsPage::createPage(QWidget *parent)
options_page->moveNeedle2->addItem("Horizontal");
options_page->moveNeedle2->addItem("Vertical");
options_page->moveNeedle3->addItem("Rotate");
options_page->moveNeedle3->addItem("Horizontal");
options_page->moveNeedle3->addItem("Vertical");
// Restore the contents from the settings:
options_page->svgSourceFile->setText(m_config->dialFile());
options_page->backgroundID->setText(m_config->dialBackground());
options_page->foregroundID->setText(m_config->dialForeground());
options_page->needle1ID->setText(m_config->dialNeedle1());
options_page->needle2ID->setText(m_config->dialNeedle2());
options_page->needle3ID->setText(m_config->dialNeedle3());
options_page->needle1Min->setValue(m_config->getN1Min());
options_page->needle1Max->setValue(m_config->getN1Max());
options_page->needle2Min->setValue(m_config->getN2Min());
options_page->needle2Max->setValue(m_config->getN2Max());
options_page->needle3Min->setValue(m_config->getN3Min());
options_page->needle3Max->setValue(m_config->getN3Max());
options_page->factor1->setValue(m_config->getN1Factor());
options_page->factor2->setValue(m_config->getN2Factor());
options_page->factor3->setValue(m_config->getN3Factor());
options_page->moveNeedle1->setCurrentIndex(options_page->moveNeedle1->findText(m_config->getN1Move()));
options_page->moveNeedle2->setCurrentIndex(options_page->moveNeedle2->findText(m_config->getN2Move()));
options_page->moveNeedle3->setCurrentIndex(options_page->moveNeedle3->findText(m_config->getN3Move()));
//select saved UAV Object field values
if(options_page->uavObject1->findText(m_config->getN1DataObject())!=-1){
@ -103,6 +113,7 @@ QWidget *AirspeedGadgetOptionsPage::createPage(QWidget *parent)
}
}
connect(options_page->uavObject1, SIGNAL(currentIndexChanged(QString)), this, SLOT(on_uavObject1_currentIndexChanged(QString)));
if(options_page->uavObject2->findText(m_config->getN2DataObject())!=-1){
options_page->uavObject2->setCurrentIndex(options_page->uavObject2->findText(m_config->getN2DataObject()));
// Now load the object field values:
@ -116,6 +127,21 @@ QWidget *AirspeedGadgetOptionsPage::createPage(QWidget *parent)
}
}
connect(options_page->uavObject2, SIGNAL(currentIndexChanged(QString)), this, SLOT(on_uavObject2_currentIndexChanged(QString)));
if(options_page->uavObject3->findText(m_config->getN3DataObject())!=-1){
options_page->uavObject3->setCurrentIndex(options_page->uavObject3->findText(m_config->getN3DataObject()));
// Now load the object field values:
UAVDataObject* obj = dynamic_cast<UAVDataObject*>( objManager->getObject(m_config->getN3DataObject()));
if (obj != NULL ) {
QList<UAVObjectField*> fieldList = obj->getFields();
foreach (UAVObjectField* field, fieldList) {
options_page->objectField3->addItem(field->getName());
}
options_page->objectField3->setCurrentIndex(options_page->objectField3->findText(m_config->getN3ObjField()));
}
}
connect(options_page->uavObject3, SIGNAL(currentIndexChanged(QString)), this, SLOT(on_uavObject3_currentIndexChanged(QString)));
connect(options_page->loadFile, SIGNAL(clicked()), this, SLOT(on_loadFile_clicked()));
return optionsPageWidget;
}
@ -133,18 +159,25 @@ void AirspeedGadgetOptionsPage::apply()
m_config->setDialForegroundID(options_page->foregroundID->text());
m_config->setDialNeedleID1(options_page->needle1ID->text());
m_config->setDialNeedleID2(options_page->needle2ID->text());
m_config->setDialNeedleID3(options_page->needle3ID->text());
m_config->setN1Min(options_page->needle1Min->value());
m_config->setN1Max(options_page->needle1Max->value());
m_config->setN1Factor(options_page->factor1->value());
m_config->setN2Min(options_page->needle2Min->value());
m_config->setN2Max(options_page->needle2Max->value());
m_config->setN2Factor(options_page->factor2->value());
m_config->setN3Min(options_page->needle3Min->value());
m_config->setN3Max(options_page->needle3Max->value());
m_config->setN3Factor(options_page->factor3->value());
m_config->setN1DataObject(options_page->uavObject1->currentText());
m_config->setN2DataObject(options_page->uavObject2->currentText());
m_config->setN3DataObject(options_page->uavObject3->currentText());
m_config->setN1ObjField(options_page->objectField1->currentText());
m_config->setN2ObjField(options_page->objectField2->currentText());
m_config->setN3ObjField(options_page->objectField3->currentText());
m_config->setN1Move(options_page->moveNeedle1->currentText());
m_config->setN2Move(options_page->moveNeedle2->currentText());
m_config->setN3Move(options_page->moveNeedle3->currentText());
}
/*
@ -164,7 +197,7 @@ void AirspeedGadgetOptionsPage::on_uavObject1_currentIndexChanged(QString val) {
/*
Fills in the field2 combo box when value is changed in the
object1 field
object2 field
*/
void AirspeedGadgetOptionsPage::on_uavObject2_currentIndexChanged(QString val) {
options_page->objectField2->clear();
@ -177,6 +210,21 @@ void AirspeedGadgetOptionsPage::on_uavObject2_currentIndexChanged(QString val) {
}
}
/*
Fills in the field3 combo box when value is changed in the
object3 field
*/
void AirspeedGadgetOptionsPage::on_uavObject3_currentIndexChanged(QString val) {
options_page->objectField3->clear();
ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
UAVObjectManager *objManager = pm->getObject<UAVObjectManager>();
UAVDataObject* obj = dynamic_cast<UAVDataObject*>( objManager->getObject(val) );
QList<UAVObjectField*> fieldList = obj->getFields();
foreach (UAVObjectField* field, fieldList) {
options_page->objectField3->addItem(field->getName());
}
}
/*
Opens an open file dialog.

View File

@ -63,6 +63,7 @@ private slots:
void on_loadFile_clicked();
void on_uavObject1_currentIndexChanged(QString val);
void on_uavObject2_currentIndexChanged(QString val);
void on_uavObject3_currentIndexChanged(QString val);
};
#endif // AIRSPEEDGADGETOPTIONSPAGE_H

View File

@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>487</width>
<height>326</height>
<height>346</height>
</rect>
</property>
<property name="sizePolicy">
@ -24,11 +24,11 @@
<rect>
<x>-1</x>
<y>-1</y>
<width>481</width>
<height>354</height>
<width>504</width>
<height>331</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout" stretch="0,0,0,0,0,0,0">
<layout class="QVBoxLayout" name="verticalLayout" stretch="0,0,0,0,0,0">
<property name="sizeConstraint">
<enum>QLayout::SetMinimumSize</enum>
</property>
@ -106,414 +106,647 @@
</layout>
</item>
<item>
<widget class="Line" name="line_5">
<property name="orientation">
<enum>Qt::Horizontal</enum>
<widget class="QTabWidget" name="tabWidget">
<property name="currentIndex">
<number>2</number>
</property>
<widget class="QWidget" name="tab">
<attribute name="title">
<string>Indicator 1</string>
</attribute>
<widget class="QWidget" name="">
<property name="geometry">
<rect>
<x>0</x>
<y>10</y>
<width>471</width>
<height>110</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<property name="spacing">
<number>4</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>4</number>
</property>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_5">
<item>
<widget class="QLabel" name="label_4">
<property name="text">
<string>Indicator 1</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="label_12">
<property name="text">
<string>Movement:</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="moveNeedle1"/>
</item>
<item>
<widget class="QLabel" name="label_5">
<property name="text">
<string>ID:</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="needle1ID">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>50</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>16777215</height>
</size>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<property name="topMargin">
<number>10</number>
</property>
<item>
<widget class="QLabel" name="label_6">
<property name="text">
<string>Min:</string>
</property>
</widget>
</item>
<item>
<widget class="QDoubleSpinBox" name="needle1Min">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="decimals">
<number>3</number>
</property>
<property name="minimum">
<double>-100000.000000000000000</double>
</property>
<property name="maximum">
<double>100000.000000000000000</double>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_7">
<property name="text">
<string>Max:</string>
</property>
</widget>
</item>
<item>
<widget class="QDoubleSpinBox" name="needle1Max">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="decimals">
<number>3</number>
</property>
<property name="minimum">
<double>-100000.000000000000000</double>
</property>
<property name="maximum">
<double>100000.000000000000000</double>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_10">
<property name="text">
<string>Factor:</string>
</property>
</widget>
</item>
<item>
<widget class="QDoubleSpinBox" name="factor1">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimum">
<double>-100000.000000000000000</double>
</property>
<property name="maximum">
<double>100000.000000000000000</double>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_4">
<property name="topMargin">
<number>10</number>
</property>
<item>
<widget class="QLabel" name="label_8">
<property name="text">
<string>DataObject</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="uavObject1">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_9">
<property name="text">
<string>ObjectField</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="objectField1">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="Line" name="line_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
<widget class="QWidget" name="tab_2">
<attribute name="title">
<string>Indicator 2</string>
</attribute>
<widget class="QWidget" name="">
<property name="geometry">
<rect>
<x>0</x>
<y>10</y>
<width>471</width>
<height>116</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_4">
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>4</number>
</property>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_6">
<item>
<widget class="QLabel" name="label_16">
<property name="text">
<string>Indicator 2</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="label_13">
<property name="text">
<string>Movement:</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="moveNeedle2"/>
</item>
<item>
<widget class="QLabel" name="label_17">
<property name="text">
<string>ID:</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="needle2ID">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_7">
<property name="topMargin">
<number>10</number>
</property>
<item>
<widget class="QLabel" name="label_18">
<property name="text">
<string>Min:</string>
</property>
</widget>
</item>
<item>
<widget class="QDoubleSpinBox" name="needle2Min">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="decimals">
<number>3</number>
</property>
<property name="minimum">
<double>-10000.000000000000000</double>
</property>
<property name="maximum">
<double>100000.000000000000000</double>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_19">
<property name="text">
<string>Max:</string>
</property>
</widget>
</item>
<item>
<widget class="QDoubleSpinBox" name="needle2Max">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="decimals">
<number>3</number>
</property>
<property name="minimum">
<double>-100000.000000000000000</double>
</property>
<property name="maximum">
<double>100000.000000000000000</double>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_11">
<property name="text">
<string>Factor:</string>
</property>
</widget>
</item>
<item>
<widget class="QDoubleSpinBox" name="factor2">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimum">
<double>-100000.000000000000000</double>
</property>
<property name="maximum">
<double>100000.000000000000000</double>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_8">
<property name="topMargin">
<number>10</number>
</property>
<item>
<widget class="QLabel" name="label_20">
<property name="text">
<string>DataObject</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="uavObject2">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_21">
<property name="text">
<string>ObjectField</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="objectField2">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="Line" name="line_4">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
<widget class="QWidget" name="tab_3">
<attribute name="title">
<string>Indicator 3</string>
</attribute>
<widget class="QWidget" name="layoutWidget">
<property name="geometry">
<rect>
<x>0</x>
<y>10</y>
<width>471</width>
<height>116</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_5">
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>4</number>
</property>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_9">
<item>
<widget class="QLabel" name="label_22">
<property name="text">
<string>Indicator 3</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="label_14">
<property name="text">
<string>Movement:</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="moveNeedle3"/>
</item>
<item>
<widget class="QLabel" name="label_23">
<property name="text">
<string>ID:</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="needle3ID">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_10">
<property name="topMargin">
<number>10</number>
</property>
<item>
<widget class="QLabel" name="label_24">
<property name="text">
<string>Min:</string>
</property>
</widget>
</item>
<item>
<widget class="QDoubleSpinBox" name="needle3Min">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="decimals">
<number>3</number>
</property>
<property name="minimum">
<double>-10000.000000000000000</double>
</property>
<property name="maximum">
<double>100000.000000000000000</double>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_25">
<property name="text">
<string>Max:</string>
</property>
</widget>
</item>
<item>
<widget class="QDoubleSpinBox" name="needle3Max">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="decimals">
<number>3</number>
</property>
<property name="minimum">
<double>-100000.000000000000000</double>
</property>
<property name="maximum">
<double>100000.000000000000000</double>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_15">
<property name="text">
<string>Factor:</string>
</property>
</widget>
</item>
<item>
<widget class="QDoubleSpinBox" name="factor3">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimum">
<double>-100000.000000000000000</double>
</property>
<property name="maximum">
<double>100000.000000000000000</double>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_11">
<property name="topMargin">
<number>10</number>
</property>
<item>
<widget class="QLabel" name="label_26">
<property name="text">
<string>DataObject</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="uavObject3">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_27">
<property name="text">
<string>ObjectField</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="objectField3">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="Line" name="line_6">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
</widget>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout_2">
<property name="spacing">
<number>4</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>10</number>
</property>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_5">
<item>
<widget class="QLabel" name="label_4">
<property name="text">
<string>Indicator 1</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="label_12">
<property name="text">
<string>Movement:</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="moveNeedle1"/>
</item>
<item>
<widget class="QLabel" name="label_5">
<property name="text">
<string>ID:</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="needle1ID">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>50</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>16777215</height>
</size>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<property name="topMargin">
<number>10</number>
</property>
<item>
<widget class="QLabel" name="label_6">
<property name="text">
<string>Min:</string>
</property>
</widget>
</item>
<item>
<widget class="QDoubleSpinBox" name="needle1Min">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="decimals">
<number>3</number>
</property>
<property name="minimum">
<double>-100000.000000000000000</double>
</property>
<property name="maximum">
<double>100000.000000000000000</double>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_7">
<property name="text">
<string>Max:</string>
</property>
</widget>
</item>
<item>
<widget class="QDoubleSpinBox" name="needle1Max">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="decimals">
<number>3</number>
</property>
<property name="minimum">
<double>-100000.000000000000000</double>
</property>
<property name="maximum">
<double>100000.000000000000000</double>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_10">
<property name="text">
<string>Factor:</string>
</property>
</widget>
</item>
<item>
<widget class="QDoubleSpinBox" name="factor1">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimum">
<double>-100000.000000000000000</double>
</property>
<property name="maximum">
<double>100000.000000000000000</double>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_4">
<property name="topMargin">
<number>10</number>
</property>
<item>
<widget class="QLabel" name="label_8">
<property name="text">
<string>DataObject</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="uavObject1">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_9">
<property name="text">
<string>ObjectField</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="objectField1">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="Line" name="line_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout_4">
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>10</number>
</property>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_6">
<item>
<widget class="QLabel" name="label_16">
<property name="text">
<string>Indicator 2</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="label_13">
<property name="text">
<string>Movement:</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="moveNeedle2"/>
</item>
<item>
<widget class="QLabel" name="label_17">
<property name="text">
<string>ID:</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="needle2ID">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_7">
<property name="topMargin">
<number>10</number>
</property>
<item>
<widget class="QLabel" name="label_18">
<property name="text">
<string>Min:</string>
</property>
</widget>
</item>
<item>
<widget class="QDoubleSpinBox" name="needle2Min">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="decimals">
<number>3</number>
</property>
<property name="minimum">
<double>-10000.000000000000000</double>
</property>
<property name="maximum">
<double>100000.000000000000000</double>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_19">
<property name="text">
<string>Max:</string>
</property>
</widget>
</item>
<item>
<widget class="QDoubleSpinBox" name="needle2Max">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="decimals">
<number>3</number>
</property>
<property name="minimum">
<double>-100000.000000000000000</double>
</property>
<property name="maximum">
<double>100000.000000000000000</double>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_11">
<property name="text">
<string>Factor:</string>
</property>
</widget>
</item>
<item>
<widget class="QDoubleSpinBox" name="factor2">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimum">
<double>-100000.000000000000000</double>
</property>
<property name="maximum">
<double>100000.000000000000000</double>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_8">
<property name="topMargin">
<number>10</number>
</property>
<item>
<widget class="QLabel" name="label_20">
<property name="text">
<string>DataObject</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="uavObject2">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_21">
<property name="text">
<string>ObjectField</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="objectField2">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="Line" name="line_4">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
</layout>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Minimum</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
@ -522,6 +755,13 @@
</property>
</spacer>
</item>
<item>
<widget class="Line" name="line_5">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
</layout>
</widget>
</widget>

View File

@ -28,31 +28,35 @@
#include "airspeedgadgetwidget.h"
#include <iostream>
#include <QDebug>
#include "math.h"
AirspeedGadgetWidget::AirspeedGadgetWidget(QWidget *parent) : QGraphicsView(parent)
{
// TODO: create a proper "needle" object instead of hardcoding all this
// which is ugly (but easy).
setMinimumSize(64,64);
setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
setScene(new QGraphicsScene(this));
m_renderer = new QSvgRenderer();
m_background = new QGraphicsSvgItem();
m_foreground = new QGraphicsSvgItem();
m_needle1 = new QGraphicsSvgItem();
m_needle2 = new QGraphicsSvgItem();
m_needle3 = new QGraphicsSvgItem();
paint();
needle1Target = 0;
needle2Target = 0;
needle3Target = 0;
needle1Value = 0;
needle2Value = 0;
needle3Value = 0;
obj1 = NULL;
obj2 = NULL;
rotateN1 = horizN1 = vertN1 = false;
rotateN2 = horizN2 = vertN2 = false;
obj3 = NULL;
// This timer mechanism makes needles rotate smoothly
connect(&dialTimer, SIGNAL(timeout()), this, SLOT(rotateNeedles()));
@ -68,15 +72,18 @@ AirspeedGadgetWidget::~AirspeedGadgetWidget()
/*!
\brief Connects the widget to the relevant UAVObjects
*/
void AirspeedGadgetWidget::connectNeedles(QString object1, QString nfield1, QString object2, QString nfield2 ) {
void AirspeedGadgetWidget::connectNeedles(QString object1, QString nfield1,
QString object2, QString nfield2,
QString object3, QString nfield3) {
if (obj1 != NULL)
disconnect(obj1,SIGNAL(objectUpdated(UAVObject*)),this,SLOT(updateNeedle1(UAVObject*)));
if (obj2 != NULL)
disconnect(obj2,SIGNAL(objectUpdated(UAVObject*)),this,SLOT(updateNeedle2(UAVObject*)));
if (obj3 != NULL)
disconnect(obj3,SIGNAL(objectUpdated(UAVObject*)),this,SLOT(updateNeedle3(UAVObject*)));
ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
UAVObjectManager *objManager = pm->getObject<UAVObjectManager>();
std::cout << "Connect needles - " << object1.toStdString() << "-"<< nfield1.toStdString() << " - " <<
object2.toStdString() << "-" << nfield2.toStdString() << std::endl;
// Check validity of arguments first, reject empty args and unknown fields.
if (!(object1.isEmpty() || nfield1.isEmpty())) {
@ -101,6 +108,18 @@ void AirspeedGadgetWidget::connectNeedles(QString object1, QString nfield1, QStr
std::cout << "Error: Object is unknown (" << object2.toStdString() << ")." << std::endl;
}
}
// And do the same for the third needle.
if (!(object3.isEmpty() || nfield3.isEmpty())) {
obj3 = dynamic_cast<UAVDataObject*>( objManager->getObject(object3) );
if (obj3 != NULL ) {
std::cout << "Connected Object 3 (" << object3.toStdString() << ")." << std::endl;
connect(obj3, SIGNAL(objectUpdated(UAVObject*)), this, SLOT(updateNeedle3(UAVObject*)));
field3 = nfield3;
} else {
std::cout << "Error: Object is unknown (" << object3.toStdString() << ")." << std::endl;
}
}
}
/*!
@ -114,7 +133,6 @@ void AirspeedGadgetWidget::updateNeedle1(UAVObject *object1) {
} else {
std::cout << "Wrong field, maybe an issue with object disconnection ?" << std::endl;
}
std::cout << "Update Needle 1 with value of field " << field1.toStdString() << std::endl;
}
/*!
@ -129,8 +147,24 @@ void AirspeedGadgetWidget::updateNeedle2(UAVObject *object2) {
}
}
/*!
\brief Called by the UAVObject which got updated
*/
void AirspeedGadgetWidget::updateNeedle3(UAVObject *object3) {
UAVObjectField* field = object3->getField(field3);
if (field) {
setNeedle3(field->getDouble());
} else {
std::cout << "Wrong field, maybe an issue with object disconnection ?" << std::endl;
}
}
/*
Initializes the dial file, and does all the one-time calculations for
display later.
*/
void AirspeedGadgetWidget::setDialFile(QString dfn, QString bg, QString fg, QString n1, QString n2,
QString n1Move, QString n2Move)
QString n3, QString n1Move, QString n2Move, QString n3Move)
{
if (QFile::exists(dfn))
{
@ -139,25 +173,28 @@ void AirspeedGadgetWidget::setDialFile(QString dfn, QString bg, QString fg, QStr
{
fgenabled = false;
n2enabled = false;
n3enabled = false;
QGraphicsScene *l_scene = scene();
l_scene->removeItem(m_foreground);
l_scene->removeItem(m_background);
l_scene->removeItem(m_needle1);
l_scene->removeItem(m_needle2);
l_scene->removeItem(m_needle3);
// We assume the scene contains at least the background
// and needle1
m_background->setSharedRenderer(m_renderer);
m_background->setElementId(bg);
l_scene->addItem(m_background);
m_needle1->setSharedRenderer(m_renderer);
m_needle1->setElementId(n1);
l_scene->addItem(m_needle1);
if (m_renderer->elementExists(fg)) {
m_foreground->setSharedRenderer(m_renderer);
m_foreground->setElementId(fg);
if (!l_scene->items().contains(m_foreground))
l_scene->addItem(m_foreground);
fgenabled = true;
} else {
if (l_scene->items().contains(m_foreground))
l_scene->removeItem(m_foreground);
fgenabled = false;
}
// The dial gadget allows Needle1 and Needle2 to be
// the same element, for combined movement. Needle3
// is always independent.
if (n1 == n2) {
m_needle2 = m_needle1;
n2enabled = true;
@ -165,15 +202,35 @@ void AirspeedGadgetWidget::setDialFile(QString dfn, QString bg, QString fg, QStr
if (m_renderer->elementExists(n2)) {
m_needle2->setSharedRenderer(m_renderer);
m_needle2->setElementId(n2);
if (!l_scene->items().contains(m_needle2))
l_scene->addItem(m_needle2);
l_scene->addItem(m_needle2);
n2enabled = true;
} else {
if (l_scene->items().contains(m_needle2))
l_scene->removeItem(m_needle2);
n2enabled = false;
}
}
}
if (m_renderer->elementExists(n3)) {
m_needle3->setSharedRenderer(m_renderer);
m_needle3->setElementId(n3);
l_scene->addItem(m_needle3);
n3enabled = true;
}
if (m_renderer->elementExists(fg)) {
m_foreground->setSharedRenderer(m_renderer);
m_foreground->setElementId(fg);
l_scene->addItem(m_foreground);
fgenabled = true;
}
rotateN1 = false;
horizN1 = false;
vertN1 = false;
rotateN2 = false;
horizN2 = false;
vertN2 = false;
rotateN3 = false;
horizN3 = false;
vertN3 = false;
// Now setup the rotation/translation settings:
// this is UGLY UGLY UGLY, sorry...
@ -193,17 +250,37 @@ void AirspeedGadgetWidget::setDialFile(QString dfn, QString bg, QString fg, QStr
vertN2 = true;
}
// std::cout<<"Dial file loaded ("<< dfn.toStdString() << ")" << std::endl;
l_scene->setSceneRect(m_background->boundingRect());
if (n3Move.contains("Rotate")) {
rotateN3 = true;
} else if (n3Move.contains("Horizontal")) {
horizN3 = true;
} else if (n3Move.contains("Vertical")) {
vertN3 = true;
}
// Initialize the center for all transforms of the dials to the
l_scene->setSceneRect(m_background->boundingRect());
// Now Initialize the center for all transforms of the dial needles to the
// center of the background:
QRectF rect1 = m_background->boundingRect();
QPointF tr1 = m_background->mapToScene(rect1.width()/2,rect1.height()/2);
QPointF tr = m_needle1->mapFromScene(tr1);
m_needle1->setTransformOriginPoint(tr.x(),tr.y());
tr = m_needle2->mapFromScene(tr1);
m_needle2->setTransformOriginPoint(tr.x(),tr.y());
// - Move the center of the needle to the center of the background.
QRectF rectB = m_background->boundingRect();
QRectF rectN = m_needle1->boundingRect();
m_needle1->setPos(rectB.width()/2-rectN.width()/2,rectB.height()/2-rectN.height()/2);
// - Put the transform origin point of the needle at its center.
m_needle1->setTransformOriginPoint(rectN.width()/2,rectN.height()/2);
if ((n1 != n2) && n2enabled) {
// Only do it for needle1 if it is not the same as n2
rectN = m_needle2->boundingRect();
m_needle2->setPos(rectB.width()/2-rectN.width()/2,rectB.height()/2-rectN.height()/2);
m_needle2->setTransformOriginPoint(rectN.width()/2,rectN.height()/2);
}
if (n3enabled) {
rectN = m_needle3->boundingRect();
m_needle3->setPos(rectB.width()/2-rectN.width()/2,rectB.height()/2-rectN.height()/2);
m_needle3->setTransformOriginPoint(rectN.width()/2,rectN.height()/2);
}
// Last: clip the display region to the rectangle of the background
// TODO
}
}
else
@ -217,6 +294,7 @@ void AirspeedGadgetWidget::paint()
l_scene->addItem(m_background);
l_scene->addItem(m_needle1);
l_scene->addItem(m_needle2);
l_scene->addItem(m_needle3);
l_scene->addItem(m_foreground);
l_scene->setSceneRect(m_background->boundingRect());
update();
@ -266,6 +344,18 @@ void AirspeedGadgetWidget::setNeedle2(double value) {
}
}
void AirspeedGadgetWidget::setNeedle3(double value) {
if (rotateN3) {
needle3Target = 360*value*n3Factor/(n3MaxValue-n3MinValue);
}
if (horizN3) {
needle3Target = value*n3Factor/(n3MaxValue-n3MinValue);
}
if (vertN3) {
needle3Target = value*n3Factor/(n3MaxValue-n3MinValue);
}
}
// Take an input value and rotate the dial accordingly
// Rotation is smooth, starts fast and slows down when
// approaching the target.
@ -275,6 +365,9 @@ void AirspeedGadgetWidget::setNeedle2(double value) {
// to the same element.
void AirspeedGadgetWidget::rotateNeedles()
{
// TODO: watch out of potential drift of needles due to
// rounding errors. Should implement a way to set the value
// exactly to the target once it falls below the threshold.
if ((abs((needle2Value-needle2Target)*10) > 5) && n2enabled) {
double needle2Diff;
needle2Diff =(needle2Target - needle2Value)/5;
@ -293,7 +386,7 @@ void AirspeedGadgetWidget::rotateNeedles()
// the transform origin point the opposite way
// so that it keeps rotating from the same point.
// (this is only useful if needle1 and needle2 are the
// same object, for combined movement.
// same object, for combined movement such as attitude indicator).
QPointF oop = m_needle2->transformOriginPoint();
m_needle2->setTransformOriginPoint(oop.x()-opd.x(),oop.y()-opd.y());
}
@ -320,6 +413,25 @@ void AirspeedGadgetWidget::rotateNeedles()
needle1Value += needle1Diff;
}
if ((abs((needle3Value-needle3Target)*10) > 5)) {
double needle3Diff;
needle3Diff = (needle3Target - needle3Value)/5;
if (rotateN3) {
m_needle3->setRotation(m_needle3->rotation()+needle3Diff);
} else {
QPointF opd = QPointF(0,0);
if (horizN3) {
opd = QPointF(needle3Diff,0);
}
if (vertN3) {
opd = QPointF(0,needle3Diff);
}
m_needle3->setTransform(QTransform::fromTranslate(opd.x(),opd.y()), true);
QPointF oop = m_needle3->transformOriginPoint();
m_needle3->setTransformOriginPoint((oop.x()-opd.x()),(oop.y()-opd.y()));
}
needle3Value += needle3Diff;
}
update();
}

View File

@ -46,26 +46,32 @@ class AirspeedGadgetWidget : public QGraphicsView
public:
AirspeedGadgetWidget(QWidget *parent = 0);
~AirspeedGadgetWidget();
void setDialFile(QString dfn, QString bg, QString fg, QString n1, QString n2, QString n1Move,
QString n2Move);
void setDialFile(QString dfn, QString bg, QString fg, QString n1, QString n2, QString n3,
QString n1Move, QString n2Move, QString n3Move);
void paint();
// setNeedle1 and setNeedle2 use a timer to simulate
// needle inertia
void setNeedle1(double value);
void setNeedle2(double value);
void setNeedle3(double value);
void setN1Min(double value) {n1MinValue = value;}
void setN1Max(double value) {n1MaxValue = value;}
void setN1Factor(double value) {n1Factor = value;}
void setN2Min(double value) {n2MinValue = value;}
void setN2Max(double value) {n2MaxValue = value;}
void setN2Factor(double value) {n2Factor = value;}
void setN3Min(double value) {n3MinValue = value;}
void setN3Max(double value) {n3MaxValue = value;}
void setN3Factor(double value) {n3Factor = value;}
// Sets up needle/UAVObject connections:
void connectNeedles(QString object1, QString field1,
QString object2, QString field2);
QString object2, QString field2,
QString object3, QString field3);
public slots:
void updateNeedle1(UAVObject *object1); // Called by the UAVObject
void updateNeedle2(UAVObject *object2); // Called by the UAVObject
void updateNeedle3(UAVObject *object3); // Called by the UAVObject
protected:
void paintEvent(QPaintEvent *event);
@ -81,17 +87,22 @@ private:
QGraphicsSvgItem *m_foreground;
QGraphicsSvgItem *m_needle1;
QGraphicsSvgItem *m_needle2;
QGraphicsSvgItem *m_needle3;
bool n3enabled;
bool n2enabled; // Simple flag to skip rendering if the
bool fgenabled; // layer does not exist.
// Settings concerning move of the dials
bool rotateN1;
bool rotateN2;
bool rotateN3;
bool horizN1;
bool horizN2;
bool horizN3;
bool vertN1;
bool vertN2;
bool vertN3;
double n1MinValue;
double n1MaxValue;
@ -99,6 +110,9 @@ private:
double n2MinValue;
double n2MaxValue;
double n2Factor;
double n3MinValue;
double n3MaxValue;
double n3Factor;
// The Value and target variables
// are expressed in degrees
@ -106,12 +120,16 @@ private:
double needle1Value;
double needle2Target;
double needle2Value;
double needle3Target;
double needle3Value;
// Name of the fields to read when an update is received:
UAVDataObject* obj1;
UAVDataObject* obj2;
UAVDataObject* obj3;
QString field1;
QString field2;
QString field3;
// Rotation timer
QTimer dialTimer;