mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-04 13:13:25 +03:00
Integration of OCCT 6.5.0 from SVN
This commit is contained in:
27
src/ShapeProcessAPI/ShapeProcessAPI.cdl
Executable file
27
src/ShapeProcessAPI/ShapeProcessAPI.cdl
Executable file
@@ -0,0 +1,27 @@
|
||||
-- File: ShapeProcessAPI.cdl
|
||||
-- Created: Thu Jun 17 18:34:19 1999
|
||||
-- Author: data exchange team
|
||||
-- <det@doomox.nnov.matra-dtv.fr>
|
||||
---Copyright: Matra Datavision 1999
|
||||
|
||||
|
||||
package ShapeProcessAPI
|
||||
|
||||
---Purpose: Provides tools for converting shapes for data exchange
|
||||
-- between various systems (CATIA, EUCLID3 etc.)
|
||||
|
||||
uses
|
||||
|
||||
TopAbs,
|
||||
TopoDS,
|
||||
TopTools,
|
||||
Message,
|
||||
ShapeProcess,
|
||||
TCollection
|
||||
|
||||
is
|
||||
|
||||
class ApplySequence;
|
||||
---Purpose: Applies one of the sequence of calls from resource file.
|
||||
|
||||
end ShapeProcessAPI;
|
59
src/ShapeProcessAPI/ShapeProcessAPI_ApplySequence.cdl
Executable file
59
src/ShapeProcessAPI/ShapeProcessAPI_ApplySequence.cdl
Executable file
@@ -0,0 +1,59 @@
|
||||
-- File: ShapeProcessAPI_ApplySequence.cdl
|
||||
-- Created: Tue Jun 22 11:35:28 1999
|
||||
-- Author: data exchange team
|
||||
-- <det@friendox>
|
||||
---Copyright: Matra Datavision 1999
|
||||
|
||||
|
||||
class ApplySequence from ShapeProcessAPI
|
||||
|
||||
---Purpose: Applies one of the sequence read from resource file.
|
||||
|
||||
uses
|
||||
|
||||
ShapeEnum from TopAbs,
|
||||
Shape from TopoDS,
|
||||
DataMapOfShapeShape from TopTools,
|
||||
Printer from Message,
|
||||
ShapeContext from ShapeProcess,
|
||||
AsciiString from TCollection
|
||||
is
|
||||
|
||||
Create (rscName: CString; seqName: CString = "") returns ApplySequence from ShapeProcessAPI;
|
||||
---Purpose: Creates an object and loads resource file and sequence of
|
||||
-- operators given by their names.
|
||||
|
||||
Context (me: in out) returns ShapeContext from ShapeProcess;
|
||||
---C++ : return &
|
||||
---Purpose: Returns object for managing resource file and sequence of
|
||||
-- operators.
|
||||
|
||||
PrepareShape (me: in out; shape : Shape from TopoDS;
|
||||
fillmap: Boolean = Standard_False;
|
||||
until : ShapeEnum from TopAbs = TopAbs_SHAPE)
|
||||
returns Shape from TopoDS;
|
||||
---Purpose: Performs sequence of operators stored in myRsc.
|
||||
-- If <fillmap> is True adds history "shape-shape" into myMap
|
||||
-- for shape and its subshapes until level <until> (included).
|
||||
-- If <until> is TopAbs_SHAPE, all the subshapes are considered.
|
||||
|
||||
ClearMap (me: in out);
|
||||
---Purpose: Clears myMap with accumulated history.
|
||||
|
||||
Map (me) returns DataMapOfShapeShape from TopTools;
|
||||
---C++: return const &
|
||||
---Purpose: Returns myMap with accumulated history.
|
||||
|
||||
PrintPreparationResult (me);
|
||||
---Purpose: Prints result of preparation onto the messenger of the context.
|
||||
-- Note that results can be accumulated from previous preparations
|
||||
-- it method ClearMap was not called before PrepareShape.
|
||||
---Remark: At the moment outputs information only on shells and faces.
|
||||
|
||||
fields
|
||||
|
||||
myContext: ShapeContext from ShapeProcess;
|
||||
myMap : DataMapOfShapeShape from TopTools;
|
||||
mySeq : AsciiString from TCollection;
|
||||
|
||||
end ApplySequence;
|
149
src/ShapeProcessAPI/ShapeProcessAPI_ApplySequence.cxx
Executable file
149
src/ShapeProcessAPI/ShapeProcessAPI_ApplySequence.cxx
Executable file
@@ -0,0 +1,149 @@
|
||||
// File: ShapeProcessAPI_ApplySequence.cxx
|
||||
// Created: Tue Jun 22 11:41:11 1999
|
||||
// Author: data exchange team
|
||||
// <det@friendox>
|
||||
|
||||
|
||||
#include <ShapeProcessAPI_ApplySequence.ixx>
|
||||
#include <TCollection_AsciiString.hxx>
|
||||
#include <TopoDS_Iterator.hxx>
|
||||
#include <TopTools_DataMapIteratorOfDataMapOfShapeShape.hxx>
|
||||
#include <Message_Messenger.hxx>
|
||||
#include <Message_Msg.hxx>
|
||||
#include <Resource_Manager.hxx>
|
||||
#include <ShapeProcess.hxx>
|
||||
#include <ShapeProcess_OperLibrary.hxx>
|
||||
|
||||
//=======================================================================
|
||||
//function : ShapeProcessAPI_ApplySequence
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
ShapeProcessAPI_ApplySequence::ShapeProcessAPI_ApplySequence(const Standard_CString rscName,
|
||||
const Standard_CString seqName)
|
||||
{
|
||||
|
||||
myContext = new ShapeProcess_ShapeContext(rscName);
|
||||
myContext->SetDetalisation ( TopAbs_FACE );
|
||||
TCollection_AsciiString str ( seqName );
|
||||
|
||||
// initialize operators
|
||||
ShapeProcess_OperLibrary::Init ();
|
||||
|
||||
mySeq = str;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Context
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Handle(ShapeProcess_ShapeContext)& ShapeProcessAPI_ApplySequence::Context()
|
||||
{
|
||||
return myContext;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : PrepareShape
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
TopoDS_Shape ShapeProcessAPI_ApplySequence::PrepareShape(const TopoDS_Shape& shape,
|
||||
const Standard_Boolean /*fillmap*/,
|
||||
const TopAbs_ShapeEnum /*until*/)
|
||||
{
|
||||
Handle(Resource_Manager) rsc = myContext->ResourceManager();
|
||||
myContext->Init(shape);
|
||||
|
||||
TCollection_AsciiString str(mySeq);
|
||||
str += ".exec.op";
|
||||
if ( rsc->Find ( str.ToCString() ) ) {
|
||||
ShapeProcess::Perform ( myContext, mySeq.ToCString() );
|
||||
}
|
||||
|
||||
return myContext->Result();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : ClearMap
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void ShapeProcessAPI_ApplySequence::ClearMap()
|
||||
{
|
||||
//myContext->Map().Clear();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Map
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
const TopTools_DataMapOfShapeShape& ShapeProcessAPI_ApplySequence::Map() const
|
||||
{
|
||||
return myContext->Map();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : PrintPreparationResult
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void ShapeProcessAPI_ApplySequence::PrintPreparationResult () const
|
||||
{
|
||||
Standard_Integer SS = 0, SN = 0, FF = 0, FS = 0, FN = 0;
|
||||
for (TopTools_DataMapIteratorOfDataMapOfShapeShape It (myContext->Map()); It.More(); It.Next()) {
|
||||
TopoDS_Shape keyshape = It.Key(), valueshape = It.Value();
|
||||
if (keyshape.ShapeType() == TopAbs_SHELL)
|
||||
if (valueshape.IsNull()) SN++;
|
||||
else SS++;
|
||||
else if (keyshape.ShapeType() == TopAbs_FACE)
|
||||
if (valueshape.IsNull()) FN++;
|
||||
else if (valueshape.ShapeType() == TopAbs_SHELL) FS++;
|
||||
else FF++;
|
||||
}
|
||||
|
||||
Handle(Message_Messenger) aMessenger = myContext->Messenger();
|
||||
|
||||
// mapping
|
||||
Message_Msg EPMSG100 ("PrResult.Print.MSG100"); //Mapping:
|
||||
aMessenger->Send (EPMSG100, Message_Info, Standard_True);
|
||||
Message_Msg TPMSG50 ("PrResult.Print.MSG50"); // Shells:
|
||||
aMessenger->Send (TPMSG50, Message_Info, Standard_True);
|
||||
Message_Msg EPMSG110 ("PrResult.Print.MSG110"); // Result is Shell : %d
|
||||
EPMSG110.Arg (SS);
|
||||
aMessenger->Send (EPMSG110, Message_Info, Standard_True);
|
||||
Message_Msg EPMSG150 ("PrResult.Print.MSG150"); // No Result : %d
|
||||
EPMSG150.Arg (SN);
|
||||
aMessenger->Send (EPMSG150, Message_Info, Standard_True);
|
||||
|
||||
TCollection_AsciiString tmp110 (EPMSG110.Original()), tmp150 (EPMSG150.Original());
|
||||
EPMSG110.Set (tmp110.ToCString());
|
||||
EPMSG150.Set (tmp150.ToCString());
|
||||
|
||||
Message_Msg TPMSG55 ("PrResult.Print.MSG55"); // Faces:
|
||||
aMessenger->Send (TPMSG55, Message_Info, Standard_True);
|
||||
Message_Msg EPMSG115 ("PrResult.Print.MSG115"); // Result is Face : %d
|
||||
EPMSG115.Arg (FF);
|
||||
aMessenger->Send (EPMSG115, Message_Info, Standard_True);
|
||||
EPMSG110.Arg (FS);
|
||||
aMessenger->Send (EPMSG110, Message_Info, Standard_True);
|
||||
EPMSG150.Arg (FN);
|
||||
aMessenger->Send (EPMSG150, Message_Info, Standard_True);
|
||||
|
||||
// preparation ratio
|
||||
Standard_Real SPR = 1, FPR = 1;
|
||||
Standard_Integer STotalR = SS, FTotalR = FF + FS;
|
||||
Standard_Integer NbS = STotalR + SN, NbF = FTotalR + FN;
|
||||
if (NbS > 0) SPR = 1. * (NbS - SN) / NbS;
|
||||
if (NbF > 0) FPR = 1. * (NbF - FN) / NbF;
|
||||
Message_Msg PMSG200 ("PrResult.Print.MSG200"); //Preparation ratio:
|
||||
aMessenger->Send (PMSG200, Message_Info, Standard_True);
|
||||
Message_Msg PMSG205 ("PrResult.Print.MSG205"); // Shells: %d per cent
|
||||
PMSG205.Arg ((Standard_Integer) (100 * SPR));
|
||||
aMessenger->Send (PMSG205, Message_Info, Standard_True);
|
||||
Message_Msg PMSG210 ("PrResult.Print.MSG210"); // Faces : %d per cent
|
||||
PMSG210.Arg ((Standard_Integer) (100 * FPR));
|
||||
aMessenger->Send (PMSG210, Message_Info, Standard_True);
|
||||
}
|
||||
|
Reference in New Issue
Block a user