1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-09 13:22:24 +03:00

0023959: Getting rid of generic classes in Visualization: generic classes were removed from Prs3d

Errors corrections; DsgPrs_DatumTool class was removed as unused
This commit is contained in:
aba
2013-06-20 15:28:40 +04:00
parent 8ba3c5e073
commit d7223c763e
48 changed files with 1874 additions and 3239 deletions

8
src/StdPrs/FILES Normal file
View File

@@ -0,0 +1,8 @@
StdPrs_HLRShape.hxx
StdPrs_HLRShape.cxx
StdPrs_Point.hxx
StdPrs_Vertex.hxx
StdPrs_WFDeflectionShape.hxx
StdPrs_WFRestrictedFace.hxx
StdPrs_WFRestrictedFace.cxx
StdPrs_WFShape.hxx

View File

@@ -28,24 +28,24 @@ package StdPrs
-- modes such as wireframe, shading or hidden line removal mode.
uses
Prs3d,
Prs3d,
Geom,
Geom2d,
Adaptor3d,
Adaptor2d,
GeomAdaptor,
GeomAdaptor,
Geom2dAdaptor,
BRepAdaptor,
BRepAdaptor,
TopTools,
TopoDS,
TopExp,
TopAbs,
TopAbs,
BRepTools,
Bnd,
TColStd,
HLRAlgo,
HLRBRep,
Quantity,
TColStd,
HLRAlgo,
HLRBRep,
Quantity,
BRepMesh,
gp,
TColgp,
@@ -58,17 +58,9 @@ is
class ToolVertex;
class ToolRFace;
class HLRToolShape;
--class ToolSectionShape;
class ToolShadedShape;
class ShadedShape;
class Point
instantiates Point from Prs3d(Point from Geom, ToolPoint from StdPrs);
class Vertex
instantiates Point from Prs3d(Vertex from TopoDS, ToolVertex from StdPrs);
class PoleCurve;
---Purpose: computes the presentation of curves by drawing
-- a broken line linking the poles of the curve.
@@ -103,18 +95,12 @@ is
-----------------------------------------------
class WFDeflectionRestrictedFace;
class WFDeflectionShape instantiates WFShape from Prs3d
(WFDeflectionRestrictedFace from StdPrs,
DeflectionCurve from StdPrs,
Vertex from StdPrs);
---Purpose: computes the wireframe presentation of faces with
-- restrictions by displaying a given number of U and/or
-- V isoparametric curves. The isoparametric curves are
-- drawn with respect to a maximal chordial deviation.
-- The presentation includes the restriction curves.
-----------------------------------------------
--- Instantiations whith no deflection drawing.
-----------------------------------------------
class Curve;
---Purpose: computes the presentation of objects to be
-- seen as curves. The computation will be made
@@ -126,29 +112,37 @@ is
-- by displaying a given number of U and/or V isoparametric
--- curves. The isoparametric curves are drawn with respect
-- to a given number of points.
class WFRestrictedFace instantiates WFRestrictedFace from Prs3d
(Curve from StdPrs,
ToolRFace from StdPrs);
class WFShape instantiates WFShape from Prs3d
(WFRestrictedFace from StdPrs,
Curve from StdPrs,
Vertex from StdPrs);
class HLRShape instantiates HLRShape from Prs3d
(Shape from TopoDS,
HLRToolShape from StdPrs,
Curve from BRepAdaptor,
DeflectionCurve from StdPrs);
class HLRPolyShape;
---Category: Hidden lines removal algorithms.
class HLRPolyShape;
---Purpose: computes the presentation of objects with
-- removal of their hidden lines for a specific
-- projector. The polygonal algorithm is used.
imported HLRShape;
---Purpose: computes the presentation of objects with
-- removal of their hidden lines for a specific
-- projector. The exact algorithm is used.
imported NListOfSequenceOfPnt from Prs3d;
imported NListIteratorOfListOfSequenceOfPnt from Prs3d;
imported NListOfSequenceOfPnt from Prs3d;
imported NListIteratorOfListOfSequenceOfPnt from Prs3d;
imported WFShape;
imported WFDeflectionShape;
---Purpose: computes the wireframe presentation of surfaces
-- by displaying planar sections.
imported Vertex;
imported Point;
---Purpose: computes the presentation of objects to be
-- seen as points.
imported WFRestrictedFace;
---Purpose: Computes the wireframe presentation of faces with
-- restrictions by displaying a given number of U and/or
-- V isoparametric curves. The isoparametric curves are
-- drawn with a fixed number of points.
-- The presentation includes the restriction curves.
end StdPrs;

View File

@@ -0,0 +1,76 @@
// Copyright (c) 2013 OPEN CASCADE SAS
//
// The content of this file is subject to the Open CASCADE Technology Public
// License Version 6.5 (the "License"). You may not use the content of this file
// except in compliance with the License. Please obtain a copy of the License
// at http://www.opencascade.org and read it completely before using this file.
//
// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
//
// The Original Code and all software distributed under the License is
// distributed on an "AS IS" basis, without warranty of any kind, and the
// Initial Developer hereby disclaims all such warranties, including without
// limitation, any warranties of merchantability, fitness for a particular
// purpose or non-infringement. Please see the License for the specific terms
// and conditions governing the rights and limitations under the License.
#include <BRepAdaptor_Curve.hxx>
#include <Graphic3d_Group.hxx>
#include <Prs3d_Drawer.hxx>
#include <Prs3d_LineAspect.hxx>
#include <Prs3d_Presentation.hxx>
#include <Prs3d_Projector.hxx>
#include <StdPrs_HLRShape.hxx>
#include <StdPrs_HLRToolShape.hxx>
#include <StdPrs_DeflectionCurve.hxx>
#include <TopoDS_Shape.hxx>
#include <TColgp_SequenceOfPnt.hxx>
//=======================================================================
//function : Add
//purpose :
//=======================================================================
void StdPrs_HLRShape::Add (const Handle(Prs3d_Presentation)& thePresentation,
const TopoDS_Shape& theShape,
const Handle(Prs3d_Drawer)& theDrawer,
const Handle(Prs3d_Projector)& theProjector)
{
StdPrs_HLRToolShape aTool(theShape, theProjector->Projector());
Standard_Integer aNbEdges = aTool.NbEdges();
Standard_Integer anI;
Standard_Real anU1, anU2;
BRepAdaptor_Curve aCurve;
Standard_Real aDeviation = theDrawer->MaximalChordialDeviation();
Handle(Graphic3d_Group) aGroup = Prs3d_Root::CurrentGroup(thePresentation);
aGroup->SetPrimitivesAspect(theDrawer->SeenLineAspect()->Aspect());
Standard_Real anAngle = theDrawer->DeviationAngle();
TColgp_SequenceOfPnt aPoints;
for (anI = 1; anI <= aNbEdges; ++anI)
{
for(aTool.InitVisible(anI); aTool.MoreVisible(); aTool.NextVisible())
{
aTool.Visible(aCurve, anU1, anU2);
StdPrs_DeflectionCurve::Add(thePresentation, aCurve,
anU1, anU2, aDeviation, aPoints, anAngle);
}
}
if(theDrawer->DrawHiddenLine())
{
aGroup->SetPrimitivesAspect(theDrawer->HiddenLineAspect()->Aspect());
for (anI = 1; anI <= aNbEdges; ++anI)
{
for (aTool.InitHidden(anI); aTool.MoreHidden(); aTool.NextHidden())
{
aTool.Hidden(aCurve, anU1, anU2);
StdPrs_DeflectionCurve::Add(thePresentation, aCurve,
anU1, anU2, aDeviation, aPoints, anAngle);
}
}
}
}

View File

@@ -0,0 +1,38 @@
// Copyright (c) 2013 OPEN CASCADE SAS
//
// The content of this file is subject to the Open CASCADE Technology Public
// License Version 6.5 (the "License"). You may not use the content of this file
// except in compliance with the License. Please obtain a copy of the License
// at http://www.opencascade.org and read it completely before using this file.
//
// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
//
// The Original Code and all software distributed under the License is
// distributed on an "AS IS" basis, without warranty of any kind, and the
// Initial Developer hereby disclaims all such warranties, including without
// limitation, any warranties of merchantability, fitness for a particular
// purpose or non-infringement. Please see the License for the specific terms
// and conditions governing the rights and limitations under the License.
#ifndef _StdPrs_HLRFace_H__
#define _StdPrs_HLRFace_H__
#include <Prs3d_Root.hxx>
#include <Handle_Prs3d_Presentation.hxx>
#include <Handle_Prs3d_Drawer.hxx>
#include <Handle_Prs3d_Projector.hxx>
class StdPrs_HLRShape: public Prs3d_Root
{
public:
DEFINE_STANDARD_ALLOC
Standard_EXPORT static void Add
(const Handle(Prs3d_Presentation)& thePresentation,
const TopoDS_Shape& theShape,
const Handle(Prs3d_Drawer)& theDrawer,
const Handle(Prs3d_Projector)& theProjector);
};
#endif

View File

@@ -0,0 +1,28 @@
// Copyright (c) 2013 OPEN CASCADE SAS
//
// The content of this file is subject to the Open CASCADE Technology Public
// License Version 6.5 (the "License"). You may not use the content of this file
// except in compliance with the License. Please obtain a copy of the License
// at http://www.opencascade.org and read it completely before using this file.
//
// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
//
// The Original Code and all software distributed under the License is
// distributed on an "AS IS" basis, without warranty of any kind, and the
// Initial Developer hereby disclaims all such warranties, including without
// limitation, any warranties of merchantability, fitness for a particular
// purpose or non-infringement. Please see the License for the specific terms
// and conditions governing the rights and limitations under the License.
#ifndef _StdPrs_Point_H__
#define _StdPrs_Point_H__
#include <Geom_Point.hxx>
#include <Prs3d_Point.hxx>
#include <Prs3d_Drawer.hxx>
#include <Prs3d_Presentation.hxx>
#include <StdPrs_ToolPoint.hxx>
typedef Prs3d_Point<Handle(Geom_Point), StdPrs_ToolPoint> StdPrs_Point;
#endif

View File

@@ -0,0 +1,28 @@
// Copyright (c) 2013 OPEN CASCADE SAS
//
// The content of this file is subject to the Open CASCADE Technology Public
// License Version 6.5 (the "License"). You may not use the content of this file
// except in compliance with the License. Please obtain a copy of the License
// at http://www.opencascade.org and read it completely before using this file.
//
// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
//
// The Original Code and all software distributed under the License is
// distributed on an "AS IS" basis, without warranty of any kind, and the
// Initial Developer hereby disclaims all such warranties, including without
// limitation, any warranties of merchantability, fitness for a particular
// purpose or non-infringement. Please see the License for the specific terms
// and conditions governing the rights and limitations under the License.
#ifndef _StdPrs_Vertex_H__
#define _StdPrs_Vertex_H__
#include <Prs3d_Point.hxx>
#include <Prs3d_Drawer.hxx>
#include <TopoDS_Vertex.hxx>
#include <StdPrs_ToolVertex.hxx>
#include <Prs3d_Presentation.hxx>
typedef Prs3d_Point<TopoDS_Vertex, StdPrs_ToolVertex> StdPrs_Vertex;
#endif

View File

@@ -0,0 +1,32 @@
// Copyright (c) 2013 OPEN CASCADE SAS
//
// The content of this file is subject to the Open CASCADE Technology Public
// License Version 6.5 (the "License"). You may not use the content of this file
// except in compliance with the License. Please obtain a copy of the License
// at http://www.opencascade.org and read it completely before using this file.
//
// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
//
// The Original Code and all software distributed under the License is
// distributed on an "AS IS" basis, without warranty of any kind, and the
// Initial Developer hereby disclaims all such warranties, including without
// limitation, any warranties of merchantability, fitness for a particular
// purpose or non-infringement. Please see the License for the specific terms
// and conditions governing the rights and limitations under the License.
#ifndef _StdPrs_WFDeflectionShape_H__
#define _StdPrs_WFDeflectionShape_H__
#include <Prs3d_Presentation.hxx>
#include <Prs3d_WFShape.hxx>
#include <Prs3d_Drawer.hxx>
#include <Prs3d_Root.hxx>
#include <StdPrs_WFDeflectionRestrictedFace.hxx>
#include <StdPrs_DeflectionCurve.hxx>
#include <StdPrs_Vertex.hxx>
#include <TopoDS_Shape.hxx>
#include <TopTools_HSequenceOfShape.hxx>
typedef Prs3d_WFShape <StdPrs_WFDeflectionRestrictedFace, StdPrs_DeflectionCurve, StdPrs_Vertex> StdPrs_WFDeflectionShape;
#endif

View File

@@ -0,0 +1,524 @@
// Copyright (c) 2013 OPEN CASCADE SAS
//
// The content of this file is subject to the Open CASCADE Technology Public
// License Version 6.5 (the "License"). You may not use the content of this file
// except in compliance with the License. Please obtain a copy of the License
// at http://www.opencascade.org and read it completely before using this file.
//
// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
//
// The Original Code and all software distributed under the License is
// distributed on an "AS IS" basis, without warranty of any kind, and the
// Initial Developer hereby disclaims all such warranties, including without
// limitation, any warranties of merchantability, fitness for a particular
// purpose or non-infringement. Please see the License for the specific terms
// and conditions governing the rights and limitations under the License.
#include <Hatch_Hatcher.hxx>
#include <Graphic3d_Group.hxx>
#include <gp_Pnt.hxx>
#include <Prs3d_IsoAspect.hxx>
#include <Adaptor3d_IsoCurve.hxx>
#include <Bnd_Box2d.hxx>
#include <BndLib_Add2dCurve.hxx>
#include <Precision.hxx>
#include <GeomAdaptor_Curve.hxx>
#include <Geom_Curve.hxx>
#include <GeomAbs_SurfaceType.hxx>
#include <Geom_Surface.hxx>
#include <StdPrs_WFRestrictedFace.hxx>
#include <StdPrs_ToolRFace.hxx>
#include <StdPrs_Curve.hxx>
#include <Prs3d_NListOfSequenceOfPnt.hxx>
//=========================================================================
// function: Add
// purpose
//=========================================================================
void StdPrs_WFRestrictedFace::Add
(const Handle (Prs3d_Presentation)& thePresentation,
const Handle(BRepAdaptor_HSurface)& theFace,
const Standard_Boolean theDrawUIso,
const Standard_Boolean theDrawVIso,
const Quantity_Length theDeflection,
const Standard_Integer theNbUIso,
const Standard_Integer theNBVIso,
const Handle(Prs3d_Drawer)& theDrawer,
Prs3d_NListOfSequenceOfPnt& theCurves)
{
Standard_Real aLimit = theDrawer->MaximalParameterValue();
Standard_Integer aNbPoints = theDrawer->Discretisation();
StdPrs_ToolRFace aToolRst (theFace);
// Compute bounds of the restriction
Standard_Real aUMin,aUMax,aVMin,aVMax;
Standard_Integer anI;
gp_Pnt2d aPoint1,aPoint2;
Bnd_Box2d aBndBox;
for (aToolRst.Init(); aToolRst.More(); aToolRst.Next())
{
Adaptor2d_Curve2dPtr aRCurve = aToolRst.Value();
BndLib_Add2dCurve::Add(*aRCurve, Precision::PConfusion(), aBndBox);
}
if (!aBndBox.IsVoid())
aBndBox.Get(aUMin, aVMin, aUMax, aVMax);
else
{ // No pcurves -- take natural bounds
aUMin = theFace->Surface().FirstUParameter();
aVMin = theFace->Surface().FirstVParameter();
aUMax = theFace->Surface().LastUParameter();
aVMax = theFace->Surface().LastVParameter();
}
// Load the isos
Hatch_Hatcher anIsoBuild(1.e-5,aToolRst.IsOriented());
Standard_Boolean isFaceUClosed = theFace->IsUClosed();
Standard_Boolean isFaceVClosed = theFace->IsVClosed();
if (!isFaceUClosed)
{
aUMin = aUMin + ( aUMax - aUMin) /1000.;
aUMax = aUMax - ( aUMax - aUMin) /1000.;
}
if (!isFaceVClosed)
{
aVMin = aVMin + ( aVMax - aVMin) /1000.;
aVMax = aVMax - ( aVMax - aVMin) /1000.;
}
if (theDrawUIso)
{
if (theNbUIso > 0)
{
isFaceUClosed = Standard_False;
Standard_Real du= isFaceUClosed ? (aUMax-aUMin)/theNbUIso : (aUMax-aUMin)/(1+theNbUIso);
for (anI=1; anI<=theNbUIso;anI++)
{
anIsoBuild.AddXLine(aUMin+du*anI);
}
}
}
if (theDrawVIso)
{
if (theNBVIso > 0)
{
isFaceVClosed = Standard_False;
Standard_Real dv= isFaceVClosed ?(aVMax-aVMin)/theNBVIso : (aVMax-aVMin)/(1+theNBVIso);
for (anI=1; anI<=theNBVIso;anI++)
{
anIsoBuild.AddYLine(aVMin+dv*anI);
}
}
}
// Trim the isos
Standard_Real anU1, anU2, anU, aDU;
for (aToolRst.Init(); aToolRst.More(); aToolRst.Next())
{
TopAbs_Orientation anOrientation = aToolRst.Orientation();
if (anOrientation == TopAbs_FORWARD || anOrientation == TopAbs_REVERSED)
{
Adaptor2d_Curve2dPtr aRCurve = aToolRst.Value();
anU1 = aRCurve->FirstParameter();
anU2 = aRCurve->LastParameter();
if (aRCurve->GetType() != GeomAbs_Line)
{
aDU = (anU2-anU1)/(aNbPoints-1);
aPoint2 = aRCurve->Value(anU1);
for (anI = 2; anI <= aNbPoints; ++anI)
{
anU = anU1 + (anI-1)*aDU;
aPoint1 = aPoint2;
aPoint2 = aRCurve->Value(anU);
if(anOrientation == TopAbs_FORWARD )
anIsoBuild.Trim(aPoint1,aPoint2);
else
anIsoBuild.Trim(aPoint2,aPoint1);
}
}
else {
aPoint1 = aRCurve->Value(anU1);
aPoint2 = aRCurve->Value(anU2);
if(anOrientation == TopAbs_FORWARD )
anIsoBuild.Trim(aPoint1,aPoint2);
else
anIsoBuild.Trim(aPoint2,aPoint1);
}
}
}
// Draw the isos
Adaptor3d_IsoCurve anIsoCurve;
anIsoCurve.Load(theFace);
Handle(Geom_Curve) aBCurve;
const BRepAdaptor_Surface& aBSurface = *(BRepAdaptor_Surface*)&(theFace->Surface());
GeomAbs_SurfaceType aFaceType = theFace->GetType();
Standard_Integer aNbLines = anIsoBuild.NbLines();
Handle(Geom_Surface) aGeomBSurface;
if (aFaceType == GeomAbs_BezierSurface)
{
aGeomBSurface = aBSurface.Bezier();
}
else if (aFaceType == GeomAbs_BSplineSurface)
{
aGeomBSurface = aBSurface.BSpline();
}
for (anI = 1; anI <= aNbLines; ++anI)
{
Standard_Integer NumberOfIntervals = anIsoBuild.NbIntervals(anI);
Standard_Real anIsoCoord = anIsoBuild.Coordinate(anI);
for (Standard_Integer aJ = 1; aJ <= NumberOfIntervals; aJ++)
{
Standard_Real b1=anIsoBuild.Start(anI,aJ),b2=anIsoBuild.End(anI,aJ);
if(b1 == RealFirst() || b2 == RealLast())
continue;
TColgp_SequenceOfPnt aPoints;
if (!aGeomBSurface.IsNull())
{
if (anIsoBuild.IsXLine(anI))
aBCurve = aGeomBSurface->UIso(anIsoCoord);
else
aBCurve = aGeomBSurface->VIso(anIsoCoord);
//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
StdPrs_Curve::Add(thePresentation,GeomAdaptor_Curve(aBCurve), b1, b2, theDeflection, aPoints, 30, Standard_False);
theCurves.Append(aPoints);
}
else
{
if (anIsoBuild.IsXLine(anI))
anIsoCurve.Load(GeomAbs_IsoU,anIsoCoord,b1,b2);
else
anIsoCurve.Load(GeomAbs_IsoV,anIsoCoord,b1,b2);
StdPrs_Curve::Add(thePresentation,anIsoCurve, theDeflection, theDrawer, aPoints, Standard_False);
theCurves.Append(aPoints);
}
}
}
}
//=========================================================================
// function: Match
// purpose
//=========================================================================
Standard_Boolean StdPrs_WFRestrictedFace::Match
(const Quantity_Length theX,
const Quantity_Length theY,
const Quantity_Length theZ,
const Quantity_Length theDistance,
const Handle(BRepAdaptor_HSurface)& theFace,
const Standard_Boolean theDrawUIso,
const Standard_Boolean theDrawVIso,
const Quantity_Length theDeflection,
const Standard_Integer theNbUIso,
const Standard_Integer theNBVIso,
const Handle(Prs3d_Drawer)& theDrawer)
{
Standard_Real aLimit = theDrawer->MaximalParameterValue();
Standard_Integer aNbPoints = theDrawer->Discretisation();
StdPrs_ToolRFace aToolRst (theFace);
// Compute bounds of the restriction
Standard_Real anUMin,anUMax,aVMin,aVMax;
Standard_Real anU,aV,aStep;
Standard_Integer anI,anNbP = 10;
anUMin = aVMin = RealLast();
anUMax = aVMax = RealFirst();
gp_Pnt2d aPoint1,aPoint2;
for (aToolRst.Init(); aToolRst.More(); aToolRst.Next())
{
Adaptor2d_Curve2dPtr aRCurve = aToolRst.Value();
anU = aRCurve->FirstParameter();
aV = aRCurve->LastParameter();
if (aRCurve->GetType() != GeomAbs_Line)
{
aStep = ( aV - anU) / anNbP;
for (anI = 0; anI <= anNbP; ++anI)
{
gp_Pnt2d aRCurvePoint = aRCurve->Value(anU);
if (aRCurvePoint.X() < anUMin) anUMin = aRCurvePoint.X();
if (aRCurvePoint.X() > anUMax) anUMax = aRCurvePoint.X();
if (aRCurvePoint.Y() < aVMin) aVMin = aRCurvePoint.Y();
if (aRCurvePoint.Y() > aVMax) aVMax = aRCurvePoint.Y();
anU += aStep;
}
}
else
{
aPoint1 = aRCurve->Value(anU);
if (aPoint1.X() < anUMin) anUMin = aPoint1.X();
if (aPoint1.X() > anUMax) anUMax = aPoint1.X();
if (aPoint1.Y() < aVMin) aVMin = aPoint1.Y();
if (aPoint1.Y() > aVMax) aVMax = aPoint1.Y();
aPoint2 = aRCurve->Value(aV);
if (aPoint2.X() < anUMin) anUMin = aPoint2.X();
if (aPoint2.X() > anUMax) anUMax = aPoint2.X();
if (aPoint2.Y() < aVMin) aVMin = aPoint2.Y();
if (aPoint2.Y() > aVMax) aVMax = aPoint2.Y();
}
}
// Load the isos
Hatch_Hatcher anIsoBuild(1.e-5,aToolRst.IsOriented());
Standard_Boolean anUClosed = theFace->IsUClosed();
Standard_Boolean aVClosed = theFace->IsVClosed();
if ( ! anUClosed )
{
anUMin = anUMin + ( anUMax - anUMin) /1000.;
anUMax = anUMax - ( anUMax - anUMin) /1000.;
}
if ( ! aVClosed )
{
aVMin = aVMin + ( aVMax - aVMin) /1000.;
aVMax = aVMax - ( aVMax - aVMin) /1000.;
}
if (theDrawUIso)
{
if (theNbUIso > 0)
{
anUClosed = Standard_False;
Standard_Real du= anUClosed ? (anUMax-anUMin)/theNbUIso : (anUMax-anUMin)/(1+theNbUIso);
for (anI=1; anI<=theNbUIso;anI++){
anIsoBuild.AddXLine(anUMin+du*anI);
}
}
}
if (theDrawVIso){
if ( theNBVIso > 0) {
aVClosed = Standard_False;
Standard_Real dv= aVClosed ?(aVMax-aVMin)/theNBVIso : (aVMax-aVMin)/(1+theNBVIso);
for (anI=1; anI<=theNBVIso;anI++){
anIsoBuild.AddYLine(aVMin+dv*anI);
}
}
}
// Trim the isos
Standard_Real anU1, anU2, aDU;
for (aToolRst.Init(); aToolRst.More(); aToolRst.Next())
{
TopAbs_Orientation Orient = aToolRst.Orientation();
if (Orient == TopAbs_FORWARD || Orient == TopAbs_REVERSED)
{
Adaptor2d_Curve2dPtr aRCurve = aToolRst.Value();
anU1 = aRCurve->FirstParameter();
anU2 = aRCurve->LastParameter();
if (aRCurve->GetType() != GeomAbs_Line) {
aDU = (anU2-anU1)/(aNbPoints-1);
aPoint2 = aRCurve->Value(anU1);
for (anI = 2; anI <= aNbPoints; anI++) {
anU = anU1 + (anI-1)*aDU;
aPoint1 = aPoint2;
aPoint2 = aRCurve->Value(anU);
if(Orient == TopAbs_FORWARD )
anIsoBuild.Trim(aPoint1,aPoint2);
else
anIsoBuild.Trim(aPoint2,aPoint1);
}
}
else {
aPoint1 = aRCurve->Value(anU1);
aPoint2 = aRCurve->Value(anU2);
if(Orient == TopAbs_FORWARD )
anIsoBuild.Trim(aPoint1,aPoint2);
else
anIsoBuild.Trim(aPoint2,aPoint1);
}
}
}
// Draw the isos
Adaptor3d_IsoCurve anIso;
anIso.Load(theFace);
Standard_Integer aNbLines = anIsoBuild.NbLines();
for (anI = 1; anI <= aNbLines; anI++)
{
Standard_Integer aNbIntervals = anIsoBuild.NbIntervals(anI);
Standard_Real aCoord = anIsoBuild.Coordinate(anI);
for (Standard_Integer j = 1; j <= aNbIntervals; j++)
{
Standard_Real anIsoStart=anIsoBuild.Start(anI,j),anIsoEnd=anIsoBuild.End(anI,j);
anIsoStart = anIsoStart == RealFirst() ? - aLimit : anIsoStart;
anIsoEnd = anIsoEnd == RealLast() ? aLimit : anIsoEnd;
if (anIsoBuild.IsXLine(anI))
anIso.Load(GeomAbs_IsoU,aCoord,anIsoStart,anIsoEnd);
else
anIso.Load(GeomAbs_IsoV,aCoord,anIsoStart,anIsoEnd);
if (StdPrs_Curve::Match(theX,theY,theZ,theDistance,anIso,
theDeflection, aLimit, aNbPoints))
return Standard_True;
}
}
return Standard_False;
}
//=========================================================================
// function: Add
// purpose
//=========================================================================
void StdPrs_WFRestrictedFace::Add
(const Handle (Prs3d_Presentation)& thePresentation,
const Handle(BRepAdaptor_HSurface)& theFace,
const Handle (Prs3d_Drawer)& theDrawer)
{
Prs3d_NListOfSequenceOfPnt aCurves;
StdPrs_WFRestrictedFace::Add (thePresentation,
theFace,
Standard_True,
Standard_True,
theDrawer->MaximalChordialDeviation(),
theDrawer->UIsoAspect()->Number(),
theDrawer->VIsoAspect()->Number(),
theDrawer,
aCurves);
}
//=========================================================================
// function: AddUIso
// purpose
//=========================================================================
void StdPrs_WFRestrictedFace::AddUIso
(const Handle (Prs3d_Presentation)& thePresentation,
const Handle(BRepAdaptor_HSurface)& theFace,
const Handle (Prs3d_Drawer)& theDrawer)
{
Prs3d_NListOfSequenceOfPnt aCurves;
StdPrs_WFRestrictedFace::Add (thePresentation,
theFace,
Standard_True,
Standard_False,
theDrawer->MaximalChordialDeviation(),
theDrawer->UIsoAspect()->Number(),
theDrawer->VIsoAspect()->Number(),
theDrawer,
aCurves);
}
//=========================================================================
// function: AddVIso
// purpose
//=========================================================================
void StdPrs_WFRestrictedFace::AddVIso
(const Handle (Prs3d_Presentation)& thePresentation,
const Handle(BRepAdaptor_HSurface)& theFace,
const Handle (Prs3d_Drawer)& theDrawer)
{
Prs3d_NListOfSequenceOfPnt aCurves;
StdPrs_WFRestrictedFace::Add (thePresentation,
theFace,
Standard_False,
Standard_True,
theDrawer->MaximalChordialDeviation(),
theDrawer->UIsoAspect()->Number(),
theDrawer->VIsoAspect()->Number(),
theDrawer,
aCurves);
}
//=========================================================================
// function: Match
// purpose
//=========================================================================
Standard_Boolean StdPrs_WFRestrictedFace::Match
(const Quantity_Length theX,
const Quantity_Length theY,
const Quantity_Length theZ,
const Quantity_Length theDistance,
const Handle(BRepAdaptor_HSurface)& theFace,
const Handle (Prs3d_Drawer)& theDrawer)
{
return StdPrs_WFRestrictedFace::Match (
theX, theY, theZ, theDistance,
theFace,
Standard_True,
Standard_True,
theDrawer->MaximalChordialDeviation(),
theDrawer->UIsoAspect()->Number(),
theDrawer->VIsoAspect()->Number(),
theDrawer);
}
//=========================================================================
// function: MatchUIso
// purpose
//=========================================================================
Standard_Boolean StdPrs_WFRestrictedFace::MatchUIso
(const Quantity_Length theX,
const Quantity_Length theY,
const Quantity_Length theZ,
const Quantity_Length theDistance,
const Handle(BRepAdaptor_HSurface)& theFace,
const Handle (Prs3d_Drawer)& theDrawer)
{
return StdPrs_WFRestrictedFace::Match (
theX, theY, theZ,theDistance,
theFace,
Standard_True,
Standard_False,
theDrawer->MaximalChordialDeviation(),
theDrawer->UIsoAspect()->Number(),
theDrawer->VIsoAspect()->Number(),
theDrawer);
}
//=========================================================================
// function: MatchVIso
// purpose
//=========================================================================
Standard_Boolean StdPrs_WFRestrictedFace::MatchVIso
(const Quantity_Length theX,
const Quantity_Length theY,
const Quantity_Length theZ,
const Quantity_Length theDistance,
const Handle(BRepAdaptor_HSurface)& theFace,
const Handle (Prs3d_Drawer)& theDrawer)
{
return StdPrs_WFRestrictedFace::Match (
theX, theY, theZ, theDistance,
theFace,
Standard_False,
Standard_True,
theDrawer->MaximalChordialDeviation(),
theDrawer->UIsoAspect()->Number(),
theDrawer->VIsoAspect()->Number(),
theDrawer);
}

View File

@@ -0,0 +1,96 @@
// Copyright (c) 2013 OPEN CASCADE SAS
//
// The content of this file is subject to the Open CASCADE Technology Public
// License Version 6.5 (the "License"). You may not use the content of this file
// except in compliance with the License. Please obtain a copy of the License
// at http://www.opencascade.org and read it completely before using this file.
//
// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
//
// The Original Code and all software distributed under the License is
// distributed on an "AS IS" basis, without warranty of any kind, and the
// Initial Developer hereby disclaims all such warranties, including without
// limitation, any warranties of merchantability, fitness for a particular
// purpose or non-infringement. Please see the License for the specific terms
// and conditions governing the rights and limitations under the License.
#ifndef _StdPrs_WFRestrictedFace_H__
#define _StdPrs_WFRestrictedFace_H__
#include <BRepAdaptor_HSurface.hxx>
#include <Prs3d_Drawer.hxx>
#include <Prs3d_Presentation.hxx>
#include <Prs3d_Root.hxx>
#include <Prs3d_NListOfSequenceOfPnt.hxx>
class StdPrs_WFRestrictedFace : public Prs3d_Root
{
public:
DEFINE_STANDARD_ALLOC
Standard_EXPORT static void Add
(const Handle (Prs3d_Presentation)& thePresentation,
const Handle(BRepAdaptor_HSurface)& theFace,
const Standard_Boolean theDrawUIso,
const Standard_Boolean theDrawVIso,
const Quantity_Length theDeflection,
const Standard_Integer theNbUIso,
const Standard_Integer theNbVIso,
const Handle(Prs3d_Drawer)& theDrawer,
Prs3d_NListOfSequenceOfPnt& theCurves);
Standard_EXPORT static void Add
(const Handle (Prs3d_Presentation)& thePresentation,
const Handle(BRepAdaptor_HSurface)& theFace,
const Handle (Prs3d_Drawer)& theDrawer);
Standard_EXPORT static Standard_Boolean Match
(const Quantity_Length theX,
const Quantity_Length theY,
const Quantity_Length theZ,
const Quantity_Length theDistance,
const Handle(BRepAdaptor_HSurface)& theFace,
const Standard_Boolean theDrawUIso,
const Standard_Boolean theDrawVIso,
const Quantity_Length theDeflection,
const Standard_Integer theNbUIso,
const Standard_Integer theNbVIso,
const Handle(Prs3d_Drawer)& theDrawer);
Standard_EXPORT static Standard_Boolean Match
(const Quantity_Length theX,
const Quantity_Length theY,
const Quantity_Length theZ,
const Quantity_Length theDistance,
const Handle(BRepAdaptor_HSurface)& theFace,
const Handle (Prs3d_Drawer)& theDrawer);
Standard_EXPORT static Standard_Boolean MatchUIso
(const Quantity_Length theX,
const Quantity_Length theY,
const Quantity_Length theZ,
const Quantity_Length theDistance,
const Handle(BRepAdaptor_HSurface)& theFace,
const Handle (Prs3d_Drawer)& theDrawer);
Standard_EXPORT static Standard_Boolean MatchVIso
(const Quantity_Length theX,
const Quantity_Length theY,
const Quantity_Length theZ,
const Quantity_Length theDistance,
const Handle(BRepAdaptor_HSurface)& theFace,
const Handle (Prs3d_Drawer)& theDrawer);
Standard_EXPORT static void AddUIso
(const Handle (Prs3d_Presentation)& thePresentation,
const Handle(BRepAdaptor_HSurface)& theFace,
const Handle (Prs3d_Drawer)& theDrawer);
Standard_EXPORT static void AddVIso
(const Handle (Prs3d_Presentation)& thePresentation,
const Handle(BRepAdaptor_HSurface)& theFace,
const Handle (Prs3d_Drawer)& theDrawer);
};
#endif

View File

@@ -0,0 +1,32 @@
// Copyright (c) 2013 OPEN CASCADE SAS
//
// The content of this file is subject to the Open CASCADE Technology Public
// License Version 6.5 (the "License"). You may not use the content of this file
// except in compliance with the License. Please obtain a copy of the License
// at http://www.opencascade.org and read it completely before using this file.
//
// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
//
// The Original Code and all software distributed under the License is
// distributed on an "AS IS" basis, without warranty of any kind, and the
// Initial Developer hereby disclaims all such warranties, including without
// limitation, any warranties of merchantability, fitness for a particular
// purpose or non-infringement. Please see the License for the specific terms
// and conditions governing the rights and limitations under the License.
#ifndef _StdPrs_WFShape_H__
#define _StdPrs_WFShape_H__
#include <Prs3d_Root.hxx>
#include <Prs3d_Presentation.hxx>
#include <Prs3d_Drawer.hxx>
#include <TopTools_HSequenceOfShape.hxx>
#include <Quantity_Length.hxx>
#include <Prs3d_WFShape.hxx>
#include <StdPrs_WFRestrictedFace.hxx>
#include <StdPrs_Curve.hxx>
#include <StdPrs_Vertex.hxx>
typedef Prs3d_WFShape <StdPrs_WFRestrictedFace, StdPrs_Curve, StdPrs_Vertex> StdPrs_WFShape;
#endif