1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-19 13:40:49 +03:00

0023634: Eliminate Polyline and Polygon usage in drawers

Polylines and polygons removed, now everything is based on PrimitiveArrays.
Added use of Graphic3d_ArrayOfSegments, some additional clean up in Graphic3d_Group.
Dead code elimination in AIS and V3d
Corrected compilation errors
Fixed grid presentation
Adding test case correction
This commit is contained in:
kgv
2013-01-18 13:36:18 +04:00
parent 44cf55e600
commit b8ddfc2f5d
134 changed files with 4369 additions and 9572 deletions

View File

@@ -28,7 +28,7 @@
#include <TCollection_AsciiString.hxx>
#include <Graphic3d_AspectMarker3d.hxx>
#include <Graphic3d_AspectLine3d.hxx>
#include <Graphic3d_Array1OfVertex.hxx>
#include <Graphic3d_ArrayOfPolylines.hxx>
#include <Prs3d_Text.hxx>
void Prs3d_AnglePresentation::Draw (
@@ -38,60 +38,43 @@ void Prs3d_AnglePresentation::Draw (
const gp_Pnt& AttachmentPoint1,
const gp_Pnt& AttachmentPoint2,
const gp_Pnt& AttachmentPoint3,
const gp_Pnt& OffsetPoint) {
const gp_Pnt& OffsetPoint)
{
Handle(Prs3d_AngleAspect) AA = aDrawer->AngleAspect();
Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(AA->LineAspect()->Aspect());
Handle(Prs3d_AngleAspect) AA = aDrawer->AngleAspect();
Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(AA->LineAspect()->Aspect());
gp_Vec V1 (AttachmentPoint1,AttachmentPoint2);
gp_Vec V2 (AttachmentPoint1,AttachmentPoint3);
Standard_Real alpha = V1.Angle(V2);
Standard_Real ray = AttachmentPoint1.Distance(OffsetPoint);
const Standard_Real alpha = V1.Angle(V2);
const Standard_Real ray = AttachmentPoint1.Distance(OffsetPoint);
gp_Dir I (V1);
gp_Dir K = I.Crossed(gp_Dir(V2));
gp_Dir K = I.Crossed(gp_Dir(V2));
gp_Dir J = K.Crossed(I);
//
Standard_Real xc,yc,zc;
AttachmentPoint1.Coord(xc,yc,zc);
Graphic3d_Array1OfVertex V(1,2);
Standard_Real x1,y1,z1,x2,y2,z2;
AttachmentPoint2.Coord(x1,y1,z1);
AttachmentPoint3.Coord(x2,y2,z2);
Standard_Integer nbp = Max (4 , Standard_Integer (50. * alpha / M_PI));
Standard_Real dteta = alpha/(nbp-1);
Standard_Real x,y,z;
const Standard_Integer nbp = Max (4 , Standard_Integer (50. * alpha / M_PI));
const Standard_Real dteta = alpha/(nbp-1);
gp_Vec u;
for (Standard_Integer i = 1; i<=nbp; i++) {
u = (gp_Vec(I) * Cos ( (i-1) * dteta)
+ gp_Vec(J) * Sin ( (i-1) * dteta)) * ray ;
u.Coord(x,y,z);
if(i == 1) {
V(1).SetCoord( xc + x, yc + y, zc + z);
V(2).SetCoord( x1,y1,z1);
Prs3d_Root::CurrentGroup(aPresentation)->Polyline(V);}
else {
V(2).SetCoord( xc + x, yc + y, zc + z);
Prs3d_Root::CurrentGroup(aPresentation)->Polyline(V);
if( i == nbp ) {
Standard_Real a1,b1,c1,a2,b2,c2;
V(1).Coord(a1,b1,c1); gp_Pnt pt1(a1,b1,c1);
V(2).Coord(a2,b2,c2); gp_Pnt pt2(a2,b2,c2);
gp_Dir dir( gp_Vec(pt1 , pt2) );
Prs3d_Arrow::Draw(aPresentation,pt2,dir,AA->ArrowAspect()->Angle(),
AA->ArrowAspect()->Length());
}
V(1)=V(2);
}
gp_Pnt p1, p2;
Handle(Graphic3d_ArrayOfPolylines) aPrims = new Graphic3d_ArrayOfPolylines(nbp+2);
aPrims->AddVertex(AttachmentPoint2);
for (Standard_Integer i = 1; i<=nbp; i++)
{
u = (gp_Vec(I) * Cos ( (i-1) * dteta)
+ gp_Vec(J) * Sin ( (i-1) * dteta)) * ray ;
p2 = AttachmentPoint1.Translated(u);
aPrims->AddVertex(p2);
if( i == nbp ) {
gp_Dir dir( gp_Vec(p1,p2) );
Prs3d_Arrow::Draw(aPresentation,p2,dir,AA->ArrowAspect()->Angle(),AA->ArrowAspect()->Length());
}
p1 = p2;
}
V(2).SetCoord(x2,y2,z2);
Prs3d_Root::CurrentGroup(aPresentation)->Polyline(V);
u = (gp_Vec(I) * Cos ( alpha/2.)
+ gp_Vec(J) * Sin ( alpha/2.)) * ray ;
u.Coord(x,y,z);
Prs3d_Text::Draw(aPresentation,AA->TextAspect(),aText,
gp_Pnt(xc+x,yc+y,zc+z));
aPrims->AddVertex(AttachmentPoint3);
Prs3d_Root::CurrentGroup(aPresentation)->AddPrimitiveArray(aPrims);
u = (gp_Vec(I) * Cos (0.5*alpha)
+ gp_Vec(J) * Sin (0.5*alpha)) * ray ;
Prs3d_Text::Draw(aPresentation,AA->TextAspect(),aText,AttachmentPoint1.Translated(u));
}

View File

@@ -18,7 +18,8 @@
#include <Prs3d_Arrow.ixx>
#include <Graphic3d_Group.hxx>
#include <Graphic3d_Array1OfVertex.hxx>
#include <Graphic3d_ArrayOfSegments.hxx>
#include <Graphic3d_ArrayOfPolylines.hxx>
//=======================================================================
//function : Draw
@@ -27,10 +28,10 @@
void Prs3d_Arrow::Draw(const Handle(Prs3d_Presentation)& aPresentation,
const gp_Pnt& aLocation,
const gp_Dir& aDirection,
const gp_Dir& aDirection,
const Quantity_PlaneAngle anAngle,
const Quantity_Length aLength) {
const Quantity_Length aLength)
{
Quantity_Length dx,dy,dz; aDirection.Coord(dx,dy,dz);
//
// Point of the arrow:
@@ -54,34 +55,36 @@ void Prs3d_Arrow::Draw(const Handle(Prs3d_Presentation)& aPresentation,
Quantity_Length Norme = sqrt ( xi*xi + yi*yi + zi*zi );
xi = xi / Norme; yi = yi / Norme; zi = zi/Norme;
Quantity_Length xj = dy * zi - dz * yi;
Quantity_Length yj = dz * xi - dx * zi;
Quantity_Length zj = dx * yi - dy * xi;
const Quantity_Length xj = dy * zi - dz * yi;
const Quantity_Length yj = dz * xi - dx * zi;
const Quantity_Length zj = dx * yi - dy * xi;
Standard_Integer NbPoints = 15;
const Standard_Integer NbPoints = 15;
Graphic3d_Array1OfVertex VN(1,NbPoints+1);
Graphic3d_Array1OfVertex V2(1,2);
V2(1).SetCoord(xo,yo,zo);
Handle(Graphic3d_ArrayOfSegments) aPrims1 = new Graphic3d_ArrayOfSegments(2*NbPoints);
Handle(Graphic3d_ArrayOfPolylines) aPrims2 = new Graphic3d_ArrayOfPolylines(NbPoints+1);
Quantity_Length x,y,z;
Standard_Real cosinus,sinus, Tg=tan(anAngle);
gp_Pnt p1;
const Standard_Real Tg=tan(anAngle);
for (Standard_Integer i = 1 ; i <= NbPoints ; i++) {
for (Standard_Integer i = 1; i <= NbPoints ; i++)
{
const Standard_Real cosinus = cos ( 2 * M_PI / NbPoints * (i-1) );
const Standard_Real sinus = sin ( 2 * M_PI / NbPoints * (i-1) );
cosinus = cos ( 2 * M_PI / NbPoints * (i-1) );
sinus = sin ( 2 * M_PI / NbPoints * (i-1) );
const gp_Pnt pp(xc + (cosinus * xi + sinus * xj) * aLength * Tg,
yc + (cosinus * yi + sinus * yj) * aLength * Tg,
zc + (cosinus * zi + sinus * zj) * aLength * Tg);
x = xc + (cosinus * xi + sinus * xj) * aLength * Tg;
y = yc + (cosinus * yi + sinus * yj) * aLength * Tg;
z = zc + (cosinus * zi + sinus * zj) * aLength * Tg;
VN(i).SetCoord(x,y,z);
if(i==1) VN(NbPoints+1).SetCoord(x,y,z);
V2(2).SetCoord(x,y,z);
Prs3d_Root::CurrentGroup(aPresentation)->Polyline(V2);
aPrims1->AddVertex(aLocation);
aPrims1->AddVertex(pp);
if(i==1) p1 = pp;
aPrims2->AddVertex(pp);
}
Prs3d_Root::CurrentGroup(aPresentation)->Polyline(VN);
aPrims2->AddVertex(p1);
Prs3d_Root::CurrentGroup(aPresentation)->AddPrimitiveArray(aPrims1);
Prs3d_Root::CurrentGroup(aPresentation)->AddPrimitiveArray(aPrims2);
}
//=======================================================================
@@ -93,6 +96,6 @@ void Prs3d_Arrow::Fill(const Handle(Prs3d_Presentation)& /*aPresentation*/,
const gp_Pnt& /*aLocation*/,
const gp_Dir& /*aDirection*/,
const Quantity_PlaneAngle /*anAngle*/,
const Quantity_Length /*aLength*/)
const Quantity_Length /*aLength*/)
{
}

View File

@@ -30,21 +30,19 @@
#include <Prs3d_DatumAspect.hxx>
#include <Prs3d_TextAspect.hxx>
#include <Prs3d_ArrowAspect.hxx>
#include <Graphic3d_Array1OfVertex.hxx>
#include <Graphic3d_ArrayOfSegments.hxx>
void Prs3d_Datum::Add( const Handle(Prs3d_Presentation)& aPresentation,
const anyDatum& aDatum,
const Handle(Prs3d_Drawer)& aDrawer ) {
const Handle(Prs3d_Drawer)& aDrawer )
{
Handle(Prs3d_DatumAspect) DA = aDrawer->DatumAspect();
Handle(Graphic3d_Group) G = Prs3d_Root::CurrentGroup(aPresentation);
Quantity_Color Col; Aspect_TypeOfLine Tol; Standard_Real W;
DA->FirstAxisAspect()->Aspect()->Values(Col,Tol,W);
Handle(Graphic3d_AspectMarker3d) Asp = new Graphic3d_AspectMarker3d
(Aspect_TOM_BALL,Col,.1);
Handle(Graphic3d_AspectMarker3d) Asp = new Graphic3d_AspectMarker3d(Aspect_TOM_BALL,Col,.1);
gp_Ax2 Axis = DatumTool::Ax2(aDatum);
gp_Pnt Orig = Axis.Location();
@@ -56,72 +54,63 @@ void Prs3d_Datum::Add( const Handle(Prs3d_Presentation)& aPresentation,
// Trace d'une petite sphere au debut du vecteur:
//
Quantity_Length xo,yo,zo,x,y,z;
Quantity_Length xo,yo,zo;
Orig.Coord(xo,yo,zo);
G->SetPrimitivesAspect(Asp);
G->Marker(Graphic3d_Vertex (xo,yo,zo));
Graphic3d_Array1OfVertex A(1,2);
A(1).SetCoord(xo,yo,zo);
Quantity_Length DS;
#ifdef IMP120100
Quantity_Length arrowAngle = aDrawer->ArrowAspect()->Angle();
Quantity_Length textHeight = aDrawer->TextAspect()->Height();
#endif
if (DA->DrawFirstAndSecondAxis()) {
oX.Coord(x,y,z);
Handle(Graphic3d_ArrayOfSegments) aPrims;
if (DA->DrawFirstAndSecondAxis())
{
DS = DA->FirstAxisLength();
x = xo + x*DS; y = yo + y*DS; z = zo + z*DS;
A(2).SetCoord(x,y,z);
const gp_Pnt p1(Orig.XYZ() + oX.XYZ()*DS);
G->SetPrimitivesAspect(DA->FirstAxisAspect()->Aspect());
G->Polyline(A);
#ifdef IMP120100
aPrims = new Graphic3d_ArrayOfSegments(2);
aPrims->AddVertex(Orig);
aPrims->AddVertex(p1);
G->AddPrimitiveArray(aPrims);
G->SetPrimitivesAspect(aDrawer->ArrowAspect()->Aspect());
Prs3d_Arrow::Draw(aPresentation,gp_Pnt(x,y,z),oX,arrowAngle,DS/10.);
Prs3d_Arrow::Draw(aPresentation,p1,oX,arrowAngle,DS/10.);
G->SetPrimitivesAspect(aDrawer->TextAspect()->Aspect());
G->Text(Standard_CString("X"),A(2),16.);
#else
Prs3d_Arrow::Draw(aPresentation,gp_Pnt(x,y,z),oX,M_PI/180.*10.,DS/10.);
Prs3d_Root::CurrentGroup(aPresentation)->Text(Standard_CString("X"),A(2),1./81.);
#endif
}
if (DA->DrawFirstAndSecondAxis()) {
oY.Coord(x,y,z);
Graphic3d_Vertex v1(p1.X(),p1.Y(),p1.Z());
G->Text(Standard_CString("X"),v1,16.);
DS = DA->SecondAxisLength();
x = xo + x*DS; y = yo + y*DS; z = zo + z*DS;
A(2).SetCoord(x,y,z);
const gp_Pnt p2(Orig.XYZ() + oY.XYZ()*DS);
G->SetPrimitivesAspect(DA->SecondAxisAspect()->Aspect());
G->Polyline(A);
#ifdef IMP120100
aPrims = new Graphic3d_ArrayOfSegments(2);
aPrims->AddVertex(Orig);
aPrims->AddVertex(p2);
G->AddPrimitiveArray(aPrims);
G->SetPrimitivesAspect(aDrawer->ArrowAspect()->Aspect());
Prs3d_Arrow::Draw(aPresentation,gp_Pnt(x,y,z),oY,arrowAngle,DS/10.);
Prs3d_Arrow::Draw(aPresentation,p2,oY,arrowAngle,DS/10.);
G->SetPrimitivesAspect(aDrawer->TextAspect()->Aspect());
G->Text(Standard_CString("Y"),A(2),16.);
#else
Prs3d_Arrow::Draw(aPresentation,gp_Pnt(x,y,z),oY,M_PI/180.*10.,DS/10.);
Prs3d_Root::CurrentGroup(aPresentation)->Text(Standard_CString("Y"),A(2),1./81.);
#endif
}
if (DA->DrawThirdAxis()) {
oZ.Coord(x,y,z);
Graphic3d_Vertex v2(p2.X(),p2.Y(),p2.Z());
G->Text(Standard_CString("Y"),v2,16.);
}
if (DA->DrawThirdAxis())
{
DS = DA->ThirdAxisLength();
x = xo + x*DS; y = yo + y*DS; z = zo + z*DS;
A(2).SetCoord(x,y,z);
const gp_Pnt p3(Orig.XYZ() + oZ.XYZ()*DS);
G->SetPrimitivesAspect(DA->ThirdAxisAspect()->Aspect());
G->Polyline(A);
#ifdef IMP120100
aPrims = new Graphic3d_ArrayOfSegments(2);
aPrims->AddVertex(Orig);
aPrims->AddVertex(p3);
G->AddPrimitiveArray(aPrims);
G->SetPrimitivesAspect(aDrawer->ArrowAspect()->Aspect());
Prs3d_Arrow::Draw(aPresentation,gp_Pnt(x,y,z),oZ,arrowAngle,DS/10.);
Prs3d_Arrow::Draw(aPresentation,p3,oZ,arrowAngle,DS/10.);
G->SetPrimitivesAspect(aDrawer->TextAspect()->Aspect());
G->Text(Standard_CString("Z"),A(2),16.);
#else
Prs3d_Root::CurrentGroup(aPresentation)->Text(Standard_CString("Z"),A(2),1./81.);
Prs3d_Arrow::Draw(aPresentation,gp_Pnt(x,y,z),oZ,M_PI/180.*10.,DS/10.);
#endif
}
Graphic3d_Vertex v3(p3.X(),p3.Y(),p3.Z());
G->Text(Standard_CString("Z"),v3,16.);
}
}

View File

@@ -40,7 +40,6 @@ void Prs3d_HLRShape::Add(const Handle (Prs3d_Presentation)& aPresentation,
aGroup->SetPrimitivesAspect(aDrawer->SeenLineAspect()->Aspect());
aGroup->BeginPrimitives();
Standard_Real anAngle = aDrawer->DeviationAngle();
TColgp_SequenceOfPnt Points;
for (i=1;i<=NbEdge;i++){
@@ -49,19 +48,17 @@ void Prs3d_HLRShape::Add(const Handle (Prs3d_Presentation)& aPresentation,
CurvePresentation::Add(aPresentation,TheCurve,U1,U2,def, Points, anAngle);
}
}
aGroup->EndPrimitives();
if(aDrawer->DrawHiddenLine()){
if(aDrawer->DrawHiddenLine())
{
aGroup->SetPrimitivesAspect(aDrawer->HiddenLineAspect()->Aspect());
aGroup->BeginPrimitives();
for (i=1;i<=NbEdge;i++){
for(Tool.InitHidden(i);Tool.MoreHidden();Tool.NextHidden()){
Tool.Hidden(TheCurve,U1,U2);
CurvePresentation::Add(aPresentation,TheCurve,U1,U2,def, Points, anAngle);
}
}
aGroup->EndPrimitives();
}
}

View File

@@ -28,7 +28,7 @@
#include <TCollection_AsciiString.hxx>
#include <Graphic3d_AspectMarker3d.hxx>
#include <Graphic3d_AspectLine3d.hxx>
#include <Graphic3d_Array1OfVertex.hxx>
#include <Graphic3d_ArrayOfPolylines.hxx>
#include <Prs3d_Text.hxx>
void Prs3d_LengthPresentation::Draw (
@@ -37,53 +37,33 @@ void Prs3d_LengthPresentation::Draw (
const TCollection_ExtendedString& aText,
const gp_Pnt& AttachmentPoint1,
const gp_Pnt& AttachmentPoint2,
const gp_Pnt& OffsetPoint) {
const gp_Pnt& OffsetPoint)
{
Handle(Prs3d_LengthAspect) LA = aDrawer->LengthAspect();
Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(LA->LineAspect()->Aspect());
Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(LA->LineAspect()->Aspect());
gp_Dir D (gp_Vec(AttachmentPoint1,AttachmentPoint2));
gp_Lin L (OffsetPoint,D);
gp_Pnt Proj1 = ElCLib::Value(ElCLib::Parameter(L,AttachmentPoint1),L);
gp_Pnt Proj2 = ElCLib::Value(ElCLib::Parameter(L,AttachmentPoint2),L);
Graphic3d_Array1OfVertex V(1,2);
Handle(Graphic3d_ArrayOfPolylines) aPrims = new Graphic3d_ArrayOfPolylines(4);
aPrims->AddVertex(AttachmentPoint1);
aPrims->AddVertex(Proj1);
aPrims->AddVertex(Proj2);
aPrims->AddVertex(AttachmentPoint2);
Prs3d_Root::CurrentGroup(aPresentation)->AddPrimitiveArray(aPrims);
Quantity_Length X,Y,Z;
Proj1.Coord(X,Y,Z);
V(1).SetCoord(X,Y,Z);
if (LA->DrawFirstArrow())
Prs3d_Arrow::Draw(aPresentation,Proj1,D.Reversed(),LA->Arrow1Aspect()->Angle(),LA->Arrow1Aspect()->Length());
AttachmentPoint1.Coord(X,Y,Z);
V(2).SetCoord(X,Y,Z);
Prs3d_Root::CurrentGroup(aPresentation)->Polyline(V);
Proj2.Coord(X,Y,Z);
V(2).SetCoord(X,Y,Z);
Prs3d_Root::CurrentGroup(aPresentation)->Polyline(V);
AttachmentPoint2.Coord(X,Y,Z);
V(1).SetCoord(X,Y,Z);
Prs3d_Root::CurrentGroup(aPresentation)->Polyline(V);
Proj1.Coord(X,Y,Z);
if (LA->DrawFirstArrow()) {
Prs3d_Arrow::Draw(aPresentation,Proj1,D.Reversed(),
LA->Arrow1Aspect()->Angle(),
LA->Arrow1Aspect()->Length());
}
Quantity_Length X2,Y2,Z2;
Proj2.Coord(X2,Y2,Z2);
if (LA->DrawSecondArrow()) {
Prs3d_Arrow::Draw(aPresentation,Proj2,D,
LA->Arrow2Aspect()->Angle(),
LA->Arrow2Aspect()->Length());
}
gp_Pnt p;
p.SetCoord( (X+X2)/2. , (Y+Y2)/2. , (Z+Z2)/2.);
if (LA->DrawSecondArrow())
Prs3d_Arrow::Draw(aPresentation,Proj2,D,LA->Arrow2Aspect()->Angle(),LA->Arrow2Aspect()->Length());
gp_Pnt p( .5*(X+X2), .5*(Y+Y2), .5*(Z+Z2) );
Prs3d_Text::Draw(aPresentation,LA->TextAspect(),aText,p);
}

View File

@@ -16,7 +16,7 @@
// purpose or non-infringement. Please see the License for the specific terms
// and conditions governing the rights and limitations under the License.
#include <Graphic3d_Array1OfVertex.hxx>
#include <Graphic3d_ArrayOfPolylines.hxx>
#include <Graphic3d_Vertex.hxx>
#include <Graphic3d_Group.hxx>
#include <Prs3d_Arrow.hxx>
@@ -26,29 +26,25 @@
#include <Prs3d_LineAspect.hxx>
#include <Prs3d.hxx>
static void DrawLine (const anyLine& aLine,
const Handle(Graphic3d_Group)& aGroup) {
Standard_Integer Count=0;
static void DrawLine (const anyLine& aLine, const Handle(Graphic3d_Group)& aGroup)
{
Quantity_Length x,y,z;
Standard_Integer Lower = LineTool::Lower(aLine);
Standard_Integer Upper = LineTool::Upper(aLine);
Standard_Integer i = LineTool::Lower(aLine);
const Standard_Integer Upper = LineTool::Upper(aLine);
Graphic3d_Array1OfVertex VertexArray(1,Upper-Lower+1);
for (Standard_Integer i=Lower;i<=Upper;i++){
Handle(Graphic3d_ArrayOfPolylines) aPrims = new Graphic3d_ArrayOfPolylines(Upper-i+1);
for (; i <= Upper; i++) {
LineTool::Coord(aLine,i,x,y,z);
VertexArray(++Count).SetCoord(x,y,z);
aPrims->AddVertex((Standard_ShortReal)x,(Standard_ShortReal)y,(Standard_ShortReal)z);
}
aGroup->Polyline(VertexArray);
aGroup->AddPrimitiveArray(aPrims);
}
void Prs3d_Line::Add (const Handle (Prs3d_Presentation)& aPresentation,
const anyLine& aLine,
const Handle (Prs3d_Drawer)& aDrawer){
// Prs3d_Root::NewGroup(aPresentation);
const Handle (Prs3d_Drawer)& aDrawer)
{
Handle(Graphic3d_Group) TheGroup = Prs3d_Root::CurrentGroup(aPresentation);
TheGroup->SetPrimitivesAspect(aDrawer->LineAspect()->Aspect());
DrawLine(aLine,TheGroup);
@@ -68,12 +64,10 @@ void Prs3d_Line::Add (const Handle (Prs3d_Presentation)& aPresentation,
}
}
}
void Prs3d_Line::Add (const Handle (Prs3d_Presentation)& aPresentation,
const anyLine& aLine){
void Prs3d_Line::Add (const Handle (Prs3d_Presentation)& aPresentation, const anyLine& aLine)
{
DrawLine (aLine,Prs3d_Root::CurrentGroup(aPresentation));
}
Standard_Integer Prs3d_Line::Pick
@@ -83,46 +77,45 @@ Standard_Integer Prs3d_Line::Pick
const Quantity_Length aDistance,
const anyLine& aLine,
const Handle (Prs3d_Drawer)& aDrawer,
const Prs3d_TypeOfLinePicking TypeOfPicking){
Standard_Integer Lower = LineTool::Lower(aLine);
Standard_Integer Upper = LineTool::Upper(aLine);
const Prs3d_TypeOfLinePicking TypeOfPicking)
{
Standard_Integer i = LineTool::Lower(aLine);
const Standard_Integer Upper = LineTool::Upper(aLine);
Standard_Integer num = 0;
Quantity_Length X1,Y1,Z1,X2,Y2,Z2,dist;
Standard_Real DistMin = RealLast();
for (Standard_Integer i=Lower;i<=Upper;i++){
for (; i <= Upper; i++)
{
LineTool::Coord(aLine,i,X2,Y2,Z2);
switch (TypeOfPicking) {
case Prs3d_TOLP_Point: {
dist = Abs(X-X2)+Abs(Y-Y2)+ Abs(Z-Z2);
if(dist < aDistance) {
if (dist < DistMin) {
DistMin = dist;
num = i;
}
case Prs3d_TOLP_Point: {
dist = Abs(X-X2)+Abs(Y-Y2)+ Abs(Z-Z2);
if(dist < aDistance) {
if (dist < DistMin) {
DistMin = dist;
num = i;
}
}
break;
}
}
break;
case Prs3d_TOLP_Segment: {
if (i > 1) {
if (Prs3d::MatchSegment
(X,Y,Z,aDistance,gp_Pnt(X1,Y1,Z1),gp_Pnt(X2,Y2,Z2),dist)){
if(dist < aDistance) {
if (dist < DistMin) {
DistMin = dist;
num = i;
}
}
}
case Prs3d_TOLP_Segment: {
if (i > 1) {
if (Prs3d::MatchSegment(X,Y,Z,aDistance,gp_Pnt(X1,Y1,Z1),gp_Pnt(X2,Y2,Z2),dist)) {
if(dist < aDistance) {
if (dist < DistMin) {
DistMin = dist;
num = i;
}
}
}
}
X1=X2;Y1=Y2;Z1=Z2;
break;
}
X1=X2;Y1=Y2;Z1=Z2;
}
break;
}
}
return num;
return num;
}

View File

@@ -16,14 +16,13 @@
// purpose or non-infringement. Please see the License for the specific terms
// and conditions governing the rights and limitations under the License.
#include <Graphic3d_Array1OfVertex.hxx>
#include <Graphic3d_Vertex.hxx>
#include <Graphic3d_Group.hxx>
#include <Prs3d_PointAspect.hxx>
static void DrawPoint (const anyPoint& aPoint,
const Handle(Graphic3d_Group) aGroup) {
const Handle(Graphic3d_Group) aGroup)
{
Quantity_Length x,y,z;
PointTool::Coord(aPoint,x,y,z);
Graphic3d_Vertex Vertex(x,y,z);
@@ -32,16 +31,15 @@ static void DrawPoint (const anyPoint& aPoint,
void Prs3d_Point::Add (const Handle (Prs3d_Presentation)& aPresentation,
const anyPoint& aPoint,
const Handle (Prs3d_Drawer)& aDrawer){
const Handle (Prs3d_Drawer)& aDrawer)
{
Handle(Graphic3d_Group) TheGroup = Prs3d_Root::CurrentGroup(aPresentation);
TheGroup->SetPrimitivesAspect(aDrawer->PointAspect()->Aspect());
DrawPoint(aPoint,TheGroup);
}
void Prs3d_Point::Add (const Handle (Prs3d_Presentation)& aPresentation,
const anyPoint& aPoint){
void Prs3d_Point::Add (const Handle (Prs3d_Presentation)& aPresentation, const anyPoint& aPoint)
{
DrawPoint(aPoint,Prs3d_Root::CurrentGroup(aPresentation));
}
@@ -50,8 +48,8 @@ Standard_Boolean Prs3d_Point::Match (const anyPoint& aPoint,
const Quantity_Length X,
const Quantity_Length Y,
const Quantity_Length Z,
const Quantity_Length aDistance) {
const Quantity_Length aDistance)
{
Quantity_Length x,y,z;
PointTool::Coord(aPoint,x,y,z);
return Sqrt( (X-x)*(X-x) + (Y-y)*(Y-y) + (Z-z)*(Z-z) ) <= aDistance;

View File

@@ -24,7 +24,7 @@
#include <Prs3d_LineAspect.hxx>
#include <gp_Vec.hxx>
#include <gp_Pnt.hxx>
#include <Graphic3d_Array1OfVertex.hxx>
#include <Graphic3d_ArrayOfSegments.hxx>
void Prs3d_Vector::Add(const Handle(Prs3d_Presentation)& aPresentation,
@@ -33,9 +33,7 @@ void Prs3d_Vector::Add(const Handle(Prs3d_Presentation)& aPresentation,
{
gp_Pnt Pnt = VectorTool::Location(aVector);
gp_Vec Vec = VectorTool::Vec(aVector);
Quantity_Length x1,y1,z1,dx,dy,dz;
Pnt.Coord(x1,y1,z1);
Vec.Coord(dx,dy,dz);
gp_Pnt Pnt2 = Pnt.Translated(Vec);
Handle(Graphic3d_Group) G = Prs3d_Root::CurrentGroup(aPresentation);
G->SetPrimitivesAspect(aDrawer->VectorAspect()->Aspect());
@@ -43,25 +41,20 @@ void Prs3d_Vector::Add(const Handle(Prs3d_Presentation)& aPresentation,
Quantity_Color Col; Aspect_TypeOfLine Tol; Standard_Real W;
aDrawer->VectorAspect()->Aspect()->Values(Col,Tol,W);
Graphic3d_Array1OfVertex A(1,2);
//
// Trace d'une petite sphere au debut du vecteur:
//
Graphic3d_Vertex VTX;
VTX.SetCoord(x1,y1,z1);
Handle(Graphic3d_AspectMarker3d) Asp = new Graphic3d_AspectMarker3d
(Aspect_TOM_BALL,Col,1.);
Quantity_Length x1,y1,z1;
Pnt.Coord(x1,y1,z1);
Graphic3d_Vertex VTX(x1,y1,z1);
Handle(Graphic3d_AspectMarker3d) Asp = new Graphic3d_AspectMarker3d(Aspect_TOM_BALL,Col,1.);
G->SetPrimitivesAspect(Asp);
G->Marker(VTX);
A(1).SetCoord(x1,y1,z1);
A(2).SetCoord(x1+dx,y1+dy,z1+dz);
G->Polyline(A);
Prs3d_Arrow::Draw(aPresentation,gp_Pnt(x1+dx,y1+dy,z1+dz),gp_Dir(Vec),
M_PI/180.*10.,Sqrt(dx*dx+dy*dy+dz*dz)/10.);
Handle(Graphic3d_ArrayOfSegments) aPrims = new Graphic3d_ArrayOfSegments(2);
aPrims->AddVertex(Pnt);
aPrims->AddVertex(Pnt2);
G->AddPrimitiveArray(aPrims);
Prs3d_Arrow::Draw(aPresentation,Pnt2,gp_Dir(Vec),M_PI/180.*10.,Vec.Magnitude()/10.);
}

View File

@@ -17,7 +17,6 @@
// and conditions governing the rights and limitations under the License.
#include <Hatch_Hatcher.hxx>
#include <Graphic3d_Array1OfVertex.hxx>
#include <Graphic3d_Group.hxx>
#include <gp_Pnt.hxx>
#include <gp_Pnt2d.hxx>
@@ -26,12 +25,6 @@
#include <GCPnts_UniformDeflection.hxx>
#include <Adaptor3d_IsoCurve.hxx>
#ifdef DEBUG
#include <OSD_Timer.hxx>
extern OSD_Timer RestrictedFaceTimer1,RestrictedFaceTimer2,RestrictedFaceTimer3,RestrictedFaceTimer4;
#endif
//=========================================================================
// function: Add
@@ -48,11 +41,6 @@ void Prs3d_WFDeflectionRestrictedFace::Add
const Handle(Prs3d_Drawer)& aDrawer,
Prs3d_NListOfSequenceOfPnt& Curves)
{
#ifdef DEBUG
RestrictedFaceTimer1.Start();
#endif
RestrictionTool ToolRst (aFace);
Standard_Real aLimit = aDrawer->MaximalParameterValue();
@@ -94,12 +82,6 @@ void Prs3d_WFDeflectionRestrictedFace::Add
}
}
#ifdef DEBUG
RestrictedFaceTimer1.Stop();
RestrictedFaceTimer2.Start();
#endif
// load the isos
Hatch_Hatcher isobuild(1.e-5,ToolRst.IsOriented());
Standard_Boolean UClosed = aFace->IsUClosed();
@@ -134,11 +116,6 @@ void Prs3d_WFDeflectionRestrictedFace::Add
}
}
#ifdef DEBUG
RestrictedFaceTimer2.Stop();
RestrictedFaceTimer3.Start();
#endif
// trim the isos
gp_Pnt2d P1,P2;
Standard_Real U1, U2;
@@ -182,13 +159,7 @@ void Prs3d_WFDeflectionRestrictedFace::Add
}
}
#ifdef DEBUG
RestrictedFaceTimer3.Stop();
RestrictedFaceTimer4.Start();
#endif
// draw the isos
Adaptor3d_IsoCurve anIso;
anIso.Load(aFace);
Standard_Integer NumberOfLines = isobuild.NbLines();
@@ -210,10 +181,6 @@ void Prs3d_WFDeflectionRestrictedFace::Add
DrawFaceIso::Add(aPresentation,anIso,Deflection, aLimit);
}
}
#ifdef DEBUG
RestrictedFaceTimer4.Stop();
#endif
}
@@ -359,26 +326,17 @@ Standard_Boolean Prs3d_WFDeflectionRestrictedFace::Match
void Prs3d_WFDeflectionRestrictedFace::Add
(const Handle (Prs3d_Presentation)& aPresentation,
const Handle(BRepAdaptor_HSurface)& aFace,
const Handle (Prs3d_Drawer)& aDrawer){
Quantity_Length Deflection = aDrawer->MaximalChordialDeviation();
Standard_Integer finu = aDrawer->UIsoAspect()->Number();
Standard_Integer finv = aDrawer->VIsoAspect()->Number();
Handle(Graphic3d_Group) TheGroup = Prs3d_Root::CurrentGroup(aPresentation);
TheGroup->BeginPrimitives();
const Handle (Prs3d_Drawer)& aDrawer)
{
Prs3d_WFDeflectionRestrictedFace::Add (
aPresentation,
aFace,
Standard_True,
Standard_True,
Deflection,
finu,
finv,
aDrawer->MaximalChordialDeviation(),
aDrawer->UIsoAspect()->Number(),
aDrawer->VIsoAspect()->Number(),
aDrawer);
TheGroup->EndPrimitives();
}
@@ -389,19 +347,16 @@ void Prs3d_WFDeflectionRestrictedFace::Add
void Prs3d_WFDeflectionRestrictedFace::AddUIso
(const Handle (Prs3d_Presentation)& aPresentation,
const Handle(BRepAdaptor_HSurface)& aFace,
const Handle (Prs3d_Drawer)& aDrawer) {
Quantity_Length Deflection = aDrawer->MaximalChordialDeviation();
Standard_Integer finu = aDrawer->UIsoAspect()->Number();
Standard_Integer finv = aDrawer->VIsoAspect()->Number();
const Handle (Prs3d_Drawer)& aDrawer)
{
Prs3d_WFDeflectionRestrictedFace::Add (
aPresentation,
aFace,
Standard_True,
Standard_False,
Deflection,
finu,
finv,
aDrawer->MaximalChordialDeviation(),
aDrawer->UIsoAspect()->Number(),
aDrawer->VIsoAspect()->Number(),
aDrawer);
}
@@ -413,19 +368,16 @@ void Prs3d_WFDeflectionRestrictedFace::AddUIso
void Prs3d_WFDeflectionRestrictedFace::AddVIso
(const Handle (Prs3d_Presentation)& aPresentation,
const Handle(BRepAdaptor_HSurface)& aFace,
const Handle (Prs3d_Drawer)& aDrawer) {
Quantity_Length Deflection = aDrawer->MaximalChordialDeviation();
Standard_Integer finu = aDrawer->UIsoAspect()->Number();
Standard_Integer finv = aDrawer->VIsoAspect()->Number();
Prs3d_WFDeflectionRestrictedFace::Add (
const Handle (Prs3d_Drawer)& aDrawer)
{
Prs3d_WFDeflectionRestrictedFace::Add (
aPresentation,
aFace,
Standard_False,
Standard_True,
Deflection,
finu,
finv,
aDrawer->MaximalChordialDeviation(),
aDrawer->UIsoAspect()->Number(),
aDrawer->VIsoAspect()->Number(),
aDrawer);
}
@@ -440,20 +392,17 @@ Standard_Boolean Prs3d_WFDeflectionRestrictedFace::Match
const Quantity_Length Z,
const Quantity_Length aDistance,
const Handle(BRepAdaptor_HSurface)& aFace,
const Handle (Prs3d_Drawer)& aDrawer){
Quantity_Length Deflection = aDrawer->MaximalChordialDeviation();
Standard_Integer finu = aDrawer->UIsoAspect()->Number();
Standard_Integer finv = aDrawer->VIsoAspect()->Number();
const Handle (Prs3d_Drawer)& aDrawer)
{
return Prs3d_WFDeflectionRestrictedFace::Match (
X,Y,Z,aDistance,
aFace,
aDrawer,
Standard_True,
Standard_True,
Deflection,
finu,
finv);
aFace,
aDrawer,
Standard_True,
Standard_True,
aDrawer->MaximalChordialDeviation(),
aDrawer->UIsoAspect()->Number(),
aDrawer->VIsoAspect()->Number());
}
@@ -467,20 +416,20 @@ Standard_Boolean Prs3d_WFDeflectionRestrictedFace::MatchUIso
const Quantity_Length Z,
const Quantity_Length aDistance,
const Handle(BRepAdaptor_HSurface)& aFace,
const Handle (Prs3d_Drawer)& aDrawer) {
const Handle (Prs3d_Drawer)& aDrawer)
{
Quantity_Length Deflection = aDrawer->MaximalChordialDeviation();
Standard_Integer finu = aDrawer->UIsoAspect()->Number();
Standard_Integer finv = aDrawer->VIsoAspect()->Number();
return Prs3d_WFDeflectionRestrictedFace::Match (
X,Y,Z,aDistance,
aFace,
aDrawer,
Standard_True,
Standard_False,
Deflection,
finu,
finv);
aFace,
aDrawer,
Standard_True,
Standard_False,
Deflection,
finu,
finv);
}
@@ -494,20 +443,15 @@ Standard_Boolean Prs3d_WFDeflectionRestrictedFace::MatchVIso
const Quantity_Length Z,
const Quantity_Length aDistance,
const Handle(BRepAdaptor_HSurface)& aFace,
const Handle (Prs3d_Drawer)& aDrawer) {
Quantity_Length Deflection = aDrawer->MaximalChordialDeviation();
Standard_Integer finu = aDrawer->UIsoAspect()->Number();
Standard_Integer finv = aDrawer->VIsoAspect()->Number();
const Handle (Prs3d_Drawer)& aDrawer)
{
return Prs3d_WFDeflectionRestrictedFace::Match (
X,Y,Z,aDistance,
aFace,
aDrawer,
Standard_False,
Standard_True,
Deflection,
finu,
finv);
aFace,
aDrawer,
Standard_False,
Standard_True,
aDrawer->MaximalChordialDeviation(),
aDrawer->UIsoAspect()->Number(),
aDrawer->VIsoAspect()->Number());
}

View File

@@ -19,15 +19,7 @@
// and conditions governing the rights and limitations under the License.
#ifdef DEBUG
#include <OSD_Timer.hxx>
extern OSD_Timer RestrictedFaceTimer1,RestrictedFaceTimer2,RestrictedFaceTimer3,RestrictedFaceTimer4;
#endif
#include <Hatch_Hatcher.hxx>
#include <Graphic3d_Array1OfVertex.hxx>
#include <Graphic3d_ArrayOfPrimitives.hxx>
#include <Graphic3d_Group.hxx>
#include <gp_Pnt.hxx>
#include <Prs3d_IsoAspect.hxx>
@@ -55,14 +47,9 @@ void Prs3d_WFRestrictedFace::Add
const Handle(Prs3d_Drawer)& aDrawer,
Prs3d_NListOfSequenceOfPnt& Curves)
{
Standard_Boolean isPA = Graphic3d_ArrayOfPrimitives::IsEnable();
Standard_Real aLimit = aDrawer->MaximalParameterValue();
Standard_Integer nbPoints = aDrawer->Discretisation();
#ifdef DEBUG
RestrictedFaceTimer1.Start();
#endif
RestrictionTool ToolRst (aFace);
// compute bounds of the restriction
@@ -87,12 +74,6 @@ void Prs3d_WFRestrictedFace::Add
VMax = aFace->Surface().LastVParameter();
}
#ifdef DEBUG
RestrictedFaceTimer1.Stop();
RestrictedFaceTimer2.Start();
#endif
// load the isos
Hatch_Hatcher isobuild(1.e-5,ToolRst.IsOriented());
Standard_Boolean UClosed = aFace->IsUClosed();
@@ -127,11 +108,6 @@ void Prs3d_WFRestrictedFace::Add
}
}
#ifdef DEBUG
RestrictedFaceTimer2.Stop();
RestrictedFaceTimer3.Start();
#endif
// trim the isos
Standard_Real U1, U2, U, DU;
@@ -165,14 +141,7 @@ void Prs3d_WFRestrictedFace::Add
}
}
#ifdef DEBUG
RestrictedFaceTimer3.Stop();
RestrictedFaceTimer4.Start();
#endif
// draw the isos
Adaptor3d_IsoCurve anIso;
anIso.Load(aFace);
Handle(Geom_Curve) BC;
@@ -207,7 +176,7 @@ void Prs3d_WFRestrictedFace::Add
BC = GB->VIso(Coord);
//Note that the isos are the part of the shape, it will be displayed after a computation the whole shape
//NbPoints = 30 - default parameter for computation of such curves
DrawFaceIso::Add(aPresentation,GeomAdaptor_Curve(BC), b1, b2, aDeflection, Pnts, 30, !isPA);
DrawFaceIso::Add(aPresentation,GeomAdaptor_Curve(BC), b1, b2, aDeflection, Pnts, 30, Standard_False);
Curves.Append(Pnts);
}
else {
@@ -215,14 +184,11 @@ void Prs3d_WFRestrictedFace::Add
anIso.Load(GeomAbs_IsoU,Coord,b1,b2);
else
anIso.Load(GeomAbs_IsoV,Coord,b1,b2);
DrawFaceIso::Add(aPresentation,anIso, aDeflection, aDrawer, Pnts, !isPA);
DrawFaceIso::Add(aPresentation,anIso, aDeflection, aDrawer, Pnts, Standard_False);
Curves.Append(Pnts);
}
}
}
#ifdef DEBUG
RestrictedFaceTimer4.Stop();
#endif
}
@@ -380,12 +346,10 @@ Standard_Boolean Prs3d_WFRestrictedFace::Match
}
}
return Standard_False;
return Standard_False;
}
//=========================================================================
// function: Add
// purpose
@@ -393,27 +357,19 @@ Standard_Boolean Prs3d_WFRestrictedFace::Match
void Prs3d_WFRestrictedFace::Add
(const Handle (Prs3d_Presentation)& aPresentation,
const Handle(BRepAdaptor_HSurface)& aFace,
const Handle (Prs3d_Drawer)& aDrawer){
Standard_Integer finu = aDrawer->UIsoAspect()->Number();
Standard_Integer finv = aDrawer->VIsoAspect()->Number();
Quantity_Length aDeflection = aDrawer->MaximalChordialDeviation();
Handle(Graphic3d_Group) TheGroup = Prs3d_Root::CurrentGroup(aPresentation);
TheGroup->BeginPrimitives();
const Handle (Prs3d_Drawer)& aDrawer)
{
Prs3d_NListOfSequenceOfPnt Curves;
Prs3d_WFRestrictedFace::Add (
aPresentation,
aFace,
Standard_True,
Standard_True,
aDeflection,
finu,
finv,
aDrawer->MaximalChordialDeviation(),
aDrawer->UIsoAspect()->Number(),
aDrawer->VIsoAspect()->Number(),
aDrawer,
Curves);
TheGroup->EndPrimitives();
}
@@ -424,20 +380,17 @@ void Prs3d_WFRestrictedFace::Add
void Prs3d_WFRestrictedFace::AddUIso
(const Handle (Prs3d_Presentation)& aPresentation,
const Handle(BRepAdaptor_HSurface)& aFace,
const Handle (Prs3d_Drawer)& aDrawer) {
Standard_Integer finu = aDrawer->UIsoAspect()->Number();
Standard_Integer finv = aDrawer->VIsoAspect()->Number();
Quantity_Length aDeflection = aDrawer->MaximalChordialDeviation();
const Handle (Prs3d_Drawer)& aDrawer)
{
Prs3d_NListOfSequenceOfPnt Curves;
Prs3d_WFRestrictedFace::Add (
aPresentation,
aFace,
Standard_True,
Standard_False,
aDeflection,
finu,
finv,
aDrawer->MaximalChordialDeviation(),
aDrawer->UIsoAspect()->Number(),
aDrawer->VIsoAspect()->Number(),
aDrawer,
Curves);
}
@@ -450,20 +403,17 @@ void Prs3d_WFRestrictedFace::AddUIso
void Prs3d_WFRestrictedFace::AddVIso
(const Handle (Prs3d_Presentation)& aPresentation,
const Handle(BRepAdaptor_HSurface)& aFace,
const Handle (Prs3d_Drawer)& aDrawer) {
Standard_Integer finu = aDrawer->UIsoAspect()->Number();
Standard_Integer finv = aDrawer->VIsoAspect()->Number();
Quantity_Length aDeflection = aDrawer->MaximalChordialDeviation();
const Handle (Prs3d_Drawer)& aDrawer)
{
Prs3d_NListOfSequenceOfPnt Curves;
Prs3d_WFRestrictedFace::Add (
aPresentation,
aFace,
Standard_False,
Standard_True,
aDeflection,
finu,
finv,
aDrawer->MaximalChordialDeviation(),
aDrawer->UIsoAspect()->Number(),
aDrawer->VIsoAspect()->Number(),
aDrawer,
Curves);
}
@@ -479,20 +429,17 @@ Standard_Boolean Prs3d_WFRestrictedFace::Match
const Quantity_Length Z,
const Quantity_Length aDistance,
const Handle(BRepAdaptor_HSurface)& aFace,
const Handle (Prs3d_Drawer)& aDrawer){
Standard_Integer finu = aDrawer->UIsoAspect()->Number();
Standard_Integer finv = aDrawer->VIsoAspect()->Number();
Quantity_Length aDeflection = aDrawer->MaximalChordialDeviation();
const Handle (Prs3d_Drawer)& aDrawer)
{
return Prs3d_WFRestrictedFace::Match (
X,Y,Z,aDistance,
aFace,
Standard_True,
Standard_True,
aDeflection,
finu,
finv,
aDrawer);
aFace,
Standard_True,
Standard_True,
aDrawer->MaximalChordialDeviation(),
aDrawer->UIsoAspect()->Number(),
aDrawer->VIsoAspect()->Number(),
aDrawer);
}
@@ -506,20 +453,17 @@ Standard_Boolean Prs3d_WFRestrictedFace::MatchUIso
const Quantity_Length Z,
const Quantity_Length aDistance,
const Handle(BRepAdaptor_HSurface)& aFace,
const Handle (Prs3d_Drawer)& aDrawer) {
Standard_Integer finu = aDrawer->UIsoAspect()->Number();
Standard_Integer finv = aDrawer->VIsoAspect()->Number();
Quantity_Length aDeflection = aDrawer->MaximalChordialDeviation();
const Handle (Prs3d_Drawer)& aDrawer)
{
return Prs3d_WFRestrictedFace::Match (
X,Y,Z,aDistance,
aFace,
Standard_True,
Standard_False,
aDeflection,
finu,
finv,
aDrawer);
aFace,
Standard_True,
Standard_False,
aDrawer->MaximalChordialDeviation(),
aDrawer->UIsoAspect()->Number(),
aDrawer->VIsoAspect()->Number(),
aDrawer);
}
@@ -533,18 +477,15 @@ Standard_Boolean Prs3d_WFRestrictedFace::MatchVIso
const Quantity_Length Z,
const Quantity_Length aDistance,
const Handle(BRepAdaptor_HSurface)& aFace,
const Handle (Prs3d_Drawer)& aDrawer) {
Standard_Integer finu = aDrawer->UIsoAspect()->Number();
Standard_Integer finv = aDrawer->VIsoAspect()->Number();
Quantity_Length aDeflection = aDrawer->MaximalChordialDeviation();
const Handle (Prs3d_Drawer)& aDrawer)
{
return Prs3d_WFRestrictedFace::Match (
X,Y,Z,aDistance,
aFace,
Standard_False,
Standard_True,
aDeflection,
finu,
finv,
aDrawer);
aFace,
Standard_False,
Standard_True,
aDrawer->MaximalChordialDeviation(),
aDrawer->UIsoAspect()->Number(),
aDrawer->VIsoAspect()->Number(),
aDrawer);
}

View File

@@ -33,7 +33,6 @@
#include <BRepAdaptor_HSurface.hxx>
#include <BRepAdaptor_Curve.hxx>
#include <Graphic3d_AspectLine3d.hxx>
#include <Graphic3d_ArrayOfPrimitives.hxx>
#include <Graphic3d_ArrayOfPolylines.hxx>
#include <Poly_Connect.hxx>
@@ -55,14 +54,6 @@
#include <Prs3d_NListOfSequenceOfPnt.hxx>
#include <Prs3d_NListIteratorOfListOfSequenceOfPnt.hxx>
#ifdef DEB_MESH
#include <OSD_Timer.hxx>
extern OSD_Timer RestrictedFaceTimer1,RestrictedFaceTimer2,RestrictedFaceTimer3,RestrictedFaceTimer4;
extern OSD_Timer ShapeTimer;
extern OSD_Timer FaceExplorerTimer, CurveExplorerTimer;
extern OSD_Timer UIsoTimer,VIsoTimer,WireTimer,FreeBoundaryTimer,UnFreeBoundaryTimer;
#endif
static Standard_Boolean IsSame(const Handle(Graphic3d_AspectLine3d)& UAspect,
const Handle(Graphic3d_AspectLine3d)& VAspect)
{
@@ -84,50 +75,29 @@ static Standard_Boolean IsSame(const Handle(Graphic3d_AspectLine3d)& UAspect,
static Standard_Boolean AddPolygon(const TopoDS_Edge& E,
Handle(Graphic3d_Group)& TheGroup,
const Standard_Real deflection,
const Handle (Prs3d_Drawer)& ,
TColgp_SequenceOfPnt& Pnts)
Handle(Graphic3d_Group)& TheGroup,
const Standard_Real deflection,
const Handle (Prs3d_Drawer)& ,
TColgp_SequenceOfPnt& Pnts)
{
TopLoc_Location l;
gp_Pnt P;
Standard_Boolean result = Standard_False;
Standard_Boolean IsPrimArray = Graphic3d_ArrayOfPrimitives::IsEnable();
Standard_Boolean OK;
Standard_Real fi, la;
Handle(Poly_Polygon3D) Polyg;
Handle(Geom_Curve) CC3d = BRep_Tool::Curve(E, fi, la);
Polyg = BRep_Tool::Polygon3D(E, l);
if (!Polyg.IsNull()) {
OK = Polyg->Deflection() <= deflection;
OK = OK || (CC3d.IsNull());
Handle(Poly_Polygon3D) Polyg = BRep_Tool::Polygon3D(E, l);
if (OK) {
result = Standard_True;
if (!Polyg.IsNull()) {
if ((Polyg->Deflection() <= deflection) || CC3d.IsNull()) {
const TColgp_Array1OfPnt& Points = Polyg->Nodes();
Graphic3d_Array1OfVertex V(1, Points.Length());
Standard_Integer po, ii = 1;
Standard_Integer po = Points.Lower();
if (l.IsIdentity()) {
for (po = Points.Lower(); po <= Points.Upper(); po++) {
P = Points.Value(po);
V(ii).SetCoord(P.X(), P.Y(), P.Z());
Pnts.Append(P);
ii++;
}
for (; po <= Points.Upper(); po++)
Pnts.Append(Points.Value(po));
}
else {
for (po = Points.Lower(); po <= Points.Upper(); po++) {
P = Points.Value(po).Transformed(l);
V(ii).SetCoord(P.X(), P.Y(), P.Z());
Pnts.Append(P);
ii++;
}
for (; po <= Points.Upper(); po++)
Pnts.Append(Points.Value(po).Transformed(l));
}
if(!IsPrimArray)
TheGroup->Polyline(V);
return result;
return Standard_True;
}
}
@@ -135,46 +105,26 @@ static Standard_Boolean AddPolygon(const TopoDS_Edge& E,
Handle(Poly_PolygonOnTriangulation) HIndices;
BRep_Tool::PolygonOnTriangulation(E, HIndices, Tr, l);
if (!HIndices.IsNull()) {
OK = HIndices->Deflection() <= deflection;
OK = OK || (CC3d.IsNull());
if (OK) {
result = Standard_True;
if ((HIndices->Deflection() <= deflection) || CC3d.IsNull()) {
const TColStd_Array1OfInteger& Indices = HIndices->Nodes();
const TColgp_Array1OfPnt& Nodes = Tr->Nodes();
Graphic3d_Array1OfVertex V(1, Indices.Length());
Standard_Integer po, ii = 1;
Standard_Integer po = Indices.Lower();
if (l.IsIdentity()) {
for (po = Indices.Lower(); po <= Indices.Upper(); po++) {
P = Nodes(Indices(po));
V(ii).SetCoord(P.X(), P.Y(), P.Z());
Pnts.Append(P);
ii++;
}
for (; po <= Indices.Upper(); po++)
Pnts.Append(Nodes(Indices(po)));
}
else {
for (po = Indices.Lower(); po <= Indices.Upper(); po++) {
P = Nodes(Indices(po)).Transformed(l);
V(ii).SetCoord(P.X(), P.Y(), P.Z());
Pnts.Append(P);
ii++;
}
for (; po <= Indices.Upper(); po++)
Pnts.Append(Nodes(Indices(po)).Transformed(l));
}
if(!IsPrimArray)
TheGroup->Polyline(V);
return result;
return Standard_True;
}
}
return result;
return Standard_False;
}
//=========================================================================
// function: Add
// purpose
@@ -185,17 +135,6 @@ void Prs3d_WFShape::Add(const Handle (Prs3d_Presentation)& aPresentation,
{
if (aShape.IsNull()) return;
Standard_Boolean isPrimArrayEnabled = Graphic3d_ArrayOfPrimitives::IsEnable();
#ifdef DEB_MESH
RestrictedFaceTimer1.Reset();
RestrictedFaceTimer2.Reset();
RestrictedFaceTimer3.Reset();
RestrictedFaceTimer4.Reset();
#endif
#ifdef DEB_MESH
ShapeTimer.Start();
#endif
Prs3d_ShapeTool Tool(aShape);
TopTools_ListOfShape LFree, LUnFree, LWire;
for (Tool.InitCurve();Tool.MoreCurve();Tool.NextCurve())
@@ -208,13 +147,6 @@ void Prs3d_WFShape::Add(const Handle (Prs3d_Presentation)& aPresentation,
default: LUnFree.Append(E);
}
}
#ifdef DEB_MESH
ShapeTimer.Stop();
#endif
#ifdef DEB_MESH
RestrictedFaceTimer1.Start();
#endif
Standard_Real aDeflection;
if (aDrawer->TypeOfDeflection() == Aspect_TOD_RELATIVE)
@@ -235,10 +167,6 @@ void Prs3d_WFShape::Add(const Handle (Prs3d_Presentation)& aPresentation,
else
aDeflection = aDrawer->MaximalChordialDeviation();
#ifdef DEB_MESH
RestrictedFaceTimer1.Stop();
#endif
Handle(Graphic3d_Group) TheGroup = Prs3d_Root::CurrentGroup(aPresentation);
Prs3d_NListOfSequenceOfPnt UIsoCurves;
@@ -252,15 +180,8 @@ void Prs3d_WFShape::Add(const Handle (Prs3d_Presentation)& aPresentation,
{
const Standard_Integer isoU = aDrawer->UIsoAspect()->Number();
const Standard_Integer isoV = aDrawer->VIsoAspect()->Number();
#ifdef DEB_MESH
UIsoTimer.Start();
#endif
if (isoU || isoV)
{
if(!isPrimArrayEnabled) {
TheGroup->SetPrimitivesAspect(aDrawer->UIsoAspect()->Aspect());
TheGroup->BeginPrimitives();
}
BRepAdaptor_Surface S;
for (Tool.InitFace();Tool.MoreFace();Tool.NextFace())
{
@@ -285,34 +206,18 @@ void Prs3d_WFShape::Add(const Handle (Prs3d_Presentation)& aPresentation,
}
catch (Standard_Failure)
{
#ifdef DEB_MESH
const TopoDS_Face& FF = S.Face();
cout <<"probleme pour les isos de la face "<< (void*) &(*(FF).TShape()) << endl;
#endif
}
}
}
}
if(!isPrimArrayEnabled)
TheGroup->EndPrimitives();
}
#ifdef DEB_MESH
UIsoTimer.Stop();
#endif
}
else
{
const Standard_Integer isoU = aDrawer->UIsoAspect()->Number();
const Standard_Integer isoV = aDrawer->VIsoAspect()->Number();
#ifdef DEB_MESH
UIsoTimer.Start();
#endif
if (isoU)
{
if(!isPrimArrayEnabled) {
TheGroup->SetPrimitivesAspect(aDrawer->UIsoAspect()->Aspect());
TheGroup->BeginPrimitives();
}
BRepAdaptor_Surface S;
for (Tool.InitFace();Tool.MoreFace();Tool.NextFace())
{
@@ -343,19 +248,9 @@ void Prs3d_WFShape::Add(const Handle (Prs3d_Presentation)& aPresentation,
}
}
}
if(!isPrimArrayEnabled)
TheGroup->EndPrimitives();
}
#ifdef DEB_MESH
UIsoTimer.Stop();
VIsoTimer.Start();
#endif
if (isoV)
{
if(!isPrimArrayEnabled) {
TheGroup->SetPrimitivesAspect(aDrawer->VIsoAspect()->Aspect());
TheGroup->BeginPrimitives();
}
BRepAdaptor_Surface S;
for (Tool.InitFace();Tool.MoreFace();Tool.NextFace())
{
@@ -386,65 +281,48 @@ void Prs3d_WFShape::Add(const Handle (Prs3d_Presentation)& aPresentation,
}
}
}
if (!isPrimArrayEnabled) TheGroup->EndPrimitives();
}
#ifdef DEB_MESH
VIsoTimer.Stop();
#endif
}
Standard_Integer nbVertices = 0, nbBounds = 0;
if(isPrimArrayEnabled) {
if(UIsoCurves.Size() > 0) {
nbBounds = UIsoCurves.Size();
Prs3d_NListIteratorOfListOfSequenceOfPnt It;
for( It.Init(UIsoCurves); It.More(); It.Next())
nbVertices += It.Value().Length();
Handle(Graphic3d_ArrayOfPolylines) UIsoArray =
new Graphic3d_ArrayOfPolylines(nbVertices,nbBounds);
for( It.Init(UIsoCurves); It.More(); It.Next()) {
TColgp_SequenceOfPnt Pnts;
Pnts.Assign(It.Value());
UIsoArray->AddBound(Pnts.Length());
for(int i=1; i<=Pnts.Length(); i++)
UIsoArray->AddVertex(Pnts.Value(i));
}
Handle(Graphic3d_Group) TheGroup = Prs3d_Root::NewGroup(aPresentation);
TheGroup->SetPrimitivesAspect(aDrawer->UIsoAspect()->Aspect());
TheGroup->BeginPrimitives();
TheGroup->AddPrimitiveArray(UIsoArray);
TheGroup->EndPrimitives();
}
if(UIsoCurves.Size() > 0) {
nbBounds = UIsoCurves.Size();
Prs3d_NListIteratorOfListOfSequenceOfPnt It;
for( It.Init(UIsoCurves); It.More(); It.Next())
nbVertices += It.Value().Length();
Handle(Graphic3d_ArrayOfPolylines) UIsoArray =
new Graphic3d_ArrayOfPolylines(nbVertices,nbBounds);
for( It.Init(UIsoCurves); It.More(); It.Next()) {
TColgp_SequenceOfPnt Pnts;
Pnts.Assign(It.Value());
UIsoArray->AddBound(Pnts.Length());
for(int i=1; i<=Pnts.Length(); i++)
UIsoArray->AddVertex(Pnts.Value(i));
}
Handle(Graphic3d_Group) TheGroup = Prs3d_Root::NewGroup(aPresentation);
TheGroup->SetPrimitivesAspect(aDrawer->UIsoAspect()->Aspect());
TheGroup->AddPrimitiveArray(UIsoArray);
}
if(VIsoCurves.Size() > 0) {
nbBounds = VIsoCurves.Size();
Prs3d_NListIteratorOfListOfSequenceOfPnt It;
for( It.Init(VIsoCurves); It.More(); It.Next())
nbVertices += It.Value().Length();
Handle(Graphic3d_ArrayOfPolylines) VIsoArray =
new Graphic3d_ArrayOfPolylines(nbVertices,nbBounds);
for( It.Init(VIsoCurves); It.More(); It.Next()) {
TColgp_SequenceOfPnt Pnts;
Pnts.Assign(It.Value());
VIsoArray->AddBound(Pnts.Length());
for(int i=1; i<=Pnts.Length(); i++)
VIsoArray->AddVertex(Pnts.Value(i));
}
Handle(Graphic3d_Group) TheGroup = Prs3d_Root::NewGroup(aPresentation);
TheGroup->SetPrimitivesAspect(aDrawer->VIsoAspect()->Aspect());
TheGroup->BeginPrimitives();
TheGroup->AddPrimitiveArray(VIsoArray);
TheGroup->EndPrimitives();
if(VIsoCurves.Size() > 0) {
nbBounds = VIsoCurves.Size();
Prs3d_NListIteratorOfListOfSequenceOfPnt It;
for( It.Init(VIsoCurves); It.More(); It.Next())
nbVertices += It.Value().Length();
Handle(Graphic3d_ArrayOfPolylines) VIsoArray =
new Graphic3d_ArrayOfPolylines(nbVertices,nbBounds);
for( It.Init(VIsoCurves); It.More(); It.Next()) {
TColgp_SequenceOfPnt Pnts;
Pnts.Assign(It.Value());
VIsoArray->AddBound(Pnts.Length());
for(int i=1; i<=Pnts.Length(); i++)
VIsoArray->AddVertex(Pnts.Value(i));
}
Handle(Graphic3d_Group) TheGroup = Prs3d_Root::NewGroup(aPresentation);
TheGroup->SetPrimitivesAspect(aDrawer->VIsoAspect()->Aspect());
TheGroup->AddPrimitiveArray(VIsoArray);
}
#ifdef DEB_MESH
WireTimer.Start();
#endif
if(!isPrimArrayEnabled) {
TheGroup->SetPrimitivesAspect(aDrawer->UIsoAspect()->Aspect());
TheGroup->BeginPrimitives();
}
gp_Pnt P;
TopLoc_Location l;
Graphic3d_Vertex V1, V2;
@@ -514,11 +392,6 @@ void Prs3d_WFShape::Add(const Handle (Prs3d_Presentation)& aPresentation,
gp_Pnt P2 = Nodes(Free(2*i)).Transformed(l);
SurfPnts.Append(P1);
SurfPnts.Append(P2);
if(!isPrimArrayEnabled) {
V1.SetCoord(P1.X(), P1.Y(), P1.Z());
V2.SetCoord(P2.X(), P2.Y(), P2.Z());
TheGroup->Polyline(V1, V2);
}
}
}
if(DispTriangles) {
@@ -527,19 +400,12 @@ void Prs3d_WFShape::Add(const Handle (Prs3d_Presentation)& aPresentation,
gp_Pnt P2 = Nodes(Internal(2*i)).Transformed(l);
SurfPnts.Append(P1);
SurfPnts.Append(P2);
if(!isPrimArrayEnabled) {
V1.SetCoord(P1.X(), P1.Y(), P1.Z());
V2.SetCoord(P2.X(), P2.Y(), P2.Z());
TheGroup->Polyline(V1, V2);
}
}
}
}
}
}
if(!isPrimArrayEnabled)
TheGroup->EndPrimitives();
if(isPrimArrayEnabled && SurfPnts.Length()>0){
if(SurfPnts.Length()>0){
nbVertices = SurfPnts.Length();
nbBounds = (Standard_Integer)nbVertices / 2;
Handle(Graphic3d_ArrayOfPolylines) SurfArray =
@@ -550,15 +416,11 @@ void Prs3d_WFShape::Add(const Handle (Prs3d_Presentation)& aPresentation,
SurfArray->AddVertex(SurfPnts.Value(i+1));
}
Handle(Graphic3d_Group) TheGroup = Prs3d_Root::NewGroup(aPresentation);
if(DispTriangles && Tool.HasSurface()) {
if(DispTriangles && Tool.HasSurface())
TheGroup->SetPrimitivesAspect(aDrawer->UIsoAspect()->Aspect());
}
else {
else
TheGroup->SetPrimitivesAspect(aDrawer->FreeBoundaryAspect()->Aspect());
}
TheGroup->BeginPrimitives();
TheGroup->AddPrimitiveArray(SurfArray);
TheGroup->EndPrimitives();
}
TopTools_ListIteratorOfListOfShape It;
@@ -566,7 +428,6 @@ void Prs3d_WFShape::Add(const Handle (Prs3d_Presentation)& aPresentation,
{
// Wire (without any neighbour)
TheGroup->SetPrimitivesAspect(aDrawer->WireAspect()->Aspect());
TheGroup->BeginPrimitives();
for (It.Initialize(LWire); It.More(); It.Next()) {
const TopoDS_Edge& E = TopoDS::Edge(It.Value());
try
@@ -576,7 +437,7 @@ void Prs3d_WFShape::Add(const Handle (Prs3d_Presentation)& aPresentation,
if (!AddPolygon(E, TheGroup, aDeflection, aDrawer, Pnts)) {
if (BRep_Tool::IsGeometric(E)) {
BRepAdaptor_Curve C(E);
CurvePresentation::Add(aPresentation, C, aDeflection, aDrawer, Pnts, !isPrimArrayEnabled);
CurvePresentation::Add(aPresentation, C, aDeflection, aDrawer, Pnts, Standard_False);
WireCurves.Append(Pnts);
}
}
@@ -590,21 +451,11 @@ void Prs3d_WFShape::Add(const Handle (Prs3d_Presentation)& aPresentation,
#endif
}
}
TheGroup->EndPrimitives();
}
#ifdef DEB_MESH
WireTimer.Stop();
FreeBoundaryTimer.Start();
#endif
if (aDrawer->FreeBoundaryDraw())
{
// Free boundaries;
if(!isPrimArrayEnabled) {
TheGroup->SetPrimitivesAspect(aDrawer->FreeBoundaryAspect()->Aspect());
TheGroup->BeginPrimitives();
}
for (It.Initialize(LFree); It.More(); It.Next()) {
const TopoDS_Edge& E = TopoDS::Edge(It.Value());
if (!BRep_Tool::Degenerated(E)) {
@@ -614,7 +465,7 @@ void Prs3d_WFShape::Add(const Handle (Prs3d_Presentation)& aPresentation,
if (!AddPolygon(E, TheGroup, aDeflection, aDrawer, Pnts)) {
if (BRep_Tool::IsGeometric(E)) {
BRepAdaptor_Curve C(E);
CurvePresentation::Add(aPresentation, C, aDeflection, aDrawer, Pnts, !isPrimArrayEnabled);
CurvePresentation::Add(aPresentation, C, aDeflection, aDrawer, Pnts, Standard_False);
FreeCurves.Append(Pnts);
}
}
@@ -629,23 +480,12 @@ void Prs3d_WFShape::Add(const Handle (Prs3d_Presentation)& aPresentation,
}
}
}
if(!isPrimArrayEnabled)
TheGroup->EndPrimitives();
}
#ifdef DEB_MESH
FreeBoundaryTimer.Stop();
UnFreeBoundaryTimer.Start();
#endif
if (aDrawer->UnFreeBoundaryDraw()) {
// Unfree boundaries;
if(!isPrimArrayEnabled) {
TheGroup->SetPrimitivesAspect(aDrawer->UnFreeBoundaryAspect()->Aspect());
TheGroup->BeginPrimitives();
}
for (It.Initialize(LUnFree); It.More(); It.Next()) {
const TopoDS_Edge& E = TopoDS::Edge(It.Value());
try
@@ -655,7 +495,7 @@ void Prs3d_WFShape::Add(const Handle (Prs3d_Presentation)& aPresentation,
if (!AddPolygon(E, TheGroup, aDeflection, aDrawer, Pnts)) {
if (BRep_Tool::IsGeometric(E)) {
BRepAdaptor_Curve C(E);
CurvePresentation::Add(aPresentation, C, aDeflection, aDrawer, Pnts, !isPrimArrayEnabled);
CurvePresentation::Add(aPresentation, C, aDeflection, aDrawer, Pnts, Standard_False);
UnFreeCurves.Append(Pnts);
}
}
@@ -669,113 +509,77 @@ void Prs3d_WFShape::Add(const Handle (Prs3d_Presentation)& aPresentation,
#endif
}
}
if(!isPrimArrayEnabled)
TheGroup->EndPrimitives();
}
if(isPrimArrayEnabled) {
if(WireCurves.Size() > 0) {
nbBounds = WireCurves.Size();
Prs3d_NListIteratorOfListOfSequenceOfPnt It;
for( It.Init(WireCurves); It.More(); It.Next())
nbVertices += It.Value().Length();
Handle(Graphic3d_ArrayOfPolylines) WireArray =
new Graphic3d_ArrayOfPolylines(nbVertices,nbBounds);
for( It.Init(WireCurves); It.More(); It.Next()) {
TColgp_SequenceOfPnt Pnts;
Pnts.Assign(It.Value());
WireArray->AddBound(Pnts.Length());
for(i=1; i<=Pnts.Length(); i++)
WireArray->AddVertex(Pnts.Value(i));
}
Handle(Graphic3d_Group) TheGroup = Prs3d_Root::NewGroup(aPresentation);
TheGroup->SetPrimitivesAspect(aDrawer->WireAspect()->Aspect());
TheGroup->BeginPrimitives();
TheGroup->AddPrimitiveArray(WireArray);
TheGroup->EndPrimitives();
}
if(FreeCurves.Size() > 0) {
nbBounds = FreeCurves.Size();
Prs3d_NListIteratorOfListOfSequenceOfPnt It;
for( It.Init(FreeCurves); It.More(); It.Next())
nbVertices += It.Value().Length();
Handle(Graphic3d_ArrayOfPolylines) FreeArray =
new Graphic3d_ArrayOfPolylines(nbVertices,nbBounds);
for( It.Init(FreeCurves); It.More(); It.Next()) {
TColgp_SequenceOfPnt Pnts;
Pnts.Assign(It.Value());
FreeArray->AddBound(Pnts.Length());
for(i=1; i<=Pnts.Length(); i++)
FreeArray->AddVertex(Pnts.Value(i));
}
Handle(Graphic3d_Group) TheGroup = Prs3d_Root::NewGroup(aPresentation);
TheGroup->SetPrimitivesAspect(aDrawer->FreeBoundaryAspect()->Aspect());
TheGroup->BeginPrimitives();
TheGroup->AddPrimitiveArray(FreeArray);
TheGroup->EndPrimitives();
}
if(UnFreeCurves.Size() > 0) {
nbBounds = UnFreeCurves.Size();
Prs3d_NListIteratorOfListOfSequenceOfPnt It;
for( It.Init(UnFreeCurves); It.More(); It.Next())
nbVertices += It.Value().Length();
Handle(Graphic3d_ArrayOfPolylines) UnFreeArray =
new Graphic3d_ArrayOfPolylines(nbVertices,nbBounds);
for( It.Init(UnFreeCurves); It.More(); It.Next()) {
TColgp_SequenceOfPnt Pnts;
Pnts.Assign(It.Value());
UnFreeArray->AddBound(Pnts.Length());
for(i=1; i<=Pnts.Length(); i++)
UnFreeArray->AddVertex(Pnts.Value(i));
}
Handle(Graphic3d_Group) TheGroup = Prs3d_Root::NewGroup(aPresentation);
TheGroup->SetPrimitivesAspect(aDrawer->UnFreeBoundaryAspect()->Aspect());
TheGroup->BeginPrimitives();
TheGroup->AddPrimitiveArray(UnFreeArray);
TheGroup->EndPrimitives();
}
if(WireCurves.Size() > 0) {
nbBounds = WireCurves.Size();
Prs3d_NListIteratorOfListOfSequenceOfPnt It;
for( It.Init(WireCurves); It.More(); It.Next())
nbVertices += It.Value().Length();
Handle(Graphic3d_ArrayOfPolylines) WireArray =
new Graphic3d_ArrayOfPolylines(nbVertices,nbBounds);
for( It.Init(WireCurves); It.More(); It.Next()) {
TColgp_SequenceOfPnt Pnts;
Pnts.Assign(It.Value());
WireArray->AddBound(Pnts.Length());
for(i=1; i<=Pnts.Length(); i++)
WireArray->AddVertex(Pnts.Value(i));
}
Handle(Graphic3d_Group) TheGroup = Prs3d_Root::NewGroup(aPresentation);
TheGroup->SetPrimitivesAspect(aDrawer->WireAspect()->Aspect());
TheGroup->AddPrimitiveArray(WireArray);
}
if(FreeCurves.Size() > 0) {
nbBounds = FreeCurves.Size();
Prs3d_NListIteratorOfListOfSequenceOfPnt It;
for( It.Init(FreeCurves); It.More(); It.Next())
nbVertices += It.Value().Length();
Handle(Graphic3d_ArrayOfPolylines) FreeArray =
new Graphic3d_ArrayOfPolylines(nbVertices,nbBounds);
for( It.Init(FreeCurves); It.More(); It.Next()) {
TColgp_SequenceOfPnt Pnts;
Pnts.Assign(It.Value());
FreeArray->AddBound(Pnts.Length());
for(i=1; i<=Pnts.Length(); i++)
FreeArray->AddVertex(Pnts.Value(i));
}
Handle(Graphic3d_Group) TheGroup = Prs3d_Root::NewGroup(aPresentation);
TheGroup->SetPrimitivesAspect(aDrawer->FreeBoundaryAspect()->Aspect());
TheGroup->AddPrimitiveArray(FreeArray);
}
if(UnFreeCurves.Size() > 0) {
nbBounds = UnFreeCurves.Size();
Prs3d_NListIteratorOfListOfSequenceOfPnt It;
for( It.Init(UnFreeCurves); It.More(); It.Next())
nbVertices += It.Value().Length();
Handle(Graphic3d_ArrayOfPolylines) UnFreeArray =
new Graphic3d_ArrayOfPolylines(nbVertices,nbBounds);
for( It.Init(UnFreeCurves); It.More(); It.Next()) {
TColgp_SequenceOfPnt Pnts;
Pnts.Assign(It.Value());
UnFreeArray->AddBound(Pnts.Length());
for(i=1; i<=Pnts.Length(); i++)
UnFreeArray->AddVertex(Pnts.Value(i));
}
Handle(Graphic3d_Group) TheGroup = Prs3d_Root::NewGroup(aPresentation);
TheGroup->SetPrimitivesAspect(aDrawer->UnFreeBoundaryAspect()->Aspect());
TheGroup->AddPrimitiveArray(UnFreeArray);
}
// Points
Standard_Boolean theFirst = Standard_True;
for(Tool.InitVertex();Tool.MoreVertex();Tool.NextVertex()){
if(theFirst){
theFirst = Standard_False;
if(!isPrimArrayEnabled) {
TheGroup->SetPrimitivesAspect(aDrawer->PointAspect()->Aspect());
TheGroup->BeginPrimitives();
}
}
TopoDS_Vertex V = Tool.GetVertex();
if(!isPrimArrayEnabled)
PointPresentation::Add(aPresentation,V);
ShapePoints.Append(BRep_Tool::Pnt(V));
}
if (!theFirst) TheGroup->EndPrimitives();
for(Tool.InitVertex();Tool.MoreVertex();Tool.NextVertex())
ShapePoints.Append(BRep_Tool::Pnt(Tool.GetVertex()));
nbVertices = ShapePoints.Length();
if(isPrimArrayEnabled && nbVertices > 0) {
if(nbVertices > 0) {
Graphic3d_Array1OfVertex PointArray(1, nbVertices);
for(i=1; i<=nbVertices; i++)
PointArray.SetValue(i, Graphic3d_Vertex(ShapePoints.Value(i).X(), ShapePoints.Value(i).Y(), ShapePoints.Value(i).Z()));
Handle(Graphic3d_Group) TheGroup = Prs3d_Root::NewGroup(aPresentation);
TheGroup->SetPrimitivesAspect(aDrawer->PointAspect()->Aspect());
TheGroup->BeginPrimitives();
TheGroup->MarkerSet(PointArray);
TheGroup->EndPrimitives();
}
#ifdef DEB_MESH
UnFreeBoundaryTimer.Stop();
// cout << "Restrictions Min Max computation " ;
// RestrictedFaceTimer1.Show();
// cout << "Iso loading " ;
// RestrictedFaceTimer2.Show();
// cout << "Iso hatching " ;
// RestrictedFaceTimer3.Show();
// cout << "Iso drawing " ;
// RestrictedFaceTimer4.Show();
#endif
}