]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
[PythonAPI / sketcher] update getter names as discussed with DBC
authorRenaud NEDELEC <renaud.nedelec@opencascade.com>
Fri, 6 Nov 2015 09:28:48 +0000 (10:28 +0100)
committerRenaud NEDELEC <renaud.nedelec@opencascade.com>
Fri, 6 Nov 2015 09:28:48 +0000 (10:28 +0100)
src/PythonAPI/Test/TestSketcherAddArc.py
src/PythonAPI/Test/TestSketcherSetTangent.py
src/PythonAPI/model/sketcher/arc.py
src/PythonAPI/model/sketcher/sketch.py

index 9b433f0fde4f756bd9d4d03b3ed506b7c5d466af..1f83a1153509f9f4627cdb95fbce51605d0ffcd6 100644 (file)
@@ -10,8 +10,8 @@ class SketcherAddArc(SketcherTestCase):
     def test_arc_by_coords(self):
         arc = self.sketch.addArc(0, 1, 0, 0, 1, 1)
         model.do()
-        self.assertEqual(arc.startPointData().x(), 0)        
-        self.assertEqual(arc.startPointData().y(), 0)
+        self.assertEqual(arc.startPoint().x(), 0)        
+        self.assertEqual(arc.startPoint().y(), 0)
     
     def test_arc_by_points(self):
         center = geom.Pnt2d(0, 1)
@@ -19,8 +19,8 @@ class SketcherAddArc(SketcherTestCase):
         end = geom.Pnt2d(1, 1)
         arc = self.sketch.addArc(center, start, end)
         model.do()
-        self.assertEqual(arc.startPointData().x(), 0)        
-        self.assertEqual(arc.startPointData().y(), 0)
+        self.assertEqual(arc.startPoint().x(), 0)        
+        self.assertEqual(arc.startPoint().y(), 0)
     
     def test_number_of_args(self):
         with self.assertRaises(WrongNumberOfArguments):
@@ -34,12 +34,12 @@ class SketcherAddArc(SketcherTestCase):
         arc.setStartPoint(-1.0, 0)
         arc.setEndPoint(0, 1.0)
         model.do()
-        self.assertEqual(arc.centerData().x(), 0)        
-        self.assertEqual(arc.centerData().y(), 0)
-        self.assertEqual(arc.startPointData().x(), -1)        
-        self.assertEqual(arc.startPointData().y(), 0)
-        self.assertEqual(arc.endPointData().x(), 0)        
-        self.assertEqual(arc.endPointData().y(), 1)
+        self.assertEqual(arc.center().x(), 0)        
+        self.assertEqual(arc.center().y(), 0)
+        self.assertEqual(arc.startPoint().x(), -1)        
+        self.assertEqual(arc.startPoint().y(), 0)
+        self.assertEqual(arc.endPoint().x(), 0)        
+        self.assertEqual(arc.endPoint().y(), 1)
         
     
 if __name__ == "__main__":
index 5b0959fd2a05f8a3a5b7fab5187cf28ad33d0737..2e782649c7744c826c5845a00812c2e6193aaf92 100644 (file)
@@ -8,7 +8,7 @@ class SketcherSetTangent(SketcherTestCase):
         self.line = self.sketch.addLine(0, 0, 0, 1)
         self.arc = self.sketch.addArc(0, 1, 0, 0, 1, 1)
         self.sketch.setCoincident(
-            self.line.endPointData(), self.arc.startPointData()
+            self.line.endPointData(), self.arc.startPoint()
             )
         
     def test_set_tangent(self):
index 0a7ae432dc7be7bb0484d68f10aa37590bf6eb39..212666af86e5b149d06cb1de0b5f42c1ada8b185 100644 (file)
@@ -29,25 +29,7 @@ class Arc(Interface):
                 )
         self.execute()
         
-    ########
-    #
-    # Set methods
-    #
-    ########
-    
-    def setCenter(self, x, y):
-        """Set arc center."""
-        self._center.setValue(x, y)
         
-    def setStartPoint(self, x, y):
-        """Set start point."""
-        self._start_point.setValue(x, y)
-        
-    def setEndPoint(self, x, y):
-        """Set end point value."""
-        self._end_point.setValue(x, y)
-        
-    
     ########
     #
     # Getters
@@ -55,21 +37,40 @@ class Arc(Interface):
     ########
 
 
-    def centerData(self):
-        """Return the center point data."""
+    def center(self):
+        """Return the center point."""
         return self._center
 
-    def startPointData(self):
-        """Return the start point data."""
+    def startPoint(self):
+        """Return the start point."""
         return self._start_point
 
-    def endPointData(self):
-        """Return the end point data."""
+    def endPoint(self):
+        """Return the end point."""
         return self._end_point
 
     def result(self):
         """Return the arc circular line attribute."""
         return self._feature.lastResult()
+    
+        
+    ########
+    #
+    # Set methods
+    #
+    ########
+    
+    def setCenter(self, x, y):
+        """Set arc center."""
+        self._center.setValue(x, y)
+        
+    def setStartPoint(self, x, y):
+        """Set start point."""
+        self._start_point.setValue(x, y)
+        
+    def setEndPoint(self, x, y):
+        """Set end point value."""
+        self._end_point.setValue(x, y)
 
 
     ########
index 828284530c6dc6dc0cfea4ab323efc663ebfe26b..24268b4c55d285e1be9cfdc8168897bf13adda35 100644 (file)
@@ -45,7 +45,7 @@ def addSketch(document, plane):
     Returns:
        Sketch: sketch object
     """
-    feature = featureToCompositeFeature(doc.addFeature("Sketch"))
+    feature = featureToCompositeFeature(document.addFeature("Sketch"))
     return Sketch(feature, plane)
 
 class Sketch(Interface):