1 // Created on: 1995-07-24
2 // Created by: Modelistation
3 // Copyright (c) 1995-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.
18 #include <Adaptor3d_Surface.hxx>
19 #include <Geom_BezierSurface.hxx>
20 #include <Geom_BSplineSurface.hxx>
21 #include <Graphic3d_ArrayOfPolylines.hxx>
22 #include <Graphic3d_Group.hxx>
23 #include <Prs3d_IsoAspect.hxx>
24 #include <Prs3d_Presentation.hxx>
25 #include <StdPrs_WFPoleSurface.hxx>
26 #include <TColgp_Array2OfPnt.hxx>
28 static void AddPoles(const Handle (Prs3d_Presentation)& aPresentation,
29 const TColgp_Array2OfPnt& A,
30 const Handle (Prs3d_Drawer)& aDrawer)
33 const Standard_Integer n = A.ColLength();
34 const Standard_Integer m = A.RowLength();
36 Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(aDrawer->UIsoAspect()->Aspect());
37 Handle(Graphic3d_ArrayOfPolylines) aPrims = new Graphic3d_ArrayOfPolylines(n*m,n);
41 aPrims->AddVertex(A(i,j));
43 Prs3d_Root::CurrentGroup(aPresentation)->AddPrimitiveArray(aPrims);
45 Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(aDrawer->VIsoAspect()->Aspect());
46 aPrims = new Graphic3d_ArrayOfPolylines(n*m,m);
50 aPrims->AddVertex(A(i,j));
52 Prs3d_Root::CurrentGroup(aPresentation)->AddPrimitiveArray(aPrims);
56 //=======================================================================
59 //=======================================================================
61 void StdPrs_WFPoleSurface::Add (const Handle (Prs3d_Presentation)& aPresentation,
62 const Adaptor3d_Surface& aSurface,
63 const Handle (Prs3d_Drawer)& aDrawer)
66 GeomAbs_SurfaceType SType = aSurface.GetType();
67 if (SType == GeomAbs_BezierSurface || SType == GeomAbs_BSplineSurface) {
68 Standard_Integer n , m;
69 if (SType == GeomAbs_BezierSurface) {
70 Handle(Geom_BezierSurface) B = aSurface.Bezier();
71 n = aSurface.NbUPoles();
72 m = aSurface.NbVPoles();
73 TColgp_Array2OfPnt A(1,n,1,m);
74 (aSurface.Bezier())->Poles(A);
75 AddPoles(aPresentation, A, aDrawer);
77 else if (SType == GeomAbs_BSplineSurface) {
78 Handle(Geom_BSplineSurface) B = aSurface.BSpline();
79 n = (aSurface.BSpline())->NbUPoles();
80 m = (aSurface.BSpline())->NbVPoles();
81 TColgp_Array2OfPnt A(1,n,1,m);
82 (aSurface.BSpline())->Poles(A);
83 AddPoles(aPresentation, A, aDrawer);