1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-14 13:30:48 +03:00

Integration of OCCT 6.5.0 from SVN

This commit is contained in:
bugmaster
2011-03-16 07:30:28 +00:00
committed by bugmaster
parent 4903637061
commit 7fd59977df
16375 changed files with 3882564 additions and 0 deletions

61
src/HLRTest/HLRTest.cdl Executable file
View File

@@ -0,0 +1,61 @@
-- File: HLRTest.cdl
-- Created: Fri Dec 6 13:47:52 1991
-- Author: Remi LEQUETTE
-- <rle@phobox>
---Copyright: Matra Datavision 1991, 1992
package HLRTest
---Purpose: This package is a test of the Hidden Lines
-- algorithms instantiated on the BRep Data Structure
-- and using the Draw package to display the results.
uses
Standard,
MMgt,
TCollection,
gp,
TopoDS,
HLRAlgo,
HLRBRep,
HLRTopoBRep,
Draw
is
class ShapeData;
class DrawableEdgeTool;
---Purpose: Used to display the results.
class DrawablePolyEdgeTool;
---Purpose: Used to display the results.
class Projector;
---Purpose: Draw Variable Projector to test
class OutLiner;
---Purpose: Draw Variable Outliner to test
Set(Name : CString;
P : Projector from HLRAlgo);
---Purpose: Set a Projector Variable
GetProjector(Name : in out CString;
P : in out Projector from HLRAlgo)
returns Boolean;
---Purpose: Get a projector variable
-- Returns false if the variable is not a projector
Set(Name : CString;
S : Shape from TopoDS);
---Purpose: Set a OutLiner Variable
GetOutLiner(Name : in out CString)
returns OutLiner from HLRTopoBRep;
---Purpose: Get a outliner variable
-- Returns a null handle if the variable is not a outliner
Commands(I : in out Interpretor from Draw);
---Purpose: Defines commands to test the Hidden Line Removal
end HLRTest;

514
src/HLRTest/HLRTest.cxx Executable file
View File

@@ -0,0 +1,514 @@
// File: HLRTest.cxx
// Created: Wed Apr 5 17:10:51 1995
// Author: Christophe MARION
// <cma@ecolox>
#include <HLRTest.ixx>
#include <HLRTest_Projector.hxx>
#include <HLRTest_OutLiner.hxx>
#include <TColStd_ListIteratorOfListOfInteger.hxx>
#include <gp_Ax3.hxx>
#include <Draw_Appli.hxx>
#include <Draw.hxx>
#include <DBRep.hxx>
#include <HLRBRep_Algo.hxx>
#include <HLRBRep_HLRToShape.hxx>
static Handle(HLRBRep_Algo) hider;
#ifdef WNT
Standard_IMPORT Draw_Viewer dout;
#endif
#include <BRepTopAdaptor_MapOfShapeTool.hxx>
//=======================================================================
//function : Set
//purpose :
//=======================================================================
void HLRTest::Set (const Standard_CString Name,
const HLRAlgo_Projector& P)
{
Draw::Set(Name,new HLRTest_Projector(P));
}
//=======================================================================
//function : GetProjector
//purpose :
//=======================================================================
Standard_Boolean HLRTest::GetProjector (Standard_CString& Name,
HLRAlgo_Projector& P)
{
Handle(HLRTest_Projector) HP =
Handle(HLRTest_Projector)::DownCast(Draw::Get(Name));
if (HP.IsNull()) return Standard_False;
P = HP->Projector();
return Standard_True;
}
//=======================================================================
//function : Set
//purpose :
//=======================================================================
void HLRTest::Set (const Standard_CString Name,
const TopoDS_Shape& S)
{
Draw::Set(Name,new HLRTest_OutLiner(S));
}
//=======================================================================
//function : GetOutLiner
//purpose :
//=======================================================================
Handle(HLRTopoBRep_OutLiner) HLRTest::GetOutLiner (Standard_CString& Name)
{
Handle(Draw_Drawable3D) D = Draw::Get(Name);
Handle(HLRTest_OutLiner) HS = Handle(HLRTest_OutLiner)::DownCast(D);
if (!HS.IsNull()) return HS->OutLiner();
Handle(HLRTopoBRep_OutLiner) HO;
return HO;
}
//=======================================================================
//function : hprj
//purpose :
//=======================================================================
static Standard_Integer
hprj (Draw_Interpretor& , Standard_Integer n, const char** a)
{
Standard_Integer id = 1;
if (n < 2) return 1;
if (n > 2) id = atoi(a[2]);
//
gp_Ax2 anAx2 = gp::XOY();
if (n == 11)
{
Standard_Real x = atof(a[2]);
Standard_Real y = atof(a[3]);
Standard_Real z = atof(a[4]);
Standard_Real dx = atof(a[5]);
Standard_Real dy = atof(a[6]);
Standard_Real dz = atof(a[7]);
Standard_Real dx1 = atof(a[8]);
Standard_Real dy1 = atof(a[9]);
Standard_Real dz1 = atof(a[10]);
gp_Pnt anOrigin (x, y, z);
gp_Dir aNormal (dx, dy, dz);
gp_Dir aDX (dx1, dy1, dz1);
anAx2 = gp_Ax2(anOrigin, aNormal, aDX);
}
HLRAlgo_Projector P(anAx2);
HLRTest::Set(a[1],P);
return 0;
}
//=======================================================================
//function : hout
//purpose :
//=======================================================================
static Standard_Integer
hout (Draw_Interpretor& di, Standard_Integer n, const char** a)
{
if (n < 2) return 1;
const char *name = a[2];
TopoDS_Shape S = DBRep::Get(name);
if (S.IsNull()) {
di << name << " is not a shape." << "\n";
return 1;
}
HLRTest::Set(a[1],S);
return 0;
}
//=======================================================================
//function : hfil
//purpose :
//=======================================================================
static Standard_Integer
hfil (Draw_Interpretor& di, Standard_Integer n, const char** a)
{
Standard_Integer nbIso = 0;
if (n < 3) return 1;
if (n > 3) nbIso = atoi(a[3]);
const char *name1 = a[1];
Handle(HLRTopoBRep_OutLiner) HS = HLRTest::GetOutLiner(name1);
if (HS.IsNull()) {
di << name1 << " is not an OutLiner." << "\n";
return 1;
}
const char *name2 = a[2];
HLRAlgo_Projector P;
if (!HLRTest::GetProjector(name2,P)) {
di << name2 << " is not a projector." << "\n";
return 1;
}
BRepTopAdaptor_MapOfShapeTool MST;
HS->Fill(P,MST,nbIso);
return 0;
}
//=======================================================================
//function : sori
//purpose :
//=======================================================================
static Standard_Integer
sori (Draw_Interpretor& di, Standard_Integer n, const char** a)
{
if (n < 3) return 1;
const char *name1 = a[1];
const char *name2 = a[2];
Handle(HLRTopoBRep_OutLiner) HS = HLRTest::GetOutLiner(name2);
if (HS.IsNull()) {
di << name2 << " is not an OutLiner." << "\n";
return 1;
}
DBRep::Set(name1,HS->OriginalShape());
return 0;
}
//=======================================================================
//function : sout
//purpose :
//=======================================================================
static Standard_Integer
sout (Draw_Interpretor& di, Standard_Integer n, const char** a)
{
if (n < 3) return 1;
const char *name1 = a[1];
const char *name2 = a[2];
Handle(HLRTopoBRep_OutLiner) HS = HLRTest::GetOutLiner(name2);
if (HS.IsNull()) {
di << name2 << " is not an OutLiner." << "\n";
return 1;
}
if (HS->OutLinedShape().IsNull()) {
di << name2 << " has no OutLinedShape." << "\n";
return 1;
}
DBRep::Set(name1,HS->OutLinedShape());
return 0;
}
//=======================================================================
//function : hloa
//purpose :
//=======================================================================
static Standard_Integer
hloa (Draw_Interpretor& di, Standard_Integer n, const char** a)
{
if (n < 2) return 1;
const char *name1 = a[1];
Handle(HLRTopoBRep_OutLiner) HS = HLRTest::GetOutLiner(name1);
if (HS.IsNull()) {
di << name1 << " is not an OutLiner." << "\n";
return 1;
}
hider->Load(HS);
return 0;
}
//=======================================================================
//function : hrem
//purpose :
//=======================================================================
static Standard_Integer
hrem (Draw_Interpretor& di, Standard_Integer n, const char** a)
{
if (n > 1) {
const char *name = a[1];
Standard_Integer index;
Handle(HLRTopoBRep_OutLiner) HS = HLRTest::GetOutLiner(name);
if (HS.IsNull()) {
TopoDS_Shape S = DBRep::Get(name);
if (S.IsNull()) {
di << name << " is not an OutLiner and not a shape." << "\n";
return 1;
}
else {
index = hider->Index(S);
if (index == 0) {
di << name << " not loaded shape." << "\n";
return 1;
}
}
}
else {
index = hider->Index(HS->OriginalShape());
if (index == 0) {
di << name << " not loaded outliner." << "\n";
return 1;
}
}
hider->Remove(index);
di << name << " removed" << "\n";
}
else {
while (hider->NbShapes() > 0) {
hider->Remove(1);
}
di << " all shapes removed" << "\n";
}
return 0;
}
//=======================================================================
//function : sprj
//purpose :
//=======================================================================
static Standard_Integer
sprj (Draw_Interpretor& di, Standard_Integer n, const char** a)
{
if (n < 2) return 1;
const char *name = a[1];
HLRAlgo_Projector P;
if (!HLRTest::GetProjector(name,P)) {
di << name << " is not a projector." << "\n";
return 1;
}
hider->Projector(P);
return 0;
}
//=======================================================================
//function : upda
//purpose :
//=======================================================================
static Standard_Integer
upda (Draw_Interpretor& , Standard_Integer, const char**)
{
hider->Update();
return 0;
}
//=======================================================================
//function : hide
//purpose :
//=======================================================================
static Standard_Integer
hide (Draw_Interpretor& , Standard_Integer, const char**)
{
hider->Hide();
return 0;
}
//=======================================================================
//function : show
//purpose :
//=======================================================================
static Standard_Integer
show (Draw_Interpretor& , Standard_Integer, const char**)
{
hider->ShowAll();
return 0;
}
//=======================================================================
//function : hdbg
//purpose :
//=======================================================================
static Standard_Integer
hdbg (Draw_Interpretor& di, Standard_Integer, const char**)
{
hider->Debug(!hider->Debug());
if (hider->Debug())
di << "debug" << "\n";
else
di << "no debug" << "\n";
return 0;
}
//=======================================================================
//function : hnul
//purpose :
//=======================================================================
static Standard_Integer
hnul (Draw_Interpretor& , Standard_Integer, const char**)
{
hider->OutLinedShapeNullify();
return 0;
}
//=======================================================================
//function : hres
//purpose :
//=======================================================================
static Standard_Integer
hres (Draw_Interpretor& , Standard_Integer n, const char** a)
{
TopoDS_Shape S,V,V1,VN,VO,VI,H,H1,HN,HO,HI;
if (n > 1) {
const char *name = a[1];
S = DBRep::Get(name);
}
HLRBRep_HLRToShape HS(hider);
if (S.IsNull()) {
V = HS.VCompound();
V1 = HS.Rg1LineVCompound();
VN = HS.RgNLineVCompound();
VO = HS.OutLineVCompound();
VI = HS.IsoLineVCompound();
H = HS.HCompound();
H1 = HS.Rg1LineHCompound();
HN = HS.RgNLineHCompound();
HO = HS.OutLineHCompound();
HI = HS.IsoLineHCompound();
}
else {
V = HS.VCompound(S);
V1 = HS.Rg1LineVCompound(S);
VN = HS.RgNLineVCompound(S);
VO = HS.OutLineVCompound(S);
VI = HS.IsoLineVCompound(S);
H = HS.HCompound(S);
H1 = HS.Rg1LineHCompound(S);
HN = HS.RgNLineHCompound(S);
HO = HS.OutLineHCompound(S);
HI = HS.IsoLineHCompound(S);
}
if (!V .IsNull()) DBRep::Set("vl",V);
if (!V1.IsNull()) DBRep::Set("v1l",V1);
if (!VN.IsNull()) DBRep::Set("vnl",VN);
if (!VO.IsNull()) DBRep::Set("vol",VO);
if (!VI.IsNull()) DBRep::Set("vil",VI);
if (!H .IsNull()) DBRep::Set("hl",H);
if (!H1.IsNull()) DBRep::Set("h1l",H1);
if (!HN.IsNull()) DBRep::Set("hnl",HN);
if (!HO.IsNull()) DBRep::Set("hol",HO);
if (!HI.IsNull()) DBRep::Set("hil",HI);
return 0;
}
//=======================================================================
//function : Commands
//purpose :
//=======================================================================
void HLRTest::Commands (Draw_Interpretor& theCommands)
{
const char* g = "ADVALGOS HLR Commands";
theCommands.Add("hprj" ,"hprj name [view-id = 1]" ,__FILE__,hprj,g);
theCommands.Add("houtl" ,"houtl name shape" ,__FILE__,hout,g);
theCommands.Add("hfill" ,"hfill name proj [nbIso]" ,__FILE__,hfil,g);
theCommands.Add("hsin" ,"hsin name outliner" ,__FILE__,sori,g);
theCommands.Add("hsout" ,"hsout name outliner" ,__FILE__,sout,g);
theCommands.Add("hload" ,"hload outliner" ,__FILE__,hloa,g);
theCommands.Add("hremove" ,"hremove [name]" ,__FILE__,hrem,g);
theCommands.Add("hsetprj" ,"hsetprj [name]" ,__FILE__,sprj,g);
theCommands.Add("hupdate" ,"hupdate" ,__FILE__,upda,g);
theCommands.Add("hhide" ,"hhide" ,__FILE__,hide,g);
theCommands.Add("hshowall" ,"hshowall" ,__FILE__,show,g);
theCommands.Add("hdebug" ,"hdebug" ,__FILE__,hdbg,g);
theCommands.Add("hnullify" ,"hnullify" ,__FILE__,hnul,g);
theCommands.Add("hres2d" ,"hres2d" ,__FILE__,hres,g);
hider = new HLRBRep_Algo();
}
//=======================================================================
//function : save and restore projector
//purpose :
//=======================================================================
static Standard_Boolean stest(const Handle(Draw_Drawable3D)& d)
{
return d->IsInstance(STANDARD_TYPE(HLRTest_Projector));
}
//=======================================================================
//function : ssave
//purpose :
//=======================================================================
static void ssave (const Handle(Draw_Drawable3D)&d, ostream& OS)
{
Handle(HLRTest_Projector) HP =
Handle(HLRTest_Projector)::DownCast(d);
const HLRAlgo_Projector& P = HP->Projector();
OS << (P.Perspective() ? "1" : "0") << "\n";
if (P.Perspective())
OS << P.Focus() << "\n";
gp_Trsf T = P.Transformation();
gp_XYZ V = T.TranslationPart();
gp_Mat M = T.VectorialPart();
OS << M(1,1) << " ";
OS << M(1,2) << " ";
OS << M(1,3) << " ";
OS << V.Coord(1) << " ";
OS << "\n";
OS << M(2,1) << " ";
OS << M(2,2) << " ";
OS << M(2,3) << " ";
OS << V.Coord(2) << " ";
OS << "\n";
OS << M(3,1) << " ";
OS << M(3,2) << " ";
OS << M(3,3) << " ";
OS << V.Coord(3) << " ";
OS << "\n";
}
//=======================================================================
//function : srestore
//purpose :
//=======================================================================
static Handle(Draw_Drawable3D) srestore (istream& IS)
{
Standard_Boolean pers;
IS >> pers;
Standard_Real focus = 1;
if (pers) IS >> focus;
gp_Trsf T;
Standard_Real V1[3],V2[3],V3[3];
Standard_Real V[3];
IS >> V1[0] >> V1[1] >> V1[2] >> V[0];
IS >> V2[0] >> V2[1] >> V2[2] >> V[1];
IS >> V3[0] >> V3[1] >> V3[2] >> V[2];
gp_Dir D1(V1[0],V1[1],V1[2]);
gp_Dir D2(V2[0],V2[1],V2[2]);
gp_Dir D3(V3[0],V3[1],V3[2]);
gp_Ax3 axes(gp_Pnt(0,0,0),D3,D1);
D3.Cross(D1);
if (D3.Dot(D2) < 0) axes.YReverse();
T.SetTransformation(axes);
T.SetTranslationPart(gp_Vec(V[0],V[1],V[2]));
HLRAlgo_Projector P(T,pers,focus);
Handle(HLRTest_Projector) HP = new HLRTest_Projector(P);
return HP;
}
//=======================================================================
//function : ssr
//purpose :
//=======================================================================
static Draw_SaveAndRestore ssr("HLRTest_Projector",stest,ssave,srestore);

View File

@@ -0,0 +1,59 @@
-- File: DrawableEdgeTool.cdl
-- Created: Thu Aug 27 16:28:55 1992
-- Author: Christophe MARION
-- <cma@sdsun2>
---Copyright: Matra Datavision 1992
class DrawableEdgeTool from HLRTest inherits Drawable3D from Draw
---Purpose:
uses
Boolean from Standard,
Integer from Standard,
Display from Draw,
Algo from HLRBRep,
Data from HLRBRep,
EdgeData from HLRBRep
is
Create(Alg : Algo from HLRBRep;
Visible : Boolean from Standard;
IsoLine : Boolean from Standard;
Rg1Line : Boolean from Standard;
RgNLine : Boolean from Standard;
ViewId : Integer from Standard)
returns mutable DrawableEdgeTool from HLRTest;
DrawOn(me; D : in out Display from Draw);
InternalDraw(me; D :in out Display from Draw;
typ : Integer from Standard)
is static private;
DrawFace(me; D : in out Display from Draw;
typ : Integer from Standard;
nCB : Integer from Standard;
iface : Integer from Standard;
e2,iCB : in out Integer from Standard;
DS : in out Data from HLRBRep)
is static private;
DrawEdge(me; D : in out Display from Draw;
inFace : Boolean from Standard;
typ : Integer from Standard;
nCB : Integer from Standard;
ie : Integer from Standard;
e2,iCB : in out Integer from Standard;
ed : in out EdgeData from HLRBRep)
is static private;
fields
myAlgo : Algo from HLRBRep;
myVisible : Boolean from Standard;
myIsoLine : Boolean from Standard;
myRg1Line : Boolean from Standard;
myRgNLine : Boolean from Standard;
myViewId : Integer from Standard;
end DrawableEdgeTool;

View File

@@ -0,0 +1,227 @@
// File: HLRTest_DrawableEdgeTool.cxx
// Created: Wed Oct 14 11:16:16 1992
// Author: Christophe MARION
// <cma@sdsun1>
#include <HLRTest_DrawableEdgeTool.ixx>
#include <HLRTest_ShapeData.hxx>
#include <HLRBRep_Data.hxx>
#include <HLRAlgo_EdgeIterator.hxx>
#include <HLRBRep_ShapeBounds.hxx>
//=======================================================================
//function : HLRTest_DrawableEdgeTool
//purpose :
//=======================================================================
HLRTest_DrawableEdgeTool::HLRTest_DrawableEdgeTool
(const Handle(HLRBRep_Algo)& Alg,
const Standard_Boolean Visible,
const Standard_Boolean IsoLine,
const Standard_Boolean Rg1Line,
const Standard_Boolean RgNLine,
const Standard_Integer ViewId) :
myAlgo(Alg),
myVisible(Visible),
myIsoLine(IsoLine),
myRg1Line(Rg1Line),
myRgNLine(RgNLine),
myViewId(ViewId)
{}
//=======================================================================
//function : DrawOn
//purpose :
//=======================================================================
void HLRTest_DrawableEdgeTool::DrawOn(Draw_Display& D) const
{
if (myViewId == D.ViewId()) {
if (myIsoLine) InternalDraw(D,1);
InternalDraw(D,2);
InternalDraw(D,3);
}
}
//=======================================================================
//function : InternalDraw
//purpose :
//=======================================================================
void
HLRTest_DrawableEdgeTool::InternalDraw (Draw_Display& D,
const Standard_Integer typ) const
{
Handle(HLRBRep_Data) DS = myAlgo->DataStructure();
if (!DS.IsNull()) {
// Standard_Real sta,end;
// Standard_ShortReal tolsta,tolend;
// Standard_Integer ie,v1,v2,e1,e2,f1,f2;
Standard_Integer ie,e2;
Standard_Integer iCB = 1;
Standard_Integer nCB = myAlgo->NbShapes();
Standard_Integer ne = DS->NbEdges();
Standard_Integer nf = DS->NbFaces();
HLRBRep_EdgeData* ed = &(DS->EDataArray().ChangeValue(0));
ed++;
e2 = 0;
for (ie = 1; ie <= ne; ie++) {
if (ed->Selected() && !ed->Vertical()) ed->Used(Standard_False);
else ed->Used(Standard_True);
ed++;
}
for (Standard_Integer iface = 1; iface <= nf; iface++)
DrawFace(D,typ,nCB,iface,e2,iCB,DS);
if (typ >= 3) {
iCB = 1;
e2 = 0;
HLRBRep_EdgeData* ed = &(DS->EDataArray().ChangeValue(0));
ed++;
for (Standard_Integer ie = 1; ie <= ne; ie++) {
if (!ed->Used()) {
DrawEdge(D,Standard_False,typ,nCB,ie,e2,iCB,*ed);
ed->Used(Standard_True);
}
ed++;
}
}
}
}
//=======================================================================
//function : DrawFace
//purpose :
//=======================================================================
void
HLRTest_DrawableEdgeTool::DrawFace (Draw_Display& D,
const Standard_Integer typ,
const Standard_Integer nCB,
const Standard_Integer iface,
Standard_Integer& e2,
Standard_Integer& iCB,
Handle(HLRBRep_Data)& DS) const
{
HLRBRep_FaceIterator Itf;
for (Itf.InitEdge(DS->FDataArray().ChangeValue(iface));
Itf.MoreEdge();
Itf.NextEdge()) {
Standard_Integer ie = Itf.Edge();
HLRBRep_EdgeData& edf = DS->EDataArray().ChangeValue(ie);
if (!edf.Used()) {
Standard_Boolean todraw;
if ((!myRg1Line &&
!Itf.OutLine() &&
edf.Rg1Line()) ||
(!myRgNLine &&
!Itf.OutLine() &&
edf.RgNLine())) todraw = Standard_False;
else if (typ == 1) todraw = Itf.IsoLine();
else if (typ == 2) todraw = Itf.OutLine() || Itf.Internal();
else todraw = !(Itf.IsoLine() ||
(Itf.OutLine() || Itf.Internal()));
if (todraw) DrawEdge(D,Standard_True,typ,nCB,ie,e2,iCB,edf);
edf.Used(Standard_True);
}
}
}
//=======================================================================
//function : DrawEdge
//purpose :
//=======================================================================
void
HLRTest_DrawableEdgeTool::DrawEdge (Draw_Display& D,
const Standard_Boolean inFace,
const Standard_Integer typ,
const Standard_Integer nCB,
const Standard_Integer ie,
Standard_Integer& e2,
Standard_Integer& iCB,
HLRBRep_EdgeData& ed) const
{
Standard_Boolean todraw = Standard_True;
if (!inFace &&
((!myRg1Line && ed.Rg1Line()) ||
(!myRgNLine && ed.RgNLine()))) todraw = Standard_False;
if (todraw) {
Standard_Real sta,end;
Standard_ShortReal tolsta,tolend;
Standard_Integer v1,v2,e1,f1,f2;
HLRAlgo_EdgeIterator It;
if (myVisible) {
while (ie > e2 && iCB <= nCB) {
HLRBRep_ShapeBounds& ShB
= myAlgo->ShapeBounds(iCB);
ShB.Bounds(v1,v2,e1,e2,f1,f2);
Handle(HLRTest_ShapeData) ShData =
Handle(HLRTest_ShapeData)::DownCast(ShB.ShapeData());
if (typ == 1) D.SetColor(ShData->VisibleIsoColor());
else if (typ == 2) D.SetColor(ShData->VisibleOutLineColor());
else D.SetColor(ShData->VisibleColor());
iCB++;
}
const HLRBRep_Curve& ec = ed.Geometry();
for (It.InitVisible(ed.Status());
It.MoreVisible();
It.NextVisible()) {
It.Visible(sta,tolsta,end,tolend);
D.MoveTo(ec.Value3D(sta));
if (!ec.GetType() == GeomAbs_Line) {
Standard_Integer nbPnt = 100;
Standard_Real step = (end-sta)/(nbPnt+1);
for (Standard_Integer i = 1; i <= nbPnt; i++) {
sta += step;
D.DrawTo(ec.Value3D(sta));
}
}
D.DrawTo(ec.Value3D(end));
}
}
else {
while (ie > e2 && iCB <= nCB) {
HLRBRep_ShapeBounds& ShB
= myAlgo->ShapeBounds(iCB);
ShB.Bounds(v1,v2,e1,e2,f1,f2);
Handle(HLRTest_ShapeData) ShData =
Handle(HLRTest_ShapeData)::DownCast(ShB.ShapeData());
if (typ == 1) D.SetColor(ShData->HiddenIsoColor());
else if (typ == 2) D.SetColor(ShData->HiddenOutLineColor());
else D.SetColor(ShData->HiddenColor());
iCB++;
}
const HLRBRep_Curve& ec = ed.Geometry();
for (It.InitHidden(ed.Status());
It.MoreHidden();
It.NextHidden()) {
It.Hidden(sta,tolsta,end,tolend);
D.MoveTo(ec.Value3D(sta));
if (!ec.GetType() == GeomAbs_Line) {
Standard_Integer nbPnt = 100;
Standard_Real step = (end-sta)/(nbPnt+1);
for (Standard_Integer i = 1; i <= nbPnt; i++) {
sta += step;
D.DrawTo(ec.Value3D(sta));
}
}
D.DrawTo(ec.Value3D(end));
}
}
}
}

View File

@@ -0,0 +1,77 @@
-- File: DrawablePolyEdgeTool.cdl
-- Created: Thu Aug 27 16:28:55 1992
-- Author: Christophe MARION
-- <cma@sdsun2>
---Copyright: Matra Datavision 1992
class DrawablePolyEdgeTool from HLRTest inherits Drawable3D from Draw
---Purpose:
uses
Boolean from Standard,
Integer from Standard,
Display from Draw,
PolyAlgo from HLRBRep,
ListOfBPoint from HLRBRep
is
Create(Alg : PolyAlgo from HLRBRep;
ViewId : Integer from Standard;
Debug : Boolean from Standard = Standard_False)
returns mutable DrawablePolyEdgeTool from HLRTest;
Show(me : mutable)
---C++: inline
is static;
Hide(me : mutable)
---C++: inline
is static;
DisplayRg1Line(me : mutable; B : Boolean from Standard)
---C++: inline
is static;
DisplayRg1Line(me) returns Boolean from Standard
---C++: inline
is static;
DisplayRgNLine(me : mutable; B : Boolean from Standard)
---C++: inline
is static;
DisplayRgNLine(me) returns Boolean from Standard
---C++: inline
is static;
DisplayHidden(me : mutable; B : Boolean from Standard)
---C++: inline
is static;
DisplayHidden(me) returns Boolean from Standard
---C++: inline
is static;
DrawOn(me; D : in out Display from Draw);
Debug(me) returns Boolean from Standard
---C++: inline
is static;
Debug(me : mutable; B : Boolean from Standard)
---C++: inline
is static;
fields
myAlgo : PolyAlgo from HLRBRep;
myDispRg1 : Boolean from Standard;
myDispRgN : Boolean from Standard;
myDispHid : Boolean from Standard;
myViewId : Integer from Standard;
myBiPntVis : ListOfBPoint from HLRBRep;
myBiPntHid : ListOfBPoint from HLRBRep;
myDebug : Boolean from Standard;
myHideMode : Boolean from Standard;
end DrawablePolyEdgeTool;

View File

@@ -0,0 +1,150 @@
// File: HLRTest_DrawablePolyEdgeTool.cxx
// Created: Wed Oct 14 11:16:16 1992
// Author: Christophe MARION
// <cma@sdsun1>
// Modified by cma, Mon Oct 23 16:11:46 1995
#include <HLRTest_DrawablePolyEdgeTool.ixx>
#include <HLRBRep_BiPoint.hxx>
#include <HLRBRep_ListIteratorOfListOfBPoint.hxx>
#include <HLRAlgo_EdgeStatus.hxx>
#include <HLRAlgo_EdgeIterator.hxx>
#include <Draw_Color.hxx>
#include <OSD_Chronometer.hxx>
#define PntX1 ((Standard_Real*)Coordinates)[0]
#define PntY1 ((Standard_Real*)Coordinates)[1]
#define PntZ1 ((Standard_Real*)Coordinates)[2]
#define PntX2 ((Standard_Real*)Coordinates)[3]
#define PntY2 ((Standard_Real*)Coordinates)[4]
#define PntZ2 ((Standard_Real*)Coordinates)[5]
//=======================================================================
//function : HLRTest_DrawablePolyEdgeTool
//purpose :
//=======================================================================
HLRTest_DrawablePolyEdgeTool::
HLRTest_DrawablePolyEdgeTool (const Handle(HLRBRep_PolyAlgo)& Alg,
const Standard_Integer ViewId,
const Standard_Boolean Debug) :
myAlgo(Alg),
myDispHid(Standard_False),
myViewId(ViewId),
myDebug(Debug),
myHideMode(Standard_True)
{
OSD_Chronometer ChronHide;
if (myDebug) {
ChronHide.Reset();
ChronHide.Start();
}
Standard_Real sta,end,dx,dy,dz;
Standard_ShortReal tolsta,tolend;
HLRAlgo_EdgeIterator It;
myBiPntVis.Clear();
myBiPntHid.Clear();
Standard_Address Coordinates;
HLRAlgo_EdgeStatus status;
TopoDS_Shape S;
Standard_Boolean reg1,regn,outl,intl;
for (myAlgo->InitHide(); myAlgo->MoreHide(); myAlgo->NextHide()) {
myAlgo->Hide(Coordinates,status,S,reg1,regn,outl,intl);
dx = PntX2 - PntX1;
dy = PntY2 - PntY1;
dz = PntZ2 - PntZ1;
for (It.InitVisible(status);
It.MoreVisible();
It.NextVisible()) {
It.Visible(sta,tolsta,end,tolend);
myBiPntVis.Append
(HLRBRep_BiPoint
(PntX1 + sta * dx,PntY1 + sta * dy,PntZ1 + sta * dz,
PntX1 + end * dx,PntY1 + end * dy,PntZ1 + end * dz,
S,reg1,regn,outl,intl));
}
for (It.InitHidden(status);
It.MoreHidden();
It.NextHidden()) {
It.Hidden(sta,tolsta,end,tolend);
myBiPntHid.Append
(HLRBRep_BiPoint
(PntX1 + sta * dx,PntY1 + sta * dy,PntZ1 + sta * dz,
PntX1 + end * dx,PntY1 + end * dy,PntZ1 + end * dz,
S,reg1,regn,outl,intl));
}
}
if (myDebug) {
ChronHide.Stop();
cout << " Temps Hide :";
ChronHide.Show();
}
}
//=======================================================================
//function : DrawOn
//purpose :
//=======================================================================
void HLRTest_DrawablePolyEdgeTool::DrawOn (Draw_Display& D) const
{
if (myViewId == D.ViewId()) {
if (myHideMode) {
HLRBRep_ListIteratorOfListOfBPoint It;
if (myDispHid) {
D.SetColor(Draw_bleu);
for (It.Initialize(myBiPntHid);
It.More();
It.Next()) {
const HLRBRep_BiPoint& BP = It.Value();
Standard_Boolean todraw = Standard_True;
if ((!myDispRg1 && BP.Rg1Line() && !BP.OutLine()) ||
(!myDispRgN && BP.RgNLine() && !BP.OutLine()))
todraw = Standard_False;
if (todraw) {
D.MoveTo(BP.P1());
D.DrawTo(BP.P2());
}
}
}
D.SetColor(Draw_vert);
for (It.Initialize(myBiPntVis);
It.More();
It.Next()) {
const HLRBRep_BiPoint& BP = It.Value();
Standard_Boolean todraw = Standard_True;
if ((!myDispRg1 && BP.Rg1Line() && !BP.OutLine()) ||
(!myDispRgN && BP.RgNLine() && !BP.OutLine()))
todraw = Standard_False;
if (todraw) {
D.MoveTo(BP.P1());
D.DrawTo(BP.P2());
}
}
}
else {
Standard_Address Coordinates;
TopoDS_Shape S;
Standard_Boolean reg1,regn,outl,intl;
D.SetColor(Draw_vert);
for (myAlgo->InitShow(); myAlgo->MoreShow(); myAlgo->NextShow()) {
myAlgo->Show(Coordinates,S,reg1,regn,outl,intl);
Standard_Boolean todraw = Standard_True;
if ((!myDispRg1 && reg1 && !outl) ||
(!myDispRgN && regn && !outl))
todraw = Standard_False;
if (todraw) {
D.MoveTo(gp_Pnt(PntX1,PntY1,PntZ1));
D.DrawTo(gp_Pnt(PntX2,PntY2,PntZ2));
}
}
}
}
}

View File

@@ -0,0 +1,93 @@
// File: HLRTest_DrawablePolyEdgeTool.lxx
// Created: Wed Nov 15 21:43:57 1995
// Author: Christophe MARION
// <cma@ecolox>
//=======================================================================
//function : Show
//purpose :
//=======================================================================
inline void HLRTest_DrawablePolyEdgeTool::Show()
{ myHideMode = Standard_False; }
//=======================================================================
//function : Hide
//purpose :
//=======================================================================
inline void HLRTest_DrawablePolyEdgeTool::Hide()
{ myHideMode = Standard_True; }
//=======================================================================
//function : DisplayRg1Line
//purpose :
//=======================================================================
inline void
HLRTest_DrawablePolyEdgeTool::DisplayRg1Line (const Standard_Boolean B)
{ myDispRg1 = B; }
//=======================================================================
//function : DisplayRg1Line
//purpose :
//=======================================================================
inline Standard_Boolean
HLRTest_DrawablePolyEdgeTool::DisplayRg1Line () const
{ return myDispRg1; }
//=======================================================================
//function : DisplayRgNLine
//purpose :
//=======================================================================
inline void
HLRTest_DrawablePolyEdgeTool::DisplayRgNLine(const Standard_Boolean B)
{ myDispRgN = B; }
//=======================================================================
//function : DisplayRgNLine
//purpose :
//=======================================================================
inline Standard_Boolean
HLRTest_DrawablePolyEdgeTool::DisplayRgNLine () const
{ return myDispRgN; }
//=======================================================================
//function : DisplayHidden
//purpose :
//=======================================================================
inline void
HLRTest_DrawablePolyEdgeTool::DisplayHidden(const Standard_Boolean B)
{ myDispHid = B; }
//=======================================================================
//function : DisplayHidden
//purpose :
//=======================================================================
inline Standard_Boolean
HLRTest_DrawablePolyEdgeTool::DisplayHidden () const
{ return myDispHid; }
//=======================================================================
//function : Debug
//purpose :
//=======================================================================
inline void
HLRTest_DrawablePolyEdgeTool::Debug(const Standard_Boolean B)
{ myDebug = B; }
//=======================================================================
//function : Debug
//purpose :
//=======================================================================
inline Standard_Boolean
HLRTest_DrawablePolyEdgeTool::Debug () const
{ return myDebug; }

View File

@@ -0,0 +1,43 @@
-- File: HLRTest_OutLiner.cdl
-- Created: Wed Apr 5 16:38:22 1995
-- Author: Christophe MARION
-- <cma@ecolox>
---Copyright: Matra Datavision 1995
class OutLiner from HLRTest inherits Drawable3D from Draw
---Purpose:
uses
OStream,
Display from Draw,
Interpretor from Draw,
OutLiner from HLRTopoBRep,
Shape from TopoDS
is
Create(S : Shape from TopoDS)
returns mutable OutLiner from HLRTest;
OutLiner(me) returns OutLiner from HLRTopoBRep;
---C++: inline
DrawOn(me; dis : in out Display from Draw);
---Purpose: Does nothhing,
Copy(me) returns mutable Drawable3D from Draw
---Purpose: For variable copy.
is redefined;
Dump(me; S : in out OStream)
---Purpose: For variable dump.
is redefined;
Whatis(me; I : in out Interpretor from Draw)
---Purpose: For variable whatis command. Set as a result the
-- type of the variable.
is redefined;
fields
myOutLiner : OutLiner from HLRTopoBRep;
end OutLiner;

View File

@@ -0,0 +1,58 @@
// File: HLRTest_OutLiner.cxx
// Created: Wed Apr 5 17:06:37 1995
// Author: Christophe MARION
// <cma@ecolox>
#include <HLRTest_OutLiner.ixx>
//=======================================================================
//function : HLRTest_OutLiner
//purpose :
//=======================================================================
HLRTest_OutLiner::HLRTest_OutLiner (const TopoDS_Shape& S)
{
myOutLiner = new HLRTopoBRep_OutLiner(S);
}
//=======================================================================
//function : DrawOn
//purpose :
//=======================================================================
void HLRTest_OutLiner::DrawOn (Draw_Display& dis) const
{
}
//=======================================================================
//function : Copy
//purpose :
//=======================================================================
Handle(Draw_Drawable3D) HLRTest_OutLiner::Copy () const
{
Handle(HLRTest_OutLiner) O =
new HLRTest_OutLiner(myOutLiner->OriginalShape());
return O;
}
//=======================================================================
//function : Dump
//purpose :
//=======================================================================
void HLRTest_OutLiner::Dump (Standard_OStream& S) const
{
S << "This is an outliner" << endl;
}
//=======================================================================
//function : Whatis
//purpose :
//=======================================================================
void HLRTest_OutLiner::Whatis (Draw_Interpretor& I) const
{
I << "outliner";
}

View File

@@ -0,0 +1,15 @@
// File: HLRTest_OutLiner.lxx
// Created: Wed Apr 5 17:10:19 1995
// Author: Christophe MARION
// <cma@ecolox>
//=======================================================================
//function : OutLiner
//purpose :
//=======================================================================
inline Handle(HLRTopoBRep_OutLiner) HLRTest_OutLiner::OutLiner() const
{
return myOutLiner;
}

View File

@@ -0,0 +1,43 @@
-- File: HLRTest_Projector.cdl
-- Created: Wed Apr 5 16:30:59 1995
-- Author: Christophe MARION
-- <cma@ecolox>
---Copyright: Matra Datavision 1995
class Projector from HLRTest inherits Drawable3D from Draw
---Purpose:
uses
OStream,
Display from Draw,
Interpretor from Draw,
Projector from HLRAlgo
is
Create(P : Projector from HLRAlgo)
returns mutable Projector from HLRTest;
Projector(me) returns Projector from HLRAlgo;
---C++: return const &
---C++: inline
DrawOn(me; dis : in out Display from Draw);
---Purpose: Does nothhing,
Copy(me) returns mutable Drawable3D from Draw
---Purpose: For variable copy.
is redefined;
Dump(me; S : in out OStream)
---Purpose: For variable dump.
is redefined;
Whatis(me; I : in out Interpretor from Draw)
---Purpose: For variable whatis command. Set as a result the
-- type of the variable.
is redefined;
fields
myProjector : Projector from HLRAlgo;
end Projector;

View File

@@ -0,0 +1,68 @@
// File: HLRTest_Projector.cxx
// Created: Wed Apr 5 16:58:12 1995
// Author: Christophe MARION
// <cma@ecolox>
#include <Standard_Stream.hxx>
#include <HLRTest_Projector.ixx>
//=======================================================================
//function : HLRTest_Projector
//purpose :
//=======================================================================
HLRTest_Projector::HLRTest_Projector (const HLRAlgo_Projector& P) :
myProjector(P)
{
}
//=======================================================================
//function : DrawOn
//purpose :
//=======================================================================
void HLRTest_Projector::DrawOn (Draw_Display&) const
{
}
//=======================================================================
//function : Copy
//purpose :
//=======================================================================
Handle(Draw_Drawable3D) HLRTest_Projector::Copy () const
{
return new HLRTest_Projector(myProjector);
}
//=======================================================================
//function : Dump
//purpose :
//=======================================================================
void HLRTest_Projector::Dump (Standard_OStream& S) const
{
S << "Projector : \n";
if (myProjector.Perspective())
S << "perspective, focal = " << myProjector.Focus() << "\n";
for (Standard_Integer i = 1; i <= 3; i++) {
for (Standard_Integer j = 1; j <= 4; j++) {
S << setw(15) << myProjector.Transformation().Value(i,j);
}
S << "\n";
}
S << endl;
}
//=======================================================================
//function : Whatis
//purpose :
//=======================================================================
void HLRTest_Projector::Whatis (Draw_Interpretor& I) const
{
I << "projector";
}

View File

@@ -0,0 +1,15 @@
// File: HLRTest_Projector.lxx
// Created: Wed Apr 5 17:05:16 1995
// Author: Christophe MARION
// <cma@ecolox>
//=======================================================================
//function : Projector
//purpose :
//=======================================================================
inline const HLRAlgo_Projector & HLRTest_Projector::Projector () const
{
return myProjector;
}

View File

@@ -0,0 +1,74 @@
-- File: HLRTest_ShapeData.cdl
-- Created: Fri Aug 21 17:10:30 1992
-- Author: Christophe MARION
-- <cma@sdsun1>
---Copyright: Matra Datavision 1992
class ShapeData from HLRTest inherits TShared from MMgt
---Purpose: Contains the colors of a shape.
uses
Color from Draw
is
Create(CVis,COVis,CIVis,CHid,COHid,CIHid : Color from Draw)
returns mutable ShapeData from HLRTest;
VisibleColor(me: mutable; CVis : Color from Draw)
---C++: inline
is static;
VisibleOutLineColor(me: mutable; COVis : Color from Draw)
---C++: inline
is static;
VisibleIsoColor(me: mutable; CIVis : Color from Draw)
---C++: inline
is static;
HiddenColor(me: mutable; CHid : Color from Draw)
---C++: inline
is static;
HiddenOutLineColor(me: mutable; COHid : Color from Draw)
---C++: inline
is static;
HiddenIsoColor(me: mutable; CIHid : Color from Draw)
---C++: inline
is static;
VisibleColor(me) returns Color from Draw
---C++: inline
is static;
VisibleOutLineColor(me) returns Color from Draw
---C++: inline
is static;
VisibleIsoColor(me) returns Color from Draw
---C++: inline
is static;
HiddenColor(me) returns Color from Draw
---C++: inline
is static;
HiddenOutLineColor(me) returns Color from Draw
---C++: inline
is static;
HiddenIsoColor(me) returns Color from Draw
---C++: inline
is static;
fields
myVColor : Color from Draw;
myVOColor : Color from Draw;
myVIColor : Color from Draw;
myHColor : Color from Draw;
myHOColor : Color from Draw;
myHIColor : Color from Draw;
end ShapeData;

View File

@@ -0,0 +1,23 @@
// File: HLRTest_ShapeData.cxx
// Created: Tue Aug 25 10:43:05 1992
// Author: Christophe MARION
// <cma@sdsun2>
#include <HLRTest_ShapeData.ixx>
//=======================================================================
//function : HLRTest_ShapeData
//purpose :
//=======================================================================
HLRTest_ShapeData::HLRTest_ShapeData
(const Draw_Color& CVis,
const Draw_Color& COVis,
const Draw_Color& CIVis,
const Draw_Color& CHid,
const Draw_Color& COHid,
const Draw_Color& CIHid) :
myVColor(CVis),myVOColor(COVis),myVIColor(CIVis),
myHColor(CHid),myHOColor(COHid),myHIColor(CIHid)
{}

105
src/HLRTest/HLRTest_ShapeData.lxx Executable file
View File

@@ -0,0 +1,105 @@
// File: HLRTest_ShapeData.lxx
// Created: Tue Aug 25 10:43:05 1992
// Author: Christophe MARION
// <cma@sdsun2>
//=======================================================================
//function : VisibleColor
//purpose :
//=======================================================================
inline void HLRTest_ShapeData::VisibleColor(const Draw_Color& CVis)
{ myVColor = CVis; }
//=======================================================================
//function : VisibleOutLineColor
//purpose :
//=======================================================================
inline void HLRTest_ShapeData::VisibleOutLineColor
(const Draw_Color& COVis)
{ myVOColor = COVis; }
//=======================================================================
//function : VisibleIsoColor
//purpose :
//=======================================================================
inline void HLRTest_ShapeData::VisibleIsoColor
(const Draw_Color& CIVis)
{ myVIColor = CIVis; }
//=======================================================================
//function : HiddenColor
//purpose :
//=======================================================================
inline void HLRTest_ShapeData::HiddenColor(const Draw_Color& CHid)
{ myHColor = CHid; }
//=======================================================================
//function : HiddenOutLineColor
//purpose :
//=======================================================================
inline void HLRTest_ShapeData::HiddenOutLineColor
(const Draw_Color& COHid)
{ myHOColor = COHid; }
//=======================================================================
//function : HiddenIsoColor
//purpose :
//=======================================================================
inline void HLRTest_ShapeData::HiddenIsoColor
(const Draw_Color& CIHid)
{ myHIColor = CIHid; }
//=======================================================================
//function : VisibleColor
//purpose :
//=======================================================================
inline Draw_Color HLRTest_ShapeData::VisibleColor() const
{ return myVColor; }
//=======================================================================
//function : VisibleOutLineColor
//purpose :
//=======================================================================
inline Draw_Color HLRTest_ShapeData::VisibleOutLineColor() const
{ return myVOColor; }
//=======================================================================
//function : VisibleIsoColor
//purpose :
//=======================================================================
inline Draw_Color HLRTest_ShapeData::VisibleIsoColor() const
{ return myVIColor; }
//=======================================================================
//function : HiddenColor
//purpose :
//=======================================================================
inline Draw_Color HLRTest_ShapeData::HiddenColor() const
{ return myHColor; }
//=======================================================================
//function : HiddenOutLineColor
//purpose :
//=======================================================================
inline Draw_Color HLRTest_ShapeData::HiddenOutLineColor() const
{ return myHOColor; }
//=======================================================================
//function : HiddenIsoColor
//purpose :
//=======================================================================
inline Draw_Color HLRTest_ShapeData::HiddenIsoColor() const
{ return myHIColor; }