OdbDesignLib
OdbDesign ODB++ Parsing Library
 
Loading...
Searching...
No Matches
ContourPolygon.h
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
10namespace Odb::Lib::FileModel::Design
11{
12 struct ODBDESIGN_EXPORT ContourPolygon : public IProtoBuffable<Odb::Lib::Protobuf::ContourPolygon>
13 {
15 {
16 m_polygonParts.clear();
17 }
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;
28
29 // Segment/Arc
30 double endX, endY;
31
32 // Arc
33 double xCenter, yCenter;
34 bool isClockwise;
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;
54 double xStart, yStart;
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}