0031687: Draw Harness, ViewerTest - extend command vrenderparams with option updating...
[occt.git] / src / StepSelect / StepSelect_FloatFormat.hxx
CommitLineData
42cf5bc1 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
5//
6// This file is part of Open CASCADE Technology software library.
7//
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.
13//
14// Alternatively, this file may be used under the terms of Open CASCADE
15// commercial license or contractual agreement.
16
17#ifndef _StepSelect_FloatFormat_HeaderFile
18#define _StepSelect_FloatFormat_HeaderFile
19
20#include <Standard.hxx>
21#include <Standard_Type.hxx>
22
23#include <Standard_Boolean.hxx>
24#include <TCollection_AsciiString.hxx>
25#include <Standard_Real.hxx>
26#include <StepSelect_FileModifier.hxx>
27#include <Standard_Integer.hxx>
28#include <Standard_CString.hxx>
29class TCollection_AsciiString;
30class IFSelect_ContextWrite;
31class StepData_StepWriter;
32
33
34class StepSelect_FloatFormat;
35DEFINE_STANDARD_HANDLE(StepSelect_FloatFormat, StepSelect_FileModifier)
36
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 StepWriter allows to manage it.
40//! Formats are given under C-printf form
41class StepSelect_FloatFormat : public StepSelect_FileModifier
42{
43
44public:
45
46
47 //! Creates a new FloatFormat, with standard options :
48 //! ZeroSuppress, Main Format = %E,
49 //! Format between 0.001 and 1000. = %f
50 Standard_EXPORT StepSelect_FloatFormat();
51
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);
56
57 //! Sets ZeroSuppress mode to a new value
58 Standard_EXPORT void SetZeroSuppress (const Standard_Boolean mode);
59
60 //! Sets Main Format to a new value
61 //! Remark : SetFormat, SetZeroSuppress and SetFormatForRange are
62 //! independant
63 Standard_EXPORT void SetFormat (const Standard_CString format = "%E");
64
65 //! Sets Format for Range to a new value with its range of
66 //! application.
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
71 //! range around 1.
72 Standard_EXPORT void SetFormatForRange (const Standard_CString format = "%f", const Standard_Real Rmin = 0.1, const Standard_Real Rmax = 1000.0);
73
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
82 //! applies
83 Standard_EXPORT void Format (Standard_Boolean& zerosup, TCollection_AsciiString& mainform, Standard_Boolean& hasrange, TCollection_AsciiString& forminrange, Standard_Real& rangemin, Standard_Real& rangemax) const;
84
85 //! Sets the Floatting Formats of StepWriter to the recorded
86 //! parameters
79104795 87 Standard_EXPORT void Perform (IFSelect_ContextWrite& ctx, StepData_StepWriter& writer) const Standard_OVERRIDE;
42cf5bc1 88
89 //! Returns specific Label : for instance,
90 //! "Float Format [ZeroSuppress] %E [, in range R1-R2 %f]"
79104795 91 Standard_EXPORT TCollection_AsciiString Label() const Standard_OVERRIDE;
42cf5bc1 92
93
94
95
92efcf78 96 DEFINE_STANDARD_RTTIEXT(StepSelect_FloatFormat,StepSelect_FileModifier)
42cf5bc1 97
98protected:
99
100
101
102
103private:
104
105
106 Standard_Boolean thezerosup;
107 TCollection_AsciiString themainform;
108 TCollection_AsciiString theformrange;
109 Standard_Real therangemin;
110 Standard_Real therangemax;
111
112
113};
114
115
116
117
118
119
120
121#endif // _StepSelect_FloatFormat_HeaderFile