@@ -39,6 +39,22 @@ TEST_CASE("Extend box_t with points", "[NoDB]")
3939 REQUIRE (box.max () == geom::point_t {3.0 , 2.0 });
4040}
4141
42+ TEST_CASE (" Extend box_t with box_t" , " [NoDB]" )
43+ {
44+ geom::box_t box;
45+ box.extend (geom::box_t {1.0 , 2.0 , 3.0 , 4.0 });
46+ REQUIRE (box.min_x () == Approx (1.0 ));
47+ REQUIRE (box.max_x () == Approx (3.0 ));
48+ REQUIRE (box.min_y () == Approx (2.0 ));
49+ REQUIRE (box.max_y () == Approx (4.0 ));
50+
51+ box.extend (geom::box_t {-1.0 , 2.0 , 2.0 , 5.0 });
52+ REQUIRE (box.min_x () == Approx (-1.0 ));
53+ REQUIRE (box.max_x () == Approx (3.0 ));
54+ REQUIRE (box.min_y () == Approx (2.0 ));
55+ REQUIRE (box.max_y () == Approx (5.0 ));
56+ }
57+
4258TEST_CASE (" Extend box_t with linestring" , " [NoDB]" )
4359{
4460 geom::box_t box;
@@ -81,6 +97,18 @@ TEST_CASE("Calculate envelope of polygon geometry")
8197 REQUIRE (geom::envelope (geom) == geom::box_t {0.0 , 0.0 , 1.0 , 1.0 });
8298}
8399
100+ TEST_CASE (" Calculate envelope of multipoint geometry" )
101+ {
102+ geom::geometry_t geom{geom::multipoint_t {}};
103+
104+ auto &mpt = geom.get <geom::multipoint_t >();
105+
106+ mpt.add_geometry ({2.3 , 1.4 });
107+ mpt.add_geometry ({7.3 , 0.4 });
108+
109+ REQUIRE (geom::envelope (geom) == geom::box_t {2.3 , 0.4 , 7.3 , 1.4 });
110+ }
111+
84112TEST_CASE (" Calculate envelope of multilinestring geometry" )
85113{
86114 geom::geometry_t geom{geom::multilinestring_t {}};
@@ -106,3 +134,16 @@ TEST_CASE("Calculate envelope of multipolygon geometry")
106134
107135 REQUIRE (geom::envelope (geom) == geom::box_t {1.1 , 1.1 , 4.4 , 3.3 });
108136}
137+
138+ TEST_CASE (" Calculate envelope of geometry collection" )
139+ {
140+ geom::geometry_t geom{geom::collection_t {}};
141+
142+ auto &c = geom.get <geom::collection_t >();
143+
144+ c.add_geometry (geom::geometry_t {geom::point_t {2.1 , 1.2 }});
145+ c.add_geometry (geom::geometry_t {geom::polygon_t {geom::ring_t {
146+ {2.2 , 2.2 }, {2.2 , 3.3 }, {4.4 , 3.3 }, {4.4 , 2.2 }, {2.2 , 2.2 }}}});
147+
148+ REQUIRE (geom::envelope (geom) == geom::box_t {2.1 , 1.2 , 4.4 , 3.3 });
149+ }
0 commit comments