Commit 6364e628 authored by Patrick José Pereira's avatar Patrick José Pereira

new wind rose version

Signed-off-by: 's avatarPatrick José Pereira <patrickelectric@gmail.com>
parent 5040a42d
......@@ -194,7 +194,7 @@
<file alias="TrashDelete.svg">resources/TrashDelete.svg</file>
<file alias="waves.svg">resources/waves.svg</file>
<file alias="wind-rose.svg">resources/wind-rose.svg</file>
<file alias="wind-rose-arrows.svg">resources/wind-rose-arrows.svg</file>
<file alias="wind-rose-arrow.svg">resources/wind-rose-arrow.svg</file>
<file alias="XDelete.svg">resources/XDelete.svg</file>
<file alias="XDeleteBlack.svg">resources/XDeleteBlack.svg</file>
<file>resources/icons/qgroundcontrol.ico</file>
......
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Generator: IcoMoon.io -->
<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:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="352"
height="512"
viewBox="0 0 352 512"
version="1.1"
id="svg3740"
sodipodi:docname="wind-rose-arrow.svg"
style="fill:#000000"
inkscape:version="0.92.1 r">
<metadata
id="metadata3746">
<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>
</cc:Work>
</rdf:RDF>
</metadata>
<defs
id="defs3744" />
<sodipodi:namedview
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="1366"
inkscape:window-height="722"
id="namedview3742"
showgrid="false"
inkscape:pagecheckerboard="true"
inkscape:zoom="0.65186406"
inkscape:cx="-149.4937"
inkscape:cy="264.4641"
inkscape:window-x="1366"
inkscape:window-y="0"
inkscape:window-maximized="1"
inkscape:current-layer="svg3740" />
<g
id="g3758">
<path
inkscape:connector-curvature="0"
id="path3738"
d="M 0,416 96,512 352,256 96,0 0,96 160,256 Z" />
</g>
</svg>
This diff is collapsed.
......@@ -422,7 +422,7 @@ Rectangle {
onClicked: {
var cords = windRoseButton.mapToItem(_root, 0, 0)
windRose.popup(cords.x + windRoseButton.width/2, cords.y + windRoseButton.height/2);
windRosePie.popup(cords.x + windRoseButton.width / 2, cords.y + windRoseButton.height / 2);
}
}
}
......@@ -547,83 +547,86 @@ Rectangle {
}
}
PieMenu {
id: windRose
triggerMode: TriggerMode.TriggerOnPress
height: 2.75*windRoseButton.height
width: 2.75*windRoseButton.width
onVisibleChanged: {
windRoseSvg.visible = visible
Image {
id: windRoseArrow
source: "/res/wind-rose-arrow.svg"
visible: windRosePie.visible
width: windRosePie.width / 5
height: width * 1.454
smooth: true
transform: Rotation {
origin.x: windRoseArrow.width / 2
origin.y: windRoseArrow.height / 2
axis { x: 0; y: 0; z: 1 } angle: windRosePie.angle
}
x: windRosePie.x + Math.sin(- windRosePie.angle*Math.PI/180 - Math.PI/2)*(windRosePie.width/2 - windRoseArrow.width/2) + windRosePie.width / 2 - windRoseArrow.width / 2
y: windRosePie.y + Math.cos(- windRosePie.angle*Math.PI/180 - Math.PI/2)*(windRosePie.height/2 - windRoseArrow.width/2) + windRosePie.height / 2 - windRoseArrow.height / 2
z: windRosePie.z
}
style: PieMenuStyle {
cancelRadius: windRoseButton.height*0.5
shadowRadius: 0
startAngle: -22.5
endAngle: 337.5
Item {
id: windRosePie
height: 2.6*windRoseButton.height
width: 2.6*windRoseButton.width
visible: false
property string colorCircle: Qt.rgba(0, 0, 0, 0.45)
property string colorBackground: Qt.rgba(0, 0, 0, 0.75)
property real lineWidth: windRoseButton.width / 3
property real angle: 0
Canvas {
id: windRoseCanvas
anchors.fill: parent
onPaint: {
var ctx = getContext("2d")
var x = width / 2
var y = height / 2
var angleWidth = 0.03 * Math.PI
var start = windRosePie.angle*Math.PI/180 - angleWidth
var end = windRosePie.angle*Math.PI/180 + angleWidth
ctx.reset()
ctx.beginPath();
ctx.arc(x, y, (width / 3) - windRosePie.lineWidth / 2, 0, 2*Math.PI, false)
ctx.lineWidth = windRosePie.lineWidth
ctx.strokeStyle = windRosePie.colorBackground
ctx.stroke()
ctx.beginPath();
ctx.arc(x, y, (width / 3) - windRosePie.lineWidth / 2, start, end, false)
ctx.lineWidth = windRosePie.lineWidth
ctx.strokeStyle = windRosePie.colorCircle
ctx.stroke()
}
}
function popup(x, y) {
if (x !== undefined)
windRosePie.x = x - windRosePie.width / 2;
if (y !== undefined)
windRosePie.y = y - windRosePie.height / 2;
MenuItem {
onTriggered: {
gridAngleText.text = "-90";
gridAngleText.editingFinished();
}
windRosePie.visible = true;
}
MenuItem {
onTriggered: {
gridAngleText.text = "-45";
gridAngleText.editingFinished();
}
}
MenuItem {
onTriggered: {
gridAngleText.text = "0";
gridAngleText.editingFinished();
}
}
MenuItem {
onTriggered: {
gridAngleText.text = "45";
gridAngleText.editingFinished();
}
}
MenuItem {
onTriggered: {
gridAngleText.text = "90";
gridAngleText.editingFinished();
}
}
MenuItem {
onTriggered: {
gridAngleText.text = "135";
gridAngleText.editingFinished();
}
}
MenuItem {
onTriggered: {
gridAngleText.text = "180";
gridAngleText.editingFinished();
MouseArea {
id: mouseArea
anchors.fill: parent
acceptedButtons: Qt.LeftButton | Qt.RightButton
onClicked: {
windRosePie.visible = false;
}
}
MenuItem {
onTriggered: {
gridAngleText.text = "-135";
onPositionChanged: {
var point = Qt.point(mouseX - parent.width / 2, mouseY - parent.height / 2)
var angle = Math.round(Math.atan2(point.y, point.x) * 180 / Math.PI)
windRoseCanvas.requestPaint()
windRosePie.angle = angle
gridAngleText.text = angle
gridAngleText.editingFinished();
}
}
}
Image {
id: windRoseSvg
source: "/res/wind-rose-arrows.svg"
visible: false
width: windRose.width
height: windRose.height
x: windRose.x;
y: windRose.y;
z: windRose.z;
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment