Salome HOME
Update copyright information
[modules/geom.git] / src / OBJECT / GEOM_WireframeFace.cxx
index dc1aba5170893802c7738e615234583cc5a6a4e1..08430275f90b25173bba25cd76fa11ab2c3b6913 100755 (executable)
@@ -1,3 +1,24 @@
+//  Copyright (C) 2007-2008  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
 #include "GEOM_WireframeFace.h" 
  
 #include <vtkObjectFactory.h> 
 vtkStandardNewMacro(GEOM_WireframeFace);
  
 GEOM_WireframeFace::GEOM_WireframeFace(): 
-  NbIso(1), 
-  Discret(15) 
+  Discret(15)
 { 
+  NbIso[0] = 1;
+  NbIso[1] = 1;
 } 
  
 GEOM_WireframeFace::~GEOM_WireframeFace() 
@@ -58,12 +80,29 @@ Execute()
   }
 }
 
+void GEOM_WireframeFace::SetNbIso(const int theNb[2])
+{
+  if ( theNb[0] == NbIso[0] && theNb[1] == NbIso[1])
+    return;
+
+  NbIso[0] = theNb[0];
+  NbIso[1] = theNb[1];
+
+  Modified();
+}
+
+void GEOM_WireframeFace::GetNbIso(int &theNbU,int &theNbV)
+{
+  theNbU = NbIso[0];
+  theNbV = NbIso[1];
+}
+
 void  
 GEOM_WireframeFace:: 
 OCC2VTK(const TopoDS_Face& theFace,
         vtkPolyData* thePolyData,
                    vtkPoints* thePts,  
-        const int theNbIso, 
+        const int theNbIso[2]
         const int theDiscret) 
 { 
   TopoDS_Face aFace = theFace; 
@@ -74,7 +113,7 @@ OCC2VTK(const TopoDS_Face& theFace,
 void 
 GEOM_WireframeFace:: 
 CreateIso(const TopoDS_Face& theFace,
-               const int theNbIso
+         const int theNbIso[2]
           const int theDiscret, 
           vtkPolyData* thePolyData,
           vtkPoints* thePts)
@@ -95,8 +134,8 @@ CreateIso(const TopoDS_Face& theFace,
                                     Standard_False);
   
   Standard_Real anUMin, anUMax, aVMin, aVMax;
-  TColStd_Array1OfReal anUPrm(1, theNbIso), aVPrm(1, theNbIso);
-  TColStd_Array1OfInteger anUInd(1, theNbIso), aVInd(1, theNbIso);
+  TColStd_Array1OfReal anUPrm(1, theNbIso[0]), aVPrm(1, theNbIso[1]);
+  TColStd_Array1OfInteger anUInd(1, theNbIso[0]), aVInd(1, theNbIso[1]);
 
   anUInd.Init(0);
   aVInd.Init(0);
@@ -185,11 +224,11 @@ CreateIso(const TopoDS_Face& theFace,
   Standard_Real confusion = Min(DeltaU, DeltaV) * HATHCER_CONFUSION_3D ;
   aHatcher.Confusion3d (confusion) ;
 
-  Standard_Real StepU = DeltaU / (Standard_Real)theNbIso;
+  Standard_Real StepU = DeltaU / (Standard_Real)theNbIso[0];
   if(StepU > confusion){
     Standard_Real UPrm = anUMin + StepU / 2.;
     gp_Dir2d Dir(0., 1.) ;
-    for(IIso = 1 ; IIso <= theNbIso ; IIso++) {
+    for(IIso = 1 ; IIso <= theNbIso[0] ; IIso++) {
       anUPrm(IIso) = UPrm ;
       gp_Pnt2d Ori (UPrm, 0.) ;
       Geom2dAdaptor_Curve HCur (new Geom2d_Line (Ori, Dir)) ;
@@ -198,11 +237,11 @@ CreateIso(const TopoDS_Face& theFace,
     }
   }
 
-  Standard_Real StepV = DeltaV / (Standard_Real) theNbIso ;
+  Standard_Real StepV = DeltaV / (Standard_Real) theNbIso[1] ;
   if(StepV > confusion){
     Standard_Real VPrm = aVMin + StepV / 2.;
     gp_Dir2d Dir(1., 0.);
-    for(IIso = 1 ; IIso <= theNbIso ; IIso++){
+    for(IIso = 1 ; IIso <= theNbIso[1] ; IIso++){
       aVPrm(IIso) = VPrm;
       gp_Pnt2d Ori (0., VPrm);
       Geom2dAdaptor_Curve HCur(new Geom2d_Line (Ori, Dir));
@@ -217,9 +256,9 @@ CreateIso(const TopoDS_Face& theFace,
   aHatcher.Trim() ;
 
   Standard_Integer aNbDom = 0 ; // for debug purpose
-  for(IIso = 1 ; IIso <= theNbIso ; IIso++){
-    Standard_Integer Index ;
+  Standard_Integer Index ;
 
+  for(IIso = 1 ; IIso <= theNbIso[0] ; IIso++){
     Index = anUInd(IIso) ;
     if(Index != 0){
       if(aHatcher.TrimDone(Index) && !aHatcher.TrimFailed(Index)){
@@ -228,7 +267,9 @@ CreateIso(const TopoDS_Face& theFace,
           aNbDom = aHatcher.NbDomains (Index);
       }
     }
+  }
 
+  for(IIso = 1 ; IIso <= theNbIso[1] ; IIso++){
     Index = aVInd(IIso);
     if(Index != 0){
       if(aHatcher.TrimDone (Index) && !aHatcher.TrimFailed(Index)){