1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-06-30 12:14:08 +03:00
occt/src/StepToTopoDS/StepToTopoDS_TranslateShell.cxx
tiv 0423218095 0030895: Coding Rules - specify std namespace explicitly for std::cout and streams
"endl" manipulator for Message_Messenger is renamed to "Message_EndLine".

The following entities from std namespace are now used
with std:: explicitly specified (from Standard_Stream.hxx):
std::istream,std::ostream,std::ofstream,std::ifstream,std::fstream,
std::filebuf,std::streambuf,std::streampos,std::ios,std::cout,std::cerr,
std::cin,std::endl,std::ends,std::flush,std::setw,std::setprecision,
std::hex,std::dec.
2019-08-16 12:16:38 +03:00

140 lines
4.8 KiB
C++

// Created on: 1995-01-03
// Created by: Frederic MAUPAS
// Copyright (c) 1995-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
//: gka 09.04.99: S4136: improving tolerance management
#include <BRep_Builder.hxx>
#include <Message_ProgressIndicator.hxx>
#include <Message_ProgressSentry.hxx>
#include <StdFail_NotDone.hxx>
#include <StepShape_ConnectedFaceSet.hxx>
#include <StepShape_FaceSurface.hxx>
#include <StepToTopoDS_NMTool.hxx>
#include <StepToTopoDS_Tool.hxx>
#include <StepToTopoDS_TranslateFace.hxx>
#include <StepToTopoDS_TranslateShell.hxx>
#include <TopoDS.hxx>
#include <TopoDS_Face.hxx>
#include <TopoDS_Shape.hxx>
#include <TopoDS_Shell.hxx>
#include <Transfer_TransientProcess.hxx>
// ============================================================================
// Method : StepToTopoDS_TranslateShell::StepToTopoDS_TranslateShell
// Purpose : Empty Constructor
// ============================================================================
StepToTopoDS_TranslateShell::StepToTopoDS_TranslateShell()
{
done = Standard_False;
}
// ============================================================================
// Method : StepToTopoDS_TranslateShell::StepToTopoDS_TranslateShell()
// Purpose : Constructor with a ConnectedFaceSet and a Tool
// ============================================================================
StepToTopoDS_TranslateShell::StepToTopoDS_TranslateShell
(const Handle(StepShape_ConnectedFaceSet)& CFS, StepToTopoDS_Tool& T, StepToTopoDS_NMTool& NMTool)
{
Init(CFS, T, NMTool);
}
// ============================================================================
// Method : Init
// Purpose : Init with a ConnectedFaceSet and a Tool
// ============================================================================
void StepToTopoDS_TranslateShell::Init
(const Handle(StepShape_ConnectedFaceSet)& CFS, StepToTopoDS_Tool& aTool, StepToTopoDS_NMTool& NMTool)
{
//bug15697
if(CFS.IsNull())
return;
if (!aTool.IsBound(CFS)) {
BRep_Builder B;
Handle(Transfer_TransientProcess) TP = aTool.TransientProcess();
Standard_Integer NbFc = CFS->NbCfsFaces();
TopoDS_Shell Sh;
B.MakeShell(Sh);
TopoDS_Face F;
TopoDS_Shape S;
Handle(StepShape_Face) StepFace;
StepToTopoDS_TranslateFace myTranFace;
myTranFace.SetPrecision(Precision()); //gka
myTranFace.SetMaxTol(MaxTol());
Message_ProgressSentry PS ( TP->GetProgress(), "Face", 0, NbFc, 1 );
for (Standard_Integer i = 1; i <= NbFc && PS.More(); i++, PS.Next()) {
#ifdef OCCT_DEBUG
std::cout << "Processing Face : " << i << std::endl;
#endif
StepFace = CFS->CfsFacesValue(i);
Handle(StepShape_FaceSurface) theFS =
Handle(StepShape_FaceSurface)::DownCast(StepFace);
if (!theFS.IsNull()) {
myTranFace.Init(theFS, aTool, NMTool);
if (myTranFace.IsDone()) {
S = myTranFace.Value();
F = TopoDS::Face(S);
B.Add(Sh, F);
}
else { // Warning only + add FaceSurface file Identifier
TP->AddWarning(theFS, " a Face from Shell not mapped to TopoDS");
}
}
else { // Warning : add identifier
TP->AddWarning(StepFace, " Face is not of FaceSurface Type; not mapped to TopoDS");
}
}
Sh.Closed (BRep_Tool::IsClosed (Sh));
myResult = Sh;
aTool.Bind(CFS, myResult);
myError = StepToTopoDS_TranslateShellDone;
done = Standard_True;
}
else {
myResult = TopoDS::Shell(aTool.Find(CFS));
myError = StepToTopoDS_TranslateShellDone;
done = Standard_True;
}
}
// ============================================================================
// Method : Value
// Purpose : Return the mapped Shape
// ============================================================================
const TopoDS_Shape& StepToTopoDS_TranslateShell::Value() const
{
StdFail_NotDone_Raise_if (!done, "StepToTopoDS_TranslateShell::Value() - no result");
return myResult;
}
// ============================================================================
// Method : Error
// Purpose : Return the TranslateShell Error code
// ============================================================================
StepToTopoDS_TranslateShellError StepToTopoDS_TranslateShell::Error() const
{
return myError;
}