Add a time+layer equivalence check
This is more useful than exact_equivalent() since _start offset may not match in some cases (compounds, import, record with different capture latencies). However shared group editing (range, copy/paste) does result in consistent layers and matching position+length.
This commit is contained in:
@@ -205,6 +205,7 @@ public:
|
||||
bool size_equivalent (boost::shared_ptr<const Region>) const;
|
||||
bool overlap_equivalent (boost::shared_ptr<const Region>) const;
|
||||
bool enclosed_equivalent (boost::shared_ptr<const Region>) const;
|
||||
bool layer_and_time_equivalent (boost::shared_ptr<const Region>) const;
|
||||
bool region_list_equivalent (boost::shared_ptr<const Region>) const;
|
||||
bool source_equivalent (boost::shared_ptr<const Region>) const;
|
||||
bool any_source_equivalent (boost::shared_ptr<const Region>) const;
|
||||
|
||||
@@ -631,7 +631,8 @@ typedef std::vector<boost::shared_ptr<Bundle> > BundleList;
|
||||
enum RegionEquivalence {
|
||||
Exact,
|
||||
Enclosed,
|
||||
Overlap
|
||||
Overlap,
|
||||
LayerTime
|
||||
};
|
||||
|
||||
enum WaveformScale {
|
||||
|
||||
@@ -694,6 +694,7 @@ setup_enum_writer ()
|
||||
REGISTER_ENUM(Exact);
|
||||
REGISTER_ENUM(Enclosed);
|
||||
REGISTER_ENUM(Overlap);
|
||||
REGISTER_ENUM(LayerTime);
|
||||
REGISTER(_RegionEquivalence);
|
||||
|
||||
REGISTER_ENUM(Linear);
|
||||
|
||||
@@ -846,6 +846,13 @@ Playlist::get_equivalent_regions (boost::shared_ptr<Region> other, vector<boost:
|
||||
}
|
||||
}
|
||||
break;
|
||||
case LayerTime:
|
||||
for (RegionList::iterator i = regions.begin(); i != regions.end(); ++i) {
|
||||
if ((*i)->layer_and_time_equivalent (other)) {
|
||||
results.push_back (*i);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case Enclosed:
|
||||
for (RegionList::iterator i = regions.begin(); i != regions.end(); ++i) {
|
||||
if ((*i)->enclosed_equivalent (other)) {
|
||||
|
||||
@@ -1484,6 +1484,14 @@ Region::enclosed_equivalent (boost::shared_ptr<const Region> other) const
|
||||
(first_sample() <= other->first_sample() && last_sample() >= other->last_sample()) ;
|
||||
}
|
||||
|
||||
bool
|
||||
Region::layer_and_time_equivalent (boost::shared_ptr<const Region> other) const
|
||||
{
|
||||
return _layer == other->_layer &&
|
||||
_position == other->_position &&
|
||||
_length == other->_length;
|
||||
}
|
||||
|
||||
bool
|
||||
Region::exact_equivalent (boost::shared_ptr<const Region> other) const
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user