| 1 | // Created by: CKY / Contract Toubro-Larsen |
| 2 | // Copyright (c) 1993-1999 Matra Datavision |
| 3 | // Copyright (c) 1999-2012 OPEN CASCADE SAS |
| 4 | // |
| 5 | // The content of this file is subject to the Open CASCADE Technology Public |
| 6 | // License Version 6.5 (the "License"). You may not use the content of this file |
| 7 | // except in compliance with the License. Please obtain a copy of the License |
| 8 | // at http://www.opencascade.org and read it completely before using this file. |
| 9 | // |
| 10 | // The Initial Developer of the Original Code is Open CASCADE S.A.S., having its |
| 11 | // main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. |
| 12 | // |
| 13 | // The Original Code and all software distributed under the License is |
| 14 | // distributed on an "AS IS" basis, without warranty of any kind, and the |
| 15 | // Initial Developer hereby disclaims all such warranties, including without |
| 16 | // limitation, any warranties of merchantability, fitness for a particular |
| 17 | // purpose or non-infringement. Please see the License for the specific terms |
| 18 | // and conditions governing the rights and limitations under the License. |
| 19 | |
| 20 | //-------------------------------------------------------------------- |
| 21 | //-------------------------------------------------------------------- |
| 22 | |
| 23 | #include <IGESAppli_ToolLevelToPWBLayerMap.ixx> |
| 24 | #include <IGESData_ParamCursor.hxx> |
| 25 | #include <TColStd_HArray1OfInteger.hxx> |
| 26 | #include <Interface_HArray1OfHAsciiString.hxx> |
| 27 | #include <TCollection_HAsciiString.hxx> |
| 28 | #include <IGESData_Dump.hxx> |
| 29 | #include <Interface_Macros.hxx> |
| 30 | |
| 31 | |
| 32 | IGESAppli_ToolLevelToPWBLayerMap::IGESAppli_ToolLevelToPWBLayerMap () { } |
| 33 | |
| 34 | |
| 35 | void IGESAppli_ToolLevelToPWBLayerMap::ReadOwnParams |
| 36 | (const Handle(IGESAppli_LevelToPWBLayerMap)& ent, |
| 37 | const Handle(IGESData_IGESReaderData)& /* IR */, IGESData_ParamReader& PR) const |
| 38 | { |
| 39 | //Standard_Boolean st; //szv#4:S4163:12Mar99 not needed |
| 40 | Standard_Integer num, i; |
| 41 | Standard_Integer tempNbPropertyValues; |
| 42 | Handle(TColStd_HArray1OfInteger) tempExchangeFileLevelNumber; |
| 43 | Handle(Interface_HArray1OfHAsciiString) tempNativeLevel; |
| 44 | Handle(TColStd_HArray1OfInteger) tempPhysicalLayerNumber; |
| 45 | Handle(Interface_HArray1OfHAsciiString) tempExchangeFileLevelIdent; |
| 46 | //szv#4:S4163:12Mar99 `st=` not needed |
| 47 | PR.ReadInteger(PR.Current(), "Number of property values", tempNbPropertyValues); |
| 48 | if (!PR.ReadInteger(PR.Current(), "Number of definitions", num)) num = 0; |
| 49 | if (num > 0) { |
| 50 | tempExchangeFileLevelNumber = |
| 51 | new TColStd_HArray1OfInteger(1, num); |
| 52 | tempNativeLevel = new Interface_HArray1OfHAsciiString(1, num); |
| 53 | tempPhysicalLayerNumber = new TColStd_HArray1OfInteger(1, num); |
| 54 | tempExchangeFileLevelIdent = new Interface_HArray1OfHAsciiString(1, num); |
| 55 | } |
| 56 | else PR.AddFail("Number of definitions: Not Positive"); |
| 57 | |
| 58 | if (!tempExchangeFileLevelNumber.IsNull() && |
| 59 | !tempNativeLevel.IsNull() && |
| 60 | !tempPhysicalLayerNumber.IsNull() && |
| 61 | !tempExchangeFileLevelIdent.IsNull() ) |
| 62 | for ( i = 1; i <= num; i++ ) |
| 63 | { |
| 64 | Standard_Integer tempEFLN; |
| 65 | //szv#4:S4163:12Mar99 moved in if |
| 66 | if (PR.ReadInteger(PR.Current(), "Exchange File Level Number", tempEFLN)) |
| 67 | tempExchangeFileLevelNumber->SetValue(i, tempEFLN); |
| 68 | Handle(TCollection_HAsciiString) tempNL; |
| 69 | if (PR.ReadText(PR.Current(), "Native Level Identification", tempNL)) |
| 70 | tempNativeLevel->SetValue(i, tempNL); |
| 71 | Standard_Integer tempPLN; |
| 72 | if (PR.ReadInteger(PR.Current(), "Physical Layer Number", tempPLN)) |
| 73 | tempPhysicalLayerNumber->SetValue(i, tempPLN); |
| 74 | Handle(TCollection_HAsciiString) tempEFLI; |
| 75 | if (PR.ReadText(PR.Current(), "Exchange File Level Identification", tempEFLI)) |
| 76 | tempExchangeFileLevelIdent->SetValue(i, tempEFLI); |
| 77 | } |
| 78 | DirChecker(ent).CheckTypeAndForm(PR.CCheck(),ent); |
| 79 | ent->Init(tempNbPropertyValues, tempExchangeFileLevelNumber, |
| 80 | tempNativeLevel, tempPhysicalLayerNumber, tempExchangeFileLevelIdent); |
| 81 | } |
| 82 | |
| 83 | void IGESAppli_ToolLevelToPWBLayerMap::WriteOwnParams |
| 84 | (const Handle(IGESAppli_LevelToPWBLayerMap)& ent, IGESData_IGESWriter& IW) const |
| 85 | { |
| 86 | Standard_Integer i, num; |
| 87 | IW.Send(ent->NbPropertyValues()); |
| 88 | IW.Send(ent->NbLevelToLayerDefs()); |
| 89 | for ( num = ent->NbLevelToLayerDefs(), i = 1; i <= num; i++ ) |
| 90 | { |
| 91 | IW.Send(ent->ExchangeFileLevelNumber(i)); |
| 92 | IW.Send(ent->NativeLevel(i)); |
| 93 | IW.Send(ent->PhysicalLayerNumber(i)); |
| 94 | IW.Send(ent->ExchangeFileLevelIdent(i)); |
| 95 | } |
| 96 | } |
| 97 | |
| 98 | void IGESAppli_ToolLevelToPWBLayerMap::OwnShared |
| 99 | (const Handle(IGESAppli_LevelToPWBLayerMap)& /* ent */, Interface_EntityIterator& /* iter */) const |
| 100 | { |
| 101 | } |
| 102 | |
| 103 | void IGESAppli_ToolLevelToPWBLayerMap::OwnCopy |
| 104 | (const Handle(IGESAppli_LevelToPWBLayerMap)& another, |
| 105 | const Handle(IGESAppli_LevelToPWBLayerMap)& ent, Interface_CopyTool& /* TC */) const |
| 106 | { |
| 107 | Standard_Integer tempNbPropertyValues = another->NbPropertyValues(); |
| 108 | Standard_Integer num = another->NbLevelToLayerDefs(); |
| 109 | Handle(TColStd_HArray1OfInteger) tempExchangeFileLevelNumber = |
| 110 | new TColStd_HArray1OfInteger(1, num); |
| 111 | Handle(Interface_HArray1OfHAsciiString) tempNativeLevel = |
| 112 | new Interface_HArray1OfHAsciiString(1, num); |
| 113 | Handle(TColStd_HArray1OfInteger) tempPhysicalLayerNumber = |
| 114 | new TColStd_HArray1OfInteger(1, num); |
| 115 | Handle(Interface_HArray1OfHAsciiString) tempExchangeFileLevelIdent = |
| 116 | new Interface_HArray1OfHAsciiString(1, num); |
| 117 | for ( Standard_Integer i = 1; i <= num; i++ ) |
| 118 | { |
| 119 | tempExchangeFileLevelNumber->SetValue(i,another->ExchangeFileLevelNumber(i)); |
| 120 | tempNativeLevel->SetValue |
| 121 | (i, new TCollection_HAsciiString(another->NativeLevel(i))); |
| 122 | tempPhysicalLayerNumber->SetValue(i, another->PhysicalLayerNumber(i)); |
| 123 | tempExchangeFileLevelIdent->SetValue |
| 124 | (i,new TCollection_HAsciiString |
| 125 | (another->ExchangeFileLevelIdent(i))); |
| 126 | } |
| 127 | ent->Init (tempNbPropertyValues, tempExchangeFileLevelNumber, tempNativeLevel, |
| 128 | tempPhysicalLayerNumber, tempExchangeFileLevelIdent); |
| 129 | } |
| 130 | |
| 131 | IGESData_DirChecker IGESAppli_ToolLevelToPWBLayerMap::DirChecker |
| 132 | (const Handle(IGESAppli_LevelToPWBLayerMap)& /* ent */ ) const |
| 133 | { |
| 134 | IGESData_DirChecker DC(406, 24); |
| 135 | DC.Structure(IGESData_DefVoid); |
| 136 | DC.GraphicsIgnored(); |
| 137 | DC.LineFont(IGESData_DefVoid); |
| 138 | DC.LineWeight(IGESData_DefVoid); |
| 139 | DC.Color(IGESData_DefVoid); |
| 140 | DC.BlankStatusIgnored(); |
| 141 | DC.UseFlagIgnored(); |
| 142 | DC.HierarchyStatusIgnored(); |
| 143 | return DC; |
| 144 | } |
| 145 | |
| 146 | void IGESAppli_ToolLevelToPWBLayerMap::OwnCheck |
| 147 | (const Handle(IGESAppli_LevelToPWBLayerMap)& /* ent */, |
| 148 | const Interface_ShareTool& , Handle(Interface_Check)& /* ach */) const |
| 149 | { |
| 150 | } |
| 151 | |
| 152 | void IGESAppli_ToolLevelToPWBLayerMap::OwnDump |
| 153 | (const Handle(IGESAppli_LevelToPWBLayerMap)& ent, const IGESData_IGESDumper& /* dumper */, |
| 154 | const Handle(Message_Messenger)& S, const Standard_Integer level) const |
| 155 | { |
| 156 | Standard_Integer i, num; |
| 157 | S << "IGESAppli_LevelToPWBLayerMap" << endl; |
| 158 | S << "Number of property values : " << ent->NbPropertyValues() << endl; |
| 159 | S << "Exchange File Level Number : " << endl; |
| 160 | S << "Native Level Identification : " << endl; |
| 161 | S << "Physical Layer Number : " << endl; |
| 162 | S << "Exchange File Level Identification : "; |
| 163 | IGESData_DumpStrings |
| 164 | (S,-level,1, ent->NbLevelToLayerDefs(),ent->ExchangeFileLevelIdent); |
| 165 | S << endl; |
| 166 | if (level > 4) |
| 167 | for ( num = ent->NbLevelToLayerDefs(), i = 1; i <= num; i++ ) |
| 168 | { |
| 169 | S << "[" << i << "]: " << endl; |
| 170 | S << "Exchange File Level Number : " |
| 171 | << ent->ExchangeFileLevelNumber(i) << endl; |
| 172 | S << "Native Level Identification : "; |
| 173 | IGESData_DumpString(S,ent->NativeLevel(i)); |
| 174 | S << endl; |
| 175 | S << "Physical Layer Number : " << ent->PhysicalLayerNumber(i) << endl; |
| 176 | S << "Exchange File Level Identification : "; |
| 177 | IGESData_DumpString(S,ent->ExchangeFileLevelIdent(i)); |
| 178 | S << endl; |
| 179 | } |
| 180 | } |