Tue, 27 Jul 2021 11:11:32 +0300
fix too long lines
#pragma once #include "object.h" #include "widgets/vec3editor.h" #include "model.h" #include "modeleditcontext.h" namespace ldraw { template<int N, typename> class PolygonObject; } template<int N, typename = std::enable_if_t<(N > 0 and N <= 4)>> class ldraw::PolygonObject : public ColoredObject { public: using BaseClass = ColoredObject; PolygonObject(const std::array<glm::vec3, N>& points, const Color color) : ColoredObject{color}, points{points} {} int numPoints() const override { return N; } const glm::vec3& getPoint(int index) const override { Q_ASSERT(index >= 0 and index < N); return this->points[index]; } QVariant getProperty(const Property id) const override { switch (id) { case Property::Point0: return QVariant::fromValue(points[0]); case Property::Point1: return QVariant::fromValue(points[1]); case Property::Point2: if (N >= 3) { return QVariant::fromValue(points[2]); } break; case Property::Point3: if (N >= 4) { return QVariant::fromValue(points[3]); } break; default: break; } return BaseClass::getProperty(id); } void setProperty(SetPropertyResult* result, const PropertyKeyValue& pair) override { LDRAW_OBJECT_HANDLE_SET_PROPERTY(Point0, {points[0] = value;}) LDRAW_OBJECT_HANDLE_SET_PROPERTY(Point1, {points[1] = value;}) if constexpr (N >= 3) { LDRAW_OBJECT_HANDLE_SET_PROPERTY(Point2, {points[2] = value;}) } if constexpr (N >= 4) { LDRAW_OBJECT_HANDLE_SET_PROPERTY(Point3, {points[3] = value;}) } ColoredObject::setProperty(result, pair); } std::array<glm::vec3, N> points; };