Initial scene to svg conversion.
This commit is contained in:
parent
65ac927929
commit
1fc730d413
15 changed files with 164 additions and 28 deletions
|
@ -25,15 +25,16 @@ list(APPEND publishing_LIB_INCLUDES
|
|||
pdf/PdfXRefTable.cpp
|
||||
pdf/PdfWriter.cpp
|
||||
plotting/GraphPlotter.h
|
||||
plotting/SvgConverter.h
|
||||
plotting/SvgConverter.cpp
|
||||
DocumentConverter.cpp
|
||||
)
|
||||
|
||||
add_library(publishing SHARED ${publishing_LIB_INCLUDES} ${publishing_INCLUDES} ${publishing_HEADERS})
|
||||
|
||||
target_include_directories(publishing PUBLIC
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/pdf"
|
||||
${CMAKE_CURRENT_SOURCE_DIR}
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/pdf
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/plotting
|
||||
)
|
||||
set_target_properties( publishing PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS ON )
|
||||
target_link_libraries( publishing PUBLIC core web graphics visual_elements)
|
||||
|
|
|
@ -0,0 +1,42 @@
|
|||
#include "SvgConverter.h"
|
||||
|
||||
#include "SvgDocument.h"
|
||||
#include "Scene.h"
|
||||
|
||||
#include "SceneItem.h"
|
||||
#include "SceneModel.h"
|
||||
|
||||
#include "AbstractMesh.h"
|
||||
#include "TriMesh.h"
|
||||
|
||||
#include "SvgShapeElements.h"
|
||||
|
||||
std::unique_ptr<SvgDocument> SvgConverter::convert(Scene* scene)
|
||||
{
|
||||
auto doc = std::make_unique<SvgDocument>();
|
||||
|
||||
scene->update();
|
||||
for(auto item : scene->getItems())
|
||||
{
|
||||
if (item->getType() == SceneItem::Type::MODEL)
|
||||
{
|
||||
auto mesh = dynamic_cast<SceneModel*>(item)->getMesh();
|
||||
|
||||
if (mesh->getType() == AbstractMesh::MeshType::TRI)
|
||||
{
|
||||
for(const auto& face : dynamic_cast<TriMesh*>(mesh)->getFaces())
|
||||
{
|
||||
auto svg_tri = std::make_unique<SvgPolygon>();
|
||||
// Get node locs for face
|
||||
|
||||
// Convert to pixel
|
||||
|
||||
// add polygon to doc
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return std::move(doc);
|
||||
}
|
|
@ -0,0 +1,12 @@
|
|||
#pragma once
|
||||
|
||||
#include <memory>
|
||||
|
||||
class SvgDocument;
|
||||
class Scene;
|
||||
|
||||
class SvgConverter
|
||||
{
|
||||
public:
|
||||
std::unique_ptr<SvgDocument> convert(Scene* scene);
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue