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.
17 #include <StdPrs_WFPoleSurface.ixx>
19 #include <Graphic3d_Group.hxx>
20 #include <TColgp_Array2OfPnt.hxx>
21 #include <Prs3d_IsoAspect.hxx>
22 #include <Graphic3d_ArrayOfPolylines.hxx>
24 #include <Geom_BezierSurface.hxx>
25 #include <Geom_BSplineSurface.hxx>
27 static void AddPoles(const Handle (Prs3d_Presentation)& aPresentation,
28 const TColgp_Array2OfPnt& A,
29 const Handle (Prs3d_Drawer)& aDrawer)
32 const Standard_Integer n = A.ColLength();
33 const Standard_Integer m = A.RowLength();
35 Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(aDrawer->UIsoAspect()->Aspect());
36 Handle(Graphic3d_ArrayOfPolylines) aPrims = new Graphic3d_ArrayOfPolylines(n*m,n);
40 aPrims->AddVertex(A(i,j));
42 Prs3d_Root::CurrentGroup(aPresentation)->AddPrimitiveArray(aPrims);
44 Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(aDrawer->VIsoAspect()->Aspect());
45 aPrims = new Graphic3d_ArrayOfPolylines(n*m,m);
49 aPrims->AddVertex(A(i,j));
51 Prs3d_Root::CurrentGroup(aPresentation)->AddPrimitiveArray(aPrims);
55 //=======================================================================
58 //=======================================================================
60 void StdPrs_WFPoleSurface::Add (const Handle (Prs3d_Presentation)& aPresentation,
61 const Adaptor3d_Surface& aSurface,
62 const Handle (Prs3d_Drawer)& aDrawer)
65 GeomAbs_SurfaceType SType = aSurface.GetType();
66 if (SType == GeomAbs_BezierSurface || SType == GeomAbs_BSplineSurface) {
67 Standard_Integer n , m;
68 if (SType == GeomAbs_BezierSurface) {
69 Handle(Geom_BezierSurface) B = aSurface.Bezier();
70 n = aSurface.NbUPoles();
71 m = aSurface.NbVPoles();
72 TColgp_Array2OfPnt A(1,n,1,m);
73 (aSurface.Bezier())->Poles(A);
74 AddPoles(aPresentation, A, aDrawer);
76 else if (SType == GeomAbs_BSplineSurface) {
77 Handle(Geom_BSplineSurface) B = aSurface.BSpline();
78 n = (aSurface.BSpline())->NbUPoles();
79 m = (aSurface.BSpline())->NbVPoles();
80 TColgp_Array2OfPnt A(1,n,1,m);
81 (aSurface.BSpline())->Poles(A);
82 AddPoles(aPresentation, A, aDrawer);