Skip to content
Snippets Groups Projects
Commit fda65a62 authored by tjc's avatar tjc
Browse files

use strict defn for non-matching overlaps

git-svn-id: svn+ssh://svn.internal.sanger.ac.uk/repos/svn/pathsoft/artemis/trunk@2754 ee4ac58c-ac51-4696-9907-e4b3aa274f04
parent e35db096
No related branches found
No related tags found
No related merge requests found
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
* *
* $Header: //tmp/pathsoft/artemis/uk/ac/sanger/artemis/components/SelectMenu.java,v 1.6 2005-04-11 10:26:22 tjc Exp $ * $Header: //tmp/pathsoft/artemis/uk/ac/sanger/artemis/components/SelectMenu.java,v 1.7 2005-06-06 18:48:55 tjc Exp $
**/ **/
package uk.ac.sanger.artemis.components; package uk.ac.sanger.artemis.components;
...@@ -50,7 +50,7 @@ import javax.swing.*; ...@@ -50,7 +50,7 @@ import javax.swing.*;
* "Select by key". * "Select by key".
* *
* @author Kim Rutherford * @author Kim Rutherford
* @version $Id: SelectMenu.java,v 1.6 2005-04-11 10:26:22 tjc Exp $ * @version $Id: SelectMenu.java,v 1.7 2005-06-06 18:48:55 tjc Exp $
**/ **/
public class SelectMenu extends SelectionMenu public class SelectMenu extends SelectionMenu
...@@ -205,6 +205,16 @@ public class SelectMenu extends SelectionMenu ...@@ -205,6 +205,16 @@ public class SelectMenu extends SelectionMenu
{ {
public void actionPerformed(ActionEvent event) public void actionPerformed(ActionEvent event)
{ {
final JCheckBox cbox_strict = new JCheckBox("Strictly no overlapping regions",true);
int n = JOptionPane.showConfirmDialog(null, cbox_strict,
"Selecting Features in Non-matching Regions",
JOptionPane.OK_CANCEL_OPTION,
JOptionPane.QUESTION_MESSAGE);
if(n == JOptionPane.CANCEL_OPTION)
return;
frame.setCursor(cbusy); frame.setCursor(cbusy);
Vector diffs = null; Vector diffs = null;
if(alignQueryViewer == null || alignSubjectViewer == null) if(alignQueryViewer == null || alignSubjectViewer == null)
...@@ -222,7 +232,7 @@ public class SelectMenu extends SelectionMenu ...@@ -222,7 +232,7 @@ public class SelectMenu extends SelectionMenu
} }
if(diffs != null) if(diffs != null)
selectAllFeatures(diffs); selectAllFeatures(diffs,cbox_strict.isSelected());
frame.setCursor(cdone); frame.setCursor(cdone);
} }
}); });
...@@ -451,10 +461,11 @@ public class SelectMenu extends SelectionMenu ...@@ -451,10 +461,11 @@ public class SelectMenu extends SelectionMenu
/** /**
* *
* Select all features in a given collection of regions. * Select all features in a given collection of regions.
* @param regions Vector of coordinates. * @param regions Vector of coordinates of non-matching region.
* @param isStrict true if not allowing any overlap with matching region.
* *
*/ */
private void selectAllFeatures(final Vector regions) private void selectAllFeatures(final Vector regions, final boolean isStrict)
{ {
final FeaturePredicate predicate = new FeaturePredicate() final FeaturePredicate predicate = new FeaturePredicate()
...@@ -481,10 +492,14 @@ public class SelectMenu extends SelectionMenu ...@@ -481,10 +492,14 @@ public class SelectMenu extends SelectionMenu
diff_start = coords[0].intValue(); diff_start = coords[0].intValue();
diff_end = coords[1].intValue(); diff_end = coords[1].intValue();
if( (feat_start >= diff_start && feat_start <= diff_end) || if( isStrict && feat_start >= diff_start && feat_start <= diff_end &&
(feat_end >= diff_start && feat_end <= diff_end) || feat_end >= diff_start && feat_end <= diff_end )
(diff_start >= feat_start && diff_start <= feat_end) || return true;
(diff_end >= feat_start && diff_end <= feat_end ) ) else if( !isStrict &&
((feat_start >= diff_start && feat_start <= diff_end) ||
(feat_end >= diff_start && feat_end <= diff_end) ||
(diff_start >= feat_start && diff_start <= feat_end) ||
(diff_end >= feat_start && diff_end <= feat_end )) )
return true; return true;
else if(diff_start > feat_end) else if(diff_start > feat_end)
return false; return false;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment