From 476ec3a71422e41240a629e354ef4613209a7789 Mon Sep 17 00:00:00 2001 From: Matthias Koefferlein Date: Sun, 17 Nov 2024 22:04:28 +0100 Subject: [PATCH 1/2] Implemented solution for #1923 ('move', 'moved') 1. Added move and moved to Point and DPoint 2. dx/dy is 0 by default now 3. arguments of move and moved are called v (vector) and dx/dy consistently --- src/db/db/gsiDeclDbBox.cc | 14 +++---- src/db/db/gsiDeclDbEdge.cc | 12 +++--- src/db/db/gsiDeclDbEdgePairs.cc | 20 ++++----- src/db/db/gsiDeclDbEdges.cc | 12 +++--- src/db/db/gsiDeclDbPath.cc | 12 +++--- src/db/db/gsiDeclDbPoint.cc | 73 +++++++++++++++++++++++++++++++++ src/db/db/gsiDeclDbPolygon.cc | 38 ++++++++--------- src/db/db/gsiDeclDbRegion.cc | 14 +++---- src/db/db/gsiDeclDbText.cc | 12 +++--- src/db/db/gsiDeclDbTexts.cc | 20 ++++----- 10 files changed, 149 insertions(+), 78 deletions(-) diff --git a/src/db/db/gsiDeclDbBox.cc b/src/db/db/gsiDeclDbBox.cc index d2c5fcc8f1..6bf0601da3 100644 --- a/src/db/db/gsiDeclDbBox.cc +++ b/src/db/db/gsiDeclDbBox.cc @@ -380,36 +380,34 @@ struct box_defs "\n" "@return The scaled box\n" ) + - method_ext ("move", &box_defs::move, gsi::arg ("dx"), gsi::arg ("dy"), + method_ext ("move", &box_defs::move, gsi::arg ("dx", 0), gsi::arg ("dy", 0), "@brief Moves the box by a certain distance\n" "\n" - "\n" "This is a convenience method which takes two values instead of a Point object.\n" "This method has been introduced in version 0.23.\n" "\n" "@return A reference to this box.\n" ) + - method_ext ("moved", &box_defs::moved, gsi::arg ("dx"), gsi::arg ("dy"), + method_ext ("moved", &box_defs::moved, gsi::arg ("dx, 0"), gsi::arg ("dy", 0), "@brief Moves the box by a certain distance\n" "\n" - "\n" "This is a convenience method which takes two values instead of a Point object.\n" "This method has been introduced in version 0.23.\n" "\n" "@return The moved box.\n" ) + - method ("move", &C::move, gsi::arg ("distance"), + method ("move", &C::move, gsi::arg ("d"), "@brief Moves the box by a certain distance\n" "\n" "\n" "Moves the box by a given offset and returns the moved\n" "box. Does not check for coordinate overflows.\n" "\n" - "@param distance The offset to move the box.\n" + "@param d The offset to move the box.\n" "\n" "@return A reference to this box.\n" ) + - method ("moved", &C::moved, gsi::arg ("distance"), + method ("moved", &C::moved, gsi::arg ("d"), "@brief Returns the box moved by a certain distance\n" "\n" "\n" @@ -417,7 +415,7 @@ struct box_defs "box. Does not modify this box. Does not check for coordinate\n" "overflows.\n" "\n" - "@param distance The offset to move the box.\n" + "@param d The offset to move the box.\n" "\n" "@return The moved box.\n" ) + diff --git a/src/db/db/gsiDeclDbEdge.cc b/src/db/db/gsiDeclDbEdge.cc index 1abff31454..c50c89c186 100644 --- a/src/db/db/gsiDeclDbEdge.cc +++ b/src/db/db/gsiDeclDbEdge.cc @@ -207,17 +207,17 @@ struct edge_defs "\n" "This method has been introduced in version 0.25.\n" ) + - method ("moved", &C::moved, gsi::arg ("p"), + method ("moved", &C::moved, gsi::arg ("v"), "@brief Returns the moved edge (does not modify self)\n" "\n" "Moves the edge by the given offset and returns the \n" "moved edge. The edge is not modified.\n" "\n" - "@param p The distance to move the edge.\n" + "@param v The distance to move the edge.\n" "\n" "@return The moved edge.\n" ) + - method_ext ("moved", &moved_xy, gsi::arg ("dx"), gsi::arg ("dy"), + method_ext ("moved", &moved_xy, gsi::arg ("dx", 0), gsi::arg ("dy", 0), "@brief Returns the moved edge (does not modify self)\n" "\n" "Moves the edge by the given offset and returns the \n" @@ -325,17 +325,17 @@ struct edge_defs "\n" "@return The transformed edge.\n" ) + - method ("move", &C::move, gsi::arg ("p"), + method ("move", &C::move, gsi::arg ("v"), "@brief Moves the edge.\n" "\n" "Moves the edge by the given offset and returns the \n" "moved edge. The edge is overwritten.\n" "\n" - "@param p The distance to move the edge.\n" + "@param v The distance to move the edge.\n" "\n" "@return The moved edge.\n" ) + - method_ext ("move", &move_xy, gsi::arg ("dx"), gsi::arg ("dy"), + method_ext ("move", &move_xy, gsi::arg ("dx", 0), gsi::arg ("dy", 0), "@brief Moves the edge.\n" "\n" "Moves the edge by the given offset and returns the \n" diff --git a/src/db/db/gsiDeclDbEdgePairs.cc b/src/db/db/gsiDeclDbEdgePairs.cc index 780b954425..3fa1633f0b 100644 --- a/src/db/db/gsiDeclDbEdgePairs.cc +++ b/src/db/db/gsiDeclDbEdgePairs.cc @@ -735,49 +735,49 @@ Class decl_EdgePairs (decl_dbShapeCollection, "db", "EdgePairs", "\n" "The 'join_with' alias has been introduced in version 0.28.12." ) + - method_ext ("move", &move_p, gsi::arg ("p"), + method_ext ("move", &move_p, gsi::arg ("v"), "@brief Moves the edge pair collection\n" "\n" "Moves the edge pairs by the given offset and returns the \n" "moved edge pair collection. The edge pair collection is overwritten.\n" "\n" - "@param p The distance to move the edge pairs.\n" + "@param v The distance to move the edge pairs.\n" "\n" "@return The moved edge pairs (self).\n" "\n" "Starting with version 0.25 the displacement is of vector type." ) + - method_ext ("move", &move_xy, gsi::arg ("x"), gsi::arg ("y"), + method_ext ("move", &move_xy, gsi::arg ("dx"), gsi::arg ("dy"), "@brief Moves the edge pair collection\n" "\n" "Moves the edge pairs by the given offset and returns the \n" "moved edge pairs. The edge pair collection is overwritten.\n" "\n" - "@param x The x distance to move the edge pairs.\n" - "@param y The y distance to move the edge pairs.\n" + "@param dx The x distance to move the edge pairs.\n" + "@param dy The y distance to move the edge pairs.\n" "\n" "@return The moved edge pairs (self).\n" ) + - method_ext ("moved", &moved_p, gsi::arg ("p"), + method_ext ("moved", &moved_p, gsi::arg ("v"), "@brief Returns the moved edge pair collection (does not modify self)\n" "\n" "Moves the edge pairs by the given offset and returns the \n" "moved edge pairs. The edge pair collection is not modified.\n" "\n" - "@param p The distance to move the edge pairs.\n" + "@param v The distance to move the edge pairs.\n" "\n" "@return The moved edge pairs.\n" "\n" "Starting with version 0.25 the displacement is of vector type." ) + - method_ext ("moved", &moved_xy, gsi::arg ("x"), gsi::arg ("y"), + method_ext ("moved", &moved_xy, gsi::arg ("dx", 0), gsi::arg ("dy", 0), "@brief Returns the moved edge pair collection (does not modify self)\n" "\n" "Moves the edge pairs by the given offset and returns the \n" "moved edge pairs. The edge pair collection is not modified.\n" "\n" - "@param x The x distance to move the edge pairs.\n" - "@param y The y distance to move the edge pairs.\n" + "@param dx The x distance to move the edge pairs.\n" + "@param dy The y distance to move the edge pairs.\n" "\n" "@return The moved edge pairs.\n" ) + diff --git a/src/db/db/gsiDeclDbEdges.cc b/src/db/db/gsiDeclDbEdges.cc index 6d86681e5d..78776b43f3 100644 --- a/src/db/db/gsiDeclDbEdges.cc +++ b/src/db/db/gsiDeclDbEdges.cc @@ -1621,14 +1621,14 @@ Class decl_Edges (decl_dbShapeCollection, "db", "Edges", "\n" "Starting with version 0.25 the displacement type is a vector." ) + - method_ext ("move", &move_xy, gsi::arg ("x"), gsi::arg ("y"), + method_ext ("move", &move_xy, gsi::arg ("dx", 0), gsi::arg ("dy", 0), "@brief Moves the edge collection\n" "\n" "Moves the edge collection by the given offset and returns the \n" "moved edge collection. The edge collection is overwritten.\n" "\n" - "@param x The x distance to move the edge collection.\n" - "@param y The y distance to move the edge collection.\n" + "@param dx The x distance to move the edge collection.\n" + "@param dy The y distance to move the edge collection.\n" "\n" "@return The moved edge collection (self).\n" ) + @@ -1644,14 +1644,14 @@ Class decl_Edges (decl_dbShapeCollection, "db", "Edges", "\n" "Starting with version 0.25 the displacement type is a vector." ) + - method_ext ("moved", &moved_xy, gsi::arg ("x"), gsi::arg ("v"), + method_ext ("moved", &moved_xy, gsi::arg ("dx", 0), gsi::arg ("dv", 0), "@brief Returns the moved edge collection (does not modify self)\n" "\n" "Moves the edge collection by the given offset and returns the \n" "moved edge collection. The edge collection is not modified.\n" "\n" - "@param x The x distance to move the edge collection.\n" - "@param y The y distance to move the edge collection.\n" + "@param dx The x distance to move the edge collection.\n" + "@param dy The y distance to move the edge collection.\n" "\n" "@return The moved edge collection.\n" ) + diff --git a/src/db/db/gsiDeclDbPath.cc b/src/db/db/gsiDeclDbPath.cc index 1f8bc9b458..35cc28f528 100644 --- a/src/db/db/gsiDeclDbPath.cc +++ b/src/db/db/gsiDeclDbPath.cc @@ -208,17 +208,17 @@ struct path_defs "Returns the scaled object. All coordinates are multiplied with the given factor and if " "necessary rounded." ) + - method ("move", &C::move, gsi::arg ("p"), + method ("move", &C::move, gsi::arg ("v"), "@brief Moves the path.\n" "\n" "Moves the path by the given offset and returns the \n" "moved path. The path is overwritten.\n" "\n" - "@param p The distance to move the path.\n" + "@param v The distance to move the path.\n" "\n" "@return The moved path.\n" ) + - method_ext ("move", &move_xy, gsi::arg ("dx"), gsi::arg ("dy"), + method_ext ("move", &move_xy, gsi::arg ("dx", 0), gsi::arg ("dy", 0), "@brief Moves the path.\n" "\n" "Moves the path by the given offset and returns the \n" @@ -231,17 +231,17 @@ struct path_defs "\n" "This version has been added in version 0.23.\n" ) + - method ("moved", &C::moved, gsi::arg ("p"), + method ("moved", &C::moved, gsi::arg ("v"), "@brief Returns the moved path (does not change self)\n" "\n" "Moves the path by the given offset and returns the \n" "moved path. The path is not modified.\n" "\n" - "@param p The distance to move the path.\n" + "@param v The distance to move the path.\n" "\n" "@return The moved path.\n" ) + - method_ext ("moved", &moved_xy, gsi::arg ("dx"), gsi::arg ("dy"), + method_ext ("moved", &moved_xy, gsi::arg ("dx", 0), gsi::arg ("dy", 0), "@brief Returns the moved path (does not change self)\n" "\n" "Moves the path by the given offset and returns the \n" diff --git a/src/db/db/gsiDeclDbPoint.cc b/src/db/db/gsiDeclDbPoint.cc index 34de7a1ad2..02ce8cc840 100644 --- a/src/db/db/gsiDeclDbPoint.cc +++ b/src/db/db/gsiDeclDbPoint.cc @@ -36,6 +36,7 @@ template struct point_defs { typedef typename C::coord_type coord_type; + typedef typename C::vector_type vector_type; static C *from_string (const char *s) { @@ -97,6 +98,28 @@ struct point_defs return std::hfunc (*pt); } + static C move_d (C *p, const vector_type &d) + { + *p += d; + return *p; + } + + static C move_xy (C *p, coord_type dx, coord_type dy) + { + *p += vector_type (dx, dy); + return *p; + } + + static C moved_d (const C *p, const vector_type &d) + { + return *p + d; + } + + static C moved_xy (const C *p, coord_type dx, coord_type dy) + { + return *p + vector_type (dx, dy); + } + static gsi::Methods methods () { return @@ -170,6 +193,56 @@ struct point_defs "\n" "This method has been introduced in version 0.25.\n" ) + + method_ext ("move", &move_d, gsi::arg ("v"), + "@brief Moves the point.\n" + "\n" + "This method is equivalent to '+='. It was introduced to harmonize the API " + "with the other objects. The point is modified.\n" + "\n" + "@param v The distance to move the point.\n" + "\n" + "@return The moved point.\n" + "\n" + "This method has been introduced in version 0.29.9." + ) + + method_ext ("move", &move_xy, gsi::arg ("dx", 0), gsi::arg ("dy", 0), + "@brief Moves the point.\n" + "\n" + "Moves the point by the given offset and returns the \n" + "moved point. The point is modified.\n" + "\n" + "@param dx The x distance to move the point.\n" + "@param dy The y distance to move the point.\n" + "\n" + "@return The moved point.\n" + "\n" + "This method has been introduced in version 0.29.9." + ) + + method_ext ("moved", &moved_d, gsi::arg ("v"), + "@brief Returns the moved point.\n" + "\n" + "This method is equivalent to '+'. It was introduced to harmonize the API " + "with the other objects. The point is not modified.\n" + "\n" + "@param v The distance to move the point.\n" + "\n" + "@return The moved point.\n" + "\n" + "This method has been introduced in version 0.29.9." + ) + + method_ext ("moved", &moved_xy, gsi::arg ("dx", 0), gsi::arg ("dy", 0), + "@brief Returns the moved point.\n" + "\n" + "Moves the point by the given offset and returns the \n" + "moved point. The point is not modified.\n" + "\n" + "@param dx The x distance to move the point.\n" + "@param dy The y distance to move the point.\n" + "\n" + "@return The moved point.\n" + "\n" + "This method has been introduced in version 0.29.9." + ) + method ("x", &C::x, "@brief Accessor to the x coordinate\n" ) + diff --git a/src/db/db/gsiDeclDbPolygon.cc b/src/db/db/gsiDeclDbPolygon.cc index f552ac1ff7..97670a5154 100644 --- a/src/db/db/gsiDeclDbPolygon.cc +++ b/src/db/db/gsiDeclDbPolygon.cc @@ -429,45 +429,45 @@ struct simple_polygon_defs "Returns the scaled object. All coordinates are multiplied with the given factor and if " "necessary rounded." ) + - method ("move", &C::move, gsi::arg ("p"), + method ("move", &C::move, gsi::arg ("v"), "@brief Moves the simple polygon.\n" "\n" "Moves the simple polygon by the given offset and returns the \n" "moved simple polygon. The polygon is overwritten.\n" "\n" - "@param p The distance to move the simple polygon.\n" + "@param v The distance to move the simple polygon.\n" "\n" "@return The moved simple polygon.\n" ) + - method_ext ("move", &move_xy, gsi::arg ("x"), gsi::arg ("y"), + method_ext ("move", &move_xy, gsi::arg ("dx", 0), gsi::arg ("dy", 0), "@brief Moves the polygon.\n" "\n" "Moves the polygon by the given offset and returns the \n" "moved polygon. The polygon is overwritten.\n" "\n" - "@param x The x distance to move the polygon.\n" - "@param y The y distance to move the polygon.\n" + "@param dx The x distance to move the polygon.\n" + "@param dy The y distance to move the polygon.\n" "\n" "@return The moved polygon (self).\n" ) + - method ("moved", &C::moved, gsi::arg ("p"), + method ("moved", &C::moved, gsi::arg ("v"), "@brief Returns the moved simple polygon\n" "\n" "Moves the simple polygon by the given offset and returns the \n" "moved simple polygon. The polygon is not modified.\n" "\n" - "@param p The distance to move the simple polygon.\n" + "@param v The distance to move the simple polygon.\n" "\n" "@return The moved simple polygon.\n" ) + - method_ext ("moved", &moved_xy, gsi::arg ("x"), gsi::arg ("y"), + method_ext ("moved", &moved_xy, gsi::arg ("dx", 0), gsi::arg ("dy", 0), "@brief Returns the moved polygon (does not modify self)\n" "\n" "Moves the polygon by the given offset and returns the \n" "moved polygon. The polygon is not modified.\n" "\n" - "@param x The x distance to move the polygon.\n" - "@param y The y distance to move the polygon.\n" + "@param dx The x distance to move the polygon.\n" + "@param dy The y distance to move the polygon.\n" "\n" "@return The moved polygon.\n" "\n" @@ -1470,30 +1470,30 @@ struct polygon_defs "Returns the scaled object. All coordinates are multiplied with the given factor and if " "necessary rounded." ) + - method ("move", &C::move, gsi::arg ("p"), + method ("move", &C::move, gsi::arg ("v"), "@brief Moves the polygon.\n" "\n" "Moves the polygon by the given offset and returns the \n" "moved polygon. The polygon is overwritten.\n" "\n" - "@param p The distance to move the polygon.\n" + "@param v The distance to move the polygon.\n" "\n" "@return The moved polygon (self).\n" "\n" "This method has been introduced in version 0.23.\n" ) + - method_ext ("move", &move_xy, gsi::arg ("x"), gsi::arg ("y"), + method_ext ("move", &move_xy, gsi::arg ("dx", 0), gsi::arg ("dy", 0), "@brief Moves the polygon.\n" "\n" "Moves the polygon by the given offset and returns the \n" "moved polygon. The polygon is overwritten.\n" "\n" - "@param x The x distance to move the polygon.\n" - "@param y The y distance to move the polygon.\n" + "@param dx The x distance to move the polygon.\n" + "@param dy The y distance to move the polygon.\n" "\n" "@return The moved polygon (self).\n" ) + - method ("moved", &C::moved, gsi::arg ("p"), + method ("moved", &C::moved, gsi::arg ("v"), "@brief Returns the moved polygon (does not modify self)\n" "\n" "Moves the polygon by the given offset and returns the \n" @@ -1505,14 +1505,14 @@ struct polygon_defs "\n" "This method has been introduced in version 0.23.\n" ) + - method_ext ("moved", &moved_xy, gsi::arg ("x"), gsi::arg ("y"), + method_ext ("moved", &moved_xy, gsi::arg ("dx", 0), gsi::arg ("dy", 0), "@brief Returns the moved polygon (does not modify self)\n" "\n" "Moves the polygon by the given offset and returns the \n" "moved polygon. The polygon is not modified.\n" "\n" - "@param x The x distance to move the polygon.\n" - "@param y The y distance to move the polygon.\n" + "@param dx The x distance to move the polygon.\n" + "@param dy The y distance to move the polygon.\n" "\n" "@return The moved polygon.\n" "\n" diff --git a/src/db/db/gsiDeclDbRegion.cc b/src/db/db/gsiDeclDbRegion.cc index e42ab0b243..ee52cda6f2 100644 --- a/src/db/db/gsiDeclDbRegion.cc +++ b/src/db/db/gsiDeclDbRegion.cc @@ -3039,14 +3039,14 @@ Class decl_Region (decl_dbShapeCollection, "db", "Region", "\n" "@return The moved region (self).\n" ) + - method_ext ("move", &move_xy, gsi::arg ("x"), gsi::arg ("y"), + method_ext ("move", &move_xy, gsi::arg ("dx", 0), gsi::arg ("dy", 0), "@brief Moves the region\n" "\n" "Moves the region by the given offset and returns the \n" "moved region. The region is overwritten.\n" "\n" - "@param x The x distance to move the region.\n" - "@param y The y distance to move the region.\n" + "@param dx The x distance to move the region.\n" + "@param dy The y distance to move the region.\n" "\n" "@return The moved region (self).\n" ) + @@ -3058,18 +3058,18 @@ Class decl_Region (decl_dbShapeCollection, "db", "Region", "\n" "Starting with version 0.25 this method accepts a vector argument.\n" "\n" - "@param p The distance to move the region.\n" + "@param v The distance to move the region.\n" "\n" "@return The moved region.\n" ) + - method_ext ("moved", &moved_xy, gsi::arg ("x"), gsi::arg ("y"), + method_ext ("moved", &moved_xy, gsi::arg ("dx", 0), gsi::arg ("dy", 0), "@brief Returns the moved region (does not modify self)\n" "\n" "Moves the region by the given offset and returns the \n" "moved region. The region is not modified.\n" "\n" - "@param x The x distance to move the region.\n" - "@param y The y distance to move the region.\n" + "@param dx The x distance to move the region.\n" + "@param dy The y distance to move the region.\n" "\n" "@return The moved region.\n" ) + diff --git a/src/db/db/gsiDeclDbText.cc b/src/db/db/gsiDeclDbText.cc index be37cf36e9..d37c71bb6b 100644 --- a/src/db/db/gsiDeclDbText.cc +++ b/src/db/db/gsiDeclDbText.cc @@ -296,18 +296,18 @@ struct text_defs "\n" "See \\valign= for a description of this property.\n" ) + - method_ext ("move", &move, gsi::arg ("distance"), + method_ext ("move", &move, gsi::arg ("v"), "@brief Moves the text by a certain distance (modifies self)\n" "\n" "\n" "Moves the text by a given offset and returns the moved\n" "text. Does not check for coordinate overflows.\n" "\n" - "@param p The offset to move the text.\n" + "@param v The offset to move the text.\n" "\n" "@return A reference to this text object\n" ) + - method_ext ("move", &move_xy, gsi::arg ("dx"), gsi::arg ("dy"), + method_ext ("move", &move_xy, gsi::arg ("dx", 0), gsi::arg ("dy", 0), "@brief Moves the text by a certain distance (modifies self)\n" "\n" "\n" @@ -321,7 +321,7 @@ struct text_defs "\n" "This method was introduced in version 0.23." ) + - method_ext ("moved", &moved, gsi::arg ("distance"), + method_ext ("moved", &moved, gsi::arg ("v"), "@brief Returns the text moved by a certain distance (does not modify self)\n" "\n" "\n" @@ -329,11 +329,11 @@ struct text_defs "text. Does not modify *this. Does not check for coordinate\n" "overflows.\n" "\n" - "@param p The offset to move the text.\n" + "@param v The offset to move the text.\n" "\n" "@return The moved text.\n" ) + - method_ext ("moved", &moved_xy, gsi::arg ("dx"), gsi::arg ("dy"), + method_ext ("moved", &moved_xy, gsi::arg ("dx", 0), gsi::arg ("dy", 0), "@brief Returns the text moved by a certain distance (does not modify self)\n" "\n" "\n" diff --git a/src/db/db/gsiDeclDbTexts.cc b/src/db/db/gsiDeclDbTexts.cc index 359249795f..5696f682e9 100644 --- a/src/db/db/gsiDeclDbTexts.cc +++ b/src/db/db/gsiDeclDbTexts.cc @@ -484,45 +484,45 @@ Class decl_Texts (decl_dbShapeCollection, "db", "Texts", "\n" "The 'join_with' alias has been introduced in version 0.28.12." ) + - method_ext ("move", &move_p, gsi::arg ("p"), + method_ext ("move", &move_p, gsi::arg ("v"), "@brief Moves the text collection\n" "\n" "Moves the texts by the given offset and returns the \n" "moved text collection. The text collection is overwritten.\n" "\n" - "@param p The distance to move the texts.\n" + "@param v The distance to move the texts.\n" "\n" "@return The moved texts (self).\n" ) + - method_ext ("move", &move_xy, gsi::arg ("x"), gsi::arg ("y"), + method_ext ("move", &move_xy, gsi::arg ("dx", 0), gsi::arg ("dy", 0), "@brief Moves the text collection\n" "\n" "Moves the edge pairs by the given offset and returns the \n" "moved texts. The edge pair collection is overwritten.\n" "\n" - "@param x The x distance to move the texts.\n" - "@param y The y distance to move the texts.\n" + "@param dx The x distance to move the texts.\n" + "@param dy The y distance to move the texts.\n" "\n" "@return The moved texts (self).\n" ) + - method_ext ("moved", &moved_p, gsi::arg ("p"), + method_ext ("moved", &moved_p, gsi::arg ("v"), "@brief Returns the moved text collection (does not modify self)\n" "\n" "Moves the texts by the given offset and returns the \n" "moved texts. The text collection is not modified.\n" "\n" - "@param p The distance to move the texts.\n" + "@param v The distance to move the texts.\n" "\n" "@return The moved texts.\n" ) + - method_ext ("moved", &moved_xy, gsi::arg ("x"), gsi::arg ("y"), + method_ext ("moved", &moved_xy, gsi::arg ("dx", 0), gsi::arg ("dy", 0), "@brief Returns the moved edge pair collection (does not modify self)\n" "\n" "Moves the texts by the given offset and returns the \n" "moved texts. The text collection is not modified.\n" "\n" - "@param x The x distance to move the texts.\n" - "@param y The y distance to move the texts.\n" + "@param dx The x distance to move the texts.\n" + "@param dy The y distance to move the texts.\n" "\n" "@return The moved texts.\n" ) + From 0ce7fb18a99afc028c15cfb13763479a2a455c31 Mon Sep 17 00:00:00 2001 From: Matthias Koefferlein Date: Sun, 17 Nov 2024 22:09:52 +0100 Subject: [PATCH 2/2] Added test for Point/DPoint --- testdata/ruby/dbPointTest.rb | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/testdata/ruby/dbPointTest.rb b/testdata/ruby/dbPointTest.rb index 248ae939bc..647a97ae13 100644 --- a/testdata/ruby/dbPointTest.rb +++ b/testdata/ruby/dbPointTest.rb @@ -163,6 +163,28 @@ def test_4_Point end + # move/moved + def test_5_Point + + p1 = RBA::DPoint::new(1, 2) + assert_equal(p1.moved(2, 3).to_s, "3,5") + assert_equal(p1.to_s, "1,2") + assert_equal(p1.move(2, 3).to_s, "3,5") + assert_equal(p1.to_s, "3,5") + + p1 = RBA::DPoint::new(1, 2) + assert_equal(p1.moved(RBA::DVector::new(2, 3)).to_s, "3,5") + assert_equal(p1.to_s, "1,2") + assert_equal(p1.move(RBA::DVector::new(2, 3)).to_s, "3,5") + assert_equal(p1.to_s, "3,5") + + p1 = RBA::DPoint::new(1, 2) + assert_equal(p1.moved(:dx => 1).to_s, "2,2") + p1.move(:dy => 3) + assert_equal(p1.to_s, "1,5") + + end + end load("test_epilogue.rb")