973c2be1 |
1 | // Copyright (c) 1999-2014 OPEN CASCADE SAS |
b311480e |
2 | // |
973c2be1 |
3 | // This file is part of Open CASCADE Technology software library. |
b311480e |
4 | // |
973c2be1 |
5 | // This library is free software; you can redistribute it and / or modify it |
6 | // under the terms of the GNU Lesser General Public version 2.1 as published |
7 | // by the Free Software Foundation, with special exception defined in the file |
8 | // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT |
9 | // distribution for complete text of the license and disclaimer of any warranty. |
b311480e |
10 | // |
973c2be1 |
11 | // Alternatively, this file may be used under the terms of Open CASCADE |
12 | // commercial license or contractual agreement. |
7fd59977 |
13 | |
14 | #include <RWStepVisual_RWSurfaceStyleParameterLine.ixx> |
15 | #include <StepVisual_CurveStyle.hxx> |
16 | #include <Standard_Integer.hxx> |
17 | |
18 | #include <StepVisual_HArray1OfDirectionCountSelect.hxx> |
19 | |
20 | #include <Interface_EntityIterator.hxx> |
21 | |
22 | |
23 | #include <StepVisual_SurfaceStyleParameterLine.hxx> |
24 | |
25 | |
26 | RWStepVisual_RWSurfaceStyleParameterLine::RWStepVisual_RWSurfaceStyleParameterLine () {} |
27 | |
28 | void RWStepVisual_RWSurfaceStyleParameterLine::ReadStep |
29 | (const Handle(StepData_StepReaderData)& data, |
30 | const Standard_Integer num, |
31 | Handle(Interface_Check)& ach, |
32 | const Handle(StepVisual_SurfaceStyleParameterLine)& ent) const |
33 | { |
34 | |
35 | |
36 | // --- Number of Parameter Control --- |
37 | |
38 | if (!data->CheckNbParams(num,2,ach,"surface_style_parameter_line")) return; |
39 | |
40 | // --- own field : styleOfParameterLines --- |
41 | |
42 | Handle(StepVisual_CurveStyle) aStyleOfParameterLines; |
43 | //szv#4:S4163:12Mar99 `Standard_Boolean stat1 =` not needed |
44 | data->ReadEntity(num, 1,"style_of_parameter_lines", ach, STANDARD_TYPE(StepVisual_CurveStyle), aStyleOfParameterLines); |
45 | |
46 | // --- own field : directionCounts --- |
47 | // DirectionCount : select de UDirectionCount et VDirectionCount qui sont |
48 | // des type INTEGER; |
49 | // Par consequent, on doit trouver dans le fichier : |
50 | // ... , (U_DIRECTION_COUNT(10), V_DIRECTION_COUNT(1)) ); |
51 | |
52 | Standard_Integer numr, numpr; |
53 | TCollection_AsciiString UType("U_DIRECTION_COUNT"); |
54 | TCollection_AsciiString VType("V_DIRECTION_COUNT"); |
55 | TCollection_AsciiString TrueType; |
56 | |
57 | Handle(StepVisual_HArray1OfDirectionCountSelect) aDirectionCounts; |
58 | Standard_Integer aDirectionCountsItem; |
59 | StepVisual_DirectionCountSelect aDirectionCountSelect; |
60 | |
61 | Standard_Integer nsub2; |
62 | if (data->ReadSubList (num,2,"direction_counts",ach,nsub2)) { |
63 | Standard_Integer nb2 = data->NbParams(nsub2); |
64 | aDirectionCounts = new StepVisual_HArray1OfDirectionCountSelect(1, nb2); |
65 | for (Standard_Integer i2 = 1; i2 <= nb2; i2 ++) { |
66 | // looks for true type : |
67 | //szv#4:S4163:12Mar99 `Standard_Boolean statUV =` not needed |
68 | if (data->ReadTypedParam(nsub2,i2,Standard_True,"direction_count", ach,numr,numpr,TrueType)) { |
69 | //szv#4:S4163:12Mar99 `Standard_Boolean stat1 =` not needed |
70 | if (data->ReadInteger (numr,numpr,"direction_counts",ach,aDirectionCountsItem)) { |
71 | if (TrueType == UType) { |
72 | aDirectionCountSelect.SetUDirectionCount(aDirectionCountsItem); |
73 | aDirectionCounts->SetValue(i2,aDirectionCountSelect); |
74 | } |
75 | else if (TrueType == VType) { |
76 | aDirectionCountSelect.SetVDirectionCount(aDirectionCountsItem); |
77 | aDirectionCounts->SetValue(i2,aDirectionCountSelect); |
78 | } |
79 | else { |
80 | ach->AddFail("Parameter #2 (direction_counts) item has illegal TYPE"); |
81 | } |
82 | } |
83 | else { |
84 | ach->AddFail("Parameter #2 (direction_counts) item is not an INTEGER"); |
85 | } |
86 | } |
87 | else { |
88 | ach->AddFail("Parameter #2 (direction_counts) item is not TYPED"); |
89 | } |
90 | } |
91 | } |
92 | |
93 | //--- Initialisation of the read entity --- |
94 | |
95 | ent->Init(aStyleOfParameterLines, aDirectionCounts); |
96 | } |
97 | |
98 | |
99 | void RWStepVisual_RWSurfaceStyleParameterLine::WriteStep |
100 | (StepData_StepWriter& SW, |
101 | const Handle(StepVisual_SurfaceStyleParameterLine)& ent) const |
102 | { |
103 | |
104 | // --- own field : styleOfParameterLines --- |
105 | |
106 | SW.Send(ent->StyleOfParameterLines()); |
107 | |
108 | // --- own field : directionCounts --- |
109 | // Attention : a modifier avant utilisation |
110 | |
111 | SW.Send(ent->DirectionCounts()); |
112 | } |
113 | |
114 | |
115 | void RWStepVisual_RWSurfaceStyleParameterLine::Share(const Handle(StepVisual_SurfaceStyleParameterLine)& ent, Interface_EntityIterator& iter) const |
116 | { |
117 | |
118 | iter.GetOneItem(ent->StyleOfParameterLines()); |
119 | } |
120 | |