1 // Created on: 1995-08-25
2 // Created by: Christian CAILLET
3 // Copyright (c) 1995-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 _IGESData_BasicEditor_HeaderFile
18 #define _IGESData_BasicEditor_HeaderFile
20 #include <Standard.hxx>
21 #include <Standard_DefineAlloc.hxx>
22 #include <Standard_Handle.hxx>
24 #include <Standard_Boolean.hxx>
25 #include <Interface_GeneralLib.hxx>
26 #include <IGESData_SpecificLib.hxx>
27 #include <Standard_Integer.hxx>
28 #include <Standard_Real.hxx>
29 #include <Standard_CString.hxx>
30 class IGESData_Protocol;
31 class IGESData_IGESModel;
32 class IGESData_IGESEntity;
35 //! This class provides various functions of basic edition,
37 //! - setting header unit (WARNING : DOES NOT convert entities)
38 //! - computation of the status (Subordinate, UseFlag) of entities
39 //! of IGES Entities on a whole model
40 //! - auto correction of IGES Entities, defined both by DirChecker
41 //! and by specific service AutoCorrect
42 //! (this auto correction performs non-ambigious, rather logic,
44 class IGESData_BasicEditor
51 //! Creates an empty Basic Editor which should be initialized via Init() method.
52 Standard_EXPORT IGESData_BasicEditor();
54 //! Creates a Basic Editor, with a new IGESModel, ready to run
55 Standard_EXPORT IGESData_BasicEditor(const Handle(IGESData_Protocol)& protocol);
57 //! Creates a Basic Editor for IGES Data, ready to run
58 Standard_EXPORT IGESData_BasicEditor(const Handle(IGESData_IGESModel)& model, const Handle(IGESData_Protocol)& protocol);
60 //! Initialize a Basic Editor, with a new IGESModel, ready to run
61 Standard_EXPORT void Init (const Handle(IGESData_Protocol)& protocol);
63 //! Initialize a Basic Editor for IGES Data, ready to run
64 Standard_EXPORT void Init (const Handle(IGESData_IGESModel)& model, const Handle(IGESData_Protocol)& protocol);
66 //! Returns the designated model
67 Standard_EXPORT Handle(IGESData_IGESModel) Model() const;
69 //! Sets a new unit from its flag (param 14 of Global Section)
70 //! Returns True if done, False if <flag> is incorrect
71 Standard_EXPORT Standard_Boolean SetUnitFlag (const Standard_Integer flag);
73 //! Sets a new unit from its value in meters (rounded to the
74 //! closest one, max gap 1%)
75 //! Returns True if done, False if <val> is too far from a
77 Standard_EXPORT Standard_Boolean SetUnitValue (const Standard_Real val);
79 //! Sets a new unit from its name (param 15 of Global Section)
80 //! Returns True if done, False if <name> is incorrect
81 //! Remark : if <flag> has been set to 3 (user defined), <name>
83 Standard_EXPORT Standard_Boolean SetUnitName (const Standard_CString name);
85 //! Applies unit value to convert header data : Resolution,
86 //! MaxCoord, MaxLineWeight
87 //! Applies unit only once after SetUnit... has been called,
88 //! if <enforce> is given as True.
89 //! It can be called just before writing the model to a file,
90 //! i.e. when definitive values are finally known
91 Standard_EXPORT void ApplyUnit (const Standard_Boolean enforce = Standard_False);
93 //! Performs the re-computation of status on the whole model
94 //! (Subordinate Status and Use Flag of each IGES Entity), which
95 //! can have required values according the way they are referenced
96 //! (see definitions of Logical use, Physical use, etc...)
97 Standard_EXPORT void ComputeStatus();
99 //! Performs auto-correction on an IGESEntity
100 //! Returns True if something has changed, False if nothing done.
102 //! Works with the specific IGES Services : DirChecker which
103 //! allows to correct data in "Directory Part" of Entities (such
104 //! as required values for status, or references to be null), and
105 //! the specific IGES service OwnCorrect, which is specialised for
106 //! each type of entity.
107 Standard_EXPORT Standard_Boolean AutoCorrect (const Handle(IGESData_IGESEntity)& ent);
109 //! Performs auto-correction on the whole Model
110 //! Returns the count of modified entities
111 Standard_EXPORT Standard_Integer AutoCorrectModel();
113 //! From the name of unit, computes flag number, 0 if incorrect
114 //! (in this case, user defined entity remains possible)
115 Standard_EXPORT static Standard_Integer UnitNameFlag (const Standard_CString name);
117 //! From the flag of unit, determines value in MM, 0 if incorrect
118 Standard_EXPORT static Standard_Real UnitFlagValue (const Standard_Integer flag);
120 //! From the flag of unit, determines its name, "" if incorrect
121 Standard_EXPORT static Standard_CString UnitFlagName (const Standard_Integer flag);
123 //! From the flag of IGES version, returns name, "" if incorrect
124 Standard_EXPORT static Standard_CString IGESVersionName (const Standard_Integer flag);
126 //! Returns the maximum allowed value for IGESVersion Flag
127 Standard_EXPORT static Standard_Integer IGESVersionMax();
129 //! From the flag of drafting standard, returns name, "" if incorrect
130 Standard_EXPORT static Standard_CString DraftingName (const Standard_Integer flag);
132 //! Returns the maximum allowed value for Drafting Flag
133 Standard_EXPORT static Standard_Integer DraftingMax();
148 Standard_Boolean theunit;
149 Handle(IGESData_Protocol) theproto;
150 Handle(IGESData_IGESModel) themodel;
151 Interface_GeneralLib theglib;
152 IGESData_SpecificLib theslib;
163 #endif // _IGESData_BasicEditor_HeaderFile