123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524 |
- #ifndef __FIGURE_H__
- #define __FIGURE_H__
- #include "TypeDef.h"
- class BaseItem;
- class QPointF;
- template <typename T>
- class QList;
- namespace JVision
- {
-
- enum class JVision_API E_FIGURE_TYPE : int
- {
- E_AUTO_FIGURE = 0,
- E_CIRCLE,
- E_CONCENTRIC_CIRCLE,
- E_RECTANGLE,
- E_RECTANGLE_R,
- E_CONCENTRIC_RECTANGLE,
- E_LINE_OBJ,
- E_CALIPERS,
- E_POLYGEN,
- };
-
- struct JVision_API BaseFigure
- {
-
- BaseItem* ConvertBaseItem() { return nullptr; }
-
- static std::string GetFigureNameCN(E_FIGURE_TYPE type);
-
- static BaseFigure* Create(E_FIGURE_TYPE type);
-
- static void Destroy(BaseFigure* data);
-
- static bool FigureIsEqual(const BaseFigure* figure_1, const BaseFigure* figure_2);
-
- static bool CopyData(BaseFigure* figure_1, BaseFigure* figure_2);
-
- virtual std::string serializeJSON() = 0;
-
- virtual bool DeserializeJSON(const std::string jsonStr) = 0;
-
- BaseFigure(E_FIGURE_TYPE _type);
- E_FIGURE_TYPE type;
- static const double epsilon;
- };
-
- struct JVision_API Circle : public BaseFigure
- {
-
- Circle();
-
- Circle(double _x, double _y, double _radius);
-
- std::string serializeJSON();
-
- bool DeserializeJSON(const std::string jsonStr);
-
- bool operator==(const Circle& other) const;
-
- bool Copy(Circle* dst);
- double x;
- double y;
- double radius;
- };
-
- struct JVision_API CCircle : public BaseFigure
- {
-
- CCircle();
-
- CCircle(double _x, double _y, double _small_radius, double _big_radius);
-
- std::string serializeJSON();
-
- bool DeserializeJSON(const std::string jsonStr);
-
- bool operator==(const CCircle& other) const;
-
- bool Copy(CCircle* dst);
- double x;
- double y;
- double small_radius;
- double radius;
- double big_radius;
- };
-
- struct JVision_API Rectangle : public BaseFigure
- {
-
- Rectangle();
-
- Rectangle(double _x, double _y, double _width, double _height);
-
- std::string serializeJSON();
-
- bool DeserializeJSON(const std::string jsonStr);
-
- bool operator==(const Rectangle& other) const;
-
- bool Copy(Rectangle* dst);
- double x;
- double y;
- double width;
- double height;
- };
-
- struct JVision_API RotatedRect : public BaseFigure
- {
-
- RotatedRect();
-
- RotatedRect(double _x, double _y, double _phi, double _lenth1, double _lenth2);
-
- std::string serializeJSON();
-
- bool DeserializeJSON(const std::string jsonStr);
-
- bool operator==(const RotatedRect& other) const;
-
- bool Copy(RotatedRect* dst);
- double x;
- double y;
- double phi;
- double lenth1;
- double lenth2;
- };
-
- struct JVision_API CRectangle :public BaseFigure
- {
-
- CRectangle();
-
- CRectangle(double _x, double _y, double _phi, double _lenth1, double _lenth2, double _Diff);
-
- std::string serializeJSON();
-
- bool DeserializeJSON(const std::string jsonStr);
-
- bool operator==(const CRectangle& other) const;
-
- bool Copy(CRectangle* dst);
- double x;
- double y;
- double phi;
- double lenth1;
- double lenth2;
- double Diff;
- };
-
- struct JVision_API Line : public BaseFigure
- {
-
- Line();
-
- Line(double _StartX, double _StartY, double _EndX, double _EndY);
-
- std::string serializeJSON();
-
- bool DeserializeJSON(const std::string jsonStr);
-
- bool operator==(const Line& other) const;
-
- bool Copy(Line* dst);
- double StartX;
- double StartY;
- double EndX;
- double EndY;
- };
-
- struct JVision_API Caliper : public BaseFigure
- {
-
- Caliper();
-
- Caliper(double _x1, double _y1, double _x2, double _y2, double _height, int _segment_line_num);
-
- std::string serializeJSON();
-
- bool DeserializeJSON(const std::string jsonStr);
-
- bool operator==(const Caliper& other) const;
-
- bool Copy(Caliper* dst);
- double lineStartX;
- double lineEndX;
- double lineStartY;
- double lineEndY;
- double height;
- std::string caliperCase;
- int segment_line_num;
-
- double x1;
- double y1;
- double x2;
- double y2;
- double row;
- double col;
- double len1;
- double len2;
- double angle;
- };
-
- struct JVision_API MPolygon : public BaseFigure
- {
-
- MPolygon();
-
- MPolygon(QList<QPointF> Points, QList<QPointF> List_P, QList<QList<QPointF>> List_Ps);
-
- std::string serializeJSON();
-
- bool DeserializeJSON(const std::string jsonStr);
-
- bool operator==(const MPolygon& other) const;
-
- bool Copy(MPolygon* dst);
- QList<QPointF>* points;
- QList<QPointF>* list_p;
- QList<QList<QPointF>>* list_ps;
- };
- }
- #endif
|