Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-10-10 09:28:44

0001 // Created on: 1995-08-25
0002 // Created by: Christian CAILLET
0003 // Copyright (c) 1995-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 _IGESData_BasicEditor_HeaderFile
0018 #define _IGESData_BasicEditor_HeaderFile
0019 
0020 #include <Standard.hxx>
0021 #include <Standard_DefineAlloc.hxx>
0022 #include <Standard_Handle.hxx>
0023 
0024 #include <Standard_Boolean.hxx>
0025 #include <Interface_GeneralLib.hxx>
0026 #include <IGESData_SpecificLib.hxx>
0027 #include <Standard_Integer.hxx>
0028 #include <Standard_Real.hxx>
0029 class IGESData_Protocol;
0030 class IGESData_IGESModel;
0031 class IGESData_IGESEntity;
0032 
0033 //! This class provides various functions of basic edition,
0034 //! such as :
0035 //! - setting header unit (WARNING : DOES NOT convert entities)
0036 //! - computation of the status (Subordinate, UseFlag) of entities
0037 //! of IGES Entities on a whole model
0038 //! - auto correction of IGES Entities, defined both by DirChecker
0039 //! and by specific service AutoCorrect
0040 //! (this auto correction performs non-ambigious, rather logic,
0041 //! editions)
0042 class IGESData_BasicEditor
0043 {
0044 public:
0045   DEFINE_STANDARD_ALLOC
0046 
0047   //! Creates an empty Basic Editor which should be initialized via Init() method.
0048   Standard_EXPORT IGESData_BasicEditor();
0049 
0050   //! Creates a Basic Editor, with a new IGESModel, ready to run
0051   Standard_EXPORT IGESData_BasicEditor(const occ::handle<IGESData_Protocol>& protocol);
0052 
0053   //! Creates a Basic Editor for IGES Data, ready to run
0054   Standard_EXPORT IGESData_BasicEditor(const occ::handle<IGESData_IGESModel>& model,
0055                                        const occ::handle<IGESData_Protocol>&  protocol);
0056 
0057   //! Initialize a Basic Editor, with a new IGESModel, ready to run
0058   Standard_EXPORT void Init(const occ::handle<IGESData_Protocol>& protocol);
0059 
0060   //! Initialize a Basic Editor for IGES Data, ready to run
0061   Standard_EXPORT void Init(const occ::handle<IGESData_IGESModel>& model,
0062                             const occ::handle<IGESData_Protocol>&  protocol);
0063 
0064   //! Returns the designated model
0065   Standard_EXPORT occ::handle<IGESData_IGESModel> Model() const;
0066 
0067   //! Sets a new unit from its flag (param 14 of Global Section)
0068   //! Returns True if done, False if <flag> is incorrect
0069   Standard_EXPORT bool SetUnitFlag(const int flag);
0070 
0071   //! Sets a new unit from its value in meters (rounded to the
0072   //! closest one, max gap 1%)
0073   //! Returns True if done, False if <val> is too far from a
0074   //! suitable value
0075   Standard_EXPORT bool SetUnitValue(const double val);
0076 
0077   //! Sets a new unit from its name (param 15 of Global Section)
0078   //! Returns True if done, False if <name> is incorrect
0079   //! Remark : if <flag> has been set to 3 (user defined), <name>
0080   //! is then free
0081   Standard_EXPORT bool SetUnitName(const char* const name);
0082 
0083   //! Applies unit value to convert header data : Resolution,
0084   //! MaxCoord, MaxLineWeight
0085   //! Applies unit only once after SetUnit... has been called,
0086   //! if <enforce> is given as True.
0087   //! It can be called just before writing the model to a file,
0088   //! i.e. when definitive values are finally known
0089   Standard_EXPORT void ApplyUnit(const bool enforce = false);
0090 
0091   //! Performs the re-computation of status on the whole model
0092   //! (Subordinate Status and Use Flag of each IGES Entity), which
0093   //! can have required values according the way they are referenced
0094   //! (see definitions of Logical use, Physical use, etc...)
0095   Standard_EXPORT void ComputeStatus();
0096 
0097   //! Performs auto-correction on an IGESEntity
0098   //! Returns True if something has changed, False if nothing done.
0099   //!
0100   //! Works with the specific IGES Services : DirChecker which
0101   //! allows to correct data in "Directory Part" of Entities (such
0102   //! as required values for status, or references to be null), and
0103   //! the specific IGES service OwnCorrect, which is specialised for
0104   //! each type of entity.
0105   Standard_EXPORT bool AutoCorrect(const occ::handle<IGESData_IGESEntity>& ent);
0106 
0107   //! Performs auto-correction on the whole Model
0108   //! Returns the count of modified entities
0109   Standard_EXPORT int AutoCorrectModel();
0110 
0111   //! From the name of unit, computes flag number, 0 if incorrect
0112   //! (in this case, user defined entity remains possible)
0113   Standard_EXPORT static int UnitNameFlag(const char* const name);
0114 
0115   //! From the flag of unit, determines value in MM, 0 if incorrect
0116   Standard_EXPORT static double UnitFlagValue(const int flag);
0117 
0118   //! From the flag of unit, determines its name, "" if incorrect
0119   Standard_EXPORT static const char* UnitFlagName(const int flag);
0120 
0121   //! From the flag of IGES version, returns name, "" if incorrect
0122   Standard_EXPORT static const char* IGESVersionName(const int flag);
0123 
0124   //! Returns the maximum allowed value for IGESVersion Flag
0125   Standard_EXPORT static int IGESVersionMax();
0126 
0127   //! From the flag of drafting standard, returns name, "" if incorrect
0128   Standard_EXPORT static const char* DraftingName(const int flag);
0129 
0130   //! Returns the maximum allowed value for Drafting Flag
0131   Standard_EXPORT static int DraftingMax();
0132 
0133   //! Returns Flag corresponding to the scaling theValue.
0134   //! Returns 0 if there's no such flag.
0135   Standard_EXPORT static int GetFlagByValue(const double theValue);
0136 
0137 private:
0138   bool                            theunit;
0139   occ::handle<IGESData_Protocol>  theproto;
0140   occ::handle<IGESData_IGESModel> themodel;
0141   Interface_GeneralLib            theglib;
0142   IGESData_SpecificLib            theslib;
0143 };
0144 
0145 #endif // _IGESData_BasicEditor_HeaderFile