From 0bb0f400bffefadadaf91d99dc37dceee2654820 Mon Sep 17 00:00:00 2001 From: Matthias Koefferlein Date: Mon, 7 Feb 2022 22:44:35 +0100 Subject: [PATCH] Introducing world box. --- src/db/db/gsiDeclDbBox.cc | 21 +++++++++++++++++++++ testdata/ruby/dbBoxTest.rb | 14 ++++++++++++++ 2 files changed, 35 insertions(+) diff --git a/src/db/db/gsiDeclDbBox.cc b/src/db/db/gsiDeclDbBox.cc index 14c5c7d42..42a6789a2 100644 --- a/src/db/db/gsiDeclDbBox.cc +++ b/src/db/db/gsiDeclDbBox.cc @@ -49,6 +49,11 @@ struct box_defs return c.release (); } + static C world () + { + return C::world (); + } + static C *new_v () { return new C (); @@ -132,6 +137,22 @@ struct box_defs "are not provided in the correct order (i.e. right < left), these are " "swapped." ) + + method ("world", &world, + "@brief Gets the 'world' box\n" + "The world box is the biggest box that can be represented. So it is basically 'all'. The " + "world box behaves neutral on intersections for example. In other operations such as displacement or transformations, " + "the world box may render unexpected results because of coordinate overflow.\n" + "\n" + "The world box can be used\n" + "@ul\n" + " @li for comparison ('==', '!=', '<') @/li\n" + " @li in union and intersection ('+' and '&') @/li\n" + " @li in relations (\\contains?, \\overlaps?, \\touches?) @/li\n" + " @li as 'all' argument in region queries @/li\n" + "@/ul\n" + "\n" + "This method has been introduced in version 0.28." + ) + method ("p1", &C::p1, "@brief Gets the lower left point of the box\n" ) + diff --git a/testdata/ruby/dbBoxTest.rb b/testdata/ruby/dbBoxTest.rb index 92e56dab9..4f6c1de10 100644 --- a/testdata/ruby/dbBoxTest.rb +++ b/testdata/ruby/dbBoxTest.rb @@ -106,6 +106,13 @@ class DBBox_TestClass < TestBase a = RBA::DBox.new assert_equal( a.empty?, true ) + a = RBA::DBox::world + b = RBA::DBox::new(1, 2, 3, 4) + assert_equal( a.empty?, false ) + assert_equal( a == RBA::DBox::world, true ) + assert_equal( (a + b) == RBA::DBox::world, true ) + assert_equal( (a & b) == b, true ) + end # DBox basics @@ -303,6 +310,13 @@ class DBBox_TestClass < TestBase a = RBA::Box.new assert_equal( a.empty?, true ) + a = RBA::Box::world + b = RBA::Box::new(1, 2, 3, 4) + assert_equal( a.empty?, false ) + assert_equal( a == RBA::Box::world, true ) + assert_equal( (a + b) == RBA::Box::world, true ) + assert_equal( (a & b) == b, true ) + end # Box basics