mirror of
https://git.salome-platform.org/gitpub/modules/geom.git
synced 2024-11-15 10:08:35 +05:00
Rollback previous incorrect integration.
This commit is contained in:
parent
242c40379f
commit
5de82fb1be
@ -39,6 +39,8 @@
|
|||||||
#include "GEOM_ShadingFace.h"
|
#include "GEOM_ShadingFace.h"
|
||||||
#include "SVTK_Actor.h"
|
#include "SVTK_Actor.h"
|
||||||
|
|
||||||
|
#include <OCC2VTK_Tools.h>
|
||||||
|
|
||||||
#include <vtkObjectFactory.h>
|
#include <vtkObjectFactory.h>
|
||||||
#include <vtkRenderer.h>
|
#include <vtkRenderer.h>
|
||||||
#include <vtkProperty.h>
|
#include <vtkProperty.h>
|
||||||
@ -47,14 +49,8 @@
|
|||||||
|
|
||||||
#include <TopAbs_ShapeEnum.hxx>
|
#include <TopAbs_ShapeEnum.hxx>
|
||||||
#include <TopExp_Explorer.hxx>
|
#include <TopExp_Explorer.hxx>
|
||||||
#include <Poly_Triangulation.hxx>
|
|
||||||
#include <BRepMesh_IncrementalMesh.hxx>
|
|
||||||
#include <Bnd_Box.hxx>
|
|
||||||
#include <TopoDS.hxx>
|
#include <TopoDS.hxx>
|
||||||
#include <BRep_Tool.hxx>
|
#include <BRep_Tool.hxx>
|
||||||
#include <BRepBndLib.hxx>
|
|
||||||
#include <TopTools_ListOfShape.hxx>
|
|
||||||
#include <TopoDS_Iterator.hxx>
|
|
||||||
#include <TopExp.hxx>
|
#include <TopExp.hxx>
|
||||||
|
|
||||||
#include <vtkPolyDataWriter.h>
|
#include <vtkPolyDataWriter.h>
|
||||||
@ -106,10 +102,7 @@ GEOM_Actor::GEOM_Actor():
|
|||||||
myHighlightProp(vtkProperty::New()),
|
myHighlightProp(vtkProperty::New()),
|
||||||
myPreHighlightProp(vtkProperty::New()),
|
myPreHighlightProp(vtkProperty::New()),
|
||||||
myShadingFaceProp(vtkProperty::New()),
|
myShadingFaceProp(vtkProperty::New()),
|
||||||
isOnlyVertex(false),
|
isOnlyVertex(false)
|
||||||
// Making deflection relative similarly to GEOM_AISShape
|
|
||||||
myDeflection( .001 ),
|
|
||||||
myIsRelative( true )
|
|
||||||
{
|
{
|
||||||
#ifdef MYDEBUG
|
#ifdef MYDEBUG
|
||||||
MESSAGE (this<< " GEOM_Actor::GEOM_Actor");
|
MESSAGE (this<< " GEOM_Actor::GEOM_Actor");
|
||||||
@ -181,6 +174,7 @@ GEOM_Actor::GEOM_Actor():
|
|||||||
|
|
||||||
// Toggle display mode
|
// Toggle display mode
|
||||||
setDisplayMode(0); // WIRE FRAME
|
setDisplayMode(0); // WIRE FRAME
|
||||||
|
SetVectorMode(0); //
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -357,39 +351,6 @@ GEOM_Actor
|
|||||||
return myVectorMode;
|
return myVectorMode;
|
||||||
}
|
}
|
||||||
|
|
||||||
static
|
|
||||||
void
|
|
||||||
MeshShape(const TopoDS_Shape& theShape,
|
|
||||||
float& theDeflection,
|
|
||||||
bool theIsRelative)
|
|
||||||
{
|
|
||||||
static Standard_Real RELATIVE_DEFLECTION = 0.0001;
|
|
||||||
Standard_Real aDeflection = theDeflection <= 0 ? RELATIVE_DEFLECTION : theDeflection;
|
|
||||||
|
|
||||||
// theDeflection <= 0 -> Compute default theDeflection
|
|
||||||
// Otherwise compute the absolute deflection on the basis of relative
|
|
||||||
if(theDeflection <= 0 || theIsRelative ){
|
|
||||||
Bnd_Box B;
|
|
||||||
BRepBndLib::Add(theShape, B);
|
|
||||||
if(!B.IsVoid()){
|
|
||||||
Standard_Real aXmin, aYmin, aZmin, aXmax, aYmax, aZmax;
|
|
||||||
B.Get(aXmin, aYmin, aZmin, aXmax, aYmax, aZmax);
|
|
||||||
|
|
||||||
// This magic line comes from Prs3d_ShadedShape.gxx in OCCT
|
|
||||||
aDeflection = std::max( aXmax-aXmin , std::max(aYmax-aYmin , aZmax-aZmin))
|
|
||||||
*aDeflection*4;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
// Just to assign some value, because a void bnd box is not a good case
|
|
||||||
aDeflection = RELATIVE_DEFLECTION;
|
|
||||||
|
|
||||||
if(theDeflection <= 0)
|
|
||||||
theDeflection = theIsRelative ? RELATIVE_DEFLECTION : aDeflection;
|
|
||||||
}
|
|
||||||
|
|
||||||
BRepMesh_IncrementalMesh aMesh(theShape,aDeflection);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
GEOM_Actor::
|
GEOM_Actor::
|
||||||
SetDeflection(float theDeflection, bool theIsRelative)
|
SetDeflection(float theDeflection, bool theIsRelative)
|
||||||
@ -397,7 +358,7 @@ SetDeflection(float theDeflection, bool theIsRelative)
|
|||||||
myDeflection = theDeflection;
|
myDeflection = theDeflection;
|
||||||
myIsRelative = theIsRelative;
|
myIsRelative = theIsRelative;
|
||||||
|
|
||||||
MeshShape(myShape,myDeflection,myIsRelative);
|
GEOM::MeshShape2(myShape,myDeflection,myIsRelative);
|
||||||
|
|
||||||
SetModified();
|
SetModified();
|
||||||
}
|
}
|
||||||
@ -428,7 +389,12 @@ void GEOM_Actor::SetShape (const TopoDS_Shape& theShape,
|
|||||||
TopTools_IndexedDataMapOfShapeListOfShape anEdgeMap;
|
TopTools_IndexedDataMapOfShapeListOfShape anEdgeMap;
|
||||||
TopExp::MapShapesAndAncestors(theShape,TopAbs_EDGE,TopAbs_FACE,anEdgeMap);
|
TopExp::MapShapesAndAncestors(theShape,TopAbs_EDGE,TopAbs_FACE,anEdgeMap);
|
||||||
|
|
||||||
SetShape(theShape,anEdgeMap,theIsVector);
|
GEOM::SetShape(theShape,anEdgeMap,theIsVector,
|
||||||
|
myIsolatedEdgeSource.Get(),
|
||||||
|
myOneFaceEdgeSource.Get(),
|
||||||
|
mySharedEdgeSource.Get(),
|
||||||
|
myWireframeFaceSource.Get(),
|
||||||
|
myShadingFaceSource.Get());
|
||||||
isOnlyVertex =
|
isOnlyVertex =
|
||||||
myIsolatedEdgeSource->IsEmpty() &&
|
myIsolatedEdgeSource->IsEmpty() &&
|
||||||
myOneFaceEdgeSource->IsEmpty() &&
|
myOneFaceEdgeSource->IsEmpty() &&
|
||||||
@ -443,65 +409,6 @@ void GEOM_Actor::SetShape (const TopoDS_Shape& theShape,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void GEOM_Actor::SetShape (const TopoDS_Shape& theShape,
|
|
||||||
const TopTools_IndexedDataMapOfShapeListOfShape& theEdgeMap,
|
|
||||||
bool theIsVector)
|
|
||||||
{
|
|
||||||
if (theShape.ShapeType() == TopAbs_COMPOUND) {
|
|
||||||
TopoDS_Iterator anItr(theShape);
|
|
||||||
for (; anItr.More(); anItr.Next()) {
|
|
||||||
SetShape(anItr.Value(),theEdgeMap,theIsVector);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
switch (theShape.ShapeType()) {
|
|
||||||
case TopAbs_WIRE: {
|
|
||||||
TopExp_Explorer anEdgeExp(theShape,TopAbs_EDGE);
|
|
||||||
for (; anEdgeExp.More(); anEdgeExp.Next()){
|
|
||||||
const TopoDS_Edge& anEdge = TopoDS::Edge(anEdgeExp.Current());
|
|
||||||
if (!BRep_Tool::Degenerated(anEdge))
|
|
||||||
myIsolatedEdgeSource->AddEdge(anEdge,theIsVector);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case TopAbs_EDGE: {
|
|
||||||
const TopoDS_Edge& anEdge = TopoDS::Edge(theShape);
|
|
||||||
if (!BRep_Tool::Degenerated(anEdge))
|
|
||||||
myIsolatedEdgeSource->AddEdge(anEdge,theIsVector);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case TopAbs_VERTEX: {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
default: {
|
|
||||||
TopExp_Explorer aFaceExp (theShape,TopAbs_FACE);
|
|
||||||
for(; aFaceExp.More(); aFaceExp.Next()) {
|
|
||||||
const TopoDS_Face& aFace = TopoDS::Face(aFaceExp.Current());
|
|
||||||
myWireframeFaceSource->AddFace(aFace);
|
|
||||||
myShadingFaceSource->AddFace(aFace);
|
|
||||||
TopExp_Explorer anEdgeExp(aFaceExp.Current(), TopAbs_EDGE);
|
|
||||||
for(; anEdgeExp.More(); anEdgeExp.Next()) {
|
|
||||||
const TopoDS_Edge& anEdge = TopoDS::Edge(anEdgeExp.Current());
|
|
||||||
if(!BRep_Tool::Degenerated(anEdge)){
|
|
||||||
// compute the number of faces
|
|
||||||
int aNbOfFaces = theEdgeMap.FindFromKey(anEdge).Extent();
|
|
||||||
switch(aNbOfFaces){
|
|
||||||
case 0: // isolated edge
|
|
||||||
myIsolatedEdgeSource->AddEdge(anEdge,theIsVector);
|
|
||||||
break;
|
|
||||||
case 1: // edge in only one face
|
|
||||||
myOneFaceEdgeSource->AddEdge(anEdge,theIsVector);
|
|
||||||
break;
|
|
||||||
default: // edge shared by at least two faces
|
|
||||||
mySharedEdgeSource->AddEdge(anEdge,theIsVector);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// OLD METHODS
|
// OLD METHODS
|
||||||
void GEOM_Actor::setDeflection(double adef) {
|
void GEOM_Actor::setDeflection(double adef) {
|
||||||
#ifdef MYDEBUG
|
#ifdef MYDEBUG
|
||||||
@ -906,3 +813,5 @@ void GEOM_Actor::GetMatrix(vtkCamera* theCam, vtkMatrix4x4 *result)
|
|||||||
matrix->Delete();
|
matrix->Delete();
|
||||||
this->Transform->Pop();
|
this->Transform->Pop();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -56,8 +56,6 @@ class vtkRenderer;
|
|||||||
class vtkAppendPolyData;
|
class vtkAppendPolyData;
|
||||||
typedef GEOM_SmartPtr<vtkAppendPolyData> PAppendFilter;
|
typedef GEOM_SmartPtr<vtkAppendPolyData> PAppendFilter;
|
||||||
|
|
||||||
class TopTools_IndexedDataMapOfShapeListOfShape;
|
|
||||||
|
|
||||||
class GEOM_OBJECT_EXPORT GEOM_Actor: public SALOME_Actor
|
class GEOM_OBJECT_EXPORT GEOM_Actor: public SALOME_Actor
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@ -69,10 +67,6 @@ public:
|
|||||||
bool theIsRelative,
|
bool theIsRelative,
|
||||||
bool theIsVector = false);
|
bool theIsVector = false);
|
||||||
|
|
||||||
void SetShape (const TopoDS_Shape& theShape,
|
|
||||||
const TopTools_IndexedDataMapOfShapeListOfShape& theEdgeMap,
|
|
||||||
bool theIsVector);
|
|
||||||
|
|
||||||
void SetDeflection(float theDeflection, bool theIsRelative);
|
void SetDeflection(float theDeflection, bool theIsRelative);
|
||||||
float GetDeflection() const{ return myDeflection;}
|
float GetDeflection() const{ return myDeflection;}
|
||||||
bool GetIsRelative() const{ return myIsRelative;}
|
bool GetIsRelative() const{ return myIsRelative;}
|
||||||
@ -232,3 +226,5 @@ private:
|
|||||||
};
|
};
|
||||||
|
|
||||||
#endif //GEOM_ACTOR_H
|
#endif //GEOM_ACTOR_H
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user