torqml 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (79) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +32 -0
  3. data/.yardopts +3 -0
  4. data/Gemfile +5 -0
  5. data/LICENSE +21 -0
  6. data/README.md +148 -0
  7. data/Rakefile +6 -0
  8. data/assets/images/capture.png +0 -0
  9. data/assets/images/configure.png +0 -0
  10. data/assets/images/edit.png +0 -0
  11. data/assets/images/play.png +0 -0
  12. data/assets/images/reload.png +0 -0
  13. data/assets/images/stop.png +0 -0
  14. data/assets/shapes/TQBox.obj +44 -0
  15. data/assets/shapes/TQCone.obj +169 -0
  16. data/assets/shapes/TQCylinder.obj +585 -0
  17. data/assets/shapes/TQSphere.obj +1497 -0
  18. data/assets/shapes/TQTorus.obj +3754 -0
  19. data/bin/torqml +12 -0
  20. data/examples/SerialLink/SerialLink.qml +35 -0
  21. data/examples/SerialLink/main.qml +29 -0
  22. data/examples/SerialLink/main_multi.qml +40 -0
  23. data/examples/Tutorial/MyModel.qml +34 -0
  24. data/examples/Tutorial/main_00_minimal.qml +10 -0
  25. data/examples/Tutorial/main_01_property.qml +15 -0
  26. data/examples/Tutorial/main_02_pose.qml +19 -0
  27. data/examples/Tutorial/main_03_link.qml +32 -0
  28. data/examples/Tutorial/main_04_importmodel.qml +7 -0
  29. data/examples/Tutorial/main_05_cameralight.qml +17 -0
  30. data/examples/Tutorial/main_06_animation.qml +18 -0
  31. data/examples/WheeledVehicle/WheeledVehicle.qml +62 -0
  32. data/examples/WheeledVehicle/data/maze2014student.dat +19 -0
  33. data/examples/WheeledVehicle/data/wheeledvehicle.csv +11712 -0
  34. data/examples/WheeledVehicle/main.qml +38 -0
  35. data/examples/WheeledVehicle/plugins/MazeWallGenerator/plugin.rb +68 -0
  36. data/examples/WheeledVehicle/plugins/MazeWallGenerator/qml/TorQML/Plugins/MazeWallGenerator/MazeHorizWall.qml +29 -0
  37. data/examples/WheeledVehicle/plugins/MazeWallGenerator/qml/TorQML/Plugins/MazeWallGenerator/MazeVertWall.qml +30 -0
  38. data/examples/WheeledVehicle/plugins/MazeWallGenerator/qml/TorQML/Plugins/MazeWallGenerator/MazeWallGenerator.qml +24 -0
  39. data/examples/WheeledVehicle/plugins/MazeWallGenerator/qml/TorQML/Plugins/MazeWallGenerator/qmldir +4 -0
  40. data/examples/WheeledVehicle/plugins/MazeWallGenerator/qml/TorQML/Plugins/MazeWallGenerator/wallAllocator.js +47 -0
  41. data/ext/TorQML/FrameGrabber/extconf.rb +45 -0
  42. data/ext/TorQML/FrameGrabber/framegrabber.cpp +36 -0
  43. data/ext/TorQML/FrameGrabber/framegrabber.pro +9 -0
  44. data/ext/TorQML/FrameGrabber/qmldir +2 -0
  45. data/lib/torqml.rb +47 -0
  46. data/lib/torqml/datasources.rb +12 -0
  47. data/lib/torqml/datasources/csvdatasource.rb +44 -0
  48. data/lib/torqml/datasources/datasource.rb +44 -0
  49. data/lib/torqml/datasources/lineardatasource.rb +47 -0
  50. data/lib/torqml/datasources/matrixdatasource.rb +37 -0
  51. data/lib/torqml/plugins.rb +44 -0
  52. data/lib/torqml/version.rb +6 -0
  53. data/plugins/DO_NOT_MODIFY_THIS_DIRECTORY +2 -0
  54. data/qml/TorQML/DataSources/TQCSVDataSource.qml +17 -0
  55. data/qml/TorQML/DataSources/TQLinearDataSource.qml +18 -0
  56. data/qml/TorQML/DataSources/qmldir +3 -0
  57. data/qml/TorQML/Shapes/TQAxis.qml +26 -0
  58. data/qml/TorQML/Shapes/TQBox.qml +11 -0
  59. data/qml/TorQML/Shapes/TQCone.qml +17 -0
  60. data/qml/TorQML/Shapes/TQCoordinate.qml +30 -0
  61. data/qml/TorQML/Shapes/TQCylinder.qml +17 -0
  62. data/qml/TorQML/Shapes/TQGrid.qml +36 -0
  63. data/qml/TorQML/Shapes/TQPrimitive.qml +33 -0
  64. data/qml/TorQML/Shapes/TQSphere.qml +18 -0
  65. data/qml/TorQML/Shapes/TQTorus.qml +18 -0
  66. data/qml/TorQML/Shapes/qmldir +10 -0
  67. data/qml/TorQML/TQModel.qml +9 -0
  68. data/qml/TorQML/Views/Dialogs/TQCaptureDialog.qml +197 -0
  69. data/qml/TorQML/Views/Dialogs/TQProgressDialog.qml +36 -0
  70. data/qml/TorQML/Views/Dialogs/qmldir +3 -0
  71. data/qml/TorQML/Views/TQBasicView.qml +148 -0
  72. data/qml/TorQML/Views/TQCamera.qml +11 -0
  73. data/qml/TorQML/Views/TQViewport.qml +41 -0
  74. data/qml/TorQML/Views/basicview.js +172 -0
  75. data/qml/TorQML/Views/mouseEventHandler.js +55 -0
  76. data/qml/TorQML/Views/qmldir +4 -0
  77. data/qml/TorQML/qmldir +2 -0
  78. data/torqml.gemspec +29 -0
  79. metadata +181 -0
@@ -0,0 +1,10 @@
1
+ module TorQML.Shapes
2
+ TQAxis 0.1 TQAxis.qml
3
+ TQBox 0.1 TQBox.qml
4
+ TQCone 0.1 TQCone.qml
5
+ TQCoordinate 0.1 TQCoordinate.qml
6
+ TQCylinder 0.1 TQCylinder.qml
7
+ TQGrid 0.1 TQGrid.qml
8
+ TQPrimitive 0.1 TQPrimitive.qml
9
+ TQSphere 0.1 TQSphere.qml
10
+ TQTorus 0.1 TQTorus.qml
@@ -0,0 +1,9 @@
1
+ import QtQuick 2.0
2
+
3
+ // root component for user-defined models
4
+ Item {
5
+ id: objroot
6
+ property var dataSource: null
7
+ }
8
+
9
+ // vim:set ts=4 sw=4 et:
@@ -0,0 +1,197 @@
1
+ import QtQuick 2.0
2
+ import QtQuick.Controls 1.1
3
+ import QtQuick.Window 2.1
4
+ import QtQuick.Layouts 1.1
5
+ import QtQuick.Dialogs 1.1
6
+
7
+ Window {
8
+ id: _captureDialog
9
+ title: "Capture frames"
10
+ width: 500
11
+ height: 450
12
+ flags: Qt.Dialog
13
+ modality: Qt.WindowModal
14
+ property real maxFrame: 1
15
+ property string returnValue: ""
16
+ property alias frameWidth: _frameWidth.value
17
+ property alias frameHeight: _frameHeight.value
18
+
19
+ SystemPalette{ id: _palette }
20
+ color: _palette.window
21
+
22
+ ColumnLayout {
23
+ anchors.fill: parent
24
+ anchors.margins: 10
25
+ GroupBox {
26
+ Layout.fillWidth: true
27
+ title: "Format"
28
+ RowLayout {
29
+ anchors.fill: parent
30
+ ExclusiveGroup{ id: _formatGroup }
31
+ RadioButton {
32
+ id: _formatPng
33
+ text: "png"
34
+ checked: true
35
+ exclusiveGroup: _formatGroup
36
+ }
37
+ RadioButton {
38
+ id: _formatMp4
39
+ text: "mp4"
40
+ exclusiveGroup: _formatGroup
41
+ enabled: false
42
+ }
43
+ }
44
+ }
45
+ GroupBox {
46
+ Layout.fillWidth: true
47
+ title: "Dimension"
48
+ RowLayout {
49
+ SpinBox {
50
+ id: _frameWidth
51
+ minimumValue: 1
52
+ maximumValue: 2048
53
+ }
54
+ Label { text: " x " }
55
+ SpinBox {
56
+ id: _frameHeight
57
+ minimumValue: 1
58
+ maximumValue: 2048
59
+ }
60
+ Label { text: " px" }
61
+ }
62
+ }
63
+ GroupBox {
64
+ Layout.fillWidth: true
65
+ title: "Frame Range"
66
+ ColumnLayout {
67
+ anchors.fill: parent
68
+ ExclusiveGroup{ id: _rangeGroup }
69
+ RadioButton {
70
+ id: _rangeCurrent
71
+ text: "Current frame"
72
+ exclusiveGroup: _rangeGroup
73
+ }
74
+ RadioButton {
75
+ id: _rangeAll
76
+ text: "All frames"
77
+ checked: true
78
+ exclusiveGroup: _rangeGroup
79
+ }
80
+ RowLayout {
81
+ RadioButton {
82
+ id: _rangeCustom
83
+ text: "Custom range : "
84
+ exclusiveGroup: _rangeGroup
85
+ onCheckedChanged: { _rangeFrom.enabled = checked; _rangeTo.enabled = checked; }
86
+ }
87
+ SpinBox {
88
+ id: _rangeFrom
89
+ minimumValue: 1
90
+ maximumValue: maxFrame
91
+ enabled: false
92
+ value: 1
93
+ }
94
+ Label { text: "-" }
95
+ SpinBox {
96
+ id: _rangeTo
97
+ minimumValue: 1
98
+ maximumValue: maxFrame
99
+ enabled: false
100
+ value: maxFrame
101
+ }
102
+ }
103
+ RowLayout {
104
+ Label { text: "Frame skip : " }
105
+ SpinBox {
106
+ id: _rangeFrameSkip
107
+ minimumValue: 0
108
+ maximumValue: maxFrame
109
+ value: 0
110
+ }
111
+ }
112
+ }
113
+ }
114
+ GroupBox {
115
+ Layout.fillWidth: true
116
+ title: "Directory"
117
+ RowLayout {
118
+ anchors.fill: parent
119
+ TextField {
120
+ id: _pathDir
121
+ Layout.fillWidth: true
122
+ }
123
+ Button {
124
+ text: "..."
125
+ FileDialog {
126
+ id: _pathDialog
127
+ title: "Select a directory"
128
+ folder: ""
129
+ selectFolder: true
130
+ selectExisting: true
131
+ // FIXME: QImage::save does not accept canonical urls
132
+ onAccepted: { _pathDir.text = _pathDialog.fileUrls.toString().replace("file://", ""); }
133
+ }
134
+ onClicked: { _pathDialog.open(); }
135
+ // FIXME: QImage::save does not accept canonical urls
136
+ Component.onCompleted: { _pathDir.text = _pathDialog.folder.toString().replace("file://", ""); }
137
+ }
138
+ }
139
+ }
140
+ GroupBox {
141
+ Layout.fillWidth: true
142
+ title: "Prefix"
143
+ TextField {
144
+ id: _prefix
145
+ anchors.fill: parent
146
+ Layout.fillWidth: true
147
+ text: "frame_"
148
+ }
149
+ }
150
+ RowLayout {
151
+ Layout.alignment: Qt.AlignRight
152
+ Button {
153
+ text: "Ok"
154
+ onClicked: {
155
+ if(_rangeCustom.checked && _rangeFrom.value > _rangeTo.value) {
156
+ _alertDialog.text = "Invalid frame range!";
157
+ _alertDialog.open();
158
+ return;
159
+ }
160
+ var returnObject = {
161
+ "format": (_formatPng.checked ? "png" : "") + (_formatMp4.checked ? "mp4" : ""),
162
+ "dimension": {
163
+ "width": _frameWidth.value,
164
+ "height": _frameHeight.value
165
+ },
166
+ "range": {
167
+ "mode": (_rangeCurrent.checked ? "current" : "") + (_rangeAll.checked ? "all" : "") + (_rangeCustom.checked ? "custom" : ""),
168
+ "from": _rangeFrom.value,
169
+ "to": _rangeTo.value,
170
+ "frameSkip": _rangeFrameSkip.value
171
+ },
172
+ "path": {
173
+ "directory": _pathDir.text,
174
+ "prefix": _prefix.text
175
+ }
176
+ };
177
+ returnValue = JSON.stringify(returnObject);
178
+ _captureDialog.close();
179
+ }
180
+ }
181
+ Button {
182
+ text: "Cancel"
183
+ onClicked: {
184
+ returnValue = "";
185
+ _captureDialog.close();
186
+ }
187
+ }
188
+ }
189
+ MessageDialog {
190
+ id: _alertDialog;
191
+ title: "Warning"
192
+ icon: StandardIcon.Warning
193
+ }
194
+ }
195
+ }
196
+
197
+ // vim:set ts=4 sw=4 et:
@@ -0,0 +1,36 @@
1
+ import QtQuick 2.0
2
+ import QtQuick.Controls 1.1
3
+ import QtQuick.Window 2.1
4
+ import QtQuick.Layouts 1.1
5
+ import QtQuick.Dialogs 1.1
6
+
7
+ Window {
8
+ id: _progressDialog
9
+ title: "Exporting..."
10
+ width: 300
11
+ height: 80
12
+ flags: Qt.Dialog
13
+ modality: Qt.WindowModal
14
+ property alias minimumValue: _progress.minimumValue
15
+ property alias maximumValue: _progress.maximumValue
16
+ property alias value: _progress.value
17
+
18
+ SystemPalette{ id: _palette }
19
+ color: _palette.window
20
+
21
+ ColumnLayout {
22
+ anchors.fill: parent
23
+ anchors.margins: 5
24
+ ProgressBar {
25
+ Layout.fillWidth: true
26
+ id: _progress
27
+ }
28
+ Button {
29
+ Layout.fillWidth: true
30
+ text: "Abort"
31
+ onClicked: { _progressDialog.close(); }
32
+ }
33
+ }
34
+ }
35
+
36
+ // vim:set ts=4 sw=4 et:
@@ -0,0 +1,3 @@
1
+ module TorQML.Views.Dialogs
2
+ TQCaptureDialog 0.1 TQCaptureDialog.qml
3
+ TQProgressDialog 0.1 TQProgressDialog.qml
@@ -0,0 +1,148 @@
1
+ import QtQuick 2.0
2
+ import QtQuick.Controls 1.1
3
+ import QtQuick.Window 2.1
4
+ import QtQuick.Layouts 1.1
5
+ import QtQuick.Dialogs 1.1
6
+ import Qt3D 2.0
7
+ import TorQML.DataSources 0.1
8
+ import TorQML.FrameGrabber 0.1
9
+ import TorQML.Views.Dialogs 0.1
10
+ import "basicview.js" as BasicViewLogic
11
+
12
+ ApplicationWindow {
13
+ property alias models: _viewport.children
14
+ property alias numberOfFrames: _slider.maximumValue
15
+ property alias msPerFrame: _timePerFrame.value
16
+ property alias light: _viewport.light
17
+ property alias camera: _viewport.camera
18
+ id: _window
19
+ flags: Qt.Dialog
20
+
21
+ visible: true
22
+ width: 640
23
+ height: 480
24
+ color: "black"
25
+
26
+ title: "TorQML Viewer"
27
+
28
+ menuBar: MenuBar {
29
+ id: _menuBar
30
+ Menu {
31
+ title: "File"
32
+ MenuItem { text: "Open..." }
33
+ MenuItem { text: "Close" }
34
+ }
35
+ Menu {
36
+ title: "Tool"
37
+ MenuItem{ text: "hogehoge" }
38
+ }
39
+ }
40
+
41
+ toolBar: ToolBar {
42
+ id: _toolBar
43
+
44
+ RowLayout {
45
+ height: 34
46
+ spacing: 5
47
+
48
+ ToolButton {
49
+ id: _playButton
50
+ iconSource: "../../../assets/images/play.png"
51
+
52
+ onClicked: {
53
+ if(_slider.value == numberOfFrames) _slider.value = 1;
54
+ _sliderTransition.start();
55
+ }
56
+ }
57
+ ToolButton {
58
+ id: _stopButton
59
+ iconSource: "../../../assets/images/stop.png"
60
+
61
+ onClicked: _sliderTransition.stop();
62
+ }
63
+
64
+ Slider {
65
+ id: _slider
66
+ property real from: 0
67
+ property real to: numberOfFrames
68
+ minimumValue: 1
69
+ maximumValue: numberOfFrames
70
+
71
+ onValueChanged: BasicViewLogic.updateFrame(value);
72
+ onMaximumValueChanged: _maxFrameText.text = "/" + numberOfFrames;
73
+ Keys.onPressed: BasicViewLogic.onKeyPressed(event);
74
+
75
+ NumberAnimation on value {
76
+ id: _sliderTransition; from: _slider.from; to: _slider.to;
77
+ duration: _timePerFrame.value * (_slider.to - _slider.from); running:false
78
+ }
79
+ }
80
+ Label {
81
+ id: _frameText
82
+ text: Math.floor(_slider.value)
83
+ }
84
+ Label { id: _maxFrameText; text: "/" + numberOfFrames }
85
+
86
+ SpinBox {
87
+ id: _timePerFrame
88
+ minimumValue: 1
89
+ value: 1
90
+
91
+ onValueChanged: BasicViewLogic.restartTransition(value);
92
+ }
93
+ Label { text: "ms/f" }
94
+
95
+ ToolButton {
96
+ id: _reloadButton
97
+ iconSource: "../../../assets/images/reload.png"
98
+
99
+ onClicked: BasicViewLogic.reloadData();
100
+ }
101
+ ToolButton {
102
+ id: _captureButton
103
+ iconSource: "../../../assets/images/capture.png"
104
+
105
+ onClicked: BasicViewLogic.showCaptureDialog();
106
+ }
107
+ }
108
+ }
109
+
110
+ statusBar: StatusBar { id: _statusBar }
111
+
112
+ TQViewport {
113
+ id: _viewport;
114
+ Keys.forwardTo: [_slider]
115
+ }
116
+
117
+ FrameGrabber { id: _frameGrabber }
118
+
119
+ TQProgressDialog { id: _progressDialog }
120
+ TQCaptureDialog {
121
+ id: _captureDialog;
122
+ Component.onCompleted: _captureConnection.target = _captureDialog;
123
+ }
124
+ Connections {
125
+ id: _captureConnection
126
+ onVisibleChanged: BasicViewLogic.onCaptureDialogClosed();
127
+ }
128
+
129
+ Timer {
130
+ id: _frameGrabberStarter;
131
+ interval: 200;
132
+ repeat: false;
133
+ onTriggered: _frameGrabberTimer.start();
134
+ }
135
+
136
+ Timer {
137
+ id: _frameGrabberTimer
138
+ property variant config
139
+ property real currentFrame
140
+ interval: 1
141
+ repeat: true
142
+ onTriggered: BasicViewLogic.captureFrame();
143
+ }
144
+
145
+ Component.onCompleted: BasicViewLogic.initialize();
146
+ }
147
+
148
+ // vim:set ts=4 sw=4 et:
@@ -0,0 +1,11 @@
1
+ import QtQuick 2.0
2
+ import Qt3D 2.0
3
+
4
+ Camera {
5
+ center: "0,0,0"
6
+ eye: "8,5,5"
7
+ nearPlane: 0.01
8
+ fieldOfView: 30
9
+ }
10
+
11
+ // vim:set ts=4 sw=4 et:
@@ -0,0 +1,41 @@
1
+ import QtQuick 2.0
2
+ import Qt3D 2.0
3
+ import "mouseEventHandler.js" as MouseEventHandler
4
+
5
+ Viewport {
6
+ id: _viewport
7
+ width: parent.width; height: parent.height
8
+ light: Light {
9
+ position: "50,80,50"
10
+ ambientColor: "white"
11
+ }
12
+ fovzoom: true
13
+ focus: true
14
+ anchors.fill: parent
15
+ camera: TQCamera {}
16
+ MouseArea {
17
+ id: _mouseArea
18
+ property bool rotating: false
19
+ property bool translating: false
20
+ property int startX: 0
21
+ property int startY: 0
22
+ property variant startEye
23
+ property variant startCenter
24
+ property variant startUpVector
25
+ anchors.fill: parent
26
+ onPressed: {
27
+ MouseEventHandler.onPressed(mouse);
28
+ }
29
+ onReleased: {
30
+ MouseEventHandler.onReleased(mouse);
31
+ }
32
+ onPositionChanged: {
33
+ MouseEventHandler.onPositionChanged(mouse);
34
+ }
35
+ onWheel: {
36
+ MouseEventHandler.onWheel(wheel);
37
+ }
38
+ }
39
+ }
40
+
41
+ // vim:set ts=4 sw=4 et: