1 // Created on: 1994-10-24
2 // Created by: Jean Yves LEBEY
3 // Copyright (c) 1994-1999 Matra Datavision
4 // Copyright (c) 1999-2014 OPEN CASCADE SAS
6 // This file is part of Open CASCADE Technology software library.
8 // This library is free software; you can redistribute it and/or modify it under
9 // the terms of the GNU Lesser General Public License version 2.1 as published
10 // by the Free Software Foundation, with special exception defined in the file
11 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
12 // distribution for complete text of the license and disclaimer of any warranty.
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
17 #include <TestTopOpe.hxx>
18 #include <TestTopOpe_HDSDisplayer.hxx>
19 #include <TestTopOpeDraw_DrawableSHA.hxx>
20 #include <TestTopOpeDraw_DrawableP3D.hxx>
21 #include <TestTopOpeDraw_DrawableC3D.hxx>
22 #include <TestTopOpeDraw_TTOT.hxx>
23 #include <TestTopOpeDraw_Displayer.hxx>
24 #include <TopOpeBRepDS_connex.hxx>
25 #include <TopOpeBRepDS_Point.hxx>
26 #include <TopOpeBRepDS_Curve.hxx>
27 #include <TopOpeBRepDS_PointIterator.hxx>
28 #include <TopOpeBRepDS_PointExplorer.hxx>
29 #include <TopOpeBRepDS_CurveExplorer.hxx>
30 #include <TopOpeBRepDS_Explorer.hxx>
31 #include <TopOpeBRepDS_TKI.hxx>
32 #include <TopOpeBRepDS_Check.hxx>
33 #include <TopOpeBRepDS_Dumper.hxx>
34 #include <TopOpeBRepDS.hxx>
35 #include <Geom_TrimmedCurve.hxx>
36 #include <BRep_Tool.hxx>
38 #include <TopLoc_Location.hxx>
39 #include <Geom_Curve.hxx>
40 #include <GeomAdaptor_Curve.hxx>
41 #include <GeomAbs_CurveType.hxx>
42 #include <GeomAdaptor_Surface.hxx>
43 #include <GeomAbs_SurfaceType.hxx>
44 #include <GeomAPI_ProjectPointOnCurve.hxx>
45 #include <BRepAdaptor_Curve.hxx>
46 #include <TColStd_ListOfInteger.hxx>
47 #include <TColStd_ListIteratorOfListOfInteger.hxx>
48 #include <TopOpeBRepDS_define.hxx>
50 #include <Draw_Appli.hxx>
51 #include <DrawTrSurf_Curve.hxx>
52 #include <Draw_Interpretor.hxx>
53 #include <DrawTrSurf.hxx>
54 #include <Draw_Marker3D.hxx>
58 TSEEpar(const TCollection_AsciiString& s) { set(s); }
59 void set(const TCollection_AsciiString& s) {
60 miskind = misshap = misgeom = missect = misdege = misafev = misedcu = Standard_False;
61 mTK = TopOpeBRepDS_UNKNOWN; mTS = TopAbs_SHAPE;
62 char* sK = (char *)s.ToCString();
63 miskind = TestTopOpeDraw_TTOT::StringToKind(s,mTK);
65 misshap = TopOpeBRepDS::IsTopology(mTK);
66 if (misshap) mTS = TopOpeBRepDS::KindToShape(mTK);
67 else misgeom = TopOpeBRepDS::IsGeometry(mTK);
69 else if ( ! strcasecmp(sK,"s") ) {
70 misshap = Standard_True; mTS = TopAbs_SHAPE;
72 else if ( ! strcasecmp(sK,"se") ) {
73 missect = Standard_True; mTK = TopOpeBRepDS_EDGE;
75 else if ( ! strcasecmp(sK,"de") ) {
76 misdege = Standard_True; mTK = TopOpeBRepDS_EDGE;
78 else if ( ! strcasecmp(sK,"fev") ) {
79 misafev = Standard_True;
81 else if ( ! strcasecmp(sK,"ec") ) {
82 misedcu = Standard_True;
85 Standard_Boolean iskind() { return miskind;}
86 Standard_Boolean isshap() { return misshap;}
87 Standard_Boolean isgeom() { return misgeom;}
88 Standard_Boolean issect() { return missect;}
89 Standard_Boolean isdege() { return misdege;}
90 Standard_Boolean isafev() { return misafev;}
91 Standard_Boolean isedcu() { return misedcu;}
92 TopOpeBRepDS_Kind TK() {return mTK;}
93 TopAbs_ShapeEnum TS() {return mTS;}
95 Standard_Boolean miskind,misshap,misgeom,missect,misdege,misafev,misedcu;
96 TopOpeBRepDS_Kind mTK; TopAbs_ShapeEnum mTS;
99 class TDSpar : public TSEEpar {
101 TDSpar(const TCollection_AsciiString& s) : TSEEpar(s) {}
104 #define ISINTEGER(MMstr) ((strspn((MMstr),"0123456789") == strlen((MMstr))))
106 TestTopOpe_HDSDisplayer* PHDSD = NULL;
107 static TestTopOpeDraw_Displayer* POCD = NULL;
109 static Standard_Boolean SFindKeep = Standard_False;
110 static Standard_Boolean GFindKeep = Standard_False;
111 static Standard_Boolean PrintDistancePP = Standard_False;
112 static Standard_Integer SelectRankShape = 0;
113 static Standard_Boolean DisOri = Standard_False;
114 static Standard_Boolean TolFlag = Standard_False;
115 static Standard_Real OldParFlag = -1.0;
116 static Standard_Real ParFlag = -1.0;
120 Standard_Boolean myEOK;
121 TestTopOpe_HDSDisplayer* myEPHDSD;
122 Handle(TopOpeBRepDS_HDataStructure) myEHDS; TopOpeBRepDS_DataStructure *myEPDS;
123 TopOpeBRepDS_Kind myETK;TopAbs_ShapeEnum myETS;Standard_Integer myEindex;
124 Standard_Boolean myEiskind,myEisshape,myEisgeome,myEissect;
125 TCollection_AsciiString myEnamedbrep,myEnamedisp; Draw_ColorKind myEnamecolor;
129 // tsee_entity::tsee_entity() {
130 myEOK = Standard_False;
131 if (PHDSD == NULL) return; myEPHDSD = PHDSD;
132 myEHDS = myEPHDSD->CurrentHDS(); myEPDS = (TopOpeBRepDS_DataStructure*)&myEHDS->ChangeDS();
133 myETK = TopOpeBRepDS_UNKNOWN;myETS = TopAbs_SHAPE; myEindex = 0;
134 myEiskind = myEisshape = myEisgeome = myEissect = Standard_False;
135 myEnamedbrep = ""; myEnamedisp = ""; myEnamecolor = Draw_blanc;
136 myEOK = Standard_True;
139 Standard_Boolean IsP() const { return (myETK == TopOpeBRepDS_POINT); }
140 Standard_Boolean IsV() const { return (myETK == TopOpeBRepDS_VERTEX); }
141 Standard_Boolean Is0() const { return IsP() || IsV(); }
142 Standard_Integer Set(Standard_Integer na,const char** a,Standard_Integer iargK,Standard_Integer iargI);
144 virtual ~tsee_entity() {}
145 void virtual See() = 0;
148 Standard_Integer tsee_entity::Set(Standard_Integer na,const char** a,Standard_Integer iargK,Standard_Integer iargI) {
149 myEOK = Standard_False;
150 if (iargK>=na) return 1; if (iargI>=na) return 1;
151 TCollection_AsciiString ascK = a[iargK]; myEindex = Draw::Atoi(a[iargI]);
152 myEiskind = TestTopOpeDraw_TTOT::StringToKind(ascK,myETK);
153 if (!myEiskind) return 1; if (myETK == TopOpeBRepDS_UNKNOWN) return 1;
155 myEisshape = TopOpeBRepDS::IsTopology(myETK);
157 if ((myEindex < 1) || (myEindex > myEPDS->NbShapes())) return 0;
158 myETS = TopOpeBRepDS::KindToShape(myETK);
159 const TopoDS_Shape& S = myEPDS->Shape(myEindex);
160 if (myETS != S.ShapeType()) return 0;
161 myEPHDSD->ShapeName(myEindex,S,myEnamedbrep);
162 myEPHDSD->ShapeDisplayName(myEindex,S,myEnamedisp);
165 myEisgeome = TopOpeBRepDS::IsGeometry(myETK);
168 TopOpeBRepDS_PointExplorer pex(myEHDS->DS());
169 if (!pex.IsPoint(myEindex)) return 1;
171 TestTopOpeDraw_TTOT::GeometryName(myEindex,myETK,myEnamedbrep);
172 myEPHDSD->GeometryDisplayName(myEindex,myETK,myEnamedisp);
175 myEnamecolor = TestTopOpeDraw_TTOT::GeometryColor(myETK);
176 myEOK = Standard_True;
180 class tsee_entity0 : public tsee_entity {
186 gp_Pnt tsee_entity0::Pnt() const
188 if (!Is0()) throw Standard_Failure("not 0d");
190 if (IsP()) P = myEPDS->Point(myEindex).Point();
191 else if (IsV()) P = BRep_Tool::Pnt(TopoDS::Vertex(myEPDS->Shape(myEindex)));
196 (const TCollection_AsciiString& namedbrep,const TCollection_AsciiString& namedisp,const Draw_Color& namecolor,const TopOpeBRepDS_Point& P)
198 Handle(TestTopOpeDraw_DrawableP3D) D;
200 D = new TestTopOpeDraw_DrawableP3D(P.Point(),Draw_CircleZoom,namecolor,
201 namedisp.ToCString(),namecolor,
204 D = new TestTopOpeDraw_DrawableP3D(P.Point(),Draw_Square,namecolor,
205 namedisp.ToCString(),namecolor);
207 char *pname = (char *)namedbrep.ToCString();
211 void tsee_entity0::See()
213 if (IsP()) ::SetPoint(myEnamedbrep,myEnamedisp,myEnamecolor,myEPDS->Point(myEindex));
214 if (IsV()) POCD->DisplayShape(myEnamedbrep,myEnamedisp,myEPDS->Shape(myEindex));
217 //-----------------------------------------------
219 //-----------------------------------------------
220 (const TCollection_AsciiString& namedbrep,
221 const TCollection_AsciiString& namedisp,
222 const Draw_Color& namecolor,
223 const TopOpeBRepDS_Curve& DSC,
224 const Standard_Integer iC)
226 if ( !PHDSD ) return;
227 const Handle(Geom_Curve) GC = DSC.Curve();
228 if ( GC.IsNull() ) { cout<<"Curve() nulle"<<endl; return; }
230 Standard_Real f = GC->FirstParameter();
231 Standard_Real l = GC->LastParameter();
233 GeomAdaptor_Curve GAC(GC);
234 GeomAbs_CurveType GACt = GAC.GetType();
235 if ( GACt == GeomAbs_Line ) {
236 Standard_Real fline = RealLast(),lline = RealFirst();
237 Standard_Integer imother = DSC.Mother(),igood;
238 if(imother) igood = imother;
240 TopOpeBRepDS_PointIterator it = PHDSD->CurrentHDS()->CurvePoints(igood);
241 for(; it.More(); it.Next()) {
242 Standard_Real p = it.Parameter();
243 fline = Min(fline,p); lline = Max(fline,p);
249 Handle(Geom_TrimmedCurve) GTC = new Geom_TrimmedCurve(GC,f,l);
250 Handle(TestTopOpeDraw_DrawableC3D) D;
251 D = new TestTopOpeDraw_DrawableC3D(GTC,namecolor,namedisp.ToCString(),namecolor);
252 char *pname = (char *)namedbrep.ToCString();
256 static TopoDS_Shape bidbid;
257 static const TopoDS_Shape& GetShape(const Standard_Integer IS,const TopAbs_ShapeEnum TS)
259 Standard_Boolean TypeControl = Standard_True;
260 if ( !PHDSD ) return bidbid;
262 static TopoDS_Shape ShapeNull;
263 const TopOpeBRepDS_DataStructure& BDS = PHDSD->CurrentBDS();
265 // check on shape index and on shape kind if kind differs from TopAbs_SHAPE
266 Standard_Integer ns = BDS.NbShapes();
267 if ( IS < 1 || IS > ns) {
268 TopAbs::Print(TS,cout);cout<<" "<<IS<<" does not exist in DS"<<endl;
271 else if ( !PHDSD->ShapeKind(IS,TS) ) {
274 cout<<" is not a ";TopAbs::Print(TS,cout);
275 cout<<" but a "; TopAbs::Print(BDS.Shape(IS,SFindKeep).ShapeType(),cout);
281 const TopoDS_Shape& S = BDS.Shape(IS,SFindKeep);
285 static const TopoDS_Shape& GetShape(const Standard_Integer IS)
287 if ( !PHDSD ) return bidbid;
288 const TopOpeBRepDS_DataStructure& BDS = PHDSD->CurrentBDS();
289 const TopoDS_Shape& S = BDS.Shape(IS);
293 //-----------------------------------------------------------------------
295 //-----------------------------------------------------------------------
296 static Standard_Integer SeeSectionEdge(const Standard_Integer ISE)
298 if ( !PHDSD || !POCD ) return 0;
300 Standard_Integer nse = PHDSD->CurrentBDS().NbSectionEdges();
301 if ( ISE < 1 || ISE > nse ) return 0;
302 const TopoDS_Shape& SE = PHDSD->CurrentBDS().SectionEdge(ISE);
303 if (SE.IsNull()) return 0;
305 TCollection_AsciiString namedbrep; PHDSD->SectionEdgeName(ISE,SE,namedbrep);
306 TCollection_AsciiString namedisp; PHDSD->SectionEdgeDisplayName(ISE,SE,namedisp);
307 POCD->DisplayGeometry(Standard_True);
308 POCD->DisplayShape(namedbrep,namedisp,SE);
312 //-----------------------------------------------------------------------
314 //-----------------------------------------------------------------------
315 Standard_Integer SeeShapeIS(const Standard_Integer I,const TopoDS_Shape& S)
317 if ( !PHDSD || !POCD) return 0;
319 if (S.IsNull()) return 0;
320 TCollection_AsciiString namedbrep; PHDSD->ShapeName(I,S,namedbrep);
321 TCollection_AsciiString namedisp = namedbrep;
322 // NameDisplay = *name/name* if S subshape of shape1/shape2
323 TCollection_AsciiString ast = "*";
324 const TopOpeBRepDS_DataStructure& BDS = PHDSD->CurrentBDS();
325 // if the Shape was removed from the DS, "*" is replaced by "~"
328 Standard_Boolean of1 = PHDSD->SubShape(S,1);if(of1) namedisp = ast+namedisp;
329 Standard_Boolean of2 = PHDSD->SubShape(S,2);if(of2) namedisp = namedisp+ast;
330 if (SelectRankShape == 1 && !of1) return 0;
331 if (SelectRankShape == 2 && !of2) return 0;
333 if (S.ShapeType()==TopAbs_EDGE) POCD->DisplayGeometry(Standard_True);
334 else POCD->DisplayGeometry(DisOri);
335 if((S.ShapeType()==TopAbs_VERTEX) && TolFlag) {
336 const TopoDS_Vertex& V = TopoDS::Vertex(S);
337 Standard_Real Tol = BRep_Tool::Tolerance(V);
340 POCD->DisplayShape(namedbrep,namedisp,S);
346 //-----------------------------------------------------------------------
348 //-----------------------------------------------------------------------
349 static Standard_Integer SeeShape(TCollection_AsciiString namedbrep)
351 if ( !PHDSD || !POCD ) return 0;
353 const char* pname = (const char *)namedbrep.ToCString();
354 TopoDS_Shape S = DBRep::Get(pname);
355 if ( S.IsNull() ) return 0;
356 TCollection_AsciiString namedisp;
357 PHDSD->ShapeDisplayName(namedbrep,S,namedisp);
358 POCD->DisplayShape(namedbrep,namedisp,S);
362 //-----------------------------------------------------------------------
364 //-----------------------------------------------------------------------
365 static Standard_Integer SeePoint(const Standard_Integer I)
367 if ( !PHDSD ) return 0;
369 const TopOpeBRepDS_DataStructure& BDS = PHDSD->CurrentBDS();
370 if (I < 1 || I > BDS.NbPoints()) return 0;
372 TopOpeBRepDS_PointExplorer pex(BDS);
373 Standard_Boolean isp = pex.IsPoint(I);
376 const TopOpeBRepDS_Point& P = BDS.Point(I);
377 TopOpeBRepDS_Kind K = TopOpeBRepDS_POINT;
378 TCollection_AsciiString namedbrep; TestTopOpeDraw_TTOT::GeometryName(I,K,namedbrep);
379 TCollection_AsciiString namedisp; PHDSD->GeometryDisplayName(I,K,namedisp);
380 Draw_ColorKind namecolor = TestTopOpeDraw_TTOT::GeometryColor(K);
381 SetPoint(namedbrep,namedisp,namecolor,P);
385 //-----------------------------------------------------------------------
387 //-----------------------------------------------------------------------
388 static Standard_Integer SeeCurve(const Standard_Integer I)
390 if ( !PHDSD ) return 0;
392 const TopOpeBRepDS_DataStructure& BDS = PHDSD->CurrentBDS();
393 if (I < 1 || I > BDS.NbCurves()) return 0;
395 TopOpeBRepDS_CurveExplorer cex(BDS,GFindKeep);
396 Standard_Boolean isc = cex.IsCurve(I);
399 const TopOpeBRepDS_Curve& C = BDS.Curve(I);
400 TopOpeBRepDS_Kind K = TopOpeBRepDS_CURVE;
401 TCollection_AsciiString namedbrep; TestTopOpeDraw_TTOT::GeometryName(I,K,namedbrep);
402 TCollection_AsciiString namedisp; PHDSD->GeometryDisplayName(I,K,namedisp);
403 Draw_ColorKind namecolor = TestTopOpeDraw_TTOT::GeometryColor(K);
404 SetCurve(namedbrep,namedisp,namecolor,C,I);
409 //-----------------------------------------------------------------------
411 //-----------------------------------------------------------------------
412 Standard_Integer SeeSurface(const Standard_Integer I) // NYI
414 if ( !PHDSD ) return 0;
416 const TopOpeBRepDS_DataStructure& BDS = PHDSD->CurrentBDS();
417 if (I < 1 || I > BDS.NbSurfaces()) return 0;
421 //-----------------------------------------------------------------------
423 //-----------------------------------------------------------------------
424 static Standard_Integer SeeEdgeCurve(const Standard_Integer IE,const TopoDS_Shape& SE)
426 if ( !POCD ) return 0;
428 if (SE.IsNull()) return 0;
429 const TopoDS_Edge& E = TopoDS::Edge(SE);
430 TopLoc_Location L;Standard_Real f,l;Handle(Geom_Curve) GC=BRep_Tool::Curve(E,L,f,l);
431 TCollection_AsciiString namedbrep="E";TestTopOpeDraw_TTOT::CatCurveName(IE,namedbrep);
432 TCollection_AsciiString namedisp="E";TestTopOpeDraw_TTOT::CatCurveDisplayName(IE,GC,namedisp);
433 POCD->DisplayGeometry(Standard_True);
434 POCD->DisplayShape(namedbrep,namedisp,SE);
438 //-----------------------------------------------------------------------
440 //-----------------------------------------------------------------------
441 static Standard_Integer SeeGeometry(const Standard_Integer IG,const TopOpeBRepDS_Kind TK)
443 if (TK == TopOpeBRepDS_POINT) return SeePoint(IG);
444 else if (TK == TopOpeBRepDS_CURVE) return SeeCurve(IG);
445 else if (TK == TopOpeBRepDS_SURFACE) return SeeSurface(IG);
449 //-----------------------------------------------------------------------
451 //-----------------------------------------------------------------------
452 static Standard_Integer SeeGeometry(const TopOpeBRepDS_Kind TK)
454 if ( !PHDSD ) return 0;
456 const TopOpeBRepDS_DataStructure& BDS = PHDSD->CurrentBDS();
458 if (TK == TopOpeBRepDS_POINT) {
459 TopOpeBRepDS_PointExplorer pex(BDS,GFindKeep);
460 for (; pex.More(); pex.Next()) {
461 Standard_Integer ig = pex.Index();
465 else if (TK == TopOpeBRepDS_CURVE) {
466 TopOpeBRepDS_CurveExplorer cex(BDS,GFindKeep);
467 for (; cex.More(); cex.Next()) {
468 Standard_Integer ig = cex.Index();
472 else if (TK == TopOpeBRepDS_SURFACE) { //NYI
477 //-----------------------------------------------------------------------
479 //-----------------------------------------------------------------------
480 Standard_Integer TOPOPE_SeeShape(char* name)
482 TCollection_AsciiString asc = name;
483 Standard_Integer res = SeeShape(asc);
487 //-----------------------------------------------------------------------
488 // suppressarg : remove a[d],modify na--
489 //-----------------------------------------------------------------------
490 void suppressarg(Standard_Integer& na,const char** a,const Standard_Integer d)
492 for(Standard_Integer i=d;i<na;i++) {
499 //-----------------------------------------------------------------------
500 // suppressargs : remove a[*] from <f> to <l>,modify na = na - (l - f)
501 //-----------------------------------------------------------------------
502 Standard_EXPORT void suppressargs(Standard_Integer& na,const char** a,const Standard_Integer f,const Standard_Integer l)
507 for(Standard_Integer i=0;i<na-l;i++) {
514 //-----------------------------------------------------------------------
516 //-----------------------------------------------------------------------
517 static void tsee_flags(Standard_Integer& na,const char** a) {
518 GFindKeep = Standard_False;
519 PrintDistancePP = Standard_False;
522 for (Standard_Integer ia = 1; ia < na; ia++) {
523 if (!strcasecmp(a[ia],"-k")) {
524 suppressarg(na,a,ia);
525 GFindKeep = Standard_True;
527 else if (!strcasecmp(a[ia],"-d")) {
528 // tsee -d p 4 7 : display p_4,p_7 + tds p 4 7 + calculate distance (p_4,p_7)
529 suppressarg(na,a,ia);
530 PrintDistancePP = Standard_True;
532 else if (!strcasecmp(a[ia],"-1")) {
533 // tsee -1 s 4 : display s_4 <=> s_4 is subshape of the 1st argument
534 suppressarg(na,a,ia);
537 else if (!strcasecmp(a[ia],"-2")) {
538 // tsee -2 s 4 : display s_4 <=> s_4 is subshape of the 2nd argument
539 suppressarg(na,a,ia);
542 else if (!strcasecmp(a[ia],"-p") && (ia < na-1)) {
543 suppressargs(na,a,ia,ia+1);
544 Standard_Real t = Draw::Atof(a[ia+1]);
545 if (t >= 0. && t <= 1.) {
546 OldParFlag = ParFlag; ParFlag = t;
552 void OthersCommands_help(const char* CommandName,const char* syntaxe = "");
553 //-----------------------------------------------------------------------
555 //-----------------------------------------------------------------------
556 static void tsee_help(const char* CommandName, Draw_Interpretor& di)
559 di<<"tsee : Draw entities of data structure (DS) loaded by TestTopOpe::CurrentDS().\n";
560 di<<"DS entities are shapes and geometries accessed by a <type> and an <index>.\n";
561 di<<"basic usage :\n";
562 di<<" tsee <type> <index1 index2 ...>\n";
563 di<<"<type> = so sh f w e v s for solid/shell/face/wire/edge/vertex/shape\n";
564 di<<" su cu p for surface/curve/point (N.B : su is NYI)\n";
565 di<<"<index> = integer\n";
566 di<<"example : 'tsee e 3' will draw the edge of index 3\n";
567 di<<" 'tsee e 3 6' will draw the edges of index 3 and 6\n";
568 di<<" 'tsee e' will draw all the edges.\n";
570 di<<"Index values of DS entities may be given by the 'tds' command which prints\n";
571 di<<"the content of the DS for each shape and geometry type.\n";
572 di<<"Entities are drawn with a specific color according to their type.\n";
575 di<<"'tsee <t> <i>' creates the drawable object named <t>_<i>.\n";
576 di<<"This name is displayed near the entity in one if the forms : \n";
577 di<<" *<t>_<i> meaning entity belongs to the first shape of current operation.\n";
578 di<<" <t>_<i>* meaning entity belongs to the second shape of current operation.\n";
580 di<<"Same Domain shapes : \n";
581 di<<"'tsee <type> sd' to display all shapes of <type> having same domain data.\n";
582 di<<"example : 'tsee e sd' to display all edges sharing a 1d geometric domain\n";
583 di<<" with other edges.\n";
585 di<<"Optional flags :\n";
586 OthersCommands_help(CommandName);
587 di<<"Other types :\n";
588 di<<"'tsee fev' : displays all faces,then edges,then vertices.\n";
589 di<<"'tsee es <i>' displays edge described as section edge <i>.\n";
590 di<<" The name of a section edge likes t_i<j>,where :\n";
591 di<<" - i is the edge index in the set of section edge,\n";
592 di<<" - j is edge index in the DS (as any edge).\n";
596 static void tseei_help(Draw_Interpretor& di)
599 di<<"tseei : Draws entities of data structure (DS) loaded by TestTopOpe::CurrentDS().\n";
600 di<<"Draws the objects appearing in interferences DS objects.\n";
601 di<<"See command 'tsee' for discussion about DS objects.\n";
605 static void tki_help(Draw_Interpretor& di)
608 di<<"tki,tkig,tkis : Groups interferences of DS objects\n";
609 di<<" by geometry (g),or support (s),and index.\n";
610 di<<"See command 'tsee' for discussion about DS objects.\n";
611 di<<"(Test of class TopOpeBRepDS_TKI)\n";
615 static void tds_help(Draw_Interpretor& di)
618 di<<"tds : dump current DS (loaded by CurrentDS())\n";
619 di<<"basic usage : tds <-arg> type <index1 index2 ...>\n";
621 di<<"Description of curve geometry (type = c) : <-arg> = -t -k -s -l\n";
622 di<<"\t-k : print only the curve with keep = Standard_True\n";
623 di<<"\t-l : (long) print all poles and knots for BSplines curves\n";
624 di<<"\t-s : (short) print only 4 poles and 4 knots for BSplines curves\n";
625 di<<"on shapes (type = s|so|sh|f|w|e|v) : <-arg> = -ssi\n";
626 di<<"\t-ssi : print only ShapeShapeInterferences\n";
628 di<<"See command 'tsee' for discussion about type and <index1 index2 ...>.\n";
632 typedef Standard_Integer (*tf_SeeShape)(const Standard_Integer I,const TopoDS_Shape& S);
633 extern void OthersCommands_flags(Standard_Integer& na,const char** a,TestTopOpeDraw_Displayer& TD);
634 void COUTNOHDS(Draw_Interpretor& di) {di<<"no current HDS\n";}
635 Standard_Integer tsee_SeeShapefunc(Draw_Interpretor& di,Standard_Integer na_in,const char** a,tf_SeeShape SeeShapefunc)
637 if (na_in == 1 || (na_in == 2 && !strcasecmp(a[1],"-h"))) {
642 Standard_Integer na = na_in;
643 if ((PHDSD == NULL) || (POCD == NULL)) return 0;
645 const Handle(TopOpeBRepDS_HDataStructure)& HDS = PHDSD->CurrentHDS();
646 if (HDS.IsNull()) { COUTNOHDS(di); return 0; }
647 if (na < 2) return 1;
648 const TopOpeBRepDS_DataStructure& BDS = PHDSD->CurrentBDS();
650 POCD->InitDisplayer();
651 TolFlag = Standard_False;
653 OthersCommands_flags(na,a,*POCD);
654 TolFlag = POCD->TolIs();
655 DisOri = POCD->DisplayGeometry();
657 Standard_Integer i1arg = 1;
658 TSEEpar Tpar(a[i1arg]);
660 // Standard_Integer ia,is,ig;
661 Standard_Integer ia,is;
663 if ( PrintDistancePP ) {
665 if (na == 4) { // tsee p 3 4
666 if (E1.Set(na,a,i1arg+0,i1arg+1)) return 1;
667 if (E2.Set(na,a,i1arg+0,i1arg+2)) return 1;
669 else if (na == 5) { // tsee p 3 v 4
670 if (E1.Set(na,a,i1arg+0,i1arg+1)) return 1;
671 if (E2.Set(na,a,i1arg+2,i1arg+3)) return 1;
673 if (!E1.myEOK || !E2.myEOK) return 1;
676 di<<"Distance "<<E1.myEnamedbrep.ToCString()<<" "<<E2.myEnamedbrep.ToCString()<<" : "<<E1.Pnt().Distance(E2.Pnt())<<"\n";
680 else if ( Tpar.isshap() ) {
681 // na == 2 : display all DS shapes of type TS
682 // na > 2 : display DS shapes of type TS of index Draw::Atoi(a[2]..a[narg-1])
684 TopOpeBRepDS_Explorer x(HDS,Tpar.TS(),Standard_False);
685 for(;x.More();x.Next()) (*SeeShapefunc)(x.Index(),x.Current());
688 if ( !strcmp(a[i1arg+1],"sd") ) { // shapes HasSameDomain of type TS
689 TopOpeBRepDS_Explorer x(HDS,Tpar.TS(),Standard_False);
690 for (;x.More();x.Next()) {
691 Standard_Boolean isSsd = HDS->HasSameDomain(x.Current());
692 if (isSsd ) (*SeeShapefunc)(x.Index(),x.Current());
695 else if (Tpar.isshap() && (Tpar.TS() == TopAbs_EDGE) && (na>=2) && POCD->ParIs()) {
696 // see edges [4..na[ with of the name in t in [0..1] / range
698 TopOpeBRepDS_Explorer x(HDS,TopAbs_EDGE,Standard_False);
699 for (;x.More();x.Next()) (*SeeShapefunc)(x.Index(),x.Current());
702 for (ia = i1arg+1; ia < na; ia++) {
703 is = Draw::Atoi(a[ia]);
704 (*SeeShapefunc)(is,GetShape(is,Tpar.TS()));
707 ParFlag = OldParFlag;
710 for (ia = i1arg+1; ia < na; ia++) {
711 is = Draw::Atoi(a[ia]);
712 (*SeeShapefunc)(is,GetShape(is,Tpar.TS()));
718 else if ( Tpar.isgeom() ) {
719 // na == 2 : display all DS geometries of type TK
720 // na > 2 : display DS geometries of type TK index Draw::Atoi(a[2])..a[narg-1])
721 if (na == 2 ) SeeGeometry(Tpar.TK());
722 else for (ia = i1arg+1; ia < na; ia++) SeeGeometry(Standard_Integer(Draw::Atoi(a[ia])),Tpar.TK());
725 else if ( Tpar.isafev() ) {
726 // faces then edges then vertices
727 TopOpeBRepDS_Explorer x;
728 for (x.Init(HDS,TopAbs_FACE,Standard_False);x.More();x.Next()) (*SeeShapefunc)(x.Index(),GetShape(x.Index()));
729 for (x.Init(HDS,TopAbs_EDGE,Standard_False);x.More();x.Next()) (*SeeShapefunc)(x.Index(),GetShape(x.Index()));
730 for (x.Init(HDS,TopAbs_VERTEX,Standard_False);x.More();x.Next()) (*SeeShapefunc)(x.Index(),GetShape(x.Index()));
733 else if ( Tpar.isedcu() ) {
734 // na == 2 : display curves of all DS edges
735 // na > 2 : display curve of DS edges index Draw::Atoi(a[2])..a[narg-1])
737 TopOpeBRepDS_Explorer x(HDS,TopAbs_EDGE,Standard_False);
738 for (;x.More();x.Next()) SeeEdgeCurve(x.Index(),x.Edge());
741 for (ia = i1arg+1; ia < na; ia++) {
742 is = Draw::Atoi(a[ia]);
743 SeeEdgeCurve(is,GetShape(is,TopAbs_EDGE));
748 else if ( Tpar.issect() ) { // na=2 all section edges,na>2 section edges (a[2]..a[na-1])
749 Standard_Integer ise,nse = BDS.NbSectionEdges();
750 if (na == 2) for (ise = 1; ise<=nse; ise++) SeeSectionEdge(ise);
751 else for (ia = i1arg+1; ia<na; ia++) SeeSectionEdge(Draw::Atoi(a[ia]));
754 else if (Tpar.isdege()) {
755 TopOpeBRepDS_Explorer x;
756 for (x.Init(HDS,TopAbs_EDGE);x.More();x.Next()) {
757 if (BRep_Tool::Degenerated(x.Edge())) (*SeeShapefunc)(x.Index(),GetShape(x.Index()));
762 } // tsee_SeeShapefunc
764 //-----------------------------------------------------------------------
766 //-----------------------------------------------------------------------
767 Standard_Integer tsee(Draw_Interpretor& di,Standard_Integer na_in,const char** a)
769 if (na_in == 1 || (na_in == 2 && !strcasecmp(a[1],"-h"))) {
773 tf_SeeShape ssf = (tf_SeeShape)SeeShapeIS;
774 Standard_Integer r = tsee_SeeShapefunc(di,na_in,a,ssf);
778 //-----------------------------------------------------------------------
780 //-----------------------------------------------------------------------
781 Standard_Integer SeeAnyKI(const TopOpeBRepDS_Kind TK,const Standard_Integer I) {
782 TopAbs_ShapeEnum TS = TopAbs_COMPOUND;
783 Standard_Boolean isshape,isgeome; isshape = isgeome = Standard_False;
784 isshape = TopOpeBRepDS::IsTopology(TK);
785 if (isshape) TS = TopOpeBRepDS::KindToShape(TK);
786 else isgeome = TopOpeBRepDS::IsGeometry(TK);
787 if (isshape) SeeShapeIS(I,GetShape(I,TS));
788 else if (isgeome) SeeGeometry(I,TK);
792 //-----------------------------------------------------------------------
794 //-----------------------------------------------------------------------
795 (TColStd_ListOfInteger& LOK,TColStd_ListOfInteger& LOI,
796 const TopOpeBRepDS_Kind K,const Standard_Integer I)
798 Standard_Boolean isshape,isgeome; isshape = isgeome = Standard_False;
799 isshape = TopOpeBRepDS::IsTopology(K);
801 isgeome = TopOpeBRepDS::IsGeometry(K);
803 if (LOK.IsEmpty() && LOI.IsEmpty()) {
804 LOK.Append((Standard_Integer)K); LOI.Append(I);
808 // to sort, it is considered that :
809 // POINT == VERTEX,CURVE == EDGE,SURFACE == FACE
811 TopAbs_ShapeEnum SKtri=TopAbs_COMPOUND;
813 if (isshape) SKtri = TopOpeBRepDS::KindToShape(K);
815 if (K == TopOpeBRepDS_POINT) SKtri = TopAbs_VERTEX;
816 else if (K == TopOpeBRepDS_CURVE) SKtri = TopAbs_EDGE;
817 else if (K == TopOpeBRepDS_SURFACE) SKtri = TopAbs_FACE;
821 TColStd_ListIteratorOfListOfInteger ITLOK(LOK);
822 TColStd_ListIteratorOfListOfInteger ITLOI(LOI);
823 Standard_Boolean equa = Standard_False;
824 for (; ITLOK.More(),ITLOI.More(); ITLOK.Next(),ITLOI.Next()) {
826 Standard_Integer ifK = ITLOK.Value() ;
827 TopOpeBRepDS_Kind fK = (TopOpeBRepDS_Kind) ifK ;
828 TopAbs_ShapeEnum fSK = TopOpeBRepDS::KindToShape(fK);
829 // TopOpeBRepDS_Kind fK = (TopOpeBRepDS_Kind)ITLOK.Value(); TopAbs_ShapeEnum fSK = TopOpeBRepDS::KindToShape(fK);
830 Standard_Integer fI = ITLOI.Value();
831 if (SKtri == fSK && I == fI) {
832 equa = Standard_True;
836 LOK.InsertBefore((Standard_Integer)K,ITLOK);
837 LOI.InsertBefore(I,ITLOI);
841 if ( !ITLOK.More() && !equa) {
842 LOK.Append((Standard_Integer)K);
847 //-----------------------------------------------------------------------
849 //-----------------------------------------------------------------------
850 Standard_Integer SeeShapeISI(const Standard_Integer I,const TopoDS_Shape& S,Draw_Interpretor& di)
852 if ( !PHDSD ) return 0;
853 const Handle(TopOpeBRepDS_HDataStructure)& HDS = PHDSD->CurrentHDS();
854 if (S.IsNull()) return 0;
857 TopOpeBRepDS_Kind SK = TopOpeBRepDS::ShapeToKind(S.ShapeType());
858 const TopOpeBRepDS_DataStructure& BDS = HDS->DS();
859 const TopOpeBRepDS_ListOfInterference& LOI = BDS.ShapeInterferences(S);
860 TopOpeBRepDS_ListIteratorOfListOfInterference ITLOI(LOI);
861 TColStd_ListOfInteger LOKK,LOII;
863 for (;ITLOI.More();ITLOI.Next()) {
864 const Handle(TopOpeBRepDS_Interference)& HI = ITLOI.Value();
865 const TopOpeBRepDS_Transition& T = HI->Transition();
867 TopAbs_ShapeEnum sb = T.ShapeBefore();TopOpeBRepDS_Kind sbk = TopOpeBRepDS::ShapeToKind(sb);
868 Standard_Integer sbi = T.IndexBefore();
869 TopAbs_ShapeEnum sa = T.ShapeAfter();TopOpeBRepDS_Kind sak = TopOpeBRepDS::ShapeToKind(sa);
870 Standard_Integer sai = T.IndexAfter();
871 TopOpeBRepDS_Kind gk,sk; Standard_Integer gi,si; HI->GKGSKS(gk,gi,sk,si);
873 AddShapeKI(LOKK,LOII,sbk,sbi);
874 AddShapeKI(LOKK,LOII,sak,sai);
875 AddShapeKI(LOKK,LOII,gk,gi);
876 AddShapeKI(LOKK,LOII,sk,si);
879 TColStd_ListIteratorOfListOfInteger ITLOKK,ITLOII;
881 ITLOKK.Initialize(LOKK); ITLOII.Initialize(LOII);
882 Standard_Boolean ya = ITLOKK.More();
883 TopOpeBRepDS::Print(SK,I,cout,""," : ");
884 for(; ITLOKK.More(),ITLOII.More(); ITLOKK.Next(),ITLOII.Next()) {
886 Standard_Integer ikk = ITLOKK.Value() ;
887 TopOpeBRepDS_Kind kk = (TopOpeBRepDS_Kind) ikk ;
888 Standard_Integer ii = ITLOII.Value();
889 // TopOpeBRepDS_Kind kk = (TopOpeBRepDS_Kind)ITLOKK.Value(); Standard_Integer ii = ITLOII.Value();
890 TopOpeBRepDS::Print(kk,ii,cout,""," ");
892 if (ya) di<<"\n"; else di<<"no shape interference\n";
894 ITLOKK.Initialize(LOKK); ITLOII.Initialize(LOII);
895 for(; ITLOKK.More(),ITLOII.More(); ITLOKK.Next(),ITLOII.Next()) {
897 Standard_Integer ikk =ITLOKK.Value() ;
898 TopOpeBRepDS_Kind kk = (TopOpeBRepDS_Kind) ikk ;
899 Standard_Integer ii = ITLOII.Value();
900 // TopOpeBRepDS_Kind kk = (TopOpeBRepDS_Kind)ITLOKK.Value(); Standard_Integer ii = ITLOII.Value();
908 //-----------------------------------------------------------------------
910 //-----------------------------------------------------------------------
911 Standard_Integer SeeShapeTKIG(const Standard_Integer I,const TopoDS_Shape& S)
913 if ( !PHDSD ) return 0;
914 const Handle(TopOpeBRepDS_HDataStructure)& HDS = PHDSD->CurrentHDS();
915 if (S.IsNull()) return 0;
918 TopOpeBRepDS_Kind SK = TopOpeBRepDS::ShapeToKind(S.ShapeType());
919 const TopOpeBRepDS_ListOfInterference& LOI = HDS->DS().ShapeInterferences(S);
920 TopOpeBRepDS_TKI tki;
921 TCollection_AsciiString s1,s2;
924 tki.FillOnGeometry(LOI);
925 s1=TopOpeBRepDS::SPrint(SK,I,""," by G : \n");
926 tki.Init();if (tki.More()) s2="\n";else s2="";
927 tki.DumpTKIIterator(s1,s2);
932 //-----------------------------------------------------------------------
934 //-----------------------------------------------------------------------
935 Standard_Integer SeeShapeTKIS(const Standard_Integer I,const TopoDS_Shape& S)
937 if ( !PHDSD ) return 0;
938 const Handle(TopOpeBRepDS_HDataStructure)& HDS = PHDSD->CurrentHDS();
939 if (S.IsNull()) return 0;
942 TopOpeBRepDS_Kind SK = TopOpeBRepDS::ShapeToKind(S.ShapeType());
943 const TopOpeBRepDS_ListOfInterference& LOI = HDS->DS().ShapeInterferences(S);
944 TopOpeBRepDS_TKI tki;
945 TCollection_AsciiString s1,s2;
948 tki.FillOnSupport(LOI);
949 s1=TopOpeBRepDS::SPrint(SK,I,""," by S : \n");
950 tki.Init();if (tki.More()) s2="\n";else s2="";
951 tki.DumpTKIIterator(s1,s2);
956 //-----------------------------------------------------------------------
958 //-----------------------------------------------------------------------
959 Standard_Integer SeeShapeTKI(const Standard_Integer I,const TopoDS_Shape& S,Draw_Interpretor& di)
967 //-----------------------------------------------------------------------
969 //-----------------------------------------------------------------------
970 Standard_Integer tseei(Draw_Interpretor& di,Standard_Integer na_in,const char** a)
972 if (na_in == 1) { tseei_help(di); return 0; }
973 tf_SeeShape ssf = (tf_SeeShape)SeeShapeISI;
974 Standard_Integer r = tsee_SeeShapefunc(di,na_in,a,ssf);
978 //-----------------------------------------------------------------------
980 //-----------------------------------------------------------------------
981 Standard_Integer tki(Draw_Interpretor& di,Standard_Integer na_in,const char** a)
983 if (na_in == 1) { tki_help(di); return 0; }
985 tf_SeeShape ssf = NULL;
986 if ( !strcasecmp(a[0],"tki") ) ssf = (tf_SeeShape)SeeShapeTKI;
987 else if ( !strcasecmp(a[0],"tkig") ) ssf = (tf_SeeShape)SeeShapeTKIG;
988 else if ( !strcasecmp(a[0],"tkis") ) ssf = (tf_SeeShape)SeeShapeTKIS;
989 if (ssf == NULL) return 0;
991 Standard_Integer r = tsee_SeeShapefunc(di,na_in,a,ssf);
995 //-----------------------------------------------------------------------
997 // 1 = kind of DS object to dump = [s] [so sh f w e v] [se] [su c p]
998 // 2,3 ... = [i1,i2 ...] = indices of DS object to see
999 //-----------------------------------------------------------------------
1000 Standard_Integer tds(Draw_Interpretor& di,Standard_Integer na,const char** a)
1002 Standard_Integer ia ;
1003 for ( ia = 0; ia < na; ia++) {
1004 if (!strcasecmp(a[ia],"-ssi")) {
1005 suppressarg(na,a,ia);
1008 else if (!strncmp(a[ia],"-",1)) {
1009 TCollection_AsciiString as = a[ia];
1011 for(Standard_Integer i = 1;i <= as.Length(); i++) {
1012 if (as.Value(i) == 'h') { tds_help(di); return 0; }
1014 suppressarg(na,a,ia);
1018 if (PHDSD == NULL) return 0;
1019 const Handle(TopOpeBRepDS_HDataStructure)& HDS = PHDSD->CurrentHDS();
1020 if (HDS.IsNull()) {COUTNOHDS(di);return 0;}
1021 PHDSD->CurrentBDS();
1026 Standard_Integer TPPE(Draw_Interpretor& di,Standard_Integer na,const char** a)
1028 if (PHDSD == NULL) return 0;
1029 const Handle(TopOpeBRepDS_HDataStructure)& HDS = PHDSD->CurrentHDS();
1030 if ( HDS.IsNull() ) { COUTNOHDS(di); return 0; }
1032 if (na != 5) return 1;
1033 Standard_Boolean ok = Standard_True;
1038 Standard_Integer ip = Draw::Atoi(a[2]);
1039 Standard_Integer ie = Draw::Atoi(a[4]);
1040 ok = ok && (ip >= 1); ok = ok && (ie >= 1);
1046 ok = Standard_False;
1047 if (!strcmp("p",a[1])){
1049 ok = ok && (ip <= HDS->NbPoints());
1050 if (ok) pds = HDS->Point(ip).Point();
1051 if (!ok) di<<" geometry "<<ip<<" is not a point\n";
1053 if (!strcmp("v",a[1])){
1055 ok = ok && (ip <= HDS->NbShapes());
1057 TopoDS_Shape sh = HDS->Shape(ip,SFindKeep);
1058 ok = ok && (sh.ShapeType() == TopAbs_VERTEX);
1059 if (ok) pds =BRep_Tool::Pnt(TopoDS::Vertex(sh));
1061 if (!ok) di<<" shape "<<ip<<" is not a vertex\n";
1063 if (!strcmp("e",a[3])){
1064 ok = ok && (ie <= HDS->NbShapes());
1066 TopoDS_Shape sh = HDS->Shape(ie,SFindKeep);
1067 ok = ok && (sh.ShapeType() == TopAbs_EDGE);
1068 if (ok) ed = TopoDS::Edge(sh);
1070 if (!ok) di<<" shape "<<ie<<" is not an edge\n";
1072 } else ok = Standard_False;
1074 Standard_Real dmin=0;
1078 Handle(Geom_Curve) cu = BRep_Tool::Curve(ed,f,l);
1079 GeomAPI_ProjectPointOnCurve ponc(pds,cu,f,l);
1080 ok = ponc.NbPoints() >= 1;
1083 dmin = ponc.LowerDistance();
1084 Standard_Real par = ponc.LowerDistanceParameter();
1085 BRepAdaptor_Curve bc(ed);
1086 pproj = bc.Value(par);
1091 TCollection_AsciiString pp("p");
1092 pp.AssignCat(ip); pp.AssignCat("e"); pp.AssignCat(ie);
1093 char* ppp = (char *)pp.ToCString();
1094 DrawTrSurf::Set(ppp,pproj);
1095 di<<"dist point "<<ip<<" on edge "<<ie<<" = "<<dmin<<"\n";
1096 } else di<<"projection failed\n";
1101 void FUN_ChkIntgInterf(Draw_Interpretor& di) //***Check Integrity Interference
1103 if ( PHDSD == NULL ) return;
1104 PHDSD->CurrentHDS()->ChkIntg();
1105 di<<"Check interference integrity completed\n";
1108 void FUN_ChkIntgSamDomain(Draw_Interpretor& di) //***Check Integrity SameDomain
1110 if ( PHDSD == NULL ) return;
1111 TopOpeBRepDS_Check C(PHDSD->CurrentHDS());
1112 if(C.ChkIntgSamDom())
1113 di<<"Check SameDomain integrity completed\n";
1116 void FUN_ChkIntg(Draw_Interpretor& di) //***Check Integrity
1118 if ( PHDSD == NULL ) return;
1119 FUN_ChkIntgInterf(di);
1120 FUN_ChkIntgSamDomain(di);
1123 void FUN_ChkVertex(Draw_Interpretor& di) //***Check Vertex SameDomain
1125 if ( PHDSD == NULL ) return;
1126 TopOpeBRepDS_Check C(PHDSD->CurrentHDS());
1127 if(C.OneVertexOnPnt())
1128 di<<"Check Structure Vertex SameDomain Complete\n";
1131 //---------------------------------------------------------
1132 Standard_Integer topochk(Draw_Interpretor& di,Standard_Integer na,const char** a)
1134 if (strcmp(a[0],"topochk")) return 1;
1138 ::FUN_ChkVertex(di);
1140 else if(na > 2) return 1;
1141 else if(!strcmp (a[1],"-i")) ::FUN_ChkIntg(di);
1142 else if(!strncmp(a[1],"-i",2)) {
1143 if (!strcmp(a[1],"-ii")) ::FUN_ChkIntgInterf(di);
1144 else if(!strcmp(a[1],"-isd")) ::FUN_ChkIntgSamDomain(di);
1146 else if(!strcmp (a[1],"-s")) ::FUN_ChkVertex(di);
1148 di<<"option : -i = check DS full integrity\n";
1149 di<<"option : -ii = check only interferences\n";
1150 di<<"option : -isd = check only SameDomain data\n\n";
1151 di<<"option : -s = check only SameDomain data on vertex\n";
1157 //-----------------------------------------------------------------------
1159 //-----------------------------------------------------------------------
1160 Standard_Integer SeeShapeTCX(const Standard_Integer I,const TopoDS_Shape& S)
1162 if ( !PHDSD ) return 0;
1163 const Handle(TopOpeBRepDS_HDataStructure)& HDS = PHDSD->CurrentHDS();
1164 if (S.IsNull()) return 0;
1169 static void tcx_help(Draw_Interpretor& di)
1171 di<<"tcx : function not documented\n";
1174 //-----------------------------------------------------------------------
1176 //-----------------------------------------------------------------------
1177 Standard_Integer tcx(Draw_Interpretor& di,Standard_Integer na_in,const char** a)
1179 if (na_in == 1) { tcx_help(di); return 0; }
1180 Standard_Integer r = tsee_SeeShapefunc(di,na_in,a,SeeShapeTCX);
1185 //---------------------------------------------------------
1186 Standard_Integer tcx(Draw_Interpretor& di,Standard_Integer na,const char** a)
1188 if (PHDSD == NULL) return 0;
1189 const Handle(TopOpeBRepDS_HDataStructure)& HDS = PHDSD->CurrentHDS();
1190 if ( HDS.IsNull() ) { COUTNOHDS(di); return 0; }
1191 if (na == 1) FDSCNX_Dump(HDS);
1193 if (ISINTEGER(a[1])) FDSCNX_Dump(HDS,Draw::Atoi(a[1]));
1200 //-----------------------------------------------------------------------
1201 Standard_Integer tdsri(Draw_Interpretor& di,Standard_Integer na_in,const char** a)
1203 if (na_in == 1 || (na_in == 2 && !strcasecmp(a[1],"-h"))) {
1207 Standard_Integer na = na_in;
1208 if ((PHDSD == NULL) || (POCD == NULL)) return 0;
1209 const Handle(TopOpeBRepDS_HDataStructure)& HDS = PHDSD->CurrentHDS();
1210 if (HDS.IsNull()) { COUTNOHDS(di); return 0; }
1211 if (na < 5) return 1;
1212 TopOpeBRepDS_DataStructure& BDS = HDS->ChangeDS();
1214 Standard_Integer i1arg = 1;
1215 TDSpar Tpar(a[i1arg]);
1217 if ( strcasecmp(a[i1arg + 2],"i") ) return 0;
1218 Standard_Integer ii = Draw::Atoi(a[i1arg + 3]);
1219 // Standard_Integer ia,is,ig;
1220 Standard_Integer is;
1221 if ( Tpar.isshap() ) {
1222 is = Draw::Atoi(a[i1arg + 1]);
1223 const TopoDS_Shape& s = GetShape(is,Tpar.TS()); if (s.IsNull()) return 0;
1224 TopOpeBRepDS_ListOfInterference& li = BDS.ChangeShapeInterferences(is);
1225 Standard_Integer i=0; TopOpeBRepDS_ListIteratorOfListOfInterference it(li);
1236 //=======================================================================
1237 //function : DSCommands
1239 //=======================================================================
1240 void TestTopOpe::HDSCommands(Draw_Interpretor& theCommands)
1242 static Standard_Boolean done = Standard_False;
1244 done = Standard_True;
1245 PHDSD = (TestTopOpe_HDSDisplayer*) new (TestTopOpe_HDSDisplayer);
1246 POCD = (TestTopOpeDraw_Displayer*) new (TestTopOpeDraw_Displayer);
1248 const char* g = "Topological operation data structure commands";
1249 theCommands.Add("tseei","no args to get help",__FILE__,tseei,g);
1250 theCommands.Add("tsee","no args to get help ",__FILE__,tsee,g);
1251 theCommands.Add("tki","no args to get help ",__FILE__,tki,g);
1252 theCommands.Add("tkig","no args to get help ",__FILE__,tki,g);
1253 theCommands.Add("tkis","no args to get help ",__FILE__,tki,g);
1254 theCommands.Add("tds","-h to get help ",__FILE__,tds,g);
1255 theCommands.Add("tppe","tppe p/v <ip> e <ie>",__FILE__,TPPE);
1256 theCommands.Add("topochk","check current DS (loaded by CurrentDS()",__FILE__,topochk,g);
1257 theCommands.Add("tcx","dump connexity information",__FILE__,tcx,g);
1258 theCommands.Add("tdsri","remove interference : tdsri type itype iinterf",__FILE__,tdsri,g);