From ec4a5da05c628a91728a7fcd59f33182477c37b3 Mon Sep 17 00:00:00 2001 From: PGotzmann Date: Tue, 23 Jan 2018 19:35:02 +0100 Subject: [PATCH] added AbstractionLayer Template Basic layer implementation to use as a template for new layers. Including detailed ToDos. --- .../AbstractionLayer_TemplateLayer.cpp | 26 ++++++++ .../AbstractionLayer_TemplateLayer.h | 62 +++++++++++++++++++ ...bstractionLayer_TemplateLayer_Properties.h | 23 +++++++ .../Layer_TEMPLATE/TODO_FOR_NEW_LAYER.txt | 21 +++++++ 4 files changed, 132 insertions(+) create mode 100644 Source/functions/AbstractionLayers/Layer_TEMPLATE/AbstractionLayer_TemplateLayer.cpp create mode 100644 Source/functions/AbstractionLayers/Layer_TEMPLATE/AbstractionLayer_TemplateLayer.h create mode 100644 Source/functions/AbstractionLayers/Layer_TEMPLATE/AbstractionLayer_TemplateLayer_Properties.h create mode 100644 Source/functions/AbstractionLayers/Layer_TEMPLATE/TODO_FOR_NEW_LAYER.txt diff --git a/Source/functions/AbstractionLayers/Layer_TEMPLATE/AbstractionLayer_TemplateLayer.cpp b/Source/functions/AbstractionLayers/Layer_TEMPLATE/AbstractionLayer_TemplateLayer.cpp new file mode 100644 index 0000000..bc5ba26 --- /dev/null +++ b/Source/functions/AbstractionLayers/Layer_TEMPLATE/AbstractionLayer_TemplateLayer.cpp @@ -0,0 +1,26 @@ + +#include "AbstractionLayer_TemplateLayer.h" //TODO: Replace every occurrence of "TemplateLayer" in this file with Layer Name +#include "../../../header.h" //TODO: add AbstractionLayer_TemplateLayer.cpp to CMakeList +#include + + + +bool AbstractionLayer_TemplateLayer::PreProcessing(coor mySize, const vector* partArray) +{ + //TODO: your implementation (see AbstractionLayer_Base.h for further descriptions) +} + +bool AbstractionLayer_TemplateLayer::EvaluateQuality (coor constraintCoordinate, qualityVector& qVector) +{ + //TODO: your implementation (see AbstractionLayer_Base.h for further descriptions) +} + +bool AbstractionLayer_TemplateLayer::SetConstraintOnPosition(const coor constraintCoordinate,const AbstractionLayer_TemplateLayer_Properties constraint) +{ + //TODO: your implementation (see AbstractionLayer_Base.h for further descriptions) +} + +bool AbstractionLayer_TemplateLayer::RemoveConstraintOnPosition(const coor constraintCoordinate) +{ + //TODO: your implementation (see AbstractionLayer_Base.h for further descriptions) +} \ No newline at end of file diff --git a/Source/functions/AbstractionLayers/Layer_TEMPLATE/AbstractionLayer_TemplateLayer.h b/Source/functions/AbstractionLayers/Layer_TEMPLATE/AbstractionLayer_TemplateLayer.h new file mode 100644 index 0000000..8b78a03 --- /dev/null +++ b/Source/functions/AbstractionLayers/Layer_TEMPLATE/AbstractionLayer_TemplateLayer.h @@ -0,0 +1,62 @@ + +#ifndef SOURCE_ABSTRACTIONLAYER_TemplateLayer_H //%TODO: Change include guards (Replace TEMPLATELAYER) +#define SOURCE_ABSTRACTIONLAYER_TemplateLayer_H + //TODO: Replace every occurrence of "TemplateLayer" in this file with Layer Name + +#include "AbstractionLayer_TemplateLayer.h" +#include "../AbstraktionLayer_Base.h" + + //TODO: Check which includes are necessary for your layer +#include +#include +#include +//#include +//#include +//#include +//#include +//#include +#include "opencv2/highgui/highgui.hpp" +#include "opencv2/imgproc/imgproc.hpp" + + + + + +#ifdef _WIN32 +#define PATH "..\\..\\..\\pieces\\%04d.jpg" +#elif defined __unix__ +#define PATH "..//..//..//pieces//%04d.jpg" +#elif defined __APPLE__ + #define PATH "..//..//..//pieces//%04d.jpg" +#endif + + +using namespace std; +using namespace cv; //for openCV functions + +class AbstractionLayer_TemplateLayer : public AbstractionLayer_Base +{ +public: //TODO: implement at least these functions ind AbstractionLayer_TemplateLayer.cpp + bool PreProcessing(coor mySize, const vector* partArray) ; + bool EvaluateQuality (const coor constraintCoordinate, qualityVector& qVector); + bool SetConstraintOnPosition(const coor constraintCoordinate,const AbstractionLayer_TemplateLayer_Properties constraint); + bool RemoveConstraintOnPosition(const coor constraintCoordinate); + +//--------------------implemented in base class---------------------- +// +// void InitialiseConstraintMatrixSize(const int32_t collumns, const int32_t rows) //TODO: overload function if special initialisation of ConstraintMatrix is needed +// { +// m_constraintMatrix = vector>(collumns, vector(rows)); +// } + +// vector> m_constraintMatrix{}; //<-- Matrix where the constraints of the layer will be saved +//-------------------------------------------------------------------- + + +private: +}; + + + + +#endif //SOURCE_ABSTRACTIONLAYER_TemplateLayer_H diff --git a/Source/functions/AbstractionLayers/Layer_TEMPLATE/AbstractionLayer_TemplateLayer_Properties.h b/Source/functions/AbstractionLayers/Layer_TEMPLATE/AbstractionLayer_TemplateLayer_Properties.h new file mode 100644 index 0000000..97683fe --- /dev/null +++ b/Source/functions/AbstractionLayers/Layer_TEMPLATE/AbstractionLayer_TemplateLayer_Properties.h @@ -0,0 +1,23 @@ + +#ifndef SOURCE_ABSTRACTIONLAYER_TEMPLATELAYER_H +#define SOURCE_ABSTRACTIONLAYER_TEMPLATELAYER_H //%TODO: Change include guards (Replace TEMPLATELAYER) + +#include + //TODO: Replace every occurrence of "TemplateLayer" in this file with Layer Name + + +class AbstractionLayer_TemplateLayer_Properties +{ +public: + AbstractionLayer_TemplateLayer_Properties() {} + + +private: + int m_template_feature; //TODO: add private member variables to store relevant information for your Layer for each position or part + //TODO: (used in ConstraintMatrix and Part Vector) + friend class AbstractionLayer_TemplateLayer; +}; + + + +#endif //SOURCE_ABSTRACTIONLAYER_TEMPLATELAYER_H diff --git a/Source/functions/AbstractionLayers/Layer_TEMPLATE/TODO_FOR_NEW_LAYER.txt b/Source/functions/AbstractionLayers/Layer_TEMPLATE/TODO_FOR_NEW_LAYER.txt new file mode 100644 index 0000000..905063f --- /dev/null +++ b/Source/functions/AbstractionLayers/Layer_TEMPLATE/TODO_FOR_NEW_LAYER.txt @@ -0,0 +1,21 @@ +Todo for new layer: + +copy and rename folder "Layer_TEMPLATE" (and files) +Check all "//TODO:" comments in these files + +header add: +- add include to new abstractionlayer.h in solve.h +- add include to properties.h in input.h + +code add: +- add 1 to DESTRUCTION_COUNT in destructionPower.h +- add SpeedTable information in DestructionPower.cpp +- add abstractionlayer cpp to puzzle class in solve.h +- add Properties to Piece class in input.h + +- add Preprocessing in 'Preprocessing' in solve.h +- add remove call in Puzzle::removeConstraints in puzzleExtension.cpp +- add set call in Puzzle::setConstraints in puzzleExtension.cpp +- add threshold in SetBestOrMoreLayers in structure.cpp +- add EvaluateQuality to switchcase in solve in structure.cpp +- remove - removeSimilar Call from backtrack function in structure.cpp \ No newline at end of file