diff --git a/ArchitectureColoredPainting/ArchitectureColoredPainting.vcxproj.filters b/ArchitectureColoredPainting/ArchitectureColoredPainting.vcxproj.filters
index 8fb8e83..5e476ce 100644
--- a/ArchitectureColoredPainting/ArchitectureColoredPainting.vcxproj.filters
+++ b/ArchitectureColoredPainting/ArchitectureColoredPainting.vcxproj.filters
@@ -130,16 +130,16 @@
Source Files\Editor
- Source Files
+ Source Files\Editor
- Source Files
+ Source Files\Editor
- Source Files
+ Source Files\Editor
- Source Files
+ Source Files\Editor
@@ -168,7 +168,7 @@
Header Files
- Header Files
+ Header Files\Editor
@@ -287,17 +287,17 @@
Header Files\Editor
-
- Header Files
+
+ Header Files\Editor
- Header Files
+ Header Files\Editor
-
- Header Files
+
+ Header Files\Editor
- Header Files
+ Header Files\Editor
diff --git a/ArchitectureColoredPainting/src/Editor/LayerManager.cpp b/ArchitectureColoredPainting/src/Editor/LayerManager.cpp
index 8c36f08..0ebbb92 100644
--- a/ArchitectureColoredPainting/src/Editor/LayerManager.cpp
+++ b/ArchitectureColoredPainting/src/Editor/LayerManager.cpp
@@ -1,5 +1,8 @@
#include "LayerManager.h"
-
-void LayerManager::paint(QPainter *painter) const
+LayerManager::LayerManager(QObject *parent)
+{
+ scene = new QGraphicsScene(parent);
+}
+void LayerManager::paint(QGraphicsView *view) const
{
}
diff --git a/ArchitectureColoredPainting/src/Editor/LayerManager.h b/ArchitectureColoredPainting/src/Editor/LayerManager.h
index 02653a8..df52e82 100644
--- a/ArchitectureColoredPainting/src/Editor/LayerManager.h
+++ b/ArchitectureColoredPainting/src/Editor/LayerManager.h
@@ -1,6 +1,6 @@
#pragma once
#include "LayerWrapper.h"
-#include
+#include
#include
#include
using std::pair;
@@ -9,10 +9,12 @@ class LayerManager
{
private:
using LayerPtrs = vector;
- LayerWrapper root;
+ LayerWrapper *root;
LayerPtrs selectedLayers;
LayerPtrs involvedLeafLayersCache;
+ QGraphicsScene *scene;
public:
- void paint(QPainter *painter) const;
+ LayerManager(QObject *parent = 0);
+ void paint(QGraphicsView *view) const;
};
diff --git a/ArchitectureColoredPainting/src/Editor/LayerWrapper.cpp b/ArchitectureColoredPainting/src/Editor/LayerWrapper.cpp
index 6f5dcb1..74c0401 100644
--- a/ArchitectureColoredPainting/src/Editor/LayerWrapper.cpp
+++ b/ArchitectureColoredPainting/src/Editor/LayerWrapper.cpp
@@ -1,8 +1,5 @@
#include "LayerWrapper.h"
-void LayerWrapper::applyStyles(SimpleElement &element)
-{
-}
void FolderLayerWrapper::addChild(LayerWrapper *child)
{
}
diff --git a/ArchitectureColoredPainting/src/Editor/LayerWrapper.h b/ArchitectureColoredPainting/src/Editor/LayerWrapper.h
index 426f88f..f18f6a4 100644
--- a/ArchitectureColoredPainting/src/Editor/LayerWrapper.h
+++ b/ArchitectureColoredPainting/src/Editor/LayerWrapper.h
@@ -1,6 +1,9 @@
#pragma once
#include "GraphicElement.h"
#include "LayerStyle.h"
+#include
+#include
+#include
#include
#include
#include
@@ -16,7 +19,7 @@ class LayerWrapper
QPainterPath cache;
public:
- void applyStyles(SimpleElement &element); // invoke by manager, then invoke parent's applyStyles
+ virtual void draw(QGraphicsScene *scene) = 0; // invoke by manager, then invoke parent's applyStyles
// todo: provide atomic operations for Events
};
diff --git a/ArchitectureColoredPainting/src/Editor/PreviewWindow.cpp b/ArchitectureColoredPainting/src/Editor/PreviewWindow.cpp
index 9de0d83..726012d 100644
--- a/ArchitectureColoredPainting/src/Editor/PreviewWindow.cpp
+++ b/ArchitectureColoredPainting/src/Editor/PreviewWindow.cpp
@@ -10,7 +10,7 @@ void PreviewWindow::show()
{
mainScene->clear();
QFile settingFile;
- settingFile.setFileName("C:/Users/Karlis/Desktop/data.json");
+ settingFile.setFileName("../data.json");
settingFile.open(QFile::ReadOnly);
QByteArray setting = settingFile.readAll().trimmed();
QJsonDocument jsonDoc(QJsonDocument::fromJson(setting));
diff --git a/ArchitectureColoredPainting/src/Editor/PreviewWindow.h b/ArchitectureColoredPainting/src/Editor/PreviewWindow.h
index ac6805a..b5a2f99 100644
--- a/ArchitectureColoredPainting/src/Editor/PreviewWindow.h
+++ b/ArchitectureColoredPainting/src/Editor/PreviewWindow.h
@@ -1,5 +1,6 @@
#pragma once
#include "GraphicElement.h"
+#include "LayerManager.h"
#include "QGraphicsItem.h"
#include "QGraphicsView.h"
#include
diff --git a/data.json b/data.json
new file mode 100644
index 0000000..e9053a7
--- /dev/null
+++ b/data.json
@@ -0,0 +1,26 @@
+{
+"elements":[
+ {
+ "type":"polygon",
+ "data":{
+ "points":[{"x":20,"y":30},{"x":20,"y":50},{"x":50,"y":100},{"x":20,"y":30}]
+ }
+ },
+ {
+ "type":"polygon",
+ "data":{
+ "points":[{"x":100,"y":100},{"x":100,"y":500},{"x":500,"y":500},{"x":100,"y":100}]
+ }
+ },
+ {
+ "type":"round",
+ "data":{
+ "x-axis":500,
+ "y-axis":500,
+ "angle":360
+ }
+ }
+]
+
+
+}
\ No newline at end of file