Merge branch 'main' of http://101.34.228.45:3000/BigC/ArchitectureColoredPainting
commit
c81c7d69d4
|
@ -41,7 +41,7 @@ Painting PaintingUtil::transfromToPainting(QString jsonFilePath) {
|
||||||
shared_ptr<LayerManager> layerManager = make_shared<LayerManager>(jsonObj, elementManager.get());
|
shared_ptr<LayerManager> layerManager = make_shared<LayerManager>(jsonObj, elementManager.get());
|
||||||
LayerWrapper* root = layerManager->getRoot();
|
LayerWrapper* root = layerManager->getRoot();
|
||||||
root->getCache();
|
root->getCache();
|
||||||
handleLayerWrapper(root, QTransform(), painting, contourMap);
|
handleLayerWrapper(root, QTransform(), painting, contourMap, QSize(jsonObj.value("width").toVariant().value<int>(), jsonObj.value("height").toVariant().value<int>()));
|
||||||
clear();
|
clear();
|
||||||
return painting;
|
return painting;
|
||||||
//qDebug() << elementManager->toJson();
|
//qDebug() << elementManager->toJson();
|
||||||
|
@ -70,7 +70,7 @@ Painting PaintingUtil::transfromToPainting(QString jsonFilePath) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void PaintingUtil::handleLayerWrapper(LayerWrapper* nowLayer, QTransform transform, Painting& painting, std::unordered_map<LayerWrapper*, Contour>& contourMap) {
|
void PaintingUtil::handleLayerWrapper(LayerWrapper* nowLayer, QTransform transform, Painting& painting, std::unordered_map<LayerWrapper*, Contour>& contourMap, const QSize& screenSize) {
|
||||||
LeafLayerWrapper* leafLayer = dynamic_cast<LeafLayerWrapper*>(nowLayer);
|
LeafLayerWrapper* leafLayer = dynamic_cast<LeafLayerWrapper*>(nowLayer);
|
||||||
qDebug() << nowLayer;
|
qDebug() << nowLayer;
|
||||||
|
|
||||||
|
@ -80,7 +80,7 @@ void PaintingUtil::handleLayerWrapper(LayerWrapper* nowLayer, QTransform transfo
|
||||||
|
|
||||||
GroupElement* wrapperElement = dynamic_cast<GroupElement*>(leafLayer->wrappedElement);
|
GroupElement* wrapperElement = dynamic_cast<GroupElement*>(leafLayer->wrappedElement);
|
||||||
if (wrapperElement != nullptr) {
|
if (wrapperElement != nullptr) {
|
||||||
handleLayerWrapper(wrapperElement->sourceLayer, transform, painting, contourMap);
|
handleLayerWrapper(wrapperElement->sourceLayer, transform, painting, contourMap, screenSize);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -106,7 +106,6 @@ void PaintingUtil::handleLayerWrapper(LayerWrapper* nowLayer, QTransform transfo
|
||||||
contourMap.insert({ nowLayer, contour });
|
contourMap.insert({ nowLayer, contour });
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
QSize screenSize = QSize(1080, 1080);
|
|
||||||
|
|
||||||
ElementTransform elementTransform;
|
ElementTransform elementTransform;
|
||||||
QTransform leafTransform = trans.inverted() * transform * QTransform::fromScale(2. / screenSize.width(), 2. / screenSize.height()) * QTransform::fromTranslate(-1, -1) * QTransform::fromScale(1, -1);
|
QTransform leafTransform = trans.inverted() * transform * QTransform::fromScale(2. / screenSize.width(), 2. / screenSize.height()) * QTransform::fromTranslate(-1, -1) * QTransform::fromScale(1, -1);
|
||||||
|
@ -158,7 +157,7 @@ void PaintingUtil::handleLayerWrapper(LayerWrapper* nowLayer, QTransform transfo
|
||||||
FolderLayerWrapper* folderLayer = dynamic_cast<FolderLayerWrapper*>(nowLayer);
|
FolderLayerWrapper* folderLayer = dynamic_cast<FolderLayerWrapper*>(nowLayer);
|
||||||
if (folderLayer != nullptr) {
|
if (folderLayer != nullptr) {
|
||||||
for (auto sonLayer : folderLayer->children) {
|
for (auto sonLayer : folderLayer->children) {
|
||||||
handleLayerWrapper(sonLayer.get(), transform, painting, contourMap);
|
handleLayerWrapper(sonLayer.get(), transform, painting, contourMap, screenSize);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -12,7 +12,7 @@ private:
|
||||||
static void clear();
|
static void clear();
|
||||||
//static const double pi;
|
//static const double pi;
|
||||||
static QJsonObject readJsonFile(QString jsonFilePath);
|
static QJsonObject readJsonFile(QString jsonFilePath);
|
||||||
static void handleLayerWrapper(LayerWrapper* nowLayer, QTransform transform, Renderer::Painting& painting, std::unordered_map<LayerWrapper*, Contour>& contourMap);
|
static void handleLayerWrapper(LayerWrapper* nowLayer, QTransform transform, Renderer::Painting& painting, std::unordered_map<LayerWrapper*, Contour>& contourMap, const QSize& screenSize);
|
||||||
//static double getMaxLineWidth(LayerWrapper* root);
|
//static double getMaxLineWidth(LayerWrapper* root);
|
||||||
public:
|
public:
|
||||||
static Renderer::Painting transfromToPainting(QString jsonFilePath);
|
static Renderer::Painting transfromToPainting(QString jsonFilePath);
|
||||||
|
|
|
@ -272,8 +272,8 @@ namespace UnitTest
|
||||||
{1.00, Material{QColor(58,64,151)}}
|
{1.00, Material{QColor(58,64,151)}}
|
||||||
};
|
};
|
||||||
return { BaseStyle(std::make_shared<TransformStyle>(),
|
return { BaseStyle(std::make_shared<TransformStyle>(),
|
||||||
std::make_shared<MaterialStyleStroke>(80, StrokeType::kRightSide, StrokeEndType::kFlatRound,
|
std::make_shared<MaterialStyleStroke>(90, StrokeType::kRightSide, StrokeEndType::kFlatRound,
|
||||||
std::make_shared<StrokeRadialGradient>(materialMap, false), std::map<float, float>{ {0,1},{1,0}})) };
|
std::make_shared<StrokeRadialGradient>(materialMap, false), std::map<float, float>{ {0.6,1},{0.8, 0.8},{0.94,0.6}, {0.96,0.6},{0.97,0.4},{1,0.1}})) };
|
||||||
}
|
}
|
||||||
} style;
|
} style;
|
||||||
TestGLWidget w(style, testPath);
|
TestGLWidget w(style, testPath);
|
||||||
|
|
Loading…
Reference in New Issue