Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:03:57

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