File indexing completed on 2024-04-21 03:50:55

0001 #ifndef MARKEDOBJECT_H
0002 #define MARKEDOBJECT_H
0003 
0004 #include <memory>
0005 #include <QVariant>
0006 #include <QString>
0007 
0008 #include "core/markedclass.h"
0009 #include "core/markedobject_p.h"
0010 
0011 class MarkedClass;
0012 
0013 /** Base class that represents all types of annotated data. */
0014 class MarkedObject
0015 {
0016 public:
0017     enum class Type {
0018         Polygon,
0019         Sentence
0020     };
0021     /** Create a MarkedObject with given d pointer and MarkedClass's object.
0022      * @param d_ptr - d pointer.
0023      * @param objClass - pointer of a MarkedClass.
0024      */
0025     explicit MarkedObject(std::unique_ptr<MarkedObjectPrivate> d_ptr, MarkedClass* objClass);
0026 
0027     /** Create a MarkedObject with given MarkedClass's object, initialize a d pointer internally.
0028      * @param objClass - pointer of a MarkedClass.
0029      */
0030     explicit MarkedObject(MarkedClass* objClass);
0031 
0032     /** @return the instance of MarkedClass used. */
0033     MarkedClass* objClass() const;
0034 
0035     /** Chance the instance of MarkedClass used. */
0036     void setObjClass(MarkedClass* objClass);
0037 
0038     /** Reset MarkedObject. */
0039     virtual void clear() = 0;
0040 
0041     /** Reset MarkedObject::Type of the instance. */
0042     virtual MarkedObject::Type type() = 0;
0043 
0044     /** @return unitary name of the MarkedObject instance. */
0045     virtual QString unitName() const = 0;
0046 
0047 protected:
0048     std::unique_ptr<MarkedObjectPrivate> d_p;
0049 };
0050 
0051 #endif // MARKEDOBJECT_H