summaryrefslogtreecommitdiff
path: root/src/dxfdata.h
blob: ac7260c2d7df730d79cc51bd46bed9642d765bcb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#ifndef DXFDATA_H_
#define DXFDATA_H_

#include "linalg.h"
#include <vector>

class DxfData
{
public:
	struct Path {
		std::vector<int> indices; // indices into DxfData::points
		bool is_closed, is_inner;
		Path() : is_closed(false), is_inner(false) { }
	};
	struct Dim {
		unsigned int type;
		double coords[7][2];
		double angle;
		double length;
		std::string name;
		Dim() {
			for (int i = 0; i < 7; i++)
			for (int j = 0; j < 2; j++)
				coords[i][j] = 0;
			type = 0;
			angle = 0;
			length = 0;
		}
	};

	std::vector<Vector2d> points;
	std::vector<Path> paths;
	std::vector<Dim> dims;

	DxfData();
	DxfData(double fn, double fs, double fa, 
					const std::string &filename, const std::string &layername = "",
					double xorigin = 0.0, double yorigin = 0.0, double scale = 1.0);

	int addPoint(double x, double y);

	void fixup_path_direction();
	std::string dump() const;
};

#endif
contact: Jan Huwald // Impressum