Initial plotting support.
This commit is contained in:
parent
df450a7be0
commit
c2027801be
34 changed files with 756 additions and 20 deletions
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;
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue