diff -r 4bec0525ef1b -r 93ec4d630346 src/linetypes/edge.cpp --- a/src/linetypes/edge.cpp Thu Mar 19 21:06:06 2020 +0200 +++ b/src/linetypes/edge.cpp Wed Mar 25 16:07:20 2020 +0200 @@ -1,43 +1,11 @@ #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& 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)); + return utility::format( + "%1 %2", + utility::vertexToStringParens(this->points[0]), + utility::vertexToStringParens(this->points[1])); } void ldraw::Edge::getPolygons( @@ -45,23 +13,5 @@ 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; + polygons.push_back(gl::edgeLine(this->points[0], this->points[1], this->colorIndex, this->id)); } - -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); - } -}