mirror of https://github.com/KLayout/klayout.git
WIP: made first unit tests functional again.
This commit is contained in:
parent
f604d149b5
commit
e595c32fe1
|
|
@ -369,22 +369,32 @@ AsIfFlatRegion::perimeter (const db::Box &box) const
|
|||
Box AsIfFlatRegion::bbox () const
|
||||
{
|
||||
if (! m_bbox_valid) {
|
||||
m_bbox = db::Box ();
|
||||
for (RegionIterator p (begin ()); ! p.at_end (); ++p) {
|
||||
m_bbox += p->box ();
|
||||
}
|
||||
m_bbox = compute_bbox ();
|
||||
m_bbox_valid = true;
|
||||
}
|
||||
|
||||
return m_bbox;
|
||||
}
|
||||
|
||||
Box AsIfFlatRegion::compute_bbox () const
|
||||
{
|
||||
db::Box b;
|
||||
for (RegionIterator p (begin ()); ! p.at_end (); ++p) {
|
||||
b += p->box ();
|
||||
}
|
||||
return b;
|
||||
}
|
||||
|
||||
void AsIfFlatRegion::update_bbox (const db::Box &b)
|
||||
{
|
||||
m_bbox = b;
|
||||
m_bbox_valid = true;
|
||||
}
|
||||
|
||||
void AsIfFlatRegion::invalidate_bbox ()
|
||||
{
|
||||
m_bbox_valid = false;
|
||||
}
|
||||
|
||||
RegionDelegate *
|
||||
AsIfFlatRegion::filtered (const PolygonFilterBase &filter) const
|
||||
{
|
||||
|
|
@ -1612,7 +1622,7 @@ namespace
|
|||
|
||||
|
||||
FlatRegion::FlatRegion ()
|
||||
: AsIfFlatRegion ()
|
||||
: AsIfFlatRegion (), m_polygons (false), m_merged_polygons (false)
|
||||
{
|
||||
init ();
|
||||
}
|
||||
|
|
@ -1751,18 +1761,10 @@ bool FlatRegion::is_merged () const
|
|||
return m_is_merged;
|
||||
}
|
||||
|
||||
void FlatRegion::set_box (const db::Box &b)
|
||||
Box FlatRegion::compute_bbox () const
|
||||
{
|
||||
m_polygons.clear ();
|
||||
if (! b.empty () && b.width () > 0 && b.height () > 0 ) {
|
||||
m_polygons.insert (db::Polygon (b));
|
||||
}
|
||||
|
||||
m_is_merged = true;
|
||||
update_bbox (b);
|
||||
|
||||
m_merged_polygons.clear ();
|
||||
m_merged_polygons_valid = false;
|
||||
m_polygons.update_bbox ();
|
||||
return m_polygons.bbox ();
|
||||
}
|
||||
|
||||
RegionDelegate *FlatRegion::filter_in_place (const PolygonFilterBase &filter)
|
||||
|
|
@ -2058,13 +2060,24 @@ namespace
|
|||
}
|
||||
|
||||
OriginalLayerRegion::OriginalLayerRegion ()
|
||||
: AsIfFlatRegion ()
|
||||
: AsIfFlatRegion (), m_merged_polygons (false)
|
||||
{
|
||||
init ();
|
||||
}
|
||||
|
||||
OriginalLayerRegion::OriginalLayerRegion (const OriginalLayerRegion &other)
|
||||
: AsIfFlatRegion (other),
|
||||
m_is_merged (other.m_is_merged),
|
||||
m_merged_polygons (other.m_merged_polygons),
|
||||
m_merged_polygons_valid (other.m_merged_polygons_valid),
|
||||
m_iter (other.m_iter),
|
||||
m_iter_trans (other.m_iter_trans)
|
||||
{
|
||||
// .. nothing yet ..
|
||||
}
|
||||
|
||||
OriginalLayerRegion::OriginalLayerRegion (const RecursiveShapeIterator &si, bool is_merged)
|
||||
: AsIfFlatRegion (), m_iter (si)
|
||||
: AsIfFlatRegion (), m_merged_polygons (false), m_iter (si)
|
||||
{
|
||||
init ();
|
||||
|
||||
|
|
@ -2072,7 +2085,7 @@ OriginalLayerRegion::OriginalLayerRegion (const RecursiveShapeIterator &si, bool
|
|||
}
|
||||
|
||||
OriginalLayerRegion::OriginalLayerRegion (const RecursiveShapeIterator &si, const db::ICplxTrans &trans, bool merged_semantics, bool is_merged)
|
||||
: AsIfFlatRegion (), m_iter (si), m_iter_trans (trans)
|
||||
: AsIfFlatRegion (), m_merged_polygons (false), m_iter (si), m_iter_trans (trans)
|
||||
{
|
||||
init ();
|
||||
|
||||
|
|
|
|||
|
|
@ -825,7 +825,7 @@ private:
|
|||
mutable bool m_bbox_valid;
|
||||
mutable db::Box m_bbox;
|
||||
|
||||
void ensure_bbox_valid ();
|
||||
virtual db::Box compute_bbox () const;
|
||||
static RegionDelegate *region_from_box (const db::Box &b);
|
||||
|
||||
EdgePairs run_check (db::edge_relation_type rel, bool different_polygons, const Region *other, db::Coord d, bool whole_edges, metrics_type metrics, double ignore_angle, distance_type min_projection, distance_type max_projection) const;
|
||||
|
|
@ -869,8 +869,6 @@ public:
|
|||
virtual size_t size () const;
|
||||
virtual bool is_merged () const;
|
||||
|
||||
virtual Box bbox () const;
|
||||
|
||||
virtual RegionDelegate *merged_in_place ();
|
||||
virtual RegionDelegate *merged_in_place (bool min_coherence, unsigned int min_wc);
|
||||
virtual RegionDelegate *merged () const;
|
||||
|
|
@ -930,11 +928,11 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
db::Shapes &raw_polygons ();
|
||||
db::Shapes &raw_polygons () { return m_polygons; }
|
||||
|
||||
protected:
|
||||
virtual void merged_semantics_changed ();
|
||||
void set_box (const db::Box &box);
|
||||
virtual Box compute_bbox () const;
|
||||
void invalidate_cache ();
|
||||
|
||||
private:
|
||||
|
|
@ -957,6 +955,7 @@ class DB_PUBLIC OriginalLayerRegion
|
|||
{
|
||||
public:
|
||||
OriginalLayerRegion ();
|
||||
OriginalLayerRegion (const OriginalLayerRegion &other);
|
||||
OriginalLayerRegion (const RecursiveShapeIterator &si, bool is_merged = false);
|
||||
OriginalLayerRegion (const RecursiveShapeIterator &si, const db::ICplxTrans &trans, bool merged_semantics, bool is_merged = false);
|
||||
virtual ~OriginalLayerRegion ();
|
||||
|
|
|
|||
Loading…
Reference in New Issue