diff --git a/ArchitectureColoredPainting/ArchitectureColoredPainting.vcxproj b/ArchitectureColoredPainting/ArchitectureColoredPainting.vcxproj index 1c52dfd..6aaae03 100644 --- a/ArchitectureColoredPainting/ArchitectureColoredPainting.vcxproj +++ b/ArchitectureColoredPainting/ArchitectureColoredPainting.vcxproj @@ -99,7 +99,10 @@ + + + @@ -151,7 +154,11 @@ + + + + diff --git a/ArchitectureColoredPainting/ArchitectureColoredPainting.vcxproj.filters b/ArchitectureColoredPainting/ArchitectureColoredPainting.vcxproj.filters index b73c477..1d9364f 100644 --- a/ArchitectureColoredPainting/ArchitectureColoredPainting.vcxproj.filters +++ b/ArchitectureColoredPainting/ArchitectureColoredPainting.vcxproj.filters @@ -129,6 +129,15 @@ Source Files\Editor + + Source Files + + + Source Files + + + Source Files + @@ -272,6 +281,18 @@ Header Files\Editor + + Header Files + + + Header Files + + + Header Files + + + Header Files + diff --git a/ArchitectureColoredPainting/src/Editor/ElementManager.cpp b/ArchitectureColoredPainting/src/Editor/ElementManager.cpp new file mode 100644 index 0000000..af7cbde --- /dev/null +++ b/ArchitectureColoredPainting/src/Editor/ElementManager.cpp @@ -0,0 +1,15 @@ +#include "ElementManager.h" +ElementManager *ElementManager::getInstance() +{ + return nullptr; +} +void ElementManager::addElement(GraphicElement *element) +{ +} +void ElementManager::removeElement(GraphicElement *pElement) +{ +} +GraphicElement *ElementManager::getElementById(int index) +{ + return nullptr; +} diff --git a/ArchitectureColoredPainting/src/Editor/ElementManager.h b/ArchitectureColoredPainting/src/Editor/ElementManager.h new file mode 100644 index 0000000..0397576 --- /dev/null +++ b/ArchitectureColoredPainting/src/Editor/ElementManager.h @@ -0,0 +1,19 @@ +#pragma once +#include "GraphicElement.h" +#include +using std::vector; +class ElementManager +{ + private: + static ElementManager *INSTANCE; + vector mElements; + + public: + static ElementManager *getInstance(); + void addElement(GraphicElement *element); + void removeElement(GraphicElement *pElement); + /** + * only used in initialization + */ + GraphicElement *getElementById(int index); +}; diff --git a/ArchitectureColoredPainting/src/Editor/LayerManager.cpp b/ArchitectureColoredPainting/src/Editor/LayerManager.cpp new file mode 100644 index 0000000..8c36f08 --- /dev/null +++ b/ArchitectureColoredPainting/src/Editor/LayerManager.cpp @@ -0,0 +1,5 @@ +#include "LayerManager.h" + +void LayerManager::paint(QPainter *painter) const +{ +} diff --git a/ArchitectureColoredPainting/src/Editor/LayerManager.h b/ArchitectureColoredPainting/src/Editor/LayerManager.h new file mode 100644 index 0000000..02653a8 --- /dev/null +++ b/ArchitectureColoredPainting/src/Editor/LayerManager.h @@ -0,0 +1,18 @@ +#pragma once +#include "LayerWrapper.h" +#include +#include +#include +using std::pair; +using std::vector; +class LayerManager +{ + private: + using LayerPtrs = vector; + LayerWrapper root; + LayerPtrs selectedLayers; + LayerPtrs involvedLeafLayersCache; + + public: + void paint(QPainter *painter) const; +}; diff --git a/ArchitectureColoredPainting/src/Editor/LayerStyle.h b/ArchitectureColoredPainting/src/Editor/LayerStyle.h new file mode 100644 index 0000000..d3966ab --- /dev/null +++ b/ArchitectureColoredPainting/src/Editor/LayerStyle.h @@ -0,0 +1,6 @@ +#pragma once +class LayerStyle +{ + public: + virtual void apply() = 0; +}; diff --git a/ArchitectureColoredPainting/src/Editor/LayerWrapper.cpp b/ArchitectureColoredPainting/src/Editor/LayerWrapper.cpp new file mode 100644 index 0000000..6f5dcb1 --- /dev/null +++ b/ArchitectureColoredPainting/src/Editor/LayerWrapper.cpp @@ -0,0 +1,11 @@ +#include "LayerWrapper.h" + +void LayerWrapper::applyStyles(SimpleElement &element) +{ +} +void FolderLayerWrapper::addChild(LayerWrapper *child) +{ +} +void FolderLayerWrapper::removeChild(LayerWrapper *child) +{ +} diff --git a/ArchitectureColoredPainting/src/Editor/LayerWrapper.h b/ArchitectureColoredPainting/src/Editor/LayerWrapper.h new file mode 100644 index 0000000..426f88f --- /dev/null +++ b/ArchitectureColoredPainting/src/Editor/LayerWrapper.h @@ -0,0 +1,37 @@ +#pragma once +#include "GraphicElement.h" +#include "LayerStyle.h" +#include +#include +#include +#include +using std::shared_ptr; +using std::vector; +class LayerWrapper +{ + protected: + shared_ptr parent; + QPointF referencePoint; + vector styles; + QPainterPath cache; + + public: + void applyStyles(SimpleElement &element); // invoke by manager, then invoke parent's applyStyles + // todo: provide atomic operations for Events +}; + +class FolderLayerWrapper : public LayerWrapper +{ + private: + vector> children; + + public: + void addChild(LayerWrapper *child); + void removeChild(LayerWrapper *child); +}; + +class LeafLayerWrapper : public LayerWrapper +{ + private: + shared_ptr wrappedElement; +};