Newer
Older
* If there are some selected bases or features select the features that are
* fully contained within that selection.
**/
private void selectContainedFeatures () {
final MarkerRange selected_marker_range =
getSelection ().getMarkerRange ();
final FeatureVector featuresContainedByRange;
try
{
if (selected_marker_range == null) {
final FeatureVector selected_features = getSelection ().getAllFeatures ();
if (selected_features.size () == 0) {
new MessageDialog (getParentFrame (), "nothing selected");
return;
featuresContainedByRange = new FeatureVector();
for(int i=0; i<selected_features.size(); i++) {
Range r = selected_features.elementAt(i).getMaxRawRange();
final FeatureVector featuresContained = getFeaturesContainedByRange(r);
for(int j=0; j<featuresContained.size(); j++) {
final Feature f = featuresContained.elementAt(j);
if(!featuresContainedByRange.contains(f) && !selected_features.contains(f))
featuresContainedByRange.add(f);
}
}
} else {
featuresContainedByRange = getFeaturesContainedByRange(
selected_marker_range.getRawRange());
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
} catch (OutOfRangeException e) {
throw new Error ("internal error - unexpected exception: " + e);
}
getSelection ().set (featuresContainedByRange);
}
/**
* Return the features that are contained by a given range
* @param r
* @return
* @throws OutOfRangeException
*/
private FeatureVector getFeaturesContainedByRange(Range r) throws OutOfRangeException
{
final FeatureVector featuresInRange =
getEntryGroup ().getFeaturesInRange (r);
final FeatureVector featuresContainedByRange = new FeatureVector();
for(int i=0; i<featuresInRange.size(); i++)
{
Feature f = featuresInRange.elementAt(i);
Range maxR = f.getMaxRawRange();
if(r.getStart() <= maxR.getStart() &&
r.getEnd() >= maxR.getEnd())
featuresContainedByRange.add(f);
return featuresContainedByRange;
/**
* This method sends an GotoEvent to all the GotoEvent listeners that will
* make the given base visible.
**/
private void makeBaseVisible (final Marker base_marker) {
goto_event_source.gotoBase (base_marker);
}
/**
* Return the EntryGroup that was passed to the constructor.
**/
private EntryGroup getEntryGroup () {
return entry_group;
}
}