diff --git a/src/db/db/dbAsIfFlatRegion.cc b/src/db/db/dbAsIfFlatRegion.cc index 3cd1c80e3..4f88ae245 100644 --- a/src/db/db/dbAsIfFlatRegion.cc +++ b/src/db/db/dbAsIfFlatRegion.cc @@ -1109,7 +1109,7 @@ AsIfFlatRegion::run_check (db::edge_relation_type rel, bool different_polygons, 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 (), options.shielded, options.not_opposite, options.rect_filter); + db::check_local_operation op (check, different_polygons, other != 0, other && other->is_merged (), options.shielded, options.opposite_filter, options.rect_filter); db::local_processor proc; proc.set_base_verbosity (base_verbosity ()); diff --git a/src/db/db/dbCompoundOperation.cc b/src/db/db/dbCompoundOperation.cc index bdc569580..84e0863fb 100644 --- a/src/db/db/dbCompoundOperation.cc +++ b/src/db/db/dbCompoundOperation.cc @@ -1116,14 +1116,14 @@ CompoundRegionCheckOperationNode::CompoundRegionCheckOperationNode (db::edge_rel void CompoundRegionCheckOperationNode::do_compute_local (db::Layout *layout, const shape_interactions &interactions, std::vector > &results, size_t max_vertex_count, double area_ratio) const { - db::check_local_operation op (m_check, m_different_polygons, true, false, m_options.shielded, m_options.not_opposite, m_options.rect_filter); + db::check_local_operation op (m_check, m_different_polygons, true, false, m_options.shielded, m_options.opposite_filter, m_options.rect_filter); op.compute_local (layout, interactions, results, max_vertex_count, area_ratio); } void CompoundRegionCheckOperationNode::do_compute_local (db::Layout *layout, const shape_interactions &interactions, std::vector > &results, size_t max_vertex_count, double area_ratio) const { - db::check_local_operation op (m_check, m_different_polygons, true, false, m_options.shielded, m_options.not_opposite, m_options.rect_filter); + db::check_local_operation op (m_check, m_different_polygons, true, false, m_options.shielded, m_options.opposite_filter, m_options.rect_filter); op.compute_local (layout, interactions, results, max_vertex_count, area_ratio); } diff --git a/src/db/db/dbDeepRegion.cc b/src/db/db/dbDeepRegion.cc index f5d126c78..a64f74135 100644 --- a/src/db/db/dbDeepRegion.cc +++ b/src/db/db/dbDeepRegion.cc @@ -1488,7 +1488,7 @@ DeepRegion::run_check (db::edge_relation_type rel, bool different_polygons, cons std::auto_ptr res (new db::DeepEdgePairs (polygons.derived ())); - db::CheckLocalOperation op (check, different_polygons, other_deep != 0, other && other->is_merged (), options.shielded, options.not_opposite, options.rect_filter); + db::CheckLocalOperation op (check, different_polygons, other_deep != 0, other && other->is_merged (), options.shielded, options.opposite_filter, options.rect_filter); db::local_processor proc (const_cast (&polygons.layout ()), const_cast (&polygons.initial_cell ()), diff --git a/src/db/db/dbEdgePairRelations.cc b/src/db/db/dbEdgePairRelations.cc index 219cb31fe..987590b11 100644 --- a/src/db/db/dbEdgePairRelations.cc +++ b/src/db/db/dbEdgePairRelations.cc @@ -54,7 +54,7 @@ db::Edge::distance_type edge_projection (const db::Edge &a, const db::Edge &b) * This function applies Euclidian metrics. * If no such part is found, this function returns false. */ -bool euclidian_near_part_of_edge (bool include_zero, db::Coord d, const db::Edge &e, const db::Edge &other, db::Edge *output) +bool euclidian_near_part_of_edge (bool include_zero, db::coord_traits::distance_type d, const db::Edge &e, const db::Edge &other, db::Edge *output) { // Handle the case of point-like basic edge: cannot determine // orientation @@ -119,7 +119,7 @@ bool euclidian_near_part_of_edge (bool include_zero, db::Coord d, const db::Edge // handle the parallel case if (e.parallel (g)) { - if (std::abs (e.distance (g.p1 ())) >= d) { + if (std::abs (double (e.distance (g.p1 ()))) >= double (d)) { return false; } } else { @@ -197,7 +197,7 @@ bool euclidian_near_part_of_edge (bool include_zero, db::Coord d, const db::Edge * This function applies Square metrics. * If no such part is found, this function returns false. */ -static bool var_near_part_of_edge (bool include_zero, db::Coord d, db::Coord dd, const db::Edge &e, const db::Edge &other, db::Edge *output) +static bool var_near_part_of_edge (bool include_zero, db::coord_traits::distance_type d, db::coord_traits::distance_type dd, const db::Edge &e, const db::Edge &other, db::Edge *output) { // Handle the case of point-like basic edge: cannot determine // orientation @@ -229,14 +229,14 @@ static bool var_near_part_of_edge (bool include_zero, db::Coord d, db::Coord dd, // Handle the case of point vs. edge if (g.is_degenerate ()) { - db::Coord gd = e.distance (g.p1 ()); - if (gd <= -d || gd >= 0) { + double gd = double (e.distance (g.p1 ())); + if (gd <= -double (d) || gd >= 0) { return false; } - if (db::sprod (db::Vector (g.p1 () - e.p1 ()), e.d ()) < -dd * e.double_length ()) { + if (db::sprod (db::Vector (g.p1 () - e.p1 ()), e.d ()) < -(dd * e.double_length ())) { return false; } - if (db::sprod (db::Vector (e.p2 () - g.p1 ()), e.d ()) < -dd * e.double_length ()) { + if (db::sprod (db::Vector (e.p2 () - g.p1 ()), e.d ()) < -(dd * e.double_length ())) { return false; } if (output) { @@ -255,7 +255,7 @@ static bool var_near_part_of_edge (bool include_zero, db::Coord d, db::Coord dd, // handle the parallel case if (e.parallel (g)) { - if (std::abs (e.distance (g.p1 ())) >= d) { + if (std::abs (double (e.distance (g.p1 ()))) >= double (d)) { return false; } } else { @@ -275,8 +275,8 @@ static bool var_near_part_of_edge (bool include_zero, db::Coord d, db::Coord dd, } if (db::sprod_sign (e, g) == 0) { - if (db::sprod (db::Vector (g.p1 () - e.p1 ()), e.d ()) < -dd * e.double_length () || - db::sprod (db::Vector (e.p2 () - g.p1 ()), e.d ()) < -dd * e.double_length ()) { + if (db::sprod (db::Vector (g.p1 () - e.p1 ()), e.d ()) < -(dd * e.double_length ()) || + db::sprod (db::Vector (e.p2 () - g.p1 ()), e.d ()) < -(dd * e.double_length ())) { return false; } } else { @@ -314,7 +314,7 @@ static bool var_near_part_of_edge (bool include_zero, db::Coord d, db::Coord dd, * This function applies Projected metrics. * If no such part is found, this function returns false. */ -bool projected_near_part_of_edge (bool include_zero, db::Coord d, const db::Edge &e, const db::Edge &other, db::Edge *output) +bool projected_near_part_of_edge (bool include_zero, db::coord_traits::distance_type d, const db::Edge &e, const db::Edge &other, db::Edge *output) { return var_near_part_of_edge (include_zero, d, 0, e, other, output); } @@ -325,7 +325,7 @@ bool projected_near_part_of_edge (bool include_zero, db::Coord d, const db::Edge * This function applies Square metrics. * If no such part is found, this function returns false. */ -bool square_near_part_of_edge (bool include_zero, db::Coord d, const db::Edge &e, const db::Edge &other, db::Edge *output) +bool square_near_part_of_edge (bool include_zero, db::coord_traits::distance_type d, const db::Edge &e, const db::Edge &other, db::Edge *output) { return var_near_part_of_edge (include_zero, d, d, e, other, output); } diff --git a/src/db/db/dbRegionDelegate.h b/src/db/db/dbRegionDelegate.h index e98131ad6..87c9720da 100644 --- a/src/db/db/dbRegionDelegate.h +++ b/src/db/db/dbRegionDelegate.h @@ -61,7 +61,7 @@ struct DB_PUBLIC RegionCheckOptions distance_type _min_projection = 0, distance_type _max_projection = std::numeric_limits::max (), bool _shielded = true, - bool _no_opposite = false, + OppositeFilter _opposite_filter = NoOppositeFilter, RectFilter _rect_filter = NoSideAllowed) : whole_edges (_whole_edges), metrics (_metrics), @@ -69,7 +69,7 @@ struct DB_PUBLIC RegionCheckOptions min_projection (_min_projection), max_projection (_max_projection), shielded (_shielded), - not_opposite (_no_opposite), + opposite_filter (_opposite_filter), rect_filter (_rect_filter) { } @@ -121,11 +121,9 @@ struct DB_PUBLIC RegionCheckOptions bool shielded; /** - * @brief Suppresses opposite error edges - * - * If true, error edges opposite of each other across the respective polygon part cancel. + * @brief Specifies the opposite filter */ - bool not_opposite; + OppositeFilter opposite_filter; /** * @brief Specifies a filter for error markers on rectangular shapes diff --git a/src/db/db/dbRegionLocalOperations.cc b/src/db/db/dbRegionLocalOperations.cc index 53df40f58..cc44a3d6c 100644 --- a/src/db/db/dbRegionLocalOperations.cc +++ b/src/db/db/dbRegionLocalOperations.cc @@ -169,8 +169,8 @@ static bool shields_interaction (const db::EdgePair &ep, const P &poly) template -check_local_operation::check_local_operation (const EdgeRelationFilter &check, bool different_polygons, bool has_other, bool other_is_merged, bool shielded, bool no_opposite, db::RectFilter rect_filter) - : m_check (check), m_different_polygons (different_polygons), m_has_other (has_other), m_other_is_merged (other_is_merged), m_shielded (shielded), m_no_opposite (no_opposite), m_rect_filter (rect_filter) +check_local_operation::check_local_operation (const EdgeRelationFilter &check, bool different_polygons, bool has_other, bool other_is_merged, bool shielded, db::OppositeFilter opposite_filter, db::RectFilter rect_filter) + : m_check (check), m_different_polygons (different_polygons), m_has_other (has_other), m_other_is_merged (other_is_merged), m_shielded (shielded), m_opposite_filter (opposite_filter), m_rect_filter (rect_filter) { // .. nothing yet .. } @@ -181,7 +181,7 @@ check_local_operation::compute_local (db::Layout *layout, const shape_in { tl_assert (results.size () == 1); std::unordered_set &result = results.front (); - tl_assert (results.empty ()); + tl_assert (result.empty ()); edge2edge_check > edge_check (m_check, result, m_different_polygons, m_has_other, m_shielded); poly2poly_check > poly_check (edge_check); @@ -256,9 +256,9 @@ check_local_operation::compute_local (db::Layout *layout, const shape_in scanner.process (poly_check, m_check.distance (), db::box_convert ()); } while (edge_check.prepare_next_pass ()); - // detect and remove parts of the result which have results "opposite" - // ("opposite" is defined by the projection part) - if (m_no_opposite && ! result.empty ()) { + // detect and remove parts of the result which have or do not have results "opposite" + // ("opposite" is defined by the projection of edges "through" the subject shape) + if (m_opposite_filter != db::NoOppositeFilter && ! result.empty ()) { db::EdgeRelationFilter opp (db::WidthRelation, std::numeric_limits::max (), db::Projection); @@ -270,9 +270,11 @@ check_local_operation::compute_local (db::Layout *layout, const shape_in projections.clear (); - std::unordered_set::const_iterator ep2 = ep1; - ++ep2; - for ( ; ep2 != result.end (); ++ep2) { + for (std::unordered_set::const_iterator ep2 = result.begin (); ep2 != result.end (); ++ep2) { + + if (ep1 == ep2) { + continue; + } db::EdgePair ep_opp; if (opp.check (ep1->first (), ep2->first (), &ep_opp)) { @@ -291,11 +293,16 @@ check_local_operation::compute_local (db::Layout *layout, const shape_in } if (! projections.empty ()) { - db::Edges ce = db::Edges (ep1->first ()) - db::Edges (projections.begin (), projections.end ()); + db::Edges ce; + if (m_opposite_filter == db::OnlyOpposite) { + ce = db::Edges (ep1->first ()) & db::Edges (projections.begin (), projections.end ()); + } else if (m_opposite_filter == db::NotOpposite) { + ce = db::Edges (ep1->first ()) - db::Edges (projections.begin (), projections.end ()); + } for (db::Edges::const_iterator re = ce.begin (); ! re.at_end (); ++re) { cleaned_result.insert (db::EdgePair (*re, ep1->second ())); } - } else { + } else if (m_opposite_filter == db::NotOpposite) { cleaned_result.insert (*ep1); } diff --git a/src/db/db/dbRegionLocalOperations.h b/src/db/db/dbRegionLocalOperations.h index cf35e3018..9c23d6673 100644 --- a/src/db/db/dbRegionLocalOperations.h +++ b/src/db/db/dbRegionLocalOperations.h @@ -68,12 +68,33 @@ enum RectFilter ThreeSidesAllowed }; +/** + * @brief Specifies an error filter for opposite errors + */ +enum OppositeFilter +{ + /** + * @brief No filter + */ + NoOppositeFilter, + + /** + * @brief Only errors appearing on opposite sides of a figure will be reported + */ + OnlyOpposite, + + /** + * @brief Only errors NOT appearing on opposite sides of a figure will be reported + */ + NotOpposite +}; + template class check_local_operation : public local_operation { public: - check_local_operation (const EdgeRelationFilter &check, bool different_polygons, bool has_other, bool other_is_merged, bool shielded, bool no_opposite, db::RectFilter rect_filter); + check_local_operation (const EdgeRelationFilter &check, bool different_polygons, bool has_other, bool other_is_merged, bool shielded, db::OppositeFilter opposite_filter, db::RectFilter rect_filter); virtual void compute_local (db::Layout * /*layout*/, const shape_interactions &interactions, std::vector > &results, size_t /*max_vertex_count*/, double /*area_ratio*/) const; @@ -87,7 +108,7 @@ private: bool m_has_other; bool m_other_is_merged; bool m_shielded; - bool m_no_opposite; + db::OppositeFilter m_opposite_filter; db::RectFilter m_rect_filter; }; diff --git a/src/db/db/gsiDeclDbCompoundOperation.cc b/src/db/db/gsiDeclDbCompoundOperation.cc index 910c176ba..cef6d37ba 100644 --- a/src/db/db/gsiDeclDbCompoundOperation.cc +++ b/src/db/db/gsiDeclDbCompoundOperation.cc @@ -174,7 +174,7 @@ static db::CompoundRegionOperationNode *new_minkowsky_sum_node4 (db::CompoundReg return new db::CompoundRegionProcessingOperationNode (new db::minkowsky_sum_computation > (p), input, true /*processor is owned*/); } -static db::CompoundRegionOperationNode *new_check_node (db::edge_relation_type rel, bool different_polygons, db::Coord 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, bool no_opposite, db::RectFilter rect_filter) +static db::CompoundRegionOperationNode *new_check_node (db::edge_relation_type rel, bool different_polygons, db::Coord 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, db::OppositeFilter opposite_filter, db::RectFilter rect_filter) { return new db::CompoundRegionCheckOperationNode (rel, different_polygons, d, db::RegionCheckOptions (whole_edges, @@ -183,12 +183,12 @@ static db::CompoundRegionOperationNode *new_check_node (db::edge_relation_type r min_projection.is_nil () ? db::Region::distance_type (0) : min_projection.to (), max_projection.is_nil () ? std::numeric_limits::max () : max_projection.to (), shielded, - no_opposite, + opposite_filter, rect_filter) ); } -static db::CompoundRegionOperationNode *new_check_node (db::CompoundRegionOperationNode *input, db::edge_relation_type rel, bool different_polygons, db::Coord d, bool whole_edges, db::metrics_type metrics, const tl::Variant &ignore_angle, const tl::Variant &min_projection, const tl::Variant &max_projection, bool shielded, bool no_opposite, db::RectFilter rect_filter) +static db::CompoundRegionOperationNode *new_check_node (db::CompoundRegionOperationNode *input, db::edge_relation_type rel, bool different_polygons, db::Coord d, bool whole_edges, db::metrics_type metrics, const tl::Variant &ignore_angle, const tl::Variant &min_projection, const tl::Variant &max_projection, bool shielded, db::OppositeFilter opposite_filter, db::RectFilter rect_filter) { return new db::CompoundRegionCheckOperationNode (input, rel, different_polygons, d, db::RegionCheckOptions (whole_edges, @@ -197,39 +197,39 @@ static db::CompoundRegionOperationNode *new_check_node (db::CompoundRegionOperat min_projection.is_nil () ? db::Region::distance_type (0) : min_projection.to (), max_projection.is_nil () ? std::numeric_limits::max () : max_projection.to (), shielded, - no_opposite, + opposite_filter, rect_filter) ); } static db::CompoundRegionOperationNode *new_width_check_node (db::Coord d, bool whole_edges, db::metrics_type metrics, const tl::Variant &ignore_angle, const tl::Variant &min_projection, const tl::Variant &max_projection, bool shielded) { - return new_check_node (db::WidthRelation, false, d, whole_edges, metrics, ignore_angle, min_projection, max_projection, shielded, false, db::NoSideAllowed); + return new_check_node (db::WidthRelation, false, d, whole_edges, metrics, ignore_angle, min_projection, max_projection, shielded, db::NoOppositeFilter, db::NoSideAllowed); } -static db::CompoundRegionOperationNode *new_space_check_node (db::Coord d, bool whole_edges, db::metrics_type metrics, const tl::Variant &ignore_angle, const tl::Variant &min_projection, const tl::Variant &max_projection, bool shielded, bool no_opposite, db::RectFilter rect_filter) +static db::CompoundRegionOperationNode *new_space_check_node (db::Coord d, bool whole_edges, db::metrics_type metrics, const tl::Variant &ignore_angle, const tl::Variant &min_projection, const tl::Variant &max_projection, bool shielded, db::OppositeFilter opposite_filter, db::RectFilter rect_filter) { - return new_check_node (db::SpaceRelation, true, d, whole_edges, metrics, ignore_angle, min_projection, max_projection, shielded, no_opposite, rect_filter); + return new_check_node (db::SpaceRelation, true, d, whole_edges, metrics, ignore_angle, min_projection, max_projection, shielded, opposite_filter, rect_filter); } static db::CompoundRegionOperationNode *new_notch_check_node (db::Coord d, bool whole_edges, db::metrics_type metrics, const tl::Variant &ignore_angle, const tl::Variant &min_projection, const tl::Variant &max_projection, bool shielded) { - return new_check_node (db::SpaceRelation, false, d, whole_edges, metrics, ignore_angle, min_projection, max_projection, shielded, false, db::NoSideAllowed); + return new_check_node (db::SpaceRelation, false, d, whole_edges, metrics, ignore_angle, min_projection, max_projection, shielded, db::NoOppositeFilter, db::NoSideAllowed); } -static db::CompoundRegionOperationNode *new_separation_check_node (db::CompoundRegionOperationNode *input, db::Coord d, bool whole_edges, db::metrics_type metrics, const tl::Variant &ignore_angle, const tl::Variant &min_projection, const tl::Variant &max_projection, bool shielded, bool no_opposite, db::RectFilter rect_filter) +static db::CompoundRegionOperationNode *new_separation_check_node (db::CompoundRegionOperationNode *input, db::Coord d, bool whole_edges, db::metrics_type metrics, const tl::Variant &ignore_angle, const tl::Variant &min_projection, const tl::Variant &max_projection, bool shielded, db::OppositeFilter opposite_filter, db::RectFilter rect_filter) { - return new_check_node (input, db::SpaceRelation, true, d, whole_edges, metrics, ignore_angle, min_projection, max_projection, shielded, no_opposite, rect_filter); + return new_check_node (input, db::SpaceRelation, true, d, whole_edges, metrics, ignore_angle, min_projection, max_projection, shielded, opposite_filter, rect_filter); } -static db::CompoundRegionOperationNode *new_overlap_check_node (db::CompoundRegionOperationNode *input, db::Coord d, bool whole_edges, db::metrics_type metrics, const tl::Variant &ignore_angle, const tl::Variant &min_projection, const tl::Variant &max_projection, bool shielded, bool no_opposite, db::RectFilter rect_filter) +static db::CompoundRegionOperationNode *new_overlap_check_node (db::CompoundRegionOperationNode *input, db::Coord d, bool whole_edges, db::metrics_type metrics, const tl::Variant &ignore_angle, const tl::Variant &min_projection, const tl::Variant &max_projection, bool shielded, db::OppositeFilter opposite_filter, db::RectFilter rect_filter) { - return new_check_node (input, db::OverlapRelation, true, d, whole_edges, metrics, ignore_angle, min_projection, max_projection, shielded, no_opposite, rect_filter); + return new_check_node (input, db::OverlapRelation, true, d, whole_edges, metrics, ignore_angle, min_projection, max_projection, shielded, opposite_filter, rect_filter); } -static db::CompoundRegionOperationNode *new_inside_check_node (db::CompoundRegionOperationNode *input, db::Coord d, bool whole_edges, db::metrics_type metrics, const tl::Variant &ignore_angle, const tl::Variant &min_projection, const tl::Variant &max_projection, bool shielded, bool no_opposite, db::RectFilter rect_filter) +static db::CompoundRegionOperationNode *new_inside_check_node (db::CompoundRegionOperationNode *input, db::Coord d, bool whole_edges, db::metrics_type metrics, const tl::Variant &ignore_angle, const tl::Variant &min_projection, const tl::Variant &max_projection, bool shielded, db::OppositeFilter opposite_filter, db::RectFilter rect_filter) { - return new_check_node (input, db::InsideRelation, true, d, whole_edges, metrics, ignore_angle, min_projection, max_projection, shielded, no_opposite, rect_filter); + return new_check_node (input, db::InsideRelation, true, d, whole_edges, metrics, ignore_angle, min_projection, max_projection, shielded, opposite_filter, rect_filter); } static db::CompoundRegionOperationNode *new_perimeter_filter (db::CompoundRegionOperationNode *input, db::coord_traits::perimeter_type pmin, db::coord_traits::perimeter_type pmax, bool inverse) @@ -334,19 +334,19 @@ Class decl_CompoundRegionOperationNode ("db", " gsi::constructor ("new_width_check", &new_width_check_node, gsi::arg ("d"), gsi::arg ("whole_edges", false), gsi::arg ("metrics", db::Euclidian), gsi::arg ("ignore_angle", tl::Variant (), "default"), gsi::arg ("min_projection", tl::Variant (), "0"), gsi::arg ("max_projection", tl::Variant (), "max."), gsi::arg ("shielded", true), "@brief Creates a node providing a width check.\n" ) + - gsi::constructor ("new_space_check", &new_space_check_node, gsi::arg ("d"), gsi::arg ("whole_edges", false), gsi::arg ("metrics", db::Euclidian), gsi::arg ("ignore_angle", tl::Variant (), "default"), gsi::arg ("min_projection", tl::Variant (), "0"), gsi::arg ("max_projection", tl::Variant (), "max."), gsi::arg ("shielded", true), gsi::arg ("not_opposite", false), gsi::arg ("rect_filter", db::NoSideAllowed), + gsi::constructor ("new_space_check", &new_space_check_node, gsi::arg ("d"), gsi::arg ("whole_edges", false), gsi::arg ("metrics", db::Euclidian), gsi::arg ("ignore_angle", tl::Variant (), "default"), gsi::arg ("min_projection", tl::Variant (), "0"), gsi::arg ("max_projection", tl::Variant (), "max."), gsi::arg ("shielded", true), gsi::arg ("opposite_filter", db::NoOppositeFilter), gsi::arg ("rect_filter", db::NoSideAllowed), "@brief Creates a node providing a space check.\n" ) + gsi::constructor ("new_notch_check", &new_notch_check_node, gsi::arg ("d"), gsi::arg ("whole_edges", false), gsi::arg ("metrics", db::Euclidian), gsi::arg ("ignore_angle", tl::Variant (), "default"), gsi::arg ("min_projection", tl::Variant (), "0"), gsi::arg ("max_projection", tl::Variant (), "max."), gsi::arg ("shielded", true), "@brief Creates a node providing a intra-polygon space check.\n" ) + - gsi::constructor ("new_separation_check", &new_separation_check_node, gsi::arg ("input"), gsi::arg ("d"), gsi::arg ("whole_edges", false), gsi::arg ("metrics", db::Euclidian), gsi::arg ("ignore_angle", tl::Variant (), "default"), gsi::arg ("min_projection", tl::Variant (), "0"), gsi::arg ("max_projection", tl::Variant (), "max."), gsi::arg ("shielded", true), gsi::arg ("not_opposite", false), gsi::arg ("rect_filter", db::NoSideAllowed), + gsi::constructor ("new_separation_check", &new_separation_check_node, gsi::arg ("input"), gsi::arg ("d"), gsi::arg ("whole_edges", false), gsi::arg ("metrics", db::Euclidian), gsi::arg ("ignore_angle", tl::Variant (), "default"), gsi::arg ("min_projection", tl::Variant (), "0"), gsi::arg ("max_projection", tl::Variant (), "max."), gsi::arg ("shielded", true), gsi::arg ("opposite_filter", db::NoOppositeFilter), gsi::arg ("rect_filter", db::NoSideAllowed), "@brief Creates a node providing a separation check.\n" ) + - gsi::constructor ("new_overlap_check", &new_overlap_check_node, gsi::arg ("input"), gsi::arg ("d"), gsi::arg ("whole_edges", false), gsi::arg ("metrics", db::Euclidian), gsi::arg ("ignore_angle", tl::Variant (), "default"), gsi::arg ("min_projection", tl::Variant (), "0"), gsi::arg ("max_projection", tl::Variant (), "max."), gsi::arg ("shielded", true), gsi::arg ("not_opposite", false), gsi::arg ("rect_filter", db::NoSideAllowed), + gsi::constructor ("new_overlap_check", &new_overlap_check_node, gsi::arg ("input"), gsi::arg ("d"), gsi::arg ("whole_edges", false), gsi::arg ("metrics", db::Euclidian), gsi::arg ("ignore_angle", tl::Variant (), "default"), gsi::arg ("min_projection", tl::Variant (), "0"), gsi::arg ("max_projection", tl::Variant (), "max."), gsi::arg ("shielded", true), gsi::arg ("opposite_filter", db::NoOppositeFilter), gsi::arg ("rect_filter", db::NoSideAllowed), "@brief Creates a node providing an overlap check.\n" ) + - gsi::constructor ("new_inside_check", &new_inside_check_node, gsi::arg ("input"), gsi::arg ("d"), gsi::arg ("whole_edges", false), gsi::arg ("metrics", db::Euclidian), gsi::arg ("ignore_angle", tl::Variant (), "default"), gsi::arg ("min_projection", tl::Variant (), "0"), gsi::arg ("max_projection", tl::Variant (), "max."), gsi::arg ("shielded", true), gsi::arg ("not_opposite", false), gsi::arg ("rect_filter", db::NoSideAllowed), + gsi::constructor ("new_inside_check", &new_inside_check_node, gsi::arg ("input"), gsi::arg ("d"), gsi::arg ("whole_edges", false), gsi::arg ("metrics", db::Euclidian), gsi::arg ("ignore_angle", tl::Variant (), "default"), gsi::arg ("min_projection", tl::Variant (), "0"), gsi::arg ("max_projection", tl::Variant (), "max."), gsi::arg ("shielded", true), gsi::arg ("opposite_filter", db::NoOppositeFilter), gsi::arg ("rect_filter", db::NoSideAllowed), "@brief Creates a node providing an inside (enclosure) check.\n" ) + gsi::constructor ("new_perimeter_filter", &new_perimeter_filter, gsi::arg ("input"), gsi::arg ("pmin", 0), gsi::arg ("pmax", std::numeric_limits::perimeter_type>::max (), "max"), gsi::arg ("inverse", false), @@ -481,7 +481,7 @@ gsi::Enum decl_dbPreferredOrientation ("db", "Preferre "This enum has been introduced in version 0.27." ); -gsi::EnumIn decl_dbRegionBBoxFilter_ParameterType ("db", "ParameterType", +gsi::EnumIn decl_dbRegionBBoxFilter_ParameterType ("db", "ParameterType", gsi::enum_const ("BoxWidth", db::RegionBBoxFilter::BoxWidth, "@brief Measures the width of the bounding box\n" ) + diff --git a/src/db/db/gsiDeclDbRegion.cc b/src/db/db/gsiDeclDbRegion.cc index 3df8b4589..1bbbcff0b 100644 --- a/src/db/db/gsiDeclDbRegion.cc +++ b/src/db/db/gsiDeclDbRegion.cc @@ -449,7 +449,7 @@ static db::EdgePairs width2 (const db::Region *r, db::Region::distance_type d, b ); } -static db::EdgePairs space2 (const db::Region *r, db::Region::distance_type d, bool whole_edges, db::metrics_type metrics, const tl::Variant &ignore_angle, const tl::Variant &min_projection, const tl::Variant &max_projection, bool shielded, bool not_opposite, db::RectFilter rect_filter) +static db::EdgePairs space2 (const db::Region *r, db::Region::distance_type d, bool whole_edges, db::metrics_type metrics, const tl::Variant &ignore_angle, const tl::Variant &min_projection, const tl::Variant &max_projection, bool shielded, db::OppositeFilter opposite, db::RectFilter rect_filter) { return r->space_check (d, db::RegionCheckOptions (whole_edges, metrics, @@ -457,7 +457,7 @@ static db::EdgePairs space2 (const db::Region *r, db::Region::distance_type d, b min_projection.is_nil () ? db::Region::distance_type (0) : min_projection.to (), max_projection.is_nil () ? std::numeric_limits::max () : max_projection.to (), shielded, - not_opposite, + opposite, rect_filter) ); } @@ -473,7 +473,7 @@ static db::EdgePairs notch2 (const db::Region *r, db::Region::distance_type d, b ); } -static db::EdgePairs isolated2 (const db::Region *r, db::Region::distance_type d, bool whole_edges, db::metrics_type metrics, const tl::Variant &ignore_angle, const tl::Variant &min_projection, const tl::Variant &max_projection, bool shielded, bool not_opposite, db::RectFilter rect_filter) +static db::EdgePairs isolated2 (const db::Region *r, db::Region::distance_type d, bool whole_edges, db::metrics_type metrics, const tl::Variant &ignore_angle, const tl::Variant &min_projection, const tl::Variant &max_projection, bool shielded, db::OppositeFilter opposite, db::RectFilter rect_filter) { return r->isolated_check (d, db::RegionCheckOptions (whole_edges, metrics, @@ -481,12 +481,12 @@ static db::EdgePairs isolated2 (const db::Region *r, db::Region::distance_type d min_projection.is_nil () ? db::Region::distance_type (0) : min_projection.to (), max_projection.is_nil () ? std::numeric_limits::max () : max_projection.to (), shielded, - not_opposite, + opposite, rect_filter) ); } -static db::EdgePairs inside2 (const db::Region *r, const db::Region &other, db::Region::distance_type d, bool whole_edges, db::metrics_type metrics, const tl::Variant &ignore_angle, const tl::Variant &min_projection, const tl::Variant &max_projection, bool shielded, bool not_opposite, db::RectFilter rect_filter) +static db::EdgePairs inside2 (const db::Region *r, const db::Region &other, db::Region::distance_type d, bool whole_edges, db::metrics_type metrics, const tl::Variant &ignore_angle, const tl::Variant &min_projection, const tl::Variant &max_projection, bool shielded, db::OppositeFilter opposite, db::RectFilter rect_filter) { return r->inside_check (other, d, db::RegionCheckOptions (whole_edges, metrics, @@ -494,12 +494,12 @@ static db::EdgePairs inside2 (const db::Region *r, const db::Region &other, db:: min_projection.is_nil () ? db::Region::distance_type (0) : min_projection.to (), max_projection.is_nil () ? std::numeric_limits::max () : max_projection.to (), shielded, - not_opposite, + opposite, rect_filter) ); } -static db::EdgePairs overlap2 (const db::Region *r, const db::Region &other, db::Region::distance_type d, bool whole_edges, db::metrics_type metrics, const tl::Variant &ignore_angle, const tl::Variant &min_projection, const tl::Variant &max_projection, bool shielded, bool not_opposite, db::RectFilter rect_filter) +static db::EdgePairs overlap2 (const db::Region *r, const db::Region &other, db::Region::distance_type d, bool whole_edges, db::metrics_type metrics, const tl::Variant &ignore_angle, const tl::Variant &min_projection, const tl::Variant &max_projection, bool shielded, db::OppositeFilter opposite, db::RectFilter rect_filter) { return r->overlap_check (other, d, db::RegionCheckOptions (whole_edges, metrics, @@ -507,12 +507,12 @@ static db::EdgePairs overlap2 (const db::Region *r, const db::Region &other, db: min_projection.is_nil () ? db::Region::distance_type (0) : min_projection.to (), max_projection.is_nil () ? std::numeric_limits::max () : max_projection.to (), shielded, - not_opposite, + opposite, rect_filter) ); } -static db::EdgePairs enclosing2 (const db::Region *r, const db::Region &other, db::Region::distance_type d, bool whole_edges, db::metrics_type metrics, const tl::Variant &ignore_angle, const tl::Variant &min_projection, const tl::Variant &max_projection, bool shielded, bool not_opposite, db::RectFilter rect_filter) +static db::EdgePairs enclosing2 (const db::Region *r, const db::Region &other, db::Region::distance_type d, bool whole_edges, db::metrics_type metrics, const tl::Variant &ignore_angle, const tl::Variant &min_projection, const tl::Variant &max_projection, bool shielded, db::OppositeFilter opposite, db::RectFilter rect_filter) { return r->enclosing_check (other, d, db::RegionCheckOptions (whole_edges, metrics, @@ -520,12 +520,12 @@ static db::EdgePairs enclosing2 (const db::Region *r, const db::Region &other, d min_projection.is_nil () ? db::Region::distance_type (0) : min_projection.to (), max_projection.is_nil () ? std::numeric_limits::max () : max_projection.to (), shielded, - not_opposite, + opposite, rect_filter) ); } -static db::EdgePairs separation2 (const db::Region *r, const db::Region &other, db::Region::distance_type d, bool whole_edges, db::metrics_type metrics, const tl::Variant &ignore_angle, const tl::Variant &min_projection, const tl::Variant &max_projection, bool shielded, bool not_opposite, db::RectFilter rect_filter) +static db::EdgePairs separation2 (const db::Region *r, const db::Region &other, db::Region::distance_type d, bool whole_edges, db::metrics_type metrics, const tl::Variant &ignore_angle, const tl::Variant &min_projection, const tl::Variant &max_projection, bool shielded, db::OppositeFilter opposite, db::RectFilter rect_filter) { return r->separation_check (other, d, db::RegionCheckOptions (whole_edges, metrics, @@ -533,7 +533,7 @@ static db::EdgePairs separation2 (const db::Region *r, const db::Region &other, min_projection.is_nil () ? db::Region::distance_type (0) : min_projection.to (), max_projection.is_nil () ? std::numeric_limits::max () : max_projection.to (), shielded, - not_opposite, + opposite, rect_filter) ); } @@ -2015,7 +2015,7 @@ Class decl_Region (decl_dbShapeCollection, "db", "Region", "\n" "The 'shielded' option has been introduced in version 0.27." ) + - method_ext ("space_check", &space2, gsi::arg ("d"), gsi::arg ("whole_edges", false), gsi::arg ("metrics", db::metrics_type::Euclidian), gsi::arg ("ignore_angle", tl::Variant (), "default"), gsi::arg ("min_projection", tl::Variant (), "0"), gsi::arg ("max_projection", tl::Variant (), "max"), gsi::arg ("shielded", true), gsi::arg ("not_opposite", false), gsi::arg ("rect_filter", db::NoSideAllowed), + method_ext ("space_check", &space2, gsi::arg ("d"), gsi::arg ("whole_edges", false), gsi::arg ("metrics", db::metrics_type::Euclidian), gsi::arg ("ignore_angle", tl::Variant (), "default"), gsi::arg ("min_projection", tl::Variant (), "0"), gsi::arg ("max_projection", tl::Variant (), "max"), gsi::arg ("shielded", true), gsi::arg ("opposite_filter", db::NoOppositeFilter), gsi::arg ("rect_filter", db::NoSideAllowed), "@brief Performs a space check with options\n" "@param d The minimum space for which the polygons are checked\n" "@param whole_edges If true, deliver the whole edges\n" @@ -2023,13 +2023,11 @@ Class decl_Region (decl_dbShapeCollection, "db", "Region", "@param ignore_angle The angle above which no check is performed\n" "@param min_projection The lower threshold of the projected length of one edge onto another\n" "@param max_projection The upper limit of the projected length of one edge onto another\n" - "@param shielded Enables shielding\n" - "\n" - "This version is similar to the simple version with one parameter. In addition, it allows " - "to specify many more options.\n" + "@param opposite_filter Specifies a filter mode for errors happening on opposite sides of inputs shapes\n" + "@param rect_filter Specifies an error filter for rectangular input shapes\n" "\n" "If \"whole_edges\" is true, the resulting \\EdgePairs collection will receive the whole " - "edges which contribute in the space check.\n" + "edges which contribute in the width check.\n" "\n" "\"metrics\" can be one of the constants \\Euclidian, \\Square or \\Projection. See there for " "a description of these constants.\n" @@ -2051,7 +2049,7 @@ Class decl_Region (decl_dbShapeCollection, "db", "Region", "violations between the original and the shielding features. If not necessary, shielding can be disabled by setting this flag to " "false. In general, this will improve performance somewhat.\n" "\n" - "\"not_opposite\" will supress all errors happening on both of two opposite sides of the input figures. " + "\"opposite_filter\" specifies whether to require or reject errors happening on opposite sides of a figure. " "\"rect_filter\" allows suppressing specific error configurations on rectangular input figures.\n" "\n" "Merged semantics applies for the input of this method (see \\merged_semantics= of merged semantics)\n" @@ -2098,7 +2096,7 @@ Class decl_Region (decl_dbShapeCollection, "db", "Region", "\n" "The 'shielded' option has been introduced in version 0.27." ) + - method_ext ("isolated_check", &isolated2, gsi::arg ("d"), gsi::arg ("whole_edges", false), gsi::arg ("metrics", db::metrics_type::Euclidian), gsi::arg ("ignore_angle", tl::Variant (), "default"), gsi::arg ("min_projection", tl::Variant (), "0"), gsi::arg ("max_projection", tl::Variant (), "max"), gsi::arg ("shielded", true), gsi::arg ("not_opposite", false), gsi::arg ("rect_filter", db::NoSideAllowed), + method_ext ("isolated_check", &isolated2, gsi::arg ("d"), gsi::arg ("whole_edges", false), gsi::arg ("metrics", db::metrics_type::Euclidian), gsi::arg ("ignore_angle", tl::Variant (), "default"), gsi::arg ("min_projection", tl::Variant (), "0"), gsi::arg ("max_projection", tl::Variant (), "max"), gsi::arg ("shielded", true), gsi::arg ("opposite_filter", db::NoOppositeFilter), gsi::arg ("rect_filter", db::NoSideAllowed), "@brief Performs a space check between edges of different polygons with options\n" "@param d The minimum space for which the polygons are checked\n" "@param whole_edges If true, deliver the whole edges\n" @@ -2106,185 +2104,7 @@ Class decl_Region (decl_dbShapeCollection, "db", "Region", "@param ignore_angle The angle above which no check is performed\n" "@param min_projection The lower threshold of the projected length of one edge onto another\n" "@param max_projection The upper limit of the projected length of one edge onto another\n" - "@param shielded Enables shielding\n" - "\n" - "This version is similar to the simple version with one parameter. In addition, it allows " - "to specify many more options.\n" - "\n" - "If \"whole_edges\" is true, the resulting \\EdgePairs collection will receive the whole " - "edges which contribute in the space check.\n" - "\n" - "\"metrics\" can be one of the constants \\Euclidian, \\Square or \\Projection. See there for " - "a description of these constants.\n" - "Use nil for this value to select the default (Euclidian metrics).\n" - "\n" - "\"ignore_angle\" specifies the angle limit of two edges. If two edges form an angle equal or " - "above the given value, they will not contribute in the check. " - "Setting this value to 90 (the default) will exclude edges with an angle of 90 degree or more from the check.\n" - "Use nil for this value to select the default.\n" - "\n" - "\"min_projection\" and \"max_projection\" allow selecting edges by their projected value upon each other. " - "It is sufficient if the projection of one edge on the other matches the specified condition. " - "The projected length must be larger or equal to \"min_projection\" and less than \"max_projection\". " - "If you don't want to specify one limit, pass nil to the respective value.\n" - "\n" - "\"shielded\" controls whether shielding is applied. Shielding means that rule violations are not " - "detected 'through' other features. Measurements are only made where the opposite edge is unobstructed.\n" - "Shielding often is not optional as a rule violation in shielded case automatically comes with rule " - "violations between the original and the shielding features. If not necessary, shielding can be disabled by setting this flag to " - "false. In general, this will improve performance somewhat.\n" - "\n" - "\"not_opposite\" will supress all errors happening on both of two opposite sides of the input figures. " - "\"rect_filter\" allows suppressing specific error configurations on rectangular input figures.\n" - "\n" - "Merged semantics applies for the input of this method (see \\merged_semantics= of merged semantics)\n" - "\n" - "The 'shielded', 'not_opposite' and 'rect_sides' options have been introduced in version 0.27." - ) + - method_ext ("inside_check", &inside2, gsi::arg ("other"), gsi::arg ("d"), gsi::arg ("whole_edges", false), gsi::arg ("metrics", db::metrics_type::Euclidian), gsi::arg ("ignore_angle", tl::Variant (), "default"), gsi::arg ("min_projection", tl::Variant (), "0"), gsi::arg ("max_projection", tl::Variant (), "max"), gsi::arg ("shielded", true), gsi::arg ("not_opposite", false), gsi::arg ("rect_filter", db::NoSideAllowed), - "@brief Performs an inside check with options\n" - "@param d The minimum distance for which the polygons are checked\n" - "@param other The other region against which to check\n" - "@param whole_edges If true, deliver the whole edges\n" - "@param metrics Specify the metrics type\n" - "@param ignore_angle The angle above which no check is performed\n" - "@param min_projection The lower threshold of the projected length of one edge onto another\n" - "@param max_projection The upper limit of the projected length of one edge onto another\n" - "@param shielded Enables shielding\n" - "\n" - "This version is similar to the simple version with one parameter. In addition, it allows " - "to specify many more options.\n" - "\n" - "If \"whole_edges\" is true, the resulting \\EdgePairs collection will receive the whole " - "edges which contribute in the width check.\n" - "\n" - "\"metrics\" can be one of the constants \\Euclidian, \\Square or \\Projection. See there for " - "a description of these constants.\n" - "Use nil for this value to select the default (Euclidian metrics).\n" - "\n" - "\"ignore_angle\" specifies the angle limit of two edges. If two edges form an angle equal or " - "above the given value, they will not contribute in the check. " - "Setting this value to 90 (the default) will exclude edges with an angle of 90 degree or more from the check.\n" - "Use nil for this value to select the default.\n" - "\n" - "\"min_projection\" and \"max_projection\" allow selecting edges by their projected value upon each other. " - "It is sufficient if the projection of one edge on the other matches the specified condition. " - "The projected length must be larger or equal to \"min_projection\" and less than \"max_projection\". " - "If you don't want to specify one limit, pass nil to the respective value.\n" - "\n" - "\"shielded\" controls whether shielding is applied. Shielding means that rule violations are not " - "detected 'through' other features. Measurements are only made where the opposite edge is unobstructed.\n" - "Shielding often is not optional as a rule violation in shielded case automatically comes with rule " - "violations between the original and the shielding features. If not necessary, shielding can be disabled by setting this flag to " - "false. In general, this will improve performance somewhat.\n" - "\n" - "\"not_opposite\" will supress all errors happening on both of two opposite sides of the input figures. " - "\"rect_filter\" allows suppressing specific error configurations on rectangular input figures.\n" - "\n" - "Merged semantics applies for the input of this method (see \\merged_semantics= of merged semantics)\n" - "\n" - "The 'shielded', 'not_opposite' and 'rect_sides' options have been introduced in version 0.27." - ) + - method_ext ("overlap_check", &overlap2, gsi::arg ("other"), gsi::arg ("d"), gsi::arg ("whole_edges", false), gsi::arg ("metrics", db::metrics_type::Euclidian), gsi::arg ("ignore_angle", tl::Variant (), "default"), gsi::arg ("min_projection", tl::Variant (), "0"), gsi::arg ("max_projection", tl::Variant (), "max"), gsi::arg ("shielded", true), gsi::arg ("not_opposite", false), gsi::arg ("rect_filter", db::NoSideAllowed), - "@brief Performs an overlap check with options\n" - "@param d The minimum overlap for which the polygons are checked\n" - "@param other The other region against which to check\n" - "@param whole_edges If true, deliver the whole edges\n" - "@param metrics Specify the metrics type\n" - "@param ignore_angle The angle above which no check is performed\n" - "@param min_projection The lower threshold of the projected length of one edge onto another\n" - "@param max_projection The upper limit of the projected length of one edge onto another\n" - "@param shielded Enables shielding\n" - "\n" - "This version is similar to the simple version with one parameter. In addition, it allows " - "to specify many more options.\n" - "\n" - "If \"whole_edges\" is true, the resulting \\EdgePairs collection will receive the whole " - "edges which contribute in the width check.\n" - "\n" - "\"metrics\" can be one of the constants \\Euclidian, \\Square or \\Projection. See there for " - "a description of these constants.\n" - "Use nil for this value to select the default (Euclidian metrics).\n" - "\n" - "\"ignore_angle\" specifies the angle limit of two edges. If two edges form an angle equal or " - "above the given value, they will not contribute in the check. " - "Setting this value to 90 (the default) will exclude edges with an angle of 90 degree or more from the check.\n" - "Use nil for this value to select the default.\n" - "\n" - "\"min_projection\" and \"max_projection\" allow selecting edges by their projected value upon each other. " - "It is sufficient if the projection of one edge on the other matches the specified condition. " - "The projected length must be larger or equal to \"min_projection\" and less than \"max_projection\". " - "If you don't want to specify one limit, pass nil to the respective value.\n" - "\n" - "\"shielded\" controls whether shielding is applied. Shielding means that rule violations are not " - "detected 'through' other features. Measurements are only made where the opposite edge is unobstructed.\n" - "Shielding often is not optional as a rule violation in shielded case automatically comes with rule " - "violations between the original and the shielding features. If not necessary, shielding can be disabled by setting this flag to " - "false. In general, this will improve performance somewhat.\n" - "\n" - "\"not_opposite\" will supress all errors happening on both of two opposite sides of the input figures. " - "\"rect_filter\" allows suppressing specific error configurations on rectangular input figures.\n" - "\n" - "Merged semantics applies for the input of this method (see \\merged_semantics= of merged semantics)\n" - "\n" - "The 'shielded', 'not_opposite' and 'rect_sides' options have been introduced in version 0.27." - ) + - method_ext ("enclosing_check", &enclosing2, gsi::arg ("other"), gsi::arg ("d"), gsi::arg ("whole_edges", false), gsi::arg ("metrics", db::metrics_type::Euclidian), gsi::arg ("ignore_angle", tl::Variant (), "default"), gsi::arg ("min_projection", tl::Variant (), "0"), gsi::arg ("max_projection", tl::Variant (), "max"), gsi::arg ("shielded", true), gsi::arg ("not_opposite", false), gsi::arg ("rect_filter", db::NoSideAllowed), - "@brief Performs an enclosing check with options\n" - "@param d The minimum enclosing distance for which the polygons are checked\n" - "@param other The other region against which to check\n" - "@param whole_edges If true, deliver the whole edges\n" - "@param metrics Specify the metrics type\n" - "@param ignore_angle The angle above which no check is performed\n" - "@param min_projection The lower threshold of the projected length of one edge onto another\n" - "@param max_projection The upper limit of the projected length of one edge onto another\n" - "@param shielded Enables shielding\n" - "@param not_opposite Reports error edges only if not opposite to other edges on the original figure\n" - "@param rect_filter Filters out certain allowed errors on rectangle input shapes\n" - "\n" - "This version is similar to the simple version with one parameter. In addition, it allows " - "to specify many more options.\n" - "\n" - "If \"whole_edges\" is true, the resulting \\EdgePairs collection will receive the whole " - "edges which contribute in the width check.\n" - "\n" - "\"metrics\" can be one of the constants \\Euclidian, \\Square or \\Projection. See there for " - "a description of these constants.\n" - "Use nil for this value to select the default (Euclidian metrics).\n" - "\n" - "\"ignore_angle\" specifies the angle limit of two edges. If two edges form an angle equal or " - "above the given value, they will not contribute in the check. " - "Setting this value to 90 (the default) will exclude edges with an angle of 90 degree or more from the check.\n" - "Use nil for this value to select the default.\n" - "\n" - "\"min_projection\" and \"max_projection\" allow selecting edges by their projected value upon each other. " - "It is sufficient if the projection of one edge on the other matches the specified condition. " - "The projected length must be larger or equal to \"min_projection\" and less than \"max_projection\". " - "If you don't want to specify one limit, pass nil to the respective value.\n" - "\n" - "\"shielded\" controls whether shielding is applied. Shielding means that rule violations are not " - "detected 'through' other features. Measurements are only made where the opposite edge is unobstructed.\n" - "Shielding often is not optional as a rule violation in shielded case automatically comes with rule " - "violations between the original and the shielding features. If not necessary, shielding can be disabled by setting this flag to " - "false. In general, this will improve performance somewhat.\n" - "\n" - "\"not_opposite\" will supress all errors happening on both of two opposite sides of the input figures. " - "\"rect_filter\" allows suppressing specific error configurations on rectangular input figures.\n" - "\n" - "Merged semantics applies for the input of this method (see \\merged_semantics= of merged semantics)\n" - "\n" - "The 'shielded', 'not_opposite' and 'rect_sides' options have been introduced in version 0.27." - ) + - method_ext ("separation_check", &separation2, gsi::arg ("other"), gsi::arg ("d"), gsi::arg ("whole_edges", false), gsi::arg ("metrics", db::metrics_type::Euclidian), gsi::arg ("ignore_angle", tl::Variant (), "default"), gsi::arg ("min_projection", tl::Variant (), "0"), gsi::arg ("max_projection", tl::Variant (), "max"), gsi::arg ("shielded", true), gsi::arg ("not_opposite", false), gsi::arg ("rect_filter", db::NoSideAllowed), - "@brief Performs a separation check with options\n" - "@param d The minimum separation for which the polygons are checked\n" - "@param other The other region against which to check\n" - "@param whole_edges If true, deliver the whole edges\n" - "@param metrics Specify the metrics type\n" - "@param ignore_angle The angle above which no check is performed\n" - "@param min_projection The lower threshold of the projected length of one edge onto another\n" - "@param max_projection The upper limit of the projected length of one edge onto another\n" - "@param not_opposite Reports error edges only if not opposite to other edges on the original figure\n" + "@param opposite_filter Specifies a filter mode for errors happening on opposite sides of inputs shapes\n" "@param rect_filter Specifies an error filter for rectangular input shapes\n" "\n" "If \"whole_edges\" is true, the resulting \\EdgePairs collection will receive the whole " @@ -2310,7 +2130,175 @@ Class decl_Region (decl_dbShapeCollection, "db", "Region", "violations between the original and the shielding features. If not necessary, shielding can be disabled by setting this flag to " "false. In general, this will improve performance somewhat.\n" "\n" - "\"not_opposite\" will supress all errors happening on both of two opposite sides of the input figures. " + "\"opposite_filter\" specifies whether to require or reject errors happening on opposite sides of a figure. " + "\"rect_filter\" allows suppressing specific error configurations on rectangular input figures.\n" + "\n" + "Merged semantics applies for the input of this method (see \\merged_semantics= of merged semantics)\n" + "\n" + "The 'shielded', 'not_opposite' and 'rect_sides' options have been introduced in version 0.27." + ) + + method_ext ("inside_check", &inside2, gsi::arg ("other"), gsi::arg ("d"), gsi::arg ("whole_edges", false), gsi::arg ("metrics", db::metrics_type::Euclidian), gsi::arg ("ignore_angle", tl::Variant (), "default"), gsi::arg ("min_projection", tl::Variant (), "0"), gsi::arg ("max_projection", tl::Variant (), "max"), gsi::arg ("shielded", true), gsi::arg ("opposite_filter", db::NoOppositeFilter), gsi::arg ("rect_filter", db::NoSideAllowed), + "@brief Performs an inside check with options\n" + "@param d The minimum distance for which the polygons are checked\n" + "@param other The other region against which to check\n" + "@param whole_edges If true, deliver the whole edges\n" + "@param metrics Specify the metrics type\n" + "@param ignore_angle The angle above which no check is performed\n" + "@param min_projection The lower threshold of the projected length of one edge onto another\n" + "@param max_projection The upper limit of the projected length of one edge onto another\n" + "@param opposite_filter Specifies a filter mode for errors happening on opposite sides of inputs shapes\n" + "@param rect_filter Specifies an error filter for rectangular input shapes\n" + "\n" + "If \"whole_edges\" is true, the resulting \\EdgePairs collection will receive the whole " + "edges which contribute in the width check.\n" + "\n" + "\"metrics\" can be one of the constants \\Euclidian, \\Square or \\Projection. See there for " + "a description of these constants.\n" + "Use nil for this value to select the default (Euclidian metrics).\n" + "\n" + "\"ignore_angle\" specifies the angle limit of two edges. If two edges form an angle equal or " + "above the given value, they will not contribute in the check. " + "Setting this value to 90 (the default) will exclude edges with an angle of 90 degree or more from the check.\n" + "Use nil for this value to select the default.\n" + "\n" + "\"min_projection\" and \"max_projection\" allow selecting edges by their projected value upon each other. " + "It is sufficient if the projection of one edge on the other matches the specified condition. " + "The projected length must be larger or equal to \"min_projection\" and less than \"max_projection\". " + "If you don't want to specify one limit, pass nil to the respective value.\n" + "\n" + "\"shielded\" controls whether shielding is applied. Shielding means that rule violations are not " + "detected 'through' other features. Measurements are only made where the opposite edge is unobstructed.\n" + "Shielding often is not optional as a rule violation in shielded case automatically comes with rule " + "violations between the original and the shielding features. If not necessary, shielding can be disabled by setting this flag to " + "false. In general, this will improve performance somewhat.\n" + "\n" + "\"opposite_filter\" specifies whether to require or reject errors happening on opposite sides of a figure. " + "\"rect_filter\" allows suppressing specific error configurations on rectangular input figures.\n" + "\n" + "Merged semantics applies for the input of this method (see \\merged_semantics= of merged semantics)\n" + "\n" + "The 'shielded', 'not_opposite' and 'rect_sides' options have been introduced in version 0.27." + ) + + method_ext ("overlap_check", &overlap2, gsi::arg ("other"), gsi::arg ("d"), gsi::arg ("whole_edges", false), gsi::arg ("metrics", db::metrics_type::Euclidian), gsi::arg ("ignore_angle", tl::Variant (), "default"), gsi::arg ("min_projection", tl::Variant (), "0"), gsi::arg ("max_projection", tl::Variant (), "max"), gsi::arg ("shielded", true), gsi::arg ("opposite_filter", db::NoOppositeFilter), gsi::arg ("rect_filter", db::NoSideAllowed), + "@brief Performs an overlap check with options\n" + "@param d The minimum overlap for which the polygons are checked\n" + "@param other The other region against which to check\n" + "@param whole_edges If true, deliver the whole edges\n" + "@param metrics Specify the metrics type\n" + "@param ignore_angle The angle above which no check is performed\n" + "@param min_projection The lower threshold of the projected length of one edge onto another\n" + "@param max_projection The upper limit of the projected length of one edge onto another\n" + "@param opposite_filter Specifies a filter mode for errors happening on opposite sides of inputs shapes\n" + "@param rect_filter Specifies an error filter for rectangular input shapes\n" + "\n" + "If \"whole_edges\" is true, the resulting \\EdgePairs collection will receive the whole " + "edges which contribute in the width check.\n" + "\n" + "\"metrics\" can be one of the constants \\Euclidian, \\Square or \\Projection. See there for " + "a description of these constants.\n" + "Use nil for this value to select the default (Euclidian metrics).\n" + "\n" + "\"ignore_angle\" specifies the angle limit of two edges. If two edges form an angle equal or " + "above the given value, they will not contribute in the check. " + "Setting this value to 90 (the default) will exclude edges with an angle of 90 degree or more from the check.\n" + "Use nil for this value to select the default.\n" + "\n" + "\"min_projection\" and \"max_projection\" allow selecting edges by their projected value upon each other. " + "It is sufficient if the projection of one edge on the other matches the specified condition. " + "The projected length must be larger or equal to \"min_projection\" and less than \"max_projection\". " + "If you don't want to specify one limit, pass nil to the respective value.\n" + "\n" + "\"shielded\" controls whether shielding is applied. Shielding means that rule violations are not " + "detected 'through' other features. Measurements are only made where the opposite edge is unobstructed.\n" + "Shielding often is not optional as a rule violation in shielded case automatically comes with rule " + "violations between the original and the shielding features. If not necessary, shielding can be disabled by setting this flag to " + "false. In general, this will improve performance somewhat.\n" + "\n" + "\"opposite_filter\" specifies whether to require or reject errors happening on opposite sides of a figure. " + "\"rect_filter\" allows suppressing specific error configurations on rectangular input figures.\n" + "\n" + "Merged semantics applies for the input of this method (see \\merged_semantics= of merged semantics)\n" + "\n" + "The 'shielded', 'not_opposite' and 'rect_sides' options have been introduced in version 0.27." + ) + + method_ext ("enclosing_check", &enclosing2, gsi::arg ("other"), gsi::arg ("d"), gsi::arg ("whole_edges", false), gsi::arg ("metrics", db::metrics_type::Euclidian), gsi::arg ("ignore_angle", tl::Variant (), "default"), gsi::arg ("min_projection", tl::Variant (), "0"), gsi::arg ("max_projection", tl::Variant (), "max"), gsi::arg ("shielded", true), gsi::arg ("opposite_filter", db::NoOppositeFilter), gsi::arg ("rect_filter", db::NoSideAllowed), + "@brief Performs an enclosing check with options\n" + "@param d The minimum enclosing distance for which the polygons are checked\n" + "@param other The other region against which to check\n" + "@param whole_edges If true, deliver the whole edges\n" + "@param metrics Specify the metrics type\n" + "@param ignore_angle The angle above which no check is performed\n" + "@param min_projection The lower threshold of the projected length of one edge onto another\n" + "@param max_projection The upper limit of the projected length of one edge onto another\n" + "@param opposite_filter Specifies a filter mode for errors happening on opposite sides of inputs shapes\n" + "@param rect_filter Specifies an error filter for rectangular input shapes\n" + "\n" + "If \"whole_edges\" is true, the resulting \\EdgePairs collection will receive the whole " + "edges which contribute in the width check.\n" + "\n" + "\"metrics\" can be one of the constants \\Euclidian, \\Square or \\Projection. See there for " + "a description of these constants.\n" + "Use nil for this value to select the default (Euclidian metrics).\n" + "\n" + "\"ignore_angle\" specifies the angle limit of two edges. If two edges form an angle equal or " + "above the given value, they will not contribute in the check. " + "Setting this value to 90 (the default) will exclude edges with an angle of 90 degree or more from the check.\n" + "Use nil for this value to select the default.\n" + "\n" + "\"min_projection\" and \"max_projection\" allow selecting edges by their projected value upon each other. " + "It is sufficient if the projection of one edge on the other matches the specified condition. " + "The projected length must be larger or equal to \"min_projection\" and less than \"max_projection\". " + "If you don't want to specify one limit, pass nil to the respective value.\n" + "\n" + "\"shielded\" controls whether shielding is applied. Shielding means that rule violations are not " + "detected 'through' other features. Measurements are only made where the opposite edge is unobstructed.\n" + "Shielding often is not optional as a rule violation in shielded case automatically comes with rule " + "violations between the original and the shielding features. If not necessary, shielding can be disabled by setting this flag to " + "false. In general, this will improve performance somewhat.\n" + "\n" + "\"opposite_filter\" specifies whether to require or reject errors happening on opposite sides of a figure. " + "\"rect_filter\" allows suppressing specific error configurations on rectangular input figures.\n" + "\n" + "Merged semantics applies for the input of this method (see \\merged_semantics= of merged semantics)\n" + "\n" + "The 'shielded', 'not_opposite' and 'rect_sides' options have been introduced in version 0.27." + ) + + method_ext ("separation_check", &separation2, gsi::arg ("other"), gsi::arg ("d"), gsi::arg ("whole_edges", false), gsi::arg ("metrics", db::metrics_type::Euclidian), gsi::arg ("ignore_angle", tl::Variant (), "default"), gsi::arg ("min_projection", tl::Variant (), "0"), gsi::arg ("max_projection", tl::Variant (), "max"), gsi::arg ("shielded", true), gsi::arg ("opposite_filter", db::NoOppositeFilter), gsi::arg ("rect_filter", db::NoSideAllowed), + "@brief Performs a separation check with options\n" + "@param d The minimum separation for which the polygons are checked\n" + "@param other The other region against which to check\n" + "@param whole_edges If true, deliver the whole edges\n" + "@param metrics Specify the metrics type\n" + "@param ignore_angle The angle above which no check is performed\n" + "@param min_projection The lower threshold of the projected length of one edge onto another\n" + "@param max_projection The upper limit of the projected length of one edge onto another\n" + "@param opposite_filter Specifies a filter mode for errors happening on opposite sides of inputs shapes\n" + "@param rect_filter Specifies an error filter for rectangular input shapes\n" + "\n" + "If \"whole_edges\" is true, the resulting \\EdgePairs collection will receive the whole " + "edges which contribute in the width check.\n" + "\n" + "\"metrics\" can be one of the constants \\Euclidian, \\Square or \\Projection. See there for " + "a description of these constants.\n" + "Use nil for this value to select the default (Euclidian metrics).\n" + "\n" + "\"ignore_angle\" specifies the angle limit of two edges. If two edges form an angle equal or " + "above the given value, they will not contribute in the check. " + "Setting this value to 90 (the default) will exclude edges with an angle of 90 degree or more from the check.\n" + "Use nil for this value to select the default.\n" + "\n" + "\"min_projection\" and \"max_projection\" allow selecting edges by their projected value upon each other. " + "It is sufficient if the projection of one edge on the other matches the specified condition. " + "The projected length must be larger or equal to \"min_projection\" and less than \"max_projection\". " + "If you don't want to specify one limit, pass nil to the respective value.\n" + "\n" + "\"shielded\" controls whether shielding is applied. Shielding means that rule violations are not " + "detected 'through' other features. Measurements are only made where the opposite edge is unobstructed.\n" + "Shielding often is not optional as a rule violation in shielded case automatically comes with rule " + "violations between the original and the shielding features. If not necessary, shielding can be disabled by setting this flag to " + "false. In general, this will improve performance somewhat.\n" + "\n" + "\"opposite_filter\" specifies whether to require or reject errors happening on opposite sides of a figure. " "\"rect_filter\" allows suppressing specific error configurations on rectangular input figures.\n" "\n" "Merged semantics applies for the input of this method (see \\merged_semantics= of merged semantics)\n" @@ -2546,5 +2534,21 @@ gsi::EnumIn decl_Region_RectFilter ("db", "RectFilte "This enum has been introduced in version 0.27." ); + +gsi::EnumIn decl_Region_OppositeFilter ("db", "OppositeFilter", + gsi::enum_const ("NoOppositeFilter", db::OppositeFilter::NoOppositeFilter, + "@brief No opposite filtering\n" + ) + + gsi::enum_const ("OnlyOpposite", db::OppositeFilter::OnlyOpposite, + "@brief Only errors appearing on opposite sides of a figure will be reported\n" + ) + + gsi::enum_const ("NotOpposite", db::OppositeFilter::NotOpposite, + "@brief Only errors NOT appearing on opposite sides of a figure will be reported\n" + ), + "@brief This class represents the opposite error filter mode for \\Region#separation and related checks.\n" + "\n" + "This enum has been introduced in version 0.27." +); + } diff --git a/src/db/unit_tests/dbRegionTests.cc b/src/db/unit_tests/dbRegionTests.cc index 5effd8f91..561e2c32b 100644 --- a/src/db/unit_tests/dbRegionTests.cc +++ b/src/db/unit_tests/dbRegionTests.cc @@ -583,7 +583,7 @@ TEST(15d) 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) +TEST(15e) { // #650 db::Region r; @@ -631,7 +631,65 @@ TEST(15e) EXPECT_EQ (r.space_check (1000).to_string (), "(20857,3600;20857,66000)/(19957,66000;19957,3600)"); } -TEST(16) +TEST(15g) +{ + // opposite_filter + + db::Region r2; + r2.insert (db::Box (db::Point (0, 0), db::Point (90, 300))); + r2.insert (db::Box (db::Point (210, 100), db::Point (300, 200))); + + db::Region r1; + r1.insert (db::Box (db::Point (100, 0), db::Point (200, 300))); + + db::RegionCheckOptions options; + options.metrics = db::Projection; + options.opposite_filter = db::NoOppositeFilter; + EXPECT_EQ (r1.separation_check (r2, 40, options).to_string (), + "(200,200;200,100)/(210,100;210,200);(100,0;100,300)/(90,300;90,0)"); + + options.opposite_filter = db::NotOpposite; + EXPECT_EQ (r1.separation_check (r2, 40, options).to_string (), + "(100,200;100,300)/(90,300;90,0);(100,0;100,100)/(90,300;90,0)"); + + options.opposite_filter = db::OnlyOpposite; + EXPECT_EQ (r1.separation_check (r2, 40, options).to_string (), + "(100,100;100,200)/(90,300;90,0);(200,200;200,100)/(210,100;210,200)"); +} + +TEST(15h) +{ + // opposite_filter with internal shielding + + // shielding within opposite error detection + db::Region r2; + r2.insert (db::Box (db::Point (0, 0), db::Point (90, 100))); + r2.insert (db::Box (db::Point (0, 200), db::Point (90, 300))); + r2.insert (db::Box (db::Point (210, 0), db::Point (300, 100))); + r2.insert (db::Box (db::Point (210, 200), db::Point (300, 300))); + + db::Region r1; + r1.insert (db::Box (db::Point (100, 0), db::Point (140, 300))); + r1.insert (db::Box (db::Point (140, 0), db::Point (160, 200))); + r1.insert (db::Box (db::Point (160, 0), db::Point (200, 300))); + + db::RegionCheckOptions options; + options.shielded = false; // does NOT disable internal shielding for "opposite" + options.metrics = db::Projection; + options.opposite_filter = db::NoOppositeFilter; + EXPECT_EQ (r1.separation_check (r2, 40, options).to_string (), + "(100,0;100,100)/(90,100;90,0);(200,100;200,0)/(210,0;210,100);(100,200;100,300)/(90,300;90,200);(200,300;200,200)/(210,200;210,300)"); + + options.opposite_filter = db::NotOpposite; + EXPECT_EQ (r1.separation_check (r2, 40, options).to_string (), + "(200,300;200,200)/(210,200;210,300);(100,200;100,300)/(90,300;90,200)"); + + options.opposite_filter = db::OnlyOpposite; + EXPECT_EQ (r1.separation_check (r2, 40, options).to_string (), + "(200,100;200,0)/(210,0;210,100);(100,0;100,100)/(90,100;90,0)"); +} + +TEST(16) { db::Region a; a.insert (db::Box (db::Point (10, 20), db::Point (20, 30)));