First API steps

This commit is contained in:
Matthias Koefferlein 2024-08-03 23:18:57 +02:00
parent a5ea8eb590
commit 7510728a71
9 changed files with 462 additions and 0 deletions

View File

@ -241,6 +241,90 @@ AsIfFlatEdgePairs::filtered (const EdgePairFilterBase &filter) const
return new_edge_pairs.release ();
}
RegionDelegate *
AsIfFlatEdgePairs::pull_interacting (const Region &) const
{
// @@@
}
EdgesDelegate *
AsIfFlatEdgePairs::pull_interacting (const Edges &) const
{
// @@@
}
EdgePairsDelegate *
AsIfFlatEdgePairs::selected_interacting (const Region &other, size_t min_count, size_t max_count) const
{
// @@@
}
EdgePairsDelegate *
AsIfFlatEdgePairs::selected_not_interacting (const Region &other, size_t min_count, size_t max_count) const
{
// @@@
}
EdgePairsDelegate *
AsIfFlatEdgePairs::selected_interacting (const Edges &other, size_t min_count, size_t max_count) const
{
// @@@
}
EdgePairsDelegate *
AsIfFlatEdgePairs::selected_not_interacting (const Edges &other, size_t min_count, size_t max_count) const
{
// @@@
}
std::pair<EdgePairsDelegate *, EdgePairsDelegate *>
AsIfFlatEdgePairs::selected_interacting_pair (const Region &other, size_t min_count, size_t max_count) const
{
// @@@
}
std::pair<EdgePairsDelegate *, EdgePairsDelegate *>
AsIfFlatEdgePairs::selected_interacting_pair (const Edges &other, size_t min_count, size_t max_count) const
{
// @@@
}
EdgePairsDelegate *
AsIfFlatEdgePairs::selected_outside (const Region &other) const
{
// @@@
}
EdgePairsDelegate *
AsIfFlatEdgePairs::selected_not_outside (const Region &other) const
{
// @@@
}
std::pair<EdgePairsDelegate *, EdgePairsDelegate *>
AsIfFlatEdgePairs::selected_outside_pair (const Region &other) const
{
// @@@
}
EdgePairsDelegate *
AsIfFlatEdgePairs::selected_inside (const Region &other) const
{
// @@@
}
EdgePairsDelegate *
AsIfFlatEdgePairs::selected_not_inside (const Region &other) const
{
// @@@
}
std::pair<EdgePairsDelegate *, EdgePairsDelegate *>
AsIfFlatEdgePairs::selected_inside_pair (const Region &other) const
{
// @@@
}
RegionDelegate *
AsIfFlatEdgePairs::polygons (db::Coord e) const
{

View File

@ -62,6 +62,22 @@ public:
virtual RegionDelegate *processed_to_polygons (const EdgePairToPolygonProcessorBase &proc) const;
virtual EdgesDelegate *processed_to_edges (const EdgePairToEdgeProcessorBase &proc) const;
virtual RegionDelegate *pull_interacting (const Region &) const;
virtual EdgesDelegate *pull_interacting (const Edges &) const;
virtual EdgePairsDelegate *selected_interacting (const Region &other, size_t min_count, size_t max_count) const;
virtual EdgePairsDelegate *selected_not_interacting (const Region &other, size_t min_count, size_t max_count) const;
virtual EdgePairsDelegate *selected_interacting (const Edges &other, size_t min_count, size_t max_count) const;
virtual EdgePairsDelegate *selected_not_interacting (const Edges &other, size_t min_count, size_t max_count) const;
virtual std::pair<EdgePairsDelegate *, EdgePairsDelegate *> selected_interacting_pair (const Region &other, size_t min_count, size_t max_count) const;
virtual std::pair<EdgePairsDelegate *, EdgePairsDelegate *> selected_interacting_pair (const Edges &other, size_t min_count, size_t max_count) const;
virtual EdgePairsDelegate *selected_outside (const Region &other) const;
virtual EdgePairsDelegate *selected_not_outside (const Region &other) const;
virtual std::pair<EdgePairsDelegate *, EdgePairsDelegate *> selected_outside_pair (const Region &other) const;
virtual EdgePairsDelegate *selected_inside (const Region &other) const;
virtual EdgePairsDelegate *selected_not_inside (const Region &other) const;
virtual std::pair<EdgePairsDelegate *, EdgePairsDelegate *> selected_inside_pair (const Region &other) const;
virtual EdgePairsDelegate *add_in_place (const EdgePairs &other)
{
return add (other);

View File

@ -497,6 +497,90 @@ RegionDelegate *DeepEdgePairs::polygons (db::Coord e) const
return new db::DeepRegion (new_layer);
}
RegionDelegate *
DeepEdgePairs::pull_interacting (const Region &) const
{
// @@@
}
EdgesDelegate *
DeepEdgePairs::pull_interacting (const Edges &) const
{
// @@@
}
EdgePairsDelegate *
DeepEdgePairs::selected_interacting (const Region &other, size_t min_count, size_t max_count) const
{
// @@@
}
EdgePairsDelegate *
DeepEdgePairs::selected_not_interacting (const Region &other, size_t min_count, size_t max_count) const
{
// @@@
}
EdgePairsDelegate *
DeepEdgePairs::selected_interacting (const Edges &other, size_t min_count, size_t max_count) const
{
// @@@
}
EdgePairsDelegate *
DeepEdgePairs::selected_not_interacting (const Edges &other, size_t min_count, size_t max_count) const
{
// @@@
}
std::pair<EdgePairsDelegate *, EdgePairsDelegate *>
DeepEdgePairs::selected_interacting_pair (const Region &other, size_t min_count, size_t max_count) const
{
// @@@
}
std::pair<EdgePairsDelegate *, EdgePairsDelegate *>
DeepEdgePairs::selected_interacting_pair (const Edges &other, size_t min_count, size_t max_count) const
{
// @@@
}
EdgePairsDelegate *
DeepEdgePairs::selected_outside (const Region &other) const
{
// @@@
}
EdgePairsDelegate *
DeepEdgePairs::selected_not_outside (const Region &other) const
{
// @@@
}
std::pair<EdgePairsDelegate *, EdgePairsDelegate *>
DeepEdgePairs::selected_outside_pair (const Region &other) const
{
// @@@
}
EdgePairsDelegate *
DeepEdgePairs::selected_inside (const Region &other) const
{
// @@@
}
EdgePairsDelegate *
DeepEdgePairs::selected_not_inside (const Region &other) const
{
// @@@
}
std::pair<EdgePairsDelegate *, EdgePairsDelegate *>
DeepEdgePairs::selected_inside_pair (const Region &other) const
{
// @@@
}
EdgesDelegate *DeepEdgePairs::generic_edges (bool first, bool second) const
{
db::DeepLayer new_layer = deep_layer ().derived ();

View File

@ -83,6 +83,22 @@ public:
virtual RegionDelegate *processed_to_polygons (const EdgePairToPolygonProcessorBase &filter) const;
virtual EdgesDelegate *processed_to_edges (const EdgePairToEdgeProcessorBase &filter) const;
virtual RegionDelegate *pull_interacting (const Region &) const;
virtual EdgesDelegate *pull_interacting (const Edges &) const;
virtual EdgePairsDelegate *selected_interacting (const Region &other, size_t min_count, size_t max_count) const;
virtual EdgePairsDelegate *selected_not_interacting (const Region &other, size_t min_count, size_t max_count) const;
virtual EdgePairsDelegate *selected_interacting (const Edges &other, size_t min_count, size_t max_count) const;
virtual EdgePairsDelegate *selected_not_interacting (const Edges &other, size_t min_count, size_t max_count) const;
virtual std::pair<EdgePairsDelegate *, EdgePairsDelegate *> selected_interacting_pair (const Region &other, size_t min_count, size_t max_count) const;
virtual std::pair<EdgePairsDelegate *, EdgePairsDelegate *> selected_interacting_pair (const Edges &other, size_t min_count, size_t max_count) const;
virtual EdgePairsDelegate *selected_outside (const Region &other) const;
virtual EdgePairsDelegate *selected_not_outside (const Region &other) const;
virtual std::pair<EdgePairsDelegate *, EdgePairsDelegate *> selected_outside_pair (const Region &other) const;
virtual EdgePairsDelegate *selected_inside (const Region &other) const;
virtual EdgePairsDelegate *selected_not_inside (const Region &other) const;
virtual std::pair<EdgePairsDelegate *, EdgePairsDelegate *> selected_inside_pair (const Region &other) const;
virtual EdgePairsDelegate *add_in_place (const EdgePairs &other);
virtual EdgePairsDelegate *add (const EdgePairs &other) const;

View File

@ -224,6 +224,16 @@ void EdgePairs::second_edges (Edges &output) const
output.set_delegate (mp_delegate->second_edges ());
}
void EdgePairs::pull_interacting (Region &output, const Region &other) const
{
// @@@
}
void EdgePairs::pull_interacting (Edges &output, const Edges &other) const
{
// @@@
}
void EdgePairs::set_delegate (EdgePairsDelegate *delegate)
{
if (delegate != mp_delegate) {

View File

@ -370,6 +370,214 @@ public:
*/
void processed (Edges &output, const EdgePairToEdgeProcessorBase &proc) const;
/**
* @brief Selects all polygons of the region set which overlap or touch edges from this edge pair set
*
* Merged semantics applies for the other region. Merged polygons will be selected from the other region
* if merged semantics is enabled.
*/
void pull_interacting (Region &output, const Region &other) const;
/**
* @brief Selects all edges of the other edge set which overlap or touch edges from this edge pair set
*
* Merged semantics applies. If merged semantics is chosen, the connected edge parts will be
* selected as a whole from other.
*/
void pull_interacting (Edges &output, const Edges &other) const;
/**
* @brief Selects all edge pairs of this set which overlap or touch with polygons from the region
*/
EdgePairs &select_interacting (const Region &other, size_t min_count = 1, size_t max_count = std::numeric_limits<size_t>::max ())
{
set_delegate (mp_delegate->selected_interacting (other, min_count, max_count));
return *this;
}
/**
* @brief Returns all edge pairs of this set which overlap or touch with polygons from the region
*
* This method is an out-of-place version of select_interacting.
*/
EdgePairs selected_interacting (const Region &other, size_t min_count = 1, size_t max_count = std::numeric_limits<size_t>::max ()) const
{
return EdgePairs (mp_delegate->selected_interacting (other, min_count, max_count));
}
/**
* @brief Selects all edge pairs of this set which do not overlap or touch with polygons from the region
*/
EdgePairs &select_not_interacting (const Region &other, size_t min_count = 1, size_t max_count = std::numeric_limits<size_t>::max ())
{
set_delegate (mp_delegate->selected_not_interacting (other, min_count, max_count));
return *this;
}
/**
* @brief Returns all edge pairs of this set which do not overlap or touch with polygons from the region
*
* This method is an out-of-place version of select_not_interacting.
*/
EdgePairs selected_not_interacting (const Region &other, size_t min_count = 1, size_t max_count = std::numeric_limits<size_t>::max ()) const
{
return EdgePairs (mp_delegate->selected_not_interacting (other, min_count, max_count));
}
/**
* @brief Returns all edge pairs of this set which do not overlap or touch with polygons from the region together with the ones that do not
*/
std::pair<EdgePairs, EdgePairs> selected_interacting_differential (const Region &other, size_t min_count = 1, size_t max_count = std::numeric_limits<size_t>::max ()) const
{
std::pair<db::EdgePairsDelegate *, db::EdgePairsDelegate *> p = mp_delegate->selected_interacting_pair (other, min_count, max_count);
return std::pair<EdgePairs, EdgePairs> (EdgePairs (p.first), EdgePairs (p.second));
}
/**
* @brief Selects all edge pairs of this collection which are completely outside polygons from the region
*/
EdgePairs &select_outside (const Region &other)
{
set_delegate (mp_delegate->selected_outside (other));
return *this;
}
/**
* @brief Selects all edge pairs of this collection which are not completely outside polygons from the region
*/
EdgePairs &select_not_outside (const Region &other)
{
set_delegate (mp_delegate->selected_not_outside (other));
return *this;
}
/**
* @brief Returns all edge pairs of this collection which are completely outside polygons from the region
*
* This method is an out-of-place version of select_outside.
*/
EdgePairs selected_outside (const Region &other) const
{
return EdgePairs (mp_delegate->selected_outside (other));
}
/**
* @brief Returns all edge pairs of this collection which are not completely outside polygons from the region
*
* This method is an out-of-place version of select_not_outside.
*/
EdgePairs selected_not_outside (const Region &other) const
{
return EdgePairs (mp_delegate->selected_not_outside (other));
}
/**
* @brief Returns all edge pairs of this which are completely outside polygons from the region and the opposite ones at the same time
*
* This method is equivalent to calling selected_outside and selected_not_outside, but faster.
*/
std::pair<EdgePairs, EdgePairs> selected_outside_differential (const Region &other) const
{
std::pair<db::EdgePairsDelegate *, db::EdgePairsDelegate *> p = mp_delegate->selected_outside_pair (other);
return std::pair<EdgePairs, EdgePairs> (EdgePairs (p.first), EdgePairs (p.second));
}
/**
* @brief Selects all edge pairs of this collection which are completely inside polygons from the region
*/
EdgePairs &select_inside (const Region &other)
{
set_delegate (mp_delegate->selected_inside (other));
return *this;
}
/**
* @brief Selects all edge pairs of this collection which are not completely inside polygons from the region
*/
EdgePairs &select_not_inside (const Region &other)
{
set_delegate (mp_delegate->selected_not_inside (other));
return *this;
}
/**
* @brief Returns all edge pairs of this which are completely inside polygons from the region
*
* This method is an out-of-place version of select_inside.
*/
EdgePairs selected_inside (const Region &other) const
{
return EdgePairs (mp_delegate->selected_inside (other));
}
/**
* @brief Returns all edge pairs of this which are not completely inside polygons from the region
*
* This method is an out-of-place version of select_not_inside.
*/
EdgePairs selected_not_inside (const Region &other) const
{
return EdgePairs (mp_delegate->selected_not_inside (other));
}
/**
* @brief Returns all edge pairs of this which are completely inside polygons from the region and the opposite ones at the same time
*
* This method is equivalent to calling selected_inside and selected_not_inside, but faster.
*/
std::pair<EdgePairs, EdgePairs> selected_inside_differential (const Region &other) const
{
std::pair<db::EdgePairsDelegate *, db::EdgePairsDelegate *> p = mp_delegate->selected_inside_pair (other);
return std::pair<EdgePairs, EdgePairs> (EdgePairs (p.first), EdgePairs (p.second));
}
/**
* @brief Selects all edge pairs of this edge pairs set which overlap or touch with edges from the edge set
*/
EdgePairs &select_interacting (const Edges &other, size_t min_count = 1, size_t max_count = std::numeric_limits<size_t>::max ())
{
set_delegate (mp_delegate->selected_interacting (other, min_count, max_count));
return *this;
}
/**
* @brief Returns all edge pairs of this edge pairs set which overlap or touch with edges from the edge set
*
* This method is an out-of-place version of select_interacting.
*/
EdgePairs selected_interacting (const Edges &other, size_t min_count = 1, size_t max_count = std::numeric_limits<size_t>::max ()) const
{
return EdgePairs (mp_delegate->selected_interacting (other, min_count, max_count));
}
/**
* @brief Returns all edge pairs of this edge set which do not overlap or touch with edges from the other edge set together with the ones that do not
*/
std::pair<EdgePairs, EdgePairs> selected_interacting_differential (const Edges &other, size_t min_count = 1, size_t max_count = std::numeric_limits<size_t>::max ()) const
{
std::pair<db::EdgePairsDelegate *, db::EdgePairsDelegate *> p = mp_delegate->selected_interacting_pair (other, min_count, max_count);
return std::pair<EdgePairs, EdgePairs> (EdgePairs (p.first), EdgePairs (p.second));
}
/**
* @brief Selects all edge pairs of this edge pairs set which do not overlap or touch with edges from the edge set
*/
EdgePairs &select_not_interacting (const Edges &other, size_t min_count = 1, size_t max_count = std::numeric_limits<size_t>::max ())
{
set_delegate (mp_delegate->selected_not_interacting (other, min_count, max_count));
return *this;
}
/**
* @brief Returns all edge pairs of this edge pairs set which do not overlap or touch with edges from the edge set
*
* This method is an out-of-place version of select_not_interacting.
*/
EdgePairs selected_not_interacting (const Edges &other, size_t min_count = 1, size_t max_count = std::numeric_limits<size_t>::max ()) const
{
return EdgePairs (mp_delegate->selected_not_interacting (other, min_count, max_count));
}
/**
* @brief Transforms the edge pair set
*/

View File

@ -200,6 +200,22 @@ public:
virtual RegionDelegate *processed_to_polygons (const EdgePairToPolygonProcessorBase &proc) const = 0;
virtual EdgesDelegate *processed_to_edges (const EdgePairToEdgeProcessorBase &proc) const = 0;
virtual RegionDelegate *pull_interacting (const Region &) const = 0;
virtual EdgesDelegate *pull_interacting (const Edges &) const = 0;
virtual EdgePairsDelegate *selected_interacting (const Region &other, size_t min_count, size_t max_count) const = 0;
virtual EdgePairsDelegate *selected_not_interacting (const Region &other, size_t min_count, size_t max_count) const = 0;
virtual EdgePairsDelegate *selected_interacting (const Edges &other, size_t min_count, size_t max_count) const = 0;
virtual EdgePairsDelegate *selected_not_interacting (const Edges &other, size_t min_count, size_t max_count) const = 0;
virtual std::pair<EdgePairsDelegate *, EdgePairsDelegate *> selected_interacting_pair (const Region &other, size_t min_count, size_t max_count) const = 0;
virtual std::pair<EdgePairsDelegate *, EdgePairsDelegate *> selected_interacting_pair (const Edges &other, size_t min_count, size_t max_count) const = 0;
virtual EdgePairsDelegate *selected_outside (const Region &other) const = 0;
virtual EdgePairsDelegate *selected_not_outside (const Region &other) const = 0;
virtual std::pair<EdgePairsDelegate *, EdgePairsDelegate *> selected_outside_pair (const Region &other) const = 0;
virtual EdgePairsDelegate *selected_inside (const Region &other) const = 0;
virtual EdgePairsDelegate *selected_not_inside (const Region &other) const = 0;
virtual std::pair<EdgePairsDelegate *, EdgePairsDelegate *> selected_inside_pair (const Region &other) const = 0;
virtual RegionDelegate *polygons (db::Coord e) const = 0;
virtual EdgesDelegate *edges () const = 0;
virtual EdgesDelegate *first_edges () const = 0;

View File

@ -65,6 +65,18 @@ EmptyEdgePairs::processed_to_edges (const EdgePairToEdgeProcessorBase &) const
return new EmptyEdges ();
}
RegionDelegate *
EmptyEdgePairs::pull_interacting (const Region &) const
{
return new EmptyRegion ();
}
EdgesDelegate *
EmptyEdgePairs::pull_interacting (const Edges &) const
{
return new EmptyEdges ();
}
EdgesDelegate *
EmptyEdgePairs::edges () const
{

View File

@ -61,6 +61,22 @@ public:
virtual RegionDelegate *processed_to_polygons (const EdgePairToPolygonProcessorBase &filter) const;
virtual EdgesDelegate *processed_to_edges (const EdgePairToEdgeProcessorBase &filter) const;
virtual RegionDelegate *pull_interacting (const Region &) const;
virtual EdgesDelegate *pull_interacting (const Edges &) const;
virtual EdgePairsDelegate *selected_interacting (const Region &, size_t, size_t) const { return new EmptyEdgePairs (); }
virtual EdgePairsDelegate *selected_not_interacting (const Region &, size_t, size_t) const { return new EmptyEdgePairs (); }
virtual EdgePairsDelegate *selected_interacting (const Edges &, size_t, size_t) const { return new EmptyEdgePairs (); }
virtual EdgePairsDelegate *selected_not_interacting (const Edges &, size_t, size_t) const { return new EmptyEdgePairs (); }
virtual std::pair<EdgePairsDelegate *, EdgePairsDelegate *> selected_interacting_pair (const Region &, size_t, size_t) const { return std::make_pair (new EmptyEdgePairs (), new EmptyEdgePairs ()); }
virtual std::pair<EdgePairsDelegate *, EdgePairsDelegate *> selected_interacting_pair (const Edges &, size_t, size_t) const { return std::make_pair (new EmptyEdgePairs (), new EmptyEdgePairs ()); }
virtual EdgePairsDelegate *selected_outside (const Region &) const { return new EmptyEdgePairs (); }
virtual EdgePairsDelegate *selected_not_outside (const Region &) const { return new EmptyEdgePairs (); }
virtual std::pair<EdgePairsDelegate *, EdgePairsDelegate *> selected_outside_pair (const Region &) const { return std::make_pair (new EmptyEdgePairs (), new EmptyEdgePairs ()); }
virtual EdgePairsDelegate *selected_inside (const Region &) const { return new EmptyEdgePairs (); }
virtual EdgePairsDelegate *selected_not_inside (const Region &) const { return new EmptyEdgePairs (); }
virtual std::pair<EdgePairsDelegate *, EdgePairsDelegate *> selected_inside_pair (const Region &) const { return std::make_pair (new EmptyEdgePairs (), new EmptyEdgePairs ()); }
virtual RegionDelegate *polygons (db::Coord e) const;
virtual EdgesDelegate *edges () const;
virtual EdgesDelegate *first_edges () const;