ProjectStore.hpp 3.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. #pragma once
  2. // Include modules
  3. #include "lib3mf_implicit.hpp"
  4. #include "OptiTrackPoint.hpp"
  5. #include "SteamVRTrackPoint.hpp"
  6. #include "ActionPoint.hpp"
  7. #include "TrackSystemSettingsStructs.hpp"
  8. #include "OpenScadRenderer.hpp"
  9. #include "enums.hpp"
  10. // Include dependencies
  11. #include <string>
  12. #include <nlohmann/json.hpp>
  13. using json = nlohmann::json;
  14. class ProjectStore {
  15. public:
  16. // Create an empty project
  17. ProjectStore();
  18. // Destructor
  19. ~ProjectStore();
  20. // Load a mesh
  21. void loadMesh(std::string meshFile);
  22. // Load a project
  23. bool loadProject(std::string projectFile);
  24. // Save the project to the loaded file
  25. bool saveProject();
  26. // Save the project to a new file
  27. bool saveProject(std::string projectFile);
  28. // Export the project
  29. bool exportProject(std::string path, ExportSettings settings);
  30. // UNIVERSAL
  31. // Get trackpoint
  32. TrackPoint* getTrackPointById(int id, ActiveTrackingSystem activeTrackingSystem);
  33. // Add trackpoint
  34. void addTrackPoint(osg::Vec3 point, osg::Vec3 normal, ActiveTrackingSystem activeTrackingSystem);
  35. // Count trackpoints
  36. int getCount(ActiveTrackingSystem activeTrackingSystem);
  37. // Remove trackpoint
  38. void removeTrackPoint(int id, ActiveTrackingSystem activeTrackingSystem);
  39. // NORMAL MODIFIER
  40. // Update normal modifier
  41. void updateNormalModifier(osg::Vec3 modifier);
  42. // Return normal modifier
  43. osg::Vec3 getNormalModifier();
  44. // OPTITRACK
  45. // Get all OptiTrack points
  46. std::vector<OptiTrackPoint*> getOptiTrackPoints();
  47. // Update actual OptiTrack settings
  48. void updateOptiTrackSettings(OptiTrackSettings optiTrackSettings);
  49. // Return OptiTrack settings
  50. OptiTrackSettings getOptiTrackSettings();
  51. // STEAM VR TRACK
  52. // Get all SteamVRTrack points
  53. std::vector<SteamVRTrackPoint*> getSteamVRTrackPoints();
  54. // Update actual SteamVRTrack settings
  55. void updateSteamVRTrackSettings(SteamVRTrackSettings steamVrTrackSettings);
  56. // Return SteamVRTrack settings
  57. SteamVRTrackSettings getSteamVRTrackSettings();
  58. // ACTION POINTS
  59. // Get all Action points
  60. std::vector<ActionPoint*> getActionPoints();
  61. // Update actual Action point settings
  62. void updateActionPointSettings(ActionPointSettings actionPointSettings);
  63. // Return Action point settings
  64. ActionPointSettings getActionPointSettings();
  65. // Check if an identifier is already in use
  66. bool actionPointIdentifierInUse(std::string candidate);
  67. private:
  68. bool _projectLoaded;
  69. bool _projectModified;
  70. Lib3MF::PWrapper _wrapper;
  71. Lib3MF::PModel _project;
  72. std::string _projectFile;
  73. std::vector<OptiTrackPoint*> _optiTrackPoints;
  74. std::vector<SteamVRTrackPoint*> _steamVrTrackPoints;
  75. std::vector<ActionPoint*> _actionPoints;
  76. OptiTrackSettings _optiTrackSettings = OptiTrackSettings {OPTITRACK_DEFAULT_LENGTH, OPTITRACK_DEFAULT_RADIUS};
  77. EMFTrackSettings _emfTrackSettings;
  78. SteamVRTrackSettings _steamVrTrackSettings = SteamVRTrackSettings {STEAMVR_DEFAULT_LENGTH};
  79. ActionPointSettings _actionPointSettings = ActionPointSettings {ACTIONPOINT_DEFAULT_IDENFIFIER};
  80. osg::Vec3 _normalModifier = osg::Vec3(0.0f, 0.0f, 0.0f);
  81. void load3mfLib();
  82. void render3MFMesh();
  83. void updateMetaData();
  84. void loadMetaData();
  85. std::vector<float> osgVecToStdVec(osg::Vec3f input);
  86. osg::Vec3f stdVecToOsgVec(std::vector<float> input);
  87. };