Skip to content
Snippets Groups Projects
Commit 2578e514 authored by calrama's avatar calrama
Browse files

Add and enforce formating style

parent 4728ec11
Branches
No related tags found
No related merge requests found
Showing
with 740 additions and 535 deletions
---
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
...
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
...@@ -7,8 +7,6 @@ class BT_INTERFACES_API ENUMS : public QObject ...@@ -7,8 +7,6 @@ class BT_INTERFACES_API ENUMS : public QObject
{ {
Q_OBJECT Q_OBJECT
public: public:
enum CONTROLLERTYPE : unsigned int { enum CONTROLLERTYPE : unsigned int {
NO_CTR, NO_CTR,
MAINWINDOW, MAINWINDOW,
...@@ -38,4 +36,3 @@ public: ...@@ -38,4 +36,3 @@ public:
}; };
Q_ENUM(COREPERMISSIONS) Q_ENUM(COREPERMISSIONS)
}; };
...@@ -3,11 +3,9 @@ ...@@ -3,11 +3,9 @@
#include "QDebug" #include "QDebug"
IBioTrackerContext::IBioTrackerContext(QObject* parent)
IBioTrackerContext::IBioTrackerContext(QObject *parent) : : QObject(parent)
QObject(parent)
{ {
} }
void IBioTrackerContext::createApplication() void IBioTrackerContext::createApplication()
...@@ -16,20 +14,18 @@ void IBioTrackerContext::createApplication() ...@@ -16,20 +14,18 @@ void IBioTrackerContext::createApplication()
connectController(); connectController();
} }
void IBioTrackerContext::createAppController() void IBioTrackerContext::createAppController()
{ {
} }
IController *IBioTrackerContext::requestController(ENUMS::CONTROLLERTYPE ctrtype) IController* IBioTrackerContext::requestController(
ENUMS::CONTROLLERTYPE ctrtype)
{ {
return m_ControllersMap.value(ctrtype); return m_ControllersMap.value(ctrtype);
} }
void IBioTrackerContext::connectController() void IBioTrackerContext::connectController()
{ {
} }
void IBioTrackerContext::addController(IController* ctr) void IBioTrackerContext::addController(IController* ctr)
......
...@@ -12,7 +12,9 @@ class BT_INTERFACES_API IBioTrackerContext : public QObject ...@@ -12,7 +12,9 @@ class BT_INTERFACES_API IBioTrackerContext : public QObject
Q_OBJECT Q_OBJECT
public: public:
IBioTrackerContext(QObject* parent = 0); IBioTrackerContext(QObject* parent = 0);
~IBioTrackerContext() {} ~IBioTrackerContext()
{
}
void createApplication(); void createApplication();
...@@ -23,9 +25,7 @@ protected: ...@@ -23,9 +25,7 @@ protected:
virtual void connectController(); virtual void connectController();
void addController(IController* ctr); void addController(IController* ctr);
protected: protected:
QMap<ENUMS::CONTROLLERTYPE, IController*> m_ControllersMap; QMap<ENUMS::CONTROLLERTYPE, IController*> m_ControllersMap;
}; };
#include "IBioTrackerPlugin.h" #include "IBioTrackerPlugin.h"
IView *IBioTrackerPlugin::getTrackerParameterWidget() { return nullptr; }; IView* IBioTrackerPlugin::getTrackerParameterWidget()
IView *IBioTrackerPlugin::getTrackerElementsWidget() { return nullptr; }; {
IModel *IBioTrackerPlugin::getTrackerComponentModel() { return nullptr; }; return nullptr;
void IBioTrackerPlugin::sendCorePermissions() { return; }; };
IModelTrackedComponentFactory *IBioTrackerPlugin::getComponentFactory() { return nullptr; }; IView* IBioTrackerPlugin::getTrackerElementsWidget()
void IBioTrackerPlugin::connectInterfaces() { return; }; {
void IBioTrackerPlugin::receiveAreaDescriptor(IModelAreaDescriptor *areaDescr) { return; }; return nullptr;
\ No newline at end of file };
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
...@@ -10,12 +10,13 @@ ...@@ -10,12 +10,13 @@
#include "memory" #include "memory"
#include <Interfaces/API.h> #include <Interfaces/API.h>
class BT_INTERFACES_API IBioTrackerPlugin : public QObject class BT_INTERFACES_API IBioTrackerPlugin : public QObject
{ {
Q_OBJECT Q_OBJECT
public: public:
~IBioTrackerPlugin() {} ~IBioTrackerPlugin()
{
}
virtual void createPlugin() = 0; virtual void createPlugin() = 0;
...@@ -46,22 +47,25 @@ private: ...@@ -46,22 +47,25 @@ private:
Q_SIGNALS: Q_SIGNALS:
void emitCvMat(std::shared_ptr<cv::Mat> mat, QString name); void emitCvMat(std::shared_ptr<cv::Mat> mat, QString name);
/** /**
* Will be sent when tracking is doen to multiple components of the core app * Will be sent when tracking is doen to multiple components of the core
* An example is the visualisation which is then updated * app An example is the visualisation which is then updated
*/ */
void emitTrackingDone(uint framenumber); void emitTrackingDone(uint framenumber);
void emitChangeDisplayImage(QString str); void emitChangeDisplayImage(QString str);
void emitCorePermission(std::pair<ENUMS::COREPERMISSIONS, bool>); void emitCorePermission(std::pair<ENUMS::COREPERMISSIONS, bool>);
public Q_SLOTS: public Q_SLOTS:
virtual void receiveCurrentFrameFromMainApp(std::shared_ptr<cv::Mat> mat, uint frameNumber) = 0; 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 * Recieves area descriptor data for rectification (px to cm) and for
* tracking arena boundary
*/ */
virtual void receiveAreaDescriptor(IModelAreaDescriptor* areaDescr); virtual void receiveAreaDescriptor(IModelAreaDescriptor* areaDescr);
// private Q_SLOTS: // private Q_SLOTS:
// virtual void receiveCvMatFromController(std::shared_ptr<cv::Mat> mat, QString name) = 0; // virtual void receiveCvMatFromController(std::shared_ptr<cv::Mat> mat,
// QString name) = 0;
}; };
#define IBioTrackerPlugin_iid "de.fu-berlin.mi.biorobotics.IBioTrackerPlugin" #define IBioTrackerPlugin_iid "de.fu-berlin.mi.biorobotics.IBioTrackerPlugin"
......
#include "IController.h" #include "IController.h"
IController::IController(QObject* parent,
IController::IController(QObject *parent, IBioTrackerContext *context, ENUMS::CONTROLLERTYPE ctr) : QObject(parent), IBioTrackerContext* context,
m_BioTrackerContext(context), ENUMS::CONTROLLERTYPE ctr)
m_ControllerType(ctr) : QObject(parent)
, m_BioTrackerContext(context)
, m_ControllerType(ctr)
{ {
} }
void IController::cleanup() { void IController::cleanup()
{
} }
IBioTrackerContext* IController::getBioTrackerContext() IBioTrackerContext* IController::getBioTrackerContext()
...@@ -19,7 +20,6 @@ IBioTrackerContext *IController::getBioTrackerContext() ...@@ -19,7 +20,6 @@ IBioTrackerContext *IController::getBioTrackerContext()
void IController::connectModelToController() void IController::connectModelToController()
{ {
} }
void IController::createComponents() void IController::createComponents()
...@@ -34,19 +34,23 @@ void IController::connectComponents() ...@@ -34,19 +34,23 @@ void IController::connectComponents()
connectControllerToController(); connectControllerToController();
} }
void IController::addView(IView *view) { void IController::addView(IView* view)
{
m_View = view; m_View = view;
} }
void IController::addModel(IModel *model) { void IController::addModel(IModel* model)
{
m_Model = model; m_Model = model;
} }
IModel *IController::getModel() { IModel* IController::getModel()
{
return m_Model.data(); return m_Model.data();
} }
IView *IController::getView() { IView* IController::getView()
{
return m_View; return m_View;
} }
......
...@@ -12,10 +12,14 @@ ...@@ -12,10 +12,14 @@
#include "Interfaces/ENUMS.h" #include "Interfaces/ENUMS.h"
#include <Interfaces/API.h> #include <Interfaces/API.h>
class BT_INTERFACES_API IController : public QObject { class BT_INTERFACES_API IController : public QObject
{
Q_OBJECT Q_OBJECT
public: public:
explicit IController(QObject *parent = 0, IBioTrackerContext *context = 0, ENUMS::CONTROLLERTYPE ctr = ENUMS::CONTROLLERTYPE::NO_CTR); explicit IController(
QObject* parent = 0,
IBioTrackerContext* context = 0,
ENUMS::CONTROLLERTYPE ctr = ENUMS::CONTROLLERTYPE::NO_CTR);
/** /**
* @brief * @brief
...@@ -50,7 +54,6 @@ protected: ...@@ -50,7 +54,6 @@ protected:
QPointer<IModel> m_Model; QPointer<IModel> m_Model;
ENUMS::CONTROLLERTYPE m_ControllerType; ENUMS::CONTROLLERTYPE m_ControllerType;
}; };
#endif // ICONTROLLER_H #endif // ICONTROLLER_H
#include "IModel.h" #include "IModel.h"
IModel::IModel(QObject *parent) : QObject(parent) { IModel::IModel(QObject* parent)
: QObject(parent)
{
} }
IModel::~IModel() { IModel::~IModel()
{
} }
...@@ -4,7 +4,8 @@ ...@@ -4,7 +4,8 @@
#include "memory" #include "memory"
#include <Interfaces/API.h> #include <Interfaces/API.h>
class BT_INTERFACES_API IModel : public QObject { class BT_INTERFACES_API IModel : public QObject
{
Q_OBJECT Q_OBJECT
public: public:
explicit IModel(QObject* parent = 0); explicit IModel(QObject* parent = 0);
......
...@@ -9,27 +9,28 @@ class BT_INTERFACES_API IModelAreaDescriptor :public IModel ...@@ -9,27 +9,28 @@ class BT_INTERFACES_API IModelAreaDescriptor :public IModel
Q_OBJECT Q_OBJECT
public: public:
IModelAreaDescriptor(QObject *parent = 0) : IModel(parent) {}; IModelAreaDescriptor(QObject* parent = 0)
: IModel(parent){};
//~IModelAreaDescriptor(); //~IModelAreaDescriptor();
public: public:
virtual bool inTrackingArea(cv::Point2f point_cm) = 0; virtual bool inTrackingArea(cv::Point2f point_cm) = 0;
/** /**
* Transform the provided pixel coordinates into world coordinates and return world coordinates. * Transform the provided pixel coordinates into world coordinates and
* return world coordinates.
* @param: pixelCoords, a list of points. * @param: pixelCoords, a list of points.
* @return: world coordinates in as a list. * @return: world coordinates in as a list.
*/ */
virtual cv::Point2f pxToCm(cv::Point point_px) = 0; virtual cv::Point2f pxToCm(cv::Point point_px) = 0;
/** /**
* Transform the provided pixel point into world coordinates and return world point. * Transform the provided pixel point into world coordinates and return
* world point.
* @param: point, a pixel point, used opencv point * @param: point, a pixel point, used opencv point
* @return: world point. * @return: world point.
*/ */
virtual cv::Point2f cmToPx(cv::Point2f point_cm) = 0; virtual cv::Point2f cmToPx(cv::Point2f point_cm) = 0;
public:
public:
}; };
#include "IModelDataExporter.h" #include "IModelDataExporter.h"
IModelDataExporter::IModelDataExporter(QObject* parent)
: IModel(parent)
IModelDataExporter::IModelDataExporter(QObject *parent) :
IModel(parent)
{ {
} }
IModelDataExporter::~IModelDataExporter() IModelDataExporter::~IModelDataExporter()
{ {
} }
...@@ -23,8 +23,14 @@ public: ...@@ -23,8 +23,14 @@ public:
virtual void writeAll(std::string f) = 0; virtual void writeAll(std::string f) = 0;
virtual void close() = 0; virtual void close() = 0;
virtual void finalizeAndReInit() = 0; virtual void finalizeAndReInit() = 0;
void setFps(float fps) { _fps = fps; }; void setFps(float fps)
void setTitle(std::string title) { _title = title; }; {
_fps = fps;
};
void setTitle(std::string title)
{
_title = title;
};
virtual void finalize() = 0; virtual void finalize() = 0;
virtual void loadFile(std::string file) = 0; virtual void loadFile(std::string file) = 0;
...@@ -38,4 +44,3 @@ public: ...@@ -38,4 +44,3 @@ public:
signals: signals:
void fileWritten(QFileInfo file); void fileWritten(QFileInfo file);
}; };
...@@ -6,52 +6,46 @@ ...@@ -6,52 +6,46 @@
IModelTrackedComponentFactory* factory = nullptr; IModelTrackedComponentFactory* factory = nullptr;
IModelTrackedComponent::IModelTrackedComponent(QObject *parent) : IModelTrackedComponent::IModelTrackedComponent(QObject* parent)
IModel(parent) : IModel(parent)
{ {
} }
IModelComponentEuclidian2D::IModelComponentEuclidian2D(QObject *parent) : IModelComponentEuclidian2D::IModelComponentEuclidian2D(QObject* parent)
IModelTrackedComponent(parent) : IModelTrackedComponent(parent)
{ {
} }
IModelComponentTemporal2D::IModelComponentTemporal2D(QObject *parent) : IModelComponentTemporal2D::IModelComponentTemporal2D(QObject* parent)
IModelComponentEuclidian2D(parent) : IModelComponentEuclidian2D(parent)
{ {
} }
IModelTrackedPoint::IModelTrackedPoint(QObject *parent) : IModelTrackedPoint::IModelTrackedPoint(QObject* parent)
IModelComponentTemporal2D(parent) : IModelComponentTemporal2D(parent)
{ {
} }
IModelTrackedPolygon::IModelTrackedPolygon(QObject *parent) : IModelTrackedPolygon::IModelTrackedPolygon(QObject* parent)
IModelComponentTemporal2D(parent) : IModelComponentTemporal2D(parent)
{ {
} }
IModelTrackedEllipse::IModelTrackedEllipse(QObject *parent) : IModelTrackedEllipse::IModelTrackedEllipse(QObject* parent)
IModelTrackedPoint(parent) : IModelTrackedPoint(parent)
{ {
} }
IModelTrackedRectangle::IModelTrackedRectangle(QObject *parent) : IModelTrackedRectangle::IModelTrackedRectangle(QObject* parent)
IModelTrackedPoint(parent) : IModelTrackedPoint(parent)
{ {
} }
QDataStream &operator<<(QDataStream &ds, const QList<IModelTrackedComponent*> &data) { QDataStream& operator<<(QDataStream& ds,
ds << qint64(data.size()); const QList<IModelTrackedComponent*>& data)
for (int i = 0; i<data.size(); ++i)
{ {
ds << qint64(data.size());
for (int i = 0; i < data.size(); ++i) {
if (data[i] != nullptr) if (data[i] != nullptr)
ds << QString((data[i])->metaObject()->className()); ds << QString((data[i])->metaObject()->className());
else else
...@@ -61,26 +55,26 @@ QDataStream &operator<<(QDataStream &ds, const QList<IModelTrackedComponent*> &d ...@@ -61,26 +55,26 @@ QDataStream &operator<<(QDataStream &ds, const QList<IModelTrackedComponent*> &d
return ds; return ds;
} }
QDataStream &operator >> (QDataStream &ds, QList<IModelTrackedComponent*> &data) { QDataStream& operator>>(QDataStream& ds, QList<IModelTrackedComponent*>& data)
{
qint64 s; qint64 s;
ds >> s; ds >> s;
for (int i = 0; i<s; ++i) for (int i = 0; i < s; ++i) {
{
QString cn; QString cn;
ds >> cn; ds >> cn;
std::string sss = cn.toStdString(); std::string sss = cn.toStdString();
IModelTrackedComponent* cp = static_cast<IModelTrackedComponent*>(factory->getNewTrackedElement(cn)); IModelTrackedComponent* cp = static_cast<IModelTrackedComponent*>(
factory->getNewTrackedElement(cn));
ds >> (*cp); ds >> (*cp);
data.append(cp); data.append(cp);
} }
return ds; return ds;
} }
QDataStream &operator<<(QDataStream &ds, const IModelTrackedComponent &data) { QDataStream& operator<<(QDataStream& ds, const IModelTrackedComponent& data)
for (int i = 0; i<data.metaObject()->propertyCount(); ++i)
{
if (data.metaObject()->property(i).isStored(&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); QVariant v = data.metaObject()->property(i).read(&data);
ds << data.metaObject()->property(i).read(&data); ds << data.metaObject()->property(i).read(&data);
} }
...@@ -88,16 +82,14 @@ QDataStream &operator<<(QDataStream &ds, const IModelTrackedComponent &data) { ...@@ -88,16 +82,14 @@ QDataStream &operator<<(QDataStream &ds, const IModelTrackedComponent &data) {
return ds; return ds;
} }
QDataStream &operator>>(QDataStream &ds, IModelTrackedComponent &data) { QDataStream& operator>>(QDataStream& ds, IModelTrackedComponent& data)
QVariant var;
for (int i = 0; i<data.metaObject()->propertyCount(); ++i)
{
if (data.metaObject()->property(i).isStored(&data))
{ {
QVariant var;
for (int i = 0; i < data.metaObject()->propertyCount(); ++i) {
if (data.metaObject()->property(i).isStored(&data)) {
ds >> var; ds >> var;
data.metaObject()->property(i).write(&data, var); data.metaObject()->property(i).write(&data, var);
} }
} }
return ds; return ds;
} }
...@@ -8,14 +8,14 @@ ...@@ -8,14 +8,14 @@
#include <QPolygonF> #include <QPolygonF>
#include <ostream> #include <ostream>
/** /**
* This is the common interface for all TrackedComponents (IModelTrackedTrajectory and any leaf class). * This is the common interface for all TrackedComponents
* It is part of the Composite Pattern and is the equivalent to the abstract Component class. * (IModelTrackedTrajectory and any leaf class). It is part of the Composite
* This class is derived from IModel from the Model-View-Controller structure. * Pattern and is the equivalent to the abstract Component class. This class is
* A TrackedComponent has a QObject as parent and it * derived from IModel from the Model-View-Controller structure. A
* has a methode called operate() that needs to be implemented * TrackedComponent has a QObject as parent and it has a methode called
* by all derivatives of this interface class. * operate() that needs to be implemented by all derivatives of this interface
* class.
*/ */
/* /*
...@@ -32,38 +32,63 @@ class BT_INTERFACES_API IModelTrackedComponent : public IModel ...@@ -32,38 +32,63 @@ class BT_INTERFACES_API IModelTrackedComponent : public IModel
Q_PROPERTY(double id READ getId() WRITE setId STORED true) Q_PROPERTY(double id READ getId() WRITE setId STORED true)
public: public:
/** /**
* The constructor of the IModelTrackedComponent class is able to receive a QObject as parent. * The constructor of the IModelTrackedComponent class is able to receive a
* QObject as parent.
*/ */
IModelTrackedComponent(QObject* parent = 0); IModelTrackedComponent(QObject* parent = 0);
/* /*
Getters, Setters & Checkers Getters, Setters & Checkers
*/ */
virtual void setValid(bool v) { _valid = v; }; virtual void setValid(bool v)
virtual void setId(int id) { _id = id; }; {
virtual void setFixed(bool fixed) { _fixed = fixed; }; _valid = v;
virtual void setParent(IModelTrackedComponent *p) { _parentNode = p; }; };
virtual int getId() { return _id; }; virtual void setId(int id)
virtual bool getValid() { return _valid; }; {
virtual bool getFixed() { return _fixed; }; _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. * The methode operate() must be implemented by every derivative of this
* class.
*/ */
virtual void operate() = 0; virtual void operate() = 0;
protected: protected:
int _id; /**< id of the component */ int _id; /**< id of the component */
bool _valid; /**< validity of the component; if invalid -> not visualized */ bool
bool _fixed; /**< fix status; if fixed the tracked should not change state*/ _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 */ IModelTrackedComponent* _parentNode = nullptr; /**< parent */
}; };
Q_DECLARE_METATYPE(QList<IModelTrackedComponent*>) Q_DECLARE_METATYPE(QList<IModelTrackedComponent*>)
/** /**
* Serialization operator for multiple components. * Serialization operator for multiple components.
*/ */
QDataStream &operator<<(QDataStream &ds, const QList<IModelTrackedComponent*> &data); QDataStream& operator<<(QDataStream& ds,
const QList<IModelTrackedComponent*>& data);
/** /**
* Deserialization operator for multiple components. * Deserialization operator for multiple components.
*/ */
...@@ -71,7 +96,8 @@ QDataStream &operator>>(QDataStream &ds, QList<IModelTrackedComponent*> &data); ...@@ -71,7 +96,8 @@ QDataStream &operator>>(QDataStream &ds, QList<IModelTrackedComponent*> &data);
/** /**
* Serialization operator for one component. * Serialization operator for one component.
*/ */
QDataStream &operator<<(QDataStream &out, const IModelTrackedComponent &painting); QDataStream& operator<<(QDataStream& out,
const IModelTrackedComponent& painting);
/** /**
* Deserialization operator for one component. * Deserialization operator for one component.
*/ */
...@@ -84,13 +110,16 @@ QDataStream &operator>>(QDataStream &in, IModelTrackedComponent &painting); ...@@ -84,13 +110,16 @@ QDataStream &operator>>(QDataStream &in, IModelTrackedComponent &painting);
* and the width and height (in px and _coordinateUnit) * and the width and height (in px and _coordinateUnit)
*******************************************************************************/ *******************************************************************************/
class BT_INTERFACES_API IModelComponentEuclidian2D : public IModelTrackedComponent { class BT_INTERFACES_API IModelComponentEuclidian2D
: public IModelTrackedComponent
{
public: public:
Q_OBJECT Q_OBJECT
/* /*
Q_PROPERTY-System: http://doc.qt.io/qt-5/properties.html Q_PROPERTY-System: http://doc.qt.io/qt-5/properties.html
*/ */
Q_PROPERTY(QString coordinateUnit READ getCoordinateUnit() WRITE setCoordinateUnit STORED true) Q_PROPERTY(QString coordinateUnit READ getCoordinateUnit()
WRITE setCoordinateUnit STORED true)
Q_PROPERTY(float x READ getX() WRITE setX STORED hasX) Q_PROPERTY(float x READ getX() WRITE setX STORED hasX)
Q_PROPERTY(float y READ getY() WRITE setY STORED hasY) Q_PROPERTY(float y READ getY() WRITE setY STORED hasY)
Q_PROPERTY(float w READ getW() WRITE setW STORED hasW) Q_PROPERTY(float w READ getW() WRITE setW STORED hasW)
...@@ -104,16 +133,24 @@ public: ...@@ -104,16 +133,24 @@ public:
public: public:
/** /**
* The constructor of the IModelTrackedComponent class is able to receive a QObject as parent. * The constructor of the IModelTrackedComponent class is able to receive a
* It should not be implemented as it is a not a leaf or a composite * QObject as parent. It should not be implemented as it is a not a leaf or
* a composite
*/ */
IModelComponentEuclidian2D(QObject* parent = 0); IModelComponentEuclidian2D(QObject* parent = 0);
/* Returns a human-readable string about coordinate units. /* 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 QString getCoordinateUnit()
virtual void setCoordinateUnit(QString c) { _coordinateUnit = c; }; {
return "cm";
};
virtual void setCoordinateUnit(QString c)
{
_coordinateUnit = c;
};
/* /*
Getters, Setters & Checkers Getters, Setters & Checkers
...@@ -152,7 +189,8 @@ public: ...@@ -152,7 +189,8 @@ public:
virtual bool hasDeg() = 0; virtual bool hasDeg() = 0;
protected: protected:
QString _coordinateUnit; /**< coordinate unit, will be saved in exported file */ QString _coordinateUnit; /**< coordinate unit, will be saved in exported
file */
float _x; /**< x-coordinate in coordinate unit*/ float _x; /**< x-coordinate in coordinate unit*/
float _y; /**< y-coordinate in coordinate unit*/ float _y; /**< y-coordinate in coordinate unit*/
float _w; /**< width in coordinate unit*/ float _w; /**< width in coordinate unit*/
...@@ -171,7 +209,9 @@ protected: ...@@ -171,7 +209,9 @@ protected:
* It expands it from 2D to 3D. * It expands it from 2D to 3D.
* Reserved for future 3D tracking. * Reserved for future 3D tracking.
*******************************************************************************/ *******************************************************************************/
class BT_INTERFACES_API IModelComponentEuclidian3D : public IModelComponentEuclidian2D { class BT_INTERFACES_API IModelComponentEuclidian3D
: public IModelComponentEuclidian2D
{
public: public:
Q_OBJECT Q_OBJECT
/* /*
...@@ -181,8 +221,10 @@ public: ...@@ -181,8 +221,10 @@ public:
Q_PROPERTY(float zpx READ getZpx() WRITE setZpx STORED hasZpx) Q_PROPERTY(float zpx READ getZpx() WRITE setZpx STORED hasZpx)
Q_PROPERTY(float d READ getD() WRITE setD STORED hasD) Q_PROPERTY(float d READ getD() WRITE setD STORED hasD)
Q_PROPERTY(float dpx READ getDpx() WRITE setDpx STORED hasDpx) Q_PROPERTY(float dpx READ getDpx() WRITE setDpx STORED hasDpx)
Q_PROPERTY(float rada2 READ getRadAxis2() WRITE setRadAxis2 STORED hasRadAxis2) Q_PROPERTY(float rada2 READ getRadAxis2()
Q_PROPERTY(float rada3 READ getRadAxis3() WRITE setRadAxis3 STORED hasRadAxis3) WRITE setRadAxis2 STORED hasRadAxis2)
Q_PROPERTY(float rada3 READ getRadAxis3()
WRITE setRadAxis3 STORED hasRadAxis3)
public: public:
/* /*
...@@ -223,19 +265,23 @@ protected: ...@@ -223,19 +265,23 @@ protected:
* This class is derived from IModelComponentEuclidian2D. * This class is derived from IModelComponentEuclidian2D.
* It expands it to 2D with timestamps. * It expands it to 2D with timestamps.
*******************************************************************************/ *******************************************************************************/
class BT_INTERFACES_API IModelComponentTemporal2D : public IModelComponentEuclidian2D { class BT_INTERFACES_API IModelComponentTemporal2D
: public IModelComponentEuclidian2D
{
public: public:
Q_OBJECT Q_OBJECT
/* /*
Q_PROPERTY-System: http://doc.qt.io/qt-5/properties.html Q_PROPERTY-System: http://doc.qt.io/qt-5/properties.html
*/ */
Q_PROPERTY(qint64 time READ getTime() WRITE setTime STORED hasTime) 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: public:
/** /**
* The constructor of the IModelComponentTemporal2D class is able to receive a QObject as parent. * The constructor of the IModelComponentTemporal2D class is able to
* It should not be implemented as it is a not a leaf nore a composite * receive a QObject as parent. It should not be implemented as it is a not
* a leaf nore a composite
*/ */
IModelComponentTemporal2D(QObject* parent = 0); IModelComponentTemporal2D(QObject* parent = 0);
...@@ -248,7 +294,6 @@ public: ...@@ -248,7 +294,6 @@ public:
virtual void setTimeString(QString t) = 0; virtual void setTimeString(QString t) = 0;
virtual QString getTimeString() = 0; virtual QString getTimeString() = 0;
virtual bool hasTimeString() = 0; virtual bool hasTimeString() = 0;
}; };
/***************************************************************************/ /** /***************************************************************************/ /**
...@@ -265,7 +310,8 @@ class BT_INTERFACES_API IModelTrackedPoint : public IModelComponentTemporal2D ...@@ -265,7 +310,8 @@ class BT_INTERFACES_API IModelTrackedPoint : public IModelComponentTemporal2D
public: public:
/** /**
* The constructor of the IModelTrackedPoint class is able to receive a QObject as parent. * The constructor of the IModelTrackedPoint class is able to receive a
* QObject as parent.
*/ */
IModelTrackedPoint(QObject* parent = 0); IModelTrackedPoint(QObject* parent = 0);
}; };
...@@ -283,9 +329,9 @@ class BT_INTERFACES_API IModelTrackedPolygon : public IModelComponentTemporal2D ...@@ -283,9 +329,9 @@ class BT_INTERFACES_API IModelTrackedPolygon : public IModelComponentTemporal2D
Q_OBJECT Q_OBJECT
public: public:
/** /**
* The constructor of the IModelTrackedPolygon class is able to receive a QObject as parent. * The constructor of the IModelTrackedPolygon class is able to receive a
* QObject as parent.
*/ */
IModelTrackedPolygon(QObject* parent = 0); IModelTrackedPolygon(QObject* parent = 0);
...@@ -297,7 +343,8 @@ public: ...@@ -297,7 +343,8 @@ public:
virtual float hasPolygon() = 0; virtual float hasPolygon() = 0;
protected: 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 */
}; };
/***************************************************************************/ /** /***************************************************************************/ /**
...@@ -313,10 +360,10 @@ class BT_INTERFACES_API IModelTrackedEllipse : public IModelTrackedPoint ...@@ -313,10 +360,10 @@ class BT_INTERFACES_API IModelTrackedEllipse : public IModelTrackedPoint
public: public:
/** /**
* The constructor of the IModelTrackedEllipse class is able to receive a QObject as parent. * The constructor of the IModelTrackedEllipse class is able to receive a
* QObject as parent.
*/ */
IModelTrackedEllipse(QObject* parent = 0); IModelTrackedEllipse(QObject* parent = 0);
}; };
/***************************************************************************/ /** /***************************************************************************/ /**
...@@ -332,7 +379,8 @@ class BT_INTERFACES_API IModelTrackedRectangle : public IModelTrackedPoint ...@@ -332,7 +379,8 @@ class BT_INTERFACES_API IModelTrackedRectangle : public IModelTrackedPoint
public: public:
/** /**
* The constructor of the IModelTrackedRectangle class is able to receive a QObject as parent. * The constructor of the IModelTrackedRectangle class is able to receive a
* QObject as parent.
*/ */
IModelTrackedRectangle(QObject* parent = 0); IModelTrackedRectangle(QObject* parent = 0);
}; };
#include "IModelTrackedComponentFactory.h" #include "IModelTrackedComponentFactory.h"
IModelTrackedComponentFactory::IModelTrackedComponentFactory() { IModelTrackedComponentFactory::IModelTrackedComponentFactory()
{
} }
IModelTrackedComponentFactory::~IModelTrackedComponentFactory() IModelTrackedComponentFactory::~IModelTrackedComponentFactory()
{ {
} }
IModelTrackedComponent *IModelTrackedComponentFactory::getNewTrackedElement(QString name) IModelTrackedComponent* IModelTrackedComponentFactory::getNewTrackedElement(
QString name)
{ {
return createTrackedElement(name); return createTrackedElement(name);
} }
IModelTrackedComponent *IModelTrackedComponentFactory::getNewTrackedObject(QString name) IModelTrackedComponent* IModelTrackedComponentFactory::getNewTrackedObject(
QString name)
{ {
return createTrackedObject(name); return createTrackedObject(name);
} }
IModelTrackedComponent *IModelTrackedComponentFactory::getNewTrackedTrajectory(QString name) IModelTrackedComponent* IModelTrackedComponentFactory::getNewTrackedTrajectory(
QString name)
{ {
return createTrackedTrajectory(name); return createTrackedTrajectory(name);
} }
...@@ -20,5 +20,4 @@ protected: ...@@ -20,5 +20,4 @@ protected:
virtual IModelTrackedComponent* createTrackedElement(QString name) = 0; virtual IModelTrackedComponent* createTrackedElement(QString name) = 0;
virtual IModelTrackedComponent* createTrackedObject(QString name) = 0; virtual IModelTrackedComponent* createTrackedObject(QString name) = 0;
virtual IModelTrackedComponent* createTrackedTrajectory(QString name) = 0; virtual IModelTrackedComponent* createTrackedTrajectory(QString name) = 0;
}; };
...@@ -3,8 +3,8 @@ ...@@ -3,8 +3,8 @@
int IModelTrackedTrajectory::nextID = -1; int IModelTrackedTrajectory::nextID = -1;
IModelTrackedTrajectory::IModelTrackedTrajectory(QObject *parent) : IModelTrackedTrajectory::IModelTrackedTrajectory(QObject* parent)
IModelTrackedComponent(parent) : IModelTrackedComponent(parent)
{ {
_id = ++nextID; _id = ++nextID;
} }
...@@ -12,5 +12,4 @@ IModelTrackedTrajectory::IModelTrackedTrajectory(QObject *parent) : ...@@ -12,5 +12,4 @@ IModelTrackedTrajectory::IModelTrackedTrajectory(QObject *parent) :
void IModelTrackedTrajectory::operate() void IModelTrackedTrajectory::operate()
{ {
// please implement this method in an TrackedObject class // please implement this method in an TrackedObject class
} }
...@@ -4,17 +4,20 @@ ...@@ -4,17 +4,20 @@
/** /**
* This interface class derives from IModelTrackedComponent. * This interface class derives from IModelTrackedComponent.
* This class is part of the Composite Pattern and represents the the abstract Composite class. * This class is part of the Composite Pattern and represents the the abstract
* Its purpose is to define the responsibility * Composite class. Its purpose is to define the responsibility for adding,
* for adding, deleting and returning leaf objects. * 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 class BT_INTERFACES_API IModelTrackedTrajectory : public IModelTrackedComponent
{ {
Q_OBJECT Q_OBJECT
Q_PROPERTY(QList<IModelTrackedComponent*> childNodes READ getChildNodes() WRITE setChildNodes STORED hasChildNodes); Q_PROPERTY(QList<IModelTrackedComponent*> childNodes READ getChildNodes()
WRITE setChildNodes STORED hasChildNodes);
public: public:
/** /**
* The constructor. * The constructor.
...@@ -22,22 +25,27 @@ public: ...@@ -22,22 +25,27 @@ public:
IModelTrackedTrajectory(QObject* parent); 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. * 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; 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. * 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; 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. * 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; 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. * 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; virtual int size() = 0;
...@@ -50,14 +58,19 @@ public: ...@@ -50,14 +58,19 @@ public:
virtual int validCount() = 0; virtual int validCount() = 0;
/** /**
* This shoudd simply return a last child object (highest index). * This shoudd simply return a last child object (highest index).
*/ */
virtual IModelTrackedComponent* getLastChild() = 0; virtual IModelTrackedComponent* getLastChild() = 0;
virtual void setTime(std::chrono::system_clock::time_point t) { _time = t; }; virtual void setTime(std::chrono::system_clock::time_point t)
virtual std::chrono::system_clock::time_point getTime() { return _time; }; {
_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 void setChildNodes(QList<IModelTrackedComponent*> n) = 0;
...@@ -69,5 +82,4 @@ public: ...@@ -69,5 +82,4 @@ public:
protected: protected:
static int nextID; static int nextID;
std::chrono::system_clock::time_point _time; std::chrono::system_clock::time_point _time;
}; };
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment