-
Notifications
You must be signed in to change notification settings - Fork 283
/
Copy pathPose3d.qml
149 lines (136 loc) · 4.38 KB
/
Pose3d.qml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
/*
* Copyright (C) 2020 Open Source Robotics Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
import QtQuick 2.9
import QtQuick.Controls 2.2
import QtQuick.Controls.Material 2.1
import QtQuick.Layouts 1.3
import QtQuick.Controls.Styles 1.4
import "qrc:/ComponentInspector"
import "qrc:/qml"
// Item displaying 3D pose information.
Rectangle {
height: header.height + gzPoseInstance.height
width: componentInspector.width
color: index % 2 == 0 ? lightGrey : darkGrey
// Left indentation
property int indentation: 10
// Horizontal margins
property int margin: 5
// Send new pose to C++
function sendPose(x, y, z, roll, pitch, yaw) {
// TODO(anyone) There's a loss of precision when these values get to C++
Pose3dImpl.OnPose(x, y, z, roll, pitch, yaw);
}
Column {
anchors.fill: parent
// Header
Rectangle {
id: header
width: parent.width
height: typeHeader.height
color: "transparent"
RowLayout {
anchors.fill: parent
Item {
width: margin
}
Image {
id: icon
sourceSize.height: indentation
sourceSize.width: indentation
fillMode: Image.Pad
Layout.alignment : Qt.AlignVCenter
source: gzPoseInstance.expand ?
"qrc:/Gazebo/images/minus.png" : "qrc:/Gazebo/images/plus.png"
}
TypeHeader {
id: typeHeader
}
Item {
Layout.fillWidth: true
}
}
MouseArea {
anchors.fill: parent
hoverEnabled: true
cursorShape: Qt.PointingHandCursor
onClicked: {
gzPoseInstance.expand = !gzPoseInstance.expand
}
onEntered: {
header.color = highlightColor
}
onExited: {
header.color = "transparent"
}
}
}
Rectangle {
color: "transparent"
width: parent.width
height: gzPoseInstance.height
// Content
GzPose {
id: gzPoseInstance
width: parent.width - margin * 2 - indentation
x: margin + indentation
readOnly: {
var isModel = entityType == "model"
return !(isModel) || nestedModel
}
xValue: model.data[0]
yValue: model.data[1]
zValue: model.data[2]
rollValue: model.data[3]
pitchValue: model.data[4]
yawValue: model.data[5]
onGzPoseSet: {
// _x, _y, _z, _roll, _pitch, _yaw are parameters of signal gzPoseSet
sendPose(_x, _y, _z, _roll, _pitch, _yaw)
}
// By default it is closed
expand: false
// plotting
gzPlotEnabled: true
gzPlotMimeDataX: { "text/plain" : (model === null) ? "" :
"Component," + model.entity + "," + model.typeId + "," +
model.dataType + ",x," + model.shortName
}
gzPlotMimeDataY: { "text/plain" : (model === null) ? "" :
"Component," + model.entity + "," + model.typeId + "," +
model.dataType + ",y," + model.shortName
}
gzPlotMimeDataZ: { "text/plain" : (model === null) ? "" :
"Component," + model.entity + "," + model.typeId + "," +
model.dataType + ",z," + model.shortName
}
gzPlotMimeDataRoll: { "text/plain" : (model === null) ? "" :
"Component," + model.entity + "," + model.typeId + "," +
model.dataType + ",roll," + model.shortName
}
gzPlotMimeDataPitch: { "text/plain" : (model === null) ? "" :
"Component," + model.entity + "," + model.typeId + "," +
model.dataType + ",pitch," + model.shortName
}
gzPlotMimeDataYaw: { "text/plain" : (model === null) ? "" :
"Component," + model.entity + "," + model.typeId + "," +
model.dataType + ",yaw," + model.shortName
}
} // end gzPoseInstance
} // end Rectangle
} // end Column
} // end Rectangle