Fix linux build.
This commit is contained in:
parent
c5363327e8
commit
198caa700b
16 changed files with 34 additions and 24 deletions
|
@ -15,7 +15,7 @@ void CanvasDrawingArea::addShapeAt(unsigned x, unsigned y)
|
|||
{
|
||||
if (mActiveDrawingCommand == CanvasDrawCommand::CIRCLE)
|
||||
{
|
||||
auto circle = std::make_unique<CircleNode>(Transform(DiscretePoint(x, y)), 5);
|
||||
auto circle = std::make_unique<CircleNode>(Transform(Point2(x, y)), 5);
|
||||
circle->setFillColor(Color(255, 0, 0));
|
||||
circle->setName("CanvasDrawingArea_CircleNode");
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@ void ImageViewWidget::doPaint(const PaintEvent* event)
|
|||
|
||||
if (!mGridNode)
|
||||
{
|
||||
mGridNode = std::make_unique<GridNode>(Transform(mLocation));
|
||||
mGridNode = std::make_unique<GridNode>(Transform(Point3(mLocation)));
|
||||
mGridNode->setName(mName + "_GridNode");
|
||||
mGridNode->setNumX(mNumX);
|
||||
mGridNode->setNumY(mNumY);
|
||||
|
|
|
@ -34,7 +34,7 @@ void MeshViewerView::doPaint(const PaintEvent* event)
|
|||
|
||||
if (!mMeshNode)
|
||||
{
|
||||
mMeshNode = std::make_unique<MeshNode>(Transform(mLocation));
|
||||
mMeshNode = std::make_unique<MeshNode>(Transform(Point3(mLocation)));
|
||||
mMeshNode->setName(mName + "_MeshNode");
|
||||
|
||||
mMeshNode->setWidth(mSize.mWidth);
|
||||
|
|
|
@ -3,15 +3,15 @@
|
|||
#include "LineNode.h"
|
||||
|
||||
WireNode::WireNode(const Transform& transform)
|
||||
: AbstractVisualNode(transform)
|
||||
: AbstractVisualNode(transform)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void WireNode::setContent(Wire* wire)
|
||||
{
|
||||
mContent = wire;
|
||||
mContentDirty = true;
|
||||
mContent = wire;
|
||||
mContentDirty = true;
|
||||
}
|
||||
|
||||
void WireNode::setInputLocation(const Point2& point)
|
||||
|
@ -66,4 +66,4 @@ void WireNode::createOrUpdateGeometry(SceneInfo*)
|
|||
|
||||
addChild(mLine.get());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -27,6 +27,15 @@ Transform::Transform(const Point3& location, const Scale& scale, const Rotation&
|
|||
|
||||
}
|
||||
|
||||
Transform::Transform(const Point2& location, const Scale& scale, const Rotation& rotation)
|
||||
: mLocation(Point<3>::from(location)),
|
||||
mScale(scale),
|
||||
mRotation(rotation),
|
||||
mMatrix()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void Transform::applyPre(const Transform& transform)
|
||||
{
|
||||
mLocation.moveBy(transform.getLocation().getX(), transform.getLocation().getY(), transform.getLocation().getZ());
|
||||
|
|
|
@ -37,6 +37,8 @@ class Transform
|
|||
public:
|
||||
Transform(const Point3& location = {}, const Scale& scale = {}, const Rotation& rotation = {});
|
||||
|
||||
Transform(const Point2& location, const Scale& scale = {}, const Rotation& rotation = {});
|
||||
|
||||
void applyPre(const Transform& transform);
|
||||
|
||||
const Point3& getLocation() const;
|
||||
|
|
|
@ -7,10 +7,9 @@
|
|||
#include <numeric>
|
||||
|
||||
template<std::size_t DIM>
|
||||
Point<DIM>::Point(const Point<2>& p)
|
||||
: Point(p.getX(), p.getY())
|
||||
Point<DIM> Point<DIM>::from(const Point<2>& p)
|
||||
{
|
||||
|
||||
return Point<DIM>(p.getX(), p.getY());
|
||||
}
|
||||
|
||||
template<std::size_t DIM>
|
||||
|
|
|
@ -15,7 +15,7 @@ public:
|
|||
|
||||
Point(const Vector<double, DIM>& v);
|
||||
|
||||
Point(const Point<2>& p);
|
||||
static Point<DIM> from(const Point<2>& p);
|
||||
|
||||
Point(const Point<DIM>& p) = default;
|
||||
|
||||
|
|
|
@ -56,7 +56,7 @@ void EquationNode::addExpression(SceneInfo* sceneInfo, const LatexMathExpression
|
|||
}
|
||||
|
||||
MLOG_INFO("Processing leaf expr with content: " << content << " and size " << content.size());
|
||||
auto node = std::make_unique<TextNode>(content, Transform(mTextCursor));
|
||||
auto node = std::make_unique<TextNode>(content, Transform(Point<3>::from(mTextCursor)));
|
||||
node->setFont(mDefaultFont);
|
||||
addChild(node.get());
|
||||
|
||||
|
@ -75,7 +75,7 @@ void EquationNode::addExpression(SceneInfo* sceneInfo, const LatexMathExpression
|
|||
|
||||
mTextCursor.moveBy(x_cache - mTextCursor.getX(), 16.0);
|
||||
std::vector<Point2> end_loc{ { 25.0, 0.0 } };
|
||||
auto dividing_line = std::make_unique<LineNode>(Transform(mTextCursor), end_loc);
|
||||
auto dividing_line = std::make_unique<LineNode>(Transform(Point<3>::from(mTextCursor)), end_loc);
|
||||
addChild(dividing_line.get());
|
||||
mLines.push_back(std::move(dividing_line));
|
||||
|
||||
|
@ -92,7 +92,7 @@ void EquationNode::addExpression(SceneInfo* sceneInfo, const LatexMathExpression
|
|||
{
|
||||
auto left_content = expression->getLeftSymbol().mUnicode;
|
||||
|
||||
auto left_node = std::make_unique<TextNode>(left_content, Transform(mTextCursor));
|
||||
auto left_node = std::make_unique<TextNode>(left_content, Transform(Point<3>::from(mTextCursor)));
|
||||
left_node->setFont(mDefaultFont);
|
||||
addChild(left_node.get());
|
||||
|
||||
|
@ -103,7 +103,7 @@ void EquationNode::addExpression(SceneInfo* sceneInfo, const LatexMathExpression
|
|||
|
||||
auto right_content = expression->getRightSymbol().mUnicode;
|
||||
|
||||
auto right_node = std::make_unique<TextNode>(right_content, Transform(mTextCursor));
|
||||
auto right_node = std::make_unique<TextNode>(right_content, Transform(Point<3>::from(mTextCursor)));
|
||||
right_node->setFont(mDefaultFont);
|
||||
addChild(right_node.get());
|
||||
|
||||
|
@ -120,4 +120,4 @@ void EquationNode::createOrUpdateGeometry(SceneInfo* sceneInfo)
|
|||
mText.clear();
|
||||
|
||||
addExpression(sceneInfo, mContent);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -48,7 +48,7 @@ std::vector<double> AbstractMesh::getVectorAttribute(const std::string& tag) con
|
|||
|
||||
void AbstractMesh::scale(double scaleX, double scaleY)
|
||||
{
|
||||
Transform transform({ 0.0, 0.0 }, scaleX, scaleY);
|
||||
Transform transform(Point3{ 0.0, 0.0, 0.0 }, scaleX, scaleY);
|
||||
|
||||
for (auto& node : mNodes)
|
||||
{
|
||||
|
|
|
@ -35,7 +35,7 @@ void LineNode::createOrUpdateGeometry(SceneInfo*)
|
|||
if (!mEndNode)
|
||||
{
|
||||
auto end_loc = mPoints[mPoints.size() - 1];
|
||||
mEndNode = std::make_unique<LineEndNode>(Transform(end_loc));
|
||||
mEndNode = std::make_unique<LineEndNode>(Transform(Point<3>::from(end_loc)));
|
||||
addChild(mEndNode.get());
|
||||
}
|
||||
mEndNode->setStyle(mEndEndStyle);
|
||||
|
|
|
@ -130,7 +130,7 @@ void SvgNode::onCircle(XmlElement* element, std::unique_ptr<GeometryNode>& node)
|
|||
minor_radius *= transform.getScale().mY;
|
||||
}
|
||||
|
||||
auto circle_node = std::make_unique<CircleNode>(Transform(loc), radius);
|
||||
auto circle_node = std::make_unique<CircleNode>(Transform(Point<3>::from(loc)), radius);
|
||||
circle_node->setMinorRadius(minor_radius);
|
||||
node = std::move(circle_node);
|
||||
}
|
||||
|
|
|
@ -47,7 +47,7 @@ Transform SvgShapeElement::getTransform() const
|
|||
if (in_translate)
|
||||
{
|
||||
const auto loc = parsePoint(working_string, 0.0);
|
||||
transform.setLocation(loc);
|
||||
transform.setLocation(Point<3>::from(loc));
|
||||
in_translate = false;
|
||||
}
|
||||
else if (in_scale)
|
||||
|
|
|
@ -205,7 +205,7 @@ void Button::doPaint(const PaintEvent* event)
|
|||
{
|
||||
if (mTransformDirty)
|
||||
{
|
||||
mRootNode->setTransform(Transform(mLocation));
|
||||
mRootNode->setTransform(Transform(Point3(mLocation)));
|
||||
mTransformDirty = false;
|
||||
}
|
||||
|
||||
|
@ -255,7 +255,7 @@ void Button::updateIcon(const PaintEvent* event)
|
|||
{
|
||||
if (!mIconNode && mIcon != Resource::Icon::Svg::NONE)
|
||||
{
|
||||
mIconNode = std::make_unique<IconNode>(Transform(Point(15.0, 8.0), 0.5, 0.5));
|
||||
mIconNode = std::make_unique<IconNode>(Transform(Point3(15.0, 8.0), 0.5, 0.5));
|
||||
mIconNode->setName(mName + "_IconNode");
|
||||
mIconNode->setSvgContent(MediaResourceManager::getSvgIconNode(mIcon));
|
||||
mRootNode->addChild(mIconNode.get());
|
||||
|
|
|
@ -335,7 +335,7 @@ void Widget::createOrUpdateGeometry()
|
|||
|
||||
void Widget::updateTransform()
|
||||
{
|
||||
mRootNode->setTransform({ mLocation });
|
||||
mRootNode->setTransform(Point3{ mLocation });
|
||||
}
|
||||
|
||||
void Widget::updateMaterial(const PaintEvent* event)
|
||||
|
|
|
@ -16,7 +16,7 @@ TEST_CASE(TestSvgConverter, "[publishing]")
|
|||
Scene scene;
|
||||
//scene.setShowMeshOutline(true);
|
||||
|
||||
CircleNode circle({40, 40}, 20);
|
||||
CircleNode circle(Point2{40, 40}, 20);
|
||||
circle.setFillColor({255, 0, 0});
|
||||
scene.addNode(&circle);
|
||||
|
||||
|
|
Loading…
Reference in a new issue