mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-19 13:40:49 +03:00
Compare commits
1 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
68d403eda6 |
@@ -686,17 +686,6 @@ proc OCCDoc_MakeDoxyfile {docType outDir tagFileDir {doxyFileName} {generatorMod
|
||||
# Write specific options
|
||||
if { $docType == "REFMAN" } {
|
||||
|
||||
# always include optional components
|
||||
set aHaveD3dBack ""
|
||||
set aHaveGlesBack ""
|
||||
set aHaveVtkBack ""
|
||||
if { [info exists ::env(HAVE_D3D)] } { set aHaveD3dBack "$::env(HAVE_D3D)" }
|
||||
if { [info exists ::env(HAVE_GLES2)] } { set aHaveGlesBack "$::env(HAVE_GLES2)" }
|
||||
if { [info exists ::env(HAVE_VTK)] } { set aHaveVtkBack "$::env(HAVE_VTK)" }
|
||||
set ::env(HAVE_D3D) "true"
|
||||
set ::env(HAVE_GLES2) "true"
|
||||
set ::env(HAVE_VTK) "true"
|
||||
|
||||
# Load lists of modules scripts
|
||||
if { $productsPath == "" } {
|
||||
set modules_scripts [glob -nocomplain -type f -directory "[OCCDoc_GetSourceDir $productsPath]/OS/" *.tcl]
|
||||
@@ -822,11 +811,6 @@ proc OCCDoc_MakeDoxyfile {docType outDir tagFileDir {doxyFileName} {generatorMod
|
||||
|
||||
puts $doxyFile ""
|
||||
|
||||
# restore environment variables
|
||||
set ::env(HAVE_D3D) "$aHaveD3dBack"
|
||||
set ::env(HAVE_GLES2) "$aHaveGlesBack"
|
||||
set ::env(HAVE_VTK) "$aHaveVtkBack"
|
||||
|
||||
} elseif { $docType == "OVERVIEW" } {
|
||||
|
||||
# Add common options for generation of Overview and User Guides
|
||||
|
@@ -577,7 +577,7 @@ bool OcctJni_Viewer::saveSnapshot (const TCollection_AsciiString& thePath,
|
||||
}
|
||||
|
||||
Image_AlienPixMap anAlienImage;
|
||||
if (!anAlienImage.InitTrash (Image_Format_BGRA, theWidth, theHeight))
|
||||
if (!anAlienImage.InitTrash (Image_PixMap::ImgBGRA, theWidth, theHeight))
|
||||
{
|
||||
Message::DefaultMessenger()->Send (TCollection_AsciiString() + "RGBA image " + theWidth + "x" + theHeight + " allocation failed", Message_Fail);
|
||||
return false;
|
||||
@@ -586,7 +586,7 @@ bool OcctJni_Viewer::saveSnapshot (const TCollection_AsciiString& thePath,
|
||||
// OpenGL ES does not support fetching data in BGRA format
|
||||
// while FreeImage does not support RGBA format.
|
||||
Image_PixMap anImage;
|
||||
anImage.InitWrapper (Image_Format_RGBA,
|
||||
anImage.InitWrapper (Image_PixMap::ImgRGBA,
|
||||
anAlienImage.ChangeData(),
|
||||
anAlienImage.SizeX(),
|
||||
anAlienImage.SizeY(),
|
||||
|
@@ -217,7 +217,7 @@ void OCC_2dView::OnUpdateBUTTONGridCancel(CCmdUI* pCmdUI)
|
||||
void OCC_2dView::OnSize(UINT nType, int cx, int cy)
|
||||
{
|
||||
OCC_BaseView::OnSize (nType, cx, cy);
|
||||
// Take care : This function is called before OnInitialUpdate
|
||||
// Take care : This fonction is call before OnInitialUpdate
|
||||
if (!myView.IsNull())
|
||||
myView->MustBeResized();
|
||||
}
|
||||
|
@@ -29,7 +29,6 @@
|
||||
#include <GeometryTest.hxx>
|
||||
#include <Draw_Interpretor.hxx>
|
||||
#include <Draw_Appli.hxx>
|
||||
#include <Draw_ProgressIndicator.hxx>
|
||||
#include <DrawTrSurf.hxx>
|
||||
#include <TopAbs_ShapeEnum.hxx>
|
||||
#include <TopoDS.hxx>
|
||||
@@ -168,13 +167,8 @@ static Standard_Integer plate (Draw_Interpretor & di,Standard_Integer n,const ch
|
||||
NbPtsCur->Value(i));
|
||||
Henri.Add(Cont);
|
||||
}
|
||||
Handle(Draw_ProgressIndicator) aProgress = new Draw_ProgressIndicator(di, 1);
|
||||
Henri.Perform(aProgress->Start());
|
||||
if (aProgress->UserBreak())
|
||||
{
|
||||
di << "Error: UserBreak\n";
|
||||
return 0;
|
||||
}
|
||||
|
||||
Henri.Perform();
|
||||
|
||||
Standard_Real ErrG0 = 1.1*Henri.G0Error();
|
||||
//std::cout<<" dist. max = "<<Henri.G0Error()<<" ; angle max = "<<Henri.G1Error()<<std::endl;
|
||||
@@ -223,7 +217,7 @@ static Standard_Integer plate (Draw_Interpretor & di,Standard_Integer n,const ch
|
||||
// commande gplate : resultat face egale a la surface approchee
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
static Standard_Integer gplate (Draw_Interpretor & di,Standard_Integer n,const char** a)
|
||||
static Standard_Integer gplate (Draw_Interpretor & ,Standard_Integer n,const char** a)
|
||||
{
|
||||
if (n < 6 ) return 1;
|
||||
Standard_Integer NbCurFront=Draw::Atoi(a[2]),
|
||||
@@ -304,13 +298,7 @@ static Standard_Integer gplate (Draw_Interpretor & di,Standard_Integer n,const c
|
||||
Henri.Add(PCont);
|
||||
}
|
||||
}
|
||||
Handle(Draw_ProgressIndicator) aProgress = new Draw_ProgressIndicator(di, 1);
|
||||
Henri.Perform(aProgress->Start());
|
||||
if (aProgress->UserBreak())
|
||||
{
|
||||
di << "Error: UserBreak\n";
|
||||
return 0;
|
||||
}
|
||||
Henri.Perform();
|
||||
Standard_Integer nbcarreau=9;
|
||||
Standard_Integer degmax=8;
|
||||
Standard_Real seuil;
|
||||
@@ -380,13 +368,7 @@ static Standard_Integer approxplate (Draw_Interpretor & di,Standard_Integer n,co
|
||||
Henri.Add(Cont);
|
||||
}
|
||||
|
||||
Handle(Draw_ProgressIndicator) aProgress = new Draw_ProgressIndicator(di, 1);
|
||||
Henri.Perform(aProgress->Start());
|
||||
if (aProgress->UserBreak())
|
||||
{
|
||||
di << "Error: UserBreak\n";
|
||||
return 0;
|
||||
}
|
||||
Henri.Perform();
|
||||
|
||||
Standard_Real dmax = Henri.G0Error(),
|
||||
anmax = Henri.G1Error();
|
||||
|
@@ -470,7 +470,7 @@ void GeomPlate_BuildPlateSurface::Perform(const Message_ProgressRange& theProgre
|
||||
//======================================================================
|
||||
// Initial Surface
|
||||
//======================================================================
|
||||
Message_ProgressScope aPS(theProgress, "Calculating the surface filled", 100, Standard_True);
|
||||
Message_ProgressScope aPS(theProgress, NULL, 100, Standard_True);
|
||||
if (!mySurfInitIsGive)
|
||||
{
|
||||
ComputeSurfInit (aPS.Next(10));
|
||||
@@ -1716,8 +1716,7 @@ void GeomPlate_BuildPlateSurface::ComputeSurfInit(const Message_ProgressRange& t
|
||||
//====================================================================
|
||||
// Construction of the surface
|
||||
//====================================================================
|
||||
Message_ProgressScope aPS(theProgress, "ComputeSurfInit", 1);
|
||||
myPlate.SolveTI(2, ComputeAnisotropie(), aPS.Next());
|
||||
myPlate.SolveTI(2, ComputeAnisotropie(), theProgress);
|
||||
if (theProgress.UserBreak())
|
||||
{
|
||||
return;
|
||||
|
@@ -193,7 +193,7 @@ static Standard_Boolean Connect (const Handle(ShapeAnalysis_Wire)& theSAW,
|
||||
GTranslate2d = Standard_False;
|
||||
|
||||
if (GTranslate3d && GTranslate2d) {
|
||||
//Setting preference in the case of inconsistency between 3D and 2D
|
||||
//Setting preference in the case of inconsitency between 3D and 2D
|
||||
if (surfcurv == 2) Preferred3d = Standard_False;
|
||||
else if (surfcurv == 3) Preferred2d = Standard_False;
|
||||
else if (myfilepreference == 2) Preferred3d = Standard_False;
|
||||
|
@@ -108,7 +108,7 @@ public:
|
||||
Standard_EXPORT gp_Dir TransformedAxis() const;
|
||||
|
||||
//! Returns a Definition computed from equation, easier to use
|
||||
//! <Center> : the center of the conic (meaningless for
|
||||
//! <Center> : the center of the the conic (meaningless for
|
||||
//! a parabola) (defined with Z displacement)
|
||||
//! <MainAxis> : the Main Axis of the conic (for a Circle,
|
||||
//! arbitrary the X Axis)
|
||||
|
@@ -59,7 +59,7 @@ public:
|
||||
|
||||
//! Sets Main Format to a new value
|
||||
//! Remark : SetFormat, SetZeroSuppress and SetFormatForRange are
|
||||
//! independent
|
||||
//! independant
|
||||
Standard_EXPORT void SetFormat (const Standard_CString format = "%E");
|
||||
|
||||
//! Sets Format for Range to a new value with its range of
|
||||
|
@@ -48,7 +48,7 @@ public:
|
||||
Standard_EXPORT IGESSelect_SelectPCurves(const Standard_Boolean basic);
|
||||
|
||||
//! Explores an entity, to take its contained PCurves
|
||||
//! An independent curve is IGNORED : only faces are explored
|
||||
//! An independant curve is IGNORED : only faces are explored
|
||||
Standard_EXPORT Standard_Boolean Explore (const Standard_Integer level, const Handle(Standard_Transient)& ent, const Interface_Graph& G, Interface_EntityIterator& explored) const Standard_OVERRIDE;
|
||||
|
||||
//! Returns a text defining the criterium : "Basic PCurves" or
|
||||
|
@@ -37,14 +37,14 @@ DEFINE_STANDARD_HANDLE(IGESSelect_SelectSubordinate, IFSelect_SelectExtract)
|
||||
|
||||
//! This selections uses Subordinate Status as sort criterium
|
||||
//! It is an integer number which can be :
|
||||
//! 0 Independent
|
||||
//! 1 Physically Dependent
|
||||
//! 2 Logically Dependent
|
||||
//! 0 Independant
|
||||
//! 1 Physically Dependant
|
||||
//! 2 Logically Dependant
|
||||
//! 3 Both (recorded)
|
||||
//! + to sort :
|
||||
//! 4 : 1 or 3 -> at least Physically
|
||||
//! 5 : 2 or 3 -> at least Logically
|
||||
//! 6 : 1 or 2 or 3 -> any kind of dependence
|
||||
//! 6 : 1 or 2 or 3 -> any kind of dependance
|
||||
//! (corresponds to 0 reversed)
|
||||
class IGESSelect_SelectSubordinate : public IFSelect_SelectExtract
|
||||
{
|
||||
@@ -62,7 +62,7 @@ public:
|
||||
//! Status matching the criterium
|
||||
Standard_EXPORT Standard_Boolean Sort (const Standard_Integer rank, const Handle(Standard_Transient)& ent, const Handle(Interface_InterfaceModel)& model) const Standard_OVERRIDE;
|
||||
|
||||
//! Returns the Selection criterium : "IGES Entity, Independent"
|
||||
//! Returns the Selection criterium : "IGES Entity, Independant"
|
||||
//! etc...
|
||||
Standard_EXPORT TCollection_AsciiString ExtractLabel() const Standard_OVERRIDE;
|
||||
|
||||
|
@@ -172,7 +172,7 @@ IGESToBRep_IGESBoundary::IGESToBRep_IGESBoundary(const IGESToBRep_CurveAndSurfac
|
||||
GTranslate2d = Standard_False;
|
||||
|
||||
if (GTranslate3d && GTranslate2d) {
|
||||
//Setting preference in the case of inconsistency between 3D and 2D
|
||||
//Setting preference in the case of inconsitency between 3D and 2D
|
||||
if (myfilepreference == 2) Preferred3d = Standard_False;
|
||||
else if (myfilepreference == 3) Preferred2d = Standard_False;
|
||||
else Preferred3d = Standard_False;
|
||||
|
@@ -72,7 +72,7 @@ public:
|
||||
//! and may contain pcurves)
|
||||
Handle(ShapeExtend_WireData) WireData3d() const;
|
||||
|
||||
//! Returns the wire from 2D curves (edges contain pcurves
|
||||
//! Returns the the wire from 2D curves (edges contain pcurves
|
||||
//! only)
|
||||
Handle(ShapeExtend_WireData) WireData2d() const;
|
||||
|
||||
|
@@ -16,11 +16,10 @@
|
||||
#ifndef __IVTK_ISHAPEDATA_H__
|
||||
#define __IVTK_ISHAPEDATA_H__
|
||||
|
||||
#include <gp_Pnt.hxx>
|
||||
#include <IVtk_Interface.hxx>
|
||||
#include <IVtk_Types.hxx>
|
||||
#include <NCollection_Vec3.hxx>
|
||||
|
||||
class IVtk_IShapeData;
|
||||
DEFINE_STANDARD_HANDLE( IVtk_IShapeData, IVtk_Interface )
|
||||
|
||||
//! @class IVtk_IShapeData
|
||||
@@ -35,11 +34,11 @@ public:
|
||||
DEFINE_STANDARD_RTTIEXT(IVtk_IShapeData,IVtk_Interface)
|
||||
|
||||
//! Insert a coordinate
|
||||
//! @param [in] thePnt point position
|
||||
//! @param [in] theNorm point normal
|
||||
//! @param [in] theX X coordinate
|
||||
//! @param [in] theY Y coordinate
|
||||
//! @param [in] theZ Z coordinate
|
||||
//! @return id of added point
|
||||
virtual IVtk_PointId InsertPoint (const gp_Pnt& thePnt,
|
||||
const NCollection_Vec3<float>& theNorm) = 0;
|
||||
virtual IVtk_PointId InsertCoordinate (double theX, double theY, double theZ) = 0;
|
||||
|
||||
//! Insert a vertex.
|
||||
//! @param [in] theShapeID id of the sub-shape to which the vertex belongs.
|
||||
@@ -78,27 +77,6 @@ public:
|
||||
const IVtk_PointId thePointId2,
|
||||
const IVtk_PointId thePointId3,
|
||||
const IVtk_MeshType theMeshType = MT_Undefined) = 0;
|
||||
|
||||
public:
|
||||
|
||||
//! Insert a coordinate
|
||||
//! @param [in] theX X coordinate
|
||||
//! @param [in] theY Y coordinate
|
||||
//! @param [in] theZ Z coordinate
|
||||
//! @return id of added point
|
||||
virtual IVtk_PointId InsertCoordinate (double theX, double theY, double theZ)
|
||||
{
|
||||
return InsertCoordinate (gp_Pnt (theX, theY, theZ));
|
||||
}
|
||||
|
||||
//! Insert a coordinate
|
||||
//! @param [in] thePnt point position
|
||||
//! @return id of added point
|
||||
IVtk_PointId InsertCoordinate (const gp_Pnt& thePnt)
|
||||
{
|
||||
return InsertPoint (thePnt, NCollection_Vec3<float>(0.0f, 0.0f, 1.0f));
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
#endif // __IVTK_ISHAPEDATA_H__
|
||||
|
@@ -17,10 +17,10 @@
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(IVtk_IShapeMesher,IVtk_Interface)
|
||||
|
||||
// ================================================================
|
||||
// Function : initialize
|
||||
// Purpose :
|
||||
// ================================================================
|
||||
// Handle implementation
|
||||
|
||||
|
||||
//! Executes the mesh generation algorithms. To be defined in implementation class.
|
||||
void IVtk_IShapeMesher::initialize (const IVtk_IShape::Handle& theShape,
|
||||
const IVtk_IShapeData::Handle& theData)
|
||||
{
|
||||
@@ -28,10 +28,9 @@ void IVtk_IShapeMesher::initialize (const IVtk_IShape::Handle& theShape,
|
||||
myShapeData = theData;
|
||||
}
|
||||
|
||||
// ================================================================
|
||||
// Function : Build
|
||||
// Purpose :
|
||||
// ================================================================
|
||||
//! Main entry point for building shape representation
|
||||
//! @param [in] shape IShape to be meshed
|
||||
//! @param [in] data IShapeData interface visualization data is passed to.
|
||||
void IVtk_IShapeMesher::Build (const IVtk_IShape::Handle& theShape,
|
||||
const IVtk_IShapeData::Handle& theData)
|
||||
{
|
||||
|
@@ -31,15 +31,11 @@ public:
|
||||
typedef Handle(IVtk_IShapeMesher) Handle;
|
||||
virtual ~IVtk_IShapeMesher() { }
|
||||
|
||||
//! Main entry point for building shape representation
|
||||
//! @param [in] shape IShape to be meshed
|
||||
//! @param [in] data IShapeData interface visualization data is passed to.
|
||||
Standard_EXPORT void Build (const IVtk_IShape::Handle& theShape, const IVtk_IShapeData::Handle& theData);
|
||||
|
||||
DEFINE_STANDARD_RTTIEXT(IVtk_IShapeMesher,IVtk_Interface)
|
||||
|
||||
protected:
|
||||
//! Executes the mesh generation algorithms. To be defined in implementation class.
|
||||
Standard_EXPORT virtual void initialize (const IVtk_IShape::Handle& theShapeObj,
|
||||
const IVtk_IShapeData::Handle& theShapeData);
|
||||
virtual void internalBuild() = 0;
|
||||
|
@@ -167,22 +167,6 @@ static Handle(PipelinePtr) PipelineByActorName (const TCollection_AsciiString& t
|
||||
return PipelineByActor (anActor);
|
||||
}
|
||||
|
||||
//! Create global presentation attributes.
|
||||
static Handle(Prs3d_Drawer) createDefaultDrawer()
|
||||
{
|
||||
Handle(Prs3d_Drawer) aGlobalDrawer = new Prs3d_Drawer();
|
||||
aGlobalDrawer->SetTypeOfDeflection (Aspect_TOD_RELATIVE);
|
||||
aGlobalDrawer->SetDeviationCoefficient (0.0001);
|
||||
return aGlobalDrawer;
|
||||
}
|
||||
|
||||
//! Get global presentation attributes (analog of AIS_InteractiveContext::DefaultDrawer()).
|
||||
static const Handle(Prs3d_Drawer)& GetDefaultDrawer()
|
||||
{
|
||||
static Handle(Prs3d_Drawer) aGlobalDrawer = createDefaultDrawer();
|
||||
return aGlobalDrawer;
|
||||
}
|
||||
|
||||
#ifdef _WIN32
|
||||
|
||||
static Handle(WNT_Window)& GetWindow()
|
||||
@@ -511,106 +495,12 @@ vtkActor* CreateActor (const Standard_Integer theId,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
Handle(PipelinePtr) aPL = new PipelinePtr (theShape, theId, GetDefaultDrawer());
|
||||
Handle(PipelinePtr) aPL = new PipelinePtr (theShape, theId);
|
||||
GetPipelines()->Bind (theId, aPL);
|
||||
|
||||
aPL->Actor()->GetProperty()->SetInterpolationToPhong();
|
||||
return aPL->Actor();
|
||||
}
|
||||
|
||||
|
||||
//===============================================================================================
|
||||
//function : VtkDefaults
|
||||
//purpose :
|
||||
//===============================================================================================
|
||||
static int VtkDefaults (Draw_Interpretor& theDi,
|
||||
Standard_Integer theArgsNb,
|
||||
const char** theArgVec)
|
||||
{
|
||||
const Handle(Prs3d_Drawer)& aDefParams = GetDefaultDrawer();
|
||||
if (theArgsNb < 2)
|
||||
{
|
||||
if (aDefParams->TypeOfDeflection() == Aspect_TOD_RELATIVE)
|
||||
{
|
||||
theDi << "DeflType: relative\n"
|
||||
<< "DeviationCoeff: " << aDefParams->DeviationCoefficient() << "\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
theDi << "DeflType: absolute\n"
|
||||
<< "AbsoluteDeflection: " << aDefParams->MaximalChordialDeviation() << "\n";
|
||||
}
|
||||
theDi << "AngularDeflection: " << (180.0 * aDefParams->DeviationAngle() / M_PI) << "\n";
|
||||
theDi << "AutoTriangulation: " << (aDefParams->IsAutoTriangulation() ? "on" : "off") << "\n";
|
||||
return 0;
|
||||
}
|
||||
|
||||
for (Standard_Integer anArgIter = 1; anArgIter < theArgsNb; ++anArgIter)
|
||||
{
|
||||
TCollection_AsciiString anArg (theArgVec[anArgIter]);
|
||||
anArg.UpperCase();
|
||||
if (anArg == "-ABSDEFL"
|
||||
|| anArg == "-ABSOLUTEDEFLECTION"
|
||||
|| anArg == "-DEFL"
|
||||
|| anArg == "-DEFLECTION")
|
||||
{
|
||||
if (++anArgIter >= theArgsNb)
|
||||
{
|
||||
theDi << "Syntax error at " << anArg;
|
||||
return 1;
|
||||
}
|
||||
aDefParams->SetTypeOfDeflection (Aspect_TOD_ABSOLUTE);
|
||||
aDefParams->SetMaximalChordialDeviation (Draw::Atof (theArgVec[anArgIter]));
|
||||
}
|
||||
else if (anArg == "-RELDEFL"
|
||||
|| anArg == "-RELATIVEDEFLECTION"
|
||||
|| anArg == "-DEVCOEFF"
|
||||
|| anArg == "-DEVIATIONCOEFF"
|
||||
|| anArg == "-DEVIATIONCOEFFICIENT")
|
||||
{
|
||||
if (++anArgIter >= theArgsNb)
|
||||
{
|
||||
theDi << "Syntax error at " << anArg;
|
||||
return 1;
|
||||
}
|
||||
aDefParams->SetTypeOfDeflection (Aspect_TOD_RELATIVE);
|
||||
aDefParams->SetDeviationCoefficient (Draw::Atof (theArgVec[anArgIter]));
|
||||
}
|
||||
else if (anArg == "-ANGDEFL"
|
||||
|| anArg == "-ANGULARDEFL"
|
||||
|| anArg == "-ANGULARDEFLECTION")
|
||||
{
|
||||
if (++anArgIter >= theArgsNb)
|
||||
{
|
||||
theDi << "Syntax error at " << anArg;
|
||||
return 1;
|
||||
}
|
||||
aDefParams->SetDeviationAngle (M_PI * Draw::Atof (theArgVec[anArgIter]) / 180.0);
|
||||
}
|
||||
else if (anArg == "-AUTOTR"
|
||||
|| anArg == "-AUTOTRIANG"
|
||||
|| anArg == "-AUTOTRIANGULATION")
|
||||
{
|
||||
++anArgIter;
|
||||
bool toTurnOn = true;
|
||||
if (anArgIter >= theArgsNb
|
||||
|| !Draw::ParseOnOff (theArgVec[anArgIter], toTurnOn))
|
||||
{
|
||||
theDi << "Syntax error at '" << anArg << "'";
|
||||
return 1;
|
||||
}
|
||||
aDefParams->SetAutoTriangulation (toTurnOn);
|
||||
}
|
||||
else
|
||||
{
|
||||
theDi << "Syntax error: unknown argument '" << anArg << "'";
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
//================================================================
|
||||
// Function : VtkDisplay
|
||||
// Purpose :
|
||||
@@ -829,159 +719,158 @@ static Standard_Integer VtkRemove (Draw_Interpretor& ,
|
||||
|
||||
//================================================================
|
||||
// Function : VtkSetDisplayMode
|
||||
// Purpose :
|
||||
// Purpose :
|
||||
// Draw args : ivtksetdispmode [name] mode(0,1)
|
||||
//================================================================
|
||||
static Standard_Integer VtkSetDisplayMode (Draw_Interpretor& theDI,
|
||||
static Standard_Integer VtkSetDisplayMode (Draw_Interpretor& ,
|
||||
Standard_Integer theArgNum,
|
||||
const char** theArgs)
|
||||
{
|
||||
if (!GetInteractor()
|
||||
|| !GetInteractor()->IsEnabled())
|
||||
{
|
||||
theDI << "Error: call ivtkinit before";
|
||||
Message::SendFail() << "Error: call ivtkinit before";
|
||||
return 1;
|
||||
}
|
||||
else if (theArgNum != 2 && theArgNum != 3)
|
||||
{
|
||||
Message::SendFail() << "Syntax error: expects 1 or 2 arguments";
|
||||
return 1;
|
||||
}
|
||||
|
||||
Standard_Integer aDispMode = -1;
|
||||
Standard_Integer isFaceBoundaryDraw = -1, isSmoothShading = -1;
|
||||
Graphic3d_TypeOfShadingModel aShadingModel = Graphic3d_TOSM_DEFAULT;
|
||||
NCollection_Sequence< vtkSmartPointer<vtkActor> > anActors;
|
||||
for (Standard_Integer anArgIter = 1; anArgIter < theArgNum; ++anArgIter)
|
||||
if (theArgNum == 2)
|
||||
{
|
||||
TCollection_AsciiString anArgCase (theArgs[anArgIter]);
|
||||
anArgCase.LowerCase();
|
||||
if (anArgCase == "-faceboundarydraw"
|
||||
|| anArgCase == "-drawfaceboundary"
|
||||
|| anArgCase == "-faceboundary")
|
||||
// Set disp mode for all objects
|
||||
Standard_Integer aMode = Draw::Atoi (theArgs[1]); // Get mode
|
||||
DoubleMapOfActorsAndNames::Iterator anIter (GetMapOfActors());
|
||||
while (anIter.More())
|
||||
{
|
||||
bool toDraw = Draw::ParseOnOffNoIterator (theArgNum, theArgs, anArgIter);
|
||||
isFaceBoundaryDraw = toDraw ? 1 : 0;
|
||||
}
|
||||
else if (anArgCase == "-smoothshading"
|
||||
|| anArgCase == "-smooth")
|
||||
{
|
||||
bool toEnable = Draw::ParseOnOffNoIterator (theArgNum, theArgs, anArgIter);
|
||||
isSmoothShading = toEnable ? 1 : 0;
|
||||
}
|
||||
else if (anArgIter + 1 < theArgNum
|
||||
&& (anArgCase == "-shadingmodel"))
|
||||
{
|
||||
TCollection_AsciiString aModelName (theArgs[++anArgIter]);
|
||||
aModelName.LowerCase();
|
||||
if (aModelName == "fragment"
|
||||
|| aModelName == "frag"
|
||||
|| aModelName == "phong")
|
||||
vtkSmartPointer<vtkActor> anActor = anIter.Key1();
|
||||
IVtkTools_ShapeDataSource* aSrc = IVtkTools_ShapeObject::GetShapeSource (anActor);
|
||||
if (aSrc)
|
||||
{
|
||||
aShadingModel = Graphic3d_TOSM_FRAGMENT;
|
||||
IVtkOCC_Shape::Handle anOccShape = aSrc->GetShape();
|
||||
if (!anOccShape.IsNull())
|
||||
{
|
||||
IVtkTools_DisplayModeFilter* aFilter = GetPipeline ( anOccShape->GetId() )->GetDisplayModeFilter();
|
||||
aFilter->SetDisplayMode((IVtk_DisplayMode)aMode);
|
||||
aFilter->Modified();
|
||||
aFilter->Update();
|
||||
}
|
||||
}
|
||||
else if (aModelName == "vertex"
|
||||
|| aModelName == "vert"
|
||||
|| aModelName == "gouraud")
|
||||
{
|
||||
aShadingModel = Graphic3d_TOSM_VERTEX;
|
||||
}
|
||||
else if (aModelName == "facet"
|
||||
|| aModelName == "flat")
|
||||
{
|
||||
aShadingModel = Graphic3d_TOSM_FACET;
|
||||
}
|
||||
else
|
||||
{
|
||||
theDI << "Syntax error: unknown shading model '" << theArgs[anArgIter] << "'";
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
else if (aDispMode == -1
|
||||
&& (anArgCase == "0"
|
||||
|| anArgCase == "1"))
|
||||
{
|
||||
aDispMode = Draw::Atoi (theArgs[anArgIter]);
|
||||
}
|
||||
else if (aDispMode == -1
|
||||
&& (anArgCase == "-shaded"
|
||||
|| anArgCase == "-shading"))
|
||||
{
|
||||
aDispMode = DM_Shading;
|
||||
}
|
||||
else if (aDispMode == -1
|
||||
&& anArgCase == "-wireframe")
|
||||
{
|
||||
aDispMode = DM_Wireframe;
|
||||
}
|
||||
else
|
||||
{
|
||||
TCollection_AsciiString aName = theArgs[anArgIter];
|
||||
vtkSmartPointer<vtkActor> anActor;
|
||||
if (!GetMapOfActors().Find2 (aName, anActor))
|
||||
{
|
||||
theDI << "Syntax error: object '" << aName << "' not found";
|
||||
return 1;
|
||||
}
|
||||
anActors.Append (anActor);
|
||||
anIter.Next();
|
||||
}
|
||||
}
|
||||
if (aDispMode == -1)
|
||||
// Set disp mode for named object
|
||||
else
|
||||
{
|
||||
theDI << "Syntax error: wrong number of arguments";
|
||||
TCollection_AsciiString aName = theArgs[1];
|
||||
vtkSmartPointer<vtkActor> anActor;
|
||||
if (!GetMapOfActors().Find2 (aName, anActor))
|
||||
{
|
||||
Message::SendFail() << "Syntax error: object '" << aName << "' not found";
|
||||
return 1;
|
||||
}
|
||||
|
||||
Standard_Integer aMode = atoi(theArgs[2]);
|
||||
vtkSmartPointer<IVtkTools_ShapeDataSource> aSrc = IVtkTools_ShapeObject::GetShapeSource (anActor);
|
||||
if (aSrc)
|
||||
{
|
||||
IVtkOCC_Shape::Handle anOccShape = aSrc->GetShape();
|
||||
if (!anOccShape.IsNull())
|
||||
{
|
||||
IVtkTools_DisplayModeFilter* aFilter = GetPipeline (anOccShape->GetId())->GetDisplayModeFilter();
|
||||
aFilter->SetDisplayMode ((IVtk_DisplayMode)aMode);
|
||||
aFilter->Modified();
|
||||
aFilter->Update();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Redraw window
|
||||
GetInteractor()->Render();
|
||||
return 0;
|
||||
}
|
||||
|
||||
//================================================================
|
||||
// Function : VtkSetBoundaryDraw
|
||||
// Purpose :
|
||||
//================================================================
|
||||
static Standard_Integer VtkSetBoundaryDraw (Draw_Interpretor& ,
|
||||
Standard_Integer theArgNum,
|
||||
const char** theArgs)
|
||||
{
|
||||
if (!GetInteractor()
|
||||
|| !GetInteractor()->IsEnabled())
|
||||
{
|
||||
Message::SendFail() << "Error: call ivtkinit before";
|
||||
return 1;
|
||||
}
|
||||
else if (theArgNum != 2 && theArgNum != 3)
|
||||
{
|
||||
Message::SendFail() << "Syntax error: expects 1 or 2 arguments";
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (anActors.IsEmpty())
|
||||
if (theArgNum == 2)
|
||||
{
|
||||
// update all objects
|
||||
for (DoubleMapOfActorsAndNames::Iterator anIter (GetMapOfActors()); anIter.More(); anIter.Next())
|
||||
// Set disp mode for all objects
|
||||
Standard_Boolean toDraw = true;
|
||||
Draw::ParseOnOff (theArgs[1], toDraw);
|
||||
DoubleMapOfActorsAndNames::Iterator anIter(GetMapOfActors());
|
||||
while (anIter.More())
|
||||
{
|
||||
anActors.Append (anIter.Key1());
|
||||
vtkSmartPointer<vtkActor> anActor = anIter.Key1();
|
||||
// Set Red color for boundary edges
|
||||
vtkLookupTable* aTable = (vtkLookupTable*)anActor->GetMapper()->GetLookupTable();
|
||||
IVtkTools::SetLookupTableColor(aTable, MT_SharedEdge, 1., 0., 0., 1.);
|
||||
|
||||
IVtkTools_ShapeDataSource* aSrc = IVtkTools_ShapeObject::GetShapeSource(anActor);
|
||||
if (aSrc)
|
||||
{
|
||||
IVtkOCC_Shape::Handle anOccShape = aSrc->GetShape();
|
||||
if (!anOccShape.IsNull())
|
||||
{
|
||||
IVtkTools_DisplayModeFilter* aFilter = GetPipeline(anOccShape->GetId())->GetDisplayModeFilter();
|
||||
aFilter->SetDisplayMode(DM_Shading);
|
||||
aFilter->SetFaceBoundaryDraw(toDraw != 0);
|
||||
aFilter->Modified();
|
||||
aFilter->Update();
|
||||
}
|
||||
}
|
||||
anIter.Next();
|
||||
}
|
||||
}
|
||||
|
||||
for (NCollection_Sequence< vtkSmartPointer<vtkActor> >::Iterator anActorIter (anActors); anActorIter.More(); anActorIter.Next())
|
||||
else
|
||||
{
|
||||
vtkSmartPointer<vtkActor> anActor = anActorIter.Value();
|
||||
IVtkTools_ShapeDataSource* aSrc = IVtkTools_ShapeObject::GetShapeSource (anActor);
|
||||
if (aSrc == NULL)
|
||||
// Set disp mode for named object
|
||||
TCollection_AsciiString aName = theArgs[1];
|
||||
vtkSmartPointer<vtkActor> anActor;
|
||||
if (!GetMapOfActors().Find2 (aName, anActor))
|
||||
{
|
||||
continue;
|
||||
Message::SendFail() << "Syntax error: object '" << aName << "' not found";
|
||||
return 1;
|
||||
}
|
||||
|
||||
IVtkOCC_Shape::Handle anOccShape = aSrc->GetShape();
|
||||
if (!anOccShape.IsNull())
|
||||
{
|
||||
IVtkTools_DisplayModeFilter* aFilter = GetPipeline ( anOccShape->GetId() )->GetDisplayModeFilter();
|
||||
aFilter->SetDisplayMode ((IVtk_DisplayMode)aDispMode);
|
||||
if (isFaceBoundaryDraw != -1)
|
||||
{
|
||||
// Set Red color for boundary edges
|
||||
vtkLookupTable* aTable = (vtkLookupTable*)anActor->GetMapper()->GetLookupTable();
|
||||
IVtkTools::SetLookupTableColor (aTable, MT_SharedEdge, 1., 0., 0., 1.);
|
||||
aFilter->SetFaceBoundaryDraw (isFaceBoundaryDraw == 1);
|
||||
}
|
||||
if (isSmoothShading != -1)
|
||||
{
|
||||
aFilter->SetSmoothShading (isSmoothShading == 1);
|
||||
}
|
||||
switch (aShadingModel)
|
||||
{
|
||||
case Graphic3d_TOSM_FACET:
|
||||
{
|
||||
anActor->GetProperty()->SetInterpolationToFlat();
|
||||
break;
|
||||
}
|
||||
case Graphic3d_TOSM_VERTEX:
|
||||
{
|
||||
anActor->GetProperty()->SetInterpolationToGouraud();
|
||||
break;
|
||||
}
|
||||
case Graphic3d_TOSM_FRAGMENT:
|
||||
{
|
||||
anActor->GetProperty()->SetInterpolationToPhong();
|
||||
break;
|
||||
}
|
||||
default: break;
|
||||
}
|
||||
Standard_Boolean toDraw = true;
|
||||
Draw::ParseOnOff (theArgs[2], toDraw);
|
||||
|
||||
aFilter->Modified();
|
||||
aFilter->Update();
|
||||
// Set Red color for boundary edges
|
||||
vtkLookupTable* aTable = (vtkLookupTable*)anActor->GetMapper()->GetLookupTable();
|
||||
IVtkTools::SetLookupTableColor (aTable, MT_SharedEdge, 1., 0., 0., 1.);
|
||||
|
||||
vtkSmartPointer<IVtkTools_ShapeDataSource> aSrc = IVtkTools_ShapeObject::GetShapeSource (anActor);
|
||||
if (aSrc)
|
||||
{
|
||||
IVtkOCC_Shape::Handle anOccShape = aSrc->GetShape();
|
||||
if (!anOccShape.IsNull())
|
||||
{
|
||||
IVtkTools_DisplayModeFilter* aFilter = GetPipeline (anOccShape->GetId())->GetDisplayModeFilter();
|
||||
aFilter->SetDisplayMode (DM_Shading);
|
||||
aFilter->SetFaceBoundaryDraw (toDraw != 0);
|
||||
aFilter->Modified();
|
||||
aFilter->Update();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1620,14 +1509,6 @@ void IVtkDraw::Commands (Draw_Interpretor& theCommands)
|
||||
"ivtkclose : Closes the Vtk window.",
|
||||
__FILE__, VtkClose, group);
|
||||
|
||||
theCommands.Add("ivtkdefaults",
|
||||
"ivtkdefaults [-absDefl value]"
|
||||
"\n\t\t: [-devCoeff value]"
|
||||
"\n\t\t: [-angDefl value]"
|
||||
"\n\t\t: [-autoTriang {off/on | 0/1}]"
|
||||
"\n\t\t: Sets default VTK meshing parameters."
|
||||
, __FILE__, VtkDefaults, group);
|
||||
|
||||
theCommands.Add("ivtkrenderparams",
|
||||
"ivtkrenderparams [-depthPeeling NbLayers] [-shadows {on|off}]"
|
||||
"\n\t\t: Sets Vtk rendering parameters."
|
||||
@@ -1657,14 +1538,16 @@ void IVtkDraw::Commands (Draw_Interpretor& theCommands)
|
||||
__FILE__, VtkRemove, group);
|
||||
|
||||
theCommands.Add("ivtksetdispmode",
|
||||
"ivtksetdispmode [name] mode={0|1} [-faceBoundaryDraw {0|1}] [-smoothShading {0|1}]"
|
||||
"\n\t\t: [-shadingModel {phong|gouraud|flat}]"
|
||||
"\n\t\t: Sets or unsets display mode to the object with the given name or to all objects."
|
||||
"\n\t\t: -faceBoundaryDraw show/hide boundaries within shading display mode"
|
||||
"\n\t\t: -smoothShading enable/disable vertex normals for smooth shading"
|
||||
"\n\t\t: -shadingModel sets specified shading model",
|
||||
"ivtksetdispmode [name] mode={0|1}"
|
||||
"\n\t\t: Sets or unsets display mode 'mode' to the object with name 'name' or to all objects.",
|
||||
__FILE__, VtkSetDisplayMode, group);
|
||||
|
||||
theCommands.Add("ivtksetboundingdraw",
|
||||
"ivtksetboundingdraw [name] {on|off}"
|
||||
"\n\t\t: Sets or unsets boundaries drawing for shading display mode"
|
||||
"\n\t\t: to the object with name 'name' or to all objects.",
|
||||
__FILE__, VtkSetBoundaryDraw, group);
|
||||
|
||||
theCommands.Add("ivtksetselmode",
|
||||
"ivtksetselmode [name] mode {on|off}"
|
||||
"\n\t\t: Sets or unsets selection mode 'mode' to the object with name 'name'"
|
||||
|
@@ -39,8 +39,7 @@ IMPLEMENT_STANDARD_RTTIEXT(IVtkDraw_HighlightAndSelectionPipeline,Standard_Trans
|
||||
//===========================================================
|
||||
|
||||
IVtkDraw_HighlightAndSelectionPipeline::IVtkDraw_HighlightAndSelectionPipeline (const TopoDS_Shape& theShape,
|
||||
const Standard_Integer theShapeID,
|
||||
const Handle(Prs3d_Drawer)& theDrawerLink)
|
||||
const Standard_Integer theShapeID)
|
||||
: Standard_Transient()
|
||||
{
|
||||
/* ===========================
|
||||
@@ -58,7 +57,7 @@ IVtkDraw_HighlightAndSelectionPipeline::IVtkDraw_HighlightAndSelectionPipeline (
|
||||
* ======================== */
|
||||
|
||||
myActor = vtkSmartPointer<vtkActor>::New();
|
||||
IVtkOCC_Shape::Handle anIVtkShape = new IVtkOCC_Shape (theShape, theDrawerLink);
|
||||
IVtkOCC_Shape::Handle anIVtkShape = new IVtkOCC_Shape (theShape);
|
||||
anIVtkShape->SetId (theShapeID);
|
||||
vtkSmartPointer<IVtkTools_ShapeDataSource> aDataSource = vtkSmartPointer<IVtkTools_ShapeDataSource>::New();
|
||||
aDataSource->SetShape (anIVtkShape);
|
||||
|
@@ -37,8 +37,6 @@
|
||||
typedef NCollection_DataMap <IVtk_IdType, vtkSmartPointer<IVtkTools_DisplayModeFilter> > DisplayModeFiltersMap;
|
||||
typedef NCollection_DataMap <IVtk_IdType, vtkSmartPointer<IVtkTools_SubPolyDataFilter> > SubShapesFiltersMap;
|
||||
|
||||
class Prs3d_Drawer;
|
||||
|
||||
class IVtkDraw_HighlightAndSelectionPipeline;
|
||||
DEFINE_STANDARD_HANDLE(IVtkDraw_HighlightAndSelectionPipeline, Standard_Transient)
|
||||
|
||||
@@ -63,8 +61,7 @@ public:
|
||||
public:
|
||||
|
||||
IVtkDraw_HighlightAndSelectionPipeline (const TopoDS_Shape& theShape,
|
||||
const Standard_Integer theShapeID,
|
||||
const Handle(Prs3d_Drawer)& theDrawerLink);
|
||||
const Standard_Integer theShapeID);
|
||||
~IVtkDraw_HighlightAndSelectionPipeline() {}
|
||||
|
||||
public:
|
||||
|
@@ -18,7 +18,6 @@
|
||||
#include <AIS_Shape.hxx>
|
||||
#include <BRepBndLib.hxx>
|
||||
#include <Message.hxx>
|
||||
#include <StdPrs_ToolTriangulatedShape.hxx>
|
||||
#include <Select3D_SensitiveBox.hxx>
|
||||
#include <SelectMgr_Selection.hxx>
|
||||
#include <Standard_ErrorHandler.hxx>
|
||||
@@ -28,9 +27,12 @@
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(IVtkOCC_SelectableObject,SelectMgr_SelectableObject)
|
||||
|
||||
// Handle implementation
|
||||
|
||||
|
||||
//============================================================================
|
||||
// Method: Constructor
|
||||
// Purpose:
|
||||
// Purpose: Constructs a selectable object initialized by the given shape
|
||||
//============================================================================
|
||||
IVtkOCC_SelectableObject::IVtkOCC_SelectableObject (const IVtkOCC_Shape::Handle& theShape)
|
||||
: SelectMgr_SelectableObject (PrsMgr_TOP_AllView),
|
||||
@@ -40,35 +42,37 @@ IVtkOCC_SelectableObject::IVtkOCC_SelectableObject (const IVtkOCC_Shape::Handle&
|
||||
{
|
||||
myShape->SetSelectableObject (this);
|
||||
}
|
||||
|
||||
// Minor stuff - but it facilitates usage of OCCT selection
|
||||
// classes dealing with deflection, see ComputeSelection() below
|
||||
myOCCTDrawer = new Prs3d_Drawer();
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
// Method: Constructor
|
||||
// Purpose:
|
||||
// Purpose: Constructs uninitialized selectable object.
|
||||
// setShape() should be called later.
|
||||
//============================================================================
|
||||
IVtkOCC_SelectableObject::IVtkOCC_SelectableObject()
|
||||
: SelectMgr_SelectableObject (PrsMgr_TOP_AllView)
|
||||
{
|
||||
//
|
||||
}
|
||||
: SelectMgr_SelectableObject (PrsMgr_TOP_AllView),
|
||||
myShape (0)
|
||||
{ }
|
||||
|
||||
//============================================================================
|
||||
// Method: Destructor
|
||||
// Purpose:
|
||||
// Purpose:
|
||||
//============================================================================
|
||||
IVtkOCC_SelectableObject::~IVtkOCC_SelectableObject()
|
||||
{
|
||||
//
|
||||
}
|
||||
{ }
|
||||
|
||||
//============================================================================
|
||||
// Method: SetShape
|
||||
// Purpose:
|
||||
// Purpose: Sets the selectable shape
|
||||
//============================================================================
|
||||
void IVtkOCC_SelectableObject::SetShape (const IVtkOCC_Shape::Handle& theShape)
|
||||
{
|
||||
myShape = theShape;
|
||||
if (!myShape.IsNull())
|
||||
if (! myShape.IsNull())
|
||||
{
|
||||
myShape->SetSelectableObject (this);
|
||||
}
|
||||
@@ -80,7 +84,7 @@ void IVtkOCC_SelectableObject::SetShape (const IVtkOCC_Shape::Handle& theShape)
|
||||
|
||||
//============================================================================
|
||||
// Method: ComputeSelection
|
||||
// Purpose:
|
||||
// Purpose: Internal method, computes selection data for viewer selector
|
||||
//============================================================================
|
||||
void IVtkOCC_SelectableObject::ComputeSelection (const Handle(SelectMgr_Selection)& theSelection,
|
||||
const Standard_Integer theMode)
|
||||
@@ -90,17 +94,33 @@ void IVtkOCC_SelectableObject::ComputeSelection (const Handle(SelectMgr_Selectio
|
||||
return;
|
||||
}
|
||||
|
||||
const TopoDS_Shape& anOcctShape = myShape->GetShape();
|
||||
if (anOcctShape.ShapeType() == TopAbs_COMPOUND
|
||||
&& anOcctShape.NbChildren() == 0)
|
||||
TopoDS_Shape anOcctShape = myShape->GetShape();
|
||||
|
||||
if (anOcctShape.ShapeType() == TopAbs_COMPOUND && anOcctShape.NbChildren() == 0)
|
||||
{
|
||||
// Shape empty -> go away
|
||||
return;
|
||||
}
|
||||
|
||||
const TopAbs_ShapeEnum aTypeOfSel = AIS_Shape::SelectionType (theMode);
|
||||
const Handle(Prs3d_Drawer)& aDrawer = myShape->Attributes();
|
||||
const Standard_Real aDeflection = StdPrs_ToolTriangulatedShape::GetDeflection (anOcctShape, aDrawer);
|
||||
TopAbs_ShapeEnum aTypeOfSel = AIS_Shape::SelectionType (theMode);
|
||||
|
||||
Standard_Real aDeflection = myOCCTDrawer->MaximalChordialDeviation();
|
||||
if (myOCCTDrawer->TypeOfDeflection() == Aspect_TOD_RELATIVE)
|
||||
{
|
||||
Bnd_Box aBndBox;
|
||||
BRepBndLib::Add (anOcctShape, aBndBox);
|
||||
if (!aBndBox.IsVoid())
|
||||
{
|
||||
Standard_Real aXmin, aYmin, aZmin, aXmax, aYmax, aZmax;
|
||||
aBndBox.Get (aXmin, aYmin, aZmin, aXmax, aYmax, aZmax);
|
||||
aDeflection = Max (aXmax - aXmin, Max (aYmax - aYmin, aZmax - aZmin)) *
|
||||
myOCCTDrawer->DeviationCoefficient();
|
||||
}
|
||||
}
|
||||
|
||||
// Assume the shape has been displayed already -> triangulation should exist
|
||||
Standard_Boolean isAutoTriangulation = Standard_False;
|
||||
|
||||
try
|
||||
{
|
||||
OCC_CATCH_SIGNALS
|
||||
@@ -109,8 +129,8 @@ void IVtkOCC_SelectableObject::ComputeSelection (const Handle(SelectMgr_Selectio
|
||||
anOcctShape,
|
||||
aTypeOfSel,
|
||||
aDeflection,
|
||||
aDrawer->DeviationAngle(),
|
||||
aDrawer->IsAutoTriangulation());
|
||||
myOCCTDrawer->DeviationAngle(),
|
||||
isAutoTriangulation);
|
||||
}
|
||||
catch (const Standard_Failure& anException)
|
||||
{
|
||||
@@ -138,7 +158,8 @@ const Bnd_Box& IVtkOCC_SelectableObject::BoundingBox()
|
||||
return myBndBox;
|
||||
}
|
||||
|
||||
const TopoDS_Shape& anOcctShape = myShape->GetShape();
|
||||
TopoDS_Shape anOcctShape = myShape->GetShape();
|
||||
|
||||
if (anOcctShape.ShapeType() == TopAbs_COMPOUND && anOcctShape.NbChildren() == 0)
|
||||
{
|
||||
// Shape empty -> nothing to do
|
||||
|
@@ -73,6 +73,7 @@ private:
|
||||
private:
|
||||
IVtkOCC_Shape::Handle myShape;
|
||||
Bnd_Box myBndBox;
|
||||
Handle(Prs3d_Drawer) myOCCTDrawer;
|
||||
};
|
||||
|
||||
#endif // __IVTKOCC_SELECTABLEOBJECT_H__
|
||||
|
@@ -14,29 +14,20 @@
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#include <IVtkOCC_Shape.hxx>
|
||||
|
||||
#include <TopExp.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(IVtkOCC_Shape,IVtk_IShape)
|
||||
|
||||
// Handle implementation
|
||||
|
||||
|
||||
//============================================================================
|
||||
// Method: Constructor
|
||||
// Purpose:
|
||||
//============================================================================
|
||||
IVtkOCC_Shape::IVtkOCC_Shape (const TopoDS_Shape& theShape,
|
||||
const Handle(Prs3d_Drawer)& theDrawerLink)
|
||||
: myTopoDSShape (theShape),
|
||||
myOCCTDrawer (new Prs3d_Drawer())
|
||||
IVtkOCC_Shape::IVtkOCC_Shape (const TopoDS_Shape& theShape)
|
||||
: myTopoDSShape (theShape)
|
||||
{
|
||||
if (!theDrawerLink.IsNull())
|
||||
{
|
||||
myOCCTDrawer->SetLink (theDrawerLink);
|
||||
}
|
||||
else
|
||||
{
|
||||
// these old defaults have been moved from IVtkOCC_ShapeMesher constructor
|
||||
myOCCTDrawer->SetDeviationCoefficient (0.0001); // Aspect_TOD_RELATIVE
|
||||
}
|
||||
buildSubShapeIdMap();
|
||||
}
|
||||
|
||||
@@ -47,24 +38,26 @@ IVtkOCC_Shape::IVtkOCC_Shape (const TopoDS_Shape& theShape,
|
||||
IVtkOCC_Shape::~IVtkOCC_Shape() { }
|
||||
|
||||
//============================================================================
|
||||
// Method: GetSubShapeId
|
||||
// Purpose:
|
||||
// Method: getSubShapeId
|
||||
// Purpose: Returns unique ID of the given sub-shape within the top-level shape.
|
||||
//============================================================================
|
||||
IVtk_IdType IVtkOCC_Shape::GetSubShapeId (const TopoDS_Shape& theSubShape) const
|
||||
{
|
||||
Standard_Integer anIndex = theSubShape.IsSame (myTopoDSShape) ?
|
||||
-1 :
|
||||
mySubShapeIds.FindIndex (theSubShape);
|
||||
if (anIndex == 0) // Not found in the map
|
||||
|
||||
if (!anIndex) // Not found in the map
|
||||
{
|
||||
return (IVtk_IdType )-1;
|
||||
anIndex = -1;
|
||||
}
|
||||
|
||||
return (IVtk_IdType)anIndex;
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
// Method: getSubIds
|
||||
// Purpose:
|
||||
// Purpose: Get ids of sub-shapes composing a sub-shape with the given id.
|
||||
//============================================================================
|
||||
IVtk_ShapeIdList IVtkOCC_Shape::GetSubIds (const IVtk_IdType theId) const
|
||||
{
|
||||
@@ -80,7 +73,7 @@ IVtk_ShapeIdList IVtkOCC_Shape::GetSubIds (const IVtk_IdType theId) const
|
||||
}
|
||||
else
|
||||
{
|
||||
// Find all composing vertices, edges and faces of the found sub-shape
|
||||
// Find all composing vertices, edges and faces of the the found sub-shape
|
||||
// and append their ids to the result.
|
||||
TopTools_IndexedMapOfShape aSubShapes;
|
||||
if (aShape.IsSame (myTopoDSShape))
|
||||
|
@@ -32,23 +32,19 @@ public:
|
||||
|
||||
typedef Handle(IVtkOCC_Shape) Handle;
|
||||
|
||||
//! Constructor for OCC IShape implementation.
|
||||
//! @param theShape [in] shape to display
|
||||
//! @param theDrawerLink [in] default attributes to link
|
||||
Standard_EXPORT IVtkOCC_Shape (const TopoDS_Shape& theShape,
|
||||
const Handle(Prs3d_Drawer)& theDrawerLink = Handle(Prs3d_Drawer)());
|
||||
//! Constructor for OCC IShape implementation
|
||||
Standard_EXPORT IVtkOCC_Shape (const TopoDS_Shape& theShape);
|
||||
|
||||
//! Destructor
|
||||
Standard_EXPORT virtual ~IVtkOCC_Shape();
|
||||
|
||||
//! Returns unique ID of the given sub-shape within the top-level shape.
|
||||
Standard_EXPORT IVtk_IdType GetSubShapeId (const IVtk_IShape::Handle&) const;
|
||||
|
||||
DEFINE_STANDARD_RTTIEXT(IVtkOCC_Shape,IVtk_IShape)
|
||||
|
||||
//! Get the wrapped original OCCT shape
|
||||
//! @return TopoDS_Shape the wrapped original OCCT shape
|
||||
const TopoDS_Shape& GetShape() const
|
||||
TopoDS_Shape GetShape() const
|
||||
{
|
||||
return myTopoDSShape;
|
||||
}
|
||||
@@ -82,17 +78,11 @@ public:
|
||||
}
|
||||
|
||||
//! @return Handle to the selectable object for this shape.
|
||||
const Handle(SelectMgr_SelectableObject)& GetSelectableObject() const
|
||||
Handle(SelectMgr_SelectableObject) GetSelectableObject() const
|
||||
{
|
||||
return mySelectable;
|
||||
}
|
||||
|
||||
//! Return presentation attributes.
|
||||
const Handle(Prs3d_Drawer)& Attributes() const { return myOCCTDrawer; }
|
||||
|
||||
//! Set presentation attributes.
|
||||
void SetAttributes (const Handle(Prs3d_Drawer)& theDrawer) { myOCCTDrawer = theDrawer; }
|
||||
|
||||
private:
|
||||
//! @brief Build a map of sub-shapes by their IDs
|
||||
//!
|
||||
@@ -104,7 +94,6 @@ private:
|
||||
private:
|
||||
TopTools_IndexedMapOfShape mySubShapeIds; //!< Map of sub-shapes by their IDs
|
||||
TopoDS_Shape myTopoDSShape; //!< The wrapped main OCCT shape
|
||||
Handle(Prs3d_Drawer) myOCCTDrawer; //!< presentation attributes
|
||||
Handle(SelectMgr_SelectableObject) mySelectable; //!< Link to a holder of selection primitives
|
||||
};
|
||||
|
||||
|
@@ -15,71 +15,54 @@
|
||||
|
||||
#include <IVtkOCC_ShapeMesher.hxx>
|
||||
|
||||
#include <Adaptor3d_IsoCurve.hxx>
|
||||
#include <Bnd_Box.hxx>
|
||||
#include <BRep_Tool.hxx>
|
||||
#include <BRepBndLib.hxx>
|
||||
#include <BRepMesh_DiscretFactory.hxx>
|
||||
#include <BRepMesh_DiscretRoot.hxx>
|
||||
#include <BRepTools.hxx>
|
||||
#include <Hatch_Hatcher.hxx>
|
||||
#include <GCPnts_QuasiUniformDeflection.hxx>
|
||||
#include <GCPnts_TangentialDeflection.hxx>
|
||||
#include <Geom_BezierSurface.hxx>
|
||||
#include <Geom_BSplineSurface.hxx>
|
||||
#include <Geom2dAdaptor_Curve.hxx>
|
||||
#include <GeomAdaptor_Curve.hxx>
|
||||
#include <gp_Dir2d.hxx>
|
||||
#include <gp_Pnt2d.hxx>
|
||||
#include <Message.hxx>
|
||||
#include <NCollection_Array1.hxx>
|
||||
#include <Poly_Polygon3D.hxx>
|
||||
#include <Poly_PolygonOnTriangulation.hxx>
|
||||
#include <Poly_Triangulation.hxx>
|
||||
#include <Precision.hxx>
|
||||
#include <Prs3d.hxx>
|
||||
#include <Prs3d_Drawer.hxx>
|
||||
#include <Prs3d_IsoAspect.hxx>
|
||||
#include <Standard_ErrorHandler.hxx>
|
||||
#include <StdPrs_Isolines.hxx>
|
||||
#include <StdPrs_ToolTriangulatedShape.hxx>
|
||||
#include <TColgp_SequenceOfPnt2d.hxx>
|
||||
#include <TColStd_Array1OfReal.hxx>
|
||||
#include <TopExp.hxx>
|
||||
#include <TopExp_Explorer.hxx>
|
||||
#include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(IVtkOCC_ShapeMesher,IVtk_IShapeMesher)
|
||||
|
||||
//================================================================
|
||||
// Function : IVtkOCC_ShapeMesher
|
||||
// Purpose :
|
||||
//================================================================
|
||||
IVtkOCC_ShapeMesher::IVtkOCC_ShapeMesher()
|
||||
{
|
||||
//
|
||||
}
|
||||
// Handle implementation
|
||||
|
||||
//================================================================
|
||||
// Function : ~IVtkOCC_ShapeMesher
|
||||
// Purpose :
|
||||
//================================================================
|
||||
IVtkOCC_ShapeMesher::~IVtkOCC_ShapeMesher()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
//================================================================
|
||||
// Function : internalBuild
|
||||
// Purpose :
|
||||
// Purpose :
|
||||
//================================================================
|
||||
void IVtkOCC_ShapeMesher::internalBuild()
|
||||
{
|
||||
const TopoDS_Shape& anOcctShape = GetShapeObj()->GetShape();
|
||||
if (anOcctShape.IsNull())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
const Handle(Prs3d_Drawer)& anOcctDrawer = GetShapeObj()->Attributes();
|
||||
const Standard_Real aShapeDeflection = StdPrs_ToolTriangulatedShape::GetDeflection (anOcctShape, anOcctDrawer);
|
||||
if (anOcctDrawer->IsAutoTriangulation())
|
||||
{
|
||||
StdPrs_ToolTriangulatedShape::ClearOnOwnDeflectionChange (anOcctShape, anOcctDrawer, true);
|
||||
StdPrs_ToolTriangulatedShape::Tessellate (anOcctShape, anOcctDrawer);
|
||||
}
|
||||
for (TopExp_Explorer aFaceIter (anOcctShape, TopAbs_FACE); aFaceIter.More(); aFaceIter.Next())
|
||||
{
|
||||
const TopoDS_Face& anOcctFace = TopoDS::Face (aFaceIter.Current());
|
||||
TopLoc_Location aLoc;
|
||||
if (const Handle(Poly_Triangulation)& anOcctTriangulation = BRep_Tool::Triangulation (anOcctFace, aLoc))
|
||||
{
|
||||
StdPrs_ToolTriangulatedShape::ComputeNormals (anOcctFace, anOcctTriangulation);
|
||||
}
|
||||
}
|
||||
// TODO: do we need any protection here so as not to triangualte
|
||||
// the shape twice??? This can be done e.g. by checking if
|
||||
// triangulation exists for TopoDS_Shape..
|
||||
meshShape();
|
||||
|
||||
// Free vertices and free edges should always be shown.
|
||||
// Shared edges are needed in WF representation only.
|
||||
@@ -88,79 +71,83 @@ void IVtkOCC_ShapeMesher::internalBuild()
|
||||
addEdges();
|
||||
|
||||
// Build wireframe points and cells (lines for isolines)
|
||||
for (TopExp_Explorer aFaceIter (anOcctShape, TopAbs_FACE); aFaceIter.More(); aFaceIter.Next())
|
||||
{
|
||||
const TopoDS_Face& anOcctFace = TopoDS::Face (aFaceIter.Current());
|
||||
try
|
||||
{
|
||||
OCC_CATCH_SIGNALS
|
||||
addWFFace (anOcctFace, GetShapeObj()->GetSubShapeId (anOcctFace), aShapeDeflection);
|
||||
}
|
||||
catch (const Standard_Failure& anException)
|
||||
{
|
||||
Message::SendFail (TCollection_AsciiString("Error: addWireFrameFaces() wireframe presentation builder has failed (")
|
||||
+ anException.GetMessageString() + ")");
|
||||
}
|
||||
}
|
||||
addWireFrameFaces();
|
||||
|
||||
// Build shaded representation (based on Poly_Triangulation)
|
||||
for (TopExp_Explorer aFaceIter (anOcctShape, TopAbs_FACE); aFaceIter.More(); aFaceIter.Next())
|
||||
{
|
||||
const TopoDS_Face& anOcctFace = TopoDS::Face (aFaceIter.Current());
|
||||
addShadedFace (anOcctFace, GetShapeObj()->GetSubShapeId (anOcctFace));
|
||||
}
|
||||
addShadedFaces();
|
||||
}
|
||||
|
||||
//================================================================
|
||||
// Function : GetShapeObj
|
||||
// Purpose :
|
||||
// Purpose :
|
||||
//================================================================
|
||||
const IVtkOCC_Shape::Handle IVtkOCC_ShapeMesher::GetShapeObj() const
|
||||
{
|
||||
return IVtkOCC_Shape::Handle::DownCast(myShapeObj);
|
||||
return (IVtkOCC_Shape::Handle::DownCast(myShapeObj));
|
||||
}
|
||||
|
||||
//================================================================
|
||||
// Function : GetDeflection
|
||||
// Purpose :
|
||||
// Purpose : Returns absolute deflection used by this algorithm.
|
||||
//================================================================
|
||||
Standard_Real IVtkOCC_ShapeMesher::GetDeflection() const
|
||||
{
|
||||
if (myDeflection < Precision::Confusion()) // if not yet initialized
|
||||
{
|
||||
Handle(Prs3d_Drawer) aDefDrawer = new Prs3d_Drawer();
|
||||
aDefDrawer->SetTypeOfDeflection (Aspect_TOD_RELATIVE);
|
||||
aDefDrawer->SetDeviationCoefficient (GetDeviationCoeff());
|
||||
myDeflection = StdPrs_ToolTriangulatedShape::GetDeflection (GetShapeObj()->GetShape(), aDefDrawer);
|
||||
}
|
||||
|
||||
return myDeflection;
|
||||
}
|
||||
|
||||
//================================================================
|
||||
// Function : meshShape
|
||||
// Purpose :
|
||||
//================================================================
|
||||
void IVtkOCC_ShapeMesher::meshShape()
|
||||
{
|
||||
const TopoDS_Shape& anOcctShape = GetShapeObj()->GetShape();
|
||||
return !anOcctShape.IsNull()
|
||||
? StdPrs_ToolTriangulatedShape::GetDeflection (anOcctShape, GetShapeObj()->Attributes())
|
||||
: 0.0;
|
||||
}
|
||||
|
||||
//================================================================
|
||||
// Function : GetDeflection
|
||||
// Purpose :
|
||||
//================================================================
|
||||
Standard_Real IVtkOCC_ShapeMesher::GetDeviationCoeff() const
|
||||
{
|
||||
if (IVtkOCC_Shape::Handle aShape = GetShapeObj())
|
||||
if (anOcctShape.IsNull())
|
||||
{
|
||||
return aShape->Attributes()->DeviationCoefficient();
|
||||
return;
|
||||
}
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
//================================================================
|
||||
// Function : GetDeviationAngle
|
||||
// Purpose :
|
||||
//================================================================
|
||||
Standard_Real IVtkOCC_ShapeMesher::GetDeviationAngle() const
|
||||
{
|
||||
if (IVtkOCC_Shape::Handle aShape = GetShapeObj())
|
||||
//Clean triangulation before compute incremental mesh
|
||||
BRepTools::Clean (anOcctShape);
|
||||
|
||||
//Compute triangulation
|
||||
Standard_Real aDeflection = GetDeflection();
|
||||
if (aDeflection < Precision::Confusion())
|
||||
{
|
||||
return aShape->Attributes()->DeviationAngle();
|
||||
return;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
OCC_CATCH_SIGNALS
|
||||
|
||||
Handle(BRepMesh_DiscretRoot) anAlgo;
|
||||
anAlgo = BRepMesh_DiscretFactory::Get().Discret (anOcctShape,
|
||||
aDeflection,
|
||||
GetDeviationAngle());
|
||||
if (!anAlgo.IsNull())
|
||||
{
|
||||
anAlgo->Perform();
|
||||
}
|
||||
}
|
||||
catch (const Standard_Failure& anException)
|
||||
{
|
||||
Message::SendFail (TCollection_AsciiString("Error: IVtkOCC_ShapeMesher::meshShape() triangulation builder has failed (")
|
||||
+ anException.GetMessageString() + ")");
|
||||
}
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
//================================================================
|
||||
// Function : addFreeVertices
|
||||
// Purpose :
|
||||
// Purpose :
|
||||
//================================================================
|
||||
void IVtkOCC_ShapeMesher::addFreeVertices()
|
||||
{
|
||||
@@ -189,7 +176,7 @@ void IVtkOCC_ShapeMesher::addFreeVertices()
|
||||
|
||||
//================================================================
|
||||
// Function : addEdges
|
||||
// Purpose :
|
||||
// Purpose :
|
||||
//================================================================
|
||||
void IVtkOCC_ShapeMesher::addEdges()
|
||||
{
|
||||
@@ -226,9 +213,54 @@ void IVtkOCC_ShapeMesher::addEdges()
|
||||
}
|
||||
}
|
||||
|
||||
//================================================================
|
||||
// Function : addWireFrameFaces
|
||||
// Purpose :
|
||||
//================================================================
|
||||
void IVtkOCC_ShapeMesher::addWireFrameFaces()
|
||||
{
|
||||
// Check the deflection value once for all faces
|
||||
if (GetDeflection() < Precision::Confusion())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
TopExp_Explorer aFaceIter (GetShapeObj()->GetShape(), TopAbs_FACE);
|
||||
for (; aFaceIter.More(); aFaceIter.Next())
|
||||
{
|
||||
const TopoDS_Face& anOcctFace = TopoDS::Face (aFaceIter.Current());
|
||||
try
|
||||
{
|
||||
OCC_CATCH_SIGNALS
|
||||
addWFFace (anOcctFace,
|
||||
GetShapeObj()->GetSubShapeId (anOcctFace));
|
||||
}
|
||||
catch (const Standard_Failure& anException)
|
||||
{
|
||||
Message::SendFail (TCollection_AsciiString("Error: addWireFrameFaces() wireframe presentation builder has failed (")
|
||||
+ anException.GetMessageString() + ")");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//================================================================
|
||||
// Function : addShadedFaces
|
||||
// Purpose :
|
||||
//================================================================
|
||||
void IVtkOCC_ShapeMesher::addShadedFaces()
|
||||
{
|
||||
TopExp_Explorer aFaceIter (GetShapeObj()->GetShape(), TopAbs_FACE);
|
||||
for (; aFaceIter.More(); aFaceIter.Next())
|
||||
{
|
||||
const TopoDS_Face& anOcctFace = TopoDS::Face (aFaceIter.Current());
|
||||
addShadedFace (anOcctFace,
|
||||
GetShapeObj()->GetSubShapeId (anOcctFace));
|
||||
}
|
||||
}
|
||||
|
||||
//================================================================
|
||||
// Function : addVertex
|
||||
// Purpose :
|
||||
// Purpose :
|
||||
//================================================================
|
||||
void IVtkOCC_ShapeMesher::addVertex (const TopoDS_Vertex& theVertex,
|
||||
const IVtk_IdType theShapeId,
|
||||
@@ -241,14 +273,53 @@ void IVtkOCC_ShapeMesher::addVertex (const TopoDS_Vertex& theVertex,
|
||||
|
||||
gp_Pnt aPnt3d = BRep_Tool::Pnt (theVertex);
|
||||
|
||||
IVtk_PointId anId = myShapeData->InsertCoordinate (aPnt3d);
|
||||
IVtk_PointId anId =
|
||||
myShapeData->InsertCoordinate (aPnt3d.X(), aPnt3d.Y(), aPnt3d.Z());
|
||||
myShapeData->InsertVertex (theShapeId, anId, theMeshType);
|
||||
|
||||
}
|
||||
|
||||
//================================================================
|
||||
// Function : processPolyline
|
||||
// Purpose :
|
||||
//================================================================
|
||||
void IVtkOCC_ShapeMesher::processPolyline (Standard_Integer theNbNodes,
|
||||
const TColgp_Array1OfPnt& thePoints,
|
||||
const TColStd_Array1OfInteger& thePointIds,
|
||||
const IVtk_IdType theOcctId,
|
||||
bool theNoTransform,
|
||||
gp_Trsf theTransformation,
|
||||
const IVtk_MeshType theMeshType)
|
||||
{
|
||||
if (theNbNodes < 2)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
IVtk_PointIdList aPolyPointIds;
|
||||
|
||||
IVtk_PointId anId;
|
||||
for (Standard_Integer aJ = 0; aJ < theNbNodes; aJ++)
|
||||
{
|
||||
Standard_Integer aPntId = thePointIds (aJ + 1);
|
||||
gp_Pnt point = thePoints (aPntId);
|
||||
|
||||
if (!theNoTransform)
|
||||
{
|
||||
// Apply the transformation to points
|
||||
point.Transform (theTransformation);
|
||||
}
|
||||
|
||||
anId = myShapeData->InsertCoordinate (point.X(), point.Y(), point.Z());
|
||||
aPolyPointIds.Append (anId);
|
||||
}
|
||||
|
||||
myShapeData->InsertLine (theOcctId, &aPolyPointIds, theMeshType);
|
||||
}
|
||||
|
||||
//================================================================
|
||||
// Function : addEdge
|
||||
// Purpose :
|
||||
// Purpose :
|
||||
//================================================================
|
||||
void IVtkOCC_ShapeMesher::addEdge (const TopoDS_Edge& theEdge,
|
||||
const IVtk_IdType theShapeId,
|
||||
@@ -259,69 +330,81 @@ void IVtkOCC_ShapeMesher::addEdge (const TopoDS_Edge& theEdge,
|
||||
return;
|
||||
}
|
||||
|
||||
// Two discrete representations of an OCCT edge are possible:
|
||||
// 1. Polygon on trinagulation - holds Ids of points
|
||||
// contained in Poly_Triangulation object
|
||||
Handle(Poly_PolygonOnTriangulation) aPolyOnTriangulation;
|
||||
Handle(Poly_Triangulation) aTriangulation;
|
||||
TopLoc_Location aLoc;
|
||||
BRep_Tool::PolygonOnTriangulation (theEdge, aPolyOnTriangulation, aTriangulation, aLoc, 1);
|
||||
if (!aPolyOnTriangulation.IsNull()
|
||||
&& aPolyOnTriangulation->NbNodes() >= 2)
|
||||
{
|
||||
// prefer polygon on triangulation when defined
|
||||
const gp_Trsf aTrsf = aLoc.Transformation();
|
||||
const bool hasTransform = !aLoc.IsIdentity();
|
||||
TopLoc_Location aLocation;
|
||||
BRep_Tool::PolygonOnTriangulation (theEdge,
|
||||
aPolyOnTriangulation,
|
||||
aTriangulation,
|
||||
aLocation,
|
||||
1);
|
||||
|
||||
// 2. 3D polygon - holds 3D points
|
||||
Handle(Poly_Polygon3D) aPoly3d;
|
||||
if (aPolyOnTriangulation.IsNull())
|
||||
{
|
||||
aPoly3d = BRep_Tool::Polygon3D (theEdge, aLocation);
|
||||
}
|
||||
|
||||
if (aPoly3d.IsNull() && aPolyOnTriangulation.IsNull())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Handle a non-identity transofmation applied to the edge
|
||||
gp_Trsf anEdgeTransf;
|
||||
bool noTransform = true;
|
||||
if (!aLocation.IsIdentity())
|
||||
{
|
||||
noTransform = false;
|
||||
anEdgeTransf = aLocation.Transformation();
|
||||
}
|
||||
|
||||
if (!aPoly3d.IsNull())
|
||||
{
|
||||
Standard_Integer aNbNodes = aPoly3d->NbNodes();
|
||||
const TColgp_Array1OfPnt& aPoints = aPoly3d->Nodes();
|
||||
TColStd_Array1OfInteger aPointIds (1, aNbNodes);
|
||||
|
||||
for (Standard_Integer anI = 1; anI <= aNbNodes; anI++)
|
||||
{
|
||||
aPointIds.SetValue (anI, anI);
|
||||
}
|
||||
|
||||
processPolyline (aNbNodes,
|
||||
aPoints,
|
||||
aPointIds,
|
||||
theShapeId,
|
||||
noTransform,
|
||||
anEdgeTransf,
|
||||
theMeshType);
|
||||
}
|
||||
else if (aPolyOnTriangulation->NbNodes() >= 2)
|
||||
{
|
||||
IVtk_PointIdList aPolyPointIds;
|
||||
const Standard_Integer aNbNodes = aPolyOnTriangulation->NbNodes();
|
||||
for (Standard_Integer aJ = 0; aJ < aNbNodes; aJ++)
|
||||
{
|
||||
const Standard_Integer aPntId = aPolyOnTriangulation->Node (aJ + 1);
|
||||
gp_Pnt aPoint = aTriangulation->Node (aPntId);
|
||||
gp_Dir aNorm = aTriangulation->HasNormals() ? aTriangulation->Normal (aPntId) : gp::DZ();
|
||||
if (hasTransform)
|
||||
{
|
||||
aPoint.Transform (aTrsf);
|
||||
aNorm .Transform (aTrsf);
|
||||
}
|
||||
if (!noTransform) { aPoint.Transform (anEdgeTransf); }
|
||||
|
||||
IVtk_PointId anId = myShapeData->InsertPoint (aPoint, Graphic3d_Vec3 ((float )aNorm.X(), (float )aNorm.Y(), (float )aNorm.Z()));
|
||||
IVtk_PointId anId = myShapeData->InsertCoordinate (aPoint.X(), aPoint.Y(), aPoint.Z());
|
||||
aPolyPointIds.Append (anId);
|
||||
}
|
||||
myShapeData->InsertLine (theShapeId, &aPolyPointIds, theMeshType);
|
||||
return;
|
||||
}
|
||||
|
||||
// try polygon 3d
|
||||
Handle(Poly_Polygon3D) aPoly3d = BRep_Tool::Polygon3D (theEdge, aLoc);
|
||||
if (aPoly3d.IsNull()
|
||||
|| aPoly3d->NbNodes() < 2)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
const gp_Trsf anEdgeTransf = aLoc.Transformation();
|
||||
const bool noTransform = aLoc.IsIdentity();
|
||||
IVtk_PointIdList aPolyPointIds;
|
||||
for (Standard_Integer aNodeIter = 1; aNodeIter <= aPoly3d->NbNodes(); ++aNodeIter)
|
||||
{
|
||||
gp_Pnt aPnt = aPoly3d->Nodes().Value (aNodeIter);
|
||||
if (!noTransform)
|
||||
{
|
||||
aPnt.Transform (anEdgeTransf);
|
||||
}
|
||||
|
||||
const IVtk_PointId anId = myShapeData->InsertCoordinate (aPnt);
|
||||
aPolyPointIds.Append (anId);
|
||||
}
|
||||
myShapeData->InsertLine (theShapeId, &aPolyPointIds, theMeshType);
|
||||
}
|
||||
|
||||
//================================================================
|
||||
// Function : addWFFace
|
||||
// Purpose :
|
||||
// Purpose :
|
||||
//================================================================
|
||||
void IVtkOCC_ShapeMesher::addWFFace (const TopoDS_Face& theFace,
|
||||
const IVtk_IdType theShapeId,
|
||||
const Standard_Real theDeflection)
|
||||
void IVtkOCC_ShapeMesher::addWFFace (const TopoDS_Face& theFace,
|
||||
const IVtk_IdType theShapeId)
|
||||
{
|
||||
if (theFace.IsNull())
|
||||
{
|
||||
@@ -331,6 +414,12 @@ void IVtkOCC_ShapeMesher::addWFFace (const TopoDS_Face& theFace,
|
||||
TopoDS_Face aFaceToMesh = theFace;
|
||||
aFaceToMesh.Orientation (TopAbs_FORWARD);
|
||||
|
||||
// The code that builds wireframe representation for a TopoDS_Face
|
||||
// has been adapted from some OCCT 6.5.1 methods:
|
||||
// - Prs3d_WFShape::Add()
|
||||
// - StdPrs_WFDeflectionRestrictedFace::Add()
|
||||
// - StdPrs_DeflectionCurve::Add()
|
||||
|
||||
// Add face's edges here but with the face ID
|
||||
for (TopExp_Explorer anEdgeIter (aFaceToMesh, TopAbs_EDGE); anEdgeIter.More(); anEdgeIter.Next())
|
||||
{
|
||||
@@ -345,8 +434,16 @@ void IVtkOCC_ShapeMesher::addWFFace (const TopoDS_Face& theFace,
|
||||
return;
|
||||
}
|
||||
|
||||
const Standard_Real aDeflection = GetDeflection();
|
||||
Handle(Prs3d_Drawer) aDrawer = new Prs3d_Drawer();
|
||||
aDrawer->SetUIsoAspect (new Prs3d_IsoAspect (Quantity_NOC_WHITE, Aspect_TOL_SOLID, 1.0f, myNbIsos[0]));
|
||||
aDrawer->SetVIsoAspect (new Prs3d_IsoAspect (Quantity_NOC_WHITE, Aspect_TOL_SOLID, 1.0f, myNbIsos[1]));
|
||||
aDrawer->SetDeviationAngle (myDevAngle);
|
||||
aDrawer->SetDeviationCoefficient (myDevCoeff);
|
||||
aDrawer->SetMaximalChordialDeviation (aDeflection);
|
||||
|
||||
Prs3d_NListOfSequenceOfPnt aPolylines;
|
||||
StdPrs_Isolines::Add (theFace, GetShapeObj()->Attributes(), theDeflection, aPolylines, aPolylines);
|
||||
StdPrs_Isolines::Add (theFace, aDrawer, aDeflection, aPolylines, aPolylines);
|
||||
for (Prs3d_NListOfSequenceOfPnt::Iterator aPolyIter (aPolylines); aPolyIter.More(); aPolyIter.Next())
|
||||
{
|
||||
const Handle(TColgp_HSequenceOfPnt)& aPoints = aPolyIter.Value();
|
||||
@@ -360,7 +457,7 @@ void IVtkOCC_ShapeMesher::addWFFace (const TopoDS_Face& theFace,
|
||||
for (TColgp_HSequenceOfPnt::Iterator aNodeIter (*aPoints); aNodeIter.More(); aNodeIter.Next())
|
||||
{
|
||||
const gp_Pnt& aPnt = aNodeIter.Value();
|
||||
const IVtk_PointId anId = myShapeData->InsertCoordinate (aPnt);
|
||||
const IVtk_PointId anId = myShapeData->InsertCoordinate (aPnt.X(), aPnt.Y(), aPnt.Z());
|
||||
aPolyPointIds.Append (anId);
|
||||
}
|
||||
|
||||
@@ -370,7 +467,7 @@ void IVtkOCC_ShapeMesher::addWFFace (const TopoDS_Face& theFace,
|
||||
|
||||
//================================================================
|
||||
// Function : addShadedFace
|
||||
// Purpose :
|
||||
// Purpose :
|
||||
//================================================================
|
||||
void IVtkOCC_ShapeMesher::addShadedFace (const TopoDS_Face& theFace,
|
||||
const IVtk_IdType theShapeId)
|
||||
@@ -380,17 +477,21 @@ void IVtkOCC_ShapeMesher::addShadedFace (const TopoDS_Face& theFace,
|
||||
return;
|
||||
}
|
||||
|
||||
// Build triangulation of the face.
|
||||
TopLoc_Location aLoc;
|
||||
const Handle(Poly_Triangulation)& anOcctTriangulation = BRep_Tool::Triangulation (theFace, aLoc);
|
||||
Handle(Poly_Triangulation) anOcctTriangulation = BRep_Tool::Triangulation (theFace, aLoc);
|
||||
if (anOcctTriangulation.IsNull())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Determinant of transform matrix less then 0 means that mirror transform applied
|
||||
const gp_Trsf aTrsf = aLoc.Transformation();
|
||||
const bool hasTransform = !aLoc.IsIdentity();
|
||||
const bool isMirrored = aTrsf.VectorialPart().Determinant() < 0;
|
||||
gp_Trsf aPntTransform;
|
||||
Standard_Boolean noTransform = Standard_True;
|
||||
if (!aLoc.IsIdentity())
|
||||
{
|
||||
noTransform = Standard_False;
|
||||
aPntTransform = aLoc.Transformation();
|
||||
}
|
||||
|
||||
// Get triangulation points.
|
||||
Standard_Integer aNbPoints = anOcctTriangulation->NbNodes();
|
||||
@@ -398,40 +499,30 @@ void IVtkOCC_ShapeMesher::addShadedFace (const TopoDS_Face& theFace,
|
||||
// Keep inserted points id's of triangulation in an array.
|
||||
NCollection_Array1<IVtk_PointId> aPointIds (1, aNbPoints);
|
||||
IVtk_PointId anId;
|
||||
for (Standard_Integer anI = 1; anI <= aNbPoints; anI++)
|
||||
|
||||
Standard_Integer anI;
|
||||
for (anI = 1; anI <= aNbPoints; anI++)
|
||||
{
|
||||
gp_Pnt aPoint = anOcctTriangulation->Node (anI);
|
||||
gp_Dir aNorm = anOcctTriangulation->HasNormals() ? anOcctTriangulation->Normal (anI) : gp::DZ();
|
||||
if ((theFace.Orientation() == TopAbs_REVERSED) ^ isMirrored)
|
||||
|
||||
if (!noTransform)
|
||||
{
|
||||
aNorm.Reverse();
|
||||
}
|
||||
if (hasTransform)
|
||||
{
|
||||
aPoint.Transform (aTrsf);
|
||||
aNorm .Transform (aTrsf);
|
||||
aPoint.Transform (aPntTransform);
|
||||
}
|
||||
|
||||
// Add a point into output shape data and keep its id in the array.
|
||||
anId = myShapeData->InsertPoint (aPoint, Graphic3d_Vec3 ((float )aNorm.X(), (float )aNorm.Y(), (float )aNorm.Z()));
|
||||
anId = myShapeData->InsertCoordinate (aPoint.X(), aPoint.Y(), aPoint.Z());
|
||||
aPointIds.SetValue (anI, anId);
|
||||
}
|
||||
|
||||
// Create triangles on the created triangulation points.
|
||||
const Standard_Integer aNbTriangles = anOcctTriangulation->NbTriangles();
|
||||
Standard_Integer aNbTriangles = anOcctTriangulation->NbTriangles();
|
||||
Standard_Integer aN1, aN2, aN3;
|
||||
for (Standard_Integer anI = 1; anI <= aNbTriangles; anI++)
|
||||
for (anI = 1; anI <= aNbTriangles; anI++)
|
||||
{
|
||||
if (theFace.Orientation() == TopAbs_REVERSED)
|
||||
{
|
||||
anOcctTriangulation->Triangle (anI).Get (aN1, aN3, aN2);
|
||||
}
|
||||
else
|
||||
{
|
||||
anOcctTriangulation->Triangle (anI).Get (aN1, aN2, aN3);
|
||||
}
|
||||
|
||||
anOcctTriangulation->Triangle (anI).Get (aN1, aN2, aN3); // get indexes of triangle's points
|
||||
// Insert new triangle on these points into output shape data.
|
||||
myShapeData->InsertTriangle (theShapeId, aPointIds(aN1), aPointIds(aN2), aPointIds(aN3), MT_ShadedFace);
|
||||
myShapeData->InsertTriangle (
|
||||
theShapeId, aPointIds(aN1), aPointIds(aN2), aPointIds(aN3), MT_ShadedFace);
|
||||
}
|
||||
}
|
||||
|
@@ -16,22 +16,24 @@
|
||||
#ifndef __IVTKOCC_SHAPEMESHER_H__
|
||||
#define __IVTKOCC_SHAPEMESHER_H__
|
||||
|
||||
#include <BRepAdaptor_Surface.hxx>
|
||||
#include <IVtkOCC_Shape.hxx>
|
||||
#include <IVtk_IShapeMesher.hxx>
|
||||
#include <TColgp_Array1OfPnt.hxx>
|
||||
#include <TColgp_SequenceOfPnt.hxx>
|
||||
#include <TColStd_Array1OfInteger.hxx>
|
||||
#include <TopoDS.hxx>
|
||||
#include <TopoDS_Edge.hxx>
|
||||
#include <TopoDS_Face.hxx>
|
||||
#include <TopoDS_Vertex.hxx>
|
||||
#include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
|
||||
#include <TopTools_ListOfShape.hxx>
|
||||
#include <TopTools_ShapeMapHasher.hxx>
|
||||
|
||||
typedef NCollection_DataMap <TopoDS_Shape, IVtk_MeshType, TopTools_ShapeMapHasher> IVtk_ShapeTypeMap;
|
||||
typedef NCollection_Sequence <gp_Pnt> IVtk_Polyline;
|
||||
typedef NCollection_List <IVtk_Polyline> IVtk_PolylineList;
|
||||
|
||||
class Prs3d_Drawer;
|
||||
|
||||
class IVtkOCC_ShapeMesher;
|
||||
DEFINE_STANDARD_HANDLE( IVtkOCC_ShapeMesher, IVtk_IShapeMesher )
|
||||
|
||||
@@ -45,11 +47,19 @@ DEFINE_STANDARD_HANDLE( IVtkOCC_ShapeMesher, IVtk_IShapeMesher )
|
||||
class IVtkOCC_ShapeMesher : public IVtk_IShapeMesher
|
||||
{
|
||||
public:
|
||||
//! Main constructor.
|
||||
Standard_EXPORT IVtkOCC_ShapeMesher();
|
||||
IVtkOCC_ShapeMesher (const Standard_Real& theDevCoeff = 0.0001,
|
||||
const Standard_Real& theDevAngle = 12.0 * M_PI / 180.0,
|
||||
const Standard_Integer theNbUIsos = 1,
|
||||
const Standard_Integer theNbVIsos = 1)
|
||||
: myDevCoeff (theDevCoeff),
|
||||
myDevAngle (theDevAngle),
|
||||
myDeflection (0.0)
|
||||
{
|
||||
myNbIsos[0] = theNbUIsos;
|
||||
myNbIsos[1] = theNbVIsos;
|
||||
}
|
||||
|
||||
//! Destructor.
|
||||
Standard_EXPORT virtual ~IVtkOCC_ShapeMesher();
|
||||
virtual ~IVtkOCC_ShapeMesher() { }
|
||||
|
||||
//! Returns absolute deflection used by this algorithm.
|
||||
//! This value is calculated on the basis of the shape's bounding box.
|
||||
@@ -61,19 +71,28 @@ public:
|
||||
|
||||
//! Returns relative deviation coefficient used by this algorithm.
|
||||
//! @return relative deviation coefficient
|
||||
Standard_EXPORT Standard_Real GetDeviationCoeff() const;
|
||||
Standard_Real GetDeviationCoeff() const
|
||||
{
|
||||
return myDevCoeff;
|
||||
}
|
||||
|
||||
//! Returns deviation angle used by this algorithm.
|
||||
//! This is the maximum allowed angle between the normals to the
|
||||
//! curve/surface and the normals to polyline/faceted representation.
|
||||
//! @return deviation angle (in radians)
|
||||
Standard_EXPORT Standard_Real GetDeviationAngle() const;
|
||||
Standard_Real GetDeviationAngle() const
|
||||
{
|
||||
return myDevAngle;
|
||||
}
|
||||
|
||||
protected:
|
||||
//! Executes the mesh generation algorithms. To be defined in implementation class.
|
||||
Standard_EXPORT virtual void internalBuild() Standard_OVERRIDE;
|
||||
|
||||
private:
|
||||
//! Internal method, generates OCCT triangulation starting from TopoDS_Shape
|
||||
//! @see IVtkOCC_ShapeMesher::addEdge, IVtkOCC_ShapeMesher::addShadedFace
|
||||
void meshShape();
|
||||
|
||||
//! Extracts free vertices from the shape (i.e. those not belonging to any edge)
|
||||
//! and passes the geometry to IPolyData.
|
||||
@@ -83,6 +102,12 @@ private:
|
||||
//! Adds all the edges (free and non-free) to IPolyData.
|
||||
void addEdges();
|
||||
|
||||
//! Adds wireframe representations of all faces to IPolyData.
|
||||
void addWireFrameFaces();
|
||||
|
||||
//! Adds shaded representations of all faces to IPolyData.
|
||||
void addShadedFaces();
|
||||
|
||||
//! Adds the point coordinates, connectivity info and
|
||||
//! sub-shape ID for the OCCT vertex.
|
||||
//!
|
||||
@@ -105,22 +130,33 @@ private:
|
||||
//! Generates wireframe representation of the given TopoDS_Face object
|
||||
//! with help of OCCT algorithms. The resulting polylines are passed to IPolyData
|
||||
//! interface and associated with the given sub-shape ID.
|
||||
//! @param [in] theFace TopoDS_Face object to build wireframe representation for
|
||||
//! @param [in] theShapeId The face' sub-shape ID
|
||||
//! @param [in] theDeflection curve deflection
|
||||
void addWFFace (const TopoDS_Face& theFace,
|
||||
const IVtk_IdType theShapeId,
|
||||
const Standard_Real theDeflection);
|
||||
//! @param [in] faceToMesh TopoDS_Face object to build wireframe representation for.
|
||||
//! @param [in] shapeId The face' sub-shape ID
|
||||
void addWFFace (const TopoDS_Face& theFace,
|
||||
const IVtk_IdType theShapeId);
|
||||
|
||||
//! Creates shaded representation of the given TopoDS_Face object
|
||||
//! starting from OCCT triangulation that should be created in advance.
|
||||
//! The resulting triangles are passed to IPolyData
|
||||
//! interface and associated with the given sub-shape ID.
|
||||
//! @param [in] theFace TopoDS_Face object to build shaded representation for
|
||||
//! @param [in] theShapeId the face' sub-shape ID
|
||||
//! @param [in] faceToMesh TopoDS_Face object to build shaded representation for.
|
||||
//! @param [in] shapeId The face' sub-shape ID
|
||||
//! @see IVtkOCC_ShapeMesher::meshShape, IVtkOCC_ShapeMesher::addEdge
|
||||
void addShadedFace (const TopoDS_Face& theFace,
|
||||
const IVtk_IdType theShapeId);
|
||||
void addShadedFace (const TopoDS_Face& theFace,
|
||||
const IVtk_IdType theShapeId);
|
||||
|
||||
//! Internal helper method that unpacks the input arrays of points and
|
||||
//! connectivity and creates the polyline using IPolyData interface.
|
||||
//! Optionally, the transformation specified through the last argument
|
||||
//! can be applied to each point's coordinates (noTransform == true).
|
||||
//! The polyline is associated with the given sub-shape ID.
|
||||
void processPolyline (Standard_Integer theNbNodes,
|
||||
const TColgp_Array1OfPnt& thePoints,
|
||||
const TColStd_Array1OfInteger& thePointIds,
|
||||
const IVtk_IdType theOcctId,
|
||||
bool theNoTransform,
|
||||
gp_Trsf theTransformation,
|
||||
const IVtk_MeshType theMeshType);
|
||||
|
||||
//! Get the IShape as OCC implementation
|
||||
const IVtkOCC_Shape::Handle GetShapeObj() const;
|
||||
@@ -128,7 +164,11 @@ private:
|
||||
DEFINE_STANDARD_RTTIEXT(IVtkOCC_ShapeMesher,IVtk_IShapeMesher)
|
||||
|
||||
private:
|
||||
IVtk_ShapeTypeMap myEdgesTypes;
|
||||
IVtk_ShapeTypeMap myEdgesTypes;
|
||||
Standard_Real myDevCoeff;
|
||||
Standard_Real myDevAngle;
|
||||
mutable Standard_Real myDeflection;
|
||||
Standard_Integer myNbIsos[2];
|
||||
};
|
||||
|
||||
#endif // __IVTKOCC_SHAPEMESHER_H__
|
||||
|
@@ -23,9 +23,12 @@
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(IVtkOCC_ShapePickerAlgo,IVtk_IShapePickerAlgo)
|
||||
|
||||
// Handle implementation
|
||||
|
||||
|
||||
//================================================================
|
||||
// Function : Constructor
|
||||
// Purpose :
|
||||
// Purpose :
|
||||
//================================================================
|
||||
IVtkOCC_ShapePickerAlgo::IVtkOCC_ShapePickerAlgo() :
|
||||
myViewerSelector (new IVtkOCC_ViewerSelector())
|
||||
@@ -33,7 +36,7 @@ myViewerSelector (new IVtkOCC_ViewerSelector())
|
||||
|
||||
//================================================================
|
||||
// Function : Destructor
|
||||
// Purpose :
|
||||
// Purpose :
|
||||
//================================================================
|
||||
IVtkOCC_ShapePickerAlgo::~IVtkOCC_ShapePickerAlgo()
|
||||
{ }
|
||||
@@ -54,29 +57,30 @@ void IVtkOCC_ShapePickerAlgo::SetView (const IVtk_IView::Handle& theView)
|
||||
IVtk_SelectionModeList IVtkOCC_ShapePickerAlgo::GetSelectionModes (
|
||||
const IVtk_IShape::Handle& theShape) const
|
||||
{
|
||||
if (theShape.IsNull())
|
||||
{
|
||||
return IVtk_SelectionModeList();
|
||||
}
|
||||
|
||||
// Get shape implementation from shape interface.
|
||||
Handle(IVtkOCC_Shape) aShapeImpl = Handle(IVtkOCC_Shape)::DownCast(theShape);
|
||||
|
||||
// Get selectable object from the shape implementation.
|
||||
Handle(IVtkOCC_SelectableObject) aSelObj = Handle(IVtkOCC_SelectableObject)::DownCast(aShapeImpl->GetSelectableObject());
|
||||
if (aSelObj.IsNull())
|
||||
{
|
||||
return IVtk_SelectionModeList();
|
||||
}
|
||||
|
||||
IVtk_SelectionModeList aRes;
|
||||
for (IVtk_SelectionMode aSelMode = SM_Shape; aSelMode <= SM_Compound; aSelMode = (IVtk_SelectionMode)(aSelMode + 1))
|
||||
|
||||
if (! theShape.IsNull())
|
||||
{
|
||||
if (myViewerSelector->IsActive (aSelObj, aSelMode))
|
||||
// Get shape implementation from shape interface.
|
||||
Handle(IVtkOCC_Shape) aShapeImpl = Handle(IVtkOCC_Shape)::DownCast(theShape);
|
||||
|
||||
// Get selectable object from the shape implementation.
|
||||
Handle(IVtkOCC_SelectableObject) aSelObj =
|
||||
Handle(IVtkOCC_SelectableObject)::DownCast(aShapeImpl->GetSelectableObject());
|
||||
|
||||
if (!aSelObj.IsNull())
|
||||
{
|
||||
aRes.Append (aSelMode);
|
||||
IVtk_SelectionMode aSelMode;
|
||||
for (aSelMode = SM_Shape; aSelMode <= SM_Compound; aSelMode = (IVtk_SelectionMode)(aSelMode + 1))
|
||||
{
|
||||
if (myViewerSelector->IsActive (aSelObj, aSelMode))
|
||||
{
|
||||
aRes.Append (aSelMode);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return aRes;
|
||||
}
|
||||
|
||||
@@ -98,7 +102,8 @@ void IVtkOCC_ShapePickerAlgo::SetSelectionMode (const IVtk_IShape::Handle& theSh
|
||||
// are destroyed when shapes are deactivated...
|
||||
|
||||
// Get shape implementation from shape interface.
|
||||
Handle(IVtkOCC_Shape) aShapeImpl = Handle(IVtkOCC_Shape)::DownCast(theShape);
|
||||
Handle(IVtkOCC_Shape) aShapeImpl =
|
||||
Handle(IVtkOCC_Shape)::DownCast(theShape);
|
||||
|
||||
// Get selectable object from the shape implementation.
|
||||
Handle(IVtkOCC_SelectableObject) aSelObj =
|
||||
@@ -175,9 +180,11 @@ void IVtkOCC_ShapePickerAlgo::SetSelectionMode (const IVtk_ShapePtrList& theShap
|
||||
const IVtk_SelectionMode theMode,
|
||||
const bool /*theIsTurnOn*/)
|
||||
{
|
||||
for (IVtk_ShapePtrList::Iterator anIt (theShapes); anIt.More(); anIt.Next())
|
||||
IVtk_IShape::Handle aShape;
|
||||
IVtk_ShapePtrList::Iterator anIt (theShapes);
|
||||
for (; anIt.More(); anIt.Next())
|
||||
{
|
||||
IVtk_IShape::Handle aShape = anIt.Value();
|
||||
aShape = anIt.Value();
|
||||
SetSelectionMode (aShape, theMode);
|
||||
}
|
||||
}
|
||||
@@ -364,7 +371,8 @@ void IVtkOCC_ShapePickerAlgo::RemoveSelectableObject(const IVtk_IShape::Handle&
|
||||
{
|
||||
clearPicked();
|
||||
// Get shape implementation from shape interface.
|
||||
Handle(IVtkOCC_Shape) aShapeImpl = Handle(IVtkOCC_Shape)::DownCast(theShape);
|
||||
Handle(IVtkOCC_Shape) aShapeImpl =
|
||||
Handle(IVtkOCC_Shape)::DownCast(theShape);
|
||||
|
||||
// Get selectable object from the shape implementation.
|
||||
Handle(IVtkOCC_SelectableObject) aSelObj =
|
||||
@@ -373,4 +381,4 @@ void IVtkOCC_ShapePickerAlgo::RemoveSelectableObject(const IVtk_IShape::Handle&
|
||||
myViewerSelector->RemoveSelectableObject(aSelObj);
|
||||
myViewerSelector->Clear();
|
||||
aShapeImpl->SetSelectableObject(NULL);
|
||||
}
|
||||
}
|
@@ -14,11 +14,11 @@
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#include <IVtkOCC_ViewerSelector.hxx>
|
||||
|
||||
#include <Select3D_SensitiveBox.hxx>
|
||||
#include <TColgp_Array1OfPnt2d.hxx>
|
||||
#include <Graphic3d_Camera.hxx>
|
||||
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(IVtkOCC_ViewerSelector,SelectMgr_ViewerSelector)
|
||||
|
||||
//============================================================================
|
||||
@@ -27,8 +27,8 @@ IMPLEMENT_STANDARD_RTTIEXT(IVtkOCC_ViewerSelector,SelectMgr_ViewerSelector)
|
||||
//============================================================================
|
||||
IVtkOCC_ViewerSelector::IVtkOCC_ViewerSelector()
|
||||
: SelectMgr_ViewerSelector(),
|
||||
myPixTol(2),
|
||||
myToUpdateTol(Standard_True)
|
||||
myPixTol(2),
|
||||
myToUpdateTol(Standard_True)
|
||||
{
|
||||
}
|
||||
|
||||
|
@@ -25,6 +25,7 @@
|
||||
//! @brief Class that implements OCCT selection algorithm.
|
||||
//!
|
||||
//! Inspired by StdSelect_ViewerSelector3d class from OCCT 6.5.1
|
||||
|
||||
class IVtkOCC_ViewerSelector : public SelectMgr_ViewerSelector
|
||||
{
|
||||
public:
|
||||
@@ -65,5 +66,4 @@ private:
|
||||
};
|
||||
|
||||
DEFINE_STANDARD_HANDLE( IVtkOCC_ViewerSelector, SelectMgr_ViewerSelector )
|
||||
|
||||
#endif // __IVTKOCC_VIEWERSELECTOR_H__
|
||||
|
@@ -34,10 +34,9 @@ vtkStandardNewMacro(IVtkTools_DisplayModeFilter)
|
||||
// Purpose:
|
||||
//============================================================================
|
||||
IVtkTools_DisplayModeFilter::IVtkTools_DisplayModeFilter()
|
||||
: myDisplayMode (DM_Wireframe),
|
||||
myDoDisplaySharedVertices (false),
|
||||
myDrawFaceBoundaries (false),
|
||||
myIsSmoothShading (true)
|
||||
: myDisplayMode (DM_Wireframe),
|
||||
myDoDisplaySharedVertices (false),
|
||||
myDrawFaceBoundaries( false )
|
||||
{
|
||||
// Filter according to values in subshapes types array.
|
||||
myIdsArrayName = IVtkVTK_ShapeData::ARRNAME_MESH_TYPES();
|
||||
@@ -79,7 +78,6 @@ int IVtkTools_DisplayModeFilter::RequestData (vtkInformation *theRequest,
|
||||
vtkInformationVector *theOutputVector)
|
||||
{
|
||||
SetData (myModesDefinition[myDisplayMode]);
|
||||
myToCopyNormals = myIsSmoothShading && (myDisplayMode == DM_Shading);
|
||||
return Superclass::RequestData (theRequest, theInputVector, theOutputVector);
|
||||
}
|
||||
|
||||
@@ -186,16 +184,3 @@ void IVtkTools_DisplayModeFilter::SetFaceBoundaryDraw(bool theToDraw)
|
||||
}
|
||||
Modified();
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
// Method: SetSmoothShading
|
||||
// Purpose:
|
||||
//============================================================================
|
||||
void IVtkTools_DisplayModeFilter::SetSmoothShading (bool theIsSmooth)
|
||||
{
|
||||
if (myIsSmoothShading != theIsSmooth)
|
||||
{
|
||||
myIsSmoothShading = theIsSmooth;
|
||||
Modified();
|
||||
}
|
||||
}
|
||||
|
@@ -58,26 +58,21 @@ public:
|
||||
//! Returns True if drawing Boundary of faces for shading mode is defined.
|
||||
bool FaceBoundaryDraw() const { return myDrawFaceBoundaries; }
|
||||
|
||||
//! Returns TRUE if vertex normals should be included for smooth shading within DM_Shading mode or not.
|
||||
bool IsSmoothShading() const { return myIsSmoothShading; }
|
||||
|
||||
//! Set if vertex normals should be included for smooth shading or not.
|
||||
void SetSmoothShading (bool theIsSmooth);
|
||||
|
||||
protected:
|
||||
//! Filter cells according to the given set of ids.
|
||||
virtual int RequestData (vtkInformation *, vtkInformationVector **, vtkInformationVector *) Standard_OVERRIDE;
|
||||
virtual int RequestData (vtkInformation *, vtkInformationVector **, vtkInformationVector *);
|
||||
|
||||
IVtkTools_DisplayModeFilter();
|
||||
virtual ~IVtkTools_DisplayModeFilter();
|
||||
|
||||
protected:
|
||||
IVtk_DisplayMode myDisplayMode; //!< Display mode defining mesh types to pass through this filter
|
||||
//! Display mode defining mesh types to pass through this filter.
|
||||
IVtk_DisplayMode myDisplayMode;
|
||||
IVtk_IdTypeMap myModesDefinition[2];
|
||||
bool myDoDisplaySharedVertices;
|
||||
|
||||
bool myDrawFaceBoundaries; //!< Draw Face boundaries within shading display mode
|
||||
bool myIsSmoothShading; //!< include vertex normals for smooth shading or not
|
||||
//! Draw Face boundaries flag is applicable only for shading display mode.
|
||||
bool myDrawFaceBoundaries;
|
||||
};
|
||||
|
||||
#ifdef _MSC_VER
|
||||
|
@@ -38,10 +38,10 @@ vtkStandardNewMacro(IVtkTools_ShapeDataSource)
|
||||
|
||||
//================================================================
|
||||
// Function : Constructor
|
||||
// Purpose :
|
||||
// Purpose :
|
||||
//================================================================
|
||||
IVtkTools_ShapeDataSource::IVtkTools_ShapeDataSource()
|
||||
: myPolyData (new IVtkVTK_ShapeData()),
|
||||
: myPolyData (new IVtkVTK_ShapeData),
|
||||
myIsFastTransformMode (Standard_False),
|
||||
myIsTransformOnly (Standard_False)
|
||||
{
|
||||
@@ -51,112 +51,130 @@ IVtkTools_ShapeDataSource::IVtkTools_ShapeDataSource()
|
||||
|
||||
//================================================================
|
||||
// Function : Destructor
|
||||
// Purpose :
|
||||
// Purpose :
|
||||
//================================================================
|
||||
IVtkTools_ShapeDataSource::~IVtkTools_ShapeDataSource()
|
||||
{
|
||||
//
|
||||
}
|
||||
{ }
|
||||
|
||||
//================================================================
|
||||
// Function : SetShape
|
||||
// Purpose :
|
||||
// Purpose :
|
||||
//================================================================
|
||||
void IVtkTools_ShapeDataSource::SetShape (const IVtkOCC_Shape::Handle& theOccShape)
|
||||
{
|
||||
myIsTransformOnly = myIsFastTransformMode
|
||||
&& !myOccShape.IsNull()
|
||||
&& theOccShape->GetShape().IsPartner (myOccShape->GetShape());
|
||||
if (myIsFastTransformMode && !myOccShape.IsNull() &&
|
||||
theOccShape->GetShape().IsPartner (myOccShape->GetShape() ) )
|
||||
{
|
||||
myIsTransformOnly = Standard_True;
|
||||
}
|
||||
else
|
||||
{
|
||||
myIsTransformOnly = Standard_False;
|
||||
}
|
||||
|
||||
myOccShape = theOccShape;
|
||||
this->Modified();
|
||||
}
|
||||
|
||||
//================================================================
|
||||
// Function : GetShape
|
||||
// Purpose :
|
||||
//================================================================
|
||||
IVtkOCC_Shape::Handle IVtkTools_ShapeDataSource::GetShape()
|
||||
{
|
||||
return myOccShape;
|
||||
}
|
||||
|
||||
//================================================================
|
||||
// Function : RequestData
|
||||
// Purpose :
|
||||
// Purpose :
|
||||
//================================================================
|
||||
int IVtkTools_ShapeDataSource::RequestData(vtkInformation *vtkNotUsed(theRequest),
|
||||
vtkInformationVector **vtkNotUsed(theInputVector),
|
||||
vtkInformationVector *theOutputVector)
|
||||
{
|
||||
vtkSmartPointer<vtkPolyData> aPolyData = vtkPolyData::GetData (theOutputVector);
|
||||
if (aPolyData.GetPointer() == NULL)
|
||||
if (aPolyData.GetPointer() != NULL)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
aPolyData->Allocate();
|
||||
vtkSmartPointer<vtkPoints> aPts = vtkSmartPointer<vtkPoints>::New();
|
||||
aPolyData->SetPoints (aPts);
|
||||
|
||||
aPolyData->Allocate();
|
||||
vtkSmartPointer<vtkPoints> aPts = vtkSmartPointer<vtkPoints>::New();
|
||||
aPolyData->SetPoints (aPts);
|
||||
vtkSmartPointer<vtkPolyData> aTransformedData;
|
||||
TopoDS_Shape aShape = myOccShape->GetShape();
|
||||
TopLoc_Location aShapeLoc = aShape.Location();
|
||||
|
||||
vtkSmartPointer<vtkPolyData> aTransformedData;
|
||||
TopoDS_Shape aShape = myOccShape->GetShape();
|
||||
const TopLoc_Location aShapeLoc = aShape.Location();
|
||||
if (myIsTransformOnly)
|
||||
{
|
||||
vtkSmartPointer<vtkPolyData> aPrevData = myPolyData->getVtkPolyData();
|
||||
if (!aShapeLoc.IsIdentity())
|
||||
if (myIsTransformOnly)
|
||||
{
|
||||
aTransformedData = this->transform (aPrevData, aShapeLoc);
|
||||
vtkSmartPointer<vtkPolyData> aPrevData = myPolyData->getVtkPolyData();
|
||||
if ( !aShapeLoc.IsIdentity() )
|
||||
{
|
||||
aTransformedData = this->transform (aPrevData, aShapeLoc);
|
||||
}
|
||||
else
|
||||
{
|
||||
aTransformedData = aPrevData;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
aTransformedData = aPrevData;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
IVtkOCC_Shape::Handle aShapeWrapperCopy = myOccShape;
|
||||
if (myIsFastTransformMode
|
||||
&& !aShapeLoc.IsIdentity())
|
||||
{
|
||||
// Reset location before meshing
|
||||
aShape.Location (TopLoc_Location());
|
||||
aShapeWrapperCopy = new IVtkOCC_Shape (aShape);
|
||||
aShapeWrapperCopy->SetAttributes (myOccShape->Attributes());
|
||||
aShapeWrapperCopy->SetId (myOccShape->GetId());
|
||||
IVtkOCC_Shape::Handle aShapeWrapperCopy;
|
||||
if ( myIsFastTransformMode && !aShapeLoc.IsIdentity() )
|
||||
{
|
||||
// Reset location before meshing
|
||||
aShape.Location (TopLoc_Location());
|
||||
aShapeWrapperCopy = new IVtkOCC_Shape (aShape);
|
||||
aShapeWrapperCopy->SetId (myOccShape->GetId());
|
||||
}
|
||||
else
|
||||
{
|
||||
aShapeWrapperCopy = myOccShape;
|
||||
}
|
||||
|
||||
myPolyData = new IVtkVTK_ShapeData;
|
||||
IVtkOCC_ShapeMesher::Handle aMesher = new IVtkOCC_ShapeMesher;
|
||||
aMesher->Build (aShapeWrapperCopy, myPolyData);
|
||||
vtkSmartPointer<vtkPolyData> aMeshData = myPolyData->getVtkPolyData();
|
||||
|
||||
if ( myIsFastTransformMode && !aShapeLoc.IsIdentity() )
|
||||
{
|
||||
aTransformedData = this->transform (aMeshData, aShapeLoc);
|
||||
}
|
||||
else
|
||||
{
|
||||
aTransformedData = aMeshData;
|
||||
}
|
||||
}
|
||||
|
||||
myPolyData = new IVtkVTK_ShapeData();
|
||||
IVtkOCC_ShapeMesher::Handle aMesher = new IVtkOCC_ShapeMesher();
|
||||
aMesher->Build (aShapeWrapperCopy, myPolyData);
|
||||
vtkSmartPointer<vtkPolyData> aMeshData = myPolyData->getVtkPolyData();
|
||||
if (myIsFastTransformMode
|
||||
&& !aShapeLoc.IsIdentity())
|
||||
{
|
||||
aTransformedData = this->transform (aMeshData, aShapeLoc);
|
||||
}
|
||||
else
|
||||
{
|
||||
aTransformedData = aMeshData;
|
||||
}
|
||||
aPolyData->CopyStructure (aTransformedData); // Copy points and cells
|
||||
aPolyData->CopyAttributes (aTransformedData); // Copy data arrays (sub-shapes IDs)
|
||||
|
||||
// We store the OccShape instance in a IVtkTools_ShapeObject
|
||||
// wrapper in vtkInformation object of vtkDataObject, then pass it
|
||||
// to the actors through pipelines, so selection logic can access
|
||||
// OccShape easily given the actor instance.
|
||||
IVtkTools_ShapeObject::SetShapeSource (this, aPolyData);
|
||||
aPolyData->GetAttributes (vtkDataObject::CELL)->SetPedigreeIds (SubShapeIDs());
|
||||
}
|
||||
|
||||
aPolyData->CopyStructure (aTransformedData); // Copy points and cells
|
||||
aPolyData->CopyAttributes (aTransformedData); // Copy data arrays (sub-shapes IDs)
|
||||
|
||||
// We store the OccShape instance in a IVtkTools_ShapeObject
|
||||
// wrapper in vtkInformation object of vtkDataObject, then pass it
|
||||
// to the actors through pipelines, so selection logic can access
|
||||
// OccShape easily given the actor instance.
|
||||
IVtkTools_ShapeObject::SetShapeSource (this, aPolyData);
|
||||
aPolyData->GetAttributes (vtkDataObject::CELL)->SetPedigreeIds (SubShapeIDs());
|
||||
return 1;
|
||||
}
|
||||
|
||||
//================================================================
|
||||
// Function : SubShapeIDs
|
||||
// Purpose :
|
||||
// Purpose :
|
||||
//================================================================
|
||||
vtkSmartPointer<vtkIdTypeArray> IVtkTools_ShapeDataSource::SubShapeIDs()
|
||||
{
|
||||
vtkSmartPointer<vtkDataArray> anArr = GetOutput()->GetCellData()->GetArray(IVtkVTK_ShapeData::ARRNAME_SUBSHAPE_IDS());
|
||||
return vtkSmartPointer<vtkIdTypeArray> (vtkIdTypeArray::SafeDownCast (anArr.GetPointer()));
|
||||
vtkSmartPointer<vtkDataArray> arr =
|
||||
GetOutput()->GetCellData()->GetArray(IVtkVTK_ShapeData::ARRNAME_SUBSHAPE_IDS());
|
||||
return vtkSmartPointer<vtkIdTypeArray>(
|
||||
vtkIdTypeArray::SafeDownCast(arr.GetPointer()) );
|
||||
}
|
||||
|
||||
//================================================================
|
||||
// Function : GetId
|
||||
// Purpose :
|
||||
// Purpose :
|
||||
//================================================================
|
||||
IVtk_IdType IVtkTools_ShapeDataSource::GetId() const
|
||||
{
|
||||
@@ -165,16 +183,16 @@ IVtk_IdType IVtkTools_ShapeDataSource::GetId() const
|
||||
|
||||
//================================================================
|
||||
// Function : Contains
|
||||
// Purpose :
|
||||
// Purpose :
|
||||
//================================================================
|
||||
Standard_Boolean IVtkTools_ShapeDataSource::Contains (const IVtkOCC_Shape::Handle& theShape) const
|
||||
Standard_Boolean IVtkTools_ShapeDataSource::Contains (const IVtkOCC_Shape::Handle& shape) const
|
||||
{
|
||||
return myOccShape == theShape;
|
||||
return ((myOccShape == shape) ? Standard_True : Standard_False);
|
||||
}
|
||||
|
||||
//================================================================
|
||||
// Function : transform
|
||||
// Purpose :
|
||||
// Purpose :
|
||||
//================================================================
|
||||
vtkSmartPointer<vtkPolyData> IVtkTools_ShapeDataSource::transform (vtkPolyData* theSource,
|
||||
const gp_Trsf& theTrsf) const
|
||||
@@ -187,12 +205,10 @@ vtkSmartPointer<vtkPolyData> IVtkTools_ShapeDataSource::transform (vtkPolyData*
|
||||
vtkSmartPointer<vtkTransform> aTransform = vtkSmartPointer<vtkTransform>::New();
|
||||
vtkSmartPointer<vtkMatrix4x4> aMx = vtkSmartPointer<vtkMatrix4x4>::New();
|
||||
for (Standard_Integer aRow = 0; aRow < 3; ++aRow)
|
||||
{
|
||||
for (Standard_Integer aCol = 0; aCol < 4; ++aCol)
|
||||
{
|
||||
aMx->SetElement (aRow, aCol, theTrsf.Value (aRow + 1, aCol + 1) );
|
||||
}
|
||||
}
|
||||
|
||||
aTransform->SetMatrix (aMx);
|
||||
vtkSmartPointer<vtkTransformPolyDataFilter> aTrsfFilter
|
||||
|
@@ -51,8 +51,7 @@ public: //! @name Initialization
|
||||
|
||||
//! Get the source OCCT shape.
|
||||
//! @return occShape OCCT shape wrapper.
|
||||
const IVtkOCC_Shape::Handle& GetShape() { return myOccShape; }
|
||||
|
||||
IVtkOCC_Shape::Handle GetShape();
|
||||
inline void FastTransformModeOn() { myIsFastTransformMode = true; }
|
||||
inline void FastTransformModeOff() { myIsFastTransformMode = false; }
|
||||
|
||||
@@ -83,7 +82,7 @@ protected: //! @name Interface to override
|
||||
//! @param theOutputVector [in] the pointer to output data, that is filled in this method.
|
||||
virtual int RequestData(vtkInformation* theRequest,
|
||||
vtkInformationVector** theInputVector,
|
||||
vtkInformationVector* theOutputVector) Standard_OVERRIDE;
|
||||
vtkInformationVector* theOutputVector);
|
||||
|
||||
protected: //! @name Internals
|
||||
|
||||
|
@@ -39,7 +39,7 @@ class IVtkTools_ShapeDataSource;
|
||||
//! @class IVtkTools_ShapeObject
|
||||
//! @brief VTK holder class for OCC shapes to pass them through pipelines.
|
||||
//!
|
||||
//! It is descendant of vtkObject (data). Logically it is a one of milestones of VTK pipeline.
|
||||
//! It is descendent of vtkObject (data). Logically it is a one of milestones of VTK pipeline.
|
||||
//! It stores data of OCC shape (the OccShape instance) in vtkInformation object of vtkDataObject.
|
||||
//! Then pass it to the actors through pipelines,
|
||||
//! so selection logic can access OccShape easily given the actor instance.
|
||||
|
@@ -49,7 +49,7 @@ public:
|
||||
|
||||
//! Pick entities in the given point.
|
||||
//! @return Number of detected entities.
|
||||
virtual int Pick (double theX, double theY, double theZ, vtkRenderer *theRenderer = NULL) Standard_OVERRIDE;
|
||||
int Pick (double theX, double theY, double theZ, vtkRenderer *theRenderer = NULL);
|
||||
|
||||
//! Pick entities in the given rectangle area.
|
||||
//! @return Number of detected entities.
|
||||
|
@@ -21,109 +21,30 @@
|
||||
#pragma warning(push)
|
||||
#endif
|
||||
#include <vtkCellData.h>
|
||||
#include <vtkFloatArray.h>
|
||||
#include <vtkGenericCell.h>
|
||||
#include <vtkIdList.h>
|
||||
#include <vtkIdTypeArray.h>
|
||||
#include <vtkInformation.h>
|
||||
#include <vtkInformationVector.h>
|
||||
#include <vtkObjectFactory.h>
|
||||
#include <vtkPointData.h>
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
|
||||
namespace
|
||||
{
|
||||
//! Modified version of vtkPolyData::CopyCells() that includes copying of normals.
|
||||
//! How to ask vtkPolyData::CopyCells() to do that automatically?
|
||||
static void copyCells (vtkPolyData* theDst,
|
||||
vtkPolyData* theSrc,
|
||||
vtkIdList* theIdList)
|
||||
{
|
||||
//theDst->CopyCells (theSrc, theIdList);
|
||||
|
||||
const vtkIdType aNbPts = theSrc->GetNumberOfPoints();
|
||||
vtkDataArray* anOldNormals = theSrc->GetPointData()->GetNormals();
|
||||
|
||||
if (theDst->GetPoints() == NULL)
|
||||
{
|
||||
theDst->SetPoints (vtkSmartPointer<vtkPoints>::New());
|
||||
}
|
||||
|
||||
vtkSmartPointer<vtkIdList> aNewCellPts = vtkSmartPointer<vtkIdList>::New();
|
||||
vtkSmartPointer<vtkGenericCell> aCell = vtkSmartPointer<vtkGenericCell>::New();
|
||||
NCollection_Vec3<double> anXYZ;
|
||||
vtkPointData* aNewPntData = theDst->GetPointData();
|
||||
vtkCellData* aNewCellData = theDst->GetCellData();
|
||||
vtkPoints* aNewPoints = theDst->GetPoints();
|
||||
vtkSmartPointer<vtkFloatArray> aNewNormals;
|
||||
if (anOldNormals != NULL)
|
||||
{
|
||||
aNewNormals = vtkSmartPointer<vtkFloatArray>::New();
|
||||
aNewNormals->SetName ("Normals");
|
||||
aNewNormals->SetNumberOfComponents (3);
|
||||
theDst->GetPointData()->SetNormals (aNewNormals);
|
||||
}
|
||||
|
||||
vtkSmartPointer<vtkIdList> aPntMap = vtkSmartPointer<vtkIdList>::New(); // maps old pt ids into new
|
||||
aPntMap->SetNumberOfIds (aNbPts);
|
||||
for (vtkIdType i = 0; i < aNbPts; ++i)
|
||||
{
|
||||
aPntMap->SetId (i, -1);
|
||||
}
|
||||
|
||||
// Filter the cells
|
||||
for (vtkIdType aCellIter = 0; aCellIter < theIdList->GetNumberOfIds(); ++aCellIter)
|
||||
{
|
||||
theSrc->GetCell (theIdList->GetId (aCellIter), aCell);
|
||||
vtkIdList* aCellPts = aCell->GetPointIds();
|
||||
const vtkIdType aNbCellPts = aCell->GetNumberOfPoints();
|
||||
for (vtkIdType i = 0; i < aNbCellPts; ++i)
|
||||
{
|
||||
const vtkIdType aPtId = aCellPts->GetId (i);
|
||||
vtkIdType aNewId = aPntMap->GetId (aPtId);
|
||||
if (aNewId < 0)
|
||||
{
|
||||
theSrc->GetPoint (aPtId, anXYZ.ChangeData());
|
||||
|
||||
aNewId = aNewPoints->InsertNextPoint (anXYZ.GetData());
|
||||
aPntMap->SetId (aPtId, aNewId);
|
||||
aNewPntData->CopyData (theSrc->GetPointData(), aPtId, aNewId);
|
||||
|
||||
if (anOldNormals != NULL)
|
||||
{
|
||||
anOldNormals->GetTuple (aPtId, anXYZ.ChangeData());
|
||||
aNewNormals->InsertNextTuple (anXYZ.GetData());
|
||||
}
|
||||
}
|
||||
aNewCellPts->InsertId (i, aNewId);
|
||||
}
|
||||
|
||||
const vtkIdType aNewCellId = theDst->InsertNextCell (aCell->GetCellType(), aNewCellPts);
|
||||
aNewCellData->CopyData (theSrc->GetCellData(), theIdList->GetId (aCellIter), aNewCellId);
|
||||
aNewCellPts->Reset();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
vtkStandardNewMacro(IVtkTools_SubPolyDataFilter)
|
||||
|
||||
//================================================================
|
||||
// Function : Constructor
|
||||
// Purpose :
|
||||
// Purpose :
|
||||
//================================================================
|
||||
IVtkTools_SubPolyDataFilter::IVtkTools_SubPolyDataFilter()
|
||||
: myIdsArrayName (IVtkVTK_ShapeData::ARRNAME_SUBSHAPE_IDS()),
|
||||
myDoFiltering (true),
|
||||
myToCopyNormals (true)
|
||||
{
|
||||
//
|
||||
myIdsArrayName = IVtkVTK_ShapeData::ARRNAME_SUBSHAPE_IDS();
|
||||
myDoFiltering = true;
|
||||
}
|
||||
|
||||
//================================================================
|
||||
// Function : Destructor
|
||||
// Purpose :
|
||||
// Purpose :
|
||||
//================================================================
|
||||
IVtkTools_SubPolyDataFilter::~IVtkTools_SubPolyDataFilter() { }
|
||||
|
||||
@@ -149,17 +70,18 @@ int IVtkTools_SubPolyDataFilter::RequestData (vtkInformation *vtkNotUsed(theRequ
|
||||
|
||||
if (myDoFiltering)
|
||||
{
|
||||
vtkSmartPointer<vtkCellData> anInputCellData = anInput->GetCellData();
|
||||
vtkSmartPointer<vtkCellData> anOutputCellData = anOutput->GetCellData();
|
||||
vtkSmartPointer<vtkIdTypeArray> aDataArray = vtkIdTypeArray::SafeDownCast (anInputCellData->GetArray (myIdsArrayName));
|
||||
vtkSmartPointer<vtkCellData> aCellData = anInput->GetCellData();
|
||||
vtkIdType aSize = 0;
|
||||
vtkSmartPointer<vtkIdTypeArray> aDataArray =
|
||||
vtkIdTypeArray::SafeDownCast (aCellData->GetArray (myIdsArrayName));
|
||||
|
||||
// List of cell ids to be passed
|
||||
vtkSmartPointer<vtkIdList> anIdList = vtkSmartPointer<vtkIdList>::New();
|
||||
anIdList->Allocate (myIdsSet.Extent()); // Allocate the list of ids
|
||||
anIdList->Allocate(myIdsSet.Extent()); // Allocate the list of ids
|
||||
|
||||
const vtkIdType aSize = aDataArray.GetPointer() != NULL ? aDataArray->GetNumberOfTuples() : 0;
|
||||
if (aSize != 0)
|
||||
if (aDataArray.GetPointer() != NULL)
|
||||
{
|
||||
aSize = aDataArray->GetNumberOfTuples();
|
||||
anIdList->Allocate (aSize); // Allocate the list of ids
|
||||
}
|
||||
|
||||
@@ -178,41 +100,39 @@ int IVtkTools_SubPolyDataFilter::RequestData (vtkInformation *vtkNotUsed(theRequ
|
||||
}
|
||||
|
||||
// Copy cells with their points according to the prepared list of cell ids.
|
||||
anOutputCellData->AllocateArrays (anInputCellData->GetNumberOfArrays());
|
||||
anOutput->Allocate (anInput, anIdList->GetNumberOfIds()); // Allocate output cells
|
||||
|
||||
anOutput->GetCellData()->AllocateArrays(anInput->GetCellData()->GetNumberOfArrays());
|
||||
anOutput->Allocate(anInput, anIdList->GetNumberOfIds()); // Allocate output cells
|
||||
// Pass data arrays.
|
||||
// Create new arrays for output data
|
||||
for (Standard_Integer anI = 0; anI < anInputCellData->GetNumberOfArrays(); anI++)
|
||||
{
|
||||
vtkSmartPointer<vtkDataArray> anInArr = anInputCellData->GetArray (anI);
|
||||
vtkSmartPointer<vtkDataArray> anOutArr = vtkSmartPointer<vtkDataArray>::Take (vtkDataArray::CreateDataArray(anInArr->GetDataType()));
|
||||
vtkSmartPointer<vtkCellData> anInData = anInput->GetCellData();
|
||||
vtkSmartPointer<vtkCellData> anOutData = anOutput->GetCellData();
|
||||
vtkSmartPointer<vtkDataArray> anInArr, anOutArr;
|
||||
|
||||
anOutArr->SetName (anInArr->GetName());
|
||||
anOutArr->Allocate (anIdList->GetNumberOfIds() * anInArr->GetNumberOfComponents());
|
||||
for (Standard_Integer anI = 0; anI < anInData->GetNumberOfArrays(); anI++)
|
||||
{
|
||||
anInArr = anInData->GetArray (anI);
|
||||
anOutArr = vtkSmartPointer<vtkDataArray>::Take(
|
||||
vtkDataArray::CreateDataArray(anInArr->GetDataType()));
|
||||
anOutArr->SetName(anInArr->GetName());
|
||||
anOutArr->Allocate(anIdList->GetNumberOfIds() * anInArr->GetNumberOfComponents());
|
||||
anOutArr->SetNumberOfTuples (anIdList->GetNumberOfIds());
|
||||
anOutArr->SetNumberOfComponents (anInArr->GetNumberOfComponents());
|
||||
anOutputCellData->AddArray (anOutArr);
|
||||
anOutData->AddArray(anOutArr);
|
||||
}
|
||||
|
||||
// Copy cells with ids from our list.
|
||||
if (myToCopyNormals)
|
||||
{
|
||||
copyCells (anOutput, anInput, anIdList);
|
||||
}
|
||||
else
|
||||
{
|
||||
anOutput->CopyCells (anInput, anIdList);
|
||||
}
|
||||
anOutput->CopyCells (anInput, anIdList);
|
||||
|
||||
// Copy filtered arrays data
|
||||
for (Standard_Integer anI = 0; anI < anInputCellData->GetNumberOfArrays(); anI++)
|
||||
vtkIdType anOutId, anInId;
|
||||
|
||||
for (Standard_Integer anI = 0; anI < anInData->GetNumberOfArrays(); anI++)
|
||||
{
|
||||
vtkSmartPointer<vtkDataArray> anInArr = anInputCellData ->GetArray (anI);
|
||||
vtkSmartPointer<vtkDataArray> anOutArr = anOutputCellData->GetArray (anI);
|
||||
for (vtkIdType anOutId = 0; anOutId < anIdList->GetNumberOfIds(); anOutId++)
|
||||
anInArr = anInData->GetArray (anI);
|
||||
anOutArr = anOutData->GetArray(anI);
|
||||
for (anOutId = 0; anOutId < anIdList->GetNumberOfIds(); anOutId++)
|
||||
{
|
||||
const vtkIdType anInId = anIdList->GetId (anOutId);
|
||||
anInId = anIdList->GetId (anOutId);
|
||||
anOutArr->SetTuple (anOutId, anInId, anInArr);
|
||||
}
|
||||
}
|
||||
@@ -228,7 +148,7 @@ int IVtkTools_SubPolyDataFilter::RequestData (vtkInformation *vtkNotUsed(theRequ
|
||||
|
||||
//================================================================
|
||||
// Function : SetDoFiltering
|
||||
// Purpose :
|
||||
// Purpose :
|
||||
//================================================================
|
||||
void IVtkTools_SubPolyDataFilter::SetDoFiltering (const bool theDoFiltering)
|
||||
{
|
||||
@@ -249,12 +169,12 @@ void IVtkTools_SubPolyDataFilter::PrintSelf (std::ostream& theOs, vtkIndent theI
|
||||
IVtk_IdTypeMap::Iterator anIter(myIdsSet);
|
||||
while (anIter.More())
|
||||
{
|
||||
theOs << " " << anIter.Value();
|
||||
anIter.Next();
|
||||
if (anIter.More())
|
||||
{
|
||||
theOs << "; ";
|
||||
}
|
||||
theOs << " " << anIter.Value();
|
||||
anIter.Next();
|
||||
if (anIter.More())
|
||||
{
|
||||
theOs << "; ";
|
||||
}
|
||||
}
|
||||
theOs << "}" << "\n";
|
||||
}
|
||||
@@ -283,7 +203,8 @@ void IVtkTools_SubPolyDataFilter::SetData (const IVtk_IdTypeMap theSet)
|
||||
//================================================================
|
||||
void IVtkTools_SubPolyDataFilter::AddData (const IVtk_IdTypeMap theSet)
|
||||
{
|
||||
for (IVtk_IdTypeMap::Iterator anIt (theSet); anIt.More(); anIt.Next())
|
||||
IVtk_IdTypeMap::Iterator anIt (theSet);
|
||||
for (; anIt.More(); anIt.Next())
|
||||
{
|
||||
if (!myIdsSet.Contains (anIt.Value()))
|
||||
{
|
||||
@@ -308,7 +229,8 @@ void IVtkTools_SubPolyDataFilter::SetData (const IVtk_ShapeIdList theIdList)
|
||||
//================================================================
|
||||
void IVtkTools_SubPolyDataFilter::AddData (const IVtk_ShapeIdList theIdList)
|
||||
{
|
||||
for (IVtk_ShapeIdList::Iterator anIt (theIdList); anIt.More(); anIt.Next())
|
||||
IVtk_ShapeIdList::Iterator anIt (theIdList);
|
||||
for (; anIt.More(); anIt.Next())
|
||||
{
|
||||
if (!myIdsSet.Contains (anIt.Value()))
|
||||
{
|
||||
@@ -317,9 +239,10 @@ void IVtkTools_SubPolyDataFilter::AddData (const IVtk_ShapeIdList theIdList)
|
||||
}
|
||||
}
|
||||
|
||||
//! Set ids to be passed through this filter.
|
||||
//================================================================
|
||||
// Function : SetIdsArrayName
|
||||
// Purpose :
|
||||
// Purpose :
|
||||
//================================================================
|
||||
void IVtkTools_SubPolyDataFilter::SetIdsArrayName (const char* theArrayName)
|
||||
{
|
||||
|
@@ -60,7 +60,7 @@ public:
|
||||
protected:
|
||||
//! @brief Filter cells according to the given set of ids.
|
||||
//! Note: Data arrays are not passed through if filtering is turned on.
|
||||
virtual int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *) Standard_OVERRIDE;
|
||||
virtual int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *);
|
||||
|
||||
IVtkTools_SubPolyDataFilter();
|
||||
virtual ~IVtkTools_SubPolyDataFilter();
|
||||
@@ -70,7 +70,6 @@ protected:
|
||||
IVtk_IdTypeMap myIdsSet;
|
||||
const char* myIdsArrayName;
|
||||
bool myDoFiltering;
|
||||
bool myToCopyNormals;
|
||||
};
|
||||
|
||||
#ifdef _MSC_VER
|
||||
|
@@ -19,9 +19,7 @@
|
||||
#include <Standard_WarningsDisable.hxx>
|
||||
#include <vtkCellData.h>
|
||||
#include <vtkDoubleArray.h>
|
||||
#include <vtkFloatArray.h>
|
||||
#include <vtkIdList.h>
|
||||
#include <vtkPointData.h>
|
||||
#include <vtkPoints.h>
|
||||
#include <vtkPolyData.h>
|
||||
#include <Standard_WarningsRestore.hxx>
|
||||
@@ -30,7 +28,7 @@ IMPLEMENT_STANDARD_RTTIEXT(IVtkVTK_ShapeData,IVtk_IShapeData)
|
||||
|
||||
//================================================================
|
||||
// Function : Constructor
|
||||
// Purpose :
|
||||
// Purpose :
|
||||
//================================================================
|
||||
IVtkVTK_ShapeData::IVtkVTK_ShapeData()
|
||||
{
|
||||
@@ -38,11 +36,6 @@ IVtkVTK_ShapeData::IVtkVTK_ShapeData()
|
||||
myPolyData->Allocate();
|
||||
myPolyData->SetPoints (vtkSmartPointer<vtkPoints>::New());
|
||||
|
||||
myNormals = vtkSmartPointer<vtkFloatArray>::New();
|
||||
myNormals->SetName ("Normals");
|
||||
myNormals->SetNumberOfComponents (3);
|
||||
myPolyData->GetPointData()->SetNormals (myNormals);
|
||||
|
||||
mySubShapeIDs = vtkSmartPointer<vtkIdTypeArray>::New();
|
||||
mySubShapeIDs->SetName (IVtkVTK_ShapeData::ARRNAME_SUBSHAPE_IDS());
|
||||
mySubShapeIDs->SetNumberOfComponents (1);
|
||||
@@ -56,29 +49,25 @@ IVtkVTK_ShapeData::IVtkVTK_ShapeData()
|
||||
|
||||
//================================================================
|
||||
// Function : Destructor
|
||||
// Purpose :
|
||||
// Purpose :
|
||||
//================================================================
|
||||
IVtkVTK_ShapeData::~IVtkVTK_ShapeData()
|
||||
{ }
|
||||
|
||||
//================================================================
|
||||
// Function : InsertPoint
|
||||
// Purpose :
|
||||
// Function : InsertCoordinate
|
||||
// Purpose :
|
||||
//================================================================
|
||||
IVtk_PointId IVtkVTK_ShapeData::InsertPoint (const gp_Pnt& thePnt,
|
||||
const NCollection_Vec3<float>& theNorm)
|
||||
IVtk_PointId IVtkVTK_ShapeData::InsertCoordinate (double theX,
|
||||
double theY,
|
||||
double theZ)
|
||||
{
|
||||
IVtk_PointId aPointId = myPolyData->GetPoints()->InsertNextPoint (thePnt.X(), thePnt.Y(), thePnt.Z());
|
||||
if (myNormals.GetPointer() != NULL)
|
||||
{
|
||||
myNormals->InsertNextTuple (theNorm.GetData());
|
||||
}
|
||||
return aPointId;
|
||||
return myPolyData->GetPoints()->InsertNextPoint (theX, theY, theZ);
|
||||
}
|
||||
|
||||
//================================================================
|
||||
// Function : InsertVertex
|
||||
// Purpose :
|
||||
// Purpose :
|
||||
//================================================================
|
||||
void IVtkVTK_ShapeData::InsertVertex (const IVtk_IdType theShapeID,
|
||||
const IVtk_PointId thePointId,
|
||||
@@ -91,7 +80,7 @@ void IVtkVTK_ShapeData::InsertVertex (const IVtk_IdType theShapeID,
|
||||
|
||||
//================================================================
|
||||
// Function : InsertLine
|
||||
// Purpose :
|
||||
// Purpose :
|
||||
//================================================================
|
||||
void IVtkVTK_ShapeData::InsertLine (const IVtk_IdType theShapeID,
|
||||
const IVtk_PointId thePointId1,
|
||||
@@ -105,7 +94,7 @@ void IVtkVTK_ShapeData::InsertLine (const IVtk_IdType theShapeID,
|
||||
|
||||
//================================================================
|
||||
// Function : InsertLine
|
||||
// Purpose :
|
||||
// Purpose :
|
||||
//================================================================
|
||||
void IVtkVTK_ShapeData::InsertLine (const IVtk_IdType theShapeID,
|
||||
const IVtk_PointIdList* thePointIds,
|
||||
@@ -130,7 +119,7 @@ void IVtkVTK_ShapeData::InsertLine (const IVtk_IdType theShapeID,
|
||||
|
||||
//================================================================
|
||||
// Function : InsertTriangle
|
||||
// Purpose :
|
||||
// Purpose :
|
||||
//================================================================
|
||||
void IVtkVTK_ShapeData::InsertTriangle (const IVtk_IdType theShapeID,
|
||||
const IVtk_PointId thePointId1,
|
||||
|
@@ -16,8 +16,6 @@
|
||||
#ifndef __IVTKVTK_SHAPEDATA_H__
|
||||
#define __IVTKVTK_SHAPEDATA_H__
|
||||
|
||||
#include <gp_Dir.hxx>
|
||||
#include <gp_Pnt.hxx>
|
||||
#include <IVtk_IShapeData.hxx>
|
||||
|
||||
// prevent disabling some MSVC warning messages by VTK headers
|
||||
@@ -28,7 +26,6 @@
|
||||
#include <Standard_WarningsRestore.hxx>
|
||||
|
||||
class vtkIdTypeArray;
|
||||
class vtkFloatArray;
|
||||
|
||||
class IVtkVTK_ShapeData;
|
||||
DEFINE_STANDARD_HANDLE( IVtkVTK_ShapeData, IVtk_IShapeData )
|
||||
@@ -54,11 +51,11 @@ public:
|
||||
DEFINE_STANDARD_RTTIEXT(IVtkVTK_ShapeData,IVtk_IShapeData)
|
||||
|
||||
//! Insert a coordinate
|
||||
//! @param [in] thePnt point position
|
||||
//! @param [in] theNorm point normal
|
||||
//! @param [in] theX X coordinate
|
||||
//! @param [in] theY Y coordinate
|
||||
//! @param [in] theZ Z coordinate
|
||||
//! @return id of added point
|
||||
Standard_EXPORT virtual IVtk_PointId InsertPoint (const gp_Pnt& thePnt,
|
||||
const NCollection_Vec3<float>& theNorm) Standard_OVERRIDE;
|
||||
Standard_EXPORT virtual IVtk_PointId InsertCoordinate (double theX, double theY, double theZ) Standard_OVERRIDE;
|
||||
|
||||
//! Insert a vertex.
|
||||
//! @param [in] theShapeID id of the subshape to which the vertex belongs.
|
||||
@@ -124,7 +121,6 @@ private:
|
||||
|
||||
private:
|
||||
vtkSmartPointer< vtkPolyData > myPolyData; //!< Shape geometry as vtkPolyData
|
||||
vtkSmartPointer< vtkFloatArray > myNormals; //!< vertex normals
|
||||
vtkSmartPointer< vtkIdTypeArray > mySubShapeIDs; //!< Array of sub-shapes ids
|
||||
vtkSmartPointer< vtkIdTypeArray > myMeshTypes; //!< Array of type codes of mesh parts
|
||||
};
|
||||
|
@@ -13,6 +13,7 @@
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
|
||||
#include <IVtkVTK_View.hxx>
|
||||
|
||||
// prevent disabling some MSVC warning messages by VTK headers
|
||||
|
@@ -1227,8 +1227,8 @@ Standard_Integer project6(const IntPolyh_Point &ax,
|
||||
}
|
||||
//=======================================================================
|
||||
//function : TriContact
|
||||
//purpose : This function checks if two triangles are in
|
||||
// contact or not, return 1 if yes, return 0
|
||||
//purpose : This fonction Check if two triangles are in
|
||||
// contact or no, return 1 if yes, return 0
|
||||
// if no.
|
||||
//=======================================================================
|
||||
Standard_Integer IntPolyh_MaillageAffinage::TriContact
|
||||
|
@@ -39,11 +39,11 @@ public:
|
||||
|
||||
DEFINE_STANDARD_ALLOC
|
||||
|
||||
|
||||
|
||||
Standard_EXPORT IntPolyh_MaillageAffinage(const Handle(Adaptor3d_Surface)& S1, const Standard_Integer NbSU1, const Standard_Integer NbSV1, const Handle(Adaptor3d_Surface)& S2, const Standard_Integer NbSU2, const Standard_Integer NbSV2, const Standard_Integer PRINT);
|
||||
|
||||
|
||||
Standard_EXPORT IntPolyh_MaillageAffinage(const Handle(Adaptor3d_Surface)& S1, const Handle(Adaptor3d_Surface)& S2, const Standard_Integer PRINT);
|
||||
|
||||
|
||||
|
||||
//! Makes the sampling of the surface -
|
||||
//! Fills the arrays with the parametric values of the sampling points (triangulation nodes).
|
||||
@@ -54,7 +54,7 @@ public:
|
||||
//! Computes points on one surface and fills an array of points;
|
||||
//! standard (default) method
|
||||
Standard_EXPORT void FillArrayOfPnt (const Standard_Integer SurfID);
|
||||
|
||||
|
||||
//! isShiftFwd flag is added. The purpose is to define shift
|
||||
//! of points along normal to the surface in this point. The
|
||||
//! shift length represents maximal deflection of triangulation.
|
||||
@@ -64,7 +64,7 @@ public:
|
||||
//! advanced method
|
||||
Standard_EXPORT void FillArrayOfPnt (const Standard_Integer SurfID,
|
||||
const Standard_Boolean isShiftFwd);
|
||||
|
||||
|
||||
//! Compute points on one surface and fill an array of points;
|
||||
//! If given, <theDeflTol> is the deflection tolerance of the given sampling.
|
||||
//! standard (default) method
|
||||
@@ -72,7 +72,7 @@ public:
|
||||
const TColStd_Array1OfReal& Upars,
|
||||
const TColStd_Array1OfReal& Vpars,
|
||||
const Standard_Real *theDeflTol = NULL);
|
||||
|
||||
|
||||
//! isShiftFwd flag is added. The purpose is to define shift
|
||||
//! of points along normal to the surface in this point. The
|
||||
//! shift length represents maximal deflection of triangulation.
|
||||
@@ -103,90 +103,97 @@ public:
|
||||
//! of the two bounding boxes, and mark the points of
|
||||
//! the two surfaces that are inside.
|
||||
Standard_EXPORT void CommonBox (const Bnd_Box& B1, const Bnd_Box& B2, Standard_Real& xMin, Standard_Real& yMin, Standard_Real& zMin, Standard_Real& xMax, Standard_Real& yMax, Standard_Real& zMax);
|
||||
|
||||
|
||||
//! Compute edges from the array of points
|
||||
Standard_EXPORT void FillArrayOfEdges (const Standard_Integer SurfID);
|
||||
|
||||
|
||||
//! Compute triangles from the array of points, and --
|
||||
//! mark the triangles that use marked points by the
|
||||
//! CommonBox function.
|
||||
Standard_EXPORT void FillArrayOfTriangles (const Standard_Integer SurfID);
|
||||
|
||||
|
||||
//! Refine systematicaly all marked triangles of both surfaces
|
||||
Standard_EXPORT void CommonPartRefinement();
|
||||
|
||||
|
||||
//! Refine systematicaly all marked triangles of ONE surface
|
||||
Standard_EXPORT void LocalSurfaceRefinement (const Standard_Integer SurfId);
|
||||
|
||||
|
||||
//! Compute deflection for all triangles of one
|
||||
//! surface,and sort min and max of deflections
|
||||
Standard_EXPORT void ComputeDeflections (const Standard_Integer SurfID);
|
||||
|
||||
|
||||
//! Refine both surfaces using BoundSortBox as --
|
||||
//! rejection. The criterions used to refine a --
|
||||
//! triangle are: The deflection The size of the --
|
||||
//! bounding boxes (one surface may be very small
|
||||
//! compared to the other)
|
||||
Standard_EXPORT void TrianglesDeflectionsRefinementBSB();
|
||||
|
||||
//! This function checks if two triangles are in contact or not,
|
||||
//! return 1 if yes, return 0 if not.
|
||||
|
||||
//! This fonction Check if two triangles are in
|
||||
//! contact or no, return 1 if yes, return 0
|
||||
//! if no.
|
||||
Standard_EXPORT Standard_Integer TriContact (const IntPolyh_Point& P1, const IntPolyh_Point& P2, const IntPolyh_Point& P3, const IntPolyh_Point& Q1, const IntPolyh_Point& Q2, const IntPolyh_Point& Q3, Standard_Real& Angle) const;
|
||||
|
||||
|
||||
Standard_EXPORT Standard_Integer TriangleEdgeContact (const Standard_Integer TriSurfID, const Standard_Integer EdgeIndice, const IntPolyh_Triangle& Tri1, const IntPolyh_Triangle& Tri2, const IntPolyh_Point& P1, const IntPolyh_Point& P2, const IntPolyh_Point& P3, const IntPolyh_Point& C1, const IntPolyh_Point& C2, const IntPolyh_Point& C3, const IntPolyh_Point& Pe1, const IntPolyh_Point& Pe2, const IntPolyh_Point& E, const IntPolyh_Point& N, IntPolyh_StartPoint& SP1, IntPolyh_StartPoint& SP2) const;
|
||||
|
||||
//! From two triangles compute intersection points.
|
||||
//! If we found more than two intersection points
|
||||
//! that means that those triangles are coplanar
|
||||
|
||||
//! From two triangles compute intersection points.
|
||||
//! If I found more than two intersection points
|
||||
//! that's mean that those triangle are coplanar
|
||||
Standard_EXPORT Standard_Integer StartingPointsResearch (const Standard_Integer T1, const Standard_Integer T2, IntPolyh_StartPoint& SP1, IntPolyh_StartPoint& SP2) const;
|
||||
|
||||
//! from two triangles and an intersection point I
|
||||
//! search the other point (if it exists).
|
||||
|
||||
//! from two triangles and an intersection point I
|
||||
//! search the other point (if it exist).
|
||||
//! This function is used by StartPointChain
|
||||
Standard_EXPORT Standard_Integer NextStartingPointsResearch (const Standard_Integer T1, const Standard_Integer T2, const IntPolyh_StartPoint& SPInit, IntPolyh_StartPoint& SPNext) const;
|
||||
|
||||
//! Analyse each couple of triangles from the two -- array of triangles,
|
||||
//! to see if they are in contact, and compute the incidence.
|
||||
//! Then put couples in contact in the array of couples
|
||||
|
||||
//! Analyse each couple of triangles from the two --
|
||||
//! array of triangles, to see if they are in
|
||||
//! contact, and compute the incidence. Then put
|
||||
//! couples in contact in the array of couples
|
||||
Standard_EXPORT Standard_Integer TriangleCompare();
|
||||
|
||||
|
||||
//! Loop on the array of couples. Compute StartPoints.
|
||||
//! Try to chain the StartPoints into SectionLines or
|
||||
//! put the point in the ArrayOfTangentZones if
|
||||
//! chaining it, is not possible.
|
||||
Standard_EXPORT Standard_Integer StartPointsChain (IntPolyh_ArrayOfSectionLines& TSectionLines, IntPolyh_ArrayOfTangentZones& TTangentZones);
|
||||
|
||||
|
||||
//! Mainly used by StartPointsChain(), this function
|
||||
//! try to compute the next StartPoint.
|
||||
Standard_EXPORT Standard_Integer GetNextChainStartPoint (const IntPolyh_StartPoint& SPInit, IntPolyh_StartPoint& SPNext, IntPolyh_SectionLine& MySectionLine, IntPolyh_ArrayOfTangentZones& TTangentZones, const Standard_Boolean Prepend = Standard_False);
|
||||
|
||||
|
||||
Standard_EXPORT const IntPolyh_ArrayOfPoints& GetArrayOfPoints (const Standard_Integer SurfID) const;
|
||||
|
||||
|
||||
Standard_EXPORT const IntPolyh_ArrayOfEdges& GetArrayOfEdges (const Standard_Integer SurfID) const;
|
||||
|
||||
|
||||
Standard_EXPORT const IntPolyh_ArrayOfTriangles& GetArrayOfTriangles (const Standard_Integer SurfID) const;
|
||||
|
||||
|
||||
Standard_EXPORT Standard_Integer GetFinTE (const Standard_Integer SurfID) const;
|
||||
|
||||
|
||||
Standard_EXPORT Standard_Integer GetFinTT (const Standard_Integer SurfID) const;
|
||||
|
||||
|
||||
Standard_EXPORT Bnd_Box GetBox (const Standard_Integer SurfID) const;
|
||||
|
||||
|
||||
//! This method returns list of couples of contact triangles.
|
||||
Standard_EXPORT IntPolyh_ListOfCouples& GetCouples();
|
||||
|
||||
|
||||
Standard_EXPORT void SetEnlargeZone (const Standard_Boolean EnlargeZone);
|
||||
|
||||
|
||||
Standard_EXPORT Standard_Boolean GetEnlargeZone() const;
|
||||
|
||||
|
||||
//! returns FlecheMin
|
||||
Standard_EXPORT Standard_Real GetMinDeflection (const Standard_Integer SurfID) const;
|
||||
|
||||
|
||||
//! returns FlecheMax
|
||||
Standard_EXPORT Standard_Real GetMaxDeflection (const Standard_Integer SurfID) const;
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
||||
Handle(Adaptor3d_Surface) MaSurface1;
|
||||
Handle(Adaptor3d_Surface) MaSurface2;
|
||||
Bnd_Box MyBox1;
|
||||
|
@@ -128,10 +128,10 @@ void IntRes2d_Intersection::SetValues(const IntRes2d_Intersection& Other) {
|
||||
//-- parameter of the bounds of the composite Curve
|
||||
//-- Merge of two Intersection Segments S1 and S2 when :
|
||||
//--
|
||||
//-- S1 : U1First,PosU1First --> U1Last,PosU1Last
|
||||
//-- V1First,PosV1First --> V1Last,PosV1Last
|
||||
//-- S2 : U2First,PosU2First --> U2Last,PosU2Last
|
||||
//-- V2First,PosV2First --> V2Last,PosV2Last
|
||||
//-- S1 : U1First,PosU1Fisrt --> U1Last,PosU1Last
|
||||
//-- V1First,PosV1Fisrt --> V1Last,PosV1Last
|
||||
//-- S2 : U2First,PosU2Fisrt --> U2Last,PosU2Last
|
||||
//-- V2First,PosV2Fisrt --> V2Last,PosV2Last
|
||||
//--
|
||||
//-- 1 U : X------1-------E H-----2-------X U -->
|
||||
//-- V : X------1-------X X-----2-------X <- V -> ?
|
||||
|
@@ -4,9 +4,15 @@ IntTools_Array1OfRange.hxx
|
||||
IntTools_Array1OfRoots.hxx
|
||||
IntTools_BaseRangeSample.cxx
|
||||
IntTools_BaseRangeSample.hxx
|
||||
IntTools_BaseRangeSample.lxx
|
||||
IntTools_BeanFaceIntersector.cxx
|
||||
IntTools_BeanFaceIntersector.hxx
|
||||
IntTools_CArray1.gxx
|
||||
IntTools_CArray1.lxx
|
||||
IntTools_CArray1OfInteger.hxx
|
||||
IntTools_CArray1OfInteger_0.cxx
|
||||
IntTools_CArray1OfReal.hxx
|
||||
IntTools_CArray1OfReal_0.cxx
|
||||
IntTools_CommonPrt.cxx
|
||||
IntTools_CommonPrt.hxx
|
||||
IntTools_Context.cxx
|
||||
@@ -15,9 +21,12 @@ IntTools_Curve.cxx
|
||||
IntTools_Curve.hxx
|
||||
IntTools_CurveRangeLocalizeData.cxx
|
||||
IntTools_CurveRangeLocalizeData.hxx
|
||||
IntTools_CurveRangeLocalizeData.lxx
|
||||
IntTools_CurveRangeSample.cxx
|
||||
IntTools_CurveRangeSample.hxx
|
||||
IntTools_CurveRangeSample.lxx
|
||||
IntTools_CurveRangeSampleMapHasher.hxx
|
||||
IntTools_CurveRangeSampleMapHasher.lxx
|
||||
IntTools_DataMapIteratorOfDataMapOfCurveSampleBox.hxx
|
||||
IntTools_DataMapIteratorOfDataMapOfSurfaceSampleBox.hxx
|
||||
IntTools_DataMapOfCurveSampleBox.hxx
|
||||
@@ -43,6 +52,7 @@ IntTools_MapOfCurveSample.hxx
|
||||
IntTools_MapOfSurfaceSample.hxx
|
||||
IntTools_MarkedRangeSet.cxx
|
||||
IntTools_MarkedRangeSet.hxx
|
||||
IntTools_MarkedRangeSet.lxx
|
||||
IntTools_PntOn2Faces.cxx
|
||||
IntTools_PntOn2Faces.hxx
|
||||
IntTools_PntOnFace.cxx
|
||||
@@ -65,9 +75,10 @@ IntTools_SurfaceRangeSample.cxx
|
||||
IntTools_SurfaceRangeSample.hxx
|
||||
IntTools_SurfaceRangeSample.lxx
|
||||
IntTools_SurfaceRangeSampleMapHasher.hxx
|
||||
IntTools_SurfaceRangeSampleMapHasher.lxx
|
||||
IntTools_Tools.cxx
|
||||
IntTools_Tools.hxx
|
||||
IntTools_TopolTool.cxx
|
||||
IntTools_TopolTool.hxx
|
||||
IntTools_WLineTool.hxx
|
||||
IntTools_WLineTool.cxx
|
||||
IntTools_WLineTool.cxx
|
@@ -13,7 +13,6 @@
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#include <IntTools.hxx>
|
||||
|
||||
#include <BRep_Tool.hxx>
|
||||
#include <BRepAdaptor_Curve.hxx>
|
||||
@@ -25,14 +24,15 @@
|
||||
#include <gp_Circ.hxx>
|
||||
#include <gp_Pnt.hxx>
|
||||
#include <GProp_GProps.hxx>
|
||||
#include <IntTools.hxx>
|
||||
#include <IntTools_Array1OfRoots.hxx>
|
||||
#include <IntTools_CArray1OfReal.hxx>
|
||||
#include <IntTools_Root.hxx>
|
||||
#include <TColStd_ListIteratorOfListOfReal.hxx>
|
||||
#include <TColStd_ListOfReal.hxx>
|
||||
#include <TopoDS_Edge.hxx>
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
//=======================================================================
|
||||
//function : IntTools::GetRadius
|
||||
//purpose :
|
||||
@@ -89,17 +89,17 @@
|
||||
//function : PrepareArgs
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Integer IntTools::PrepareArgs (BRepAdaptor_Curve& C,
|
||||
const Standard_Real Tmax,
|
||||
const Standard_Real Tmin,
|
||||
const Standard_Integer Discret,
|
||||
const Standard_Real Deflection,
|
||||
TColStd_Array1OfReal& anArgs)
|
||||
Standard_Integer IntTools::PrepareArgs(BRepAdaptor_Curve& C,
|
||||
const Standard_Real Tmax,
|
||||
const Standard_Real Tmin,
|
||||
const Standard_Integer Discret,
|
||||
const Standard_Real Deflection,
|
||||
IntTools_CArray1OfReal& anArgs)
|
||||
{
|
||||
|
||||
TColStd_ListOfReal aPars;
|
||||
Standard_Real dt, tCurrent, tNext, aR, anAbsDeflection;
|
||||
Standard_Integer ip, i, j, aNbDeflectionPoints;
|
||||
Standard_Integer ip, i, j, aNbDeflectionPoints, aDiscretBis;
|
||||
Standard_Boolean aRFlag;
|
||||
|
||||
GeomAbs_CurveType aCurveType;
|
||||
@@ -150,12 +150,11 @@ Standard_Integer IntTools::PrepareArgs (BRepAdaptor_Curve& C,
|
||||
}
|
||||
|
||||
aPars.Append(Tmax);
|
||||
const Standard_Integer aDiscretBis = aPars.Extent();
|
||||
anArgs.Resize (0, aDiscretBis - 1, false);
|
||||
aDiscretBis=aPars.Extent();
|
||||
anArgs.Resize(aDiscretBis);
|
||||
TColStd_ListIteratorOfListOfReal anIt(aPars);
|
||||
for (i = 0; anIt.More(); anIt.Next(), i++)
|
||||
{
|
||||
anArgs.SetValue (i, anIt.Value());
|
||||
for (i=0; anIt.More(); anIt.Next(), i++) {
|
||||
anArgs(i)=anIt.Value();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
@@ -16,43 +16,123 @@
|
||||
#ifndef _IntTools_HeaderFile
|
||||
#define _IntTools_HeaderFile
|
||||
|
||||
#include <IntTools_CArray1OfReal.hxx>
|
||||
#include <IntTools_SequenceOfRoots.hxx>
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_DefineAlloc.hxx>
|
||||
#include <Standard_Handle.hxx>
|
||||
|
||||
#include <Standard_Real.hxx>
|
||||
#include <IntTools_SequenceOfRoots.hxx>
|
||||
#include <Standard_Integer.hxx>
|
||||
class TopoDS_Edge;
|
||||
class gp_Pnt;
|
||||
class Geom_Curve;
|
||||
class BRepAdaptor_Curve;
|
||||
class IntTools_CArray1OfReal;
|
||||
class IntTools_Context;
|
||||
class IntTools_ShrunkRange;
|
||||
class IntTools_Range;
|
||||
class IntTools_CommonPrt;
|
||||
class IntTools_Root;
|
||||
class IntTools_EdgeEdge;
|
||||
class IntTools_EdgeFace;
|
||||
class IntTools_FClass2d;
|
||||
class IntTools_MarkedRangeSet;
|
||||
class IntTools_BaseRangeSample;
|
||||
class IntTools_CurveRangeSample;
|
||||
class IntTools_SurfaceRangeSample;
|
||||
class IntTools_CurveRangeLocalizeData;
|
||||
class IntTools_SurfaceRangeLocalizeData;
|
||||
class IntTools_BeanFaceIntersector;
|
||||
class IntTools_Curve;
|
||||
class IntTools_PntOnFace;
|
||||
class IntTools_PntOn2Faces;
|
||||
class IntTools_TopolTool;
|
||||
class IntTools_FaceFace;
|
||||
class IntTools_Tools;
|
||||
class IntTools_CArray1;
|
||||
class IntTools_CArray1OfInteger;
|
||||
class IntTools_CArray1OfReal;
|
||||
class IntTools_CurveRangeSampleMapHasher;
|
||||
class IntTools_SurfaceRangeSampleMapHasher;
|
||||
|
||||
//! Contains classes for intersection and classification purposes and accompanying classes.
|
||||
|
||||
//! Contains classes for intersection and classification
|
||||
//! purposes and accompanying classes
|
||||
class IntTools
|
||||
{
|
||||
public:
|
||||
|
||||
DEFINE_STANDARD_ALLOC
|
||||
|
||||
|
||||
//! returns the length of the edge;
|
||||
Standard_EXPORT static Standard_Real Length (const TopoDS_Edge& E);
|
||||
|
||||
|
||||
//! Remove from the sequence aSeq the Roots that have
|
||||
//! values ti and tj such as |ti-tj] < anEpsT.
|
||||
Standard_EXPORT static void RemoveIdenticalRoots (IntTools_SequenceOfRoots& aSeq, const Standard_Real anEpsT);
|
||||
|
||||
//! Sort the sequence aSeq of the Roots to arrange the Roots in increasing order.
|
||||
|
||||
//! Sort the sequence aSeq of the Roots to arrange the
|
||||
//! Roons in increasing order
|
||||
Standard_EXPORT static void SortRoots (IntTools_SequenceOfRoots& aSeq, const Standard_Real anEpsT);
|
||||
|
||||
//! Find the states (before and after) for each Root from the sequence aSeq
|
||||
|
||||
//! Find the states (before and after) for each Root
|
||||
//! from the sequence aSeq
|
||||
Standard_EXPORT static void FindRootStates (IntTools_SequenceOfRoots& aSeq, const Standard_Real anEpsNull);
|
||||
|
||||
|
||||
Standard_EXPORT static Standard_Integer Parameter (const gp_Pnt& P, const Handle(Geom_Curve)& Curve, Standard_Real& aParm);
|
||||
|
||||
|
||||
Standard_EXPORT static Standard_Integer GetRadius (const BRepAdaptor_Curve& C, const Standard_Real t1, const Standard_Real t3, Standard_Real& R);
|
||||
|
||||
Standard_EXPORT static Standard_Integer PrepareArgs (BRepAdaptor_Curve& C, const Standard_Real tMax, const Standard_Real tMin, const Standard_Integer Discret, const Standard_Real Deflect, IntTools_CArray1OfReal& anArgs);
|
||||
|
||||
Standard_EXPORT static Standard_Integer PrepareArgs (BRepAdaptor_Curve& C,
|
||||
const Standard_Real tMax, const Standard_Real tMin,
|
||||
const Standard_Integer Discret, const Standard_Real Deflect,
|
||||
TColStd_Array1OfReal& anArgs);
|
||||
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
||||
|
||||
|
||||
friend class IntTools_Context;
|
||||
friend class IntTools_ShrunkRange;
|
||||
friend class IntTools_Range;
|
||||
friend class IntTools_CommonPrt;
|
||||
friend class IntTools_Root;
|
||||
friend class IntTools_EdgeEdge;
|
||||
friend class IntTools_EdgeFace;
|
||||
friend class IntTools_FClass2d;
|
||||
friend class IntTools_MarkedRangeSet;
|
||||
friend class IntTools_BaseRangeSample;
|
||||
friend class IntTools_CurveRangeSample;
|
||||
friend class IntTools_SurfaceRangeSample;
|
||||
friend class IntTools_CurveRangeLocalizeData;
|
||||
friend class IntTools_SurfaceRangeLocalizeData;
|
||||
friend class IntTools_BeanFaceIntersector;
|
||||
friend class IntTools_Curve;
|
||||
friend class IntTools_PntOnFace;
|
||||
friend class IntTools_PntOn2Faces;
|
||||
friend class IntTools_TopolTool;
|
||||
friend class IntTools_FaceFace;
|
||||
friend class IntTools_Tools;
|
||||
friend class IntTools_CArray1;
|
||||
friend class IntTools_CArray1OfInteger;
|
||||
friend class IntTools_CArray1OfReal;
|
||||
friend class IntTools_CurveRangeSampleMapHasher;
|
||||
friend class IntTools_SurfaceRangeSampleMapHasher;
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // _IntTools_HeaderFile
|
||||
|
@@ -19,8 +19,10 @@
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_DefineAlloc.hxx>
|
||||
#include <Standard_Handle.hxx>
|
||||
|
||||
#include <Standard_Integer.hxx>
|
||||
|
||||
|
||||
//! base class for range index management
|
||||
class IntTools_BaseRangeSample
|
||||
{
|
||||
@@ -28,18 +30,38 @@ public:
|
||||
|
||||
DEFINE_STANDARD_ALLOC
|
||||
|
||||
|
||||
Standard_EXPORT IntTools_BaseRangeSample();
|
||||
|
||||
|
||||
Standard_EXPORT IntTools_BaseRangeSample(const Standard_Integer theDepth);
|
||||
|
||||
void SetDepth (const Standard_Integer theDepth);
|
||||
|
||||
Standard_Integer GetDepth() const;
|
||||
|
||||
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
|
||||
void SetDepth (const Standard_Integer theDepth) { myDepth = theDepth; }
|
||||
|
||||
Standard_Integer GetDepth() const { return myDepth; }
|
||||
|
||||
private:
|
||||
|
||||
|
||||
|
||||
Standard_Integer myDepth;
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
#include <IntTools_BaseRangeSample.lxx>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // _IntTools_BaseRangeSample_HeaderFile
|
||||
|
25
src/IntTools/IntTools_BaseRangeSample.lxx
Normal file
25
src/IntTools/IntTools_BaseRangeSample.lxx
Normal file
@@ -0,0 +1,25 @@
|
||||
// Created on: 2005-10-05
|
||||
// Created by: Mikhail KLOKOV
|
||||
// Copyright (c) 2005-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.
|
||||
|
||||
inline void IntTools_BaseRangeSample::SetDepth(const Standard_Integer theDepth)
|
||||
{
|
||||
myDepth = theDepth;
|
||||
}
|
||||
|
||||
|
||||
inline Standard_Integer IntTools_BaseRangeSample::GetDepth() const
|
||||
{
|
||||
return myDepth;
|
||||
}
|
169
src/IntTools/IntTools_CArray1.gxx
Normal file
169
src/IntTools/IntTools_CArray1.gxx
Normal file
@@ -0,0 +1,169 @@
|
||||
// Created on: 2000-05-26
|
||||
// Created by: Peter KURNEV
|
||||
// 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.
|
||||
|
||||
//=======================================================================
|
||||
//function : IntTools_CArray1
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
IntTools_CArray1::IntTools_CArray1 (const Standard_Integer Length):
|
||||
myStart(NULL),
|
||||
myLength(0),
|
||||
myIsAllocated(Standard_False)
|
||||
{
|
||||
Resize(Length);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : IntTools_CArray1
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
IntTools_CArray1::IntTools_CArray1 (const Array1Item& Item,
|
||||
const Standard_Integer Length):
|
||||
myLength(Length),
|
||||
myIsAllocated(Standard_False)
|
||||
{
|
||||
Standard_ConstructionError_Raise_if(Length < 0,"IntTools_CArray1:: Length < 0");
|
||||
myStart = (void*)(&Item);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Init
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void IntTools_CArray1::Init (const Array1Item& V)
|
||||
{
|
||||
Array1Item* p = (Array1Item*) myStart;
|
||||
for(Standard_Integer i = 0; i < Length() ; i++) {
|
||||
*p++ = V;
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Destroy
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void IntTools_CArray1::Destroy()
|
||||
{
|
||||
if (myIsAllocated) {
|
||||
delete [] (Array1Item *)myStart;
|
||||
myIsAllocated = Standard_False;
|
||||
}
|
||||
myStart = NULL;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : IsEqual
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean IntTools_CArray1::IsEqual(const IntTools_CArray1& Other) const
|
||||
{
|
||||
if (&Other == this)
|
||||
return Standard_True;
|
||||
else if (Length() != Other.Length())
|
||||
return Standard_False;
|
||||
else if (Length() == 0)
|
||||
return Standard_True;
|
||||
//
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Resize
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void IntTools_CArray1::Resize(const Standard_Integer theNewLength)
|
||||
{
|
||||
Standard_ConstructionError_Raise_if(theNewLength < 0,"IntTools_CArray1: length < 0");
|
||||
|
||||
Array1Item* p = NULL;
|
||||
|
||||
Destroy();
|
||||
|
||||
myLength = theNewLength;
|
||||
|
||||
if (theNewLength > 0) {
|
||||
// default creator called for each item of the array
|
||||
p = new Array1Item[theNewLength];
|
||||
if (!p) throw Standard_OutOfMemory("IntTools_CArray1 : Allocation failed.");
|
||||
myIsAllocated = Standard_True;
|
||||
}
|
||||
|
||||
myStart = (void*) p;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Append
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void IntTools_CArray1::Append (const Array1Item& Value)
|
||||
{
|
||||
const Standard_Integer theNewLength=myLength+1;
|
||||
|
||||
Array1Item* p = NULL;
|
||||
|
||||
if (theNewLength > 0) {
|
||||
// default creator called for each item of the array
|
||||
p = new Array1Item[theNewLength];
|
||||
if (!p) throw Standard_OutOfMemory("IntTools_CArray1 : Allocation failed.");
|
||||
|
||||
if (myLength!=0) {
|
||||
Standard_Integer aBytesPerItem=sizeof(Array1Item);
|
||||
memcpy (p, myStart, myLength*aBytesPerItem);
|
||||
}
|
||||
|
||||
*(p+myLength)=Value;
|
||||
Destroy();
|
||||
myLength = theNewLength;
|
||||
myIsAllocated = Standard_True;
|
||||
}
|
||||
|
||||
myStart = (void*) p;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : Value
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
const Array1Item& IntTools_CArray1::Value(const Standard_Integer Index) const
|
||||
{
|
||||
if (myLength <1 || Index < 0 || Index >= myLength)
|
||||
throw Standard_OutOfRange("IntTools_CArray1::Value");
|
||||
|
||||
return ((Array1Item *)myStart)[Index];
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : SetValue
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void IntTools_CArray1::SetValue (const Standard_Integer Index,
|
||||
const Array1Item& Value)
|
||||
{
|
||||
ChangeValue(Index) = Value;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : ChangeValue
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Array1Item& IntTools_CArray1::ChangeValue(const Standard_Integer Index)
|
||||
{
|
||||
if (myLength < 1 || Index < 0 || Index >= myLength)
|
||||
throw Standard_OutOfRange("IntTools_CArray1::ChangeValue");
|
||||
|
||||
return ((Array1Item *)myStart)[Index];
|
||||
}
|
||||
|
26
src/IntTools/IntTools_CArray1.lxx
Normal file
26
src/IntTools/IntTools_CArray1.lxx
Normal file
@@ -0,0 +1,26 @@
|
||||
// Created on: 2000-05-26
|
||||
// Created by: Peter KURNEV
|
||||
// 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.
|
||||
|
||||
#include <Standard_OutOfRange.hxx>
|
||||
|
||||
//=======================================================================
|
||||
//function : Length
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
inline Standard_Integer IntTools_CArray1::Length() const
|
||||
{
|
||||
return myLength;
|
||||
}
|
||||
|
153
src/IntTools/IntTools_CArray1OfInteger.hxx
Normal file
153
src/IntTools/IntTools_CArray1OfInteger.hxx
Normal file
@@ -0,0 +1,153 @@
|
||||
// Created on: 2000-05-18
|
||||
// Created by: Peter KURNEV
|
||||
// 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 _IntTools_CArray1OfInteger_HeaderFile
|
||||
#define _IntTools_CArray1OfInteger_HeaderFile
|
||||
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_DefineAlloc.hxx>
|
||||
#include <Standard_Handle.hxx>
|
||||
|
||||
#include <Standard_Address.hxx>
|
||||
#include <Standard_Integer.hxx>
|
||||
#include <Standard_Boolean.hxx>
|
||||
class Standard_ConstructionError;
|
||||
class Standard_OutOfRange;
|
||||
class Standard_OutOfMemory;
|
||||
|
||||
|
||||
|
||||
class IntTools_CArray1OfInteger
|
||||
{
|
||||
public:
|
||||
|
||||
DEFINE_STANDARD_ALLOC
|
||||
|
||||
|
||||
|
||||
//! Creates an array of given Length.
|
||||
Standard_EXPORT IntTools_CArray1OfInteger(const Standard_Integer Length = 0);
|
||||
|
||||
|
||||
//! Creates an array sharing datas with an other.
|
||||
//! Example:
|
||||
//! Item tab[100];
|
||||
//! CArray1OfItem thetab (tab[0],100);
|
||||
//!
|
||||
//! CArray1OfItem aArray1(100);
|
||||
//! CArray1OfItem anSharedArray1(aArray1.ChangeValue(0),aArray1.Length());
|
||||
//!
|
||||
//! Warning:
|
||||
//! The validity of length are under the responsibility
|
||||
//! of the user.
|
||||
//! The sahred array must have a valid address during the life of
|
||||
//! the Array1.
|
||||
Standard_EXPORT IntTools_CArray1OfInteger(const Standard_Integer& Item, const Standard_Integer Length);
|
||||
|
||||
|
||||
//! Initializes the array with a given value.
|
||||
Standard_EXPORT void Init (const Standard_Integer& V);
|
||||
|
||||
|
||||
//! destroy current content and realloc the new size
|
||||
//! does nothing if Length() == theLength
|
||||
Standard_EXPORT void Resize (const Standard_Integer theNewLength);
|
||||
|
||||
|
||||
//! Frees the allocated area corresponding to the
|
||||
//! array.
|
||||
Standard_EXPORT void Destroy();
|
||||
~IntTools_CArray1OfInteger()
|
||||
{
|
||||
Destroy();
|
||||
}
|
||||
|
||||
|
||||
//! Returns the number of elements of <me>.
|
||||
Standard_Integer Length() const;
|
||||
|
||||
Standard_EXPORT void Append (const Standard_Integer& Value);
|
||||
|
||||
|
||||
//! Sets the <Index>th element of the array to
|
||||
//! <Value>.
|
||||
Standard_EXPORT void SetValue (const Standard_Integer Index, const Standard_Integer& Value);
|
||||
|
||||
|
||||
//! Returns the value of the <Index>th element of the
|
||||
//! array.
|
||||
Standard_EXPORT const Standard_Integer& Value (const Standard_Integer Index) const;
|
||||
const Standard_Integer& operator () (const Standard_Integer Index) const
|
||||
{
|
||||
return Value(Index);
|
||||
}
|
||||
|
||||
|
||||
//! Returns the value of the <Index>th element of the
|
||||
//! array.
|
||||
Standard_EXPORT Standard_Integer& ChangeValue (const Standard_Integer Index);
|
||||
Standard_Integer& operator () (const Standard_Integer Index)
|
||||
{
|
||||
return ChangeValue(Index);
|
||||
}
|
||||
|
||||
|
||||
//! Applyies the == operator on each array item
|
||||
Standard_EXPORT Standard_Boolean IsEqual (const IntTools_CArray1OfInteger& Other) const;
|
||||
Standard_Boolean operator == (const IntTools_CArray1OfInteger& Other) const
|
||||
{
|
||||
return IsEqual(Other);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
||||
|
||||
//! Prohibits the creator by copy
|
||||
Standard_EXPORT IntTools_CArray1OfInteger(const IntTools_CArray1OfInteger& AnArray);
|
||||
|
||||
|
||||
Standard_Address myStart;
|
||||
Standard_Integer myLength;
|
||||
Standard_Boolean myIsAllocated;
|
||||
|
||||
|
||||
};
|
||||
|
||||
#define Array1Item Standard_Integer
|
||||
#define Array1Item_hxx <Standard_Integer.hxx>
|
||||
#define IntTools_CArray1 IntTools_CArray1OfInteger
|
||||
#define IntTools_CArray1_hxx <IntTools_CArray1OfInteger.hxx>
|
||||
|
||||
#include <IntTools_CArray1.lxx>
|
||||
|
||||
#undef Array1Item
|
||||
#undef Array1Item_hxx
|
||||
#undef IntTools_CArray1
|
||||
#undef IntTools_CArray1_hxx
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // _IntTools_CArray1OfInteger_HeaderFile
|
28
src/IntTools/IntTools_CArray1OfInteger_0.cxx
Normal file
28
src/IntTools/IntTools_CArray1OfInteger_0.cxx
Normal file
@@ -0,0 +1,28 @@
|
||||
// Created on: 2000-05-18
|
||||
// Created by: Peter KURNEV
|
||||
// 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.
|
||||
|
||||
#include <IntTools_CArray1OfInteger.hxx>
|
||||
|
||||
#include <Standard_ConstructionError.hxx>
|
||||
#include <Standard_OutOfRange.hxx>
|
||||
#include <Standard_OutOfMemory.hxx>
|
||||
|
||||
|
||||
#define Array1Item Standard_Integer
|
||||
#define Array1Item_hxx <Standard_Integer.hxx>
|
||||
#define IntTools_CArray1 IntTools_CArray1OfInteger
|
||||
#define IntTools_CArray1_hxx <IntTools_CArray1OfInteger.hxx>
|
||||
#include <IntTools_CArray1.gxx>
|
||||
|
@@ -16,9 +16,139 @@
|
||||
#ifndef _IntTools_CArray1OfReal_HeaderFile
|
||||
#define _IntTools_CArray1OfReal_HeaderFile
|
||||
|
||||
#include <TColStd_Array1OfReal.hxx>
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_DefineAlloc.hxx>
|
||||
#include <Standard_Handle.hxx>
|
||||
|
||||
#include <Standard_Address.hxx>
|
||||
#include <Standard_Integer.hxx>
|
||||
#include <Standard_Boolean.hxx>
|
||||
#include <Standard_Real.hxx>
|
||||
class Standard_ConstructionError;
|
||||
class Standard_OutOfRange;
|
||||
class Standard_OutOfMemory;
|
||||
|
||||
|
||||
|
||||
class IntTools_CArray1OfReal
|
||||
{
|
||||
public:
|
||||
|
||||
DEFINE_STANDARD_ALLOC
|
||||
|
||||
|
||||
|
||||
//! Creates an array of given Length.
|
||||
Standard_EXPORT IntTools_CArray1OfReal(const Standard_Integer Length = 0);
|
||||
|
||||
|
||||
//! Creates an array sharing datas with an other.
|
||||
//! Example:
|
||||
//! Item tab[100];
|
||||
//! CArray1OfItem thetab (tab[0],100);
|
||||
//!
|
||||
//! CArray1OfItem aArray1(100);
|
||||
//! CArray1OfItem anSharedArray1(aArray1.ChangeValue(0),aArray1.Length());
|
||||
//!
|
||||
//! Warning:
|
||||
//! The validity of length are under the responsibility
|
||||
//! of the user.
|
||||
//! The sahred array must have a valid address during the life of
|
||||
//! the Array1.
|
||||
Standard_EXPORT IntTools_CArray1OfReal(const Standard_Real& Item, const Standard_Integer Length);
|
||||
|
||||
|
||||
//! Initializes the array with a given value.
|
||||
Standard_EXPORT void Init (const Standard_Real& V);
|
||||
|
||||
|
||||
//! destroy current content and realloc the new size
|
||||
//! does nothing if Length() == theLength
|
||||
Standard_EXPORT void Resize (const Standard_Integer theNewLength);
|
||||
|
||||
|
||||
//! Frees the allocated area corresponding to the
|
||||
//! array.
|
||||
Standard_EXPORT void Destroy();
|
||||
~IntTools_CArray1OfReal()
|
||||
{
|
||||
Destroy();
|
||||
}
|
||||
|
||||
|
||||
//! Returns the number of elements of <me>.
|
||||
Standard_Integer Length() const;
|
||||
|
||||
Standard_EXPORT void Append (const Standard_Real& Value);
|
||||
|
||||
|
||||
//! Sets the <Index>th element of the array to
|
||||
//! <Value>.
|
||||
Standard_EXPORT void SetValue (const Standard_Integer Index, const Standard_Real& Value);
|
||||
|
||||
|
||||
//! Returns the value of the <Index>th element of the
|
||||
//! array.
|
||||
Standard_EXPORT const Standard_Real& Value (const Standard_Integer Index) const;
|
||||
const Standard_Real& operator () (const Standard_Integer Index) const
|
||||
{
|
||||
return Value(Index);
|
||||
}
|
||||
|
||||
|
||||
//! Returns the value of the <Index>th element of the
|
||||
//! array.
|
||||
Standard_EXPORT Standard_Real& ChangeValue (const Standard_Integer Index);
|
||||
Standard_Real& operator () (const Standard_Integer Index)
|
||||
{
|
||||
return ChangeValue(Index);
|
||||
}
|
||||
|
||||
|
||||
//! Applies the == operator on each array item
|
||||
Standard_EXPORT Standard_Boolean IsEqual (const IntTools_CArray1OfReal& Other) const;
|
||||
Standard_Boolean operator == (const IntTools_CArray1OfReal& Other) const
|
||||
{
|
||||
return IsEqual(Other);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
||||
|
||||
//! Prohibits the creator by copy
|
||||
Standard_EXPORT IntTools_CArray1OfReal(const IntTools_CArray1OfReal& AnArray);
|
||||
|
||||
|
||||
Standard_Address myStart;
|
||||
Standard_Integer myLength;
|
||||
Standard_Boolean myIsAllocated;
|
||||
|
||||
|
||||
};
|
||||
|
||||
#define Array1Item Standard_Real
|
||||
#define Array1Item_hxx <Standard_Real.hxx>
|
||||
#define IntTools_CArray1 IntTools_CArray1OfReal
|
||||
#define IntTools_CArray1_hxx <IntTools_CArray1OfReal.hxx>
|
||||
|
||||
#include <IntTools_CArray1.lxx>
|
||||
|
||||
#undef Array1Item
|
||||
#undef Array1Item_hxx
|
||||
#undef IntTools_CArray1
|
||||
#undef IntTools_CArray1_hxx
|
||||
|
||||
|
||||
|
||||
Standard_DEPRECATED("Deprecated alias - TColStd_Array1OfReal should be used instead")
|
||||
typedef TColStd_Array1OfReal IntTools_CArray1OfReal;
|
||||
|
||||
#endif // _IntTools_CArray1OfReal_HeaderFile
|
||||
|
28
src/IntTools/IntTools_CArray1OfReal_0.cxx
Normal file
28
src/IntTools/IntTools_CArray1OfReal_0.cxx
Normal file
@@ -0,0 +1,28 @@
|
||||
// Created on: 2000-05-18
|
||||
// Created by: Peter KURNEV
|
||||
// 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.
|
||||
|
||||
#include <IntTools_CArray1OfReal.hxx>
|
||||
|
||||
#include <Standard_ConstructionError.hxx>
|
||||
#include <Standard_OutOfRange.hxx>
|
||||
#include <Standard_OutOfMemory.hxx>
|
||||
|
||||
|
||||
#define Array1Item Standard_Real
|
||||
#define Array1Item_hxx <Standard_Real.hxx>
|
||||
#define IntTools_CArray1 IntTools_CArray1OfReal
|
||||
#define IntTools_CArray1_hxx <IntTools_CArray1OfReal.hxx>
|
||||
#include <IntTools_CArray1.gxx>
|
||||
|
@@ -19,14 +19,18 @@
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_DefineAlloc.hxx>
|
||||
#include <Standard_Handle.hxx>
|
||||
|
||||
#include <Standard_Integer.hxx>
|
||||
#include <Standard_Real.hxx>
|
||||
#include <IntTools_MapOfCurveSample.hxx>
|
||||
#include <IntTools_DataMapOfCurveSampleBox.hxx>
|
||||
#include <Standard_Boolean.hxx>
|
||||
#include <IntTools_ListOfCurveRangeSample.hxx>
|
||||
|
||||
class IntTools_CurveRangeSample;
|
||||
class Bnd_Box;
|
||||
|
||||
|
||||
|
||||
class IntTools_CurveRangeLocalizeData
|
||||
{
|
||||
public:
|
||||
@@ -36,27 +40,46 @@ public:
|
||||
|
||||
Standard_EXPORT IntTools_CurveRangeLocalizeData(const Standard_Integer theNbSample, const Standard_Real theMinRange);
|
||||
|
||||
Standard_Integer GetNbSample() const { return myNbSampleC; }
|
||||
|
||||
Standard_Real GetMinRange() const { return myMinRangeC; }
|
||||
|
||||
Standard_Integer GetNbSample() const;
|
||||
|
||||
Standard_Real GetMinRange() const;
|
||||
|
||||
Standard_EXPORT void AddOutRange (const IntTools_CurveRangeSample& theRange);
|
||||
|
||||
|
||||
Standard_EXPORT void AddBox (const IntTools_CurveRangeSample& theRange, const Bnd_Box& theBox);
|
||||
|
||||
|
||||
Standard_EXPORT Standard_Boolean FindBox (const IntTools_CurveRangeSample& theRange, Bnd_Box& theBox) const;
|
||||
|
||||
|
||||
Standard_EXPORT Standard_Boolean IsRangeOut (const IntTools_CurveRangeSample& theRange) const;
|
||||
|
||||
|
||||
Standard_EXPORT void ListRangeOut (IntTools_ListOfCurveRangeSample& theList) const;
|
||||
|
||||
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
||||
|
||||
Standard_Integer myNbSampleC;
|
||||
Standard_Real myMinRangeC;
|
||||
IntTools_MapOfCurveSample myMapRangeOut;
|
||||
IntTools_DataMapOfCurveSampleBox myMapBox;
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
#include <IntTools_CurveRangeLocalizeData.lxx>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // _IntTools_CurveRangeLocalizeData_HeaderFile
|
||||
|
27
src/IntTools/IntTools_CurveRangeLocalizeData.lxx
Normal file
27
src/IntTools/IntTools_CurveRangeLocalizeData.lxx
Normal file
@@ -0,0 +1,27 @@
|
||||
// Created on: 2005-10-14
|
||||
// Created by: Mikhail KLOKOV
|
||||
// Copyright (c) 2005-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.
|
||||
|
||||
inline Standard_Integer IntTools_CurveRangeLocalizeData::GetNbSample() const
|
||||
{
|
||||
return myNbSampleC;
|
||||
}
|
||||
|
||||
|
||||
inline Standard_Real IntTools_CurveRangeLocalizeData::GetMinRange() const
|
||||
{
|
||||
return myMinRangeC;
|
||||
}
|
||||
|
||||
|
@@ -24,9 +24,9 @@
|
||||
#include <IntTools_BaseRangeSample.hxx>
|
||||
#include <Standard_Boolean.hxx>
|
||||
#include <Standard_Real.hxx>
|
||||
|
||||
class IntTools_Range;
|
||||
|
||||
|
||||
//! class for range index management of curve
|
||||
class IntTools_CurveRangeSample : public IntTools_BaseRangeSample
|
||||
{
|
||||
@@ -39,26 +39,39 @@ public:
|
||||
|
||||
Standard_EXPORT IntTools_CurveRangeSample(const Standard_Integer theIndex);
|
||||
|
||||
void SetRangeIndex (const Standard_Integer theIndex) { myIndex = theIndex; }
|
||||
|
||||
Standard_Integer GetRangeIndex() const { return myIndex; }
|
||||
|
||||
Standard_Boolean IsEqual (const IntTools_CurveRangeSample& Other) const
|
||||
{
|
||||
return ((myIndex == Other.myIndex) && (GetDepth() == Other.GetDepth()));
|
||||
}
|
||||
|
||||
void SetRangeIndex (const Standard_Integer theIndex);
|
||||
|
||||
Standard_Integer GetRangeIndex() const;
|
||||
|
||||
Standard_Boolean IsEqual (const IntTools_CurveRangeSample& Other) const;
|
||||
|
||||
Standard_EXPORT IntTools_Range GetRange (const Standard_Real theFirst, const Standard_Real theLast, const Standard_Integer theNbSample) const;
|
||||
|
||||
Standard_Integer GetRangeIndexDeeper (const Standard_Integer theNbSample) const
|
||||
{
|
||||
return myIndex * theNbSample;
|
||||
}
|
||||
Standard_Integer GetRangeIndexDeeper (const Standard_Integer theNbSample) const;
|
||||
|
||||
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
||||
|
||||
Standard_Integer myIndex;
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
#include <IntTools_CurveRangeSample.lxx>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // _IntTools_CurveRangeSample_HeaderFile
|
||||
|
36
src/IntTools/IntTools_CurveRangeSample.lxx
Normal file
36
src/IntTools/IntTools_CurveRangeSample.lxx
Normal file
@@ -0,0 +1,36 @@
|
||||
// Created on: 2005-10-05
|
||||
// Created by: Mikhail KLOKOV
|
||||
// Copyright (c) 2005-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.
|
||||
|
||||
inline void IntTools_CurveRangeSample::SetRangeIndex(const Standard_Integer theIndex)
|
||||
{
|
||||
myIndex = theIndex;
|
||||
}
|
||||
|
||||
|
||||
inline Standard_Integer IntTools_CurveRangeSample::GetRangeIndex() const
|
||||
{
|
||||
return myIndex;
|
||||
}
|
||||
|
||||
inline Standard_Boolean IntTools_CurveRangeSample::IsEqual(const IntTools_CurveRangeSample& Other) const
|
||||
{
|
||||
return ((myIndex == Other.myIndex) && (GetDepth() == Other.GetDepth()));
|
||||
}
|
||||
|
||||
|
||||
inline Standard_Integer IntTools_CurveRangeSample::GetRangeIndexDeeper(const Standard_Integer theNbSample) const
|
||||
{
|
||||
return myIndex * theNbSample;
|
||||
}
|
@@ -16,11 +16,14 @@
|
||||
#ifndef _IntTools_CurveRangeSampleMapHasher_HeaderFile
|
||||
#define _IntTools_CurveRangeSampleMapHasher_HeaderFile
|
||||
|
||||
#include <IntTools_CurveRangeSample.hxx>
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_DefineAlloc.hxx>
|
||||
#include <Standard_Handle.hxx>
|
||||
|
||||
#include <Standard_Integer.hxx>
|
||||
#include <Standard_Boolean.hxx>
|
||||
class IntTools_CurveRangeSample;
|
||||
|
||||
|
||||
//! class for range index management of curve
|
||||
class IntTools_CurveRangeSampleMapHasher
|
||||
@@ -33,19 +36,35 @@ public:
|
||||
//! @param theKey the key which hash code is to be computed
|
||||
//! @param theUpperBound the upper bound of the range a computing hash code must be within
|
||||
//! @return a computed hash code, in the range [1, theUpperBound]
|
||||
static Standard_Integer HashCode (const IntTools_CurveRangeSample& theKey, const Standard_Integer theUpperBound)
|
||||
{
|
||||
return ::HashCode(theKey.GetDepth(), theUpperBound);
|
||||
}
|
||||
static Standard_Integer HashCode (const IntTools_CurveRangeSample& theKey, const Standard_Integer theUpperBound);
|
||||
|
||||
//! Returns True when the two keys are the same. Two
|
||||
//! same keys must have the same hashcode, the
|
||||
//! contrary is not necessary.
|
||||
static Standard_Boolean IsEqual (const IntTools_CurveRangeSample& S1, const IntTools_CurveRangeSample& S2)
|
||||
{
|
||||
return S1.IsEqual(S2);
|
||||
}
|
||||
static Standard_Boolean IsEqual (const IntTools_CurveRangeSample& S1, const IntTools_CurveRangeSample& S2);
|
||||
|
||||
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
#include <IntTools_CurveRangeSampleMapHasher.lxx>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // _IntTools_CurveRangeSampleMapHasher_HeaderFile
|
||||
|
29
src/IntTools/IntTools_CurveRangeSampleMapHasher.lxx
Normal file
29
src/IntTools/IntTools_CurveRangeSampleMapHasher.lxx
Normal file
@@ -0,0 +1,29 @@
|
||||
// Created on: 2005-10-14
|
||||
// Created by: Mikhail KLOKOV
|
||||
// Copyright (c) 2005-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.
|
||||
|
||||
//=======================================================================
|
||||
// function : HashCode
|
||||
// purpose :
|
||||
//=======================================================================
|
||||
inline Standard_Integer IntTools_CurveRangeSampleMapHasher::HashCode (const IntTools_CurveRangeSample& theKey,
|
||||
const Standard_Integer theUpperBound)
|
||||
{
|
||||
return ::HashCode(theKey.GetDepth(), theUpperBound);
|
||||
}
|
||||
|
||||
inline Standard_Boolean IntTools_CurveRangeSampleMapHasher::IsEqual(const IntTools_CurveRangeSample& S1,
|
||||
const IntTools_CurveRangeSample& S2) {
|
||||
return S1.IsEqual(S2);
|
||||
}
|
@@ -39,6 +39,7 @@
|
||||
#include <IntCurveSurface_IntersectionPoint.hxx>
|
||||
#include <IntTools.hxx>
|
||||
#include <IntTools_BeanFaceIntersector.hxx>
|
||||
#include <IntTools_CArray1OfInteger.hxx>
|
||||
#include <IntTools_CommonPrt.hxx>
|
||||
#include <IntTools_Context.hxx>
|
||||
#include <IntTools_FClass2d.hxx>
|
||||
|
@@ -73,11 +73,14 @@ public:
|
||||
//! Returns True if faces are tangent
|
||||
Standard_EXPORT Standard_Boolean TangentFaces() const;
|
||||
|
||||
//! Provides post-processing the result lines.
|
||||
//! @param bToSplit [in] split the closed 3D-curves on parts when TRUE,
|
||||
//! remain untouched otherwise
|
||||
Standard_EXPORT void PrepareLines3D (const Standard_Boolean bToSplit = Standard_True);
|
||||
|
||||
//! Provides post-processing the result lines.
|
||||
//! <bToSplit> - the flag.
|
||||
//! In case of <bToSplit> is true the closed 3D-curves will be splitted
|
||||
//! on parts.
|
||||
//! In case of <bToSplit> is false the closed 3D-curves remain untouched.
|
||||
Standard_EXPORT void PrepareLines3D (const Standard_Boolean bToSplit = Standard_True);
|
||||
|
||||
Standard_EXPORT void SetList (IntSurf_ListOfPntOn2S& ListOfPnts);
|
||||
|
||||
|
||||
|
@@ -11,8 +11,9 @@
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#include <IntTools_MarkedRangeSet.hxx>
|
||||
|
||||
#include <IntTools_CArray1OfReal.hxx>
|
||||
#include <IntTools_MarkedRangeSet.hxx>
|
||||
#include <IntTools_Range.hxx>
|
||||
|
||||
IntTools_MarkedRangeSet::IntTools_MarkedRangeSet() :
|
||||
@@ -27,8 +28,9 @@ IntTools_MarkedRangeSet::IntTools_MarkedRangeSet(const Standard_Real theFirst
|
||||
SetBoundaries(theFirstBoundary, theLastBoundary, theInitFlag);
|
||||
}
|
||||
|
||||
IntTools_MarkedRangeSet::IntTools_MarkedRangeSet (const TColStd_Array1OfReal& theSortedArray,
|
||||
const Standard_Integer theInitFlag)
|
||||
IntTools_MarkedRangeSet::IntTools_MarkedRangeSet(const IntTools_CArray1OfReal& theSortedArray,
|
||||
const Standard_Integer theInitFlag)
|
||||
|
||||
{
|
||||
SetRanges(theSortedArray, theInitFlag);
|
||||
}
|
||||
@@ -45,19 +47,19 @@ void IntTools_MarkedRangeSet::SetBoundaries(const Standard_Real theFirstBound
|
||||
myFlags.Append(theInitFlag);
|
||||
}
|
||||
|
||||
void IntTools_MarkedRangeSet::SetRanges (const TColStd_Array1OfReal& theSortedArray,
|
||||
const Standard_Integer theInitFlag)
|
||||
void IntTools_MarkedRangeSet::SetRanges(const IntTools_CArray1OfReal& theSortedArray,
|
||||
const Standard_Integer theInitFlag)
|
||||
{
|
||||
myRangeSetStorer.Clear();
|
||||
myFlags.Clear();
|
||||
for (TColStd_Array1OfReal::Iterator aRangeIter (theSortedArray); aRangeIter.More(); aRangeIter.Next())
|
||||
{
|
||||
myRangeSetStorer.Append (aRangeIter.Value());
|
||||
Standard_Integer i = 0;
|
||||
|
||||
for(i = 0; i < theSortedArray.Length(); i++) {
|
||||
myRangeSetStorer.Append(theSortedArray(i));
|
||||
}
|
||||
myRangeNumber = myRangeSetStorer.Length() - 1;
|
||||
|
||||
for (Standard_Integer i = 1; i <= myRangeNumber; i++)
|
||||
{
|
||||
for(i = 1; i <= myRangeNumber; i++) {
|
||||
myFlags.Append(theInitFlag);
|
||||
}
|
||||
}
|
||||
|
@@ -16,12 +16,19 @@
|
||||
#ifndef _IntTools_MarkedRangeSet_HeaderFile
|
||||
#define _IntTools_MarkedRangeSet_HeaderFile
|
||||
|
||||
#include <IntTools_CArray1OfReal.hxx>
|
||||
#include <TColStd_SequenceOfReal.hxx>
|
||||
#include <TColStd_SequenceOfInteger.hxx>
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_DefineAlloc.hxx>
|
||||
#include <Standard_Handle.hxx>
|
||||
|
||||
#include <TColStd_SequenceOfReal.hxx>
|
||||
#include <Standard_Integer.hxx>
|
||||
#include <TColStd_SequenceOfInteger.hxx>
|
||||
#include <Standard_Real.hxx>
|
||||
#include <Standard_Boolean.hxx>
|
||||
class IntTools_CArray1OfReal;
|
||||
class IntTools_Range;
|
||||
|
||||
|
||||
//! class MarkedRangeSet provides continuous set of ranges marked with flags
|
||||
class IntTools_MarkedRangeSet
|
||||
{
|
||||
@@ -29,6 +36,8 @@ public:
|
||||
|
||||
DEFINE_STANDARD_ALLOC
|
||||
|
||||
|
||||
|
||||
//! Empty constructor
|
||||
Standard_EXPORT IntTools_MarkedRangeSet();
|
||||
|
||||
@@ -43,7 +52,7 @@ public:
|
||||
//! Warning:
|
||||
//! The constructor do not check if the values of array are not sorted
|
||||
//! It should be checked before function invocation
|
||||
Standard_EXPORT IntTools_MarkedRangeSet(const TColStd_Array1OfReal& theSortedArray, const Standard_Integer theInitFlag);
|
||||
Standard_EXPORT IntTools_MarkedRangeSet(const IntTools_CArray1OfReal& theSortedArray, const Standard_Integer theInitFlag);
|
||||
|
||||
|
||||
//! build set of ranges which consists of one range with
|
||||
@@ -56,7 +65,7 @@ public:
|
||||
//! Warning:
|
||||
//! The function do not check if the values of array are not sorted
|
||||
//! It should be checked before function invocation
|
||||
Standard_EXPORT void SetRanges (const TColStd_Array1OfReal& theSortedArray, const Standard_Integer theInitFlag);
|
||||
Standard_EXPORT void SetRanges (const IntTools_CArray1OfReal& theSortedArray, const Standard_Integer theInitFlag);
|
||||
|
||||
|
||||
//! Inserts a new range marked with flag theFlag
|
||||
@@ -114,21 +123,42 @@ public:
|
||||
//! can be equal to theValue, otherwise upper boundary of the range
|
||||
//! can be equal to theValue.
|
||||
Standard_EXPORT Standard_Integer GetIndex (const Standard_Real theValue, const Standard_Boolean UseLower) const;
|
||||
|
||||
|
||||
//! Returns number of ranges
|
||||
Standard_Integer Length() const { return myRangeNumber; }
|
||||
Standard_Integer Length() const;
|
||||
|
||||
|
||||
//! Returns the range with index theIndex.
|
||||
//! the Index can be from 1 to Length()
|
||||
Standard_EXPORT IntTools_Range Range (const Standard_Integer theIndex) const;
|
||||
|
||||
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
||||
|
||||
TColStd_SequenceOfReal myRangeSetStorer;
|
||||
Standard_Integer myRangeNumber;
|
||||
TColStd_SequenceOfInteger myFlags;
|
||||
TColStd_SequenceOfInteger myFoundIndices;
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
#include <IntTools_MarkedRangeSet.lxx>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // _IntTools_MarkedRangeSet_HeaderFile
|
||||
|
17
src/IntTools/IntTools_MarkedRangeSet.lxx
Normal file
17
src/IntTools/IntTools_MarkedRangeSet.lxx
Normal file
@@ -0,0 +1,17 @@
|
||||
// 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.
|
||||
|
||||
inline Standard_Integer IntTools_MarkedRangeSet::Length() const
|
||||
{
|
||||
return myRangeNumber;
|
||||
}
|
@@ -16,11 +16,15 @@
|
||||
#ifndef _IntTools_SurfaceRangeSampleMapHasher_HeaderFile
|
||||
#define _IntTools_SurfaceRangeSampleMapHasher_HeaderFile
|
||||
|
||||
#include <IntTools_SurfaceRangeSample.hxx>
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_DefineAlloc.hxx>
|
||||
#include <Standard_Handle.hxx>
|
||||
|
||||
#include <Standard_Integer.hxx>
|
||||
#include <Standard_Boolean.hxx>
|
||||
class IntTools_SurfaceRangeSample;
|
||||
|
||||
|
||||
|
||||
class IntTools_SurfaceRangeSampleMapHasher
|
||||
{
|
||||
@@ -32,19 +36,35 @@ public:
|
||||
//! @param theKey the key which hash code is to be computed
|
||||
//! @param theUpperBound the upper bound of the range a computing hash code must be within
|
||||
//! @return a computed hash code, in the range [1, theUpperBound]
|
||||
static Standard_Integer HashCode (const IntTools_SurfaceRangeSample& theKey, Standard_Integer theUpperBound)
|
||||
{
|
||||
return ::HashCode (theKey.GetIndexU() * theKey.GetIndexV(), theUpperBound);
|
||||
}
|
||||
static Standard_Integer HashCode (const IntTools_SurfaceRangeSample& theKey, Standard_Integer theUpperBound);
|
||||
|
||||
//! Returns True when the two keys are the same. Two
|
||||
//! same keys must have the same hashcode, the
|
||||
//! contrary is not necessary.
|
||||
static Standard_Boolean IsEqual (const IntTools_SurfaceRangeSample& S1, const IntTools_SurfaceRangeSample& S2)
|
||||
{
|
||||
return S1.IsEqual(S2);
|
||||
}
|
||||
static Standard_Boolean IsEqual (const IntTools_SurfaceRangeSample& S1, const IntTools_SurfaceRangeSample& S2);
|
||||
|
||||
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
#include <IntTools_SurfaceRangeSampleMapHasher.lxx>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // _IntTools_SurfaceRangeSampleMapHasher_HeaderFile
|
||||
|
30
src/IntTools/IntTools_SurfaceRangeSampleMapHasher.lxx
Normal file
30
src/IntTools/IntTools_SurfaceRangeSampleMapHasher.lxx
Normal file
@@ -0,0 +1,30 @@
|
||||
// Created on: 2005-10-14
|
||||
// Created by: Mikhail KLOKOV
|
||||
// Copyright (c) 2005-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.
|
||||
|
||||
//=======================================================================
|
||||
// function : HashCode
|
||||
// purpose :
|
||||
//=======================================================================
|
||||
inline Standard_Integer IntTools_SurfaceRangeSampleMapHasher::HashCode (const IntTools_SurfaceRangeSample& theKey,
|
||||
const Standard_Integer theUpperBound)
|
||||
{
|
||||
// return (((K.GetDepthU() % Upper) ^ (K.GetDepthV() % Upper)) % Upper);
|
||||
return ::HashCode (theKey.GetIndexU() * theKey.GetIndexV(), theUpperBound);
|
||||
}
|
||||
|
||||
inline Standard_Boolean IntTools_SurfaceRangeSampleMapHasher::IsEqual(const IntTools_SurfaceRangeSample& S1,
|
||||
const IntTools_SurfaceRangeSample& S2) {
|
||||
return S1.IsEqual(S2);
|
||||
}
|
@@ -65,10 +65,10 @@ public:
|
||||
Standard_EXPORT static Handle(TColStd_HArray1OfReal) MixBnd (const Standard_Integer Degree, const TColStd_Array1OfReal& Knots, const TColStd_Array1OfInteger& Mults, const Handle(Law_Linear)& Lin);
|
||||
|
||||
//! Builds the poles of the 1d bspline that is null on the
|
||||
//! right side of Knots(Index) (on the left if
|
||||
//! rigth side of Knots(Index) (on the left if
|
||||
//! NulOnTheRight is false) and that is like a
|
||||
//! t*(1-t)(1-t) curve on the left side of Knots(Index)
|
||||
//! (on the right if NulOnTheRight is false). The result
|
||||
//! (on the rigth if NulOnTheRight is false). The result
|
||||
//! curve is C1 with a derivative equal to 1. at first
|
||||
//! parameter (-1 at last parameter if NulOnTheRight is
|
||||
//! false).
|
||||
|
@@ -42,6 +42,7 @@ class Law_BSpFunc : public Law_Function
|
||||
|
||||
public:
|
||||
|
||||
|
||||
Standard_EXPORT Law_BSpFunc();
|
||||
|
||||
Standard_EXPORT Law_BSpFunc(const Handle(Law_BSpline)& C, const Standard_Real First, const Standard_Real Last);
|
||||
@@ -51,11 +52,14 @@ public:
|
||||
//! Returns the number of intervals for continuity
|
||||
//! <S>. May be one if Continuity(me) >= <S>
|
||||
Standard_EXPORT Standard_Integer NbIntervals (const GeomAbs_Shape S) const Standard_OVERRIDE;
|
||||
|
||||
//! Stores in <T> the parameters bounding the intervals of continuity <S>.
|
||||
//! The array must provide enough room to accommodate for the parameters, i.e. T.Length() > NbIntervals()
|
||||
|
||||
//! Stores in <T> the parameters bounding the intervals
|
||||
//! of continuity <S>.
|
||||
//!
|
||||
//! The array must provide enough room to accomodate
|
||||
//! for the parameters. i.e. T.Length() > NbIntervals()
|
||||
Standard_EXPORT void Intervals (TColStd_Array1OfReal& T, const GeomAbs_Shape S) const Standard_OVERRIDE;
|
||||
|
||||
|
||||
Standard_EXPORT Standard_Real Value (const Standard_Real X) Standard_OVERRIDE;
|
||||
|
||||
Standard_EXPORT void D1 (const Standard_Real X, Standard_Real& F, Standard_Real& D) Standard_OVERRIDE;
|
||||
@@ -76,14 +80,30 @@ public:
|
||||
|
||||
Standard_EXPORT void SetCurve (const Handle(Law_BSpline)& C);
|
||||
|
||||
|
||||
|
||||
|
||||
DEFINE_STANDARD_RTTIEXT(Law_BSpFunc,Law_Function)
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
||||
Handle(Law_BSpline) curv;
|
||||
Standard_Real first;
|
||||
Standard_Real last;
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // _Law_BSpFunc_HeaderFile
|
||||
|
@@ -68,7 +68,7 @@ DEFINE_STANDARD_HANDLE(Law_BSpline, Standard_Transient)
|
||||
//! - Quasi-uniform if all multiplicities are 1
|
||||
//! but the first and the last which are Degree+1.
|
||||
//!
|
||||
//! - PiecewiseBezier if all multiplicities are
|
||||
//! - PiecewiseBezier if all multiplicites are
|
||||
//! Degree but the first and the last which are
|
||||
//! Degree+1.
|
||||
//!
|
||||
@@ -518,7 +518,7 @@ public:
|
||||
//! StartingCondition = 1 means the first point and tangent cannot move
|
||||
//! EndingCondition = 1 means the last point and tangent cannot move
|
||||
//! and so forth
|
||||
//! ErrorStatus != 0 means that there are not enough degree of freedom
|
||||
//! ErrorStatus != 0 means that there are not enought degree of freedom
|
||||
//! with the constrain to deform the curve accordingly
|
||||
Standard_EXPORT void MovePointAndTangent (const Standard_Real U, const Standard_Real NewValue, const Standard_Real Derivative, const Standard_Real Tolerance, const Standard_Integer StartingCondition, const Standard_Integer EndingCondition, Standard_Integer& ErrorStatus);
|
||||
|
||||
|
@@ -48,34 +48,36 @@ class Law_Composite : public Law_Function
|
||||
|
||||
public:
|
||||
|
||||
|
||||
|
||||
//! Construct an empty Law
|
||||
Standard_EXPORT Law_Composite();
|
||||
|
||||
//! Construct an empty, trimmed Law
|
||||
|
||||
//! Construct an empty, trimed Law
|
||||
Standard_EXPORT Law_Composite(const Standard_Real First, const Standard_Real Last, const Standard_Real Tol);
|
||||
|
||||
|
||||
Standard_EXPORT GeomAbs_Shape Continuity() const Standard_OVERRIDE;
|
||||
|
||||
|
||||
//! Returns the number of intervals for continuity
|
||||
//! <S>. May be one if Continuity(me) >= <S>
|
||||
Standard_EXPORT Standard_Integer NbIntervals (const GeomAbs_Shape S) const Standard_OVERRIDE;
|
||||
|
||||
//! Stores in <T> the parameters bounding the intervals of continuity <S>.
|
||||
//! The array must provide enough room to accommodate for the parameters,
|
||||
//! i.e. T.Length() > NbIntervals()
|
||||
|
||||
//! Stores in <T> the parameters bounding the intervals
|
||||
//! of continuity <S>.
|
||||
//!
|
||||
//! The array must provide enough room to accomodate
|
||||
//! for the parameters. i.e. T.Length() > NbIntervals()
|
||||
Standard_EXPORT void Intervals (TColStd_Array1OfReal& T, const GeomAbs_Shape S) const Standard_OVERRIDE;
|
||||
|
||||
|
||||
//! Returns the value at parameter X.
|
||||
Standard_EXPORT Standard_Real Value (const Standard_Real X) Standard_OVERRIDE;
|
||||
|
||||
|
||||
//! Returns the value and the first derivative at parameter X.
|
||||
Standard_EXPORT void D1 (const Standard_Real X, Standard_Real& F, Standard_Real& D) Standard_OVERRIDE;
|
||||
|
||||
|
||||
//! Returns the value, first and second derivatives
|
||||
//! at parameter X.
|
||||
Standard_EXPORT void D2 (const Standard_Real X, Standard_Real& F, Standard_Real& D, Standard_Real& D2) Standard_OVERRIDE;
|
||||
|
||||
|
||||
//! Returns a law equivalent of <me> between
|
||||
//! parameters <First> and <Last>. <Tol> is used to
|
||||
//! test for 3d points confusion.
|
||||
@@ -83,24 +85,33 @@ public:
|
||||
//! in these values <First> and <Last> if
|
||||
//! the Law is not Cn.
|
||||
Standard_EXPORT Handle(Law_Function) Trim (const Standard_Real PFirst, const Standard_Real PLast, const Standard_Real Tol) const Standard_OVERRIDE;
|
||||
|
||||
|
||||
//! Returns the parametric bounds of the function.
|
||||
Standard_EXPORT void Bounds (Standard_Real& PFirst, Standard_Real& PLast) Standard_OVERRIDE;
|
||||
|
||||
|
||||
//! Returns the elementary function of the composite used
|
||||
//! to compute at parameter W.
|
||||
Standard_EXPORT Handle(Law_Function)& ChangeElementaryLaw (const Standard_Real W);
|
||||
|
||||
|
||||
Standard_EXPORT Law_Laws& ChangeLaws();
|
||||
|
||||
|
||||
Standard_EXPORT Standard_Boolean IsPeriodic() const;
|
||||
|
||||
|
||||
Standard_EXPORT void SetPeriodic();
|
||||
|
||||
|
||||
|
||||
|
||||
DEFINE_STANDARD_RTTIEXT(Law_Composite,Law_Function)
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
||||
//! Set the current function.
|
||||
Standard_EXPORT void Prepare (Standard_Real& W);
|
||||
|
||||
@@ -113,6 +124,13 @@ private:
|
||||
Standard_Real TLast;
|
||||
Standard_Real PTol;
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // _Law_Composite_HeaderFile
|
||||
|
@@ -44,9 +44,11 @@ public:
|
||||
//! <S>. May be one if Continuity(me) >= <S>
|
||||
Standard_EXPORT virtual Standard_Integer NbIntervals (const GeomAbs_Shape S) const = 0;
|
||||
|
||||
//! Stores in <T> the parameters bounding the intervals of continuity <S>.
|
||||
//! The array must provide enough room to accommodate for the parameters,
|
||||
//! i.e. T.Length() > NbIntervals()
|
||||
//! Stores in <T> the parameters bounding the intervals
|
||||
//! of continuity <S>.
|
||||
//!
|
||||
//! The array must provide enough room to accomodate
|
||||
//! for the parameters. i.e. T.Length() > NbIntervals()
|
||||
Standard_EXPORT virtual void Intervals (TColStd_Array1OfReal& T, const GeomAbs_Shape S) const = 0;
|
||||
|
||||
//! Returns the value of the function at the point of parameter X.
|
||||
|
@@ -50,6 +50,7 @@ LocOpe_SequenceOfLin.hxx
|
||||
LocOpe_SequenceOfPntFace.hxx
|
||||
LocOpe_SplitDrafts.cxx
|
||||
LocOpe_SplitDrafts.hxx
|
||||
LocOpe_SplitDrafts.lxx
|
||||
LocOpe_Spliter.cxx
|
||||
LocOpe_Spliter.hxx
|
||||
LocOpe_Spliter.lxx
|
||||
|
@@ -78,7 +78,7 @@ public:
|
||||
|
||||
//! On the element of range <I>, searches the first
|
||||
//! intersection point located after the parameter
|
||||
//! <From>, which orientation is not TopAbs_EXTERNAL.
|
||||
//! <From>, wich orientation is not TopAbs_EXTERNAL.
|
||||
//! If found, returns <Standard_True>. <Or> contains
|
||||
//! the orientation of the point, <IndFrom> and
|
||||
//! <IndTo> represents the interval of index in the
|
||||
@@ -91,7 +91,7 @@ public:
|
||||
|
||||
//! On the element of range <I>, searches the first
|
||||
//! intersection point located before the parameter
|
||||
//! <From>, which orientation is not TopAbs_EXTERNAL.
|
||||
//! <From>, wich orientation is not TopAbs_EXTERNAL.
|
||||
//! If found, returns <Standard_True>. <Or> contains
|
||||
//! the orientation of the point, <IndFrom> and
|
||||
//! <IndTo> represents the interval of index in the
|
||||
@@ -104,7 +104,7 @@ public:
|
||||
|
||||
//! On the element of range <I>, searches the first
|
||||
//! intersection point located after the index
|
||||
//! <FromInd> ( >= FromInd + 1), which orientation is
|
||||
//! <FromInd> ( >= FromInd + 1), wich orientation is
|
||||
//! not TopAbs_EXTERNAL. If found, returns
|
||||
//! <Standard_True>. <Or> contains the orientation of
|
||||
//! the point, <IndFrom> and <IndTo> represents the
|
||||
@@ -118,7 +118,7 @@ public:
|
||||
|
||||
//! On the element of range <I>, searches the first
|
||||
//! intersection point located before the index
|
||||
//! <FromInd> ( <= FromInd -1), which orientation is
|
||||
//! <FromInd> ( <= FromInd -1), wich orientation is
|
||||
//! not TopAbs_EXTERNAL. If found, returns
|
||||
//! <Standard_True>. <Or> contains the orientation of
|
||||
//! the point, <IndFrom> and <IndTo> represents the
|
||||
|
@@ -75,7 +75,7 @@ public:
|
||||
const LocOpe_PntFace& Point (const Standard_Integer Index) const;
|
||||
|
||||
//! Searches the first intersection point located
|
||||
//! after the parameter <From>, which orientation is
|
||||
//! after the parameter <From>, wich orientation is
|
||||
//! not TopAbs_EXTERNAL. If found, returns
|
||||
//! <Standard_True>. <Or> contains the orientation of
|
||||
//! the point, <IndFrom> and <IndTo> represents the
|
||||
@@ -87,7 +87,7 @@ public:
|
||||
Standard_EXPORT Standard_Boolean LocalizeAfter (const Standard_Real From, TopAbs_Orientation& Or, Standard_Integer& IndFrom, Standard_Integer& IndTo) const;
|
||||
|
||||
//! Searches the first intersection point located
|
||||
//! before the parameter <From>, which orientation is
|
||||
//! before the parameter <From>, wich orientation is
|
||||
//! not TopAbs_EXTERNAL. If found, returns
|
||||
//! <Standard_True>. <Or> contains the orientation of
|
||||
//! the point, <IndFrom> and <IndTo> represents the
|
||||
@@ -99,7 +99,7 @@ public:
|
||||
Standard_EXPORT Standard_Boolean LocalizeBefore (const Standard_Real From, TopAbs_Orientation& Or, Standard_Integer& IndFrom, Standard_Integer& IndTo) const;
|
||||
|
||||
//! Searches the first intersection point located
|
||||
//! after the index <FromInd> ( >= FromInd + 1), which
|
||||
//! after the index <FromInd> ( >= FromInd + 1), wich
|
||||
//! orientation is not TopAbs_EXTERNAL. If found,
|
||||
//! returns <Standard_True>. <Or> contains the
|
||||
//! orientation of the point, <IndFrom> and <IndTo>
|
||||
@@ -111,7 +111,7 @@ public:
|
||||
Standard_EXPORT Standard_Boolean LocalizeAfter (const Standard_Integer FromInd, TopAbs_Orientation& Or, Standard_Integer& IndFrom, Standard_Integer& IndTo) const;
|
||||
|
||||
//! Searches the first intersection point located
|
||||
//! before the index <FromInd> ( <= FromInd -1), which
|
||||
//! before the index <FromInd> ( <= FromInd -1), wich
|
||||
//! orientation is not TopAbs_EXTERNAL. If found,
|
||||
//! returns <Standard_True>. <Or> contains the
|
||||
//! orientation of the point, <IndFrom> and <IndTo>
|
||||
|
@@ -14,7 +14,7 @@
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#include <LocOpe_Generator.hxx>
|
||||
// Modifed: Portage NT 7-5-97 DPF (return NewParameter)
|
||||
|
||||
#include <BRep_Builder.hxx>
|
||||
#include <BRep_Tool.hxx>
|
||||
@@ -35,6 +35,7 @@
|
||||
#include <gp_Pln.hxx>
|
||||
#include <LocOpe_BuildShape.hxx>
|
||||
#include <LocOpe_GeneratedShape.hxx>
|
||||
#include <LocOpe_Generator.hxx>
|
||||
#include <Precision.hxx>
|
||||
#include <Standard_NoSuchObject.hxx>
|
||||
#include <Standard_NullObject.hxx>
|
||||
|
@@ -20,16 +20,23 @@
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_DefineAlloc.hxx>
|
||||
#include <Standard_Handle.hxx>
|
||||
#include <Standard_Real.hxx>
|
||||
|
||||
#include <TopoDS_Shape.hxx>
|
||||
#include <TopTools_DataMapOfShapeListOfShape.hxx>
|
||||
#include <Standard_Real.hxx>
|
||||
#include <Standard_Boolean.hxx>
|
||||
#include <TopTools_ListOfShape.hxx>
|
||||
|
||||
class StdFail_NotDone;
|
||||
class Standard_NoSuchObject;
|
||||
class Standard_ConstructionError;
|
||||
class Standard_NullObject;
|
||||
class TopoDS_Shape;
|
||||
class TopoDS_Face;
|
||||
class TopoDS_Wire;
|
||||
class gp_Dir;
|
||||
class gp_Pln;
|
||||
|
||||
|
||||
//! This class provides a tool to realize the
|
||||
//! following operations on a shape :
|
||||
//! - split a face of the shape with a wire,
|
||||
@@ -41,13 +48,14 @@ public:
|
||||
|
||||
DEFINE_STANDARD_ALLOC
|
||||
|
||||
//! Empty constructor.
|
||||
LocOpe_SplitDrafts() {}
|
||||
|
||||
//! Creates the algorithm on the shape <S>.
|
||||
LocOpe_SplitDrafts(const TopoDS_Shape& S) : myShape (S) {}
|
||||
|
||||
//! Initializes the algorithm with the shape <S>.
|
||||
//! Empty constructor.
|
||||
LocOpe_SplitDrafts();
|
||||
|
||||
//! Creates the algoritm on the shape <S>.
|
||||
LocOpe_SplitDrafts(const TopoDS_Shape& S);
|
||||
|
||||
//! Initializes the algoritm with the shape <S>.
|
||||
Standard_EXPORT void Init (const TopoDS_Shape& S);
|
||||
|
||||
//! Splits the face <F> of the former given shape with
|
||||
@@ -77,23 +85,43 @@ public:
|
||||
//! angle.
|
||||
Standard_EXPORT void Perform (const TopoDS_Face& F, const TopoDS_Wire& W, const gp_Dir& Extract, const gp_Pln& NPl, const Standard_Real Angle);
|
||||
|
||||
//! Returns <Standard_True> if the modification has been successfully performed.
|
||||
Standard_Boolean IsDone() const { return !myResult.IsNull(); }
|
||||
|
||||
const TopoDS_Shape& OriginalShape() const { return myShape; }
|
||||
|
||||
//! Returns <Standard_True> if the modification has
|
||||
//! been succesfully performed.
|
||||
Standard_Boolean IsDone() const;
|
||||
|
||||
const TopoDS_Shape& OriginalShape() const;
|
||||
|
||||
//! Returns the modified shape.
|
||||
Standard_EXPORT const TopoDS_Shape& Shape() const;
|
||||
|
||||
|
||||
//! Manages the descendant shapes.
|
||||
Standard_EXPORT const TopTools_ListOfShape& ShapesFromShape (const TopoDS_Shape& S) const;
|
||||
|
||||
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
||||
|
||||
TopoDS_Shape myShape;
|
||||
TopoDS_Shape myResult;
|
||||
TopTools_DataMapOfShapeListOfShape myMap;
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
#include <LocOpe_SplitDrafts.lxx>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // _LocOpe_SplitDrafts_HeaderFile
|
||||
|
54
src/LocOpe/LocOpe_SplitDrafts.lxx
Normal file
54
src/LocOpe/LocOpe_SplitDrafts.lxx
Normal file
@@ -0,0 +1,54 @@
|
||||
// Created on: 1996-10-02
|
||||
// Created by: Jacques GOUSSARD
|
||||
// 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.
|
||||
|
||||
//=======================================================================
|
||||
//function : LocOpe_SplitDrafts
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
inline LocOpe_SplitDrafts::LocOpe_SplitDrafts ()
|
||||
{}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : LocOpe_SplitDrafts
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
inline LocOpe_SplitDrafts::LocOpe_SplitDrafts (const TopoDS_Shape& S):
|
||||
myShape(S)
|
||||
{}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : IsDone
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
inline Standard_Boolean LocOpe_SplitDrafts::IsDone() const
|
||||
{
|
||||
return (!myResult.IsNull());
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : OriginalShape
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
inline const TopoDS_Shape& LocOpe_SplitDrafts::OriginalShape () const
|
||||
{
|
||||
return myShape;
|
||||
}
|
@@ -53,7 +53,7 @@ public:
|
||||
Standard_EXPORT void Init (const TopoDS_Shape& S);
|
||||
|
||||
//! Add splitting edges or wires for whole initial shape
|
||||
//! without additional specification edge->face, edge->edge
|
||||
//! withot additional specification edge->face, edge->edge
|
||||
//! This method puts edge on the corresponding faces from initial shape
|
||||
Standard_EXPORT Standard_Boolean Add(const TopTools_SequenceOfShape& theEdges);
|
||||
|
||||
|
@@ -20,13 +20,15 @@
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_DefineAlloc.hxx>
|
||||
#include <Standard_Handle.hxx>
|
||||
#include <Standard_OStream.hxx>
|
||||
|
||||
#include <Standard_OStream.hxx>
|
||||
class LocalAnalysis_SurfaceContinuity;
|
||||
class LocalAnalysis_CurveContinuity;
|
||||
class LocalAnalysis_SurfaceContinuity;
|
||||
class LocalAnalysis_CurveContinuity;
|
||||
|
||||
|
||||
|
||||
//! This package gives tools to check the local continuity
|
||||
//! between two points situated on two curves or two surfaces.
|
||||
class LocalAnalysis
|
||||
@@ -35,21 +37,42 @@ public:
|
||||
|
||||
DEFINE_STANDARD_ALLOC
|
||||
|
||||
//! This class compute s and gives tools to check the local
|
||||
//! continuity between two points situated on 2 curves.
|
||||
|
||||
|
||||
//! This class compute
|
||||
//! s and gives tools to check the local
|
||||
//! continuity between two points situated on 2 curves)
|
||||
//!
|
||||
//! This function gives information about a variable CurveContinuity
|
||||
//! This fonction gives informations about a variable CurveContinuity
|
||||
Standard_EXPORT static void Dump (const LocalAnalysis_SurfaceContinuity& surfconti, Standard_OStream& o);
|
||||
|
||||
|
||||
//! This function gives information about a variable SurfaceContinuity
|
||||
//! This fonction gives informations about a variable SurfaceContinuity
|
||||
Standard_EXPORT static void Dump (const LocalAnalysis_CurveContinuity& curvconti, Standard_OStream& o);
|
||||
|
||||
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
||||
|
||||
|
||||
friend class LocalAnalysis_SurfaceContinuity;
|
||||
friend class LocalAnalysis_CurveContinuity;
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // _LocalAnalysis_HeaderFile
|
||||
|
@@ -734,30 +734,19 @@ static Standard_Integer trianglesinfo (Draw_Interpretor& theDI, Standard_Integer
|
||||
aDynTypeCounter = &aStats->TypeMap.ChangeFromIndex (aNewIndex);
|
||||
}
|
||||
(*aDynTypeCounter)++;
|
||||
aStats->NbTriangles += aLOD->NbTriangles();
|
||||
if (aLOD->HasDeferredData())
|
||||
{
|
||||
aStats->NbDeferredFaces++;
|
||||
if (aLOD->HasGeometry())
|
||||
{
|
||||
aStats->NbTriangles += aLOD->NbTriangles();
|
||||
}
|
||||
else
|
||||
if (!aLOD->HasGeometry())
|
||||
{
|
||||
aStats->NbUnloadedFaces++;
|
||||
aStats->NbTriangles += aLOD->NbDeferredTriangles();
|
||||
aStats->NbUnloadedTriangles += aLOD->NbDeferredTriangles();
|
||||
}
|
||||
}
|
||||
else
|
||||
else if (!aLOD->HasGeometry())
|
||||
{
|
||||
if (aLOD->HasGeometry())
|
||||
{
|
||||
aStats->NbTriangles += aLOD->NbTriangles();
|
||||
}
|
||||
else
|
||||
{
|
||||
aStats->NbEmptyFaces++;
|
||||
}
|
||||
aStats->NbEmptyFaces++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -60,10 +60,10 @@ public:
|
||||
//! Returns geometry information about node or element
|
||||
//! ID is the numerical identificator of node or element
|
||||
//! IsElement indicates this ID describe node ( if Standard_False ) or element ( if Standard_True )
|
||||
//! Coords is an array of coordinates of node(s).
|
||||
//! Coords is an array of co-ordinates of node(s).
|
||||
//! For node it is only 3 numbers: X, Y, Z in the strict order
|
||||
//! For element it is 3*n numbers, where n is number of this element vertices
|
||||
//! The order is strict also: X1, Y1, Z1, X2,...., where Xi, Yi, Zi are coordinates of vertices
|
||||
//! The order is strict also: X1, Y1, Z1, X2,...., where Xi, Yi, Zi are co-ordinates of vertices
|
||||
//! NbNodes is number of nodes. It is recommended this parameter to be set to 1 for node.
|
||||
//! Type is type of node or element (from enumeration). It is recommended this parameter to be set to
|
||||
//! MeshVS_ET_Node for node.
|
||||
@@ -101,7 +101,7 @@ public:
|
||||
//! There is default method, for advance reflection this method can be redefined.
|
||||
//! Id is the numerical identificator of only element!
|
||||
//! Max is maximal number of nodes an element can consist of
|
||||
//! nx, ny, nz are values whose represent coordinates of normal (will be returned)
|
||||
//! nx, ny, nz are values whose represent co-ordinates of normal (will be returned)
|
||||
//! In the redefined method you can return normal with length more then 1, but in this case
|
||||
//! the appearance of element will be more bright than usual. For ordinary brightness you must return
|
||||
//! normal with length 1
|
||||
@@ -160,7 +160,7 @@ public:
|
||||
|
||||
//! Returns maps of entities (nodes and elements) detected
|
||||
//! by mouse selection with rectangular box (XMin, YMin, XMax, YMax)
|
||||
//! on the current view plane, with the tolerance aTol.
|
||||
//! on the current veiw plane, with the tolerance aTol.
|
||||
//! Returns True if something is detected.
|
||||
//! It should be redefined if the advanced mesh selection is
|
||||
//! activated. Default implementation returns False.
|
||||
@@ -168,7 +168,7 @@ public:
|
||||
|
||||
//! Returns maps of entities (nodes and elements) detected
|
||||
//! by mouse selection with the polyline <Polyline>
|
||||
//! on the current view plane, with the tolerance aTol.
|
||||
//! on the current veiw plane, with the tolerance aTol.
|
||||
//! Returns True if something is detected.
|
||||
//! It should be redefined if the advanced mesh selection is
|
||||
//! activated. Default implementation returns False.
|
||||
@@ -182,8 +182,27 @@ public:
|
||||
//! activated. Default implementation returns False.
|
||||
Standard_EXPORT virtual Standard_Boolean GetDetectedEntities (const Handle(MeshVS_Mesh)& Prs, Handle(TColStd_HPackedMapOfInteger)& Nodes, Handle(TColStd_HPackedMapOfInteger)& Elements);
|
||||
|
||||
|
||||
|
||||
|
||||
DEFINE_STANDARD_RTTIEXT(MeshVS_DataSource,Standard_Transient)
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // _MeshVS_DataSource_HeaderFile
|
||||
|
@@ -39,6 +39,7 @@ class MeshVS_MeshPrsBuilder : public MeshVS_PrsBuilder
|
||||
|
||||
public:
|
||||
|
||||
|
||||
//! Creates builder with certain display mode flags, data source, ID and priority
|
||||
Standard_EXPORT MeshVS_MeshPrsBuilder(const Handle(MeshVS_Mesh)& Parent, const MeshVS_DisplayModeFlags& Flags = MeshVS_DMF_OCCMask, const Handle(MeshVS_DataSource)& DS = 0, const Standard_Integer Id = -1, const MeshVS_BuilderPriority& Priority = MeshVS_BP_Mesh);
|
||||
|
||||
@@ -60,10 +61,14 @@ public:
|
||||
//! Calculate how many polygons or polylines are necessary to draw passed topology
|
||||
Standard_EXPORT static void HowManyPrimitives (const Handle(MeshVS_HArray1OfSequenceOfInteger)& Topo, const Standard_Boolean AsPolygons, const Standard_Boolean IsSelect, const Standard_Integer NbNodes, Standard_Integer& Vertices, Standard_Integer& Bounds);
|
||||
|
||||
|
||||
|
||||
|
||||
DEFINE_STANDARD_RTTIEXT(MeshVS_MeshPrsBuilder,MeshVS_PrsBuilder)
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
//! Add to array of polylines some lines representing link
|
||||
Standard_EXPORT void AddLinkPrs (const TColStd_Array1OfReal& theCoords, const Handle(Graphic3d_ArrayOfSegments)& theLines, const Standard_Boolean IsShrinked, const Standard_Real ShrinkCoef) const;
|
||||
|
||||
@@ -75,13 +80,26 @@ protected:
|
||||
|
||||
//! Draw array of polygons and polylines in the certain order according to transparency
|
||||
Standard_EXPORT void DrawArrays (const Handle(Prs3d_Presentation)& Prs, const Handle(Graphic3d_ArrayOfPrimitives)& thePolygons, const Handle(Graphic3d_ArrayOfPrimitives)& theLines, const Handle(Graphic3d_ArrayOfPrimitives)& theLinkLines, const Handle(Graphic3d_ArrayOfPrimitives)& theVolumesInShad, const Standard_Boolean IsPolygonsEdgesOff, const Standard_Boolean IsSelected, const Handle(Graphic3d_AspectFillArea3d)& theFillAsp, const Handle(Graphic3d_AspectLine3d)& theLineAsp) const;
|
||||
|
||||
|
||||
//! Default calculation of center of face or link. This method if useful for shrink mode presentation
|
||||
//! theCoords is array of nodes coordinates in the strict order X1, Y1, Z1, X2...
|
||||
//! theCoords is array of nodes co-ordinates in the strict order X1, Y1, Z1, X2...
|
||||
//! NbNodes is number of nodes an element consist of
|
||||
//! xG, yG, zG are coordinates of center whose will be returned
|
||||
//! xG, yG, zG are co-ordinates of center whose will be returned
|
||||
Standard_EXPORT static void CalculateCenter (const TColStd_Array1OfReal& theCoords, const Standard_Integer NbNodes, Standard_Real& xG, Standard_Real& yG, Standard_Real& zG);
|
||||
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // _MeshVS_MeshPrsBuilder_HeaderFile
|
||||
|
@@ -76,7 +76,7 @@ public:
|
||||
static void StopAlert (const Handle(Message_AlertExtended)& theAlert) { SetAlertMetrics (theAlert, Standard_False); }
|
||||
|
||||
//! Sets current values of default report metrics into the alert.
|
||||
//! Processed only alert with Message_AttributeMeter attribute
|
||||
//! Processed oly alert with Message_AttributeMeter attribute
|
||||
//! @param theAlert an alert
|
||||
//! @param theStartValue flag, if true, the start value is collected otherwise stop
|
||||
static Standard_EXPORT void SetAlertMetrics (const Handle(Message_AlertExtended)& theAlert,
|
||||
|
@@ -56,6 +56,7 @@ public:
|
||||
|
||||
DEFINE_STANDARD_ALLOC
|
||||
|
||||
|
||||
//! Load message file <theFileName> from directory <theDirName>
|
||||
//! or its sub-directory
|
||||
Standard_EXPORT static Standard_Boolean Load (const Standard_CString theDirName, const Standard_CString theFileName);
|
||||
@@ -95,13 +96,36 @@ public:
|
||||
|
||||
Standard_EXPORT static const TCollection_ExtendedString& Msg (const Standard_CString key);
|
||||
|
||||
//! Gives the text for the message identified by the keyword <key>.
|
||||
//! If there are no messages with such keyword defined, the error message is returned.
|
||||
//! In that case reference to static string is returned, it can be changed with next call(s) to Msg().
|
||||
//! Gives the text for the message identified by the keyword <key>
|
||||
//! If there are no messages with such keyword defined,
|
||||
//! the error message is returned.
|
||||
//! In that case reference to static string is returned, it can
|
||||
//! be chenged with next call(s) to Msg().
|
||||
//! Note: The error message is constructed like 'Unknown message: <key>', and can
|
||||
//! itself be customized by defining message with key Message_Msg_BadKeyword.
|
||||
Standard_EXPORT static const TCollection_ExtendedString& Msg (const TCollection_AsciiString& key);
|
||||
|
||||
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // _Message_MsgFile_HeaderFile
|
||||
|
@@ -23,28 +23,36 @@
|
||||
#include <NCollection_DefineAlloc.hxx>
|
||||
#include <NCollection_StlIterator.hxx>
|
||||
|
||||
//! The class NCollection_Array1 represents unidimensional arrays of fixed size known at run time.
|
||||
//! The range of the index is user defined.
|
||||
//! An array1 can be constructed with a "C array".
|
||||
//! This functionality is useful to call methods expecting an Array1.
|
||||
//! It allows to carry the bounds inside the arrays.
|
||||
//!
|
||||
//! Examples:
|
||||
//! @code
|
||||
//! Item tab[100]; // an example with a C array
|
||||
//! NCollection_Array1<Item> ttab (tab[0], 1, 100);
|
||||
//!
|
||||
//! NCollection_Array1<Item> tttab (ttab(10), 10, 20); // a slice of ttab
|
||||
//! @endcode
|
||||
//! If you want to reindex an array from 1 to Length do:
|
||||
//! @code
|
||||
//! NCollection_Array1<Item> tab1 (tab (tab.Lower()), 1, tab.Length());
|
||||
//! @endcode
|
||||
//! Warning: Programs client of such a class must be independent of the range of the first element.
|
||||
//! Then, a C++ for loop must be written like this
|
||||
//! @code
|
||||
//! for (i = A.Lower(); i <= A.Upper(); i++)
|
||||
//! @endcode
|
||||
// *********************************************** Template for Array1 class
|
||||
|
||||
/**
|
||||
* Purpose: The class Array1 represents unidimensional arrays
|
||||
* of fixed size known at run time.
|
||||
* The range of the index is user defined.
|
||||
* An array1 can be constructed with a "C array".
|
||||
* This functionality is useful to call methods expecting
|
||||
* an Array1. It allows to carry the bounds inside the arrays.
|
||||
*
|
||||
* Examples: Item tab[100]; // An example with a C array
|
||||
* Array1OfItem ttab (tab[0],1,100);
|
||||
*
|
||||
* Array1OfItem tttab (ttab(10),10,20); // a slice of ttab
|
||||
*
|
||||
* If you want to reindex an array from 1 to Length do :
|
||||
*
|
||||
* Array1 tab1(tab(tab.Lower()),1,tab.Length());
|
||||
*
|
||||
* Warning: Programs client of such a class must be independant
|
||||
* of the range of the first element. Then, a C++ for
|
||||
* loop must be written like this
|
||||
*
|
||||
* for (i = A.Lower(); i <= A.Upper(); i++)
|
||||
*
|
||||
* Changes: In comparison to TCollection the flag isAllocated was
|
||||
* renamed into myDeletable (alike in the Array2). For naming
|
||||
* compatibility the method IsAllocated remained in class along
|
||||
* with IsDeletable.
|
||||
*/
|
||||
template <class TheItemType>
|
||||
class NCollection_Array1
|
||||
{
|
||||
|
@@ -21,13 +21,15 @@ proc Draw:toolkits { } {
|
||||
if { [info exists ::env(HAVE_GLES2)] && "$::env(HAVE_GLES2)" == "true" } {
|
||||
lappend aResult "TKOpenGlesTest"
|
||||
}
|
||||
|
||||
if { [info exists ::env(HAVE_D3D)] } {
|
||||
if { "$::env(HAVE_D3D)" == "true" } {
|
||||
if { "$::tcl_platform(platform)" == "windows" } {
|
||||
if { [info exists ::env(HAVE_D3D)] } {
|
||||
if { "$::env(HAVE_D3D)" == "true" } {
|
||||
lappend aResult "TKD3DHostTest"
|
||||
}
|
||||
} elseif { [info exists ::env(VCVER)] && "$::env(VCVER)" != "vc8" && "$::env(VCVER)" != "vc9" && "$::env(VCVER)" != "vc10" } {
|
||||
lappend aResult "TKD3DHostTest"
|
||||
}
|
||||
}
|
||||
|
||||
if { [info exists ::env(HAVE_VTK)] && "$::env(HAVE_VTK)" == "true" } {
|
||||
lappend aResult "TKIVtkDraw"
|
||||
}
|
||||
|
@@ -21,13 +21,15 @@ proc Visualization:toolkits { } {
|
||||
if { [info exists ::env(HAVE_GLES2)] && "$::env(HAVE_GLES2)" == "true" } {
|
||||
lappend aResult "TKOpenGles"
|
||||
}
|
||||
|
||||
if { [info exists ::env(HAVE_D3D)] } {
|
||||
if { "$::env(HAVE_D3D)" == "true" } {
|
||||
if { "$::tcl_platform(platform)" == "windows" } {
|
||||
if { [info exists ::env(HAVE_D3D)] } {
|
||||
if { "$::env(HAVE_D3D)" == "true" } {
|
||||
lappend aResult "TKD3DHost"
|
||||
}
|
||||
} elseif { [info exists ::env(VCVER)] && "$::env(VCVER)" != "vc8" && "$::env(VCVER)" != "vc9" && "$::env(VCVER)" != "vc10" } {
|
||||
lappend aResult "TKD3DHost"
|
||||
}
|
||||
}
|
||||
|
||||
if { [info exists ::env(HAVE_VTK)] && "$::env(HAVE_VTK)" == "true" } {
|
||||
lappend aResult "TKIVtk"
|
||||
}
|
||||
|
@@ -14,10 +14,10 @@
|
||||
|
||||
#include <OSD.hxx>
|
||||
|
||||
//=======================================================================
|
||||
//function : RealToCString
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
// Convert Real to CString in format e with 16 significant digits.
|
||||
// The decimal point character is always a period.
|
||||
// The conversion is independant from current locale database
|
||||
|
||||
Standard_Boolean OSD::RealToCString(const Standard_Real aReal,
|
||||
Standard_PCharacter& aString)
|
||||
{
|
||||
|
@@ -19,8 +19,8 @@
|
||||
#include <Standard_PCharacter.hxx>
|
||||
#include <OSD_SignalMode.hxx>
|
||||
|
||||
//! Set of Operating System Dependent (OSD) tools.
|
||||
class OSD
|
||||
//! Set of Operating Sytem Dependent (OSD) Tools
|
||||
class OSD
|
||||
{
|
||||
public:
|
||||
|
||||
@@ -118,17 +118,17 @@ public:
|
||||
//! Commands the process to sleep for a number of milliseconds
|
||||
Standard_EXPORT static void MilliSecSleep (const Standard_Integer theMilliseconds);
|
||||
|
||||
//! Converts aReal into aCstring in exponential format with a period as decimal point,
|
||||
//! no thousand separator and no grouping of digits.
|
||||
//! The conversion is independent from the current locale
|
||||
//! Converts aReal into aCstring in exponential format with a period as
|
||||
//! decimal point, no thousand separator and no grouping of digits.
|
||||
//! The conversion is independant from the current locale
|
||||
Standard_EXPORT static Standard_Boolean RealToCString (const Standard_Real aReal, Standard_PCharacter& aString);
|
||||
|
||||
//! Converts aCstring representing a real with a period as decimal point,
|
||||
//! no thousand separator and no grouping of digits into aReal.
|
||||
//!
|
||||
//! The conversion is independent from the current locale.
|
||||
//! Converts aCstring representing a real with a period as
|
||||
//! decimal point, no thousand separator and no grouping of digits
|
||||
//! into aReal .
|
||||
//! The conversion is independant from the current locale.
|
||||
Standard_EXPORT static Standard_Boolean CStringToReal (const Standard_CString aString, Standard_Real& aReal);
|
||||
|
||||
|
||||
//! since Windows NT does not support 'SIGINT' signal like UNIX,
|
||||
//! then this method checks whether Ctrl-Break keystroke was or
|
||||
//! not. If yes then raises Exception_CTRL_BREAK.
|
||||
|
@@ -31,7 +31,7 @@ public:
|
||||
public:
|
||||
|
||||
//! Creates Directory object.
|
||||
//! It is initialized to an empty name.
|
||||
//! It is initiliazed to an empty name.
|
||||
Standard_EXPORT OSD_Directory();
|
||||
|
||||
//! Creates Directory object initialized with theName.
|
||||
|
@@ -289,7 +289,7 @@ TCollection_AsciiString OSD_Environment::Value()
|
||||
|
||||
// msvc C-runtime (_wputenv()) puts variable using WinAPI internally (calls SetEnvironmentVariableW())
|
||||
// and also caches its value in its own map,
|
||||
// so that _wgetenv() ignores WinAPI and retrieves variable from this cache.
|
||||
// so that _wgetenv() ignores WinAPI and retieves variable from this cache.
|
||||
//
|
||||
// Using _wgetenv() might lead to awkward results in context when several C-runtimes are used
|
||||
// at once within application or WinAPI is used directly for setting environment variable.
|
||||
|
@@ -57,7 +57,7 @@ public:
|
||||
//! Changes environment variable value.
|
||||
//! Raises ConstructionError either if the string contains
|
||||
//! characters not in range of ' '...'~' or if the string
|
||||
//! contains the character '$' which is forbidden.
|
||||
//! contains the character '$' which is forbiden.
|
||||
Standard_EXPORT void SetValue (const TCollection_AsciiString& Value);
|
||||
|
||||
//! Gets the value of an environment variable
|
||||
@@ -66,7 +66,7 @@ public:
|
||||
//! Changes environment variable name.
|
||||
//! Raises ConstructionError either if the string contains
|
||||
//! characters not in range of ' '...'~' or if the string
|
||||
//! contains the character '$' which is forbidden.
|
||||
//! contains the character '$' which is forbiden.
|
||||
Standard_EXPORT void SetName (const TCollection_AsciiString& name);
|
||||
|
||||
//! Gets the name of <me>.
|
||||
|
@@ -159,7 +159,7 @@ public:
|
||||
Standard_EXPORT Standard_Boolean IsOpen() const;
|
||||
|
||||
//! returns TRUE if the file exists and if the user
|
||||
//! has the authorization to read it.
|
||||
//! has the autorization to read it.
|
||||
Standard_EXPORT Standard_Boolean IsReadable();
|
||||
|
||||
//! returns TRUE if the file can be read and overwritten.
|
||||
@@ -170,7 +170,7 @@ public:
|
||||
|
||||
//! Enables to emulate unix "tail -f" command.
|
||||
//! If a line is available in the file <me> returns it.
|
||||
//! Otherwise attempts to read again aNbTries times in the file
|
||||
//! Otherwise attemps to read again aNbTries times in the file
|
||||
//! waiting aDelay seconds between each read.
|
||||
//! If meanwhile the file increases returns the next line, otherwise
|
||||
//! returns FALSE.
|
||||
|
@@ -295,7 +295,7 @@ Quantity_Date OSD_FileNode::CreationMoment(){
|
||||
|
||||
// if (Failed()) Perror();
|
||||
|
||||
/* Get File Information */
|
||||
/* Get File Informations */
|
||||
|
||||
TCollection_AsciiString aBuffer;
|
||||
myPath.SystemName ( aBuffer );
|
||||
@@ -323,7 +323,7 @@ Quantity_Date OSD_FileNode::AccessMoment(){
|
||||
|
||||
// if (Failed()) Perror();
|
||||
|
||||
/* Get File Information */
|
||||
/* Get File Informations */
|
||||
|
||||
TCollection_AsciiString aBuffer;
|
||||
myPath.SystemName ( aBuffer );
|
||||
|
@@ -39,7 +39,7 @@ public:
|
||||
//! Default implementation create a stream from file buffer returned by OSD_FileSystem::OpenFileBuffer().
|
||||
//! @param theUrl [in] path to open
|
||||
//! @param theMode [in] flags describing the requested input mode for the stream (std::ios_base::in will be implicitly added)
|
||||
//! @param theOffset [in] expected stream position from the beginning of the file (beginning of the stream by default);
|
||||
//! @param theOffset [in] expected stream position from the begining of the file (beginning of the stream by default);
|
||||
//! -1 would keep seek position undefined (in case of re-using theOldStream)
|
||||
//! @param theOldStream [in] a pointer to existing stream pointing to theUrl to be reused (without re-opening)
|
||||
//! @return pointer to newly created opened stream, to theOldStream if it can be reused or NULL in case of failure.
|
||||
@@ -52,7 +52,7 @@ public:
|
||||
//! Opens stream buffer for specified file URL.
|
||||
//! @param theUrl [in] path to open
|
||||
//! @param theMode [in] flags describing the requested input mode for the stream
|
||||
//! @param theOffset [in] expected stream position from the beginning of the buffer (beginning of the stream buffer by default)
|
||||
//! @param theOffset [in] expected stream position from the begining of the buffer (beginning of the stream buffer by default)
|
||||
//! @param theOutBufSize [out] total buffer size (only if buffer is opened for read)
|
||||
//! @return pointer to newly created opened stream buffer or NULL in case of failure.
|
||||
virtual opencascade::std::shared_ptr<std::streambuf> OpenStreamBuffer (const TCollection_AsciiString& theUrl,
|
||||
|
@@ -142,7 +142,7 @@ public:
|
||||
Standard_Mutex myMutex; //!< used for thread-safe access
|
||||
Numbers* myArray; //!< indexed from 0 to myMaxAllocSize-1
|
||||
ptrdiff_t myTotalLeftSize; //!< currently remained allocated size
|
||||
size_t myTotalPeakSize; //!< maximum cumulative allocated size
|
||||
size_t myTotalPeakSize; //!< maxium cumulative allocated size
|
||||
size_t myBreakSize; //!< user defined allocation size to debug (see place_for_breakpoint())
|
||||
size_t myBreakPeak; //!< user defined peak size limit to debug
|
||||
};
|
||||
|
@@ -205,7 +205,7 @@ void OSD_Parallel::SetUseOcctThreads (Standard_Boolean theToUseOcct)
|
||||
|
||||
//=======================================================================
|
||||
//function : NbLogicalProcessors
|
||||
//purpose : Returns number of logical processors.
|
||||
//purpose : Returns number of logical proccessors.
|
||||
//=======================================================================
|
||||
Standard_Integer OSD_Parallel::NbLogicalProcessors()
|
||||
{
|
||||
|
@@ -187,7 +187,7 @@ protected:
|
||||
};
|
||||
|
||||
//! Interface class representing functor object.
|
||||
//! Intended to add polymorphic behaviour to For and ForEach functionality
|
||||
//! Intended to add polymorphic behavour to For and ForEach functionality
|
||||
//! enabling execution of arbitrary function in parallel mode.
|
||||
class FunctorInterface
|
||||
{
|
||||
|
@@ -76,7 +76,7 @@ namespace
|
||||
|
||||
private: //! @name private fields
|
||||
|
||||
const OSD_Parallel::UniversalIterator& myBegin; //!< First element of range.
|
||||
const OSD_Parallel::UniversalIterator& myBegin; //!< Fisrt element of range.
|
||||
const OSD_Parallel::UniversalIterator& myEnd; //!< Last element of range.
|
||||
mutable OSD_Parallel::UniversalIterator myIt; //!< First non processed element of range.
|
||||
mutable Standard_Mutex myMutex; //!< Access controller for the first non processed element.
|
||||
|
@@ -298,7 +298,7 @@ static void MacExtract(const TCollection_AsciiString& what,
|
||||
Standard_Integer pos;
|
||||
Standard_PCharacter p;
|
||||
|
||||
// I don't know how to distinguish a disk from a trek !
|
||||
// I don't know how to distingish a disk from a trek !
|
||||
|
||||
trek = what;
|
||||
|
||||
@@ -612,7 +612,7 @@ static void P2DOS (TCollection_AsciiString & Way){
|
||||
|
||||
|
||||
|
||||
// Convert a path to system dependent syntax
|
||||
// Convert a path to system dependant syntax
|
||||
|
||||
void OSD_Path::SystemName (TCollection_AsciiString& FullName,
|
||||
const OSD_SysType aType)const{
|
||||
|
@@ -32,7 +32,7 @@ public:
|
||||
//! i.e. current directory.
|
||||
Standard_EXPORT OSD_Path();
|
||||
|
||||
//! Creates a Path object initialized by dependent path.
|
||||
//! Creates a Path object initialized by dependant path.
|
||||
//! ex: OSD_Path me ("/usr/bin/myprog.sh",OSD_UnixBSD);
|
||||
//!
|
||||
//! OSD_Path me ("sys$common:[syslib]cc.exe",OSD_OSF) will
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user