1 // Created on: 1994-06-01
2 // Created by: Christian CAILLET
3 // Copyright (c) 1994-1999 Matra Datavision
4 // Copyright (c) 1999-2014 OPEN CASCADE SAS
6 // This file is part of Open CASCADE Technology software library.
8 // This library is free software; you can redistribute it and/or modify it under
9 // the terms of the GNU Lesser General Public License version 2.1 as published
10 // by the Free Software Foundation, with special exception defined in the file
11 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
12 // distribution for complete text of the license and disclaimer of any warranty.
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
17 #ifndef _IGESSelect_FloatFormat_HeaderFile
18 #define _IGESSelect_FloatFormat_HeaderFile
20 #include <Standard.hxx>
21 #include <Standard_Type.hxx>
23 #include <Standard_Boolean.hxx>
24 #include <TCollection_AsciiString.hxx>
25 #include <Standard_Real.hxx>
26 #include <IGESSelect_FileModifier.hxx>
27 #include <Standard_Integer.hxx>
28 #include <Standard_CString.hxx>
29 class TCollection_AsciiString;
30 class IFSelect_ContextWrite;
31 class IGESData_IGESWriter;
34 class IGESSelect_FloatFormat;
35 DEFINE_STANDARD_HANDLE(IGESSelect_FloatFormat, IGESSelect_FileModifier)
37 //! This class gives control out format for floatting values :
38 //! ZeroSuppress or no, Main Format, Format in Range (for values
39 //! around 1.), as IGESWriter allows to manage it.
40 //! Formats are given under C-printf form
41 class IGESSelect_FloatFormat : public IGESSelect_FileModifier
47 //! Creates a new FloatFormat, with standard options :
48 //! ZeroSuppress, Main Format = %E,
49 //! Format between 0.001 and 1000. = %f
50 Standard_EXPORT IGESSelect_FloatFormat();
52 //! Sets FloatFormat to default value (see Create) but if <digits>
53 //! is given positive, it commands Formats (main and range) to
54 //! ensure <digits> significant digits to be displayed
55 Standard_EXPORT void SetDefault (const Standard_Integer digits = 0);
57 //! Sets ZeroSuppress mode to a new value
58 Standard_EXPORT void SetZeroSuppress (const Standard_Boolean mode);
60 //! Sets Main Format to a new value
61 //! Remark : SetFormat, SetZeroSuppress and SetFormatForRange are
63 Standard_EXPORT void SetFormat (const Standard_CString format = "%E");
65 //! Sets Format for Range to a new value with its range of
67 //! To cancel it, give format as "" (empty string)
68 //! Remark that if the condition (0. < Rmin < Rmax) is not
69 //! verified, this secondary format will be ignored.
70 //! Moreover, this secondary format is intended to be used in a
72 Standard_EXPORT void SetFormatForRange (const Standard_CString format = "%f", const Standard_Real Rmin = 0.1, const Standard_Real Rmax = 1000.0);
74 //! Returns all recorded parameters :
75 //! zerosup : ZeroSuppress status
76 //! mainform : Main Format (which applies out of the range, or
77 //! for every real if no range is set)
78 //! hasrange : True if a FormatInRange is set, False else
79 //! (following parameters do not apply if it is False)
80 //! forminrange : Secondary Format (it applies inside the range)
81 //! rangemin, rangemax : the range in which the secondary format
83 Standard_EXPORT void Format (Standard_Boolean& zerosup, TCollection_AsciiString& mainform, Standard_Boolean& hasrange, TCollection_AsciiString& forminrange, Standard_Real& rangemin, Standard_Real& rangemax) const;
85 //! Sets the Floatting Formats of IGESWriter to the recorded
87 Standard_EXPORT void Perform (IFSelect_ContextWrite& ctx, IGESData_IGESWriter& writer) const Standard_OVERRIDE;
89 //! Returns specific Label : for instance,
90 //! "Float Format [ZeroSuppress] %E [, in range R1-R2 %f]"
91 Standard_EXPORT TCollection_AsciiString Label() const Standard_OVERRIDE;
96 DEFINE_STANDARD_RTTIEXT(IGESSelect_FloatFormat,IGESSelect_FileModifier)
106 Standard_Boolean thezerosup;
107 TCollection_AsciiString themainform;
108 TCollection_AsciiString theformrange;
109 Standard_Real therangemin;
110 Standard_Real therangemax;
121 #endif // _IGESSelect_FloatFormat_HeaderFile