Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-24 09:16:16

0001 // Created on: 1994-06-01
0002 // Created by: Christian CAILLET
0003 // Copyright (c) 1994-1999 Matra Datavision
0004 // Copyright (c) 1999-2014 OPEN CASCADE SAS
0005 //
0006 // This file is part of Open CASCADE Technology software library.
0007 //
0008 // This library is free software; you can redistribute it and/or modify it under
0009 // the terms of the GNU Lesser General Public License version 2.1 as published
0010 // by the Free Software Foundation, with special exception defined in the file
0011 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
0012 // distribution for complete text of the license and disclaimer of any warranty.
0013 //
0014 // Alternatively, this file may be used under the terms of Open CASCADE
0015 // commercial license or contractual agreement.
0016 
0017 #ifndef _IGESSelect_FloatFormat_HeaderFile
0018 #define _IGESSelect_FloatFormat_HeaderFile
0019 
0020 #include <Standard.hxx>
0021 #include <Standard_Type.hxx>
0022 
0023 #include <TCollection_AsciiString.hxx>
0024 #include <IGESSelect_FileModifier.hxx>
0025 #include <Standard_Integer.hxx>
0026 class IFSelect_ContextWrite;
0027 class IGESData_IGESWriter;
0028 
0029 //! This class gives control out format for floatting values :
0030 //! ZeroSuppress or no, Main Format, Format in Range (for values
0031 //! around 1.), as IGESWriter allows to manage it.
0032 //! Formats are given under C-printf form
0033 class IGESSelect_FloatFormat : public IGESSelect_FileModifier
0034 {
0035 
0036 public:
0037   //! Creates a new FloatFormat, with standard options :
0038   //! ZeroSuppress, Main Format = %E,
0039   //! Format between 0.001 and 1000. = %f
0040   Standard_EXPORT IGESSelect_FloatFormat();
0041 
0042   //! Sets FloatFormat to default value (see Create) but if <digits>
0043   //! is given positive, it commands Formats (main and range) to
0044   //! ensure <digits> significant digits to be displayed
0045   Standard_EXPORT void SetDefault(const int digits = 0);
0046 
0047   //! Sets ZeroSuppress mode to a new value
0048   Standard_EXPORT void SetZeroSuppress(const bool mode);
0049 
0050   //! Sets Main Format to a new value
0051   //! Remark : SetFormat, SetZeroSuppress and SetFormatForRange are
0052   //! independent
0053   Standard_EXPORT void SetFormat(const char* const format = "%E");
0054 
0055   //! Sets Format for Range to a new value with its range of
0056   //! application.
0057   //! To cancel it, give format as "" (empty string)
0058   //! Remark that if the condition (0. < Rmin < Rmax) is not
0059   //! verified, this secondary format will be ignored.
0060   //! Moreover, this secondary format is intended to be used in a
0061   //! range around 1.
0062   Standard_EXPORT void SetFormatForRange(const char* const format = "%f",
0063                                          const double      Rmin   = 0.1,
0064                                          const double      Rmax   = 1000.0);
0065 
0066   //! Returns all recorded parameters :
0067   //! zerosup  : ZeroSuppress status
0068   //! mainform : Main Format (which applies out of the range, or
0069   //! for every real if no range is set)
0070   //! hasrange : True if a FormatInRange is set, False else
0071   //! (following parameters do not apply if it is False)
0072   //! forminrange : Secondary Format (it applies inside the range)
0073   //! rangemin, rangemax : the range in which the secondary format
0074   //! applies
0075   Standard_EXPORT void Format(bool&                    zerosup,
0076                               TCollection_AsciiString& mainform,
0077                               bool&                    hasrange,
0078                               TCollection_AsciiString& forminrange,
0079                               double&                  rangemin,
0080                               double&                  rangemax) const;
0081 
0082   //! Sets the Floatting Formats of IGESWriter to the recorded
0083   //! parameters
0084   Standard_EXPORT void Perform(IFSelect_ContextWrite& ctx,
0085                                IGESData_IGESWriter&   writer) const override;
0086 
0087   //! Returns specific Label : for instance,
0088   //! "Float Format [ZeroSuppress] %E [, in range R1-R2 %f]"
0089   Standard_EXPORT TCollection_AsciiString Label() const override;
0090 
0091   DEFINE_STANDARD_RTTIEXT(IGESSelect_FloatFormat, IGESSelect_FileModifier)
0092 
0093 private:
0094   bool                    thezerosup;
0095   TCollection_AsciiString themainform;
0096   TCollection_AsciiString theformrange;
0097   double                  therangemin;
0098   double                  therangemax;
0099 };
0100 
0101 #endif // _IGESSelect_FloatFormat_HeaderFile