Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/issue 1923 #1928

Merged
merged 2 commits into from
Nov 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 6 additions & 8 deletions src/db/db/gsiDeclDbBox.cc
Original file line number Diff line number Diff line change
Expand Up @@ -380,44 +380,42 @@ struct box_defs
"\n"
"@return The scaled box\n"
) +
method_ext ("move", &box_defs<C>::move, gsi::arg ("dx"), gsi::arg ("dy"),
method_ext ("move", &box_defs<C>::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<C>::moved, gsi::arg ("dx"), gsi::arg ("dy"),
method_ext ("moved", &box_defs<C>::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"
"Moves the box by a given offset and returns the moved\n"
"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"
) +
Expand Down
12 changes: 6 additions & 6 deletions src/db/db/gsiDeclDbEdge.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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"
Expand Down
20 changes: 10 additions & 10 deletions src/db/db/gsiDeclDbEdgePairs.cc
Original file line number Diff line number Diff line change
Expand Up @@ -735,49 +735,49 @@ Class<db::EdgePairs> 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"
) +
Expand Down
12 changes: 6 additions & 6 deletions src/db/db/gsiDeclDbEdges.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1621,14 +1621,14 @@ Class<db::Edges> 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"
) +
Expand All @@ -1644,14 +1644,14 @@ Class<db::Edges> 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"
) +
Expand Down
12 changes: 6 additions & 6 deletions src/db/db/gsiDeclDbPath.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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"
Expand Down
73 changes: 73 additions & 0 deletions src/db/db/gsiDeclDbPoint.cc
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ template <class C>
struct point_defs
{
typedef typename C::coord_type coord_type;
typedef typename C::vector_type vector_type;

static C *from_string (const char *s)
{
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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"
) +
Expand Down
Loading
Loading