WIP: fixed a few issues with the DRC implementation

This commit is contained in:
Matthias Koefferlein 2020-09-21 23:35:35 +02:00
parent 91e924c559
commit f6107e0686
3 changed files with 22 additions and 38 deletions

View File

@ -1962,7 +1962,7 @@ class InteractingWithTextLocalOperation
{
public:
InteractingWithTextLocalOperation (bool inverse, size_t min_count, size_t max_count)
: m_inverse (inverse), m_min_count (min_count), m_max_count (max_count)
: m_inverse (inverse), m_min_count (std::max (size_t (1), min_count)), m_max_count (max_count)
{
// .. nothing yet ..
}

View File

@ -1476,7 +1476,7 @@ Class<db::Region> decl_Region (decl_dbShapeCollection, "db", "Region",
"\n"
"Merged semantics applies for this method (see \\merged_semantics= of merged semantics)\n"
) +
method ("interacting", (db::Region (db::Region::*) (const db::Region &, size_t, size_t) const) &db::Region::selected_interacting, gsi::arg ("other"), gsi::arg ("min_count", size_t (0)), gsi::arg ("max_count", size_t (std::numeric_limits<size_t>::max ()), "unlimited"),
method ("interacting", (db::Region (db::Region::*) (const db::Region &, size_t, size_t) const) &db::Region::selected_interacting, gsi::arg ("other"), gsi::arg ("min_count", size_t (1)), gsi::arg ("max_count", size_t (std::numeric_limits<size_t>::max ()), "unlimited"),
"@brief Returns the polygons of this region which overlap or touch polygons from the other region\n"
"\n"
"'min_count' and 'max_count' impose a constraint on the number of times a polygon of this region "
@ -1490,7 +1490,7 @@ Class<db::Region> decl_Region (decl_dbShapeCollection, "db", "Region",
"\n"
"The min_count and max_count arguments have been added in version 0.27.\n"
) +
method ("not_interacting", (db::Region (db::Region::*) (const db::Region &, size_t, size_t) const) &db::Region::selected_not_interacting, gsi::arg ("other"), gsi::arg ("min_count", size_t (0)), gsi::arg ("max_count", size_t (std::numeric_limits<size_t>::max ()), "unlimited"),
method ("not_interacting", (db::Region (db::Region::*) (const db::Region &, size_t, size_t) const) &db::Region::selected_not_interacting, gsi::arg ("other"), gsi::arg ("min_count", size_t (1)), gsi::arg ("max_count", size_t (std::numeric_limits<size_t>::max ()), "unlimited"),
"@brief Returns the polygons of this region which do not overlap or touch polygons from the other region\n"
"\n"
"'min_count' and 'max_count' impose a constraint on the number of times a polygon of this region "
@ -1504,7 +1504,7 @@ Class<db::Region> decl_Region (decl_dbShapeCollection, "db", "Region",
"\n"
"The min_count and max_count arguments have been added in version 0.27.\n"
) +
method ("select_interacting", (db::Region &(db::Region::*) (const db::Region &, size_t, size_t)) &db::Region::select_interacting, gsi::arg ("other"), gsi::arg ("min_count", size_t (0)), gsi::arg ("max_count", size_t (std::numeric_limits<size_t>::max ()), "unlimited"),
method ("select_interacting", (db::Region &(db::Region::*) (const db::Region &, size_t, size_t)) &db::Region::select_interacting, gsi::arg ("other"), gsi::arg ("min_count", size_t (1)), gsi::arg ("max_count", size_t (std::numeric_limits<size_t>::max ()), "unlimited"),
"@brief Selects the polygons from this region which overlap or touch polygons from the other region\n"
"\n"
"'min_count' and 'max_count' impose a constraint on the number of times a polygon of this region "
@ -1518,7 +1518,7 @@ Class<db::Region> decl_Region (decl_dbShapeCollection, "db", "Region",
"\n"
"The min_count and max_count arguments have been added in version 0.27.\n"
) +
method ("select_not_interacting", (db::Region &(db::Region::*) (const db::Region &, size_t, size_t)) &db::Region::select_not_interacting, gsi::arg ("other"), gsi::arg ("min_count", size_t (0)), gsi::arg ("max_count", size_t (std::numeric_limits<size_t>::max ()), "unlimited"),
method ("select_not_interacting", (db::Region &(db::Region::*) (const db::Region &, size_t, size_t)) &db::Region::select_not_interacting, gsi::arg ("other"), gsi::arg ("min_count", size_t (1)), gsi::arg ("max_count", size_t (std::numeric_limits<size_t>::max ()), "unlimited"),
"@brief Selects the polygons from this region which do not overlap or touch polygons from the other region\n"
"\n"
"'min_count' and 'max_count' impose a constraint on the number of times a polygon of this region "
@ -1532,7 +1532,7 @@ Class<db::Region> decl_Region (decl_dbShapeCollection, "db", "Region",
"\n"
"The min_count and max_count arguments have been added in version 0.27.\n"
) +
method ("interacting", (db::Region (db::Region::*) (const db::Edges &, size_t, size_t) const) &db::Region::selected_interacting, gsi::arg ("other"), gsi::arg ("min_count", size_t (0)), gsi::arg ("max_count", size_t (std::numeric_limits<size_t>::max ()), "unlimited"),
method ("interacting", (db::Region (db::Region::*) (const db::Edges &, size_t, size_t) const) &db::Region::selected_interacting, gsi::arg ("other"), gsi::arg ("min_count", size_t (1)), gsi::arg ("max_count", size_t (std::numeric_limits<size_t>::max ()), "unlimited"),
"@brief Returns the polygons of this region which overlap or touch edges from the edge collection\n"
"\n"
"'min_count' and 'max_count' impose a constraint on the number of times a polygon of this region "
@ -1547,7 +1547,7 @@ Class<db::Region> decl_Region (decl_dbShapeCollection, "db", "Region",
"This method has been introduced in version 0.25.\n"
"The min_count and max_count arguments have been added in version 0.27.\n"
) +
method ("not_interacting", (db::Region (db::Region::*) (const db::Edges &, size_t, size_t) const) &db::Region::selected_not_interacting, gsi::arg ("other"), gsi::arg ("min_count", size_t (0)), gsi::arg ("max_count", size_t (std::numeric_limits<size_t>::max ()), "unlimited"),
method ("not_interacting", (db::Region (db::Region::*) (const db::Edges &, size_t, size_t) const) &db::Region::selected_not_interacting, gsi::arg ("other"), gsi::arg ("min_count", size_t (1)), gsi::arg ("max_count", size_t (std::numeric_limits<size_t>::max ()), "unlimited"),
"@brief Returns the polygons of this region which do not overlap or touch edges from the edge collection\n"
"\n"
"'min_count' and 'max_count' impose a constraint on the number of times a polygon of this region "
@ -1562,7 +1562,7 @@ Class<db::Region> decl_Region (decl_dbShapeCollection, "db", "Region",
"This method has been introduced in version 0.25\n"
"The min_count and max_count arguments have been added in version 0.27.\n"
) +
method ("select_interacting", (db::Region &(db::Region::*) (const db::Edges &, size_t, size_t)) &db::Region::select_interacting, gsi::arg ("other"), gsi::arg ("min_count", size_t (0)), gsi::arg ("max_count", size_t (std::numeric_limits<size_t>::max ()), "unlimited"),
method ("select_interacting", (db::Region &(db::Region::*) (const db::Edges &, size_t, size_t)) &db::Region::select_interacting, gsi::arg ("other"), gsi::arg ("min_count", size_t (1)), gsi::arg ("max_count", size_t (std::numeric_limits<size_t>::max ()), "unlimited"),
"@brief Selects the polygons from this region which overlap or touch edges from the edge collection\n"
"\n"
"'min_count' and 'max_count' impose a constraint on the number of times a polygon of this region "
@ -1577,7 +1577,7 @@ Class<db::Region> decl_Region (decl_dbShapeCollection, "db", "Region",
"This method has been introduced in version 0.25\n"
"The min_count and max_count arguments have been added in version 0.27.\n"
) +
method ("select_not_interacting", (db::Region &(db::Region::*) (const db::Edges &, size_t, size_t)) &db::Region::select_not_interacting, gsi::arg ("other"), gsi::arg ("min_count", size_t (0)), gsi::arg ("max_count", size_t (std::numeric_limits<size_t>::max ()), "unlimited"),
method ("select_not_interacting", (db::Region &(db::Region::*) (const db::Edges &, size_t, size_t)) &db::Region::select_not_interacting, gsi::arg ("other"), gsi::arg ("min_count", size_t (1)), gsi::arg ("max_count", size_t (std::numeric_limits<size_t>::max ()), "unlimited"),
"@brief Selects the polygons from this region which do not overlap or touch edges from the edge collection\n"
"\n"
"'min_count' and 'max_count' impose a constraint on the number of times a polygon of this region "
@ -1592,7 +1592,7 @@ Class<db::Region> decl_Region (decl_dbShapeCollection, "db", "Region",
"This method has been introduced in version 0.25\n"
"The min_count and max_count arguments have been added in version 0.27.\n"
) +
method ("interacting", (db::Region (db::Region::*) (const db::Texts &, size_t, size_t) const) &db::Region::selected_interacting, gsi::arg ("other"), gsi::arg ("min_count", size_t (0)), gsi::arg ("max_count", size_t (std::numeric_limits<size_t>::max ()), "unlimited"),
method ("interacting", (db::Region (db::Region::*) (const db::Texts &, size_t, size_t) const) &db::Region::selected_interacting, gsi::arg ("other"), gsi::arg ("min_count", size_t (1)), gsi::arg ("max_count", size_t (std::numeric_limits<size_t>::max ()), "unlimited"),
"@brief Returns the polygons of this region which overlap or touch texts\n"
"\n"
"'min_count' and 'max_count' impose a constraint on the number of times a polygon of this region "
@ -1606,7 +1606,7 @@ Class<db::Region> decl_Region (decl_dbShapeCollection, "db", "Region",
"\n"
"This method has been introduced in version 0.27\n"
) +
method ("not_interacting", (db::Region (db::Region::*) (const db::Texts &, size_t, size_t) const) &db::Region::selected_not_interacting, gsi::arg ("other"), gsi::arg ("min_count", size_t (0)), gsi::arg ("max_count", size_t (std::numeric_limits<size_t>::max ()), "unlimited"),
method ("not_interacting", (db::Region (db::Region::*) (const db::Texts &, size_t, size_t) const) &db::Region::selected_not_interacting, gsi::arg ("other"), gsi::arg ("min_count", size_t (1)), gsi::arg ("max_count", size_t (std::numeric_limits<size_t>::max ()), "unlimited"),
"@brief Returns the polygons of this region which do not overlap or touch texts\n"
"\n"
"'min_count' and 'max_count' impose a constraint on the number of times a polygon of this region "
@ -1620,7 +1620,7 @@ Class<db::Region> decl_Region (decl_dbShapeCollection, "db", "Region",
"\n"
"This method has been introduced in version 0.27\n"
) +
method ("select_interacting", (db::Region &(db::Region::*) (const db::Texts &, size_t, size_t)) &db::Region::select_interacting, gsi::arg ("other"), gsi::arg ("min_count", size_t (0)), gsi::arg ("max_count", size_t (std::numeric_limits<size_t>::max ()), "unlimited"),
method ("select_interacting", (db::Region &(db::Region::*) (const db::Texts &, size_t, size_t)) &db::Region::select_interacting, gsi::arg ("other"), gsi::arg ("min_count", size_t (1)), gsi::arg ("max_count", size_t (std::numeric_limits<size_t>::max ()), "unlimited"),
"@brief Selects the polygons of this region which overlap or touch texts\n"
"\n"
"@return The region after the polygons have been selected (self)\n"
@ -1634,7 +1634,7 @@ Class<db::Region> decl_Region (decl_dbShapeCollection, "db", "Region",
"\n"
"This method has been introduced in version 0.27\n"
) +
method ("select_not_interacting", (db::Region &(db::Region::*) (const db::Texts &, size_t, size_t)) &db::Region::select_not_interacting, gsi::arg ("other"), gsi::arg ("min_count", size_t (0)), gsi::arg ("max_count", size_t (std::numeric_limits<size_t>::max ()), "unlimited"),
method ("select_not_interacting", (db::Region &(db::Region::*) (const db::Texts &, size_t, size_t)) &db::Region::select_not_interacting, gsi::arg ("other"), gsi::arg ("min_count", size_t (1)), gsi::arg ("max_count", size_t (std::numeric_limits<size_t>::max ()), "unlimited"),
"@brief Selects the polygons of this region which do not overlap or touch texts\n"
"\n"
"'min_count' and 'max_count' impose a constraint on the number of times a polygon of this region "

View File

@ -1946,21 +1946,16 @@ CODE
# In tiled mode, there are no modifying versions. Emulate using the non-modifying one.
eval <<"CODE"
def #{f}(other, *args)
if :#{fi} != :interacting && :#{fi} != :not_interacting
requires_edges_or_region("#{f}")
requires_same_type(other, "#{f}")
requires_edges_texts_or_region("#{f}")
if self.data.is_a?(RBA::Text)
other.requires_region("#{f}")
elsif self.data.is_a?(RBA::Region)
other.requires_edges_texts_or_region("#{f}")
else
requires_edges_texts_or_region("#{f}")
if self.data.is_a?(RBA::Text)
other.requires_region("#{f}")
elsif self.data.is_a?(RBA::Region)
other.requires_edges_texts_or_region("#{f}")
else
other.requires_edges_or_region("#{f}")
end
other.requires_edges_or_region("#{f}")
end
if @engine.is_tiled?
self.data = @engine._tcmd(self.data, 0, self.data.class, :#{fi}, other.data, *minmax_count(:#{f}, *args))
self.data = @engine._tcmd(self.data, 0, self.data.class, :#{fi}, other.data, *minmax_count(:#{fi}, *args))
DRCLayer::new(@engine, self.data)
else
DRCLayer::new(@engine, @engine._tcmd(self.data, 0, self.data.class, :#{f}, other.data, *minmax_count(:#{f}, *args)))
@ -1974,19 +1969,8 @@ CODE
# In tiled mode, there are no modifying versions. Emulate using the non-modifying one.
eval <<"CODE"
def #{f}(other)
if :#{fi} != :interacting && :#{fi} != :not_interacting
requires_edges_or_region("#{f}")
requires_same_type(other, "#{f}")
else
requires_edges_texts_or_region("#{f}")
if self.data.is_a?(RBA::Text)
other.requires_region("#{f}")
elsif self.data.is_a?(RBA::Region)
other.requires_edges_texts_or_region("#{f}")
else
other.requires_edges_or_region("#{f}")
end
end
requires_edges_or_region("#{f}")
requires_same_type(other, "#{f}")
if @engine.is_tiled?
self.data = @engine._tcmd(self.data, 0, self.data.class, :#{fi}, other.data)
DRCLayer::new(@engine, self.data)