Main Page
Namespaces
Classes
Files
File List
File Members
VSDXGeometryList.h
Go to the documentation of this file.
1
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2
/* libvisio
3
* Version: MPL 1.1 / GPLv2+ / LGPLv2+
4
*
5
* The contents of this file are subject to the Mozilla Public License Version
6
* 1.1 (the "License"); you may not use this file except in compliance with
7
* the License or as specified alternatively below. You may obtain a copy of
8
* the License at http://www.mozilla.org/MPL/
9
*
10
* Software distributed under the License is distributed on an "AS IS" basis,
11
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12
* for the specific language governing rights and limitations under the
13
* License.
14
*
15
* Major Contributor(s):
16
* Copyright (C) 2011 Fridrich Strba <fridrich.strba@bluewin.ch>
17
* Copyright (C) 2011 Eilidh McAdam <tibbylickle@gmail.com>
18
*
19
*
20
* All Rights Reserved.
21
*
22
* For minor contributions see the git repository.
23
*
24
* Alternatively, the contents of this file may be used under the terms of
25
* either the GNU General Public License Version 2 or later (the "GPLv2+"), or
26
* the GNU Lesser General Public License Version 2 or later (the "LGPLv2+"),
27
* in which case the provisions of the GPLv2+ or the LGPLv2+ are applicable
28
* instead of those above.
29
*/
30
31
#ifndef __VSDXGEOMETRYLIST_H__
32
#define __VSDXGEOMETRYLIST_H__
33
34
#include <vector>
35
#include <map>
36
37
namespace
libvisio
38
{
39
40
class
VSDXGeometryListElement;
41
class
VSDXCollector;
42
43
class
VSDXGeometryList
44
{
45
public
:
46
VSDXGeometryList
();
47
VSDXGeometryList
(
const
VSDXGeometryList
&geomList);
48
~VSDXGeometryList
();
49
VSDXGeometryList
&
operator=
(
const
VSDXGeometryList
&geomList);
50
51
void
addGeometry
(
unsigned
id
,
unsigned
level,
unsigned
char
geomFlags);
52
void
addMoveTo
(
unsigned
id
,
unsigned
level,
double
x,
double
y);
53
void
addLineTo
(
unsigned
id
,
unsigned
level,
double
x,
double
y);
54
void
addArcTo
(
unsigned
id
,
unsigned
level,
double
x2,
double
y2,
double
bow);
55
void
addNURBSTo
(
unsigned
id
,
unsigned
level,
double
x2,
double
y2,
unsigned
char
xType,
unsigned
char
yType,
unsigned
degree, std::vector<std::pair<double, double> > controlPoints, std::vector<double> knotVector, std::vector<double> weights);
56
void
addNURBSTo
(
unsigned
id
,
unsigned
level,
double
x2,
double
y2,
double
knot,
double
knotPrev,
double
weight,
double
weightPrev,
unsigned
dataID);
57
void
addPolylineTo
(
unsigned
id
,
unsigned
level,
double
x,
double
y,
unsigned
char
xType,
unsigned
char
yType, std::vector<std::pair<double, double> > points);
58
void
addPolylineTo
(
unsigned
id
,
unsigned
level,
double
x,
double
y,
unsigned
dataID);
59
void
addEllipse
(
unsigned
id
,
unsigned
level,
double
cx,
double
cy,
double
xleft,
double
yleft,
double
xtop,
double
ytop);
60
void
addEllipticalArcTo
(
unsigned
id
,
unsigned
level,
double
x3,
double
y3,
double
x2,
double
y2,
double
angle,
double
ecc);
61
void
addSplineStart
(
unsigned
id
,
unsigned
level,
double
x,
double
y,
double
secondKnot,
double
firstKnot,
double
lastKnot,
unsigned
degree);
62
void
addSplineKnot
(
unsigned
id
,
unsigned
level,
double
x,
double
y,
double
knot);
63
void
addInfiniteLine
(
unsigned
id
,
unsigned
level,
double
x1,
double
y1,
double
x2,
double
y2);
64
void
setElementsOrder
(
const
std::vector<unsigned> &
m_elementsOrder
);
65
void
handle
(
VSDXCollector
*collector)
const
;
66
void
clear
();
67
bool
empty
()
const
68
{
69
return
(
m_elements
.empty());
70
}
71
VSDXGeometryListElement
*
getElement
(
unsigned
index)
const
;
72
std::vector<unsigned>
getElementsOrder
()
const
73
{
74
return
m_elementsOrder
;
75
}
76
unsigned
count
()
const
77
{
78
return
m_elements
.size();
79
}
80
private
:
81
std::map<unsigned, VSDXGeometryListElement *>
m_elements
;
82
std::vector<unsigned>
m_elementsOrder
;
83
};
84
85
class
VSDXGeometryListElement
86
{
87
public
:
88
VSDXGeometryListElement
() {}
89
virtual
~VSDXGeometryListElement
() {}
90
virtual
void
handle
(
VSDXCollector
*collector) = 0;
91
virtual
VSDXGeometryListElement
*
clone
() = 0;
92
};
93
94
class
VSDXPolylineTo2
:
public
VSDXGeometryListElement
95
{
96
public
:
97
VSDXPolylineTo2
(
unsigned
id
,
unsigned
level,
double
x,
double
y,
unsigned
dataID) :
98
m_dataID
(dataID),
m_id
(id),
m_level
(level),
m_x
(x),
m_y
(y) {}
99
~VSDXPolylineTo2
() {}
100
void
handle
(
VSDXCollector
*collector);
101
VSDXGeometryListElement
*
clone
();
102
unsigned
m_dataID
;
103
private
:
104
unsigned
m_id
,
m_level
;
105
double
m_x
,
m_y
;
106
};
107
108
class
VSDXNURBSTo2
:
public
VSDXGeometryListElement
109
{
110
public
:
111
VSDXNURBSTo2
(
unsigned
id
,
unsigned
level,
double
x2,
double
y2,
double
knot,
double
knotPrev,
double
weight,
double
weightPrev,
unsigned
dataID) :
112
m_dataID
(dataID),
m_id
(id),
m_level
(level),
m_x2
(x2),
m_y2
(y2),
m_knot
(knot),
m_knotPrev
(knotPrev),
m_weight
(weight),
m_weightPrev
(weightPrev) {}
113
~VSDXNURBSTo2
() {}
114
void
handle
(
VSDXCollector
*collector);
115
VSDXGeometryListElement
*
clone
();
116
unsigned
m_dataID
;
117
private
:
118
unsigned
m_id
,
m_level
;
119
double
m_x2
,
m_y2
;
120
double
m_knot
,
m_knotPrev
;
121
double
m_weight
,
m_weightPrev
;
122
123
};
124
125
}
// namespace libvisio
126
127
#endif // __VSDXGEOMETRYLIST_H__
128
/* vim:set shiftwidth=2 softtabstop=2 expandtab: */
Generated for libvisio by
doxygen
1.8.1.1