1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-09 13:22:24 +03:00

// removing XSControl useless files

updated test ploads with STL module to work with mesh generation
This commit is contained in:
dpasukhi
2023-01-24 11:47:52 +00:00
parent 22b4b9c557
commit 3bff555ce7
33 changed files with 269 additions and 2055 deletions

View File

@@ -32,7 +32,6 @@ Transfer_IteratorOfProcessForTransient.hxx
Transfer_IteratorOfProcessForTransient_0.cxx
Transfer_MapContainer.cxx
Transfer_MapContainer.hxx
Transfer_Mapper.gxx
Transfer_MultipleBinder.cxx
Transfer_MultipleBinder.hxx
Transfer_ProcessForFinder.hxx

View File

@@ -1,41 +0,0 @@
// 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.
//#include <Transfer_Mapper.ixx>
#include <Standard_Integer.hxx>
Transfer_Mapper::Transfer_Mapper (const TheKey& akey)
: theval (akey)
{ SetHashCode ( TheHasher::HashCode (akey, IntegerLast() ) ); }
const TheKey& Transfer_Mapper::Value () const
{ return theval; }
Standard_Boolean Transfer_Mapper::Equates
(const Handle(Transfer_Finder)& other) const
{
if (other.IsNull()) return Standard_False;
if (GetHashCode() != other->GetHashCode()) return Standard_False;
if (other->DynamicType() != DynamicType()) return Standard_False;
Handle(Transfer_Mapper) another = Handle(Transfer_Mapper)::DownCast(other);
// return (theval == another->Value());
return TheHasher::IsEqual (theval,another->Value());
}
Handle(Standard_Type) Transfer_Mapper::ValueType () const
{ return TheInfo::Type(theval); }
Standard_CString Transfer_Mapper::ValueTypeName () const
{ return TheInfo::TypeName(theval); }

View File

@@ -22,23 +22,52 @@
#include <Transfer_DataInfo.hxx>
#include <Transfer_Finder.hxx>
//=======================================================================
//function : Transfer_TransientMapper
//purpose :
//=======================================================================
Transfer_TransientMapper::Transfer_TransientMapper(const Handle(Standard_Transient)& akey)
: theval(akey)
{
SetHashCode(TColStd_MapTransientHasher::HashCode(akey, IntegerLast()));
}
//=======================================================================
//function : Value
//purpose :
//=======================================================================
const Handle(Standard_Transient)& Transfer_TransientMapper::Value() const
{
return theval;
}
//=======================================================================
//function : Equates
//purpose :
//=======================================================================
Standard_Boolean Transfer_TransientMapper::Equates(const Handle(Transfer_Finder)& other) const
{
if (other.IsNull()) return Standard_False;
if (GetHashCode() != other->GetHashCode()) return Standard_False;
if (other->DynamicType() != DynamicType()) return Standard_False;
Handle(Transfer_TransientMapper) another = Handle(Transfer_TransientMapper)::DownCast(other);
return TColStd_MapTransientHasher::IsEqual(theval, another->Value());
}
//=======================================================================
//function : ValueType
//purpose :
//=======================================================================
Handle(Standard_Type) Transfer_TransientMapper::ValueType() const
{
return Transfer_DataInfo::Type(theval);
}
#define TheKey Handle(Standard_Transient)
#define TheKey_hxx <Standard_Transient.hxx>
#define TheHasher TColStd_MapTransientHasher
#define TheHasher_hxx <TColStd_MapTransientHasher.hxx>
#define TheInfo Transfer_DataInfo
#define TheInfo_hxx <Transfer_DataInfo.hxx>
#define Transfer_Mapper Transfer_TransientMapper
#define Transfer_Mapper_hxx <Transfer_TransientMapper.hxx>
#define Handle_Transfer_Mapper Handle(Transfer_TransientMapper)
#include <Transfer_Mapper.gxx>
//=======================================================================
//function : ValueTypeName
//purpose :
//=======================================================================
Standard_CString Transfer_TransientMapper::ValueTypeName() const
{
return Transfer_DataInfo::TypeName(theval);
}

View File

@@ -1,13 +1,5 @@
TransferBRep.cxx
TransferBRep.hxx
TransferBRep_BinderOfShape.cxx
TransferBRep_BinderOfShape.hxx
TransferBRep_HSequenceOfTransferResultInfo.hxx
TransferBRep_OrientedShapeMapper.hxx
TransferBRep_OrientedShapeMapper_0.cxx
TransferBRep_Reader.cxx
TransferBRep_Reader.hxx
TransferBRep_SequenceOfTransferResultInfo.hxx
TransferBRep_ShapeBinder.cxx
TransferBRep_ShapeBinder.hxx
TransferBRep_ShapeInfo.cxx

View File

@@ -38,8 +38,8 @@ static void ShapeAppend
const Handle(TopTools_HSequenceOfShape)& shapes)
{
if (binder.IsNull()) return;
if (binder->IsKind(STANDARD_TYPE(TransferBRep_BinderOfShape))) {
DeclareAndCast(TransferBRep_BinderOfShape,shbind,binder);
if (binder->IsKind(STANDARD_TYPE(TransferBRep_ShapeBinder))) {
DeclareAndCast(TransferBRep_ShapeBinder,shbind,binder);
if (shbind->HasResult()) shapes->Append (shbind->Result());
}
else if (binder->IsKind(STANDARD_TYPE(TransferBRep_ShapeListBinder))) {
@@ -63,7 +63,7 @@ static void ShapeAppend
TopoDS_Shape shape;
Handle(Transfer_Binder) bnd = binder;
while (!bnd.IsNull()) {
DeclareAndCast(TransferBRep_BinderOfShape,shb,bnd);
DeclareAndCast(TransferBRep_ShapeBinder,shb,bnd);
if (!shb.IsNull()) return shb->Result();
DeclareAndCast(Transfer_SimpleBinderOfTransient,hsb,bnd);
if (!hsb.IsNull()) {
@@ -344,7 +344,7 @@ Interface_CheckIterator TransferBRep::BRepCheck
Handle(Standard_Transient) ent = ach->Entity();
if (ent.IsNull()) continue;
if (!alsoshapes) {
if (ent->IsKind(STANDARD_TYPE(TransferBRep_BinderOfShape)) ||
if (ent->IsKind(STANDARD_TYPE(TransferBRep_ShapeBinder)) ||
ent->IsKind(STANDARD_TYPE(TopoDS_HShape)) ||
ent->IsKind(STANDARD_TYPE(TransferBRep_ShapeMapper)) ) continue;
}
@@ -363,7 +363,7 @@ Interface_CheckIterator TransferBRep::BRepCheck
Handle(Standard_Transient) ent = ach->Entity();
if (ent.IsNull()) continue;
DeclareAndCast(TopoDS_HShape,hs,ent);
DeclareAndCast(TransferBRep_BinderOfShape,sb,ent);
DeclareAndCast(TransferBRep_ShapeBinder,sb,ent);
DeclareAndCast(TransferBRep_ShapeMapper,sm,ent);
if (!hs.IsNull()) ls->Append (hs->Shape());
if (!sb.IsNull()) ls->Append (sb->Result());
@@ -377,7 +377,7 @@ Interface_CheckIterator TransferBRep::BRepCheck
{
TopoDS_Shape S;
DeclareAndCast(TopoDS_HShape,hs,obj);
DeclareAndCast(TransferBRep_BinderOfShape,sb,obj);
DeclareAndCast(TransferBRep_ShapeBinder,sb,obj);
DeclareAndCast(TransferBRep_ShapeMapper,sm,obj);
if (!hs.IsNull()) S = hs->Shape();
if (!sb.IsNull()) S = sb->Result();
@@ -397,7 +397,7 @@ Interface_CheckIterator TransferBRep::BRepCheck
} else {
TopoDS_Shape sh;
DeclareAndCast(TopoDS_HShape,hsh,ent);
DeclareAndCast(TransferBRep_BinderOfShape,sbs,ent);
DeclareAndCast(TransferBRep_ShapeBinder,sbs,ent);
DeclareAndCast(TransferBRep_ShapeMapper,smp,ent);
if (!hsh.IsNull()) sh = hsh->Shape();
if (!sbs.IsNull()) sh = sbs->Result();

View File

@@ -25,7 +25,6 @@
#include <Standard_Boolean.hxx>
#include <TColStd_HSequenceOfTransient.hxx>
#include <TopAbs_Orientation.hxx>
#include <TransferBRep_HSequenceOfTransferResultInfo.hxx>
#include <TColStd_HSequenceOfInteger.hxx>
#include <Standard_Integer.hxx>
class TopoDS_Shape;
@@ -40,6 +39,8 @@ class TransferBRep_TransferResultInfo;
class Interface_CheckIterator;
class Interface_InterfaceModel;
typedef NCollection_Sequence<Handle(TransferBRep_TransferResultInfo)> TransferBRep_SequenceOfTransferResultInfo;
DEFINE_HSEQUENCE(TransferBRep_HSequenceOfTransferResultInfo, TransferBRep_SequenceOfTransferResultInfo)
//! This package gathers services to simply read files and convert
//! them to Shapes from CasCade. IE. it can be used in conjunction

View File

@@ -1,48 +0,0 @@
// 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.
#include <TransferBRep_BinderOfShape.hxx>
#include <TransferBRep_ShapeInfo.hxx>
IMPLEMENT_STANDARD_RTTIEXT(TransferBRep_BinderOfShape,Transfer_Binder)
TransferBRep_BinderOfShape::TransferBRep_BinderOfShape (){ }
TransferBRep_BinderOfShape::TransferBRep_BinderOfShape (const TopoDS_Shape& res)
: theres (res)
{ SetResultPresent(); }
// Standard_Boolean TransferBRep_BinderOfShape::IsMultiple() const
// { return Standard_False; }
Handle(Standard_Type) TransferBRep_BinderOfShape::ResultType () const
{ return TransferBRep_ShapeInfo::Type (theres); } // correspond a "STANDARD_TYPE(TopoDS_Shape)"
Standard_CString TransferBRep_BinderOfShape::ResultTypeName () const
{ return TransferBRep_ShapeInfo::TypeName (theres); } // correspond a "STANDARD_TYPE(TopoDS_Shape)"
void TransferBRep_BinderOfShape::SetResult (const TopoDS_Shape& res)
{
SetResultPresent();
theres = res;
}
const TopoDS_Shape& TransferBRep_BinderOfShape::Result () const
{ return theres; }
TopoDS_Shape& TransferBRep_BinderOfShape::CResult ()
{ SetResultPresent(); return theres; }

View File

@@ -1,99 +0,0 @@
// Created on: 1992-02-17
// Created by: Christian CAILLET
// Copyright (c) 1992-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.
#ifndef _TransferBRep_BinderOfShape_HeaderFile
#define _TransferBRep_BinderOfShape_HeaderFile
#include <Standard.hxx>
#include <TopoDS_Shape.hxx>
#include <Transfer_Binder.hxx>
#include <Standard_Type.hxx>
#include <Standard_CString.hxx>
class TransferBRep_BinderOfShape;
DEFINE_STANDARD_HANDLE(TransferBRep_BinderOfShape, Transfer_Binder)
//! Allows direct binding between a starting Object and the Result
//! of its transfer when it is Unique.
//! The Result itself is defined as a formal parameter <Shape from TopoDS>
//! Warning : While it is possible to instantiate BinderOfShape with any Type
//! for the Result, it is not advisable to instantiate it with
//! Transient Classes, because such Results are directly known and
//! managed by TransferProcess & Co, through
//! SimpleBinderOfTransient : this class looks like instantiation
//! of BinderOfShape, but its method ResultType
//! is adapted (reads DynamicType of the Result)
class TransferBRep_BinderOfShape : public Transfer_Binder
{
public:
//! normal standard constructor, creates an empty BinderOfShape
Standard_EXPORT TransferBRep_BinderOfShape();
//! constructor which in the same time defines the result
//! Returns True if a starting object is bound with SEVERAL
//! results : Here, returns always False
//! But it can have next results
Standard_EXPORT TransferBRep_BinderOfShape(const TopoDS_Shape& res);
//! Returns the Type permitted for the Result, i.e. the Type
//! of the Parameter Class <Shape from TopoDS> (statically defined)
Standard_EXPORT Handle(Standard_Type) ResultType() const Standard_OVERRIDE;
//! Returns the Type Name computed for the Result (dynamic)
Standard_EXPORT Standard_CString ResultTypeName() const Standard_OVERRIDE;
//! Defines the Result
Standard_EXPORT void SetResult (const TopoDS_Shape& res);
//! Returns the defined Result, if there is one
Standard_EXPORT const TopoDS_Shape& Result() const;
//! Returns the defined Result, if there is one, and allows to
//! change it (avoids Result + SetResult).
//! Admits that Result can be not yet defined
//! Warning : a call to CResult causes Result to be known as defined
Standard_EXPORT TopoDS_Shape& CResult();
DEFINE_STANDARD_RTTIEXT(TransferBRep_BinderOfShape,Transfer_Binder)
protected:
private:
TopoDS_Shape theres;
};
#endif // _TransferBRep_BinderOfShape_HeaderFile

View File

@@ -1,26 +0,0 @@
// Created on: 1994-10-03
// Created by: Christian CAILLET
// Copyright (c) 1994-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.
#ifndef TransferBRep_HSequenceOfTransferResultInfo_HeaderFile
#define TransferBRep_HSequenceOfTransferResultInfo_HeaderFile
#include <TransferBRep_SequenceOfTransferResultInfo.hxx>
#include <NCollection_DefineHSequence.hxx>
DEFINE_HSEQUENCE(TransferBRep_HSequenceOfTransferResultInfo, TransferBRep_SequenceOfTransferResultInfo)
#endif

View File

@@ -1,89 +0,0 @@
// Created on: 1994-10-03
// Created by: Christian CAILLET
// Copyright (c) 1994-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.
#ifndef _TransferBRep_OrientedShapeMapper_HeaderFile
#define _TransferBRep_OrientedShapeMapper_HeaderFile
#include <Standard.hxx>
#include <Standard_Type.hxx>
#include <TopoDS_Shape.hxx>
#include <Transfer_Finder.hxx>
#include <Standard_Boolean.hxx>
#include <Standard_Type.hxx>
#include <Standard_CString.hxx>
class TopoDS_Shape;
class TopTools_OrientedShapeMapHasher;
class TransferBRep_ShapeInfo;
class Transfer_Finder;
class TransferBRep_OrientedShapeMapper;
DEFINE_STANDARD_HANDLE(TransferBRep_OrientedShapeMapper, Transfer_Finder)
class TransferBRep_OrientedShapeMapper : public Transfer_Finder
{
public:
//! Creates a Mapper with a Value. This Value can then not be
//! changed. It is used by the Hasher to compute the HashCode,
//! which will then be stored for an immediate reading.
Standard_EXPORT TransferBRep_OrientedShapeMapper(const TopoDS_Shape& akey);
//! Returns the contained value
Standard_EXPORT const TopoDS_Shape& Value() const;
//! Specific testof equality : defined as False if <other> has
//! not the same true Type, else contents are compared (by
//! C++ operator ==)
Standard_EXPORT Standard_Boolean Equates (const Handle(Transfer_Finder)& other) const Standard_OVERRIDE;
//! Returns the Type of the Value. By default, returns the
//! DynamicType of <me>, but can be redefined
Standard_EXPORT virtual Handle(Standard_Type) ValueType() const Standard_OVERRIDE;
//! Returns the name of the Type of the Value. Default is name
//! of ValueType, unless it is for a non-handled object
Standard_EXPORT virtual Standard_CString ValueTypeName() const Standard_OVERRIDE;
DEFINE_STANDARD_RTTI_INLINE(TransferBRep_OrientedShapeMapper,Transfer_Finder)
protected:
private:
TopoDS_Shape theval;
};
#endif // _TransferBRep_OrientedShapeMapper_HeaderFile

View File

@@ -1,45 +0,0 @@
// Created on: 1994-10-03
// Created by: Christian CAILLET
// Copyright (c) 1994-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.
#include <TransferBRep_OrientedShapeMapper.hxx>
#include <Standard_Type.hxx>
#include <TopoDS_Shape.hxx>
#include <TopTools_OrientedShapeMapHasher.hxx>
#include <TransferBRep_ShapeInfo.hxx>
#include <Transfer_Finder.hxx>
#define TheKey TopoDS_Shape
#define TheKey_hxx <TopoDS_Shape.hxx>
#define TheHasher TopTools_OrientedShapeMapHasher
#define TheHasher_hxx <TopTools_OrientedShapeMapHasher.hxx>
#define TheInfo TransferBRep_ShapeInfo
#define TheInfo_hxx <TransferBRep_ShapeInfo.hxx>
#define Transfer_Mapper TransferBRep_OrientedShapeMapper
#define Transfer_Mapper_hxx <TransferBRep_OrientedShapeMapper.hxx>
#define Handle_Transfer_Mapper Handle(TransferBRep_OrientedShapeMapper)
#include <Transfer_Mapper.gxx>

View File

@@ -1,270 +0,0 @@
// 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.
#include <BRep_Builder.hxx>
#include <Interface_CheckIterator.hxx>
#include <Interface_CheckTool.hxx>
#include <Interface_InterfaceModel.hxx>
#include <Interface_Protocol.hxx>
#include <Message_Messenger.hxx>
#include <Message_ProgressScope.hxx>
#include <Standard_Transient.hxx>
#include <TopoDS_Compound.hxx>
#include <TopoDS_Shape.hxx>
#include <Transfer_ActorOfTransientProcess.hxx>
#include <Transfer_TransferOutput.hxx>
#include <Transfer_TransientProcess.hxx>
#include <TransferBRep.hxx>
#include <TransferBRep_Reader.hxx>
TransferBRep_Reader::TransferBRep_Reader ()
: theDone (Standard_False) , theFilest (0) , theNewpr (Standard_False)
{ theShapes = new TopTools_HSequenceOfShape(); theTransi = new TColStd_HSequenceOfTransient(); }
void TransferBRep_Reader::SetProtocol
(const Handle(Interface_Protocol)& protocol)
{ theProto = protocol; }
Handle(Interface_Protocol) TransferBRep_Reader::Protocol () const
{ return theProto; }
void TransferBRep_Reader::SetActor
(const Handle(Transfer_ActorOfTransientProcess)& actor)
{ theActor = actor; }
Handle(Transfer_ActorOfTransientProcess) TransferBRep_Reader::Actor () const
{ return theActor; }
void TransferBRep_Reader::SetFileStatus (const Standard_Integer status)
{ theFilest = status; }
Standard_Integer TransferBRep_Reader::FileStatus () const
{ return theFilest; }
Standard_Boolean TransferBRep_Reader::FileNotFound () const
{ return (theFilest < 0); }
Standard_Boolean TransferBRep_Reader::SyntaxError () const
{ return (theFilest > 0); }
void TransferBRep_Reader::SetModel
(const Handle(Interface_InterfaceModel)& model)
{
theModel = model;
Clear();
}
Handle(Interface_InterfaceModel) TransferBRep_Reader::Model () const
{ return theModel; }
void TransferBRep_Reader::Clear ()
{
theDone = Standard_False;
theShapes->Clear(); theTransi->Clear();
}
Standard_Boolean TransferBRep_Reader::CheckStatusModel
(const Standard_Boolean withprint) const
{
Interface_CheckTool cht (theModel,theProto);
Interface_CheckIterator chl = cht.CompleteCheckList();
if (withprint
&& !theProc.IsNull()
&& !theProc->Messenger().IsNull())
{
Message_Messenger::StreamBuffer aBuffer = theProc->Messenger()->SendInfo();
chl.Print (aBuffer, theModel, Standard_False);
}
return chl.IsEmpty(Standard_True);
}
Interface_CheckIterator TransferBRep_Reader::CheckListModel () const
{
Interface_CheckTool cht (theModel,theProto);
Interface_CheckIterator chl = cht.CompleteCheckList();
return chl;
}
Standard_Boolean& TransferBRep_Reader::ModeNewTransfer ()
{ return theNewpr; }
Standard_Boolean TransferBRep_Reader::BeginTransfer ()
{
theDone = Standard_False;
if (theModel.IsNull()) return Standard_False;
if (theNewpr || theProc.IsNull())
theProc = new Transfer_TransientProcess (theModel->NbEntities());
else theProc->Clear();
theProc->SetErrorHandle(Standard_True);
theProc->SetModel (theModel);
PrepareTransfer();
theProc->SetActor (theActor);
return Standard_True;
}
void TransferBRep_Reader::EndTransfer ()
{
theShapes->Append ( TransferBRep::Shapes (theProc,Standard_True) );
Standard_Integer i,nb = theProc->NbRoots();
for (i = 1; i <= nb; i ++) {
Handle(Standard_Transient) ent = theProc->Root(i);
Handle(Standard_Transient) res = theProc->FindTransient(ent);
if (!res.IsNull()) theTransi->Append (res);
}
theDone = Standard_True;
}
void TransferBRep_Reader::PrepareTransfer () { }
void TransferBRep_Reader::TransferRoots (const Message_ProgressRange& theProgress)
{
Clear();
if (!BeginTransfer()) return;
Transfer_TransferOutput TP (theProc,theModel);
TP.TransferRoots(theProto, theProgress);
EndTransfer();
}
Standard_Boolean TransferBRep_Reader::Transfer (const Standard_Integer num,
const Message_ProgressRange& theProgress)
{
if (!BeginTransfer()) return Standard_False;
if (num <= 0 || num > theModel->NbEntities()) return Standard_False;
Handle(Standard_Transient) ent = theModel->Value(num);
Transfer_TransferOutput TP (theProc,theModel);
if (theProc->TraceLevel() > 1) {
Message_Messenger::StreamBuffer sout = theProc->Messenger()->SendInfo();
sout<<"-- Transfer(Read) : ";
theModel->Print (ent, sout);
sout<<std::endl;
}
TP.Transfer(ent, theProgress);
theProc->SetRoot(ent);
EndTransfer();
return Standard_True;
}
void TransferBRep_Reader::TransferList
(const Handle(TColStd_HSequenceOfTransient)& list,
const Message_ProgressRange& theProgress)
{
if (!BeginTransfer()) return;
if (list.IsNull()) return;
Transfer_TransferOutput TP (theProc,theModel);
Standard_Integer i, nb = list->Length();
Message_Messenger::StreamBuffer sout = theProc->Messenger()->SendInfo();
if (theProc->TraceLevel() > 1)
sout<<"-- Transfer(Read-List) : "<<nb<<" Items"<<std::endl;
Message_ProgressScope aPS(theProgress, NULL, nb);
for (i = 1; i <= nb && aPS.More(); i++) {
Message_ProgressRange aRange = aPS.Next();
Handle(Standard_Transient) ent = list->Value(i);
if (theModel->Number(ent) == 0) continue;
if (theProc->TraceLevel() > 1)
{
sout<<"-- Transfer(Read-List), Item "<<i<<" : ";
theModel->Print (ent, sout);
sout<<std::endl;
}
TP.Transfer (ent, aRange);
theProc->SetRoot(ent);
}
EndTransfer();
}
Standard_Boolean TransferBRep_Reader::IsDone () const
{ return theDone; }
// ###### RESULTAT : SHAPES ######
Standard_Integer TransferBRep_Reader::NbShapes () const
{ return theShapes->Length(); }
Handle(TopTools_HSequenceOfShape) TransferBRep_Reader::Shapes () const
{ return theShapes; }
const TopoDS_Shape& TransferBRep_Reader::Shape
(const Standard_Integer num) const
{ return theShapes->Value(num); }
TopoDS_Shape TransferBRep_Reader::OneShape () const
{
TopoDS_Shape res;
Standard_Integer nb = theShapes->Length();
if (nb == 0) return res;
else if (nb == 1) return theShapes->Value(1);
else {
TopoDS_Compound C;
BRep_Builder B;
B.MakeCompound(C);
for (Standard_Integer i = 1; i <= nb; i ++) B.Add (C,theShapes->Value(i));
return C;
}
}
TopoDS_Shape TransferBRep_Reader::ShapeResult
(const Handle(Standard_Transient)& ent) const
{ return TransferBRep::ShapeResult (theProc,ent); }
// ###### RESULTAT : TRANSIENTS ######
Standard_Integer TransferBRep_Reader::NbTransients () const
{ return theTransi->Length(); }
Handle(TColStd_HSequenceOfTransient) TransferBRep_Reader::Transients () const
{ return theTransi; }
Handle(Standard_Transient) TransferBRep_Reader::Transient
(const Standard_Integer num) const
{ return theTransi->Value(num); }
// ###### CHECKS ######
Standard_Boolean TransferBRep_Reader::CheckStatusResult
(const Standard_Boolean withprint) const
{
Interface_CheckIterator chl;
if (!theProc.IsNull()) chl = theProc->CheckList(Standard_False);
if (withprint
&& !theProc.IsNull()
&& !theProc->Messenger().IsNull())
{
Message_Messenger::StreamBuffer aBuffer = theProc->Messenger()->SendInfo();
chl.Print (aBuffer, theModel, Standard_False);
}
return chl.IsEmpty(Standard_True);
}
Interface_CheckIterator TransferBRep_Reader::CheckListResult () const
{
if (!theProc.IsNull()) return theProc->CheckList(Standard_False);
Interface_CheckIterator chbid; return chbid;
}
Handle(Transfer_TransientProcess) TransferBRep_Reader::TransientProcess
() const
{ return theProc; }
TransferBRep_Reader::~TransferBRep_Reader()
{}

View File

@@ -1,217 +0,0 @@
// Created on: 1994-10-03
// Created by: Christian CAILLET
// Copyright (c) 1994-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.
#ifndef _TransferBRep_Reader_HeaderFile
#define _TransferBRep_Reader_HeaderFile
#include <Standard.hxx>
#include <Standard_DefineAlloc.hxx>
#include <Standard_Handle.hxx>
#include <Standard_Integer.hxx>
#include <TopTools_HSequenceOfShape.hxx>
#include <TColStd_HSequenceOfTransient.hxx>
#include <Message_ProgressRange.hxx>
class Interface_Protocol;
class Transfer_ActorOfTransientProcess;
class Interface_InterfaceModel;
class Transfer_TransientProcess;
class Interface_CheckIterator;
class TopoDS_Shape;
class Standard_Transient;
//! This class offers a simple, easy to call, way of transferring
//! data from interface files to Shapes from CasCade
//! It must be specialized according to each norm/protocol, by :
//! - defining how to read a file (specific method with protocol)
//! - definig transfer, by providing an Actor
class TransferBRep_Reader
{
public:
DEFINE_STANDARD_ALLOC
//! Initializes a non-specialised Reader. Typically, for each norm
//! or protocol, is will be required to define a specific Create
//! to load a file and transfer it
Standard_EXPORT TransferBRep_Reader();
//! Records the protocol to be used for read and transfer roots
Standard_EXPORT void SetProtocol (const Handle(Interface_Protocol)& protocol);
//! Returns the recorded Protocol
Standard_EXPORT virtual Handle(Interface_Protocol) Protocol() const;
//! Records the actor to be used for transfers
Standard_EXPORT void SetActor (const Handle(Transfer_ActorOfTransientProcess)& actor);
//! Returns the recorded Actor
Standard_EXPORT virtual Handle(Transfer_ActorOfTransientProcess) Actor() const;
//! Sets File Status to be interpreted as follows :
//! = 0 OK
//! < 0 file not found
//! > 0 read error, no Model could be created
Standard_EXPORT void SetFileStatus (const Standard_Integer status);
//! Returns the File Status
Standard_EXPORT Standard_Integer FileStatus() const;
//! Returns True if FileStatus is for FileNotFound
Standard_EXPORT Standard_Boolean FileNotFound() const;
//! Returns True if FileStatus is for Error during read
//! (major error; for local error, see CheckModel)
Standard_EXPORT Standard_Boolean SyntaxError() const;
//! Specifies a Model to work on
//! Also clears the result and Done status
Standard_EXPORT void SetModel (const Handle(Interface_InterfaceModel)& model);
//! Returns the Model to be worked on
Standard_EXPORT Handle(Interface_InterfaceModel) Model() const;
//! clears the result and Done status. But not the Model.
Standard_EXPORT void Clear();
//! Checks the Model. Returns True if there is NO FAIL at all
//! (regardless Warnings)
//! If <withprint> is True, also sends Checks on standard output
Standard_EXPORT Standard_Boolean CheckStatusModel (const Standard_Boolean withprint) const;
//! Checks the Model (complete : syntax + semantic) and returns
//! the produced Check List
Standard_EXPORT Interface_CheckIterator CheckListModel() const;
//! Returns (by Reference, hence can be changed) the Mode for new
//! Transfer : True (D) means that each new Transfer produces a
//! new TransferProcess. Else keeps the original one but each
//! Transfer clears its (former results are not kept)
Standard_EXPORT Standard_Boolean& ModeNewTransfer();
//! Initializes the Reader for a Transfer (one,roots, or list)
//! Also calls PrepareTransfer
//! Returns True when done, False if could not be done
Standard_EXPORT Standard_Boolean BeginTransfer();
//! Ebds a Transfer (one, roots or list) by recording its result
Standard_EXPORT void EndTransfer();
//! Prepares the Transfer. Also can act on the Actor or change the
//! TransientProcess if required.
//! Should not set the Actor into the TransientProcess, it is done
//! by caller. The provided default does nothing.
Standard_EXPORT virtual void PrepareTransfer();
//! Transfers all Root Entities which are recognized as Geom-Topol
//! The result will be a list of Shapes.
//! This method calls user redefinable PrepareTransfer
//! Remark : former result is cleared
Standard_EXPORT virtual void TransferRoots(const Message_ProgressRange& theProgress = Message_ProgressRange());
//! Transfers an Entity given its rank in the Model (Root or not)
//! Returns True if it is recognized as Geom-Topol.
//! (But it can have failed : see IsDone)
Standard_EXPORT virtual Standard_Boolean Transfer (const Standard_Integer num,
const Message_ProgressRange& theProgress = Message_ProgressRange());
//! Transfers a list of Entities (only the ones also in the Model)
//! Remark : former result is cleared
Standard_EXPORT virtual void TransferList (const Handle(TColStd_HSequenceOfTransient)& list,
const Message_ProgressRange& theProgress = Message_ProgressRange());
//! Returns True if the LAST Transfer/TransferRoots was a success
Standard_EXPORT Standard_Boolean IsDone() const;
//! Returns the count of produced Shapes (roots)
Standard_EXPORT Standard_Integer NbShapes() const;
//! Returns the complete list of produced Shapes
Standard_EXPORT Handle(TopTools_HSequenceOfShape) Shapes() const;
//! Returns a Shape given its rank, by default the first one
Standard_EXPORT const TopoDS_Shape& Shape (const Standard_Integer num = 1) const;
//! Returns a Shape produced from a given entity (if it was
//! individually transferred or if an intermediate result is
//! known). If no Shape is bound with <ent>, returns a Null Shape
//! Warning : Runs on the last call to Transfer,TransferRoots,TransferList
Standard_EXPORT TopoDS_Shape ShapeResult (const Handle(Standard_Transient)& ent) const;
//! Returns a unique Shape for the result :
//! - a void Shape (type = SHAPE) if result is empty
//! - a simple Shape if result has only one : returns this one
//! - a Compound if result has more than one Shape
Standard_EXPORT TopoDS_Shape OneShape() const;
//! Returns the count of produced Transient Results (roots)
Standard_EXPORT Standard_Integer NbTransients() const;
//! Returns the complete list of produced Transient Results
Standard_EXPORT Handle(TColStd_HSequenceOfTransient) Transients() const;
//! Returns a Transient Root Result, given its rank (by default
//! the first one)
Standard_EXPORT Handle(Standard_Transient) Transient (const Standard_Integer num = 1) const;
//! Checks the Result of last Transfer (individual or roots, no
//! cumulation on several transfers). Returns True if NO fail
//! occurred during Transfer (queries the TransientProcess)
Standard_EXPORT Standard_Boolean CheckStatusResult (const Standard_Boolean withprints) const;
//! Checks the Result of last Transfer (individual or roots, no
//! cumulation on several transfers) and returns the produced list
Standard_EXPORT Interface_CheckIterator CheckListResult() const;
//! Returns the TransientProcess. It records information about
//! the very last transfer done. Null if no transfer yet done.
//! Can be used for queries more accurate than the default ones.
Standard_EXPORT Handle(Transfer_TransientProcess) TransientProcess() const;
Standard_EXPORT virtual ~TransferBRep_Reader();
protected:
Standard_Boolean theDone;
Handle(Transfer_TransientProcess) theProc;
private:
Handle(Interface_Protocol) theProto;
Handle(Transfer_ActorOfTransientProcess) theActor;
Handle(Interface_InterfaceModel) theModel;
Standard_Integer theFilest;
Standard_Boolean theNewpr;
Handle(TopTools_HSequenceOfShape) theShapes;
Handle(TColStd_HSequenceOfTransient) theTransi;
};
#endif // _TransferBRep_Reader_HeaderFile

View File

@@ -1,26 +0,0 @@
// Created on: 1994-10-03
// Created by: Christian CAILLET
// Copyright (c) 1994-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.
#ifndef TransferBRep_SequenceOfTransferResultInfo_HeaderFile
#define TransferBRep_SequenceOfTransferResultInfo_HeaderFile
#include <TransferBRep_TransferResultInfo.hxx>
#include <NCollection_Sequence.hxx>
typedef NCollection_Sequence<Handle(TransferBRep_TransferResultInfo)> TransferBRep_SequenceOfTransferResultInfo;
#endif

View File

@@ -11,6 +11,7 @@
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <TransferBRep_ShapeBinder.hxx>
#include <TopoDS.hxx>
#include <TopoDS_Compound.hxx>
@@ -22,41 +23,150 @@
#include <TopoDS_Solid.hxx>
#include <TopoDS_Vertex.hxx>
#include <TopoDS_Wire.hxx>
#include <TransferBRep_ShapeBinder.hxx>
#include <TransferBRep_ShapeInfo.hxx>
IMPLEMENT_STANDARD_RTTIEXT(TransferBRep_ShapeBinder,TransferBRep_BinderOfShape)
IMPLEMENT_STANDARD_RTTIEXT(TransferBRep_ShapeBinder, Transfer_Binder)
TransferBRep_ShapeBinder::TransferBRep_ShapeBinder () { }
//=======================================================================
//function : Value
//purpose :
//=======================================================================
TransferBRep_ShapeBinder::TransferBRep_ShapeBinder() {}
TransferBRep_ShapeBinder::TransferBRep_ShapeBinder (const TopoDS_Shape& shape)
: TransferBRep_BinderOfShape (shape) { }
//=======================================================================
//function : Value
//purpose :
//=======================================================================
TransferBRep_ShapeBinder::TransferBRep_ShapeBinder(const TopoDS_Shape& shape)
: theres(shape)
{
SetResultPresent();
}
TopAbs_ShapeEnum TransferBRep_ShapeBinder::ShapeType () const
//=======================================================================
//function : Value
//purpose :
//=======================================================================
TopAbs_ShapeEnum TransferBRep_ShapeBinder::ShapeType() const
{
if (!HasResult()) return TopAbs_SHAPE;
return Result().ShapeType();
}
TopoDS_Vertex TransferBRep_ShapeBinder::Vertex() const
{ return TopoDS::Vertex(Result()); }
//=======================================================================
//function : Value
//purpose :
//=======================================================================
TopoDS_Vertex TransferBRep_ShapeBinder::Vertex() const
{
return TopoDS::Vertex(Result());
}
TopoDS_Edge TransferBRep_ShapeBinder::Edge() const
{ return TopoDS::Edge(Result()); }
//=======================================================================
//function : Value
//purpose :
//=======================================================================
TopoDS_Edge TransferBRep_ShapeBinder::Edge() const
{
return TopoDS::Edge(Result());
}
TopoDS_Wire TransferBRep_ShapeBinder::Wire() const
{ return TopoDS::Wire(Result()); }
//=======================================================================
//function : Value
//purpose :
//=======================================================================
TopoDS_Wire TransferBRep_ShapeBinder::Wire() const
{
return TopoDS::Wire(Result());
}
TopoDS_Face TransferBRep_ShapeBinder::Face() const
{ return TopoDS::Face(Result()); }
//=======================================================================
//function : Value
//purpose :
//=======================================================================
TopoDS_Face TransferBRep_ShapeBinder::Face() const
{
return TopoDS::Face(Result());
}
TopoDS_Shell TransferBRep_ShapeBinder::Shell() const
{ return TopoDS::Shell(Result()); }
//=======================================================================
//function : Value
//purpose :
//=======================================================================
TopoDS_Shell TransferBRep_ShapeBinder::Shell() const
{
return TopoDS::Shell(Result());
}
TopoDS_Solid TransferBRep_ShapeBinder::Solid() const
{ return TopoDS::Solid(Result()); }
//=======================================================================
//function : Value
//purpose :
//=======================================================================
TopoDS_Solid TransferBRep_ShapeBinder::Solid() const
{
return TopoDS::Solid(Result());
}
TopoDS_CompSolid TransferBRep_ShapeBinder::CompSolid() const
{ return TopoDS::CompSolid(Result()); }
//=======================================================================
//function : Value
//purpose :
//=======================================================================
TopoDS_CompSolid TransferBRep_ShapeBinder::CompSolid() const
{
return TopoDS::CompSolid(Result());
}
TopoDS_Compound TransferBRep_ShapeBinder::Compound() const
{ return TopoDS::Compound(Result()); }
//=======================================================================
//function : Value
//purpose :
//=======================================================================
TopoDS_Compound TransferBRep_ShapeBinder::Compound() const
{
return TopoDS::Compound(Result());
}
//=======================================================================
//function : Value
//purpose :
//=======================================================================
Handle(Standard_Type) TransferBRep_ShapeBinder::ResultType() const
{
return TransferBRep_ShapeInfo::Type(theres);
}
//=======================================================================
//function : Value
//purpose :
//=======================================================================
Standard_CString TransferBRep_ShapeBinder::ResultTypeName() const
{
return TransferBRep_ShapeInfo::TypeName(theres);
}
//=======================================================================
//function : Value
//purpose :
//=======================================================================
void TransferBRep_ShapeBinder::SetResult(const TopoDS_Shape& res)
{
SetResultPresent();
theres = res;
}
//=======================================================================
//function : Value
//purpose :
//=======================================================================
const TopoDS_Shape& TransferBRep_ShapeBinder::Result() const
{
return theres;
}
//=======================================================================
//function : Value
//purpose :
//=======================================================================
TopoDS_Shape& TransferBRep_ShapeBinder::CResult()
{
SetResultPresent(); return theres;
}

View File

@@ -19,10 +19,10 @@
#include <Standard.hxx>
#include <Standard_Type.hxx>
#include <TransferBRep_BinderOfShape.hxx>
#include <TopAbs_ShapeEnum.hxx>
class TopoDS_Shape;
#include <TopoDS_Shape.hxx>
#include <Transfer_Binder.hxx>
class TopoDS_Vertex;
class TopoDS_Edge;
class TopoDS_Wire;
@@ -32,18 +32,16 @@ class TopoDS_Solid;
class TopoDS_CompSolid;
class TopoDS_Compound;
class TransferBRep_ShapeBinder;
DEFINE_STANDARD_HANDLE(TransferBRep_ShapeBinder, TransferBRep_BinderOfShape)
DEFINE_STANDARD_HANDLE(TransferBRep_ShapeBinder, Transfer_Binder)
//! A ShapeBinder is a BinderOfShape with some additional services
//! to cast the Result under various kinds of Shapes
class TransferBRep_ShapeBinder : public TransferBRep_BinderOfShape
class TransferBRep_ShapeBinder : public Transfer_Binder
{
public:
//! Creates an empty ShapeBinder
Standard_EXPORT TransferBRep_ShapeBinder();
@@ -69,27 +67,31 @@ public:
Standard_EXPORT TopoDS_Compound Compound() const;
//! Returns the Type permitted for the Result, i.e. the Type
//! of the Parameter Class <Shape from TopoDS> (statically defined)
Standard_EXPORT Handle(Standard_Type) ResultType() const Standard_OVERRIDE;
//! Returns the Type Name computed for the Result (dynamic)
Standard_EXPORT Standard_CString ResultTypeName() const Standard_OVERRIDE;
//! Defines the Result
Standard_EXPORT void SetResult(const TopoDS_Shape& res);
DEFINE_STANDARD_RTTIEXT(TransferBRep_ShapeBinder,TransferBRep_BinderOfShape)
//! Returns the defined Result, if there is one
Standard_EXPORT const TopoDS_Shape& Result() const;
//! Returns the defined Result, if there is one, and allows to
//! change it (avoids Result + SetResult).
//! Admits that Result can be not yet defined
//! Warning : a call to CResult causes Result to be known as defined
Standard_EXPORT TopoDS_Shape& CResult();
DEFINE_STANDARD_RTTIEXT(TransferBRep_ShapeBinder, Transfer_Binder)
protected:
private:
TopoDS_Shape theres;
};
#endif // _TransferBRep_ShapeBinder_HeaderFile

View File

@@ -23,23 +23,52 @@
#include <TransferBRep_ShapeInfo.hxx>
#include <Transfer_Finder.hxx>
//=======================================================================
//function : TransferBRep_ShapeMapper
//purpose :
//=======================================================================
TransferBRep_ShapeMapper::TransferBRep_ShapeMapper(const TopoDS_Shape& akey)
: theval(akey)
{
SetHashCode(TopTools_ShapeMapHasher::HashCode(akey, IntegerLast()));
}
//=======================================================================
//function : Value
//purpose :
//=======================================================================
const TopoDS_Shape& TransferBRep_ShapeMapper::Value() const
{
return theval;
}
//=======================================================================
//function : Equates
//purpose :
//=======================================================================
Standard_Boolean TransferBRep_ShapeMapper::Equates(const Handle(Transfer_Finder)& other) const
{
if (other.IsNull()) return Standard_False;
if (GetHashCode() != other->GetHashCode()) return Standard_False;
if (other->DynamicType() != DynamicType()) return Standard_False;
Handle(TransferBRep_ShapeMapper) another = Handle(TransferBRep_ShapeMapper)::DownCast(other);
return TopTools_ShapeMapHasher::IsEqual(theval, another->Value());
}
//=======================================================================
//function : ValueType
//purpose :
//=======================================================================
Handle(Standard_Type) TransferBRep_ShapeMapper::ValueType() const
{
return TransferBRep_ShapeInfo::Type(theval);
}
#define TheKey TopoDS_Shape
#define TheKey_hxx <TopoDS_Shape.hxx>
#define TheHasher TopTools_ShapeMapHasher
#define TheHasher_hxx <TopTools_ShapeMapHasher.hxx>
#define TheInfo TransferBRep_ShapeInfo
#define TheInfo_hxx <TransferBRep_ShapeInfo.hxx>
#define Transfer_Mapper TransferBRep_ShapeMapper
#define Transfer_Mapper_hxx <TransferBRep_ShapeMapper.hxx>
#define Handle_Transfer_Mapper Handle(TransferBRep_ShapeMapper)
#include <Transfer_Mapper.gxx>
//=======================================================================
//function : ValueTypeName
//purpose :
//=======================================================================
Standard_CString TransferBRep_ShapeMapper::ValueTypeName() const
{
return TransferBRep_ShapeInfo::TypeName(theval);
}

View File

@@ -1,5 +1,3 @@
XSControl.cxx
XSControl.hxx
XSControl_ConnectedShapes.cxx
XSControl_ConnectedShapes.hxx
XSControl_Controller.cxx
@@ -14,10 +12,6 @@ XSControl_TransferReader.cxx
XSControl_TransferReader.hxx
XSControl_TransferWriter.cxx
XSControl_TransferWriter.hxx
XSControl_Utils.cxx
XSControl_Utils.hxx
XSControl_Vars.cxx
XSControl_Vars.hxx
XSControl_WorkSession.cxx
XSControl_WorkSession.hxx
XSControl_Writer.cxx

View File

@@ -1,32 +0,0 @@
// 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.
#include <XSControl.hxx>
#include <IFSelect_SessionPilot.hxx>
#include <XSControl_Vars.hxx>
#include <XSControl_WorkSession.hxx>
Handle(XSControl_WorkSession) XSControl::Session
(const Handle(IFSelect_SessionPilot)& pilot)
{ return Handle(XSControl_WorkSession)::DownCast(pilot->Session()); }
Handle(XSControl_Vars) XSControl::Vars
(const Handle(IFSelect_SessionPilot)& pilot)
{
Handle(XSControl_Vars) avars = new XSControl_Vars;;
Handle(XSControl_WorkSession) WS = XSControl::Session(pilot);
//if (!WS.IsNull()) avars = WS->Vars();
return avars;
}

View File

@@ -1,48 +0,0 @@
// Created on: 1995-03-13
// Created by: Christian CAILLET
// 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.
#ifndef _XSControl_HeaderFile
#define _XSControl_HeaderFile
#include <Standard.hxx>
#include <Standard_DefineAlloc.hxx>
#include <Standard_Handle.hxx>
class XSControl_WorkSession;
class IFSelect_SessionPilot;
class XSControl_Vars;
//! This package provides complements to IFSelect & Co for
//! control of a session
class XSControl
{
public:
DEFINE_STANDARD_ALLOC
//! Returns the WorkSession of a SessionPilot, but casts it as
//! from XSControl : it then gives access to Control & Transfers
Standard_EXPORT static Handle(XSControl_WorkSession) Session (const Handle(IFSelect_SessionPilot)& pilot);
//! Returns the Vars of a SessionPilot, it is brought by Session
//! it provides access to external variables
Standard_EXPORT static Handle(XSControl_Vars) Vars (const Handle(IFSelect_SessionPilot)& pilot);
};
#endif // _XSControl_HeaderFile

View File

@@ -45,7 +45,6 @@
#include <TransferBRep_ShapeBinder.hxx>
#include <XSControl_Controller.hxx>
#include <XSControl_TransferReader.hxx>
#include <XSControl_Utils.hxx>
#include <Message.hxx>
#include <stdio.h>
@@ -395,8 +394,7 @@ TopoDS_Shape XSControl_TransferReader::ShapeResult
if (res.IsNull()) return tres;
Handle(Transfer_ResultFromTransient) mres = res->MainResult();
if (mres.IsNull()) return tres;
XSControl_Utils xu;
TopoDS_Shape sh = xu.BinderShape (mres->Binder());
TopoDS_Shape sh = TransferBRep::ShapeResult(mres->Binder());
// Ouh la vilaine verrue
Standard_Real tolang = Interface_Static::RVal("read.encoderegularity.angle");
@@ -444,12 +442,11 @@ Handle(Standard_Transient) XSControl_TransferReader::EntityFromResult
{
Handle(Standard_Transient) nulh;
// cas de la shape
XSControl_Utils xu;
TopoDS_Shape sh = xu.BinderShape (res);
if (!sh.IsNull()) return EntityFromShapeResult (sh,mode);
Handle(Transfer_Binder) abinder;
DeclareAndCast(Transfer_Binder,binder,res);
TopoDS_Shape sh = TransferBRep::ShapeResult(binder);
if (!sh.IsNull()) return EntityFromShapeResult (sh,mode);
Standard_Integer i,j,nb;
if (mode == 0 || mode == 1) {
@@ -511,7 +508,6 @@ Handle(Standard_Transient) XSControl_TransferReader::EntityFromShapeResult
if (res.IsNull()) return nulh;
Standard_Integer i,j,nb;
XSControl_Utils xu;
if (mode == 0 || mode == 1 || mode == -1) {
// on regarde dans le TransientProcess
if (!myTP.IsNull()) {
@@ -548,7 +544,7 @@ Handle(Standard_Transient) XSControl_TransferReader::EntityFromShapeResult
for (ir = 1; ir <= nr; ir ++) {
DeclareAndCast(Transfer_ResultFromTransient,rft,list->Value(ir));
if (rft.IsNull()) continue;
TopoDS_Shape sh = xu.BinderShape (rft->Binder());
TopoDS_Shape sh = TransferBRep::ShapeResult(rft->Binder());
if (!sh.IsNull() && sh == res) return rft->Start();
}
@@ -579,7 +575,6 @@ Handle(TColStd_HSequenceOfTransient) XSControl_TransferReader::EntitiesFromShape
// A present, recherche et enregistrement
XSControl_Utils xu;
if (mode == 0 || mode == 1) {
// on regarde dans le TransientProcess
if (!myTP.IsNull()) {
@@ -587,7 +582,7 @@ Handle(TColStd_HSequenceOfTransient) XSControl_TransferReader::EntitiesFromShape
for (j = 1; j <= nb; j ++) {
i = (mode == 0 ? myModel->Number (myTP->Root(j)) : j);
if (i == 0) continue;
TopoDS_Shape sh = xu.BinderShape (myTP->MapItem(i));
TopoDS_Shape sh = TransferBRep::ShapeResult(myTP->MapItem(i));
if (!sh.IsNull() && shapes.Contains(sh)) {
lt->Append (myTP->Mapped(i));
j=nb; //skl (for looking for entities in checkbrep)
@@ -609,7 +604,7 @@ Handle(TColStd_HSequenceOfTransient) XSControl_TransferReader::EntitiesFromShape
for (ir = 1; ir <= nr; ir ++) {
DeclareAndCast(Transfer_ResultFromTransient,rft,list->Value(i));
if (rft.IsNull()) continue;
TopoDS_Shape sh = xu.BinderShape (rft->Binder());
TopoDS_Shape sh = TransferBRep::ShapeResult(rft->Binder());
if (!sh.IsNull() && shapes.Contains(sh)) lt->Append (rft->Start());
}

View File

@@ -20,12 +20,12 @@
#include <Standard_Failure.hxx>
#include <Standard_Transient.hxx>
#include <Standard_Type.hxx>
#include <TransferBRep.hxx>
#include <Transfer_ActorOfFinderProcess.hxx>
#include <Transfer_SimpleBinderOfTransient.hxx>
#include <Transfer_TransientMapper.hxx>
#include <XSControl_Controller.hxx>
#include <XSControl_TransferWriter.hxx>
#include <XSControl_Utils.hxx>
#include <ShapeUpgrade_RemoveLocations.hxx>
IMPLEMENT_STANDARD_RTTIEXT(XSControl_TransferWriter,Standard_Transient)
@@ -72,8 +72,9 @@ void XSControl_TransferWriter::PrintStats (const Standard_Integer , const Standa
Standard_Boolean XSControl_TransferWriter::RecognizeTransient (const Handle(Standard_Transient)& obj)
{
if (myController.IsNull()) return Standard_False;
XSControl_Utils xu;
TopoDS_Shape sh = xu.BinderShape (obj);
Handle(Transfer_Binder) aBinder = Handle(Transfer_Binder)::DownCast(obj);
TopoDS_Shape sh = TransferBRep::ShapeResult(aBinder);
if (!sh.IsNull()) return RecognizeShape (sh);
return myController->RecognizeWriteTransient (obj,myTransferMode);
}

View File

@@ -1,582 +0,0 @@
// 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.
#include <BRep_Builder.hxx>
#include <BRepTools.hxx>
#include <Interface_HArray1OfHAsciiString.hxx>
#include <Interface_Macros.hxx>
#include <Interface_MSG.hxx>
#include <Message.hxx>
#include <Message_Messenger.hxx>
#include <Standard_Transient.hxx>
#include <Standard_TypeMismatch.hxx>
#include <TCollection_AsciiString.hxx>
#include <TCollection_ExtendedString.hxx>
#include <TCollection_HAsciiString.hxx>
#include <TCollection_HExtendedString.hxx>
#include <TColStd_HArray1OfTransient.hxx>
#include <TColStd_HSequenceOfAsciiString.hxx>
#include <TColStd_HSequenceOfExtendedString.hxx>
#include <TopExp_Explorer.hxx>
#include <TopoDS_Compound.hxx>
#include <TopoDS_HShape.hxx>
#include <TopoDS_Iterator.hxx>
#include <TopoDS_Shape.hxx>
#include <TopoDS_Shell.hxx>
#include <TopoDS_Wire.hxx>
#include <Transfer_SimpleBinderOfTransient.hxx>
#include <TransferBRep.hxx>
#include <TransferBRep_ShapeBinder.hxx>
#include <TransferBRep_ShapeMapper.hxx>
#include <XSControl_Utils.hxx>
static TCollection_AsciiString bufasc;
static TCollection_ExtendedString bufext;
static const Standard_ExtString voidext = { 0 };
XSControl_Utils::XSControl_Utils () { }
// #########################################################
// ####### Fonctions de TRACE #######
void XSControl_Utils::TraceLine (const Standard_CString line) const
{
Message_Messenger::StreamBuffer sout = Message::SendInfo();
sout<<line<<std::endl;
}
void XSControl_Utils::TraceLines (const Handle(Standard_Transient)& lines) const
{
Message_Messenger::StreamBuffer sout = Message::SendInfo();
Standard_Integer i,nb;
DeclareAndCast(TColStd_HSequenceOfHAsciiString,linha,lines);
if (!linha.IsNull()) {
nb = linha->Length();
for (i = 1; i <= nb; i ++)
if (!linha->Value(i).IsNull()) sout<<linha->Value(i)->ToCString()<<std::endl;
return;
}
DeclareAndCast(TColStd_HSequenceOfAsciiString,lina,lines);
if (!lina.IsNull()) {
nb = lina->Length();
for (i = 1; i <= nb; i ++)
sout<<lina->Value(i).ToCString()<<std::endl;
return;
}
DeclareAndCast(TColStd_HSequenceOfHExtendedString,linhe,lines);
if (!linhe.IsNull()) {
nb = linhe->Length();
for (i = 1; i <= nb; i ++)
if (!linhe->Value(i).IsNull())
sout << linhe->Value(i)->String() << std::endl;
return;
}
DeclareAndCast(TColStd_HSequenceOfExtendedString,linee,lines);
if (!linee.IsNull()) {
nb = linee->Length();
for (i = 1; i <= nb; i ++)
sout << linee->Value(i) << std::endl;
return;
}
DeclareAndCast(TCollection_HAsciiString,lin1a,lines);
if (!lin1a.IsNull()) sout<<lin1a->String();
DeclareAndCast(TCollection_HExtendedString,lin1e,lines);
if (!lin1e.IsNull()) sout<<lin1e->String();
}
// #########################################################
// ####### TRANSIENT : Quelques acces de base #######
Standard_Boolean XSControl_Utils::IsKind
(const Handle(Standard_Transient)& item, const Handle(Standard_Type)& what) const
{
if (item.IsNull()) return Standard_False;
if (what.IsNull()) return Standard_False;
return item->IsKind(what);
}
Standard_CString XSControl_Utils::TypeName
(const Handle(Standard_Transient)& item, const Standard_Boolean nopk) const
{
if (item.IsNull()) return "";
DeclareAndCast(Standard_Type,atype,item);
if (atype.IsNull()) atype = item->DynamicType();
Standard_CString tn = atype->Name();
if (!nopk) return tn;
for (int i = 0; tn[i] != '\0'; i ++) {
if (tn[i] == '_') return &tn[i+1];
}
return tn;
}
// ####### TRANSIENT : Fonctions de liste #######
Handle(Standard_Transient) XSControl_Utils::TraValue
(const Handle(Standard_Transient)& seqval, const Standard_Integer num) const
{
Handle(Standard_Transient) val;
if (num < 1) return val;
if (seqval.IsNull()) return val;
DeclareAndCast(TColStd_HSequenceOfHAsciiString,seqs,seqval);
if (!seqs.IsNull())
{ if (num <= seqs->Length()) val = seqs->Value(num); return val; }
DeclareAndCast(TColStd_HSequenceOfTransient,seqt,seqval);
if (!seqt.IsNull())
{ if (num <= seqt->Length()) val = seqt->Value(num); return val; }
// throw Standard_TypeMismatch("XSControl_Utils::SeqTraValue");
return val;
}
Handle(TColStd_HSequenceOfTransient) XSControl_Utils::NewSeqTra () const
{ return new TColStd_HSequenceOfTransient(); }
void XSControl_Utils::AppendTra
(const Handle(TColStd_HSequenceOfTransient)& seqval,
const Handle(Standard_Transient)& traval) const
{ seqval->Append (traval); }
// ####### DATES #######
Standard_CString XSControl_Utils::DateString
(const Standard_Integer yy, const Standard_Integer mm,
const Standard_Integer dd, const Standard_Integer hh,
const Standard_Integer mn, const Standard_Integer ss) const
{
char ladate[50] = {};
Interface_MSG::TDate (ladate, yy,mm,dd,hh,mn,ss);
bufasc.Clear(); bufasc.AssignCat(ladate);
return bufasc.ToCString();
}
void XSControl_Utils::DateValues
(const Standard_CString text,
Standard_Integer& yy, Standard_Integer& mm, Standard_Integer& dd,
Standard_Integer& hh, Standard_Integer& mn, Standard_Integer& ss) const
{ Interface_MSG::NDate (text, yy,mm,dd,hh,mn,ss); }
// ##########################################################
// ####### STRING : Ascii de base #######
Standard_CString XSControl_Utils::ToCString
(const Handle(TCollection_HAsciiString)& strval) const
{
//JR/Hp
Standard_CString astr = (Standard_CString ) (strval.IsNull() ? "" : strval->ToCString());
return astr ;
// return (strval.IsNull() ? "" : strval->ToCString());
}
Standard_CString XSControl_Utils::ToCString
(const TCollection_AsciiString& strval) const
{ return strval.ToCString(); }
Handle(TCollection_HAsciiString) XSControl_Utils::ToHString
(const Standard_CString strcon) const
{ return new TCollection_HAsciiString(strcon); }
TCollection_AsciiString XSControl_Utils::ToAString
(const Standard_CString strcon) const
{ return TCollection_AsciiString(strcon); }
// ####### STRING : Extended de base #######
Standard_ExtString XSControl_Utils::ToEString
(const Handle(TCollection_HExtendedString)& strval) const
{ return (strval.IsNull() ? voidext : strval->ToExtString()); }
Standard_ExtString XSControl_Utils::ToEString
(const TCollection_ExtendedString& strval) const
{ return strval.ToExtString(); }
Handle(TCollection_HExtendedString) XSControl_Utils::ToHString
(const Standard_ExtString strcon) const
{ return new TCollection_HExtendedString(strcon); }
TCollection_ExtendedString XSControl_Utils::ToXString
(const Standard_ExtString strcon) const
{ return TCollection_ExtendedString(strcon); }
// ####### STRING : Ascii <-> Extended #######
Standard_ExtString XSControl_Utils::AsciiToExtended (const Standard_CString str) const
{
bufext.Clear(); bufext = TCollection_ExtendedString (str);
return bufext.ToExtString();
}
Standard_Boolean XSControl_Utils::IsAscii (const Standard_ExtString str) const
{
bufext.Clear(); bufext.AssignCat (str);
return bufext.IsAscii();
}
Standard_CString XSControl_Utils::ExtendedToAscii (const Standard_ExtString str) const
{
bufext.Clear(); bufext.AssignCat (str); bufasc.Clear();
Standard_Integer i, nb = bufext.Length();
for (i = 1; i <= nb; i ++) {
int unext = bufext.Value(i);
unext = unext & 127;
char uncar = char(unext);
bufasc.AssignCat (uncar);
}
return bufasc.ToCString();
}
// ####### STRING : LISTES #######
Standard_CString XSControl_Utils::CStrValue
(const Handle(Standard_Transient)& list, const Standard_Integer num) const
{
DeclareAndCast(TColStd_HSequenceOfHAsciiString,linha,list);
if (!linha.IsNull()) {
//JR/Hp
Standard_CString astr = (Standard_CString )
(num > linha->Length() ? "" : linha->Value(num)->ToCString());
return astr ;
// return (num > linha->Length() ? "" : linha->Value(num)->ToCString());
}
DeclareAndCast(TColStd_HSequenceOfAsciiString,lina,list);
if (!lina.IsNull()) {
//JR/Hp
Standard_CString astr = (Standard_CString )
(num > lina->Length() ? "" : lina->Value(num).ToCString());
return astr ;
// return (num > lina->Length() ? "" : lina->Value(num).ToCString());
}
DeclareAndCast(TColStd_HSequenceOfHExtendedString,linhe,list);
if (!linhe.IsNull()) {
//JR/Hp
Standard_CString astr = (Standard_CString )
(num > linhe->Length() ? "" : ExtendedToAscii(linhe->Value(num)->ToExtString()));
return astr ;
// return (num > linhe->Length() ? "" : ExtendedToAscii(linhe->Value(num)->ToExtString()));
}
DeclareAndCast(TColStd_HSequenceOfExtendedString,linee,list);
if (!linee.IsNull()) {
//JR/Hp
Standard_CString astr = (Standard_CString )
(num > linee->Length() ? "" : ExtendedToAscii(linee->Value(num).ToExtString()));
return astr ;
// return (num > linee->Length() ? "" : ExtendedToAscii(linee->Value(num).T
}
DeclareAndCast(TCollection_HAsciiString,lin1a,list);
if (!lin1a.IsNull()) return lin1a->ToCString();
DeclareAndCast(TCollection_HExtendedString,lin1e,list);
if (!lin1e.IsNull()) return ExtendedToAscii(lin1e->ToExtString());
return "";
}
Standard_ExtString XSControl_Utils::EStrValue
(const Handle(Standard_Transient)& list, const Standard_Integer num) const
{
DeclareAndCast(TColStd_HSequenceOfHAsciiString,linha,list);
if (!linha.IsNull()) return
(num > linha->Length() ? voidext : AsciiToExtended(linha->Value(num)->ToCString()));
DeclareAndCast(TColStd_HSequenceOfAsciiString,lina,list);
if (!lina.IsNull())
(num > lina->Length() ? voidext : AsciiToExtended(lina->Value(num).ToCString()));
DeclareAndCast(TColStd_HSequenceOfHExtendedString,linhe,list);
if (!linhe.IsNull()) return
(num > linhe->Length() ? voidext : linhe->Value(num)->ToExtString());
DeclareAndCast(TColStd_HSequenceOfExtendedString,linee,list);
if (!linee.IsNull()) return
(num > linee->Length() ? voidext : linee->Value(num).ToExtString());
DeclareAndCast(TCollection_HAsciiString,lin1a,list);
if (!lin1a.IsNull()) return AsciiToExtended(lin1a->ToCString());
DeclareAndCast(TCollection_HExtendedString,lin1e,list);
if (!lin1e.IsNull()) return lin1e->ToExtString();
return voidext;
}
Handle(TColStd_HSequenceOfHAsciiString) XSControl_Utils::NewSeqCStr () const
{ return new TColStd_HSequenceOfHAsciiString(); }
void XSControl_Utils::AppendCStr
(const Handle(TColStd_HSequenceOfHAsciiString)& seqval,
const Standard_CString strval) const
{ seqval->Append (new TCollection_HAsciiString(strval)); }
Handle(TColStd_HSequenceOfHExtendedString) XSControl_Utils::NewSeqEStr () const
{ return new TColStd_HSequenceOfHExtendedString(); }
void XSControl_Utils::AppendEStr
(const Handle(TColStd_HSequenceOfHExtendedString)& seqval,
const Standard_ExtString strval) const
{ seqval->Append (new TCollection_HExtendedString(strval)); }
// ##########################################################
// ####### SHAPES : Acces de base #######
TopoDS_Shape XSControl_Utils::CompoundFromSeq
(const Handle(TopTools_HSequenceOfShape)& seqval) const
{
BRep_Builder B;
TopoDS_Compound C;
B.MakeCompound(C);
Standard_Integer i,n = seqval->Length();
for (i = 1; i <= n ; i ++) B.Add(C,seqval->Value(i));
return C;
}
TopAbs_ShapeEnum XSControl_Utils::ShapeType
(const TopoDS_Shape& shape, const Standard_Boolean compound) const
{
if (shape.IsNull()) return TopAbs_SHAPE;
TopAbs_ShapeEnum res = shape.ShapeType();
if (!compound || res != TopAbs_COMPOUND) return res;
res = TopAbs_SHAPE;
for (TopoDS_Iterator iter(shape); iter.More(); iter.Next()) {
TopoDS_Shape sh = iter.Value();
if (sh.IsNull()) continue;
TopAbs_ShapeEnum typ = sh.ShapeType();
if (typ == TopAbs_COMPOUND) typ = ShapeType (sh,compound);
if (res == TopAbs_SHAPE) res = typ;
// Egalite : OK; Pseudo-Egalite : EDGE/WIRE ou FACE/SHELL
else if (res == TopAbs_EDGE && typ == TopAbs_WIRE) res = typ;
else if (res == TopAbs_WIRE && typ == TopAbs_EDGE) continue;
else if (res == TopAbs_FACE && typ == TopAbs_SHELL) res = typ;
else if (res == TopAbs_SHELL && typ == TopAbs_FACE) continue;
else if (res != typ) return TopAbs_COMPOUND;
}
return res;
}
TopoDS_Shape XSControl_Utils::SortedCompound
(const TopoDS_Shape& shape, const TopAbs_ShapeEnum type,
const Standard_Boolean explore, const Standard_Boolean compound) const
{
if (shape.IsNull()) return shape;
TopAbs_ShapeEnum typ = shape.ShapeType();
TopoDS_Shape sh, sh0;
Standard_Integer nb = 0;
// Compound : on le prend, soit tel quel, soit son contenu
if (typ == TopAbs_COMPOUND || typ == TopAbs_COMPSOLID) {
TopoDS_Compound C;
BRep_Builder B;
B.MakeCompound (C);
for (TopoDS_Iterator it(shape); it.More(); it.Next()) {
sh0 = SortedCompound (it.Value(),type,explore,compound);
if (sh0.IsNull()) continue;
sh = sh0;
typ = sh.ShapeType();
if (typ == TopAbs_COMPOUND && !compound) {
for (TopoDS_Iterator it2 (sh); it2.More(); it2.Next())
{ nb ++; sh = it2.Value(); B.Add (C, sh); }
}
else { nb ++; B.Add (C,sh); }
}
if (nb == 0) C.Nullify();
else if (nb == 1) return sh;
return C;
}
// Egalite : OK; Pseudo-Egalite : EDGE/WIRE ou FACE/SHELL
if (typ == type) return shape;
if (typ == TopAbs_EDGE && type == TopAbs_WIRE) {
BRep_Builder B;
TopoDS_Wire W;
B.MakeWire (W);
B.Add (W,shape); // ne passe pas ! : TopoDS::Edge(shape)
return W;
}
if (typ == TopAbs_FACE && type == TopAbs_SHELL) {
BRep_Builder B;
TopoDS_Shell S;
B.MakeShell (S);
B.Add (S,shape); // ne passe pas ! : TopoDS::Face(shape));
S.Closed (BRep_Tool::IsClosed (S));
return S;
}
// Le reste : selon exploration
if (!explore) {
TopoDS_Shape nulsh;
return nulsh;
}
// Ici, on doit explorer
// SOLID + mode COMPOUND : reconduire les SHELLs
if (typ == TopAbs_SOLID && compound) {
TopoDS_Compound C;
BRep_Builder B;
B.MakeCompound (C);
for (TopoDS_Iterator it(shape); it.More(); it.Next()) {
sh0 = SortedCompound (it.Value(),type,explore,compound);
if (sh0.IsNull()) continue;
sh = sh0;
nb ++; B.Add (C,sh);
}
if (nb == 0) C.Nullify();
else if (nb == 1) return sh;
return C;
}
// Exploration classique
TopoDS_Compound CC;
BRep_Builder BB;
BB.MakeCompound(CC);
for (TopExp_Explorer aExp (shape,type); aExp.More(); aExp.Next()) {
nb ++;
sh = aExp.Current();
BB.Add (CC,sh);
}
if (nb == 0) CC.Nullify();
else if (nb == 1) return sh;
return CC;
}
// ####### SHAPES : Liste #######
TopoDS_Shape XSControl_Utils::ShapeValue
(const Handle(TopTools_HSequenceOfShape)& seqval, const Standard_Integer num) const
{
TopoDS_Shape shape;
if (seqval.IsNull()) return shape;
if (num > 0 && num <= seqval->Length()) shape = seqval->Value(num);
return shape;
}
Handle(TopTools_HSequenceOfShape) XSControl_Utils::NewSeqShape () const
{ return new TopTools_HSequenceOfShape(); }
void XSControl_Utils::AppendShape
(const Handle(TopTools_HSequenceOfShape)& seqval, const TopoDS_Shape& shape) const
{ seqval->Append (shape); }
// ####### SHAPES <-> Transient #######
Handle(Standard_Transient) XSControl_Utils::ShapeBinder
(const TopoDS_Shape& shape, const Standard_Boolean hs) const
{ if (hs) return new TopoDS_HShape (shape);
else return new TransferBRep_ShapeBinder (shape); }
TopoDS_Shape XSControl_Utils::BinderShape
(const Handle(Standard_Transient)& tr) const
{
TopoDS_Shape sh;
DeclareAndCast(Transfer_Binder,sb,tr);
if (!sb.IsNull()) return TransferBRep::ShapeResult(sb);
DeclareAndCast(TransferBRep_ShapeMapper,sm,tr);
if (!sm.IsNull()) return sm->Value();
DeclareAndCast(TopoDS_HShape,hs,tr);
if (!hs.IsNull()) return hs->Shape();
return sh;
}
// ##########################################################
// ####### LISTES : Fonctions Generales #######
Standard_Integer XSControl_Utils::SeqLength
(const Handle(Standard_Transient)& seqval) const
{
if (seqval.IsNull()) return 0;
DeclareAndCast(TColStd_HSequenceOfHAsciiString,seqs,seqval);
if (!seqs.IsNull()) return seqs->Length();
DeclareAndCast(TColStd_HSequenceOfAsciiString,seqa,seqval);
if (!seqa.IsNull()) return seqa->Length();
DeclareAndCast(TColStd_HSequenceOfHExtendedString,seqe,seqval);
if (!seqe.IsNull()) return seqe->Length();
DeclareAndCast(TColStd_HSequenceOfHExtendedString,seqx,seqval);
if (!seqx.IsNull()) return seqx->Length();
DeclareAndCast(TColStd_HSequenceOfTransient,seqt,seqval);
if (!seqt.IsNull()) return seqt->Length();
DeclareAndCast(TopTools_HSequenceOfShape,seqh,seqval);
if (!seqh.IsNull()) return seqh->Length();
DeclareAndCast(TColStd_HSequenceOfInteger,seqi,seqval);
if (!seqi.IsNull()) return seqi->Length();
// throw Standard_TypeMismatch("XSControl_Utils::SeqLength");
return 0;
}
Handle(Standard_Transient) XSControl_Utils::SeqToArr
(const Handle(Standard_Transient)& seqval, const Standard_Integer first) const
{
Standard_Integer i,lng;
Handle(Standard_Transient) val;
if (seqval.IsNull()) return val;
DeclareAndCast(TColStd_HSequenceOfHAsciiString,seqs,seqval);
if (!seqs.IsNull()) {
lng = seqs->Length();
Handle(Interface_HArray1OfHAsciiString) arrs =
new Interface_HArray1OfHAsciiString(first,lng-first+1);
for (i = 1; i <= lng; i ++) arrs->SetValue (i-first+1,seqs->Value(i));
return arrs;
}
DeclareAndCast(TColStd_HSequenceOfTransient,seqt,seqval);
if (!seqt.IsNull()) {
lng = seqt->Length();
Handle(TColStd_HArray1OfTransient) arrt =
new TColStd_HArray1OfTransient(first,lng-first+1);
for (i = 1; i <= lng; i ++) arrt->SetValue (i-first+1,seqt->Value(i));
return arrt;
}
throw Standard_TypeMismatch("XSControl_Utils::SeqToArr");
}
Handle(Standard_Transient) XSControl_Utils::ArrToSeq
(const Handle(Standard_Transient)& arrval) const
{
Standard_Integer i,first,last;
Handle(Standard_Transient) val;
if (arrval.IsNull()) return val;
DeclareAndCast(Interface_HArray1OfHAsciiString,arrs,arrval);
if (!arrs.IsNull()) {
first = arrs->Lower();
last = arrs->Upper();
Handle(TColStd_HSequenceOfHAsciiString) seqs =
new TColStd_HSequenceOfHAsciiString();
for (i = first; i <= last; i ++) seqs->Append (arrs->Value(i));
return seqs;
}
DeclareAndCast(TColStd_HArray1OfTransient,arrt,arrval);
if (!arrt.IsNull()) {
first = arrt->Lower();
last = arrt->Upper();
Handle(TColStd_HSequenceOfTransient) seqt =
new TColStd_HSequenceOfTransient();
for (i = first; i <= last; i ++) seqt->Append (arrt->Value(i));
return seqt;
}
throw Standard_TypeMismatch("XSControl_Utils::ArrToSeq");
}
Standard_Integer XSControl_Utils::SeqIntValue
(const Handle(TColStd_HSequenceOfInteger)& seqval,
const Standard_Integer num) const
{
if (seqval.IsNull()) return 0;
return seqval->Value(num);
}

View File

@@ -1,195 +0,0 @@
// Created on: 1995-12-04
// Created by: Christian CAILLET
// 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.
#ifndef _XSControl_Utils_HeaderFile
#define _XSControl_Utils_HeaderFile
#include <Standard.hxx>
#include <Standard_DefineAlloc.hxx>
#include <Standard_Handle.hxx>
#include <Standard_CString.hxx>
#include <Standard_Type.hxx>
#include <Standard_Integer.hxx>
#include <TColStd_HSequenceOfTransient.hxx>
#include <TColStd_HSequenceOfHAsciiString.hxx>
#include <TColStd_HSequenceOfHExtendedString.hxx>
#include <TopTools_HSequenceOfShape.hxx>
#include <TopAbs_ShapeEnum.hxx>
#include <TColStd_HSequenceOfInteger.hxx>
class Standard_Transient;
class TCollection_HAsciiString;
class TCollection_AsciiString;
class TCollection_HExtendedString;
class TCollection_ExtendedString;
class TopoDS_Shape;
//! This class provides various useful utility routines, to
//! facilitate handling of most common data structures :
//! transients (type, type name ...),
//! strings (ascii or extended, pointed or handled or ...),
//! shapes (reading, writing, testing ...),
//! sequences & arrays (of strings, of transients, of shapes ...),
//! ...
//!
//! Also it gives some helps on some data structures from XSTEP,
//! such as printing on standard trace file, recignizing most
//! currently used auxiliary types (Binder,Mapper ...)
class XSControl_Utils
{
public:
DEFINE_STANDARD_ALLOC
//! the only use of this, is to allow a frontal to get one
//! distinct "Utils" set per separate engine
Standard_EXPORT XSControl_Utils();
//! Just prints a line into the current Trace File. This allows to
//! better characterise the various trace outputs, as desired.
Standard_EXPORT void TraceLine (const Standard_CString line) const;
//! Just prints a line or a set of lines into the current Trace
//! File. <lines> can be a HAscii/ExtendedString (produces a print
//! without ending line) or a HSequence or HArray1 Of ..
//! (one new line per item)
Standard_EXPORT void TraceLines (const Handle(Standard_Transient)& lines) const;
Standard_EXPORT Standard_Boolean IsKind (const Handle(Standard_Transient)& item, const Handle(Standard_Type)& what) const;
//! Returns the name of the dynamic type of an object, i.e. :
//! If it is a Type, its Name
//! If it is a object not a type, the Name of its DynamicType
//! If it is Null, an empty string
//! If <nopk> is False (D), gives complete name
//! If <nopk> is True, returns class name without package
Standard_EXPORT Standard_CString TypeName (const Handle(Standard_Transient)& item, const Standard_Boolean nopk = Standard_False) const;
Standard_EXPORT Handle(Standard_Transient) TraValue (const Handle(Standard_Transient)& list, const Standard_Integer num) const;
Standard_EXPORT Handle(TColStd_HSequenceOfTransient) NewSeqTra() const;
Standard_EXPORT void AppendTra (const Handle(TColStd_HSequenceOfTransient)& seqval, const Handle(Standard_Transient)& traval) const;
Standard_EXPORT Standard_CString DateString (const Standard_Integer yy, const Standard_Integer mm, const Standard_Integer dd, const Standard_Integer hh, const Standard_Integer mn, const Standard_Integer ss) const;
Standard_EXPORT void DateValues (const Standard_CString text, Standard_Integer& yy, Standard_Integer& mm, Standard_Integer& dd, Standard_Integer& hh, Standard_Integer& mn, Standard_Integer& ss) const;
Standard_EXPORT Standard_CString ToCString (const Handle(TCollection_HAsciiString)& strval) const;
Standard_EXPORT Standard_CString ToCString (const TCollection_AsciiString& strval) const;
Standard_EXPORT Handle(TCollection_HAsciiString) ToHString (const Standard_CString strcon) const;
Standard_EXPORT TCollection_AsciiString ToAString (const Standard_CString strcon) const;
Standard_EXPORT Standard_ExtString ToEString (const Handle(TCollection_HExtendedString)& strval) const;
Standard_EXPORT Standard_ExtString ToEString (const TCollection_ExtendedString& strval) const;
Standard_EXPORT Handle(TCollection_HExtendedString) ToHString (const Standard_ExtString strcon) const;
Standard_EXPORT TCollection_ExtendedString ToXString (const Standard_ExtString strcon) const;
Standard_EXPORT Standard_ExtString AsciiToExtended (const Standard_CString str) const;
Standard_EXPORT Standard_Boolean IsAscii (const Standard_ExtString str) const;
Standard_EXPORT Standard_CString ExtendedToAscii (const Standard_ExtString str) const;
Standard_EXPORT Standard_CString CStrValue (const Handle(Standard_Transient)& list, const Standard_Integer num) const;
Standard_EXPORT Standard_ExtString EStrValue (const Handle(Standard_Transient)& list, const Standard_Integer num) const;
Standard_EXPORT Handle(TColStd_HSequenceOfHAsciiString) NewSeqCStr() const;
Standard_EXPORT void AppendCStr (const Handle(TColStd_HSequenceOfHAsciiString)& seqval, const Standard_CString strval) const;
Standard_EXPORT Handle(TColStd_HSequenceOfHExtendedString) NewSeqEStr() const;
Standard_EXPORT void AppendEStr (const Handle(TColStd_HSequenceOfHExtendedString)& seqval, const Standard_ExtString strval) const;
//! Converts a list of Shapes to a Compound (a kind of Shape)
Standard_EXPORT TopoDS_Shape CompoundFromSeq (const Handle(TopTools_HSequenceOfShape)& seqval) const;
//! Returns the type of a Shape : true type if <compound> is False
//! If <compound> is True and <shape> is a Compound, iterates on
//! its items. If all are of the same type, returns this type.
//! Else, returns COMPOUND. If it is empty, returns SHAPE
//! For a Null Shape, returns SHAPE
Standard_EXPORT TopAbs_ShapeEnum ShapeType (const TopoDS_Shape& shape, const Standard_Boolean compound) const;
//! From a Shape, builds a Compound as follows :
//! explores it level by level
//! If <explore> is False, only COMPOUND items. Else, all items
//! Adds to the result, shapes which comply to <type>
//! + if <type> is WIRE, considers free edges (and makes wires)
//! + if <type> is SHELL, considers free faces (and makes shells)
//! If <compound> is True, gathers items in compounds which
//! correspond to starting COMPOUND,SOLID or SHELL containers, or
//! items directly contained in a Compound
Standard_EXPORT TopoDS_Shape SortedCompound (const TopoDS_Shape& shape, const TopAbs_ShapeEnum type, const Standard_Boolean explore, const Standard_Boolean compound) const;
Standard_EXPORT TopoDS_Shape ShapeValue (const Handle(TopTools_HSequenceOfShape)& seqv, const Standard_Integer num) const;
Standard_EXPORT Handle(TopTools_HSequenceOfShape) NewSeqShape() const;
Standard_EXPORT void AppendShape (const Handle(TopTools_HSequenceOfShape)& seqv, const TopoDS_Shape& shape) const;
//! Creates a Transient Object from a Shape : it is either a Binder
//! (used by functions which require a Transient but can process
//! a Shape, such as viewing functions) or a HShape (according to hs)
//! Default is a HShape
Standard_EXPORT Handle(Standard_Transient) ShapeBinder (const TopoDS_Shape& shape, const Standard_Boolean hs = Standard_True) const;
//! From a Transient, returns a Shape.
//! In fact, recognizes ShapeBinder ShapeMapper and HShape
Standard_EXPORT TopoDS_Shape BinderShape (const Handle(Standard_Transient)& tr) const;
Standard_EXPORT Standard_Integer SeqLength (const Handle(Standard_Transient)& list) const;
Standard_EXPORT Handle(Standard_Transient) SeqToArr (const Handle(Standard_Transient)& seq, const Standard_Integer first = 1) const;
Standard_EXPORT Handle(Standard_Transient) ArrToSeq (const Handle(Standard_Transient)& arr) const;
Standard_EXPORT Standard_Integer SeqIntValue (const Handle(TColStd_HSequenceOfInteger)& list, const Standard_Integer num) const;
protected:
private:
};
#endif // _XSControl_Utils_HeaderFile

View File

@@ -1,94 +0,0 @@
// 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.
#include <Geom2d_CartesianPoint.hxx>
#include <Geom2d_Curve.hxx>
#include <Geom_CartesianPoint.hxx>
#include <Geom_Geometry.hxx>
#include <Geom_Surface.hxx>
#include <gp_Pnt.hxx>
#include <gp_Pnt2d.hxx>
#include <Interface_Macros.hxx>
#include <Standard_Transient.hxx>
#include <Standard_Type.hxx>
#include <TopoDS_HShape.hxx>
#include <TopoDS_Shape.hxx>
#include <XSControl_Vars.hxx>
IMPLEMENT_STANDARD_RTTIEXT(XSControl_Vars,Standard_Transient)
XSControl_Vars::XSControl_Vars() { }
void XSControl_Vars::Set
(const Standard_CString name,
const Handle(Standard_Transient)& val)
{
thevars.Bind(name,val);
}
Handle(Standard_Transient) XSControl_Vars::Get ( Standard_CString& name) const
{
Handle(Standard_Transient) val;
if (!thevars.Find(name, val))
val.Nullify();
return val;
}
Handle(Geom_Geometry) XSControl_Vars::GetGeom ( Standard_CString& name) const
{ return GetCasted(Geom_Geometry,Get(name)); }
Handle(Geom2d_Curve) XSControl_Vars::GetCurve2d ( Standard_CString& name) const
{ return GetCasted(Geom2d_Curve,Get(name)); }
Handle(Geom_Curve) XSControl_Vars::GetCurve ( Standard_CString& name) const
{ return GetCasted(Geom_Curve,Get(name)); }
Handle(Geom_Surface) XSControl_Vars::GetSurface ( Standard_CString& name) const
{ return GetCasted(Geom_Surface,Get(name)); }
void XSControl_Vars::SetPoint (const Standard_CString name, const gp_Pnt& val)
{ Set (name, new Geom_CartesianPoint(val)); }
Standard_Boolean XSControl_Vars::GetPoint (Standard_CString& name, gp_Pnt& pnt) const
{
DeclareAndCast(Geom_CartesianPoint,val,Get(name));
if (val.IsNull()) return Standard_False;
pnt = val->Pnt();
return Standard_True;
}
void XSControl_Vars::SetPoint2d (const Standard_CString name, const gp_Pnt2d& val)
{ Set (name, new Geom2d_CartesianPoint(val)); }
Standard_Boolean XSControl_Vars::GetPoint2d (Standard_CString& name, gp_Pnt2d& pnt) const
{
DeclareAndCast(Geom2d_CartesianPoint,val,Get(name));
if (val.IsNull()) return Standard_False;
pnt = val->Pnt2d();
return Standard_True;
}
void XSControl_Vars::SetShape (const Standard_CString name, const TopoDS_Shape& val)
{ Set (name, new TopoDS_HShape(val)); }
TopoDS_Shape XSControl_Vars::GetShape (Standard_CString& name) const
{
TopoDS_Shape sh;
DeclareAndCast(TopoDS_HShape,val,Get(name));
if (!val.IsNull()) sh = val->Shape();
return sh;
}

View File

@@ -1,104 +0,0 @@
// Created on: 1998-07-22
// Created by: Christian CAILLET
// Copyright (c) 1998-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.
#ifndef _XSControl_Vars_HeaderFile
#define _XSControl_Vars_HeaderFile
#include <Standard.hxx>
#include <Standard_Type.hxx>
#include <Standard_Transient.hxx>
#include <NCollection_DataMap.hxx>
#include <TCollection_AsciiString.hxx>
class Geom_Geometry;
class Geom2d_Curve;
class Geom_Curve;
class Geom_Surface;
class gp_Pnt;
class gp_Pnt2d;
class TopoDS_Shape;
class XSControl_Vars;
DEFINE_STANDARD_HANDLE(XSControl_Vars, Standard_Transient)
//! Defines a receptacle for externally defined variables, each
//! one has a name
//!
//! I.E. a WorkSession for XSTEP is generally used inside a
//! context, which brings variables, especially shapes and
//! geometries. For instance DRAW or an application engine
//!
//! This class provides a common form for this. It also provides
//! a default implementation (locally recorded variables in a
//! dictionary), but which is aimed to be redefined
class XSControl_Vars : public Standard_Transient
{
public:
Standard_EXPORT XSControl_Vars();
Standard_EXPORT virtual void Set (const Standard_CString name, const Handle(Standard_Transient)& val);
Standard_EXPORT virtual Handle(Standard_Transient) Get (Standard_CString& name) const;
Standard_EXPORT virtual Handle(Geom_Geometry) GetGeom (Standard_CString& name) const;
Standard_EXPORT virtual Handle(Geom2d_Curve) GetCurve2d (Standard_CString& name) const;
Standard_EXPORT virtual Handle(Geom_Curve) GetCurve (Standard_CString& name) const;
Standard_EXPORT virtual Handle(Geom_Surface) GetSurface (Standard_CString& name) const;
Standard_EXPORT virtual void SetPoint (const Standard_CString name, const gp_Pnt& val);
Standard_EXPORT virtual void SetPoint2d (const Standard_CString name, const gp_Pnt2d& val);
Standard_EXPORT virtual Standard_Boolean GetPoint (Standard_CString& name, gp_Pnt& pnt) const;
Standard_EXPORT virtual Standard_Boolean GetPoint2d (Standard_CString& name, gp_Pnt2d& pnt) const;
Standard_EXPORT virtual void SetShape (const Standard_CString name, const TopoDS_Shape& val);
Standard_EXPORT virtual TopoDS_Shape GetShape (Standard_CString& name) const;
DEFINE_STANDARD_RTTIEXT(XSControl_Vars,Standard_Transient)
protected:
private:
NCollection_DataMap<TCollection_AsciiString, Handle(Standard_Transient)> thevars;
};
#endif // _XSControl_Vars_HeaderFile

View File

@@ -27,7 +27,6 @@
class XSControl_Controller;
class XSControl_TransferReader;
class XSControl_TransferWriter;
class XSControl_Vars;
class Transfer_TransientProcess;
class Interface_InterfaceModel;
class Transfer_FinderProcess;

View File

@@ -22,7 +22,6 @@
#include <TColStd_HSequenceOfTransient.hxx>
#include <Transfer_ResultFromModel.hxx>
#include <Transfer_TransientProcess.hxx>
#include <XSControl.hxx>
#include <XSControl_Controller.hxx>
#include <XSDRAW.hxx>
#include <XSDRAWBase.hxx>

View File

@@ -38,14 +38,12 @@
#include <TransferBRep.hxx>
#include <TransferBRep_ShapeListBinder.hxx>
#include <TransferBRep_ShapeMapper.hxx>
#include <XSControl.hxx>
#include <XSControl_ConnectedShapes.hxx>
#include <XSControl_Controller.hxx>
#include <XSDRAW.hxx>
#include <XSDRAWBase.hxx>
#include <XSControl_TransferReader.hxx>
#include <XSControl_TransferWriter.hxx>
#include <XSControl_Vars.hxx>
#include <XSControl_WorkSession.hxx>
//=======================================================================
@@ -618,24 +616,6 @@ static Standard_Integer XSControl_fromshape(Draw_Interpretor& theDI,
aSSC.SStream() << std::endl;
}
}
/* else {
TopoDS_Shape comp = TransferBRep::ShapeResult(bnd);
if ( ! comp.IsNull() && comp.ShapeType() < Shape.ShapeType() ) {
Standard_Boolean start = Standard_True;
for ( TopoDS_Iterator it(comp); it.More(); it.Next() ) {
Handle(Transfer_Finder) cfnd = TransferBRep::ShapeMapper (FP,it.Value());
if ( cfnd.IsNull() ) continue;
Handle(Standard_Transient) cent = FP->FindTransient (cfnd);
if ( cent.IsNull() ) continue;
if ( start )
aSSC.SStream()<<"Shape "<<arg1<<" : exported to entities ";
else aSSC.SStream() << ", ";
start = Standard_False;
XSControl::Session(pilot)->Model()->Print(cent,aSSC.SStream());
}
if ( ! start ) aSSC.SStream()<<std::endl;
}
} */
}
}
}

View File

@@ -6,7 +6,7 @@ puts ""
# Visualization - randomly directed arrows on test v3d mesh B7
##########################################################################################################
pload XSDRAW
pload XSDRAW STL
vinit
vclear

View File

@@ -1,6 +1,6 @@
# Test performance of dynamic loading / unloading of large OCCT library
set libname TKSTEP
set libname TKXDESTEP
switch -nocase [checkplatform] {
windows {set libname ${libname}.dll}

View File

@@ -1,2 +1,2 @@
pload MODELING VISUALIZATION XSDRAW
pload MODELING VISUALIZATION XSDRAW STL
vinit View1

View File

@@ -3,7 +3,7 @@ puts "OCC26566: Visualization - incorrect highlight after selection of owners wi
puts "========"
puts ""
pload VISUALIZATION MODELING XSDRAW
pload VISUALIZATION MODELING XSDRAW STL
vinit View1
# create an object with auto-highlight disabled