1 // Created on: 1993-09-14 2 // Created by: Frederic MAUPAS 3 // Copyright (c) 1993-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 _STEPConstruct_ContextTool_HeaderFile 18 #define _STEPConstruct_ContextTool_HeaderFile 19 20 #include <Standard.hxx> 21 #include <Standard_DefineAlloc.hxx> 22 #include <Standard_Handle.hxx> 23 24 #include <TColStd_SequenceOfInteger.hxx> 25 #include <STEPConstruct_AP203Context.hxx> 26 #include <Standard_Boolean.hxx> 27 #include <Standard_Integer.hxx> 28 #include <TColStd_HSequenceOfTransient.hxx> 29 class StepBasic_ApplicationProtocolDefinition; 30 class StepGeom_Axis2Placement3d; 31 class StepData_StepModel; 32 class TCollection_HAsciiString; 33 class STEPConstruct_AP203Context; 34 class STEPConstruct_Part; 35 class STEPConstruct_Assembly; 36 37 38 //! Maintains global context tool for writing. 39 //! Gives access to Product Definition Context (one per Model) 40 //! Maintains ApplicationProtocolDefinition entity (common for all 41 //! products) 42 //! Also maintains context specific for AP203 and provides set of 43 //! methods to work with various STEP constructs as required 44 //! by Actor 45 class STEPConstruct_ContextTool 46 { 47 public: 48 49 DEFINE_STANDARD_ALLOC 50 51 52 Standard_EXPORT STEPConstruct_ContextTool(); 53 54 Standard_EXPORT STEPConstruct_ContextTool(const Handle(StepData_StepModel)& aStepModel); 55 56 //! Initialize ApplicationProtocolDefinition by the first 57 //! entity of that type found in the model 58 Standard_EXPORT void SetModel (const Handle(StepData_StepModel)& aStepModel); 59 60 Standard_EXPORT Handle(StepBasic_ApplicationProtocolDefinition) GetAPD(); 61 62 Standard_EXPORT void AddAPD (const Standard_Boolean enforce = Standard_False); 63 64 //! Returns True if APD.schema_name is config_control_design 65 Standard_EXPORT Standard_Boolean IsAP203() const; 66 67 //! Returns True if APD.schema_name is automotive_design 68 Standard_EXPORT Standard_Boolean IsAP214() const; 69 70 //! Returns True if APD.schema_name is ap242_managed_model_based_3d_engineering 71 Standard_EXPORT Standard_Boolean IsAP242() const; 72 73 Standard_EXPORT Handle(TCollection_HAsciiString) GetACstatus(); 74 75 Standard_EXPORT Handle(TCollection_HAsciiString) GetACschemaName(); 76 77 Standard_EXPORT Standard_Integer GetACyear(); 78 79 Standard_EXPORT Handle(TCollection_HAsciiString) GetACname(); 80 81 Standard_EXPORT void SetACstatus (const Handle(TCollection_HAsciiString)& status); 82 83 Standard_EXPORT void SetACschemaName (const Handle(TCollection_HAsciiString)& schemaName); 84 85 Standard_EXPORT void SetACyear (const Standard_Integer year); 86 87 Standard_EXPORT void SetACname (const Handle(TCollection_HAsciiString)& name); 88 89 //! Returns a default axis placement 90 Standard_EXPORT Handle(StepGeom_Axis2Placement3d) GetDefaultAxis(); 91 92 //! Returns tool which maintains context specific for AP203 93 Standard_EXPORT STEPConstruct_AP203Context& AP203Context(); 94 95 //! Returns current assembly level 96 Standard_EXPORT Standard_Integer Level() const; 97 98 Standard_EXPORT void NextLevel(); 99 100 Standard_EXPORT void PrevLevel(); 101 102 //! Changes current assembly level 103 Standard_EXPORT void SetLevel (const Standard_Integer lev); 104 105 //! Returns current index of assembly component on current level 106 Standard_EXPORT Standard_Integer Index() const; 107 108 Standard_EXPORT void NextIndex(); 109 110 Standard_EXPORT void PrevIndex(); 111 112 //! Changes current index of assembly component on current level 113 Standard_EXPORT void SetIndex (const Standard_Integer ind); 114 115 //! Generates a product name basing on write.step.product.name 116 //! parameter and current position in the assembly structure 117 Standard_EXPORT Handle(TCollection_HAsciiString) GetProductName() const; 118 119 //! Produces and returns a full list of root entities required 120 //! for part identified by SDRTool (including SDR itself) 121 Standard_EXPORT Handle(TColStd_HSequenceOfTransient) GetRootsForPart (const STEPConstruct_Part& SDRTool); 122 123 //! Produces and returns a full list of root entities required 124 //! for assembly link identified by assembly (including NAUO and CDSR) 125 Standard_EXPORT Handle(TColStd_HSequenceOfTransient) GetRootsForAssemblyLink (const STEPConstruct_Assembly& assembly); 126 127 128 129 130 protected: 131 132 133 134 135 136 private: 137 138 139 140 TColStd_SequenceOfInteger myLevel; 141 Handle(StepBasic_ApplicationProtocolDefinition) theAPD; 142 STEPConstruct_AP203Context theAP203; 143 Handle(StepGeom_Axis2Placement3d) myAxis; 144 145 146 }; 147 148 149 150 151 152 153 154 #endif // _STEPConstruct_ContextTool_HeaderFile 155