CFx SDK Documentation 2026 SP0
Loading...
Searching...
No Matches
GsPageParams.h
Go to the documentation of this file.
1
2// Copyright (C) 2002-2024, 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-2024 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//FELIX_CHANGE_BEGIN Build fix
30#include "Ge/GeGbl.h"
31//FELIX_CHANGE_END
32
45{
46 double m_dPaperWidth; // All are in mm.
47 double m_dPaperHeight;
48
49 double m_dLeftMargin;
50 double m_dRightMargin;
51 double m_dTopMargin;
52 double m_dBottomMargin;
53public:
67 : m_dPaperWidth(210.)
68 , m_dPaperHeight(297.)
69 , m_dLeftMargin(0.)
70 , m_dRightMargin(0.)
71 , m_dTopMargin(0.)
72 , m_dBottomMargin(0.)
73 {
74 }
75
82 OdGsPageParams(double dPaperWidth, double dPaperHeight)
83 : m_dPaperWidth(dPaperWidth)
84 , m_dPaperHeight(dPaperHeight)
85 , m_dLeftMargin(0.)
86 , m_dRightMargin(0.)
87 , m_dTopMargin(0.)
88 , m_dBottomMargin(0.)
89 {
90 }
91
96 {
97 }
98
105 {
106 *this = data;
107 }
108
115 {
116 m_dPaperWidth = from.m_dPaperWidth; // All are in mm.
117 m_dPaperHeight = from.m_dPaperHeight;
118 m_dLeftMargin = from.m_dLeftMargin;
119 m_dRightMargin = from.m_dRightMargin;
120 m_dTopMargin = from.m_dTopMargin;
121 m_dBottomMargin = from.m_dBottomMargin;
122 return *this;
123 }
124
128 double getPaperWidth() const { return m_dPaperWidth; }
129
133 double getPaperHeight() const { return m_dPaperHeight; }
134
138 double getLeftMargin() const { return m_dLeftMargin; }
139
143 double getRightMargin() const { return m_dRightMargin; }
144
148 double getTopMargin() const { return m_dTopMargin; }
149
153 double getBottomMargin() const { return m_dBottomMargin; }
154
165 void set(
166 double dPaperWidth,
167 double dPaperHeight,
168 double dLeftMargin = 0.,
169 double dRightMargin = 0.,
170 double dTopMargin = 0.,
171 double dBottomMargin = 0.
172 )
173 {
174 //FELIX_CHANGE_BEGIN
175 const double dTol = odmax( 1e-10, OdGeContext::gZeroTol.equalPoint() );
176 if ( !OdPositive( dPaperWidth, dTol ) || !OdPositive( dPaperHeight, dTol ) || OdNegative( dLeftMargin, dTol ) || OdNegative( dRightMargin, dTol ) || OdNegative( dTopMargin, dTol ) || OdNegative( dBottomMargin, dTol ) )
177 {
179 return;
180 }
181
182 if ( OdGreaterOrEqual( dLeftMargin + dRightMargin, dPaperWidth, dTol ) )
183 {
185 return;
186 }
187
188 if ( OdGreaterOrEqual( dTopMargin + dBottomMargin, dPaperHeight, dTol ) )
189 {
191 return;
192 }
193 //FELIX_CHANGE_END
194
195 m_dPaperWidth = dPaperWidth;
196 m_dPaperHeight = dPaperHeight;
197 m_dLeftMargin = dLeftMargin;
198 m_dRightMargin = dRightMargin;
199 m_dTopMargin = dTopMargin;
200 m_dBottomMargin = dBottomMargin;
201 }
202
208 void scale(double dScale)
209 {
210 if (dScale > 1e-8)
211 {
212 m_dPaperWidth *= dScale;
213 m_dPaperHeight *= dScale;
214 m_dLeftMargin *= dScale;
215 m_dRightMargin *= dScale;
216 m_dTopMargin *= dScale;
217 m_dBottomMargin *= dScale;
218 }
219 }
220};
221
222#include "TD_PackPop.h"
223
224#endif //_GSPAGEPARAMS_INCLUDED_
#define ODA_FAIL_ONCE()
Definition DebugStuff.h:89
ODRX_CONSTEXPR const T & odmax(const T &a, const T &b)
Definition OdPlatform.h:38
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
double getPaperHeight() const
OdGsPageParams(const OdGsPageParams &data)
void scale(double dScale)
OdGsPageParams(double dPaperWidth, double dPaperHeight)
void set(double dPaperWidth, double dPaperHeight, double dLeftMargin=0., double dRightMargin=0., double dTopMargin=0., double dBottomMargin=0.)
double getTopMargin() const
double getBottomMargin() const
double getPaperWidth() const
double getLeftMargin() const
OdGsPageParams & operator=(const OdGsPageParams &from)
GLint GLenum GLsizei GLsizei GLint GLsizei const void * data
Definition gles2_ext.h:110
static GE_STATIC_EXPORT OdGeTol gZeroTol
Definition GeGbl.h:74