Salome HOME
Added a method to disable waiting cursor in the preview operation
[modules/geom.git] / src / OCC2VTK / GEOM_EdgeSource.cxx
index e44cc81e0c019ce52bac5d08c9e70962c0695ec5..abcd23fc7868152953cf59e2f85ce64674efcd78 100755 (executable)
@@ -1,21 +1,20 @@
-//  Copyright (C) 2007-2010  CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2011  CEA/DEN, EDF R&D, OPEN CASCADE
 //
-//  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 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.
+// 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
+// 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_EdgeSource.h" 
  
@@ -65,8 +64,11 @@ Execute()
 
   TEdgeSet::Iterator anIter (myEdgeSet);
   for (; anIter.More(); anIter.Next()) {
-    const TopoDS_Edge& anEdge = anIter.Value();
-    OCC2VTK(anEdge,aPolyData,aPts,myIsVector);
+    TopoDS_Edge anEdge = anIter.Value();
+    if ( !myIsVector )
+      // draw curve direction (issue 0021087)
+      anEdge.Orientation( TopAbs_FORWARD );
+    OCC2VTK(anEdge,aPolyData,aPts,myIsVector||myIsVectorMode);
   }
 }
 
@@ -191,7 +193,7 @@ void GEOM_EdgeSource::OCC2VTK (const TopoDS_Edge& theEdge,
     else
       aDirection = -aDirVec;
 
-    Standard_Real anAngle = PI/180.*5.;
+    Standard_Real anAngle = M_PI/180.*5.;
     Standard_Real aLength = aDist/10.;
 
     Standard_Real dx,dy,dz;
@@ -228,8 +230,8 @@ void GEOM_EdgeSource::OCC2VTK (const TopoDS_Edge& theEdge,
     int NbPoints = 15;
     for (int i = 1; i <= NbPoints; i++, ptPrev = ptCur)
     {
-      cosinus = cos(2. * PI / NbPoints * (i-1));   
-      sinus   = sin(2. * PI / NbPoints * (i-1));
+      cosinus = cos(2. * M_PI / NbPoints * (i-1));   
+      sinus   = sin(2. * M_PI / NbPoints * (i-1));
 
       gp_XYZ aP = aPc + (aDirI.XYZ() * cosinus + aDirJ.XYZ() * sinus) * aLength * Tg;
       coord[0] = aP.X();
@@ -263,10 +265,10 @@ void GEOM_EdgeSource::OCC2VTK (const TopoDS_Edge& theEdge,
 
 void GEOM_EdgeSource::SetVectorMode (bool theMode)
 {
-  myIsVector = theMode;
+  myIsVectorMode = theMode;
 }
 
 bool GEOM_EdgeSource::GetVectorMode ()
 {
-  return myIsVector;
+  return !myIsVector && myIsVectorMode;
 }