diff -r 2bdc3ac5e77c -r 55a55a9ec2c2 src/objecttypes/modelobject.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/objecttypes/modelobject.h Sun Sep 22 11:51:41 2019 +0300 @@ -0,0 +1,61 @@ +#pragma once +#include +#include +#include +#include "main.h" +#include "colors.h" +#include "uuid.h" +#include "vertex.h" + +namespace modelobjects +{ + enum class Property; + class BaseObject; + class ColoredBaseObject; +} + +enum class modelobjects::Property +{ + Color, + Text, + Point1, + Point2, + Point3, + Point4, + ControlPoint1, + ControlPoint2, + Position, + Transformation, + ReferenceName, + IsInverted, +}; + +class modelobjects::BaseObject +{ +public: + enum class SetPropertyResult + { + Success = 0, + PropertyNotHandled, + InvalidValue + }; + BaseObject(); + BaseObject(const BaseObject&) = delete; + virtual ~BaseObject(); + const Uuid id; + //virtual void toString(QTextStream &out) = 0; + virtual bool hasColor() const; + virtual QVariant getProperty(Property id) const; + virtual SetPropertyResult setProperty(Property id, const QVariant& value); +}; + +class modelobjects::ColoredBaseObject : public BaseObject +{ +public: + ColoredBaseObject(const Color color_index = colors::main); + bool hasColor() const override final; + QVariant getProperty(Property id) const override; + SetPropertyResult setProperty(Property id, const QVariant& value) override; +private: + Color color_index = colors::main; +};