OutputShape.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 libpagemaker 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 __LIBPAGEMAKER_OUTPUTSHAPE_H__
11#define __LIBPAGEMAKER_OUTPUTSHAPE_H__
12
13#include <memory>
14#include <vector>
15
16#include "PMDExceptions.h"
17#include "geometry.h"
18#include "libpagemaker_utils.h"
19
20namespace libpagemaker
21{
22
24{
26 uint8_t m_shapeType;
27 std::vector<InchPoint> m_points;
28 double m_rotation;
29 double m_skew;
33 std::string m_text;
34 std::vector<PMDCharProperties> m_charProps;
35 std::vector<PMDParaProperties> m_paraProps;
36 librevenge::RVNGBinaryData m_bitmap;
38
39public:
40 OutputShape(bool isClosed, int shape, double rotation, double skew, const PMDFillProperties &fillProps, const PMDStrokeProperties &strokeProps)
41 : m_isClosed(isClosed), m_shapeType(shape), m_points(), m_rotation(rotation), m_skew(skew),
43 { }
44
45 OutputShape(bool isClosed, int shape, double rotation, double skew, std::string text, std::vector<PMDCharProperties> charProps, std::vector<PMDParaProperties> paraProps)
46 : m_isClosed(isClosed), m_shapeType(shape), m_points(), m_rotation(rotation), m_skew(skew),
50 m_text(text), m_charProps(charProps), m_paraProps(paraProps), m_bitmap(), m_width(), m_height()
51 { }
52
53 OutputShape(bool isClosed, int shape, double rotation, double skew, librevenge::RVNGBinaryData bitmap)
54 : m_isClosed(isClosed), m_shapeType(shape), m_points(), m_rotation(rotation), m_skew(skew),
59 { }
60
61 unsigned numPoints() const
62 {
63 return m_points.size();
64 }
65
66 InchPoint getPoint(unsigned i) const
67 {
68 return (m_points.size() > i) ? m_points[i] : InchPoint(0, 0);
69 }
70
71 bool getIsClosed() const
72 {
73 return m_isClosed;
74 }
75
76 uint8_t shapeType() const
77 {
78 return m_shapeType;
79 }
80
82 {
83 return m_fillProps;
84 }
85
87 {
88 return m_strokeProps;
89 }
90
91 double getRotation() const
92 {
93 return m_rotation;
94 }
95
96 double getSkew() const
97 {
98 return m_skew;
99 }
100
101 std::string getText() const
102 {
103 return m_text;
104 }
105
106 std::vector<PMDCharProperties> getCharProperties() const
107 {
108 return m_charProps;
109 }
110
111 std::vector<PMDParaProperties> getParaProperties() const
112 {
113 return m_paraProps;
114 }
115
116 librevenge::RVNGBinaryData getBitmap() const
117 {
118 return m_bitmap;
119 }
120
121 std::pair<InchPoint, InchPoint> getBoundingBox() const
122 {
123 if (m_points.empty() && m_bitmap.empty())
124 {
125 throw EmptyLineSetException();
126 }
127 return std::make_pair(InchPoint(m_bboxLeft, m_bboxTop), InchPoint(m_bboxRight, m_bboxBot));
128 }
129
130 void setBoundingBox(InchPoint bboxTopLeft, InchPoint bboxBotRight)
131 {
132 m_bboxLeft = bboxTopLeft.m_x;
133 m_bboxTop = bboxTopLeft.m_y;
134 m_bboxRight = bboxBotRight.m_x;
135 m_bboxBot = bboxBotRight.m_y;
136 }
137
138 void addPoint(InchPoint point)
139 {
140 m_points.push_back(InchPoint(point.m_x, point.m_y));
141 }
142
143 void setDimensions(double width, double height)
144 {
145 m_width = width,
146 m_height = height;
147 }
148
149 double getWidth() const
150 {
151 return m_width;
152 }
153
154 double getHeight() const
155 {
156 return m_height;
157 }
158};
159
160
161std::shared_ptr<OutputShape> newOutputShape(
162 const std::shared_ptr<const PMDLineSet> &lineSet, const InchPoint &translate);
163
164}
165
166#endif /* __LIBPAGEMAKER_OUTPUTSHAPE_H__ */
167
168/* vim:set shiftwidth=2 softtabstop=2 expandtab: */
Definition OutputShape.h:24
const PMDStrokeProperties & getStrokeProperties() const
Definition OutputShape.h:86
double m_bboxLeft
Definition OutputShape.h:30
OutputShape(bool isClosed, int shape, double rotation, double skew, std::string text, std::vector< PMDCharProperties > charProps, std::vector< PMDParaProperties > paraProps)
Definition OutputShape.h:45
void setBoundingBox(InchPoint bboxTopLeft, InchPoint bboxBotRight)
Definition OutputShape.h:130
double m_height
Definition OutputShape.h:37
InchPoint getPoint(unsigned i) const
Definition OutputShape.h:66
uint8_t m_shapeType
Definition OutputShape.h:26
double m_bboxTop
Definition OutputShape.h:30
double getSkew() const
Definition OutputShape.h:96
void setDimensions(double width, double height)
Definition OutputShape.h:143
double m_rotation
Definition OutputShape.h:28
librevenge::RVNGBinaryData getBitmap() const
Definition OutputShape.h:116
librevenge::RVNGBinaryData m_bitmap
Definition OutputShape.h:36
double m_skew
Definition OutputShape.h:29
double getHeight() const
Definition OutputShape.h:154
OutputShape(bool isClosed, int shape, double rotation, double skew, librevenge::RVNGBinaryData bitmap)
Definition OutputShape.h:53
unsigned numPoints() const
Definition OutputShape.h:61
bool getIsClosed() const
Definition OutputShape.h:71
std::string getText() const
Definition OutputShape.h:101
std::vector< PMDCharProperties > getCharProperties() const
Definition OutputShape.h:106
std::vector< InchPoint > m_points
Definition OutputShape.h:27
double m_bboxRight
Definition OutputShape.h:30
std::vector< PMDParaProperties > m_paraProps
Definition OutputShape.h:35
bool m_isClosed
Definition OutputShape.h:25
std::vector< PMDCharProperties > m_charProps
Definition OutputShape.h:34
PMDStrokeProperties m_strokeProps
Definition OutputShape.h:32
PMDFillProperties m_fillProps
Definition OutputShape.h:31
const PMDFillProperties & getFillProperties() const
Definition OutputShape.h:81
double getWidth() const
Definition OutputShape.h:149
double getRotation() const
Definition OutputShape.h:91
OutputShape(bool isClosed, int shape, double rotation, double skew, const PMDFillProperties &fillProps, const PMDStrokeProperties &strokeProps)
Definition OutputShape.h:40
std::string m_text
Definition OutputShape.h:33
double m_bboxBot
Definition OutputShape.h:30
double m_width
Definition OutputShape.h:37
void addPoint(InchPoint point)
Definition OutputShape.h:138
std::vector< PMDParaProperties > getParaProperties() const
Definition OutputShape.h:111
uint8_t shapeType() const
Definition OutputShape.h:76
std::pair< InchPoint, InchPoint > getBoundingBox() const
Definition OutputShape.h:121
Definition geometry.h:23
Point< double > InchPoint
Definition geometry.h:34
std::shared_ptr< OutputShape > newOutputShape(const std::shared_ptr< const PMDLineSet > &lineSet, const InchPoint &translate)
Definition OutputShape.cpp:17
Definition PMDExceptions.h:57
Definition PMDTypes.h:44
Definition PMDTypes.h:54
Definition geometry.h:25
Unit m_y
Definition geometry.h:27
Unit m_x
Definition geometry.h:26

Generated for libpagemaker by doxygen 1.9.8