Line data Source code
1 : #pragma once
2 :
3 : #include <string>
4 : #include <vector>
5 : #include <memory>
6 : #include "../../odbdesign_export.h"
7 : #include "../../IProtoBuffable.h"
8 : #include "common.pb.h"
9 :
10 : namespace Odb::Lib::FileModel::Design
11 : {
12 : struct ODBDESIGN_EXPORT ContourPolygon : public IProtoBuffable<Odb::Lib::Protobuf::ContourPolygon>
13 : {
14 499695 : ~ContourPolygon()
15 471625 : {
16 471625 : m_polygonParts.clear();
17 499691 : }
18 :
19 : struct ODBDESIGN_EXPORT PolygonPart : public IProtoBuffable<Odb::Lib::Protobuf::ContourPolygon::PolygonPart>
20 : {
21 : enum class Type
22 : {
23 : Segment,
24 : Arc
25 : };
26 :
27 : Type type = Type::Segment;
28 :
29 : // Segment/Arc
30 : double endX = 0.0, endY = 0.0;
31 :
32 : // Arc
33 : double xCenter = 0.0, yCenter = 0.0;
34 : bool isClockwise = false;
35 :
36 : // Inherited via IProtoBuffable
37 : std::unique_ptr<Odb::Lib::Protobuf::ContourPolygon::PolygonPart> to_protobuf() const override;
38 : void from_protobuf(const Odb::Lib::Protobuf::ContourPolygon::PolygonPart& message) override;
39 :
40 : typedef std::vector<std::shared_ptr<PolygonPart>> Vector;
41 :
42 : inline static const char* SEGMENT_RECORD_TOKEN = "OS";
43 : inline static const char* ARC_RECORD_TOKEN = "OC";
44 :
45 : }; // struct PolygonPart
46 :
47 : enum class Type
48 : {
49 : Island,
50 : Hole
51 : };
52 :
53 : Type type = Type::Island;
54 : double xStart = 0.0, yStart = 0.0;
55 :
56 : PolygonPart::Vector m_polygonParts;
57 :
58 : // Inherited via IProtoBuffable
59 : std::unique_ptr<Odb::Lib::Protobuf::ContourPolygon> to_protobuf() const override;
60 : void from_protobuf(const Odb::Lib::Protobuf::ContourPolygon& message) override;
61 :
62 : typedef std::vector<std::shared_ptr<ContourPolygon>> Vector;
63 :
64 : inline static const char* BEGIN_RECORD_TOKEN = "OB";
65 : inline static const char* END_RECORD_TOKEN = "OE";
66 : inline static const char* ISLAND_TYPE_TOKEN = "I";
67 : inline static const char* HOLE_TYPE_TOKEN = "H";
68 :
69 : }; // struct ContourPolygon
70 : }
|