diff --git a/.clang-format b/.clang-format new file mode 100644 index 0000000000000000000000000000000000000000..2b27bb2f4aa05f653de31138a2ac2b24a850aa84 --- /dev/null +++ b/.clang-format @@ -0,0 +1,104 @@ +--- +Language: Cpp +Standard: Cpp11 +UseTab: Never +TabWidth: 4 +IndentWidth: 4 +AccessModifierOffset: -4 +ContinuationIndentWidth: 4 +ColumnLimit: 79 +ConstructorInitializerIndentWidth: 0 +BinPackArguments: false +BinPackParameters: false +AlignAfterOpenBracket: Align +AlignConsecutiveAssignments: true +AlignConsecutiveDeclarations: true +AlignOperands: true +AlignEscapedNewlines: Right +AlignTrailingComments: true +AllowAllArgumentsOnNextLine: false +AllowAllConstructorInitializersOnNextLine: false +ConstructorInitializerAllOnOneLineOrOnePerLine: false +AllowAllParametersOfDeclarationOnNextLine: false +AllowShortBlocksOnASingleLine: false +AllowShortCaseLabelsOnASingleLine: false +AllowShortFunctionsOnASingleLine: None +AllowShortIfStatementsOnASingleLine: Never +AllowShortLoopsOnASingleLine: false +AlwaysBreakAfterReturnType: None +AlwaysBreakBeforeMultilineStrings: true +AlwaysBreakTemplateDeclarations: Yes +BreakBeforeBraces: Custom +BraceWrapping: + AfterClass: true + AfterControlStatement: false + AfterEnum: false + AfterFunction: true + AfterNamespace: true + AfterObjCDeclaration: false + AfterStruct: true + AfterUnion: false + AfterExternBlock: false + BeforeCatch: false + BeforeElse: false + IndentBraces: false + SplitEmptyFunction: true + SplitEmptyRecord: true + SplitEmptyNamespace: true +BreakBeforeBinaryOperators: None +BreakBeforeInheritanceComma: false +BreakInheritanceList: BeforeColon +BreakBeforeTernaryOperators: true +BreakConstructorInitializers: BeforeComma +BreakAfterJavaFieldAnnotations: false +BreakStringLiterals: true +CompactNamespaces: false +Cpp11BracedListStyle: true +DerivePointerAlignment: false +DisableFormat: false +ExperimentalAutoDetectBinPacking: false +FixNamespaceComments: false +IndentCaseLabels: false +IndentPPDirectives: BeforeHash +IndentWrappedFunctionNames: true +KeepEmptyLinesAtTheStartOfBlocks: true +MaxEmptyLinesToKeep: 1 +NamespaceIndentation: All +PointerAlignment: Left +ReflowComments: true +SortIncludes: false +SortUsingDeclarations: true +SpaceAfterCStyleCast: true +SpaceAfterTemplateKeyword: false +SpaceBeforeAssignmentOperators: true +SpaceBeforeCpp11BracedList: false +SpaceBeforeCtorInitializerColon: true +SpaceBeforeInheritanceColon: true +SpaceBeforeParens: ControlStatements +SpaceBeforeRangeBasedForLoopColon: true +SpaceInEmptyParentheses: false +SpacesBeforeTrailingComments: 1 +SpacesInAngles: false +SpacesInContainerLiterals: false +SpacesInCStyleCastParentheses: false +SpacesInParentheses: false +SpacesInSquareBrackets: false +PenaltyBreakAssignment: 100 +PenaltyBreakBeforeFirstCallParameter: 19 +PenaltyBreakComment: 300 +PenaltyBreakFirstLessLess: 120 +PenaltyBreakString: 1000 +PenaltyBreakTemplateDeclaration: 10 +PenaltyExcessCharacter: 1000000 +PenaltyReturnTypeOnItsOwnLine: 1000 +CommentPragmas: '' +MacroBlockBegin: '' +MacroBlockEnd: '' +ForEachMacros: + - foreach + - Q_FOREACH + - BOOST_FOREACH +StatementMacros: + - Q_UNUSED + - QT_REQUIRE_VERSION +... diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000000000000000000000000000000000000..7b80d1c534ecc2c161a0b02606664db720304395 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,19 @@ +root = true + +[*] +charset = utf-8 +end_of_line = lf +trim_trailing_whitespace = true +insert_final_newline = true + +[*.{c,h,cc,hh,cpp,hpp,cxx,hxx}] +indent_style = space +indent_size = 4 + +[*.py] +indent_style = space +indent_size = 4 + +[*.yml] +indent_style = space +indent_size = 2 diff --git a/Src/Interfaces/ENUMS.h b/Src/Interfaces/ENUMS.h index d621066883ec666a1a9740d44be63a4d3cf97f5b..f5f003927145a34434fba68d4bb98a212f905586 100644 --- a/Src/Interfaces/ENUMS.h +++ b/Src/Interfaces/ENUMS.h @@ -7,35 +7,32 @@ class BT_INTERFACES_API ENUMS : public QObject { Q_OBJECT public: - - - enum CONTROLLERTYPE : unsigned int{ - NO_CTR, - MAINWINDOW, - TEXTUREOBJECT, - PLAYER, - COMPONENT, - TRACKING, - GRAPHICSVIEW, - TRACKEDCOMPONENTCORE, - PLUGIN, - DATAEXPORT, - ANNOTATIONS, - AREADESCRIPTOR, - COREPARAMETER, - COMMANDS, - NOTIFICATION - }; + enum CONTROLLERTYPE : unsigned int { + NO_CTR, + MAINWINDOW, + TEXTUREOBJECT, + PLAYER, + COMPONENT, + TRACKING, + GRAPHICSVIEW, + TRACKEDCOMPONENTCORE, + PLUGIN, + DATAEXPORT, + ANNOTATIONS, + AREADESCRIPTOR, + COREPARAMETER, + COMMANDS, + NOTIFICATION + }; Q_ENUM(CONTROLLERTYPE) - enum COREPERMISSIONS : unsigned int{ - COMPONENTVIEW, - COMPONENTMOVE, - COMPONENTREMOVE, - COMPONENTSWAP, - COMPONENTADD, - COMPONENTROTATE - }; - Q_ENUM(COREPERMISSIONS) + enum COREPERMISSIONS : unsigned int { + COMPONENTVIEW, + COMPONENTMOVE, + COMPONENTREMOVE, + COMPONENTSWAP, + COMPONENTADD, + COMPONENTROTATE + }; + Q_ENUM(COREPERMISSIONS) }; - diff --git a/Src/Interfaces/IBioTrackerContext.cpp b/Src/Interfaces/IBioTrackerContext.cpp index 9eb71ed0236c88070c3b8e0390dabc0f6cafeaaf..9f833c6640cca4feb45e8ca4c1311b033d850815 100644 --- a/Src/Interfaces/IBioTrackerContext.cpp +++ b/Src/Interfaces/IBioTrackerContext.cpp @@ -3,11 +3,9 @@ #include "QDebug" - -IBioTrackerContext::IBioTrackerContext(QObject *parent) : - QObject(parent) +IBioTrackerContext::IBioTrackerContext(QObject* parent) +: QObject(parent) { - } void IBioTrackerContext::createApplication() @@ -16,23 +14,21 @@ void IBioTrackerContext::createApplication() connectController(); } - void IBioTrackerContext::createAppController() { - } -IController *IBioTrackerContext::requestController(ENUMS::CONTROLLERTYPE ctrtype) +IController* IBioTrackerContext::requestController( + ENUMS::CONTROLLERTYPE ctrtype) { return m_ControllersMap.value(ctrtype); } void IBioTrackerContext::connectController() { - } -void IBioTrackerContext::addController(IController *ctr) +void IBioTrackerContext::addController(IController* ctr) { m_ControllersMap.insert(ctr->getControllerType(), ctr); } diff --git a/Src/Interfaces/IBioTrackerContext.h b/Src/Interfaces/IBioTrackerContext.h index 23eb20324c6f4c6cef9c06b08de83ea950280fb9..424336f5bc646d52aa13c760eb19cc1de8d7c6c0 100644 --- a/Src/Interfaces/IBioTrackerContext.h +++ b/Src/Interfaces/IBioTrackerContext.h @@ -11,21 +11,21 @@ class BT_INTERFACES_API IBioTrackerContext : public QObject { Q_OBJECT public: - IBioTrackerContext(QObject *parent = 0); - ~IBioTrackerContext() {} + IBioTrackerContext(QObject* parent = 0); + ~IBioTrackerContext() + { + } void createApplication(); - IController * requestController(ENUMS::CONTROLLERTYPE ctrtype); + IController* requestController(ENUMS::CONTROLLERTYPE ctrtype); protected: virtual void createAppController(); virtual void connectController(); - void addController(IController * ctr); -protected: - QMap<ENUMS::CONTROLLERTYPE, IController *> m_ControllersMap; - - + void addController(IController* ctr); +protected: + QMap<ENUMS::CONTROLLERTYPE, IController*> m_ControllersMap; }; diff --git a/Src/Interfaces/IBioTrackerPlugin.cpp b/Src/Interfaces/IBioTrackerPlugin.cpp index 6e00a5517fe7c6e4c0ea8dd588d5a50fe6fe743e..82368411df730e9c9932927b0c52e2531cea50c2 100644 --- a/Src/Interfaces/IBioTrackerPlugin.cpp +++ b/Src/Interfaces/IBioTrackerPlugin.cpp @@ -1,9 +1,30 @@ #include "IBioTrackerPlugin.h" -IView *IBioTrackerPlugin::getTrackerParameterWidget() { return nullptr; }; -IView *IBioTrackerPlugin::getTrackerElementsWidget() { return nullptr; }; -IModel *IBioTrackerPlugin::getTrackerComponentModel() { return nullptr; }; -void IBioTrackerPlugin::sendCorePermissions() { return; }; -IModelTrackedComponentFactory *IBioTrackerPlugin::getComponentFactory() { return nullptr; }; -void IBioTrackerPlugin::connectInterfaces() { return; }; -void IBioTrackerPlugin::receiveAreaDescriptor(IModelAreaDescriptor *areaDescr) { return; }; \ No newline at end of file +IView* IBioTrackerPlugin::getTrackerParameterWidget() +{ + return nullptr; +}; +IView* IBioTrackerPlugin::getTrackerElementsWidget() +{ + return nullptr; +}; +IModel* IBioTrackerPlugin::getTrackerComponentModel() +{ + return nullptr; +}; +void IBioTrackerPlugin::sendCorePermissions() +{ + return; +}; +IModelTrackedComponentFactory* IBioTrackerPlugin::getComponentFactory() +{ + return nullptr; +}; +void IBioTrackerPlugin::connectInterfaces() +{ + return; +}; +void IBioTrackerPlugin::receiveAreaDescriptor(IModelAreaDescriptor* areaDescr) +{ + return; +}; \ No newline at end of file diff --git a/Src/Interfaces/IBioTrackerPlugin.h b/Src/Interfaces/IBioTrackerPlugin.h index 808a25847301e38f3e5266f23b7d3069e00dd8ce..e98547d62f50b3eb0671986c8a4a6ca1ad0b5cf1 100644 --- a/Src/Interfaces/IBioTrackerPlugin.h +++ b/Src/Interfaces/IBioTrackerPlugin.h @@ -10,35 +10,36 @@ #include "memory" #include <Interfaces/API.h> - class BT_INTERFACES_API IBioTrackerPlugin : public QObject { Q_OBJECT public: - ~IBioTrackerPlugin() {} + ~IBioTrackerPlugin() + { + } virtual void createPlugin() = 0; - /** - * Hook for the tracker options to add to the GUI - */ - virtual IView *getTrackerParameterWidget(); - /** - * Hook for the tracking data visualization of the tracker - */ - virtual IView *getTrackerElementsWidget(); - /** - * Hook for the tracking data to visualize and export in the core app - */ - virtual IModel *getTrackerComponentModel(); - /** - * Hook for the core permissions - */ + /** + * Hook for the tracker options to add to the GUI + */ + virtual IView* getTrackerParameterWidget(); + /** + * Hook for the tracking data visualization of the tracker + */ + virtual IView* getTrackerElementsWidget(); + /** + * Hook for the tracking data to visualize and export in the core app + */ + virtual IModel* getTrackerComponentModel(); + /** + * Hook for the core permissions + */ virtual void sendCorePermissions(); - /** - * Hook for the component factory to deserialize in the core app - */ - virtual IModelTrackedComponentFactory *getComponentFactory(); + /** + * Hook for the component factory to deserialize in the core app + */ + virtual IModelTrackedComponentFactory* getComponentFactory(); private: virtual void connectInterfaces(); @@ -46,22 +47,25 @@ private: Q_SIGNALS: void emitCvMat(std::shared_ptr<cv::Mat> mat, QString name); /** - * Will be sent when tracking is doen to multiple components of the core app - * An example is the visualisation which is then updated - */ + * Will be sent when tracking is doen to multiple components of the core + * app An example is the visualisation which is then updated + */ void emitTrackingDone(uint framenumber); void emitChangeDisplayImage(QString str); void emitCorePermission(std::pair<ENUMS::COREPERMISSIONS, bool>); public Q_SLOTS: - virtual void receiveCurrentFrameFromMainApp(std::shared_ptr<cv::Mat> mat, uint frameNumber) = 0; - /** - * Recieves area descriptor data for rectification (px to cm) and for tracking arena boundary - */ - virtual void receiveAreaDescriptor(IModelAreaDescriptor *areaDescr); + virtual void receiveCurrentFrameFromMainApp(std::shared_ptr<cv::Mat> mat, + uint frameNumber) = 0; + /** + * Recieves area descriptor data for rectification (px to cm) and for + * tracking arena boundary + */ + virtual void receiveAreaDescriptor(IModelAreaDescriptor* areaDescr); -//private Q_SLOTS: -// virtual void receiveCvMatFromController(std::shared_ptr<cv::Mat> mat, QString name) = 0; + // private Q_SLOTS: + // virtual void receiveCvMatFromController(std::shared_ptr<cv::Mat> mat, + // QString name) = 0; }; #define IBioTrackerPlugin_iid "de.fu-berlin.mi.biorobotics.IBioTrackerPlugin" diff --git a/Src/Interfaces/IController/IController.cpp b/Src/Interfaces/IController/IController.cpp index 9c898cd9d428e397453599f1240399dd7dc2f815..8447ff4e030755825e8f086f652b6795dbf985ca 100644 --- a/Src/Interfaces/IController/IController.cpp +++ b/Src/Interfaces/IController/IController.cpp @@ -1,25 +1,25 @@ #include "IController.h" - -IController::IController(QObject *parent, IBioTrackerContext *context, ENUMS::CONTROLLERTYPE ctr) : QObject(parent), - m_BioTrackerContext(context), - m_ControllerType(ctr) +IController::IController(QObject* parent, + IBioTrackerContext* context, + ENUMS::CONTROLLERTYPE ctr) +: QObject(parent) +, m_BioTrackerContext(context) +, m_ControllerType(ctr) { - } -void IController::cleanup() { - +void IController::cleanup() +{ } -IBioTrackerContext *IController::getBioTrackerContext() +IBioTrackerContext* IController::getBioTrackerContext() { return m_BioTrackerContext.data(); } void IController::connectModelToController() { - } void IController::createComponents() @@ -34,19 +34,23 @@ void IController::connectComponents() connectControllerToController(); } -void IController::addView(IView *view) { +void IController::addView(IView* view) +{ m_View = view; } -void IController::addModel(IModel *model) { +void IController::addModel(IModel* model) +{ m_Model = model; } -IModel *IController::getModel() { +IModel* IController::getModel() +{ return m_Model.data(); } -IView *IController::getView() { +IView* IController::getView() +{ return m_View; } diff --git a/Src/Interfaces/IController/IController.h b/Src/Interfaces/IController/IController.h index e557ae394d937755db84e3f41bf2315f0a87bd85..0bef854ab6bde7bd9de62b770b303a65f7a80702 100644 --- a/Src/Interfaces/IController/IController.h +++ b/Src/Interfaces/IController/IController.h @@ -12,10 +12,14 @@ #include "Interfaces/ENUMS.h" #include <Interfaces/API.h> -class BT_INTERFACES_API IController : public QObject { +class BT_INTERFACES_API IController : public QObject +{ Q_OBJECT - public: - explicit IController(QObject *parent = 0, IBioTrackerContext *context = 0, ENUMS::CONTROLLERTYPE ctr = ENUMS::CONTROLLERTYPE::NO_CTR); +public: + explicit IController( + QObject* parent = 0, + IBioTrackerContext* context = 0, + ENUMS::CONTROLLERTYPE ctr = ENUMS::CONTROLLERTYPE::NO_CTR); /** * @brief @@ -29,28 +33,27 @@ class BT_INTERFACES_API IController : public QObject { virtual void cleanup(); - void addView(IView *view); - void addModel(IModel *model); - IModel *getModel(); - IView *getView(); + void addView(IView* view); + void addModel(IModel* model); + IModel* getModel(); + IView* getView(); ENUMS::CONTROLLERTYPE getControllerType(); - IBioTrackerContext *getBioTrackerContext(); + IBioTrackerContext* getBioTrackerContext(); protected: - virtual void createModel() = 0; - virtual void createView() = 0; - virtual void connectModelToController() = 0; + virtual void createModel() = 0; + virtual void createView() = 0; + virtual void connectModelToController() = 0; virtual void connectControllerToController() = 0; protected: - QPointer< IBioTrackerContext > m_BioTrackerContext; + QPointer<IBioTrackerContext> m_BioTrackerContext; - IView *m_View; + IView* m_View; QPointer<IModel> m_Model; ENUMS::CONTROLLERTYPE m_ControllerType; - }; #endif // ICONTROLLER_H diff --git a/Src/Interfaces/IModel/IModel.cpp b/Src/Interfaces/IModel/IModel.cpp index 3de1fa44e841e08714baaaab74371abe313ba3e6..a6ba7915c8229f7a6bad8a3c2a570755cdec7889 100644 --- a/Src/Interfaces/IModel/IModel.cpp +++ b/Src/Interfaces/IModel/IModel.cpp @@ -1,9 +1,10 @@ #include "IModel.h" -IModel::IModel(QObject *parent) : QObject(parent) { - +IModel::IModel(QObject* parent) +: QObject(parent) +{ } -IModel::~IModel() { - +IModel::~IModel() +{ } diff --git a/Src/Interfaces/IModel/IModel.h b/Src/Interfaces/IModel/IModel.h index 6f8e887ad6a08967dbfe163122761b82ecf191ab..da1c2f230643919b15558a8d495b4aeef67fa1b2 100644 --- a/Src/Interfaces/IModel/IModel.h +++ b/Src/Interfaces/IModel/IModel.h @@ -4,15 +4,16 @@ #include "memory" #include <Interfaces/API.h> -class BT_INTERFACES_API IModel : public QObject { +class BT_INTERFACES_API IModel : public QObject +{ Q_OBJECT - public: - explicit IModel(QObject *parent = 0); +public: + explicit IModel(QObject* parent = 0); ~IModel(); - Q_SIGNALS: +Q_SIGNALS: void notifyView(); - public Q_SLOTS: +public Q_SLOTS: }; diff --git a/Src/Interfaces/IModel/IModelAreaDescriptor.h b/Src/Interfaces/IModel/IModelAreaDescriptor.h index 5124f90f7e40cd1e98c35da557dcd8fb1b67243b..de4cb9274a48dab674dee37de229f3157a2d9247 100644 --- a/Src/Interfaces/IModel/IModelAreaDescriptor.h +++ b/Src/Interfaces/IModel/IModelAreaDescriptor.h @@ -4,32 +4,33 @@ #include <string.h> #include <opencv2/opencv.hpp> -class BT_INTERFACES_API IModelAreaDescriptor :public IModel +class BT_INTERFACES_API IModelAreaDescriptor : public IModel { - Q_OBJECT + Q_OBJECT public: - IModelAreaDescriptor(QObject *parent = 0) : IModel(parent) {}; - //~IModelAreaDescriptor(); - -public: - - virtual bool inTrackingArea(cv::Point2f point_cm) = 0; - - /** - * Transform the provided pixel coordinates into world coordinates and return world coordinates. - * @param: pixelCoords, a list of points. - * @return: world coordinates in as a list. - */ - virtual cv::Point2f pxToCm(cv::Point point_px) = 0; + IModelAreaDescriptor(QObject* parent = 0) + : IModel(parent){}; + //~IModelAreaDescriptor(); - /** - * Transform the provided pixel point into world coordinates and return world point. - * @param: point, a pixel point, used opencv point - * @return: world point. - */ - virtual cv::Point2f cmToPx(cv::Point2f point_cm) = 0; public: + virtual bool inTrackingArea(cv::Point2f point_cm) = 0; + + /** + * Transform the provided pixel coordinates into world coordinates and + * return world coordinates. + * @param: pixelCoords, a list of points. + * @return: world coordinates in as a list. + */ + virtual cv::Point2f pxToCm(cv::Point point_px) = 0; + + /** + * Transform the provided pixel point into world coordinates and return + * world point. + * @param: point, a pixel point, used opencv point + * @return: world point. + */ + virtual cv::Point2f cmToPx(cv::Point2f point_cm) = 0; +public: }; - diff --git a/Src/Interfaces/IModel/IModelDataExporter.cpp b/Src/Interfaces/IModel/IModelDataExporter.cpp index 672137e8b463864a8a3c2a711cd69cbfcf2d0c0c..ce6393493370828b85ef441b0a27e874c1f55b8a 100644 --- a/Src/Interfaces/IModel/IModelDataExporter.cpp +++ b/Src/Interfaces/IModel/IModelDataExporter.cpp @@ -1,13 +1,10 @@ #include "IModelDataExporter.h" - - -IModelDataExporter::IModelDataExporter(QObject *parent) : - IModel(parent) +IModelDataExporter::IModelDataExporter(QObject* parent) +: IModel(parent) { } - IModelDataExporter::~IModelDataExporter() { } diff --git a/Src/Interfaces/IModel/IModelDataExporter.h b/Src/Interfaces/IModel/IModelDataExporter.h index 4d4f7ac46cc9e1e4e4d6a77f53018eafb053c583..da6d1e0e970023377f75bbf780f09ce92dfba767 100644 --- a/Src/Interfaces/IModel/IModelDataExporter.h +++ b/Src/Interfaces/IModel/IModelDataExporter.h @@ -6,36 +6,41 @@ #include <string.h> #include <qfileinfo.h> /** -* Interface for the data exporters in the core app -* Besides serializing to files also includes deserializing from files -* Current exporters are CSV, generic and JSON. -*/ -class BT_INTERFACES_API IModelDataExporter :public IModel + * Interface for the data exporters in the core app + * Besides serializing to files also includes deserializing from files + * Current exporters are CSV, generic and JSON. + */ +class BT_INTERFACES_API IModelDataExporter : public IModel { - Q_OBJECT + Q_OBJECT public: - IModelDataExporter(QObject *parent = 0); - ~IModelDataExporter(); + IModelDataExporter(QObject* parent = 0); + ~IModelDataExporter(); - virtual void open(IModelTrackedTrajectory *root) = 0; - virtual void write(int idx) = 0; - virtual void writeAll(std::string f) = 0; - virtual void close() = 0; - virtual void finalizeAndReInit() = 0; - void setFps(float fps) { _fps = fps; }; - void setTitle(std::string title) { _title = title; }; - virtual void finalize() = 0; + virtual void open(IModelTrackedTrajectory* root) = 0; + virtual void write(int idx) = 0; + virtual void writeAll(std::string f) = 0; + virtual void close() = 0; + virtual void finalizeAndReInit() = 0; + void setFps(float fps) + { + _fps = fps; + }; + void setTitle(std::string title) + { + _title = title; + }; + virtual void finalize() = 0; - virtual void loadFile(std::string file) = 0; - virtual QString getSuffix() = 0; + virtual void loadFile(std::string file) = 0; + virtual QString getSuffix() = 0; public: - IModelTrackedTrajectory *_root; - float _fps; - std::string _title; + IModelTrackedTrajectory* _root; + float _fps; + std::string _title; signals: - void fileWritten(QFileInfo file); + void fileWritten(QFileInfo file); }; - diff --git a/Src/Interfaces/IModel/IModelTrackedComponent.cpp b/Src/Interfaces/IModel/IModelTrackedComponent.cpp index 1dd5f654bd3dfd2a0dffb6d600e508b6f571a68f..381fd375a26b15a95b320bfb0114713ede3d9464 100644 --- a/Src/Interfaces/IModel/IModelTrackedComponent.cpp +++ b/Src/Interfaces/IModel/IModelTrackedComponent.cpp @@ -6,52 +6,46 @@ IModelTrackedComponentFactory* factory = nullptr; -IModelTrackedComponent::IModelTrackedComponent(QObject *parent) : - IModel(parent) +IModelTrackedComponent::IModelTrackedComponent(QObject* parent) +: IModel(parent) { - } -IModelComponentEuclidian2D::IModelComponentEuclidian2D(QObject *parent) : - IModelTrackedComponent(parent) +IModelComponentEuclidian2D::IModelComponentEuclidian2D(QObject* parent) +: IModelTrackedComponent(parent) { - } -IModelComponentTemporal2D::IModelComponentTemporal2D(QObject *parent) : - IModelComponentEuclidian2D(parent) +IModelComponentTemporal2D::IModelComponentTemporal2D(QObject* parent) +: IModelComponentEuclidian2D(parent) { - } -IModelTrackedPoint::IModelTrackedPoint(QObject *parent) : - IModelComponentTemporal2D(parent) +IModelTrackedPoint::IModelTrackedPoint(QObject* parent) +: IModelComponentTemporal2D(parent) { - } -IModelTrackedPolygon::IModelTrackedPolygon(QObject *parent) : - IModelComponentTemporal2D(parent) +IModelTrackedPolygon::IModelTrackedPolygon(QObject* parent) +: IModelComponentTemporal2D(parent) { - } -IModelTrackedEllipse::IModelTrackedEllipse(QObject *parent) : - IModelTrackedPoint(parent) +IModelTrackedEllipse::IModelTrackedEllipse(QObject* parent) +: IModelTrackedPoint(parent) { - } -IModelTrackedRectangle::IModelTrackedRectangle(QObject *parent) : - IModelTrackedPoint(parent) +IModelTrackedRectangle::IModelTrackedRectangle(QObject* parent) +: IModelTrackedPoint(parent) { - } -QDataStream &operator<<(QDataStream &ds, const QList<IModelTrackedComponent*> &data) { +QDataStream& operator<<(QDataStream& ds, + const QList<IModelTrackedComponent*>& data) +{ ds << qint64(data.size()); - for (int i = 0; i<data.size(); ++i) - { + for (int i = 0; i < data.size(); ++i) { if (data[i] != nullptr) ds << QString((data[i])->metaObject()->className()); else @@ -61,43 +55,41 @@ QDataStream &operator<<(QDataStream &ds, const QList<IModelTrackedComponent*> &d return ds; } -QDataStream &operator >> (QDataStream &ds, QList<IModelTrackedComponent*> &data) { +QDataStream& operator>>(QDataStream& ds, QList<IModelTrackedComponent*>& data) +{ qint64 s; ds >> s; - for (int i = 0; i<s; ++i) - { + for (int i = 0; i < s; ++i) { QString cn; ds >> cn; - std::string sss = cn.toStdString(); - IModelTrackedComponent* cp = static_cast<IModelTrackedComponent*>(factory->getNewTrackedElement(cn)); + std::string sss = cn.toStdString(); + IModelTrackedComponent* cp = static_cast<IModelTrackedComponent*>( + factory->getNewTrackedElement(cn)); ds >> (*cp); data.append(cp); } return ds; } -QDataStream &operator<<(QDataStream &ds, const IModelTrackedComponent &data) { - for (int i = 0; i<data.metaObject()->propertyCount(); ++i) - { - if (data.metaObject()->property(i).isStored(&data)) - { +QDataStream& operator<<(QDataStream& ds, const IModelTrackedComponent& data) +{ + for (int i = 0; i < data.metaObject()->propertyCount(); ++i) { + if (data.metaObject()->property(i).isStored(&data)) { QVariant v = data.metaObject()->property(i).read(&data); - ds << data.metaObject()->property(i).read(&data); - } - } - return ds; + ds << data.metaObject()->property(i).read(&data); + } + } + return ds; } -QDataStream &operator>>(QDataStream &ds, IModelTrackedComponent &data) { - QVariant var; - for (int i = 0; i<data.metaObject()->propertyCount(); ++i) - { - if (data.metaObject()->property(i).isStored(&data)) - { - ds >> var; - data.metaObject()->property(i).write(&data, var); - } - } - return ds; +QDataStream& operator>>(QDataStream& ds, IModelTrackedComponent& data) +{ + QVariant var; + for (int i = 0; i < data.metaObject()->propertyCount(); ++i) { + if (data.metaObject()->property(i).isStored(&data)) { + ds >> var; + data.metaObject()->property(i).write(&data, var); + } + } + return ds; } - diff --git a/Src/Interfaces/IModel/IModelTrackedComponent.h b/Src/Interfaces/IModel/IModelTrackedComponent.h index 6cafab00653b359a04827c53e5d287a7c397ca36..4bdca425d0d191b5b2fd8d2aca26dda270b5125d 100644 --- a/Src/Interfaces/IModel/IModelTrackedComponent.h +++ b/Src/Interfaces/IModel/IModelTrackedComponent.h @@ -8,131 +8,168 @@ #include <QPolygonF> #include <ostream> - /** -* This is the common interface for all TrackedComponents (IModelTrackedTrajectory and any leaf class). -* It is part of the Composite Pattern and is the equivalent to the abstract Component class. -* This class is derived from IModel from the Model-View-Controller structure. -* A TrackedComponent has a QObject as parent and it -* has a methode called operate() that needs to be implemented -* by all derivatives of this interface class. -*/ + * This is the common interface for all TrackedComponents + * (IModelTrackedTrajectory and any leaf class). It is part of the Composite + * Pattern and is the equivalent to the abstract Component class. This class is + * derived from IModel from the Model-View-Controller structure. A + * TrackedComponent has a QObject as parent and it has a methode called + * operate() that needs to be implemented by all derivatives of this interface + * class. + */ /* -* Blank component -*/ + * Blank component + */ class BT_INTERFACES_API IModelTrackedComponent : public IModel { - Q_OBJECT - /* - Q_PROPERTY-System: http://doc.qt.io/qt-5/properties.html - */ - Q_PROPERTY(bool valid READ getValid() WRITE setValid STORED true) - Q_PROPERTY(double id READ getId() WRITE setId STORED true) + Q_OBJECT + /* + Q_PROPERTY-System: http://doc.qt.io/qt-5/properties.html + */ + Q_PROPERTY(bool valid READ getValid() WRITE setValid STORED true) + Q_PROPERTY(double id READ getId() WRITE setId STORED true) public: - /** - * The constructor of the IModelTrackedComponent class is able to receive a QObject as parent. - */ - IModelTrackedComponent(QObject *parent = 0); - /* - Getters, Setters & Checkers - */ - virtual void setValid(bool v) { _valid = v; }; - virtual void setId(int id) { _id = id; }; - virtual void setFixed(bool fixed) { _fixed = fixed; }; - virtual void setParent(IModelTrackedComponent *p) { _parentNode = p; }; - virtual int getId() { return _id; }; - virtual bool getValid() { return _valid; }; - virtual bool getFixed() { return _fixed; }; - - /** - * The methode operate() must be implemented by every derivative of this class. - */ - virtual void operate() = 0; + /** + * The constructor of the IModelTrackedComponent class is able to receive a + * QObject as parent. + */ + IModelTrackedComponent(QObject* parent = 0); + /* + Getters, Setters & Checkers + */ + virtual void setValid(bool v) + { + _valid = v; + }; + virtual void setId(int id) + { + _id = id; + }; + virtual void setFixed(bool fixed) + { + _fixed = fixed; + }; + virtual void setParent(IModelTrackedComponent* p) + { + _parentNode = p; + }; + virtual int getId() + { + return _id; + }; + virtual bool getValid() + { + return _valid; + }; + virtual bool getFixed() + { + return _fixed; + }; + + /** + * The methode operate() must be implemented by every derivative of this + * class. + */ + virtual void operate() = 0; protected: - int _id; /**< id of the component */ - bool _valid; /**< validity of the component; if invalid -> not visualized */ - bool _fixed; /**< fix status; if fixed the tracked should not change state*/ - IModelTrackedComponent *_parentNode = nullptr; /**< parent */ + int _id; /**< id of the component */ + bool + _valid; /**< validity of the component; if invalid -> not visualized */ + bool + _fixed; /**< fix status; if fixed the tracked should not change state*/ + IModelTrackedComponent* _parentNode = nullptr; /**< parent */ }; - Q_DECLARE_METATYPE(QList<IModelTrackedComponent*>) /** -* Serialization operator for multiple components. -*/ -QDataStream &operator<<(QDataStream &ds, const QList<IModelTrackedComponent*> &data); + * Serialization operator for multiple components. + */ +QDataStream& operator<<(QDataStream& ds, + const QList<IModelTrackedComponent*>& data); /** -* Deserialization operator for multiple components. -*/ -QDataStream &operator>>(QDataStream &ds, QList<IModelTrackedComponent*> &data); + * Deserialization operator for multiple components. + */ +QDataStream& operator>>(QDataStream& ds, QList<IModelTrackedComponent*>& data); /** -* Serialization operator for one component. -*/ -QDataStream &operator<<(QDataStream &out, const IModelTrackedComponent &painting); + * Serialization operator for one component. + */ +QDataStream& operator<<(QDataStream& out, + const IModelTrackedComponent& painting); /** -* Deserialization operator for one component. -*/ -QDataStream &operator>>(QDataStream &in, IModelTrackedComponent &painting); - -/***************************************************************************//** -* This is a node of the Composite Pattern -* This class is derived from IModelTrackedComponent. -* It includes positional data like x,y-coordinates (in px and _coordinateUnit), the orientation in rad and deg -* and the width and height (in px and _coordinateUnit) -*******************************************************************************/ - -class BT_INTERFACES_API IModelComponentEuclidian2D : public IModelTrackedComponent { + * Deserialization operator for one component. + */ +QDataStream& operator>>(QDataStream& in, IModelTrackedComponent& painting); + +/***************************************************************************/ /** + * This is a node of the Composite Pattern + * This class is derived from IModelTrackedComponent. + * It includes positional data like x,y-coordinates (in px and _coordinateUnit), the orientation in rad and deg + * and the width and height (in px and _coordinateUnit) + *******************************************************************************/ + +class BT_INTERFACES_API IModelComponentEuclidian2D +: public IModelTrackedComponent +{ public: - Q_OBJECT - /* - Q_PROPERTY-System: http://doc.qt.io/qt-5/properties.html - */ - Q_PROPERTY(QString coordinateUnit READ getCoordinateUnit() WRITE setCoordinateUnit STORED true) - Q_PROPERTY(float x READ getX() WRITE setX STORED hasX) - Q_PROPERTY(float y READ getY() WRITE setY STORED hasY) - Q_PROPERTY(float w READ getW() WRITE setW STORED hasW) - Q_PROPERTY(float h READ getH() WRITE setH STORED hasH) - Q_PROPERTY(float wpx READ getWpx() WRITE setWpx STORED hasWpx) - Q_PROPERTY(float hpx READ getHpx() WRITE setHpx STORED hasHpx) - Q_PROPERTY(float rad READ getRad() WRITE setRad STORED hasRad) - Q_PROPERTY(float deg READ getDeg() WRITE setDeg STORED hasDeg) - Q_PROPERTY(float xpx READ getXpx() WRITE setXpx STORED hasXpx) - Q_PROPERTY(float ypx READ getYpx() WRITE setYpx STORED hasYpx) + Q_OBJECT + /* + Q_PROPERTY-System: http://doc.qt.io/qt-5/properties.html + */ + Q_PROPERTY(QString coordinateUnit READ getCoordinateUnit() + WRITE setCoordinateUnit STORED true) + Q_PROPERTY(float x READ getX() WRITE setX STORED hasX) + Q_PROPERTY(float y READ getY() WRITE setY STORED hasY) + Q_PROPERTY(float w READ getW() WRITE setW STORED hasW) + Q_PROPERTY(float h READ getH() WRITE setH STORED hasH) + Q_PROPERTY(float wpx READ getWpx() WRITE setWpx STORED hasWpx) + Q_PROPERTY(float hpx READ getHpx() WRITE setHpx STORED hasHpx) + Q_PROPERTY(float rad READ getRad() WRITE setRad STORED hasRad) + Q_PROPERTY(float deg READ getDeg() WRITE setDeg STORED hasDeg) + Q_PROPERTY(float xpx READ getXpx() WRITE setXpx STORED hasXpx) + Q_PROPERTY(float ypx READ getYpx() WRITE setYpx STORED hasYpx) public: - /** - * The constructor of the IModelTrackedComponent class is able to receive a QObject as parent. - * It should not be implemented as it is a not a leaf or a composite - */ - IModelComponentEuclidian2D(QObject *parent = 0); + /** + * The constructor of the IModelTrackedComponent class is able to receive a + * QObject as parent. It should not be implemented as it is a not a leaf or + * a composite + */ + IModelComponentEuclidian2D(QObject* parent = 0); /* Returns a human-readable string about coordinate units. - * Freely enter something like "px", "cm" or "um". This will be annotated in the output. + * Freely enter something like "px", "cm" or "um". This will be annotated + * in the output. + */ + virtual QString getCoordinateUnit() + { + return "cm"; + }; + virtual void setCoordinateUnit(QString c) + { + _coordinateUnit = c; + }; + + /* + Getters, Setters & Checkers */ - virtual QString getCoordinateUnit() { return "cm"; }; - virtual void setCoordinateUnit(QString c) { _coordinateUnit = c; }; - - /* - Getters, Setters & Checkers - */ - virtual void setX(float x) = 0; - virtual void setY(float y) = 0; - virtual void setW(float w) = 0; - virtual void setH(float h) = 0; - virtual void setXpx(float h) = 0; - virtual void setYpx(float h) = 0; - virtual void setWpx(float h) = 0; - virtual void setHpx(float h) = 0; - virtual void setRad(float r) = 0; - virtual void setDeg(float d) = 0; - - virtual float getX() = 0; - virtual float getY() = 0; - virtual float getW() = 0; - virtual float getH() = 0; + virtual void setX(float x) = 0; + virtual void setY(float y) = 0; + virtual void setW(float w) = 0; + virtual void setH(float h) = 0; + virtual void setXpx(float h) = 0; + virtual void setYpx(float h) = 0; + virtual void setWpx(float h) = 0; + virtual void setHpx(float h) = 0; + virtual void setRad(float r) = 0; + virtual void setDeg(float d) = 0; + + virtual float getX() = 0; + virtual float getY() = 0; + virtual float getW() = 0; + virtual float getH() = 0; virtual float getXpx() = 0; virtual float getYpx() = 0; virtual float getWpx() = 0; @@ -140,10 +177,10 @@ public: virtual float getRad() = 0; virtual float getDeg() = 0; - virtual bool hasX() = 0; - virtual bool hasY() = 0; - virtual bool hasW() = 0; - virtual bool hasH() = 0; + virtual bool hasX() = 0; + virtual bool hasY() = 0; + virtual bool hasW() = 0; + virtual bool hasH() = 0; virtual bool hasXpx() = 0; virtual bool hasYpx() = 0; virtual bool hasWpx() = 0; @@ -152,187 +189,198 @@ public: virtual bool hasDeg() = 0; protected: - QString _coordinateUnit; /**< coordinate unit, will be saved in exported file */ - float _x; /**< x-coordinate in coordinate unit*/ - float _y; /**< y-coordinate in coordinate unit*/ - float _w; /**< width in coordinate unit*/ - float _h; /**< height in coordinate unit*/ - float _rad; /**< orientation in rad */ - float _deg; /**< orientation in deg */ - float _xpx; /**< x-coordinate in px */ - float _ypx; /**< y-coordinate in px */ - float _wpx; /**< width in px */ - float _hpx; /**< height in px */ + QString _coordinateUnit; /**< coordinate unit, will be saved in exported + file */ + float _x; /**< x-coordinate in coordinate unit*/ + float _y; /**< y-coordinate in coordinate unit*/ + float _w; /**< width in coordinate unit*/ + float _h; /**< height in coordinate unit*/ + float _rad; /**< orientation in rad */ + float _deg; /**< orientation in deg */ + float _xpx; /**< x-coordinate in px */ + float _ypx; /**< y-coordinate in px */ + float _wpx; /**< width in px */ + float _hpx; /**< height in px */ }; -/***************************************************************************//** -* This is a node of the Composite Pattern -* This class is derived from IModelComponentEuclidian2D. -* It expands it from 2D to 3D. -* Reserved for future 3D tracking. -*******************************************************************************/ -class BT_INTERFACES_API IModelComponentEuclidian3D : public IModelComponentEuclidian2D { +/***************************************************************************/ /** + * This is a node of the Composite Pattern + * This class is derived from IModelComponentEuclidian2D. + * It expands it from 2D to 3D. + * Reserved for future 3D tracking. + *******************************************************************************/ +class BT_INTERFACES_API IModelComponentEuclidian3D +: public IModelComponentEuclidian2D +{ public: - Q_OBJECT - /* - Q_PROPERTY-System: http://doc.qt.io/qt-5/properties.html - */ - Q_PROPERTY(float z READ getZ() WRITE setZ STORED hasZ) - Q_PROPERTY(float zpx READ getZpx() WRITE setZpx STORED hasZpx) - Q_PROPERTY(float d READ getD() WRITE setD STORED hasD) - Q_PROPERTY(float dpx READ getDpx() WRITE setDpx STORED hasDpx) - Q_PROPERTY(float rada2 READ getRadAxis2() WRITE setRadAxis2 STORED hasRadAxis2) - Q_PROPERTY(float rada3 READ getRadAxis3() WRITE setRadAxis3 STORED hasRadAxis3) + Q_OBJECT + /* + Q_PROPERTY-System: http://doc.qt.io/qt-5/properties.html + */ + Q_PROPERTY(float z READ getZ() WRITE setZ STORED hasZ) + Q_PROPERTY(float zpx READ getZpx() WRITE setZpx STORED hasZpx) + Q_PROPERTY(float d READ getD() WRITE setD STORED hasD) + Q_PROPERTY(float dpx READ getDpx() WRITE setDpx STORED hasDpx) + Q_PROPERTY(float rada2 READ getRadAxis2() + WRITE setRadAxis2 STORED hasRadAxis2) + Q_PROPERTY(float rada3 READ getRadAxis3() + WRITE setRadAxis3 STORED hasRadAxis3) public: - /* - Getters, Setters & Checkers - */ - virtual void setZ(float z) = 0; - virtual void setZpx(float z) = 0; - virtual void setD(float h) = 0; - virtual void setDpx(float d) = 0; - virtual void setRadAxis2(float r) = 0; - virtual void setRadAxis3(float r) = 0; - - virtual float getZ() = 0; - virtual float getZpx() = 0; - virtual float getD() = 0; - virtual float getDpx() = 0; + /* + Getters, Setters & Checkers + */ + virtual void setZ(float z) = 0; + virtual void setZpx(float z) = 0; + virtual void setD(float h) = 0; + virtual void setDpx(float d) = 0; + virtual void setRadAxis2(float r) = 0; + virtual void setRadAxis3(float r) = 0; + + virtual float getZ() = 0; + virtual float getZpx() = 0; + virtual float getD() = 0; + virtual float getDpx() = 0; virtual float getRadAxis2() = 0; virtual float getRadAxis3() = 0; - virtual bool hasZ() = 0; - virtual bool hasD() = 0; - virtual bool hasZpx() = 0; - virtual bool hasDpx() = 0; + virtual bool hasZ() = 0; + virtual bool hasD() = 0; + virtual bool hasZpx() = 0; + virtual bool hasDpx() = 0; virtual bool hasRadAxis2() = 0; virtual bool hasRadAxis3() = 0; protected: - float _z; /**< z-coordinate in coordinate unit */ - float _zpx; /**< z-coordinate in px */ - float _d; /**< d in coordinate unit*/ - float _dpx; /**< d in px */ - float _rada2; /**< rotation two */ - float _rada3; /**< rotation three */ + float _z; /**< z-coordinate in coordinate unit */ + float _zpx; /**< z-coordinate in px */ + float _d; /**< d in coordinate unit*/ + float _dpx; /**< d in px */ + float _rada2; /**< rotation two */ + float _rada3; /**< rotation three */ }; -/***************************************************************************//** -* This is a node of the Composite Pattern -* This class is derived from IModelComponentEuclidian2D. -* It expands it to 2D with timestamps. -*******************************************************************************/ -class BT_INTERFACES_API IModelComponentTemporal2D : public IModelComponentEuclidian2D { +/***************************************************************************/ /** + * This is a node of the Composite Pattern + * This class is derived from IModelComponentEuclidian2D. + * It expands it to 2D with timestamps. + *******************************************************************************/ +class BT_INTERFACES_API IModelComponentTemporal2D +: public IModelComponentEuclidian2D +{ public: - Q_OBJECT - /* - Q_PROPERTY-System: http://doc.qt.io/qt-5/properties.html - */ + Q_OBJECT + /* + Q_PROPERTY-System: http://doc.qt.io/qt-5/properties.html + */ Q_PROPERTY(qint64 time READ getTime() WRITE setTime STORED hasTime) - Q_PROPERTY(QString timeString READ getTimeString() WRITE setTimeString STORED hasTimeString) + Q_PROPERTY(QString timeString READ getTimeString() + WRITE setTimeString STORED hasTimeString) public: - /** - * The constructor of the IModelComponentTemporal2D class is able to receive a QObject as parent. - * It should not be implemented as it is a not a leaf nore a composite - */ - IModelComponentTemporal2D(QObject *parent = 0); - - /* - Getters, Setters & Checkers - */ - virtual void setTime(qint64 t) = 0; - virtual qint64 getTime() = 0; - virtual bool hasTime() = 0; - virtual void setTimeString(QString t) = 0; - virtual QString getTimeString() = 0; - virtual bool hasTimeString() = 0; - + /** + * The constructor of the IModelComponentTemporal2D class is able to + * receive a QObject as parent. It should not be implemented as it is a not + * a leaf nore a composite + */ + IModelComponentTemporal2D(QObject* parent = 0); + + /* + Getters, Setters & Checkers + */ + virtual void setTime(qint64 t) = 0; + virtual qint64 getTime() = 0; + virtual bool hasTime() = 0; + virtual void setTimeString(QString t) = 0; + virtual QString getTimeString() = 0; + virtual bool hasTimeString() = 0; }; -/***************************************************************************//** -* This is a leaf of the Composite Pattern -* This class is derived from IModelComponentTemporal2D. -* It includes 2D and time data. -* This interface can be visualized in the core application if the tracking data implements it. -* A circular point will be visualized with the radius of min(width,height) -* The position is the center of the point. -*******************************************************************************/ +/***************************************************************************/ /** + * This is a leaf of the Composite Pattern + * This class is derived from IModelComponentTemporal2D. + * It includes 2D and time data. + * This interface can be visualized in the core application if the tracking data implements it. + * A circular point will be visualized with the radius of min(width,height) + * The position is the center of the point. + *******************************************************************************/ class BT_INTERFACES_API IModelTrackedPoint : public IModelComponentTemporal2D { - Q_OBJECT + Q_OBJECT public: - /** - * The constructor of the IModelTrackedPoint class is able to receive a QObject as parent. - */ - IModelTrackedPoint(QObject *parent = 0); + /** + * The constructor of the IModelTrackedPoint class is able to receive a + * QObject as parent. + */ + IModelTrackedPoint(QObject* parent = 0); }; -/***************************************************************************//** -* This is a leaf of the Composite Pattern -* This class is derived from IModelComponentTemporal2D. -* It includes 2D and time data and a polygon. -* This interface can be visualized in the core application if the tracking data implements it. -* An irregular polygon defined by a list of polygons will be visualized. -*******************************************************************************/ +/***************************************************************************/ /** + * This is a leaf of the Composite Pattern + * This class is derived from IModelComponentTemporal2D. + * It includes 2D and time data and a polygon. + * This interface can be visualized in the core application if the tracking data implements it. + * An irregular polygon defined by a list of polygons will be visualized. + *******************************************************************************/ class BT_INTERFACES_API IModelTrackedPolygon : public IModelComponentTemporal2D { - Q_OBJECT + Q_OBJECT public: - - /** - * The constructor of the IModelTrackedPolygon class is able to receive a QObject as parent. - */ - IModelTrackedPolygon(QObject *parent = 0); - - /* - Getters, Setters & Checkers - */ - virtual void setPolygon(QList<QPolygonF> polygons) = 0; - virtual QList<QPolygonF> getPolygon() = 0; - virtual float hasPolygon() = 0; + /** + * The constructor of the IModelTrackedPolygon class is able to receive a + * QObject as parent. + */ + IModelTrackedPolygon(QObject* parent = 0); + + /* + Getters, Setters & Checkers + */ + virtual void setPolygon(QList<QPolygonF> polygons) = 0; + virtual QList<QPolygonF> getPolygon() = 0; + virtual float hasPolygon() = 0; protected: - QList<QPolygonF> _polygon; /**< List of polygons, all will be drawn when vizualized */ + QList<QPolygonF> + _polygon; /**< List of polygons, all will be drawn when vizualized */ }; -/***************************************************************************//** -* This is a leaf of the Composite Pattern -* This class is derived from IModelComponentTemporal2D. -* It includes 2D and time data. -* This interface can be visualized in the core application if the tracking data implements it. -* An ellipse will be visualized. The position is the center of the ellipse. -*******************************************************************************/ +/***************************************************************************/ /** + * This is a leaf of the Composite Pattern + * This class is derived from IModelComponentTemporal2D. + * It includes 2D and time data. + * This interface can be visualized in the core application if the tracking data implements it. + * An ellipse will be visualized. The position is the center of the ellipse. + *******************************************************************************/ class BT_INTERFACES_API IModelTrackedEllipse : public IModelTrackedPoint { - Q_OBJECT + Q_OBJECT public: - /** - * The constructor of the IModelTrackedEllipse class is able to receive a QObject as parent. - */ - IModelTrackedEllipse(QObject *parent = 0); - + /** + * The constructor of the IModelTrackedEllipse class is able to receive a + * QObject as parent. + */ + IModelTrackedEllipse(QObject* parent = 0); }; -/***************************************************************************//** -* This is a leaf of the Composite Pattern -* This class is derived from IModelComponentTemporal2D. -* It includes 2D and time data. -* This interface can be visualized in the core application if the tracking data implements it. -* A rectangle will be visualized. The position is the center of the rectangle. -*******************************************************************************/ +/***************************************************************************/ /** + * This is a leaf of the Composite Pattern + * This class is derived from IModelComponentTemporal2D. + * It includes 2D and time data. + * This interface can be visualized in the core application if the tracking data implements it. + * A rectangle will be visualized. The position is the center of the rectangle. + *******************************************************************************/ class BT_INTERFACES_API IModelTrackedRectangle : public IModelTrackedPoint { - Q_OBJECT - + Q_OBJECT + public: - /** - * The constructor of the IModelTrackedRectangle class is able to receive a QObject as parent. - */ - IModelTrackedRectangle(QObject *parent = 0); + /** + * The constructor of the IModelTrackedRectangle class is able to receive a + * QObject as parent. + */ + IModelTrackedRectangle(QObject* parent = 0); }; diff --git a/Src/Interfaces/IModel/IModelTrackedComponentFactory.cpp b/Src/Interfaces/IModel/IModelTrackedComponentFactory.cpp index 454ef1995d54ea61d099491851ff8a7291fb752d..9b207f59250834087024f2ed11f4fcf7c6765903 100644 --- a/Src/Interfaces/IModel/IModelTrackedComponentFactory.cpp +++ b/Src/Interfaces/IModel/IModelTrackedComponentFactory.cpp @@ -1,25 +1,27 @@ #include "IModelTrackedComponentFactory.h" -IModelTrackedComponentFactory::IModelTrackedComponentFactory() { - +IModelTrackedComponentFactory::IModelTrackedComponentFactory() +{ } IModelTrackedComponentFactory::~IModelTrackedComponentFactory() { - } -IModelTrackedComponent *IModelTrackedComponentFactory::getNewTrackedElement(QString name) +IModelTrackedComponent* IModelTrackedComponentFactory::getNewTrackedElement( + QString name) { return createTrackedElement(name); } -IModelTrackedComponent *IModelTrackedComponentFactory::getNewTrackedObject(QString name) +IModelTrackedComponent* IModelTrackedComponentFactory::getNewTrackedObject( + QString name) { return createTrackedObject(name); } -IModelTrackedComponent *IModelTrackedComponentFactory::getNewTrackedTrajectory(QString name) +IModelTrackedComponent* IModelTrackedComponentFactory::getNewTrackedTrajectory( + QString name) { - return createTrackedTrajectory(name); + return createTrackedTrajectory(name); } diff --git a/Src/Interfaces/IModel/IModelTrackedComponentFactory.h b/Src/Interfaces/IModel/IModelTrackedComponentFactory.h index 70c1d121f945a84fde16fd42d6eebd4cc1c7fb87..9ee77fb39dc8bae73e87f26dac2cd0e2c3ef9f28 100644 --- a/Src/Interfaces/IModel/IModelTrackedComponentFactory.h +++ b/Src/Interfaces/IModel/IModelTrackedComponentFactory.h @@ -7,18 +7,17 @@ class BT_INTERFACES_API IModelTrackedComponentFactory : public IModel { Q_OBJECT - public: +public: IModelTrackedComponentFactory(); virtual ~IModelTrackedComponentFactory() = 0; - IModelTrackedComponent *getNewTrackedElement(QString name); - IModelTrackedComponent *getNewTrackedObject(QString name); - IModelTrackedComponent *getNewTrackedTrajectory(QString name); - virtual QList<QString> getElementTypes() = 0; + IModelTrackedComponent* getNewTrackedElement(QString name); + IModelTrackedComponent* getNewTrackedObject(QString name); + IModelTrackedComponent* getNewTrackedTrajectory(QString name); + virtual QList<QString> getElementTypes() = 0; protected: - virtual IModelTrackedComponent *createTrackedElement(QString name) = 0; - virtual IModelTrackedComponent *createTrackedObject(QString name) = 0; - virtual IModelTrackedComponent *createTrackedTrajectory(QString name) = 0; - + virtual IModelTrackedComponent* createTrackedElement(QString name) = 0; + virtual IModelTrackedComponent* createTrackedObject(QString name) = 0; + virtual IModelTrackedComponent* createTrackedTrajectory(QString name) = 0; }; diff --git a/Src/Interfaces/IModel/IModelTrackedTrajectory.cpp b/Src/Interfaces/IModel/IModelTrackedTrajectory.cpp index bc869f68e1151654c97cbc10c4b9d19cdb559f4d..57336caeff7441b53d7216a89d25bec1ee540190 100644 --- a/Src/Interfaces/IModel/IModelTrackedTrajectory.cpp +++ b/Src/Interfaces/IModel/IModelTrackedTrajectory.cpp @@ -3,14 +3,13 @@ int IModelTrackedTrajectory::nextID = -1; -IModelTrackedTrajectory::IModelTrackedTrajectory(QObject *parent) : - IModelTrackedComponent(parent) +IModelTrackedTrajectory::IModelTrackedTrajectory(QObject* parent) +: IModelTrackedComponent(parent) { - _id = ++nextID; + _id = ++nextID; } void IModelTrackedTrajectory::operate() { - // please implement this method in an TrackedObject class - + // please implement this method in an TrackedObject class } diff --git a/Src/Interfaces/IModel/IModelTrackedTrajectory.h b/Src/Interfaces/IModel/IModelTrackedTrajectory.h index c3bd7b6d0f121b91454913aeed9acf89139a4d75..8050221af43c2da7b217b2f359e622e32a69dc94 100644 --- a/Src/Interfaces/IModel/IModelTrackedTrajectory.h +++ b/Src/Interfaces/IModel/IModelTrackedTrajectory.h @@ -4,70 +4,82 @@ /** * This interface class derives from IModelTrackedComponent. - * This class is part of the Composite Pattern and represents the the abstract Composite class. - * Its purpose is to define the responsibility - * for adding, deleting and returning leaf objects. + * This class is part of the Composite Pattern and represents the the abstract + * Composite class. Its purpose is to define the responsibility for adding, + * deleting and returning leaf objects. * * - * Its the Plugin Developers full responsibility to choos an internal data structure. This could be e.g. Map, List or Vector. + * Its the Plugin Developers full responsibility to choos an internal data + * structure. This could be e.g. Map, List or Vector. */ class BT_INTERFACES_API IModelTrackedTrajectory : public IModelTrackedComponent { Q_OBJECT - Q_PROPERTY(QList<IModelTrackedComponent*> childNodes READ getChildNodes() WRITE setChildNodes STORED hasChildNodes); -public: - /** - * The constructor. - */ - IModelTrackedTrajectory(QObject *parent); - - /** - * This methode must be implemented by all derivatives. Its purpose is to provide a mechanism for adding Leaf components to this structure. - */ - virtual void add(IModelTrackedComponent *comp, int pos) = 0; - - /** - * This methode must be implemented by all derivatives. Its functionality shall be a mechanism for removing Leaf components from this structure. - */ - virtual bool remove(IModelTrackedComponent *comp) = 0; - - /** - * This methode must be implemented by all derivatives. Its functionality shall be a mechanism for removing all Leaf components from this structure. - */ - virtual void clear() = 0; + Q_PROPERTY(QList<IModelTrackedComponent*> childNodes READ getChildNodes() + WRITE setChildNodes STORED hasChildNodes); - /** - * This methode must be implemented by all derivatives. Its functionality shall be a mechanism for determining the count/number of children. - */ - virtual int size() = 0; - - /** - * This should simply return a child object by an index. - */ - virtual IModelTrackedComponent* getChild(int index) = 0; +public: + /** + * The constructor. + */ + IModelTrackedTrajectory(QObject* parent); + + /** + * This methode must be implemented by all derivatives. Its purpose is to + * provide a mechanism for adding Leaf components to this structure. + */ + virtual void add(IModelTrackedComponent* comp, int pos) = 0; + + /** + * This methode must be implemented by all derivatives. Its functionality + * shall be a mechanism for removing Leaf components from this structure. + */ + virtual bool remove(IModelTrackedComponent* comp) = 0; + + /** + * This methode must be implemented by all derivatives. Its functionality + * shall be a mechanism for removing all Leaf components from this + * structure. + */ + virtual void clear() = 0; + + /** + * This methode must be implemented by all derivatives. Its functionality + * shall be a mechanism for determining the count/number of children. + */ + virtual int size() = 0; + + /** + * This should simply return a child object by an index. + */ + virtual IModelTrackedComponent* getChild(int index) = 0; virtual IModelTrackedComponent* getValidChild(int index) = 0; - virtual int validCount() = 0; + virtual int validCount() = 0; + /** + * This shoudd simply return a last child object (highest index). + */ + virtual IModelTrackedComponent* getLastChild() = 0; - /** - * This shoudd simply return a last child object (highest index). - */ - virtual IModelTrackedComponent *getLastChild() = 0; + virtual void setTime(std::chrono::system_clock::time_point t) + { + _time = t; + }; + virtual std::chrono::system_clock::time_point getTime() + { + return _time; + }; - virtual void setTime(std::chrono::system_clock::time_point t) { _time = t; }; - virtual std::chrono::system_clock::time_point getTime() { return _time; }; - - virtual QList<IModelTrackedComponent*> getChildNodes() = 0; + virtual QList<IModelTrackedComponent*> getChildNodes() = 0; virtual void setChildNodes(QList<IModelTrackedComponent*> n) = 0; - virtual bool hasChildNodes() = 0; + virtual bool hasChildNodes() = 0; public: - virtual void operate(); + virtual void operate(); protected: - static int nextID; - std::chrono::system_clock::time_point _time; - + static int nextID; + std::chrono::system_clock::time_point _time; }; diff --git a/Src/Interfaces/IModel/IModelTrackingAlgorithm.cpp b/Src/Interfaces/IModel/IModelTrackingAlgorithm.cpp index cdf89f6cde1fb8a7f487977c3c74ee7c1a24e6d9..c37c307ee5a5aa04752c756f5dffd59e8a124609 100644 --- a/Src/Interfaces/IModel/IModelTrackingAlgorithm.cpp +++ b/Src/Interfaces/IModel/IModelTrackingAlgorithm.cpp @@ -1,27 +1,28 @@ #include "IModelTrackingAlgorithm.h" -IModelTrackingAlgorithm::IModelTrackingAlgorithm(QObject *parent) : - IModel(parent) +IModelTrackingAlgorithm::IModelTrackingAlgorithm(QObject* parent) +: IModel(parent) { - } -//void ITrackingAlgorithm::setTrackedComponentFactory(ITrackedComponentFactory *factory) +// void ITrackingAlgorithm::setTrackedComponentFactory(ITrackedComponentFactory +// *factory) //{ // m_TrackedComponentFactory = factory; //} -//void ITrackingAlgorithm::setTrackedComponent(ITrackedComponent *trackedComponent) +// void ITrackingAlgorithm::setTrackedComponent(ITrackedComponent +// *trackedComponent) //{ // m_TrackedComponent = trackedComponent; //} -//ITrackedComponentFactory *ITrackingAlgorithm::getTrackedComponentFactory() +// ITrackedComponentFactory *ITrackingAlgorithm::getTrackedComponentFactory() //{ // return m_TrackedComponentFactory; //} -//ITrackedComponent *ITrackingAlgorithm::getTrackedComponent() +// ITrackedComponent *ITrackingAlgorithm::getTrackedComponent() //{ // return m_TrackedComponent; //} diff --git a/Src/Interfaces/IModel/IModelTrackingAlgorithm.h b/Src/Interfaces/IModel/IModelTrackingAlgorithm.h index 745c390281c034f0fbf3e675cbda576ee800e411..8621ae154f0e653c14e38b2e6327f3d3e92c509d 100644 --- a/Src/Interfaces/IModel/IModelTrackingAlgorithm.h +++ b/Src/Interfaces/IModel/IModelTrackingAlgorithm.h @@ -3,16 +3,16 @@ #include "IModel.h" #include "opencv2/core/core.hpp" -class BT_INTERFACES_API IModelTrackingAlgorithm :public IModel { +class BT_INTERFACES_API IModelTrackingAlgorithm : public IModel +{ Q_OBJECT - public: - IModelTrackingAlgorithm(QObject *parent = 0); +public: + IModelTrackingAlgorithm(QObject* parent = 0); - virtual void doTracking(std::shared_ptr<cv::Mat> image, uint frameNumber) = 0; + virtual void doTracking(std::shared_ptr<cv::Mat> image, + uint frameNumber) = 0; signals: void emitTrackingDone(); - void emitChangeDisplayImage(QString str); - - + void emitChangeDisplayImage(QString str); }; diff --git a/Src/Interfaces/IModel/IObject.cpp b/Src/Interfaces/IModel/IObject.cpp index 9f339496b7828d755360600b093e08f4302cc4f1..416688bdb2da43d2b707f02d5e477f6baa23ca7b 100644 --- a/Src/Interfaces/IModel/IObject.cpp +++ b/Src/Interfaces/IModel/IObject.cpp @@ -1,6 +1,6 @@ #include "IObject.h" -IObject::IObject() : - IModel(0) { - +IObject::IObject() +: IModel(0) +{ } diff --git a/Src/Interfaces/IModel/IObject.h b/Src/Interfaces/IModel/IObject.h index 0ef2dd6b2cd1eaf1148cb632dcc80d7983210d75..914b60510693dbf28c4cec86913b9a57478530c9 100644 --- a/Src/Interfaces/IModel/IObject.h +++ b/Src/Interfaces/IModel/IObject.h @@ -4,8 +4,9 @@ // #include "biotracker/util/platform.h" -class BT_INTERFACES_API IObject : public IModel { +class BT_INTERFACES_API IObject : public IModel +{ Q_OBJECT - public: +public: IObject(); }; diff --git a/Src/Interfaces/IModel/Serializable.cpp b/Src/Interfaces/IModel/Serializable.cpp index 96c86e538d952828a42d300e013711c9f477081c..6d92e2d0744a2aa2506a6b8d6d75b0df81c4563f 100644 --- a/Src/Interfaces/IModel/Serializable.cpp +++ b/Src/Interfaces/IModel/Serializable.cpp @@ -3,26 +3,23 @@ #include <qvariant.h> #include <qmetaobject.h> - -QDataStream &operator<<(QDataStream &ds, const Serializable &data) { - for (int i = 0; i<data.metaObject()->propertyCount(); ++i) - { - if (data.metaObject()->property(i).isStored(&data)) - { - ds << data.metaObject()->property(i).read(&data); - } - } - return ds; +QDataStream& operator<<(QDataStream& ds, const Serializable& data) +{ + for (int i = 0; i < data.metaObject()->propertyCount(); ++i) { + if (data.metaObject()->property(i).isStored(&data)) { + ds << data.metaObject()->property(i).read(&data); + } + } + return ds; } -QDataStream &operator>>(QDataStream &ds, Serializable &data) { - QVariant var; - for (int i = 0; i<data.metaObject()->propertyCount(); ++i) - { - if (data.metaObject()->property(i).isStored(&data)) - { - ds >> var; - data.metaObject()->property(i).write(&data, var); - } - } - return ds; +QDataStream& operator>>(QDataStream& ds, Serializable& data) +{ + QVariant var; + for (int i = 0; i < data.metaObject()->propertyCount(); ++i) { + if (data.metaObject()->property(i).isStored(&data)) { + ds >> var; + data.metaObject()->property(i).write(&data, var); + } + } + return ds; } \ No newline at end of file diff --git a/Src/Interfaces/IModel/Serializable.h b/Src/Interfaces/IModel/Serializable.h index 50f629a65d640ac6cbfdadb4604c360db0df6cb7..5a97516f7eee6069e4986d7a4f4b7c91897192e2 100644 --- a/Src/Interfaces/IModel/Serializable.h +++ b/Src/Interfaces/IModel/Serializable.h @@ -8,8 +8,8 @@ class BT_INTERFACES_API Serializable : public IModel { - Q_OBJECT + Q_OBJECT }; -QDataStream &operator<<(QDataStream &out, const Serializable &data); -QDataStream &operator>>(QDataStream &in, Serializable &data); +QDataStream& operator<<(QDataStream& out, const Serializable& data); +QDataStream& operator>>(QDataStream& in, Serializable& data); diff --git a/Src/Interfaces/IView/IView.cpp b/Src/Interfaces/IView/IView.cpp index 5743123bc7b2c8f01c12311bce2614f373c1ab34..6c95ef35be378eb8ff38c2450654ba7a35773c66 100644 --- a/Src/Interfaces/IView/IView.cpp +++ b/Src/Interfaces/IView/IView.cpp @@ -1,37 +1,41 @@ #include "IView.h" #include "Interfaces/IController/IController.h" -IView::IView(IController *controller, IModel *model): - mController(controller), - mModel(model) +IView::IView(IController* controller, IModel* model) +: mController(controller) +, mModel(model) { - } -void IView::setModel(IModel *model) { +void IView::setModel(IModel* model) +{ mModel = model; } -IView::~IView() { - +IView::~IView() +{ } -IController *IView::getController() { +IController* IView::getController() +{ return mController; } -IModel *IView::getModel() { +IModel* IView::getModel() +{ return mModel; } -const IController *IView::getController() const { - return mController; +const IController* IView::getController() const +{ + return mController; } -const IModel *IView::getModel() const { - return mModel; +const IModel* IView::getModel() const +{ + return mModel; } -void IView::setPermission(std::pair<ENUMS::COREPERMISSIONS, bool>) { - +void IView::setPermission(std::pair<ENUMS::COREPERMISSIONS, bool>) +{ } diff --git a/Src/Interfaces/IView/IView.h b/Src/Interfaces/IView/IView.h index 1178022d5d4d470513810a8e9dc1d710f75305cc..b8fab0157b5797610d5f04b185f60ca17968b95a 100644 --- a/Src/Interfaces/IView/IView.h +++ b/Src/Interfaces/IView/IView.h @@ -4,23 +4,25 @@ #include "Interfaces/ENUMS.h" #include <Interfaces/API.h> class IController; -class BT_INTERFACES_API IView { +class BT_INTERFACES_API IView +{ - public: - IView(IController *controller = 0, IModel *model = 0); +public: + IView(IController* controller = 0, IModel* model = 0); virtual ~IView() = 0; - virtual void setNewModel(IModel *model) = 0; - void setPermission(std::pair < ENUMS::COREPERMISSIONS, bool >); + virtual void setNewModel(IModel* model) = 0; + void setPermission(std::pair<ENUMS::COREPERMISSIONS, bool>); - protected: - virtual void connectModelView() = 0; - void setModel(IModel *model); - IController *getController(); - const IController *getController() const; - IModel *getModel(); - const IModel *getModel() const; - private: - IController *mController; - IModel *mModel; +protected: + virtual void connectModelView() = 0; + void setModel(IModel* model); + IController* getController(); + const IController* getController() const; + IModel* getModel(); + const IModel* getModel() const; + +private: + IController* mController; + IModel* mModel; }; diff --git a/Src/Interfaces/IView/IViewGraphicsPixmapItem.cpp b/Src/Interfaces/IView/IViewGraphicsPixmapItem.cpp index 372da22efa57c7aca010ba4ca309bd4cc81677bc..70549bc98cc014458d2619d41b2c1f46ab13186e 100644 --- a/Src/Interfaces/IView/IViewGraphicsPixmapItem.cpp +++ b/Src/Interfaces/IView/IViewGraphicsPixmapItem.cpp @@ -1,13 +1,14 @@ #include "IViewGraphicsPixmapItem.h" -IViewGraphicsPixmapItem::IViewGraphicsPixmapItem(QObject *parent, IController *controller, IModel *model) : - QObject(parent), - IView(controller, model) +IViewGraphicsPixmapItem::IViewGraphicsPixmapItem(QObject* parent, + IController* controller, + IModel* model) +: QObject(parent) +, IView(controller, model) { - } -void IViewGraphicsPixmapItem::setNewModel(IModel *model) +void IViewGraphicsPixmapItem::setNewModel(IModel* model) { if (getModel() != nullptr) { QObject::disconnect(getModel(), 0, this, 0); @@ -21,4 +22,3 @@ void IViewGraphicsPixmapItem::setNewModel(IModel *model) update(); } - diff --git a/Src/Interfaces/IView/IViewGraphicsPixmapItem.h b/Src/Interfaces/IView/IViewGraphicsPixmapItem.h index d68e1d433c2f5d2616fcdc46b03d7be6ee63aa97..2d25246b7ce056f6969ec3cbfff436fe8f0f4714 100644 --- a/Src/Interfaces/IView/IViewGraphicsPixmapItem.h +++ b/Src/Interfaces/IView/IViewGraphicsPixmapItem.h @@ -4,16 +4,20 @@ #include "QObject" #include "QGraphicsPixmapItem" -class BT_INTERFACES_API IViewGraphicsPixmapItem : public QObject, public QGraphicsPixmapItem, public IView +class BT_INTERFACES_API IViewGraphicsPixmapItem : public QObject, + public QGraphicsPixmapItem, + public IView { Q_OBJECT public: - IViewGraphicsPixmapItem(QObject *parent = 0, IController *controller = 0, IModel *model = 0); + IViewGraphicsPixmapItem(QObject* parent = 0, + IController* controller = 0, + IModel* model = 0); // IView interface public: - void setNewModel(IModel *model) override; + void setNewModel(IModel* model) override; public Q_SLOTS: - virtual void getNotified() = 0; + virtual void getNotified() = 0; }; diff --git a/Src/Interfaces/IView/IViewGraphicsScene.cpp b/Src/Interfaces/IView/IViewGraphicsScene.cpp index c1bf252da4e3bf31676c857945e4dfae294fafee..3cc70b614c08fae4d0d8418661732d6c7ef8e2c4 100644 --- a/Src/Interfaces/IView/IViewGraphicsScene.cpp +++ b/Src/Interfaces/IView/IViewGraphicsScene.cpp @@ -1,18 +1,21 @@ #include "IViewGraphicsScene.h" -IViewGraphicsScene::IViewGraphicsScene(QObject *parent, IController *controller, IModel *model) : - QGraphicsScene(parent), - IView(controller, model) +IViewGraphicsScene::IViewGraphicsScene(QObject* parent, + IController* controller, + IModel* model) +: QGraphicsScene(parent) +, IView(controller, model) { - } -void IViewGraphicsScene::setNewModel(IModel *model) +void IViewGraphicsScene::setNewModel(IModel* model) { - } void IViewGraphicsScene::connectModelView() { - QObject::connect(getModel(), &IModel::notifyView, this, &IViewGraphicsScene::getNotified); + QObject::connect(getModel(), + &IModel::notifyView, + this, + &IViewGraphicsScene::getNotified); } diff --git a/Src/Interfaces/IView/IViewGraphicsScene.h b/Src/Interfaces/IView/IViewGraphicsScene.h index 21935244041b720e1ff32e44f92a948c1547764d..4d18b3d4a68360d02137c7156d38182d9a9e2bf9 100644 --- a/Src/Interfaces/IView/IViewGraphicsScene.h +++ b/Src/Interfaces/IView/IViewGraphicsScene.h @@ -3,19 +3,22 @@ #include "QGraphicsScene" #include "IView.h" -class BT_INTERFACES_API IViewGraphicsScene : public QGraphicsScene, public IView +class BT_INTERFACES_API IViewGraphicsScene : public QGraphicsScene, + public IView { Q_OBJECT public: - IViewGraphicsScene(QObject *parent = 0, IController *controller = 0, IModel *model = 0); + IViewGraphicsScene(QObject* parent = 0, + IController* controller = 0, + IModel* model = 0); // IView interface public: - virtual void setNewModel(IModel *model) override; + virtual void setNewModel(IModel* model) override; protected: virtual void connectModelView() override; public Q_SLOTS: - virtual void getNotified() = 0; + virtual void getNotified() = 0; }; diff --git a/Src/Interfaces/IView/IViewGraphicsView.cpp b/Src/Interfaces/IView/IViewGraphicsView.cpp index 1efd2407d1312e84d21ddfcf7cfa06738fd6d30b..b9e28089682e2968ba1dc8fb3268a2dbd40d74ee 100644 --- a/Src/Interfaces/IView/IViewGraphicsView.cpp +++ b/Src/Interfaces/IView/IViewGraphicsView.cpp @@ -1,19 +1,21 @@ #include "IViewGraphicsView.h" - -IViewGraphicsView::IViewGraphicsView(QWidget *parent, IController *controller, IModel *model) : - QGraphicsView(parent), - IView(controller, model) +IViewGraphicsView::IViewGraphicsView(QWidget* parent, + IController* controller, + IModel* model) +: QGraphicsView(parent) +, IView(controller, model) { - } -void IViewGraphicsView::setNewModel(IModel *model) +void IViewGraphicsView::setNewModel(IModel* model) { - } void IViewGraphicsView::connectModelView() { - QObject::connect(getModel(), &IModel::notifyView, this, &IViewGraphicsView::getNotified); + QObject::connect(getModel(), + &IModel::notifyView, + this, + &IViewGraphicsView::getNotified); } diff --git a/Src/Interfaces/IView/IViewGraphicsView.h b/Src/Interfaces/IView/IViewGraphicsView.h index db3fa1269476a55baa51934ad516ffc15c6ee025..40d70404334c927d46b4a72dc4c9cea01f614058 100644 --- a/Src/Interfaces/IView/IViewGraphicsView.h +++ b/Src/Interfaces/IView/IViewGraphicsView.h @@ -7,15 +7,17 @@ class BT_INTERFACES_API IViewGraphicsView : public QGraphicsView, public IView { Q_OBJECT public: - IViewGraphicsView(QWidget *parent = 0, IController *controller = 0, IModel *model = 0); + IViewGraphicsView(QWidget* parent = 0, + IController* controller = 0, + IModel* model = 0); // IView interface public: - void setNewModel(IModel *model) override; + void setNewModel(IModel* model) override; protected: void connectModelView() override; public Q_SLOTS: - virtual void getNotified() = 0; + virtual void getNotified() = 0; }; diff --git a/Src/Interfaces/IView/IViewMainWindow.cpp b/Src/Interfaces/IView/IViewMainWindow.cpp index cea4f77e238b266269baf696b5d7f5b913832cd8..3c390ed9385ae863baae98fb7ba78bdffe03867b 100644 --- a/Src/Interfaces/IView/IViewMainWindow.cpp +++ b/Src/Interfaces/IView/IViewMainWindow.cpp @@ -1,20 +1,24 @@ #include "IViewMainWindow.h" -IViewMainWindow::IViewMainWindow(QWidget *parent, IController *controller, IModel *model) : - QMainWindow(parent), - IView(controller, model) { - +IViewMainWindow::IViewMainWindow(QWidget* parent, + IController* controller, + IModel* model) +: QMainWindow(parent) +, IView(controller, model) +{ } -IViewMainWindow::~IViewMainWindow() { - +IViewMainWindow::~IViewMainWindow() +{ } -void IViewMainWindow::setNewModel(IModel *model) { +void IViewMainWindow::setNewModel(IModel* model) +{ model = nullptr; setModel(model); } -void IViewMainWindow::connectModelView() { +void IViewMainWindow::connectModelView() +{ // this function is not used in MainWindow } diff --git a/Src/Interfaces/IView/IViewMainWindow.h b/Src/Interfaces/IView/IViewMainWindow.h index b5957a88a6fe6c7f006adc77c368c2ab28e06ca5..5e8a9c9757c157bda9a33e8628f20f9d1e37c948 100644 --- a/Src/Interfaces/IView/IViewMainWindow.h +++ b/Src/Interfaces/IView/IViewMainWindow.h @@ -3,12 +3,15 @@ #include <QMainWindow> #include "Interfaces/IView/IView.h" -class BT_INTERFACES_API IViewMainWindow : public QMainWindow, public IView { - public: - IViewMainWindow(QWidget *parent = 0, IController *controller = 0, IModel *model = 0); +class BT_INTERFACES_API IViewMainWindow : public QMainWindow, public IView +{ +public: + IViewMainWindow(QWidget* parent = 0, + IController* controller = 0, + IModel* model = 0); ~IViewMainWindow(); - private: - void setNewModel(IModel *model); +private: + void setNewModel(IModel* model); void connectModelView(); }; diff --git a/Src/Interfaces/IView/IViewOpenGLWidget.cpp b/Src/Interfaces/IView/IViewOpenGLWidget.cpp index 2b799f3c9bc50c21ba5c1452a95d208de04654c1..1322d2268b4252dfeff2e184f7e4c69214797659 100644 --- a/Src/Interfaces/IView/IViewOpenGLWidget.cpp +++ b/Src/Interfaces/IView/IViewOpenGLWidget.cpp @@ -1,16 +1,20 @@ #include "IViewOpenGLWidget.h" -IViewOpenGLWidget::IViewOpenGLWidget(QWidget *parent, IController *controller, IModel *model) : - QOpenGLWidget(parent), - IView(controller) { +IViewOpenGLWidget::IViewOpenGLWidget(QWidget* parent, + IController* controller, + IModel* model) +: QOpenGLWidget(parent) +, IView(controller) +{ setNewModel(model); } -IViewOpenGLWidget::~IViewOpenGLWidget() { - +IViewOpenGLWidget::~IViewOpenGLWidget() +{ } -void IViewOpenGLWidget::setNewModel(IModel *model) { +void IViewOpenGLWidget::setNewModel(IModel* model) +{ if (getModel() != nullptr) { QObject::disconnect(getModel(), 0, this, 0); } @@ -24,10 +28,15 @@ void IViewOpenGLWidget::setNewModel(IModel *model) { update(); } -void IViewOpenGLWidget::connectModelView() { - QObject::connect(getModel(), &IModel::notifyView, this, &IViewOpenGLWidget::getNotified); +void IViewOpenGLWidget::connectModelView() +{ + QObject::connect(getModel(), + &IModel::notifyView, + this, + &IViewOpenGLWidget::getNotified); } -void IViewOpenGLWidget::initializeGL() { +void IViewOpenGLWidget::initializeGL() +{ connectModelView(); } diff --git a/Src/Interfaces/IView/IViewOpenGLWidget.h b/Src/Interfaces/IView/IViewOpenGLWidget.h index 9383d62fdd3f3b851915d35041081c35d28c73b2..07db9df803856d6864eeb38dc5bebdd493939184 100644 --- a/Src/Interfaces/IView/IViewOpenGLWidget.h +++ b/Src/Interfaces/IView/IViewOpenGLWidget.h @@ -5,19 +5,22 @@ #include <QOpenGLTexture> #include <QOpenGLFunctions> - -class BT_INTERFACES_API IViewOpenGLWidget: public QOpenGLWidget, protected QOpenGLFunctions, public IView { - public: - IViewOpenGLWidget(QWidget *parent = 0, IController *controller = 0, IModel *model = 0); +class BT_INTERFACES_API IViewOpenGLWidget : public QOpenGLWidget, + protected QOpenGLFunctions, + public IView +{ +public: + IViewOpenGLWidget(QWidget* parent = 0, + IController* controller = 0, + IModel* model = 0); ~IViewOpenGLWidget(); - void setNewModel(IModel *model); + void setNewModel(IModel* model); - public Q_SLOTS: +public Q_SLOTS: virtual void getNotified() = 0; - protected: +protected: void connectModelView(); void initializeGL() override; }; - diff --git a/Src/Interfaces/IView/IViewTrackedComponent.cpp b/Src/Interfaces/IView/IViewTrackedComponent.cpp index ec38b2cc48a127f3ec998d0fa7e7a526e6f8e1dc..ea9d97183b1e81ca9ceadb0b05ffcd3e2bdc0541 100644 --- a/Src/Interfaces/IView/IViewTrackedComponent.cpp +++ b/Src/Interfaces/IView/IViewTrackedComponent.cpp @@ -1,23 +1,25 @@ #include "IViewTrackedComponent.h" -IViewTrackedComponent::IViewTrackedComponent(QGraphicsItem *parent, IController *controller, IModel *model) : - QGraphicsObject(parent), - IView(controller, model) +IViewTrackedComponent::IViewTrackedComponent(QGraphicsItem* parent, + IController* controller, + IModel* model) +: QGraphicsObject(parent) +, IView(controller, model) { - } IViewTrackedComponent::~IViewTrackedComponent() { - } -void IViewTrackedComponent::setNewModel(IModel *model) +void IViewTrackedComponent::setNewModel(IModel* model) { - } void IViewTrackedComponent::connectModelView() { - QObject::connect(getModel(), &IModel::notifyView, this, &IViewTrackedComponent::getNotified); + QObject::connect(getModel(), + &IModel::notifyView, + this, + &IViewTrackedComponent::getNotified); } diff --git a/Src/Interfaces/IView/IViewTrackedComponent.h b/Src/Interfaces/IView/IViewTrackedComponent.h index 612483a8d5046457d40e5224311c5bd5cf9cd930..29eecec7921f549dea3cd4151614cf79311c7371 100644 --- a/Src/Interfaces/IView/IViewTrackedComponent.h +++ b/Src/Interfaces/IView/IViewTrackedComponent.h @@ -4,29 +4,33 @@ #include "QGraphicsObject" /** - * This is the common interface for all views representing a TrackedComponents class (IModelTrackedTrajectory and any leaf class). - * This class is derived from IView from the Model-View-Controller structure and visializes the data from its IModel object. - * A IViewTrackedComponent has a QGraphicsItem. + * This is the common interface for all views representing a TrackedComponents + * class (IModelTrackedTrajectory and any leaf class). This class is derived + * from IView from the Model-View-Controller structure and visializes the data + * from its IModel object. A IViewTrackedComponent has a QGraphicsItem. */ -class BT_INTERFACES_API IViewTrackedComponent : public QGraphicsObject, public IView +class BT_INTERFACES_API IViewTrackedComponent : public QGraphicsObject, + public IView { Q_OBJECT public: /** - * The constructor hase a QGraphicsItem object as Parent, an IController object as its controller and an IModel object. + * The constructor hase a QGraphicsItem object as Parent, an IController + * object as its controller and an IModel object. */ - IViewTrackedComponent(QGraphicsItem *parent = 0, IController *controller = 0, IModel *model = 0); + IViewTrackedComponent(QGraphicsItem* parent = 0, + IController* controller = 0, + IModel* model = 0); ~IViewTrackedComponent(); // IView interface public: - void setNewModel(IModel *model) override; + void setNewModel(IModel* model) override; protected: void connectModelView() override; public Q_SLOTS: - virtual void getNotified() = 0; - + virtual void getNotified() = 0; }; diff --git a/Src/Interfaces/IView/IViewWidget.cpp b/Src/Interfaces/IView/IViewWidget.cpp index a0a81504dc077f64b66560ccdf499b18e361ff60..746d4eae38a7f3dc120bcdbe89191aa641a5e7d5 100644 --- a/Src/Interfaces/IView/IViewWidget.cpp +++ b/Src/Interfaces/IView/IViewWidget.cpp @@ -1,18 +1,26 @@ #include "IViewWidget.h" -IViewWidget::IViewWidget(QWidget *parent, IController *controller, IModel *model): - QWidget(parent), - IView(controller) { +IViewWidget::IViewWidget(QWidget* parent, + IController* controller, + IModel* model) +: QWidget(parent) +, IView(controller) +{ setNewModel(model); } -void IViewWidget::setNewModel(IModel *model) { +void IViewWidget::setNewModel(IModel* model) +{ setModel(model); if (getModel() != nullptr) { connectModelView(); } } -void IViewWidget::connectModelView() { - QObject::connect(getModel(), &IModel::notifyView, this, &IViewWidget::getNotified); +void IViewWidget::connectModelView() +{ + QObject::connect(getModel(), + &IModel::notifyView, + this, + &IViewWidget::getNotified); } diff --git a/Src/Interfaces/IView/IViewWidget.h b/Src/Interfaces/IView/IViewWidget.h index e0da9a3f926540134573f83751611b873186b8d6..4d6853252af3baed82c6b798fd9907b2e99eab70 100644 --- a/Src/Interfaces/IView/IViewWidget.h +++ b/Src/Interfaces/IView/IViewWidget.h @@ -3,16 +3,19 @@ #include <QWidget> #include "Interfaces/IView/IView.h" -class BT_INTERFACES_API IViewWidget : public QWidget, public IView { +class BT_INTERFACES_API IViewWidget : public QWidget, public IView +{ Q_OBJECT - public: - explicit IViewWidget(QWidget *parent = 0, IController *controller = 0, IModel *model = 0); +public: + explicit IViewWidget(QWidget* parent = 0, + IController* controller = 0, + IModel* model = 0); - void setNewModel(IModel *model); + void setNewModel(IModel* model); - public Q_SLOTS: +public Q_SLOTS: virtual void getNotified() = 0; - private: +private: void connectModelView(); };