Initial plotting support.
This commit is contained in:
parent
df450a7be0
commit
c2027801be
34 changed files with 756 additions and 20 deletions
|
@ -14,7 +14,8 @@ public:
|
|||
Rectangle,
|
||||
Circle,
|
||||
Arc,
|
||||
Line
|
||||
Line,
|
||||
Polygon
|
||||
};
|
||||
|
||||
public:
|
||||
|
|
63
src/rendering/visual_elements/nodes/LineEndNode.cpp
Normal file
63
src/rendering/visual_elements/nodes/LineEndNode.cpp
Normal file
|
@ -0,0 +1,63 @@
|
|||
#include "LineEndNode.h"
|
||||
|
||||
#include "GeometryNode.h"
|
||||
#include "PolygonNode.h"
|
||||
|
||||
LineEndNode::LineEndNode(const Transform& t)
|
||||
: MaterialNode(t)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void LineEndNode::setStyle(LineEndNode::Style style)
|
||||
{
|
||||
if (mStyle != style)
|
||||
{
|
||||
mStyle = style;
|
||||
mContentDirty = true;
|
||||
}
|
||||
}
|
||||
|
||||
void LineEndNode::setSize(double size)
|
||||
{
|
||||
if (mSize != size)
|
||||
{
|
||||
mSize = size;
|
||||
mContentDirty = true;
|
||||
}
|
||||
}
|
||||
|
||||
void LineEndNode::createOrUpdateGeometry(SceneInfo* sceneInfo)
|
||||
{
|
||||
if (!mContentNode)
|
||||
{
|
||||
if (mStyle == Style::CLOSED_ARROW)
|
||||
{
|
||||
auto polygon = std::make_unique<PolygonNode>();
|
||||
auto p0 = Point(0.0, -mSize / 2.0);
|
||||
auto p1 = Point(mSize, 0.0);
|
||||
auto p2 = Point(0.0, mSize / 2.0);
|
||||
polygon->setPoints({ p0, p1, p2 });
|
||||
polygon->setFillColor({ 0, 0, 0 });
|
||||
|
||||
mContentNode = std::move(polygon);
|
||||
addChild(mContentNode.get());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void LineEndNode::update(SceneInfo* sceneInfo)
|
||||
{
|
||||
if (mContentDirty)
|
||||
{
|
||||
createOrUpdateGeometry(sceneInfo);
|
||||
mContentDirty = false;
|
||||
}
|
||||
|
||||
if (mMaterialIsDirty)
|
||||
{
|
||||
//updateMaterial();
|
||||
mMaterialIsDirty = false;
|
||||
}
|
||||
}
|
38
src/rendering/visual_elements/nodes/LineEndNode.h
Normal file
38
src/rendering/visual_elements/nodes/LineEndNode.h
Normal file
|
@ -0,0 +1,38 @@
|
|||
#pragma once
|
||||
|
||||
#include "MaterialNode.h"
|
||||
#include "Vector.h"
|
||||
|
||||
class GeometryNode;
|
||||
|
||||
class LineEndNode : public MaterialNode
|
||||
{
|
||||
public:
|
||||
enum class Style
|
||||
{
|
||||
NONE,
|
||||
CIRCLE,
|
||||
CLOSED_ARROW,
|
||||
OPEN_ARROW,
|
||||
CURVED_ARROW
|
||||
};
|
||||
|
||||
LineEndNode(const Transform& t = {});
|
||||
|
||||
void setStyle(LineEndNode::Style style);
|
||||
|
||||
void setSize(double size);
|
||||
|
||||
void update(SceneInfo* sceneInfo) override;
|
||||
|
||||
private:
|
||||
void createOrUpdateGeometry(SceneInfo* sceneInfo);
|
||||
|
||||
std::unique_ptr<GeometryNode> mContentNode;
|
||||
|
||||
Vector mDirection;
|
||||
|
||||
bool mContentDirty{ true };
|
||||
double mSize{ 5.0 };
|
||||
Style mStyle{ Style::NONE };
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue