CFx SDK Documentation 2024 SP0
Loading...
Searching...
No Matches
GsPageParams.h
Go to the documentation of this file.
1
2// Copyright (C) 2002-2022, Open Design Alliance (the "Alliance").
3// All rights reserved.
4//
5// This software and its documentation and related materials are owned by
6// the Alliance. The software may only be incorporated into application
7// programs owned by members of the Alliance, subject to a signed
8// Membership Agreement and Supplemental Software License Agreement with the
9// Alliance. The structure and organization of this software are the valuable
10// trade secrets of the Alliance and its suppliers. The software is also
11// protected by copyright law and international treaty provisions. Application
12// programs incorporating this software must include the following statement
13// with their copyright notices:
14//
15// This application incorporates Open Design Alliance software pursuant to a license
16// agreement with Open Design Alliance.
17// Open Design Alliance Copyright (C) 2002-2022 by Open Design Alliance.
18// All rights reserved.
19//
20// By use of this software, its documentation or related materials, you
21// acknowledge and accept the above terms.
23
24#ifndef _GSPAGEPARAMS_INCLUDED_
25#define _GSPAGEPARAMS_INCLUDED_ /
26
27#include "TD_PackPush.h"
28
29#include "Ge/GeGbl.h" //FELIX_CHANGE
30
43{
44 double m_dPaperWidth; // All are in mm.
45 double m_dPaperHeight;
46
47 double m_dLeftMargin;
48 double m_dRightMargin;
49 double m_dTopMargin;
50 double m_dBottomMargin;
51public:
65 : m_dPaperWidth(210.)
66 , m_dPaperHeight(297.)
67 , m_dLeftMargin(0.)
68 , m_dRightMargin(0.)
69 , m_dTopMargin(0.)
70 , m_dBottomMargin(0.)
71 {
72 }
73
80 OdGsPageParams(double dPaperWidth, double dPaperHeight)
81 : m_dPaperWidth(dPaperWidth)
82 , m_dPaperHeight(dPaperHeight)
83 , m_dLeftMargin(0.)
84 , m_dRightMargin(0.)
85 , m_dTopMargin(0.)
86 , m_dBottomMargin(0.)
87 {
88 }
89
94 {
95 }
96
103 {
104 *this = data;
105 }
106
113 {
114 m_dPaperWidth = from.m_dPaperWidth; // All are in mm.
115 m_dPaperHeight = from.m_dPaperHeight;
116 m_dLeftMargin = from.m_dLeftMargin;
117 m_dRightMargin = from.m_dRightMargin;
118 m_dTopMargin = from.m_dTopMargin;
119 m_dBottomMargin = from.m_dBottomMargin;
120 return *this;
121 }
122
126 double getPaperWidth() const { return m_dPaperWidth; }
127
131 double getPaperHeight() const { return m_dPaperHeight; }
132
136 double getLeftMargin() const { return m_dLeftMargin; }
137
141 double getRightMargin() const { return m_dRightMargin; }
142
146 double getTopMargin() const { return m_dTopMargin; }
147
151 double getBottomMargin() const { return m_dBottomMargin; }
152
163 void set(
164 double dPaperWidth,
165 double dPaperHeight,
166 double dLeftMargin = 0.,
167 double dRightMargin = 0.,
168 double dTopMargin = 0.,
169 double dBottomMargin = 0.
170 )
171 {
172 //FELIX_CHANGE_BEGIN
173 const double dTol = odmax( 1e-10, OdGeContext::gZeroTol.equalPoint() );
174 if ( !OdPositive( dPaperWidth, dTol ) || !OdPositive( dPaperHeight, dTol ) || OdNegative( dLeftMargin, dTol ) || OdNegative( dRightMargin, dTol ) || OdNegative( dTopMargin, dTol ) || OdNegative( dBottomMargin, dTol ) )
175 {
177 return;
178 }
179
180 if ( OdGreaterOrEqual( dLeftMargin + dRightMargin, dPaperWidth, dTol ) )
181 {
183 return;
184 }
185
186 if ( OdGreaterOrEqual( dTopMargin + dBottomMargin, dPaperHeight, dTol ) )
187 {
189 return;
190 }
191 //FELIX_CHANGE_END
192
193 m_dPaperWidth = dPaperWidth;
194 m_dPaperHeight = dPaperHeight;
195 m_dLeftMargin = dLeftMargin;
196 m_dRightMargin = dRightMargin;
197 m_dTopMargin = dTopMargin;
198 m_dBottomMargin = dBottomMargin;
199 }
200
206 void scale(double dScale)
207 {
208 if (dScale > 1e-8)
209 {
210 m_dPaperWidth *= dScale;
211 m_dPaperHeight *= dScale;
212 m_dLeftMargin *= dScale;
213 m_dRightMargin *= dScale;
214 m_dTopMargin *= dScale;
215 m_dBottomMargin *= dScale;
216 }
217 }
218};
219
220#include "TD_PackPop.h"
221
222#endif //_GSPAGEPARAMS_INCLUDED_
#define ODA_FAIL_ONCE()
Definition: DebugStuff.h:89
#define odmax(X, Y)
Definition: OdPlatform.h:35
bool OdNegative(double x, double tol=1.e-10)
Definition: OdaDefs.h:527
bool OdPositive(double x, double tol=1.e-10)
Definition: OdaDefs.h:522
bool OdGreaterOrEqual(double x, double y, double tol=1.e-10)
Definition: OdaDefs.h:562
double getRightMargin() const
Definition: GsPageParams.h:141
double getPaperHeight() const
Definition: GsPageParams.h:131
OdGsPageParams(const OdGsPageParams &data)
Definition: GsPageParams.h:102
void scale(double dScale)
Definition: GsPageParams.h:206
OdGsPageParams(double dPaperWidth, double dPaperHeight)
Definition: GsPageParams.h:80
void set(double dPaperWidth, double dPaperHeight, double dLeftMargin=0., double dRightMargin=0., double dTopMargin=0., double dBottomMargin=0.)
Definition: GsPageParams.h:163
double getTopMargin() const
Definition: GsPageParams.h:146
double getBottomMargin() const
Definition: GsPageParams.h:151
double getPaperWidth() const
Definition: GsPageParams.h:126
double getLeftMargin() const
Definition: GsPageParams.h:136
OdGsPageParams & operator=(const OdGsPageParams &from)
Definition: GsPageParams.h:112
GLint GLenum GLsizei GLsizei GLint GLsizei const void * data
Definition: gles2_ext.h:110
static GE_STATIC_EXPORT OdGeTol gZeroTol
Definition: GeGbl.h:72