0026167: Coding rules - eliminate -Wlogical-not-parentheses CLang warnings in GeomToStep
[occt.git] / src / GeomToStep / GeomToStep_MakeSurface.cxx
1 // Created on: 1993-06-22
2 // Created by: Martine LANGLOIS
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 #include <GeomToStep_MakeSurface.ixx>
18 #include <StdFail_NotDone.hxx>
19 #include <StepGeom_Surface.hxx>
20 #include <GeomToStep_MakeSurface.hxx>
21 #include <Geom_BoundedSurface.hxx>
22 #include <GeomToStep_MakeBoundedSurface.hxx>
23 #include <Geom_ElementarySurface.hxx>
24 #include <GeomToStep_MakeElementarySurface.hxx>
25 #include <Geom_SweptSurface.hxx>
26 #include <GeomToStep_MakeSweptSurface.hxx>
27 #include <TCollection_HAsciiString.hxx>
28 #include <Geom_OffsetSurface.hxx>
29 #include <StepGeom_OffsetSurface.hxx>
30 #include <StepData_Logical.hxx>
31 #include <UnitsMethods.hxx>
32
33 //=============================================================================
34 // Creation d' une Surface de prostep a partir d' une Surface de Geom
35 //=============================================================================
36
37 GeomToStep_MakeSurface::GeomToStep_MakeSurface ( const Handle(Geom_Surface)& S)
38 {
39   done = Standard_True;
40   if (S->IsKind(STANDARD_TYPE(Geom_BoundedSurface))) {
41     Handle(Geom_BoundedSurface) S1 = 
42       Handle(Geom_BoundedSurface)::DownCast(S);
43     GeomToStep_MakeBoundedSurface MkBoundedS(S1);
44     theSurface = MkBoundedS.Value();
45   }
46   else if (S->IsKind(STANDARD_TYPE(Geom_ElementarySurface))) {
47     Handle(Geom_ElementarySurface) S1 = 
48       Handle(Geom_ElementarySurface)::DownCast(S);
49     GeomToStep_MakeElementarySurface MkElementaryS(S1);
50     theSurface = MkElementaryS.Value();
51   }
52   else if (S->IsKind(STANDARD_TYPE(Geom_SweptSurface))) {
53     Handle(Geom_SweptSurface) S1 = 
54       Handle(Geom_SweptSurface)::DownCast(S);
55     GeomToStep_MakeSweptSurface MkSwept(S1);
56     theSurface = MkSwept.Value();
57   }
58   else if (S->IsKind(STANDARD_TYPE(Geom_OffsetSurface))) {
59     Handle(Geom_OffsetSurface) S1 =
60       Handle(Geom_OffsetSurface)::DownCast(S);
61     GeomToStep_MakeSurface MkBasis(S1->BasisSurface());
62     done = MkBasis.IsDone();
63     if (!done) return;
64     Handle(StepGeom_OffsetSurface) Surf = new StepGeom_OffsetSurface;
65     Surf->Init (new TCollection_HAsciiString(""),
66                      MkBasis.Value(),S1->Offset()/UnitsMethods::LengthFactor(),StepData_LFalse);
67     theSurface = Surf;
68   }
69   else {
70     done = Standard_False;
71 #ifdef OCCT_DEBUG
72     cout << " unknown type " << S->DynamicType()->Name() << endl;
73 #endif
74   }
75 }
76
77
78 //=============================================================================
79 // renvoi des valeurs
80 //=============================================================================
81
82 const Handle(StepGeom_Surface) &
83       GeomToStep_MakeSurface::Value() const
84 {
85   StdFail_NotDone_Raise_if(!done, "");
86   return theSurface;
87 }