CFx SDK Documentation 2024 SP0
Loading...
Searching...
No Matches
FxUnitsFormatter.h
Go to the documentation of this file.
1//
2// (C) Copyright 2005-2023 by Graebert GmbH.
3//
4// Permission to use, copy, modify, and distribute this software in
5// object code form for any purpose and without fee is hereby granted,
6// provided that the above copyright notice appears in all copies and
7// that both that copyright notice and the limited warranty and
8// restricted rights notice below appear in all supporting
9// documentation.
10//
11// GRAEBERT PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS.
12// GRAEBERT SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF
13// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. GRAEBERT GMBH
14// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE
15// UNINTERRUPTED OR ERROR FREE.
16
17#pragma once
18
19#include "FxPragmaPush.h"
20
21#include "DDKERNEL.h"
22#include "FxFdtType.h"
23
24#include <CmColor.h>
25
26class OdGeMatrix3d;
27
28#include <DbUnitsFormatter.h>
29#include <ResBuf.h>
30#include <StaticRxObject.h>
31
32class CFxBaseDatabase;
33class CFxDatabase;
34class CFxString;
35
43{
44public:
45 typedef enum _Flags
46 {
47 eNone = 0,
48 eRelativeUnit = 0x0001 //@-character in input
49 } Flags;
50
52 ~CFxUnitsFormatter(void) override;
53
54 void SetFxDatabase( const CFxDatabase* );
55 Flags GetFlags() const;
56
57 const CFxDatabase* GetFxDatabase() const;
58 // (itoa)
59 virtual int IntToString( CFxString& strResult, int iValue ) const;
60
61 // (atoi)
62 virtual int StringToInt( int* iResult, const CFxString& strValue ) const;
63
64 // RToS
65 virtual int RealToString( CFxString& strResult, double dValue, int iUnit = -1, int iPrecision = -1, int dimzin = -1 ) const;
66
67 // DisToF
68 virtual int StringToReal( double* pResult, const CFxString& strValue, bool bNoDistance = false, bool bAllowArchitectural = true ) const;
69
70 virtual int PointToString( CFxString& strResult, const OdGePoint3d& ptValue, bool toPolar = false, int iUnit = kDecimal, int iPrecision = -1, OdChar seperator = ',' ) const;
71
72 virtual int PointToString( CFxString& strResult, const OdGePoint2d& ptValue, bool toPolar = false, int iUnit = kDecimal, int iPrecision = -1, OdChar seperator = ',' ) const;
73
74 // Converts string with point in UCS to 'OdGePoint3d' point in WCS
75 virtual int StringToPoint( OdGePoint3d& geResultWCS, const CFxString& strValueUCS, Flags* pUnitFlags = 0, const OdGePoint3d* pLastPointWCS = 0 ) const;
76
77 virtual int AngleToString( CFxString& strResult, double dValue, int iUnit = -1, int iPrecision = -1, int dimzin = -1, bool ignoreANGBASE = false ) const;
78 virtual int AngleToString( CFxString& strResult, double dValue, int iUNITMODE, int iAUPREC, int iDIMZIN, int iAUNITS, int iANGDIR, double dANGBASE ) const;
79
80 // AngToF
81 virtual int StringToAngle( double* pResult, const CFxString& strValue, int iUnit = -1, bool* isNegative = 0, bool ignoreANGBASE = false ) const;
82 virtual int StringToAngle( double* pResult, const CFxString& strValue, int iAUNITS, bool* isNegative, int iANGDIR, double dANGBASE) const;
83
84 virtual int PointToUCS( OdGePoint3d& ptResultUCS, const OdGePoint3d& ptValueWCS ) const;
85
86 virtual int PointFromUCS( OdGePoint3d& ptResultWCS, const OdGePoint3d& ptValueUCS ) const;
87
88 virtual int OrientToString( CFxString& strResult, double dValue, int iUnit = -1, int iPrecision = -1, int dimzin = -1 ) const;
89 virtual int OrientToString( CFxString& strResult, double dValue, int iUNITMODE, int iAUPREC, int iDIMZIN, int iAUNITS, int iANGDIR, double dANGBASE ) const;
90
91 virtual int StringToOrient( double* pResult, const CFxString& strValue, int iUnit = -1 ) const;
92 virtual int StringToOrient(double* pResult, const CFxString& strValue, int iAUNITS, int iANGDIR, double dANGBASE) const;
93 virtual int StringToColor( OdCmColor* iResult, const CFxString& strValue ) const;
94
95 virtual int ResBufToString( CFxString& strResult, const OdResBuf* pRb) const;
96
97 // Reads double from string till first non-digit symbol
98 // pass remainingString to get back non-digit part
99 virtual int ReadDouble( double* pResult, const CFxString& value, CFxString* remainingString = 0 ) const;
100
101 static int NameToString( CFxString& strResult, const fdt_name pRb);
102
103 static int StringToName( fdt_name* pResult, const CFxString& strValue );
104
105 virtual int GetUCS2WCS( OdGeMatrix3d& ucs2wcs ) const;
106
107protected:
115 OdString formatLinear( double value ) const override;
116
124 double unformatLinear( const OdString& string ) const override;
125
135 OdString formatAngle( double value ) const override;
136
146 double unformatAngle( const OdString& string ) const override;
147
150 double toUserAngle( double value ) const override;
151
154 double fromUserAngle( double value ) const override;
155
158 virtual CFxString additionalRealFormatting( const CFxString& strValue ) const;
159
167 OdString formatPoint( const OdGePoint3d& value ) const override;
168
174 OdGePoint3d unformatPoint( const OdString& string ) const override;
175
178 OdGePoint3d toUCS( const OdGePoint3d& wcsPt ) const override;
179
182 OdGePoint3d fromUCS( const OdGePoint3d& ucsPt ) const override;
183
186 void UCS2WCS( OdGeMatrix3d& ucs2wcs ) const
187#if TD_VERSION >= 231100
188 override
189#endif
190 ;
191
194 static int unformatL(const CFxString& string, double & resVal, bool bAllowArchitectural);
195
205 static int unformatScale(const CFxString& string, double & resVal);
206
217 static int unformatA(const CFxString& string, double & resVal, bool* isNegative = 0);
218
233 static OdString formatL(double v, LUnits units, int precision, int dimzin, int mode, OdChar decsep = 0, OdChar thsep = 0);
234
237
238protected:
240};
241
242#include "FxPragmaPop.h"
#define DDKERNEL_API
Definition: DDKERNEL.h:32
uintptr_t fdt_name[2]
Definition: FxFdtType.h:57
wchar_t OdChar
static int unformatL(const CFxString &string, double &resVal, bool bAllowArchitectural)
virtual int OrientToString(CFxString &strResult, double dValue, int iUnit=-1, int iPrecision=-1, int dimzin=-1) const
~CFxUnitsFormatter(void) override
virtual int StringToOrient(double *pResult, const CFxString &strValue, int iUnit=-1) const
virtual int RealToString(CFxString &strResult, double dValue, int iUnit=-1, int iPrecision=-1, int dimzin=-1) const
OdString formatPoint(const OdGePoint3d &value) const override
OdGePoint3d unformatPoint(const OdString &string) const override
OdString formatCmColor(const OdCmColorBase &value) const override
virtual int OrientToString(CFxString &strResult, double dValue, int iUNITMODE, int iAUPREC, int iDIMZIN, int iAUNITS, int iANGDIR, double dANGBASE) const
virtual int AngleToString(CFxString &strResult, double dValue, int iUNITMODE, int iAUPREC, int iDIMZIN, int iAUNITS, int iANGDIR, double dANGBASE) const
void SetFxDatabase(const CFxDatabase *)
double unformatAngle(const OdString &string) const override
static OdString formatL(double v, LUnits units, int precision, int dimzin, int mode, OdChar decsep=0, OdChar thsep=0)
static int unformatScale(const CFxString &string, double &resVal)
OdString formatLinear(double value) const override
virtual int StringToReal(double *pResult, const CFxString &strValue, bool bNoDistance=false, bool bAllowArchitectural=true) const
OdGePoint3d fromUCS(const OdGePoint3d &ucsPt) const override
const CFxDatabase * GetFxDatabase() const
double unformatLinear(const OdString &string) const override
virtual CFxString additionalRealFormatting(const CFxString &strValue) const
static int NameToString(CFxString &strResult, const fdt_name pRb)
virtual int StringToPoint(OdGePoint3d &geResultWCS, const CFxString &strValueUCS, Flags *pUnitFlags=0, const OdGePoint3d *pLastPointWCS=0) const
OdString formatAngle(double value) const override
Flags GetFlags() const
double fromUserAngle(double value) const override
virtual int StringToOrient(double *pResult, const CFxString &strValue, int iAUNITS, int iANGDIR, double dANGBASE) const
virtual int StringToColor(OdCmColor *iResult, const CFxString &strValue) const
OdGePoint3d toUCS(const OdGePoint3d &wcsPt) const override
virtual int PointToString(CFxString &strResult, const OdGePoint3d &ptValue, bool toPolar=false, int iUnit=kDecimal, int iPrecision=-1, OdChar seperator=',') const
virtual int PointToUCS(OdGePoint3d &ptResultUCS, const OdGePoint3d &ptValueWCS) const
static int StringToName(fdt_name *pResult, const CFxString &strValue)
virtual int StringToAngle(double *pResult, const CFxString &strValue, int iUnit=-1, bool *isNegative=0, bool ignoreANGBASE=false) const
virtual int StringToAngle(double *pResult, const CFxString &strValue, int iAUNITS, bool *isNegative, int iANGDIR, double dANGBASE) const
virtual int AngleToString(CFxString &strResult, double dValue, int iUnit=-1, int iPrecision=-1, int dimzin=-1, bool ignoreANGBASE=false) const
virtual int ReadDouble(double *pResult, const CFxString &value, CFxString *remainingString=0) const
OdSharedPtr< OdCmColorBase > unformatCmColor(const OdString &string) const override
virtual int IntToString(CFxString &strResult, int iValue) const
enum CFxUnitsFormatter::_Flags Flags
virtual int PointToString(CFxString &strResult, const OdGePoint2d &ptValue, bool toPolar=false, int iUnit=kDecimal, int iPrecision=-1, OdChar seperator=',') const
void UCS2WCS(OdGeMatrix3d &ucs2wcs) const
static int unformatA(const CFxString &string, double &resVal, bool *isNegative=0)
virtual int StringToInt(int *iResult, const CFxString &strValue) const
virtual int PointFromUCS(OdGePoint3d &ptResultWCS, const OdGePoint3d &ptValueUCS) const
double toUserAngle(double value) const override
const CFxDatabase * m_pDatabase
virtual int GetUCS2WCS(OdGeMatrix3d &ucs2wcs) const
virtual int ResBufToString(CFxString &strResult, const OdResBuf *pRb) const
const GLfloat * v
Definition: gles2_ext.h:315
GLenum GLint GLint * precision
Definition: gles2_ext.h:563
GLsizei const GLfloat * value
Definition: gles2_ext.h:302