Refactoring of the containers (Edges, Region, EdgePairs, Texts): size -> count, added hier_count. Added SRegion for shape iterator as generic polygonizable things

This commit is contained in:
Matthias Koefferlein 2020-10-11 17:51:54 +02:00
parent 8c1e0d7e0e
commit f1c7e2e8e1
60 changed files with 508 additions and 201 deletions

View File

@ -636,7 +636,7 @@ bool run_deep_xor (const XORData &xor_data)
result.layer_output = result.layout->insert_layer (lp);
xor_res.insert_into (xor_data.output_layout, xor_data.output_cell, result.layer_output);
} else {
result.shape_count = xor_res.size ();
result.shape_count = xor_res.count ();
}
++tol_index;

View File

@ -93,7 +93,7 @@ AsIfFlatEdgePairs::in (const EdgePairs &other, bool invert) const
}
size_t
AsIfFlatEdgePairs::size () const
AsIfFlatEdgePairs::count () const
{
size_t n = 0;
for (EdgePairsIterator p (begin ()); ! p.at_end (); ++p) {
@ -102,6 +102,12 @@ AsIfFlatEdgePairs::size () const
return n;
}
size_t
AsIfFlatEdgePairs::hier_count () const
{
return count ();
}
Box AsIfFlatEdgePairs::bbox () const
{
if (! m_bbox_valid) {
@ -228,7 +234,7 @@ AsIfFlatEdgePairs::add (const EdgePairs &other) const
std::auto_ptr<FlatEdgePairs> new_edge_pairs (new FlatEdgePairs (*other_flat));
new_edge_pairs->invalidate_cache ();
size_t n = new_edge_pairs->raw_edge_pairs ().size () + size ();
size_t n = new_edge_pairs->raw_edge_pairs ().size () + count ();
new_edge_pairs->reserve (n);
@ -242,7 +248,7 @@ AsIfFlatEdgePairs::add (const EdgePairs &other) const
std::auto_ptr<FlatEdgePairs> new_edge_pairs (new FlatEdgePairs ());
size_t n = size () + other.size ();
size_t n = count () + other.count ();
new_edge_pairs->reserve (n);
@ -264,7 +270,7 @@ AsIfFlatEdgePairs::equals (const EdgePairs &other) const
if (empty () != other.empty ()) {
return false;
}
if (size () != other.size ()) {
if (count () != other.count ()) {
return false;
}
EdgePairsIterator o1 (begin ());
@ -285,8 +291,8 @@ AsIfFlatEdgePairs::less (const EdgePairs &other) const
if (empty () != other.empty ()) {
return empty () < other.empty ();
}
if (size () != other.size ()) {
return (size () < other.size ());
if (count () != other.count ()) {
return (count () < other.count ());
}
EdgePairsIterator o1 (begin ());
EdgePairsIterator o2 (other.begin ());

View File

@ -41,7 +41,8 @@ public:
AsIfFlatEdgePairs (const AsIfFlatEdgePairs &other);
virtual ~AsIfFlatEdgePairs ();
virtual size_t size () const;
virtual size_t count () const;
virtual size_t hier_count () const;
virtual std::string to_string (size_t) const;
virtual Box bbox () const;

View File

@ -305,7 +305,7 @@ AsIfFlatEdges::extended (coord_type ext_b, coord_type ext_e, coord_type ext_o, c
JoinEdgesClusterCollector cluster_collector (&sg, ext_b, ext_e, ext_o, ext_i);
db::box_scanner<db::Edge, size_t> scanner (report_progress (), progress_desc ());
scanner.reserve (size ());
scanner.reserve (count ());
AddressableEdgeDelivery e (begin (), has_valid_edges ());
@ -351,7 +351,7 @@ AsIfFlatEdges::in (const Edges &other, bool invert) const
}
size_t
AsIfFlatEdges::size () const
AsIfFlatEdges::count () const
{
size_t n = 0;
for (EdgesIterator p (begin ()); ! p.at_end (); ++p) {
@ -360,6 +360,12 @@ AsIfFlatEdges::size () const
return n;
}
size_t
AsIfFlatEdges::hier_count () const
{
return count ();
}
AsIfFlatEdges::length_type
AsIfFlatEdges::length (const db::Box &box) const
{
@ -511,7 +517,7 @@ AsIfFlatEdges::run_check (db::edge_relation_type rel, const Edges *other, db::Co
std::auto_ptr<FlatEdgePairs> result (new FlatEdgePairs ());
db::box_scanner<db::Edge, size_t> scanner (report_progress (), progress_desc ());
scanner.reserve (size () + (other ? other->size () : 0));
scanner.reserve (count () + (other ? other->count () : 0));
AddressableEdgeDelivery e (begin_merged (), has_valid_merged_edges ());
@ -552,7 +558,7 @@ AsIfFlatEdges::boolean (const Edges *other, EdgeBoolOp op) const
EdgeBooleanClusterCollectorToShapes cluster_collector (&output->raw_edges (), op);
db::box_scanner<db::Edge, size_t> scanner (report_progress (), progress_desc ());
scanner.reserve (size () + (other ? other->size () : 0));
scanner.reserve (count () + (other ? other->count () : 0));
AddressableEdgeDelivery e (begin (), has_valid_edges ());
@ -622,7 +628,7 @@ AsIfFlatEdges::add (const Edges &other) const
new_edges->set_is_merged (false);
new_edges->invalidate_cache ();
size_t n = new_edges->raw_edges ().size () + size ();
size_t n = new_edges->raw_edges ().size () + count ();
new_edges->reserve (n);
@ -636,7 +642,7 @@ AsIfFlatEdges::add (const Edges &other) const
std::auto_ptr<FlatEdges> new_edges (new FlatEdges (false /*not merged*/));
size_t n = size () + other.size ();
size_t n = count () + other.count ();
new_edges->reserve (n);
@ -658,7 +664,7 @@ AsIfFlatEdges::equals (const Edges &other) const
if (empty () != other.empty ()) {
return false;
}
if (size () != other.size ()) {
if (count () != other.count ()) {
return false;
}
EdgesIterator o1 (begin ());
@ -679,8 +685,8 @@ AsIfFlatEdges::less (const Edges &other) const
if (empty () != other.empty ()) {
return empty () < other.empty ();
}
if (size () != other.size ()) {
return (size () < other.size ());
if (count () != other.count ()) {
return (count () < other.count ());
}
EdgesIterator o1 (begin ());
EdgesIterator o2 (other.begin ());

View File

@ -48,7 +48,8 @@ public:
AsIfFlatEdges ();
virtual ~AsIfFlatEdges ();
virtual size_t size () const;
virtual size_t count () const;
virtual size_t hier_count () const;
virtual std::string to_string (size_t) const;
virtual distance_type length (const db::Box &) const;
virtual Box bbox () const;

View File

@ -167,7 +167,7 @@ AsIfFlatRegion::in (const Region &other, bool invert) const
}
size_t
AsIfFlatRegion::size () const
AsIfFlatRegion::count () const
{
size_t n = 0;
for (RegionIterator p (begin ()); ! p.at_end (); ++p) {
@ -176,6 +176,12 @@ AsIfFlatRegion::size () const
return n;
}
size_t
AsIfFlatRegion::hier_count () const
{
return count ();
}
bool
AsIfFlatRegion::is_box () const
{
@ -1563,7 +1569,7 @@ AsIfFlatRegion::add (const Region &other) const
new_region->set_is_merged (false);
new_region->invalidate_cache ();
size_t n = new_region->raw_polygons ().size () + size ();
size_t n = new_region->raw_polygons ().size () + count ();
new_region->reserve (n);
@ -1577,7 +1583,7 @@ AsIfFlatRegion::add (const Region &other) const
std::auto_ptr<FlatRegion> new_region (new FlatRegion (false /*not merged*/));
size_t n = size () + other.size ();
size_t n = count () + other.count ();
new_region->reserve (n);
@ -1611,7 +1617,7 @@ AsIfFlatRegion::equals (const Region &other) const
if (empty () != other.empty ()) {
return false;
}
if (size () != other.size ()) {
if (count () != other.count ()) {
return false;
}
RegionIterator o1 (begin ());
@ -1632,8 +1638,8 @@ AsIfFlatRegion::less (const Region &other) const
if (empty () != other.empty ()) {
return empty () < other.empty ();
}
if (size () != other.size ()) {
return (size () < other.size ());
if (count () != other.count ()) {
return (count () < other.count ());
}
RegionIterator o1 (begin ());
RegionIterator o2 (other.begin ());

View File

@ -47,7 +47,8 @@ public:
virtual ~AsIfFlatRegion ();
virtual bool is_box () const;
virtual size_t size () const;
virtual size_t count () const;
virtual size_t hier_count () const;
virtual area_type area (const db::Box &box) const;
virtual perimeter_type perimeter (const db::Box &box) const;

View File

@ -106,7 +106,7 @@ AsIfFlatTexts::in (const Texts &other, bool invert) const
}
size_t
AsIfFlatTexts::size () const
AsIfFlatTexts::count () const
{
size_t n = 0;
for (TextsIterator t (begin ()); ! t.at_end (); ++t) {
@ -115,6 +115,12 @@ AsIfFlatTexts::size () const
return n;
}
size_t
AsIfFlatTexts::hier_count () const
{
return count ();
}
Box AsIfFlatTexts::bbox () const
{
if (! m_bbox_valid) {
@ -216,7 +222,7 @@ AsIfFlatTexts::add (const Texts &other) const
std::auto_ptr<FlatTexts> new_texts (new FlatTexts (*other_flat));
new_texts->invalidate_cache ();
size_t n = new_texts->raw_texts ().size () + size ();
size_t n = new_texts->raw_texts ().size () + count ();
new_texts->reserve (n);
@ -230,7 +236,7 @@ AsIfFlatTexts::add (const Texts &other) const
std::auto_ptr<FlatTexts> new_texts (new FlatTexts ());
size_t n = size () + other.size ();
size_t n = count () + other.count ();
new_texts->reserve (n);
@ -252,7 +258,7 @@ AsIfFlatTexts::equals (const Texts &other) const
if (empty () != other.empty ()) {
return false;
}
if (size () != other.size ()) {
if (count () != other.count ()) {
return false;
}
TextsIterator o1 (begin ());
@ -273,8 +279,8 @@ AsIfFlatTexts::less (const Texts &other) const
if (empty () != other.empty ()) {
return empty () < other.empty ();
}
if (size () != other.size ()) {
return (size () < other.size ());
if (count () != other.count ()) {
return (count () < other.count ());
}
TextsIterator o1 (begin ());
TextsIterator o2 (other.begin ());

View File

@ -43,7 +43,8 @@ public:
AsIfFlatTexts (const AsIfFlatTexts &other);
virtual ~AsIfFlatTexts ();
virtual size_t size () const;
virtual size_t count () const;
virtual size_t hier_count () const;
virtual std::string to_string (size_t) const;
virtual Box bbox () const;

View File

@ -172,7 +172,7 @@ std::pair<db::RecursiveShapeIterator, db::ICplxTrans> DeepEdgePairs::begin_iter
}
}
size_t DeepEdgePairs::size () const
size_t DeepEdgePairs::count () const
{
size_t n = 0;
@ -185,6 +185,18 @@ size_t DeepEdgePairs::size () const
return n;
}
size_t DeepEdgePairs::hier_count () const
{
size_t n = 0;
const db::Layout &layout = deep_layer ().layout ();
for (db::Layout::top_down_const_iterator c = layout.begin_top_down (); c != layout.end_top_down (); ++c) {
n += layout.cell (*c).shapes (deep_layer ().layer ()).size ();
}
return n;
}
std::string DeepEdgePairs::to_string (size_t nmax) const
{
return db::AsIfFlatEdgePairs::to_string (nmax);

View File

@ -53,7 +53,8 @@ public:
virtual EdgePairsIteratorDelegate *begin () const;
virtual std::pair<db::RecursiveShapeIterator, db::ICplxTrans> begin_iter () const;
virtual size_t size () const;
virtual size_t count () const;
virtual size_t hier_count () const;
virtual std::string to_string (size_t) const;
virtual Box bbox () const;
virtual bool empty () const;

View File

@ -485,7 +485,7 @@ DeepEdges::insert_into (db::Layout *layout, db::cell_index_type into_cell, unsig
deep_layer ().insert_into (layout, into_cell, into_layer);
}
size_t DeepEdges::size () const
size_t DeepEdges::count () const
{
size_t n = 0;
@ -498,6 +498,18 @@ size_t DeepEdges::size () const
return n;
}
size_t DeepEdges::hier_count () const
{
size_t n = 0;
const db::Layout &layout = deep_layer ().layout ();
for (db::Layout::top_down_const_iterator c = layout.begin_top_down (); c != layout.end_top_down (); ++c) {
n += layout.cell (*c).shapes (deep_layer ().layer ()).size ();
}
return n;
}
Box DeepEdges::bbox () const
{
return deep_layer ().initial_cell ().bbox (deep_layer ().layer ());

View File

@ -73,7 +73,8 @@ public:
virtual bool equals (const Edges &other) const;
virtual bool less (const Edges &other) const;
virtual size_t size () const;
virtual size_t count () const;
virtual size_t hier_count () const;
virtual Box bbox () const;
virtual DeepEdges::length_type length (const db::Box &) const;

View File

@ -741,7 +741,7 @@ DeepRegion::is_box () const
}
size_t
DeepRegion::size () const
DeepRegion::count () const
{
size_t n = 0;
@ -754,6 +754,19 @@ DeepRegion::size () const
return n;
}
size_t
DeepRegion::hier_count () const
{
size_t n = 0;
const db::Layout &layout = deep_layer ().layout ();
for (db::Layout::top_down_const_iterator c = layout.begin_top_down (); c != layout.end_top_down (); ++c) {
n += layout.cell (*c).shapes (deep_layer ().layer ()).size ();
}
return n;
}
DeepRegion::area_type
DeepRegion::area (const db::Box &box) const
{

View File

@ -72,7 +72,8 @@ public:
virtual bool less (const Region &other) const;
virtual bool is_box () const;
virtual size_t size () const;
virtual size_t count () const;
virtual size_t hier_count () const;
virtual area_type area (const db::Box &box) const;
virtual perimeter_type perimeter (const db::Box &box) const;

View File

@ -192,7 +192,7 @@ std::pair<db::RecursiveShapeIterator, db::ICplxTrans> DeepTexts::begin_iter () c
}
}
size_t DeepTexts::size () const
size_t DeepTexts::count () const
{
size_t n = 0;
@ -205,6 +205,18 @@ size_t DeepTexts::size () const
return n;
}
size_t DeepTexts::hier_count () const
{
size_t n = 0;
const db::Layout &layout = deep_layer ().layout ();
for (db::Layout::top_down_const_iterator c = layout.begin_top_down (); c != layout.end_top_down (); ++c) {
n += layout.cell (*c).shapes (deep_layer ().layer ()).size ();
}
return n;
}
std::string DeepTexts::to_string (size_t nmax) const
{
return db::AsIfFlatTexts::to_string (nmax);

View File

@ -54,7 +54,8 @@ public:
virtual TextsIteratorDelegate *begin () const;
virtual std::pair<db::RecursiveShapeIterator, db::ICplxTrans> begin_iter () const;
virtual size_t size () const;
virtual size_t count () const;
virtual size_t hier_count () const;
virtual std::string to_string (size_t) const;
virtual Box bbox () const;
virtual bool empty () const;

View File

@ -312,11 +312,19 @@ public:
}
/**
* @brief Returns the number of edge pairs in the edge pair set
* @brief Returns the number of (flat) edge pairs in the edge pair set
*/
size_t size () const
size_t count () const
{
return mp_delegate->size ();
return mp_delegate->count ();
}
/**
* @brief Returns the number of (hierarchical) edge pairs in the edge pair set
*/
size_t hier_count () const
{
return mp_delegate->hier_count ();
}
/**

View File

@ -83,7 +83,8 @@ public:
virtual std::pair<db::RecursiveShapeIterator, db::ICplxTrans> begin_iter () const = 0;
virtual bool empty () const = 0;
virtual size_t size () const = 0;
virtual size_t count () const = 0;
virtual size_t hier_count () const = 0;
virtual Box bbox () const = 0;

View File

@ -375,11 +375,19 @@ public:
}
/**
* @brief Returns the number of edges in the edge set
* @brief Returns the number of (flat) edges in the edge set
*/
size_t size () const
size_t count () const
{
return mp_delegate->size ();
return mp_delegate->count ();
}
/**
* @brief Returns the number of (hierarchical) edges in the edge set
*/
size_t hier_count () const
{
return mp_delegate->hier_count ();
}
/**

View File

@ -199,7 +199,8 @@ public:
virtual bool empty () const = 0;
virtual bool is_merged () const = 0;
virtual size_t size () const = 0;
virtual size_t count () const = 0;
virtual size_t hier_count () const = 0;
virtual distance_type length (const db::Box &box) const = 0;
virtual Box bbox () const = 0;

View File

@ -49,7 +49,8 @@ public:
virtual std::pair<db::RecursiveShapeIterator, db::ICplxTrans> begin_iter () const { return std::make_pair (db::RecursiveShapeIterator (), db::ICplxTrans ()); }
virtual bool empty () const { return true; }
virtual size_t size () const { return 0; }
virtual size_t count () const { return 0; }
virtual size_t hier_count () const { return 0; }
virtual Box bbox () const { return Box (); }

View File

@ -50,7 +50,8 @@ public:
virtual std::pair<db::RecursiveShapeIterator, db::ICplxTrans> begin_merged_iter () const { return std::make_pair (db::RecursiveShapeIterator (), db::ICplxTrans ()); }
virtual bool empty () const { return true; }
virtual size_t size () const { return 0; }
virtual size_t count () const { return 0; }
virtual size_t hier_count () const { return 0; }
virtual std::string to_string (size_t) const { return std::string (); }
virtual bool is_merged () const { return true; }
virtual distance_type length (const db::Box &) const { return 0; }

View File

@ -51,7 +51,8 @@ public:
virtual std::pair<db::RecursiveShapeIterator, db::ICplxTrans> begin_merged_iter () const { return std::make_pair (db::RecursiveShapeIterator (), db::ICplxTrans ()); }
virtual bool empty () const { return true; }
virtual size_t size () const { return 0; }
virtual size_t count () const { return 0; }
virtual size_t hier_count () const { return 0; }
virtual std::string to_string (size_t) const { return std::string (); }
virtual bool is_box () const { return false; }

View File

@ -49,7 +49,8 @@ public:
virtual std::pair<db::RecursiveShapeIterator, db::ICplxTrans> begin_iter () const { return std::make_pair (db::RecursiveShapeIterator (), db::ICplxTrans ()); }
virtual bool empty () const { return true; }
virtual size_t size () const { return 0; }
virtual size_t count () const { return 0; }
virtual size_t hier_count () const { return 0; }
virtual Box bbox () const { return Box (); }

View File

@ -79,7 +79,12 @@ bool FlatEdgePairs::empty () const
return m_edge_pairs.empty ();
}
size_t FlatEdgePairs::size () const
size_t FlatEdgePairs::count () const
{
return m_edge_pairs.size ();
}
size_t FlatEdgePairs::hier_count () const
{
return m_edge_pairs.size ();
}

View File

@ -65,7 +65,8 @@ public:
virtual std::pair<db::RecursiveShapeIterator, db::ICplxTrans> begin_iter () const;
virtual bool empty () const;
virtual size_t size () const;
virtual size_t count () const;
virtual size_t hier_count () const;
virtual EdgePairsDelegate *filter_in_place (const EdgePairFilterBase &filter);

View File

@ -166,7 +166,12 @@ bool FlatEdges::empty () const
return m_edges.empty ();
}
size_t FlatEdges::size () const
size_t FlatEdges::count () const
{
return m_edges.size ();
}
size_t FlatEdges::hier_count () const
{
return m_edges.size ();
}

View File

@ -72,7 +72,8 @@ public:
virtual std::pair<db::RecursiveShapeIterator, db::ICplxTrans> begin_merged_iter () const;
virtual bool empty () const;
virtual size_t size () const;
virtual size_t count () const;
virtual size_t hier_count () const;
virtual bool is_merged () const;
virtual void insert_into (Layout *layout, db::cell_index_type into_cell, unsigned int into_layer) const;
@ -119,7 +120,7 @@ public:
template <class Iter>
void insert (const Iter &b, const Iter &e)
{
reserve (size () + (e - b));
reserve (count () + (e - b));
for (Iter i = b; i != e; ++i) {
insert (*i);
}

View File

@ -175,7 +175,12 @@ bool FlatRegion::empty () const
return m_polygons.empty ();
}
size_t FlatRegion::size () const
size_t FlatRegion::count () const
{
return m_polygons.size ();
}
size_t FlatRegion::hier_count () const
{
return m_polygons.size ();
}

View File

@ -70,7 +70,8 @@ public:
virtual std::pair<db::RecursiveShapeIterator, db::ICplxTrans> begin_merged_iter () const;
virtual bool empty () const;
virtual size_t size () const;
virtual size_t count () const;
virtual size_t hier_count () const;
virtual bool is_merged () const;
virtual void insert_into (Layout *layout, db::cell_index_type into_cell, unsigned int into_layer) const;
@ -115,7 +116,7 @@ public:
template <class Iter>
void insert (const Iter &b, const Iter &e)
{
reserve (size () + (e - b));
reserve (count () + (e - b));
for (Iter i = b; i != e; ++i) {
insert (*i);
}

View File

@ -79,7 +79,12 @@ bool FlatTexts::empty () const
return m_texts.empty ();
}
size_t FlatTexts::size () const
size_t FlatTexts::count () const
{
return m_texts.size ();
}
size_t FlatTexts::hier_count () const
{
return m_texts.size ();
}

View File

@ -66,7 +66,8 @@ public:
virtual std::pair<db::RecursiveShapeIterator, db::ICplxTrans> begin_iter () const;
virtual bool empty () const;
virtual size_t size () const;
virtual size_t count () const;
virtual size_t hier_count () const;
virtual TextsDelegate *filter_in_place (const TextFilterBase &filter);

View File

@ -139,8 +139,8 @@ void NetlistDeviceExtractorMOS3Transistor::extract_devices (const std::vector<db
error (tl::to_string (tr ("Gate shape touches no diffusion - ignored")), *p);
} else {
if (rdiff2gate.size () != 2) {
error (tl::sprintf (tl::to_string (tr ("Expected two polygons on diff interacting with one gate shape (found %d) - gate shape ignored")), int (rdiff2gate.size ())), *p);
if (rdiff2gate.count () != 2) {
error (tl::sprintf (tl::to_string (tr ("Expected two polygons on diff interacting with one gate shape (found %d) - gate shape ignored")), int (rdiff2gate.count ())), *p);
continue;
}
@ -183,7 +183,7 @@ void NetlistDeviceExtractorMOS3Transistor::extract_devices (const std::vector<db
// count the number of gate shapes attached to this shape and distribute the area of the
// diffusion region to the number of gates
size_t n = rgates.selected_interacting (db::Region (*d)).size ();
size_t n = rgates.selected_interacting (db::Region (*d)).count ();
tl_assert (n > 0);
device->set_parameter_value (diff_index == 0 ? db::DeviceClassMOS3Transistor::param_id_AS : db::DeviceClassMOS3Transistor::param_id_AD, sdbu () * sdbu () * d->area () / double (n));
@ -237,13 +237,13 @@ void NetlistDeviceExtractorMOS3Transistor::extract_devices (const std::vector<db
error (tl::to_string (tr ("Gate shape touches a single diffusion only - ignored")), *p);
} else {
if (sdiff2gate.size () != 1) {
error (tl::sprintf (tl::to_string (tr ("Expected one polygons on source diff interacting with one gate shape (found %d) - gate shape ignored")), int (sdiff2gate.size ())), *p);
if (sdiff2gate.count () != 1) {
error (tl::sprintf (tl::to_string (tr ("Expected one polygons on source diff interacting with one gate shape (found %d) - gate shape ignored")), int (sdiff2gate.count ())), *p);
continue;
}
if (ddiff2gate.size () != 1) {
error (tl::sprintf (tl::to_string (tr ("Expected one polygons on drain diff interacting with one gate shape (found %d) - gate shape ignored")), int (ddiff2gate.size ())), *p);
if (ddiff2gate.count () != 1) {
error (tl::sprintf (tl::to_string (tr ("Expected one polygons on drain diff interacting with one gate shape (found %d) - gate shape ignored")), int (ddiff2gate.count ())), *p);
continue;
}
@ -287,7 +287,7 @@ void NetlistDeviceExtractorMOS3Transistor::extract_devices (const std::vector<db
// count the number of gate shapes attached to this shape and distribute the area of the
// diffusion region to the number of gates
size_t n = rgates.selected_interacting (*diff).size ();
size_t n = rgates.selected_interacting (*diff).count ();
tl_assert (n > 0);
device->set_parameter_value (diff_index == 0 ? db::DeviceClassMOS3Transistor::param_id_AS : db::DeviceClassMOS3Transistor::param_id_AD, sdbu () * sdbu () * diff->area () / double (n));
@ -432,8 +432,8 @@ void NetlistDeviceExtractorResistor::extract_devices (const std::vector<db::Regi
db::Region rres (*p);
db::Region contacts_per_res = contact_wo_res.selected_interacting (rres);
if (contacts_per_res.size () != 2) {
error (tl::sprintf (tl::to_string (tr ("Expected two polygons on contacts interacting with one resistor shape (found %d) - resistor shape ignored")), int (contacts_per_res.size ())), *p);
if (contacts_per_res.count () != 2) {
error (tl::sprintf (tl::to_string (tr ("Expected two polygons on contacts interacting with one resistor shape (found %d) - resistor shape ignored")), int (contacts_per_res.count ())), *p);
continue;
}

View File

@ -285,7 +285,7 @@ OriginalLayerEdges::ensure_merged_edges_valid () const
EdgeBooleanClusterCollectorToShapes cluster_collector (&tmp, EdgeOr);
db::box_scanner<db::Edge, size_t> scanner (report_progress (), progress_desc ());
scanner.reserve (size ());
scanner.reserve (count ());
AddressableEdgeDelivery e (begin (), has_valid_edges ());

View File

@ -367,11 +367,19 @@ public:
}
/**
* @brief Returns the number of polygons in the region
* @brief Returns the number of (flat) polygons in the region
*/
size_t size () const
size_t count () const
{
return mp_delegate->size ();
return mp_delegate->count ();
}
/**
* @brief Returns the number of (hierarchical) polygons in the region
*/
size_t hier_count () const
{
return mp_delegate->hier_count ();
}
/**

View File

@ -208,7 +208,8 @@ public:
virtual bool empty () const = 0;
virtual bool is_box () const = 0;
virtual bool is_merged () const = 0;
virtual size_t size () const = 0;
virtual size_t hier_count () const = 0;
virtual size_t count () const = 0;
virtual area_type area (const db::Box &box) const = 0;
virtual perimeter_type perimeter (const db::Box &box) const = 0;

View File

@ -164,6 +164,7 @@ public:
Texts = (1 << Text)
| (1 << TextRef)
| (1 << TextPtrArray),
Regions = Polygons | Paths | Boxes, // convertible to polygons
UserObjects = (1 << UserObject),
Properties = (1 << Null),
All = (1 << Null) - 1,

View File

@ -298,11 +298,19 @@ public:
}
/**
* @brief Returns the number of texts in the text set
* @brief Returns the number of (flat) texts in the text set
*/
size_t size () const
size_t count () const
{
return mp_delegate->size ();
return mp_delegate->count ();
}
/**
* @brief Returns the number of (hierarchical) texts in the text set
*/
size_t hier_count () const
{
return mp_delegate->hier_count ();
}
/**

View File

@ -81,7 +81,8 @@ public:
virtual std::pair<db::RecursiveShapeIterator, db::ICplxTrans> begin_iter () const = 0;
virtual bool empty () const = 0;
virtual size_t size () const = 0;
virtual size_t count () const = 0;
virtual size_t hier_count () const = 0;
virtual Box bbox () const = 0;

View File

@ -483,8 +483,19 @@ Class<db::EdgePairs> decl_EdgePairs (decl_dbShapeCollection, "db", "EdgePairs",
method ("is_empty?", &db::EdgePairs::empty,
"@brief Returns true if the collection is empty\n"
) +
method ("size", &db::EdgePairs::size,
"@brief Returns the number of edge pairs in this collection\n"
method ("count|#size", (size_t (db::EdgePairs::*) () const) &db::EdgePairs::count,
"@brief Returns the (flat) number of edge pairs in the edge pair collection\n"
"\n"
"The count is computed 'as if flat', i.e. edge pairs inside a cell are multiplied by the number of times a cell is instantiated.\n"
"\n"
"Starting with version 0.27, the method is called 'count' for consistency with \\Region. 'size' is still provided as an alias."
) +
method ("hier_count", (size_t (db::EdgePairs::*) () const) &db::EdgePairs::hier_count,
"@brief Returns the (hierarchical) number of edge pairs in the edge pair collection\n"
"\n"
"The count is computed 'hierarchical', i.e. edge pairs inside a cell are counted once even if the cell is instantiated multiple times.\n"
"\n"
"This method has been introduced in version 0.27."
) +
gsi::iterator ("each", &db::EdgePairs::begin,
"@brief Returns each edge pair of the edge pair collection\n"

View File

@ -1519,8 +1519,21 @@ Class<db::Edges> dec_Edges (decl_dbShapeCollection, "db", "Edges",
method ("is_empty?", &db::Edges::empty,
"@brief Returns true if the edge collection is empty\n"
) +
method ("size", (size_t (db::Edges::*) () const) &db::Edges::size,
"@brief Returns the number of edges in the edge collection\n"
method ("count|#size", (size_t (db::Edges::*) () const) &db::Edges::count,
"@brief Returns the (flat) number of edges in the edge collection\n"
"\n"
"This returns the number of raw edges (not merged edges if merged semantics is enabled).\n"
"The count is computed 'as if flat', i.e. edges inside a cell are multiplied by the number of times a cell is instantiated.\n"
"\n"
"Starting with version 0.27, the method is called 'count' for consistency with \\Region. 'size' is still provided as an alias."
) +
method ("hier_count", (size_t (db::Edges::*) () const) &db::Edges::hier_count,
"@brief Returns the (hierarchical) number of edges in the edge collection\n"
"\n"
"This returns the number of raw edges (not merged edges if merged semantics is enabled).\n"
"The count is computed 'hierarchical', i.e. edges inside a cell are counted once even if the cell is instantiated multiple times.\n"
"\n"
"This method has been introduced in version 0.27."
) +
gsi::iterator ("each", &db::Edges::begin,
"@brief Returns each edge of the region\n"

View File

@ -2451,12 +2451,22 @@ Class<db::Region> decl_Region (decl_dbShapeCollection, "db", "Region",
method ("is_empty?", &db::Region::empty,
"@brief Returns true if the region is empty\n"
) +
method ("size|count", (size_t (db::Region::*) () const) &db::Region::size,
"@brief Returns the number of polygons in the region\n"
method ("count|#size", (size_t (db::Region::*) () const) &db::Region::count,
"@brief Returns the (flat) number of polygons in the region\n"
"\n"
"This returns the number of raw polygons (not merged polygons if merged semantics is enabled).\n"
"The count is computed 'as if flat', i.e. polygons inside a cell are multiplied by the number of times a cell is instantiated.\n"
"\n"
"The 'count' alias has been provided in version 0.26 to avoid ambiguitiy with the 'size' method which applies a geometrical bias."
) +
method ("hier_count", (size_t (db::Region::*) () const) &db::Region::hier_count,
"@brief Returns the (hierarchical) number of polygons in the region\n"
"\n"
"This returns the number of raw polygons (not merged polygons if merged semantics is enabled).\n"
"The count is computed 'hierarchical', i.e. polygons inside a cell are counted once even if the cell is instantiated multiple times.\n"
"\n"
"This method has been introduced in version 0.27."
) +
iterator ("each", &db::Region::begin,
"@brief Returns each polygon of the region\n"
"\n"

View File

@ -446,6 +446,7 @@ static unsigned int s_all () { return db::ShapeIterator::All; }
static unsigned int s_all_with_properties () { return db::ShapeIterator::AllWithProperties; }
static unsigned int s_properties () { return db::ShapeIterator::Properties; }
static unsigned int s_polygons () { return db::ShapeIterator::Polygons; }
static unsigned int s_regions () { return db::ShapeIterator::Regions; }
static unsigned int s_boxes () { return db::ShapeIterator::Boxes; }
static unsigned int s_edges () { return db::ShapeIterator::Edges; }
static unsigned int s_edge_pairs () { return db::ShapeIterator::EdgePairs; }
@ -1254,6 +1255,11 @@ Class<db::Shapes> decl_Shapes ("db", "Shapes",
gsi::method ("SPolygons|#s_polygons", &s_polygons,
"@brief Indicates that polygons shall be retrieved"
) +
gsi::method ("SRegions|#s_regions", &s_regions,
"@brief Indicates that objects which can be polygonized shall be retrieved (paths, boxes, polygons etc.)\n"
"\n"
"This constant has been added in version 0.27."
) +
gsi::method ("SBoxes|#s_boxes", &s_boxes,
"@brief Indicates that boxes shall be retrieved"
) +

View File

@ -453,8 +453,19 @@ Class<db::Texts> decl_Texts (decl_dbShapeCollection, "db", "Texts",
method ("is_empty?", &db::Texts::empty,
"@brief Returns true if the collection is empty\n"
) +
method ("size", &db::Texts::size,
"@brief Returns the number of texts in this collection\n"
method ("count|#size", (size_t (db::Texts::*) () const) &db::Texts::count,
"@brief Returns the (flat) number of texts in the text collection\n"
"\n"
"The count is computed 'as if flat', i.e. texts inside a cell are multiplied by the number of times a cell is instantiated.\n"
"\n"
"Starting with version 0.27, the method is called 'count' for consistency with \\Region. 'size' is still provided as an alias."
) +
method ("hier_count", (size_t (db::Texts::*) () const) &db::Texts::hier_count,
"@brief Returns the (hierarchical) number of texts in the text collection\n"
"\n"
"The count is computed 'hierarchical', i.e. texts inside a cell are counted once even if the cell is instantiated multiple times.\n"
"\n"
"This method has been introduced in version 0.27."
) +
gsi::iterator ("each", &db::Texts::begin,
"@brief Returns each text of the text collection\n"

View File

@ -74,7 +74,8 @@ TEST(1_Basics)
EXPECT_EQ (ep100.empty (), true);
EXPECT_EQ (ep2.empty (), false);
EXPECT_EQ (ep2.bbox ().to_string (), "(-1050,-475;24810,3275)");
EXPECT_EQ (ep2.size (), size_t (40));
EXPECT_EQ (ep2.count (), size_t (40));
EXPECT_EQ (ep2.hier_count (), size_t (1));
EXPECT_EQ (ep2.to_string ().substr (0, 42), "(-1050,-475;-1050,475)/(250,475;250,-475);");
db::Layout target;

View File

@ -28,6 +28,7 @@
#include "dbRegion.h"
#include "dbEdgesUtils.h"
#include "dbDeepShapeStore.h"
#include "dbCellGraphUtils.h"
#include "tlUnitTest.h"
#include "tlStream.h"
@ -59,7 +60,25 @@ TEST(1)
edges.push_back (db::Edges (iter, dss));
EXPECT_EQ (edges.back ().size (), db::Edges (iter).size ());
size_t n = 0, nhier = 0;
db::CellCounter cc (&ly);
for (db::Layout::top_down_const_iterator c = ly.begin_top_down (); c != ly.end_top_down (); ++c) {
size_t ns = 0;
for (db::Shapes::shape_iterator is = ly.cell (*c).shapes (li1).begin (db::ShapeIterator::Edges); !is.at_end (); ++is) {
++ns;
}
for (db::Shapes::shape_iterator is = ly.cell (*c).shapes (li1).begin (db::ShapeIterator::Regions); !is.at_end (); ++is) {
db::Polygon p;
is->polygon (p);
ns += p.hull ().size ();
}
n += cc.weight (*c) * ns;
nhier += ns;
}
EXPECT_EQ (db::Edges (iter).count (), n);
EXPECT_EQ (edges.back ().count (), n);
EXPECT_EQ (edges.back ().hier_count (), nhier);
EXPECT_EQ (edges.back ().bbox (), db::Edges (iter).bbox ());
}

View File

@ -31,10 +31,11 @@
#include "dbEdgesUtils.h"
#include "dbDeepShapeStore.h"
#include "dbOriginalLayerRegion.h"
#include "dbCellGraphUtils.h"
#include "tlUnitTest.h"
#include "tlStream.h"
TEST(1)
TEST(1_Basic)
{
db::Layout ly;
{
@ -62,7 +63,20 @@ TEST(1)
regions.push_back (db::Region (iter, dss));
EXPECT_EQ (regions.back ().size (), db::Region (iter).size ());
size_t n = 0, nhier = 0;
db::CellCounter cc (&ly);
for (db::Layout::top_down_const_iterator c = ly.begin_top_down (); c != ly.end_top_down (); ++c) {
size_t ns = 0;
for (db::Shapes::shape_iterator is = ly.cell (*c).shapes (li1).begin (db::ShapeIterator::Regions); !is.at_end (); ++is) {
++ns;
}
n += cc.weight (*c) * ns;
nhier += ns;
}
EXPECT_EQ (db::Region (iter).count (), n);
EXPECT_EQ (regions.back ().count (), n);
EXPECT_EQ (regions.back ().hier_count (), nhier);
EXPECT_EQ (regions.back ().bbox (), db::Region (iter).bbox ());
EXPECT_EQ (regions.back ().is_merged (), false);

View File

@ -59,7 +59,8 @@ TEST(1_Basics)
EXPECT_EQ (texts100.empty (), true);
EXPECT_EQ (texts2.empty (), false);
EXPECT_EQ (texts2.bbox ().to_string (), "(-520,0;24040,2800)");
EXPECT_EQ (texts2.size (), size_t (40));
EXPECT_EQ (texts2.count (), size_t (40));
EXPECT_EQ (texts2.hier_count (), size_t (1));
EXPECT_EQ (texts2.to_string ().substr (0, 42), "('L2',r0 -520,0);('L2',r0 -520,2800);('L2'");
db::Layout target;

View File

@ -37,13 +37,15 @@ TEST(1)
EXPECT_EQ (ep != db::EdgePairs (), false);
ep.insert (db::Edge (db::Point (10, 20), db::Point (110, 120)), db::Edge (db::Point (-10, -20), db::Point (90, 80)));
EXPECT_EQ (ep.empty (), false);
EXPECT_EQ (ep.size (), size_t (1));
EXPECT_EQ (ep.count (), size_t (1));
EXPECT_EQ (ep.hier_count (), size_t (1));
EXPECT_EQ (ep.bbox ().to_string (), "(-10,-20;110,120)");
EXPECT_EQ (ep.to_string (), "(10,20;110,120)/(-10,-20;90,80)");
ep.clear ();
EXPECT_EQ (ep.empty (), true);
EXPECT_EQ (ep.size (), size_t (0));
EXPECT_EQ (ep.count (), size_t (0));
EXPECT_EQ (ep.hier_count (), size_t (0));
EXPECT_EQ (ep.bbox ().to_string (), "()");
ep.insert (db::EdgePair (db::Edge (db::Point (10, 20), db::Point (110, 120)), db::Edge (db::Point (-10, -20), db::Point (90, 80))));
EXPECT_EQ (ep == db::EdgePairs (), false);
@ -65,14 +67,17 @@ TEST(1)
db::EdgePairs ep2;
EXPECT_EQ (ep2.empty (), true);
EXPECT_EQ (ep2.size (), size_t (0));
EXPECT_EQ (ep2.count (), size_t (0));
EXPECT_EQ (ep2.hier_count (), size_t (0));
EXPECT_EQ (ep2.bbox ().to_string (), "()");
ep2.swap (ep);
EXPECT_EQ (ep.empty (), true);
EXPECT_EQ (ep.size (), size_t (0));
EXPECT_EQ (ep.count (), size_t (0));
EXPECT_EQ (ep.hier_count (), size_t (0));
EXPECT_EQ (ep.bbox ().to_string (), "()");
EXPECT_EQ (ep2.empty (), false);
EXPECT_EQ (ep2.size (), size_t (1));
EXPECT_EQ (ep2.count (), size_t (1));
EXPECT_EQ (ep2.hier_count (), size_t (1));
EXPECT_EQ (ep2.bbox ().to_string (), "(-20,-110;120,10)");
}

View File

@ -81,7 +81,8 @@ TEST(1)
r += db::Edges (db::Box (db::Point (10, 0), db::Point (110, 200)));
EXPECT_EQ (r.to_string (), "(0,0;0,200);(0,200;100,200);(100,200;100,0);(100,0;0,0);(10,0;10,200);(10,200;110,200);(110,200;110,0);(110,0;10,0)");
EXPECT_EQ (r.is_merged (), false);
EXPECT_EQ (r.size (), size_t (8));
EXPECT_EQ (r.count (), size_t (8));
EXPECT_EQ (r.hier_count (), size_t (8));
r.set_merged_semantics (false);
EXPECT_EQ (r.length (), db::Edges::length_type (1200));
EXPECT_EQ (r.length (db::Box (db::Point (-10, -10), db::Point (50, 50))), db::Edges::length_type (190));
@ -97,7 +98,8 @@ TEST(1)
EXPECT_EQ (r.bbox ().to_string (), "(0,0;110,200)");
EXPECT_EQ (r.is_merged (), true);
EXPECT_EQ (r.empty (), false);
EXPECT_EQ (r.size (), size_t (6));
EXPECT_EQ (r.count (), size_t (6));
EXPECT_EQ (r.hier_count (), size_t (6));
EXPECT_EQ (r.length (), db::Edges::length_type (1020));
r.clear ();
@ -581,13 +583,13 @@ TEST(12)
b.insert (db::Box (db::Point (30, 0), db::Point (100, 100)));
EXPECT_EQ (b.separation_check (a, 15).to_string (), "(30,9;30,41)/(20,30;20,20)");
EXPECT_EQ (b.separation_check (a, 15, true).to_string (), "(30,0;30,100)/(20,30;20,20)");
EXPECT_EQ (b.separation_check (a, 15, false, db::Euclidian, 91).to_string (), "(30,30;30,41)/(15,30;20,30);(30,9;30,41)/(20,30;20,20);(30,9;30,20)/(20,20;15,20)");
EXPECT_EQ (b.separation_check (a, 15, false, db::Euclidian, 91).to_string (), "(30,9;30,20)/(20,20;15,20);(30,9;30,41)/(20,30;20,20);(30,30;30,41)/(15,30;20,30)");
b.clear ();
b.insert (db::Box (db::Point (15, 0), db::Point (100, 100)));
EXPECT_EQ (b.overlap_check (a, 15).to_string (), "(15,6;15,44)/(20,30;20,20)");
EXPECT_EQ (b.overlap_check (a, 15, true).to_string (), "(15,0;15,100)/(20,30;20,20)");
EXPECT_EQ (b.overlap_check (a, 15, false, db::Euclidian, 91).to_string (), "(15,15;15,30)/(15,30;20,30);(15,6;15,44)/(20,30;20,20);(15,20;15,35)/(20,20;15,20)");
EXPECT_EQ (b.overlap_check (a, 15, false, db::Euclidian, 91).to_string (), "(15,20;15,35)/(20,20;15,20);(15,6;15,44)/(20,30;20,20);(15,15;15,30)/(15,30;20,30)");
}
TEST(20)
@ -641,7 +643,8 @@ TEST(20)
EXPECT_EQ (r1.length (), db::Edges::length_type (200));
EXPECT_EQ (r1.has_valid_edges (), false);
EXPECT_EQ (r1.bbox ().to_string (), "(120,20;220,140)");
EXPECT_EQ (r1.size (), size_t (6));
EXPECT_EQ (r1.count (), size_t (6));
EXPECT_EQ (r1.hier_count (), size_t (6));
EXPECT_EQ (r1.empty (), false);
db::EdgeLengthFilter f0 (0, 50, false);
@ -653,12 +656,14 @@ TEST(20)
EXPECT_EQ (r2.has_valid_edges (), false);
EXPECT_EQ (r2.length (), db::Edges::length_type (200));
EXPECT_EQ (r2.bbox ().to_string (), "(120,20;220,140)");
EXPECT_EQ (r2.size (), size_t (6));
EXPECT_EQ (r2.count (), size_t (6));
EXPECT_EQ (r2.hier_count (), size_t (6));
EXPECT_EQ (r2.empty (), false);
r2.filter (f0);
EXPECT_EQ (r2.has_valid_edges (), true);
EXPECT_EQ (r2.to_string (), "(120,20;120,40);(120,40;140,40);(140,40;140,20);(140,20;120,20)");
EXPECT_EQ (r2.size (), size_t (4));
EXPECT_EQ (r2.count (), size_t (4));
EXPECT_EQ (r2.hier_count (), size_t (4));
EXPECT_EQ (r2.empty (), false);
EXPECT_EQ (r2.length (), db::Edges::length_type (80));
@ -666,7 +671,8 @@ TEST(20)
EXPECT_EQ (r1.has_valid_edges (), true);
EXPECT_EQ (r1.to_string (), "(120,20;120,40);(120,40;140,40);(140,40;140,20);(140,20;120,20);(160,80;160,140);(220,80;160,80);(0,0;0,20);(0,20;10,20);(10,20;10,0);(10,0;0,0)");
EXPECT_EQ (r1.to_string (2), "(120,20;120,40);(120,40;140,40)...");
EXPECT_EQ (r1.size (), size_t (10));
EXPECT_EQ (r1.count (), size_t (10));
EXPECT_EQ (r1.hier_count (), size_t (10));
EXPECT_EQ (r1.length (), db::Edges::length_type (260));
rr = r1.filtered (f0);
@ -682,7 +688,8 @@ TEST(20)
EXPECT_EQ (r1.has_valid_edges (), false);
EXPECT_EQ (r1.to_string (), "(120,20;120,40);(120,40;140,40);(140,40;140,20);(140,20;120,20)");
EXPECT_EQ (r1.has_valid_edges (), false);
EXPECT_EQ (r1.size (), size_t (4));
EXPECT_EQ (r1.count (), size_t (4));
EXPECT_EQ (r1.hier_count (), size_t (4));
EXPECT_EQ (r1.empty (), false);
db::Edges r2 = r1;
@ -694,7 +701,8 @@ TEST(20)
r1.clear ();
EXPECT_EQ (r1.has_valid_edges (), true);
EXPECT_EQ (r1.size (), size_t (0));
EXPECT_EQ (r1.count (), size_t (0));
EXPECT_EQ (r1.hier_count (), size_t (0));
EXPECT_EQ (r1.empty (), true);
EXPECT_EQ (r1.length (), db::Edges::length_type (0));
@ -704,7 +712,8 @@ TEST(20)
EXPECT_EQ (r1.to_string (), "(120,20;120,40);(120,40;140,40);(140,40;140,20);(140,20;120,20)");
EXPECT_EQ (r1.has_valid_edges (), false);
EXPECT_EQ (r2.has_valid_edges (), true);
EXPECT_EQ (r2.size (), size_t (0));
EXPECT_EQ (r2.count (), size_t (0));
EXPECT_EQ (r2.hier_count (), size_t (0));
EXPECT_EQ (r2.empty (), true);
EXPECT_EQ (r2.length (), db::Edges::length_type (0));
}

View File

@ -93,7 +93,8 @@ TEST(1)
EXPECT_EQ (r.is_box (), false);
EXPECT_EQ (r.to_string (), "(0,0;0,200;100,200;100,0);(10,20;10,220;110,220;110,20)");
EXPECT_EQ (r.is_merged (), false);
EXPECT_EQ (r.size (), size_t (2));
EXPECT_EQ (r.count (), size_t (2));
EXPECT_EQ (r.hier_count (), size_t (2));
r.set_merged_semantics (false);
EXPECT_EQ (r.area (), 40000);
EXPECT_EQ (r.area (db::Box (db::Point (-10, -10), db::Point (50, 50))), 50 * 50 + 40 * 30);
@ -123,7 +124,8 @@ TEST(1)
EXPECT_EQ (r.is_merged (), true);
EXPECT_EQ (r.is_box (), false);
EXPECT_EQ (r.empty (), false);
EXPECT_EQ (r.size (), size_t (1));
EXPECT_EQ (r.count (), size_t (1));
EXPECT_EQ (r.hier_count (), size_t (1));
EXPECT_EQ (r.area (), 23800);
EXPECT_EQ (r.perimeter (), db::Region::perimeter_type (660));
@ -506,11 +508,11 @@ TEST(15a)
EXPECT_EQ (r.width_check (15).to_string (), "(0,0;0,10)/(10,10;10,0);(0,10;10,10)/(10,0;0,0)");
EXPECT_EQ (r.width_check (5).to_string (), "");
EXPECT_EQ (r.width_check (5, false, db::Euclidian, 91).to_string (), "(0,5;0,10)/(0,10;5,10);(0,0;0,5)/(5,0;0,0);(5,10;10,10)/(10,10;10,5);(10,5;10,0)/(10,0;5,0);(20,45;20,50)/(20,50;25,50);(20,20;20,25)/(25,20;20,20);(35,50;40,50)/(40,50;40,45);(40,25;40,20)/(40,20;35,20)");
EXPECT_EQ (r.space_check (15, false, db::Euclidian, 91).to_string (), "(9,10;10,10)/(20,20;20,21);(9,10;10,10)/(21,20;20,20);(10,10;10,9)/(20,20;20,21);(10,10;10,9)/(21,20;20,20)");
EXPECT_EQ (r.space_check (15, false, db::Square, 91).to_string (), "(5,10;10,10)/(20,20;20,25);(5,10;10,10)/(25,20;20,20);(10,10;10,5)/(20,20;20,25);(10,10;10,5)/(25,20;20,20)");
EXPECT_EQ (r.space_check (15).to_string (), "(9,10;10,10)/(21,20;20,20);(10,10;10,9)/(20,20;20,21)");
EXPECT_EQ (r.space_check (15, true).to_string (), "(0,10;10,10)/(40,20;20,20);(10,10;10,0)/(20,20;20,50)");
EXPECT_EQ (r.space_check (15, false, db::Square).to_string (), "(5,10;10,10)/(25,20;20,20);(10,10;10,5)/(20,20;20,25)");
EXPECT_EQ (r.space_check (15, false, db::Euclidian, 91).to_string (), "(10,10;10,9)/(21,20;20,20);(10,10;10,9)/(20,20;20,21);(9,10;10,10)/(21,20;20,20);(9,10;10,10)/(20,20;20,21)");
EXPECT_EQ (r.space_check (15, false, db::Square, 91).to_string (), "(10,10;10,5)/(25,20;20,20);(10,10;10,5)/(20,20;20,25);(5,10;10,10)/(25,20;20,20);(5,10;10,10)/(20,20;20,25)");
EXPECT_EQ (r.space_check (15).to_string (), "(10,10;10,9)/(20,20;20,21);(9,10;10,10)/(21,20;20,20)");
EXPECT_EQ (r.space_check (15, true).to_string (), "(10,10;10,0)/(20,20;20,50);(0,10;10,10)/(40,20;20,20)");
EXPECT_EQ (r.space_check (15, false, db::Square).to_string (), "(10,10;10,5)/(20,20;20,25);(5,10;10,10)/(25,20;20,20)");
r.clear ();
db::Point pts[] = {
@ -543,9 +545,9 @@ TEST(15b)
r.insert (db::Box (db::Point (400, 200), db::Point (500, 300)));
EXPECT_EQ (r.width_check (120, false, db::Projection).to_string (), "(400,200;400,300)/(500,300;500,200)");
EXPECT_EQ (r.space_check (120, false, db::Projection).to_string (), "(200,200;200,0)/(300,0;300,200);(200,500;200,300)/(300,300;300,500);(300,200;400,200)/(400,300;300,300)");
EXPECT_EQ (r.space_check (120, false, db::Projection).to_string (), "(200,500;200,300)/(300,300;300,500);(300,200;400,200)/(400,300;300,300);(200,200;200,0)/(300,0;300,200)");
EXPECT_EQ (r.notch_check (120, false, db::Projection).to_string (), "(300,200;400,200)/(400,300;300,300)");
EXPECT_EQ (r.isolated_check (120, false, db::Projection).to_string (), "(200,200;200,0)/(300,0;300,200);(200,500;200,300)/(300,300;300,500)");
EXPECT_EQ (r.isolated_check (120, false, db::Projection).to_string (), "(300,300;300,500)/(200,500;200,300);(300,0;300,200)/(200,200;200,0)");
}
TEST(15c)
@ -561,9 +563,9 @@ TEST(15c)
r.insert (db::Box (db::Point (400, 250), db::Point (500, 300)));
EXPECT_EQ (r.width_check (120, false, db::Projection).to_string (), "(400,200;400,300)/(500,300;500,200)");
EXPECT_EQ (r.space_check (120, false, db::Projection).to_string (), "(200,200;200,0)/(300,0;300,200);(200,500;200,300)/(300,300;300,500);(300,200;400,200)/(400,300;300,300)");
EXPECT_EQ (r.space_check (120, false, db::Projection).to_string (), "(200,500;200,300)/(300,300;300,500);(300,200;400,200)/(400,300;300,300);(200,200;200,0)/(300,0;300,200)");
EXPECT_EQ (r.notch_check (120, false, db::Projection).to_string (), "(300,200;400,200)/(400,300;300,300)");
EXPECT_EQ (r.isolated_check (120, false, db::Projection).to_string (), "(200,200;200,0)/(300,0;300,200);(200,500;200,300)/(300,300;300,500)");
EXPECT_EQ (r.isolated_check (120, false, db::Projection).to_string (), "(300,300;300,500)/(200,500;200,300);(300,0;300,200)/(200,200;200,0)");
}
TEST(15d)
@ -578,7 +580,7 @@ TEST(15d)
r.insert (db::Box (db::Point (600, 200), db::Point (700, 300)));
r.insert (db::Box (db::Point (0, 140), db::Point (350, 160)));
EXPECT_EQ (r.space_check (120, false, db::Projection).to_string (), "(0,100;100,100)/(100,140;0,140);(300,100;350,100)/(350,140;300,140);(300,100;400,100)/(400,200;300,200);(600,100;700,100)/(700,200;600,200);(0,160;100,160)/(100,200;0,200);(300,160;350,160)/(350,200;300,200)");
EXPECT_EQ (r.space_check (120, false, db::Projection).to_string (), "(300,100;400,100)/(400,200;300,200);(300,160;350,160)/(350,200;300,200);(0,160;100,160)/(100,200;0,200);(350,140;300,140)/(300,100;350,100);(0,100;100,100)/(100,140;0,140);(600,100;700,100)/(700,200;600,200)");
}
TEST(15e)
@ -639,22 +641,22 @@ TEST(16)
EXPECT_EQ (a.inside_check (b, 15).to_string (), "(10,20;10,30)/(0,9;0,41)");
EXPECT_EQ (a.inside_check (b, 15, true).to_string (), "(10,20;10,30)/(0,0;0,100)");
EXPECT_EQ (a.inside_check (b, 15, false, db::Euclidian, 91).to_string (), "(10,20;10,30)/(0,9;0,41);(10,30;15,30)/(0,30;0,41);(15,20;10,20)/(0,9;0,20)");
EXPECT_EQ (a.inside_check (b, 15, false, db::Euclidian, 91).to_string (), "(15,20;10,20)/(0,9;0,20);(10,30;15,30)/(0,30;0,41);(10,20;10,30)/(0,9;0,41)");
EXPECT_EQ (b.enclosing_check (a, 15).to_string (), "(0,9;0,41)/(10,20;10,30)");
EXPECT_EQ (b.enclosing_check (a, 15, true).to_string (), "(0,0;0,100)/(10,20;10,30)");
EXPECT_EQ (b.enclosing_check (a, 15, false, db::Euclidian, 91).to_string (), "(0,9;0,41)/(10,20;10,30);(0,30;0,41)/(10,30;15,30);(0,9;0,20)/(15,20;10,20)");
EXPECT_EQ (b.enclosing_check (a, 15, false, db::Euclidian, 91).to_string (), "(0,9;0,20)/(15,20;10,20);(0,30;0,41)/(10,30;15,30);(0,9;0,41)/(10,20;10,30)");
b.clear ();
b.insert (db::Box (db::Point (30, 0), db::Point (100, 100)));
EXPECT_EQ (b.separation_check (a, 15).to_string (), "(30,9;30,41)/(20,30;20,20)");
EXPECT_EQ (b.separation_check (a, 15, true).to_string (), "(30,0;30,100)/(20,30;20,20)");
EXPECT_EQ (b.separation_check (a, 15, false, db::Euclidian, 91).to_string (), "(30,30;30,41)/(15,30;20,30);(30,9;30,41)/(20,30;20,20);(30,9;30,20)/(20,20;15,20)");
EXPECT_EQ (b.separation_check (a, 15, false, db::Euclidian, 91).to_string (), "(30,9;30,20)/(20,20;15,20);(30,9;30,41)/(20,30;20,20);(30,30;30,41)/(15,30;20,30)");
b.clear ();
b.insert (db::Box (db::Point (15, 0), db::Point (100, 100)));
EXPECT_EQ (b.overlap_check (a, 15).to_string (), "(15,6;15,44)/(20,30;20,20)");
EXPECT_EQ (b.overlap_check (a, 15, true).to_string (), "(15,0;15,100)/(20,30;20,20)");
EXPECT_EQ (b.overlap_check (a, 15, false, db::Euclidian, 91).to_string (), "(15,15;15,30)/(15,30;20,30);(15,6;15,44)/(20,30;20,20);(15,20;15,35)/(20,20;15,20)");
EXPECT_EQ (b.overlap_check (a, 15, false, db::Euclidian, 91).to_string (), "(15,20;15,35)/(20,20;15,20);(15,6;15,44)/(20,30;20,20);(15,15;15,30)/(15,30;20,30)");
}
TEST(17)
@ -689,7 +691,8 @@ TEST(18a)
EXPECT_EQ (o.to_string (), "(50,10;50,30;70,30;70,10);(70,60;70,80;90,80;90,60)");
o = r;
EXPECT_EQ (o.selected_not_outside (rr).to_string (), "(0,0;0,20;20,20;20,0);(20,30;20,50;40,50;40,30);(0,60;0,80;60,80;60,60);(0,100;0,130;30,130;30,100)");
EXPECT_EQ (o.selected_outside (rr).size () + o.selected_not_outside (rr).size (), size_t (6));
EXPECT_EQ (o.selected_outside (rr).count () + o.selected_not_outside (rr).count (), size_t (6));
EXPECT_EQ (o.selected_outside (rr).hier_count () + o.selected_not_outside (rr).hier_count (), size_t (6));
o.select_not_outside (rr);
EXPECT_EQ (o.to_string (), "(0,0;0,20;20,20;20,0);(20,30;20,50;40,50;40,30);(0,60;0,80;60,80;60,60);(0,100;0,130;30,130;30,100)");
}
@ -699,10 +702,11 @@ TEST(18a)
o.select_inside (rr);
EXPECT_EQ (o.to_string (), "(20,30;20,50;40,50;40,30)");
o = r;
EXPECT_EQ (o.selected_not_inside (rr).to_string (), "(0,0;0,20;20,20;20,0);(50,10;50,30;70,30;70,10);(70,60;70,80;90,80;90,60);(0,60;0,80;60,80;60,60);(0,100;0,130;30,130;30,100)");
EXPECT_EQ (o.selected_inside (rr).size () + o.selected_not_inside (rr).size (), size_t (6));
EXPECT_EQ (o.selected_not_inside (rr).to_string (), "(0,0;0,20;20,20;20,0);(50,10;50,30;70,30;70,10);(0,60;0,80;60,80;60,60);(70,60;70,80;90,80;90,60);(0,100;0,130;30,130;30,100)");
EXPECT_EQ (o.selected_inside (rr).count () + o.selected_not_inside (rr).count (), size_t (6));
EXPECT_EQ (o.selected_inside (rr).hier_count () + o.selected_not_inside (rr).hier_count (), size_t (6));
o.select_not_inside (rr);
EXPECT_EQ (o.to_string (), "(0,0;0,20;20,20;20,0);(50,10;50,30;70,30;70,10);(70,60;70,80;90,80;90,60);(0,60;0,80;60,80;60,60);(0,100;0,130;30,130;30,100)");
EXPECT_EQ (o.to_string (), "(0,0;0,20;20,20;20,0);(50,10;50,30;70,30;70,10);(0,60;0,80;60,80;60,60);(70,60;70,80;90,80;90,60);(0,100;0,130;30,130;30,100)");
}
EXPECT_EQ (r.selected_interacting (rr).to_string (), "(0,0;0,20;20,20;20,0);(20,30;20,50;40,50;40,30);(50,10;50,30;70,30;70,10);(0,60;0,80;60,80;60,60);(0,100;0,130;30,130;30,100)");
{
@ -711,7 +715,8 @@ TEST(18a)
EXPECT_EQ (o.to_string (), "(0,0;0,20;20,20;20,0);(20,30;20,50;40,50;40,30);(50,10;50,30;70,30;70,10);(0,60;0,80;60,80;60,60);(0,100;0,130;30,130;30,100)");
o = r;
EXPECT_EQ (o.selected_not_interacting (rr).to_string (), "(70,60;70,80;90,80;90,60)");
EXPECT_EQ (o.selected_interacting (rr).size () + o.selected_not_interacting (rr).size (), size_t (6));
EXPECT_EQ (o.selected_interacting (rr).count () + o.selected_not_interacting (rr).count (), size_t (6));
EXPECT_EQ (o.selected_interacting (rr).hier_count () + o.selected_not_interacting (rr).hier_count (), size_t (6));
o.select_not_interacting (rr);
EXPECT_EQ (o.to_string (), "(70,60;70,80;90,80;90,60)");
}
@ -722,7 +727,8 @@ TEST(18a)
EXPECT_EQ (o.to_string (), "(0,0;0,20;20,20;20,0);(20,30;20,50;40,50;40,30);(0,60;0,80;60,80;60,60);(0,100;0,130;30,130;30,100)");
o = r;
EXPECT_EQ (o.selected_not_overlapping (rr).to_string (), "(50,10;50,30;70,30;70,10);(70,60;70,80;90,80;90,60)");
EXPECT_EQ (o.selected_overlapping (rr).size () + o.selected_not_overlapping (rr).size (), size_t (6));
EXPECT_EQ (o.selected_overlapping (rr).count () + o.selected_not_overlapping (rr).count (), size_t (6));
EXPECT_EQ (o.selected_overlapping (rr).hier_count () + o.selected_not_overlapping (rr).hier_count (), size_t (6));
o.select_not_overlapping (rr);
EXPECT_EQ (o.to_string (), "(50,10;50,30;70,30;70,10);(70,60;70,80;90,80;90,60)");
}
@ -898,12 +904,12 @@ TEST(18d)
EXPECT_EQ (r.pull_inside (rr).to_string (), "(10,110;10,120;20,120;20,110)");
EXPECT_EQ (r.pull_interacting (rr).to_string (), "(10,0;10,90;50,90;50,10;20,10;20,0);(10,110;10,120;20,120;20,110)");
EXPECT_EQ (r.pull_overlapping (rr).to_string (), "(10,0;10,90;50,90;50,10;20,10;20,0);(10,110;10,120;20,120;20,110)");
EXPECT_EQ (r.pull_interacting (rr).to_string (), "(10,110;10,120;20,120;20,110);(10,0;10,90;50,90;50,10;20,10;20,0)");
EXPECT_EQ (r.pull_overlapping (rr).to_string (), "(10,110;10,120;20,120;20,110);(10,0;10,90;50,90;50,10;20,10;20,0)");
rr.set_merged_semantics (false);
EXPECT_EQ (r.pull_interacting (rr).to_string (), "(10,0;10,10;20,10;20,0);(10,10;10,90;50,90;50,10);(10,110;10,120;20,120;20,110)");
EXPECT_EQ (r.pull_overlapping (rr).to_string (), "(10,10;10,90;50,90;50,10);(10,110;10,120;20,120;20,110)");
EXPECT_EQ (r.pull_interacting (rr).to_string (), "(10,110;10,120;20,120;20,110);(10,10;10,90;50,90;50,10);(10,0;10,10;20,10;20,0)");
EXPECT_EQ (r.pull_overlapping (rr).to_string (), "(10,110;10,120;20,120;20,110);(10,10;10,90;50,90;50,10)");
}
TEST(19)
@ -972,7 +978,8 @@ TEST(20)
EXPECT_EQ (r1.perimeter (), db::Region::perimeter_type (320));
EXPECT_EQ (r1.bbox ().to_string (), "(120,20;220,140)");
EXPECT_EQ (r1.is_box (), false);
EXPECT_EQ (r1.size (), size_t (2));
EXPECT_EQ (r1.count (), size_t (2));
EXPECT_EQ (r1.hier_count (), size_t (2));
EXPECT_EQ (r1.empty (), false);
db::RegionPerimeterFilter f0 (0, 100, false);
@ -985,12 +992,14 @@ TEST(20)
EXPECT_EQ (r2.perimeter (), db::Region::perimeter_type (320));
EXPECT_EQ (r2.bbox ().to_string (), "(120,20;220,140)");
EXPECT_EQ (r2.is_box (), false);
EXPECT_EQ (r2.size (), size_t (2));
EXPECT_EQ (r2.count (), size_t (2));
EXPECT_EQ (r2.hier_count (), size_t (2));
EXPECT_EQ (r2.empty (), false);
r2.filter (f0);
EXPECT_EQ (r2.has_valid_polygons (), true);
EXPECT_EQ (r2.to_string (), "(120,20;120,40;140,40;140,20)");
EXPECT_EQ (r2.size (), size_t (1));
EXPECT_EQ (r2.count (), size_t (1));
EXPECT_EQ (r2.hier_count (), size_t (1));
EXPECT_EQ (r2.empty (), false);
EXPECT_EQ (r2.is_box (), true);
EXPECT_EQ (r2.area (), 400);
@ -1000,7 +1009,8 @@ TEST(20)
EXPECT_EQ (r1.has_valid_polygons (), true);
EXPECT_EQ (r1.to_string (), "(120,20;120,40;140,40;140,20);(160,80;160,140;220,140;220,80);(0,0;0,20;10,20;10,0)");
EXPECT_EQ (r1.to_string (2), "(120,20;120,40;140,40;140,20);(160,80;160,140;220,140;220,80)...");
EXPECT_EQ (r1.size (), size_t (3));
EXPECT_EQ (r1.count (), size_t (3));
EXPECT_EQ (r1.hier_count (), size_t (3));
EXPECT_EQ (r1.area (), 4200);
EXPECT_EQ (r1.perimeter (), db::Region::perimeter_type (380));
@ -1018,7 +1028,8 @@ TEST(20)
EXPECT_EQ (r1.to_string (), "(120,20;120,40;140,40;140,20)");
EXPECT_EQ (r1.has_valid_polygons (), false);
EXPECT_EQ (r1.is_box (), true);
EXPECT_EQ (r1.size (), size_t (1));
EXPECT_EQ (r1.count (), size_t (1));
EXPECT_EQ (r1.hier_count (), size_t (1));
EXPECT_EQ (r1.empty (), false);
db::Region r2 = r1;
@ -1030,7 +1041,8 @@ TEST(20)
r1.clear ();
EXPECT_EQ (r1.has_valid_polygons (), true);
EXPECT_EQ (r1.size (), size_t (0));
EXPECT_EQ (r1.count (), size_t (0));
EXPECT_EQ (r1.hier_count (), size_t (0));
EXPECT_EQ (r1.empty (), true);
EXPECT_EQ (r1.perimeter (), db::Region::perimeter_type (0));
EXPECT_EQ (r1.area (), 0);
@ -1041,7 +1053,8 @@ TEST(20)
EXPECT_EQ (r1.to_string (), "(120,20;120,40;140,40;140,20)");
EXPECT_EQ (r1.has_valid_polygons (), false);
EXPECT_EQ (r2.has_valid_polygons (), true);
EXPECT_EQ (r2.size (), size_t (0));
EXPECT_EQ (r2.count (), size_t (0));
EXPECT_EQ (r2.hier_count (), size_t (0));
EXPECT_EQ (r2.empty (), true);
EXPECT_EQ (r2.perimeter (), db::Region::perimeter_type (0));
EXPECT_EQ (r2.area (), 0);
@ -1074,7 +1087,7 @@ TEST(20)
{
db::Region r1 (db::RecursiveShapeIterator (ly, ly.cell (top), l2));
EXPECT_EQ (r1.has_valid_polygons (), false);
EXPECT_EQ (r1.space_check (30).to_string (), "(60,10;60,20)/(40,40;40,10);(60,20;70,20)/(92,40;80,40);(70,20;70,12)/(80,40;80,48)");
EXPECT_EQ (r1.space_check (30).to_string (), "(60,20;70,20)/(92,40;80,40);(70,20;70,12)/(80,40;80,48);(60,10;60,20)/(40,40;40,10)");
EXPECT_EQ (r1.space_check (2).to_string (), "");
}
@ -1083,7 +1096,7 @@ TEST(20)
EXPECT_EQ (r1.has_valid_polygons (), false);
db::Region r2 (db::RecursiveShapeIterator (ly, ly.cell (top), l2));
EXPECT_EQ (r2.has_valid_polygons (), false);
EXPECT_EQ (r1.separation_check (r2, 20).to_string (), "(50,0;50,30)/(40,40;40,10);(63,30;80,30)/(97,40;80,40);(50,40;50,57)/(40,40;40,23);(80,70;80,40)/(80,40;80,70)");
EXPECT_EQ (r1.separation_check (r2, 20).to_string (), "(50,0;50,30)/(40,40;40,10);(50,40;50,57)/(40,40;40,23);(63,30;80,30)/(97,40;80,40);(80,70;80,40)/(80,40;80,70)");
}
{

View File

@ -38,13 +38,15 @@ TEST(1)
EXPECT_EQ (texts != db::Texts (), false);
texts.insert (db::Text ("abc", db::Trans (db::Vector (100, -200))));
EXPECT_EQ (texts.empty (), false);
EXPECT_EQ (texts.size (), size_t (1));
EXPECT_EQ (texts.count (), size_t (1));
EXPECT_EQ (texts.hier_count (), size_t (1));
EXPECT_EQ (texts.bbox ().to_string (), "(100,-200;100,-200)");
EXPECT_EQ (texts.to_string (), "('abc',r0 100,-200)");
texts.clear ();
EXPECT_EQ (texts.empty (), true);
EXPECT_EQ (texts.size (), size_t (0));
EXPECT_EQ (texts.count (), size_t (0));
EXPECT_EQ (texts.hier_count (), size_t (0));
EXPECT_EQ (texts.bbox ().to_string (), "()");
texts.insert (db::Text ("uvw", db::Trans (db::Vector (110, 210))));
EXPECT_EQ (texts == db::Texts (), false);
@ -66,14 +68,17 @@ TEST(1)
db::Texts texts2;
EXPECT_EQ (texts2.empty (), true);
EXPECT_EQ (texts2.size (), size_t (0));
EXPECT_EQ (texts2.count (), size_t (0));
EXPECT_EQ (texts2.hier_count (), size_t (0));
EXPECT_EQ (texts2.bbox ().to_string (), "()");
texts2.swap (texts);
EXPECT_EQ (texts.empty (), true);
EXPECT_EQ (texts.size (), size_t (0));
EXPECT_EQ (texts.count (), size_t (0));
EXPECT_EQ (texts.hier_count (), size_t (0));
EXPECT_EQ (texts.bbox ().to_string (), "()");
EXPECT_EQ (texts2.empty (), false);
EXPECT_EQ (texts2.size (), size_t (1));
EXPECT_EQ (texts2.count (), size_t (1));
EXPECT_EQ (texts2.hier_count (), size_t (1));
EXPECT_EQ (texts2.bbox ().to_string (), "(210,-110;210,-110)");
}

View File

@ -277,9 +277,9 @@ TEST(3)
}
EXPECT_EQ (or2.has_valid_polygons (), true);
EXPECT_EQ (or2.size () / 2000, size_t (50)); // because we use rand () the value may vary - it's only accurate to 2%
EXPECT_EQ (or2.count () / 2000, size_t (50)); // because we use rand () the value may vary - it's only accurate to 2%
EXPECT_EQ (or2_copy.has_valid_polygons (), true);
EXPECT_EQ (or2_copy.size () / 2000, size_t (40)); // because we use rand () the value may vary - it's only accurate to 2%
EXPECT_EQ (or2_copy.count () / 2000, size_t (40)); // because we use rand () the value may vary - it's only accurate to 2%
EXPECT_EQ ((or2 ^ or2_copy).empty (), true);
#if 0

View File

@ -809,7 +809,7 @@ XORWorker::do_perform_deep (const XORTask *xor_task)
// TODO: no clipping for hieararchical mode yet
mp_job->issue_region (tol_index, xor_task->layer_index (), rr);
mp_job->add_results (xor_task->lp (), *t, rr.size (), xor_task->ix (), xor_task->iy ());
mp_job->add_results (xor_task->lp (), *t, rr.count (), xor_task->ix (), xor_task->iy ());
} else if (mp_job->op () == db::BooleanOp::Xor ||
(mp_job->op () == db::BooleanOp::ANotB && !la.empty ()) ||

View File

@ -58,7 +58,7 @@ def run_testsuite(dm, ic, tiled = false)
a.join(b).xor(a + b).is_empty? || raise("xor not empty")
if !tiled
a.join(b).data.size == 16 * ic || raise("unexpected shape count")
a.join(b).data.count == 16 * ic || raise("unexpected shape count")
end
c.raw.is_clean? == false || raise("unexpected value")

View File

@ -31,7 +31,8 @@ class DBEdges_TestClass < TestBase
r = RBA::Edges::new
assert_equal(r.to_s, "")
assert_equal(r.is_empty?, true)
assert_equal(r.size, 0)
assert_equal(r.count, 0)
assert_equal(r.hier_count, 0)
assert_equal(r.bbox.to_s, "()")
assert_equal(r.is_merged?, true)
data_id = r.data_id
@ -40,21 +41,24 @@ class DBEdges_TestClass < TestBase
assert_equal(data_id != r.data_id, true)
assert_equal(r.to_s, "(10,20;100,200)")
assert_equal(r.is_empty?, false)
assert_equal(r.size, 1)
assert_equal(r.count, 1)
assert_equal(r.hier_count, 1)
assert_equal(r.bbox.to_s, "(10,20;100,200)")
assert_equal(r.is_merged?, true)
r.assign(RBA::Edges::new([RBA::Edge::new(10, 20, 100, 200), RBA::Edge::new(11, 21, 101, 201)]))
assert_equal(r.to_s, "(10,20;100,200);(11,21;101,201)")
assert_equal(r.is_empty?, false)
assert_equal(r.size, 2)
assert_equal(r.count, 2)
assert_equal(r.hier_count, 2)
assert_equal(r.bbox.to_s, "(10,20;101,201)")
assert_equal(r.is_merged?, false)
r.assign(RBA::Edges::new(RBA::Edge::new(10, 20, 100, 200)))
assert_equal(r.to_s, "(10,20;100,200)")
assert_equal(r.is_empty?, false)
assert_equal(r.size, 1)
assert_equal(r.count, 1)
assert_equal(r.hier_count, 1)
assert_equal(r.bbox.to_s, "(10,20;100,200)")
assert_equal(r.is_merged?, true)
@ -67,7 +71,8 @@ class DBEdges_TestClass < TestBase
end
assert_equal(s, "(10,20;10,200);(10,200;100,200);(100,200;100,20);(100,20;10,20)")
assert_equal(r.is_empty?, false)
assert_equal(r.size, 4)
assert_equal(r.count, 4)
assert_equal(r.hier_count, 4)
assert_equal(r.bbox.to_s, "(10,20;100,200)")
assert_equal(r.is_merged?, true)
@ -97,21 +102,24 @@ class DBEdges_TestClass < TestBase
r.clear
assert_equal(r.to_s, "")
assert_equal(r.is_empty?, true)
assert_equal(r.size, 0)
assert_equal(r.count, 0)
assert_equal(r.hier_count, 0)
assert_equal(r.bbox.to_s, "()")
assert_equal(r.is_merged?, true)
r = RBA::Edges::new(RBA::Polygon::new(RBA::Box::new(10, 20, 100, 200)))
assert_equal(r.to_s, "(10,20;10,200);(10,200;100,200);(100,200;100,20);(100,20;10,20)")
assert_equal(r.is_empty?, false)
assert_equal(r.size, 4)
assert_equal(r.count, 4)
assert_equal(r.hier_count, 4)
assert_equal(r.bbox.to_s, "(10,20;100,200)")
assert_equal(r.is_merged?, false)
r = RBA::Edges::new(RBA::SimplePolygon::new(RBA::Box::new(10, 20, 100, 200)))
assert_equal(r.to_s, "(10,20;10,200);(10,200;100,200);(100,200;100,20);(100,20;10,20)")
assert_equal(r.is_empty?, false)
assert_equal(r.size, 4)
assert_equal(r.count, 4)
assert_equal(r.hier_count, 4)
assert_equal(r.bbox.to_s, "(10,20;100,200)")
assert_equal(r.length, 2*90+2*180)
assert_equal(r.length(RBA::Box::new(0, 0, 50, 50)), 70)
@ -133,7 +141,8 @@ class DBEdges_TestClass < TestBase
assert_equal(r.extents(10).to_s, "(-10,-20;-10,20;10,20;10,-20);(-10,0;-10,20;110,20;110,0);(90,-20;90,20;110,20;110,-20);(-10,-20;-10,0;110,0;110,-20)")
assert_equal(r.extents(5, -5).to_s, "(-5,-5;-5,5;5,5;5,-5);(95,-5;95,5;105,5;105,-5)")
assert_equal(r.is_empty?, false)
assert_equal(r.size, 4)
assert_equal(r.count, 4)
assert_equal(r.hier_count, 4)
assert_equal(r.bbox.to_s, "(0,-10;100,10)")
assert_equal(r.is_merged?, false)
@ -143,7 +152,8 @@ class DBEdges_TestClass < TestBase
] )
assert_equal(r.to_s, "(10,20;10,200);(10,200;100,200);(100,200;100,20);(100,20;10,20);(20,50;20,250);(20,250;120,250);(120,250;120,50);(120,50;20,50)")
assert_equal(r.is_empty?, false)
assert_equal(r.size, 8)
assert_equal(r.count, 8)
assert_equal(r.hier_count, 8)
assert_equal(r.bbox.to_s, "(10,20;120,250)")
assert_equal(r.is_merged?, false)
@ -162,7 +172,8 @@ class DBEdges_TestClass < TestBase
assert_equal(r.to_s(30), "(-10,-20;-10,20);(-10,20;10,20);(10,20;10,-20);(10,-20;-10,-20);(-10,80;-10,120);(-10,120;10,120);(10,120;10,80);(10,80;-10,80);(190,80;190,120);(190,120;210,120);(210,120;210,80);(210,80;190,80)")
assert_equal(r.to_s(2), "(-10,-20;-10,20);(-10,20;10,20)...")
assert_equal(r.is_empty?, false)
assert_equal(r.size, 12)
assert_equal(r.count, 12)
assert_equal(r.hier_count, 12)
assert_equal(r[1].to_s, "(-10,20;10,20)")
assert_equal(r[100].to_s, "")
assert_equal(r.bbox.to_s, "(-10,-20;210,120)")
@ -172,7 +183,8 @@ class DBEdges_TestClass < TestBase
assert_equal(r.to_s(30), "(-10,-20;10,20);(-10,80;10,120);(190,80;210,120)")
assert_equal(r.to_s(2), "(-10,-20;10,20);(-10,80;10,120)...")
assert_equal(r.is_empty?, false)
assert_equal(r.size, 3)
assert_equal(r.count, 3)
assert_equal(r.hier_count, 3)
assert_equal(r.bbox.to_s, "(-10,-20;210,120)")
assert_equal(r.is_merged?, false)
assert_equal(r.has_valid_edges?, false)
@ -187,7 +199,8 @@ class DBEdges_TestClass < TestBase
r = RBA::Edges::new(ly.begin_shapes(c1.cell_index, l1), RBA::ICplxTrans::new(10, 20), true)
assert_equal(r.to_s(30), "(0,0;0,40);(0,40;20,40);(20,40;20,0);(20,0;0,0);(0,100;0,140);(0,140;20,140);(20,140;20,100);(20,100;0,100);(200,100;200,140);(200,140;220,140);(220,140;220,100);(220,100;200,100)")
assert_equal(r.is_empty?, false)
assert_equal(r.size, 12)
assert_equal(r.count, 12)
assert_equal(r.hier_count, 12)
assert_equal(r.bbox.to_s, "(0,0;220,140)")
assert_equal(r.is_merged?, false)
@ -198,7 +211,8 @@ class DBEdges_TestClass < TestBase
r = RBA::Edges::new(ly.begin_shapes(c1.cell_index, l2), RBA::ICplxTrans::new(10, 20), false)
assert_equal(r.to_s(30), "(0,0;20,40);(0,100;20,140);(200,100;220,140)")
assert_equal(r.is_empty?, false)
assert_equal(r.size, 3)
assert_equal(r.count, 3)
assert_equal(r.hier_count, 3)
assert_equal(r.bbox.to_s, "(0,0;220,140)")
assert_equal(r.is_merged?, false)
@ -596,7 +610,8 @@ class DBEdges_TestClass < TestBase
assert_equal(r.is_deep?, false)
assert_equal(r.size, 12)
assert_equal(r.count, 12)
assert_equal(r.hier_count, 12)
assert_equal(r[1].to_s, "(-10,20;10,20)")
assert_equal(r[100].to_s, "")

View File

@ -31,7 +31,8 @@ class DBRegion_TestClass < TestBase
r = RBA::Region::new
assert_equal(r.to_s, "")
assert_equal(r.is_empty?, true)
assert_equal(r.size, 0)
assert_equal(r.count, 0)
assert_equal(r.hier_count, 0)
assert_equal(r.bbox.to_s, "()")
assert_equal(r.is_merged?, true)
assert_equal(r.is_box?, false)
@ -41,7 +42,8 @@ class DBRegion_TestClass < TestBase
assert_equal(data_id != r.data_id, true)
assert_equal(r.to_s, "(10,20;10,200;100,200;100,20)")
assert_equal(r.is_empty?, false)
assert_equal(r.size, 1)
assert_equal(r.count, 1)
assert_equal(r.hier_count, 1)
assert_equal(r.bbox.to_s, "(10,20;100,200)")
assert_equal(r.is_merged?, true)
assert_equal(r.is_box?, true)
@ -73,7 +75,8 @@ class DBRegion_TestClass < TestBase
r.clear
assert_equal(r.to_s, "")
assert_equal(r.is_empty?, true)
assert_equal(r.size, 0)
assert_equal(r.count, 0)
assert_equal(r.hier_count, 0)
assert_equal(r.bbox.to_s, "()")
assert_equal(r.is_merged?, true)
assert_equal(r.is_box?, false)
@ -82,7 +85,8 @@ class DBRegion_TestClass < TestBase
assert_equal(r.to_s, "(10,20;10,200;100,200;100,20)")
assert_equal(r.is_empty?, false)
assert_equal(r.is_box?, true)
assert_equal(r.size, 1)
assert_equal(r.count, 1)
assert_equal(r.hier_count, 1)
assert_equal(r.bbox.to_s, "(10,20;100,200)")
assert_equal(r.is_merged?, false)
@ -90,7 +94,8 @@ class DBRegion_TestClass < TestBase
assert_equal(r.to_s, "(10,20;10,200;100,200;100,20)")
assert_equal(r.is_empty?, false)
assert_equal(r.is_box?, true)
assert_equal(r.size, 1)
assert_equal(r.count, 1)
assert_equal(r.hier_count, 1)
assert_equal(r.bbox.to_s, "(10,20;100,200)")
assert_equal(r.area, 90*180)
assert_equal(r.perimeter, 2*90+2*180)
@ -101,7 +106,8 @@ class DBRegion_TestClass < TestBase
assert_equal(r.to_s, "(0,-10;0,10;100,10;100,-10)")
assert_equal(r.is_box?, true)
assert_equal(r.is_empty?, false)
assert_equal(r.size, 1)
assert_equal(r.count, 1)
assert_equal(r.hier_count, 1)
assert_equal(r.bbox.to_s, "(0,-10;100,10)")
assert_equal(r.is_merged?, false)
@ -125,7 +131,8 @@ class DBRegion_TestClass < TestBase
assert_equal(r.merged(3).to_s, "")
assert_equal(r.is_empty?, false)
assert_equal(r.is_box?, false)
assert_equal(r.size, 2)
assert_equal(r.count, 2)
assert_equal(r.hier_count, 2)
assert_equal(r.bbox.to_s, "(10,20;120,250)")
assert_equal(r.is_merged?, false)
@ -151,7 +158,8 @@ class DBRegion_TestClass < TestBase
r = RBA::Region::new(ly.begin_shapes(c1.cell_index, l1))
assert_equal(r.to_s, "(-10,-20;-10,20;10,20;10,-20);(-10,80;-10,120;10,120;10,80);(190,80;190,120;210,120;210,80)")
assert_equal(r.is_empty?, false)
assert_equal(r.size, 3)
assert_equal(r.count, 3)
assert_equal(r.hier_count, 3)
assert_equal(r.bbox.to_s, "(-10,-20;210,120)")
assert_equal(r.is_merged?, false)
assert_equal(r.has_valid_polygons?, false)
@ -179,7 +187,8 @@ class DBRegion_TestClass < TestBase
assert_equal(r.extents(5, -5).to_s, "(-5,5;-5,35;25,35;25,5);(-5,105;-5,135;25,135;25,105);(195,105;195,135;225,135;225,105)")
assert_equal(r.is_empty?, false)
assert_equal(r.is_box?, false)
assert_equal(r.size, 3)
assert_equal(r.count, 3)
assert_equal(r.hier_count, 3)
assert_equal(r.bbox.to_s, "(0,0;220,140)")
assert_equal(r.is_merged?, false)
@ -258,7 +267,7 @@ class DBRegion_TestClass < TestBase
r2 = RBA::Region::new(RBA::Box::new(-10, -20, 80, 160))
assert_equal((r1 & r2).to_s, "(10,20;10,160;80,160;80,20)")
assert_equal(r1.andnot(r2).size, 2)
assert_equal(r1.andnot(r2).count, 2)
assert_equal(r1.andnot(r2)[0].to_s, "(10,20;10,160;80,160;80,20)")
rr = r1.dup
rr &= r2
@ -461,23 +470,23 @@ class DBRegion_TestClass < TestBase
assert_equal(r3a.separation_check(r1, 15, false, RBA::Region::Projection, nil, 380, 500).to_s, "")
assert_equal(r3a.separation_check(r1, 15, false, RBA::Region::Projection, nil, 0, 300).to_s, "(-10,10;-10,0)/(0,0;0,10)")
assert_equal(r3b.overlap_check(r1, 15).to_s, "(-10,10;10,10)/(21,0;0,0);(10,10;10,-10)/(0,0;0,21)")
assert_equal(r3b.overlap_check(r1, 15, false, RBA::Region::Projection, nil, nil, nil).to_s, "(0,10;10,10)/(10,0;0,0);(10,10;10,0)/(0,0;0,10)")
assert_equal(r3b.overlap_check(r1, 15, true, RBA::Region::Projection, nil, nil, nil).to_s, "(-10,10;10,10)/(100,0;0,0);(10,10;10,-10)/(0,0;0,200)")
assert_equal(r3b.overlap_check(r1, 15).to_s, "(10,10;10,-10)/(0,0;0,21);(-10,10;10,10)/(21,0;0,0)")
assert_equal(r3b.overlap_check(r1, 15, false, RBA::Region::Projection, nil, nil, nil).to_s, "(10,10;10,0)/(0,0;0,10);(0,10;10,10)/(10,0;0,0)")
assert_equal(r3b.overlap_check(r1, 15, true, RBA::Region::Projection, nil, nil, nil).to_s, "(10,10;10,-10)/(0,0;0,200);(-10,10;10,10)/(100,0;0,0)")
assert_equal(r3b.overlap_check(r1, 15, true, RBA::Region::Projection, 0.0, nil, nil).to_s, "")
assert_equal(r3b.overlap_check(r1, 15, false, RBA::Region::Projection, nil, 0, 500).to_s, "(0,10;10,10)/(10,0;0,0);(10,10;10,0)/(0,0;0,10)")
assert_equal(r3b.overlap_check(r1, 15, false, RBA::Region::Projection, nil, 0, 500).to_s, "(10,10;10,0)/(0,0;0,10);(0,10;10,10)/(10,0;0,0)")
assert_equal(r3b.overlap_check(r1, 15, false, RBA::Region::Projection, nil, 380, 500).to_s, "")
assert_equal(r3b.overlap_check(r1, 15, false, RBA::Region::Projection, nil, 0, 300).to_s, "(0,10;10,10)/(10,0;0,0);(10,10;10,0)/(0,0;0,10)")
assert_equal(r3b.overlap_check(r1, 15, false, RBA::Region::Projection, nil, 0, 300).to_s, "(10,10;10,0)/(0,0;0,10);(0,10;10,10)/(10,0;0,0)")
assert_equal((r1 | r2).merged.isolated_check(25).to_s, "(120,20;120,380)/(100,395;100,5)")
assert_equal((r1 | r2).merged.isolated_check(25, false, RBA::Region::Projection, nil, nil, nil).to_s, "(120,20;120,380)/(100,380;100,20)")
assert_equal((r1 | r2).merged.isolated_check(25, false, RBA::Region::Square, nil, nil, nil).to_s, "(120,20;120,380)/(100,400;100,0)")
assert_equal((r1 | r2).merged.isolated_check(25, false, RBA::Region::Euclidian, nil, nil, nil).to_s, "(120,20;120,380)/(100,395;100,5)")
assert_equal((r1 | r2).merged.isolated_check(25, true, RBA::Region::Euclidian, nil, nil, nil).to_s, "(120,20;120,380)/(100,400;100,0)")
assert_equal((r1 | r2).merged.isolated_check(25).to_s, "(100,395;100,5)/(120,20;120,380)")
assert_equal((r1 | r2).merged.isolated_check(25, false, RBA::Region::Projection, nil, nil, nil).to_s, "(100,380;100,20)/(120,20;120,380)")
assert_equal((r1 | r2).merged.isolated_check(25, false, RBA::Region::Square, nil, nil, nil).to_s, "(100,400;100,0)/(120,20;120,380)")
assert_equal((r1 | r2).merged.isolated_check(25, false, RBA::Region::Euclidian, nil, nil, nil).to_s, "(100,395;100,5)/(120,20;120,380)")
assert_equal((r1 | r2).merged.isolated_check(25, true, RBA::Region::Euclidian, nil, nil, nil).to_s, "(100,400;100,0)/(120,20;120,380)")
assert_equal((r1 | r2).merged.isolated_check(25, false, RBA::Region::Euclidian, 0.0, nil, nil).to_s, "")
assert_equal((r1 | r2).merged.isolated_check(25, false, RBA::Region::Euclidian, nil, 0, 300).to_s, "")
assert_equal((r1 | r2).merged.isolated_check(25, false, RBA::Region::Euclidian, nil, 300, 500).to_s, "(120,20;120,380)/(100,395;100,5)")
assert_equal((r1 | r2).merged.isolated_check(25, false, RBA::Region::Euclidian, nil, 300, nil).to_s, "(120,20;120,380)/(100,395;100,5)")
assert_equal((r1 | r2).merged.isolated_check(25, false, RBA::Region::Euclidian, nil, 300, 500).to_s, "(100,395;100,5)/(120,20;120,380)")
assert_equal((r1 | r2).merged.isolated_check(25, false, RBA::Region::Euclidian, nil, 300, nil).to_s, "(100,395;100,5)/(120,20;120,380)")
assert_equal((r1 | r2).merged.notch_check(25).to_s, "(0,200;50,200)/(50,220;10,220)")
assert_equal((r1 | r2).merged.notch_check(25, false, RBA::Region::Projection, nil, nil, nil).to_s, "(10,200;50,200)/(50,220;10,220)")
@ -488,9 +497,9 @@ class DBRegion_TestClass < TestBase
assert_equal((r1 | r2).merged.notch_check(25, true, RBA::Region::Projection, nil, 40, 50).to_s, "(0,200;50,200)/(50,220;10,220)")
assert_equal((r1 | r2).merged.notch_check(25, true, RBA::Region::Projection, nil, nil, 40).to_s, "")
assert_equal((r1 | r2).merged.space_check(25).to_s, "(120,20;120,380)/(100,395;100,5);(0,200;50,200)/(50,220;10,220)")
assert_equal((r1 | r2).merged.space_check(25, false, RBA::Region::Projection, nil, nil, nil).to_s, "(120,20;120,380)/(100,380;100,20);(10,200;50,200)/(50,220;10,220)")
assert_equal((r1 | r2).merged.space_check(25, true, RBA::Region::Projection, nil, nil, nil).to_s, "(120,20;120,380)/(100,400;100,0);(0,200;50,200)/(50,220;10,220)")
assert_equal((r1 | r2).merged.space_check(25).to_s, "(0,200;50,200)/(50,220;10,220);(120,20;120,380)/(100,395;100,5)")
assert_equal((r1 | r2).merged.space_check(25, false, RBA::Region::Projection, nil, nil, nil).to_s, "(10,200;50,200)/(50,220;10,220);(120,20;120,380)/(100,380;100,20)")
assert_equal((r1 | r2).merged.space_check(25, true, RBA::Region::Projection, nil, nil, nil).to_s, "(0,200;50,200)/(50,220;10,220);(120,20;120,380)/(100,400;100,0)")
assert_equal((r1 | r2).merged.space_check(25, true, RBA::Region::Projection, 0.0, nil, nil).to_s, "")
assert_equal((r1 | r2).merged.space_check(25, true, RBA::Region::Projection, nil, 50, nil).to_s, "(120,20;120,380)/(100,400;100,0)")
assert_equal((r1 | r2).merged.space_check(25, true, RBA::Region::Projection, nil, nil, 50).to_s, "(0,200;50,200)/(50,220;10,220)")
@ -933,7 +942,11 @@ class DBRegion_TestClass < TestBase
assert_equal(r.is_deep?, true)
assert_equal(r.area, 53120000)
assert_equal(r.count, 10)
assert_equal(r.hier_count, 1)
assert_equal(rf.area, 53120000)
assert_equal(rf.count, 10)
assert_equal(rf.hier_count, 10)
ly_new = RBA::Layout::new
tc = ly_new.add_cell("TOP")

View File

@ -81,6 +81,10 @@ class DBShapes_TestClass < TestBase
shapes.each( RBA::Shapes::SBoxes ) { |s| arr.push( s.box.to_s ) }
assert_equal( arr, ["(10,-10;50,40)", "(100,-10;150,40)", "(200,-10;250,40)"] )
arr = []
shapes.each( RBA::Shapes::SRegions ) { |s| arr.push( s.box.to_s ) }
assert_equal( arr, ["(10,-10;50,40)", "(100,-10;150,40)", "(200,-10;250,40)"] )
arr = []
shapes.each( RBA::Shapes::SPolygons ) { |s| arr.push( s.box.to_s ) }
assert_equal( arr, [] )
@ -256,8 +260,7 @@ class DBShapes_TestClass < TestBase
a = RBA::SimplePolygon::new( [ RBA::Point::new( 0, 1 ), RBA::Point::new( 1, 5 ), RBA::Point::new( 5, 5 ) ] )
b = RBA::Polygon::new( [ RBA::Point::new( 0, 1 ), RBA::Point::new( 1, 5 ), RBA::Point::new( 5, 5 ) ] )
c1.shapes( lindex ).insert( a )
arr = []
shapes.each( RBA::Shapes::SPolygons ) { |s| arr.push( s ) }
arr = shapes.each( RBA::Shapes::SPolygons ).to_a
assert_equal( arr.size, 1 )
assert_equal( arr[0].prop_id, 0 )
assert_equal( arr[0].has_prop_id?, false )
@ -342,6 +345,13 @@ class DBShapes_TestClass < TestBase
assert_equal( arr.size, 1 )
assert_equal( arr[0].is_box?, true )
# All kind of polygonizable shapes:
assert_equal( shapes.each( RBA::Shapes::SRegions ).collect(&:to_s), [ "polygon (0,1;1,5;5,5/1,2;4,4;2,4)",
"simple_polygon (0,1;1,5;5,5)",
"path (0,10;10,50) w=25 bx=0 ex=0 r=false",
"box (10,-10;50,40)" ] )
end
# Shapes (double types)

View File

@ -31,7 +31,8 @@ class DBTexts_TestClass < TestBase
r = RBA::Texts::new
assert_equal(r.to_s, "")
assert_equal(r.is_empty?, true)
assert_equal(r.size, 0)
assert_equal(r.count, 0)
assert_equal(r.hier_count, 0)
assert_equal(r.bbox.to_s, "()")
data_id = r.data_id
@ -47,7 +48,8 @@ class DBTexts_TestClass < TestBase
assert_equal(r.extents(5, 10).to_s, "(105,200;105,220;115,220;115,200)")
assert_equal(r.edges.to_s, "(110,210;110,210)")
assert_equal(r.is_empty?, false)
assert_equal(r.size, 1)
assert_equal(r.count, 1)
assert_equal(r.hier_count, 1)
assert_equal(r[0].to_s, "('uvw',r0 110,210)")
assert_equal(r[1].to_s, "")
assert_equal(r.bbox.to_s, "(110,210;110,210)")
@ -81,7 +83,8 @@ class DBTexts_TestClass < TestBase
assert_equal(r.to_s, "")
assert_equal(r.is_empty?, true)
assert_equal(r.size, 0)
assert_equal(r.count, 0)
assert_equal(r.hier_count, 0)
assert_equal(r.bbox.to_s, "()")
texts = RBA::Texts::new
@ -148,7 +151,8 @@ class DBTexts_TestClass < TestBase
assert_equal(r.to_s(30), "('abc',r0 100,-200);('abc',r0 100,-100);('abc',r0 300,-100)")
assert_equal(r.to_s(2), "('abc',r0 100,-200);('abc',r0 100,-100)...")
assert_equal(r.is_empty?, false)
assert_equal(r.size, 3)
assert_equal(r.count, 3)
assert_equal(r.hier_count, 3)
assert_equal(r.has_valid_texts?, false)
assert_equal(r.bbox.to_s, "(100,-200;300,-100)")
@ -166,7 +170,8 @@ class DBTexts_TestClass < TestBase
assert_equal(r.to_s(30), "('abc',r0 100,-200);('abc',r0 100,-100);('abc',r0 300,-100)")
assert_equal(r.to_s(2), "('abc',r0 100,-200);('abc',r0 100,-100)...")
assert_equal(r.is_empty?, false)
assert_equal(r.size, 3)
assert_equal(r.count, 3)
assert_equal(r.hier_count, 1)
assert_equal(r.has_valid_texts?, false)
assert_equal(r.bbox.to_s, "(100,-200;300,-100)")