PolygonUtils.h
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2/*
3 * This file is part of the libmspub project.
4 *
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 */
9
10#ifndef __POLYGONUTILS_H__
11#define __POLYGONUTILS_H__
12
13#include <vector>
14
15#include <librevenge/librevenge.h>
16#include <boost/function.hpp>
17#include <boost/shared_ptr.hpp>
18
19#include "ShapeType.h"
21#include "Coordinate.h"
22#include "Line.h"
23
24namespace libmspub
25{
26const int PROP_ADJUST_VAL_FIRST = 327;
27const int PROP_ADJUST_VAL_LAST = 336;
28const int PROP_GEO_LEFT = 320;
29const int PROP_GEO_TOP = 321;
30const int PROP_GEO_RIGHT = 322;
31const int PROP_GEO_BOTTOM = 323;
32
33const int OTHER_CALC_VAL = 0x400;
34const int ASPECT_RATIO = 0x600;
35
36class MSPUBCollector;
37
38typedef struct
39{
40 int m_x;
41 int m_y;
42} Vertex;
43
44typedef struct
45{
51
52typedef struct
53{
57
59{
61 unsigned m_numVertices;
62 const unsigned short *mp_elements;
63 unsigned m_numElements;
70 unsigned m_coordWidth;
71 unsigned m_coordHeight;
74 unsigned char m_adjustShiftMask;
75
76 Coordinate getTextRectangle(double x, double y, double width, double height, boost::function<double(unsigned index)> calculator) const;
77
78 CustomShape(const Vertex *p_vertices, unsigned numVertices, const unsigned short *p_elements, unsigned numElements, const Calculation *p_calculations, unsigned numCalculations, const int *p_defaultAdjustValues, unsigned numDefaultAdjustValues, const TextRectangle *p_textRectangles, unsigned numTextRectangles, unsigned coordWidth, unsigned coordHeight, const Vertex *p_gluePoints, unsigned numGluePoints, unsigned char adjustShiftMask = 0) :
79 mp_vertices(p_vertices), m_numVertices(numVertices),
80 mp_elements(p_elements), m_numElements(numElements),
81 mp_calculations(p_calculations), m_numCalculations(numCalculations),
82 mp_defaultAdjustValues(p_defaultAdjustValues), m_numDefaultAdjustValues(numDefaultAdjustValues),
83 mp_textRectangles(p_textRectangles), m_numTextRectangles(numTextRectangles),
84 m_coordWidth(coordWidth), m_coordHeight(coordHeight),
85 mp_gluePoints(p_gluePoints), m_numGluePoints(numGluePoints),
86 m_adjustShiftMask(adjustShiftMask)
87 {
88 }
89};
90
92{
93 std::vector<Vertex> m_vertices;
94 std::vector<unsigned short> m_elements;
95 std::vector<Calculation> m_calculations;
96 std::vector<int> m_defaultAdjustValues;
97 std::vector<TextRectangle> m_textRectangles;
98 std::vector<Vertex> m_gluePoints;
99 unsigned m_coordWidth;
101 unsigned char m_adjustShiftMask;
102
103 DynamicCustomShape(unsigned coordWidth, unsigned coordHeight)
104 : m_vertices(), m_elements(),
107 m_coordWidth(coordWidth), m_coordHeight(coordHeight),
109 {
110 }
111};
112
113boost::shared_ptr<const CustomShape> getFromDynamicCustomShape(const DynamicCustomShape &dcs);
114
115const CustomShape *getCustomShape(ShapeType type);
117librevenge::RVNGPropertyList calcClipPath(const std::vector<libmspub::Vertex> &verts, double x, double y, double height, double width, VectorTransformation2D transform, boost::shared_ptr<const CustomShape> shape);
118void writeCustomShape(ShapeType shapeType, librevenge::RVNGPropertyList &graphicsProps, librevenge::RVNGDrawingInterface *painter, double x, double y, double height, double width, bool closeEverything, VectorTransformation2D transform, std::vector<Line> lines, boost::function<double(unsigned index)> calculator, const std::vector<Color> &palette, boost::shared_ptr<const CustomShape> shape);
119
120} // libmspub
121#endif /* __POLYGONUTILS_H__ */
122/* vim:set shiftwidth=2 softtabstop=2 expandtab: */
Definition: MSPUBCollector.h:47
Definition: VectorTransformation2D.h:26
Definition: Arrow.h:14
const int PROP_GEO_BOTTOM
Definition: PolygonUtils.h:31
const int PROP_GEO_RIGHT
Definition: PolygonUtils.h:30
const int PROP_GEO_TOP
Definition: PolygonUtils.h:29
ShapeType
Definition: ShapeType.h:16
const int PROP_ADJUST_VAL_FIRST
Definition: PolygonUtils.h:26
librevenge::RVNGPropertyList calcClipPath(const std::vector< Vertex > &verts, double x, double y, double height, double width, VectorTransformation2D transform, boost::shared_ptr< const CustomShape > shape)
Definition: PolygonUtils.cpp:5883
const int ASPECT_RATIO
Definition: PolygonUtils.h:34
void writeCustomShape(ShapeType shapeType, librevenge::RVNGPropertyList &graphicsProps, librevenge::RVNGDrawingInterface *painter, double x, double y, double height, double width, bool closeEverything, VectorTransformation2D transform, std::vector< Line > lines, boost::function< double(unsigned index)> calculator, const std::vector< Color > &palette, boost::shared_ptr< const CustomShape > shape)
Definition: PolygonUtils.cpp:5908
bool isShapeTypeRectangle(ShapeType type)
Definition: PolygonUtils.cpp:6375
const int PROP_ADJUST_VAL_LAST
Definition: PolygonUtils.h:27
const int PROP_GEO_LEFT
Definition: PolygonUtils.h:28
const CustomShape * getCustomShape(ShapeType type)
Definition: PolygonUtils.cpp:5245
const int OTHER_CALC_VAL
Definition: PolygonUtils.h:33
boost::shared_ptr< const CustomShape > getFromDynamicCustomShape(const DynamicCustomShape &dcs)
Definition: PolygonUtils.cpp:6381
Definition: PolygonUtils.h:45
int m_argOne
Definition: PolygonUtils.h:47
int m_argTwo
Definition: PolygonUtils.h:48
int m_flags
Definition: PolygonUtils.h:46
int m_argThree
Definition: PolygonUtils.h:49
Definition: Coordinate.h:16
Definition: PolygonUtils.h:59
const int * mp_defaultAdjustValues
Definition: PolygonUtils.h:66
unsigned m_numDefaultAdjustValues
Definition: PolygonUtils.h:67
unsigned m_coordWidth
Definition: PolygonUtils.h:70
unsigned m_coordHeight
Definition: PolygonUtils.h:71
CustomShape(const Vertex *p_vertices, unsigned numVertices, const unsigned short *p_elements, unsigned numElements, const Calculation *p_calculations, unsigned numCalculations, const int *p_defaultAdjustValues, unsigned numDefaultAdjustValues, const TextRectangle *p_textRectangles, unsigned numTextRectangles, unsigned coordWidth, unsigned coordHeight, const Vertex *p_gluePoints, unsigned numGluePoints, unsigned char adjustShiftMask=0)
Definition: PolygonUtils.h:78
const Vertex * mp_vertices
Definition: PolygonUtils.h:60
unsigned m_numGluePoints
Definition: PolygonUtils.h:73
const Vertex * mp_gluePoints
Definition: PolygonUtils.h:72
unsigned m_numElements
Definition: PolygonUtils.h:63
unsigned m_numVertices
Definition: PolygonUtils.h:61
unsigned char m_adjustShiftMask
Definition: PolygonUtils.h:74
Coordinate getTextRectangle(double x, double y, double width, double height, boost::function< double(unsigned index)> calculator) const
Definition: PolygonUtils.cpp:5683
unsigned m_numTextRectangles
Definition: PolygonUtils.h:69
const unsigned short * mp_elements
Definition: PolygonUtils.h:62
const Calculation * mp_calculations
Definition: PolygonUtils.h:64
const TextRectangle * mp_textRectangles
Definition: PolygonUtils.h:68
unsigned m_numCalculations
Definition: PolygonUtils.h:65
Definition: PolygonUtils.h:92
std::vector< int > m_defaultAdjustValues
Definition: PolygonUtils.h:96
unsigned m_coordHeight
Definition: PolygonUtils.h:100
unsigned char m_adjustShiftMask
Definition: PolygonUtils.h:101
std::vector< Vertex > m_vertices
Definition: PolygonUtils.h:93
std::vector< TextRectangle > m_textRectangles
Definition: PolygonUtils.h:97
std::vector< Calculation > m_calculations
Definition: PolygonUtils.h:95
std::vector< unsigned short > m_elements
Definition: PolygonUtils.h:94
std::vector< Vertex > m_gluePoints
Definition: PolygonUtils.h:98
unsigned m_coordWidth
Definition: PolygonUtils.h:99
DynamicCustomShape(unsigned coordWidth, unsigned coordHeight)
Definition: PolygonUtils.h:103
Definition: PolygonUtils.h:53
Vertex second
Definition: PolygonUtils.h:55
Vertex first
Definition: PolygonUtils.h:54
Definition: PolygonUtils.h:39
int m_x
Definition: PolygonUtils.h:40
int m_y
Definition: PolygonUtils.h:41

Generated for libmspub by doxygen 1.9.3