diff --git a/src/db/db/dbAsIfFlatEdges.cc b/src/db/db/dbAsIfFlatEdges.cc index ed2c23177..7051708a8 100644 --- a/src/db/db/dbAsIfFlatEdges.cc +++ b/src/db/db/dbAsIfFlatEdges.cc @@ -512,7 +512,7 @@ AsIfFlatEdges::filtered (const EdgeFilterBase &filter) const } EdgePairsDelegate * -AsIfFlatEdges::run_check (db::edge_relation_type rel, const Edges *other, db::Coord d, bool whole_edges, metrics_type metrics, double ignore_angle, distance_type min_projection, distance_type max_projection) const +AsIfFlatEdges::run_check (db::edge_relation_type rel, const Edges *other, db::Coord d, const db::EdgesCheckOptions &options) const { std::auto_ptr result (new FlatEdgePairs ()); @@ -538,12 +538,12 @@ AsIfFlatEdges::run_check (db::edge_relation_type rel, const Edges *other, db::Co } } - EdgeRelationFilter check (rel, d, metrics); + EdgeRelationFilter check (rel, d, options.metrics); check.set_include_zero (false); - check.set_whole_edges (whole_edges); - check.set_ignore_angle (ignore_angle); - check.set_min_projection (min_projection); - check.set_max_projection (max_projection); + check.set_whole_edges (options.whole_edges); + check.set_ignore_angle (options.ignore_angle); + check.set_min_projection (options.min_projection); + check.set_max_projection (options.max_projection); edge2edge_check_for_edges edge_check (check, *result, other != 0); scanner.process (edge_check, d, db::box_convert ()); diff --git a/src/db/db/dbAsIfFlatEdges.h b/src/db/db/dbAsIfFlatEdges.h index 630155cf3..fda63b053 100644 --- a/src/db/db/dbAsIfFlatEdges.h +++ b/src/db/db/dbAsIfFlatEdges.h @@ -54,34 +54,34 @@ public: virtual distance_type length (const db::Box &) const; virtual Box bbox () const; - virtual EdgePairsDelegate *width_check (db::Coord d, bool whole_edges, metrics_type metrics, double ignore_angle, distance_type min_projection, distance_type max_projection) const + virtual EdgePairsDelegate *width_check (db::Coord d, const db::EdgesCheckOptions &options) const { - return run_check (db::WidthRelation, 0, d, whole_edges, metrics, ignore_angle, min_projection, max_projection); + return run_check (db::WidthRelation, 0, d, options); } - virtual EdgePairsDelegate *space_check (db::Coord d, bool whole_edges, metrics_type metrics, double ignore_angle, distance_type min_projection, distance_type max_projection) const + virtual EdgePairsDelegate *space_check (db::Coord d, const db::EdgesCheckOptions &options) const { - return run_check (db::SpaceRelation, 0, d, whole_edges, metrics, ignore_angle, min_projection, max_projection); + return run_check (db::SpaceRelation, 0, d, options); } - virtual EdgePairsDelegate *enclosing_check (const Edges &other, db::Coord d, bool whole_edges, metrics_type metrics, double ignore_angle, distance_type min_projection, distance_type max_projection) const + virtual EdgePairsDelegate *enclosing_check (const Edges &other, db::Coord d, const db::EdgesCheckOptions &options) const { - return run_check (db::OverlapRelation, &other, d, whole_edges, metrics, ignore_angle, min_projection, max_projection); + return run_check (db::OverlapRelation, &other, d, options); } - virtual EdgePairsDelegate *overlap_check (const Edges &other, db::Coord d, bool whole_edges, metrics_type metrics, double ignore_angle, distance_type min_projection, distance_type max_projection) const + virtual EdgePairsDelegate *overlap_check (const Edges &other, db::Coord d, const db::EdgesCheckOptions &options) const { - return run_check (db::WidthRelation, &other, d, whole_edges, metrics, ignore_angle, min_projection, max_projection); + return run_check (db::WidthRelation, &other, d, options); } - virtual EdgePairsDelegate *separation_check (const Edges &other, db::Coord d, bool whole_edges, metrics_type metrics, double ignore_angle, distance_type min_projection, distance_type max_projection) const + virtual EdgePairsDelegate *separation_check (const Edges &other, db::Coord d, const db::EdgesCheckOptions &options) const { - return run_check (db::SpaceRelation, &other, d, whole_edges, metrics, ignore_angle, min_projection, max_projection); + return run_check (db::SpaceRelation, &other, d, options); } - virtual EdgePairsDelegate *inside_check (const Edges &other, db::Coord d, bool whole_edges, metrics_type metrics, double ignore_angle, distance_type min_projection, distance_type max_projection) const + virtual EdgePairsDelegate *inside_check (const Edges &other, db::Coord d, const db::EdgesCheckOptions &options) const { - return run_check (db::InsideRelation, &other, d, whole_edges, metrics, ignore_angle, min_projection, max_projection); + return run_check (db::InsideRelation, &other, d, options); } virtual EdgesDelegate *process_in_place (const EdgeProcessorBase &filter) @@ -181,7 +181,7 @@ public: protected: void update_bbox (const db::Box &box); void invalidate_bbox (); - EdgePairsDelegate *run_check (db::edge_relation_type rel, const Edges *other, db::Coord d, bool whole_edges, metrics_type metrics, double ignore_angle, distance_type min_projection, distance_type max_projection) const; + EdgePairsDelegate *run_check (db::edge_relation_type rel, const Edges *other, db::Coord d, const EdgesCheckOptions &options) const; virtual EdgesDelegate *pull_generic (const Edges &edges) const; virtual RegionDelegate *pull_generic (const Region ®ion) const; virtual EdgesDelegate *selected_interacting_generic (const Edges &edges, bool inverse) const; diff --git a/src/db/db/dbAsIfFlatRegion.cc b/src/db/db/dbAsIfFlatRegion.cc index ae6094aca..9c07a8166 100644 --- a/src/db/db/dbAsIfFlatRegion.cc +++ b/src/db/db/dbAsIfFlatRegion.cc @@ -1096,20 +1096,20 @@ AsIfFlatRegion::cop_to_edges (db::CompoundRegionOperationNode &node) } EdgePairsDelegate * -AsIfFlatRegion::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, bool shielded) const +AsIfFlatRegion::run_check (db::edge_relation_type rel, bool different_polygons, const Region *other, db::Coord d, const RegionCheckOptions &options) const { #if defined(USE_LOCAL_PROCESSOR) db::RegionIterator polygons (begin_merged ()); - EdgeRelationFilter check (rel, d, metrics); + EdgeRelationFilter check (rel, d, options.metrics); check.set_include_zero (false); - check.set_whole_edges (whole_edges); - check.set_ignore_angle (ignore_angle); - check.set_min_projection (min_projection); - check.set_max_projection (max_projection); + check.set_whole_edges (options.whole_edges); + check.set_ignore_angle (options.ignore_angle); + check.set_min_projection (options.min_projection); + check.set_max_projection (options.max_projection); - db::check_local_operation op (check, different_polygons, other != 0, other && other->is_merged (), shielded); + db::check_local_operation op (check, different_polygons, other != 0, other && other->is_merged (), options.shielded); db::local_processor proc; proc.set_base_verbosity (base_verbosity ()); @@ -1153,14 +1153,14 @@ AsIfFlatRegion::run_check (db::edge_relation_type rel, bool different_polygons, } - EdgeRelationFilter check (rel, d, metrics); + EdgeRelationFilter check (rel, d, options.metrics); check.set_include_zero (false); - check.set_whole_edges (whole_edges); - check.set_ignore_angle (ignore_angle); - check.set_min_projection (min_projection); - check.set_max_projection (max_projection); + check.set_whole_edges (options.whole_edges); + check.set_ignore_angle (options.ignore_angle); + check.set_min_projection (options.min_projection); + check.set_max_projection (options.max_projection); - edge2edge_check edge_check (check, *result, different_polygons, other != 0 /*requires different layers*/, shielded); + edge2edge_check edge_check (check, *result, different_polygons, other != 0 /*requires different layers*/, options.shielded); poly2poly_check poly_check (edge_check); do { @@ -1172,18 +1172,18 @@ AsIfFlatRegion::run_check (db::edge_relation_type rel, bool different_polygons, } EdgePairsDelegate * -AsIfFlatRegion::run_single_polygon_check (db::edge_relation_type rel, db::Coord d, bool whole_edges, metrics_type metrics, double ignore_angle, distance_type min_projection, distance_type max_projection, bool shielded) const +AsIfFlatRegion::run_single_polygon_check (db::edge_relation_type rel, db::Coord d, const RegionCheckOptions &options) const { std::auto_ptr result (new FlatEdgePairs ()); - EdgeRelationFilter check (rel, d, metrics); + EdgeRelationFilter check (rel, d, options.metrics); check.set_include_zero (false); - check.set_whole_edges (whole_edges); - check.set_ignore_angle (ignore_angle); - check.set_min_projection (min_projection); - check.set_max_projection (max_projection); + check.set_whole_edges (options.whole_edges); + check.set_ignore_angle (options.ignore_angle); + check.set_min_projection (options.min_projection); + check.set_max_projection (options.max_projection); - edge2edge_check edge_check (check, *result, false /*=same polygons*/, false /*=same layers*/, shielded); + edge2edge_check edge_check (check, *result, false /*=same polygons*/, false /*=same layers*/, options.shielded); poly2poly_check poly_check (edge_check); do { diff --git a/src/db/db/dbAsIfFlatRegion.h b/src/db/db/dbAsIfFlatRegion.h index 1559a826b..2ec96546b 100644 --- a/src/db/db/dbAsIfFlatRegion.h +++ b/src/db/db/dbAsIfFlatRegion.h @@ -60,44 +60,44 @@ public: virtual RegionDelegate *cop_to_region (db::CompoundRegionOperationNode &node); virtual EdgesDelegate *cop_to_edges (db::CompoundRegionOperationNode &node); - EdgePairsDelegate *width_check (db::Coord d, bool whole_edges, metrics_type metrics, double ignore_angle, distance_type min_projection, distance_type max_projection, bool shielded) const + EdgePairsDelegate *width_check (db::Coord d, const RegionCheckOptions &options) const { - return run_single_polygon_check (db::WidthRelation, d, whole_edges, metrics, ignore_angle, min_projection, max_projection, shielded); + return run_single_polygon_check (db::WidthRelation, d, options); } - EdgePairsDelegate *space_check (db::Coord d, bool whole_edges, metrics_type metrics, double ignore_angle, distance_type min_projection, distance_type max_projection, bool shielded) const + EdgePairsDelegate *space_check (db::Coord d, const RegionCheckOptions &options) const { - return run_check (db::SpaceRelation, false, 0, d, whole_edges, metrics, ignore_angle, min_projection, max_projection, shielded); + return run_check (db::SpaceRelation, false, 0, d, options); } - EdgePairsDelegate *isolated_check (db::Coord d, bool whole_edges, metrics_type metrics, double ignore_angle, distance_type min_projection, distance_type max_projection, bool shielded) const + EdgePairsDelegate *isolated_check (db::Coord d, const RegionCheckOptions &options) const { - return run_check (db::SpaceRelation, true, 0, d, whole_edges, metrics, ignore_angle, min_projection, max_projection, shielded); + return run_check (db::SpaceRelation, true, 0, d, options); } - EdgePairsDelegate *notch_check (db::Coord d, bool whole_edges, metrics_type metrics, double ignore_angle, distance_type min_projection, distance_type max_projection, bool shielded) const + EdgePairsDelegate *notch_check (db::Coord d, const RegionCheckOptions &options) const { - return run_single_polygon_check (db::SpaceRelation, d, whole_edges, metrics, ignore_angle, min_projection, max_projection, shielded); + return run_single_polygon_check (db::SpaceRelation, d, options); } - EdgePairsDelegate *enclosing_check (const Region &other, db::Coord d, bool whole_edges, metrics_type metrics, double ignore_angle, distance_type min_projection, distance_type max_projection, bool shielded) const + EdgePairsDelegate *enclosing_check (const Region &other, db::Coord d, const RegionCheckOptions &options) const { - return run_check (db::OverlapRelation, true, &other, d, whole_edges, metrics, ignore_angle, min_projection, max_projection, shielded); + return run_check (db::OverlapRelation, true, &other, d, options); } - EdgePairsDelegate *overlap_check (const Region &other, db::Coord d, bool whole_edges, metrics_type metrics, double ignore_angle, distance_type min_projection, distance_type max_projection, bool shielded) const + EdgePairsDelegate *overlap_check (const Region &other, db::Coord d, const RegionCheckOptions &options) const { - return run_check (db::WidthRelation, true, &other, d, whole_edges, metrics, ignore_angle, min_projection, max_projection, shielded); + return run_check (db::WidthRelation, true, &other, d, options); } - EdgePairsDelegate *separation_check (const Region &other, db::Coord d, bool whole_edges, metrics_type metrics, double ignore_angle, distance_type min_projection, distance_type max_projection, bool shielded) const + EdgePairsDelegate *separation_check (const Region &other, db::Coord d, const RegionCheckOptions &options) const { - return run_check (db::SpaceRelation, true, &other, d, whole_edges, metrics, ignore_angle, min_projection, max_projection, shielded); + return run_check (db::SpaceRelation, true, &other, d, options); } - EdgePairsDelegate *inside_check (const Region &other, db::Coord d, bool whole_edges, metrics_type metrics, double ignore_angle, distance_type min_projection, distance_type max_projection, bool shielded) const + EdgePairsDelegate *inside_check (const Region &other, db::Coord d, const RegionCheckOptions &options) const { - return run_check (db::InsideRelation, true, &other, d, whole_edges, metrics, ignore_angle, min_projection, max_projection, shielded); + return run_check (db::InsideRelation, true, &other, d, options); } virtual EdgePairsDelegate *grid_check (db::Coord gx, db::Coord gy) const; @@ -264,8 +264,8 @@ protected: void update_bbox (const db::Box &box); void invalidate_bbox (); - virtual EdgePairsDelegate *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, bool shielded) const; - virtual EdgePairsDelegate *run_single_polygon_check (db::edge_relation_type rel, db::Coord d, bool whole_edges, metrics_type metrics, double ignore_angle, distance_type min_projection, distance_type max_projection, bool shielded) const; + virtual EdgePairsDelegate *run_check (db::edge_relation_type rel, bool different_polygons, const Region *other, db::Coord d, const RegionCheckOptions &options) const; + virtual EdgePairsDelegate *run_single_polygon_check (db::edge_relation_type rel, db::Coord d, const RegionCheckOptions &options) const; virtual RegionDelegate *selected_interacting_generic (const Region &other, int mode, bool touching, bool inverse, size_t min_count = 1, size_t max_count = std::numeric_limits::max ()) const; virtual RegionDelegate *selected_interacting_generic (const Edges &other, bool inverse, size_t min_count = 1, size_t max_count = std::numeric_limits::max ()) const; virtual RegionDelegate *selected_interacting_generic (const Texts &other, bool inverse, size_t min_count = 1, size_t max_count = std::numeric_limits::max ()) const; diff --git a/src/db/db/dbDeepEdges.cc b/src/db/db/dbDeepEdges.cc index 2e26b62c6..b1c410b02 100644 --- a/src/db/db/dbDeepEdges.cc +++ b/src/db/db/dbDeepEdges.cc @@ -1551,24 +1551,24 @@ private: } EdgePairsDelegate * -DeepEdges::run_check (db::edge_relation_type rel, const Edges *other, db::Coord d, bool whole_edges, metrics_type metrics, double ignore_angle, distance_type min_projection, distance_type max_projection) const +DeepEdges::run_check (db::edge_relation_type rel, const Edges *other, db::Coord d, const db::EdgesCheckOptions &options) const { const db::DeepEdges *other_deep = 0; if (other) { other_deep = dynamic_cast (other->delegate ()); if (! other_deep) { - return db::AsIfFlatEdges::run_check (rel, other, d, whole_edges, metrics, ignore_angle, min_projection, max_projection); + return db::AsIfFlatEdges::run_check (rel, other, d, options); } } const db::DeepLayer &edges = merged_deep_layer (); - EdgeRelationFilter check (rel, d, metrics); + EdgeRelationFilter check (rel, d, options.metrics); check.set_include_zero (false); - check.set_whole_edges (whole_edges); - check.set_ignore_angle (ignore_angle); - check.set_min_projection (min_projection); - check.set_max_projection (max_projection); + check.set_whole_edges (options.whole_edges); + check.set_ignore_angle (options.ignore_angle); + check.set_min_projection (options.min_projection); + check.set_max_projection (options.max_projection); std::auto_ptr res (new db::DeepEdgePairs (edges.derived ())); diff --git a/src/db/db/dbDeepEdges.h b/src/db/db/dbDeepEdges.h index a2ba715bf..36cfff8f2 100644 --- a/src/db/db/dbDeepEdges.h +++ b/src/db/db/dbDeepEdges.h @@ -81,34 +81,34 @@ public: virtual std::string to_string (size_t nmax) const; - virtual EdgePairsDelegate *width_check (db::Coord d, bool whole_edges, metrics_type metrics, double ignore_angle, distance_type min_projection, distance_type max_projection) const + virtual EdgePairsDelegate *width_check (db::Coord d, const db::EdgesCheckOptions &options) const { - return run_check (db::WidthRelation, 0, d, whole_edges, metrics, ignore_angle, min_projection, max_projection); + return run_check (db::WidthRelation, 0, d, options); } - virtual EdgePairsDelegate *space_check (db::Coord d, bool whole_edges, metrics_type metrics, double ignore_angle, distance_type min_projection, distance_type max_projection) const + virtual EdgePairsDelegate *space_check (db::Coord d, const db::EdgesCheckOptions &options) const { - return run_check (db::SpaceRelation, 0, d, whole_edges, metrics, ignore_angle, min_projection, max_projection); + return run_check (db::SpaceRelation, 0, d, options); } - virtual EdgePairsDelegate *enclosing_check (const Edges &other, db::Coord d, bool whole_edges, metrics_type metrics, double ignore_angle, distance_type min_projection, distance_type max_projection) const + virtual EdgePairsDelegate *enclosing_check (const Edges &other, db::Coord d, const db::EdgesCheckOptions &options) const { - return run_check (db::OverlapRelation, &other, d, whole_edges, metrics, ignore_angle, min_projection, max_projection); + return run_check (db::OverlapRelation, &other, d, options); } - virtual EdgePairsDelegate *overlap_check (const Edges &other, db::Coord d, bool whole_edges, metrics_type metrics, double ignore_angle, distance_type min_projection, distance_type max_projection) const + virtual EdgePairsDelegate *overlap_check (const Edges &other, db::Coord d, const db::EdgesCheckOptions &options) const { - return run_check (db::WidthRelation, &other, d, whole_edges, metrics, ignore_angle, min_projection, max_projection); + return run_check (db::WidthRelation, &other, d, options); } - virtual EdgePairsDelegate *separation_check (const Edges &other, db::Coord d, bool whole_edges, metrics_type metrics, double ignore_angle, distance_type min_projection, distance_type max_projection) const + virtual EdgePairsDelegate *separation_check (const Edges &other, db::Coord d, const db::EdgesCheckOptions &options) const { - return run_check (db::SpaceRelation, &other, d, whole_edges, metrics, ignore_angle, min_projection, max_projection); + return run_check (db::SpaceRelation, &other, d, options); } - virtual EdgePairsDelegate *inside_check (const Edges &other, db::Coord d, bool whole_edges, metrics_type metrics, double ignore_angle, distance_type min_projection, distance_type max_projection) const + virtual EdgePairsDelegate *inside_check (const Edges &other, db::Coord d, const db::EdgesCheckOptions &options) const { - return run_check (db::InsideRelation, &other, d, whole_edges, metrics, ignore_angle, min_projection, max_projection); + return run_check (db::InsideRelation, &other, d, options); } virtual EdgesDelegate *filter_in_place (const EdgeFilterBase &filter); @@ -169,7 +169,7 @@ private: const DeepLayer &merged_deep_layer () const; DeepLayer and_or_not_with(const DeepEdges *other, EdgeBoolOp op) const; DeepLayer edge_region_op (const DeepRegion *other, bool outside, bool include_borders) const; - EdgePairsDelegate *run_check (db::edge_relation_type rel, const Edges *other, db::Coord d, bool whole_edges, metrics_type metrics, double ignore_angle, distance_type min_projection, distance_type max_projection) const; + EdgePairsDelegate *run_check (db::edge_relation_type rel, const Edges *other, db::Coord d, const db::EdgesCheckOptions &options) const; virtual EdgesDelegate *pull_generic (const Edges &edges) const; virtual RegionDelegate *pull_generic (const Region ®ion) const; virtual EdgesDelegate *selected_interacting_generic (const Edges &edges, bool invert) const; diff --git a/src/db/db/dbDeepRegion.cc b/src/db/db/dbDeepRegion.cc index 86315648a..f6c30d41e 100644 --- a/src/db/db/dbDeepRegion.cc +++ b/src/db/db/dbDeepRegion.cc @@ -1467,28 +1467,28 @@ DeepRegion::cop_to_edges (db::CompoundRegionOperationNode &node) } EdgePairsDelegate * -DeepRegion::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, bool shielded) const +DeepRegion::run_check (db::edge_relation_type rel, bool different_polygons, const Region *other, db::Coord d, const RegionCheckOptions &options) const { const db::DeepRegion *other_deep = 0; if (other) { other_deep = dynamic_cast (other->delegate ()); if (! other_deep) { - return db::AsIfFlatRegion::run_check (rel, different_polygons, other, d, whole_edges, metrics, ignore_angle, min_projection, max_projection, shielded); + return db::AsIfFlatRegion::run_check (rel, different_polygons, other, d, options); } } const db::DeepLayer &polygons = merged_deep_layer (); - EdgeRelationFilter check (rel, d, metrics); + EdgeRelationFilter check (rel, d, options.metrics); check.set_include_zero (false); - check.set_whole_edges (whole_edges); - check.set_ignore_angle (ignore_angle); - check.set_min_projection (min_projection); - check.set_max_projection (max_projection); + check.set_whole_edges (options.whole_edges); + check.set_ignore_angle (options.ignore_angle); + check.set_min_projection (options.min_projection); + check.set_max_projection (options.max_projection); std::auto_ptr res (new db::DeepEdgePairs (polygons.derived ())); - db::CheckLocalOperation op (check, different_polygons, other_deep != 0, other && other->is_merged (), shielded); + db::CheckLocalOperation op (check, different_polygons, other_deep != 0, other && other->is_merged (), options.shielded); db::local_processor proc (const_cast (&polygons.layout ()), const_cast (&polygons.initial_cell ()), @@ -1506,16 +1506,16 @@ DeepRegion::run_check (db::edge_relation_type rel, bool different_polygons, cons } EdgePairsDelegate * -DeepRegion::run_single_polygon_check (db::edge_relation_type rel, db::Coord d, bool whole_edges, metrics_type metrics, double ignore_angle, distance_type min_projection, distance_type max_projection, bool shielded) const +DeepRegion::run_single_polygon_check (db::edge_relation_type rel, db::Coord d, const RegionCheckOptions &options) const { const db::DeepLayer &polygons = merged_deep_layer (); - EdgeRelationFilter check (rel, d, metrics); + EdgeRelationFilter check (rel, d, options.metrics); check.set_include_zero (false); - check.set_whole_edges (whole_edges); - check.set_ignore_angle (ignore_angle); - check.set_min_projection (min_projection); - check.set_max_projection (max_projection); + check.set_whole_edges (options.whole_edges); + check.set_ignore_angle (options.ignore_angle); + check.set_min_projection (options.min_projection); + check.set_max_projection (options.max_projection); db::Layout &layout = const_cast (polygons.layout ()); @@ -1527,7 +1527,7 @@ DeepRegion::run_single_polygon_check (db::edge_relation_type rel, db::Coord d, b for (db::Shapes::shape_iterator s = shapes.begin (db::ShapeIterator::Polygons); ! s.at_end (); ++s) { - edge2edge_check edge_check (check, result, false, false, shielded); + edge2edge_check edge_check (check, result, false, false, options.shielded); poly2poly_check poly_check (edge_check); db::Polygon poly; diff --git a/src/db/db/dbDeepRegion.h b/src/db/db/dbDeepRegion.h index f18442fa2..0b0c0f62e 100644 --- a/src/db/db/dbDeepRegion.h +++ b/src/db/db/dbDeepRegion.h @@ -136,8 +136,8 @@ protected: virtual void merged_semantics_changed (); virtual void min_coherence_changed (); - virtual EdgePairsDelegate *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, bool shielded) const; - virtual EdgePairsDelegate *run_single_polygon_check (db::edge_relation_type rel, db::Coord d, bool whole_edges, metrics_type metrics, double ignore_angle, distance_type min_projection, distance_type max_projection, bool shielded) const; + virtual EdgePairsDelegate *run_check (db::edge_relation_type rel, bool different_polygons, const Region *other, db::Coord d, const RegionCheckOptions &options) const; + virtual EdgePairsDelegate *run_single_polygon_check (db::edge_relation_type rel, db::Coord d, const RegionCheckOptions &options) const; virtual RegionDelegate *selected_interacting_generic (const Region &other, int mode, bool touching, bool inverse, size_t min_count, size_t max_count) const; virtual RegionDelegate *selected_interacting_generic (const Edges &other, bool inverse, size_t min_count, size_t max_count) const; virtual RegionDelegate *selected_interacting_generic (const Texts &other, bool inverse, size_t min_count, size_t max_count) const; diff --git a/src/db/db/dbEdges.h b/src/db/db/dbEdges.h index f2f1dd476..d2d8b4e5a 100644 --- a/src/db/db/dbEdges.h +++ b/src/db/db/dbEdges.h @@ -567,30 +567,17 @@ public: * @brief Applies a width check and returns EdgePairs which correspond to violation markers * * The width check will create a edge pairs if the width of the area between the - * edges is less than the specified threshold d. Without "whole_edges", the parts of - * the edges are returned which violate the condition. If "whole_edges" is true, the - * result will contain the complete edges participating in the result. + * edges is less than the specified threshold d. * - * "Width" refers to the space between the "inside" sides of the edges. - * - * The metrics parameter specifies which metrics to use. "Euclidian", "Square" and "Projected" - * metrics are available. - * - * ignore_angle allows specification of a maximum angle the edges can have to not participate - * in the check. By choosing 90 degree, edges having an angle of 90 degree and larger are not checked, - * but acute corners are for example. - * - * With min_projection and max_projection it is possible to specify how edges must be related - * to each other. If the length of the projection of either edge on the other is >= min_projection - * or < max_projection, the edges are considered for the check. + * "options" specifies various options to configure the check and it's output. * * The order of the edges in the resulting edge pairs is undefined. * * Merged semantics applies. */ - EdgePairs width_check (db::Coord d, bool whole_edges = false, metrics_type metrics = db::Euclidian, double ignore_angle = 90, distance_type min_projection = 0, distance_type max_projection = std::numeric_limits::max ()) const + EdgePairs width_check (db::Coord d, const db::EdgesCheckOptions &options = db::EdgesCheckOptions ()) const { - return EdgePairs (mp_delegate->width_check (d, whole_edges, metrics, ignore_angle, min_projection, max_projection)); + return EdgePairs (mp_delegate->width_check (d, options)); } /** @@ -603,9 +590,9 @@ public: * * Merged semantics applies. */ - EdgePairs space_check (db::Coord d, bool whole_edges = false, metrics_type metrics = db::Euclidian, double ignore_angle = 90, distance_type min_projection = 0, distance_type max_projection = std::numeric_limits::max ()) const + EdgePairs space_check (db::Coord d, const db::EdgesCheckOptions &options = db::EdgesCheckOptions ()) const { - return EdgePairs (mp_delegate->space_check (d, whole_edges, metrics, ignore_angle, min_projection, max_projection)); + return EdgePairs (mp_delegate->space_check (d, options)); } /** @@ -621,9 +608,9 @@ public: * * Merged semantics applies. */ - EdgePairs enclosing_check (const Edges &other, db::Coord d, bool whole_edges = false, metrics_type metrics = db::Euclidian, double ignore_angle = 90, distance_type min_projection = 0, distance_type max_projection = std::numeric_limits::max ()) const + EdgePairs enclosing_check (const Edges &other, db::Coord d, const db::EdgesCheckOptions &options = db::EdgesCheckOptions ()) const { - return EdgePairs (mp_delegate->enclosing_check (other, d, whole_edges, metrics, ignore_angle, min_projection, max_projection)); + return EdgePairs (mp_delegate->enclosing_check (other, d, options)); } /** @@ -639,9 +626,9 @@ public: * * Merged semantics applies. */ - EdgePairs overlap_check (const Edges &other, db::Coord d, bool whole_edges = false, metrics_type metrics = db::Euclidian, double ignore_angle = 90, distance_type min_projection = 0, distance_type max_projection = std::numeric_limits::max ()) const + EdgePairs overlap_check (const Edges &other, db::Coord d, const db::EdgesCheckOptions &options = db::EdgesCheckOptions ()) const { - return EdgePairs (mp_delegate->overlap_check (other, d, whole_edges, metrics, ignore_angle, min_projection, max_projection)); + return EdgePairs (mp_delegate->overlap_check (other, d, options)); } /** @@ -657,9 +644,9 @@ public: * * Merged semantics applies. */ - EdgePairs separation_check (const Edges &other, db::Coord d, bool whole_edges = false, metrics_type metrics = db::Euclidian, double ignore_angle = 90, distance_type min_projection = 0, distance_type max_projection = std::numeric_limits::max ()) const + EdgePairs separation_check (const Edges &other, db::Coord d, const db::EdgesCheckOptions &options = db::EdgesCheckOptions ()) const { - return EdgePairs (mp_delegate->separation_check (other, d, whole_edges, metrics, ignore_angle, min_projection, max_projection)); + return EdgePairs (mp_delegate->separation_check (other, d, options)); } /** @@ -675,9 +662,9 @@ public: * * Merged semantics applies. */ - EdgePairs inside_check (const Edges &other, db::Coord d, bool whole_edges = false, metrics_type metrics = db::Euclidian, double ignore_angle = 90, distance_type min_projection = 0, distance_type max_projection = std::numeric_limits::max ()) const + EdgePairs inside_check (const Edges &other, db::Coord d, const db::EdgesCheckOptions &options = db::EdgesCheckOptions ()) const { - return EdgePairs (mp_delegate->inside_check (other, d, whole_edges, metrics, ignore_angle, min_projection, max_projection)); + return EdgePairs (mp_delegate->inside_check (other, d, options)); } /** diff --git a/src/db/db/dbEdgesDelegate.h b/src/db/db/dbEdgesDelegate.h index 1dc78ecbd..dfef2d419 100644 --- a/src/db/db/dbEdgesDelegate.h +++ b/src/db/db/dbEdgesDelegate.h @@ -37,6 +37,69 @@ namespace db { +/** + * @brief A structure holding the options for the region checks (space, width, ...) + */ +struct DB_PUBLIC EdgesCheckOptions +{ + typedef db::coord_traits::distance_type distance_type; + + /** + * @brief Constructor + */ + EdgesCheckOptions (bool _whole_edges = false, + metrics_type _metrics = db::Euclidian, + double _ignore_angle = 90, + distance_type _min_projection = 0, + distance_type _max_projection = std::numeric_limits::max ()) + : whole_edges (_whole_edges), + metrics (_metrics), + ignore_angle (_ignore_angle), + min_projection (_min_projection), + max_projection (_max_projection) + { } + + /** + * @brief Specifies is whole edges are to be delivered + * + * Without "whole_edges", the parts of + * the edges are returned which violate the condition. If "whole_edges" is true, the + * result will contain the complete edges participating in the result. + */ + bool whole_edges; + + /** + * @brief Measurement metrics + * + * The metrics parameter specifies which metrics to use. "Euclidian", "Square" and "Projected" + * metrics are available. + */ + metrics_type metrics; + + /** + * @brief Specifies the obtuse angle threshold + * + * "ignore_angle" allows specification of a maximum angle that connected edges can have to not participate + * in the check. By choosing 90 degree, edges with angles of 90 degree and larger are not checked, + * but acute corners are for example. + */ + double ignore_angle; + + /** + * @brief Specifies the projection limit's minimum value + * + * With min_projection and max_projection it is possible to specify how edges must be related + * to each other. If the length of the projection of either edge on the other is >= min_projection + * or < max_projection, the edges are considered for the check. + */ + distance_type min_projection; + + /** + * @brief Specifies the projection limit's maximum value + */ + distance_type max_projection; +}; + /** * @brief A base class for edge filters */ @@ -205,12 +268,12 @@ public: virtual distance_type length (const db::Box &box) const = 0; virtual Box bbox () const = 0; - virtual EdgePairsDelegate *width_check (db::Coord d, bool whole_edges, metrics_type metrics, double ignore_angle, distance_type min_projection, distance_type max_projection) const = 0; - virtual EdgePairsDelegate *space_check (db::Coord d, bool whole_edges, metrics_type metrics, double ignore_angle, distance_type min_projection, distance_type max_projection) const = 0; - virtual EdgePairsDelegate *enclosing_check (const Edges &other, db::Coord d, bool whole_edges, metrics_type metrics, double ignore_angle, distance_type min_projection, distance_type max_projection) const = 0; - virtual EdgePairsDelegate *overlap_check (const Edges &other, db::Coord d, bool whole_edges, metrics_type metrics, double ignore_angle, distance_type min_projection, distance_type max_projection) const = 0; - virtual EdgePairsDelegate *separation_check (const Edges &other, db::Coord d, bool whole_edges, metrics_type metrics, double ignore_angle, distance_type min_projection, distance_type max_projection) const = 0; - virtual EdgePairsDelegate *inside_check (const Edges &other, db::Coord d, bool whole_edges, metrics_type metrics, double ignore_angle, distance_type min_projection, distance_type max_projection) const = 0; + virtual EdgePairsDelegate *width_check (db::Coord d, const db::EdgesCheckOptions &options) const = 0; + virtual EdgePairsDelegate *space_check (db::Coord d, const db::EdgesCheckOptions &options) const = 0; + virtual EdgePairsDelegate *enclosing_check (const Edges &other, db::Coord d, const db::EdgesCheckOptions &options) const = 0; + virtual EdgePairsDelegate *overlap_check (const Edges &other, db::Coord d, const db::EdgesCheckOptions &options) const = 0; + virtual EdgePairsDelegate *separation_check (const Edges &other, db::Coord d, const db::EdgesCheckOptions &options) const = 0; + virtual EdgePairsDelegate *inside_check (const Edges &other, db::Coord d, const db::EdgesCheckOptions &options) const = 0; virtual EdgesDelegate *filter_in_place (const EdgeFilterBase &filter) = 0; virtual EdgesDelegate *filtered (const EdgeFilterBase &filter) const = 0; diff --git a/src/db/db/dbEmptyEdges.cc b/src/db/db/dbEmptyEdges.cc index a2d81f140..3b9e02d5f 100644 --- a/src/db/db/dbEmptyEdges.cc +++ b/src/db/db/dbEmptyEdges.cc @@ -79,37 +79,37 @@ EmptyEdges::processed_to_polygons (const EdgeToPolygonProcessorBase &) const } EdgePairsDelegate * -EmptyEdges::width_check (db::Coord, bool, metrics_type, double, distance_type, distance_type) const +EmptyEdges::width_check (db::Coord, const db::EdgesCheckOptions &) const { return new EmptyEdgePairs (); } EdgePairsDelegate * -EmptyEdges::space_check (db::Coord, bool, metrics_type, double, distance_type, distance_type) const +EmptyEdges::space_check (db::Coord, const db::EdgesCheckOptions &) const { return new EmptyEdgePairs (); } EdgePairsDelegate * -EmptyEdges::enclosing_check (const Edges &, db::Coord, bool, metrics_type, double, distance_type, distance_type) const +EmptyEdges::enclosing_check (const Edges &, db::Coord, const db::EdgesCheckOptions &) const { return new EmptyEdgePairs (); } EdgePairsDelegate * -EmptyEdges::overlap_check (const Edges &, db::Coord, bool, metrics_type, double, distance_type, distance_type) const +EmptyEdges::overlap_check (const Edges &, db::Coord, const db::EdgesCheckOptions &) const { return new EmptyEdgePairs (); } EdgePairsDelegate * -EmptyEdges::separation_check (const Edges &, db::Coord, bool, metrics_type, double, distance_type, distance_type) const +EmptyEdges::separation_check (const Edges &, db::Coord, const db::EdgesCheckOptions &) const { return new EmptyEdgePairs (); } EdgePairsDelegate * -EmptyEdges::inside_check (const Edges &, db::Coord, bool, metrics_type, double, distance_type, distance_type) const +EmptyEdges::inside_check (const Edges &, db::Coord, const db::EdgesCheckOptions &) const { return new EmptyEdgePairs (); } diff --git a/src/db/db/dbEmptyEdges.h b/src/db/db/dbEmptyEdges.h index a5c1ff817..c47e70f91 100644 --- a/src/db/db/dbEmptyEdges.h +++ b/src/db/db/dbEmptyEdges.h @@ -57,12 +57,12 @@ public: virtual distance_type length (const db::Box &) const { return 0; } virtual Box bbox () const { return db::Box (); } - virtual EdgePairsDelegate *width_check (db::Coord, bool, metrics_type, double, distance_type, distance_type) const; - virtual EdgePairsDelegate *space_check (db::Coord, bool, metrics_type, double, distance_type, distance_type) const; - virtual EdgePairsDelegate *enclosing_check (const Edges &, db::Coord, bool, metrics_type, double, distance_type, distance_type) const; - virtual EdgePairsDelegate *overlap_check (const Edges &, db::Coord, bool, metrics_type, double, distance_type, distance_type) const; - virtual EdgePairsDelegate *separation_check (const Edges &, db::Coord, bool, metrics_type, double, distance_type, distance_type) const; - virtual EdgePairsDelegate *inside_check (const Edges &, db::Coord, bool, metrics_type, double, distance_type, distance_type) const; + virtual EdgePairsDelegate *width_check (db::Coord, const db::EdgesCheckOptions &) const; + virtual EdgePairsDelegate *space_check (db::Coord, const db::EdgesCheckOptions &) const; + virtual EdgePairsDelegate *enclosing_check (const Edges &, db::Coord, const db::EdgesCheckOptions &) const; + virtual EdgePairsDelegate *overlap_check (const Edges &, db::Coord, const db::EdgesCheckOptions &) const; + virtual EdgePairsDelegate *separation_check (const Edges &, db::Coord, const db::EdgesCheckOptions &) const; + virtual EdgePairsDelegate *inside_check (const Edges &, db::Coord, const db::EdgesCheckOptions &) const; virtual EdgesDelegate *filter_in_place (const EdgeFilterBase &) { return this; } virtual EdgesDelegate *filtered (const EdgeFilterBase &) const { return new EmptyEdges (); } diff --git a/src/db/db/dbEmptyRegion.cc b/src/db/db/dbEmptyRegion.cc index 07dd1134d..c2be4d9da 100644 --- a/src/db/db/dbEmptyRegion.cc +++ b/src/db/db/dbEmptyRegion.cc @@ -115,49 +115,49 @@ EmptyRegion::cop_to_edges (db::CompoundRegionOperationNode &) } EdgePairsDelegate * -EmptyRegion::width_check (db::Coord, bool, metrics_type, double, distance_type, distance_type, bool) const +EmptyRegion::width_check (db::Coord, const RegionCheckOptions &) const { return new EmptyEdgePairs (); } EdgePairsDelegate * -EmptyRegion::space_check (db::Coord, bool, metrics_type, double, distance_type, distance_type, bool) const +EmptyRegion::space_check (db::Coord, const RegionCheckOptions &) const { return new EmptyEdgePairs (); } EdgePairsDelegate * -EmptyRegion::isolated_check (db::Coord, bool, metrics_type, double, distance_type, distance_type, bool) const +EmptyRegion::isolated_check (db::Coord, const RegionCheckOptions &) const { return new EmptyEdgePairs (); } EdgePairsDelegate * -EmptyRegion::notch_check (db::Coord, bool, metrics_type, double, distance_type, distance_type, bool) const +EmptyRegion::notch_check (db::Coord, const RegionCheckOptions &) const { return new EmptyEdgePairs (); } EdgePairsDelegate * -EmptyRegion::enclosing_check (const Region &, db::Coord, bool, metrics_type, double, distance_type, distance_type, bool) const +EmptyRegion::enclosing_check (const Region &, db::Coord, const RegionCheckOptions &) const { return new EmptyEdgePairs (); } EdgePairsDelegate * -EmptyRegion::overlap_check (const Region &, db::Coord, bool, metrics_type, double, distance_type, distance_type, bool) const +EmptyRegion::overlap_check (const Region &, db::Coord, const RegionCheckOptions &) const { return new EmptyEdgePairs (); } EdgePairsDelegate * -EmptyRegion::separation_check (const Region &, db::Coord, bool , metrics_type, double, distance_type, distance_type, bool) const +EmptyRegion::separation_check (const Region &, db::Coord, const RegionCheckOptions &) const { return new EmptyEdgePairs (); } EdgePairsDelegate * -EmptyRegion::inside_check (const Region &, db::Coord, bool, metrics_type, double, distance_type, distance_type, bool) const +EmptyRegion::inside_check (const Region &, db::Coord, const RegionCheckOptions &) const { return new EmptyEdgePairs (); } diff --git a/src/db/db/dbEmptyRegion.h b/src/db/db/dbEmptyRegion.h index df1125145..b868b95bb 100644 --- a/src/db/db/dbEmptyRegion.h +++ b/src/db/db/dbEmptyRegion.h @@ -66,14 +66,14 @@ public: virtual RegionDelegate *cop_to_region (db::CompoundRegionOperationNode &node); virtual EdgesDelegate *cop_to_edges (db::CompoundRegionOperationNode &node); - virtual EdgePairsDelegate *width_check (db::Coord, bool, metrics_type, double, distance_type, distance_type, bool) const; - virtual EdgePairsDelegate *space_check (db::Coord, bool, metrics_type, double, distance_type, distance_type, bool) const; - virtual EdgePairsDelegate *isolated_check (db::Coord, bool, metrics_type, double, distance_type, distance_type, bool) const; - virtual EdgePairsDelegate *notch_check (db::Coord, bool, metrics_type, double, distance_type, distance_type, bool) const; - virtual EdgePairsDelegate *enclosing_check (const Region &, db::Coord, bool, metrics_type, double, distance_type, distance_type, bool) const; - virtual EdgePairsDelegate *overlap_check (const Region &, db::Coord, bool, metrics_type, double, distance_type, distance_type, bool) const; - virtual EdgePairsDelegate *separation_check (const Region &, db::Coord, bool , metrics_type, double, distance_type, distance_type, bool) const; - virtual EdgePairsDelegate *inside_check (const Region &, db::Coord, bool, metrics_type, double, distance_type, distance_type, bool) const; + virtual EdgePairsDelegate *width_check (db::Coord, const RegionCheckOptions &) const; + virtual EdgePairsDelegate *space_check (db::Coord, const RegionCheckOptions &) const; + virtual EdgePairsDelegate *isolated_check (db::Coord, const RegionCheckOptions &) const; + virtual EdgePairsDelegate *notch_check (db::Coord, const RegionCheckOptions &) const; + virtual EdgePairsDelegate *enclosing_check (const Region &, db::Coord, const RegionCheckOptions &) const; + virtual EdgePairsDelegate *overlap_check (const Region &, db::Coord, const RegionCheckOptions &) const; + virtual EdgePairsDelegate *separation_check (const Region &, db::Coord, const RegionCheckOptions &) const; + virtual EdgePairsDelegate *inside_check (const Region &, db::Coord, const RegionCheckOptions &) const; virtual EdgePairsDelegate *grid_check (db::Coord, db::Coord) const; virtual EdgePairsDelegate *angle_check (double, double, bool) const; diff --git a/src/db/db/dbRegion.h b/src/db/db/dbRegion.h index 8c0fc035e..6bb510914 100644 --- a/src/db/db/dbRegion.h +++ b/src/db/db/dbRegion.h @@ -644,28 +644,17 @@ public: * @brief Applies a width check and returns EdgePairs which correspond to violation markers * * The width check will create a edge pairs if the width of the area between the - * edges is less than the specified threshold d. Without "whole_edges", the parts of - * the edges are returned which violate the condition. If "whole_edges" is true, the - * result will contain the complete edges participating in the result. + * edges is less than the specified threshold d. * - * The metrics parameter specifies which metrics to use. "Euclidian", "Square" and "Projected" - * metrics are available. - * - * ingore_angle allows specification of a maximum angle that connected edges can have to not participate - * in the check. By choosing 90 degree, edges with angles of 90 degree and larger are not checked, - * but acute corners are for example. - * - * With min_projection and max_projection it is possible to specify how edges must be related - * to each other. If the length of the projection of either edge on the other is >= min_projection - * or < max_projection, the edges are considered for the check. + * "options" will specify a variety of options to configure the check. * * The order of the edges in the resulting edge pairs is undefined. * * Merged semantics applies. */ - EdgePairs width_check (db::Coord d, bool whole_edges = false, metrics_type metrics = db::Euclidian, double ignore_angle = 90, distance_type min_projection = 0, distance_type max_projection = std::numeric_limits::max (), bool shielded = true) const + EdgePairs width_check (db::Coord d, const RegionCheckOptions &options = db::RegionCheckOptions ()) const { - return EdgePairs (mp_delegate->width_check (d, whole_edges, metrics, ignore_angle, min_projection, max_projection, shielded)); + return EdgePairs (mp_delegate->width_check (d, options)); } /** @@ -676,9 +665,9 @@ public: * * Merged semantics applies. */ - EdgePairs space_check (db::Coord d, bool whole_edges = false, metrics_type metrics = db::Euclidian, double ignore_angle = 90, distance_type min_projection = 0, distance_type max_projection = std::numeric_limits::max (), bool shielded = true) const + EdgePairs space_check (db::Coord d, const RegionCheckOptions &options = db::RegionCheckOptions ()) const { - return EdgePairs (mp_delegate->space_check (d, whole_edges, metrics, ignore_angle, min_projection, max_projection, shielded)); + return EdgePairs (mp_delegate->space_check (d, options)); } /** @@ -689,9 +678,9 @@ public: * * Merged semantics applies. */ - EdgePairs isolated_check (db::Coord d, bool whole_edges = false, metrics_type metrics = db::Euclidian, double ignore_angle = 90, distance_type min_projection = 0, distance_type max_projection = std::numeric_limits::max (), bool shielded = true) const + EdgePairs isolated_check (db::Coord d, const RegionCheckOptions &options = db::RegionCheckOptions ()) const { - return EdgePairs (mp_delegate->isolated_check (d, whole_edges, metrics, ignore_angle, min_projection, max_projection, shielded)); + return EdgePairs (mp_delegate->isolated_check (d, options)); } /** @@ -702,9 +691,9 @@ public: * * Merged semantics applies. */ - EdgePairs notch_check (db::Coord d, bool whole_edges = false, metrics_type metrics = db::Euclidian, double ignore_angle = 90, distance_type min_projection = 0, distance_type max_projection = std::numeric_limits::max (), bool shielded = true) const + EdgePairs notch_check (db::Coord d, const RegionCheckOptions &options = db::RegionCheckOptions ()) const { - return EdgePairs (mp_delegate->notch_check (d, whole_edges, metrics, ignore_angle, min_projection, max_projection, shielded)); + return EdgePairs (mp_delegate->notch_check (d, options)); } /** @@ -719,9 +708,9 @@ public: * * Merged semantics applies. */ - EdgePairs enclosing_check (const Region &other, db::Coord d, bool whole_edges = false, metrics_type metrics = db::Euclidian, double ignore_angle = 90, distance_type min_projection = 0, distance_type max_projection = std::numeric_limits::max (), bool shielded = true) const + EdgePairs enclosing_check (const Region &other, db::Coord d, const RegionCheckOptions &options = db::RegionCheckOptions ()) const { - return EdgePairs (mp_delegate->enclosing_check (other, d, whole_edges, metrics, ignore_angle, min_projection, max_projection, shielded)); + return EdgePairs (mp_delegate->enclosing_check (other, d, options)); } /** @@ -736,9 +725,9 @@ public: * * Merged semantics applies. */ - EdgePairs overlap_check (const Region &other, db::Coord d, bool whole_edges = false, metrics_type metrics = db::Euclidian, double ignore_angle = 90, distance_type min_projection = 0, distance_type max_projection = std::numeric_limits::max (), bool shielded = true) const + EdgePairs overlap_check (const Region &other, db::Coord d, const RegionCheckOptions &options = db::RegionCheckOptions ()) const { - return EdgePairs (mp_delegate->overlap_check (other, d, whole_edges, metrics, ignore_angle, min_projection, max_projection, shielded)); + return EdgePairs (mp_delegate->overlap_check (other, d, options)); } /** @@ -753,9 +742,9 @@ public: * * Merged semantics applies. */ - EdgePairs separation_check (const Region &other, db::Coord d, bool whole_edges = false, metrics_type metrics = db::Euclidian, double ignore_angle = 90, distance_type min_projection = 0, distance_type max_projection = std::numeric_limits::max (), bool shielded = true) const + EdgePairs separation_check (const Region &other, db::Coord d, const RegionCheckOptions &options = db::RegionCheckOptions ()) const { - return EdgePairs (mp_delegate->separation_check (other, d, whole_edges, metrics, ignore_angle, min_projection, max_projection, shielded)); + return EdgePairs (mp_delegate->separation_check (other, d, options)); } /** @@ -770,9 +759,9 @@ public: * * Merged semantics applies. */ - EdgePairs inside_check (const Region &other, db::Coord d, bool whole_edges = false, metrics_type metrics = db::Euclidian, double ignore_angle = 90, distance_type min_projection = 0, distance_type max_projection = std::numeric_limits::max (), bool shielded = true) const + EdgePairs inside_check (const Region &other, db::Coord d, const RegionCheckOptions &options = db::RegionCheckOptions ()) const { - return EdgePairs (mp_delegate->inside_check (other, d, whole_edges, metrics, ignore_angle, min_projection, max_projection, shielded)); + return EdgePairs (mp_delegate->inside_check (other, d, options)); } /** diff --git a/src/db/db/dbRegionDelegate.h b/src/db/db/dbRegionDelegate.h index dcdf858a1..55579f854 100644 --- a/src/db/db/dbRegionDelegate.h +++ b/src/db/db/dbRegionDelegate.h @@ -44,6 +44,78 @@ class EdgesDelegate; class EdgePairsDelegate; class CompoundRegionOperationNode; +/** + * @brief A structure holding the options for the region checks (space, width, ...) + */ +struct DB_PUBLIC RegionCheckOptions +{ + typedef db::coord_traits::distance_type distance_type; + + /** + * @brief Constructor + */ + RegionCheckOptions (bool _whole_edges = false, + metrics_type _metrics = db::Euclidian, + double _ignore_angle = 90, + distance_type _min_projection = 0, + distance_type _max_projection = std::numeric_limits::max (), + bool _shielded = true) + : whole_edges (_whole_edges), + metrics (_metrics), + ignore_angle (_ignore_angle), + min_projection (_min_projection), + max_projection (_max_projection), + shielded (_shielded) + { } + + /** + * @brief Specifies is whole edges are to be delivered + * + * Without "whole_edges", the parts of + * the edges are returned which violate the condition. If "whole_edges" is true, the + * result will contain the complete edges participating in the result. + */ + bool whole_edges; + + /** + * @brief Measurement metrics + * + * The metrics parameter specifies which metrics to use. "Euclidian", "Square" and "Projected" + * metrics are available. + */ + metrics_type metrics; + + /** + * @brief Specifies the obtuse angle threshold + * + * "ignore_angle" allows specification of a maximum angle that connected edges can have to not participate + * in the check. By choosing 90 degree, edges with angles of 90 degree and larger are not checked, + * but acute corners are for example. + */ + double ignore_angle; + + /** + * @brief Specifies the projection limit's minimum value + * + * With min_projection and max_projection it is possible to specify how edges must be related + * to each other. If the length of the projection of either edge on the other is >= min_projection + * or < max_projection, the edges are considered for the check. + */ + distance_type min_projection; + + /** + * @brief Specifies the projection limit's maximum value + */ + distance_type max_projection; + + /** + * @brief Specifies shielding + * + * Set this option to false to disable shielding. By default, shielding is on. + */ + bool shielded; +}; + /** * @brief A base class for polygon filters */ @@ -220,14 +292,14 @@ public: virtual RegionDelegate *cop_to_region (db::CompoundRegionOperationNode &node) = 0; virtual EdgesDelegate *cop_to_edges (db::CompoundRegionOperationNode &node) = 0; - virtual EdgePairsDelegate *width_check (db::Coord d, bool whole_edges, metrics_type metrics, double ignore_angle, distance_type min_projection, distance_type max_projection, bool shielded) const = 0; - virtual EdgePairsDelegate *space_check (db::Coord d, bool whole_edges, metrics_type metrics, double ignore_angle, distance_type min_projection, distance_type max_projection, bool shielded) const = 0; - virtual EdgePairsDelegate *isolated_check (db::Coord d, bool whole_edges, metrics_type metrics, double ignore_angle, distance_type min_projection, distance_type max_projection, bool shielded) const = 0; - virtual EdgePairsDelegate *notch_check (db::Coord d, bool whole_edges, metrics_type metrics, double ignore_angle, distance_type min_projection, distance_type max_projection, bool shielded) const = 0; - virtual EdgePairsDelegate *enclosing_check (const Region &other, db::Coord d, bool whole_edges, metrics_type metrics, double ignore_angle, distance_type min_projection, distance_type max_projection, bool shielded) const = 0; - virtual EdgePairsDelegate *overlap_check (const Region &other, db::Coord d, bool whole_edges, metrics_type metrics, double ignore_angle, distance_type min_projection, distance_type max_projection, bool shielded) const = 0; - virtual EdgePairsDelegate *separation_check (const Region &other, db::Coord d, bool whole_edges, metrics_type metrics, double ignore_angle, distance_type min_projection, distance_type max_projection, bool shielded) const = 0; - virtual EdgePairsDelegate *inside_check (const Region &other, db::Coord d, bool whole_edges, metrics_type metrics, double ignore_angle, distance_type min_projection, distance_type max_projection, bool shielded) const = 0; + virtual EdgePairsDelegate *width_check (db::Coord d, const RegionCheckOptions &options) const = 0; + virtual EdgePairsDelegate *space_check (db::Coord d, const RegionCheckOptions &options) const = 0; + virtual EdgePairsDelegate *isolated_check (db::Coord d, const RegionCheckOptions &options) const = 0; + virtual EdgePairsDelegate *notch_check (db::Coord d, const RegionCheckOptions &options) const = 0; + virtual EdgePairsDelegate *enclosing_check (const Region &other, db::Coord d, const RegionCheckOptions &options) const = 0; + virtual EdgePairsDelegate *overlap_check (const Region &other, db::Coord d, const RegionCheckOptions &options) const = 0; + virtual EdgePairsDelegate *separation_check (const Region &other, db::Coord d, const RegionCheckOptions &options) const = 0; + virtual EdgePairsDelegate *inside_check (const Region &other, db::Coord d, const RegionCheckOptions &options) const = 0; virtual EdgePairsDelegate *grid_check (db::Coord gx, db::Coord gy) const = 0; virtual EdgePairsDelegate *angle_check (double min, double max, bool inverse) const = 0; diff --git a/src/db/db/gsiDeclDbEdges.cc b/src/db/db/gsiDeclDbEdges.cc index 64d5734d3..4a6bd2955 100644 --- a/src/db/db/gsiDeclDbEdges.cc +++ b/src/db/db/gsiDeclDbEdges.cc @@ -218,11 +218,12 @@ static db::EdgePairs width1 (const db::Edges *r, db::Edges::coord_type d) static db::EdgePairs width2 (const db::Edges *r, db::Edges::coord_type d, bool whole_edges, const tl::Variant &metrics, const tl::Variant &ignore_angle, const tl::Variant &min_projection, const tl::Variant &max_projection) { - return r->width_check (d, whole_edges, - metrics.is_nil () ? db::Euclidian : db::metrics_type (metrics.to_int ()), - ignore_angle.is_nil () ? 90 : ignore_angle.to_double (), - min_projection.is_nil () ? db::Edges::distance_type (0) : min_projection.to (), - max_projection.is_nil () ? std::numeric_limits::max () : max_projection.to ()); + return r->width_check (d, db::EdgesCheckOptions (whole_edges, + metrics.is_nil () ? db::Euclidian : db::metrics_type (metrics.to_int ()), + ignore_angle.is_nil () ? 90 : ignore_angle.to_double (), + min_projection.is_nil () ? db::Edges::distance_type (0) : min_projection.to (), + max_projection.is_nil () ? std::numeric_limits::max () : max_projection.to ()) + ); } static db::EdgePairs space1 (const db::Edges *r, db::Edges::coord_type d) @@ -232,11 +233,12 @@ static db::EdgePairs space1 (const db::Edges *r, db::Edges::coord_type d) static db::EdgePairs space2 (const db::Edges *r, db::Edges::coord_type d, bool whole_edges, const tl::Variant &metrics, const tl::Variant &ignore_angle, const tl::Variant &min_projection, const tl::Variant &max_projection) { - return r->space_check (d, whole_edges, - metrics.is_nil () ? db::Euclidian : db::metrics_type (metrics.to_int ()), - ignore_angle.is_nil () ? 90 : ignore_angle.to_double (), - min_projection.is_nil () ? db::Edges::distance_type (0) : min_projection.to (), - max_projection.is_nil () ? std::numeric_limits::max () : max_projection.to ()); + return r->space_check (d, db::EdgesCheckOptions (whole_edges, + metrics.is_nil () ? db::Euclidian : db::metrics_type (metrics.to_int ()), + ignore_angle.is_nil () ? 90 : ignore_angle.to_double (), + min_projection.is_nil () ? db::Edges::distance_type (0) : min_projection.to (), + max_projection.is_nil () ? std::numeric_limits::max () : max_projection.to ()) + ); } static db::EdgePairs inside1 (const db::Edges *r, const db::Edges &other, db::Edges::coord_type d) @@ -246,11 +248,12 @@ static db::EdgePairs inside1 (const db::Edges *r, const db::Edges &other, db::Ed static db::EdgePairs inside2 (const db::Edges *r, const db::Edges &other, db::Edges::coord_type d, bool whole_edges, const tl::Variant &metrics, const tl::Variant &ignore_angle, const tl::Variant &min_projection, const tl::Variant &max_projection) { - return r->inside_check (other, d, whole_edges, - metrics.is_nil () ? db::Euclidian : db::metrics_type (metrics.to_int ()), - ignore_angle.is_nil () ? 90 : ignore_angle.to_double (), - min_projection.is_nil () ? db::Edges::distance_type (0) : min_projection.to (), - max_projection.is_nil () ? std::numeric_limits::max () : max_projection.to ()); + return r->inside_check (other, d, db::EdgesCheckOptions (whole_edges, + metrics.is_nil () ? db::Euclidian : db::metrics_type (metrics.to_int ()), + ignore_angle.is_nil () ? 90 : ignore_angle.to_double (), + min_projection.is_nil () ? db::Edges::distance_type (0) : min_projection.to (), + max_projection.is_nil () ? std::numeric_limits::max () : max_projection.to ()) + ); } static db::EdgePairs overlap1 (const db::Edges *r, const db::Edges &other, db::Edges::coord_type d) @@ -260,11 +263,12 @@ static db::EdgePairs overlap1 (const db::Edges *r, const db::Edges &other, db::E static db::EdgePairs overlap2 (const db::Edges *r, const db::Edges &other, db::Edges::coord_type d, bool whole_edges, const tl::Variant &metrics, const tl::Variant &ignore_angle, const tl::Variant &min_projection, const tl::Variant &max_projection) { - return r->overlap_check (other, d, whole_edges, - metrics.is_nil () ? db::Euclidian : db::metrics_type (metrics.to_int ()), - ignore_angle.is_nil () ? 90 : ignore_angle.to_double (), - min_projection.is_nil () ? db::Edges::distance_type (0) : min_projection.to (), - max_projection.is_nil () ? std::numeric_limits::max () : max_projection.to ()); + return r->overlap_check (other, d, db::EdgesCheckOptions (whole_edges, + metrics.is_nil () ? db::Euclidian : db::metrics_type (metrics.to_int ()), + ignore_angle.is_nil () ? 90 : ignore_angle.to_double (), + min_projection.is_nil () ? db::Edges::distance_type (0) : min_projection.to (), + max_projection.is_nil () ? std::numeric_limits::max () : max_projection.to ()) + ); } static db::EdgePairs enclosing1 (const db::Edges *r, const db::Edges &other, db::Edges::coord_type d) @@ -274,11 +278,12 @@ static db::EdgePairs enclosing1 (const db::Edges *r, const db::Edges &other, db: static db::EdgePairs enclosing2 (const db::Edges *r, const db::Edges &other, db::Edges::coord_type d, bool whole_edges, const tl::Variant &metrics, const tl::Variant &ignore_angle, const tl::Variant &min_projection, const tl::Variant &max_projection) { - return r->enclosing_check (other, d, whole_edges, - metrics.is_nil () ? db::Euclidian : db::metrics_type (metrics.to_int ()), - ignore_angle.is_nil () ? 90 : ignore_angle.to_double (), - min_projection.is_nil () ? db::Edges::distance_type (0) : min_projection.to (), - max_projection.is_nil () ? std::numeric_limits::max () : max_projection.to ()); + return r->enclosing_check (other, d, db::EdgesCheckOptions (whole_edges, + metrics.is_nil () ? db::Euclidian : db::metrics_type (metrics.to_int ()), + ignore_angle.is_nil () ? 90 : ignore_angle.to_double (), + min_projection.is_nil () ? db::Edges::distance_type (0) : min_projection.to (), + max_projection.is_nil () ? std::numeric_limits::max () : max_projection.to ()) + ); } static db::EdgePairs separation1 (const db::Edges *r, const db::Edges &other, db::Edges::coord_type d) @@ -288,11 +293,12 @@ static db::EdgePairs separation1 (const db::Edges *r, const db::Edges &other, db static db::EdgePairs separation2 (const db::Edges *r, const db::Edges &other, db::Edges::coord_type d, bool whole_edges, const tl::Variant &metrics, const tl::Variant &ignore_angle, const tl::Variant &min_projection, const tl::Variant &max_projection) { - return r->separation_check (other, d, whole_edges, - metrics.is_nil () ? db::Euclidian : db::metrics_type (metrics.to_int ()), - ignore_angle.is_nil () ? 90 : ignore_angle.to_double (), - min_projection.is_nil () ? db::Edges::distance_type (0) : min_projection.to (), - max_projection.is_nil () ? std::numeric_limits::max () : max_projection.to ()); + return r->separation_check (other, d, db::EdgesCheckOptions (whole_edges, + metrics.is_nil () ? db::Euclidian : db::metrics_type (metrics.to_int ()), + ignore_angle.is_nil () ? 90 : ignore_angle.to_double (), + min_projection.is_nil () ? db::Edges::distance_type (0) : min_projection.to (), + max_projection.is_nil () ? std::numeric_limits::max () : max_projection.to ()) + ); } static db::Region extended_in (const db::Edges *r, db::Coord e) diff --git a/src/db/db/gsiDeclDbRegion.cc b/src/db/db/gsiDeclDbRegion.cc index cd3370222..6ac8cde0c 100644 --- a/src/db/db/gsiDeclDbRegion.cc +++ b/src/db/db/gsiDeclDbRegion.cc @@ -443,12 +443,13 @@ static db::EdgePairs width1 (const db::Region *r, db::Region::distance_type d) static db::EdgePairs width2 (const db::Region *r, db::Region::distance_type d, bool whole_edges, const tl::Variant &metrics, const tl::Variant &ignore_angle, const tl::Variant &min_projection, const tl::Variant &max_projection, bool shielded) { - return r->width_check (d, whole_edges, - metrics.is_nil () ? db::Euclidian : db::metrics_type (metrics.to_int ()), - ignore_angle.is_nil () ? 90 : ignore_angle.to_double (), - min_projection.is_nil () ? db::Region::distance_type (0) : min_projection.to (), - max_projection.is_nil () ? std::numeric_limits::max () : max_projection.to (), - shielded); + return r->width_check (d, db::RegionCheckOptions (whole_edges, + metrics.is_nil () ? db::Euclidian : db::metrics_type (metrics.to_int ()), + ignore_angle.is_nil () ? 90 : ignore_angle.to_double (), + min_projection.is_nil () ? db::Region::distance_type (0) : min_projection.to (), + max_projection.is_nil () ? std::numeric_limits::max () : max_projection.to (), + shielded) + ); } static db::EdgePairs space1 (const db::Region *r, db::Region::distance_type d) @@ -458,12 +459,13 @@ static db::EdgePairs space1 (const db::Region *r, db::Region::distance_type d) static db::EdgePairs space2 (const db::Region *r, db::Region::distance_type d, bool whole_edges, const tl::Variant &metrics, const tl::Variant &ignore_angle, const tl::Variant &min_projection, const tl::Variant &max_projection, bool shielded) { - return r->space_check (d, whole_edges, - metrics.is_nil () ? db::Euclidian : db::metrics_type (metrics.to_int ()), - ignore_angle.is_nil () ? 90 : ignore_angle.to_double (), - min_projection.is_nil () ? db::Region::distance_type (0) : min_projection.to (), - max_projection.is_nil () ? std::numeric_limits::max () : max_projection.to (), - shielded); + return r->space_check (d, db::RegionCheckOptions (whole_edges, + metrics.is_nil () ? db::Euclidian : db::metrics_type (metrics.to_int ()), + ignore_angle.is_nil () ? 90 : ignore_angle.to_double (), + min_projection.is_nil () ? db::Region::distance_type (0) : min_projection.to (), + max_projection.is_nil () ? std::numeric_limits::max () : max_projection.to (), + shielded) + ); } static db::EdgePairs notch1 (const db::Region *r, db::Region::distance_type d) @@ -473,12 +475,13 @@ static db::EdgePairs notch1 (const db::Region *r, db::Region::distance_type d) static db::EdgePairs notch2 (const db::Region *r, db::Region::distance_type d, bool whole_edges, const tl::Variant &metrics, const tl::Variant &ignore_angle, const tl::Variant &min_projection, const tl::Variant &max_projection, bool shielded) { - return r->notch_check (d, whole_edges, - metrics.is_nil () ? db::Euclidian : db::metrics_type (metrics.to_int ()), - ignore_angle.is_nil () ? 90 : ignore_angle.to_double (), - min_projection.is_nil () ? db::Region::distance_type (0) : min_projection.to (), - max_projection.is_nil () ? std::numeric_limits::max () : max_projection.to (), - shielded); + return r->notch_check (d, db::RegionCheckOptions (whole_edges, + metrics.is_nil () ? db::Euclidian : db::metrics_type (metrics.to_int ()), + ignore_angle.is_nil () ? 90 : ignore_angle.to_double (), + min_projection.is_nil () ? db::Region::distance_type (0) : min_projection.to (), + max_projection.is_nil () ? std::numeric_limits::max () : max_projection.to (), + shielded) + ); } static db::EdgePairs isolated1 (const db::Region *r, db::Region::distance_type d) @@ -488,12 +491,13 @@ static db::EdgePairs isolated1 (const db::Region *r, db::Region::distance_type d static db::EdgePairs isolated2 (const db::Region *r, db::Region::distance_type d, bool whole_edges, const tl::Variant &metrics, const tl::Variant &ignore_angle, const tl::Variant &min_projection, const tl::Variant &max_projection, bool shielded) { - return r->isolated_check (d, whole_edges, - metrics.is_nil () ? db::Euclidian : db::metrics_type (metrics.to_int ()), - ignore_angle.is_nil () ? 90 : ignore_angle.to_double (), - min_projection.is_nil () ? db::Region::distance_type (0) : min_projection.to (), - max_projection.is_nil () ? std::numeric_limits::max () : max_projection.to (), - shielded); + return r->isolated_check (d, db::RegionCheckOptions (whole_edges, + metrics.is_nil () ? db::Euclidian : db::metrics_type (metrics.to_int ()), + ignore_angle.is_nil () ? 90 : ignore_angle.to_double (), + min_projection.is_nil () ? db::Region::distance_type (0) : min_projection.to (), + max_projection.is_nil () ? std::numeric_limits::max () : max_projection.to (), + shielded) + ); } static db::EdgePairs inside1 (const db::Region *r, const db::Region &other, db::Region::distance_type d) @@ -503,12 +507,13 @@ static db::EdgePairs inside1 (const db::Region *r, const db::Region &other, db:: static db::EdgePairs inside2 (const db::Region *r, const db::Region &other, db::Region::distance_type d, bool whole_edges, const tl::Variant &metrics, const tl::Variant &ignore_angle, const tl::Variant &min_projection, const tl::Variant &max_projection, bool shielded) { - return r->inside_check (other, d, whole_edges, - metrics.is_nil () ? db::Euclidian : db::metrics_type (metrics.to_int ()), - ignore_angle.is_nil () ? 90 : ignore_angle.to_double (), - min_projection.is_nil () ? db::Region::distance_type (0) : min_projection.to (), - max_projection.is_nil () ? std::numeric_limits::max () : max_projection.to (), - shielded); + return r->inside_check (other, d, db::RegionCheckOptions (whole_edges, + metrics.is_nil () ? db::Euclidian : db::metrics_type (metrics.to_int ()), + ignore_angle.is_nil () ? 90 : ignore_angle.to_double (), + min_projection.is_nil () ? db::Region::distance_type (0) : min_projection.to (), + max_projection.is_nil () ? std::numeric_limits::max () : max_projection.to (), + shielded) + ); } static db::EdgePairs overlap1 (const db::Region *r, const db::Region &other, db::Region::distance_type d) @@ -518,12 +523,13 @@ static db::EdgePairs overlap1 (const db::Region *r, const db::Region &other, db: static db::EdgePairs overlap2 (const db::Region *r, const db::Region &other, db::Region::distance_type d, bool whole_edges, const tl::Variant &metrics, const tl::Variant &ignore_angle, const tl::Variant &min_projection, const tl::Variant &max_projection, bool shielded) { - return r->overlap_check (other, d, whole_edges, - metrics.is_nil () ? db::Euclidian : db::metrics_type (metrics.to_int ()), - ignore_angle.is_nil () ? 90 : ignore_angle.to_double (), - min_projection.is_nil () ? db::Region::distance_type (0) : min_projection.to (), - max_projection.is_nil () ? std::numeric_limits::max () : max_projection.to (), - shielded); + return r->overlap_check (other, d, db::RegionCheckOptions (whole_edges, + metrics.is_nil () ? db::Euclidian : db::metrics_type (metrics.to_int ()), + ignore_angle.is_nil () ? 90 : ignore_angle.to_double (), + min_projection.is_nil () ? db::Region::distance_type (0) : min_projection.to (), + max_projection.is_nil () ? std::numeric_limits::max () : max_projection.to (), + shielded) + ); } static db::EdgePairs enclosing1 (const db::Region *r, const db::Region &other, db::Region::distance_type d) @@ -533,12 +539,13 @@ static db::EdgePairs enclosing1 (const db::Region *r, const db::Region &other, d static db::EdgePairs enclosing2 (const db::Region *r, const db::Region &other, db::Region::distance_type d, bool whole_edges, const tl::Variant &metrics, const tl::Variant &ignore_angle, const tl::Variant &min_projection, const tl::Variant &max_projection, bool shielded) { - return r->enclosing_check (other, d, whole_edges, - metrics.is_nil () ? db::Euclidian : db::metrics_type (metrics.to_int ()), - ignore_angle.is_nil () ? 90 : ignore_angle.to_double (), - min_projection.is_nil () ? db::Region::distance_type (0) : min_projection.to (), - max_projection.is_nil () ? std::numeric_limits::max () : max_projection.to (), - shielded); + return r->enclosing_check (other, d, db::RegionCheckOptions (whole_edges, + metrics.is_nil () ? db::Euclidian : db::metrics_type (metrics.to_int ()), + ignore_angle.is_nil () ? 90 : ignore_angle.to_double (), + min_projection.is_nil () ? db::Region::distance_type (0) : min_projection.to (), + max_projection.is_nil () ? std::numeric_limits::max () : max_projection.to (), + shielded) + ); } static db::EdgePairs separation1 (const db::Region *r, const db::Region &other, db::Region::distance_type d) @@ -548,12 +555,13 @@ static db::EdgePairs separation1 (const db::Region *r, const db::Region &other, static db::EdgePairs separation2 (const db::Region *r, const db::Region &other, db::Region::distance_type d, bool whole_edges, const tl::Variant &metrics, const tl::Variant &ignore_angle, const tl::Variant &min_projection, const tl::Variant &max_projection, bool shielded) { - return r->separation_check (other, d, whole_edges, - metrics.is_nil () ? db::Euclidian : db::metrics_type (metrics.to_int ()), - ignore_angle.is_nil () ? 90 : ignore_angle.to_double (), - min_projection.is_nil () ? db::Region::distance_type (0) : min_projection.to (), - max_projection.is_nil () ? std::numeric_limits::max () : max_projection.to (), - shielded); + return r->separation_check (other, d, db::RegionCheckOptions (whole_edges, + metrics.is_nil () ? db::Euclidian : db::metrics_type (metrics.to_int ()), + ignore_angle.is_nil () ? 90 : ignore_angle.to_double (), + min_projection.is_nil () ? db::Region::distance_type (0) : min_projection.to (), + max_projection.is_nil () ? std::numeric_limits::max () : max_projection.to (), + shielded) + ); } static std::vector andnot (const db::Region *r, const db::Region &other) diff --git a/src/db/unit_tests/dbDeepEdgesTests.cc b/src/db/unit_tests/dbDeepEdgesTests.cc index 93834ac9f..aeaf472e8 100644 --- a/src/db/unit_tests/dbDeepEdgesTests.cc +++ b/src/db/unit_tests/dbDeepEdgesTests.cc @@ -499,12 +499,12 @@ TEST(9_DRCChecks) target.insert (target_top_cell_index, target.get_layer (db::LayerProperties (4, 0)), r4); target.insert (target_top_cell_index, target.get_layer (db::LayerProperties (6, 0)), r6); - target.insert (target_top_cell_index, target.get_layer (db::LayerProperties (10, 0)), e3.space_check (500, false, db::Projection, 90, 0)); - target.insert (target_top_cell_index, target.get_layer (db::LayerProperties (11, 0)), e3.space_check (500, true, db::Projection, 90, 300)); + target.insert (target_top_cell_index, target.get_layer (db::LayerProperties (10, 0)), e3.space_check (500, db::EdgesCheckOptions (false, db::Projection, 90, 0))); + target.insert (target_top_cell_index, target.get_layer (db::LayerProperties (11, 0)), e3.space_check (500, db::EdgesCheckOptions (true, db::Projection, 90, 300))); - target.insert (target_top_cell_index, target.get_layer (db::LayerProperties (20, 0)), e3.separation_check (e4, 200, false, db::Projection, 90, 0)); + target.insert (target_top_cell_index, target.get_layer (db::LayerProperties (20, 0)), e3.separation_check (e4, 200, db::EdgesCheckOptions (false, db::Projection, 90, 0))); - target.insert (target_top_cell_index, target.get_layer (db::LayerProperties (30, 0)), e6.enclosing_check (e4, 100, true, db::Projection, 90, 0)); + target.insert (target_top_cell_index, target.get_layer (db::LayerProperties (30, 0)), e6.enclosing_check (e4, 100, db::EdgesCheckOptions (true, db::Projection, 90, 0))); CHECKPOINT(); db::compare_layouts (_this, target, tl::testsrc () + "/testdata/algo/deep_edges_au9.gds"); diff --git a/src/db/unit_tests/dbDeepRegionTests.cc b/src/db/unit_tests/dbDeepRegionTests.cc index 1960dcc81..f9dcea33c 100644 --- a/src/db/unit_tests/dbDeepRegionTests.cc +++ b/src/db/unit_tests/dbDeepRegionTests.cc @@ -1074,10 +1074,10 @@ TEST(17_SinglePolygonChecks) target.insert (target_top_cell_index, target.get_layer (db::LayerProperties (4, 0)), r4); target.insert (target_top_cell_index, target.get_layer (db::LayerProperties (6, 0)), r6); - target.insert (target_top_cell_index, target.get_layer (db::LayerProperties (10, 0)), r3.width_check (260, false, db::Euclidian, 90, 0)); - target.insert (target_top_cell_index, target.get_layer (db::LayerProperties (11, 0)), r3.width_check (260, true, db::Projection, 90, 2000)); + target.insert (target_top_cell_index, target.get_layer (db::LayerProperties (10, 0)), r3.width_check (260, db::RegionCheckOptions (false, db::Euclidian, 90, 0))); + target.insert (target_top_cell_index, target.get_layer (db::LayerProperties (11, 0)), r3.width_check (260, db::RegionCheckOptions (true, db::Projection, 90, 2000))); - target.insert (target_top_cell_index, target.get_layer (db::LayerProperties (20, 0)), r6.notch_check (1300, false, db::Euclidian, 90, 0)); + target.insert (target_top_cell_index, target.get_layer (db::LayerProperties (20, 0)), r6.notch_check (1300, db::RegionCheckOptions (false, db::Euclidian, 90, 0))); CHECKPOINT(); db::compare_layouts (_this, target, tl::testsrc () + "/testdata/algo/deep_region_au17.gds"); @@ -1116,12 +1116,12 @@ TEST(18_MultiPolygonChecks) target.insert (target_top_cell_index, target.get_layer (db::LayerProperties (4, 0)), r4); target.insert (target_top_cell_index, target.get_layer (db::LayerProperties (6, 0)), r6); - target.insert (target_top_cell_index, target.get_layer (db::LayerProperties (10, 0)), r3.space_check (500, false, db::Projection, 90, 0)); - target.insert (target_top_cell_index, target.get_layer (db::LayerProperties (11, 0)), r3.space_check (500, true, db::Projection, 90, 300)); + target.insert (target_top_cell_index, target.get_layer (db::LayerProperties (10, 0)), r3.space_check (500, db::RegionCheckOptions (false, db::Projection, 90, 0))); + target.insert (target_top_cell_index, target.get_layer (db::LayerProperties (11, 0)), r3.space_check (500, db::RegionCheckOptions (true, db::Projection, 90, 300))); - target.insert (target_top_cell_index, target.get_layer (db::LayerProperties (20, 0)), r3.separation_check (r4, 200, false, db::Projection, 90, 0)); + target.insert (target_top_cell_index, target.get_layer (db::LayerProperties (20, 0)), r3.separation_check (r4, 200, db::RegionCheckOptions (false, db::Projection, 90, 0))); - target.insert (target_top_cell_index, target.get_layer (db::LayerProperties (30, 0)), r6.enclosing_check (r4, 100, true, db::Projection, 90, 0)); + target.insert (target_top_cell_index, target.get_layer (db::LayerProperties (30, 0)), r6.enclosing_check (r4, 100, db::RegionCheckOptions (true, db::Projection, 90, 0))); CHECKPOINT(); db::compare_layouts (_this, target, tl::testsrc () + "/testdata/algo/deep_region_au18.gds"); diff --git a/src/db/unit_tests/dbEdgesTests.cc b/src/db/unit_tests/dbEdgesTests.cc index 54ac99367..630d84867 100644 --- a/src/db/unit_tests/dbEdgesTests.cc +++ b/src/db/unit_tests/dbEdgesTests.cc @@ -556,12 +556,12 @@ TEST(11) EXPECT_EQ (r.edges ().width_check (15).to_string (), "(0,0;0,10)/(10,10;10,0);(0,10;10,10)/(10,0;0,0)"); EXPECT_EQ (r.edges ().width_check (5).to_string (), ""); - EXPECT_EQ (r.edges ().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.edges ().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.edges ().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.edges ().width_check (5, db::EdgesCheckOptions (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.edges ().space_check (15, db::EdgesCheckOptions (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.edges ().space_check (15, db::EdgesCheckOptions (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.edges ().space_check (15).to_string (), "(9,10;10,10)/(21,20;20,20);(10,10;10,9)/(20,20;20,21)"); - EXPECT_EQ (r.edges ().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.edges ().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.edges ().space_check (15, db::EdgesCheckOptions (true)).to_string (), "(0,10;10,10)/(40,20;20,20);(10,10;10,0)/(20,20;20,50)"); + EXPECT_EQ (r.edges ().space_check (15, db::EdgesCheckOptions (false, db::Square)).to_string (), "(5,10;10,10)/(25,20;20,20);(10,10;10,5)/(20,20;20,25)"); } TEST(12) @@ -573,23 +573,23 @@ TEST(12) b.insert (db::Box (db::Point (0, 0), db::Point (100, 100))); EXPECT_EQ (a.edges ().inside_check (b.edges (), 15).to_string (), "(10,20;10,30)/(0,9;0,41)"); - EXPECT_EQ (a.edges ().inside_check (b.edges (), 15, true).to_string (), "(10,20;10,30)/(0,0;0,100)"); - EXPECT_EQ (a.edges ().inside_check (b.edges (), 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.edges ().inside_check (b.edges (), 15, db::EdgesCheckOptions (true)).to_string (), "(10,20;10,30)/(0,0;0,100)"); + EXPECT_EQ (a.edges ().inside_check (b.edges (), 15, db::EdgesCheckOptions (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 (b.edges ().enclosing_check (a.edges (), 15).to_string (), "(0,9;0,41)/(10,20;10,30)"); - EXPECT_EQ (b.edges ().enclosing_check (a.edges (), 15, true).to_string (), "(0,0;0,100)/(10,20;10,30)"); - EXPECT_EQ (b.edges ().enclosing_check (a.edges (), 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.edges ().enclosing_check (a.edges (), 15, db::EdgesCheckOptions (true)).to_string (), "(0,0;0,100)/(10,20;10,30)"); + EXPECT_EQ (b.edges ().enclosing_check (a.edges (), 15, db::EdgesCheckOptions (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)"); 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,9;30,20)/(20,20;15,20);(30,9;30,41)/(20,30;20,20);(30,30;30,41)/(15,30;20,30)"); + EXPECT_EQ (b.separation_check (a, 15, db::RegionCheckOptions (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,20;15,35)/(20,20;15,20);(15,6;15,44)/(20,30;20,20);(15,15;15,30)/(15,30;20,30)"); + EXPECT_EQ (b.overlap_check (a, 15, db::RegionCheckOptions (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) @@ -732,9 +732,9 @@ TEST(20) db::Edges r1 (db::RecursiveShapeIterator (ly, ly.cell (top), l2), false); EXPECT_EQ (r1.width_check (20).to_string (), "(60,10;60,20)/(70,20;70,10);(60,20;70,20)/(70,10;60,10)"); EXPECT_EQ (r1.width_check (50).to_string (), "(60,10;60,20)/(70,20;70,10);(60,20;70,20)/(70,10;60,10);(60,20;70,20)/(40,10;11,10);(70,10;60,10)/(20,40;40,40);(10,10;10,40)/(40,40;40,10);(10,40;40,40)/(40,10;10,10);(80,70;140,70)/(140,40;80,40)"); - EXPECT_EQ (r1.width_check (50, true).to_string (), "(60,10;60,20)/(70,20;70,10);(60,20;70,20)/(70,10;60,10);(60,20;70,20)/(40,10;10,10);(70,10;60,10)/(10,40;40,40);(10,10;10,40)/(40,40;40,10);(10,40;40,40)/(40,10;10,10);(80,70;140,70)/(140,40;80,40)"); - EXPECT_EQ (r1.width_check (50, false, db::Projection).to_string (), "(60,10;60,20)/(70,20;70,10);(60,20;70,20)/(70,10;60,10);(10,10;10,40)/(40,40;40,10);(10,40;40,40)/(40,10;10,10);(80,70;140,70)/(140,40;80,40)"); - EXPECT_EQ (r1.width_check (50, false, db::Euclidian, 90, 1).to_string (), "(60,10;60,20)/(70,20;70,10);(60,20;70,20)/(70,10;60,10);(10,10;10,40)/(40,40;40,10);(10,40;40,40)/(40,10;10,10);(80,70;140,70)/(140,40;80,40)"); + EXPECT_EQ (r1.width_check (50, db::EdgesCheckOptions (true)).to_string (), "(60,10;60,20)/(70,20;70,10);(60,20;70,20)/(70,10;60,10);(60,20;70,20)/(40,10;10,10);(70,10;60,10)/(10,40;40,40);(10,10;10,40)/(40,40;40,10);(10,40;40,40)/(40,10;10,10);(80,70;140,70)/(140,40;80,40)"); + EXPECT_EQ (r1.width_check (50, db::EdgesCheckOptions (false, db::Projection)).to_string (), "(60,10;60,20)/(70,20;70,10);(60,20;70,20)/(70,10;60,10);(10,10;10,40)/(40,40;40,10);(10,40;40,40)/(40,10;10,10);(80,70;140,70)/(140,40;80,40)"); + EXPECT_EQ (r1.width_check (50, db::EdgesCheckOptions (false, db::Euclidian, 90, 1)).to_string (), "(60,10;60,20)/(70,20;70,10);(60,20;70,20)/(70,10;60,10);(10,10;10,40)/(40,40;40,10);(10,40;40,40)/(40,10;10,10);(80,70;140,70)/(140,40;80,40)"); } { @@ -750,8 +750,8 @@ TEST(20) db::Edges r2 (db::RecursiveShapeIterator (ly, ly.cell (top), l2), false); EXPECT_EQ (r2.has_valid_edges (), 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, false, db::Projection).to_string (), "(50,10;50,30)/(40,30;40,10);(80,70;80,40)/(80,40;80,70)"); - EXPECT_EQ (r1.separation_check (r2, 20, false, db::Euclidian, 90, 1).to_string (), "(50,0;50,30)/(40,40;40,10);(80,70;80,40)/(80,40;80,70)"); + EXPECT_EQ (r1.separation_check (r2, 20, db::EdgesCheckOptions (false, db::Projection)).to_string (), "(50,10;50,30)/(40,30;40,10);(80,70;80,40)/(80,40;80,70)"); + EXPECT_EQ (r1.separation_check (r2, 20, db::EdgesCheckOptions (false, db::Euclidian, 90, 1)).to_string (), "(50,0;50,30)/(40,40;40,10);(80,70;80,40)/(80,40;80,70)"); } { diff --git a/src/db/unit_tests/dbRegionTests.cc b/src/db/unit_tests/dbRegionTests.cc index d9e8037b5..5effd8f91 100644 --- a/src/db/unit_tests/dbRegionTests.cc +++ b/src/db/unit_tests/dbRegionTests.cc @@ -507,12 +507,12 @@ 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 (), "(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.width_check (5, db::RegionCheckOptions (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, db::RegionCheckOptions (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, db::RegionCheckOptions (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)"); + EXPECT_EQ (r.space_check (15, db::RegionCheckOptions (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, db::RegionCheckOptions (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[] = { @@ -544,10 +544,10 @@ TEST(15b) r.insert (db::Box (db::Point (300, 300), db::Point (500, 500))); 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,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 (), "(300,300;300,500)/(200,500;200,300);(300,0;300,200)/(200,200;200,0)"); + EXPECT_EQ (r.width_check (120, db::RegionCheckOptions (false, db::Projection)).to_string (), "(400,200;400,300)/(500,300;500,200)"); + EXPECT_EQ (r.space_check (120, db::RegionCheckOptions (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, db::RegionCheckOptions (false, db::Projection)).to_string (), "(300,200;400,200)/(400,300;300,300)"); + EXPECT_EQ (r.isolated_check (120, db::RegionCheckOptions (false, db::Projection)).to_string (), "(300,300;300,500)/(200,500;200,300);(300,0;300,200)/(200,200;200,0)"); } TEST(15c) @@ -562,10 +562,10 @@ TEST(15c) r.insert (db::Box (db::Point (400, 200), db::Point (500, 250))); 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,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 (), "(300,300;300,500)/(200,500;200,300);(300,0;300,200)/(200,200;200,0)"); + EXPECT_EQ (r.width_check (120, db::RegionCheckOptions (false, db::Projection)).to_string (), "(400,200;400,300)/(500,300;500,200)"); + EXPECT_EQ (r.space_check (120, db::RegionCheckOptions (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, db::RegionCheckOptions (false, db::Projection)).to_string (), "(300,200;400,200)/(400,300;300,300)"); + EXPECT_EQ (r.isolated_check (120, db::RegionCheckOptions (false, db::Projection)).to_string (), "(300,300;300,500)/(200,500;200,300);(300,0;300,200)/(200,200;200,0)"); } TEST(15d) @@ -580,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 (), "(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)"); + EXPECT_EQ (r.space_check (120, db::RegionCheckOptions (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) @@ -640,23 +640,23 @@ TEST(16) b.insert (db::Box (db::Point (0, 0), db::Point (100, 100))); 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 (), "(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 (a.inside_check (b, 15, db::RegionCheckOptions (true)).to_string (), "(10,20;10,30)/(0,0;0,100)"); + EXPECT_EQ (a.inside_check (b, 15, db::RegionCheckOptions (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,20)/(15,20;10,20);(0,30;0,41)/(10,30;15,30);(0,9;0,41)/(10,20;10,30)"); + EXPECT_EQ (b.enclosing_check (a, 15, db::RegionCheckOptions (true)).to_string (), "(0,0;0,100)/(10,20;10,30)"); + EXPECT_EQ (b.enclosing_check (a, 15, db::RegionCheckOptions (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,9;30,20)/(20,20;15,20);(30,9;30,41)/(20,30;20,20);(30,30;30,41)/(15,30;20,30)"); + EXPECT_EQ (b.separation_check (a, 15, db::RegionCheckOptions (true)).to_string (), "(30,0;30,100)/(20,30;20,20)"); + EXPECT_EQ (b.separation_check (a, 15, db::RegionCheckOptions (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,20;15,35)/(20,20;15,20);(15,6;15,44)/(20,30;20,20);(15,15;15,30)/(15,30;20,30)"); + EXPECT_EQ (b.overlap_check (a, 15, db::RegionCheckOptions (true)).to_string (), "(15,0;15,100)/(20,30;20,20)"); + EXPECT_EQ (b.overlap_check (a, 15, db::RegionCheckOptions (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)