From 574660174e51a03de9a564a1aa2f44c729a02b9d Mon Sep 17 00:00:00 2001 From: Matthias Koefferlein Date: Sun, 6 Dec 2020 09:06:16 +0100 Subject: [PATCH] WIP: 'not_opposite' and 'rect_filter' --- src/db/db/dbAsIfFlatRegion.cc | 5 +- src/db/db/dbCompoundOperation.cc | 28 +- src/db/db/dbCompoundOperation.h | 6 +- src/db/db/dbDeepEdges.cc | 6 +- src/db/db/dbDeepRegion.cc | 2 +- src/db/db/dbRegionDelegate.h | 21 +- src/db/db/dbRegionLocalOperations.cc | 116 +++++- src/db/db/dbRegionLocalOperations.h | 48 ++- src/db/db/gsiDeclDbCompoundOperation.cc | 93 ++--- src/db/db/gsiDeclDbRegion.cc | 468 ++++++++++-------------- 10 files changed, 427 insertions(+), 366 deletions(-) diff --git a/src/db/db/dbAsIfFlatRegion.cc b/src/db/db/dbAsIfFlatRegion.cc index 9c07a8166..3cd1c80e3 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); + db::check_local_operation op (check, different_polygons, other != 0, other && other->is_merged (), options.shielded, options.not_opposite, options.rect_filter); db::local_processor proc; proc.set_base_verbosity (base_verbosity ()); @@ -1126,6 +1126,9 @@ AsIfFlatRegion::run_check (db::edge_relation_type rel, bool different_polygons, return output.release (); #else + // not supported in this implementation + tl_assert (! m_options.no_opposite); + std::auto_ptr result (new FlatEdgePairs ()); db::box_scanner scanner (report_progress (), progress_desc ()); diff --git a/src/db/db/dbCompoundOperation.cc b/src/db/db/dbCompoundOperation.cc index 9175d62a4..bdc569580 100644 --- a/src/db/db/dbCompoundOperation.cc +++ b/src/db/db/dbCompoundOperation.cc @@ -1089,41 +1089,41 @@ CompoundRegionToEdgePairProcessingOperationNode::processed (db::Layout *, const // --------------------------------------------------------------------------------------------- -CompoundRegionCheckOperationNode::CompoundRegionCheckOperationNode (CompoundRegionOperationNode *input, db::edge_relation_type rel, bool different_polygons, db::Coord d, bool whole_edges, db::metrics_type metrics, double ignore_angle, db::coord_traits::distance_type min_projection, db::coord_traits::distance_type max_projection, bool shielded) - : CompoundRegionMultiInputOperationNode (input), m_check (rel, d, metrics), m_different_polygons (different_polygons), m_shielded (shielded) +CompoundRegionCheckOperationNode::CompoundRegionCheckOperationNode (CompoundRegionOperationNode *input, db::edge_relation_type rel, bool different_polygons, db::Coord d, const db::RegionCheckOptions &options) + : CompoundRegionMultiInputOperationNode (input), m_check (rel, d, options.metrics), m_different_polygons (different_polygons), m_options (options) { set_description ("check"); m_check.set_include_zero (false); - m_check.set_whole_edges (whole_edges); - m_check.set_ignore_angle (ignore_angle); - m_check.set_min_projection (min_projection); - m_check.set_max_projection (max_projection); + m_check.set_whole_edges (options.whole_edges); + m_check.set_ignore_angle (options.ignore_angle); + m_check.set_min_projection (options.min_projection); + m_check.set_max_projection (options.max_projection); } -CompoundRegionCheckOperationNode::CompoundRegionCheckOperationNode (db::edge_relation_type rel, bool different_polygons, db::Coord d, bool whole_edges, db::metrics_type metrics, double ignore_angle, db::coord_traits::distance_type min_projection, db::coord_traits::distance_type max_projection, bool shielded) - : CompoundRegionMultiInputOperationNode (), m_check (rel, d, metrics), m_different_polygons (different_polygons), m_shielded (shielded) +CompoundRegionCheckOperationNode::CompoundRegionCheckOperationNode (db::edge_relation_type rel, bool different_polygons, db::Coord d, const db::RegionCheckOptions &options) + : CompoundRegionMultiInputOperationNode (), m_check (rel, d, options.metrics), m_different_polygons (different_polygons), m_options (options) { set_description ("check"); m_check.set_include_zero (false); - m_check.set_whole_edges (whole_edges); - m_check.set_ignore_angle (ignore_angle); - m_check.set_min_projection (min_projection); - m_check.set_max_projection (max_projection); + m_check.set_whole_edges (options.whole_edges); + m_check.set_ignore_angle (options.ignore_angle); + m_check.set_min_projection (options.min_projection); + m_check.set_max_projection (options.max_projection); } 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_shielded); + db::check_local_operation op (m_check, m_different_polygons, true, false, m_options.shielded, m_options.not_opposite, 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_shielded); + db::check_local_operation op (m_check, m_different_polygons, true, false, m_options.shielded, m_options.not_opposite, m_options.rect_filter); op.compute_local (layout, interactions, results, max_vertex_count, area_ratio); } diff --git a/src/db/db/dbCompoundOperation.h b/src/db/db/dbCompoundOperation.h index e7dfd9532..92306c871 100644 --- a/src/db/db/dbCompoundOperation.h +++ b/src/db/db/dbCompoundOperation.h @@ -931,12 +931,12 @@ public: * @brief Constructor * @param input The node for the original (the node will take ownership) */ - CompoundRegionCheckOperationNode (db::CompoundRegionOperationNode *input, db::edge_relation_type rel, bool different_polygons, db::Coord d, bool whole_edges, db::metrics_type metrics, double ignore_angle, db::coord_traits::distance_type min_projection, db::coord_traits::distance_type max_projection, bool shielded); + CompoundRegionCheckOperationNode (db::CompoundRegionOperationNode *input, db::edge_relation_type rel, bool different_polygons, db::Coord d, const db::RegionCheckOptions &options); /** * @brief Constructor for the single-layer check */ - CompoundRegionCheckOperationNode (db::edge_relation_type rel, bool different_polygons, db::Coord d, bool whole_edges, db::metrics_type metrics, double ignore_angle, db::coord_traits::distance_type min_projection, db::coord_traits::distance_type max_projection, bool shielded); + CompoundRegionCheckOperationNode (db::edge_relation_type rel, bool different_polygons, db::Coord d, const db::RegionCheckOptions &options); // specifies the result type virtual ResultType result_type () const { return EdgePairs; } @@ -947,7 +947,7 @@ public: private: db::EdgeRelationFilter m_check; bool m_different_polygons; - bool m_shielded; + db::RegionCheckOptions m_options; }; diff --git a/src/db/db/dbDeepEdges.cc b/src/db/db/dbDeepEdges.cc index 5cc4c8da6..727105766 100644 --- a/src/db/db/dbDeepEdges.cc +++ b/src/db/db/dbDeepEdges.cc @@ -1466,11 +1466,11 @@ EdgesDelegate *DeepEdges::in (const Edges &other, bool invert) const namespace { -class CheckLocalOperation +class EdgesCheckLocalOperation : public local_operation { public: - CheckLocalOperation (const EdgeRelationFilter &check, bool has_other) + EdgesCheckLocalOperation (const EdgeRelationFilter &check, bool has_other) : m_check (check), m_has_other (has_other) { // .. nothing yet .. @@ -1572,7 +1572,7 @@ DeepEdges::run_check (db::edge_relation_type rel, const Edges *other, db::Coord std::auto_ptr res (new db::DeepEdgePairs (edges.derived ())); - db::CheckLocalOperation op (check, other_deep != 0); + db::EdgesCheckLocalOperation op (check, other_deep != 0); db::local_processor proc (const_cast (&edges.layout ()), const_cast (&edges.initial_cell ()), diff --git a/src/db/db/dbDeepRegion.cc b/src/db/db/dbDeepRegion.cc index f6c30d41e..f5d126c78 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); + db::CheckLocalOperation op (check, different_polygons, other_deep != 0, other && other->is_merged (), options.shielded, options.not_opposite, options.rect_filter); db::local_processor proc (const_cast (&polygons.layout ()), const_cast (&polygons.initial_cell ()), diff --git a/src/db/db/dbRegionDelegate.h b/src/db/db/dbRegionDelegate.h index 55579f854..e98131ad6 100644 --- a/src/db/db/dbRegionDelegate.h +++ b/src/db/db/dbRegionDelegate.h @@ -33,6 +33,7 @@ #include "dbEdgePairRelations.h" #include "dbShapeCollection.h" #include "dbGenericShapeIterator.h" +#include "dbRegionLocalOperations.h" #include @@ -59,13 +60,17 @@ struct DB_PUBLIC RegionCheckOptions double _ignore_angle = 90, distance_type _min_projection = 0, distance_type _max_projection = std::numeric_limits::max (), - bool _shielded = true) + bool _shielded = true, + bool _no_opposite = false, + RectFilter _rect_filter = NoSideAllowed) : whole_edges (_whole_edges), metrics (_metrics), ignore_angle (_ignore_angle), min_projection (_min_projection), max_projection (_max_projection), - shielded (_shielded) + shielded (_shielded), + not_opposite (_no_opposite), + rect_filter (_rect_filter) { } /** @@ -114,6 +119,18 @@ struct DB_PUBLIC RegionCheckOptions * Set this option to false to disable shielding. By default, shielding is on. */ bool shielded; + + /** + * @brief Suppresses opposite error edges + * + * If true, error edges opposite of each other across the respective polygon part cancel. + */ + bool not_opposite; + + /** + * @brief Specifies a filter for error markers on rectangular shapes + */ + RectFilter rect_filter; }; /** diff --git a/src/db/db/dbRegionLocalOperations.cc b/src/db/db/dbRegionLocalOperations.cc index 25de4e2b9..53df40f58 100644 --- a/src/db/db/dbRegionLocalOperations.cc +++ b/src/db/db/dbRegionLocalOperations.cc @@ -141,22 +141,50 @@ private: // --------------------------------------------------------------------------------------------------------------- -template -check_local_operation::check_local_operation (const EdgeRelationFilter &check, bool different_polygons, bool has_other, bool other_is_merged, bool shielded) - : m_check (check), m_different_polygons (different_polygons), m_has_other (has_other), m_other_is_merged (other_is_merged), m_shielded (shielded) +static inline bool shields_interaction (const db::EdgePair &ep, const db::Edge &q) +{ + db::Edge pe1 (ep.first ().p1 (), ep.second ().p2 ()); + db::Edge pe2 (ep.second ().p1 (), ep.first ().p2 ()); + + std::pair ip1 = pe1.intersect_point (q); + std::pair ip2 = pe2.intersect_point (q); + + if (ip1.first && ip2.first && ip1.second != pe1.p1 () && ip1.second != pe1.p2 () && ip2.second != pe2.p1 () && ip2.second != pe2.p2 ()) { + return ip1.second != ip2.second || (pe1.side_of (q.p1 ()) != 0 && pe2.side_of (q.p2 ()) != 0); + } else { + return false; + } +} + +template +static bool shields_interaction (const db::EdgePair &ep, const P &poly) +{ + for (typename P::polygon_edge_iterator e = poly.begin_edge (); ! e.at_end (); ++e) { + if (shields_interaction (ep, *e)) { + return true; + } + } + return false; +} + + +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) { // .. nothing yet .. } -template +template void -check_local_operation::compute_local (db::Layout *layout, const shape_interactions &interactions, std::vector > &results, size_t /*max_vertex_count*/, double /*area_ratio*/) const +check_local_operation::compute_local (db::Layout *layout, const shape_interactions &interactions, std::vector > &results, size_t /*max_vertex_count*/, double /*area_ratio*/) const { tl_assert (results.size () == 1); - std::unordered_set &result = results.front (); + std::unordered_set &result = results.front (); + tl_assert (results.empty ()); - edge2edge_check > edge_check (m_check, result, m_different_polygons, m_has_other, m_shielded); - poly2poly_check > poly_check (edge_check); + edge2edge_check > edge_check (m_check, result, m_different_polygons, m_has_other, m_shielded); + poly2poly_check > poly_check (edge_check); std::list heap; db::box_scanner scanner; @@ -227,33 +255,89 @@ check_local_operation::compute_local (db::Layout *layout, const shap do { 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 ()) { + + db::EdgeRelationFilter opp (db::WidthRelation, std::numeric_limits::max (), db::Projection); + + std::vector projections; + std::unordered_set cleaned_result; + + // filter out opposite edges + for (std::unordered_set::const_iterator ep1 = result.begin (); ep1 != result.end (); ++ep1) { + + projections.clear (); + + std::unordered_set::const_iterator ep2 = ep1; + ++ep2; + for ( ; ep2 != result.end (); ++ep2) { + + db::EdgePair ep_opp; + if (opp.check (ep1->first (), ep2->first (), &ep_opp)) { + + bool shielded = false; + for (typename shape_interactions::iterator i = interactions.begin (); i != interactions.end () && ! shielded; ++i) { + shielded = shields_interaction (ep_opp, interactions.subject_shape (i->first)); + } + + if (! shielded) { + projections.push_back (ep_opp.first ()); + } + + } + + } + + if (! projections.empty ()) { + db::Edges 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 { + cleaned_result.insert (*ep1); + } + + } + + result.swap (cleaned_result); + + } + + // implements filtering on rectangles + if (m_rect_filter != RectFilter::NoSideAllowed && ! result.empty ()) { + + // @@@ TODO: implement @@@ + + } } -template +template db::Coord -check_local_operation::dist () const +check_local_operation::dist () const { // TODO: will the distance be sufficient? Or should we take somewhat more? return m_check.distance (); } -template +template OnEmptyIntruderHint -check_local_operation::on_empty_intruder_hint () const +check_local_operation::on_empty_intruder_hint () const { return m_different_polygons ? OnEmptyIntruderHint::Drop : OnEmptyIntruderHint::Ignore; } -template +template std::string -check_local_operation::description () const +check_local_operation::description () const { return tl::to_string (tr ("Generic DRC check")); } // explicit instantiations -template class check_local_operation; -template class check_local_operation; +template class check_local_operation; +template class check_local_operation; // --------------------------------------------------------------------------------------------------------------- diff --git a/src/db/db/dbRegionLocalOperations.h b/src/db/db/dbRegionLocalOperations.h index 9bd50466a..cf35e3018 100644 --- a/src/db/db/dbRegionLocalOperations.h +++ b/src/db/db/dbRegionLocalOperations.h @@ -32,14 +32,50 @@ namespace db { -template +/** + * @brief Specifies an error filter on rectangular shapes + */ +enum RectFilter +{ + /** + * @brief No filter + */ + NoSideAllowed, + + /** + * @brief Allow errors on one side + */ + OneSideAllowed, + + /** + * @brief Allow errors on two sides (not specified which) + */ + TwoSidesAllowed, + + /** + * @brief Allow errors on two sides ("L" configuration) + */ + TwoConnectedSidesAllowed, + + /** + * @brief Allow errors on two opposite sides + */ + TwoOppositeSidesAllowed, + + /** + * @brief Allow errors on three sides + */ + ThreeSidesAllowed +}; + +template class check_local_operation - : public local_operation + : public local_operation { public: - check_local_operation (const EdgeRelationFilter &check, bool different_polygons, bool has_other, bool other_is_merged, bool shielded); + 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); - virtual void compute_local (db::Layout * /*layout*/, const shape_interactions &interactions, std::vector > &results, size_t /*max_vertex_count*/, double /*area_ratio*/) const; + virtual void compute_local (db::Layout * /*layout*/, const shape_interactions &interactions, std::vector > &results, size_t /*max_vertex_count*/, double /*area_ratio*/) const; virtual db::Coord dist () const; virtual OnEmptyIntruderHint on_empty_intruder_hint () const; @@ -51,9 +87,11 @@ private: bool m_has_other; bool m_other_is_merged; bool m_shielded; + bool m_no_opposite; + db::RectFilter m_rect_filter; }; -typedef check_local_operation CheckLocalOperation; +typedef check_local_operation CheckLocalOperation; template class interacting_local_operation diff --git a/src/db/db/gsiDeclDbCompoundOperation.cc b/src/db/db/gsiDeclDbCompoundOperation.cc index 4a1b08376..910c176ba 100644 --- a/src/db/db/gsiDeclDbCompoundOperation.cc +++ b/src/db/db/gsiDeclDbCompoundOperation.cc @@ -25,6 +25,7 @@ #include "dbCompoundOperation.h" #include "dbRegionUtils.h" +#include "dbRegionLocalOperations.h" namespace gsi { @@ -173,34 +174,62 @@ 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_width_check_node (db::Coord d, bool whole_edges, db::metrics_type metrics, double ignore_angle, db::coord_traits::distance_type min_projection, db::coord_traits::distance_type max_projection, bool shielded) +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) { - return new db::CompoundRegionCheckOperationNode (db::WidthRelation, false, d, whole_edges, metrics, ignore_angle, min_projection, max_projection, shielded); + return new db::CompoundRegionCheckOperationNode (rel, different_polygons, 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, + no_opposite, + rect_filter) + ); } -static db::CompoundRegionOperationNode *new_space_check_node (db::Coord d, bool whole_edges, db::metrics_type metrics, double ignore_angle, db::coord_traits::distance_type min_projection, db::coord_traits::distance_type max_projection, bool shielded) +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) { - return new db::CompoundRegionCheckOperationNode (db::SpaceRelation, true, d, whole_edges, metrics, ignore_angle, min_projection, max_projection, shielded); + return new db::CompoundRegionCheckOperationNode (input, rel, different_polygons, d, + db::RegionCheckOptions (whole_edges, + metrics, + 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, + no_opposite, + rect_filter) + ); } -static db::CompoundRegionOperationNode *new_notch_check_node (db::Coord d, bool whole_edges, db::metrics_type metrics, double ignore_angle, db::coord_traits::distance_type min_projection, db::coord_traits::distance_type max_projection, bool shielded) +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 db::CompoundRegionCheckOperationNode (db::SpaceRelation, false, d, whole_edges, metrics, ignore_angle, min_projection, max_projection, shielded); + return new_check_node (db::WidthRelation, false, d, whole_edges, metrics, ignore_angle, min_projection, max_projection, shielded, false, db::NoSideAllowed); } -static db::CompoundRegionOperationNode *new_separation_check_node (db::CompoundRegionOperationNode *input, db::Coord d, bool whole_edges, db::metrics_type metrics, double ignore_angle, db::coord_traits::distance_type min_projection, db::coord_traits::distance_type max_projection, bool shielded) +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) { - return new db::CompoundRegionCheckOperationNode (input, db::SpaceRelation, true, d, whole_edges, metrics, ignore_angle, min_projection, max_projection, shielded); + return new_check_node (db::SpaceRelation, true, d, whole_edges, metrics, ignore_angle, min_projection, max_projection, shielded, no_opposite, rect_filter); } -static db::CompoundRegionOperationNode *new_overlap_check_node (db::CompoundRegionOperationNode *input, db::Coord d, bool whole_edges, db::metrics_type metrics, double ignore_angle, db::coord_traits::distance_type min_projection, db::coord_traits::distance_type max_projection, bool shielded) +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 db::CompoundRegionCheckOperationNode (input, db::OverlapRelation, true, d, whole_edges, metrics, ignore_angle, min_projection, max_projection, shielded); + return new_check_node (db::SpaceRelation, false, d, whole_edges, metrics, ignore_angle, min_projection, max_projection, shielded, false, db::NoSideAllowed); } -static db::CompoundRegionOperationNode *new_inside_check_node (db::CompoundRegionOperationNode *input, db::Coord d, bool whole_edges, db::metrics_type metrics, double ignore_angle, db::coord_traits::distance_type min_projection, db::coord_traits::distance_type max_projection, bool shielded) +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) { - return new db::CompoundRegionCheckOperationNode (input, db::InsideRelation, true, d, whole_edges, metrics, ignore_angle, min_projection, max_projection, shielded); + return new_check_node (input, db::SpaceRelation, true, d, whole_edges, metrics, ignore_angle, min_projection, max_projection, shielded, no_opposite, 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) +{ + return new_check_node (input, db::OverlapRelation, true, d, whole_edges, metrics, ignore_angle, min_projection, max_projection, shielded, no_opposite, 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) +{ + return new_check_node (input, db::InsideRelation, true, d, whole_edges, metrics, ignore_angle, min_projection, max_projection, shielded, no_opposite, 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) @@ -302,22 +331,22 @@ Class decl_CompoundRegionOperationNode ("db", " gsi::constructor ("new_minkowsky_sum", &new_minkowsky_sum_node4, gsi::arg ("input"), gsi::arg ("p"), "@brief Creates a node providing a Minkowsky sum with a point sequence forming a contour.\n" ) + - 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", 90.0), gsi::arg ("min_projection", db::coord_traits::distance_type (0)), gsi::arg ("max_projection", std::numeric_limits::distance_type>::max (), "max."), gsi::arg ("shielded", true), + 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", 90.0), gsi::arg ("min_projection", db::coord_traits::distance_type (0)), gsi::arg ("max_projection", std::numeric_limits::distance_type>::max (), "max."), gsi::arg ("shielded", true), + 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), "@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", 90.0), gsi::arg ("min_projection", db::coord_traits::distance_type (0)), gsi::arg ("max_projection", std::numeric_limits::distance_type>::max (), "max."), gsi::arg ("shielded", true), + 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", 90.0), gsi::arg ("min_projection", db::coord_traits::distance_type (0)), gsi::arg ("max_projection", std::numeric_limits::distance_type>::max (), "max."), gsi::arg ("shielded", true), + 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), "@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", 90.0), gsi::arg ("min_projection", db::coord_traits::distance_type (0)), gsi::arg ("max_projection", std::numeric_limits::distance_type>::max (), "max."), gsi::arg ("shielded", true), + 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), "@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", 90.0), gsi::arg ("min_projection", db::coord_traits::distance_type (0)), gsi::arg ("max_projection", std::numeric_limits::distance_type>::max (), "max."), gsi::arg ("shielded", true), + 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), "@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), @@ -452,34 +481,6 @@ gsi::Enum decl_dbPreferredOrientation ("db", "Preferre "This enum has been introduced in version 0.27." ); -gsi::Enum decl_dbMetricsType ("db", "MetricsType", - gsi::enum_const ("Euclidian", db::metrics_type::Euclidian, - "@brief Euclidian metrics\n" - "\n" - "The distance between two points is defined as the euclidian\n" - "distance, i.e. d = sqrt(dx * dx + dy * dy).\n" - "All points within a circle with radius r around another point \n" - "have a distance less than r to this point.\n" - ) + - gsi::enum_const ("Square", db::metrics_type::Square, - "@brief Square metrics\n" - "\n" - "The distance between two points is the minimum of x and\n" - "y distance, i.e. d = min(abs(dx), abs(dy)).\n" - "All points within a square with length 2*r round another point\n" - "have a distance less than r to this point.\n" - ) + - gsi::enum_const ("Projection", db::metrics_type::Projection, - "@brief Projection metrics\n" - "\n" - "The distance between a point and another point on an edge\n" - "is measured by the distance of the point to the edge.\n" - ), - "@brief This class represents the MetricsType enum used within DRC functions\n" - "\n" - "This enum has been introduced in version 0.27." -); - 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 05709643b..3df8b4589 100644 --- a/src/db/db/gsiDeclDbRegion.cc +++ b/src/db/db/gsiDeclDbRegion.cc @@ -21,6 +21,7 @@ */ #include "gsiDecl.h" +#include "gsiEnums.h" #include "dbRegion.h" #include "dbRegionUtils.h" @@ -437,131 +438,103 @@ static db::Region merged_ext2 (db::Region *r, bool min_coherence, int min_wc) return r->merged (min_coherence, std::max (0, min_wc - 1)); } -static db::EdgePairs width1 (const db::Region *r, db::Region::distance_type d) -{ - return r->width_check (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) +static db::EdgePairs width2 (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) { 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) -{ - return r->space_check (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, 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) -{ - return r->notch_check (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, 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) -{ - return r->isolated_check (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, 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) -{ - return r->inside_check (other, d); -} - -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, 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) -{ - return r->overlap_check (other, d); -} - -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, 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) -{ - return r->enclosing_check (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, 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) -{ - return r->separation_check (other, d); -} - -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, db::RegionCheckOptions (whole_edges, - metrics.is_nil () ? db::Euclidian : db::metrics_type (metrics.to_int ()), + metrics, 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 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) +{ + return r->space_check (d, db::RegionCheckOptions (whole_edges, + metrics, + 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, + not_opposite, + rect_filter) + ); +} + +static db::EdgePairs notch2 (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) +{ + return r->notch_check (d, db::RegionCheckOptions (whole_edges, + metrics, + 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 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) +{ + return r->isolated_check (d, db::RegionCheckOptions (whole_edges, + metrics, + 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, + not_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) +{ + return r->inside_check (other, d, db::RegionCheckOptions (whole_edges, + metrics, + 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, + not_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) +{ + return r->overlap_check (other, d, db::RegionCheckOptions (whole_edges, + metrics, + 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, + not_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) +{ + return r->enclosing_check (other, d, db::RegionCheckOptions (whole_edges, + metrics, + 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, + not_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) +{ + return r->separation_check (other, d, db::RegionCheckOptions (whole_edges, + metrics, + 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, + not_opposite, + rect_filter) ); } @@ -576,21 +549,6 @@ static std::vector andnot (const db::Region *r, const db::Region &ot return res; } -static int euclidian_metrics () -{ - return db::Euclidian; -} - -static int square_metrics () -{ - return db::Square; -} - -static int projection_metrics () -{ - return db::Projection; -} - template static Container *decompose_convex (const db::Region *r, int mode) { @@ -2017,18 +1975,7 @@ Class decl_Region (decl_dbShapeCollection, "db", "Region", "\n" "@return The transformed region.\n" ) + - method_ext ("width_check", &width1, gsi::arg ("d"), - "@brief Performs a width check\n" - "@param d The minimum width for which the polygons are checked\n" - "Performs a width check against the minimum width \"d\". For locations where a polygon has a " - "width less than the given value, an error marker is produced. Error markers form a " - "\\EdgePairs collection. Edge pairs are pairs of edges where each edge marks one edge of the original " - "polygon. Edge pairs can be converted back to polygons or separated into their edge contributions.\n" - "See \\EdgePairs for a description of that collection object.\n" - "\n" - "Merged semantics applies for the input of this method (see \\merged_semantics= of merged semantics)\n" - ) + - method_ext ("width_check", &width2, gsi::arg ("d"), gsi::arg ("whole_edges"), gsi::arg ("metrics"), gsi::arg ("ignore_angle"), gsi::arg ("min_projection"), gsi::arg ("max_projection"), gsi::arg ("shielded", true), + method_ext ("width_check", &width2, 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), "@brief Performs a width check with options\n" "@param d The minimum width for which the polygons are checked\n" "@param whole_edges If true, deliver the whole edges\n" @@ -2068,21 +2015,7 @@ Class decl_Region (decl_dbShapeCollection, "db", "Region", "\n" "The 'shielded' option has been introduced in version 0.27." ) + - method_ext ("space_check", &space1, gsi::arg ("d"), - "@brief Performs a space check\n" - "@param d The minimum space for which the polygons are checked\n" - "Performs a space check against the minimum space \"d\". For locations where a polygon has a " - "space less than the given value to either itself (a notch) or to other polygons, an error marker is produced. Error markers form a " - "\\EdgePairs collection. Edge pairs are pairs of edges where each edge marks one edge of the original " - "polygon. Edge pairs can be converted back to polygons or separated into their edge contributions.\n" - "See \\EdgePairs for a description of that collection object.\n" - "\n" - "\\notch_check is a version which checks spacing of polygon edges only against edges of the same polygon.\n" - "\\isolated_check is a version which checks spacing between different polygons only.\n" - "\n" - "Merged semantics applies for the input of this method (see \\merged_semantics= of merged semantics)\n" - ) + - method_ext ("space_check", &space2, gsi::arg ("d"), gsi::arg ("whole_edges"), gsi::arg ("metrics"), gsi::arg ("ignore_angle"), gsi::arg ("min_projection"), gsi::arg ("max_projection"), gsi::arg ("shielded", true), + 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), "@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" @@ -2090,6 +2023,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" @@ -2117,27 +2051,14 @@ 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" - "Merged semantics applies for the input of this method (see \\merged_semantics= of merged semantics)\n" - "\n" - "The 'shielded' option has been introduced in version 0.27." - ) + - method_ext ("notch_check", ¬ch1, gsi::arg ("d"), - "@brief Performs a space check between edges of the same polygon\n" - "@param d The minimum space for which the polygons are checked\n" - "Performs a space check against the minimum space \"d\". For locations where a polygon has a " - "space less than the given value to either itself (a notch) or to other polygons, an error marker is produced. Error markers form a " - "\\EdgePairs collection. Edge pairs are pairs of edges where each edge marks one edge of the original " - "polygon. Edge pairs can be converted back to polygons or separated into their edge contributions.\n" - "See \\EdgePairs for a description of that collection object.\n" - "\n" - "This version is restricted to checking edges of one polygon vs. edges of itself.\n" - "To ensure that the polygon is merged and does not come in pieces, use the \\merge method before.\n" - "\\space_check is a version which checks spacing of all polygon edges vs. edges of the some or other polygons.\n" - "\\isolated_check is a version which checks spacing between different polygons only.\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 ("notch_check", ¬ch2, gsi::arg ("d"), gsi::arg ("whole_edges"), gsi::arg ("metrics"), gsi::arg ("ignore_angle"), gsi::arg ("min_projection"), gsi::arg ("max_projection"), gsi::arg ("shielded", true), + method_ext ("notch_check", ¬ch2, 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), "@brief Performs a space check between edges of the same polygon 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" @@ -2145,6 +2066,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" @@ -2176,23 +2098,7 @@ Class decl_Region (decl_dbShapeCollection, "db", "Region", "\n" "The 'shielded' option has been introduced in version 0.27." ) + - method_ext ("isolated_check", &isolated1, gsi::arg ("d"), - "@brief Performs a space check between edges of different polygons\n" - "@param d The minimum space for which the polygons are checked\n" - "Performs a space check against the minimum space \"d\". For locations where a polygon has a " - "space less than the given value to other polygons (not itself), an error marker is produced. Error markers form a " - "\\EdgePairs collection. Edge pairs are pairs of edges where each edge marks one edge of the original " - "polygon. Edge pairs can be converted back to polygons or separated into their edge contributions.\n" - "See \\EdgePairs for a description of that collection object.\n" - "\n" - "This version is restricted to checking edges of one polygon vs. edges of other polygons.\n" - "To ensure that the polygon is merged and does not come in pieces, use the \\merge method before.\n" - "\\space_check is a version which checks spacing of all polygon edges vs. edges of the some or other polygons.\n" - "\\notch_check is a version which checks spacing of polygons edges of the same polygon only.\n" - "\n" - "Merged semantics applies for the input of this method (see \\merged_semantics= of merged semantics)\n" - ) + - method_ext ("isolated_check", &isolated2, gsi::arg ("d"), gsi::arg ("whole_edges"), gsi::arg ("metrics"), gsi::arg ("ignore_angle"), gsi::arg ("min_projection"), gsi::arg ("max_projection"), gsi::arg ("shielded", true), + 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), "@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" @@ -2200,6 +2106,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" @@ -2227,22 +2134,14 @@ 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" - "Merged semantics applies for the input of this method (see \\merged_semantics= of merged semantics)\n" - "\n" - "The 'shielded' option has been introduced in version 0.27." - ) + - method_ext ("inside_check", &inside1, gsi::arg ("other"), gsi::arg ("d"), - "@brief Performs a check whether polygons of this region are inside polygons of the other region by some amount\n" - "@param d The minimum overlap for which the polygons are checked\n" - "@param other The other region against which to check\n" - "Returns edge pairs for all locations where edges of polygons of this region are inside polygons of the other region " - "by less than the given value \"d\". " - "Contrary to the name, this check does not check whether polygons are inside other polygons but rather checks " - "whether there is enough overlap of the other polygons vs. polygons of this region. " + "\"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"), gsi::arg ("metrics"), gsi::arg ("ignore_angle"), gsi::arg ("min_projection"), gsi::arg ("max_projection"), gsi::arg ("shielded", true), + 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" @@ -2251,6 +2150,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" @@ -2278,20 +2178,14 @@ 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" - "Merged semantics applies for the input of this method (see \\merged_semantics= of merged semantics)\n" - "\n" - "The 'shielded' option has been introduced in version 0.27." - ) + - method_ext ("overlap_check", &overlap1, gsi::arg ("other"), gsi::arg ("d"), - "@brief Performs a check whether polygons of this region overlap polygons of the other region by some amount\n" - "@param d The minimum overlap for which the polygons are checked\n" - "@param other The other region against which to check\n" - "Returns edge pairs for all locations where edges of polygons of this region overlap polygons of the other region " - "by less than the given value \"d\". " + "\"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"), gsi::arg ("metrics"), gsi::arg ("ignore_angle"), gsi::arg ("min_projection"), gsi::arg ("max_projection"), gsi::arg ("shielded", true), + 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" @@ -2300,6 +2194,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" @@ -2327,20 +2222,14 @@ 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" - "Merged semantics applies for the input of this method (see \\merged_semantics= of merged semantics)\n" - "\n" - "The 'shielded' option has been introduced in version 0.27." - ) + - method_ext ("enclosing_check", &enclosing1, gsi::arg ("other"), gsi::arg ("d"), - "@brief Performs a check whether polygons of this region enclose polygons of the other region by some amount\n" - "@param d The minimum overlap for which the polygons are checked\n" - "@param other The other region against which to check\n" - "Returns edge pairs for all locations where edges of polygons of this region are enclosing polygons of the other region " - "by less than the given value \"d\". " + "\"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"), gsi::arg ("metrics"), gsi::arg ("ignore_angle"), gsi::arg ("min_projection"), gsi::arg ("max_projection"), gsi::arg ("shielded", true), + 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" @@ -2349,6 +2238,9 @@ 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" + "@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" @@ -2376,20 +2268,14 @@ 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" - "Merged semantics applies for the input of this method (see \\merged_semantics= of merged semantics)\n" - "\n" - "The 'shielded' option has been introduced in version 0.27." - ) + - method_ext ("separation_check", &separation1, gsi::arg ("other"), gsi::arg ("d"), - "@brief Performs a check whether polygons of this region are separated from polygons of the other region by some amount\n" - "@param d The minimum separation for which the polygons are checked\n" - "@param other The other region against which to check\n" - "Returns edge pairs for all locations where edges of polygons of this region are separated by polygons of the other region " - "by less than the given value \"d\". " + "\"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"), gsi::arg ("metrics"), gsi::arg ("ignore_angle"), gsi::arg ("min_projection"), gsi::arg ("max_projection"), gsi::arg ("shielded", true), + 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" @@ -2398,9 +2284,8 @@ 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" - "\n" - "This version is similar to the simple version with one parameter. In addition, it allows " - "to specify many more options.\n" + "@param not_opposite Reports error edges only if not opposite to other edges on the original figure\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" @@ -2425,9 +2310,12 @@ 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. " + "\"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' option has been introduced in version 0.27." + "The 'shielded', 'not_opposite' and 'rect_sides' options have been introduced in version 0.27." ) + method_ext ("area", &area1, "@brief The area of the region\n" @@ -2562,35 +2450,6 @@ Class decl_Region (decl_dbShapeCollection, "db", "Region", "See \\base_verbosity= for details.\n" "\n" "This method has been introduced in version 0.26.\n" - ) + - method ("Euclidian", &euclidian_metrics, - "@brief Specifies Euclidian metrics for the check functions\n" - "This value can be used for the metrics parameter in the check functions, i.e. \\width_check. " - "This value specifies Euclidian metrics, i.e. the distance between two points is measured by:\n" - "\n" - "@code\n" - "d = sqrt(dx^2 + dy^2)\n" - "@/code\n" - "\n" - "All points within a circle with radius d around one point are considered to have a smaller distance than d." - ) + - method ("Square", &square_metrics, - "@brief Specifies square metrics for the check functions\n" - "This value can be used for the metrics parameter in the check functions, i.e. \\width_check. " - "This value specifies sqaure metrics, i.e. the distance between two points is measured by:\n" - "\n" - "@code\n" - "d = max(abs(dx), abs(dy))\n" - "@/code\n" - "\n" - "All points within a square with length 2*d around one point are considered to have a smaller distance than d in this metrics." - ) + - method ("Projection", &projection_metrics, - "@brief Specifies projected distance metrics for the check functions\n" - "This value can be used for the metrics parameter in the check functions, i.e. \\width_check. " - "This value specifies projected metrics, i.e. the distance is defined as the minimum distance " - "measured perpendicular to one edge. That implies that the distance is defined only where two " - "edges have a non-vanishing projection onto each other." ), "@brief A region (a potentially complex area consisting of multiple polygons)\n" "\n\n" @@ -2628,5 +2487,64 @@ Class decl_Region (decl_dbShapeCollection, "db", "Region", "This class has been introduced in version 0.23.\n" ); +gsi::EnumIn decl_Region_Metrics ("db", "Metrics", + gsi::enum_const ("Euclidian", db::Euclidian, + "@brief Specifies Euclidian metrics for the check functions\n" + "This value can be used for the metrics parameter in the check functions, i.e. \\width_check. " + "This value specifies Euclidian metrics, i.e. the distance between two points is measured by:\n" + "\n" + "@code\n" + "d = sqrt(dx^2 + dy^2)\n" + "@/code\n" + "\n" + "All points within a circle with radius d around one point are considered to have a smaller distance than d." + ) + + gsi::enum_const ("Square", db::Square, + "@brief Specifies square metrics for the check functions\n" + "This value can be used for the metrics parameter in the check functions, i.e. \\width_check. " + "This value specifies sqaure metrics, i.e. the distance between two points is measured by:\n" + "\n" + "@code\n" + "d = max(abs(dx), abs(dy))\n" + "@/code\n" + "\n" + "All points within a square with length 2*d around one point are considered to have a smaller distance than d in this metrics." + ) + + gsi::enum_const ("Projection", db::Projection, + "@brief Specifies projected distance metrics for the check functions\n" + "This value can be used for the metrics parameter in the check functions, i.e. \\width_check. " + "This value specifies projected metrics, i.e. the distance is defined as the minimum distance " + "measured perpendicular to one edge. That implies that the distance is defined only where two " + "edges have a non-vanishing projection onto each other." + ), + "@brief This class represents the metrics type for \\Region#width and related checks.\n" + "\n" + "This enum has been introduced in version 0.27." +); + +gsi::EnumIn decl_Region_RectFilter ("db", "RectFilter", + gsi::enum_const ("NoRectFilter", db::RectFilter::NoSideAllowed, + "@brief Specifies no filtering" + ) + + gsi::enum_const ("OneSideAllowed", db::RectFilter::OneSideAllowed, + "@brief Allow errors on one side" + ) + + gsi::enum_const ("TwoSidesAllowed", db::RectFilter::TwoSidesAllowed, + "@brief Allow errors on two sides (not specified which)" + ) + + gsi::enum_const ("TwoConnectedSidesAllowed", db::RectFilter::TwoConnectedSidesAllowed, + "@brief Allow errors on two sides (\"L\" configuration)" + ) + + gsi::enum_const ("TwoOppositeSidesAllowed", db::RectFilter::TwoOppositeSidesAllowed, + "@brief Allow errors on two opposite sides" + ) + + gsi::enum_const ("ThreeSidesAllowed", db::RectFilter::ThreeSidesAllowed, + "@brief Allow errors on three sides" + ), + "@brief This class represents the error filter mode on rectangles for \\Region#separation and related checks.\n" + "\n" + "This enum has been introduced in version 0.27." +); + }