Thu, 19 Mar 2020 21:06:06 +0200
PolygonObjectEditor can now modify the object properly
#include "edge.h" ldraw::Edge::Edge( const glm::vec3& point_1, const glm::vec3& point_2, const Color color_index) : ColoredObject{color_index}, point_1{point_1}, point_2{point_2} {} ldraw::Edge::Edge(const std::array<glm::vec3, 2>& vertices, const Color color) : ColoredObject{color}, point_1{vertices[0]}, point_2{vertices[1]} { } QVariant ldraw::Edge::getProperty(Property property) const { switch (property) { case Property::Point0: return QVariant::fromValue(point_1); case Property::Point1: return QVariant::fromValue(point_2); default: return BaseClass::getProperty(property); } } void ldraw::Edge::setProperty(SetPropertyResult* result, const PropertyKeyValue& pair) { LDRAW_OBJECT_HANDLE_SET_PROPERTY(Point0, {this->point_1 = value;}) LDRAW_OBJECT_HANDLE_SET_PROPERTY(Point1, {this->point_2 = value;}) BaseClass::setProperty(result, pair); } QString ldraw::Edge::textRepresentation() const { return utility::format("%1 %2", utility::vertexToStringParens(point_1), utility::vertexToStringParens(point_2)); } void ldraw::Edge::getPolygons( std::vector<gl::Polygon>& polygons, GetPolygonsContext* context) const { Q_UNUSED(context) polygons.push_back(gl::edgeLine(this->point_1, this->point_2, this->colorIndex, this->id)); } int ldraw::Edge::numPoints() const { return 2; } const glm::vec3& ldraw::Edge::getPoint(int index) const { switch (index) { case 0: return this->point_1; case 1: return this->point_2; default: return ldraw::ColoredObject::getPoint(index); } }