Johannes Kreutz 3 rokov pred
rodič
commit
e282f7564e

+ 7 - 0
trackpoint-app/CMakeLists.txt

@@ -53,8 +53,15 @@ QT_ADD_EXECUTABLE(TrackpointApp
   src/MainWindow.cpp
   include/MainWindow.hpp
   gui/MainWindow.ui
+  src/NoMeshWidget.cpp
+  include/NoMeshWidget.hpp
+  gui/NoMeshWidget.ui
+  src/EditWidget.cpp
+  include/EditWidget.hpp
+  gui/EditWidget.ui
   include/OSGWidget.hpp
   src/OSGWidget.cpp
+  src/ProjectStore.cpp
   src/PickHandler.cpp
   src/StoreHandler.cpp
   src/TrackPoint.cpp

+ 116 - 0
trackpoint-app/gui/EditWidget.ui

@@ -0,0 +1,116 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>EditWidget</class>
+ <widget class="QWidget" name="EditWidget">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>508</width>
+    <height>1164</height>
+   </rect>
+  </property>
+  <property name="windowTitle">
+   <string>Form</string>
+  </property>
+  <layout class="QVBoxLayout" name="verticalLayout">
+   <property name="spacing">
+    <number>0</number>
+   </property>
+   <property name="leftMargin">
+    <number>0</number>
+   </property>
+   <property name="topMargin">
+    <number>0</number>
+   </property>
+   <property name="rightMargin">
+    <number>0</number>
+   </property>
+   <property name="bottomMargin">
+    <number>0</number>
+   </property>
+   <item>
+    <widget class="QTabWidget" name="steamvrTrackExport">
+     <property name="currentIndex">
+      <number>0</number>
+     </property>
+     <widget class="QWidget" name="optiTrack">
+      <attribute name="title">
+       <string>OptiTrack</string>
+      </attribute>
+      <layout class="QVBoxLayout" name="verticalLayout">
+       <property name="topMargin">
+        <number>3</number>
+       </property>
+       <property name="bottomMargin">
+        <number>3</number>
+       </property>
+       <item>
+        <widget class="QPushButton" name="optiTrackExport">
+         <property name="text">
+          <string>Export for use with OptiTrack</string>
+         </property>
+        </widget>
+       </item>
+      </layout>
+     </widget>
+     <widget class="QWidget" name="emfTrack">
+      <attribute name="title">
+       <string>EMF Tracking</string>
+      </attribute>
+      <layout class="QVBoxLayout" name="verticalLayout">
+       <property name="topMargin">
+        <number>3</number>
+       </property>
+       <property name="bottomMargin">
+        <number>3</number>
+       </property>
+       <item>
+        <widget class="QPushButton" name="emfTrackExport">
+         <property name="text">
+          <string>Export for use with EMF Tracking</string>
+         </property>
+        </widget>
+       </item>
+      </layout>
+     </widget>
+     <widget class="QWidget" name="steamvrTrack">
+      <attribute name="title">
+       <string>SteamVR Tracking</string>
+      </attribute>
+      <layout class="QVBoxLayout" name="verticalLayout">
+       <property name="topMargin">
+        <number>3</number>
+       </property>
+       <property name="bottomMargin">
+        <number>3</number>
+       </property>
+       <item>
+        <widget class="QPushButton" name="pushButton_2">
+         <property name="text">
+          <string>Export for use with SteamVR Tracking</string>
+         </property>
+        </widget>
+       </item>
+      </layout>
+     </widget>
+     <widget class="QWidget" name="actionPoints">
+      <attribute name="title">
+       <string>Action Points</string>
+      </attribute>
+      <layout class="QVBoxLayout" name="verticalLayout">
+       <property name="topMargin">
+        <number>3</number>
+       </property>
+       <property name="bottomMargin">
+        <number>3</number>
+       </property>
+      </layout>
+     </widget>
+    </widget>
+   </item>
+  </layout>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>

+ 16 - 9
trackpoint-app/gui/MainWindow.ui

@@ -15,6 +15,21 @@
   </property>
   <widget class="QWidget" name="centralwidget">
    <layout class="QHBoxLayout" name="horizontalLayout">
+    <property name="spacing">
+     <number>0</number>
+    </property>
+    <property name="leftMargin">
+     <number>0</number>
+    </property>
+    <property name="topMargin">
+     <number>0</number>
+    </property>
+    <property name="rightMargin">
+     <number>0</number>
+    </property>
+    <property name="bottomMargin">
+     <number>0</number>
+    </property>
     <item>
      <widget class="QWidget" name="controlWidget" native="true">
       <property name="sizePolicy">
@@ -23,15 +38,7 @@
         <verstretch>0</verstretch>
        </sizepolicy>
       </property>
-      <layout class="QVBoxLayout" name="verticalLayout">
-       <item>
-        <widget class="QPushButton" name="pushButton">
-         <property name="text">
-          <string>PushButton</string>
-         </property>
-        </widget>
-       </item>
-      </layout>
+      <layout class="QVBoxLayout" name="verticalLayout"/>
      </widget>
     </item>
     <item>

+ 89 - 0
trackpoint-app/gui/NoMeshWidget.ui

@@ -0,0 +1,89 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>NoMeshWidget</class>
+ <widget class="QWidget" name="NoMeshWidget">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>400</width>
+    <height>300</height>
+   </rect>
+  </property>
+  <property name="windowTitle">
+   <string>Form</string>
+  </property>
+  <layout class="QVBoxLayout" name="verticalLayout_2">
+   <property name="spacing">
+    <number>0</number>
+   </property>
+   <property name="leftMargin">
+    <number>0</number>
+   </property>
+   <property name="topMargin">
+    <number>0</number>
+   </property>
+   <property name="rightMargin">
+    <number>0</number>
+   </property>
+   <property name="bottomMargin">
+    <number>0</number>
+   </property>
+   <item>
+    <widget class="QLabel" name="noMeshTitle">
+     <property name="font">
+      <font>
+       <pointsize>16</pointsize>
+       <weight>75</weight>
+       <bold>true</bold>
+       <kerning>true</kerning>
+      </font>
+     </property>
+     <property name="text">
+      <string>No Mesh loaded.</string>
+     </property>
+     <property name="alignment">
+      <set>Qt::AlignCenter</set>
+     </property>
+    </widget>
+   </item>
+   <item>
+    <widget class="QLabel" name="noMeshExplanation">
+     <property name="font">
+      <font>
+       <pointsize>10</pointsize>
+      </font>
+     </property>
+     <property name="text">
+      <string>You can load a .3mf or a .stl file to use the mesh as basis for this trackpoint project.</string>
+     </property>
+     <property name="wordWrap">
+      <bool>true</bool>
+     </property>
+    </widget>
+   </item>
+   <item>
+    <widget class="QPushButton" name="noMeshButton">
+     <property name="text">
+      <string>Load Mesh file</string>
+     </property>
+    </widget>
+   </item>
+   <item>
+    <spacer name="verticalSpacer">
+     <property name="orientation">
+      <enum>Qt::Vertical</enum>
+     </property>
+     <property name="sizeHint" stdset="0">
+      <size>
+       <width>20</width>
+       <height>40</height>
+      </size>
+     </property>
+    </spacer>
+   </item>
+  </layout>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>

+ 18 - 0
trackpoint-app/include/EditWidget.hpp

@@ -0,0 +1,18 @@
+#pragma once
+
+#include <QWidget>
+
+QT_BEGIN_NAMESPACE
+namespace Ui { class EditWidget; }
+QT_END_NAMESPACE
+
+class EditWidget: public QWidget {
+  Q_OBJECT
+
+public:
+  EditWidget(QWidget* parent = nullptr);
+  ~EditWidget();
+
+private:
+  Ui::EditWidget* ui;
+};

+ 12 - 1
trackpoint-app/include/MainWindow.hpp

@@ -1,6 +1,8 @@
 #pragma once
 
 #include "OSGWidget.hpp"
+#include "NoMeshWidget.hpp"
+#include "EditWidget.hpp"
 
 #include <QMainWindow>
 
@@ -8,14 +10,23 @@ QT_BEGIN_NAMESPACE
 namespace Ui { class MainWindow; }
 QT_END_NAMESPACE
 
+enum GuiView {
+  NoMesh,
+  Edit,
+};
+
 class MainWindow: public QMainWindow {
   Q_OBJECT
 
 public:
-  MainWindow( QWidget* parent = nullptr );
+  MainWindow(QWidget* parent = nullptr);
   ~MainWindow();
+  void renderView(GuiView view);
 
 private:
+  void openFile();
   Ui::MainWindow* ui;
   OSGWidget* osgWidget;
+  NoMeshWidget* noMeshWidget;
+  EditWidget* editWidget;
 };

+ 18 - 0
trackpoint-app/include/NoMeshWidget.hpp

@@ -0,0 +1,18 @@
+#pragma once
+
+#include <QWidget>
+
+QT_BEGIN_NAMESPACE
+namespace Ui { class NoMeshWidget; }
+QT_END_NAMESPACE
+
+class NoMeshWidget: public QWidget {
+  Q_OBJECT
+
+public:
+  NoMeshWidget(QWidget* parent = nullptr);
+  ~NoMeshWidget();
+
+private:
+  Ui::NoMeshWidget* ui;
+};

+ 16 - 0
trackpoint-app/include/ProjectStore.hpp

@@ -0,0 +1,16 @@
+#pragma once
+
+#include <QString>
+
+class ProjectStore {
+public:
+  // Create an empty project
+  ProjectStore();
+  // Load an existing project
+  ProjectStore(QString projectFile);
+  // Load a mesh
+  void loadMesh(QString meshFile);
+
+private:
+  bool projectLoaded;
+};

+ 10 - 0
trackpoint-app/src/EditWidget.cpp

@@ -0,0 +1,10 @@
+#include "EditWidget.hpp"
+#include "../gui/ui_EditWidget.h"
+
+EditWidget::EditWidget(QWidget* parent): QWidget(parent), ui(new Ui::EditWidget) {
+  ui->setupUi(this);
+}
+
+EditWidget::~EditWidget() {
+  delete ui;
+}

+ 26 - 3
trackpoint-app/src/MainWindow.cpp

@@ -1,14 +1,37 @@
 #include "MainWindow.hpp"
 #include "../gui/ui_MainWindow.h"
 
+#include <QFileDialog>
+
 MainWindow::MainWindow(QWidget* parent): QMainWindow(parent), ui(new Ui::MainWindow) {
   ui->setupUi(this);
 
-  osgWidget = new OSGWidget(nullptr);
+  osgWidget = new OSGWidget(this);
   ui->sceneWidget->layout()->addWidget(osgWidget);
+
+  renderView(Edit);
 }
 
-MainWindow::~MainWindow()
-{
+MainWindow::~MainWindow() {
   delete ui;
+  delete osgWidget;
+}
+
+void MainWindow::renderView(GuiView view) {
+  switch(view) {
+    case NoMesh: {
+      noMeshWidget = new NoMeshWidget(this);
+      ui->controlWidget->layout()->addWidget(noMeshWidget);
+      break;
+    }
+    case Edit: {
+      editWidget = new EditWidget(this);
+      ui->controlWidget->layout()->addWidget(editWidget);
+      break;
+    }
+  }
+}
+
+void MainWindow::openFile() {
+  QString fileName = QFileDialog::getOpenFileName(this, tr("Open a TrackpointApp project or a 3D-Object"), "", tr("TrackpointApp Project (*.trackproj);;3MF File (*.3mf);;STL File (*.stl)"));
 }

+ 10 - 0
trackpoint-app/src/NoMeshWidget.cpp

@@ -0,0 +1,10 @@
+#include "NoMeshWidget.hpp"
+#include "../gui/ui_NoMeshWidget.h"
+
+NoMeshWidget::NoMeshWidget(QWidget* parent): QWidget(parent), ui(new Ui::NoMeshWidget) {
+  ui->setupUi(this);
+}
+
+NoMeshWidget::~NoMeshWidget() {
+  delete ui;
+}

+ 13 - 0
trackpoint-app/src/ProjectStore.cpp

@@ -0,0 +1,13 @@
+#include "ProjectStore.hpp"
+
+ProjectStore::ProjectStore() {
+  projectLoaded = false;
+}
+
+ProjectStore::ProjectStore(QString projectFile) {
+
+}
+
+void ProjectStore::loadMesh(QString meshFile) {
+  
+}