OdbDesign
OdbDesign ODB++ Parser - C++ library, gRPC/REST server, CLI, tests
 
Loading...
Searching...
No Matches
ContourPolygon.h
Go to the documentation of this file.
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
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 = 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
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}
#define ODBDESIGN_EXPORT
std::vector< std::shared_ptr< PolygonPart > > Vector
std::vector< std::shared_ptr< ContourPolygon > > Vector