mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-14 13:30:48 +03:00
Compare commits
19 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
7bf8cf9fa5 | ||
|
2b5410a946 | ||
|
2689910506 | ||
|
9a716b8100 | ||
|
3bff555ce7 | ||
|
22b4b9c557 | ||
|
3294002e8c | ||
|
ca282cf42b | ||
|
df7e4ec695 | ||
|
8e3a8835a2 | ||
|
2d201d39d0 | ||
|
6b4fa7a257 | ||
|
63b4a36425 | ||
|
88dd51e2d4 | ||
|
188962d257 | ||
|
93a6d4548d | ||
|
669c9841b2 | ||
|
00bb121b1a | ||
|
c688fa9262 |
@@ -3,5 +3,6 @@ ModelingData TKG2d TKG3d TKGeomBase TKBRep
|
||||
ModelingAlgorithms TKGeomAlgo TKTopAlgo TKPrim TKBO TKBool TKHLR TKFillet TKOffset TKFeat TKMesh TKXMesh TKShHealing
|
||||
Visualization TKService TKV3d TKOpenGl TKOpenGles TKMeshVS TKIVtk TKD3DHost
|
||||
ApplicationFramework TKCDF TKLCAF TKCAF TKBinL TKXmlL TKBin TKXml TKStdL TKStd TKTObj TKBinTObj TKXmlTObj TKVCAF
|
||||
DataExchange TKXDE TKXSBase TKSTEPBase TKSTEPAttr TKSTEP209 TKSTEP TKIGES TKXCAF TKXDEIGES TKXDESTEP TKSTL TKVRML TKXmlXCAF TKBinXCAF TKRWMesh TKXDECascade TKExpress ExpToCasExe
|
||||
Draw TKDraw TKTopTest TKOpenGlTest TKOpenGlesTest TKD3DHostTest TKViewerTest TKXSDRAW TKDCAF TKXDEDRAW TKTObjDRAW TKQADraw TKIVtkDraw DRAWEXE
|
||||
DataExchange TKXDE TKXSBase TKXDESTEP TKXDEIGES TKXDESTL TKXDEVRML TKXDECascade TKXDEOBJ TKXDEGLTF TKXDEPLY TKXCAF TKXmlXCAF TKBinXCAF TKRWMesh
|
||||
DETools TKExpress ExpToCasExe
|
||||
Draw TKDraw TKTopTest TKOpenGlTest TKOpenGlesTest TKD3DHostTest TKViewerTest TKXSDRAW TKDCAF TKXDEDRAW TKTObjDRAW TKQADraw TKIVtkDraw DRAWEXE TKXSDRAWBase TKXSDRAWDEWrapper TKXSDRAWGLTF TKXSDRAWIGES TKXSDRAWOBJ TKXSDRAWPLY TKXSDRAWSTEP TKXSDRAWSTL TKXSDRAWVRML
|
||||
|
@@ -62,7 +62,7 @@ Administrative data, in the Global Section of the IGES file (such as the file n
|
||||
Before performing any other operation, you have to load the file using the syntax below.
|
||||
~~~~{.cpp}
|
||||
IGESControl_Reader reader;
|
||||
IFSelect_ReturnStatus stat = reader.ReadFile(“filename.igs”);
|
||||
XSControl_ReturnStatus stat = reader.ReadFile(“filename.igs”);
|
||||
~~~~
|
||||
The loading operation only loads the IGES file into computer memory; it does not translate it.
|
||||
|
||||
@@ -1125,7 +1125,7 @@ Allows writing the prepared model to a file with name *filename.igs*.
|
||||
Before performing any other operation, you must load an IGES file with:
|
||||
~~~~{.cpp}
|
||||
IGESCAFControl_Reader reader(XSDRAW::Session(), Standard_False);
|
||||
IFSelect_ReturnStatus stat = reader.ReadFile(“filename.igs”);
|
||||
XSControl_ReturnStatus stat = reader.ReadFile(“filename.igs”);
|
||||
~~~~
|
||||
Loading the file only memorizes, but does not translate the data.
|
||||
|
||||
@@ -1183,7 +1183,7 @@ aWriter.SetNameMode(mode);
|
||||
|
||||
You can perform the translation of a document by calling the function:
|
||||
~~~~{.cpp}
|
||||
IFSelect_ReturnStatus aRetSt = aWriter.Transfer(doc);
|
||||
XSControl_ReturnStatus aRetSt = aWriter.Transfer(doc);
|
||||
~~~~
|
||||
where "doc" is a variable which contains a handle to the input document for transferring and should have a type *Handle(TDocStd_Document)*.
|
||||
|
||||
@@ -1191,11 +1191,11 @@ where "doc" is a variable which contains a handle to the input document for tran
|
||||
|
||||
Write an IGES file with:
|
||||
~~~~{.cpp}
|
||||
IFSelect_ReturnStatus statw = aWriter.WriteFile("filename.igs");
|
||||
XSControl_ReturnStatus statw = aWriter.WriteFile("filename.igs");
|
||||
~~~~
|
||||
or
|
||||
~~~~{.cpp}
|
||||
IFSelect_ReturnStatus statw = writer.WriteFile (S);
|
||||
XSControl_ReturnStatus statw = writer.WriteFile (S);
|
||||
~~~~
|
||||
where S is OStream.
|
||||
|
||||
|
@@ -123,7 +123,7 @@ For further information see 2.4 Mapping STEP entities to Open CASCADE Technology
|
||||
Before performing any other operation you have to load the file with:
|
||||
~~~~{.cpp}
|
||||
STEPControl_Reader reader;
|
||||
IFSelect_ReturnStatus stat = reader.ReadFile("filename.stp");
|
||||
XSControl_ReturnStatus stat = reader.ReadFile("filename.stp");
|
||||
~~~~
|
||||
Loading the file only memorizes the data, it does not translate it.
|
||||
|
||||
@@ -1067,13 +1067,13 @@ If *TopoDS_Compound* contains any other types besides the ones mentioned in the
|
||||
In case if an OCCT shape cannot be translated according to its mode the result of translation is void.
|
||||
~~~~{.cpp}
|
||||
STEP214Control_StepModelTope mode = STEP214Control_ManifoldSolidBrep;
|
||||
IFSelect_ReturnStatus stat = writer.Transfer(shape,mode);
|
||||
XSControl_ReturnStatus stat = writer.Transfer(shape,mode);
|
||||
~~~~
|
||||
|
||||
@subsubsection occt_step_3_3_4 Writing the STEP file
|
||||
Write the STEP file with:
|
||||
~~~~{.cpp}
|
||||
IFSelect_ReturnStatus stat = writer.Write("filename.stp");
|
||||
XSControl_ReturnStatus stat = writer.Write("filename.stp");
|
||||
~~~~
|
||||
to give the file name.
|
||||
|
||||
@@ -1514,7 +1514,7 @@ In addition to the translation of shapes implemented in basic translator, it pro
|
||||
Before performing any other operation, you must load a STEP file with:
|
||||
~~~~{.cpp}
|
||||
STEPCAFControl_Reader reader(XSDRAW::Session(), Standard_False);
|
||||
IFSelect_ReturnStatus stat = reader.ReadFile("filename.stp");
|
||||
XSControl_ReturnStatus stat = reader.ReadFile("filename.stp");
|
||||
~~~~
|
||||
Loading the file only memorizes the data, it does not translate it.
|
||||
|
||||
@@ -1678,7 +1678,7 @@ aWriter.SetNameMode(mode);
|
||||
|
||||
You can perform the translation of document by calling the function:
|
||||
~~~~{.cpp}
|
||||
IFSelect_ReturnStatus aRetSt = aWriter.Transfer(doc);
|
||||
XSControl_ReturnStatus aRetSt = aWriter.Transfer(doc);
|
||||
~~~~
|
||||
where *doc* is a variable, which contains a handle to the input document for transferring and should have a type *Handle(TDocStd_Document)*.
|
||||
|
||||
@@ -1686,11 +1686,11 @@ where *doc* is a variable, which contains a handle to the input document for tr
|
||||
|
||||
Write a STEP file with:
|
||||
~~~~{.cpp}
|
||||
IFSelect_ReturnStatus statw = aWriter.WriteFile("filename.stp");
|
||||
XSControl_ReturnStatus statw = aWriter.WriteFile("filename.stp");
|
||||
~~~~
|
||||
or
|
||||
~~~~{.cpp}
|
||||
IFSelect_ReturnStatus statw = writer.WriteFile (S);
|
||||
XSControl_ReturnStatus statw = writer.WriteFile (S);
|
||||
~~~~
|
||||
where *S* is *OStream*.
|
||||
|
||||
|
@@ -1240,8 +1240,8 @@ To read a STEP file by itself, use:
|
||||
~~~~{.cpp}
|
||||
const char* theFilename = ...;
|
||||
STEPCAFControl_Reader aReader;
|
||||
IFSelect_ReturnStatus aReadStat = aReader.ReadFile (theFilename);
|
||||
if (aReadStat != IFSelect_RetDone) { .. reader/parser error .. }
|
||||
XSControl_ReturnStatus aReadStat = aReader.ReadFile (theFilename);
|
||||
if (aReadStat != XSControl_RetDone) { .. reader/parser error .. }
|
||||
// the various ways of reading a file are available here too:
|
||||
// to read it by the reader, to take it from a WorkSession ...
|
||||
Handle(TDocStd_Document) aDoc = ...;
|
||||
@@ -1278,8 +1278,8 @@ if (!aWriter.Transfer (aDoc, aMode))
|
||||
|
||||
// writing the File
|
||||
const char* theFilename = ...;
|
||||
IFSelect_ReturnStatus aStat = aWriter.Write (theFilename);
|
||||
if (aStat != IFSelect_RetDone) { .. writing failed .. }
|
||||
XSControl_ReturnStatus aStat = aWriter.Write (theFilename);
|
||||
if (aStat != XSControl_RetDone) { .. writing failed .. }
|
||||
~~~~
|
||||
|
||||
@subsection occt_xde_2_11_3 Reading an IGES File
|
||||
|
@@ -1,51 +0,0 @@
|
||||
// Copyright (c) 2023 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 <AIS_AnimationAxisRotation.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(AIS_AnimationAxisRotation, AIS_BaseAnimationObject)
|
||||
|
||||
//=============================================================================
|
||||
//function : Constructor
|
||||
//purpose :
|
||||
//=============================================================================
|
||||
AIS_AnimationAxisRotation::AIS_AnimationAxisRotation (const TCollection_AsciiString& theAnimationName,
|
||||
const Handle(AIS_InteractiveContext)& theContext,
|
||||
const Handle(AIS_InteractiveObject)& theObject,
|
||||
const gp_Ax1& theAxis,
|
||||
const Standard_Real theAngleStart,
|
||||
const Standard_Real theAngleEnd)
|
||||
: AIS_BaseAnimationObject (theAnimationName, theContext, theObject),
|
||||
myRotAxis (theAxis),
|
||||
myAngleStart (theAngleStart),
|
||||
myAngleEnd (theAngleEnd)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
//function : update
|
||||
//purpose :
|
||||
//=============================================================================
|
||||
void AIS_AnimationAxisRotation::update (const AIS_AnimationProgress& theProgress)
|
||||
{
|
||||
if (myObject.IsNull())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
gp_Trsf aTrsf;
|
||||
Standard_Real aCurrentAngle = (1.0 - theProgress.LocalNormalized) * myAngleStart + theProgress.LocalNormalized * myAngleEnd;
|
||||
aTrsf.SetRotation (myRotAxis, aCurrentAngle);
|
||||
updateTrsf (aTrsf);
|
||||
}
|
@@ -1,53 +0,0 @@
|
||||
// Copyright (c) 2023 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 _AIS_AnimationAxisRotation_HeaderFile
|
||||
#define _AIS_AnimationAxisRotation_HeaderFile
|
||||
|
||||
#include <AIS_BaseAnimationObject.hxx>
|
||||
#include <gp_TrsfNLerp.hxx>
|
||||
|
||||
//! Animation defining object transformation.
|
||||
class AIS_AnimationAxisRotation : public AIS_BaseAnimationObject
|
||||
{
|
||||
DEFINE_STANDARD_RTTIEXT(AIS_AnimationAxisRotation, AIS_BaseAnimationObject)
|
||||
public:
|
||||
|
||||
//! Constructor with initialization.
|
||||
//! @param[in] theAnimationName animation identifier
|
||||
//! @param[in] theContext interactive context where object have been displayed
|
||||
//! @param[in] theObject object to apply rotation
|
||||
//! @param[in] theAxis rotation axis
|
||||
//! @param[in] theAngleStart rotation angle at the start of animation
|
||||
//! @param[in] theAngleEnd rotation angle at the end of animation
|
||||
Standard_EXPORT AIS_AnimationAxisRotation (const TCollection_AsciiString& theAnimationName,
|
||||
const Handle(AIS_InteractiveContext)& theContext,
|
||||
const Handle(AIS_InteractiveObject)& theObject,
|
||||
const gp_Ax1& theAxis,
|
||||
const Standard_Real theAngleStart,
|
||||
const Standard_Real theAngleEnd);
|
||||
|
||||
protected:
|
||||
|
||||
//! Update the progress.
|
||||
Standard_EXPORT virtual void update (const AIS_AnimationProgress& theProgress) Standard_OVERRIDE;
|
||||
|
||||
private:
|
||||
|
||||
gp_Ax1 myRotAxis; //!< rotation axis
|
||||
Standard_Real myAngleStart; //!< start angle for rotation
|
||||
Standard_Real myAngleEnd; //!< end angle for rotation
|
||||
|
||||
};
|
||||
|
||||
#endif // _AIS_AnimationAxisRotation_HeaderFile
|
@@ -14,7 +14,10 @@
|
||||
|
||||
#include <AIS_AnimationObject.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(AIS_AnimationObject, AIS_BaseAnimationObject)
|
||||
#include <AIS_InteractiveContext.hxx>
|
||||
#include <V3d_View.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(AIS_AnimationObject, AIS_Animation)
|
||||
|
||||
//=============================================================================
|
||||
//function : Constructor
|
||||
@@ -25,7 +28,9 @@ AIS_AnimationObject::AIS_AnimationObject (const TCollection_AsciiString& theAnim
|
||||
const Handle(AIS_InteractiveObject)& theObject,
|
||||
const gp_Trsf& theTrsfStart,
|
||||
const gp_Trsf& theTrsfEnd)
|
||||
: AIS_BaseAnimationObject (theAnimationName, theContext, theObject),
|
||||
: AIS_Animation (theAnimationName),
|
||||
myContext (theContext),
|
||||
myObject (theObject),
|
||||
myTrsfLerp (theTrsfStart, theTrsfEnd)
|
||||
{
|
||||
//
|
||||
@@ -44,5 +49,52 @@ void AIS_AnimationObject::update (const AIS_AnimationProgress& theProgress)
|
||||
|
||||
gp_Trsf aTrsf;
|
||||
myTrsfLerp.Interpolate (theProgress.LocalNormalized, aTrsf);
|
||||
updateTrsf (aTrsf);
|
||||
if (!myContext.IsNull())
|
||||
{
|
||||
myContext->SetLocation (myObject, aTrsf);
|
||||
invalidateViewer();
|
||||
}
|
||||
else
|
||||
{
|
||||
myObject->SetLocalTransformation (aTrsf);
|
||||
}
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
//function : invalidateViewer
|
||||
//purpose :
|
||||
//=============================================================================
|
||||
void AIS_AnimationObject::invalidateViewer()
|
||||
{
|
||||
if (myContext.IsNull())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
const Standard_Boolean isImmediate = myContext->CurrentViewer()->ZLayerSettings (myObject->ZLayer()).IsImmediate();
|
||||
if (!isImmediate)
|
||||
{
|
||||
myContext->CurrentViewer()->Invalidate();
|
||||
return;
|
||||
}
|
||||
|
||||
// Invalidate immediate view only if it is going out of z-fit range.
|
||||
// This might be sub-optimal performing this for each animated objects in case of many animated objects.
|
||||
for (V3d_ListOfView::Iterator aDefViewIter = myContext->CurrentViewer()->DefinedViewIterator();
|
||||
aDefViewIter.More(); aDefViewIter.Next())
|
||||
{
|
||||
const Handle(V3d_View)& aView = aDefViewIter.Value();
|
||||
const Bnd_Box aMinMaxBox = aView->View()->MinMaxValues (Standard_False);
|
||||
const Bnd_Box aGraphicBox = aView->View()->MinMaxValues (Standard_True);
|
||||
Standard_Real aZNear = 0.0;
|
||||
Standard_Real aZFar = 0.0;
|
||||
if (aView->Camera()->ZFitAll (aDefViewIter.Value()->AutoZFitScaleFactor(), aMinMaxBox, aGraphicBox, aZNear, aZFar))
|
||||
{
|
||||
if (aZNear < aView->Camera()->ZNear()
|
||||
|| aZFar > aView->Camera()->ZFar())
|
||||
{
|
||||
aDefViewIter.Value()->Invalidate();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -15,23 +15,24 @@
|
||||
#ifndef _AIS_AnimationObject_HeaderFile
|
||||
#define _AIS_AnimationObject_HeaderFile
|
||||
|
||||
#include <AIS_BaseAnimationObject.hxx>
|
||||
#include <AIS_Animation.hxx>
|
||||
#include <AIS_InteractiveContext.hxx>
|
||||
#include <gp_TrsfNLerp.hxx>
|
||||
|
||||
//! Animation defining object transformation.
|
||||
class AIS_AnimationObject : public AIS_BaseAnimationObject
|
||||
class AIS_AnimationObject : public AIS_Animation
|
||||
{
|
||||
DEFINE_STANDARD_RTTIEXT(AIS_AnimationObject, AIS_BaseAnimationObject)
|
||||
DEFINE_STANDARD_RTTIEXT(AIS_AnimationObject, AIS_Animation)
|
||||
public:
|
||||
|
||||
//! Constructor with initialization.
|
||||
//! Note that start/end transformations specify exactly local transformation of the object,
|
||||
//! not the transformation to be applied to existing local transformation.
|
||||
//! @param[in] theAnimationName animation identifier
|
||||
//! @param[in] theContext interactive context where object have been displayed
|
||||
//! @param[in] theObject object to apply local transformation
|
||||
//! @param[in] theTrsfStart local transformation at the start of animation (e.g. theObject->LocalTransformation())
|
||||
//! @param[in] theTrsfEnd local transformation at the end of animation
|
||||
//! @param theAnimationName animation identifier
|
||||
//! @param theContext interactive context where object have been displayed
|
||||
//! @param theObject object to apply local transformation
|
||||
//! @param theTrsfStart local transformation at the start of animation (e.g. theObject->LocalTransformation())
|
||||
//! @param theTrsfEnd local transformation at the end of animation
|
||||
Standard_EXPORT AIS_AnimationObject (const TCollection_AsciiString& theAnimationName,
|
||||
const Handle(AIS_InteractiveContext)& theContext,
|
||||
const Handle(AIS_InteractiveObject)& theObject,
|
||||
@@ -43,10 +44,17 @@ protected:
|
||||
//! Update the progress.
|
||||
Standard_EXPORT virtual void update (const AIS_AnimationProgress& theProgress) Standard_OVERRIDE;
|
||||
|
||||
private:
|
||||
//! Invalidate the viewer for proper update.
|
||||
Standard_EXPORT void invalidateViewer();
|
||||
|
||||
protected:
|
||||
|
||||
Handle(AIS_InteractiveContext) myContext; //!< context where object is displayed
|
||||
Handle(AIS_InteractiveObject) myObject; //!< presentation object to set location
|
||||
gp_TrsfNLerp myTrsfLerp; //!< interpolation tool
|
||||
|
||||
};
|
||||
|
||||
DEFINE_STANDARD_HANDLE(AIS_AnimationObject, AIS_Animation)
|
||||
|
||||
#endif // _AIS_AnimationObject_HeaderFile
|
||||
|
@@ -1,88 +0,0 @@
|
||||
// Copyright (c) 2023 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 <AIS_BaseAnimationObject.hxx>
|
||||
|
||||
#include <V3d_View.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(AIS_BaseAnimationObject, AIS_Animation)
|
||||
|
||||
//=============================================================================
|
||||
//function : Constructor
|
||||
//purpose :
|
||||
//=============================================================================
|
||||
AIS_BaseAnimationObject::AIS_BaseAnimationObject (const TCollection_AsciiString& theAnimationName,
|
||||
const Handle(AIS_InteractiveContext)& theContext,
|
||||
const Handle(AIS_InteractiveObject)& theObject)
|
||||
: AIS_Animation (theAnimationName),
|
||||
myContext (theContext),
|
||||
myObject (theObject)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
//function : updateTrsf
|
||||
//purpose :
|
||||
//=============================================================================
|
||||
void AIS_BaseAnimationObject::updateTrsf (const gp_Trsf& theTrsf)
|
||||
{
|
||||
if (!myContext.IsNull())
|
||||
{
|
||||
myContext->SetLocation (myObject, theTrsf);
|
||||
invalidateViewer();
|
||||
}
|
||||
else
|
||||
{
|
||||
myObject->SetLocalTransformation (theTrsf);
|
||||
}
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
//function : invalidateViewer
|
||||
//purpose :
|
||||
//=============================================================================
|
||||
void AIS_BaseAnimationObject::invalidateViewer()
|
||||
{
|
||||
if (myContext.IsNull())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
const Standard_Boolean isImmediate = myContext->CurrentViewer()->ZLayerSettings (myObject->ZLayer()).IsImmediate();
|
||||
if (!isImmediate)
|
||||
{
|
||||
myContext->CurrentViewer()->Invalidate();
|
||||
return;
|
||||
}
|
||||
|
||||
// Invalidate immediate view only if it is going out of z-fit range.
|
||||
// This might be sub-optimal performing this for each animated objects in case of many animated objects.
|
||||
for (V3d_ListOfView::Iterator aDefViewIter = myContext->CurrentViewer()->DefinedViewIterator();
|
||||
aDefViewIter.More(); aDefViewIter.Next())
|
||||
{
|
||||
const Handle(V3d_View)& aView = aDefViewIter.Value();
|
||||
const Bnd_Box aMinMaxBox = aView->View()->MinMaxValues (Standard_False);
|
||||
const Bnd_Box aGraphicBox = aView->View()->MinMaxValues (Standard_True);
|
||||
Standard_Real aZNear = 0.0;
|
||||
Standard_Real aZFar = 0.0;
|
||||
if (aView->Camera()->ZFitAll (aDefViewIter.Value()->AutoZFitScaleFactor(), aMinMaxBox, aGraphicBox, aZNear, aZFar))
|
||||
{
|
||||
if (aZNear < aView->Camera()->ZNear()
|
||||
|| aZFar > aView->Camera()->ZFar())
|
||||
{
|
||||
aDefViewIter.Value()->Invalidate();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,49 +0,0 @@
|
||||
// Copyright (c) 2023 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 _AIS_BaseAnimationObject_HeaderFile
|
||||
#define _AIS_BaseAnimationObject_HeaderFile
|
||||
|
||||
#include <AIS_Animation.hxx>
|
||||
#include <AIS_InteractiveContext.hxx>
|
||||
|
||||
//! Animation defining object transformation.
|
||||
class AIS_BaseAnimationObject : public AIS_Animation
|
||||
{
|
||||
DEFINE_STANDARD_RTTIEXT(AIS_BaseAnimationObject, AIS_Animation)
|
||||
protected:
|
||||
|
||||
//! Constructor with initialization.
|
||||
//! @param[in] theAnimationName animation identifier
|
||||
//! @param[in] theContext interactive context where object have been displayed
|
||||
//! @param[in] theObject object to apply local transformation
|
||||
Standard_EXPORT AIS_BaseAnimationObject (const TCollection_AsciiString& theAnimationName,
|
||||
const Handle(AIS_InteractiveContext)& theContext,
|
||||
const Handle(AIS_InteractiveObject)& theObject);
|
||||
|
||||
//! Update the transformation.
|
||||
Standard_EXPORT void updateTrsf (const gp_Trsf& theTrsf);
|
||||
|
||||
private:
|
||||
|
||||
//! Invalidate the viewer for proper update.
|
||||
Standard_EXPORT void invalidateViewer();
|
||||
|
||||
protected:
|
||||
|
||||
Handle(AIS_InteractiveContext) myContext; //!< context where object is displayed
|
||||
Handle(AIS_InteractiveObject) myObject; //!< presentation object to set location
|
||||
|
||||
};
|
||||
|
||||
#endif // _AIS_BaseAnimationObject_HeaderFile
|
@@ -1116,23 +1116,18 @@ void AIS_Manipulator::ComputeSelection (const Handle(SelectMgr_Selection)& theSe
|
||||
const Standard_Integer theMode)
|
||||
{
|
||||
//Check mode
|
||||
const AIS_ManipulatorMode aMode = (AIS_ManipulatorMode) theMode;
|
||||
AIS_ManipulatorMode aMode = (AIS_ManipulatorMode) theMode;
|
||||
if (aMode == AIS_MM_None)
|
||||
{
|
||||
return;
|
||||
}
|
||||
Handle(SelectMgr_EntityOwner) anOwner;
|
||||
|
||||
// Sensitivity calculation for manipulator parts allows to avoid
|
||||
// overlapping of sensitive areas when size of manipulator is small.
|
||||
// Sensitivity is calculated relative to the default size of the manipulator (100.0f).
|
||||
const Standard_ShortReal aSensitivityCoef = myAxes[0].Size() / 100.0f;
|
||||
const Standard_Integer aHighSensitivity = Max (Min (RealToInt (aSensitivityCoef * 15), 15), 3); // clamp sensitivity within range [3, 15]
|
||||
const Standard_Integer aLowSensitivity = Max (Min (RealToInt (aSensitivityCoef * 10), 10), 2); // clamp sensitivity within range [2, 10]
|
||||
|
||||
switch (aMode)
|
||||
if (aMode == AIS_MM_None)
|
||||
{
|
||||
case AIS_MM_Translation:
|
||||
anOwner = new SelectMgr_EntityOwner (this, 5);
|
||||
}
|
||||
|
||||
if (aMode == AIS_MM_Translation || aMode == AIS_MM_None)
|
||||
{
|
||||
for (Standard_Integer anIt = 0; anIt < 3; ++anIt)
|
||||
{
|
||||
@@ -1141,21 +1136,23 @@ void AIS_Manipulator::ComputeSelection (const Handle(SelectMgr_Selection)& theSe
|
||||
continue;
|
||||
}
|
||||
const Axis& anAxis = myAxes[anIt];
|
||||
anOwner = new AIS_ManipulatorOwner(this, anIt, AIS_MM_Translation, 9);
|
||||
|
||||
if (aMode != AIS_MM_None)
|
||||
{
|
||||
anOwner = new AIS_ManipulatorOwner (this, anIt, AIS_MM_Translation, 9);
|
||||
}
|
||||
// define sensitivity by line
|
||||
Handle(Select3D_SensitiveSegment) aLine = new Select3D_SensitiveSegment(anOwner, gp::Origin(), anAxis.TranslatorTipPosition());
|
||||
aLine->SetSensitivityFactor (aHighSensitivity);
|
||||
Handle(Select3D_SensitiveSegment) aLine = new Select3D_SensitiveSegment (anOwner, gp::Origin(), anAxis.TranslatorTipPosition());
|
||||
aLine->SetSensitivityFactor (15);
|
||||
theSelection->Add (aLine);
|
||||
|
||||
// enlarge sensitivity by triangulation
|
||||
Handle(Select3D_SensitivePrimitiveArray) aTri = new Select3D_SensitivePrimitiveArray(anOwner);
|
||||
Handle(Select3D_SensitivePrimitiveArray) aTri = new Select3D_SensitivePrimitiveArray (anOwner);
|
||||
aTri->InitTriangulation (anAxis.TriangleArray()->Attributes(), anAxis.TriangleArray()->Indices(), TopLoc_Location());
|
||||
theSelection->Add (aTri);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case AIS_MM_Rotation:
|
||||
|
||||
if (aMode == AIS_MM_Rotation || aMode == AIS_MM_None)
|
||||
{
|
||||
for (Standard_Integer anIt = 0; anIt < 3; ++anIt)
|
||||
{
|
||||
@@ -1164,20 +1161,22 @@ void AIS_Manipulator::ComputeSelection (const Handle(SelectMgr_Selection)& theSe
|
||||
continue;
|
||||
}
|
||||
const Axis& anAxis = myAxes[anIt];
|
||||
anOwner = new AIS_ManipulatorOwner(this, anIt, AIS_MM_Rotation, 9);
|
||||
|
||||
if (aMode != AIS_MM_None)
|
||||
{
|
||||
anOwner = new AIS_ManipulatorOwner (this, anIt, AIS_MM_Rotation, 9);
|
||||
}
|
||||
// define sensitivity by circle
|
||||
const gp_Circ aGeomCircle (gp_Ax2(gp::Origin(), anAxis.ReferenceAxis().Direction()), anAxis.RotatorDiskRadius());
|
||||
Handle(Select3D_SensitiveCircle) aCircle = new ManipSensCircle(anOwner, aGeomCircle);
|
||||
aCircle->SetSensitivityFactor (aLowSensitivity);
|
||||
theSelection->Add(aCircle);
|
||||
const gp_Circ aGeomCircle (gp_Ax2 (gp::Origin(), anAxis.ReferenceAxis().Direction()), anAxis.RotatorDiskRadius());
|
||||
Handle(Select3D_SensitiveCircle) aCircle = new ManipSensCircle (anOwner, aGeomCircle);
|
||||
aCircle->SetSensitivityFactor (15);
|
||||
theSelection->Add (aCircle);
|
||||
// enlarge sensitivity by triangulation
|
||||
Handle(Select3D_SensitiveTriangulation) aTri = new ManipSensTriangulation(anOwner, myAxes[anIt].RotatorDisk().Triangulation(), anAxis.ReferenceAxis().Direction());
|
||||
Handle(Select3D_SensitiveTriangulation) aTri = new ManipSensTriangulation (anOwner, myAxes[anIt].RotatorDisk().Triangulation(), anAxis.ReferenceAxis().Direction());
|
||||
theSelection->Add (aTri);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case AIS_MM_Scaling:
|
||||
|
||||
if (aMode == AIS_MM_Scaling || aMode == AIS_MM_None)
|
||||
{
|
||||
for (Standard_Integer anIt = 0; anIt < 3; ++anIt)
|
||||
{
|
||||
@@ -1185,19 +1184,21 @@ void AIS_Manipulator::ComputeSelection (const Handle(SelectMgr_Selection)& theSe
|
||||
{
|
||||
continue;
|
||||
}
|
||||
anOwner = new AIS_ManipulatorOwner(this, anIt, AIS_MM_Scaling, 9);
|
||||
|
||||
if (aMode != AIS_MM_None)
|
||||
{
|
||||
anOwner = new AIS_ManipulatorOwner (this, anIt, AIS_MM_Scaling, 9);
|
||||
}
|
||||
// define sensitivity by point
|
||||
Handle(Select3D_SensitivePoint) aPnt = new Select3D_SensitivePoint(anOwner, myAxes[anIt].ScalerCubePosition());
|
||||
aPnt->SetSensitivityFactor (aHighSensitivity);
|
||||
Handle(Select3D_SensitivePoint) aPnt = new Select3D_SensitivePoint (anOwner, myAxes[anIt].ScalerCubePosition());
|
||||
aPnt->SetSensitivityFactor (15);
|
||||
theSelection->Add (aPnt);
|
||||
// enlarge sensitivity by triangulation
|
||||
Handle(Select3D_SensitiveTriangulation) aTri = new Select3D_SensitiveTriangulation(anOwner, myAxes[anIt].ScalerCube().Triangulation(), TopLoc_Location(), Standard_True);
|
||||
Handle(Select3D_SensitiveTriangulation) aTri = new Select3D_SensitiveTriangulation (anOwner, myAxes[anIt].ScalerCube().Triangulation(), TopLoc_Location(), Standard_True);
|
||||
theSelection->Add (aTri);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case AIS_MM_TranslationPlane:
|
||||
|
||||
if (aMode == AIS_MM_TranslationPlane || aMode == AIS_MM_None)
|
||||
{
|
||||
for (Standard_Integer anIt = 0; anIt < 3; ++anIt)
|
||||
{
|
||||
@@ -1205,32 +1206,27 @@ void AIS_Manipulator::ComputeSelection (const Handle(SelectMgr_Selection)& theSe
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (aMode != AIS_MM_None)
|
||||
{
|
||||
anOwner = new AIS_ManipulatorOwner(this, anIt, AIS_MM_TranslationPlane, 9);
|
||||
}
|
||||
|
||||
// define sensitivity by two crossed lines
|
||||
Standard_Real aSensitivityOffset = ZoomPersistence() ? aHighSensitivity * (0.5 + M_SQRT2) : 0.0;
|
||||
gp_Pnt aP1 = myAxes[((anIt + 1) % 3)].TranslatorTipPosition().Translated (myAxes[((anIt + 2) % 3)].ReferenceAxis().Direction().XYZ() * aSensitivityOffset);
|
||||
gp_Pnt aP2 = myAxes[((anIt + 2) % 3)].TranslatorTipPosition().Translated (myAxes[((anIt + 1) % 3)].ReferenceAxis().Direction().XYZ() * aSensitivityOffset);
|
||||
gp_Pnt aP1, aP2;
|
||||
aP1 = myAxes[((anIt + 1) % 3)].TranslatorTipPosition();
|
||||
aP2 = myAxes[((anIt + 2) % 3)].TranslatorTipPosition();
|
||||
gp_XYZ aMidP = (aP1.XYZ() + aP2.XYZ()) / 2.0;
|
||||
gp_XYZ anOrig = aMidP.Normalized().Multiplied (aSensitivityOffset);
|
||||
|
||||
Handle(Select3D_SensitiveSegment) aLine1 = new Select3D_SensitiveSegment(anOwner, aP1, aP2);
|
||||
aLine1->SetSensitivityFactor(aLowSensitivity);
|
||||
theSelection->Add (aLine1);
|
||||
Handle(Select3D_SensitiveSegment) aLine2 = new Select3D_SensitiveSegment(anOwner, anOrig, aMidP);
|
||||
aLine2->SetSensitivityFactor (aLowSensitivity);
|
||||
theSelection->Add (aLine2);
|
||||
aLine1->SetSensitivityFactor(10);
|
||||
theSelection->Add(aLine1);
|
||||
Handle(Select3D_SensitiveSegment) aLine2 = new Select3D_SensitiveSegment(anOwner, gp::Origin(), aMidP);
|
||||
aLine2->SetSensitivityFactor(10);
|
||||
theSelection->Add(aLine2);
|
||||
|
||||
// enlarge sensitivity by triangulation
|
||||
Handle(Select3D_SensitiveTriangulation) aTri = new Select3D_SensitiveTriangulation(anOwner, myAxes[anIt].DraggerSector().Triangulation(), TopLoc_Location(), Standard_True);
|
||||
theSelection->Add (aTri);
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
anOwner = new SelectMgr_EntityOwner(this, 5);
|
||||
break;
|
||||
theSelection->Add(aTri);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -2,8 +2,6 @@ AIS.hxx
|
||||
AIS_Animation.cxx
|
||||
AIS_Animation.hxx
|
||||
AIS_AnimationTimer.hxx
|
||||
AIS_AnimationAxisRotation.cxx
|
||||
AIS_AnimationAxisRotation.hxx
|
||||
AIS_AnimationCamera.cxx
|
||||
AIS_AnimationCamera.hxx
|
||||
AIS_AnimationObject.cxx
|
||||
@@ -14,8 +12,6 @@ AIS_Axis.cxx
|
||||
AIS_Axis.hxx
|
||||
AIS_BadEdgeFilter.cxx
|
||||
AIS_BadEdgeFilter.hxx
|
||||
AIS_BaseAnimationObject.cxx
|
||||
AIS_BaseAnimationObject.hxx
|
||||
AIS_C0RegularityFilter.cxx
|
||||
AIS_C0RegularityFilter.hxx
|
||||
AIS_CameraFrustum.cxx
|
||||
|
@@ -1,186 +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 <APIHeaderSection_EditHeader.hxx>
|
||||
#include <APIHeaderSection_MakeHeader.hxx>
|
||||
#include <IFSelect_EditForm.hxx>
|
||||
#include <Interface_TypedValue.hxx>
|
||||
#include <Standard_Transient.hxx>
|
||||
#include <Standard_Type.hxx>
|
||||
#include <StepData_StepModel.hxx>
|
||||
#include <TCollection_AsciiString.hxx>
|
||||
#include <TCollection_HAsciiString.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(APIHeaderSection_EditHeader,IFSelect_Editor)
|
||||
|
||||
static Standard_Boolean IsTimeStamp
|
||||
(const Handle(TCollection_HAsciiString)& val)
|
||||
{
|
||||
if (val.IsNull()) return Standard_False;
|
||||
if (val->Length() != 19) return Standard_False;
|
||||
// On y va
|
||||
char dizmois = val->Value(6);
|
||||
char dizjour = val->Value(9);
|
||||
char dizheur = val->Value(12);
|
||||
for (Standard_Integer i = 1; i <= 19; i ++)
|
||||
{
|
||||
char uncar = val->Value(i);
|
||||
switch (i) {
|
||||
case 1 : if (uncar != '1' && uncar != '2') return Standard_False;
|
||||
break;
|
||||
case 2 :
|
||||
case 3 :
|
||||
case 4 : if (uncar < '0' || uncar > '9') return Standard_False;
|
||||
break;
|
||||
case 5 : if (uncar != '-') return Standard_False;
|
||||
Standard_FALLTHROUGH
|
||||
case 6 : if (uncar != '0' && uncar != '1') return Standard_False;
|
||||
break;
|
||||
case 7 : if (uncar < '0' || uncar > '9') return Standard_False;
|
||||
if (dizmois == '1' && (uncar < '0' || uncar > '2')) return Standard_False;
|
||||
break;
|
||||
case 8 : if (uncar != '-') return Standard_False;
|
||||
Standard_FALLTHROUGH
|
||||
case 9 : if (uncar < '0' || uncar > '3') return Standard_False;
|
||||
break;
|
||||
case 10 : if (uncar < '0' || uncar > '9') return Standard_False;
|
||||
if (dizjour == '3' && (uncar != '0' && uncar != '1')) return Standard_False;
|
||||
break;
|
||||
case 11 : if (uncar != 'T') return Standard_False;
|
||||
Standard_FALLTHROUGH
|
||||
case 12 : if (uncar < '0' || uncar > '2') return Standard_False;
|
||||
break;
|
||||
case 13 : if (uncar < '0' || uncar > '9') return Standard_False;
|
||||
if (dizheur == '2' && (uncar < '0' || uncar > '3')) return Standard_False;
|
||||
break;
|
||||
case 14 : if (uncar != ':') return Standard_False;
|
||||
Standard_FALLTHROUGH
|
||||
case 15 : if (uncar < '0' || uncar > '5') return Standard_False;
|
||||
break;
|
||||
case 16 : if (uncar < '0' || uncar > '9') return Standard_False;
|
||||
break;
|
||||
case 17 : if (uncar != ':') return Standard_False;
|
||||
Standard_FALLTHROUGH
|
||||
case 18 : if (uncar < '0' || uncar > '5') return Standard_False;
|
||||
break;
|
||||
case 19 : if (uncar < '0' || uncar > '9') return Standard_False;
|
||||
break;
|
||||
default :
|
||||
break;
|
||||
}
|
||||
}
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
|
||||
APIHeaderSection_EditHeader::APIHeaderSection_EditHeader ()
|
||||
: IFSelect_Editor (10)
|
||||
{
|
||||
// Definition
|
||||
Handle(Interface_TypedValue) fn_name = new Interface_TypedValue("fn_name");
|
||||
SetValue (1,fn_name,"name");
|
||||
Handle(Interface_TypedValue) fn_time = new Interface_TypedValue("fn_time_stamp");
|
||||
fn_time->SetSatisfies (IsTimeStamp,"IsTimeStamp");
|
||||
SetValue (2,fn_time,"time");
|
||||
Handle(Interface_TypedValue) fn_author = new Interface_TypedValue("fn_author");
|
||||
SetValue (3,fn_author,"author"); // 1 seul (1er de liste)
|
||||
Handle(Interface_TypedValue) fn_org = new Interface_TypedValue("fn_organization");
|
||||
SetValue (4,fn_org,"org"); // 1 seul (1er de liste)
|
||||
Handle(Interface_TypedValue) fn_preproc = new Interface_TypedValue("fn_preprocessor_version");
|
||||
SetValue (5,fn_preproc,"preproc");
|
||||
Handle(Interface_TypedValue) fn_orig = new Interface_TypedValue("fn_originating_system");
|
||||
SetValue (6,fn_orig,"orig");
|
||||
Handle(Interface_TypedValue) fn_autorize = new Interface_TypedValue("fn_authorization");
|
||||
SetValue (7,fn_autorize,"autorize");
|
||||
|
||||
Handle(Interface_TypedValue) fs_schema = new Interface_TypedValue("fs_schema_identifiers");
|
||||
SetValue (8,fs_schema,"schema"); // 1 seul (1er de liste)
|
||||
|
||||
Handle(Interface_TypedValue) fd_descr = new Interface_TypedValue("fd_description");
|
||||
SetValue (9,fd_descr,"descr"); // 1 seul (1er de liste)
|
||||
|
||||
Handle(Interface_TypedValue) fd_level = new Interface_TypedValue("fd_implementation_level");
|
||||
SetValue (10,fd_level,"level");
|
||||
|
||||
}
|
||||
|
||||
TCollection_AsciiString APIHeaderSection_EditHeader::Label () const
|
||||
{ return TCollection_AsciiString ("Step Header"); }
|
||||
|
||||
Standard_Boolean APIHeaderSection_EditHeader::Recognize
|
||||
(const Handle(IFSelect_EditForm)& /*form*/) const
|
||||
{ return Standard_True; } // ??
|
||||
|
||||
Handle(TCollection_HAsciiString) APIHeaderSection_EditHeader::StringValue
|
||||
(const Handle(IFSelect_EditForm)& /*form*/, const Standard_Integer num) const
|
||||
{
|
||||
// Default Values
|
||||
return TypedValue(num)->HStringValue();
|
||||
}
|
||||
|
||||
Standard_Boolean APIHeaderSection_EditHeader::Load
|
||||
(const Handle(IFSelect_EditForm)& form,
|
||||
const Handle(Standard_Transient)& /*ent*/,
|
||||
const Handle(Interface_InterfaceModel)& model) const
|
||||
{
|
||||
Handle(StepData_StepModel) modl =
|
||||
Handle(StepData_StepModel)::DownCast(model);
|
||||
if (modl.IsNull()) return Standard_False;
|
||||
|
||||
APIHeaderSection_MakeHeader mkh (modl);
|
||||
|
||||
form->LoadValue (1 ,mkh.Name ());
|
||||
form->LoadValue (2 ,mkh.TimeStamp ());
|
||||
form->LoadValue (3 ,mkh.AuthorValue (1));
|
||||
form->LoadValue (4 ,mkh.OrganizationValue (1));
|
||||
form->LoadValue (5 ,mkh.PreprocessorVersion ());
|
||||
form->LoadValue (6 ,mkh.OriginatingSystem ());
|
||||
form->LoadValue (7 ,mkh.Authorisation ());
|
||||
|
||||
form->LoadValue (8 ,mkh.SchemaIdentifiersValue (1));
|
||||
|
||||
form->LoadValue (9 ,mkh.DescriptionValue (1));
|
||||
form->LoadValue (10,mkh.ImplementationLevel ());
|
||||
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
Standard_Boolean APIHeaderSection_EditHeader::Apply
|
||||
(const Handle(IFSelect_EditForm)& form,
|
||||
const Handle(Standard_Transient)& /*ent*/,
|
||||
const Handle(Interface_InterfaceModel)& model) const
|
||||
{
|
||||
Handle(StepData_StepModel) modl =
|
||||
Handle(StepData_StepModel)::DownCast(model);
|
||||
if (modl.IsNull()) return Standard_False;
|
||||
|
||||
APIHeaderSection_MakeHeader mkh (modl);
|
||||
|
||||
if (form->IsModified(1)) mkh.SetName (form->EditedValue(1));
|
||||
if (form->IsModified(2)) mkh.SetTimeStamp (form->EditedValue(2));
|
||||
if (form->IsModified(3)) mkh.SetAuthorValue (1,form->EditedValue(3));
|
||||
if (form->IsModified(4)) mkh.SetOrganizationValue (1,form->EditedValue(4));
|
||||
if (form->IsModified(5)) mkh.SetPreprocessorVersion (form->EditedValue(5));
|
||||
if (form->IsModified(6)) mkh.SetOriginatingSystem (form->EditedValue(6));
|
||||
if (form->IsModified(7)) mkh.SetAuthorisation (form->EditedValue(7));
|
||||
|
||||
if (form->IsModified(8)) mkh.SetSchemaIdentifiersValue (1,form->EditedValue(8));
|
||||
|
||||
if (form->IsModified(9)) mkh.SetDescriptionValue (1,form->EditedValue(9));
|
||||
if (form->IsModified(10)) mkh.SetImplementationLevel (form->EditedValue(10));
|
||||
|
||||
mkh.Apply( Handle(StepData_StepModel)::DownCast(model) );
|
||||
|
||||
return Standard_True;
|
||||
}
|
@@ -1,76 +0,0 @@
|
||||
// Created on: 1998-07-08
|
||||
// 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 _APIHeaderSection_EditHeader_HeaderFile
|
||||
#define _APIHeaderSection_EditHeader_HeaderFile
|
||||
|
||||
#include <Standard.hxx>
|
||||
|
||||
#include <IFSelect_Editor.hxx>
|
||||
#include <Standard_Integer.hxx>
|
||||
class TCollection_AsciiString;
|
||||
class IFSelect_EditForm;
|
||||
class TCollection_HAsciiString;
|
||||
class Standard_Transient;
|
||||
class Interface_InterfaceModel;
|
||||
|
||||
|
||||
class APIHeaderSection_EditHeader;
|
||||
DEFINE_STANDARD_HANDLE(APIHeaderSection_EditHeader, IFSelect_Editor)
|
||||
|
||||
|
||||
class APIHeaderSection_EditHeader : public IFSelect_Editor
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
|
||||
Standard_EXPORT APIHeaderSection_EditHeader();
|
||||
|
||||
Standard_EXPORT TCollection_AsciiString Label() const Standard_OVERRIDE;
|
||||
|
||||
Standard_EXPORT Standard_Boolean Recognize (const Handle(IFSelect_EditForm)& form) const Standard_OVERRIDE;
|
||||
|
||||
Standard_EXPORT Handle(TCollection_HAsciiString) StringValue (const Handle(IFSelect_EditForm)& form, const Standard_Integer num) const Standard_OVERRIDE;
|
||||
|
||||
Standard_EXPORT Standard_Boolean Apply (const Handle(IFSelect_EditForm)& form, const Handle(Standard_Transient)& ent, const Handle(Interface_InterfaceModel)& model) const Standard_OVERRIDE;
|
||||
|
||||
Standard_EXPORT Standard_Boolean Load (const Handle(IFSelect_EditForm)& form, const Handle(Standard_Transient)& ent, const Handle(Interface_InterfaceModel)& model) const Standard_OVERRIDE;
|
||||
|
||||
|
||||
|
||||
|
||||
DEFINE_STANDARD_RTTIEXT(APIHeaderSection_EditHeader,IFSelect_Editor)
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // _APIHeaderSection_EditHeader_HeaderFile
|
@@ -1,4 +0,0 @@
|
||||
APIHeaderSection_EditHeader.cxx
|
||||
APIHeaderSection_EditHeader.hxx
|
||||
APIHeaderSection_MakeHeader.cxx
|
||||
APIHeaderSection_MakeHeader.hxx
|
@@ -127,14 +127,6 @@ void BRepBndLib::Add(const TopoDS_Shape& S, Bnd_Box& B, Standard_Boolean useTria
|
||||
for (ex.Init(S,TopAbs_EDGE,TopAbs_FACE); ex.More(); ex.Next())
|
||||
{
|
||||
const TopoDS_Edge& E = TopoDS::Edge(ex.Current());
|
||||
|
||||
if (!useTriangulation && BRep_Tool::IsGeometric(E))
|
||||
{
|
||||
BC.Initialize(E);
|
||||
BndLib_Add3dCurve::Add(BC, BRep_Tool::Tolerance(E), B);
|
||||
continue;
|
||||
}
|
||||
|
||||
Handle(Poly_Polygon3D) P3d = BRep_Tool::Polygon3D(E, l);
|
||||
if (!P3d.IsNull() && P3d->NbNodes() > 0)
|
||||
{
|
||||
@@ -151,7 +143,7 @@ void BRepBndLib::Add(const TopoDS_Shape& S, Bnd_Box& B, Standard_Boolean useTria
|
||||
else
|
||||
{
|
||||
BRep_Tool::PolygonOnTriangulation(E, Poly, T, l);
|
||||
if (!Poly.IsNull() && !T.IsNull() && T->NbNodes() > 0)
|
||||
if (useTriangulation && !Poly.IsNull() && !T.IsNull() && T->NbNodes() > 0)
|
||||
{
|
||||
const TColStd_Array1OfInteger& Indices = Poly->Nodes();
|
||||
nbNodes = Indices.Length();
|
||||
|
@@ -41,7 +41,6 @@
|
||||
#include <TopoDS_Vertex.hxx>
|
||||
#include <TopTools_MapOfShape.hxx>
|
||||
#include <ChFi3d.hxx>
|
||||
#include <LocalAnalysis_SurfaceContinuity.hxx>
|
||||
|
||||
static void CorrectOrientationOfTangent(gp_Vec& TangVec,
|
||||
const TopoDS_Vertex& aVertex,
|
||||
@@ -51,12 +50,6 @@ static void CorrectOrientationOfTangent(gp_Vec& TangVec,
|
||||
if (aVertex.IsSame(Vlast))
|
||||
TangVec.Reverse();
|
||||
}
|
||||
|
||||
static Standard_Boolean CheckMixedContinuity (const TopoDS_Edge& theEdge,
|
||||
const TopoDS_Face& theFace1,
|
||||
const TopoDS_Face& theFace2,
|
||||
const Standard_Real theAngTol);
|
||||
|
||||
//=======================================================================
|
||||
//function : BRepOffset_Analyse
|
||||
//purpose :
|
||||
@@ -111,169 +104,16 @@ static void EdgeAnalyse(const TopoDS_Edge& E,
|
||||
ConnectType = ChFi3d::DefineConnectType(E, F1, F2, SinTol, Standard_False);
|
||||
}
|
||||
else
|
||||
{
|
||||
Standard_Boolean isTwoSplines = (aSurfType1 == GeomAbs_BSplineSurface || aSurfType1 == GeomAbs_BezierSurface) &&
|
||||
(aSurfType2 == GeomAbs_BSplineSurface || aSurfType2 == GeomAbs_BezierSurface);
|
||||
Standard_Boolean isMixedConcavity = Standard_False;
|
||||
if (isTwoSplines)
|
||||
{
|
||||
Standard_Real anAngTol = 0.1;
|
||||
isMixedConcavity = CheckMixedContinuity(E, F1, F2, anAngTol);
|
||||
}
|
||||
|
||||
if (!isMixedConcavity)
|
||||
{
|
||||
if (ChFi3d::IsTangentFaces(E, F1, F2)) //weak condition
|
||||
{
|
||||
ConnectType = ChFiDS_Tangential;
|
||||
}
|
||||
else
|
||||
{
|
||||
ConnectType = ChFi3d::DefineConnectType(E, F1, F2, SinTol, Standard_False);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ConnectType = ChFiDS_Mixed;
|
||||
}
|
||||
}
|
||||
|
||||
I.Type(ConnectType);
|
||||
LI.Append(I);
|
||||
}
|
||||
//=======================================================================
|
||||
//function : CheckMixedConcavity
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean CheckMixedContinuity (const TopoDS_Edge& theEdge,
|
||||
const TopoDS_Face& theFace1,
|
||||
const TopoDS_Face& theFace2,
|
||||
const Standard_Real theAngTol)
|
||||
{
|
||||
Standard_Boolean aMixedCont = Standard_False;
|
||||
GeomAbs_Shape aCurrOrder = BRep_Tool::Continuity(theEdge, theFace1, theFace2);
|
||||
if (aCurrOrder > GeomAbs_C0)
|
||||
{
|
||||
//Method BRep_Tool::Continuity(...) always returns minimal continuity between faces
|
||||
//so, if aCurrOrder > C0 it means that faces are tangent along whole edge.
|
||||
return aMixedCont;
|
||||
}
|
||||
//But we caqnnot trust result, if it is C0. because this value set by default.
|
||||
Standard_Real TolC0 = Max(0.001, 1.5*BRep_Tool::Tolerance(theEdge));
|
||||
|
||||
Standard_Real aFirst;
|
||||
Standard_Real aLast;
|
||||
|
||||
Handle(Geom2d_Curve) aC2d1, aC2d2;
|
||||
|
||||
if (!theFace1.IsSame(theFace2) &&
|
||||
BRep_Tool::IsClosed(theEdge, theFace1) &&
|
||||
BRep_Tool::IsClosed(theEdge, theFace2))
|
||||
{
|
||||
//Find the edge in the face 1: this edge will have correct orientation
|
||||
TopoDS_Edge anEdgeInFace1;
|
||||
TopoDS_Face aFace1 = theFace1;
|
||||
aFace1.Orientation(TopAbs_FORWARD);
|
||||
TopExp_Explorer anExplo(aFace1, TopAbs_EDGE);
|
||||
for (; anExplo.More(); anExplo.Next())
|
||||
{
|
||||
const TopoDS_Edge& anEdge = TopoDS::Edge(anExplo.Current());
|
||||
if (anEdge.IsSame(theEdge))
|
||||
{
|
||||
anEdgeInFace1 = anEdge;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (anEdgeInFace1.IsNull())
|
||||
{
|
||||
return aMixedCont;
|
||||
}
|
||||
|
||||
aC2d1 = BRep_Tool::CurveOnSurface(anEdgeInFace1, aFace1, aFirst, aLast);
|
||||
TopoDS_Face aFace2 = theFace2;
|
||||
aFace2.Orientation(TopAbs_FORWARD);
|
||||
anEdgeInFace1.Reverse();
|
||||
aC2d2 = BRep_Tool::CurveOnSurface(anEdgeInFace1, aFace2, aFirst, aLast);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Obtaining of pcurves of edge on two faces.
|
||||
aC2d1 = BRep_Tool::CurveOnSurface(theEdge, theFace1, aFirst, aLast);
|
||||
//For the case of seam edge
|
||||
TopoDS_Edge EE = theEdge;
|
||||
if (theFace1.IsSame(theFace2))
|
||||
{
|
||||
EE.Reverse();
|
||||
}
|
||||
aC2d2 = BRep_Tool::CurveOnSurface(EE, theFace2, aFirst, aLast);
|
||||
}
|
||||
|
||||
if (aC2d1.IsNull() || aC2d2.IsNull())
|
||||
{
|
||||
return aMixedCont;
|
||||
}
|
||||
|
||||
// Obtaining of two surfaces from adjacent faces.
|
||||
Handle(Geom_Surface) aSurf1 = BRep_Tool::Surface(theFace1);
|
||||
Handle(Geom_Surface) aSurf2 = BRep_Tool::Surface(theFace2);
|
||||
|
||||
if (aSurf1.IsNull() || aSurf2.IsNull())
|
||||
{
|
||||
return aMixedCont;
|
||||
}
|
||||
|
||||
Standard_Integer aNbSamples = 23;
|
||||
|
||||
// Computation of the continuity.
|
||||
Standard_Real aPar;
|
||||
Standard_Real aDelta = (aLast - aFirst) / (aNbSamples - 1);
|
||||
Standard_Integer i, istart = 1;
|
||||
Standard_Boolean isG1 = Standard_False;
|
||||
|
||||
for (i = 1, aPar = aFirst; i <= aNbSamples; i++, aPar += aDelta)
|
||||
{
|
||||
if (i == aNbSamples) aPar = aLast;
|
||||
|
||||
LocalAnalysis_SurfaceContinuity aCont(aC2d1, aC2d2, aPar,
|
||||
aSurf1, aSurf2, GeomAbs_G1, 0.001, TolC0, theAngTol, theAngTol, theAngTol);
|
||||
if (aCont.IsDone())
|
||||
{
|
||||
istart = i + 1;
|
||||
isG1 = aCont.IsG1();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (istart > aNbSamples / 2)
|
||||
{
|
||||
return aMixedCont;
|
||||
}
|
||||
|
||||
for (i = istart, aPar = aFirst; i <= aNbSamples; i++, aPar += aDelta)
|
||||
{
|
||||
if (i == aNbSamples) aPar = aLast;
|
||||
|
||||
LocalAnalysis_SurfaceContinuity aCont(aC2d1, aC2d2, aPar,
|
||||
aSurf1, aSurf2, GeomAbs_G1, 0.001, TolC0, theAngTol, theAngTol, theAngTol);
|
||||
if (!aCont.IsDone())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (aCont.IsG1() == isG1)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
aMixedCont = Standard_True;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return aMixedCont;
|
||||
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : BuildAncestors
|
||||
|
@@ -29,8 +29,7 @@ enum BRepOffset_Error
|
||||
BRepOffset_CannotTrimEdges, //!< exception while trim edges
|
||||
BRepOffset_CannotFuseVertices, //!< exception while fuse vertices
|
||||
BRepOffset_CannotExtentEdge, //!< exception while extent edges
|
||||
BRepOffset_UserBreak, //!< user break
|
||||
BRepOffset_MixedConnectivity //!< Different connectivity of faces along edge: partially C0 and tangent
|
||||
BRepOffset_UserBreak //!< user break
|
||||
};
|
||||
|
||||
#endif // _BRepOffset_Error_HeaderFile
|
||||
|
@@ -910,19 +910,6 @@ void BRepOffset_MakeOffset::MakeOffsetShape(const Message_ProgressRange& theRang
|
||||
myAnalyse.SetFaceOffsetMap (myFaceOffset);
|
||||
}
|
||||
myAnalyse.Perform(myFaceComp,TolAngle, aPS.Next(aSteps(PIOperation_Analyse)));
|
||||
TopExp_Explorer anEExp(myFaceComp, TopAbs_EDGE);
|
||||
for (; anEExp.More(); anEExp.Next())
|
||||
{
|
||||
const TopoDS_Edge& anE = TopoDS::Edge(anEExp.Current());
|
||||
const BRepOffset_ListOfInterval& aLI = myAnalyse.Type(anE);
|
||||
if (aLI.IsEmpty())
|
||||
continue;
|
||||
if (aLI.Last().Type() == ChFiDS_Mixed)
|
||||
{
|
||||
myError = BRepOffset_MixedConnectivity;
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (!aPS.More())
|
||||
{
|
||||
myError = BRepOffset_UserBreak;
|
||||
@@ -2973,36 +2960,6 @@ void BRepOffset_MakeOffset::MakeMissingWalls (const Message_ProgressRange& theRa
|
||||
TopExp::Vertices(anEdge, V1, V2);
|
||||
Standard_Real aF, aL;
|
||||
const Handle(Geom_Curve) aC = BRep_Tool::Curve(anEdge, aF, aL);
|
||||
if (V3.IsNull() && V4.IsNull())
|
||||
{
|
||||
// Initially offset edge is created without vertices.
|
||||
// Then edge is trimmed by intersection line between
|
||||
// two adjacent extended offset faces and get vertices.
|
||||
// When intersection lines are invalid for any reason,
|
||||
// (one of reson is mixed connectivity of faces)
|
||||
// algoritm of cutting offset edge by intersection line
|
||||
// can fail and offset edge cannot get vertices.
|
||||
// Follwing workaround is only to avoid exeption if V3 and V4 are Null
|
||||
// Vertex points are invalid.
|
||||
Standard_Real anOEF, anOEL;
|
||||
TopAbs_Orientation anOEOri = OE.Orientation();
|
||||
OE.Orientation(TopAbs_FORWARD);
|
||||
Handle(Geom_Curve) anOEC = BRep_Tool::Curve(OE, anOEF, anOEL);
|
||||
BRep_Builder aBB;
|
||||
gp_Pnt aP1 = anOEC->Value(aF);
|
||||
gp_Pnt aP2 = anOEC->Value(aL);
|
||||
TopoDS_Vertex anOEV1, anOEV2;
|
||||
Standard_Real aTol = Max(BRep_Tool::Tolerance(V1), BRep_Tool::Tolerance(V2));
|
||||
aBB.MakeVertex(anOEV1, aP1, aTol);
|
||||
anOEV1.Orientation(TopAbs_FORWARD);
|
||||
aBB.MakeVertex(anOEV2, aP2, aTol);
|
||||
anOEV2.Orientation(TopAbs_REVERSED);
|
||||
aBB.Add(OE, anOEV1);
|
||||
aBB.Add(OE, anOEV2);
|
||||
aBB.Range(OE, aF, aL);
|
||||
OE.Orientation(anOEOri);
|
||||
TopExp::Vertices(OE, V4, V3);
|
||||
}
|
||||
if (!aC.IsNull() &&
|
||||
(!aC->IsClosed() && !aC->IsPeriodic()))
|
||||
{
|
||||
|
@@ -281,11 +281,9 @@ static Standard_Integer mkedge(Draw_Interpretor& di, Standard_Integer n, const c
|
||||
|
||||
Handle(Geom_Curve) C = DrawTrSurf::GetCurve(a[2]);
|
||||
Handle(Geom2d_Curve) C2d = DrawTrSurf::GetCurve2d(a[2]);
|
||||
Handle(Poly_Polygon3D) P3d = DrawTrSurf::GetPolygon3D(a[2]);
|
||||
|
||||
if (C.IsNull() && C2d.IsNull() && P3d.IsNull()) {
|
||||
if (C.IsNull() && C2d.IsNull()) {
|
||||
//std::cout << a[2] << " is not a curve" << std::endl;
|
||||
di << a[2] << " is not a curve or polygon 3d\n";
|
||||
di << a[2] << " is not a curve\n";
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -293,12 +291,7 @@ static Standard_Integer mkedge(Draw_Interpretor& di, Standard_Integer n, const c
|
||||
|
||||
if (n == 3) {
|
||||
if (!C.IsNull()) edge = BRepBuilderAPI_MakeEdge(C);
|
||||
else if (!C2d.IsNull()) edge = BRepBuilderAPI_MakeEdge2d(C2d);
|
||||
else
|
||||
{
|
||||
BRep_Builder aBB;
|
||||
aBB.MakeEdge(edge, P3d);
|
||||
}
|
||||
else edge = BRepBuilderAPI_MakeEdge2d(C2d);
|
||||
}
|
||||
else {
|
||||
Handle(Geom_Surface) S;
|
||||
|
@@ -415,11 +415,6 @@ static void reportOffsetState(Draw_Interpretor& theCommands,
|
||||
theCommands << "ERROR. Can not extent edge.";
|
||||
break;
|
||||
}
|
||||
case BRepOffset_MixedConnectivity:
|
||||
{
|
||||
theCommands << "ERROR. Mixed connectivity of faces.";
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
theCommands << "ERROR. offsetperform operation not done.";
|
||||
@@ -979,10 +974,7 @@ Standard_Integer thickshell(Draw_Interpretor& theCommands,
|
||||
const BRepOffset_Error aRetCode = B.Error();
|
||||
reportOffsetState(theCommands, aRetCode);
|
||||
|
||||
if (!B.Shape().IsNull())
|
||||
{
|
||||
DBRep::Set(a[1], B.Shape());
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1117,10 +1109,7 @@ Standard_Integer offsetshape(Draw_Interpretor& theCommands,
|
||||
const BRepOffset_Error aRetCode = B.Error();
|
||||
reportOffsetState(theCommands, aRetCode);
|
||||
|
||||
if (!B.Shape().IsNull())
|
||||
{
|
||||
DBRep::Set(a[1], B.Shape());
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@@ -692,6 +692,7 @@ void ChFi3d_Builder::PerformExtremity (const Handle(ChFiDS_Spine)& Spine)
|
||||
else{
|
||||
sst = Spine->LastStatus();
|
||||
iedge = Spine->NbEdges();
|
||||
E[0] = Spine->Edges(iedge);
|
||||
V = Spine->LastVertex();
|
||||
}
|
||||
//Before all it is checked if the tangency is not dead.
|
||||
@@ -702,7 +703,6 @@ void ChFi3d_Builder::PerformExtremity (const Handle(ChFiDS_Spine)& Spine)
|
||||
}
|
||||
|
||||
if(sst == ChFiDS_BreakPoint){
|
||||
Standard_Integer aLocNbG1Connections = 0;
|
||||
TopTools_ListIteratorOfListOfShape It;//,Jt;
|
||||
Standard_Boolean sommetpourri = Standard_False;
|
||||
TopTools_IndexedMapOfOrientedShape EdgesOfV;
|
||||
@@ -720,10 +720,7 @@ void ChFi3d_Builder::PerformExtremity (const Handle(ChFiDS_Spine)& Spine)
|
||||
if (!F2.IsNull() && ChFi3d::IsTangentFaces(anEdge, F1, F2, GeomAbs_G2)) //smooth edge
|
||||
{
|
||||
if (!F1.IsSame(F2))
|
||||
{
|
||||
NbG1Connections++;
|
||||
aLocNbG1Connections++;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -762,7 +759,7 @@ void ChFi3d_Builder::PerformExtremity (const Handle(ChFiDS_Spine)& Spine)
|
||||
if (EdgesOfV.Extent() != 3)
|
||||
sommetpourri = Standard_True;
|
||||
|
||||
if(!sommetpourri && aLocNbG1Connections < 4){
|
||||
if(!sommetpourri){
|
||||
sst = ChFi3d_EdgeState(E,myEFMap);
|
||||
}
|
||||
if(ii==1)Spine->SetFirstStatus(sst);
|
||||
|
@@ -24,8 +24,7 @@ ChFiDS_Concave,
|
||||
ChFiDS_Convex,
|
||||
ChFiDS_Tangential,
|
||||
ChFiDS_FreeBound,
|
||||
ChFiDS_Other,
|
||||
ChFiDS_Mixed
|
||||
ChFiDS_Other
|
||||
};
|
||||
|
||||
#endif // _ChFiDS_TypeOfConcavity_HeaderFile
|
||||
|
@@ -114,6 +114,15 @@ bool DE_ConfigurationNode::IsExportSupported() const
|
||||
return false;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
// function : IsExportSupported
|
||||
// purpose :
|
||||
//=======================================================================
|
||||
bool DE_ConfigurationNode::IsStreamSupported() const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
// function : CheckForSupport
|
||||
// purpose :
|
||||
|
@@ -102,6 +102,10 @@ public:
|
||||
//! @return Standard_True if export is support
|
||||
Standard_EXPORT virtual bool IsExportSupported() const;
|
||||
|
||||
//! Checks the stream for import/export supporting
|
||||
//! @return Standard_True if stream is support
|
||||
Standard_EXPORT virtual bool IsStreamSupported() const;
|
||||
|
||||
//! Gets CAD format name of associated provider
|
||||
//! @return provider CAD format
|
||||
Standard_EXPORT virtual TCollection_AsciiString GetFormat() const = 0;
|
||||
@@ -128,17 +132,11 @@ public:
|
||||
|
||||
//! Gets the provider loading status
|
||||
//! @return Standard_True if the load is correct
|
||||
Standard_Boolean IsEnabled() const
|
||||
{
|
||||
return myIsEnabled;
|
||||
}
|
||||
Standard_Boolean IsEnabled() const { return myIsEnabled; }
|
||||
|
||||
//! Sets the provider loading status
|
||||
//! @param[in] theIsLoaded input load status
|
||||
void SetEnabled(const Standard_Boolean theIsLoaded)
|
||||
{
|
||||
myIsEnabled = theIsLoaded;
|
||||
}
|
||||
void SetEnabled(const Standard_Boolean theIsLoaded) { myIsEnabled = theIsLoaded; }
|
||||
|
||||
public:
|
||||
|
||||
|
@@ -22,7 +22,7 @@
|
||||
#include <Interface_GeneralModule.hxx>
|
||||
#include <Interface_GTool.hxx>
|
||||
#include <Interface_InterfaceMismatch.hxx>
|
||||
#include <Interface_InterfaceModel.hxx>
|
||||
#include <DE_DataModel.hxx>
|
||||
#include <Interface_Protocol.hxx>
|
||||
#include <Interface_ReportEntity.hxx>
|
||||
#include <Interface_SignType.hxx>
|
||||
@@ -32,7 +32,7 @@
|
||||
#include <TColStd_Array1OfTransient.hxx>
|
||||
#include <TColStd_DataMapIteratorOfDataMapOfIntegerTransient.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(Interface_InterfaceModel, Standard_Transient)
|
||||
IMPLEMENT_STANDARD_RTTIEXT(DE_DataModel, Standard_Transient)
|
||||
|
||||
// Un Modele d`Interface est un ensemble ferme d`Entites d`interface : chacune
|
||||
// est dans un seul modele a la fois; elle y a un numero (Number) qui permet de
|
||||
@@ -57,11 +57,11 @@ static const Handle(Interface_Check)& nulch()
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Interface_InterfaceModel
|
||||
//function : DE_DataModel
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Interface_InterfaceModel::Interface_InterfaceModel ()
|
||||
DE_DataModel::DE_DataModel ()
|
||||
: haschecksem (Standard_False), isdispatch (Standard_False)
|
||||
{
|
||||
thecheckstx = new Interface_Check;
|
||||
@@ -74,7 +74,7 @@ Interface_InterfaceModel::Interface_InterfaceModel ()
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void Interface_InterfaceModel::Destroy () // on fait un mimumum
|
||||
void DE_DataModel::Destroy () // on fait un mimumum
|
||||
{
|
||||
// Moins que Clear que, lui, est adapte a chaque norme
|
||||
ClearEntities();
|
||||
@@ -89,7 +89,7 @@ void Interface_InterfaceModel::Destroy () // on fait un mimumum
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void Interface_InterfaceModel::SetProtocol(const Handle(Interface_Protocol)& proto)
|
||||
void DE_DataModel::SetProtocol(const Handle(Interface_Protocol)& proto)
|
||||
{
|
||||
thegtool = new Interface_GTool(proto);
|
||||
}
|
||||
@@ -100,7 +100,7 @@ void Interface_InterfaceModel::SetProtocol(const Handle(Interface_Protocol)& pro
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Handle(Interface_Protocol) Interface_InterfaceModel::Protocol () const
|
||||
Handle(Interface_Protocol) DE_DataModel::Protocol () const
|
||||
{
|
||||
Handle(Interface_Protocol) proto;
|
||||
if (!thegtool.IsNull()) return thegtool->Protocol();
|
||||
@@ -113,7 +113,7 @@ Handle(Interface_Protocol) Interface_InterfaceModel::Protocol () const
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void Interface_InterfaceModel::SetGTool(const Handle(Interface_GTool)& gtool)
|
||||
void DE_DataModel::SetGTool(const Handle(Interface_GTool)& gtool)
|
||||
{
|
||||
thegtool = gtool;
|
||||
}
|
||||
@@ -124,7 +124,7 @@ void Interface_InterfaceModel::SetGTool(const Handle(Interface_GTool)& gtool)
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Handle(Interface_GTool) Interface_InterfaceModel::GTool () const
|
||||
Handle(Interface_GTool) DE_DataModel::GTool () const
|
||||
{
|
||||
return thegtool;
|
||||
}
|
||||
@@ -135,7 +135,7 @@ Handle(Interface_GTool) Interface_InterfaceModel::GTool () const
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void Interface_InterfaceModel::Clear ()
|
||||
void DE_DataModel::Clear ()
|
||||
{
|
||||
ClearEntities();
|
||||
thecheckstx->Clear();
|
||||
@@ -151,7 +151,7 @@ void Interface_InterfaceModel::Clear ()
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean& Interface_InterfaceModel::DispatchStatus ()
|
||||
Standard_Boolean& DE_DataModel::DispatchStatus ()
|
||||
{
|
||||
return isdispatch;
|
||||
}
|
||||
@@ -162,7 +162,7 @@ Standard_Boolean& Interface_InterfaceModel::DispatchStatus ()
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void Interface_InterfaceModel::ClearEntities ()
|
||||
void DE_DataModel::ClearEntities ()
|
||||
{
|
||||
thereports.Clear();
|
||||
therepch.Clear();
|
||||
@@ -192,7 +192,7 @@ void Interface_InterfaceModel::ClearEntities ()
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Integer Interface_InterfaceModel::NbEntities () const
|
||||
Standard_Integer DE_DataModel::NbEntities () const
|
||||
{
|
||||
return theentities.Extent();
|
||||
}
|
||||
@@ -203,7 +203,7 @@ Standard_Integer Interface_InterfaceModel::NbEntities () const
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean Interface_InterfaceModel::Contains
|
||||
Standard_Boolean DE_DataModel::Contains
|
||||
(const Handle(Standard_Transient)& anentity) const
|
||||
{
|
||||
if (theentities.Contains(anentity)) return Standard_True;
|
||||
@@ -219,7 +219,7 @@ Standard_Boolean Interface_InterfaceModel::Contains
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Integer Interface_InterfaceModel::Number
|
||||
Standard_Integer DE_DataModel::Number
|
||||
(const Handle(Standard_Transient)& anentity) const
|
||||
{
|
||||
if (anentity.IsNull()) return 0;
|
||||
@@ -234,7 +234,7 @@ Standard_Integer Interface_InterfaceModel::Number
|
||||
}
|
||||
|
||||
/*
|
||||
Standard_Integer Interface_InterfaceModel::DENumber
|
||||
Standard_Integer DE_DataModel::DENumber
|
||||
(const Handle(Standard_Transient)& anentity) const
|
||||
{
|
||||
if (anentity.IsNull()) return 0;
|
||||
@@ -257,7 +257,7 @@ Standard_Integer Interface_InterfaceModel::DENumber
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
const Handle(Standard_Transient)& Interface_InterfaceModel::Value
|
||||
const Handle(Standard_Transient)& DE_DataModel::Value
|
||||
(const Standard_Integer num) const
|
||||
{
|
||||
return theentities.FindKey(num);
|
||||
@@ -269,7 +269,7 @@ const Handle(Standard_Transient)& Interface_InterfaceModel::Value
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Integer Interface_InterfaceModel::NbTypes
|
||||
Standard_Integer DE_DataModel::NbTypes
|
||||
(const Handle(Standard_Transient)& ent) const
|
||||
{
|
||||
if (Protocol().IsNull()) return 1;
|
||||
@@ -282,7 +282,7 @@ Standard_Integer Interface_InterfaceModel::NbTypes
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Handle(Standard_Type) Interface_InterfaceModel::Type
|
||||
Handle(Standard_Type) DE_DataModel::Type
|
||||
(const Handle(Standard_Transient)& ent, const Standard_Integer nt) const
|
||||
{
|
||||
if (Protocol().IsNull()) return ent->DynamicType();
|
||||
@@ -295,13 +295,13 @@ Handle(Standard_Type) Interface_InterfaceModel::Type
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_CString Interface_InterfaceModel::TypeName
|
||||
Standard_CString DE_DataModel::TypeName
|
||||
(const Handle(Standard_Transient)& ent, const Standard_Boolean complet) const
|
||||
{
|
||||
if (!thegtool.IsNull()) return thegtool->SignValue (ent,this);
|
||||
Standard_CString tn = ent->DynamicType()->Name();
|
||||
if (complet) return tn;
|
||||
return Interface_InterfaceModel::ClassName(tn);
|
||||
return DE_DataModel::ClassName(tn);
|
||||
}
|
||||
|
||||
|
||||
@@ -310,7 +310,7 @@ Standard_CString Interface_InterfaceModel::TypeName
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_CString Interface_InterfaceModel::ClassName(const Standard_CString typnam)
|
||||
Standard_CString DE_DataModel::ClassName(const Standard_CString typnam)
|
||||
{
|
||||
return Interface_SignType::ClassName (typnam);
|
||||
}
|
||||
@@ -321,7 +321,7 @@ Standard_CString Interface_InterfaceModel::ClassName(const Standard_CString typn
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Interface_DataState Interface_InterfaceModel::EntityState
|
||||
Interface_DataState DE_DataModel::EntityState
|
||||
(const Standard_Integer num) const
|
||||
{
|
||||
Handle(Interface_ReportEntity) rep;
|
||||
@@ -349,7 +349,7 @@ Interface_DataState Interface_InterfaceModel::EntityState
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean Interface_InterfaceModel::IsReportEntity
|
||||
Standard_Boolean DE_DataModel::IsReportEntity
|
||||
(const Standard_Integer num, const Standard_Boolean semantic) const
|
||||
{
|
||||
return (semantic ? therepch.IsBound(num) : thereports.IsBound(num));
|
||||
@@ -361,7 +361,7 @@ Standard_Boolean Interface_InterfaceModel::IsReportEntity
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Handle(Interface_ReportEntity) Interface_InterfaceModel::ReportEntity
|
||||
Handle(Interface_ReportEntity) DE_DataModel::ReportEntity
|
||||
(const Standard_Integer num, const Standard_Boolean semantic) const
|
||||
{
|
||||
Handle(Interface_ReportEntity) rep;
|
||||
@@ -377,7 +377,7 @@ Handle(Interface_ReportEntity) Interface_InterfaceModel::ReportEntity
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean Interface_InterfaceModel::IsErrorEntity
|
||||
Standard_Boolean DE_DataModel::IsErrorEntity
|
||||
(const Standard_Integer num) const
|
||||
{
|
||||
Handle(Interface_ReportEntity) rep = ReportEntity(num);
|
||||
@@ -391,7 +391,7 @@ Standard_Boolean Interface_InterfaceModel::IsErrorEntity
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean Interface_InterfaceModel::IsRedefinedContent
|
||||
Standard_Boolean DE_DataModel::IsRedefinedContent
|
||||
(const Standard_Integer num) const
|
||||
{
|
||||
Handle(Interface_ReportEntity) rep = ReportEntity(num);
|
||||
@@ -405,7 +405,7 @@ Standard_Boolean Interface_InterfaceModel::IsRedefinedContent
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean Interface_InterfaceModel::ClearReportEntity
|
||||
Standard_Boolean DE_DataModel::ClearReportEntity
|
||||
(const Standard_Integer num)
|
||||
{
|
||||
if (!thereports.IsBound(num)) return Standard_False;
|
||||
@@ -419,7 +419,7 @@ Standard_Boolean Interface_InterfaceModel::ClearReportEntity
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean Interface_InterfaceModel::SetReportEntity
|
||||
Standard_Boolean DE_DataModel::SetReportEntity
|
||||
(const Standard_Integer num, const Handle(Interface_ReportEntity)& rep)
|
||||
{
|
||||
Standard_Integer nm = num;
|
||||
@@ -450,7 +450,7 @@ Standard_Boolean Interface_InterfaceModel::SetReportEntity
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean Interface_InterfaceModel::AddReportEntity
|
||||
Standard_Boolean DE_DataModel::AddReportEntity
|
||||
(const Handle(Interface_ReportEntity)& rep, const Standard_Boolean semantic)
|
||||
{
|
||||
if (rep.IsNull()) return Standard_False;
|
||||
@@ -468,7 +468,7 @@ Standard_Boolean Interface_InterfaceModel::AddReportEntity
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean Interface_InterfaceModel::IsUnknownEntity
|
||||
Standard_Boolean DE_DataModel::IsUnknownEntity
|
||||
(const Standard_Integer num) const
|
||||
{
|
||||
Handle(Interface_ReportEntity) rep = ReportEntity(num);
|
||||
@@ -485,7 +485,7 @@ Standard_Boolean Interface_InterfaceModel::IsUnknownEntity
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void Interface_InterfaceModel::FillSemanticChecks
|
||||
void DE_DataModel::FillSemanticChecks
|
||||
(const Interface_CheckIterator& checks, const Standard_Boolean clear)
|
||||
{
|
||||
if (!checks.Model().IsNull()) {
|
||||
@@ -517,7 +517,7 @@ void Interface_InterfaceModel::FillSemanticChecks
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean Interface_InterfaceModel::HasSemanticChecks () const
|
||||
Standard_Boolean DE_DataModel::HasSemanticChecks () const
|
||||
{
|
||||
return haschecksem;
|
||||
}
|
||||
@@ -528,7 +528,7 @@ Standard_Boolean Interface_InterfaceModel::HasSemanticChecks () const
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
const Handle(Interface_Check)& Interface_InterfaceModel::Check
|
||||
const Handle(Interface_Check)& DE_DataModel::Check
|
||||
(const Standard_Integer num, const Standard_Boolean syntactic) const
|
||||
{
|
||||
if (num == 0) {
|
||||
@@ -554,7 +554,7 @@ const Handle(Interface_Check)& Interface_InterfaceModel::Check
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void Interface_InterfaceModel::Reservate (const Standard_Integer nbent)
|
||||
void DE_DataModel::Reservate (const Standard_Integer nbent)
|
||||
{
|
||||
if (nbent > theentities.NbBuckets()) theentities.ReSize (nbent);
|
||||
if (nbent < -thereports.NbBuckets()) thereports.ReSize (-nbent);
|
||||
@@ -566,7 +566,7 @@ void Interface_InterfaceModel::Reservate (const Standard_Integer nbent)
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void Interface_InterfaceModel::AddEntity(const Handle(Standard_Transient)& anentity)
|
||||
void DE_DataModel::AddEntity(const Handle(Standard_Transient)& anentity)
|
||||
{
|
||||
//Standard_Integer newnum; svv #2
|
||||
if (!anentity->IsKind(typerep())) theentities.Add(anentity);
|
||||
@@ -591,7 +591,7 @@ void Interface_InterfaceModel::AddEntity(const Handle(Standard_Transient)& anent
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void Interface_InterfaceModel::AddWithRefs(const Handle(Standard_Transient)& anent,
|
||||
void DE_DataModel::AddWithRefs(const Handle(Standard_Transient)& anent,
|
||||
const Handle(Interface_Protocol)& proto,
|
||||
const Standard_Integer level,
|
||||
const Standard_Boolean listall)
|
||||
@@ -611,7 +611,7 @@ void Interface_InterfaceModel::AddWithRefs(const Handle(Standard_Transient)& ane
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void Interface_InterfaceModel::AddWithRefs(const Handle(Standard_Transient)& anent,
|
||||
void DE_DataModel::AddWithRefs(const Handle(Standard_Transient)& anent,
|
||||
const Standard_Integer level,
|
||||
const Standard_Boolean listall)
|
||||
{
|
||||
@@ -626,7 +626,7 @@ void Interface_InterfaceModel::AddWithRefs(const Handle(Standard_Transient)& ane
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void Interface_InterfaceModel::AddWithRefs(const Handle(Standard_Transient)& anent,
|
||||
void DE_DataModel::AddWithRefs(const Handle(Standard_Transient)& anent,
|
||||
const Interface_GeneralLib& lib,
|
||||
const Standard_Integer level,
|
||||
const Standard_Boolean listall)
|
||||
@@ -657,7 +657,7 @@ void Interface_InterfaceModel::AddWithRefs(const Handle(Standard_Transient)& ane
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void Interface_InterfaceModel::ReplaceEntity(const Standard_Integer nument,
|
||||
void DE_DataModel::ReplaceEntity(const Standard_Integer nument,
|
||||
const Handle(Standard_Transient)& anent)
|
||||
{
|
||||
theentities.Substitute(nument,anent);
|
||||
@@ -673,7 +673,7 @@ void Interface_InterfaceModel::ReplaceEntity(const Standard_Integer nument,
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void Interface_InterfaceModel::ReverseOrders (const Standard_Integer after)
|
||||
void DE_DataModel::ReverseOrders (const Standard_Integer after)
|
||||
{
|
||||
Standard_Integer nb = NbEntities(); //Standard_Integer num; svv #2
|
||||
if (nb < 2 || after >= nb) return;
|
||||
@@ -706,7 +706,7 @@ void Interface_InterfaceModel::ReverseOrders (const Standard_Integer after)
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void Interface_InterfaceModel::ChangeOrder(const Standard_Integer oldnum,
|
||||
void DE_DataModel::ChangeOrder(const Standard_Integer oldnum,
|
||||
const Standard_Integer newnum,
|
||||
const Standard_Integer cnt) //szv#4:S4163:12Mar99 `count` hid one from this
|
||||
{
|
||||
@@ -751,7 +751,7 @@ void Interface_InterfaceModel::ChangeOrder(const Standard_Integer oldnum,
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void Interface_InterfaceModel::GetFromTransfer
|
||||
void DE_DataModel::GetFromTransfer
|
||||
(const Interface_EntityIterator& aniter)
|
||||
{
|
||||
theentities.Clear(); theentities.ReSize (aniter.NbEntities());
|
||||
@@ -769,7 +769,7 @@ void Interface_InterfaceModel::GetFromTransfer
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean Interface_InterfaceModel::SetCategoryNumber
|
||||
Standard_Boolean DE_DataModel::SetCategoryNumber
|
||||
(const Standard_Integer num, const Standard_Integer val)
|
||||
{
|
||||
Standard_Integer i,nb = NbEntities();
|
||||
@@ -792,7 +792,7 @@ Standard_Boolean Interface_InterfaceModel::SetCategoryNumber
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Integer Interface_InterfaceModel::CategoryNumber
|
||||
Standard_Integer DE_DataModel::CategoryNumber
|
||||
(const Standard_Integer num) const
|
||||
{
|
||||
if (thecategory.IsNull()) return 0;
|
||||
@@ -807,7 +807,7 @@ Standard_Integer Interface_InterfaceModel::CategoryNumber
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void Interface_InterfaceModel::FillIterator(Interface_EntityIterator& iter) const
|
||||
void DE_DataModel::FillIterator(Interface_EntityIterator& iter) const
|
||||
{
|
||||
Standard_Integer nb = NbEntities();
|
||||
for (Standard_Integer i = 1; i <= nb; i ++)
|
||||
@@ -820,7 +820,7 @@ void Interface_InterfaceModel::FillIterator(Interface_EntityIterator& iter) cons
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Interface_EntityIterator Interface_InterfaceModel::Entities () const
|
||||
Interface_EntityIterator DE_DataModel::Entities () const
|
||||
{
|
||||
Interface_EntityIterator iter;
|
||||
FillIterator(iter);
|
||||
@@ -833,7 +833,7 @@ Interface_EntityIterator Interface_InterfaceModel::Entities () const
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Interface_EntityIterator Interface_InterfaceModel::Reports
|
||||
Interface_EntityIterator DE_DataModel::Reports
|
||||
(const Standard_Boolean semantic) const
|
||||
{
|
||||
Interface_EntityIterator iter;
|
||||
@@ -853,7 +853,7 @@ Interface_EntityIterator Interface_InterfaceModel::Reports
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Interface_EntityIterator Interface_InterfaceModel::Redefineds () const
|
||||
Interface_EntityIterator DE_DataModel::Redefineds () const
|
||||
{
|
||||
Interface_EntityIterator iter;
|
||||
TColStd_DataMapIteratorOfDataMapOfIntegerTransient itmap (thereports);
|
||||
@@ -876,7 +876,7 @@ Interface_EntityIterator Interface_InterfaceModel::Redefineds () const
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
const Handle(Interface_Check)& Interface_InterfaceModel::GlobalCheck
|
||||
const Handle(Interface_Check)& DE_DataModel::GlobalCheck
|
||||
(const Standard_Boolean syntactic) const
|
||||
{
|
||||
if (syntactic) return thecheckstx;
|
||||
@@ -889,7 +889,7 @@ const Handle(Interface_Check)& Interface_InterfaceModel::GlobalCheck
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void Interface_InterfaceModel::SetGlobalCheck(const Handle(Interface_Check)& ach)
|
||||
void DE_DataModel::SetGlobalCheck(const Handle(Interface_Check)& ach)
|
||||
{
|
||||
thecheckstx = ach;
|
||||
}
|
||||
@@ -900,7 +900,7 @@ void Interface_InterfaceModel::SetGlobalCheck(const Handle(Interface_Check)& ach
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void Interface_InterfaceModel::VerifyCheck (Handle(Interface_Check)& /*ach*/) const
|
||||
void DE_DataModel::VerifyCheck (Handle(Interface_Check)& /*ach*/) const
|
||||
{
|
||||
}
|
||||
|
||||
@@ -910,7 +910,7 @@ void Interface_InterfaceModel::VerifyCheck (Handle(Interface_Check)& /*ach*/) co
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void Interface_InterfaceModel::Print(const Handle(Standard_Transient)& ent,
|
||||
void DE_DataModel::Print(const Handle(Standard_Transient)& ent,
|
||||
Standard_OStream& S,
|
||||
const Standard_Integer mode) const
|
||||
{
|
||||
@@ -932,7 +932,7 @@ void Interface_InterfaceModel::Print(const Handle(Standard_Transient)& ent,
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void Interface_InterfaceModel::PrintToLog(const Handle(Standard_Transient)& ent,
|
||||
void DE_DataModel::PrintToLog(const Handle(Standard_Transient)& ent,
|
||||
Standard_OStream& S) const
|
||||
{
|
||||
PrintLabel (ent,S);
|
||||
@@ -947,7 +947,7 @@ void Interface_InterfaceModel::PrintToLog(const Handle(Standard_Transient)& ent,
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Integer Interface_InterfaceModel::NextNumberForLabel
|
||||
Standard_Integer DE_DataModel::NextNumberForLabel
|
||||
(const Standard_CString label, const Standard_Integer fromnum,
|
||||
const Standard_Boolean exact) const
|
||||
{
|
||||
@@ -983,7 +983,7 @@ Standard_Integer Interface_InterfaceModel::NextNumberForLabel
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean Interface_InterfaceModel::HasTemplate
|
||||
Standard_Boolean DE_DataModel::HasTemplate
|
||||
(const Standard_CString name)
|
||||
{
|
||||
return atemp.IsBound(name);
|
||||
@@ -995,12 +995,12 @@ Standard_Boolean Interface_InterfaceModel::HasTemplate
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Handle(Interface_InterfaceModel) Interface_InterfaceModel::Template
|
||||
Handle(DE_DataModel) DE_DataModel::Template
|
||||
(const Standard_CString name)
|
||||
{
|
||||
Handle(Interface_InterfaceModel) model,newmod;
|
||||
Handle(DE_DataModel) model,newmod;
|
||||
if (!HasTemplate(name)) return model;
|
||||
model = Handle(Interface_InterfaceModel)::DownCast(atemp.ChangeFind(name));
|
||||
model = Handle(DE_DataModel)::DownCast(atemp.ChangeFind(name));
|
||||
newmod = model->NewEmptyModel();
|
||||
newmod->GetFromAnother (model);
|
||||
return newmod;
|
||||
@@ -1012,8 +1012,8 @@ Handle(Interface_InterfaceModel) Interface_InterfaceModel::Template
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean Interface_InterfaceModel::SetTemplate
|
||||
(const Standard_CString name, const Handle(Interface_InterfaceModel)& model)
|
||||
Standard_Boolean DE_DataModel::SetTemplate
|
||||
(const Standard_CString name, const Handle(DE_DataModel)& model)
|
||||
{
|
||||
return atemp.Bind(name, model);
|
||||
}
|
||||
@@ -1024,7 +1024,7 @@ Standard_Boolean Interface_InterfaceModel::SetTemplate
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Handle(TColStd_HSequenceOfHAsciiString) Interface_InterfaceModel::ListTemplates ()
|
||||
Handle(TColStd_HSequenceOfHAsciiString) DE_DataModel::ListTemplates ()
|
||||
{
|
||||
Handle(TColStd_HSequenceOfHAsciiString) list = new
|
||||
TColStd_HSequenceOfHAsciiString();
|
@@ -13,30 +13,24 @@
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#ifndef _Interface_InterfaceModel_HeaderFile
|
||||
#define _Interface_InterfaceModel_HeaderFile
|
||||
#ifndef _DE_DataModel_HeaderFile
|
||||
#define _DE_DataModel_HeaderFile
|
||||
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_Type.hxx>
|
||||
|
||||
#include <Interface_EntityIterator.hxx>
|
||||
#include <Interface_DataState.hxx>
|
||||
#include <Interface_Check.hxx>
|
||||
#include <Interface_CheckIterator.hxx>
|
||||
#include <Interface_ReportEntity.hxx>
|
||||
#include <TColStd_IndexedMapOfTransient.hxx>
|
||||
#include <TColStd_DataMapOfIntegerTransient.hxx>
|
||||
#include <Standard_Transient.hxx>
|
||||
#include <Standard_Integer.hxx>
|
||||
#include <Interface_DataState.hxx>
|
||||
#include <TColStd_HSequenceOfHAsciiString.hxx>
|
||||
class Interface_Check;
|
||||
|
||||
class TCollection_HAsciiString;
|
||||
class Interface_GTool;
|
||||
class Interface_Protocol;
|
||||
class Interface_ReportEntity;
|
||||
class Interface_CheckIterator;
|
||||
class Interface_GeneralLib;
|
||||
class Interface_EntityIterator;
|
||||
|
||||
|
||||
class Interface_InterfaceModel;
|
||||
DEFINE_STANDARD_HANDLE(Interface_InterfaceModel, Standard_Transient)
|
||||
|
||||
//! Defines an (Indexed) Set of data corresponding to a complete
|
||||
//! Transfer by a File Interface, i.e. File Header and Transient
|
||||
@@ -64,39 +58,19 @@ DEFINE_STANDARD_HANDLE(Interface_InterfaceModel, Standard_Transient)
|
||||
//! under another name).
|
||||
//!
|
||||
//! See also Graph, ShareTool, CheckTool for more
|
||||
class Interface_InterfaceModel : public Standard_Transient
|
||||
class DE_DataModel : public Standard_Transient
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
|
||||
//! Clears the list of entities (service WhenDelete)
|
||||
//! Defines empty InterfaceModel, ready to be filled
|
||||
Standard_EXPORT DE_DataModel();
|
||||
|
||||
//! Clear
|
||||
Standard_EXPORT void Destroy();
|
||||
~Interface_InterfaceModel()
|
||||
{
|
||||
Destroy();
|
||||
}
|
||||
|
||||
//! Sets a Protocol for this Model
|
||||
//! It is also set by a call to AddWithRefs with Protocol
|
||||
//! It is used for : DumpHeader (as required), ClearEntities ...
|
||||
Standard_EXPORT void SetProtocol (const Handle(Interface_Protocol)& proto);
|
||||
|
||||
//! Returns the Protocol which has been set by SetProtocol, or
|
||||
//! AddWithRefs with Protocol
|
||||
Standard_EXPORT virtual Handle(Interface_Protocol) Protocol() const;
|
||||
|
||||
//! Sets a GTool for this model, which already defines a Protocol
|
||||
Standard_EXPORT void SetGTool (const Handle(Interface_GTool)& gtool);
|
||||
|
||||
//! Returns the GTool, set by SetProtocol or by SetGTool
|
||||
Standard_EXPORT Handle(Interface_GTool) GTool() const;
|
||||
|
||||
//! Returns the Dispatch Status, either for get or set
|
||||
//! A Model which is produced from Dispatch may share entities
|
||||
//! with the original (according to the Protocol), hence these
|
||||
//! non-copied entities should not be deleted
|
||||
Standard_EXPORT Standard_Boolean& DispatchStatus();
|
||||
virtual ~DE_DataModel() { Destroy(); }
|
||||
|
||||
//! Erases contained data; used when a Model is copied to others :
|
||||
//! the new copied ones begin from clear
|
||||
@@ -109,24 +83,24 @@ public:
|
||||
|
||||
//! Erases information about labels, if any : specific to each
|
||||
//! norm
|
||||
Standard_EXPORT virtual void ClearLabels() = 0;
|
||||
Standard_EXPORT virtual void ClearLabels();
|
||||
|
||||
//! Clears Model's header : specific to each norm
|
||||
Standard_EXPORT virtual void ClearHeader() = 0;
|
||||
Standard_EXPORT virtual void ClearHeader();
|
||||
|
||||
//! Returns count of contained Entities
|
||||
Standard_EXPORT Standard_Integer NbEntities() const;
|
||||
|
||||
//! Returns True if a Model contains an Entity (for a ReportEntity,
|
||||
//! looks for the ReportEntity itself AND its Concerned Entity)
|
||||
Standard_EXPORT Standard_Boolean Contains (const Handle(Standard_Transient)& anentity) const;
|
||||
Standard_EXPORT Standard_Boolean Contains(const Handle(Standard_Transient)& anentity) const;
|
||||
|
||||
//! Returns the Number of an Entity in the Model if it contains it.
|
||||
//! Else returns 0. For a ReportEntity, looks at Concerned Entity.
|
||||
//! Returns the Directory entry Number of an Entity in
|
||||
//! the Model if it contains it. Else returns 0. For a
|
||||
//! ReportEntity, looks at Concerned Entity.
|
||||
Standard_EXPORT Standard_Integer Number (const Handle(Standard_Transient)& anentity) const;
|
||||
Standard_EXPORT Standard_Integer Number(const Handle(Standard_Transient)& anentity) const;
|
||||
|
||||
//! Returns an Entity identified by its number in the Model
|
||||
//! Each sub-class of InterfaceModel can define its own method
|
||||
@@ -135,30 +109,32 @@ public:
|
||||
//! Remark : For a Reported Entity, (Erroneous, Corrected, Unknown), this
|
||||
//! method returns this Reported Entity.
|
||||
//! See ReportEntity for other questions.
|
||||
Standard_EXPORT const Handle(Standard_Transient)& Value (const Standard_Integer num) const;
|
||||
Standard_EXPORT const Handle(Standard_Transient)& Value(const Standard_Integer num) const;
|
||||
|
||||
//! Returns the count of DISTINCT types under which an entity may
|
||||
//! be processed. Defined by the Protocol, which gives default as
|
||||
//! 1 (dynamic Type).
|
||||
Standard_EXPORT Standard_Integer NbTypes (const Handle(Standard_Transient)& ent) const;
|
||||
Standard_EXPORT Standard_Integer NbTypes(const Handle(Standard_Transient)& ent) const;
|
||||
|
||||
//! Returns a type, given its rank : defined by the Protocol
|
||||
//! (by default, the first one)
|
||||
Standard_EXPORT Handle(Standard_Type) Type (const Handle(Standard_Transient)& ent, const Standard_Integer num = 1) const;
|
||||
Standard_EXPORT Handle(Standard_Type) Type(const Handle(Standard_Transient)& ent,
|
||||
const Standard_Integer num = 1) const;
|
||||
|
||||
//! Returns the type name of an entity, from the list of types
|
||||
//! (one or more ...)
|
||||
//! <complete> True (D) gives the complete type, else packages are
|
||||
//! removed
|
||||
//! WARNING : buffered, to be immediately copied or printed
|
||||
Standard_EXPORT Standard_CString TypeName (const Handle(Standard_Transient)& ent, const Standard_Boolean complete = Standard_True) const;
|
||||
Standard_EXPORT Standard_CString TypeName(const Handle(Standard_Transient)& ent,
|
||||
const Standard_Boolean complete = Standard_True) const;
|
||||
|
||||
//! From a CDL Type Name, returns the Class part (package dropped)
|
||||
//! WARNING : buffered, to be immediately copied or printed
|
||||
Standard_EXPORT static Standard_CString ClassName (const Standard_CString typnam);
|
||||
Standard_EXPORT static Standard_CString ClassName(const Standard_CString typnam);
|
||||
|
||||
//! Returns the State of an entity, given its number
|
||||
Standard_EXPORT Interface_DataState EntityState (const Standard_Integer num) const;
|
||||
Standard_EXPORT Interface_DataState EntityState(const Standard_Integer num) const;
|
||||
|
||||
//! Returns True if <num> identifies a ReportEntity in the Model
|
||||
//! Hence, ReportEntity can be called.
|
||||
@@ -169,53 +145,58 @@ public:
|
||||
//! Remember that a Report Entity can be defined for an Unknown
|
||||
//! Entity, or a Corrected or Erroneous (at read time) Entity.
|
||||
//! The ReportEntity is defined before call to method AddEntity.
|
||||
Standard_EXPORT Standard_Boolean IsReportEntity (const Standard_Integer num, const Standard_Boolean semantic = Standard_False) const;
|
||||
Standard_EXPORT Standard_Boolean IsReportEntity(const Standard_Integer num,
|
||||
const Standard_Boolean semantic = Standard_False) const;
|
||||
|
||||
//! Returns a ReportEntity identified by its number in the Model,
|
||||
//! or a Null Handle If <num> does not identify a ReportEntity.
|
||||
//!
|
||||
//! By default, queries main report, if <semantic> is True, it
|
||||
//! queries report for semantic check
|
||||
Standard_EXPORT Handle(Interface_ReportEntity) ReportEntity (const Standard_Integer num, const Standard_Boolean semantic = Standard_False) const;
|
||||
Standard_EXPORT Handle(Interface_ReportEntity) ReportEntity(const Standard_Integer num,
|
||||
const Standard_Boolean semantic = Standard_False) const;
|
||||
|
||||
//! Returns True if <num> identifies an Error Entity : in this
|
||||
//! case, a ReportEntity brings Fail Messages and possibly an
|
||||
//! "undefined" Content, see IsRedefinedEntity
|
||||
Standard_EXPORT Standard_Boolean IsErrorEntity (const Standard_Integer num) const;
|
||||
Standard_EXPORT Standard_Boolean IsErrorEntity(const Standard_Integer num) const;
|
||||
|
||||
//! Returns True if <num> identifies an Entity which content is
|
||||
//! redefined through a ReportEntity (i.e. with literal data only)
|
||||
//! This happens when an entity is syntactically erroneous in the
|
||||
//! way that its basic content remains empty.
|
||||
//! For more details (such as content itself), see ReportEntity
|
||||
Standard_EXPORT Standard_Boolean IsRedefinedContent (const Standard_Integer num) const;
|
||||
Standard_EXPORT Standard_Boolean IsRedefinedContent(const Standard_Integer num) const;
|
||||
|
||||
//! Removes the ReportEntity attached to Entity <num>. Returns
|
||||
//! True if done, False if no ReportEntity was attached to <num>.
|
||||
//! Warning : the caller must assume that this clearing is meaningful
|
||||
Standard_EXPORT Standard_Boolean ClearReportEntity (const Standard_Integer num);
|
||||
Standard_EXPORT Standard_Boolean ClearReportEntity(const Standard_Integer num);
|
||||
|
||||
//! Sets or Replaces a ReportEntity for the Entity <num>. Returns
|
||||
//! True if Report is replaced, False if it has been replaced
|
||||
//! Warning : the caller must assume that this setting is meaningful
|
||||
Standard_EXPORT Standard_Boolean SetReportEntity (const Standard_Integer num, const Handle(Interface_ReportEntity)& rep);
|
||||
Standard_EXPORT Standard_Boolean SetReportEntity(const Standard_Integer num,
|
||||
const Handle(Interface_ReportEntity)& rep);
|
||||
|
||||
//! Adds a ReportEntity as such. Returns False if the concerned
|
||||
//! entity is not recorded in the Model
|
||||
//! Else, adds it into, either the main report list or the
|
||||
//! list for semantic checks, then returns True
|
||||
Standard_EXPORT Standard_Boolean AddReportEntity (const Handle(Interface_ReportEntity)& rep, const Standard_Boolean semantic = Standard_False);
|
||||
Standard_EXPORT Standard_Boolean AddReportEntity(const Handle(Interface_ReportEntity)& rep,
|
||||
const Standard_Boolean semantic = Standard_False);
|
||||
|
||||
//! Returns True if <num> identifies an Unknown Entity : in this
|
||||
//! case, a ReportEntity with no Check Messages designates it.
|
||||
Standard_EXPORT Standard_Boolean IsUnknownEntity (const Standard_Integer num) const;
|
||||
Standard_EXPORT Standard_Boolean IsUnknownEntity(const Standard_Integer num) const;
|
||||
|
||||
//! Fills the list of semantic checks.
|
||||
//! This list is computed (by CheckTool). Hence, it can be stored
|
||||
//! in the model for later queries
|
||||
//! <clear> True (D) : new list replaces
|
||||
//! <clear> False : new list is cumulated
|
||||
Standard_EXPORT void FillSemanticChecks (const Interface_CheckIterator& checks, const Standard_Boolean clear = Standard_True);
|
||||
Standard_EXPORT void FillSemanticChecks(const Interface_CheckIterator& checks,
|
||||
const Standard_Boolean clear = Standard_True);
|
||||
|
||||
//! Returns True if semantic checks have been filled
|
||||
Standard_EXPORT Standard_Boolean HasSemanticChecks() const;
|
||||
@@ -225,13 +206,14 @@ public:
|
||||
//! <semantic> True : recorded semantic check
|
||||
//! <semantic> False : recorded syntactic check (see ReportEntity)
|
||||
//! If no check is recorded for <num>, returns an empty Check
|
||||
Standard_EXPORT const Handle(Interface_Check)& Check (const Standard_Integer num, const Standard_Boolean syntactic) const;
|
||||
Standard_EXPORT const Handle(Interface_Check)& Check(const Standard_Integer num,
|
||||
const Standard_Boolean syntactic) const;
|
||||
|
||||
//! Does a reservation for the List of Entities (for optimized
|
||||
//! storage management). If it is not called, storage management
|
||||
//! can be less efficient. <nbent> is the expected count of
|
||||
//! Entities to store
|
||||
Standard_EXPORT virtual void Reservate (const Standard_Integer nbent);
|
||||
Standard_EXPORT virtual void Reservate(const Standard_Integer nbent);
|
||||
|
||||
//! Internal method for adding an Entity. Used by file reading
|
||||
//! (defined by each Interface) and Transfer tools. It adds the
|
||||
@@ -240,68 +222,52 @@ public:
|
||||
//! Reports, its Concerned Entity (Erroneous or Corrected, else
|
||||
//! Unknown) is added to the list of Entities.
|
||||
//! That is, the ReportEntity must be created before Adding
|
||||
Standard_EXPORT virtual void AddEntity (const Handle(Standard_Transient)& anentity);
|
||||
|
||||
//! Adds to the Model, an Entity with all its References, as they
|
||||
//! are defined by General Services FillShared and ListImplied.
|
||||
//! Process is recursive (any sub-levels) if <level> = 0 (Default)
|
||||
//! Else, adds sub-entities until the required sub-level.
|
||||
//! Especially, if <level> = 1, adds immediate subs and that's all
|
||||
//!
|
||||
//! If <listall> is False (Default), an entity (<anentity> itself
|
||||
//! or one of its subs at any level) which is already recorded in
|
||||
//! the Model is not analysed, only the newly added ones are.
|
||||
//! If <listall> is True, all items are analysed (this allows to
|
||||
//! ensure the consistency of an adding made by steps)
|
||||
Standard_EXPORT void AddWithRefs (const Handle(Standard_Transient)& anent, const Handle(Interface_Protocol)& proto, const Standard_Integer level = 0, const Standard_Boolean listall = Standard_False);
|
||||
|
||||
//! Same as above, but works with the Protocol of the Model
|
||||
Standard_EXPORT void AddWithRefs (const Handle(Standard_Transient)& anent, const Standard_Integer level = 0, const Standard_Boolean listall = Standard_False);
|
||||
|
||||
//! Same as above, but works with an already created GeneralLib
|
||||
Standard_EXPORT void AddWithRefs (const Handle(Standard_Transient)& anent, const Interface_GeneralLib& lib, const Standard_Integer level = 0, const Standard_Boolean listall = Standard_False);
|
||||
Standard_EXPORT virtual void AddEntity(const Handle(Standard_Transient)& anentity);
|
||||
|
||||
//! Replace Entity with Number=nument on other entity - "anent"
|
||||
Standard_EXPORT void ReplaceEntity (const Standard_Integer nument, const Handle(Standard_Transient)& anent);
|
||||
Standard_EXPORT void ReplaceEntity(const Standard_Integer nument,
|
||||
const Handle(Standard_Transient)& anent);
|
||||
|
||||
//! Reverses the Numbers of the Entities, between <after> and the
|
||||
//! total count of Entities. Thus, the entities :
|
||||
//! 1,2 ... after, after+1 ... nb-1, nb become numbered as :
|
||||
//! 1,2 ... after, nb, nb-1 ... after+1
|
||||
//! By default (after = 0) the whole list of Entities is reversed
|
||||
Standard_EXPORT void ReverseOrders (const Standard_Integer after = 0);
|
||||
Standard_EXPORT void ReverseOrders(const Standard_Integer after = 0);
|
||||
|
||||
//! Changes the Numbers of some Entities : <oldnum> is moved to
|
||||
//! <newnum>, same for <count> entities. Thus :
|
||||
//! 1,2 ... newnum-1 newnum ... oldnum .. oldnum+count oldnum+count+1 .. gives
|
||||
//! 1,2 ... newnum-1 oldnum .. oldnum+count newnum ... oldnum+count+1
|
||||
//! (can be seen as a circular permutation)
|
||||
Standard_EXPORT void ChangeOrder (const Standard_Integer oldnum, const Standard_Integer newnum, const Standard_Integer count = 1);
|
||||
Standard_EXPORT void ChangeOrder(const Standard_Integer oldnum,
|
||||
const Standard_Integer newnum,
|
||||
const Standard_Integer count = 1);
|
||||
|
||||
//! Gets contents from an EntityIterator, prepared by a
|
||||
//! Transfer tool (e.g TransferCopy). Starts from clear
|
||||
Standard_EXPORT void GetFromTransfer (const Interface_EntityIterator& aniter);
|
||||
Standard_EXPORT void GetFromTransfer(const Interface_EntityIterator& aniter);
|
||||
|
||||
//! Gets header (data specific of a defined Interface) from
|
||||
//! another InterfaceModel; called from TransferCopy
|
||||
Standard_EXPORT virtual void GetFromAnother (const Handle(Interface_InterfaceModel)& other) = 0;
|
||||
Standard_EXPORT virtual void GetFromAnother(const Handle(DE_DataModel)& other);
|
||||
|
||||
//! Returns a New Empty Model, same type as <me> (whatever its
|
||||
//! Type); called to Copy parts a Model into other ones, then
|
||||
//! followed by a call to GetFromAnother (Header) then filling
|
||||
//! with specified Entities, themselves copied
|
||||
Standard_EXPORT virtual Handle(Interface_InterfaceModel) NewEmptyModel() const = 0;
|
||||
Standard_EXPORT virtual Handle(DE_DataModel) NewEmptyModel() const;
|
||||
|
||||
//! Records a category number for an entity number
|
||||
//! Returns True when done, False if <num> is out of range
|
||||
Standard_EXPORT Standard_Boolean SetCategoryNumber (const Standard_Integer num, const Standard_Integer val);
|
||||
Standard_EXPORT Standard_Boolean SetCategoryNumber(const Standard_Integer num, const Standard_Integer val);
|
||||
|
||||
//! Returns the recorded category number for a given entity number
|
||||
//! 0 if none was defined for this entity
|
||||
Standard_EXPORT Standard_Integer CategoryNumber (const Standard_Integer num) const;
|
||||
Standard_EXPORT Standard_Integer CategoryNumber(const Standard_Integer num) const;
|
||||
|
||||
//! Allows an EntityIterator to get a list of Entities
|
||||
Standard_EXPORT void FillIterator (Interface_EntityIterator& iter) const;
|
||||
Standard_EXPORT void FillIterator(Interface_EntityIterator& iter) const;
|
||||
|
||||
//! Returns the list of all Entities, as an Iterator on Entities
|
||||
//! (the Entities themselves, not the Reports)
|
||||
@@ -313,7 +279,7 @@ public:
|
||||
//! queried for Concerned Entity, Content, Check ...)
|
||||
//! By default, returns the main reports, is <semantic> is True it
|
||||
//! returns the list for semantic checks
|
||||
Standard_EXPORT Interface_EntityIterator Reports (const Standard_Boolean semantic = Standard_False) const;
|
||||
Standard_EXPORT Interface_EntityIterator Reports(const Standard_Boolean semantic = Standard_False) const;
|
||||
|
||||
//! Returns the list of ReportEntities which redefine data
|
||||
//! (generally, if concerned entity is "Error", a literal content
|
||||
@@ -322,46 +288,22 @@ public:
|
||||
|
||||
//! Returns the GlobalCheck, which memorizes messages global to
|
||||
//! the file (not specific to an Entity), especially Header
|
||||
Standard_EXPORT const Handle(Interface_Check)& GlobalCheck (const Standard_Boolean syntactic = Standard_True) const;
|
||||
Standard_EXPORT const Handle(Interface_Check)& GlobalCheck(const Standard_Boolean syntactic = Standard_True) const;
|
||||
|
||||
//! Allows to modify GlobalCheck, after getting then completing it
|
||||
//! Remark : it is SYNTACTIC check. Semantics, see FillChecks
|
||||
Standard_EXPORT void SetGlobalCheck (const Handle(Interface_Check)& ach);
|
||||
Standard_EXPORT void SetGlobalCheck(const Handle(Interface_Check)& ach);
|
||||
|
||||
//! Minimum Semantic Global Check on data in model (header)
|
||||
//! Can only check basic Data. See also GlobalCheck from Protocol
|
||||
//! for a check which takes the Graph into account
|
||||
//! Default does nothing, can be redefined
|
||||
Standard_EXPORT virtual void VerifyCheck (Handle(Interface_Check)& ach) const;
|
||||
|
||||
//! Dumps Header in a short, easy to read, form, onto a Stream
|
||||
//! <level> allows to print more or less parts of the header,
|
||||
//! if necessary. 0 for basic print
|
||||
Standard_EXPORT virtual void DumpHeader (Standard_OStream& S, const Standard_Integer level = 0) const = 0;
|
||||
|
||||
//! Prints identification of a given entity in <me>, in order to
|
||||
//! be printed in a list or phrase
|
||||
//! <mode> < 0 : prints only its number
|
||||
//! <mode> = 1 : just calls PrintLabel
|
||||
//! <mode> = 0 (D) : prints its number plus '/' plus PrintLabel
|
||||
//! If <ent> == <me>, simply prints "Global"
|
||||
//! If <ent> is unknown, prints "??/its type"
|
||||
Standard_EXPORT void Print (const Handle(Standard_Transient)& ent, Standard_OStream& s, const Standard_Integer mode = 0) const;
|
||||
|
||||
//! Prints label specific to each norm, for a given entity.
|
||||
//! Must only print label itself, in order to be included in a
|
||||
//! phrase. Can call the result of StringLabel, but not obliged.
|
||||
Standard_EXPORT virtual void PrintLabel (const Handle(Standard_Transient)& ent, Standard_OStream& S) const = 0;
|
||||
|
||||
//! Prints label specific to each norm in log format, for
|
||||
//! a given entity.
|
||||
//! By default, just calls PrintLabel, can be redefined
|
||||
Standard_EXPORT virtual void PrintToLog (const Handle(Standard_Transient)& ent, Standard_OStream& S) const;
|
||||
Standard_EXPORT virtual void VerifyCheck(Handle(Interface_Check)& ach) const;
|
||||
|
||||
//! Returns a string with the label attached to a given entity.
|
||||
//! Warning : While this string may be edited on the spot, if it is a read
|
||||
//! field, the returned value must be copied before.
|
||||
Standard_EXPORT virtual Handle(TCollection_HAsciiString) StringLabel (const Handle(Standard_Transient)& ent) const = 0;
|
||||
Standard_EXPORT virtual Handle(TCollection_HAsciiString) StringLabel(const Handle(Standard_Transient)& ent) const;
|
||||
|
||||
//! Searches a label which matches with one entity.
|
||||
//! Begins from <lastnum>+1 (default:1) and scans the entities
|
||||
@@ -373,55 +315,19 @@ public:
|
||||
//!
|
||||
//! This method is virtual, hence it can be redefined for a more
|
||||
//! efficient search (if exact is true).
|
||||
Standard_EXPORT virtual Standard_Integer NextNumberForLabel (const Standard_CString label, const Standard_Integer lastnum = 0, const Standard_Boolean exact = Standard_True) const;
|
||||
|
||||
//! Returns true if a template is attached to a given name
|
||||
Standard_EXPORT static Standard_Boolean HasTemplate (const Standard_CString name);
|
||||
|
||||
//! Returns the template model attached to a name, or a Null Handle
|
||||
Standard_EXPORT static Handle(Interface_InterfaceModel) Template (const Standard_CString name);
|
||||
|
||||
//! Records a new template model with a name. If the name was
|
||||
//! already recorded, the corresponding template is replaced by
|
||||
//! the new one. Then, WARNING : test HasTemplate to avoid
|
||||
//! surprises
|
||||
Standard_EXPORT static Standard_Boolean SetTemplate (const Standard_CString name, const Handle(Interface_InterfaceModel)& model);
|
||||
|
||||
//! Returns the complete list of names attached to template models
|
||||
Standard_EXPORT static Handle(TColStd_HSequenceOfHAsciiString) ListTemplates();
|
||||
|
||||
|
||||
|
||||
DEFINE_STANDARD_RTTIEXT(Interface_InterfaceModel,Standard_Transient)
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
//! Defines empty InterfaceModel, ready to be filled
|
||||
Standard_EXPORT Interface_InterfaceModel();
|
||||
|
||||
Standard_EXPORT virtual Standard_Integer NextNumberForLabel(const Standard_CString label,
|
||||
const Standard_Integer lastnum = 0,
|
||||
const Standard_Boolean exact = Standard_True) const;
|
||||
|
||||
DEFINE_STANDARD_RTTIEXT(DE_DataModel, Standard_Transient)
|
||||
|
||||
private:
|
||||
|
||||
|
||||
TColStd_IndexedMapOfTransient theentities;
|
||||
TColStd_DataMapOfIntegerTransient thereports;
|
||||
TColStd_DataMapOfIntegerTransient therepch;
|
||||
Handle(Interface_Check) thecheckstx;
|
||||
Handle(Interface_Check) thechecksem;
|
||||
Standard_Boolean haschecksem;
|
||||
Standard_Boolean isdispatch;
|
||||
Handle(TCollection_HAsciiString) thecategory;
|
||||
Handle(Interface_GTool) thegtool;
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // _Interface_InterfaceModel_HeaderFile
|
||||
#endif // _DE_DataModel_HeaderFile
|
@@ -14,10 +14,111 @@
|
||||
#include <DE_Provider.hxx>
|
||||
|
||||
#include <DE_ConfigurationNode.hxx>
|
||||
#include <OSD_Directory.hxx>
|
||||
#include <OSD_File.hxx>
|
||||
#include <OSD_OpenFile.hxx>
|
||||
#include <OSD_Protection.hxx>
|
||||
#include <Message.hxx>
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(DE_Provider, Standard_Transient)
|
||||
|
||||
namespace
|
||||
{
|
||||
class DE_TemporaryFile
|
||||
{
|
||||
public:
|
||||
DE_TemporaryFile(const TCollection_AsciiString& theFolderPath,
|
||||
const TCollection_AsciiString& theExtension);
|
||||
|
||||
~DE_TemporaryFile();
|
||||
|
||||
TCollection_AsciiString Path() const { return myTempPath; }
|
||||
|
||||
Standard_Boolean IsDone() const { return myIsCreated; }
|
||||
|
||||
private:
|
||||
|
||||
Standard_Boolean myIsCreated = Standard_False;
|
||||
TCollection_AsciiString myTempPath;
|
||||
OSD_File myFile;
|
||||
};
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
// function : DE_TemporaryFile
|
||||
// purpose :
|
||||
//=======================================================================
|
||||
DE_TemporaryFile::DE_TemporaryFile(const TCollection_AsciiString& theFolderPath,
|
||||
const TCollection_AsciiString& theExtension)
|
||||
{
|
||||
Standard_Boolean anIsCreated = Standard_False;
|
||||
OSD_Directory aDirectory;
|
||||
if (!theFolderPath.IsEmpty())
|
||||
{
|
||||
OSD_Directory anInternalFolder(theFolderPath);
|
||||
if (!anInternalFolder.Failed())
|
||||
{
|
||||
aDirectory = anInternalFolder;
|
||||
anIsCreated = Standard_True;
|
||||
}
|
||||
}
|
||||
if (!anIsCreated)
|
||||
{
|
||||
aDirectory = OSD_Directory::BuildTemporary();
|
||||
}
|
||||
OSD_Path aPath;
|
||||
aDirectory.Path(aPath);
|
||||
TCollection_AsciiString aFullPath;
|
||||
aPath.SystemName(aFullPath);
|
||||
if (!anIsCreated)
|
||||
{
|
||||
Message::SendTrace() << "DE Provider : Using temporary folder from system : ["
|
||||
<< aFullPath << "]";
|
||||
}
|
||||
if (aDirectory.Failed())
|
||||
{
|
||||
Message::SendFail() << "Error: DE Provider : Can't create folder by path : ["
|
||||
<< aFullPath << "]";
|
||||
}
|
||||
TCollection_AsciiString aTempName(tempnam(aFullPath.ToCString(), nullptr));
|
||||
aTempName += ".";
|
||||
aTempName += theExtension;
|
||||
myFile = OSD_File(aTempName);
|
||||
myFile.Build(OSD_ReadWrite, OSD_Protection());
|
||||
if (myFile.Failed())
|
||||
{
|
||||
Message::SendFail() << "Error: DE Provider : Can't create tempolary file by path : ["
|
||||
<< aTempName << "]";
|
||||
return;
|
||||
}
|
||||
myIsCreated = Standard_True;
|
||||
myTempPath = aTempName;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
// function : DE_TemporaryFile
|
||||
// purpose :
|
||||
//=======================================================================
|
||||
DE_TemporaryFile::~DE_TemporaryFile()
|
||||
{
|
||||
if (!myIsCreated)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (myFile.IsLocked())
|
||||
{
|
||||
myFile.UnLock();
|
||||
}
|
||||
myFile.Close();
|
||||
if (std::remove(myTempPath.ToCString()) != 0)
|
||||
{
|
||||
Message::SendFail() << "Error: DE Provider : Can't remove tempolary file by path : ["
|
||||
<< myTempPath << "]";
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
// function : DE_Provider
|
||||
// purpose :
|
||||
@@ -39,75 +140,129 @@ DE_Provider::DE_Provider(const Handle(DE_ConfigurationNode)& theNode)
|
||||
//=======================================================================
|
||||
Standard_Boolean DE_Provider::Read(const TCollection_AsciiString& thePath,
|
||||
const Handle(TDocStd_Document)& theDocument,
|
||||
Handle(XSControl_WorkSession)& theWS,
|
||||
Handle(DE_WorkSession)& theWS,
|
||||
const Message_ProgressRange& theProgress)
|
||||
{
|
||||
(void)thePath;
|
||||
(void)theDocument;
|
||||
(void)theWS;
|
||||
(void)theProgress;
|
||||
Message::SendFail() << "Error: provider " << GetFormat() <<
|
||||
" " << GetVendor() <<" doesn't support read operation";
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
// function : Write
|
||||
// purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean DE_Provider::Write(const TCollection_AsciiString& thePath,
|
||||
const Handle(TDocStd_Document)& theDocument,
|
||||
Handle(XSControl_WorkSession)& theWS,
|
||||
const Message_ProgressRange& theProgress)
|
||||
{
|
||||
(void)thePath;
|
||||
(void)theDocument;
|
||||
(void)theWS;
|
||||
(void)theProgress;
|
||||
Message::SendFail() << "Error: provider " << GetFormat() <<
|
||||
" " << GetVendor() << " doesn't support write operation";
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
// function : Read
|
||||
// purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean DE_Provider::Read(const TCollection_AsciiString& thePath,
|
||||
const Handle(TDocStd_Document)& theDocument,
|
||||
const Message_ProgressRange& theProgress)
|
||||
{
|
||||
(void)thePath;
|
||||
(void)theDocument;
|
||||
(void)theProgress;
|
||||
Message::SendFail() << "Error: provider " << GetFormat() <<
|
||||
" " << GetVendor() << " doesn't support read operation";
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
// function : Read
|
||||
// purpose :
|
||||
//=======================================================================
|
||||
bool DE_Provider::Read(std::istream& theIStream,
|
||||
const Handle(TDocStd_Document)& theDocument,
|
||||
const TCollection_AsciiString theName,
|
||||
Handle(DE_WorkSession)& theWS,
|
||||
const Message_ProgressRange& theProgress)
|
||||
{
|
||||
(void)theName;
|
||||
if (myNode.IsNull() ||
|
||||
myNode->GetFormat() != GetFormat() ||
|
||||
myNode->GetVendor() != GetVendor())
|
||||
{
|
||||
Message::SendFail() << "Error: provider " << GetFormat() <<
|
||||
" " << GetVendor() << " : Incorrect Configuration node";
|
||||
return Standard_False;
|
||||
}
|
||||
if (!myNode->IsImportSupported())
|
||||
{
|
||||
Message::SendFail() << "Error: provider " << GetFormat() <<
|
||||
" " << GetVendor() << " doesn't support read operation";
|
||||
return Standard_False;
|
||||
}
|
||||
TColStd_ListOfAsciiString anExtns = myNode->GetExtensions();
|
||||
TCollection_AsciiString anExt("tmp");
|
||||
if (!anExtns.IsEmpty())
|
||||
{
|
||||
anExt = anExtns.First();
|
||||
}
|
||||
DE_TemporaryFile aTempFile(myTempFolder, anExt);
|
||||
if (!aTempFile.IsDone())
|
||||
{
|
||||
return Standard_False;
|
||||
}
|
||||
std::ofstream aStream;
|
||||
OSD_OpenStream(aStream, aTempFile.Path(), std::ios::out | std::ios::binary);
|
||||
aStream << theIStream.rdbuf();
|
||||
return Read(aTempFile.Path(), theDocument, theWS, theProgress);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
// function : Write
|
||||
// purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean DE_Provider::Write(const TCollection_AsciiString& thePath,
|
||||
const Handle(TDocStd_Document)& theDocument,
|
||||
Handle(DE_WorkSession)& theWS,
|
||||
const Message_ProgressRange& theProgress)
|
||||
{
|
||||
(void)thePath;
|
||||
(void)theDocument;
|
||||
(void)theWS;
|
||||
(void)theProgress;
|
||||
Message::SendFail() << "Error: provider " << GetFormat() <<
|
||||
" " << GetVendor() << " doesn't support write operation";
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
// function : Write
|
||||
// purpose :
|
||||
//=======================================================================
|
||||
bool DE_Provider::Write(std::ostream& theOStream,
|
||||
const Handle(TDocStd_Document)& theDocument,
|
||||
Handle(DE_WorkSession)& theWS,
|
||||
const Message_ProgressRange& theProgress)
|
||||
{
|
||||
if (myNode.IsNull() ||
|
||||
myNode->GetFormat() != GetFormat() ||
|
||||
myNode->GetVendor() != GetVendor())
|
||||
{
|
||||
Message::SendFail() << "Error: provider " << GetFormat() <<
|
||||
" " << GetVendor() << " : Incorrect Configuration node";
|
||||
return Standard_False;
|
||||
}
|
||||
if (!myNode->IsExportSupported())
|
||||
{
|
||||
Message::SendFail() << "Error: provider " << GetFormat() <<
|
||||
" " << GetVendor() << " doesn't support write operation";
|
||||
return Standard_False;
|
||||
}
|
||||
TColStd_ListOfAsciiString anExtns = myNode->GetExtensions();
|
||||
TCollection_AsciiString anExt("tmp");
|
||||
if (!anExtns.IsEmpty())
|
||||
{
|
||||
anExt = anExtns.First();
|
||||
}
|
||||
DE_TemporaryFile aTempFile(myTempFolder, anExt);
|
||||
if (!aTempFile.IsDone())
|
||||
{
|
||||
return Standard_False;
|
||||
}
|
||||
if (!Write(aTempFile.Path(), theDocument, theWS, theProgress))
|
||||
{
|
||||
return Standard_False;
|
||||
}
|
||||
std::ifstream aStream;
|
||||
OSD_OpenStream(aStream, aTempFile.Path().ToCString(), std::ios::in | std::ios::binary);
|
||||
theOStream << aStream.rdbuf();
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
// function : Read
|
||||
// purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean DE_Provider::Read(const TCollection_AsciiString& thePath,
|
||||
TopoDS_Shape& theShape,
|
||||
Handle(XSControl_WorkSession)& theWS,
|
||||
Handle(DE_WorkSession)& theWS,
|
||||
const Message_ProgressRange& theProgress)
|
||||
{
|
||||
(void)thePath;
|
||||
@@ -119,38 +274,46 @@ Standard_Boolean DE_Provider::Read(const TCollection_AsciiString& thePath,
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
// function : Write
|
||||
// purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean DE_Provider::Write(const TCollection_AsciiString& thePath,
|
||||
const TopoDS_Shape& theShape,
|
||||
Handle(XSControl_WorkSession)& theWS,
|
||||
const Message_ProgressRange& theProgress)
|
||||
{
|
||||
(void)thePath;
|
||||
(void)theShape;
|
||||
(void)theWS;
|
||||
(void)theProgress;
|
||||
Message::SendFail() << "Error: provider " << GetFormat() <<
|
||||
" " << GetVendor() << " doesn't support write operation";
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
// function : Read
|
||||
// purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean DE_Provider::Read(const TCollection_AsciiString& thePath,
|
||||
bool DE_Provider::Read(std::istream& theIStream,
|
||||
TopoDS_Shape& theShape,
|
||||
const TCollection_AsciiString theName,
|
||||
Handle(DE_WorkSession)& theWS,
|
||||
const Message_ProgressRange& theProgress)
|
||||
{
|
||||
(void)thePath;
|
||||
(void)theShape;
|
||||
(void)theProgress;
|
||||
(void)theName;
|
||||
if (myNode.IsNull() ||
|
||||
myNode->GetFormat() != GetFormat() ||
|
||||
myNode->GetVendor() != GetVendor())
|
||||
{
|
||||
Message::SendFail() << "Error: provider " << GetFormat() <<
|
||||
" " << GetVendor() << " : Incorrect Configuration node";
|
||||
return Standard_False;
|
||||
}
|
||||
if (!myNode->IsImportSupported())
|
||||
{
|
||||
Message::SendFail() << "Error: provider " << GetFormat() <<
|
||||
" " << GetVendor() << " doesn't support read operation";
|
||||
return Standard_False;
|
||||
}
|
||||
TColStd_ListOfAsciiString anExtns = myNode->GetExtensions();
|
||||
TCollection_AsciiString anExt("tmp");
|
||||
if (!anExtns.IsEmpty())
|
||||
{
|
||||
anExt = anExtns.First();
|
||||
}
|
||||
DE_TemporaryFile aTempFile(myTempFolder, anExt);
|
||||
if (!aTempFile.IsDone())
|
||||
{
|
||||
return Standard_False;
|
||||
}
|
||||
std::ofstream aStream;
|
||||
OSD_OpenStream(aStream, aTempFile.Path(), std::ios::out | std::ios::binary);
|
||||
aStream << theIStream.rdbuf();
|
||||
return Read(aTempFile.Path(), theShape, theWS, theProgress);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@@ -159,12 +322,58 @@ Standard_Boolean DE_Provider::Read(const TCollection_AsciiString& thePath,
|
||||
//=======================================================================
|
||||
Standard_Boolean DE_Provider::Write(const TCollection_AsciiString& thePath,
|
||||
const TopoDS_Shape& theShape,
|
||||
Handle(DE_WorkSession)& theWS,
|
||||
const Message_ProgressRange& theProgress)
|
||||
{
|
||||
(void)thePath;
|
||||
(void)theShape;
|
||||
(void)theWS;
|
||||
(void)theProgress;
|
||||
Message::SendFail() << "Error: provider " << GetFormat() <<
|
||||
" " << GetVendor() << " doesn't support write operation";
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
// function : Write
|
||||
// purpose :
|
||||
//=======================================================================
|
||||
bool DE_Provider::Write(std::ostream& theOStream,
|
||||
const TopoDS_Shape& theShape,
|
||||
Handle(DE_WorkSession)& theWS,
|
||||
const Message_ProgressRange& theProgress)
|
||||
{
|
||||
if (myNode.IsNull() ||
|
||||
myNode->GetFormat() != GetFormat() ||
|
||||
myNode->GetVendor() != GetVendor())
|
||||
{
|
||||
Message::SendFail() << "Error: provider " << GetFormat() <<
|
||||
" " << GetVendor() << " : Incorrect Configuration node";
|
||||
return Standard_False;
|
||||
}
|
||||
if (!myNode->IsExportSupported())
|
||||
{
|
||||
Message::SendFail() << "Error: provider " << GetFormat() <<
|
||||
" " << GetVendor() << " doesn't support write operation";
|
||||
return Standard_False;
|
||||
}
|
||||
TColStd_ListOfAsciiString anExtns = myNode->GetExtensions();
|
||||
TCollection_AsciiString anExt("tmp");
|
||||
if (!anExtns.IsEmpty())
|
||||
{
|
||||
anExt = anExtns.First();
|
||||
}
|
||||
DE_TemporaryFile aTempFile(myTempFolder, anExt);
|
||||
if (!aTempFile.IsDone())
|
||||
{
|
||||
return Standard_False;
|
||||
}
|
||||
if (!Write(aTempFile.Path(), theShape, theWS, theProgress))
|
||||
{
|
||||
return Standard_False;
|
||||
}
|
||||
std::ifstream aStream;
|
||||
OSD_OpenStream(aStream, aTempFile.Path().ToCString(), std::ios::in | std::ios::binary);
|
||||
theOStream << aStream.rdbuf();
|
||||
return Standard_True;
|
||||
}
|
||||
|
@@ -18,7 +18,7 @@
|
||||
|
||||
class DE_ConfigurationNode;
|
||||
class TopoDS_Shape;
|
||||
class XSControl_WorkSession;
|
||||
class DE_WorkSession;
|
||||
class TDocStd_Document;
|
||||
|
||||
//! Base class to make transfer process.
|
||||
@@ -61,38 +61,44 @@ public:
|
||||
//! @param[in] theWS current work session
|
||||
//! @param theProgress[in] progress indicator
|
||||
//! @return True if Read was successful
|
||||
Standard_EXPORT virtual Standard_Boolean Read(const TCollection_AsciiString& thePath,
|
||||
Standard_EXPORT virtual bool Read(const TCollection_AsciiString& thePath,
|
||||
const Handle(TDocStd_Document)& theDocument,
|
||||
Handle(XSControl_WorkSession)& theWS,
|
||||
const Message_ProgressRange& theProgress = Message_ProgressRange());
|
||||
|
||||
//! Writes a CAD file, according internal configuration
|
||||
//! @param[in] thePath path to the export CAD file
|
||||
//! @param[out] theDocument document to export
|
||||
//! @param[in] theWS current work session
|
||||
//! @param theProgress[in] progress indicator
|
||||
//! @return True if Write was successful
|
||||
Standard_EXPORT virtual Standard_Boolean Write(const TCollection_AsciiString& thePath,
|
||||
const Handle(TDocStd_Document)& theDocument,
|
||||
Handle(XSControl_WorkSession)& theWS,
|
||||
Handle(DE_WorkSession)& theWS,
|
||||
const Message_ProgressRange& theProgress = Message_ProgressRange());
|
||||
|
||||
//! Reads a CAD file, according internal configuration
|
||||
//! @param[in] thePath path to the import CAD file
|
||||
//! @param[in] theIStream stream to import CAD data
|
||||
//! @param[out] theDocument document to save result
|
||||
//! @paramp[in] theName name of CAD file, can be empty
|
||||
//! @param[in] theWS current work session
|
||||
//! @param theProgress[in] progress indicator
|
||||
//! @return True if Read was successful
|
||||
Standard_EXPORT virtual Standard_Boolean Read(const TCollection_AsciiString& thePath,
|
||||
//! @return true if Read operation has ended correctly
|
||||
Standard_EXPORT virtual bool Read(std::istream& theIStream,
|
||||
const Handle(TDocStd_Document)& theDocument,
|
||||
const TCollection_AsciiString theName,
|
||||
Handle(DE_WorkSession)& theWS,
|
||||
const Message_ProgressRange& theProgress = Message_ProgressRange());
|
||||
|
||||
//! Writes a CAD file, according internal configuration
|
||||
//! @param[in] thePath path to the export CAD file
|
||||
//! @param[out] theDocument document to export
|
||||
//! @param[in] theWS current work session
|
||||
//! @param theProgress[in] progress indicator
|
||||
//! @return True if Write was successful
|
||||
Standard_EXPORT virtual Standard_Boolean Write(const TCollection_AsciiString& thePath,
|
||||
Standard_EXPORT virtual bool Write(const TCollection_AsciiString& thePath,
|
||||
const Handle(TDocStd_Document)& theDocument,
|
||||
Handle(DE_WorkSession)& theWS,
|
||||
const Message_ProgressRange& theProgress = Message_ProgressRange());
|
||||
|
||||
//! Writes a CAD file, according internal configuration
|
||||
//! @param[in] theOStream stream to export CAD data
|
||||
//! @param[out] theDocument document to export
|
||||
//! @param[in] theWS current work session
|
||||
//! @param theProgress[in] progress indicator
|
||||
//! @return true if Write operation has ended correctly
|
||||
Standard_EXPORT virtual bool Write(std::ostream& theOStream,
|
||||
const Handle(TDocStd_Document)& theDocument,
|
||||
Handle(DE_WorkSession)& theWS,
|
||||
const Message_ProgressRange& theProgress = Message_ProgressRange());
|
||||
|
||||
//! Reads a CAD file, according internal configuration
|
||||
@@ -101,9 +107,22 @@ public:
|
||||
//! @param[in] theWS current work session
|
||||
//! @param theProgress[in] progress indicator
|
||||
//! @return True if Read was successful
|
||||
Standard_EXPORT virtual Standard_Boolean Read(const TCollection_AsciiString& thePath,
|
||||
Standard_EXPORT virtual bool Read(const TCollection_AsciiString& thePath,
|
||||
TopoDS_Shape& theShape,
|
||||
Handle(XSControl_WorkSession)& theWS,
|
||||
Handle(DE_WorkSession)& theWS,
|
||||
const Message_ProgressRange& theProgress = Message_ProgressRange());
|
||||
|
||||
//! Reads a CAD file, according internal configuration
|
||||
//! @param[in] theIStream stream to the CAD file
|
||||
//! @param[out] theShape shape to save result
|
||||
//! @paramp[in] theName name of CAD file, can be empty
|
||||
//! @param[in] theWS current work session
|
||||
//! @param theProgress[in] progress indicator
|
||||
//! @return true if Read operation has ended correctly
|
||||
Standard_EXPORT virtual bool Read(std::istream& theIStream,
|
||||
TopoDS_Shape& theShape,
|
||||
const TCollection_AsciiString theName,
|
||||
Handle(DE_WorkSession)& theWS,
|
||||
const Message_ProgressRange& theProgress = Message_ProgressRange());
|
||||
|
||||
//! Writes a CAD file, according internal configuration
|
||||
@@ -112,27 +131,20 @@ public:
|
||||
//! @param[in] theWS current work session
|
||||
//! @param theProgress[in] progress indicator
|
||||
//! @return True if Write was successful
|
||||
Standard_EXPORT virtual Standard_Boolean Write(const TCollection_AsciiString& thePath,
|
||||
Standard_EXPORT virtual bool Write(const TCollection_AsciiString& thePath,
|
||||
const TopoDS_Shape& theShape,
|
||||
Handle(XSControl_WorkSession)& theWS,
|
||||
const Message_ProgressRange& theProgress = Message_ProgressRange());
|
||||
|
||||
//! Reads a CAD file, according internal configuration
|
||||
//! @param[in] thePath path to the import CAD file
|
||||
//! @param[out] theShape shape to save result
|
||||
//! @param theProgress[in] progress indicator
|
||||
//! @return True if Read was successful
|
||||
Standard_EXPORT virtual Standard_Boolean Read(const TCollection_AsciiString& thePath,
|
||||
TopoDS_Shape& theShape,
|
||||
Handle(DE_WorkSession)& theWS,
|
||||
const Message_ProgressRange& theProgress = Message_ProgressRange());
|
||||
|
||||
//! Writes a CAD file, according internal configuration
|
||||
//! @param[in] thePath path to the export CAD file
|
||||
//! @param[in] theOStream stream to export CAD data
|
||||
//! @param[out] theShape shape to export
|
||||
//! @param[in] theWS current work session
|
||||
//! @param theProgress[in] progress indicator
|
||||
//! @return True if Write was successful
|
||||
Standard_EXPORT virtual Standard_Boolean Write(const TCollection_AsciiString& thePath,
|
||||
//! @return true if Write operation has ended correctly
|
||||
Standard_EXPORT virtual bool Write(std::ostream& theOStream,
|
||||
const TopoDS_Shape& theShape,
|
||||
Handle(DE_WorkSession)& theWS,
|
||||
const Message_ProgressRange& theProgress = Message_ProgressRange());
|
||||
|
||||
public:
|
||||
@@ -147,21 +159,22 @@ public:
|
||||
|
||||
//! Gets internal configuration node
|
||||
//! @return configuration node object
|
||||
Handle(DE_ConfigurationNode) GetNode() const
|
||||
{
|
||||
return myNode;
|
||||
}
|
||||
Handle(DE_ConfigurationNode) GetNode() const { return myNode; }
|
||||
|
||||
//! Sets internal configuration node
|
||||
//! @param[in] theNode configuration node to set
|
||||
void SetNode(const Handle(DE_ConfigurationNode)& theNode)
|
||||
{
|
||||
myNode = theNode;
|
||||
}
|
||||
void SetNode(const Handle(DE_ConfigurationNode)& theNode) { myNode = theNode; }
|
||||
|
||||
//! Gets path to folder to create temp CAD files, that not support stream
|
||||
TCollection_AsciiString GetTempFolderPath() const { return myTempFolder; }
|
||||
|
||||
//! Sets path to folder to create temp CAD files, that not support stream
|
||||
void SetTempFolderPath(const TCollection_AsciiString& theFolder) { myTempFolder = theFolder; }
|
||||
|
||||
private:
|
||||
|
||||
Handle(DE_ConfigurationNode) myNode; //!< Internal configuration for the own format
|
||||
TCollection_AsciiString myTempFolder; //!< Path to folder to create temp CAD files, that not support stream
|
||||
};
|
||||
|
||||
#endif // _DE_Provider_HeaderFile
|
||||
|
502
src/DE/DE_WorkSession.cxx
Normal file
502
src/DE/DE_WorkSession.cxx
Normal file
@@ -0,0 +1,502 @@
|
||||
// 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 <DE_WorkSession.hxx>
|
||||
|
||||
#include <Interface_Check.hxx>
|
||||
#include <DE_DataModel.hxx>
|
||||
#include <Interface_Macros.hxx>
|
||||
#include <Message_Messenger.hxx>
|
||||
#include <Message_ProgressScope.hxx>
|
||||
#include <TColStd_HSequenceOfTransient.hxx>
|
||||
#include <Transfer_ResultFromModel.hxx>
|
||||
#include <Transfer_ResultFromTransient.hxx>
|
||||
#include <Transfer_SimpleBinderOfTransient.hxx>
|
||||
#include <Transfer_TransientProcess.hxx>
|
||||
#include <XSControl_Controller.hxx>
|
||||
#include <XSControl_TransferReader.hxx>
|
||||
#include <XSControl_TransferWriter.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(DE_WorkSession, Standard_Transient)
|
||||
|
||||
//=======================================================================
|
||||
//function : DE_WorkSession
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
DE_WorkSession::DE_WorkSession() :
|
||||
myTransferReader(new XSControl_TransferReader),
|
||||
myTransferWriter(new XSControl_TransferWriter)
|
||||
{}
|
||||
|
||||
//=======================================================================
|
||||
//function : DE_WorkSession
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
DE_WorkSession::~DE_WorkSession()
|
||||
{
|
||||
clearBinders();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : ClearData
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void DE_WorkSession::ClearData(const Standard_Integer mode)
|
||||
{
|
||||
// 1-2-3-4 : standard IFSelect
|
||||
if (mode >= 1 && mode <= 4) IFSelect_WorkSession::ClearData(mode);
|
||||
|
||||
// 5 : Transferts seuls
|
||||
// 6 : Resultats forces seuls
|
||||
// 7 : Management, y compris tous transferts (forces/calcules), views
|
||||
|
||||
if (mode == 5 || mode == 7)
|
||||
{
|
||||
myTransferReader->Clear(-1);
|
||||
myTransferWriter->Clear(-1);
|
||||
}
|
||||
if (mode == 6 && !myTransferReader.IsNull()) myTransferReader->Clear(1);
|
||||
myTransferReader->SetGraph(HGraph());
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : SelectNorm
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean DE_WorkSession::SelectNorm(const Standard_CString normname)
|
||||
{
|
||||
// Old norm and results
|
||||
myTransferReader->Clear(-1);
|
||||
// ???? En toute rigueur, menage a faire dans XWS : virer les items
|
||||
// ( a la limite, pourquoi pas, refaire XWS en entier)
|
||||
|
||||
Handle(XSControl_Controller) newadapt = XSControl_Controller::Recorded(normname);
|
||||
if (newadapt.IsNull()) return Standard_False;
|
||||
if (newadapt == myController) return Standard_True;
|
||||
SetController(newadapt);
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : SetController
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void DE_WorkSession::SetController(const Handle(XSControl_Controller)& ctl)
|
||||
{
|
||||
myController = ctl;
|
||||
|
||||
SetLibrary(myController->WorkLibrary());
|
||||
SetProtocol(myController->Protocol());
|
||||
|
||||
ClearItems();
|
||||
ClearFinalModifiers();
|
||||
ClearShareOut(Standard_False);
|
||||
ClearFile();
|
||||
|
||||
myTransferReader->SetController(myController);
|
||||
myTransferWriter->SetController(myController);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : SelectedNorm
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_CString DE_WorkSession::SelectedNorm(const Standard_Boolean rsc) const
|
||||
{
|
||||
//JR/Hp :
|
||||
Standard_CString astr = (Standard_CString)(myController.IsNull() ? "" : myController->Name(rsc));
|
||||
return astr;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : SelectedNorm
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void DE_WorkSession::AppendReferenceWS(const TCollection_AsciiString& theName,
|
||||
const Handle(DE_WorkSession)& theWS)
|
||||
{
|
||||
myReferenceWS.Bind(theName, theWS);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : PrintTransferStatus
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean DE_WorkSession::PrintTransferStatus(const Standard_Integer num,
|
||||
const Standard_Boolean wri,
|
||||
Standard_OStream& S) const
|
||||
{
|
||||
const Handle(Transfer_FinderProcess)& FP = myTransferWriter->FinderProcess();
|
||||
Handle(Transfer_TransientProcess) TP = myTransferReader->TransientProcess();
|
||||
|
||||
Handle(Transfer_Binder) binder;
|
||||
Handle(Transfer_Finder) finder;
|
||||
Handle(Standard_Transient) ent;
|
||||
|
||||
// *** WRITE ***
|
||||
if (wri)
|
||||
{
|
||||
if (FP.IsNull()) return Standard_False;
|
||||
if (num == 0) return Standard_False;
|
||||
|
||||
Standard_Integer ne = 0, nr = 0, max = FP->NbMapped(), maxr = FP->NbRoots();
|
||||
if (num > 0)
|
||||
{
|
||||
if (num > max) return Standard_False;
|
||||
ne = num;
|
||||
finder = FP->Mapped(ne);
|
||||
nr = FP->RootIndex(finder);
|
||||
}
|
||||
else if (num < 0)
|
||||
{
|
||||
nr = -num;
|
||||
if (nr > maxr) return Standard_False;
|
||||
finder = FP->Root(nr);
|
||||
ne = FP->MapIndex(finder);
|
||||
}
|
||||
|
||||
S << "Transfer Write item n0." << ne << " of " << max;
|
||||
if (nr > 0)
|
||||
{
|
||||
S << " ** Transfer Root n0." << ne;
|
||||
}
|
||||
S << std::endl;
|
||||
ent = FP->FindTransient(finder);
|
||||
S << " -> Type " << finder->DynamicType()->Name() << std::endl;
|
||||
FP->StartTrace(binder, finder, 0, 0); // pb sout/S
|
||||
if (!ent.IsNull())
|
||||
{
|
||||
S << " ** Resultat Transient, type " << ent->DynamicType()->Name();
|
||||
const Handle(DE_DataModel)& model = Model();
|
||||
if (!model.IsNull())
|
||||
{
|
||||
S << " In output Model, Entity "; model->Print(ent, S);
|
||||
}
|
||||
S << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
// *** READ ***
|
||||
else
|
||||
{
|
||||
if (TP.IsNull()) return Standard_False;
|
||||
Handle(DE_DataModel) model = TP->Model();
|
||||
if (model.IsNull()) std::cout << "No Model" << std::endl;
|
||||
else if (model != Model()) std::cout << "Model different from the session" << std::endl;
|
||||
if (num == 0) return Standard_False;
|
||||
|
||||
Standard_Integer ne = 0, nr = 0, max = TP->NbMapped(), maxr = TP->NbRoots();
|
||||
if (num > 0)
|
||||
{
|
||||
if (num > max) return Standard_False;
|
||||
ne = num;
|
||||
ent = TP->Mapped(ne);
|
||||
nr = TP->RootIndex(finder);
|
||||
}
|
||||
else if (num < 0)
|
||||
{
|
||||
nr = -num;
|
||||
if (nr > maxr) return Standard_False;
|
||||
ent = TP->Root(nr);
|
||||
ne = TP->MapIndex(ent);
|
||||
}
|
||||
|
||||
S << "Transfer Read item n0." << ne << " of " << max;
|
||||
if (nr > 0)
|
||||
{
|
||||
S << " ** Transfer Root n0." << ne;
|
||||
}
|
||||
S << std::endl;
|
||||
if (!model.IsNull()) { S << " In Model, Entity "; model->Print(ent, S); }
|
||||
binder = TP->MapItem(ne);
|
||||
S << std::endl;
|
||||
TP->StartTrace(binder, ent, 0, 0);
|
||||
|
||||
}
|
||||
|
||||
// *** CHECK (commun READ+WRITE) ***
|
||||
if (!binder.IsNull())
|
||||
{
|
||||
const Handle(Interface_Check) ch = binder->Check();
|
||||
Standard_Integer i, nbw = ch->NbWarnings(), nbf = ch->NbFails();
|
||||
if (nbw > 0)
|
||||
{
|
||||
S << " - Warnings : " << nbw << " :\n";
|
||||
for (i = 1; i <= nbw; i++) S << ch->CWarning(i) << std::endl;
|
||||
}
|
||||
if (nbf > 0)
|
||||
{
|
||||
S << " - Fails : " << nbf << " :\n";
|
||||
for (i = 1; i <= nbf; i++) S << ch->CFail(i) << std::endl;
|
||||
}
|
||||
}
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : InitTransferReader
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void DE_WorkSession::InitTransferReader(const Standard_Integer mode)
|
||||
{
|
||||
if (mode == 0 || mode == 5) myTransferReader->Clear(-1); // full clear
|
||||
if (myTransferReader.IsNull()) SetTransferReader(new XSControl_TransferReader);
|
||||
else SetTransferReader(myTransferReader);
|
||||
|
||||
// mode = 0 fait par SetTransferReader suite a Nullify
|
||||
if (mode == 1)
|
||||
{
|
||||
if (!myTransferReader.IsNull()) myTransferReader->Clear(-1);
|
||||
else SetTransferReader(new XSControl_TransferReader);
|
||||
}
|
||||
if (mode == 2)
|
||||
{
|
||||
Handle(Transfer_TransientProcess) TP = myTransferReader->TransientProcess();
|
||||
if (TP.IsNull())
|
||||
{
|
||||
TP = new Transfer_TransientProcess;
|
||||
myTransferReader->SetTransientProcess(TP);
|
||||
TP->SetGraph(HGraph());
|
||||
}
|
||||
Handle(TColStd_HSequenceOfTransient) lis = myTransferReader->RecordedList();
|
||||
Standard_Integer i, nb = lis->Length();
|
||||
for (i = 1; i <= nb; i++) TP->SetRoot(lis->Value(i));
|
||||
}
|
||||
if (mode == 3)
|
||||
{
|
||||
Handle(Transfer_TransientProcess) TP = myTransferReader->TransientProcess();
|
||||
if (TP.IsNull()) return;
|
||||
Standard_Integer i, nb = TP->NbRoots();
|
||||
for (i = 1; i <= nb; i++) myTransferReader->RecordResult(TP->Root(i));
|
||||
}
|
||||
if (mode == 4 || mode == 5) myTransferReader->BeginTransfer();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : SetTransferReader
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void DE_WorkSession::SetTransferReader(const Handle(XSControl_TransferReader)& TR)
|
||||
{
|
||||
if (myTransferReader != TR) //i1 pdn 03.04.99 BUC60301
|
||||
myTransferReader = TR;
|
||||
if (TR.IsNull()) return;
|
||||
TR->SetController(myController);
|
||||
TR->SetGraph(HGraph());
|
||||
if (!TR->TransientProcess().IsNull()) return;
|
||||
Handle(Transfer_TransientProcess) TP = new Transfer_TransientProcess
|
||||
(Model().IsNull() ? 100 : Model()->NbEntities() + 100);
|
||||
TP->SetGraph(HGraph());
|
||||
TP->SetErrorHandle(Standard_True);
|
||||
TR->SetTransientProcess(TP);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : MapReader
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Handle(Transfer_TransientProcess) DE_WorkSession::MapReader() const
|
||||
{
|
||||
return myTransferReader->TransientProcess();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : SetMapReader
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean DE_WorkSession::SetMapReader(const Handle(Transfer_TransientProcess)& TP)
|
||||
{
|
||||
if (TP.IsNull()) return Standard_False;
|
||||
if (TP->Model().IsNull()) TP->SetModel(Model());
|
||||
TP->SetGraph(HGraph());
|
||||
if (TP->Model() != Model()) return Standard_False;
|
||||
// TR ne doit pas bouger, c est un "crochet" pour signatures, selections ...
|
||||
// En revanche, mieux vaut le RAZ
|
||||
// Handle(XSControl_TransferReader) TR = new XSControl_TransferReader;
|
||||
Handle(XSControl_TransferReader) TR = myTransferReader;
|
||||
TR->Clear(-1);
|
||||
|
||||
SetTransferReader(TR); // avec le meme mais le reinitialise
|
||||
TR->SetTransientProcess(TP); // et prend le nouveau TP
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Result
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Handle(Standard_Transient) DE_WorkSession::Result(const Handle(Standard_Transient)& ent,
|
||||
const Standard_Integer mode) const
|
||||
{
|
||||
Standard_Integer ouca = (mode % 10);
|
||||
Standard_Integer kica = (mode / 10);
|
||||
|
||||
Handle(Transfer_Binder) binder;
|
||||
Handle(Transfer_ResultFromModel) resu;
|
||||
|
||||
if (ouca != 1) resu = myTransferReader->FinalResult(ent);
|
||||
if (mode == 20) return resu;
|
||||
|
||||
if (!resu.IsNull()) binder = resu->MainResult()->Binder();
|
||||
if (binder.IsNull() && ouca > 0)
|
||||
binder = myTransferReader->TransientProcess()->Find(ent);
|
||||
|
||||
if (kica == 1) return binder;
|
||||
DeclareAndCast(Transfer_SimpleBinderOfTransient, trb, binder);
|
||||
if (!trb.IsNull()) return trb->Result();
|
||||
return binder;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : TransferReadOne
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Integer DE_WorkSession::TransferReadOne(const Handle(Standard_Transient)& ent,
|
||||
const Message_ProgressRange& theProgress)
|
||||
{
|
||||
Handle(DE_DataModel) model = Model();
|
||||
if (ent == model) return TransferReadRoots(theProgress);
|
||||
|
||||
Handle(TColStd_HSequenceOfTransient) list = GiveList(ent);
|
||||
if (list->Length() == 1)
|
||||
return myTransferReader->TransferOne(list->Value(1), Standard_True, theProgress);
|
||||
else
|
||||
return myTransferReader->TransferList(list, Standard_True, theProgress);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : TransferReadRoots
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Integer DE_WorkSession::TransferReadRoots(const Message_ProgressRange& theProgress)
|
||||
{
|
||||
return myTransferReader->TransferRoots(Graph(), theProgress);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : NewModel
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Handle(DE_DataModel) DE_WorkSession::NewModel()
|
||||
{
|
||||
Handle(DE_DataModel) newmod;
|
||||
if (myController.IsNull()) return newmod;
|
||||
newmod = myController->NewModel();
|
||||
|
||||
SetModel(newmod);
|
||||
if (!myTransferReader->TransientProcess().IsNull())
|
||||
myTransferReader->TransientProcess()->Clear();
|
||||
//clear all contains of WS
|
||||
myTransferReader->Clear(3);
|
||||
myTransferWriter->Clear(-1);
|
||||
|
||||
return newmod;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : TransferWriter
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
const Handle(XSControl_TransferWriter)& DE_WorkSession::TransferWriter() const
|
||||
{
|
||||
return myTransferWriter;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : SetMapWriter
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean DE_WorkSession::SetMapWriter(const Handle(Transfer_FinderProcess)& theFP)
|
||||
{
|
||||
if (theFP.IsNull()) return Standard_False;
|
||||
myTransferWriter->SetFinderProcess(theFP);
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : TransferWriteShape
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
XSControl_ReturnStatus DE_WorkSession::TransferWriteShape(const TopoDS_Shape& shape,
|
||||
const Standard_Boolean compgraph,
|
||||
const Message_ProgressRange& theProgress)
|
||||
{
|
||||
XSControl_ReturnStatus status;
|
||||
if (myController.IsNull()) return XSControl_RetError;
|
||||
const Handle(DE_DataModel)& model = Model();
|
||||
if (model.IsNull() || shape.IsNull())
|
||||
{
|
||||
return XSControl_RetVoid;
|
||||
}
|
||||
|
||||
status = myTransferWriter->TransferWriteShape(model, shape, theProgress);
|
||||
if (theProgress.UserBreak())
|
||||
return XSControl_RetStop;
|
||||
// qui s occupe de tout, try/catch inclus
|
||||
|
||||
//skl insert param compgraph for XDE writing 10.12.2003
|
||||
if (compgraph) ComputeGraph(Standard_True);
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : TransferWriteCheckList
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Interface_CheckIterator DE_WorkSession::TransferWriteCheckList() const
|
||||
{
|
||||
return myTransferWriter->ResultCheckList(Model());
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : clearBinders
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void DE_WorkSession::clearBinders()
|
||||
{
|
||||
const Handle(Transfer_FinderProcess)& FP = myTransferWriter->FinderProcess();
|
||||
//Due to big number of chains of binders it is necessary to
|
||||
//collect head binders of each chain in the sequence
|
||||
TColStd_SequenceOfTransient aSeqBnd;
|
||||
TColStd_SequenceOfTransient aSeqShapes;
|
||||
Standard_Integer i = 1;
|
||||
for (; i <= FP->NbMapped(); i++)
|
||||
{
|
||||
Handle(Transfer_Binder) bnd = FP->MapItem(i);
|
||||
if (!bnd.IsNull())
|
||||
aSeqBnd.Append(bnd);
|
||||
Handle(Standard_Transient) ash(FP->Mapped(i));
|
||||
aSeqShapes.Append(ash);
|
||||
}
|
||||
//removing finder process containing result of translation.
|
||||
FP->Clear();
|
||||
ClearData(1);
|
||||
ClearData(5);
|
||||
|
||||
//removing each chain of binders
|
||||
while (aSeqBnd.Length() > 0)
|
||||
{
|
||||
Handle(Transfer_Binder) aBnd = Handle(Transfer_Binder)::DownCast(aSeqBnd.Value(1));
|
||||
Handle(Standard_Transient) ash = aSeqShapes.Value(1);
|
||||
aSeqBnd.Remove(1);
|
||||
aSeqShapes.Remove(1);
|
||||
ash.Nullify();
|
||||
while (!aBnd.IsNull())
|
||||
{
|
||||
Handle(Transfer_Binder) aBndNext = aBnd->NextResult();
|
||||
aBnd.Nullify();
|
||||
aBnd = aBndNext;
|
||||
}
|
||||
}
|
||||
}
|
71
src/DE/DE_WorkSession.hxx
Normal file
71
src/DE/DE_WorkSession.hxx
Normal file
@@ -0,0 +1,71 @@
|
||||
// Created on: 1995-06-01
|
||||
// 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_WorkSession_HeaderFile
|
||||
#define _XSControl_WorkSession_HeaderFile
|
||||
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_Type.hxx>
|
||||
|
||||
#include <Message_ProgressRange.hxx>
|
||||
#include <TCollection_AsciiString.hxx>
|
||||
#include <NCollection_DataMap.hxx>
|
||||
|
||||
class DE_DataModel;
|
||||
|
||||
typedef NCollection_DataMap<TCollection_AsciiString, Handle(DE_WorkSession)> XSControl_WorkSessionMap;
|
||||
|
||||
//! This WorkSession completes the basic one, by adding :
|
||||
//! - use of Controller, with norm selection...
|
||||
//! - management of transfers (both ways) with auxiliary classes
|
||||
//! TransferReader and TransferWriter
|
||||
//! -> these transfers may work with a Context List : its items
|
||||
//! are given by the user, according to the transfer to be
|
||||
//! i.e. it is interpreted by the Actors
|
||||
//! Each item is accessed by a Name
|
||||
class DE_WorkSession : public Standard_Transient
|
||||
{
|
||||
public:
|
||||
|
||||
Standard_EXPORT DE_WorkSession();
|
||||
|
||||
Standard_EXPORT ~DE_WorkSession();
|
||||
|
||||
//! Returns the current reference WS List, empty if not defined
|
||||
const XSControl_WorkSessionMap& ReferenceWS() const { return myReferenceWS; }
|
||||
|
||||
//! Appends new refrence Work Session
|
||||
Standard_EXPORT void AppendReferenceWS(const TCollection_AsciiString& theName,
|
||||
const Handle(DE_WorkSession)& theWS);
|
||||
|
||||
Handle(DE_DataModel) Model() { return myModel; }
|
||||
|
||||
const Handle(DE_DataModel)& Model() const { return myModel; }
|
||||
|
||||
Standard_EXPORT const TCollection_AsciiString& Vendor() const;
|
||||
|
||||
Standard_EXPORT const TCollection_AsciiString& Format() const;
|
||||
|
||||
DEFINE_STANDARD_RTTIEXT(DE_WorkSession, Standard_Transient)
|
||||
|
||||
private:
|
||||
|
||||
XSControl_WorkSessionMap myReferenceWS;
|
||||
Handle(DE_DataModel) myModel;
|
||||
|
||||
};
|
||||
|
||||
#endif // _XSControl_WorkSession_HeaderFile
|
@@ -31,7 +31,7 @@ namespace
|
||||
{
|
||||
static const TCollection_AsciiString& THE_CONFIGURATION_SCOPE()
|
||||
{
|
||||
static const TCollection_AsciiString aScope ("global");
|
||||
static const TCollection_AsciiString aScope("global");
|
||||
return aScope;
|
||||
}
|
||||
|
||||
@@ -102,17 +102,13 @@ void DE_Wrapper::SetGlobalWrapper(const Handle(DE_Wrapper)& theWrapper)
|
||||
//=======================================================================
|
||||
Standard_Boolean DE_Wrapper::Read(const TCollection_AsciiString& thePath,
|
||||
const Handle(TDocStd_Document)& theDocument,
|
||||
Handle(XSControl_WorkSession)& theWS,
|
||||
Handle(DE_WorkSession)& theWS,
|
||||
const Message_ProgressRange& theProgress)
|
||||
{
|
||||
if (theDocument.IsNull())
|
||||
{
|
||||
return Standard_False;
|
||||
}
|
||||
if (theWS.IsNull())
|
||||
{
|
||||
return Read(thePath, theDocument, theProgress);
|
||||
}
|
||||
Handle(DE_Provider) aProvider;
|
||||
if (!FindProvider(thePath, Standard_True, aProvider))
|
||||
{
|
||||
@@ -127,17 +123,13 @@ Standard_Boolean DE_Wrapper::Read(const TCollection_AsciiString& thePath,
|
||||
//=======================================================================
|
||||
Standard_Boolean DE_Wrapper::Write(const TCollection_AsciiString& thePath,
|
||||
const Handle(TDocStd_Document)& theDocument,
|
||||
Handle(XSControl_WorkSession)& theWS,
|
||||
Handle(DE_WorkSession)& theWS,
|
||||
const Message_ProgressRange& theProgress)
|
||||
{
|
||||
if (theDocument.IsNull())
|
||||
{
|
||||
return Standard_False;
|
||||
}
|
||||
if (theWS.IsNull())
|
||||
{
|
||||
return Write(thePath, theDocument, theProgress);
|
||||
}
|
||||
Handle(DE_Provider) aProvider;
|
||||
if (!FindProvider(thePath, Standard_False, aProvider))
|
||||
{
|
||||
@@ -146,59 +138,15 @@ Standard_Boolean DE_Wrapper::Write(const TCollection_AsciiString& thePath,
|
||||
return aProvider->Write(thePath, theDocument, theWS, theProgress);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
// function : Read
|
||||
// purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean DE_Wrapper::Read(const TCollection_AsciiString& thePath,
|
||||
const Handle(TDocStd_Document)& theDocument,
|
||||
const Message_ProgressRange& theProgress)
|
||||
{
|
||||
if (theDocument.IsNull())
|
||||
{
|
||||
return Standard_False;
|
||||
}
|
||||
Handle(DE_Provider) aProvider;
|
||||
if (!FindProvider(thePath, Standard_True, aProvider))
|
||||
{
|
||||
return Standard_False;
|
||||
}
|
||||
return aProvider->Read(thePath, theDocument, theProgress);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
// function : Write
|
||||
// purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean DE_Wrapper::Write(const TCollection_AsciiString& thePath,
|
||||
const Handle(TDocStd_Document)& theDocument,
|
||||
const Message_ProgressRange& theProgress)
|
||||
{
|
||||
if (theDocument.IsNull())
|
||||
{
|
||||
return Standard_False;
|
||||
}
|
||||
Handle(DE_Provider) aProvider;
|
||||
if (!FindProvider(thePath, Standard_False, aProvider))
|
||||
{
|
||||
return Standard_False;
|
||||
}
|
||||
return aProvider->Write(thePath, theDocument, theProgress);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
// function : Read
|
||||
// purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean DE_Wrapper::Read(const TCollection_AsciiString& thePath,
|
||||
TopoDS_Shape& theShape,
|
||||
Handle(XSControl_WorkSession)& theWS,
|
||||
Handle(DE_WorkSession)& theWS,
|
||||
const Message_ProgressRange& theProgress)
|
||||
{
|
||||
if (theWS.IsNull())
|
||||
{
|
||||
return Read(thePath, theShape, theProgress);
|
||||
}
|
||||
Handle(DE_Provider) aProvider;
|
||||
if (!FindProvider(thePath, Standard_True, aProvider))
|
||||
{
|
||||
@@ -213,13 +161,9 @@ Standard_Boolean DE_Wrapper::Read(const TCollection_AsciiString& thePath,
|
||||
//=======================================================================
|
||||
Standard_Boolean DE_Wrapper::Write(const TCollection_AsciiString& thePath,
|
||||
const TopoDS_Shape& theShape,
|
||||
Handle(XSControl_WorkSession)& theWS,
|
||||
Handle(DE_WorkSession)& theWS,
|
||||
const Message_ProgressRange& theProgress)
|
||||
{
|
||||
if (theWS.IsNull())
|
||||
{
|
||||
return Write(thePath, theShape, theProgress);
|
||||
}
|
||||
Handle(DE_Provider) aProvider;
|
||||
if (!FindProvider(thePath, Standard_False, aProvider))
|
||||
{
|
||||
@@ -228,39 +172,6 @@ Standard_Boolean DE_Wrapper::Write(const TCollection_AsciiString& thePath,
|
||||
return aProvider->Write(thePath, theShape, theWS, theProgress);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
// function : Read
|
||||
// purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean DE_Wrapper::Read(const TCollection_AsciiString& thePath,
|
||||
TopoDS_Shape& theShape,
|
||||
const Message_ProgressRange& theProgress)
|
||||
{
|
||||
|
||||
Handle(DE_Provider) aProvider;
|
||||
if (!FindProvider(thePath, Standard_True, aProvider))
|
||||
{
|
||||
return Standard_False;
|
||||
}
|
||||
return aProvider->Read(thePath, theShape, theProgress);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
// function : Write
|
||||
// purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean DE_Wrapper::Write(const TCollection_AsciiString& thePath,
|
||||
const TopoDS_Shape& theShape,
|
||||
const Message_ProgressRange& theProgress)
|
||||
{
|
||||
Handle(DE_Provider) aProvider;
|
||||
if (!FindProvider(thePath, Standard_False, aProvider))
|
||||
{
|
||||
return Standard_False;
|
||||
}
|
||||
return aProvider->Write(thePath, theShape, theProgress);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
// function : Load
|
||||
// purpose :
|
||||
|
@@ -21,7 +21,7 @@
|
||||
#include <TColStd_ListOfAsciiString.hxx>
|
||||
|
||||
class TopoDS_Shape;
|
||||
class XSControl_WorkSession;
|
||||
class DE_WorkSession;
|
||||
class TDocStd_Document;
|
||||
|
||||
typedef NCollection_IndexedDataMap<TCollection_AsciiString, Handle(DE_ConfigurationNode), TCollection_AsciiString> DE_ConfigurationVendorMap;
|
||||
@@ -80,7 +80,7 @@ public:
|
||||
//! @return true if Read operation has ended correctly
|
||||
Standard_EXPORT Standard_Boolean Read(const TCollection_AsciiString& thePath,
|
||||
const Handle(TDocStd_Document)& theDocument,
|
||||
Handle(XSControl_WorkSession)& theWS,
|
||||
Handle(DE_WorkSession)& theWS,
|
||||
const Message_ProgressRange& theProgress = Message_ProgressRange());
|
||||
|
||||
//! Writes a CAD file, according internal configuration
|
||||
@@ -91,25 +91,7 @@ public:
|
||||
//! @return true if Write operation has ended correctly
|
||||
Standard_EXPORT Standard_Boolean Write(const TCollection_AsciiString& thePath,
|
||||
const Handle(TDocStd_Document)& theDocument,
|
||||
Handle(XSControl_WorkSession)& theWS,
|
||||
const Message_ProgressRange& theProgress = Message_ProgressRange());
|
||||
|
||||
//! Reads a CAD file, according internal configuration
|
||||
//! @param[in] thePath path to the import CAD file
|
||||
//! @param[out] theDocument document to save result
|
||||
//! @param theProgress[in] progress indicator
|
||||
//! @return true if Read operation has ended correctly
|
||||
Standard_EXPORT Standard_Boolean Read(const TCollection_AsciiString& thePath,
|
||||
const Handle(TDocStd_Document)& theDocument,
|
||||
const Message_ProgressRange& theProgress = Message_ProgressRange());
|
||||
|
||||
//! Writes a CAD file, according internal configuration
|
||||
//! @param[in] thePath path to the export CAD file
|
||||
//! @param[out] theDocument document to export
|
||||
//! @param theProgress[in] progress indicator
|
||||
//! @return true if Write operation has ended correctly
|
||||
Standard_EXPORT Standard_Boolean Write(const TCollection_AsciiString& thePath,
|
||||
const Handle(TDocStd_Document)& theDocument,
|
||||
Handle(DE_WorkSession)& theWS,
|
||||
const Message_ProgressRange& theProgress = Message_ProgressRange());
|
||||
|
||||
//! Reads a CAD file, according internal configuration
|
||||
@@ -120,7 +102,7 @@ public:
|
||||
//! @return true if Read operation has ended correctly
|
||||
Standard_EXPORT Standard_Boolean Read(const TCollection_AsciiString& thePath,
|
||||
TopoDS_Shape& theShape,
|
||||
Handle(XSControl_WorkSession)& theWS,
|
||||
Handle(DE_WorkSession)& theWS,
|
||||
const Message_ProgressRange& theProgress = Message_ProgressRange());
|
||||
|
||||
//! Writes a CAD file, according internal configuration
|
||||
@@ -131,25 +113,7 @@ public:
|
||||
//! @return true if Write operation has ended correctly
|
||||
Standard_EXPORT Standard_Boolean Write(const TCollection_AsciiString& thePath,
|
||||
const TopoDS_Shape& theShape,
|
||||
Handle(XSControl_WorkSession)& theWS,
|
||||
const Message_ProgressRange& theProgress = Message_ProgressRange());
|
||||
|
||||
//! Reads a CAD file, according internal configuration
|
||||
//! @param[in] thePath path to the import CAD file
|
||||
//! @param[out] theShape shape to save result
|
||||
//! @param theProgress[in] progress indicator
|
||||
//! @return true if Read operation has ended correctly
|
||||
Standard_EXPORT Standard_Boolean Read(const TCollection_AsciiString& thePath,
|
||||
TopoDS_Shape& theShape,
|
||||
const Message_ProgressRange& theProgress = Message_ProgressRange());
|
||||
|
||||
//! Writes a CAD file, according internal configuration
|
||||
//! @param[in] thePath path to the export CAD file
|
||||
//! @param[out] theShape shape to export
|
||||
//! @param theProgress[in] progress indicator
|
||||
//! @return true if Write operation has ended correctly
|
||||
Standard_EXPORT Standard_Boolean Write(const TCollection_AsciiString& thePath,
|
||||
const TopoDS_Shape& theShape,
|
||||
Handle(DE_WorkSession)& theWS,
|
||||
const Message_ProgressRange& theProgress = Message_ProgressRange());
|
||||
|
||||
public:
|
||||
|
@@ -2,7 +2,11 @@ DE_ConfigurationContext.cxx
|
||||
DE_ConfigurationContext.hxx
|
||||
DE_ConfigurationNode.cxx
|
||||
DE_ConfigurationNode.hxx
|
||||
DE_DataModel.cxx
|
||||
DE_DataModel.hxx
|
||||
DE_Provider.cxx
|
||||
DE_Provider.hxx
|
||||
DE_WorkSession.cxx
|
||||
DE_WorkSession.hxx
|
||||
DE_Wrapper.cxx
|
||||
DE_Wrapper.hxx
|
||||
|
@@ -51,7 +51,21 @@ bool DEBRepCascade_Provider::Read(const TCollection_AsciiString& thePath,
|
||||
const Message_ProgressRange& theProgress)
|
||||
{
|
||||
(void)theWS;
|
||||
return Read(thePath, theDocument, theProgress);
|
||||
if (theDocument.IsNull())
|
||||
{
|
||||
Message::SendFail() << "Error: DEBRepCascade_Provider : "
|
||||
<< "Null document";
|
||||
return false;
|
||||
}
|
||||
TopoDS_Shape aShape;
|
||||
if (!Read(thePath, aShape, theWS, theProgress))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
Handle(XCAFDoc_ShapeTool) aShTool =
|
||||
XCAFDoc_DocumentTool::ShapeTool(theDocument->Main());
|
||||
aShTool->AddShape(aShape);
|
||||
return true;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@@ -64,49 +78,15 @@ bool DEBRepCascade_Provider::Write(const TCollection_AsciiString& thePath,
|
||||
const Message_ProgressRange& theProgress)
|
||||
{
|
||||
(void)theWS;
|
||||
return Write(thePath, theDocument, theProgress);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
// function : Read
|
||||
// purpose :
|
||||
//=======================================================================
|
||||
bool DEBRepCascade_Provider::Read(const TCollection_AsciiString& thePath,
|
||||
const Handle(TDocStd_Document)& theDocument,
|
||||
const Message_ProgressRange& theProgress)
|
||||
{
|
||||
if(theDocument.IsNull())
|
||||
{
|
||||
Message::SendFail() << "Error in the DEBRepCascade_Provider during reading the file " <<
|
||||
thePath << "\t: theDocument shouldn't be null";
|
||||
return false;
|
||||
}
|
||||
TopoDS_Shape aShape;
|
||||
if (!Read(thePath, aShape, theProgress))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
Handle(XCAFDoc_ShapeTool) aShTool = XCAFDoc_DocumentTool::ShapeTool(theDocument->Main());
|
||||
aShTool->AddShape(aShape);
|
||||
return true;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
// function : Write
|
||||
// purpose :
|
||||
//=======================================================================
|
||||
bool DEBRepCascade_Provider::Write(const TCollection_AsciiString& thePath,
|
||||
const Handle(TDocStd_Document)& theDocument,
|
||||
const Message_ProgressRange& theProgress)
|
||||
{
|
||||
TopoDS_Shape aShape;
|
||||
TDF_LabelSequence aLabels;
|
||||
Handle(XCAFDoc_ShapeTool) aSTool = XCAFDoc_DocumentTool::ShapeTool(theDocument->Main());
|
||||
Handle(XCAFDoc_ShapeTool) aSTool =
|
||||
XCAFDoc_DocumentTool::ShapeTool(theDocument->Main());
|
||||
aSTool->GetFreeShapes(aLabels);
|
||||
if (aLabels.Length() <= 0)
|
||||
{
|
||||
Message::SendFail() << "Error in the DEBRepCascade_Provider during writing the file " <<
|
||||
thePath << "\t: Document contain no shapes";
|
||||
Message::SendFail() << "Error: DEBRepCascade_Provider : "
|
||||
<< "Incorrect or empty Configuration Node";
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -126,7 +106,7 @@ bool DEBRepCascade_Provider::Write(const TCollection_AsciiString& thePath,
|
||||
}
|
||||
aShape = aComp;
|
||||
}
|
||||
return Write(thePath, aShape, theProgress);
|
||||
return Write(thePath, aShape, theWS, theProgress);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@@ -139,73 +119,45 @@ bool DEBRepCascade_Provider::Read(const TCollection_AsciiString& thePath,
|
||||
const Message_ProgressRange& theProgress)
|
||||
{
|
||||
(void)theWS;
|
||||
return Read(thePath, theShape, theProgress);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
// function : Write
|
||||
// purpose :
|
||||
//=======================================================================
|
||||
bool DEBRepCascade_Provider::Write(const TCollection_AsciiString& thePath,
|
||||
const TopoDS_Shape& theShape,
|
||||
Handle(XSControl_WorkSession)& theWS,
|
||||
const Message_ProgressRange& theProgress)
|
||||
{
|
||||
(void)theWS;
|
||||
return Write(thePath, theShape, theProgress);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
// function : Read
|
||||
// purpose :
|
||||
//=======================================================================
|
||||
bool DEBRepCascade_Provider::Read(const TCollection_AsciiString& thePath,
|
||||
TopoDS_Shape& theShape,
|
||||
const Message_ProgressRange& theProgress)
|
||||
{
|
||||
bool isBinaryFormat = true;
|
||||
{
|
||||
// probe file header to recognize format
|
||||
const Handle(OSD_FileSystem)& aFileSystem = OSD_FileSystem::DefaultFileSystem();
|
||||
std::shared_ptr<std::istream> aFile = aFileSystem->OpenIStream(thePath, std::ios::in | std::ios::binary);
|
||||
const Handle(OSD_FileSystem)& aFileSystem =
|
||||
OSD_FileSystem::DefaultFileSystem();
|
||||
std::shared_ptr<std::istream> aFile =
|
||||
aFileSystem->OpenIStream(thePath, std::ios::in | std::ios::binary);
|
||||
if (aFile.get() == NULL)
|
||||
{
|
||||
Message::SendFail() << "Error in the DEBRepCascade_Provider during reading the file " <<
|
||||
thePath << "\t: Cannot read the file";
|
||||
Message::SendFail() << "Error: DEBRepCascade_Provider : ["
|
||||
<< thePath << "] : Cannot open the file";
|
||||
return false;
|
||||
}
|
||||
|
||||
char aStringBuf[255] = {};
|
||||
aFile->read(aStringBuf, 255);
|
||||
if (aFile->fail())
|
||||
{
|
||||
Message::SendFail() << "Error in the DEBRepCascade_Provider during reading the file " <<
|
||||
thePath << "\t: Cannot read the file";
|
||||
Message::SendFail() << "Error: DEBRepCascade_Provider : ["
|
||||
<< thePath << "] : Cannot open the file";
|
||||
return false;
|
||||
}
|
||||
isBinaryFormat = !(::strncmp(aStringBuf, "DBRep_DrawableShape", 19) == 0);
|
||||
}
|
||||
|
||||
Standard_Boolean aReadStatus = Standard_True;
|
||||
if (isBinaryFormat)
|
||||
{
|
||||
if (!BinTools::Read(theShape, thePath.ToCString(), theProgress))
|
||||
{
|
||||
Message::SendFail() << "Error in the DEBRepCascade_Provider during reading the file " <<
|
||||
thePath << "\t: Cannot read from the file";
|
||||
return false;
|
||||
}
|
||||
aReadStatus = BinTools::Read(theShape, thePath.ToCString(), theProgress);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!BRepTools::Read(theShape, thePath.ToCString(), BRep_Builder(), theProgress))
|
||||
aReadStatus =
|
||||
BRepTools::Read(theShape, thePath.ToCString(), BRep_Builder(), theProgress);
|
||||
}
|
||||
if (!aReadStatus)
|
||||
{
|
||||
Message::SendFail() << "Error in the DEBRepCascade_Provider during reading the file " <<
|
||||
thePath << "\t: Cannot read from the file";
|
||||
return false;
|
||||
Message::SendFail() << "Error: DEBRepCascade_Provider : ["
|
||||
<< thePath << "] : Cannot read data from the file";
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
return aReadStatus;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@@ -214,65 +166,76 @@ bool DEBRepCascade_Provider::Read(const TCollection_AsciiString& thePath,
|
||||
//=======================================================================
|
||||
bool DEBRepCascade_Provider::Write(const TCollection_AsciiString& thePath,
|
||||
const TopoDS_Shape& theShape,
|
||||
Handle(XSControl_WorkSession)& theWS,
|
||||
const Message_ProgressRange& theProgress)
|
||||
{
|
||||
if (GetNode().IsNull() || !GetNode()->IsKind(STANDARD_TYPE(DEBRepCascade_ConfigurationNode)))
|
||||
(void)theWS;
|
||||
if (GetNode().IsNull() ||
|
||||
!GetNode()->IsKind(STANDARD_TYPE(DEBRepCascade_ConfigurationNode)))
|
||||
{
|
||||
Message::SendFail() << "Error in the DEBRepCascade_Provider during writing the file " <<
|
||||
thePath << "\t: Incorrect or empty Configuration Node";
|
||||
Message::SendFail() << "Error: DEBRepCascade_Provider : "
|
||||
<< "Incorrect or empty Configuration Node";
|
||||
return false;
|
||||
}
|
||||
Handle(DEBRepCascade_ConfigurationNode) aNode = Handle(DEBRepCascade_ConfigurationNode)::DownCast(GetNode());
|
||||
Handle(DEBRepCascade_ConfigurationNode) aNode =
|
||||
Handle(DEBRepCascade_ConfigurationNode)::DownCast(GetNode());
|
||||
if (aNode->InternalParameters.WriteBinary)
|
||||
{
|
||||
if (aNode->InternalParameters.WriteVersionBin > static_cast<BinTools_FormatVersion>(BinTools_FormatVersion_UPPER) ||
|
||||
aNode->InternalParameters.WriteVersionBin < static_cast<BinTools_FormatVersion>(BinTools_FormatVersion_LOWER))
|
||||
if (aNode->InternalParameters.WriteVersionBin >
|
||||
static_cast<BinTools_FormatVersion>(BinTools_FormatVersion_UPPER) ||
|
||||
aNode->InternalParameters.WriteVersionBin <
|
||||
static_cast<BinTools_FormatVersion>(BinTools_FormatVersion_LOWER))
|
||||
{
|
||||
Message::SendFail() << "Error in the DEBRepCascade_Provider during writing the file " <<
|
||||
thePath << "\t: Unknown format version";
|
||||
Message::SendFail() << "Error: DEBRepCascade_Provider : ["
|
||||
<< thePath << "] : Unknown format version";
|
||||
return false;
|
||||
}
|
||||
if (aNode->InternalParameters.WriteNormals &&
|
||||
aNode->InternalParameters.WriteVersionBin < BinTools_FormatVersion_VERSION_4)
|
||||
{
|
||||
Message::SendFail() << "Error in the DEBRepCascade_Provider during writing the file " <<
|
||||
thePath << "\t: Vertex normals require binary format version 4 or later";
|
||||
Message::SendFail() << "Error: DEBRepCascade_Provider : ["
|
||||
<< thePath << "] : Vertex normals require binary format version 4 or later";
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!BinTools::Write(theShape, thePath.ToCString(), aNode->InternalParameters.WriteTriangles,
|
||||
aNode->InternalParameters.WriteNormals, aNode->InternalParameters.WriteVersionBin, theProgress))
|
||||
if (!BinTools::Write(theShape, thePath.ToCString(),
|
||||
aNode->InternalParameters.WriteTriangles,
|
||||
aNode->InternalParameters.WriteNormals,
|
||||
aNode->InternalParameters.WriteVersionBin, theProgress))
|
||||
{
|
||||
Message::SendFail() << "Error in the DEBRepCascade_Provider during writing the file " <<
|
||||
thePath << "\t: Cannot write the file";
|
||||
Message::SendFail() << "Error: DEBRepCascade_Provider : ["
|
||||
<< thePath << "] : Cannot write the file";
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (aNode->InternalParameters.WriteVersionAscii > static_cast<TopTools_FormatVersion>(TopTools_FormatVersion_UPPER) ||
|
||||
aNode->InternalParameters.WriteVersionAscii < static_cast<TopTools_FormatVersion>(TopTools_FormatVersion_LOWER))
|
||||
if (aNode->InternalParameters.WriteVersionAscii >
|
||||
static_cast<TopTools_FormatVersion>(TopTools_FormatVersion_UPPER) ||
|
||||
aNode->InternalParameters.WriteVersionAscii <
|
||||
static_cast<TopTools_FormatVersion>(TopTools_FormatVersion_LOWER))
|
||||
{
|
||||
Message::SendFail() << "Error in the DEBRepCascade_Provider during writing the file " <<
|
||||
thePath << "\t: Unknown format version";
|
||||
Message::SendFail() << "Error: DEBRepCascade_Provider : ["
|
||||
<< thePath << "] : Unknown format version";
|
||||
return false;
|
||||
}
|
||||
if (aNode->InternalParameters.WriteNormals &&
|
||||
aNode->InternalParameters.WriteVersionAscii < TopTools_FormatVersion_VERSION_3)
|
||||
{
|
||||
Message::SendFail() << "Error in the DEBRepCascade_Provider during writing the file " <<
|
||||
thePath << "\t: Error: vertex normals require ascii format version 3 or later";
|
||||
Message::SendFail() << "Error: DEBRepCascade_Provider : ["
|
||||
<< thePath << "] : Vertex normals require ascii format version 3 or later";
|
||||
return false;
|
||||
}
|
||||
if (!BRepTools::Write(theShape, thePath.ToCString(), aNode->InternalParameters.WriteTriangles,
|
||||
aNode->InternalParameters.WriteNormals, aNode->InternalParameters.WriteVersionAscii, theProgress))
|
||||
if (!BRepTools::Write(theShape, thePath.ToCString(),
|
||||
aNode->InternalParameters.WriteTriangles,
|
||||
aNode->InternalParameters.WriteNormals,
|
||||
aNode->InternalParameters.WriteVersionAscii, theProgress))
|
||||
{
|
||||
Message::SendFail() << "Error in the DEBRepCascade_Provider during writing the file " <<
|
||||
thePath << "\t: Cannot write the file";
|
||||
Message::SendFail() << "Error: DEBRepCascade_Provider : ["
|
||||
<< thePath << "] : Cannot write the file";
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@@ -64,24 +64,6 @@ public:
|
||||
Handle(XSControl_WorkSession)& theWS,
|
||||
const Message_ProgressRange& theProgress = Message_ProgressRange()) Standard_OVERRIDE;
|
||||
|
||||
//! Reads a CAD file, according internal configuration
|
||||
//! @param[in] thePath path to the import CAD file
|
||||
//! @param[out] theDocument document to save result
|
||||
//! @param theProgress[in] progress indicator
|
||||
//! @return true if Read operation has ended correctly
|
||||
Standard_EXPORT virtual bool Read(const TCollection_AsciiString& thePath,
|
||||
const Handle(TDocStd_Document)& theDocument,
|
||||
const Message_ProgressRange& theProgress = Message_ProgressRange()) Standard_OVERRIDE;
|
||||
|
||||
//! Writes a CAD file, according internal configuration
|
||||
//! @param[in] thePath path to the export CAD file
|
||||
//! @param[out] theDocument document to export
|
||||
//! @param theProgress[in] progress indicator
|
||||
//! @return true if Write operation has ended correctly
|
||||
Standard_EXPORT virtual bool Write(const TCollection_AsciiString& thePath,
|
||||
const Handle(TDocStd_Document)& theDocument,
|
||||
const Message_ProgressRange& theProgress = Message_ProgressRange()) Standard_OVERRIDE;
|
||||
|
||||
//! Reads a CAD file, according internal configuration
|
||||
//! @param[in] thePath path to the import CAD file
|
||||
//! @param[out] theShape shape to save result
|
||||
@@ -104,24 +86,6 @@ public:
|
||||
Handle(XSControl_WorkSession)& theWS,
|
||||
const Message_ProgressRange& theProgress = Message_ProgressRange()) Standard_OVERRIDE;
|
||||
|
||||
//! Reads a CAD file, according internal configuration
|
||||
//! @param[in] thePath path to the import CAD file
|
||||
//! @param[out] theShape shape to save result
|
||||
//! @param theProgress[in] progress indicator
|
||||
//! @return true if Read operation has ended correctly
|
||||
Standard_EXPORT virtual bool Read(const TCollection_AsciiString& thePath,
|
||||
TopoDS_Shape& theShape,
|
||||
const Message_ProgressRange& theProgress = Message_ProgressRange()) Standard_OVERRIDE;
|
||||
|
||||
//! Writes a CAD file, according internal configuration
|
||||
//! @param[in] thePath path to the export CAD file
|
||||
//! @param[out] theShape shape to export
|
||||
//! @param theProgress[in] progress indicator
|
||||
//! @return true if Write operation has ended correctly
|
||||
Standard_EXPORT virtual bool Write(const TCollection_AsciiString& thePath,
|
||||
const TopoDS_Shape& theShape,
|
||||
const Message_ProgressRange& theProgress = Message_ProgressRange()) Standard_OVERRIDE;
|
||||
|
||||
public:
|
||||
|
||||
//! Gets CAD format name of associated provider
|
||||
|
@@ -59,43 +59,21 @@ bool DEXCAFCascade_Provider::Read(const TCollection_AsciiString& thePath,
|
||||
const Message_ProgressRange& theProgress)
|
||||
{
|
||||
(void)theWS;
|
||||
return Read(thePath, theDocument, theProgress);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
// function : Write
|
||||
// purpose :
|
||||
//=======================================================================
|
||||
bool DEXCAFCascade_Provider::Write(const TCollection_AsciiString& thePath,
|
||||
const Handle(TDocStd_Document)& theDocument,
|
||||
Handle(XSControl_WorkSession)& theWS,
|
||||
const Message_ProgressRange& theProgress)
|
||||
{
|
||||
(void)theWS;
|
||||
return Write(thePath, theDocument, theProgress);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
// function : Read
|
||||
// purpose :
|
||||
//=======================================================================
|
||||
bool DEXCAFCascade_Provider::Read(const TCollection_AsciiString& thePath,
|
||||
const Handle(TDocStd_Document)& theDocument,
|
||||
const Message_ProgressRange& theProgress)
|
||||
{
|
||||
if (theDocument.IsNull())
|
||||
{
|
||||
Message::SendFail() << "Error in the DEXCAFCascade_Provider during reading the file " <<
|
||||
thePath << "\t: theDocument shouldn't be null";
|
||||
Message::SendFail() << "Error: DEXCAFCascade_Provider : "
|
||||
<< "Null document";
|
||||
return false;
|
||||
}
|
||||
if (GetNode().IsNull() || !GetNode()->IsKind(STANDARD_TYPE(DEXCAFCascade_ConfigurationNode)))
|
||||
if (GetNode().IsNull() ||
|
||||
!GetNode()->IsKind(STANDARD_TYPE(DEXCAFCascade_ConfigurationNode)))
|
||||
{
|
||||
Message::SendFail() << "Error in the DEXCAFCascade_Provider during reading the file " << thePath
|
||||
<< "\t: Incorrect or empty Configuration Node";
|
||||
Message::SendFail() << "Error: DEXCAFCascade_Provider : "
|
||||
<< "Incorrect or empty Configuration Node";
|
||||
return false;
|
||||
}
|
||||
Handle(DEXCAFCascade_ConfigurationNode) aNode = Handle(DEXCAFCascade_ConfigurationNode)::DownCast(GetNode());
|
||||
Handle(DEXCAFCascade_ConfigurationNode) aNode =
|
||||
Handle(DEXCAFCascade_ConfigurationNode)::DownCast(GetNode());
|
||||
Handle(TDocStd_Document) aDocument;
|
||||
Handle(TDocStd_Application) anApp = new TDocStd_Application();
|
||||
BinDrivers::DefineFormat(anApp);
|
||||
@@ -108,12 +86,15 @@ bool DEXCAFCascade_Provider::Read(const TCollection_AsciiString& thePath,
|
||||
XmlLDrivers::DefineFormat(anApp);
|
||||
XmlTObjDrivers::DefineFormat(anApp);
|
||||
XmlXCAFDrivers::DefineFormat(anApp);
|
||||
Handle(PCDM_ReaderFilter) aFilter = new PCDM_ReaderFilter(aNode->InternalParameters.ReadAppendMode);
|
||||
for (TColStd_ListOfAsciiString::Iterator anIt(aNode->InternalParameters.ReadSkipValues); anIt.More(); anIt.Next())
|
||||
Handle(PCDM_ReaderFilter) aFilter =
|
||||
new PCDM_ReaderFilter(aNode->InternalParameters.ReadAppendMode);
|
||||
for (TColStd_ListOfAsciiString::Iterator anIt(aNode->InternalParameters.ReadSkipValues);
|
||||
anIt.More(); anIt.Next())
|
||||
{
|
||||
aFilter->AddSkipped(anIt.Value());
|
||||
}
|
||||
for (TColStd_ListOfAsciiString::Iterator anIt(aNode->InternalParameters.ReadValues); anIt.More(); anIt.Next())
|
||||
for (TColStd_ListOfAsciiString::Iterator anIt(aNode->InternalParameters.ReadValues);
|
||||
anIt.More(); anIt.Next())
|
||||
{
|
||||
if (anIt.Value().StartsWith("0"))
|
||||
{
|
||||
@@ -127,8 +108,8 @@ bool DEXCAFCascade_Provider::Read(const TCollection_AsciiString& thePath,
|
||||
|
||||
if (anApp->Open(thePath, aDocument, aFilter, theProgress) != PCDM_RS_OK)
|
||||
{
|
||||
Message::SendFail() << "Error in the DEXCAFCascade_Provider during reading the file : " << thePath
|
||||
<< "\t: Cannot open XDE document";
|
||||
Message::SendFail() << "Error: DEXCAFCascade_Provider : [" <<
|
||||
thePath << "] : Cannot open XDE document";
|
||||
return false;
|
||||
}
|
||||
theDocument->SetData(aDocument->GetData());
|
||||
@@ -141,8 +122,10 @@ bool DEXCAFCascade_Provider::Read(const TCollection_AsciiString& thePath,
|
||||
//=======================================================================
|
||||
bool DEXCAFCascade_Provider::Write(const TCollection_AsciiString& thePath,
|
||||
const Handle(TDocStd_Document)& theDocument,
|
||||
Handle(XSControl_WorkSession)& theWS,
|
||||
const Message_ProgressRange& theProgress)
|
||||
{
|
||||
(void)theWS;
|
||||
Handle(TDocStd_Application) anApp = new TDocStd_Application();
|
||||
BinXCAFDrivers::DefineFormat(anApp);
|
||||
PCDM_StoreStatus aStatus = PCDM_SS_Doc_IsNull;
|
||||
@@ -152,50 +135,50 @@ bool DEXCAFCascade_Provider::Write(const TCollection_AsciiString& thePath,
|
||||
}
|
||||
else if (!theDocument->IsSaved())
|
||||
{
|
||||
Message::SendFail() << "Storage error in the DEXCAFCascade_Provider during writing the file " <<
|
||||
thePath << "\t: Storage error : this document has never been saved";
|
||||
Message::SendFail() << "Error: DEXCAFCascade_Provider : [" <<
|
||||
thePath << "] : Storage error : Document has never been saved";
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
aStatus = anApp->Save(theDocument, theProgress);
|
||||
}
|
||||
|
||||
switch (aStatus)
|
||||
{
|
||||
case PCDM_SS_OK:
|
||||
return true;
|
||||
case PCDM_SS_DriverFailure:
|
||||
Message::SendFail() << "Error in the DEXCAFCascade_Provider during writing the file : " << thePath
|
||||
<< "\t: Storage error : driver failure";
|
||||
Message::SendFail() << "Error: DEXCAFCascade_Provider : [" <<
|
||||
thePath << "] : Storage error : driver failure";
|
||||
break;
|
||||
case PCDM_SS_WriteFailure:
|
||||
Message::SendFail() << "Error in the DEXCAFCascade_Provider during the writing the file : " << thePath
|
||||
<< "\t: Storage error : write failure";
|
||||
Message::SendFail() << "Error: DEXCAFCascade_Provider : [" <<
|
||||
thePath << "] : Storage error : write failure";
|
||||
break;
|
||||
case PCDM_SS_Failure:
|
||||
Message::SendFail() << "Error in the DEXCAFCascade_Provider during writing the file : " << thePath
|
||||
<< "\t: Storage error : general failure";
|
||||
Message::SendFail() << "Error: DEXCAFCascade_Provider : [" <<
|
||||
thePath << "] : Storage error : general failure";
|
||||
break;
|
||||
case PCDM_SS_Doc_IsNull:
|
||||
Message::SendFail() << "Error in the DEXCAFCascade_Provider during writing the file : " << thePath
|
||||
<< "\t: Storage error :: document is NULL";
|
||||
Message::SendFail() << "Error: DEXCAFCascade_Provider : [" <<
|
||||
thePath << "] : Storage error : document is NULL";
|
||||
break;
|
||||
case PCDM_SS_No_Obj:
|
||||
Message::SendFail() << "Error in the DEXCAFCascade_Provider during writing the file : " << thePath
|
||||
<< "\t: Storage error : no object";
|
||||
Message::SendFail() << "Error: DEXCAFCascade_Provider : [" <<
|
||||
thePath << "] : Storage error : no object";
|
||||
break;
|
||||
case PCDM_SS_Info_Section_Error:
|
||||
Message::SendFail() << "Error in the DEXCAFCascade_Provider during writing the file : " << thePath
|
||||
<< "\t: Storage error : section error";
|
||||
Message::SendFail() << "Error: DEXCAFCascade_Provider : [" <<
|
||||
thePath << "] : Storage error : section error";
|
||||
break;
|
||||
case PCDM_SS_UserBreak:
|
||||
Message::SendFail() << "Error in the DEXCAFCascade_Provider during writing the file : " << thePath
|
||||
<< "\t: Storage error : user break";
|
||||
Message::SendFail() << "Error: DEXCAFCascade_Provider : [" <<
|
||||
thePath << "] : Storage error : user break";
|
||||
break;
|
||||
case PCDM_SS_UnrecognizedFormat:
|
||||
Message::SendFail() << "Error in the DEXCAFCascade_Provider during writing the file : " << thePath
|
||||
<< "\t: Storage error : unrecognized document storage format : " << theDocument->StorageFormat();
|
||||
Message::SendFail() << "Error: DEXCAFCascade_Provider : [" <<
|
||||
thePath << "] : Storage error : unrecognized document storage format : "
|
||||
<< theDocument->StorageFormat();
|
||||
break;
|
||||
}
|
||||
return false;
|
||||
@@ -211,48 +194,25 @@ bool DEXCAFCascade_Provider::Read(const TCollection_AsciiString& thePath,
|
||||
const Message_ProgressRange& theProgress)
|
||||
{
|
||||
(void)theWS;
|
||||
return Read(thePath, theShape, theProgress);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
// function : Write
|
||||
// purpose :
|
||||
//=======================================================================
|
||||
bool DEXCAFCascade_Provider::Write(const TCollection_AsciiString& thePath,
|
||||
const TopoDS_Shape& theShape,
|
||||
Handle(XSControl_WorkSession)& theWS,
|
||||
const Message_ProgressRange& theProgress)
|
||||
{
|
||||
(void)theWS;
|
||||
return Write(thePath, theShape, theProgress);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
// function : Read
|
||||
// purpose :
|
||||
//=======================================================================
|
||||
bool DEXCAFCascade_Provider::Read(const TCollection_AsciiString& thePath,
|
||||
TopoDS_Shape& theShape,
|
||||
const Message_ProgressRange& theProgress)
|
||||
{
|
||||
if (GetNode().IsNull() || !GetNode()->IsKind(STANDARD_TYPE(DEXCAFCascade_ConfigurationNode)))
|
||||
if (GetNode().IsNull() ||
|
||||
!GetNode()->IsKind(STANDARD_TYPE(DEXCAFCascade_ConfigurationNode)))
|
||||
{
|
||||
Message::SendFail() << "Error in the DEXCAFCascade_Provider during reading the file " << thePath
|
||||
<< "\t: Incorrect or empty Configuration Node";
|
||||
Message::SendFail() << "Error: DEXCAFCascade_Provider : "
|
||||
<< "Incorrect or empty Configuration Node";
|
||||
return false;
|
||||
}
|
||||
Handle(TDocStd_Document) aDocument;
|
||||
Handle(TDocStd_Application) anApp = new TDocStd_Application();
|
||||
BinXCAFDrivers::DefineFormat(anApp);
|
||||
anApp->NewDocument("BinXCAF", aDocument);
|
||||
Read(thePath, aDocument, theProgress);
|
||||
Read(thePath, aDocument, theWS, theProgress);
|
||||
TDF_LabelSequence aLabels;
|
||||
Handle(XCAFDoc_ShapeTool) aSTool = XCAFDoc_DocumentTool::ShapeTool(aDocument->Main());
|
||||
aSTool->GetFreeShapes(aLabels);
|
||||
if (aLabels.Length() <= 0)
|
||||
{
|
||||
Message::SendFail() << "Error in the DEXCAFCascade_Provider during reading the file : " << thePath
|
||||
<< "\t: Document contain no shapes";
|
||||
Message::SendFail() << "Error: DEXCAFCascade_Provider : [" <<
|
||||
thePath << "] : Storage error : Document contain no shapes";
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -281,12 +241,14 @@ bool DEXCAFCascade_Provider::Read(const TCollection_AsciiString& thePath,
|
||||
//=======================================================================
|
||||
bool DEXCAFCascade_Provider::Write(const TCollection_AsciiString& thePath,
|
||||
const TopoDS_Shape& theShape,
|
||||
Handle(XSControl_WorkSession)& theWS,
|
||||
const Message_ProgressRange& theProgress)
|
||||
{
|
||||
(void)theWS;
|
||||
Handle(TDocStd_Document) aDoc = new TDocStd_Document("BinXCAF");
|
||||
Handle(XCAFDoc_ShapeTool) aShTool = XCAFDoc_DocumentTool::ShapeTool(aDoc->Main());
|
||||
aShTool->AddShape(theShape);
|
||||
return Write(thePath, aDoc, theProgress);
|
||||
return Write(thePath, aDoc, theWS, theProgress);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
|
@@ -64,24 +64,6 @@ public:
|
||||
Handle(XSControl_WorkSession)& theWS,
|
||||
const Message_ProgressRange& theProgress = Message_ProgressRange()) Standard_OVERRIDE;
|
||||
|
||||
//! Reads a CAD file, according internal configuration
|
||||
//! @param[in] thePath path to the import CAD file
|
||||
//! @param[out] theDocument document to save result
|
||||
//! @param theProgress[in] progress indicator
|
||||
//! @return true if Read operation has ended correctly
|
||||
Standard_EXPORT virtual bool Read(const TCollection_AsciiString& thePath,
|
||||
const Handle(TDocStd_Document)& theDocument,
|
||||
const Message_ProgressRange& theProgress = Message_ProgressRange()) Standard_OVERRIDE;
|
||||
|
||||
//! Writes a CAD file, according internal configuration
|
||||
//! @param[in] thePath path to the export CAD file
|
||||
//! @param[out] theDocument document to export
|
||||
//! @param theProgress[in] progress indicator
|
||||
//! @return true if Write operation has ended correctly
|
||||
Standard_EXPORT virtual bool Write(const TCollection_AsciiString& thePath,
|
||||
const Handle(TDocStd_Document)& theDocument,
|
||||
const Message_ProgressRange& theProgress = Message_ProgressRange()) Standard_OVERRIDE;
|
||||
|
||||
//! Reads a CAD file, according internal configuration
|
||||
//! @param[in] thePath path to the import CAD file
|
||||
//! @param[out] theShape shape to save result
|
||||
@@ -104,24 +86,6 @@ public:
|
||||
Handle(XSControl_WorkSession)& theWS,
|
||||
const Message_ProgressRange& theProgress = Message_ProgressRange()) Standard_OVERRIDE;
|
||||
|
||||
//! Reads a CAD file, according internal configuration
|
||||
//! @param[in] thePath path to the import CAD file
|
||||
//! @param[out] theShape shape to save result
|
||||
//! @param theProgress[in] progress indicator
|
||||
//! @return true if Read operation has ended correctly
|
||||
Standard_EXPORT virtual bool Read(const TCollection_AsciiString& thePath,
|
||||
TopoDS_Shape& theShape,
|
||||
const Message_ProgressRange& theProgress = Message_ProgressRange()) Standard_OVERRIDE;
|
||||
|
||||
//! Writes a CAD file, according internal configuration
|
||||
//! @param[in] thePath path to the export CAD file
|
||||
//! @param[out] theShape shape to export
|
||||
//! @param theProgress[in] progress indicator
|
||||
//! @return true if Write operation has ended correctly
|
||||
Standard_EXPORT virtual bool Write(const TCollection_AsciiString& thePath,
|
||||
const TopoDS_Shape& theShape,
|
||||
const Message_ProgressRange& theProgress = Message_ProgressRange()) Standard_OVERRIDE;
|
||||
|
||||
public:
|
||||
|
||||
//! Gets CAD format name of associated provider
|
||||
|
@@ -12,16 +12,13 @@ TKTObj
|
||||
TKBinTObj
|
||||
TKXmlTObj
|
||||
TKXDESTEP
|
||||
TKSTEP
|
||||
TKSTEPAttr
|
||||
TKSTEP209
|
||||
TKSTEPBase
|
||||
TKXDEIGES
|
||||
TKIGES
|
||||
TKXSBase
|
||||
TKVRML
|
||||
TKSTL
|
||||
TKXDEVRML
|
||||
TKXDESTL
|
||||
TKRWMesh
|
||||
TKXDEGLTF
|
||||
TKXDEOBJ
|
||||
TKXDEPLY
|
||||
TKXDE
|
||||
TKBinXCAF
|
||||
TKXmlXCAF
|
||||
|
@@ -33,10 +33,10 @@ DEFAULT : MODELING
|
||||
MODELING : TOPTEST
|
||||
VISUALIZATION : AISV
|
||||
OCAFKERNEL : DCAF
|
||||
DATAEXCHANGEKERNEL : XSDRAW
|
||||
DATAEXCHANGEKERNEL : XSDRAW, DEWrapper
|
||||
OCAF : VISUALIZATION, OCAFKERNEL
|
||||
DATAEXCHANGE : XDE, VISUALIZATION
|
||||
XDE : DATAEXCHANGEKERNEL, XDEDRAW
|
||||
XDE : DATAEXCHANGEKERNEL, XDEDRAW, STEP, IGES, GLTF, OBJ, PLY, STL, VRML
|
||||
ALL : MODELING, OCAFKERNEL, DATAEXCHANGE
|
||||
|
||||
TOPTEST : TKTopTest
|
||||
@@ -49,8 +49,16 @@ OPENGLES : TKOpenGlesTest
|
||||
D3DHOST : TKD3DHostTest
|
||||
XSDRAW : TKXSDRAW
|
||||
XDEDRAW : TKXDEDRAW
|
||||
DEWrapper : TKXSDRAWDEWrapper
|
||||
TOBJ : TKTObjDRAW
|
||||
DFBROWSER : TKDFBrowser
|
||||
QAcommands : TKQADraw
|
||||
VIS : TKIVtkDraw
|
||||
INSPECTOR : TKToolsDraw
|
||||
STEP : TKXSDRAWSTEP
|
||||
IGES : TKXSDRAWIGES
|
||||
GLTF : TKXSDRAWGLTF
|
||||
OBJ : TKXSDRAWOBJ
|
||||
PLY : TKXSDRAWPLY
|
||||
STL : TKXSDRAWSTL
|
||||
VRML : TKXSDRAWVRML
|
||||
|
@@ -6,5 +6,7 @@ HeaderSection_FileName.cxx
|
||||
HeaderSection_FileName.hxx
|
||||
HeaderSection_FileSchema.cxx
|
||||
HeaderSection_FileSchema.hxx
|
||||
HeaderSection_MakeHeader.cxx
|
||||
HeaderSection_MakeHeader.hxx
|
||||
HeaderSection_Protocol.cxx
|
||||
HeaderSection_Protocol.hxx
|
||||
|
@@ -17,7 +17,7 @@
|
||||
//#58 rln 28.12.98 STEP header fields (NOTE: more parameterization is necessary)
|
||||
//pdn 11.01.99 including <stdio.h> for compilation on NT
|
||||
|
||||
#include <APIHeaderSection_MakeHeader.hxx>
|
||||
#include <HeaderSection_MakeHeader.hxx>
|
||||
#include <HeaderSection_FileDescription.hxx>
|
||||
#include <HeaderSection_FileName.hxx>
|
||||
#include <HeaderSection_FileSchema.hxx>
|
||||
@@ -35,7 +35,7 @@
|
||||
static Handle(TCollection_HAsciiString) nulstr;
|
||||
static Handle(Interface_HArray1OfHAsciiString) nularr;
|
||||
|
||||
APIHeaderSection_MakeHeader::APIHeaderSection_MakeHeader
|
||||
HeaderSection_MakeHeader::HeaderSection_MakeHeader
|
||||
(const Handle(StepData_StepModel)& model)
|
||||
{
|
||||
done = Standard_True;
|
||||
@@ -56,7 +56,7 @@ APIHeaderSection_MakeHeader::APIHeaderSection_MakeHeader
|
||||
else done = Standard_False;
|
||||
}
|
||||
|
||||
APIHeaderSection_MakeHeader::APIHeaderSection_MakeHeader
|
||||
HeaderSection_MakeHeader::HeaderSection_MakeHeader
|
||||
(const Standard_Integer shapetype)
|
||||
{
|
||||
switch(shapetype) {
|
||||
@@ -68,7 +68,7 @@ APIHeaderSection_MakeHeader::APIHeaderSection_MakeHeader
|
||||
}
|
||||
}
|
||||
|
||||
void APIHeaderSection_MakeHeader::Init (const Standard_CString nameval)
|
||||
void HeaderSection_MakeHeader::Init (const Standard_CString nameval)
|
||||
{
|
||||
done = Standard_True;
|
||||
|
||||
@@ -134,12 +134,12 @@ void APIHeaderSection_MakeHeader::Init (const Standard_CString nameval)
|
||||
|
||||
}
|
||||
|
||||
Standard_Boolean APIHeaderSection_MakeHeader::IsDone() const
|
||||
Standard_Boolean HeaderSection_MakeHeader::IsDone() const
|
||||
{
|
||||
return done;
|
||||
}
|
||||
|
||||
void APIHeaderSection_MakeHeader::Apply
|
||||
void HeaderSection_MakeHeader::Apply
|
||||
(const Handle(StepData_StepModel)& model) const
|
||||
{
|
||||
Interface_EntityIterator header = model->Header();
|
||||
@@ -177,7 +177,7 @@ void APIHeaderSection_MakeHeader::Apply
|
||||
// FileName
|
||||
// ========
|
||||
|
||||
Handle(StepData_StepModel) APIHeaderSection_MakeHeader::NewModel
|
||||
Handle(StepData_StepModel) HeaderSection_MakeHeader::NewModel
|
||||
(const Handle(Interface_Protocol)& protocol) const
|
||||
{
|
||||
Handle(StepData_StepModel) stepmodel = new StepData_StepModel;
|
||||
@@ -195,16 +195,16 @@ Handle(StepData_StepModel) APIHeaderSection_MakeHeader::NewModel
|
||||
// FileName
|
||||
// ========
|
||||
|
||||
Standard_Boolean APIHeaderSection_MakeHeader::HasFn() const
|
||||
Standard_Boolean HeaderSection_MakeHeader::HasFn() const
|
||||
{ return (!fn.IsNull()); }
|
||||
|
||||
Handle(HeaderSection_FileName) APIHeaderSection_MakeHeader::FnValue() const
|
||||
Handle(HeaderSection_FileName) HeaderSection_MakeHeader::FnValue() const
|
||||
{
|
||||
return fn;
|
||||
}
|
||||
|
||||
/*
|
||||
void APIHeaderSection_MakeHeader::SetNameFromShapeType(const Standard_Integer shapetype)
|
||||
void HeaderSection_MakeHeader::SetNameFromShapeType(const Standard_Integer shapetype)
|
||||
{
|
||||
Handle(TCollection_HAsciiString) name;
|
||||
switch(shapetype)
|
||||
@@ -230,106 +230,106 @@ void APIHeaderSection_MakeHeader::SetNameFromShapeType(const Standard_Integer sh
|
||||
}
|
||||
*/
|
||||
|
||||
void APIHeaderSection_MakeHeader::SetName(const Handle(TCollection_HAsciiString)& aName)
|
||||
void HeaderSection_MakeHeader::SetName(const Handle(TCollection_HAsciiString)& aName)
|
||||
{
|
||||
if (!fn.IsNull()) fn->SetName(aName);
|
||||
}
|
||||
|
||||
Handle(TCollection_HAsciiString) APIHeaderSection_MakeHeader::Name() const
|
||||
Handle(TCollection_HAsciiString) HeaderSection_MakeHeader::Name() const
|
||||
{
|
||||
return (fn.IsNull() ? nulstr : fn->Name());
|
||||
}
|
||||
|
||||
void APIHeaderSection_MakeHeader::SetTimeStamp(const Handle(TCollection_HAsciiString)& aTimeStamp)
|
||||
void HeaderSection_MakeHeader::SetTimeStamp(const Handle(TCollection_HAsciiString)& aTimeStamp)
|
||||
{
|
||||
if (!fn.IsNull()) fn->SetTimeStamp(aTimeStamp);
|
||||
}
|
||||
|
||||
Handle(TCollection_HAsciiString) APIHeaderSection_MakeHeader::TimeStamp() const
|
||||
Handle(TCollection_HAsciiString) HeaderSection_MakeHeader::TimeStamp() const
|
||||
{
|
||||
return (fn.IsNull() ? nulstr : fn->TimeStamp());
|
||||
}
|
||||
|
||||
void APIHeaderSection_MakeHeader::SetAuthor(const Handle(Interface_HArray1OfHAsciiString)& aAuthor)
|
||||
void HeaderSection_MakeHeader::SetAuthor(const Handle(Interface_HArray1OfHAsciiString)& aAuthor)
|
||||
{
|
||||
if (!fn.IsNull()) fn->SetAuthor(aAuthor);
|
||||
}
|
||||
|
||||
void APIHeaderSection_MakeHeader::SetAuthorValue(const Standard_Integer num, const Handle(TCollection_HAsciiString)& aAuthor)
|
||||
void HeaderSection_MakeHeader::SetAuthorValue(const Standard_Integer num, const Handle(TCollection_HAsciiString)& aAuthor)
|
||||
{
|
||||
if (fn.IsNull()) return;
|
||||
Handle(Interface_HArray1OfHAsciiString) li = fn->Author();
|
||||
if (num >= li->Lower() && num <= li->Upper()) li->SetValue(num,aAuthor);
|
||||
}
|
||||
|
||||
Handle(Interface_HArray1OfHAsciiString) APIHeaderSection_MakeHeader::Author() const
|
||||
Handle(Interface_HArray1OfHAsciiString) HeaderSection_MakeHeader::Author() const
|
||||
{
|
||||
return (fn.IsNull() ? nularr : fn->Author());
|
||||
}
|
||||
|
||||
Handle(TCollection_HAsciiString) APIHeaderSection_MakeHeader::AuthorValue(const Standard_Integer num) const
|
||||
Handle(TCollection_HAsciiString) HeaderSection_MakeHeader::AuthorValue(const Standard_Integer num) const
|
||||
{
|
||||
return (fn.IsNull() ? nulstr : fn->AuthorValue(num));
|
||||
}
|
||||
|
||||
Standard_Integer APIHeaderSection_MakeHeader::NbAuthor () const
|
||||
Standard_Integer HeaderSection_MakeHeader::NbAuthor () const
|
||||
{
|
||||
return (fn.IsNull() ? 0 : fn->NbAuthor());
|
||||
}
|
||||
|
||||
void APIHeaderSection_MakeHeader::SetOrganization(const Handle(Interface_HArray1OfHAsciiString)& aOrganization)
|
||||
void HeaderSection_MakeHeader::SetOrganization(const Handle(Interface_HArray1OfHAsciiString)& aOrganization)
|
||||
{
|
||||
if (!fn.IsNull()) fn->SetOrganization(aOrganization);
|
||||
}
|
||||
|
||||
void APIHeaderSection_MakeHeader::SetOrganizationValue(const Standard_Integer num, const Handle(TCollection_HAsciiString)& aOrgan)
|
||||
void HeaderSection_MakeHeader::SetOrganizationValue(const Standard_Integer num, const Handle(TCollection_HAsciiString)& aOrgan)
|
||||
{
|
||||
if (fn.IsNull()) return;
|
||||
Handle(Interface_HArray1OfHAsciiString) li = fn->Organization();
|
||||
if (num >= li->Lower() && num <= li->Upper()) li->SetValue(num,aOrgan);
|
||||
}
|
||||
|
||||
Handle(Interface_HArray1OfHAsciiString) APIHeaderSection_MakeHeader::Organization() const
|
||||
Handle(Interface_HArray1OfHAsciiString) HeaderSection_MakeHeader::Organization() const
|
||||
{
|
||||
return (fn.IsNull() ? nularr : fn->Organization());
|
||||
}
|
||||
|
||||
Handle(TCollection_HAsciiString) APIHeaderSection_MakeHeader::OrganizationValue(const Standard_Integer num) const
|
||||
Handle(TCollection_HAsciiString) HeaderSection_MakeHeader::OrganizationValue(const Standard_Integer num) const
|
||||
{
|
||||
return (fn.IsNull() ? nulstr : fn->OrganizationValue(num));
|
||||
}
|
||||
|
||||
Standard_Integer APIHeaderSection_MakeHeader::NbOrganization () const
|
||||
Standard_Integer HeaderSection_MakeHeader::NbOrganization () const
|
||||
{
|
||||
return (fn.IsNull() ? 0 : fn->NbOrganization());
|
||||
}
|
||||
|
||||
void APIHeaderSection_MakeHeader::SetPreprocessorVersion(const Handle(TCollection_HAsciiString)& aPreprocessorVersion)
|
||||
void HeaderSection_MakeHeader::SetPreprocessorVersion(const Handle(TCollection_HAsciiString)& aPreprocessorVersion)
|
||||
{
|
||||
if (!fn.IsNull()) fn->SetPreprocessorVersion(aPreprocessorVersion);
|
||||
}
|
||||
|
||||
Handle(TCollection_HAsciiString) APIHeaderSection_MakeHeader::PreprocessorVersion() const
|
||||
Handle(TCollection_HAsciiString) HeaderSection_MakeHeader::PreprocessorVersion() const
|
||||
{
|
||||
return (fn.IsNull() ? nulstr : fn->PreprocessorVersion());
|
||||
}
|
||||
|
||||
void APIHeaderSection_MakeHeader::SetOriginatingSystem(const Handle(TCollection_HAsciiString)& aOriginatingSystem)
|
||||
void HeaderSection_MakeHeader::SetOriginatingSystem(const Handle(TCollection_HAsciiString)& aOriginatingSystem)
|
||||
{
|
||||
if (!fn.IsNull()) fn->SetOriginatingSystem(aOriginatingSystem);
|
||||
}
|
||||
|
||||
Handle(TCollection_HAsciiString) APIHeaderSection_MakeHeader::OriginatingSystem() const
|
||||
Handle(TCollection_HAsciiString) HeaderSection_MakeHeader::OriginatingSystem() const
|
||||
{
|
||||
return (fn.IsNull() ? nulstr : fn->OriginatingSystem());
|
||||
}
|
||||
|
||||
void APIHeaderSection_MakeHeader::SetAuthorisation(const Handle(TCollection_HAsciiString)& aAuthorisation)
|
||||
void HeaderSection_MakeHeader::SetAuthorisation(const Handle(TCollection_HAsciiString)& aAuthorisation)
|
||||
{
|
||||
if (!fn.IsNull()) fn->SetAuthorisation(aAuthorisation);
|
||||
}
|
||||
|
||||
Handle(TCollection_HAsciiString) APIHeaderSection_MakeHeader::Authorisation() const
|
||||
Handle(TCollection_HAsciiString) HeaderSection_MakeHeader::Authorisation() const
|
||||
{
|
||||
return (fn.IsNull() ? nulstr : fn->Authorisation());
|
||||
}
|
||||
@@ -338,37 +338,37 @@ Handle(TCollection_HAsciiString) APIHeaderSection_MakeHeader::Authorisation() co
|
||||
// File Schema
|
||||
// ===========
|
||||
|
||||
Standard_Boolean APIHeaderSection_MakeHeader::HasFs() const
|
||||
Standard_Boolean HeaderSection_MakeHeader::HasFs() const
|
||||
{ return (!fs.IsNull()); }
|
||||
|
||||
Handle(HeaderSection_FileSchema) APIHeaderSection_MakeHeader::FsValue() const
|
||||
Handle(HeaderSection_FileSchema) HeaderSection_MakeHeader::FsValue() const
|
||||
{
|
||||
return fs;
|
||||
}
|
||||
|
||||
void APIHeaderSection_MakeHeader::SetSchemaIdentifiers(const Handle(Interface_HArray1OfHAsciiString)& aSchemaIdentifiers)
|
||||
void HeaderSection_MakeHeader::SetSchemaIdentifiers(const Handle(Interface_HArray1OfHAsciiString)& aSchemaIdentifiers)
|
||||
{
|
||||
if (!fs.IsNull()) fs->SetSchemaIdentifiers(aSchemaIdentifiers);
|
||||
}
|
||||
|
||||
void APIHeaderSection_MakeHeader::SetSchemaIdentifiersValue(const Standard_Integer num, const Handle(TCollection_HAsciiString)& aSchem)
|
||||
void HeaderSection_MakeHeader::SetSchemaIdentifiersValue(const Standard_Integer num, const Handle(TCollection_HAsciiString)& aSchem)
|
||||
{
|
||||
if (fs.IsNull()) return;
|
||||
Handle(Interface_HArray1OfHAsciiString) li = fs->SchemaIdentifiers();
|
||||
if (num >= li->Lower() && num <= li->Upper()) li->SetValue(num,aSchem);
|
||||
}
|
||||
|
||||
Handle(Interface_HArray1OfHAsciiString) APIHeaderSection_MakeHeader::SchemaIdentifiers() const
|
||||
Handle(Interface_HArray1OfHAsciiString) HeaderSection_MakeHeader::SchemaIdentifiers() const
|
||||
{
|
||||
return (fs.IsNull() ? nularr : fs->SchemaIdentifiers());
|
||||
}
|
||||
|
||||
Handle(TCollection_HAsciiString) APIHeaderSection_MakeHeader::SchemaIdentifiersValue(const Standard_Integer num) const
|
||||
Handle(TCollection_HAsciiString) HeaderSection_MakeHeader::SchemaIdentifiersValue(const Standard_Integer num) const
|
||||
{
|
||||
return (fs.IsNull() ? nulstr : fs->SchemaIdentifiersValue(num));
|
||||
}
|
||||
|
||||
Standard_Integer APIHeaderSection_MakeHeader::NbSchemaIdentifiers () const
|
||||
Standard_Integer HeaderSection_MakeHeader::NbSchemaIdentifiers () const
|
||||
{
|
||||
return (fs.IsNull() ? 0 : fs->NbSchemaIdentifiers());
|
||||
}
|
||||
@@ -378,7 +378,7 @@ Standard_Integer APIHeaderSection_MakeHeader::NbSchemaIdentifiers () const
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void APIHeaderSection_MakeHeader::AddSchemaIdentifier(const Handle(TCollection_HAsciiString)& aSchem)
|
||||
void HeaderSection_MakeHeader::AddSchemaIdentifier(const Handle(TCollection_HAsciiString)& aSchem)
|
||||
{
|
||||
if ( fs.IsNull() ) fs = new HeaderSection_FileSchema;
|
||||
Handle(Interface_HArray1OfHAsciiString) idents = fs->SchemaIdentifiers();
|
||||
@@ -404,47 +404,47 @@ void APIHeaderSection_MakeHeader::AddSchemaIdentifier(const Handle(TCollection_H
|
||||
// File Description
|
||||
// ================
|
||||
|
||||
Standard_Boolean APIHeaderSection_MakeHeader::HasFd() const
|
||||
Standard_Boolean HeaderSection_MakeHeader::HasFd() const
|
||||
{ return (!fd.IsNull()); }
|
||||
|
||||
Handle(HeaderSection_FileDescription) APIHeaderSection_MakeHeader::FdValue() const
|
||||
Handle(HeaderSection_FileDescription) HeaderSection_MakeHeader::FdValue() const
|
||||
{
|
||||
return fd;
|
||||
}
|
||||
|
||||
void APIHeaderSection_MakeHeader::SetDescription(const Handle(Interface_HArray1OfHAsciiString)& aDescription)
|
||||
void HeaderSection_MakeHeader::SetDescription(const Handle(Interface_HArray1OfHAsciiString)& aDescription)
|
||||
{
|
||||
if (!fs.IsNull()) fd->SetDescription(aDescription);
|
||||
}
|
||||
|
||||
void APIHeaderSection_MakeHeader::SetDescriptionValue(const Standard_Integer num, const Handle(TCollection_HAsciiString)& aDescr)
|
||||
void HeaderSection_MakeHeader::SetDescriptionValue(const Standard_Integer num, const Handle(TCollection_HAsciiString)& aDescr)
|
||||
{
|
||||
if (fd.IsNull()) return;
|
||||
Handle(Interface_HArray1OfHAsciiString) li = fd->Description();
|
||||
if (num >= li->Lower() && num <= li->Upper()) li->SetValue(num,aDescr);
|
||||
}
|
||||
|
||||
Handle(Interface_HArray1OfHAsciiString) APIHeaderSection_MakeHeader::Description() const
|
||||
Handle(Interface_HArray1OfHAsciiString) HeaderSection_MakeHeader::Description() const
|
||||
{
|
||||
return (fd.IsNull() ? nularr : fd->Description());
|
||||
}
|
||||
|
||||
Handle(TCollection_HAsciiString) APIHeaderSection_MakeHeader::DescriptionValue(const Standard_Integer num) const
|
||||
Handle(TCollection_HAsciiString) HeaderSection_MakeHeader::DescriptionValue(const Standard_Integer num) const
|
||||
{
|
||||
return (fd.IsNull() ? nulstr : fd->DescriptionValue(num));
|
||||
}
|
||||
|
||||
Standard_Integer APIHeaderSection_MakeHeader::NbDescription () const
|
||||
Standard_Integer HeaderSection_MakeHeader::NbDescription () const
|
||||
{
|
||||
return (fd.IsNull() ? 0 : fd->NbDescription());
|
||||
}
|
||||
|
||||
void APIHeaderSection_MakeHeader::SetImplementationLevel(const Handle(TCollection_HAsciiString)& aImplementationLevel)
|
||||
void HeaderSection_MakeHeader::SetImplementationLevel(const Handle(TCollection_HAsciiString)& aImplementationLevel)
|
||||
{
|
||||
if (!fd.IsNull()) fd->SetImplementationLevel(aImplementationLevel);
|
||||
}
|
||||
|
||||
Handle(TCollection_HAsciiString) APIHeaderSection_MakeHeader::ImplementationLevel() const
|
||||
Handle(TCollection_HAsciiString) HeaderSection_MakeHeader::ImplementationLevel() const
|
||||
{
|
||||
return (fd.IsNull() ? nulstr : fd->ImplementationLevel());
|
||||
}
|
@@ -14,8 +14,8 @@
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#ifndef _APIHeaderSection_MakeHeader_HeaderFile
|
||||
#define _APIHeaderSection_MakeHeader_HeaderFile
|
||||
#ifndef _HeaderSection_MakeHeader_HeaderFile
|
||||
#define _HeaderSection_MakeHeader_HeaderFile
|
||||
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_DefineAlloc.hxx>
|
||||
@@ -34,7 +34,7 @@ class TCollection_HAsciiString;
|
||||
|
||||
//! This class allows to consult and prepare/edit data stored in
|
||||
//! a Step Model Header
|
||||
class APIHeaderSection_MakeHeader
|
||||
class HeaderSection_MakeHeader
|
||||
{
|
||||
public:
|
||||
|
||||
@@ -42,11 +42,11 @@ public:
|
||||
|
||||
|
||||
//! Prepares a new MakeHeader from scratch
|
||||
Standard_EXPORT APIHeaderSection_MakeHeader(const Standard_Integer shapetype = 0);
|
||||
Standard_EXPORT HeaderSection_MakeHeader(const Standard_Integer shapetype = 0);
|
||||
|
||||
//! Prepares a MakeHeader from the content of a StepModel
|
||||
//! See IsDone to know if the Header is well defined
|
||||
Standard_EXPORT APIHeaderSection_MakeHeader(const Handle(StepData_StepModel)& model);
|
||||
Standard_EXPORT HeaderSection_MakeHeader(const Handle(StepData_StepModel)& model);
|
||||
|
||||
//! Cancels the former definition and gives a FileName
|
||||
//! To be used when a Model has no well defined Header
|
||||
@@ -199,4 +199,4 @@ private:
|
||||
|
||||
|
||||
|
||||
#endif // _APIHeaderSection_MakeHeader_HeaderFile
|
||||
#endif // _HeaderSection_MakeHeader_HeaderFile
|
@@ -1,22 +0,0 @@
|
||||
IFGraph_AllConnected.cxx
|
||||
IFGraph_AllConnected.hxx
|
||||
IFGraph_AllShared.cxx
|
||||
IFGraph_AllShared.hxx
|
||||
IFGraph_Articulations.cxx
|
||||
IFGraph_Articulations.hxx
|
||||
IFGraph_Compare.cxx
|
||||
IFGraph_Compare.hxx
|
||||
IFGraph_ConnectedComponants.cxx
|
||||
IFGraph_ConnectedComponants.hxx
|
||||
IFGraph_Cumulate.cxx
|
||||
IFGraph_Cumulate.hxx
|
||||
IFGraph_Cycles.cxx
|
||||
IFGraph_Cycles.hxx
|
||||
IFGraph_ExternalSources.cxx
|
||||
IFGraph_ExternalSources.hxx
|
||||
IFGraph_SCRoots.cxx
|
||||
IFGraph_SCRoots.hxx
|
||||
IFGraph_StrongComponants.cxx
|
||||
IFGraph_StrongComponants.hxx
|
||||
IFGraph_SubPartsIterator.cxx
|
||||
IFGraph_SubPartsIterator.hxx
|
@@ -1,52 +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 <IFGraph_AllConnected.hxx>
|
||||
#include <Interface_Graph.hxx>
|
||||
#include <Standard_Transient.hxx>
|
||||
|
||||
// AllConnected prend toutes les Entites connectees a une Entite donnee
|
||||
// c-a-d toutes les "Shared" + toutes les "Sharings" et on recommence
|
||||
// Autrement dit le contenu du "Composant Connexe" du graphe d'ensemble
|
||||
// qui contient cette entite
|
||||
// Le calcul est effectue par GetFromEntity (Evaluate n'a rien a faire)
|
||||
IFGraph_AllConnected::IFGraph_AllConnected (const Interface_Graph& agraph)
|
||||
: thegraph (agraph) { }
|
||||
|
||||
|
||||
IFGraph_AllConnected::IFGraph_AllConnected
|
||||
(const Interface_Graph& agraph, const Handle(Standard_Transient)& ent)
|
||||
: thegraph (agraph)
|
||||
{ GetFromEntity(ent); }
|
||||
|
||||
void IFGraph_AllConnected::GetFromEntity
|
||||
(const Handle(Standard_Transient)& ent)
|
||||
{
|
||||
if (!thegraph.IsPresent(thegraph.EntityNumber(ent))) return;
|
||||
thegraph.GetFromEntity(ent,Standard_False);
|
||||
|
||||
for (Interface_EntityIterator shareds = thegraph.Shareds(ent);
|
||||
shareds.More(); shareds.Next())
|
||||
GetFromEntity(shareds.Value());
|
||||
|
||||
for (Interface_EntityIterator sharings = thegraph.Sharings(ent);
|
||||
sharings.More(); sharings.Next())
|
||||
GetFromEntity(sharings.Value());
|
||||
}
|
||||
|
||||
void IFGraph_AllConnected::ResetData ()
|
||||
{ Reset(); thegraph.Reset(); }
|
||||
|
||||
void IFGraph_AllConnected::Evaluate()
|
||||
{ GetFromGraph(thegraph); } // GetFromEntity a tout fait
|
@@ -1,85 +0,0 @@
|
||||
// Created on: 1992-10-02
|
||||
// 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 _IFGraph_AllConnected_HeaderFile
|
||||
#define _IFGraph_AllConnected_HeaderFile
|
||||
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_DefineAlloc.hxx>
|
||||
#include <Standard_Handle.hxx>
|
||||
|
||||
#include <Interface_Graph.hxx>
|
||||
#include <Interface_GraphContent.hxx>
|
||||
class Standard_Transient;
|
||||
|
||||
|
||||
//! this class gives content of the CONNECTED COMPONENT(S)
|
||||
//! which include specific Entity(ies)
|
||||
class IFGraph_AllConnected : public Interface_GraphContent
|
||||
{
|
||||
public:
|
||||
|
||||
DEFINE_STANDARD_ALLOC
|
||||
|
||||
|
||||
//! creates an AllConnected from a graph, empty ready to be filled
|
||||
Standard_EXPORT IFGraph_AllConnected(const Interface_Graph& agraph);
|
||||
|
||||
//! creates an AllConnected which memorizes Entities Connected to
|
||||
//! a given one, at any level : that is, itself, all Entities
|
||||
//! Shared by it and Sharing it, and so on.
|
||||
//! In other terms, this is the content of the CONNECTED COMPONENT
|
||||
//! which include a specific Entity
|
||||
Standard_EXPORT IFGraph_AllConnected(const Interface_Graph& agraph, const Handle(Standard_Transient)& ent);
|
||||
|
||||
//! adds an entity and its Connected ones to the list (allows to
|
||||
//! cumulate all Entities Connected by some ones)
|
||||
//! Note that if "ent" is in the already computed list,, no entity
|
||||
//! will be added, but if "ent" is not already in the list, a new
|
||||
//! Connected Component will be cumulated
|
||||
Standard_EXPORT void GetFromEntity (const Handle(Standard_Transient)& ent);
|
||||
|
||||
//! Allows to restart on a new data set
|
||||
Standard_EXPORT void ResetData();
|
||||
|
||||
//! does the specific evaluation (Connected entities atall levels)
|
||||
Standard_EXPORT virtual void Evaluate() Standard_OVERRIDE;
|
||||
|
||||
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
||||
|
||||
Interface_Graph thegraph;
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // _IFGraph_AllConnected_HeaderFile
|
@@ -1,47 +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 <IFGraph_AllShared.hxx>
|
||||
#include <Interface_EntityIterator.hxx>
|
||||
#include <Interface_Graph.hxx>
|
||||
#include <Interface_InterfaceModel.hxx>
|
||||
#include <Standard_Transient.hxx>
|
||||
|
||||
IFGraph_AllShared::IFGraph_AllShared (const Interface_Graph& agraph)
|
||||
: thegraph (agraph) { }
|
||||
|
||||
|
||||
IFGraph_AllShared::IFGraph_AllShared
|
||||
(const Interface_Graph& agraph, const Handle(Standard_Transient)& ent)
|
||||
: thegraph (agraph)
|
||||
{
|
||||
if (!agraph.Model()->Contains(ent)) return;
|
||||
GetFromEntity(ent);
|
||||
}
|
||||
|
||||
void IFGraph_AllShared::GetFromEntity
|
||||
(const Handle(Standard_Transient)& ent)
|
||||
{ thegraph.GetFromEntity(ent,Standard_True); } // le fait pour nous
|
||||
|
||||
void IFGraph_AllShared::GetFromIter (const Interface_EntityIterator& iter)
|
||||
{
|
||||
for (iter.Start(); iter.More(); iter.Next())
|
||||
thegraph.GetFromEntity(iter.Value(),Standard_True);
|
||||
}
|
||||
|
||||
void IFGraph_AllShared::ResetData ()
|
||||
{ Reset(); thegraph.Reset(); }
|
||||
|
||||
void IFGraph_AllShared::Evaluate()
|
||||
{ Reset(); GetFromGraph(thegraph); }
|
@@ -1,85 +0,0 @@
|
||||
// Created on: 1992-09-30
|
||||
// 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 _IFGraph_AllShared_HeaderFile
|
||||
#define _IFGraph_AllShared_HeaderFile
|
||||
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_DefineAlloc.hxx>
|
||||
#include <Standard_Handle.hxx>
|
||||
|
||||
#include <Interface_Graph.hxx>
|
||||
#include <Interface_GraphContent.hxx>
|
||||
class Standard_Transient;
|
||||
class Interface_EntityIterator;
|
||||
|
||||
|
||||
//! this class determines all Entities shared by some specific
|
||||
//! ones, at any level (those which will be lead in a Transfer
|
||||
//! for instance)
|
||||
class IFGraph_AllShared : public Interface_GraphContent
|
||||
{
|
||||
public:
|
||||
|
||||
DEFINE_STANDARD_ALLOC
|
||||
|
||||
|
||||
//! creates an AllShared from a graph, empty ready to be filled
|
||||
Standard_EXPORT IFGraph_AllShared(const Interface_Graph& agraph);
|
||||
|
||||
//! creates an AllShared which memrizes Entities shared by a given
|
||||
//! one, at any level, including itself
|
||||
Standard_EXPORT IFGraph_AllShared(const Interface_Graph& agraph, const Handle(Standard_Transient)& ent);
|
||||
|
||||
//! adds an entity and its shared ones to the list (allows to
|
||||
//! cumulate all Entities shared by some ones)
|
||||
Standard_EXPORT void GetFromEntity (const Handle(Standard_Transient)& ent);
|
||||
|
||||
//! Adds Entities from an EntityIterator and all their shared
|
||||
//! ones at any level
|
||||
Standard_EXPORT void GetFromIter (const Interface_EntityIterator& iter);
|
||||
|
||||
//! Allows to restart on a new data set
|
||||
Standard_EXPORT void ResetData();
|
||||
|
||||
//! does the specific evaluation (shared entities atall levels)
|
||||
Standard_EXPORT virtual void Evaluate() Standard_OVERRIDE;
|
||||
|
||||
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
||||
|
||||
Interface_Graph thegraph;
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // _IFGraph_AllShared_HeaderFile
|
@@ -1,82 +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 <IFGraph_Articulations.hxx>
|
||||
#include <Interface_EntityIterator.hxx>
|
||||
#include <Interface_Graph.hxx>
|
||||
#include <Interface_InterfaceModel.hxx>
|
||||
#include <Standard_Transient.hxx>
|
||||
|
||||
// Points d'Articulation d'un Graphe : ce sont les "passages obliges" du graphe
|
||||
// Algorithme tire du Sedgewick, p 392
|
||||
IFGraph_Articulations::IFGraph_Articulations
|
||||
(const Interface_Graph& agraph, const Standard_Boolean whole)
|
||||
: thegraph (agraph)
|
||||
{ if (whole) thegraph.GetFromModel(); }
|
||||
|
||||
|
||||
void IFGraph_Articulations::GetFromEntity
|
||||
(const Handle(Standard_Transient)& ent)
|
||||
{ thegraph.GetFromEntity(ent,Standard_True); }
|
||||
|
||||
void IFGraph_Articulations::GetFromIter(const Interface_EntityIterator& iter)
|
||||
{ thegraph.GetFromIter(iter,0); }
|
||||
|
||||
|
||||
void IFGraph_Articulations::ResetData ()
|
||||
{ Reset(); thegraph.Reset(); thelist = new TColStd_HSequenceOfInteger(); }
|
||||
|
||||
void IFGraph_Articulations::Evaluate ()
|
||||
{
|
||||
// Algorithme, cf Sedgewick "Algorithms", p 392
|
||||
thelist = new TColStd_HSequenceOfInteger();
|
||||
// Utilisation de Visit
|
||||
Standard_Integer nb = thegraph.Size();
|
||||
for (Standard_Integer i = 1; i <= nb; i ++) {
|
||||
thenow = 0;
|
||||
if (thegraph.IsPresent(i)) Visit(i);
|
||||
}
|
||||
// Resultat dans thelist
|
||||
Reset();
|
||||
Standard_Integer nbres = thelist->Length();
|
||||
for (Standard_Integer ires = 1; ires <= nbres; ires ++) {
|
||||
Standard_Integer num = thelist->Value(ires);
|
||||
GetOneItem(thegraph.Model()->Value(num));
|
||||
}
|
||||
}
|
||||
|
||||
Standard_Integer IFGraph_Articulations::Visit (const Standard_Integer num)
|
||||
{
|
||||
thenow ++;
|
||||
thegraph.SetStatus(num,thenow);
|
||||
Standard_Integer min = thenow;
|
||||
|
||||
for (Interface_EntityIterator iter = thegraph.Shareds(thegraph.Entity(num));
|
||||
iter.More(); iter.Next()) {
|
||||
Handle(Standard_Transient) ent = iter.Value();
|
||||
Standard_Integer nument = thegraph.EntityNumber(ent);
|
||||
if (!thegraph.IsPresent(num)) {
|
||||
thegraph.GetFromEntity(ent,Standard_False);
|
||||
nument = thegraph.EntityNumber(ent);
|
||||
}
|
||||
Standard_Integer statent = thegraph.Status(nument); // pas reevalue
|
||||
if (statent == 0) {
|
||||
Standard_Integer mm = Visit(nument);
|
||||
if (mm < min) min = mm;
|
||||
if (mm > thegraph.Status(num)) thelist->Append(num); // ON EN A UN : num
|
||||
}
|
||||
else if (statent < min) min = statent;
|
||||
}
|
||||
return min;
|
||||
}
|
@@ -1,75 +0,0 @@
|
||||
// Created on: 1992-09-23
|
||||
// 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 _IFGraph_Articulations_HeaderFile
|
||||
#define _IFGraph_Articulations_HeaderFile
|
||||
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_DefineAlloc.hxx>
|
||||
#include <Standard_Handle.hxx>
|
||||
|
||||
#include <Interface_Graph.hxx>
|
||||
#include <Standard_Integer.hxx>
|
||||
#include <TColStd_HSequenceOfInteger.hxx>
|
||||
#include <Interface_GraphContent.hxx>
|
||||
#include <Standard_Boolean.hxx>
|
||||
class Standard_Transient;
|
||||
class Interface_EntityIterator;
|
||||
|
||||
//! this class gives entities which are Articulation points
|
||||
//! in a whole Model or in a sub-part
|
||||
//! An Articulation Point divides the graph in two (or more)
|
||||
//! disconnected sub-graphs
|
||||
//! Identifying Articulation Points allows improving
|
||||
//! efficiency of splitting a set of Entities into sub-sets
|
||||
class IFGraph_Articulations : public Interface_GraphContent
|
||||
{
|
||||
public:
|
||||
|
||||
DEFINE_STANDARD_ALLOC
|
||||
|
||||
//! creates Articulations to evaluate a Graph
|
||||
//! whole True : works on the whole Model
|
||||
//! whole False : remains empty, ready to work on a sub-part
|
||||
Standard_EXPORT IFGraph_Articulations(const Interface_Graph& agraph, const Standard_Boolean whole);
|
||||
|
||||
//! adds an entity and its shared ones to the list
|
||||
Standard_EXPORT void GetFromEntity (const Handle(Standard_Transient)& ent);
|
||||
|
||||
//! adds a list of entities (as an iterator)
|
||||
Standard_EXPORT void GetFromIter (const Interface_EntityIterator& iter);
|
||||
|
||||
//! Allows to restart on a new data set
|
||||
Standard_EXPORT void ResetData();
|
||||
|
||||
//! Evaluates the list of Articulation points
|
||||
Standard_EXPORT virtual void Evaluate() Standard_OVERRIDE;
|
||||
|
||||
private:
|
||||
|
||||
//! basic routine of computation
|
||||
//! (see book Sedgewick "Algorithms", p 392)
|
||||
Standard_EXPORT Standard_Integer Visit (const Standard_Integer num);
|
||||
|
||||
private:
|
||||
|
||||
Interface_Graph thegraph;
|
||||
Standard_Integer thenow;
|
||||
Handle(TColStd_HSequenceOfInteger) thelist;
|
||||
|
||||
};
|
||||
|
||||
#endif // _IFGraph_Articulations_HeaderFile
|
@@ -1,78 +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 <IFGraph_AllShared.hxx>
|
||||
#include <IFGraph_Compare.hxx>
|
||||
#include <Interface_EntityIterator.hxx>
|
||||
#include <Interface_Graph.hxx>
|
||||
#include <Standard_Transient.hxx>
|
||||
|
||||
// Comparateur de deux sous-ensembles d un Modele
|
||||
// Au premier sous-ensemble, est attribue le Status 1
|
||||
// Au deuxieme sous-ensemble, est attribue le Status 2
|
||||
// La partie commune se voit attribuer le Status 3
|
||||
IFGraph_Compare::IFGraph_Compare (const Interface_Graph& agraph)
|
||||
: thegraph (agraph) { }
|
||||
|
||||
void IFGraph_Compare::GetFromEntity
|
||||
(const Handle(Standard_Transient)& ent, const Standard_Boolean first)
|
||||
{
|
||||
IFGraph_AllShared iter(thegraph.Model(),ent);
|
||||
GetFromIter(iter,first);
|
||||
}
|
||||
|
||||
void IFGraph_Compare::GetFromIter
|
||||
(const Interface_EntityIterator& iter, const Standard_Boolean first)
|
||||
{
|
||||
Standard_Integer stat = 2;
|
||||
if (first) stat = 1;
|
||||
thegraph.GetFromIter(iter,stat,3,Standard_False);
|
||||
}
|
||||
|
||||
|
||||
void IFGraph_Compare::Merge ()
|
||||
{
|
||||
thegraph.ChangeStatus (2,1);
|
||||
thegraph.ChangeStatus (3,1);
|
||||
}
|
||||
|
||||
void IFGraph_Compare::RemoveSecond ()
|
||||
{
|
||||
thegraph.ChangeStatus (3,1);
|
||||
thegraph.RemoveStatus (2);
|
||||
}
|
||||
|
||||
void IFGraph_Compare::KeepCommon ()
|
||||
{
|
||||
thegraph.RemoveStatus (1);
|
||||
thegraph.RemoveStatus (2);
|
||||
thegraph.ChangeStatus (3,1);
|
||||
}
|
||||
|
||||
void IFGraph_Compare::ResetData ()
|
||||
{ Reset(); thegraph.Reset(); }
|
||||
|
||||
void IFGraph_Compare::Evaluate ()
|
||||
{
|
||||
Reset(); GetFromGraph(thegraph); // Evaluation deja faite par le graphe
|
||||
}
|
||||
|
||||
Interface_EntityIterator IFGraph_Compare::Common () const
|
||||
{ return Interface_GraphContent(thegraph,3); }
|
||||
|
||||
Interface_EntityIterator IFGraph_Compare::FirstOnly () const
|
||||
{ return Interface_GraphContent(thegraph,1); }
|
||||
|
||||
Interface_EntityIterator IFGraph_Compare::SecondOnly () const
|
||||
{ return Interface_GraphContent(thegraph,2); }
|
@@ -1,105 +0,0 @@
|
||||
// Created on: 1992-09-23
|
||||
// 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 _IFGraph_Compare_HeaderFile
|
||||
#define _IFGraph_Compare_HeaderFile
|
||||
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_DefineAlloc.hxx>
|
||||
#include <Standard_Handle.hxx>
|
||||
|
||||
#include <Interface_Graph.hxx>
|
||||
#include <Interface_GraphContent.hxx>
|
||||
class Standard_Transient;
|
||||
class Interface_EntityIterator;
|
||||
|
||||
|
||||
//! this class evaluates effect of two compared sub-parts :
|
||||
//! cumulation (union), common part (intersection-overlapping)
|
||||
//! part specific to first sub-part or to the second one
|
||||
//! Results are kept in a Graph, several question can be set
|
||||
//! Basic Iteration gives Cumulation (union)
|
||||
class IFGraph_Compare : public Interface_GraphContent
|
||||
{
|
||||
public:
|
||||
|
||||
DEFINE_STANDARD_ALLOC
|
||||
|
||||
|
||||
//! creates empty Compare, ready to work
|
||||
Standard_EXPORT IFGraph_Compare(const Interface_Graph& agraph);
|
||||
|
||||
//! adds an entity and its shared ones to the list :
|
||||
//! first True means adds to the first sub-list, else to the 2nd
|
||||
Standard_EXPORT void GetFromEntity (const Handle(Standard_Transient)& ent, const Standard_Boolean first);
|
||||
|
||||
//! adds a list of entities (as an iterator) as such, that is,
|
||||
//! their shared entities are not considered (use AllShared to
|
||||
//! have them)
|
||||
//! first True means adds to the first sub-list, else to the 2nd
|
||||
Standard_EXPORT void GetFromIter (const Interface_EntityIterator& iter, const Standard_Boolean first);
|
||||
|
||||
//! merges the second list into the first one, hence the second
|
||||
//! list is empty
|
||||
Standard_EXPORT void Merge();
|
||||
|
||||
//! Removes the contents of second list
|
||||
Standard_EXPORT void RemoveSecond();
|
||||
|
||||
//! Keeps only Common part, sets it as First list and clears
|
||||
//! second list
|
||||
Standard_EXPORT void KeepCommon();
|
||||
|
||||
//! Allows to restart on a new data set
|
||||
Standard_EXPORT void ResetData();
|
||||
|
||||
//! Recomputes result of comparing to sub-parts
|
||||
Standard_EXPORT virtual void Evaluate() Standard_OVERRIDE;
|
||||
|
||||
//! returns entities common to the both parts
|
||||
Standard_EXPORT Interface_EntityIterator Common() const;
|
||||
|
||||
//! returns entities which are exclusively in the first list
|
||||
Standard_EXPORT Interface_EntityIterator FirstOnly() const;
|
||||
|
||||
//! returns entities which are exclusively in the second part
|
||||
Standard_EXPORT Interface_EntityIterator SecondOnly() const;
|
||||
|
||||
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
||||
|
||||
Interface_Graph thegraph;
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // _IFGraph_Compare_HeaderFile
|
@@ -1,44 +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 <IFGraph_AllConnected.hxx>
|
||||
#include <IFGraph_ConnectedComponants.hxx>
|
||||
#include <Interface_Graph.hxx>
|
||||
#include <Standard_Transient.hxx>
|
||||
|
||||
// Pour travailler, ConnectedComponants exploite AllConnected :
|
||||
// On prend un 1er Vertex, on determine ses AllConnected -> voila un 1er
|
||||
// Connected Component
|
||||
// On recommence jusqu'a ce qu'il n'y ait plus de Vertex libre
|
||||
// Honnetement, si ca ne marche pas, cf classe ConnectedVerticesIterator
|
||||
// de GraphTools qui fait en principe la meme chose
|
||||
IFGraph_ConnectedComponants::IFGraph_ConnectedComponants
|
||||
(const Interface_Graph& agraph, const Standard_Boolean whole)
|
||||
: IFGraph_SubPartsIterator (agraph, whole) { }
|
||||
|
||||
void IFGraph_ConnectedComponants::Evaluate()
|
||||
{
|
||||
// On part des "loaded"
|
||||
// Pour chacun : s il est note dans le graphe, on passe
|
||||
// Sinon, on ajoute les AllConnected en tant que sub-part
|
||||
Interface_EntityIterator loaded = Loaded();
|
||||
Reset();
|
||||
for (loaded.Start(); loaded.More(); loaded.Next()) {
|
||||
Handle(Standard_Transient) ent = loaded.Value();
|
||||
if (IsInPart(ent)) continue;
|
||||
IFGraph_AllConnected connect(Model(),ent);
|
||||
AddPart();
|
||||
GetFromIter (connect);
|
||||
}
|
||||
}
|
@@ -1,44 +0,0 @@
|
||||
// Created on: 1992-09-23
|
||||
// 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 _IFGraph_ConnectedComponants_HeaderFile
|
||||
#define _IFGraph_ConnectedComponants_HeaderFile
|
||||
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_DefineAlloc.hxx>
|
||||
|
||||
#include <IFGraph_SubPartsIterator.hxx>
|
||||
class Interface_Graph;
|
||||
|
||||
//! determines Connected Components in a Graph.
|
||||
//! They define disjoined sets of Entities.
|
||||
class IFGraph_ConnectedComponants : public IFGraph_SubPartsIterator
|
||||
{
|
||||
public:
|
||||
|
||||
DEFINE_STANDARD_ALLOC
|
||||
|
||||
//! creates with a Graph, and will analyse :
|
||||
//! whole True : all the contents of the Model
|
||||
//! whole False : sub-parts which will be given later
|
||||
Standard_EXPORT IFGraph_ConnectedComponants(const Interface_Graph& agraph, const Standard_Boolean whole);
|
||||
|
||||
//! does the computation
|
||||
Standard_EXPORT virtual void Evaluate() Standard_OVERRIDE;
|
||||
|
||||
};
|
||||
|
||||
#endif // _IFGraph_ConnectedComponants_HeaderFile
|
@@ -1,107 +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 <IFGraph_AllShared.hxx>
|
||||
#include <IFGraph_Cumulate.hxx>
|
||||
#include <Interface_EntityIterator.hxx>
|
||||
#include <Interface_Graph.hxx>
|
||||
#include <Interface_InterfaceModel.hxx>
|
||||
#include <Standard_Transient.hxx>
|
||||
|
||||
// Calcul de cumul
|
||||
// Tres simple, on note les entites demandees, et a la fin
|
||||
// on a le cumul lui-meme, et comme infos derivees, les doubles et les oublis
|
||||
// Chaque recouvrement correspond a une augmentation de UN du status
|
||||
// Les status demarrent a 2, ainsi a l ajout d une entite, on distingue bien
|
||||
// entre les entites nouvelles, liees a cet appel (statut temporaire 1) et les
|
||||
// autres (statut superieur ou egal a 2)
|
||||
IFGraph_Cumulate::IFGraph_Cumulate (const Interface_Graph& agraph)
|
||||
: thegraph (agraph) { }
|
||||
|
||||
void IFGraph_Cumulate::GetFromEntity
|
||||
(const Handle(Standard_Transient)& ent)
|
||||
{
|
||||
IFGraph_AllShared iter(thegraph.Model(),ent);
|
||||
GetFromIter (iter);
|
||||
}
|
||||
|
||||
void IFGraph_Cumulate::ResetData ()
|
||||
{ Reset(); thegraph.Reset(); }
|
||||
|
||||
void IFGraph_Cumulate::GetFromIter (const Interface_EntityIterator& iter)
|
||||
{
|
||||
thegraph.GetFromIter(iter,1,1,Standard_True);
|
||||
thegraph.ChangeStatus (1,2); // une fois le calcul fait
|
||||
}
|
||||
|
||||
void IFGraph_Cumulate::Evaluate ()
|
||||
{
|
||||
Reset(); GetFromGraph(thegraph); // evaluation deja faite dans le graphe
|
||||
}
|
||||
|
||||
Interface_EntityIterator IFGraph_Cumulate::Overlapped () const
|
||||
{
|
||||
Interface_EntityIterator iter;
|
||||
Standard_Integer nb = thegraph.Size();
|
||||
for (Standard_Integer i = 1; i <= nb; i ++) {
|
||||
if (thegraph.IsPresent(i) && thegraph.Status(i) > 2)
|
||||
iter.GetOneItem(thegraph.Entity(i));
|
||||
}
|
||||
return iter;
|
||||
}
|
||||
|
||||
Interface_EntityIterator IFGraph_Cumulate::Forgotten () const
|
||||
{
|
||||
Interface_EntityIterator iter;
|
||||
Standard_Integer nb = thegraph.Size();
|
||||
for (Standard_Integer i = 1; i <= nb; i ++) {
|
||||
if (!thegraph.IsPresent(i))
|
||||
iter.GetOneItem(thegraph.Model()->Value(i));
|
||||
}
|
||||
return iter;
|
||||
}
|
||||
|
||||
Interface_EntityIterator IFGraph_Cumulate::PerCount
|
||||
(const Standard_Integer count) const
|
||||
{
|
||||
Interface_EntityIterator iter;
|
||||
Standard_Integer nb = thegraph.Size();
|
||||
for (Standard_Integer i = 1; i <= nb; i ++) {
|
||||
if (thegraph.IsPresent(i) && thegraph.Status(i) == (count + 1))
|
||||
iter.GetOneItem(thegraph.Model()->Value(i));
|
||||
}
|
||||
return iter;
|
||||
}
|
||||
|
||||
|
||||
Standard_Integer IFGraph_Cumulate::NbTimes
|
||||
(const Handle(Standard_Transient)& ent) const
|
||||
{
|
||||
Standard_Integer num = thegraph.EntityNumber(ent);
|
||||
if (num == 0) return 0;
|
||||
Standard_Integer stat = thegraph.Status(num);
|
||||
return stat-1;
|
||||
}
|
||||
|
||||
Standard_Integer IFGraph_Cumulate::HighestNbTimes () const
|
||||
{
|
||||
Standard_Integer max = 0;
|
||||
Standard_Integer nb = thegraph.Size();
|
||||
for (Standard_Integer i = 1; i <= nb; i ++) {
|
||||
if (!thegraph.IsPresent(i)) continue;
|
||||
Standard_Integer count = thegraph.Status(i) - 1;
|
||||
if (count > max) max = count;
|
||||
}
|
||||
return max;
|
||||
}
|
@@ -1,100 +0,0 @@
|
||||
// Created on: 1992-09-23
|
||||
// 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 _IFGraph_Cumulate_HeaderFile
|
||||
#define _IFGraph_Cumulate_HeaderFile
|
||||
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_DefineAlloc.hxx>
|
||||
#include <Standard_Handle.hxx>
|
||||
|
||||
#include <Interface_Graph.hxx>
|
||||
#include <Interface_GraphContent.hxx>
|
||||
#include <Standard_Integer.hxx>
|
||||
class Standard_Transient;
|
||||
class Interface_EntityIterator;
|
||||
|
||||
|
||||
//! this class evaluates effect of cumulated sub-parts :
|
||||
//! overlapping, forgotten entities
|
||||
//! Results are kept in a Graph, several question can be set
|
||||
//! Basic Iteration gives entities which are part of Cumulation
|
||||
class IFGraph_Cumulate : public Interface_GraphContent
|
||||
{
|
||||
public:
|
||||
|
||||
DEFINE_STANDARD_ALLOC
|
||||
|
||||
|
||||
//! creates empty Cumulate, ready to work
|
||||
Standard_EXPORT IFGraph_Cumulate(const Interface_Graph& agraph);
|
||||
|
||||
//! adds an entity and its shared ones to the list
|
||||
Standard_EXPORT void GetFromEntity (const Handle(Standard_Transient)& ent);
|
||||
|
||||
//! adds a list of entities (as an iterator) as such, that is,
|
||||
//! without their shared entities (use AllShared to have them)
|
||||
Standard_EXPORT void GetFromIter (const Interface_EntityIterator& iter);
|
||||
|
||||
//! Allows to restart on a new data set
|
||||
Standard_EXPORT void ResetData();
|
||||
|
||||
//! Evaluates the result of cumulation
|
||||
Standard_EXPORT virtual void Evaluate() Standard_OVERRIDE;
|
||||
|
||||
//! returns entities which are taken several times
|
||||
Standard_EXPORT Interface_EntityIterator Overlapped() const;
|
||||
|
||||
//! returns entities which are not taken
|
||||
Standard_EXPORT Interface_EntityIterator Forgotten() const;
|
||||
|
||||
//! Returns entities taken a given count of times
|
||||
//! (0 : same as Forgotten, 1 : same as no Overlap : default)
|
||||
Standard_EXPORT Interface_EntityIterator PerCount (const Standard_Integer count = 1) const;
|
||||
|
||||
//! returns number of times an Entity has been counted
|
||||
//! (0 means forgotten, more than 1 means overlap, 1 is normal)
|
||||
Standard_EXPORT Standard_Integer NbTimes (const Handle(Standard_Transient)& ent) const;
|
||||
|
||||
//! Returns the highest number of times recorded for every Entity
|
||||
//! (0 means empty, 1 means no overlap)
|
||||
Standard_EXPORT Standard_Integer HighestNbTimes() const;
|
||||
|
||||
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
||||
|
||||
Interface_Graph thegraph;
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // _IFGraph_Cumulate_HeaderFile
|
@@ -1,39 +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 <IFGraph_Cycles.hxx>
|
||||
#include <IFGraph_StrongComponants.hxx>
|
||||
#include <Interface_Graph.hxx>
|
||||
#include <Interface_GraphContent.hxx>
|
||||
|
||||
// Cycles utilise les services de StrongComponants :
|
||||
// Il retient les Strong Componants qui ne sont pas Single
|
||||
IFGraph_Cycles::IFGraph_Cycles
|
||||
(const Interface_Graph& agraph, const Standard_Boolean whole)
|
||||
: IFGraph_SubPartsIterator (agraph,whole) { }
|
||||
|
||||
IFGraph_Cycles::IFGraph_Cycles (IFGraph_StrongComponants& subparts)
|
||||
: IFGraph_SubPartsIterator (subparts) { }
|
||||
|
||||
|
||||
void IFGraph_Cycles::Evaluate ()
|
||||
{
|
||||
IFGraph_StrongComponants complist(Model(),Standard_False);
|
||||
complist.GetFromIter(Loaded());
|
||||
for (complist.Start(); complist.More(); complist.Next()) {
|
||||
if (complist.IsSingle()) continue;
|
||||
AddPart();
|
||||
GetFromIter(complist.Entities());
|
||||
}
|
||||
}
|
@@ -1,73 +0,0 @@
|
||||
// Created on: 1992-09-23
|
||||
// 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 _IFGraph_Cycles_HeaderFile
|
||||
#define _IFGraph_Cycles_HeaderFile
|
||||
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_DefineAlloc.hxx>
|
||||
#include <Standard_Handle.hxx>
|
||||
|
||||
#include <IFGraph_SubPartsIterator.hxx>
|
||||
#include <Standard_Boolean.hxx>
|
||||
class Interface_Graph;
|
||||
class IFGraph_StrongComponants;
|
||||
|
||||
|
||||
//! determines strong components in a graph which are Cycles
|
||||
class IFGraph_Cycles : public IFGraph_SubPartsIterator
|
||||
{
|
||||
public:
|
||||
|
||||
DEFINE_STANDARD_ALLOC
|
||||
|
||||
|
||||
//! creates with a Graph, and will analyse :
|
||||
//! whole True : all the contents of the Model
|
||||
//! whole False : sub-parts which will be given later
|
||||
Standard_EXPORT IFGraph_Cycles(const Interface_Graph& agraph, const Standard_Boolean whole);
|
||||
|
||||
//! creates from a StrongComponants which was already computed
|
||||
Standard_EXPORT IFGraph_Cycles(IFGraph_StrongComponants& subparts);
|
||||
|
||||
//! does the computation. Cycles are StrongComponants which are
|
||||
//! not Single
|
||||
Standard_EXPORT virtual void Evaluate() Standard_OVERRIDE;
|
||||
|
||||
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // _IFGraph_Cycles_HeaderFile
|
@@ -1,64 +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 <IFGraph_ExternalSources.hxx>
|
||||
#include <Interface_EntityIterator.hxx>
|
||||
#include <Interface_Graph.hxx>
|
||||
#include <Standard_Transient.hxx>
|
||||
|
||||
// ExternalSources exploite les resultats stockes dans le Graphe sur Sharings
|
||||
// Soit les "Sharings" des entites notees par GetFromEntity et GetFromIter
|
||||
// Celles des "Sharings" qui n etaient pas deja notees sont ExternalSources
|
||||
// Les status :
|
||||
// - Les entites de depart sont au Status 0
|
||||
// - Les entites Sharing NOUVELLES (ExternalSources) sont au Status 1
|
||||
IFGraph_ExternalSources::IFGraph_ExternalSources
|
||||
(const Interface_Graph& agraph)
|
||||
: thegraph (agraph) { }
|
||||
|
||||
|
||||
void IFGraph_ExternalSources::GetFromEntity
|
||||
(const Handle(Standard_Transient)& ent)
|
||||
{ thegraph.GetFromEntity(ent,Standard_True); }
|
||||
|
||||
void IFGraph_ExternalSources::GetFromIter
|
||||
(const Interface_EntityIterator& iter)
|
||||
{ thegraph.GetFromIter(iter,0); }
|
||||
|
||||
void IFGraph_ExternalSources::ResetData ()
|
||||
{ Reset(); thegraph.Reset(); }
|
||||
|
||||
|
||||
void IFGraph_ExternalSources::Evaluate ()
|
||||
{
|
||||
Reset();
|
||||
thegraph.RemoveStatus(1);
|
||||
Standard_Integer nb = thegraph.Size();
|
||||
for (Standard_Integer i = 1; i <= nb; i ++) {
|
||||
if (thegraph.IsPresent(i) && thegraph.Status(i) == 0)
|
||||
thegraph.GetFromIter ( thegraph.Sharings(thegraph.Entity(i)), 1 );
|
||||
}
|
||||
GetFromGraph(thegraph,1);
|
||||
}
|
||||
|
||||
Standard_Boolean IFGraph_ExternalSources::IsEmpty ()
|
||||
{
|
||||
Evaluate();
|
||||
Standard_Integer nb = thegraph.Size();
|
||||
for (Standard_Integer i = 1; i <= nb; i ++) {
|
||||
if (thegraph.IsPresent(i) || thegraph.Status(i) == 1)
|
||||
return Standard_False;
|
||||
}
|
||||
return Standard_True;
|
||||
}
|
@@ -1,84 +0,0 @@
|
||||
// Created on: 1992-09-23
|
||||
// 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 _IFGraph_ExternalSources_HeaderFile
|
||||
#define _IFGraph_ExternalSources_HeaderFile
|
||||
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_DefineAlloc.hxx>
|
||||
#include <Standard_Handle.hxx>
|
||||
|
||||
#include <Interface_Graph.hxx>
|
||||
#include <Interface_GraphContent.hxx>
|
||||
#include <Standard_Boolean.hxx>
|
||||
class Standard_Transient;
|
||||
class Interface_EntityIterator;
|
||||
|
||||
|
||||
//! this class gives entities which are Source of entities of
|
||||
//! a sub-part, but are not contained by this sub-part
|
||||
class IFGraph_ExternalSources : public Interface_GraphContent
|
||||
{
|
||||
public:
|
||||
|
||||
DEFINE_STANDARD_ALLOC
|
||||
|
||||
|
||||
//! creates empty ExternalSources, ready to work
|
||||
Standard_EXPORT IFGraph_ExternalSources(const Interface_Graph& agraph);
|
||||
|
||||
//! adds an entity and its shared ones to the list
|
||||
Standard_EXPORT void GetFromEntity (const Handle(Standard_Transient)& ent);
|
||||
|
||||
//! adds a list of entities (as an iterator) with shared ones
|
||||
Standard_EXPORT void GetFromIter (const Interface_EntityIterator& iter);
|
||||
|
||||
//! Allows to restart on a new data set
|
||||
Standard_EXPORT void ResetData();
|
||||
|
||||
//! Evaluates external sources of a set of entities
|
||||
Standard_EXPORT virtual void Evaluate() Standard_OVERRIDE;
|
||||
|
||||
//! Returns True if no External Source are found
|
||||
//! It means that we have a "root" set
|
||||
//! (performs an Evaluation as necessary)
|
||||
Standard_EXPORT Standard_Boolean IsEmpty();
|
||||
|
||||
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
||||
|
||||
Interface_Graph thegraph;
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // _IFGraph_ExternalSources_HeaderFile
|
@@ -1,69 +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 <IFGraph_ExternalSources.hxx>
|
||||
#include <IFGraph_SCRoots.hxx>
|
||||
#include <IFGraph_StrongComponants.hxx>
|
||||
#include <Interface_Graph.hxx>
|
||||
#include <Standard_Transient.hxx>
|
||||
|
||||
//#include <Interface_GraphContent.hxx>
|
||||
IFGraph_SCRoots::IFGraph_SCRoots
|
||||
(const Interface_Graph& agraph, const Standard_Boolean whole)
|
||||
: IFGraph_StrongComponants (agraph,whole) { }
|
||||
|
||||
IFGraph_SCRoots::IFGraph_SCRoots (IFGraph_StrongComponants& subparts)
|
||||
: IFGraph_StrongComponants (subparts) { }
|
||||
|
||||
// StrongComponants racines d un ensemble donne
|
||||
// On ne tient pas compte du reste eventuel (c est un autre probleme)
|
||||
// On part du fait que StrongComponants donne les Composants dans l ordre de
|
||||
// dependance, le premier ne dependant de rien (les autres, on ne sait pas ...)
|
||||
|
||||
void IFGraph_SCRoots::Evaluate ()
|
||||
{
|
||||
IFGraph_StrongComponants complist (Model(),Standard_False);
|
||||
complist.GetFromIter(Loaded());
|
||||
// Interface_Graph G(Model());
|
||||
Interface_Graph G(thegraph);
|
||||
#ifdef OCCT_DEBUG
|
||||
std::cout<<" SCRoots:"<<std::endl;
|
||||
#endif
|
||||
G.ResetStatus();
|
||||
for (complist.Start(); complist.More(); complist.Next()) {
|
||||
Handle(Standard_Transient) ent = complist.FirstEntity();
|
||||
Standard_Integer num = G.EntityNumber(ent);
|
||||
#ifdef OCCT_DEBUG
|
||||
std::cout<<" Iteration,num="<<num<<(G.IsPresent(num) ? " Pris" : " A prendre")<<std::endl;
|
||||
#endif
|
||||
if (!G.IsPresent(num)) { // enregistrer pour suivants
|
||||
G.GetFromEntity(ent,Standard_True);
|
||||
Interface_EntityIterator list = complist.Entities();
|
||||
AddPart();
|
||||
GetFromIter(list);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* ce qui suit, c etait autre chose : les SC qui n ont pas d ExternalSource
|
||||
Interface_EntityIterator list = complist.Entities();
|
||||
IFGraph_ExternalSources eval (Model());
|
||||
eval.GetFromIter(list);
|
||||
if (eval.IsEmpty()) {
|
||||
AddPart();
|
||||
GetFromIter(list);
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
@@ -1,69 +0,0 @@
|
||||
// Created on: 1992-09-23
|
||||
// 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 _IFGraph_SCRoots_HeaderFile
|
||||
#define _IFGraph_SCRoots_HeaderFile
|
||||
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_DefineAlloc.hxx>
|
||||
|
||||
#include <IFGraph_StrongComponants.hxx>
|
||||
class Interface_Graph;
|
||||
|
||||
|
||||
//! determines strong components in a graph which are Roots
|
||||
class IFGraph_SCRoots : public IFGraph_StrongComponants
|
||||
{
|
||||
public:
|
||||
|
||||
DEFINE_STANDARD_ALLOC
|
||||
|
||||
|
||||
//! creates with a Graph, and will analyse :
|
||||
//! whole True : all the contents of the Model
|
||||
//! whole False : sub-parts which will be given later
|
||||
Standard_EXPORT IFGraph_SCRoots(const Interface_Graph& agraph, const Standard_Boolean whole);
|
||||
|
||||
//! creates from a StrongComponants which was already computed
|
||||
Standard_EXPORT IFGraph_SCRoots(IFGraph_StrongComponants& subparts);
|
||||
|
||||
//! does the computation
|
||||
Standard_EXPORT virtual void Evaluate() Standard_OVERRIDE;
|
||||
|
||||
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // _IFGraph_SCRoots_HeaderFile
|
@@ -1,34 +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 <IFGraph_StrongComponants.hxx>
|
||||
#include <Interface_Graph.hxx>
|
||||
#include <Interface_GraphContent.hxx>
|
||||
|
||||
//#include <IFGraph_SortedStrongs.hxx>
|
||||
IFGraph_StrongComponants::IFGraph_StrongComponants
|
||||
(const Interface_Graph& agraph, const Standard_Boolean whole)
|
||||
: IFGraph_SubPartsIterator (agraph, whole) { }
|
||||
|
||||
void IFGraph_StrongComponants::Evaluate ()
|
||||
{
|
||||
Interface_GraphContent iter = Loaded();
|
||||
Interface_Graph G(thegraph); G.GetFromIter(iter,0);
|
||||
Standard_Integer nb = G.Size();
|
||||
for (Standard_Integer i = 1; i <= nb; i ++) {
|
||||
if (!G.IsPresent(i)) continue;
|
||||
AddPart();
|
||||
GetFromEntity (G.Entity(i),Standard_False);
|
||||
}
|
||||
}
|
@@ -1,69 +0,0 @@
|
||||
// Created on: 1992-09-23
|
||||
// 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 _IFGraph_StrongComponants_HeaderFile
|
||||
#define _IFGraph_StrongComponants_HeaderFile
|
||||
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_DefineAlloc.hxx>
|
||||
#include <Standard_Handle.hxx>
|
||||
|
||||
#include <IFGraph_SubPartsIterator.hxx>
|
||||
#include <Standard_Boolean.hxx>
|
||||
class Interface_Graph;
|
||||
|
||||
|
||||
//! determines strong components of a graph, that is
|
||||
//! isolated entities (single components) or loops
|
||||
class IFGraph_StrongComponants : public IFGraph_SubPartsIterator
|
||||
{
|
||||
public:
|
||||
|
||||
DEFINE_STANDARD_ALLOC
|
||||
|
||||
|
||||
//! creates with a Graph, and will analyse :
|
||||
//! whole True : all the contents of the Model
|
||||
//! whole False : sub-parts which will be given later
|
||||
Standard_EXPORT IFGraph_StrongComponants(const Interface_Graph& agraph, const Standard_Boolean whole);
|
||||
|
||||
//! does the computation
|
||||
Standard_EXPORT virtual void Evaluate() Standard_OVERRIDE;
|
||||
|
||||
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // _IFGraph_StrongComponants_HeaderFile
|
@@ -1,254 +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 <IFGraph_SubPartsIterator.hxx>
|
||||
#include <Interface_Graph.hxx>
|
||||
#include <Interface_GraphContent.hxx>
|
||||
#include <Interface_InterfaceError.hxx>
|
||||
#include <Interface_InterfaceModel.hxx>
|
||||
#include <Standard_NoSuchObject.hxx>
|
||||
#include <Standard_OutOfRange.hxx>
|
||||
#include <Standard_Transient.hxx>
|
||||
#include <TColStd_Array1OfInteger.hxx>
|
||||
|
||||
// SubPartsIterator permet de regrouper les entites en plusieurs sous-parties
|
||||
// A chaque sous-partie est attache un Status : la 1re a 1, la 2e a 2, etc...
|
||||
// (consequence, les sous-parties sont necessairement disjointes)
|
||||
IFGraph_SubPartsIterator::IFGraph_SubPartsIterator
|
||||
(const Interface_Graph& agraph, const Standard_Boolean whole)
|
||||
: thegraph (agraph)
|
||||
{
|
||||
if (whole) thegraph.GetFromModel();
|
||||
theparts = new TColStd_HSequenceOfInteger();
|
||||
thefirsts = new TColStd_HSequenceOfInteger();
|
||||
thepart = 0;
|
||||
thecurr = 0;
|
||||
}
|
||||
|
||||
IFGraph_SubPartsIterator::IFGraph_SubPartsIterator
|
||||
(IFGraph_SubPartsIterator& other)
|
||||
: thegraph (other.Graph())
|
||||
{
|
||||
Standard_Integer nb = thegraph.Size();
|
||||
theparts = new TColStd_HSequenceOfInteger();
|
||||
thepart = 0;
|
||||
for (other.Start(); other.More(); other.Next()) {
|
||||
thepart ++;
|
||||
Standard_Integer nbent = 0;
|
||||
GetFromIter (other.Entities());
|
||||
for (Standard_Integer i = 1; i <= nb; i ++) {
|
||||
if (thegraph.Status(i) == thepart) nbent ++;
|
||||
}
|
||||
theparts->Append(nbent); // compte vide
|
||||
}
|
||||
thepart = 0;
|
||||
thecurr = 1;
|
||||
}
|
||||
|
||||
void IFGraph_SubPartsIterator::GetParts
|
||||
(IFGraph_SubPartsIterator& other)
|
||||
{
|
||||
if (Model() != other.Model()) throw Interface_InterfaceError("SubPartsIterator : GetParts");
|
||||
// On AJOUTE les Parts de other, sans perdre les siennes propres
|
||||
// (meme principe que le constructeur ci-dessus)
|
||||
Standard_Integer nb = thegraph.Size();
|
||||
thepart = theparts->Length();
|
||||
for (other.Start(); other.More(); other.Next()) {
|
||||
thepart ++;
|
||||
Standard_Integer nbent = 0;
|
||||
GetFromIter (other.Entities());
|
||||
for (Standard_Integer i = 1; i <= nb; i ++) {
|
||||
if (thegraph.Status(i) == thepart) nbent ++;
|
||||
}
|
||||
theparts->Append(nbent); // compte vide
|
||||
}
|
||||
}
|
||||
|
||||
const Interface_Graph& IFGraph_SubPartsIterator::Graph () const
|
||||
{ return thegraph; }
|
||||
|
||||
// .... Gestion Interne (remplissage, etc...) .... //
|
||||
|
||||
Handle(Interface_InterfaceModel) IFGraph_SubPartsIterator::Model() const
|
||||
{ return thegraph.Model(); }
|
||||
|
||||
void IFGraph_SubPartsIterator::AddPart ()
|
||||
{
|
||||
theparts->Append( Standard_Integer(0) );
|
||||
thepart = theparts->Length();
|
||||
}
|
||||
|
||||
Standard_Integer IFGraph_SubPartsIterator::NbParts () const
|
||||
{ return theparts->Length(); }
|
||||
|
||||
Standard_Integer IFGraph_SubPartsIterator::PartNum () const
|
||||
{ return thepart; }
|
||||
|
||||
void IFGraph_SubPartsIterator::SetLoad ()
|
||||
{ thepart = 0; }
|
||||
|
||||
void IFGraph_SubPartsIterator::SetPartNum (const Standard_Integer num)
|
||||
{
|
||||
if (num <= 0 || num > theparts->Length()) throw Standard_OutOfRange("IFGraph_SubPartsIterator : SetPartNum");
|
||||
thepart = num;
|
||||
}
|
||||
|
||||
void IFGraph_SubPartsIterator::GetFromEntity
|
||||
(const Handle(Standard_Transient)& ent, const Standard_Boolean shared)
|
||||
{
|
||||
thegraph.GetFromEntity(ent,shared, thepart,thepart,Standard_False);
|
||||
}
|
||||
|
||||
void IFGraph_SubPartsIterator::GetFromIter (const Interface_EntityIterator& iter)
|
||||
{
|
||||
thegraph.GetFromIter(iter, thepart,thepart, Standard_False);
|
||||
}
|
||||
|
||||
void IFGraph_SubPartsIterator::Reset ()
|
||||
{
|
||||
thegraph.Reset();
|
||||
theparts->Clear();
|
||||
thepart = 0;
|
||||
thecurr = 0;
|
||||
}
|
||||
|
||||
|
||||
// .... Resultat (Evaluation, Iterations) .... //
|
||||
|
||||
void IFGraph_SubPartsIterator::Evaluate ()
|
||||
{ } // par defaut, ne fait rien; redefinie par les sous-classes
|
||||
|
||||
Interface_GraphContent IFGraph_SubPartsIterator::Loaded () const
|
||||
{
|
||||
Interface_EntityIterator iter;
|
||||
// Standard_Integer nb = thegraph.Size();
|
||||
return Interface_GraphContent(thegraph,0);
|
||||
}
|
||||
|
||||
Interface_Graph IFGraph_SubPartsIterator::LoadedGraph () const
|
||||
{
|
||||
Interface_Graph G(Model());
|
||||
Standard_Integer nb = thegraph.Size();
|
||||
for (Standard_Integer i = 1; i <= nb; i ++) {
|
||||
if (thegraph.IsPresent(i) && thegraph.Status(i) == 0)
|
||||
G.GetFromEntity(thegraph.Entity(i),Standard_False);
|
||||
}
|
||||
return G;
|
||||
}
|
||||
|
||||
|
||||
Standard_Boolean IFGraph_SubPartsIterator::IsLoaded
|
||||
(const Handle(Standard_Transient)& ent) const
|
||||
{ return thegraph.IsPresent(thegraph.EntityNumber(ent)); }
|
||||
|
||||
Standard_Boolean IFGraph_SubPartsIterator::IsInPart
|
||||
(const Handle(Standard_Transient)& ent) const
|
||||
{
|
||||
Standard_Integer num = thegraph.EntityNumber(ent);
|
||||
if (!thegraph.IsPresent(num)) return Standard_False;
|
||||
return (thegraph.Status(num) != 0);
|
||||
}
|
||||
|
||||
Standard_Integer IFGraph_SubPartsIterator::EntityPartNum
|
||||
(const Handle(Standard_Transient)& ent) const
|
||||
{
|
||||
Standard_Integer num = thegraph.EntityNumber(ent);
|
||||
if (!thegraph.IsPresent(num)) return 0;
|
||||
return thegraph.Status(num);
|
||||
}
|
||||
|
||||
|
||||
void IFGraph_SubPartsIterator::Start ()
|
||||
{
|
||||
Evaluate();
|
||||
// On evalue les tailles des contenus des Parts
|
||||
Standard_Integer nb = thegraph.Size();
|
||||
Standard_Integer nbp = theparts->Length();
|
||||
if (thepart > nbp) thepart = nbp;
|
||||
if (nbp == 0) { thecurr = 1; return; } // L Iteration s arrete de suite
|
||||
|
||||
// - On fait les comptes (via tableaux pour performances)
|
||||
TColStd_Array1OfInteger partcounts (1,nbp); partcounts.Init(0);
|
||||
TColStd_Array1OfInteger partfirsts (1,nbp); partfirsts.Init(0);
|
||||
for (Standard_Integer i = 1; i <= nb; i ++) {
|
||||
if (!thegraph.IsPresent(i)) continue;
|
||||
Standard_Integer nump = thegraph.Status(i);
|
||||
if (nump < 1 || nump > nbp) continue;
|
||||
Standard_Integer nbent = partcounts.Value(nump);
|
||||
partcounts.SetValue(nump,nbent+1);
|
||||
if (nbent == 0) partfirsts.SetValue(nump,i);
|
||||
}
|
||||
// - On les met en forme (c-a-d dans les sequences)
|
||||
theparts->Clear(); thefirsts->Clear();
|
||||
Standard_Integer lastp = 0;
|
||||
for (Standard_Integer np = 1; np <= nbp; np ++) {
|
||||
Standard_Integer nbent = partcounts.Value(np);
|
||||
if (np != 0) lastp = np;
|
||||
theparts->Append (nbent);
|
||||
thefirsts->Append (partfirsts.Value(np));
|
||||
}
|
||||
if (lastp < nbp) theparts->Remove(lastp+1,nbp);
|
||||
// Enfin, on se prepare a iterer
|
||||
thecurr = 1;
|
||||
}
|
||||
|
||||
Standard_Boolean IFGraph_SubPartsIterator::More ()
|
||||
{
|
||||
if (thecurr == 0) Start();
|
||||
return (thecurr <= theparts->Length());
|
||||
}
|
||||
|
||||
void IFGraph_SubPartsIterator::Next ()
|
||||
{
|
||||
thecurr ++; if (thecurr > theparts->Length()) return;
|
||||
if (theparts->Value(thecurr) == 0) Next(); // sauter parties vides
|
||||
}
|
||||
|
||||
Standard_Boolean IFGraph_SubPartsIterator::IsSingle () const
|
||||
{
|
||||
if (thecurr < 1 || thecurr > theparts->Length()) throw Standard_NoSuchObject("IFGraph_SubPartsIterator : IsSingle");
|
||||
return (theparts->Value(thecurr) == 1);
|
||||
}
|
||||
|
||||
Handle(Standard_Transient) IFGraph_SubPartsIterator::FirstEntity
|
||||
() const
|
||||
{
|
||||
if (thecurr < 1 || thecurr > theparts->Length()) throw Standard_NoSuchObject("IFGraph_SubPartsIterator : FirstEntity");
|
||||
Standard_Integer nument = thefirsts->Value(thecurr);
|
||||
if (nument == 0) throw Standard_NoSuchObject("IFGraph_SubPartsIterator : FirstEntity (current part is empty)");
|
||||
return thegraph.Entity(nument);
|
||||
}
|
||||
|
||||
Interface_EntityIterator IFGraph_SubPartsIterator::Entities () const
|
||||
{
|
||||
if (thecurr < 1 || thecurr > theparts->Length()) throw Standard_NoSuchObject("IFGraph_SubPartsIterator : Entities");
|
||||
Interface_EntityIterator iter;
|
||||
Standard_Integer nb = thegraph.Size();
|
||||
Standard_Integer nument = thefirsts->Value(thecurr);
|
||||
if (nument == 0) return iter;
|
||||
if (theparts->Value(thecurr) == 1) nb = nument; // evident : 1 seule Entite
|
||||
for (Standard_Integer i = nument; i <= nb; i ++) {
|
||||
if (thegraph.Status(i) == thecurr && thegraph.IsPresent(i))
|
||||
iter.GetOneItem(thegraph.Entity(i));
|
||||
}
|
||||
return iter;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : ~IFGraph_SubPartsIterator
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
IFGraph_SubPartsIterator::~IFGraph_SubPartsIterator()
|
||||
{}
|
@@ -1,180 +0,0 @@
|
||||
// Created on: 1992-09-23
|
||||
// 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 _IFGraph_SubPartsIterator_HeaderFile
|
||||
#define _IFGraph_SubPartsIterator_HeaderFile
|
||||
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_DefineAlloc.hxx>
|
||||
#include <Standard_Handle.hxx>
|
||||
|
||||
#include <Interface_Graph.hxx>
|
||||
#include <TColStd_HSequenceOfInteger.hxx>
|
||||
#include <Standard_Integer.hxx>
|
||||
#include <Standard_Boolean.hxx>
|
||||
class Interface_InterfaceModel;
|
||||
class Standard_Transient;
|
||||
class Interface_EntityIterator;
|
||||
class Interface_GraphContent;
|
||||
|
||||
|
||||
//! defines general form for graph classes of which result is
|
||||
//! not a single iteration on Entities, but a nested one :
|
||||
//! External iteration works on sub-parts, identified by each
|
||||
//! class (according to its algorithm)
|
||||
//! Internal Iteration concerns Entities of a sub-part
|
||||
//! Sub-Parts are assumed to be disjoined; if they are not,
|
||||
//! the first one has priority
|
||||
//!
|
||||
//! A SubPartsIterator can work in two steps : first, load
|
||||
//! entities which have to be processed
|
||||
//! then, analyse to set those entities into sub-parts
|
||||
class IFGraph_SubPartsIterator
|
||||
{
|
||||
public:
|
||||
|
||||
DEFINE_STANDARD_ALLOC
|
||||
|
||||
|
||||
//! Creates with a Graph, whole or parts of it
|
||||
//! whole True : works on the entire Model
|
||||
//! whole False : empty, ready to be filled
|
||||
//! SubPartIterator is set to load entities
|
||||
Standard_EXPORT IFGraph_SubPartsIterator(const Interface_Graph& agraph, const Standard_Boolean whole);
|
||||
|
||||
//! Creates a SubPartIterator from another one and gets its Data
|
||||
//! Note that only non-empty sub-parts are taken into account
|
||||
//! PartNum is set to the last one
|
||||
Standard_EXPORT IFGraph_SubPartsIterator(IFGraph_SubPartsIterator& other);
|
||||
|
||||
//! Gets Parts from another SubPartsIterator (in addition to the
|
||||
//! ones already recorded)
|
||||
//! Error if both SubPartsIterators are not based on the same Model
|
||||
Standard_EXPORT void GetParts (IFGraph_SubPartsIterator& other);
|
||||
|
||||
//! Returns the Model with which this Iterator was created
|
||||
Standard_EXPORT Handle(Interface_InterfaceModel) Model() const;
|
||||
|
||||
//! Adds an empty part and sets it to receive entities
|
||||
Standard_EXPORT void AddPart();
|
||||
|
||||
//! Returns count of registered parts
|
||||
Standard_EXPORT Standard_Integer NbParts() const;
|
||||
|
||||
//! Returns numero of part which currently receives entities
|
||||
//! (0 at load time)
|
||||
Standard_EXPORT Standard_Integer PartNum() const;
|
||||
|
||||
//! Sets SubPartIterator to get Entities (by GetFromEntity &
|
||||
//! GetFromIter) into load status, to be analysed later
|
||||
Standard_EXPORT void SetLoad();
|
||||
|
||||
//! Sets numero of receiving part to a new value
|
||||
//! Error if not in range (1-NbParts)
|
||||
Standard_EXPORT void SetPartNum (const Standard_Integer num);
|
||||
|
||||
//! Adds an Entity : into load status if in Load mode, to the
|
||||
//! current part if there is one. If shared is True, adds
|
||||
//! also its shared ones (shared at all levels)
|
||||
Standard_EXPORT void GetFromEntity (const Handle(Standard_Transient)& ent, const Standard_Boolean shared);
|
||||
|
||||
//! Adds a list of Entities (into Load mode or to a Part),
|
||||
//! given as an Iterator
|
||||
Standard_EXPORT void GetFromIter (const Interface_EntityIterator& iter);
|
||||
|
||||
//! Erases data (parts, entities) : "me" becomes empty and in
|
||||
//! load status
|
||||
Standard_EXPORT void Reset();
|
||||
|
||||
//! Called by Clear, this method allows evaluation just before
|
||||
//! iteration; its default is doing nothing, it is designed to
|
||||
//! be redefined
|
||||
Standard_EXPORT virtual void Evaluate();
|
||||
|
||||
//! Returns entities which where loaded (not set into a sub-part)
|
||||
Standard_EXPORT Interface_GraphContent Loaded() const;
|
||||
|
||||
//! Same as above, but under the form of a Graph
|
||||
Standard_EXPORT Interface_Graph LoadedGraph() const;
|
||||
|
||||
//! Returns True if an Entity is loaded (either set into a
|
||||
//! sub-part or not)
|
||||
Standard_EXPORT Standard_Boolean IsLoaded (const Handle(Standard_Transient)& ent) const;
|
||||
|
||||
//! Returns True if an Entity is Present in a sub-part
|
||||
Standard_EXPORT Standard_Boolean IsInPart (const Handle(Standard_Transient)& ent) const;
|
||||
|
||||
//! Returns number of the sub-part in which an Entity has been set
|
||||
//! if it is not in a sub-part (or not loaded at all), Returns 0
|
||||
Standard_EXPORT Standard_Integer EntityPartNum (const Handle(Standard_Transient)& ent) const;
|
||||
|
||||
//! Sets iteration to its beginning; calls Evaluate
|
||||
Standard_EXPORT void Start();
|
||||
|
||||
//! Returns True if there are more sub-parts to iterate on
|
||||
//! Note : an empty sub-part is not taken in account by Iteration
|
||||
Standard_EXPORT Standard_Boolean More();
|
||||
|
||||
//! Sets iteration to the next sub-part
|
||||
//! if there is not, IsSingle-Entities will raises an exception
|
||||
Standard_EXPORT void Next();
|
||||
|
||||
//! Returns True if current sub-part is single (has only one Entity)
|
||||
//! Error if there is no sub-part to iterate now
|
||||
Standard_EXPORT Standard_Boolean IsSingle() const;
|
||||
|
||||
//! Returns the first entity of current sub-part, that is for a
|
||||
//! Single one, the only one it contains
|
||||
//! Error : same as above (end of iteration)
|
||||
Standard_EXPORT Handle(Standard_Transient) FirstEntity() const;
|
||||
|
||||
//! Returns current sub-part, not as a "Value", but as an Iterator
|
||||
//! on Entities it contains
|
||||
//! Error : same as above (end of iteration)
|
||||
Standard_EXPORT Interface_EntityIterator Entities() const;
|
||||
|
||||
Standard_EXPORT virtual ~IFGraph_SubPartsIterator();
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
|
||||
Interface_Graph thegraph;
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
||||
//! Returns the Graph used by <me>. Used to create another
|
||||
//! SubPartsIterator from <me>
|
||||
Standard_EXPORT const Interface_Graph& Graph() const;
|
||||
|
||||
|
||||
Handle(TColStd_HSequenceOfInteger) theparts;
|
||||
Handle(TColStd_HSequenceOfInteger) thefirsts;
|
||||
Standard_Integer thepart;
|
||||
Standard_Integer thecurr;
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // _IFGraph_SubPartsIterator_HeaderFile
|
@@ -1,168 +0,0 @@
|
||||
IFSelect.cxx
|
||||
IFSelect.hxx
|
||||
IFSelect_Act.cxx
|
||||
IFSelect_Act.hxx
|
||||
IFSelect_ActFunc.hxx
|
||||
IFSelect_Activator.cxx
|
||||
IFSelect_Activator.hxx
|
||||
IFSelect_AppliedModifiers.cxx
|
||||
IFSelect_AppliedModifiers.hxx
|
||||
IFSelect_BasicDumper.cxx
|
||||
IFSelect_BasicDumper.hxx
|
||||
IFSelect_CheckCounter.cxx
|
||||
IFSelect_CheckCounter.hxx
|
||||
IFSelect_ContextModif.cxx
|
||||
IFSelect_ContextModif.hxx
|
||||
IFSelect_ContextWrite.cxx
|
||||
IFSelect_ContextWrite.hxx
|
||||
IFSelect_Dispatch.cxx
|
||||
IFSelect_Dispatch.hxx
|
||||
IFSelect_DispGlobal.cxx
|
||||
IFSelect_DispGlobal.hxx
|
||||
IFSelect_DispPerCount.cxx
|
||||
IFSelect_DispPerCount.hxx
|
||||
IFSelect_DispPerFiles.cxx
|
||||
IFSelect_DispPerFiles.hxx
|
||||
IFSelect_DispPerOne.cxx
|
||||
IFSelect_DispPerOne.hxx
|
||||
IFSelect_DispPerSignature.cxx
|
||||
IFSelect_DispPerSignature.hxx
|
||||
IFSelect_EditForm.cxx
|
||||
IFSelect_EditForm.hxx
|
||||
IFSelect_Editor.cxx
|
||||
IFSelect_Editor.hxx
|
||||
IFSelect_EditValue.hxx
|
||||
IFSelect_FileModifier.gxx
|
||||
IFSelect_Functions.cxx
|
||||
IFSelect_Functions.hxx
|
||||
IFSelect_GeneralModifier.cxx
|
||||
IFSelect_GeneralModifier.hxx
|
||||
IFSelect_GraphCounter.cxx
|
||||
IFSelect_GraphCounter.hxx
|
||||
IFSelect_HSeqOfSelection.hxx
|
||||
IFSelect_IntParam.cxx
|
||||
IFSelect_IntParam.hxx
|
||||
IFSelect_ListEditor.cxx
|
||||
IFSelect_ListEditor.hxx
|
||||
IFSelect_ModelCopier.cxx
|
||||
IFSelect_ModelCopier.hxx
|
||||
IFSelect_ModelModifier.gxx
|
||||
IFSelect_ModifEditForm.cxx
|
||||
IFSelect_ModifEditForm.hxx
|
||||
IFSelect_Modifier.cxx
|
||||
IFSelect_Modifier.hxx
|
||||
IFSelect_ModifReorder.cxx
|
||||
IFSelect_ModifReorder.hxx
|
||||
IFSelect_PacketList.cxx
|
||||
IFSelect_PacketList.hxx
|
||||
IFSelect_ParamEditor.cxx
|
||||
IFSelect_ParamEditor.hxx
|
||||
IFSelect_PrintCount.hxx
|
||||
IFSelect_PrintFail.hxx
|
||||
IFSelect_RemainMode.hxx
|
||||
IFSelect_ReturnStatus.hxx
|
||||
IFSelect_SelectAnyList.cxx
|
||||
IFSelect_SelectAnyList.hxx
|
||||
IFSelect_SelectAnyType.cxx
|
||||
IFSelect_SelectAnyType.hxx
|
||||
IFSelect_SelectBase.cxx
|
||||
IFSelect_SelectBase.hxx
|
||||
IFSelect_SelectCombine.cxx
|
||||
IFSelect_SelectCombine.hxx
|
||||
IFSelect_SelectControl.cxx
|
||||
IFSelect_SelectControl.hxx
|
||||
IFSelect_SelectDeduct.cxx
|
||||
IFSelect_SelectDeduct.hxx
|
||||
IFSelect_SelectDiff.cxx
|
||||
IFSelect_SelectDiff.hxx
|
||||
IFSelect_SelectEntityNumber.cxx
|
||||
IFSelect_SelectEntityNumber.hxx
|
||||
IFSelect_SelectErrorEntities.cxx
|
||||
IFSelect_SelectErrorEntities.hxx
|
||||
IFSelect_SelectExplore.cxx
|
||||
IFSelect_SelectExplore.hxx
|
||||
IFSelect_SelectExtract.cxx
|
||||
IFSelect_SelectExtract.hxx
|
||||
IFSelect_SelectFlag.cxx
|
||||
IFSelect_SelectFlag.hxx
|
||||
IFSelect_SelectIncorrectEntities.cxx
|
||||
IFSelect_SelectIncorrectEntities.hxx
|
||||
IFSelect_SelectInList.cxx
|
||||
IFSelect_SelectInList.hxx
|
||||
IFSelect_SelectIntersection.cxx
|
||||
IFSelect_SelectIntersection.hxx
|
||||
IFSelect_Selection.cxx
|
||||
IFSelect_Selection.hxx
|
||||
IFSelect_SelectionIterator.cxx
|
||||
IFSelect_SelectionIterator.hxx
|
||||
IFSelect_SelectModelEntities.cxx
|
||||
IFSelect_SelectModelEntities.hxx
|
||||
IFSelect_SelectModelRoots.cxx
|
||||
IFSelect_SelectModelRoots.hxx
|
||||
IFSelect_SelectPointed.cxx
|
||||
IFSelect_SelectPointed.hxx
|
||||
IFSelect_SelectRange.cxx
|
||||
IFSelect_SelectRange.hxx
|
||||
IFSelect_SelectRootComps.cxx
|
||||
IFSelect_SelectRootComps.hxx
|
||||
IFSelect_SelectRoots.cxx
|
||||
IFSelect_SelectRoots.hxx
|
||||
IFSelect_SelectSent.cxx
|
||||
IFSelect_SelectSent.hxx
|
||||
IFSelect_SelectShared.cxx
|
||||
IFSelect_SelectShared.hxx
|
||||
IFSelect_SelectSharing.cxx
|
||||
IFSelect_SelectSharing.hxx
|
||||
IFSelect_SelectSignature.cxx
|
||||
IFSelect_SelectSignature.hxx
|
||||
IFSelect_SelectSignedShared.cxx
|
||||
IFSelect_SelectSignedShared.hxx
|
||||
IFSelect_SelectSignedSharing.cxx
|
||||
IFSelect_SelectSignedSharing.hxx
|
||||
IFSelect_SelectSuite.cxx
|
||||
IFSelect_SelectSuite.hxx
|
||||
IFSelect_SelectType.cxx
|
||||
IFSelect_SelectType.hxx
|
||||
IFSelect_SelectUnion.cxx
|
||||
IFSelect_SelectUnion.hxx
|
||||
IFSelect_SelectUnknownEntities.cxx
|
||||
IFSelect_SelectUnknownEntities.hxx
|
||||
IFSelect_SequenceOfAppliedModifiers.hxx
|
||||
IFSelect_SequenceOfGeneralModifier.hxx
|
||||
IFSelect_SequenceOfInterfaceModel.hxx
|
||||
IFSelect_SessionDumper.cxx
|
||||
IFSelect_SessionDumper.hxx
|
||||
IFSelect_SessionFile.cxx
|
||||
IFSelect_SessionFile.hxx
|
||||
IFSelect_SessionPilot.cxx
|
||||
IFSelect_SessionPilot.hxx
|
||||
IFSelect_ShareOut.cxx
|
||||
IFSelect_ShareOut.hxx
|
||||
IFSelect_ShareOutResult.cxx
|
||||
IFSelect_ShareOutResult.hxx
|
||||
IFSelect_SignAncestor.cxx
|
||||
IFSelect_SignAncestor.hxx
|
||||
IFSelect_Signature.cxx
|
||||
IFSelect_Signature.hxx
|
||||
IFSelect_SignatureList.cxx
|
||||
IFSelect_SignatureList.hxx
|
||||
IFSelect_SignCategory.cxx
|
||||
IFSelect_SignCategory.hxx
|
||||
IFSelect_SignCounter.cxx
|
||||
IFSelect_SignCounter.hxx
|
||||
IFSelect_SignMultiple.cxx
|
||||
IFSelect_SignMultiple.hxx
|
||||
IFSelect_SignType.cxx
|
||||
IFSelect_SignType.hxx
|
||||
IFSelect_SignValidity.cxx
|
||||
IFSelect_SignValidity.hxx
|
||||
IFSelect_Transformer.cxx
|
||||
IFSelect_Transformer.hxx
|
||||
IFSelect_TransformStandard.cxx
|
||||
IFSelect_TransformStandard.hxx
|
||||
IFSelect_TSeqOfDispatch.hxx
|
||||
IFSelect_TSeqOfSelection.hxx
|
||||
IFSelect_WorkLibrary.cxx
|
||||
IFSelect_WorkLibrary.hxx
|
||||
IFSelect_WorkSession.cxx
|
||||
IFSelect_WorkSession.hxx
|
@@ -1,33 +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 <IFSelect.hxx>
|
||||
#include <IFSelect_SessionFile.hxx>
|
||||
#include <IFSelect_WorkSession.hxx>
|
||||
|
||||
// Methodes de confort, evitant de devoir connaitre SessionFile, qui est un
|
||||
// Tool non destine a l export (en particulier, pas un Handle)
|
||||
Standard_Boolean IFSelect::SaveSession
|
||||
(const Handle(IFSelect_WorkSession)& WS, const Standard_CString file)
|
||||
{
|
||||
IFSelect_SessionFile sesfile(WS,file);
|
||||
return sesfile.IsDone();
|
||||
}
|
||||
|
||||
Standard_Boolean IFSelect::RestoreSession
|
||||
(const Handle(IFSelect_WorkSession)& WS, const Standard_CString file)
|
||||
{
|
||||
IFSelect_SessionFile sesfile(WS);
|
||||
return (sesfile.Read(file) == 0);
|
||||
}
|
@@ -1,60 +0,0 @@
|
||||
// Created on: 1992-09-21
|
||||
// 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 _IFSelect_HeaderFile
|
||||
#define _IFSelect_HeaderFile
|
||||
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_DefineAlloc.hxx>
|
||||
#include <Standard_Handle.hxx>
|
||||
|
||||
#include <Standard_Boolean.hxx>
|
||||
class IFSelect_WorkSession;
|
||||
|
||||
|
||||
//! Gives tools to manage Selecting a group of Entities
|
||||
//! processed by an Interface, for instance to divide up an
|
||||
//! original Model (from a File) to several smaller ones
|
||||
//! They use description of an Interface Model as a graph
|
||||
//!
|
||||
//! Remark that this corresponds to the description of a
|
||||
//! "scenario" of sharing out a File. Parts of this Scenario
|
||||
//! are intended to be permanently stored. IFSelect provides
|
||||
//! the Transient, active counterparts (to run the Scenario).
|
||||
//! But a permanent one (either as Persistent Objects or as
|
||||
//! interpretable Text) must be provided elsewhere.
|
||||
class IFSelect
|
||||
{
|
||||
public:
|
||||
|
||||
DEFINE_STANDARD_ALLOC
|
||||
|
||||
|
||||
//! Saves the state of a WorkSession from IFSelect, by using a
|
||||
//! SessionFile from IFSelect. Returns True if Done, False in
|
||||
//! case of Error on Writing. <file> gives the name of the File
|
||||
//! to be produced (this avoids to export the class SessionFile).
|
||||
Standard_EXPORT static Standard_Boolean SaveSession (const Handle(IFSelect_WorkSession)& WS, const Standard_CString file);
|
||||
|
||||
//! Restore the state of a WorkSession from IFSelect, by using a
|
||||
//! SessionFile from IFSelect. Returns True if Done, False in
|
||||
//! case of Error on Writing. <file> gives the name of the File
|
||||
//! to be used (this avoids to export the class SessionFile).
|
||||
Standard_EXPORT static Standard_Boolean RestoreSession (const Handle(IFSelect_WorkSession)& WS, const Standard_CString file);
|
||||
|
||||
};
|
||||
|
||||
#endif // _IFSelect_HeaderFile
|
@@ -1,64 +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 <IFSelect_Act.hxx>
|
||||
#include <IFSelect_SessionPilot.hxx>
|
||||
#include <Standard_Type.hxx>
|
||||
#include <TCollection_AsciiString.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(IFSelect_Act,IFSelect_Activator)
|
||||
|
||||
static TCollection_AsciiString thedefgr, thedefil;
|
||||
|
||||
|
||||
|
||||
IFSelect_Act::IFSelect_Act
|
||||
(const Standard_CString name, const Standard_CString help,
|
||||
const IFSelect_ActFunc func)
|
||||
: thename (name) , thehelp (help) , thefunc (func) { }
|
||||
|
||||
IFSelect_ReturnStatus IFSelect_Act::Do
|
||||
(const Standard_Integer, const Handle(IFSelect_SessionPilot)& pilot)
|
||||
{
|
||||
if (!thefunc) return IFSelect_RetVoid;
|
||||
return thefunc (pilot);
|
||||
}
|
||||
|
||||
Standard_CString IFSelect_Act::Help (const Standard_Integer) const
|
||||
{ return thehelp.ToCString(); }
|
||||
|
||||
|
||||
void IFSelect_Act::SetGroup
|
||||
(const Standard_CString group, const Standard_CString file)
|
||||
{ thedefgr.Clear(); if (group[0] != '\0') thedefgr.AssignCat(group);
|
||||
thedefil.Clear(); if (file [0] != '\0') thedefil.AssignCat(file); }
|
||||
|
||||
void IFSelect_Act::AddFunc
|
||||
(const Standard_CString name, const Standard_CString help,
|
||||
const IFSelect_ActFunc func)
|
||||
{
|
||||
Handle(IFSelect_Act) act = new IFSelect_Act (name,help,func);
|
||||
if (thedefgr.Length() > 0) act->SetForGroup (thedefgr.ToCString());
|
||||
act->Add (1,name);
|
||||
}
|
||||
|
||||
void IFSelect_Act::AddFSet
|
||||
(const Standard_CString name, const Standard_CString help,
|
||||
const IFSelect_ActFunc func)
|
||||
{
|
||||
Handle(IFSelect_Act) act = new IFSelect_Act (name,help,func);
|
||||
if (thedefgr.Length() > 0)
|
||||
act->SetForGroup (thedefgr.ToCString(),thedefil.ToCString());
|
||||
act->AddSet (1,name);
|
||||
}
|
@@ -1,107 +0,0 @@
|
||||
// Created on: 1996-03-05
|
||||
// Created by: Christian CAILLET
|
||||
// Copyright (c) 1996-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 _IFSelect_Act_HeaderFile
|
||||
#define _IFSelect_Act_HeaderFile
|
||||
|
||||
#include <Standard.hxx>
|
||||
|
||||
#include <IFSelect_ActFunc.hxx>
|
||||
#include <IFSelect_Activator.hxx>
|
||||
#include <IFSelect_ReturnStatus.hxx>
|
||||
#include <Standard_Integer.hxx>
|
||||
class IFSelect_SessionPilot;
|
||||
|
||||
|
||||
class IFSelect_Act;
|
||||
DEFINE_STANDARD_HANDLE(IFSelect_Act, IFSelect_Activator)
|
||||
|
||||
//! Act gives a simple way to define and add functions to be ran
|
||||
//! from a SessionPilot, as follows :
|
||||
//!
|
||||
//! Define a function as
|
||||
//! static IFSelect_RetStatus myfunc
|
||||
//! (const Standard_CString name,
|
||||
//! const Handle(IFSelect_SessionPilot)& pilot)
|
||||
//! { ... }
|
||||
//! When ran, it receives the exact name (string) of the called
|
||||
//! function, and the SessionPilot which brings other infos
|
||||
//!
|
||||
//! Add it by
|
||||
//! IFSelect_Act::AddFunc (name,help,myfunc);
|
||||
//! for a normal function, or
|
||||
//! IFSelect_Act::AddFSet (name,help,myfunc);
|
||||
//! for a function which is intended to create a control item
|
||||
//! name and help are given as CString
|
||||
//!
|
||||
//! Then, it is available for run
|
||||
class IFSelect_Act : public IFSelect_Activator
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
|
||||
//! Creates an Act with a name, help and a function
|
||||
//! mode (Add or AddSet) is given when recording
|
||||
Standard_EXPORT IFSelect_Act(const Standard_CString name, const Standard_CString help, const IFSelect_ActFunc func);
|
||||
|
||||
//! Execution of Command Line. remark that <number> is senseless
|
||||
//! because each Act brings one and only one function
|
||||
Standard_EXPORT IFSelect_ReturnStatus Do (const Standard_Integer number, const Handle(IFSelect_SessionPilot)& pilot) Standard_OVERRIDE;
|
||||
|
||||
//! Short Help for commands : returns the help given to create
|
||||
Standard_EXPORT Standard_CString Help (const Standard_Integer number) const Standard_OVERRIDE;
|
||||
|
||||
//! Changes the default group name for the following Acts
|
||||
//! group empty means to come back to default from Activator
|
||||
//! Also a file name can be precised (to query by getsource)
|
||||
Standard_EXPORT static void SetGroup (const Standard_CString group, const Standard_CString file = "");
|
||||
|
||||
//! Adds a function with its name and help : creates an Act then
|
||||
//! records it as normal function
|
||||
Standard_EXPORT static void AddFunc (const Standard_CString name, const Standard_CString help, const IFSelect_ActFunc func);
|
||||
|
||||
//! Adds a function with its name and help : creates an Act then
|
||||
//! records it as function for XSET (i.e. to create control item)
|
||||
Standard_EXPORT static void AddFSet (const Standard_CString name, const Standard_CString help, const IFSelect_ActFunc func);
|
||||
|
||||
|
||||
|
||||
|
||||
DEFINE_STANDARD_RTTIEXT(IFSelect_Act,IFSelect_Activator)
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
||||
TCollection_AsciiString thename;
|
||||
TCollection_AsciiString thehelp;
|
||||
IFSelect_ActFunc thefunc;
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // _IFSelect_Act_HeaderFile
|
@@ -1,24 +0,0 @@
|
||||
// Created on: 2000-02-29
|
||||
// Created by: data exchange team
|
||||
// Copyright (c) 2000-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 _IFSelect_ActFunc_HeaderFile
|
||||
#define _IFSelect_ActFunc_HeaderFile
|
||||
|
||||
#include <IFSelect_SessionPilot.hxx>
|
||||
#include <IFSelect_ReturnStatus.hxx>
|
||||
|
||||
typedef IFSelect_ReturnStatus (*IFSelect_ActFunc) (const Handle(IFSelect_SessionPilot)&);
|
||||
|
||||
#endif
|
@@ -1,118 +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 <IFSelect_Activator.hxx>
|
||||
#include <IFSelect_SessionPilot.hxx>
|
||||
#include <Interface_Macros.hxx>
|
||||
#include <TCollection_AsciiString.hxx>
|
||||
#include <TCollection_HAsciiString.hxx>
|
||||
#include <TColStd_SequenceOfInteger.hxx>
|
||||
#include <TColStd_SequenceOfTransient.hxx>
|
||||
#include <NCollection_DataMap.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(IFSelect_Activator,Standard_Transient)
|
||||
|
||||
static NCollection_DataMap<TCollection_AsciiString, Standard_Integer> thedico;
|
||||
static TColStd_SequenceOfInteger thenums, themodes;
|
||||
static TColStd_SequenceOfTransient theacts;
|
||||
|
||||
|
||||
void IFSelect_Activator::Adding
|
||||
(const Handle(IFSelect_Activator)& actor,
|
||||
const Standard_Integer number,
|
||||
const Standard_CString command,
|
||||
const Standard_Integer mode)
|
||||
{
|
||||
#ifdef OCCT_DEBUG
|
||||
if (thedico.IsBound(command)) {
|
||||
std::cout << "**** XSTEP commands, name conflict on " << command << " first defined remains ****" << std::endl;
|
||||
// throw Standard_DomainError("IFSelect_Activator : Add");
|
||||
}
|
||||
#endif
|
||||
|
||||
thedico.Bind(command, thenums.Length() + 1);
|
||||
|
||||
thenums.Append(number);
|
||||
theacts.Append(actor);
|
||||
themodes.Append(mode);
|
||||
}
|
||||
|
||||
void IFSelect_Activator::Add
|
||||
(const Standard_Integer number, const Standard_CString command) const
|
||||
{ Adding (this,number,command,0); }
|
||||
|
||||
void IFSelect_Activator::AddSet
|
||||
(const Standard_Integer number, const Standard_CString command) const
|
||||
{ Adding (this,number,command,1); }
|
||||
|
||||
void IFSelect_Activator::Remove (const Standard_CString command)
|
||||
{ thedico.UnBind(command); }
|
||||
|
||||
Standard_Boolean IFSelect_Activator::Select
|
||||
(const Standard_CString command, Standard_Integer& number,
|
||||
Handle(IFSelect_Activator)& actor)
|
||||
{
|
||||
Standard_Integer num;
|
||||
if (!thedico.Find(command, num)) return Standard_False;
|
||||
number = thenums(num);
|
||||
actor = Handle(IFSelect_Activator)::DownCast(theacts(num));
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
Standard_Integer IFSelect_Activator::Mode
|
||||
(const Standard_CString command)
|
||||
{
|
||||
Standard_Integer num;
|
||||
if (!thedico.Find(command, num)) return -1;
|
||||
return themodes(num);
|
||||
}
|
||||
|
||||
|
||||
Handle(TColStd_HSequenceOfAsciiString) IFSelect_Activator::Commands
|
||||
(const Standard_Integer mode, const Standard_CString command)
|
||||
{
|
||||
Standard_Integer num;
|
||||
NCollection_DataMap<TCollection_AsciiString, Standard_Integer>::Iterator iter(thedico);
|
||||
Handle(TColStd_HSequenceOfAsciiString) list =
|
||||
new TColStd_HSequenceOfAsciiString();
|
||||
for (; iter.More(); iter.Next()) {
|
||||
if (!iter.Key().StartsWith(command))
|
||||
continue;
|
||||
if (mode < 0) {
|
||||
DeclareAndCast(IFSelect_Activator,acti,theacts(iter.Value()));
|
||||
if (acti.IsNull()) continue;
|
||||
if (command[0] == '\0' || !strcmp(command,acti->Group()) )
|
||||
list->Append(iter.Key());
|
||||
} else {
|
||||
num = iter.Value();
|
||||
if (themodes(num) == mode) list->Append(iter.Key());
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
|
||||
IFSelect_Activator::IFSelect_Activator ()
|
||||
: thegroup ("XSTEP") { }
|
||||
|
||||
void IFSelect_Activator::SetForGroup
|
||||
(const Standard_CString group, const Standard_CString file)
|
||||
{ thegroup.Clear(); thegroup.AssignCat (group);
|
||||
thefile.Clear(); thefile.AssignCat (file); }
|
||||
|
||||
Standard_CString IFSelect_Activator::Group () const
|
||||
{ return thegroup.ToCString(); }
|
||||
|
||||
Standard_CString IFSelect_Activator::File () const
|
||||
{ return thefile.ToCString(); }
|
@@ -1,141 +0,0 @@
|
||||
// Created on: 1993-07-27
|
||||
// Created by: Christian CAILLET
|
||||
// Copyright (c) 1993-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 _IFSelect_Activator_HeaderFile
|
||||
#define _IFSelect_Activator_HeaderFile
|
||||
|
||||
#include <Standard.hxx>
|
||||
|
||||
#include <Standard_Transient.hxx>
|
||||
#include <Standard_Integer.hxx>
|
||||
#include <TColStd_HSequenceOfAsciiString.hxx>
|
||||
#include <IFSelect_ReturnStatus.hxx>
|
||||
class IFSelect_SessionPilot;
|
||||
|
||||
|
||||
class IFSelect_Activator;
|
||||
DEFINE_STANDARD_HANDLE(IFSelect_Activator, Standard_Transient)
|
||||
|
||||
//! Defines the general frame for working with a SessionPilot.
|
||||
//! Each Activator treats a set of Commands. Commands are given as
|
||||
//! alphanumeric strings. They can be of two main forms :
|
||||
//! - classic, to list, evaluate, enrich the session (by itself) :
|
||||
//! no specific remark, its complete execution must be described
|
||||
//! - creation of a new item : instead of creatinf it plus adding
|
||||
//! it to the session (which is a classic way), it is possible
|
||||
//! to create it and make it recorded by the SessionPilot :
|
||||
//! then, the Pilot will add it to the session; this way allows
|
||||
//! the Pilot to manage itself named items
|
||||
//!
|
||||
//! In order to make easier the use of Activator, this class
|
||||
//! provides a simple way to Select an Actor for a Command :
|
||||
//! each sub-class of SectionActor defines the command titles it
|
||||
//! recognizes, plus attaches a Number, unique for this sub-class,
|
||||
//! to each distinct command title.
|
||||
//!
|
||||
//! Each time an action is required, the corresponding Number
|
||||
//! can then be given to help the selection of the action to do.
|
||||
//!
|
||||
//! The result of an Execution must indicate if it is worth to be
|
||||
//! recorded or not : see method Do
|
||||
class IFSelect_Activator : public Standard_Transient
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
|
||||
//! Records, in a Dictionary available for all the Activators,
|
||||
//! the command title an Activator can process, attached with
|
||||
//! its number, proper for this Activator
|
||||
//! <mode> allows to distinguish various execution modes
|
||||
//! 0: default mode; 1 : for xset
|
||||
Standard_EXPORT static void Adding (const Handle(IFSelect_Activator)& actor, const Standard_Integer number, const Standard_CString command, const Standard_Integer mode);
|
||||
|
||||
//! Allows a self-definition by an Activator of the Commands it
|
||||
//! processes, call the class method Adding (mode 0)
|
||||
Standard_EXPORT void Add (const Standard_Integer number, const Standard_CString command) const;
|
||||
|
||||
//! Same as Add but specifies that this command is candidate for
|
||||
//! xset (creation of items, xset : named items; mode 1)
|
||||
Standard_EXPORT void AddSet (const Standard_Integer number, const Standard_CString command) const;
|
||||
|
||||
//! Removes a Command, if it is recorded (else, does nothing)
|
||||
Standard_EXPORT static void Remove (const Standard_CString command);
|
||||
|
||||
//! Selects, for a Command given by its title, an actor with its
|
||||
//! command number. Returns True if found, False else
|
||||
Standard_EXPORT static Standard_Boolean Select (const Standard_CString command, Standard_Integer& number, Handle(IFSelect_Activator)& actor);
|
||||
|
||||
//! Returns mode recorded for a command. -1 if not found
|
||||
Standard_EXPORT static Standard_Integer Mode (const Standard_CString command);
|
||||
|
||||
//! Returns, for a root of command title, the list of possible
|
||||
//! commands.
|
||||
//! <mode> : -1 (D) for all commands if <commands> is empty
|
||||
//! -1 + command : about a Group , >= 0 see Adding
|
||||
//! By default, it returns the whole list of known commands.
|
||||
Standard_EXPORT static Handle(TColStd_HSequenceOfAsciiString) Commands (const Standard_Integer mode = -1, const Standard_CString command = "");
|
||||
|
||||
//! Tries to execute a Command Line. <number> is the number of the
|
||||
//! command for this Activator. It Must forecast to record the
|
||||
//! result of the execution, for need of Undo-Redo
|
||||
//! Must Returns : 0 for a void command (not to be recorded),
|
||||
//! 1 if execution OK, -1 if command incorrect, -2 if error
|
||||
//! on execution
|
||||
Standard_EXPORT virtual IFSelect_ReturnStatus Do (const Standard_Integer number, const Handle(IFSelect_SessionPilot)& pilot) = 0;
|
||||
|
||||
//! Sends a short help message for a given command identified by
|
||||
//! it number for this Activator (must take one line max)
|
||||
Standard_EXPORT virtual Standard_CString Help (const Standard_Integer number) const = 0;
|
||||
|
||||
Standard_EXPORT Standard_CString Group() const;
|
||||
|
||||
Standard_EXPORT Standard_CString File() const;
|
||||
|
||||
//! Group and SetGroup define a "Group of commands" which
|
||||
//! correspond to an Activator. Default is "XSTEP"
|
||||
//! Also a file may be attached
|
||||
Standard_EXPORT void SetForGroup (const Standard_CString group, const Standard_CString file = "");
|
||||
|
||||
|
||||
|
||||
|
||||
DEFINE_STANDARD_RTTIEXT(IFSelect_Activator,Standard_Transient)
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
//! Sets the default values
|
||||
Standard_EXPORT IFSelect_Activator();
|
||||
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
||||
TCollection_AsciiString thegroup;
|
||||
TCollection_AsciiString thefile;
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // _IFSelect_Activator_HeaderFile
|
@@ -1,74 +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 <IFSelect_AppliedModifiers.hxx>
|
||||
#include <IFSelect_GeneralModifier.hxx>
|
||||
#include <Standard_Type.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(IFSelect_AppliedModifiers,Standard_Transient)
|
||||
|
||||
IFSelect_AppliedModifiers::IFSelect_AppliedModifiers
|
||||
(const Standard_Integer nbmax, const Standard_Integer nbent)
|
||||
: thelists (nbmax+1)
|
||||
{
|
||||
thenbent = nbent; theentcnt = 0;
|
||||
}
|
||||
|
||||
Standard_Boolean IFSelect_AppliedModifiers::AddModif
|
||||
(const Handle(IFSelect_GeneralModifier)& modif)
|
||||
{
|
||||
if (themodifs.Length() >= thelists.NbEntities()) return Standard_False;
|
||||
themodifs.Append(modif);
|
||||
thelists.SetNumber (themodifs.Length());
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
Standard_Boolean IFSelect_AppliedModifiers::AddNum
|
||||
(const Standard_Integer nument)
|
||||
{
|
||||
thelists.Add (nument);
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
|
||||
Standard_Integer IFSelect_AppliedModifiers::Count () const
|
||||
{ return themodifs.Length(); }
|
||||
|
||||
Standard_Boolean IFSelect_AppliedModifiers::Item
|
||||
(const Standard_Integer num,
|
||||
Handle(IFSelect_GeneralModifier)& modif,
|
||||
Standard_Integer& entcount)
|
||||
{
|
||||
if (num < 1 || num > themodifs.Length()) return Standard_False;
|
||||
modif = themodifs.Value(num);
|
||||
thelists.SetNumber (num);
|
||||
theentcnt = thelists.Length();
|
||||
entcount = (theentcnt > 0 ? theentcnt : thenbent);
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
Standard_Integer IFSelect_AppliedModifiers::ItemNum
|
||||
(const Standard_Integer nument) const
|
||||
{ return (theentcnt > 0 ? thelists.Value(nument) : nument); }
|
||||
|
||||
Handle(TColStd_HSequenceOfInteger) IFSelect_AppliedModifiers::ItemList () const
|
||||
{
|
||||
Handle(TColStd_HSequenceOfInteger) list = new TColStd_HSequenceOfInteger();
|
||||
Standard_Integer i, nb = (theentcnt > 0 ? theentcnt : thenbent);
|
||||
for (i = 1; i <= nb; i ++) list->Append (ItemNum(i));
|
||||
return list;
|
||||
}
|
||||
|
||||
Standard_Boolean IFSelect_AppliedModifiers::IsForAll () const
|
||||
{ return (theentcnt == 0); }
|
@@ -1,110 +0,0 @@
|
||||
// Created on: 1994-05-02
|
||||
// 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 _IFSelect_AppliedModifiers_HeaderFile
|
||||
#define _IFSelect_AppliedModifiers_HeaderFile
|
||||
|
||||
#include <Standard.hxx>
|
||||
|
||||
#include <IFSelect_SequenceOfGeneralModifier.hxx>
|
||||
#include <Interface_IntList.hxx>
|
||||
#include <Standard_Integer.hxx>
|
||||
#include <Standard_Transient.hxx>
|
||||
#include <TColStd_HSequenceOfInteger.hxx>
|
||||
class IFSelect_GeneralModifier;
|
||||
|
||||
class IFSelect_AppliedModifiers;
|
||||
DEFINE_STANDARD_HANDLE(IFSelect_AppliedModifiers, Standard_Transient)
|
||||
|
||||
//! This class allows to memorize and access to the modifiers
|
||||
//! which are to be applied to a file. To each modifier, is bound
|
||||
//! a list of integers (optional) : if this list is absent,
|
||||
//! the modifier applies to all the file. Else, it applies to the
|
||||
//! entities designated by these numbers in the produced file.
|
||||
//!
|
||||
//! To record a modifier, and a possible list of entity numbers to be applied on:
|
||||
//! AddModif (amodifier);
|
||||
//! loop on AddNum (anumber);
|
||||
//!
|
||||
//! To query it, Count gives the count of recorded modifiers, then for each one:
|
||||
//! Item (numodif, amodifier, entcount);
|
||||
//! IsForAll () -> can be called, if True, applies on the whole file
|
||||
//!
|
||||
//! for (i = 1; i <= entcount; i ++)
|
||||
//! nument = ItemNum (i); -> return an entity number
|
||||
class IFSelect_AppliedModifiers : public Standard_Transient
|
||||
{
|
||||
public:
|
||||
|
||||
//! Creates an AppliedModifiers, ready to record up to <nbmax>
|
||||
//! modifiers, on a model of <nbent> entities
|
||||
Standard_EXPORT IFSelect_AppliedModifiers(const Standard_Integer nbmax, const Standard_Integer nbent);
|
||||
|
||||
//! Records a modifier. By default, it is to apply on all a
|
||||
//! produced file. Further calls to AddNum will restrict this.
|
||||
//! Returns True if done, False if too many modifiers are already
|
||||
//! recorded
|
||||
Standard_EXPORT Standard_Boolean AddModif (const Handle(IFSelect_GeneralModifier)& modif);
|
||||
|
||||
//! Adds a number of entity of the output file to be applied on.
|
||||
//! If a sequence of AddNum is called after AddModif, this
|
||||
//! Modifier will be applied on the list of designated entities.
|
||||
//! Else, it will be applied on all the file
|
||||
//! Returns True if done, False if no modifier has yet been added
|
||||
Standard_EXPORT Standard_Boolean AddNum (const Standard_Integer nument);
|
||||
|
||||
//! Returns the count of recorded modifiers
|
||||
Standard_EXPORT Standard_Integer Count() const;
|
||||
|
||||
//! Returns the description for applied modifier n0 <num> :
|
||||
//! the modifier itself, and the count of entities to be applied
|
||||
//! on. If no specific list of number has been defined, returns
|
||||
//! the total count of entities of the file
|
||||
//! If this count is zero, then the modifier applies to all
|
||||
//! the file (see below). Else, the numbers are then queried by
|
||||
//! calls to ItemNum between 1 and <entcount>
|
||||
//! Returns True if OK, False if <num> is out of range
|
||||
Standard_EXPORT Standard_Boolean Item (const Standard_Integer num, Handle(IFSelect_GeneralModifier)& modif, Standard_Integer& entcount);
|
||||
|
||||
//! Returns a numero of entity to be applied on, given its rank
|
||||
//! in the list. If no list is defined (i.e. for all the file),
|
||||
//! returns <nument> itself, to give all the entities of the file
|
||||
//! Returns 0 if <nument> out of range
|
||||
Standard_EXPORT Standard_Integer ItemNum (const Standard_Integer nument) const;
|
||||
|
||||
//! Returns the list of entities to be applied on (see Item)
|
||||
//! as a HSequence (IsForAll produces the complete list of all
|
||||
//! the entity numbers of the file
|
||||
Standard_EXPORT Handle(TColStd_HSequenceOfInteger) ItemList() const;
|
||||
|
||||
//! Returns True if the applied modifier queried by last call to
|
||||
//! Item is to be applied to all the produced file.
|
||||
//! Else, <entcount> returned by Item gives the count of entity
|
||||
//! numbers, each one is queried by ItemNum
|
||||
Standard_EXPORT Standard_Boolean IsForAll() const;
|
||||
|
||||
DEFINE_STANDARD_RTTIEXT(IFSelect_AppliedModifiers,Standard_Transient)
|
||||
|
||||
private:
|
||||
|
||||
IFSelect_SequenceOfGeneralModifier themodifs;
|
||||
Interface_IntList thelists;
|
||||
Standard_Integer thenbent;
|
||||
Standard_Integer theentcnt;
|
||||
|
||||
};
|
||||
|
||||
#endif // _IFSelect_AppliedModifiers_HeaderFile
|
@@ -1,188 +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 <IFSelect_BasicDumper.hxx>
|
||||
#include <IFSelect_DispGlobal.hxx>
|
||||
#include <IFSelect_DispPerCount.hxx>
|
||||
#include <IFSelect_DispPerOne.hxx>
|
||||
#include <IFSelect_IntParam.hxx>
|
||||
#include <IFSelect_Modifier.hxx>
|
||||
#include <IFSelect_SelectDiff.hxx>
|
||||
#include <IFSelect_SelectEntityNumber.hxx>
|
||||
#include <IFSelect_SelectErrorEntities.hxx>
|
||||
#include <IFSelect_SelectIncorrectEntities.hxx>
|
||||
#include <IFSelect_SelectIntersection.hxx>
|
||||
#include <IFSelect_SelectModelEntities.hxx>
|
||||
#include <IFSelect_SelectModelRoots.hxx>
|
||||
#include <IFSelect_SelectPointed.hxx>
|
||||
#include <IFSelect_SelectRange.hxx>
|
||||
#include <IFSelect_SelectRootComps.hxx>
|
||||
#include <IFSelect_SelectRoots.hxx>
|
||||
#include <IFSelect_SelectShared.hxx>
|
||||
#include <IFSelect_SelectSharing.hxx>
|
||||
#include <IFSelect_SelectUnion.hxx>
|
||||
#include <IFSelect_SelectUnknownEntities.hxx>
|
||||
#include <IFSelect_SessionFile.hxx>
|
||||
#include <IFSelect_TransformStandard.hxx>
|
||||
#include <IFSelect_WorkSession.hxx>
|
||||
#include <Interface_Macros.hxx>
|
||||
#include <Standard_Transient.hxx>
|
||||
#include <Standard_Type.hxx>
|
||||
#include <TCollection_AsciiString.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(IFSelect_BasicDumper,IFSelect_SessionDumper)
|
||||
|
||||
//#include <IFSelect_SelectTextType.hxx>
|
||||
#define FIRSTCHAR 1
|
||||
// Param litteral "own" sous la forme :"<val>" -> first = 3
|
||||
// A present, forme simplifiee : <val> directement -> first = 1
|
||||
|
||||
|
||||
|
||||
IFSelect_BasicDumper::IFSelect_BasicDumper () { }
|
||||
|
||||
Standard_Boolean IFSelect_BasicDumper::WriteOwn
|
||||
(IFSelect_SessionFile& file, const Handle(Standard_Transient)& item) const
|
||||
{
|
||||
Handle(Standard_Type) type = item->DynamicType();
|
||||
if (type == STANDARD_TYPE(IFSelect_SelectModelRoots)) return Standard_True;
|
||||
if (type == STANDARD_TYPE(IFSelect_SelectModelEntities)) return Standard_True;
|
||||
if (type == STANDARD_TYPE(IFSelect_SelectEntityNumber)) {
|
||||
DeclareAndCast(IFSelect_SelectEntityNumber,sen,item);
|
||||
file.SendItem(sen->Number());
|
||||
return Standard_True;
|
||||
}
|
||||
if (type == STANDARD_TYPE(IFSelect_SelectPointed)) return Standard_True;
|
||||
if (type == STANDARD_TYPE(IFSelect_SelectUnion)) return Standard_True;
|
||||
if (type == STANDARD_TYPE(IFSelect_SelectIntersection)) return Standard_True;
|
||||
if (type == STANDARD_TYPE(IFSelect_SelectDiff)) return Standard_True;
|
||||
if (type == STANDARD_TYPE(IFSelect_SelectUnknownEntities)) return Standard_True;
|
||||
if (type == STANDARD_TYPE(IFSelect_SelectErrorEntities)) return Standard_True;
|
||||
if (type == STANDARD_TYPE(IFSelect_SelectIncorrectEntities)) return Standard_True;
|
||||
if (type == STANDARD_TYPE(IFSelect_SelectRoots)) return Standard_True;
|
||||
if (type == STANDARD_TYPE(IFSelect_SelectRootComps)) return Standard_True;
|
||||
if (type == STANDARD_TYPE(IFSelect_SelectRange)) {
|
||||
DeclareAndCast(IFSelect_SelectRange,sra,item);
|
||||
file.SendItem(sra->Lower());
|
||||
file.SendItem(sra->Upper());
|
||||
return Standard_True;
|
||||
}
|
||||
if (type == STANDARD_TYPE(IFSelect_SelectShared)) return Standard_True;
|
||||
if (type == STANDARD_TYPE(IFSelect_SelectSharing)) return Standard_True;
|
||||
|
||||
if (type == STANDARD_TYPE(IFSelect_DispPerOne)) return Standard_True;
|
||||
if (type == STANDARD_TYPE(IFSelect_DispGlobal)) return Standard_True;
|
||||
if (type == STANDARD_TYPE(IFSelect_DispPerCount)) {
|
||||
DeclareAndCast(IFSelect_DispPerCount,dpc,item);
|
||||
file.SendItem(dpc->Count());
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
if (type == STANDARD_TYPE(IFSelect_TransformStandard)) {
|
||||
DeclareAndCast(IFSelect_TransformStandard,trs,item);
|
||||
if (trs->CopyOption()) file.SendText("copy");
|
||||
else file.SendText("onthespot");
|
||||
Standard_Integer nbm = trs->NbModifiers();
|
||||
for (Standard_Integer i = 1; i <= nbm; i ++)
|
||||
file.SendItem(trs->Modifier(i));
|
||||
}
|
||||
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
Standard_Boolean IFSelect_BasicDumper::ReadOwn
|
||||
(IFSelect_SessionFile& file, const TCollection_AsciiString& type,
|
||||
Handle(Standard_Transient)& item) const
|
||||
{
|
||||
if (type.IsEqual("IFSelect_SelectModelRoots"))
|
||||
{ item = new IFSelect_SelectModelRoots (); return Standard_True; }
|
||||
if (type.IsEqual("IFSelect_SelectModelEntities"))
|
||||
{ item = new IFSelect_SelectModelEntities (); return Standard_True; }
|
||||
if (type.IsEqual("IFSelect_SelectEntityNumber")) {
|
||||
Handle(IFSelect_SelectEntityNumber) sen =
|
||||
new IFSelect_SelectEntityNumber ();
|
||||
sen->SetNumber (GetCasted(IFSelect_IntParam,file.ItemValue(1)));
|
||||
item = sen;
|
||||
return Standard_True;
|
||||
}
|
||||
if (type.IsEqual("IFSelect_SelectPointed"))
|
||||
{ item = new IFSelect_SelectPointed; return Standard_True; }
|
||||
if (type.IsEqual("IFSelect_SelectUnion"))
|
||||
{ item = new IFSelect_SelectUnion; return Standard_True; }
|
||||
if (type.IsEqual("IFSelect_SelectIntersection"))
|
||||
{ item = new IFSelect_SelectIntersection; return Standard_True; }
|
||||
if (type.IsEqual("IFSelect_SelectDiff"))
|
||||
{ item = new IFSelect_SelectDiff; return Standard_True; }
|
||||
if (type.IsEqual("IFSelect_SelectUnknownEntities"))
|
||||
{ item = new IFSelect_SelectUnknownEntities; return Standard_True; }
|
||||
if (type.IsEqual("IFSelect_SelectErrorEntities"))
|
||||
{ item = new IFSelect_SelectErrorEntities; return Standard_True; }
|
||||
if (type.IsEqual("IFSelect_SelectIncorrectEntities"))
|
||||
{ item = new IFSelect_SelectIncorrectEntities; return Standard_True; }
|
||||
if (type.IsEqual("IFSelect_SelectRoots"))
|
||||
{ item = new IFSelect_SelectRoots; return Standard_True; }
|
||||
if (type.IsEqual("IFSelect_SelectRootComps"))
|
||||
{ item = new IFSelect_SelectRootComps; return Standard_True; }
|
||||
if (type.IsEqual("IFSelect_SelectRange")) {
|
||||
Handle(IFSelect_SelectRange) sra = new IFSelect_SelectRange;
|
||||
sra->SetRange (GetCasted(IFSelect_IntParam,file.ItemValue(1)),
|
||||
GetCasted(IFSelect_IntParam,file.ItemValue(2)) );
|
||||
item = sra;
|
||||
return Standard_True;
|
||||
}
|
||||
if (type.IsEqual("IFSelect_SelectTextType")) {
|
||||
const TCollection_AsciiString exname = file.ParamValue(1);
|
||||
if (exname.Length() < FIRSTCHAR) return Standard_False;
|
||||
if (exname.Value(FIRSTCHAR) == 'e') {}
|
||||
else if (exname.Value(FIRSTCHAR) == 'c') {}
|
||||
else return Standard_False;
|
||||
// item = new IFSelect_SelectTextType (file.TextValue(2).ToCString(),exact);
|
||||
// return Standard_True;
|
||||
}
|
||||
if (type.IsEqual("IFSelect_SelectShared"))
|
||||
{ item = new IFSelect_SelectShared; return Standard_True; }
|
||||
if (type.IsEqual("IFSelect_SelectSharing"))
|
||||
{ item = new IFSelect_SelectSharing; return Standard_True; }
|
||||
|
||||
if (type.IsEqual("IFSelect_DispPerOne"))
|
||||
{ item = new IFSelect_DispPerOne; return Standard_True; }
|
||||
if (type.IsEqual("IFSelect_DispGlobal"))
|
||||
{ item = new IFSelect_DispGlobal; return Standard_True; }
|
||||
if (type.IsEqual("IFSelect_DispPerCount")) {
|
||||
Handle(IFSelect_DispPerCount) dpc = new IFSelect_DispPerCount;
|
||||
dpc->SetCount (GetCasted(IFSelect_IntParam,file.ItemValue(1)) );
|
||||
item = dpc;
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
if (type.IsEqual("IFSelect_TransformStandard")) {
|
||||
Standard_Boolean copyoption;
|
||||
const TCollection_AsciiString copyname = file.ParamValue(1);
|
||||
if (copyname.Length() < FIRSTCHAR) return Standard_False;
|
||||
if (copyname.Value(FIRSTCHAR) == 'c') copyoption = Standard_True;
|
||||
else if (copyname.Value(FIRSTCHAR) == 'o') copyoption = Standard_False;
|
||||
else return Standard_False;
|
||||
Handle(IFSelect_TransformStandard) trs = new IFSelect_TransformStandard;
|
||||
trs->SetCopyOption(copyoption);
|
||||
Standard_Integer nbp = file.NbParams();
|
||||
for (Standard_Integer i = 2; i <= nbp; i ++) {
|
||||
DeclareAndCast(IFSelect_Modifier,modif,file.ItemValue(i));
|
||||
if (!modif.IsNull()) trs->AddModifier(modif);
|
||||
}
|
||||
item = trs;
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
return Standard_False;
|
||||
}
|
@@ -1,75 +0,0 @@
|
||||
// Created on: 1993-11-04
|
||||
// Created by: Christian CAILLET
|
||||
// Copyright (c) 1993-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 _IFSelect_BasicDumper_HeaderFile
|
||||
#define _IFSelect_BasicDumper_HeaderFile
|
||||
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_Type.hxx>
|
||||
|
||||
#include <IFSelect_SessionDumper.hxx>
|
||||
class IFSelect_SessionFile;
|
||||
class Standard_Transient;
|
||||
class TCollection_AsciiString;
|
||||
|
||||
|
||||
class IFSelect_BasicDumper;
|
||||
DEFINE_STANDARD_HANDLE(IFSelect_BasicDumper, IFSelect_SessionDumper)
|
||||
|
||||
//! BasicDumper takes into account, for SessionFile, all the
|
||||
//! classes defined in the package IFSelect : Selections,
|
||||
//! Dispatches (there is no Modifier)
|
||||
class IFSelect_BasicDumper : public IFSelect_SessionDumper
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
|
||||
//! Creates a BasicDumper and puts it into the Library of Dumper
|
||||
Standard_EXPORT IFSelect_BasicDumper();
|
||||
|
||||
//! Write the Own Parameters of Types defined in package IFSelect
|
||||
//! Returns True if <item> has been processed, False else
|
||||
Standard_EXPORT Standard_Boolean WriteOwn (IFSelect_SessionFile& file, const Handle(Standard_Transient)& item) const Standard_OVERRIDE;
|
||||
|
||||
//! Recognizes and Read Own Parameters for Types of package
|
||||
//! IFSelect. Returns True if done and <item> created, False else
|
||||
Standard_EXPORT Standard_Boolean ReadOwn (IFSelect_SessionFile& file, const TCollection_AsciiString& type, Handle(Standard_Transient)& item) const Standard_OVERRIDE;
|
||||
|
||||
|
||||
|
||||
|
||||
DEFINE_STANDARD_RTTIEXT(IFSelect_BasicDumper,IFSelect_SessionDumper)
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // _IFSelect_BasicDumper_HeaderFile
|
@@ -1,99 +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 <IFSelect_CheckCounter.hxx>
|
||||
#include <Interface_CheckIterator.hxx>
|
||||
#include <Interface_InterfaceModel.hxx>
|
||||
#include <MoniTool_SignText.hxx>
|
||||
#include <Standard_Transient.hxx>
|
||||
#include <Standard_Type.hxx>
|
||||
|
||||
#include <stdio.h>
|
||||
IMPLEMENT_STANDARD_RTTIEXT(IFSelect_CheckCounter,IFSelect_SignatureList)
|
||||
|
||||
//=======================================================================
|
||||
//function : IFSelect_CheckCounter
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
IFSelect_CheckCounter::IFSelect_CheckCounter(const Standard_Boolean withlist)
|
||||
: IFSelect_SignatureList (withlist)
|
||||
{
|
||||
SetName("Check");
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : SetSignature
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void IFSelect_CheckCounter::SetSignature(const Handle(MoniTool_SignText)& sign)
|
||||
{
|
||||
thesign = sign;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Signature
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Handle(MoniTool_SignText) IFSelect_CheckCounter::Signature () const
|
||||
{
|
||||
return thesign;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Analyse
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void IFSelect_CheckCounter::Analyse(const Interface_CheckIterator& list,
|
||||
const Handle(Interface_InterfaceModel)& model,
|
||||
const Standard_Boolean original,
|
||||
const Standard_Boolean failsonly)
|
||||
{
|
||||
Standard_Integer i,nb,num, nbe = (model.IsNull() ? 0 : model->NbEntities());
|
||||
char mess[300];
|
||||
sprintf (mess,"Check %s",list.Name());
|
||||
SetName (mess);
|
||||
for (list.Start(); list.More(); list.Next()) {
|
||||
num = list.Number();
|
||||
Handle(Standard_Transient) ent;
|
||||
const Handle(Interface_Check) check = list.Value();
|
||||
ent = check->Entity();
|
||||
if (ent.IsNull() && num > 0 && num <= nbe) ent = model->Value(num);
|
||||
nb = check->NbFails();
|
||||
Standard_CString tystr = NULL;
|
||||
if (!ent.IsNull()) {
|
||||
if (!thesign.IsNull()) tystr = thesign->Text (ent,model).ToCString();
|
||||
else if (!model.IsNull()) tystr = model->TypeName (ent);
|
||||
else tystr =
|
||||
Interface_InterfaceModel::ClassName(ent->DynamicType()->Name());
|
||||
}
|
||||
for (i = 1; i <= nb; i ++) {
|
||||
if (ent.IsNull()) sprintf(mess,"F: %s",check->CFail(i,original));
|
||||
else sprintf(mess,"F:%s: %s",tystr,check->CFail(i,original));
|
||||
Add (ent,mess);
|
||||
}
|
||||
nb = 0;
|
||||
if (!failsonly) nb = check->NbWarnings();
|
||||
for (i = 1; i <= nb; i ++) {
|
||||
if (ent.IsNull()) sprintf(mess,"W: %s",check->CWarning(i,original));
|
||||
else sprintf(mess,"W:%s: %s",tystr,check->CWarning(i,original));
|
||||
Add (ent,mess);
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,85 +0,0 @@
|
||||
// Created on: 1994-11-07
|
||||
// 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 _IFSelect_CheckCounter_HeaderFile
|
||||
#define _IFSelect_CheckCounter_HeaderFile
|
||||
|
||||
#include <Standard.hxx>
|
||||
|
||||
#include <IFSelect_SignatureList.hxx>
|
||||
class MoniTool_SignText;
|
||||
class Interface_CheckIterator;
|
||||
class Interface_InterfaceModel;
|
||||
|
||||
|
||||
class IFSelect_CheckCounter;
|
||||
DEFINE_STANDARD_HANDLE(IFSelect_CheckCounter, IFSelect_SignatureList)
|
||||
|
||||
//! A CheckCounter allows to see a CheckList (i.e. CheckIterator)
|
||||
//! not per entity, its messages, but per message, the entities
|
||||
//! attached (count and list). Because many messages can be
|
||||
//! repeated if they are due to systematic errors
|
||||
class IFSelect_CheckCounter : public IFSelect_SignatureList
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
|
||||
//! Creates a CheckCounter, empty ready to work
|
||||
Standard_EXPORT IFSelect_CheckCounter(const Standard_Boolean withlist = Standard_False);
|
||||
|
||||
//! Sets a specific signature
|
||||
//! Else, the current SignType (in the model) is used
|
||||
Standard_EXPORT void SetSignature (const Handle(MoniTool_SignText)& sign);
|
||||
|
||||
//! Returns the Signature;
|
||||
Standard_EXPORT Handle(MoniTool_SignText) Signature() const;
|
||||
|
||||
//! Analyses a CheckIterator according a Model (which detains the
|
||||
//! entities for which the CheckIterator has messages), i.e.
|
||||
//! counts messages for entities
|
||||
//! If <original> is True, does not consider final messages but
|
||||
//! those before interpretation (such as inserting variables :
|
||||
//! integers, reals, strings)
|
||||
//! If <failsonly> is True, only Fails are considered
|
||||
//! Remark : global messages are recorded with a Null entity
|
||||
Standard_EXPORT void Analyse (const Interface_CheckIterator& list, const Handle(Interface_InterfaceModel)& model, const Standard_Boolean original = Standard_False, const Standard_Boolean failsonly = Standard_False);
|
||||
|
||||
|
||||
|
||||
|
||||
DEFINE_STANDARD_RTTIEXT(IFSelect_CheckCounter,IFSelect_SignatureList)
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
||||
Handle(MoniTool_SignText) thesign;
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // _IFSelect_CheckCounter_HeaderFile
|
@@ -1,464 +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 <IFSelect_ContextModif.hxx>
|
||||
#include <IFSelect_GeneralModifier.hxx>
|
||||
#include <IFSelect_Selection.hxx>
|
||||
#include <Interface_Check.hxx>
|
||||
#include <Interface_CheckIterator.hxx>
|
||||
#include <Interface_CopyControl.hxx>
|
||||
#include <Interface_CopyTool.hxx>
|
||||
#include <Interface_EntityIterator.hxx>
|
||||
#include <Interface_Graph.hxx>
|
||||
#include <Interface_InterfaceModel.hxx>
|
||||
#include <Interface_Protocol.hxx>
|
||||
#include <Message.hxx>
|
||||
#include <Message_Messenger.hxx>
|
||||
#include <Standard_NoSuchObject.hxx>
|
||||
#include <Standard_Transient.hxx>
|
||||
|
||||
//=======================================================================
|
||||
//function : IFSelect_ContextModif
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
IFSelect_ContextModif::IFSelect_ContextModif(const Interface_Graph& graph,
|
||||
const Interface_CopyTool& TC,
|
||||
const Standard_CString filename)
|
||||
: thegraf (graph,Standard_False) , thefile (filename) ,
|
||||
thelist (graph.Size(),' ')
|
||||
{
|
||||
themap = TC.Control(); thesel = Standard_False; thecurr = thecurt = 0;
|
||||
Standard_Integer nb = thelist.Length();
|
||||
Handle(Standard_Transient) newent;
|
||||
for (Standard_Integer i = 1; i <= nb; i ++) {
|
||||
if (themap->Search(graph.Entity(i),newent)) thelist.SetValue(i,'1');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : IFSelect_ContextModif
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
IFSelect_ContextModif::IFSelect_ContextModif(const Interface_Graph& graph,
|
||||
const Standard_CString filename)
|
||||
: thegraf (graph,Standard_False) , thefile (filename) ,
|
||||
thelist (graph.Size(),' ')
|
||||
{
|
||||
thesel = Standard_False; thecurr = thecurt = 0;
|
||||
Standard_Integer nb = thelist.Length();
|
||||
Handle(Standard_Transient) newent;
|
||||
for (Standard_Integer i = 1; i <= nb; i ++) thelist.SetValue(i,'1');
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Select
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void IFSelect_ContextModif::Select (Interface_EntityIterator& list)
|
||||
{
|
||||
thesel = Standard_True;
|
||||
Standard_Integer nb = thelist.Length();
|
||||
for (Standard_Integer i = 1; i <= nb; i ++) thelist.SetValue(i,' ');
|
||||
for (list.Start(); list.More(); list.Next()) {
|
||||
Handle(Standard_Transient) start,newent;
|
||||
start = list.Value();
|
||||
Standard_Integer num = thegraf.EntityNumber(start);
|
||||
if (num > nb || num < 0) num = 0;
|
||||
if (themap.IsNull() && num > 0) thelist.SetValue(num,'1');
|
||||
else if (themap->Search (start,newent)) {
|
||||
if (num > 0) thelist.SetValue(num,'1');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : OriginalGraph
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
const Interface_Graph& IFSelect_ContextModif::OriginalGraph () const
|
||||
{
|
||||
return thegraf;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : OriginalModel
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Handle(Interface_InterfaceModel) IFSelect_ContextModif::OriginalModel() const
|
||||
{
|
||||
return thegraf.Model();
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : SetProtocol
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void IFSelect_ContextModif::SetProtocol(const Handle(Interface_Protocol)& prot)
|
||||
{
|
||||
theprot = prot;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Protocol
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Handle(Interface_Protocol) IFSelect_ContextModif::Protocol() const
|
||||
{
|
||||
return theprot;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : HasFileName
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean IFSelect_ContextModif::HasFileName() const
|
||||
{
|
||||
return (thefile.Length() > 0);
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : FileName
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_CString IFSelect_ContextModif::FileName () const
|
||||
{
|
||||
return thefile.ToCString();
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Control
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Handle(Interface_CopyControl) IFSelect_ContextModif::Control () const
|
||||
{
|
||||
return themap;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : IsForNone
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean IFSelect_ContextModif::IsForNone () const
|
||||
{
|
||||
if (!thesel) return Standard_False;
|
||||
Standard_Integer nb = thelist.Length();
|
||||
for (Standard_Integer i = 1; i <= nb; i ++) {
|
||||
if (thelist.Value(i) != ' ') return Standard_False;
|
||||
}
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : IsForAll
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean IFSelect_ContextModif::IsForAll () const
|
||||
{
|
||||
return (!thesel);
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : IsTransferred
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean IFSelect_ContextModif::IsTransferred
|
||||
(const Handle(Standard_Transient)& ent) const
|
||||
{
|
||||
if (themap.IsNull()) return Standard_True;
|
||||
Handle(Standard_Transient) newent;
|
||||
return themap->Search(ent,newent);
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : IsSelected
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean IFSelect_ContextModif::IsSelected
|
||||
(const Handle(Standard_Transient)& ent) const
|
||||
{
|
||||
// Select a deja verifie "IsTransferred"
|
||||
Standard_Integer num = thegraf.EntityNumber(ent);
|
||||
if (num == 0) return Standard_False;
|
||||
return (thelist.Value(num) != ' ');
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : SelectedOriginal
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Interface_EntityIterator IFSelect_ContextModif::SelectedOriginal () const
|
||||
{
|
||||
Interface_EntityIterator list;
|
||||
Standard_Integer nb = thelist.Length();
|
||||
for (Standard_Integer i = 1; i <= nb; i ++) {
|
||||
if (thelist.Value(i) != ' ') list.GetOneItem (thegraf.Entity(i));
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : SelectedResult
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Interface_EntityIterator IFSelect_ContextModif::SelectedResult () const
|
||||
{
|
||||
Interface_EntityIterator list;
|
||||
Standard_Integer nb = thelist.Length();
|
||||
for (Standard_Integer i = 1; i <= nb; i ++) {
|
||||
Handle(Standard_Transient) newent;
|
||||
if (themap.IsNull()) newent = thegraf.Entity(i);
|
||||
else if (thelist.Value(i) != ' ') themap->Search (thegraf.Entity(i),newent);
|
||||
if (!newent.IsNull()) list.GetOneItem (newent);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : SelectedCount
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Integer IFSelect_ContextModif::SelectedCount () const
|
||||
{
|
||||
Standard_Integer nb = thelist.Length();
|
||||
Standard_Integer ns = 0;
|
||||
for (Standard_Integer i = 1; i <= nb; i ++)
|
||||
{ if (thelist.Value(i) != ' ') ns ++; }
|
||||
return ns;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Start
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void IFSelect_ContextModif::Start ()
|
||||
{
|
||||
thecurr = thecurt = 0;
|
||||
Next();
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : More
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean IFSelect_ContextModif::More () const
|
||||
{
|
||||
return (thecurr > 0);
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Next
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void IFSelect_ContextModif::Next()
|
||||
{
|
||||
Standard_Integer nb = thelist.Length();
|
||||
// thecurr = thecurt;
|
||||
// if (thecurr <= 0 && thecurt >= 0) return;
|
||||
for (Standard_Integer i = thecurr+1; i <= nb; i ++) {
|
||||
if (thelist.Value(i) != ' ') { thecurr = i; thecurt ++; return; }
|
||||
}
|
||||
thecurr = thecurt = 0;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : ValueOriginal
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Handle(Standard_Transient) IFSelect_ContextModif::ValueOriginal () const
|
||||
{
|
||||
if (thecurr <= 0) throw Standard_NoSuchObject("IFSelect_ContextModif");
|
||||
return thegraf.Entity(thecurr);
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : ValueResult
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Handle(Standard_Transient) IFSelect_ContextModif::ValueResult () const
|
||||
{
|
||||
if (thecurr <= 0) throw Standard_NoSuchObject("IFSelect_ContextModif");
|
||||
Handle(Standard_Transient) ent,newent;
|
||||
ent = thegraf.Entity(thecurr);
|
||||
if (themap.IsNull()) newent = ent;
|
||||
else themap->Search(ent,newent);
|
||||
return newent;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : TraceModifier
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void IFSelect_ContextModif::TraceModifier
|
||||
(const Handle(IFSelect_GeneralModifier)& modif)
|
||||
{
|
||||
if (modif.IsNull()) return;
|
||||
|
||||
Message_Messenger::StreamBuffer sout = Message::SendInfo();
|
||||
sout << "--- Run Modifier:" << std::endl;
|
||||
Handle(IFSelect_Selection) sel = modif->Selection();
|
||||
if (!sel.IsNull()) sout<<" Selection:"<<sel->Label();
|
||||
else sout<<" (no Selection)";
|
||||
|
||||
// on va simplement compter les entites
|
||||
Standard_Integer ne = 0, nb = thelist.Length();
|
||||
for (Standard_Integer i = 1; i <= nb; i ++) {
|
||||
if (thelist.Value(i) != ' ') ne ++;
|
||||
}
|
||||
if (nb == ne) sout<<" All Model ("<<nb<<" Entities)"<<std::endl;
|
||||
else sout<<" Entities,Total:"<<nb<<" Concerned:"<<ne<<std::endl;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Trace
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void IFSelect_ContextModif::Trace (const Standard_CString mess)
|
||||
{
|
||||
// Trace courante
|
||||
if (thecurr <= 0) return;
|
||||
Message_Messenger::StreamBuffer sout = Message::SendInfo();
|
||||
if (ValueOriginal() == ValueResult())
|
||||
sout<<"-- ContextModif. Entity n0 "<<thecurr<<std::endl;
|
||||
else
|
||||
sout<<"-- ContextModif. Entity in Original, n0 "<<thecurr<<" in Result, n0 "
|
||||
<<thecurt<<std::endl;
|
||||
if (mess[0] != '\0') sout<<"-- Message:"<<mess<<std::endl;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : AddCheck
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void IFSelect_ContextModif::AddCheck(const Handle(Interface_Check)& check)
|
||||
{
|
||||
if (check->NbFails() + check->NbWarnings() == 0) return;
|
||||
const Handle(Standard_Transient)& ent = check->Entity();
|
||||
Standard_Integer num = thegraf.EntityNumber(ent);
|
||||
if (num == 0 && !ent.IsNull()) num = -1; // force enregistrement
|
||||
thechek.Add(check,num);
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : AddWarning
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void IFSelect_ContextModif::AddWarning(const Handle(Standard_Transient)& start,
|
||||
const Standard_CString mess,
|
||||
const Standard_CString orig)
|
||||
{
|
||||
thechek.CCheck(thegraf.EntityNumber(start))->AddWarning(mess,orig);
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : AddFail
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void IFSelect_ContextModif::AddFail(const Handle(Standard_Transient)& start,
|
||||
const Standard_CString mess,
|
||||
const Standard_CString orig)
|
||||
{
|
||||
thechek.CCheck(thegraf.EntityNumber(start))->AddFail(mess,orig);
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : CCheck
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Handle(Interface_Check) IFSelect_ContextModif::CCheck(const Standard_Integer num)
|
||||
{
|
||||
Handle(Interface_Check) ach = thechek.CCheck(num);
|
||||
if (num > 0 && num <= thegraf.Size()) ach->SetEntity(thegraf.Entity(num));
|
||||
return ach;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : CCheck
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Handle(Interface_Check) IFSelect_ContextModif::CCheck
|
||||
(const Handle(Standard_Transient)& ent)
|
||||
{
|
||||
Standard_Integer num = thegraf.EntityNumber(ent);
|
||||
if (num == 0) num = -1; // force l enregistrement
|
||||
Handle(Interface_Check)& ach = thechek.CCheck(num);
|
||||
ach->SetEntity(ent);
|
||||
return ach;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : CheckList
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Interface_CheckIterator IFSelect_ContextModif::CheckList () const
|
||||
{
|
||||
return thechek;
|
||||
}
|
@@ -1,218 +0,0 @@
|
||||
// Created on: 1994-06-08
|
||||
// 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 _IFSelect_ContextModif_HeaderFile
|
||||
#define _IFSelect_ContextModif_HeaderFile
|
||||
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_DefineAlloc.hxx>
|
||||
#include <Standard_Handle.hxx>
|
||||
|
||||
#include <Interface_Graph.hxx>
|
||||
#include <TCollection_AsciiString.hxx>
|
||||
#include <Interface_CheckIterator.hxx>
|
||||
#include <Standard_Boolean.hxx>
|
||||
#include <Standard_Integer.hxx>
|
||||
class Interface_Protocol;
|
||||
class Interface_CopyControl;
|
||||
class Interface_CopyTool;
|
||||
class Interface_EntityIterator;
|
||||
class Interface_InterfaceModel;
|
||||
class Standard_Transient;
|
||||
class IFSelect_GeneralModifier;
|
||||
class Interface_Check;
|
||||
|
||||
|
||||
//! This class gathers various information used by Model Modifiers
|
||||
//! apart from the target model itself, and the CopyTool which
|
||||
//! must be passed directly.
|
||||
//!
|
||||
//! These information report to original data : model, entities,
|
||||
//! and the selection list if there is one : it allows to query
|
||||
//! about such or such starting entity, or result entity, or
|
||||
//! iterate on selection list ...
|
||||
//! Also data useful for file output are available (because some
|
||||
//! Modifiers concern models produced for file output).
|
||||
//!
|
||||
//! Furthermore, in return, ContextModif can record Checks, either
|
||||
//! one for all, or one for each Entity. It supports trace too.
|
||||
class IFSelect_ContextModif
|
||||
{
|
||||
public:
|
||||
|
||||
DEFINE_STANDARD_ALLOC
|
||||
|
||||
//! Prepares a ContextModif with these information :
|
||||
//! - the graph established from original model (target passed
|
||||
//! directly to Modifier)
|
||||
//! - the CopyTool which detains the CopyControl, which maps
|
||||
//! starting (in original) and result (in target) entities
|
||||
//! - an optional file name (for file output)
|
||||
//!
|
||||
//! Such a ContextModif is considered to be applied on all
|
||||
//! transferred entities (no filter active)
|
||||
Standard_EXPORT IFSelect_ContextModif(const Interface_Graph& graph, const Interface_CopyTool& TC, const Standard_CString filename = "");
|
||||
|
||||
//! Prepares a ContextModif with these information :
|
||||
//! - the graph established from original model (target passed
|
||||
//! directly to Modifier)
|
||||
//! - an optional file name (for file output)
|
||||
//! Here, no CopyControl, hence all entities are considered equal
|
||||
//! as starting and result
|
||||
//!
|
||||
//! Such a ContextModif is considered to be applied on all
|
||||
//! transferred entities (no filter active)
|
||||
Standard_EXPORT IFSelect_ContextModif(const Interface_Graph& graph, const Standard_CString filename = "");
|
||||
|
||||
//! This method requires ContextModif to be applied with a filter.
|
||||
//! If a ModelModifier is defined with a Selection criterium,
|
||||
//! the result of this Selection is used as a filter :
|
||||
//! - if none of its items has been transferred, the modification
|
||||
//! does not apply at all
|
||||
//! - else, the Modifier can query for what entities were selected
|
||||
//! and what are their results
|
||||
//! - if this method is not called before working, the Modifier
|
||||
//! has to work on the whole Model
|
||||
Standard_EXPORT void Select (Interface_EntityIterator& list);
|
||||
|
||||
//! Returns the original Graph (compared to OriginalModel, it
|
||||
//! gives more query capabilitites)
|
||||
Standard_EXPORT const Interface_Graph& OriginalGraph() const;
|
||||
|
||||
//! Returns the original model
|
||||
Standard_EXPORT Handle(Interface_InterfaceModel) OriginalModel() const;
|
||||
|
||||
//! Allows to transmit a Protocol as part of a ContextModif
|
||||
Standard_EXPORT void SetProtocol (const Handle(Interface_Protocol)& proto);
|
||||
|
||||
//! Returns the Protocol (Null if not set)
|
||||
Standard_EXPORT Handle(Interface_Protocol) Protocol() const;
|
||||
|
||||
//! Returns True if a non empty file name has been defined
|
||||
Standard_EXPORT Standard_Boolean HasFileName() const;
|
||||
|
||||
//! Returns File Name (can be empty)
|
||||
Standard_EXPORT Standard_CString FileName() const;
|
||||
|
||||
//! Returns the map for a direct use, if required
|
||||
Standard_EXPORT Handle(Interface_CopyControl) Control() const;
|
||||
|
||||
//! Returns True if Select has determined that a Modifier may not
|
||||
//! be run (filter defined and empty)
|
||||
Standard_EXPORT Standard_Boolean IsForNone() const;
|
||||
|
||||
//! Returns True if no filter is defined : a Modifier has to work
|
||||
//! on all entities of the resulting (target) model
|
||||
Standard_EXPORT Standard_Boolean IsForAll() const;
|
||||
|
||||
//! Returns True if a starting item has been transferred
|
||||
Standard_EXPORT Standard_Boolean IsTransferred (const Handle(Standard_Transient)& ent) const;
|
||||
|
||||
//! Returns True if a starting item has been transferred and selected
|
||||
Standard_EXPORT Standard_Boolean IsSelected (const Handle(Standard_Transient)& ent) const;
|
||||
|
||||
//! Returns True if a starting entity has been transferred, and
|
||||
//! the result is in <res>. Returns False else
|
||||
//! (direct call to the map)
|
||||
Standard_EXPORT Standard_Boolean Search (const Handle(Standard_Transient)& ent, Handle(Standard_Transient)& res) const;
|
||||
|
||||
//! Returns the list of original selected items.
|
||||
//! See also the iteration
|
||||
Standard_EXPORT Interface_EntityIterator SelectedOriginal() const;
|
||||
|
||||
//! Returns the list of resulting counterparts of selected items.
|
||||
//! See also the iteration
|
||||
Standard_EXPORT Interface_EntityIterator SelectedResult() const;
|
||||
|
||||
//! Returns the count of selected and transferred items
|
||||
Standard_EXPORT Standard_Integer SelectedCount() const;
|
||||
|
||||
//! Starts an iteration on selected items. It takes into account
|
||||
//! IsForAll/IsForNone, by really iterating on all selected items.
|
||||
Standard_EXPORT void Start();
|
||||
|
||||
//! Returns True until the iteration has finished
|
||||
Standard_EXPORT Standard_Boolean More() const;
|
||||
|
||||
//! Advances the iteration
|
||||
Standard_EXPORT void Next();
|
||||
|
||||
//! Returns the current selected item in the original model
|
||||
Standard_EXPORT Handle(Standard_Transient) ValueOriginal() const;
|
||||
|
||||
//! Returns the result counterpart of current selected item
|
||||
//! (in the target model)
|
||||
Standard_EXPORT Handle(Standard_Transient) ValueResult() const;
|
||||
|
||||
//! Traces the application of a Modifier. Works with default trace
|
||||
//! File and Level. Fills the trace if default trace level is at
|
||||
//! least 1. Traces the Modifier (its Label) and its Selection if
|
||||
//! there is one (its Label).
|
||||
//! To be called after Select (because status IsForAll is printed)
|
||||
//! Worths to trace a global modification. See also Trace below
|
||||
Standard_EXPORT void TraceModifier (const Handle(IFSelect_GeneralModifier)& modif);
|
||||
|
||||
//! Traces the modification of the current entity (see above,
|
||||
//! ValueOriginal and ValueResult) for default trace level >= 2.
|
||||
//! To be called on each individual entity really modified
|
||||
//! <mess> is an optional additional message
|
||||
Standard_EXPORT void Trace (const Standard_CString mess = "");
|
||||
|
||||
//! Adds a Check to the CheckList. If it is empty, nothing is done
|
||||
//! If it concerns an Entity from the Original Model (by SetEntity)
|
||||
//! to which another Check is attached, it is merged to it.
|
||||
//! Else, it is added or merged as to GlobalCheck.
|
||||
Standard_EXPORT void AddCheck (const Handle(Interface_Check)& check);
|
||||
|
||||
//! Adds a Warning Message for an Entity from the original Model
|
||||
//! If <start> is not an Entity from the original model (e.g. the
|
||||
//! model itself) this message is added to Global Check.
|
||||
Standard_EXPORT void AddWarning (const Handle(Standard_Transient)& start, const Standard_CString mess, const Standard_CString orig = "");
|
||||
|
||||
//! Adds a Fail Message for an Entity from the original Model
|
||||
//! If <start> is not an Entity from the original model (e.g. the
|
||||
//! model itself) this message is added to Global Check.
|
||||
Standard_EXPORT void AddFail (const Handle(Standard_Transient)& start, const Standard_CString mess, const Standard_CString orig = "");
|
||||
|
||||
//! Returns a Check given an Entity number (in the original Model)
|
||||
//! by default a Global Check. Creates it the first time.
|
||||
//! It can then be acknowledged on the spot, in condition that the
|
||||
//! caller works by reference ("Interface_Check& check = ...")
|
||||
Standard_EXPORT Handle(Interface_Check) CCheck (const Standard_Integer num = 0);
|
||||
|
||||
//! Returns a Check attached to an Entity from the original Model
|
||||
//! It can then be acknowledged on the spot, in condition that the
|
||||
//! caller works by reference ("Interface_Check& check = ...")
|
||||
Standard_EXPORT Handle(Interface_Check) CCheck (const Handle(Standard_Transient)& start);
|
||||
|
||||
//! Returns the complete CheckList
|
||||
Standard_EXPORT Interface_CheckIterator CheckList() const;
|
||||
|
||||
private:
|
||||
|
||||
Interface_Graph thegraf;
|
||||
Handle(Interface_Protocol) theprot;
|
||||
Handle(Interface_CopyControl) themap;
|
||||
TCollection_AsciiString thefile;
|
||||
TCollection_AsciiString thelist;
|
||||
Interface_CheckIterator thechek;
|
||||
Standard_Boolean thesel;
|
||||
Standard_Integer thecurr;
|
||||
Standard_Integer thecurt;
|
||||
|
||||
};
|
||||
|
||||
#endif // _IFSelect_ContextModif_HeaderFile
|
@@ -1,297 +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 <IFSelect_AppliedModifiers.hxx>
|
||||
#include <IFSelect_ContextWrite.hxx>
|
||||
#include <IFSelect_GeneralModifier.hxx>
|
||||
#include <Interface_Check.hxx>
|
||||
#include <Interface_CheckIterator.hxx>
|
||||
#include <Interface_HGraph.hxx>
|
||||
#include <Interface_InterfaceModel.hxx>
|
||||
#include <Interface_Protocol.hxx>
|
||||
#include <Standard_NoSuchObject.hxx>
|
||||
#include <Standard_Transient.hxx>
|
||||
|
||||
//=======================================================================
|
||||
//function : IFSelect_ContextWrite
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
IFSelect_ContextWrite::IFSelect_ContextWrite
|
||||
(const Handle(Interface_InterfaceModel)& model,
|
||||
const Handle(Interface_Protocol)& proto,
|
||||
const Handle(IFSelect_AppliedModifiers)& applieds,
|
||||
const Standard_CString filename)
|
||||
: themodel (model) , theproto (proto) , thefile (filename) ,
|
||||
theapply (applieds) , thenumod(0) , thenbent (0) , thecurr (0) { }
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : IFSelect_ContextWrite
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
IFSelect_ContextWrite::IFSelect_ContextWrite
|
||||
(const Handle(Interface_HGraph)& hgraph,
|
||||
const Handle(Interface_Protocol)& proto,
|
||||
const Handle(IFSelect_AppliedModifiers)& applieds,
|
||||
const Standard_CString filename)
|
||||
: themodel (hgraph->Graph().Model()) ,
|
||||
theproto (proto) , thefile (filename) , theapply (applieds) ,
|
||||
thehgraf (hgraph) , thenumod(0) , thenbent (0) , thecurr (0) { }
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Model
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Handle(Interface_InterfaceModel) IFSelect_ContextWrite::Model () const
|
||||
{
|
||||
return themodel;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Protocol
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Handle(Interface_Protocol) IFSelect_ContextWrite::Protocol () const
|
||||
{
|
||||
return theproto;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : FileName
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_CString IFSelect_ContextWrite::FileName () const
|
||||
{
|
||||
return thefile.ToCString();
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : AppliedModifiers
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Handle(IFSelect_AppliedModifiers) IFSelect_ContextWrite::AppliedModifiers () const
|
||||
{
|
||||
return theapply;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Graph
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
const Interface_Graph& IFSelect_ContextWrite::Graph ()
|
||||
{
|
||||
if (thehgraf.IsNull()) thehgraf = new Interface_HGraph(themodel,theproto);
|
||||
return thehgraf->Graph();
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : NbModifiers
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Integer IFSelect_ContextWrite::NbModifiers () const
|
||||
{ return (theapply.IsNull() ? 0 : theapply->Count()); }
|
||||
|
||||
Standard_Boolean IFSelect_ContextWrite::SetModifier
|
||||
(const Standard_Integer numod)
|
||||
{
|
||||
themodif.Nullify(); thenumod = thenbent = thecurr = 0;
|
||||
if (theapply.IsNull()) return Standard_False;
|
||||
if (numod < 1 || numod > theapply->Count()) return Standard_False;
|
||||
theapply->Item(numod,themodif,thenbent);
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : FileModifier
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Handle(IFSelect_GeneralModifier) IFSelect_ContextWrite::FileModifier () const
|
||||
{
|
||||
return themodif;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : IsForNone
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean IFSelect_ContextWrite::IsForNone () const
|
||||
{
|
||||
return (thenbent == 0);
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : IsForAll
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean IFSelect_ContextWrite::IsForAll () const
|
||||
{
|
||||
return theapply->IsForAll();
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : NbEntities
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Integer IFSelect_ContextWrite::NbEntities () const
|
||||
{
|
||||
return thenbent;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Start
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void IFSelect_ContextWrite::Start ()
|
||||
{
|
||||
thecurr = 1;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : More
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean IFSelect_ContextWrite::More () const
|
||||
{
|
||||
return (thecurr <= thenbent);
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Next
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void IFSelect_ContextWrite::Next ()
|
||||
{
|
||||
thecurr ++;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Value
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Handle(Standard_Transient) IFSelect_ContextWrite::Value() const
|
||||
{
|
||||
if (thecurr < 1 || thecurr > thenbent)
|
||||
throw Standard_NoSuchObject("IFSelect_ContextWrite:Value");
|
||||
Standard_Integer num = theapply->ItemNum (thecurr);
|
||||
return themodel->Value(num);
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : AddCheck
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void IFSelect_ContextWrite::AddCheck (const Handle(Interface_Check)& check)
|
||||
{
|
||||
if (check->NbFails() + check->NbWarnings() == 0) return;
|
||||
const Handle(Standard_Transient)& ent = check->Entity();
|
||||
Standard_Integer num = themodel->Number(ent);
|
||||
if (num == 0 && !ent.IsNull()) num = -1; // force enregistrement
|
||||
thecheck.Add(check,num);
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : AddWarning
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void IFSelect_ContextWrite::AddWarning(const Handle(Standard_Transient)& start,
|
||||
const Standard_CString mess,
|
||||
const Standard_CString orig)
|
||||
{
|
||||
thecheck.CCheck(themodel->Number(start))->AddWarning(mess,orig);
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : AddFail
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void IFSelect_ContextWrite::AddFail(const Handle(Standard_Transient)& start,
|
||||
const Standard_CString mess,
|
||||
const Standard_CString orig)
|
||||
{
|
||||
thecheck.CCheck(themodel->Number(start))->AddFail(mess,orig);
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : CCheck
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Handle(Interface_Check) IFSelect_ContextWrite::CCheck (const Standard_Integer num)
|
||||
{
|
||||
Handle(Interface_Check) ach = thecheck.CCheck(num);
|
||||
if (num > 0 && num <= themodel->NbEntities()) ach->SetEntity(themodel->Value(num));
|
||||
return ach;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : CCheck
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Handle(Interface_Check) IFSelect_ContextWrite::CCheck(const Handle(Standard_Transient)& ent)
|
||||
{
|
||||
Standard_Integer num = themodel->Number(ent);
|
||||
if (num == 0) num = -1; // force l enregistrement
|
||||
Handle(Interface_Check) ach = thecheck.CCheck(num);
|
||||
ach->SetEntity(ent);
|
||||
return ach;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : CheckList
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Interface_CheckIterator IFSelect_ContextWrite::CheckList () const
|
||||
{
|
||||
return thecheck;
|
||||
}
|
@@ -1,181 +0,0 @@
|
||||
// Created on: 1996-01-26
|
||||
// Created by: Christian CAILLET
|
||||
// Copyright (c) 1996-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 _IFSelect_ContextWrite_HeaderFile
|
||||
#define _IFSelect_ContextWrite_HeaderFile
|
||||
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_DefineAlloc.hxx>
|
||||
#include <Standard_Handle.hxx>
|
||||
|
||||
#include <Interface_CheckIterator.hxx>
|
||||
#include <Standard_Integer.hxx>
|
||||
#include <Standard_CString.hxx>
|
||||
class Interface_InterfaceModel;
|
||||
class Interface_Protocol;
|
||||
class IFSelect_AppliedModifiers;
|
||||
class Interface_HGraph;
|
||||
class IFSelect_GeneralModifier;
|
||||
class Interface_Graph;
|
||||
class Standard_Transient;
|
||||
class Interface_Check;
|
||||
|
||||
|
||||
//! This class gathers various information used by File Modifiers
|
||||
//! apart from the writer object, which is specific of the norm
|
||||
//! and of the physical format
|
||||
//!
|
||||
//! These information are controlled by an object AppliedModifiers
|
||||
//! (if it is not defined, no modification is allowed on writing)
|
||||
//!
|
||||
//! Furthermore, in return, ContextModif can record Checks, either
|
||||
//! one for all, or one for each Entity. It supports trace too.
|
||||
class IFSelect_ContextWrite
|
||||
{
|
||||
public:
|
||||
|
||||
DEFINE_STANDARD_ALLOC
|
||||
|
||||
|
||||
//! Prepares a ContextWrite with these information :
|
||||
//! - the model which is to be written
|
||||
//! - the protocol to be used
|
||||
//! - the filename
|
||||
//! - an object AppliedModifiers to work. It gives a list of
|
||||
//! FileModifiers to be ran, and for each one it can give
|
||||
//! a restricted list of entities (in the model), else all
|
||||
//! the model is considered
|
||||
Standard_EXPORT IFSelect_ContextWrite(const Handle(Interface_InterfaceModel)& model, const Handle(Interface_Protocol)& proto, const Handle(IFSelect_AppliedModifiers)& applieds, const Standard_CString filename);
|
||||
|
||||
//! Same as above but with an already computed Graph
|
||||
Standard_EXPORT IFSelect_ContextWrite(const Handle(Interface_HGraph)& hgraph, const Handle(Interface_Protocol)& proto, const Handle(IFSelect_AppliedModifiers)& applieds, const Standard_CString filename);
|
||||
|
||||
//! Returns the Model
|
||||
Standard_EXPORT Handle(Interface_InterfaceModel) Model() const;
|
||||
|
||||
//! Returns the Protocol;
|
||||
Standard_EXPORT Handle(Interface_Protocol) Protocol() const;
|
||||
|
||||
//! Returns the File Name
|
||||
Standard_EXPORT Standard_CString FileName() const;
|
||||
|
||||
//! Returns the object AppliedModifiers
|
||||
Standard_EXPORT Handle(IFSelect_AppliedModifiers) AppliedModifiers() const;
|
||||
|
||||
//! Returns the Graph, either given when created, else created
|
||||
//! the first time it is queried
|
||||
Standard_EXPORT const Interface_Graph& Graph();
|
||||
|
||||
//! Returns the count of recorded File Modifiers
|
||||
Standard_EXPORT Standard_Integer NbModifiers() const;
|
||||
|
||||
//! Sets active the File Modifier n0 <numod>
|
||||
//! Then, it prepares the list of entities to consider, if any
|
||||
//! Returns False if <numod> out of range
|
||||
Standard_EXPORT Standard_Boolean SetModifier (const Standard_Integer numod);
|
||||
|
||||
//! Returns the currently active File Modifier. Cast to be done
|
||||
//! Null if not properly set : must be test IsNull after casting
|
||||
Standard_EXPORT Handle(IFSelect_GeneralModifier) FileModifier() const;
|
||||
|
||||
//! Returns True if no modifier is currently set
|
||||
Standard_EXPORT Standard_Boolean IsForNone() const;
|
||||
|
||||
//! Returns True if the current modifier is to be applied to
|
||||
//! the whole model. Else, a restricted list of selected entities
|
||||
//! is defined, it can be exploited by the File Modifier
|
||||
Standard_EXPORT Standard_Boolean IsForAll() const;
|
||||
|
||||
//! Returns the total count of selected entities
|
||||
Standard_EXPORT Standard_Integer NbEntities() const;
|
||||
|
||||
//! Starts an iteration on selected items. It takes into account
|
||||
//! IsForAll/IsForNone, by really iterating on all selected items.
|
||||
Standard_EXPORT void Start();
|
||||
|
||||
//! Returns True until the iteration has finished
|
||||
Standard_EXPORT Standard_Boolean More() const;
|
||||
|
||||
//! Advances the iteration
|
||||
Standard_EXPORT void Next();
|
||||
|
||||
//! Returns the current selected entity in the model
|
||||
Standard_EXPORT Handle(Standard_Transient) Value() const;
|
||||
|
||||
//! Adds a Check to the CheckList. If it is empty, nothing is done
|
||||
//! If it concerns an Entity from the Model (by SetEntity)
|
||||
//! to which another Check is attached, it is merged to it.
|
||||
//! Else, it is added or merged as to GlobalCheck.
|
||||
Standard_EXPORT void AddCheck (const Handle(Interface_Check)& check);
|
||||
|
||||
//! Adds a Warning Message for an Entity from the Model
|
||||
//! If <start> is not an Entity from the model (e.g. the
|
||||
//! model itself) this message is added to Global Check.
|
||||
Standard_EXPORT void AddWarning (const Handle(Standard_Transient)& start, const Standard_CString mess, const Standard_CString orig = "");
|
||||
|
||||
//! Adds a Fail Message for an Entity from the Model
|
||||
//! If <start> is not an Entity from the model (e.g. the
|
||||
//! model itself) this message is added to Global Check.
|
||||
Standard_EXPORT void AddFail (const Handle(Standard_Transient)& start, const Standard_CString mess, const Standard_CString orig = "");
|
||||
|
||||
//! Returns a Check given an Entity number (in the Model)
|
||||
//! by default a Global Check. Creates it the first time.
|
||||
//! It can then be acknowledged on the spot, in condition that the
|
||||
//! caller works by reference ("Interface_Check& check = ...")
|
||||
Standard_EXPORT Handle(Interface_Check) CCheck (const Standard_Integer num = 0);
|
||||
|
||||
//! Returns a Check attached to an Entity from the Model
|
||||
//! It can then be acknowledged on the spot, in condition that the
|
||||
//! caller works by reference ("Interface_Check& check = ...")
|
||||
Standard_EXPORT Handle(Interface_Check) CCheck (const Handle(Standard_Transient)& start);
|
||||
|
||||
//! Returns the complete CheckList
|
||||
Standard_EXPORT Interface_CheckIterator CheckList() const;
|
||||
|
||||
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
||||
|
||||
Handle(Interface_InterfaceModel) themodel;
|
||||
Handle(Interface_Protocol) theproto;
|
||||
TCollection_AsciiString thefile;
|
||||
Handle(IFSelect_AppliedModifiers) theapply;
|
||||
Handle(Interface_HGraph) thehgraf;
|
||||
Interface_CheckIterator thecheck;
|
||||
Standard_Integer thenumod;
|
||||
Standard_Integer thenbent;
|
||||
Standard_Integer thecurr;
|
||||
Handle(IFSelect_GeneralModifier) themodif;
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // _IFSelect_ContextWrite_HeaderFile
|
@@ -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 <IFGraph_SubPartsIterator.hxx>
|
||||
#include <IFSelect_DispGlobal.hxx>
|
||||
#include <IFSelect_Selection.hxx>
|
||||
#include <Interface_EntityIterator.hxx>
|
||||
#include <Interface_Graph.hxx>
|
||||
#include <Standard_Type.hxx>
|
||||
#include <TCollection_AsciiString.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(IFSelect_DispGlobal,IFSelect_Dispatch)
|
||||
|
||||
// Genere un seul paquet avec la sortie finale
|
||||
IFSelect_DispGlobal::IFSelect_DispGlobal () { }
|
||||
|
||||
TCollection_AsciiString IFSelect_DispGlobal::Label () const
|
||||
{ return TCollection_AsciiString ("One File for All Input"); }
|
||||
|
||||
Standard_Boolean IFSelect_DispGlobal::LimitedMax
|
||||
(const Standard_Integer /* nbent */, Standard_Integer& pcount) const
|
||||
{ pcount = 1; return Standard_True; }
|
||||
|
||||
// 1 packet ( a partir de UniqueResult)
|
||||
void IFSelect_DispGlobal::Packets
|
||||
(const Interface_Graph& G, IFGraph_SubPartsIterator& packs) const
|
||||
{
|
||||
packs.AddPart();
|
||||
packs.GetFromIter(FinalSelection()->UniqueResult(G));
|
||||
}
|
@@ -1,78 +0,0 @@
|
||||
// Created on: 1992-11-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 _IFSelect_DispGlobal_HeaderFile
|
||||
#define _IFSelect_DispGlobal_HeaderFile
|
||||
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_Type.hxx>
|
||||
|
||||
#include <IFSelect_Dispatch.hxx>
|
||||
#include <Standard_Integer.hxx>
|
||||
class TCollection_AsciiString;
|
||||
class Interface_Graph;
|
||||
class IFGraph_SubPartsIterator;
|
||||
|
||||
|
||||
class IFSelect_DispGlobal;
|
||||
DEFINE_STANDARD_HANDLE(IFSelect_DispGlobal, IFSelect_Dispatch)
|
||||
|
||||
//! A DispGlobal gathers all the input Entities into only one
|
||||
//! global Packet
|
||||
class IFSelect_DispGlobal : public IFSelect_Dispatch
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
|
||||
//! Creates a DispGlobal
|
||||
Standard_EXPORT IFSelect_DispGlobal();
|
||||
|
||||
//! Returns as Label, "One File for all Input"
|
||||
Standard_EXPORT TCollection_AsciiString Label() const Standard_OVERRIDE;
|
||||
|
||||
//! Returns True : maximum equates 1
|
||||
Standard_EXPORT virtual Standard_Boolean LimitedMax (const Standard_Integer nbent, Standard_Integer& max) const Standard_OVERRIDE;
|
||||
|
||||
//! Computes the list of produced Packets. It is made of only ONE
|
||||
//! Packet, which gets the RootResult from the Final Selection.
|
||||
//! Remark : the inherited exception raising is never activated.
|
||||
Standard_EXPORT void Packets (const Interface_Graph& G, IFGraph_SubPartsIterator& packs) const Standard_OVERRIDE;
|
||||
|
||||
|
||||
|
||||
|
||||
DEFINE_STANDARD_RTTIEXT(IFSelect_DispGlobal,IFSelect_Dispatch)
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // _IFSelect_DispGlobal_HeaderFile
|
@@ -1,80 +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 <IFGraph_SCRoots.hxx>
|
||||
#include <IFGraph_SubPartsIterator.hxx>
|
||||
#include <IFSelect_DispPerCount.hxx>
|
||||
#include <IFSelect_IntParam.hxx>
|
||||
#include <IFSelect_Selection.hxx>
|
||||
#include <Interface_EntityIterator.hxx>
|
||||
#include <Interface_Graph.hxx>
|
||||
#include <Interface_InterfaceModel.hxx>
|
||||
#include <Standard_Type.hxx>
|
||||
#include <TCollection_AsciiString.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(IFSelect_DispPerCount,IFSelect_Dispatch)
|
||||
|
||||
IFSelect_DispPerCount::IFSelect_DispPerCount () { }
|
||||
|
||||
Handle(IFSelect_IntParam) IFSelect_DispPerCount::Count () const
|
||||
{ return thecount; }
|
||||
|
||||
void IFSelect_DispPerCount::SetCount
|
||||
(const Handle(IFSelect_IntParam)& pcount)
|
||||
{ thecount = pcount; }
|
||||
|
||||
Standard_Integer IFSelect_DispPerCount::CountValue () const
|
||||
{
|
||||
Standard_Integer pcount = 0;
|
||||
if (!thecount.IsNull()) pcount = thecount->Value();
|
||||
if (pcount <= 0) pcount = 1; // option prise par defaut
|
||||
return pcount;
|
||||
}
|
||||
|
||||
TCollection_AsciiString IFSelect_DispPerCount::Label () const
|
||||
{
|
||||
TCollection_AsciiString lab(CountValue());
|
||||
lab.Insert(1,"One File per ");
|
||||
lab.AssignCat(" Entities");
|
||||
return lab;
|
||||
}
|
||||
|
||||
|
||||
Standard_Boolean IFSelect_DispPerCount::LimitedMax
|
||||
(const Standard_Integer nbent, Standard_Integer& pcount) const
|
||||
{
|
||||
pcount = 1 + nbent / CountValue();
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
void IFSelect_DispPerCount::Packets
|
||||
(const Interface_Graph& G, IFGraph_SubPartsIterator& packs) const
|
||||
{
|
||||
// Ressemble a DispPerOne, mais fait un AddPart tous les "count" racines
|
||||
Standard_Integer pcount = CountValue();
|
||||
|
||||
IFGraph_SCRoots roots(G,Standard_False);
|
||||
roots.SetLoad();
|
||||
roots.GetFromIter(FinalSelection()->UniqueResult(G));
|
||||
// SCRoots a initie la resolution : decoupage en StrongComponants + selection
|
||||
// des racines. Un paquet correspond des lors a <count> racines
|
||||
// Donc, il faut iterer sur les Parts de roots et les prendre par <count>
|
||||
|
||||
Standard_Integer i = 0;
|
||||
for (roots.Start(); roots.More(); roots.Next()) {
|
||||
if (i == 0) packs.AddPart();
|
||||
i ++; if (i >= pcount) i = 0; // regroupement selon "count"
|
||||
packs.GetFromIter(roots.Entities());
|
||||
}
|
||||
}
|
@@ -1,92 +0,0 @@
|
||||
// Created on: 1992-11-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 _IFSelect_DispPerCount_HeaderFile
|
||||
#define _IFSelect_DispPerCount_HeaderFile
|
||||
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_Type.hxx>
|
||||
|
||||
#include <IFSelect_Dispatch.hxx>
|
||||
#include <Standard_Integer.hxx>
|
||||
class IFSelect_IntParam;
|
||||
class TCollection_AsciiString;
|
||||
class Interface_Graph;
|
||||
class IFGraph_SubPartsIterator;
|
||||
|
||||
|
||||
class IFSelect_DispPerCount;
|
||||
DEFINE_STANDARD_HANDLE(IFSelect_DispPerCount, IFSelect_Dispatch)
|
||||
|
||||
//! A DispPerCount gathers all the input Entities into one or
|
||||
//! several Packets, each containing a defined count of Entity
|
||||
//! This count is a Parameter of the DispPerCount, given as an
|
||||
//! IntParam, thus allowing external control of its Value
|
||||
class IFSelect_DispPerCount : public IFSelect_Dispatch
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
|
||||
//! Creates a DispPerCount with no Count (default value 1)
|
||||
Standard_EXPORT IFSelect_DispPerCount();
|
||||
|
||||
//! Returns the Count Parameter used for splitting
|
||||
Standard_EXPORT Handle(IFSelect_IntParam) Count() const;
|
||||
|
||||
//! Sets a new Parameter for Count
|
||||
Standard_EXPORT void SetCount (const Handle(IFSelect_IntParam)& count);
|
||||
|
||||
//! Returns the effective value of the count parameter
|
||||
//! (if Count Parameter not Set or value not positive, returns 1)
|
||||
Standard_EXPORT Standard_Integer CountValue() const;
|
||||
|
||||
//! Returns as Label, "One File per <count> Input Entities"
|
||||
Standard_EXPORT TCollection_AsciiString Label() const Standard_OVERRIDE;
|
||||
|
||||
//! Returns True, maximum count is given as <nbent>
|
||||
Standard_EXPORT virtual Standard_Boolean LimitedMax (const Standard_Integer nbent, Standard_Integer& max) const Standard_OVERRIDE;
|
||||
|
||||
//! Computes the list of produced Packets. It defines Packets in
|
||||
//! order to have at most <Count> Entities per Packet, Entities
|
||||
//! are given by RootResult from the Final Selection.
|
||||
Standard_EXPORT void Packets (const Interface_Graph& G, IFGraph_SubPartsIterator& packs) const Standard_OVERRIDE;
|
||||
|
||||
|
||||
|
||||
|
||||
DEFINE_STANDARD_RTTIEXT(IFSelect_DispPerCount,IFSelect_Dispatch)
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
||||
Handle(IFSelect_IntParam) thecount;
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // _IFSelect_DispPerCount_HeaderFile
|
@@ -1,83 +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 <IFGraph_SCRoots.hxx>
|
||||
#include <IFGraph_SubPartsIterator.hxx>
|
||||
#include <IFSelect_DispPerFiles.hxx>
|
||||
#include <IFSelect_IntParam.hxx>
|
||||
#include <IFSelect_Selection.hxx>
|
||||
#include <Interface_EntityIterator.hxx>
|
||||
#include <Interface_Graph.hxx>
|
||||
#include <Interface_InterfaceModel.hxx>
|
||||
#include <Standard_Type.hxx>
|
||||
#include <TCollection_AsciiString.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(IFSelect_DispPerFiles,IFSelect_Dispatch)
|
||||
|
||||
IFSelect_DispPerFiles::IFSelect_DispPerFiles () { }
|
||||
|
||||
Handle(IFSelect_IntParam) IFSelect_DispPerFiles::Count () const
|
||||
{ return thecount; }
|
||||
|
||||
void IFSelect_DispPerFiles::SetCount
|
||||
(const Handle(IFSelect_IntParam)& pcount)
|
||||
{ thecount = pcount; }
|
||||
|
||||
Standard_Integer IFSelect_DispPerFiles::CountValue () const
|
||||
{
|
||||
Standard_Integer pcount = 0;
|
||||
if (!thecount.IsNull()) pcount = thecount->Value();
|
||||
if (pcount <= 0) pcount = 1; // option prise par defaut
|
||||
return pcount;
|
||||
}
|
||||
|
||||
TCollection_AsciiString IFSelect_DispPerFiles::Label () const
|
||||
{
|
||||
TCollection_AsciiString lab(CountValue());
|
||||
lab.Insert(1,"Maximum ");
|
||||
lab.AssignCat(" Files");
|
||||
return lab;
|
||||
}
|
||||
|
||||
|
||||
Standard_Boolean IFSelect_DispPerFiles::LimitedMax
|
||||
(const Standard_Integer /* nbent */, Standard_Integer& pcount) const
|
||||
{
|
||||
pcount = CountValue();
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
void IFSelect_DispPerFiles::Packets
|
||||
(const Interface_Graph& G, IFGraph_SubPartsIterator& packs) const
|
||||
{
|
||||
// Ressemble a DispPerOne, mais fait "count" AddPart racines
|
||||
Standard_Integer pcount = CountValue();
|
||||
|
||||
IFGraph_SCRoots roots(G,Standard_False);
|
||||
roots.SetLoad();
|
||||
roots.GetFromIter(FinalSelection()->UniqueResult(G));
|
||||
// SCRoots a initie la resolution : decoupage en StrongComponants + selection
|
||||
// des racines. Un paquet correspond des lors a <count> racines
|
||||
// Donc, il faut iterer sur les Parts de roots et les prendre par <count>
|
||||
roots.Start(); // Start fait Evaluate specifique
|
||||
Standard_Integer nb = roots.NbParts();
|
||||
if (pcount > 0) pcount = (nb-1) / pcount +1; // par packet
|
||||
|
||||
Standard_Integer i = 0;
|
||||
for (; roots.More(); roots.Next()) { // Start deja fait
|
||||
if (i == 0) packs.AddPart();
|
||||
i ++; if (i >= pcount) i = 0; // regroupement selon "count"
|
||||
packs.GetFromIter(roots.Entities());
|
||||
}
|
||||
}
|
@@ -1,96 +0,0 @@
|
||||
// Created on: 1994-12-21
|
||||
// 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 _IFSelect_DispPerFiles_HeaderFile
|
||||
#define _IFSelect_DispPerFiles_HeaderFile
|
||||
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_Type.hxx>
|
||||
|
||||
#include <IFSelect_Dispatch.hxx>
|
||||
#include <Standard_Integer.hxx>
|
||||
class IFSelect_IntParam;
|
||||
class TCollection_AsciiString;
|
||||
class Interface_Graph;
|
||||
class IFGraph_SubPartsIterator;
|
||||
|
||||
|
||||
class IFSelect_DispPerFiles;
|
||||
DEFINE_STANDARD_HANDLE(IFSelect_DispPerFiles, IFSelect_Dispatch)
|
||||
|
||||
//! A DispPerFiles produces a determined count of Packets from the
|
||||
//! input Entities. It divides, as equally as possible, the input
|
||||
//! list into a count of files. This count is the parameter of the
|
||||
//! DispPerFiles. If the input list has less than this count, of
|
||||
//! course there will be one packet per input entity.
|
||||
//! This count is a Parameter of the DispPerFiles, given as an
|
||||
//! IntParam, thus allowing external control of its Value
|
||||
class IFSelect_DispPerFiles : public IFSelect_Dispatch
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
|
||||
//! Creates a DispPerFiles with no Count (default value 1 file)
|
||||
Standard_EXPORT IFSelect_DispPerFiles();
|
||||
|
||||
//! Returns the Count Parameter used for splitting
|
||||
Standard_EXPORT Handle(IFSelect_IntParam) Count() const;
|
||||
|
||||
//! Sets a new Parameter for Count
|
||||
Standard_EXPORT void SetCount (const Handle(IFSelect_IntParam)& count);
|
||||
|
||||
//! Returns the effective value of the count parameter
|
||||
//! (if Count Parameter not Set or value not positive, returns 1)
|
||||
Standard_EXPORT Standard_Integer CountValue() const;
|
||||
|
||||
//! Returns as Label, "Maximum <count> Files"
|
||||
Standard_EXPORT TCollection_AsciiString Label() const Standard_OVERRIDE;
|
||||
|
||||
//! Returns True, maximum count is given as CountValue
|
||||
Standard_EXPORT virtual Standard_Boolean LimitedMax (const Standard_Integer nbent, Standard_Integer& max) const Standard_OVERRIDE;
|
||||
|
||||
//! Computes the list of produced Packets. It defines Packets in
|
||||
//! order to have <Count> Packets, except if the input count of
|
||||
//! Entities is lower. Entities are given by RootResult from the
|
||||
//! Final Selection.
|
||||
Standard_EXPORT void Packets (const Interface_Graph& G, IFGraph_SubPartsIterator& packs) const Standard_OVERRIDE;
|
||||
|
||||
|
||||
|
||||
|
||||
DEFINE_STANDARD_RTTIEXT(IFSelect_DispPerFiles,IFSelect_Dispatch)
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
||||
Handle(IFSelect_IntParam) thecount;
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // _IFSelect_DispPerFiles_HeaderFile
|
@@ -1,47 +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 <IFGraph_SCRoots.hxx>
|
||||
#include <IFGraph_SubPartsIterator.hxx>
|
||||
#include <IFSelect_DispPerOne.hxx>
|
||||
#include <IFSelect_Selection.hxx>
|
||||
#include <Interface_EntityIterator.hxx>
|
||||
#include <Interface_Graph.hxx>
|
||||
#include <Interface_InterfaceModel.hxx>
|
||||
#include <Standard_Type.hxx>
|
||||
#include <TCollection_AsciiString.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(IFSelect_DispPerOne,IFSelect_Dispatch)
|
||||
|
||||
// Genere un paquet par racine (strong comp.) locale a la liste transmise
|
||||
IFSelect_DispPerOne::IFSelect_DispPerOne () { }
|
||||
|
||||
TCollection_AsciiString IFSelect_DispPerOne::Label () const
|
||||
{ return TCollection_AsciiString ("One File per Input Entity"); }
|
||||
|
||||
|
||||
Standard_Boolean IFSelect_DispPerOne::LimitedMax
|
||||
(const Standard_Integer nbent, Standard_Integer& pcount) const
|
||||
{ pcount = nbent; return Standard_True; }
|
||||
|
||||
void IFSelect_DispPerOne::Packets
|
||||
(const Interface_Graph& G, IFGraph_SubPartsIterator& packs) const
|
||||
{
|
||||
IFGraph_SCRoots packsc(G,Standard_False); // OK pour SubPartsIterator
|
||||
packsc.SetLoad();
|
||||
packsc.GetFromIter(FinalSelection()->UniqueResult(G));
|
||||
// SCRoots a initie la resolution : decoupage en StrongComponants + selection
|
||||
// des Racines. Chaque Racine correspond a un Packet. CQFD
|
||||
packs.GetParts(packsc);
|
||||
}
|
@@ -1,78 +0,0 @@
|
||||
// Created on: 1992-11-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 _IFSelect_DispPerOne_HeaderFile
|
||||
#define _IFSelect_DispPerOne_HeaderFile
|
||||
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_Type.hxx>
|
||||
|
||||
#include <IFSelect_Dispatch.hxx>
|
||||
#include <Standard_Integer.hxx>
|
||||
class TCollection_AsciiString;
|
||||
class Interface_Graph;
|
||||
class IFGraph_SubPartsIterator;
|
||||
|
||||
|
||||
class IFSelect_DispPerOne;
|
||||
DEFINE_STANDARD_HANDLE(IFSelect_DispPerOne, IFSelect_Dispatch)
|
||||
|
||||
//! A DispPerOne gathers all the input Entities into as many
|
||||
//! Packets as there Root Entities from the Final Selection,
|
||||
//! that is, one Packet per Entity
|
||||
class IFSelect_DispPerOne : public IFSelect_Dispatch
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
|
||||
//! Creates a DispPerOne
|
||||
Standard_EXPORT IFSelect_DispPerOne();
|
||||
|
||||
//! Returns as Label, "One File per Input Entity"
|
||||
Standard_EXPORT TCollection_AsciiString Label() const Standard_OVERRIDE;
|
||||
|
||||
//! Returns True, maximum limit is given as <nbent>
|
||||
Standard_EXPORT virtual Standard_Boolean LimitedMax (const Standard_Integer nbent, Standard_Integer& max) const Standard_OVERRIDE;
|
||||
|
||||
//! Returns the list of produced Packets. It defines one Packet
|
||||
//! per Entity given by RootResult from the Final Selection.
|
||||
Standard_EXPORT void Packets (const Interface_Graph& G, IFGraph_SubPartsIterator& packs) const Standard_OVERRIDE;
|
||||
|
||||
|
||||
|
||||
|
||||
DEFINE_STANDARD_RTTIEXT(IFSelect_DispPerOne,IFSelect_Dispatch)
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // _IFSelect_DispPerOne_HeaderFile
|
@@ -1,80 +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 <IFGraph_SubPartsIterator.hxx>
|
||||
#include <IFSelect_DispPerSignature.hxx>
|
||||
#include <IFSelect_Selection.hxx>
|
||||
#include <IFSelect_SignCounter.hxx>
|
||||
#include <Interface_EntityIterator.hxx>
|
||||
#include <Interface_Graph.hxx>
|
||||
#include <Standard_Type.hxx>
|
||||
#include <TCollection_AsciiString.hxx>
|
||||
#include <TCollection_HAsciiString.hxx>
|
||||
#include <TColStd_HSequenceOfHAsciiString.hxx>
|
||||
#include <TColStd_HSequenceOfTransient.hxx>
|
||||
|
||||
#include <stdio.h>
|
||||
IMPLEMENT_STANDARD_RTTIEXT(IFSelect_DispPerSignature,IFSelect_Dispatch)
|
||||
|
||||
IFSelect_DispPerSignature::IFSelect_DispPerSignature () { }
|
||||
|
||||
Handle(IFSelect_SignCounter) IFSelect_DispPerSignature::SignCounter () const
|
||||
{ return thesign; }
|
||||
|
||||
void IFSelect_DispPerSignature::SetSignCounter
|
||||
(const Handle(IFSelect_SignCounter)& sign)
|
||||
{ thesign = sign; thesign->SetList (Standard_True); }
|
||||
|
||||
Standard_CString IFSelect_DispPerSignature::SignName () const
|
||||
{ return (Standard_CString ) (thesign.IsNull() ? "???" : thesign->Name()); }
|
||||
|
||||
TCollection_AsciiString IFSelect_DispPerSignature::Label () const
|
||||
{
|
||||
char lab[50];
|
||||
sprintf (lab,"One File per Signature %s",SignName());
|
||||
return TCollection_AsciiString(lab);
|
||||
}
|
||||
|
||||
Standard_Boolean IFSelect_DispPerSignature::LimitedMax
|
||||
(const Standard_Integer nbent, Standard_Integer& max) const
|
||||
{
|
||||
max = nbent;
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
void IFSelect_DispPerSignature::Packets
|
||||
(const Interface_Graph& G, IFGraph_SubPartsIterator& packs) const
|
||||
{
|
||||
if (thesign.IsNull()) {
|
||||
packs.AddPart();
|
||||
packs.GetFromIter (FinalSelection()->RootResult(G));
|
||||
return;
|
||||
}
|
||||
|
||||
thesign->Clear();
|
||||
thesign->AddList (FinalSelection()->RootResult(G).Content(),G.Model());
|
||||
Handle(TColStd_HSequenceOfHAsciiString) list = thesign->List();
|
||||
Standard_Integer i,nb,is,nbs = list->Length();
|
||||
Handle(TCollection_HAsciiString) asign;
|
||||
Handle(TColStd_HSequenceOfTransient) ents;
|
||||
for (is = 1; is <= nbs; is ++) {
|
||||
asign = list->Value(is);
|
||||
ents = thesign->Entities (asign->ToCString());
|
||||
if (ents.IsNull()) continue;
|
||||
packs.AddPart();
|
||||
nb = ents->Length();
|
||||
for (i = 1; i <= nb; i ++)
|
||||
packs.GetFromEntity (ents->Value(i),Standard_False);
|
||||
}
|
||||
}
|
@@ -1,92 +0,0 @@
|
||||
// Created on: 1994-12-21
|
||||
// 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 _IFSelect_DispPerSignature_HeaderFile
|
||||
#define _IFSelect_DispPerSignature_HeaderFile
|
||||
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_Type.hxx>
|
||||
|
||||
#include <IFSelect_Dispatch.hxx>
|
||||
#include <Standard_Integer.hxx>
|
||||
class IFSelect_SignCounter;
|
||||
class TCollection_AsciiString;
|
||||
class Interface_Graph;
|
||||
class IFGraph_SubPartsIterator;
|
||||
|
||||
|
||||
class IFSelect_DispPerSignature;
|
||||
DEFINE_STANDARD_HANDLE(IFSelect_DispPerSignature, IFSelect_Dispatch)
|
||||
|
||||
//! A DispPerSignature sorts input Entities according to a
|
||||
//! Signature : it works with a SignCounter to do this.
|
||||
class IFSelect_DispPerSignature : public IFSelect_Dispatch
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
|
||||
//! Creates a DispPerSignature with no SignCounter (by default,
|
||||
//! produces only one packet)
|
||||
Standard_EXPORT IFSelect_DispPerSignature();
|
||||
|
||||
//! Returns the SignCounter used for splitting
|
||||
Standard_EXPORT Handle(IFSelect_SignCounter) SignCounter() const;
|
||||
|
||||
//! Sets a SignCounter for sort
|
||||
//! Remark : it is set to record lists of entities, not only counts
|
||||
Standard_EXPORT void SetSignCounter (const Handle(IFSelect_SignCounter)& sign);
|
||||
|
||||
//! Returns the name of the SignCounter, which caracterises the
|
||||
//! sorting criterium for this Dispatch
|
||||
Standard_EXPORT Standard_CString SignName() const;
|
||||
|
||||
//! Returns as Label, "One File per Signature <name>"
|
||||
Standard_EXPORT TCollection_AsciiString Label() const Standard_OVERRIDE;
|
||||
|
||||
//! Returns True, maximum count is given as <nbent>
|
||||
Standard_EXPORT virtual Standard_Boolean LimitedMax (const Standard_Integer nbent, Standard_Integer& max) const Standard_OVERRIDE;
|
||||
|
||||
//! Computes the list of produced Packets. It defines Packets from
|
||||
//! the SignCounter, which sirts the input Entities per Signature
|
||||
//! (specific of the SignCounter).
|
||||
Standard_EXPORT void Packets (const Interface_Graph& G, IFGraph_SubPartsIterator& packs) const Standard_OVERRIDE;
|
||||
|
||||
|
||||
|
||||
|
||||
DEFINE_STANDARD_RTTIEXT(IFSelect_DispPerSignature,IFSelect_Dispatch)
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
||||
Handle(IFSelect_SignCounter) thesign;
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // _IFSelect_DispPerSignature_HeaderFile
|
@@ -1,83 +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 <IFGraph_Compare.hxx>
|
||||
#include <IFGraph_SubPartsIterator.hxx>
|
||||
#include <IFSelect_Dispatch.hxx>
|
||||
#include <IFSelect_SelectionIterator.hxx>
|
||||
#include <Interface_EntityIterator.hxx>
|
||||
#include <Interface_Graph.hxx>
|
||||
#include <Standard_Type.hxx>
|
||||
#include <TCollection_AsciiString.hxx>
|
||||
#include <TCollection_HAsciiString.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(IFSelect_Dispatch,Standard_Transient)
|
||||
|
||||
void IFSelect_Dispatch::SetRootName
|
||||
(const Handle(TCollection_HAsciiString)& name)
|
||||
{
|
||||
thename = name;
|
||||
}
|
||||
|
||||
Standard_Boolean IFSelect_Dispatch::HasRootName () const
|
||||
{ return (!thename.IsNull()); }
|
||||
|
||||
const Handle(TCollection_HAsciiString)& IFSelect_Dispatch::RootName () const
|
||||
{ return thename; }
|
||||
|
||||
void IFSelect_Dispatch::SetFinalSelection
|
||||
(const Handle(IFSelect_Selection)& sel)
|
||||
{ thefinal = sel; }
|
||||
|
||||
Handle(IFSelect_Selection) IFSelect_Dispatch::FinalSelection () const
|
||||
{ return thefinal; }
|
||||
|
||||
IFSelect_SelectionIterator IFSelect_Dispatch::Selections () const
|
||||
{
|
||||
IFSelect_SelectionIterator iter;
|
||||
iter.AddItem(thefinal);
|
||||
for(; iter.More(); iter.Next()) {
|
||||
iter.Value()->FillIterator(iter); // Iterateur qui se court apres
|
||||
}
|
||||
return iter;
|
||||
}
|
||||
|
||||
|
||||
Standard_Boolean IFSelect_Dispatch::CanHaveRemainder () const
|
||||
{ return Standard_False; }
|
||||
|
||||
Standard_Boolean IFSelect_Dispatch::LimitedMax
|
||||
(const Standard_Integer , Standard_Integer& max) const
|
||||
{ max = 0; return Standard_False; }
|
||||
|
||||
Interface_EntityIterator IFSelect_Dispatch::GetEntities
|
||||
(const Interface_Graph& G) const
|
||||
{ return thefinal->UniqueResult(G); }
|
||||
|
||||
Interface_EntityIterator IFSelect_Dispatch::Packeted
|
||||
(const Interface_Graph& G) const
|
||||
{
|
||||
Interface_EntityIterator total = GetEntities(G);
|
||||
Interface_EntityIterator remain = Remainder(G);
|
||||
if (remain.NbEntities() == 0) return total;
|
||||
// sinon, faire la difference !
|
||||
IFGraph_Compare GC(G);
|
||||
GC.GetFromIter (total, Standard_True);
|
||||
GC.GetFromIter (remain,Standard_False);
|
||||
return GC.FirstOnly();
|
||||
}
|
||||
|
||||
Interface_EntityIterator IFSelect_Dispatch::Remainder
|
||||
(const Interface_Graph& ) const
|
||||
{ Interface_EntityIterator iter; return iter; } // par defaut vide
|
@@ -1,151 +0,0 @@
|
||||
// Created on: 1992-11-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 _IFSelect_Dispatch_HeaderFile
|
||||
#define _IFSelect_Dispatch_HeaderFile
|
||||
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_Type.hxx>
|
||||
|
||||
#include <Standard_Transient.hxx>
|
||||
#include <Standard_Integer.hxx>
|
||||
class TCollection_HAsciiString;
|
||||
class IFSelect_Selection;
|
||||
class IFSelect_SelectionIterator;
|
||||
class TCollection_AsciiString;
|
||||
class Interface_EntityIterator;
|
||||
class Interface_Graph;
|
||||
class IFGraph_SubPartsIterator;
|
||||
|
||||
|
||||
class IFSelect_Dispatch;
|
||||
DEFINE_STANDARD_HANDLE(IFSelect_Dispatch, Standard_Transient)
|
||||
|
||||
//! This class allows to describe how a set of Entities has to be
|
||||
//! dispatched into resulting Packets : a Packet is a sub-set of
|
||||
//! the initial set of entities.
|
||||
//!
|
||||
//! Thus, it can generate zero, one, or more Packets according
|
||||
//! input set and criterium of dispatching. And it can let apart
|
||||
//! some entities : it is the Remainder, which can be recovered
|
||||
//! by a specific Selection (RemainderFromDispatch).
|
||||
//!
|
||||
//! Depending of sub-classes, a Dispatch can potentially generate
|
||||
//! a limited or not count of packet, and a remainder or none.
|
||||
//!
|
||||
//! The input set is read from a specified Selection, attached to
|
||||
//! the Dispatch : the Final Selection of the Dispatch. The input
|
||||
//! is the Unique Root Entities list of the Final Selection
|
||||
class IFSelect_Dispatch : public Standard_Transient
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
|
||||
//! Sets a Root Name as an HAsciiString
|
||||
//! To reset it, give a Null Handle (then, a ShareOut will have
|
||||
//! to define the Default Root Name)
|
||||
Standard_EXPORT void SetRootName (const Handle(TCollection_HAsciiString)& name);
|
||||
|
||||
//! Returns True if a specific Root Name has been set
|
||||
//! (else, the Default Root Name has to be used)
|
||||
Standard_EXPORT Standard_Boolean HasRootName() const;
|
||||
|
||||
//! Returns the Root Name for files produced by this dispatch
|
||||
//! It is empty if it has not been set or if it has been reset
|
||||
Standard_EXPORT const Handle(TCollection_HAsciiString)& RootName() const;
|
||||
|
||||
//! Stores (or Changes) the Final Selection for a Dispatch
|
||||
Standard_EXPORT void SetFinalSelection (const Handle(IFSelect_Selection)& sel);
|
||||
|
||||
//! Returns the Final Selection of a Dispatch
|
||||
//! we 'd like : C++ : return const &
|
||||
Standard_EXPORT Handle(IFSelect_Selection) FinalSelection() const;
|
||||
|
||||
//! Returns the complete list of source Selections (starting
|
||||
//! from FinalSelection)
|
||||
Standard_EXPORT IFSelect_SelectionIterator Selections() const;
|
||||
|
||||
//! Returns True if a Dispatch can have a Remainder, i.e. if its
|
||||
//! criterium can let entities apart. It is a potential answer,
|
||||
//! remainder can be empty at run-time even if answer is True.
|
||||
//! (to attach a RemainderFromDispatch Selection is not allowed if
|
||||
//! answer is True).
|
||||
//! Default answer given here is False (can be redefined)
|
||||
Standard_EXPORT virtual Standard_Boolean CanHaveRemainder() const;
|
||||
|
||||
//! Returns True if a Dispatch generates a count of Packets always
|
||||
//! less than or equal to a maximum value : it can be computed
|
||||
//! from the total count of Entities to be dispatched : <nbent>.
|
||||
//! If answer is False, no limited maximum is expected for account
|
||||
//! If answer is True, expected maximum is given in argument <max>
|
||||
//! Default answer given here is False (can be redefined)
|
||||
Standard_EXPORT virtual Standard_Boolean LimitedMax (const Standard_Integer nbent, Standard_Integer& max) const;
|
||||
|
||||
//! Returns a text which defines the way a Dispatch produces
|
||||
//! packets (which will become files) from its Input
|
||||
Standard_EXPORT virtual TCollection_AsciiString Label() const = 0;
|
||||
|
||||
//! Gets Unique Root Entities from the Final Selection, given an
|
||||
//! input Graph
|
||||
//! This the starting step for an Evaluation (Packets - Remainder)
|
||||
Standard_EXPORT Interface_EntityIterator GetEntities (const Interface_Graph& G) const;
|
||||
|
||||
//! Returns the list of produced Packets into argument <pack>.
|
||||
//! Each Packet corresponds to a Part, the Entities listed are the
|
||||
//! Roots given by the Selection. Input is given as a Graph.
|
||||
//! Thus, to create a file from a packet, it suffices to take the
|
||||
//! entities listed in a Part of Packets (that is, a Packet)
|
||||
//! without worrying about Shared entities
|
||||
//! This method can raise an Exception if data are not coherent
|
||||
Standard_EXPORT virtual void Packets (const Interface_Graph& G, IFGraph_SubPartsIterator& packs) const = 0;
|
||||
|
||||
//! Returns the list of all Input Entities (see GetEntities) which
|
||||
//! are put in a Packet. That is, Entities listed in GetEntities
|
||||
//! but not in Remainder (see below). Input is given as a Graph.
|
||||
Standard_EXPORT Interface_EntityIterator Packeted (const Interface_Graph& G) const;
|
||||
|
||||
//! Returns Remainder which is a set of Entities. Can be empty.
|
||||
//! Default evaluation is empty (has to be redefined if
|
||||
//! CanHaveRemainder is redefined to return True).
|
||||
Standard_EXPORT virtual Interface_EntityIterator Remainder (const Interface_Graph& G) const;
|
||||
|
||||
|
||||
|
||||
|
||||
DEFINE_STANDARD_RTTIEXT(IFSelect_Dispatch,Standard_Transient)
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
||||
Handle(TCollection_HAsciiString) thename;
|
||||
Handle(IFSelect_Selection) thefinal;
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // _IFSelect_Dispatch_HeaderFile
|
@@ -1,546 +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 <IFSelect_EditForm.hxx>
|
||||
#include <IFSelect_Editor.hxx>
|
||||
#include <IFSelect_ListEditor.hxx>
|
||||
#include <Interface_InterfaceModel.hxx>
|
||||
#include <Interface_MSG.hxx>
|
||||
#include <Interface_TypedValue.hxx>
|
||||
#include <Standard_Transient.hxx>
|
||||
#include <Standard_Type.hxx>
|
||||
#include <TCollection_HAsciiString.hxx>
|
||||
#include <TColStd_HSequenceOfHAsciiString.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(IFSelect_EditForm,Standard_Transient)
|
||||
|
||||
IFSelect_EditForm::IFSelect_EditForm
|
||||
(const Handle(IFSelect_Editor)& editor,
|
||||
const Standard_Boolean readonly, const Standard_Boolean undoable,
|
||||
const Standard_CString label)
|
||||
: thecomplete (Standard_True) ,
|
||||
theloaded (Standard_False) ,
|
||||
thekeepst (Standard_False) ,
|
||||
thelabel (label) ,
|
||||
thenums (0,1) ,
|
||||
theorigs (0, (undoable ? editor->NbValues() : 0) ) ,
|
||||
themodifs (0, (readonly ? 0 : editor->NbValues()) ) ,
|
||||
thestatus (0, (readonly ? 0 : editor->NbValues()) ) ,
|
||||
theeditor (editor) ,
|
||||
thetouched (0) { }
|
||||
|
||||
IFSelect_EditForm::IFSelect_EditForm
|
||||
(const Handle(IFSelect_Editor)& editor,
|
||||
const TColStd_SequenceOfInteger& nums,
|
||||
const Standard_Boolean readonly, const Standard_Boolean undoable,
|
||||
const Standard_CString label)
|
||||
: thecomplete (Standard_False) ,
|
||||
theloaded (Standard_False) ,
|
||||
thekeepst (Standard_False) ,
|
||||
thelabel (label) ,
|
||||
thenums (0,nums.Length()) ,
|
||||
theorigs (0, (undoable ? nums.Length() : 0) ) ,
|
||||
themodifs (0, (readonly ? 0 : nums.Length()) ) ,
|
||||
thestatus (0, (readonly ? 0 : nums.Length()) ) ,
|
||||
theeditor (editor) ,
|
||||
thetouched (0)
|
||||
{
|
||||
Standard_Integer i,nb = nums.Length();
|
||||
for (i = 1; i <= nb; i ++) thenums.SetValue (i,nums.Value(i));
|
||||
}
|
||||
|
||||
Standard_Boolean& IFSelect_EditForm::EditKeepStatus ()
|
||||
{ return thekeepst; }
|
||||
|
||||
Standard_CString IFSelect_EditForm::Label () const
|
||||
{ return thelabel.ToCString(); }
|
||||
|
||||
Standard_Boolean IFSelect_EditForm::IsLoaded () const
|
||||
{ return theloaded; }
|
||||
|
||||
void IFSelect_EditForm::ClearData ()
|
||||
{ theent.Nullify(); themodel.Nullify(); theloaded = Standard_False; }
|
||||
|
||||
void IFSelect_EditForm::SetData
|
||||
(const Handle(Standard_Transient)& ent,
|
||||
const Handle(Interface_InterfaceModel)& model)
|
||||
{ theent = ent; themodel = model; }
|
||||
|
||||
void IFSelect_EditForm::SetEntity
|
||||
(const Handle(Standard_Transient)& ent)
|
||||
{ theent = ent; }
|
||||
|
||||
void IFSelect_EditForm::SetModel
|
||||
(const Handle(Interface_InterfaceModel)& model)
|
||||
{ themodel = model; }
|
||||
|
||||
Handle(Standard_Transient) IFSelect_EditForm::Entity () const
|
||||
{ return theent; }
|
||||
|
||||
Handle(Interface_InterfaceModel) IFSelect_EditForm::Model () const
|
||||
{ return themodel; }
|
||||
|
||||
Handle(IFSelect_Editor) IFSelect_EditForm::Editor () const
|
||||
{ return theeditor; }
|
||||
|
||||
Standard_Boolean IFSelect_EditForm::IsComplete () const
|
||||
{ return thecomplete; }
|
||||
|
||||
Standard_Integer IFSelect_EditForm::NbValues
|
||||
(const Standard_Boolean editable) const
|
||||
{
|
||||
if (!editable || thecomplete) return theeditor->NbValues();
|
||||
return thenums.Upper();
|
||||
}
|
||||
|
||||
Standard_Integer IFSelect_EditForm::NumberFromRank
|
||||
(const Standard_Integer rank) const
|
||||
{
|
||||
if (thecomplete) return rank;
|
||||
if (rank < 1 || rank > thenums.Upper()) return 0;
|
||||
return thenums.Value(rank);
|
||||
}
|
||||
|
||||
Standard_Integer IFSelect_EditForm::RankFromNumber
|
||||
(const Standard_Integer num) const
|
||||
{
|
||||
if (thecomplete) return num;
|
||||
Standard_Integer i, n = thenums.Upper();
|
||||
for (i = 1; i <= n; i ++) {
|
||||
if (thenums.Value(i) == num) return i;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
Standard_Integer IFSelect_EditForm::NameNumber
|
||||
(const Standard_CString name) const
|
||||
{
|
||||
Standard_Integer res = theeditor->NameNumber(name);
|
||||
if (thecomplete || res == 0) return res;
|
||||
// Sinon, chercher res dans thenums
|
||||
Standard_Integer i, nb = thenums.Length();
|
||||
for (i = 1; i <= nb; i ++) {
|
||||
if (res == thenums.Value(i)) return res;
|
||||
}
|
||||
return -res;
|
||||
}
|
||||
|
||||
Standard_Integer IFSelect_EditForm::NameRank
|
||||
(const Standard_CString name) const
|
||||
{
|
||||
Standard_Integer res = theeditor->NameNumber(name);
|
||||
if (thecomplete || res == 0) return res;
|
||||
// Sinon, chercher res dans thenums
|
||||
Standard_Integer i, nb = thenums.Length();
|
||||
for (i = 1; i <= nb; i ++) {
|
||||
if (res == thenums.Value(i)) return i;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
void IFSelect_EditForm::LoadDefault ()
|
||||
{
|
||||
theloaded = Standard_True;
|
||||
thetouched = 0;
|
||||
Standard_Integer i,nb = theorigs.Upper();
|
||||
if (nb == 0) return;
|
||||
for (i = 1; i <= nb; i ++) {
|
||||
Standard_Integer num = NumberFromRank(i);
|
||||
if (num == 0) continue;
|
||||
Handle(TCollection_HAsciiString) str = theeditor->StringValue (this,num);
|
||||
theorigs.SetValue (i,str);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Standard_Boolean IFSelect_EditForm::LoadData
|
||||
(const Handle(Standard_Transient)& ent,
|
||||
const Handle(Interface_InterfaceModel)& model)
|
||||
{
|
||||
thetouched = 0;
|
||||
if (!theeditor->Load (this,ent,model)) return Standard_False;
|
||||
SetData (ent,model);
|
||||
theloaded = Standard_True;
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
Standard_Boolean IFSelect_EditForm::LoadEntity
|
||||
(const Handle(Standard_Transient)& ent)
|
||||
{
|
||||
thetouched = 0;
|
||||
Handle(Interface_InterfaceModel) model;
|
||||
if (!theeditor->Load (this,ent,model)) return Standard_False;
|
||||
SetEntity (ent);
|
||||
theloaded = Standard_True;
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
Standard_Boolean IFSelect_EditForm::LoadModel
|
||||
(const Handle(Interface_InterfaceModel)& model)
|
||||
{
|
||||
thetouched = 0;
|
||||
Handle(Standard_Transient) ent;
|
||||
if (!theeditor->Load (this,ent,model)) return Standard_False;
|
||||
SetData (ent,model);
|
||||
theloaded = Standard_True;
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
Standard_Boolean IFSelect_EditForm::LoadData ()
|
||||
{
|
||||
thetouched = 0;
|
||||
Handle(Interface_InterfaceModel) model;
|
||||
Handle(Standard_Transient) ent;
|
||||
if (!theeditor->Load (this,ent,model)) return Standard_False;
|
||||
theloaded = Standard_True;
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
|
||||
// ######## VALUES ########
|
||||
|
||||
Handle(IFSelect_ListEditor) IFSelect_EditForm::ListEditor
|
||||
(const Standard_Integer num) const
|
||||
{
|
||||
Standard_Integer n = RankFromNumber(num);
|
||||
Handle(IFSelect_ListEditor) led;
|
||||
if (n <= 0 || n > theorigs.Upper()) return led;
|
||||
if (!theeditor->IsList(n)) return led;
|
||||
led = theeditor->ListEditor (num);
|
||||
Handle(TColStd_HSequenceOfHAsciiString) lis = theeditor->ListValue(this,num);
|
||||
led->LoadModel (themodel);
|
||||
led->LoadValues (lis);
|
||||
return led;
|
||||
}
|
||||
|
||||
void IFSelect_EditForm::LoadValue
|
||||
(const Standard_Integer num, const Handle(TCollection_HAsciiString)& val)
|
||||
{
|
||||
Standard_Integer n = RankFromNumber(num);
|
||||
if (n <= 0 || n > theorigs.Upper()) return;
|
||||
theorigs.SetValue (n,val);
|
||||
}
|
||||
|
||||
void IFSelect_EditForm::LoadList
|
||||
(const Standard_Integer num, const Handle(TColStd_HSequenceOfHAsciiString)& list)
|
||||
{
|
||||
Standard_Integer n = RankFromNumber(num);
|
||||
if (n <= 0 || n > theorigs.Upper()) return;
|
||||
theorigs.SetValue (n,list);
|
||||
}
|
||||
|
||||
|
||||
Handle(TCollection_HAsciiString) IFSelect_EditForm::OriginalValue
|
||||
(const Standard_Integer num) const
|
||||
{
|
||||
Standard_Integer n = RankFromNumber(num);
|
||||
Handle(TCollection_HAsciiString) val;
|
||||
if (theorigs.Upper() == 0) return theeditor->StringValue (this,num);
|
||||
else return Handle(TCollection_HAsciiString)::DownCast(theorigs.Value(n));
|
||||
}
|
||||
|
||||
Handle(TColStd_HSequenceOfHAsciiString) IFSelect_EditForm::OriginalList
|
||||
(const Standard_Integer num) const
|
||||
{
|
||||
Standard_Integer n = RankFromNumber(num);
|
||||
Handle(TColStd_HSequenceOfHAsciiString) list;
|
||||
if (theorigs.Upper() == 0) return theeditor->ListValue (this,num);
|
||||
else return Handle(TColStd_HSequenceOfHAsciiString)::DownCast(theorigs.Value(n));
|
||||
}
|
||||
|
||||
Handle(TCollection_HAsciiString) IFSelect_EditForm::EditedValue
|
||||
(const Standard_Integer num) const
|
||||
{
|
||||
if (themodifs.Upper() == 0) return OriginalValue(num);
|
||||
if (!IsModified(num)) return OriginalValue(num);
|
||||
Standard_Integer n = RankFromNumber(num);
|
||||
return Handle(TCollection_HAsciiString)::DownCast(themodifs.Value(n));
|
||||
}
|
||||
|
||||
Handle(TColStd_HSequenceOfHAsciiString) IFSelect_EditForm::EditedList
|
||||
(const Standard_Integer num) const
|
||||
{
|
||||
if (themodifs.Upper() == 0) return OriginalList(num);
|
||||
if (!IsModified(num)) return OriginalList(num);
|
||||
Standard_Integer n = RankFromNumber(num);
|
||||
return Handle(TColStd_HSequenceOfHAsciiString)::DownCast(themodifs.Value(n));
|
||||
}
|
||||
|
||||
|
||||
Standard_Boolean IFSelect_EditForm::IsModified
|
||||
(const Standard_Integer num) const
|
||||
{
|
||||
if (thestatus.Upper() == 0) return Standard_False;
|
||||
Standard_Integer n = RankFromNumber(num);
|
||||
return (thestatus.Value(n) != 0);
|
||||
}
|
||||
|
||||
Standard_Boolean IFSelect_EditForm::IsTouched
|
||||
(const Standard_Integer num) const
|
||||
{
|
||||
if (thestatus.Upper() == 0) return Standard_False;
|
||||
Standard_Integer n = RankFromNumber(num);
|
||||
return (thestatus.Value(n) == 2);
|
||||
}
|
||||
|
||||
Standard_Boolean IFSelect_EditForm::Modify
|
||||
(const Standard_Integer num, const Handle(TCollection_HAsciiString)& newval,
|
||||
const Standard_Boolean enforce)
|
||||
{
|
||||
// Peut-on editer
|
||||
thetouched = 0;
|
||||
if (themodifs.Upper() == 0) return Standard_False;
|
||||
Standard_Integer tnum = RankFromNumber(num);
|
||||
if (tnum == 0) return Standard_False;
|
||||
IFSelect_EditValue acc = theeditor->EditMode (num);
|
||||
if (newval.IsNull() && acc != IFSelect_Optional) return Standard_False;
|
||||
if (!enforce && (acc == IFSelect_EditProtected || acc == IFSelect_EditComputed)) return Standard_False;
|
||||
|
||||
// Satisfies ?
|
||||
Handle(Interface_TypedValue) typval = theeditor->TypedValue(num);
|
||||
if (!typval->Satisfies(newval)) return Standard_False;
|
||||
Interface_ParamType pty = typval->Type();
|
||||
if (pty == Interface_ParamIdent && !newval.IsNull()) {
|
||||
if (themodel.IsNull()) return Standard_False;
|
||||
if (themodel->NextNumberForLabel(newval->ToCString(),0,Standard_False) <= 0)
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
// Update ?
|
||||
if (!theeditor->Update(this,num,newval,enforce)) return Standard_False;
|
||||
|
||||
thestatus.SetValue (tnum,1);
|
||||
themodifs.SetValue (tnum,newval);
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
Standard_Boolean IFSelect_EditForm::ModifyList
|
||||
(const Standard_Integer num, const Handle(IFSelect_ListEditor)& edited,
|
||||
const Standard_Boolean enforce)
|
||||
{
|
||||
// Faut-il prendre
|
||||
if (edited.IsNull()) return Standard_False;
|
||||
if (!edited->IsTouched()) return Standard_False;
|
||||
Handle(TColStd_HSequenceOfHAsciiString) newlist = edited->EditedValues();
|
||||
|
||||
// Peut-on editer
|
||||
thetouched = 0;
|
||||
if (themodifs.Upper() == 0) return Standard_False;
|
||||
Standard_Integer tnum = RankFromNumber(num);
|
||||
if (tnum == 0) return Standard_False;
|
||||
IFSelect_EditValue acc = theeditor->EditMode (num);
|
||||
if (acc == IFSelect_EditRead || acc == IFSelect_EditDynamic) return Standard_False;
|
||||
if (newlist.IsNull() && acc != IFSelect_Optional) return Standard_False;
|
||||
if (!enforce && (acc == IFSelect_EditProtected || acc == IFSelect_EditComputed)) return Standard_False;
|
||||
|
||||
// Update ?
|
||||
if (!theeditor->UpdateList(this,num,newlist,enforce)) return Standard_False;
|
||||
|
||||
thestatus.SetValue (tnum,1);
|
||||
themodifs.SetValue (tnum,newlist);
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
Standard_Boolean IFSelect_EditForm::ModifyListValue
|
||||
(const Standard_Integer num, const Handle(TColStd_HSequenceOfHAsciiString)& list,
|
||||
const Standard_Boolean enforce)
|
||||
{
|
||||
Handle(IFSelect_ListEditor) led = ListEditor (num);
|
||||
if (led.IsNull()) return Standard_False;
|
||||
if (!led->LoadEdited(list)) return Standard_False;
|
||||
return ModifyList (num,led,enforce);
|
||||
}
|
||||
|
||||
|
||||
Standard_Boolean IFSelect_EditForm::Touch
|
||||
(const Standard_Integer num, const Handle(TCollection_HAsciiString)& newval)
|
||||
{
|
||||
if (themodifs.Upper() == 0) return Standard_False;
|
||||
Standard_Integer tnum = RankFromNumber(num);
|
||||
if (tnum == 0) return Standard_False;
|
||||
|
||||
thestatus.SetValue (tnum,2);
|
||||
themodifs.SetValue (tnum,newval);
|
||||
thetouched ++;
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
Standard_Boolean IFSelect_EditForm::TouchList
|
||||
(const Standard_Integer num, const Handle(TColStd_HSequenceOfHAsciiString)& newlist)
|
||||
{
|
||||
if (themodifs.Upper() == 0) return Standard_False;
|
||||
Standard_Integer tnum = RankFromNumber(num);
|
||||
if (tnum == 0) return Standard_False;
|
||||
|
||||
thestatus.SetValue (tnum,2);
|
||||
themodifs.SetValue (tnum,newlist);
|
||||
thetouched ++;
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
|
||||
void IFSelect_EditForm::ClearEdit (const Standard_Integer num)
|
||||
{
|
||||
Standard_Integer i, nb = thestatus.Upper();
|
||||
if (num == 0) {
|
||||
for (i = 1; i <= nb; i ++) thestatus.SetValue (i,0);
|
||||
} else {
|
||||
Standard_Integer tnum = RankFromNumber(num);
|
||||
if (tnum > 0 && num <= nb) thestatus.SetValue (tnum,0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void IFSelect_EditForm::PrintDefs (Standard_OStream& S) const
|
||||
{
|
||||
Standard_Integer iv, nbv = NbValues(Standard_True);
|
||||
S<<"***** EditForm, Label : "<<Label()<<std::endl;
|
||||
if (IsComplete()) S<<"Complete, "<<nbv<<" Values"<<std::endl;
|
||||
else {
|
||||
S<<"Extraction on "<<nbv<<" Values : (extracted<-editor)"<<std::endl;
|
||||
for (iv = 1; iv <= nbv; iv ++) S<<" "<<iv<<"<-"<<NumberFromRank(iv);
|
||||
S<<std::endl;
|
||||
}
|
||||
S<<"*****"<<std::endl;
|
||||
}
|
||||
|
||||
|
||||
static void PrintList
|
||||
(const Handle(TColStd_HSequenceOfHAsciiString)& list,
|
||||
Standard_OStream& S, const Standard_Boolean alsolist)
|
||||
{
|
||||
if (list.IsNull()) { S<<"(NULL LIST)"<<std::endl; return; }
|
||||
|
||||
Standard_Integer i,nb = list->Length();
|
||||
S<<"(List : "<<nb<<" Items)"<<std::endl;
|
||||
if (!alsolist) return;
|
||||
|
||||
for (i = 1; i <= nb; i ++) {
|
||||
Handle(TCollection_HAsciiString) str = list->Value(i);
|
||||
S<<" ["<<i<<"] "<< (str.IsNull() ? "(NULL)" : str->ToCString())<<std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
void IFSelect_EditForm::PrintValues
|
||||
(Standard_OStream& S, const Standard_Integer what,
|
||||
const Standard_Boolean names, const Standard_Boolean alsolist) const
|
||||
{
|
||||
Standard_Integer iv, nbv = NbValues(Standard_True);
|
||||
S<< "****************************************************"<<std::endl;
|
||||
S<<"***** "<<Label()<<Interface_MSG::Blanks(Label(),40)<<"*****"<<std::endl;
|
||||
S<<"***** *****"<<std::endl;
|
||||
if (!theloaded)
|
||||
S<<"***** Values are NOT loaded *****"<<std::endl;
|
||||
|
||||
else {
|
||||
// Donnees sur lesquelles on a travaille
|
||||
if (themodel.IsNull()) {
|
||||
if (theent.IsNull()) S<<"***** No loaded data";
|
||||
else S<<"***** No loaded Model. Loaded object : type "<<theent->DynamicType()->Name();
|
||||
} else {
|
||||
if (theent.IsNull()) S<<"***** No loaded entity";
|
||||
else { S<<"***** Loaded entity : "; themodel->PrintLabel (theent, S); }
|
||||
}
|
||||
}
|
||||
S<<std::endl<<"****************************************************"<<std::endl<<std::endl;
|
||||
|
||||
// Affichage des valeurs
|
||||
Standard_Boolean nams = names;
|
||||
Standard_Integer maxnam = theeditor->MaxNameLength (names ? 0 : -1);
|
||||
if (maxnam == 0) { maxnam = theeditor->MaxNameLength (0); nams = Standard_True; }
|
||||
Standard_Integer nbmod = 0;
|
||||
if (what != 0) S<<"Mod N0 Name Value"<<std::endl;
|
||||
else S<<" N0 Name Value"<<std::endl;
|
||||
|
||||
for (iv = 1; iv <= nbv; iv ++) {
|
||||
Standard_Integer jv = NumberFromRank(iv);
|
||||
Standard_CString name = theeditor->Name(jv,!nams);
|
||||
|
||||
// Original ou Final
|
||||
if (what != 0) {
|
||||
Handle(TCollection_HAsciiString) str;
|
||||
if (IsModified(jv)) S<<"* ";
|
||||
else S<<" ";
|
||||
S<<Interface_MSG::Blanks(iv,3)<<iv<<" "
|
||||
<<name<<Interface_MSG::Blanks(name,maxnam)<<" ";
|
||||
|
||||
if (theeditor->IsList(jv)) {
|
||||
Handle(TColStd_HSequenceOfHAsciiString) list;
|
||||
if (what < 0) list = OriginalList (jv);
|
||||
if (what > 0) list = EditedList (jv);
|
||||
PrintList (list,S,alsolist);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (what < 0) str = OriginalValue (jv);
|
||||
if (what > 0) str = EditedValue (jv);
|
||||
|
||||
S<< (str.IsNull() ? "(NULL)" : str->ToCString()) <<std::endl;
|
||||
|
||||
// Modified only
|
||||
} else {
|
||||
if (!IsModified(jv)) continue;
|
||||
nbmod ++;
|
||||
if (theeditor->IsList(jv)) {
|
||||
Handle(TColStd_HSequenceOfHAsciiString) list= OriginalList (jv);
|
||||
S<<Interface_MSG::Blanks(iv,3)<<iv<<" "
|
||||
<<name<<Interface_MSG::Blanks(name,maxnam)<<" ORIG:";
|
||||
PrintList (list,S,alsolist);
|
||||
|
||||
list = EditedList (jv);
|
||||
S<<Interface_MSG::Blanks("",maxnam+5)<<"MOD :";
|
||||
PrintList (list,S,alsolist);
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
Handle(TCollection_HAsciiString) str = OriginalValue (jv);
|
||||
S<<Interface_MSG::Blanks(iv,3)<<iv<<" "
|
||||
<<name<<Interface_MSG::Blanks(name,maxnam)<<" ORIG:"
|
||||
<< (str.IsNull() ? "(NULL)" : str->ToCString()) <<std::endl;
|
||||
str = EditedValue (jv);
|
||||
S<<Interface_MSG::Blanks("",maxnam+4)<<" MOD :"<< (str.IsNull() ? "(NULL)" : str->ToCString()) <<std::endl;
|
||||
}
|
||||
}
|
||||
if (what == 0) S<<"On "<<nbv<<" Values, "<<nbmod<<" Modified"<<std::endl;
|
||||
}
|
||||
|
||||
|
||||
Standard_Boolean IFSelect_EditForm::Apply ()
|
||||
{
|
||||
Standard_Boolean stat = ApplyData(theent,themodel);
|
||||
if (stat && !thekeepst) ClearEdit();
|
||||
return stat;
|
||||
}
|
||||
|
||||
|
||||
Standard_Boolean IFSelect_EditForm::Recognize () const
|
||||
{ return theeditor->Recognize(this); }
|
||||
|
||||
Standard_Boolean IFSelect_EditForm::ApplyData
|
||||
(const Handle(Standard_Transient)& ent,
|
||||
const Handle(Interface_InterfaceModel)& model)
|
||||
{ return theeditor->Apply (this,ent,model); }
|
||||
|
||||
|
||||
Standard_Boolean IFSelect_EditForm::Undo ()
|
||||
{
|
||||
if (thestatus.Upper() == 0 || theorigs.Upper() == 0) return Standard_False;
|
||||
Standard_Integer i, nb = thestatus.Upper();
|
||||
for (i = 1; i <= nb; i ++) {
|
||||
if (thestatus.Value (i) != 0) themodifs.SetValue (i,theorigs.Value(i));
|
||||
}
|
||||
return Apply ();
|
||||
}
|
@@ -1,294 +0,0 @@
|
||||
// Created on: 1998-02-23
|
||||
// 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 _IFSelect_EditForm_HeaderFile
|
||||
#define _IFSelect_EditForm_HeaderFile
|
||||
|
||||
#include <Standard.hxx>
|
||||
|
||||
#include <TColStd_Array1OfInteger.hxx>
|
||||
#include <TColStd_Array1OfTransient.hxx>
|
||||
#include <Standard_Integer.hxx>
|
||||
#include <Standard_Transient.hxx>
|
||||
#include <TColStd_SequenceOfInteger.hxx>
|
||||
#include <TColStd_HSequenceOfHAsciiString.hxx>
|
||||
class IFSelect_Editor;
|
||||
class Interface_InterfaceModel;
|
||||
class IFSelect_ListEditor;
|
||||
class TCollection_HAsciiString;
|
||||
|
||||
class IFSelect_EditForm;
|
||||
DEFINE_STANDARD_HANDLE(IFSelect_EditForm, Standard_Transient)
|
||||
|
||||
//! An EditForm is the way to apply an Editor on an Entity or on
|
||||
//! the Model
|
||||
//! It gives read-only or read-write access, with or without undo
|
||||
//!
|
||||
//! It can be complete (all the values of the Editor are present)
|
||||
//! or partial (a sub-list of these value are present)
|
||||
//! Anyway, all references to Number (argument <num>) refer to
|
||||
//! Number of Value for the Editor
|
||||
//! While references to Rank are for rank in the EditForm, which
|
||||
//! may differ if it is not Complete
|
||||
//! Two methods give the correspondence between this Number and
|
||||
//! the Rank in the EditForm : RankFromNumber and NumberFromRank
|
||||
class IFSelect_EditForm : public Standard_Transient
|
||||
{
|
||||
public:
|
||||
|
||||
//! Creates a complete EditForm from an Editor
|
||||
//! A specific Label can be given
|
||||
Standard_EXPORT IFSelect_EditForm(const Handle(IFSelect_Editor)& editor, const Standard_Boolean readonly, const Standard_Boolean undoable, const Standard_CString label = "");
|
||||
|
||||
//! Creates an extracted EditForm from an Editor, limited to
|
||||
//! the values identified in <nums>
|
||||
//! A specific Label can be given
|
||||
Standard_EXPORT IFSelect_EditForm(const Handle(IFSelect_Editor)& editor, const TColStd_SequenceOfInteger& nums, const Standard_Boolean readonly, const Standard_Boolean undoable, const Standard_CString label = "");
|
||||
|
||||
//! Returns and may change the keep status on modif
|
||||
//! It starts as False
|
||||
//! If it is True, Apply does not clear modification status
|
||||
//! and the EditForm can be loaded again, modified value remain
|
||||
//! and may be applied again
|
||||
//! Remark that ApplyData does not clear the modification status,
|
||||
//! a call to ClearEdit does
|
||||
Standard_EXPORT Standard_Boolean& EditKeepStatus();
|
||||
|
||||
Standard_EXPORT Standard_CString Label() const;
|
||||
|
||||
//! Tells if the EditForm is loaded now
|
||||
Standard_EXPORT Standard_Boolean IsLoaded() const;
|
||||
|
||||
Standard_EXPORT void ClearData();
|
||||
|
||||
Standard_EXPORT void SetData (const Handle(Standard_Transient)& ent, const Handle(Interface_InterfaceModel)& model);
|
||||
|
||||
Standard_EXPORT void SetEntity (const Handle(Standard_Transient)& ent);
|
||||
|
||||
Standard_EXPORT void SetModel (const Handle(Interface_InterfaceModel)& model);
|
||||
|
||||
Standard_EXPORT Handle(Standard_Transient) Entity() const;
|
||||
|
||||
Standard_EXPORT Handle(Interface_InterfaceModel) Model() const;
|
||||
|
||||
Standard_EXPORT Handle(IFSelect_Editor) Editor() const;
|
||||
|
||||
//! Tells if an EditForm is complete or is an extract from Editor
|
||||
Standard_EXPORT Standard_Boolean IsComplete() const;
|
||||
|
||||
//! Returns the count of values
|
||||
//! <editable> True : count of editable values, i.e.
|
||||
//! For a complete EditForm, it is given by the Editor
|
||||
//! Else, it is the length of the extraction map
|
||||
//! <editable> False : all the values from the Editor
|
||||
Standard_EXPORT Standard_Integer NbValues (const Standard_Boolean editable) const;
|
||||
|
||||
//! Returns the Value Number in the Editor from a given Rank in
|
||||
//! the EditForm
|
||||
//! For a complete EditForm, both are equal
|
||||
//! Else, it is given by the extraction map
|
||||
//! Returns 0 if <rank> exceeds the count of editable values,
|
||||
Standard_EXPORT Standard_Integer NumberFromRank (const Standard_Integer rank) const;
|
||||
|
||||
//! Returns the Rank in the EditForm from a given Number of Value
|
||||
//! for the Editor
|
||||
//! For a complete EditForm, both are equal
|
||||
//! Else, it is given by the extraction map
|
||||
//! Returns 0 if <number> is not forecast to be edited, or is
|
||||
//! out of range
|
||||
Standard_EXPORT Standard_Integer RankFromNumber (const Standard_Integer number) const;
|
||||
|
||||
//! Returns the Value Number in the Editor for a given Name
|
||||
//! i.e. the true ValueNumber which can be used in various methods
|
||||
//! of EditForm
|
||||
//! If it is not complete, for a recorded (in the Editor) but
|
||||
//! non-loaded name, returns negative value (- number)
|
||||
Standard_EXPORT Standard_Integer NameNumber (const Standard_CString name) const;
|
||||
|
||||
//! Returns the Rank of Value in the EditForm for a given Name
|
||||
//! i.e. if it is not complete, for a recorded (in the Editor) but
|
||||
//! non-loaded name, returns 0
|
||||
Standard_EXPORT Standard_Integer NameRank (const Standard_CString name) const;
|
||||
|
||||
//! For a read-write undoable EditForm, loads original values
|
||||
//! from defaults stored in the Editor
|
||||
Standard_EXPORT void LoadDefault();
|
||||
|
||||
//! Loads modifications to data
|
||||
//! Default uses Editor. Can be redefined
|
||||
//! Remark that <ent> and/or <model> may be null, according to the
|
||||
//! kind of Editor. Shortcuts are available for these cases, but
|
||||
//! they finally call LoadData (hence, just ignore non-used args)
|
||||
Standard_EXPORT virtual Standard_Boolean LoadData (const Handle(Standard_Transient)& ent, const Handle(Interface_InterfaceModel)& model);
|
||||
|
||||
//! Shortcut for LoadData when <model> is not used
|
||||
Standard_EXPORT Standard_Boolean LoadEntity (const Handle(Standard_Transient)& ent);
|
||||
|
||||
//! Shortcut for LoadData when only the model is concerned
|
||||
Standard_EXPORT Standard_Boolean LoadModel (const Handle(Interface_InterfaceModel)& model);
|
||||
|
||||
//! Shortcut when both <ent> and <model> are not used
|
||||
//! (when the Editor works on fully static or global data)
|
||||
Standard_EXPORT Standard_Boolean LoadData();
|
||||
|
||||
//! Returns a ListEditor to edit the parameter <num> of the
|
||||
//! EditForm, if it is a List
|
||||
//! The Editor created it (by ListEditor) then loads it (by
|
||||
//! ListValue)
|
||||
//! For a single parameter, returns a Null Handle ...
|
||||
Standard_EXPORT Handle(IFSelect_ListEditor) ListEditor (const Standard_Integer num) const;
|
||||
|
||||
//! Loads an original value (single). Called by the Editor only
|
||||
Standard_EXPORT void LoadValue (const Standard_Integer num, const Handle(TCollection_HAsciiString)& val);
|
||||
|
||||
//! Loads an original value as a list. Called by the Editor only
|
||||
Standard_EXPORT void LoadList (const Standard_Integer num, const Handle(TColStd_HSequenceOfHAsciiString)& list);
|
||||
|
||||
//! From an edited value, returns its ... value (original one)
|
||||
//! Null means that this value is not defined
|
||||
//! <num> is for the EditForm, not the Editor
|
||||
//! It is for a single parameter. For a list, gives a Null Handle
|
||||
Standard_EXPORT Handle(TCollection_HAsciiString) OriginalValue (const Standard_Integer num) const;
|
||||
|
||||
//! Returns an original value, as a list
|
||||
//! <num> is for the EditForm, not the Editor
|
||||
//! For a single parameter, gives a Null Handle
|
||||
Standard_EXPORT Handle(TColStd_HSequenceOfHAsciiString) OriginalList (const Standard_Integer num) const;
|
||||
|
||||
//! Returns the Edited (i.e. Modified) Value (string for single)
|
||||
//! <num> reports to the EditForm
|
||||
//! If IsModified is False, returns OriginalValue
|
||||
//! Null with IsModified True : means that this value is not
|
||||
//! defined or has been removed
|
||||
//! It is for a single parameter. For a list, gives a Null Handle
|
||||
Standard_EXPORT Handle(TCollection_HAsciiString) EditedValue (const Standard_Integer num) const;
|
||||
|
||||
//! Returns the Edited Value as a list
|
||||
//! If IsModified is False, returns OriginalValue
|
||||
//! Null with IsModified True : means that this value is not
|
||||
//! defined or has been removed
|
||||
//! For a single parameter, gives a Null Handle
|
||||
Standard_EXPORT Handle(TColStd_HSequenceOfHAsciiString) EditedList (const Standard_Integer num) const;
|
||||
|
||||
//! Tells if a Value (of the EditForm) is modified (directly or
|
||||
//! through touching by Update)
|
||||
Standard_EXPORT Standard_Boolean IsModified (const Standard_Integer num) const;
|
||||
|
||||
//! Tells if a Value (of the EditForm) has been touched, i.e.
|
||||
//! not modified directly but by the modification of another one
|
||||
//! (by method Update from the Editor)
|
||||
Standard_EXPORT Standard_Boolean IsTouched (const Standard_Integer num) const;
|
||||
|
||||
//! Gives a new value for the item <num> of the EditForm, if
|
||||
//! it is a single parameter (for a list, just returns False)
|
||||
//! Null means to Remove it
|
||||
//! <enforce> True to overpass Protected or Computed Access Mode
|
||||
//! Calls the method Update from the Editor, which can touch other
|
||||
//! parameters (see NbTouched)
|
||||
//! Returns True if well recorded, False if this value is not
|
||||
//! allowed
|
||||
//! Warning : Does not apply immediately : will be applied by the method
|
||||
//! Apply
|
||||
Standard_EXPORT Standard_Boolean Modify (const Standard_Integer num, const Handle(TCollection_HAsciiString)& newval, const Standard_Boolean enforce = Standard_False);
|
||||
|
||||
//! Changes the value of an item of the EditForm, if it is a List
|
||||
//! (else, just returns False)
|
||||
//! The ListEditor contains the edited values of the list
|
||||
//! If no edition was recorded, just returns False
|
||||
//! Calls the method Update from the Editor, which can touch other
|
||||
//! parameters (see NbTouched)
|
||||
//! Returns True if well recorded, False if this value is not
|
||||
//! allowed
|
||||
//! Warning : Does not apply immediately : will be applied by the method
|
||||
//! Apply
|
||||
Standard_EXPORT Standard_Boolean ModifyList (const Standard_Integer num, const Handle(IFSelect_ListEditor)& edited, const Standard_Boolean enforce = Standard_False);
|
||||
|
||||
//! As ModifyList but the new value is given as such
|
||||
//! Creates a ListEditor, Loads it, then calls ModifyList
|
||||
Standard_EXPORT Standard_Boolean ModifyListValue (const Standard_Integer num, const Handle(TColStd_HSequenceOfHAsciiString)& list, const Standard_Boolean enforce = Standard_False);
|
||||
|
||||
//! Gives a new value computed by the Editor, if another parameter
|
||||
//! commands the value of <num>
|
||||
//! It is generally the case for a Computed Parameter for instance
|
||||
//! Increments the counter of touched parameters
|
||||
//! Warning : it gives no protection for ReadOnly etc... while it is the
|
||||
//! internal way of touching parameters
|
||||
//! Does not work (returns False) if <num> is for a list
|
||||
Standard_EXPORT Standard_Boolean Touch (const Standard_Integer num, const Handle(TCollection_HAsciiString)& newval);
|
||||
|
||||
//! Acts as Touch but for a list
|
||||
//! Does not work (returns False) if <num> is for a single param
|
||||
Standard_EXPORT Standard_Boolean TouchList (const Standard_Integer num, const Handle(TColStd_HSequenceOfHAsciiString)& newlist);
|
||||
|
||||
//! Returns the count of parameters touched by the last Modify
|
||||
//! (apart from the modified parameter itself)
|
||||
//! Normally it is zero
|
||||
Standard_EXPORT Standard_Integer NbTouched() const;
|
||||
|
||||
//! Clears modification status : by default all, or one by its
|
||||
//! numbers (in the Editor)
|
||||
Standard_EXPORT void ClearEdit (const Standard_Integer num = 0);
|
||||
|
||||
//! Prints Definitions, relative to the Editor
|
||||
Standard_EXPORT void PrintDefs (Standard_OStream& S) const;
|
||||
|
||||
//! Prints Values, according to what and alsolist
|
||||
//! <names> True : prints Long Names; False : prints Short Names
|
||||
//! <what> < 0 : prints Original Values (+ flag Modified)
|
||||
//! <what> > 0 : prints Final Values (+flag Modified)
|
||||
//! <what> = 0 : prints Modified Values (Original + Edited)
|
||||
//! <alsolist> False (D) : lists are printed only as their count
|
||||
//! <alsolist> True : lists are printed for all their items
|
||||
Standard_EXPORT void PrintValues (Standard_OStream& S, const Standard_Integer what, const Standard_Boolean names, const Standard_Boolean alsolist = Standard_False) const;
|
||||
|
||||
//! Applies modifications to own data
|
||||
//! Calls ApplyData then Clears Status according EditKeepStatus
|
||||
Standard_EXPORT Standard_Boolean Apply();
|
||||
|
||||
//! Tells if this EditForm can work with its Editor and its actual
|
||||
//! Data (Entity and Model)
|
||||
//! Default uses Editor. Can be redefined
|
||||
Standard_EXPORT virtual Standard_Boolean Recognize() const;
|
||||
|
||||
//! Applies modifications to data
|
||||
//! Default uses Editor. Can be redefined
|
||||
Standard_EXPORT virtual Standard_Boolean ApplyData (const Handle(Standard_Transient)& ent, const Handle(Interface_InterfaceModel)& model);
|
||||
|
||||
//! For an undoable EditForm, Applies ... origibal values !
|
||||
//! and clears modified ones
|
||||
//! Can be run only once
|
||||
Standard_EXPORT Standard_Boolean Undo();
|
||||
|
||||
DEFINE_STANDARD_RTTIEXT(IFSelect_EditForm,Standard_Transient)
|
||||
|
||||
private:
|
||||
|
||||
Standard_Boolean thecomplete;
|
||||
Standard_Boolean theloaded;
|
||||
Standard_Boolean thekeepst;
|
||||
TCollection_AsciiString thelabel;
|
||||
TColStd_Array1OfInteger thenums;
|
||||
TColStd_Array1OfTransient theorigs;
|
||||
TColStd_Array1OfTransient themodifs;
|
||||
TColStd_Array1OfInteger thestatus;
|
||||
Handle(IFSelect_Editor) theeditor;
|
||||
Handle(Standard_Transient) theent;
|
||||
Handle(Interface_InterfaceModel) themodel;
|
||||
Standard_Integer thetouched;
|
||||
|
||||
};
|
||||
|
||||
#endif // _IFSelect_EditForm_HeaderFile
|
@@ -1,37 +0,0 @@
|
||||
// Created on: 1992-09-21
|
||||
// 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 _IFSelect_EditValue_HeaderFile
|
||||
#define _IFSelect_EditValue_HeaderFile
|
||||
|
||||
//! Controls access on Values by an Editor
|
||||
//! EditOptional : normal access, in addition may be removed
|
||||
//! Editable : normal access, must be present
|
||||
//! EditProtected : access must be validated
|
||||
//! EditComputed : why write it ? it will be recomputed
|
||||
//! EditRead : no way to write it, only for read
|
||||
//! EditDynamic : not a field, only to be displayed
|
||||
enum IFSelect_EditValue
|
||||
{
|
||||
IFSelect_Optional,
|
||||
IFSelect_Editable,
|
||||
IFSelect_EditProtected,
|
||||
IFSelect_EditComputed,
|
||||
IFSelect_EditRead,
|
||||
IFSelect_EditDynamic
|
||||
};
|
||||
|
||||
#endif // _IFSelect_EditValue_HeaderFile
|
@@ -1,230 +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 <IFSelect_EditForm.hxx>
|
||||
#include <IFSelect_Editor.hxx>
|
||||
#include <IFSelect_ListEditor.hxx>
|
||||
#include <Interface_InterfaceModel.hxx>
|
||||
#include <Interface_MSG.hxx>
|
||||
#include <Interface_TypedValue.hxx>
|
||||
#include <Standard_OutOfRange.hxx>
|
||||
#include <Standard_Transient.hxx>
|
||||
#include <Standard_Type.hxx>
|
||||
#include <TCollection_AsciiString.hxx>
|
||||
#include <TCollection_HAsciiString.hxx>
|
||||
|
||||
#include <string.h>
|
||||
IMPLEMENT_STANDARD_RTTIEXT(IFSelect_Editor,Standard_Transient)
|
||||
|
||||
IFSelect_Editor::IFSelect_Editor (const Standard_Integer nbval)
|
||||
: thenbval (nbval) , themaxsh (0) , themaxco (0) , themaxla (0) ,
|
||||
thevalues (1,nbval) , theshorts (1,nbval) , themodes (1,nbval) ,
|
||||
thelists (1,nbval)
|
||||
{ thelists.Init(-1); }
|
||||
|
||||
void IFSelect_Editor::SetNbValues (const Standard_Integer nbval)
|
||||
{
|
||||
if (nbval > thevalues.Upper()) throw Standard_OutOfRange("IFSelect_Editor:SetNbValues");
|
||||
thenbval = nbval;
|
||||
}
|
||||
|
||||
void IFSelect_Editor::SetValue
|
||||
(const Standard_Integer num, const Handle(Interface_TypedValue)& typval,
|
||||
const Standard_CString shortname, const IFSelect_EditValue editmode)
|
||||
{
|
||||
if (num < 1 || num > thenbval) return;
|
||||
TCollection_AsciiString shn (shortname);
|
||||
Standard_Integer lng = shn.Length();
|
||||
if (lng > 0) thenames.Bind (shortname,num);
|
||||
if (lng > themaxsh) themaxsh = lng;
|
||||
lng = (Standard_Integer) strlen (typval->Name());
|
||||
if (lng > themaxco) themaxco = lng;
|
||||
lng = (Standard_Integer) strlen (typval->Label());
|
||||
if (lng > themaxla) themaxla = lng;
|
||||
|
||||
thenames.Bind (typval->Name(),num);
|
||||
Standard_Integer edm = (Standard_Integer) editmode;
|
||||
thevalues.SetValue (num,typval);
|
||||
theshorts.SetValue (num,shn);
|
||||
themodes.SetValue (num,edm);
|
||||
}
|
||||
|
||||
void IFSelect_Editor::SetList
|
||||
(const Standard_Integer num, const Standard_Integer max)
|
||||
{
|
||||
if (num < 1 || num > thenbval) return;
|
||||
thelists.SetValue (num,max);
|
||||
}
|
||||
|
||||
Standard_Integer IFSelect_Editor::NbValues () const
|
||||
{ return thenbval; }
|
||||
|
||||
Handle(Interface_TypedValue) IFSelect_Editor::TypedValue
|
||||
(const Standard_Integer num) const
|
||||
{ return Handle(Interface_TypedValue)::DownCast(thevalues.Value(num)); }
|
||||
|
||||
Standard_Boolean IFSelect_Editor::IsList (const Standard_Integer num) const
|
||||
{
|
||||
if (num < 1 || num > thenbval) return Standard_False;
|
||||
return (thelists.Value(num) >= 0);
|
||||
}
|
||||
|
||||
Standard_Integer IFSelect_Editor::MaxList (const Standard_Integer num) const
|
||||
{
|
||||
if (num < 1 || num > thenbval) return -1;
|
||||
return thelists.Value(num);
|
||||
}
|
||||
|
||||
Standard_CString IFSelect_Editor::Name
|
||||
(const Standard_Integer num, const Standard_Boolean isshort) const
|
||||
{
|
||||
if (num < 1 || num > thenbval) return "";
|
||||
if (isshort) return theshorts.Value (num).ToCString();
|
||||
else return TypedValue (num)->Name();
|
||||
}
|
||||
|
||||
IFSelect_EditValue IFSelect_Editor::EditMode
|
||||
(const Standard_Integer num) const
|
||||
{
|
||||
if (num < 1 || num > thenbval) return IFSelect_EditDynamic;
|
||||
Standard_Integer edm = themodes.Value(num);
|
||||
return (IFSelect_EditValue) edm;
|
||||
}
|
||||
|
||||
void IFSelect_Editor::PrintNames (Standard_OStream& S) const
|
||||
{
|
||||
Standard_Integer i, nb = NbValues();
|
||||
S<<"**** Editor : "<<Label()<<std::endl;
|
||||
S<<"**** Nb Values = "<<nb<<" **** Names / Labels"<<std::endl;
|
||||
S<<" Num ";
|
||||
if (themaxsh > 0) S<<"Short"<<Interface_MSG::Blanks("Short",themaxsh)<<" ";
|
||||
S<<"Complete"<<Interface_MSG::Blanks("Complete",themaxco)<<" Label"<<std::endl;
|
||||
|
||||
for (i = 1; i <= nb; i ++) {
|
||||
Handle(Interface_TypedValue) tv = TypedValue(i);
|
||||
if (tv.IsNull()) continue;
|
||||
S<<Interface_MSG::Blanks(i,3)<<i<<" ";
|
||||
if (themaxsh > 0) {
|
||||
const TCollection_AsciiString& sho = theshorts(i);
|
||||
S<<sho<<Interface_MSG::Blanks(sho.ToCString(),themaxsh)<<" ";
|
||||
}
|
||||
S<<tv->Name()<<Interface_MSG::Blanks(tv->Name(),themaxco)<<" "<<tv->Label()<<std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
void IFSelect_Editor::PrintDefs
|
||||
(Standard_OStream& S, const Standard_Boolean labels) const
|
||||
{
|
||||
Standard_Integer i, nb = NbValues();
|
||||
S<<"**** Editor : "<<Label()<<std::endl;
|
||||
S<<"**** Nb Values = "<<nb<<" **** "<<(labels ? "Labels" : "Names")<<" / Definitions"<<std::endl;
|
||||
S<<" Num ";
|
||||
if (labels) S<<"Label"<<Interface_MSG::Blanks("Label",themaxla);
|
||||
else {
|
||||
if (themaxsh > 0) S<<"Short"<<Interface_MSG::Blanks("Short",themaxsh+1);
|
||||
S<<"Complete"<<Interface_MSG::Blanks("Complete",themaxco);
|
||||
}
|
||||
S<<" Edit Mode & Definition"<<std::endl;
|
||||
|
||||
for (i = 1; i <= nb; i ++) {
|
||||
Handle(Interface_TypedValue) tv = TypedValue(i);
|
||||
if (tv.IsNull()) continue;
|
||||
S<<" "<<Interface_MSG::Blanks(i,3)<<i<<" ";
|
||||
if (labels) S<<tv->Label()<<Interface_MSG::Blanks(tv->Label(),themaxla);
|
||||
else {
|
||||
if (themaxsh > 0) {
|
||||
const TCollection_AsciiString& sho = theshorts(i);
|
||||
S<<sho<<Interface_MSG::Blanks(sho.ToCString(),themaxsh)<<" ";
|
||||
}
|
||||
S<<tv->Name()<<Interface_MSG::Blanks(tv->Name(),themaxco);
|
||||
}
|
||||
|
||||
S<<" ";
|
||||
Standard_Integer maxls = MaxList (i);
|
||||
if (maxls == 0) S<<" (List) ";
|
||||
else if (maxls > 0) S<<" (List <= "<<maxls<<" Items) ";
|
||||
else S<<" ";
|
||||
IFSelect_EditValue edm = EditMode (i);
|
||||
switch (edm) {
|
||||
case IFSelect_Optional : S<<"Optional "; break;
|
||||
case IFSelect_Editable : S<<"Editable "; break;
|
||||
case IFSelect_EditProtected : S<<"Protected"; break;
|
||||
case IFSelect_EditComputed : S<<"Computed "; break;
|
||||
case IFSelect_EditRead : S<<"ReadOnly "; break;
|
||||
case IFSelect_EditDynamic : S<<"Dynamic "; break;
|
||||
default : S<<"?????????"; break;
|
||||
}
|
||||
|
||||
S<<" "<<tv->Definition()<<std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Standard_Integer IFSelect_Editor::MaxNameLength
|
||||
(const Standard_Integer what) const
|
||||
{
|
||||
if (what == -1) return themaxsh;
|
||||
if (what == 0) return themaxco;
|
||||
if (what == 1) return themaxla;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
Standard_Integer IFSelect_Editor::NameNumber
|
||||
(const Standard_CString name) const
|
||||
{
|
||||
Standard_Integer res;
|
||||
if (thenames.Find(name,res))
|
||||
return res;
|
||||
res = atoi (name); // si c est un entier, on tente le coup
|
||||
if (res < 1 || res > NbValues()) res = 0;
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
Handle(IFSelect_EditForm) IFSelect_Editor::Form
|
||||
(const Standard_Boolean readonly, const Standard_Boolean undoable) const
|
||||
{
|
||||
return new IFSelect_EditForm (this,readonly,undoable,Label().ToCString());
|
||||
}
|
||||
|
||||
Handle(IFSelect_ListEditor) IFSelect_Editor::ListEditor
|
||||
(const Standard_Integer num) const
|
||||
{
|
||||
Handle(IFSelect_ListEditor) led;
|
||||
Standard_Integer max = MaxList (num);
|
||||
if (max < 0) return led;
|
||||
led = new IFSelect_ListEditor (TypedValue(num),max);
|
||||
return led;
|
||||
}
|
||||
|
||||
Handle(TColStd_HSequenceOfHAsciiString) IFSelect_Editor::ListValue
|
||||
(const Handle(IFSelect_EditForm)& /*form*/, const Standard_Integer /*num*/) const
|
||||
{
|
||||
Handle(TColStd_HSequenceOfHAsciiString) list;
|
||||
return list;
|
||||
}
|
||||
|
||||
|
||||
Standard_Boolean IFSelect_Editor::Update
|
||||
(const Handle(IFSelect_EditForm)& /*form*/, const Standard_Integer /*num*/,
|
||||
const Handle(TCollection_HAsciiString)& /*newval*/,
|
||||
const Standard_Boolean /*enforce*/) const
|
||||
{ return Standard_True; }
|
||||
|
||||
Standard_Boolean IFSelect_Editor::UpdateList
|
||||
(const Handle(IFSelect_EditForm)& /*form*/, const Standard_Integer /*num*/,
|
||||
const Handle(TColStd_HSequenceOfHAsciiString)& /*newval*/,
|
||||
const Standard_Boolean /*enforce*/) const
|
||||
{ return Standard_True; }
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user