Switch to template types for vectors
This commit is contained in:
parent
9f036d6438
commit
8192ef78e8
105 changed files with 1614 additions and 1424 deletions
|
@ -23,6 +23,8 @@
|
|||
#include "SvgTextElement.h"
|
||||
#include "XmlAttribute.h"
|
||||
|
||||
#include "PostscriptWriter.h"
|
||||
|
||||
std::unique_ptr<SvgDocument> SvgPainter::paint(Scene* scene, double width, double height) const
|
||||
{
|
||||
auto doc = std::make_unique<SvgDocument>();
|
||||
|
@ -65,7 +67,7 @@ void SvgPainter::paintMesh(SvgDocument* document, SceneModel* model, bool showOu
|
|||
{
|
||||
auto svg_tri = std::make_unique<SvgPolygon>();
|
||||
|
||||
std::vector<Point> points(3);
|
||||
std::vector<Point2> points(3);
|
||||
unsigned count = 0;
|
||||
|
||||
auto face_locs = face->getNodeLocations();
|
||||
|
@ -158,7 +160,7 @@ void SvgPainter::paintPrimitive(SvgDocument* document, SceneModel* model) const
|
|||
|
||||
void SvgPainter::paintPolygon(SvgDocument* document, SceneModel* model) const
|
||||
{
|
||||
auto model_polygon = dynamic_cast<ntk::Polygon*>(model->getGeometry());
|
||||
auto model_polygon = dynamic_cast<Polygon2*>(model->getGeometry());
|
||||
|
||||
auto svg_polygon = std::make_unique<SvgPolygon>();
|
||||
svg_polygon->setPoints(model_polygon->getPoints().getPoints());
|
||||
|
@ -201,9 +203,9 @@ void SvgPainter::paintCircle(SvgDocument* document, SceneModel* model) const
|
|||
|
||||
void SvgPainter::paintLine(SvgDocument* document, SceneModel* model) const
|
||||
{
|
||||
auto model_line = dynamic_cast<Line*>(model->getGeometry());
|
||||
auto model_line = dynamic_cast<Line2*>(model->getGeometry());
|
||||
auto svg_line = std::make_unique<SvgPolyline>();
|
||||
svg_line->setPoints(model_line->getFirstPoint(), model_line->getPoints().getPoints());
|
||||
svg_line->setPoints(model_line->getPoints().getPoints());
|
||||
|
||||
setStyle(model, svg_line.get());
|
||||
document->getRoot()->addChild(std::move(svg_line));
|
||||
|
@ -211,8 +213,8 @@ void SvgPainter::paintLine(SvgDocument* document, SceneModel* model) const
|
|||
|
||||
void SvgPainter::paintLineSegment(SvgDocument* document, SceneModel* model) const
|
||||
{
|
||||
auto model_line = dynamic_cast<LineSegment*>(model->getGeometry());
|
||||
auto svg_line = std::make_unique<SvgLine>(model_line->getFirstPoint(), model_line->getEndPoint());
|
||||
auto model_line = dynamic_cast<LineSegment2*>(model->getGeometry());
|
||||
auto svg_line = std::make_unique<SvgLine>(model_line->getPoint0(), model_line->getPoint1());
|
||||
|
||||
setStyle(model, svg_line.get());
|
||||
document->getRoot()->addChild(std::move(svg_line));
|
||||
|
@ -222,7 +224,8 @@ void SvgPainter::paintPath(SvgDocument* document, SceneModel* model) const
|
|||
{
|
||||
auto model_path = dynamic_cast<GeometryPath*>(model->getGeometry());
|
||||
|
||||
auto path_string = model_path->getAsPostScript();
|
||||
PostscriptWriter writer;
|
||||
const auto path_string = writer.toString(model_path);
|
||||
|
||||
auto svg_path = std::make_unique<SvgPath>();
|
||||
svg_path->setPath(path_string);
|
||||
|
@ -236,7 +239,7 @@ void SvgPainter::paintText(SvgDocument* document, SceneText* text) const
|
|||
auto svg_text = std::make_unique<SvgTextElement>();
|
||||
svg_text->setContent(text->getTextData().mContent);
|
||||
|
||||
Point centre(text->getTextWidth() / 2.0, text->getTextHeight() / 2.0);
|
||||
Point2 centre(text->getTextWidth() / 2.0, text->getTextHeight() / 2.0);
|
||||
svg_text->setLocation(centre);
|
||||
svg_text->setFontFamily(text->getTextData().mFont.getFaceName());
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue