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

select non-matching regions

git-svn-id: svn+ssh://svn.internal.sanger.ac.uk/repos/svn/pathsoft/artemis/trunk@2387 ee4ac58c-ac51-4696-9907-e4b3aa274f04
parent 295ef5d8
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.2 2005-04-07 16:27:51 tjc Exp $ * $Header: //tmp/pathsoft/artemis/uk/ac/sanger/artemis/components/SelectMenu.java,v 1.3 2005-04-08 13:51:40 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.2 2005-04-07 16:27:51 tjc Exp $ * @version $Id: SelectMenu.java,v 1.3 2005-04-08 13:51:40 tjc Exp $
**/ **/
public class SelectMenu extends SelectionMenu public class SelectMenu extends SelectionMenu
...@@ -99,6 +99,11 @@ public class SelectMenu extends SelectionMenu ...@@ -99,6 +99,11 @@ public class SelectMenu extends SelectionMenu
**/ **/
final private int MAX_FEATURE_TO_SELECT_COUNT = 10000; final private int MAX_FEATURE_TO_SELECT_COUNT = 10000;
/** busy cursor */
private Cursor cbusy = new Cursor(Cursor.WAIT_CURSOR);
/** done cursor */
private Cursor cdone = new Cursor(Cursor.DEFAULT_CURSOR);
/** /**
* Create a new SelectMenu object and all it's menu items. * Create a new SelectMenu object and all it's menu items.
...@@ -171,7 +176,9 @@ public class SelectMenu extends SelectionMenu ...@@ -171,7 +176,9 @@ public class SelectMenu extends SelectionMenu
{ {
public void actionPerformed(ActionEvent event) public void actionPerformed(ActionEvent event)
{ {
frame.setCursor(cbusy);
selectAll(); selectAll();
frame.setCursor(cdone);
} }
}); });
...@@ -182,7 +189,9 @@ public class SelectMenu extends SelectionMenu ...@@ -182,7 +189,9 @@ public class SelectMenu extends SelectionMenu
{ {
public void actionPerformed(ActionEvent event) public void actionPerformed(ActionEvent event)
{ {
frame.setCursor(cbusy);
selectAllBases(); selectAllBases();
frame.setCursor(cdone);
} }
}); });
...@@ -196,6 +205,7 @@ public class SelectMenu extends SelectionMenu ...@@ -196,6 +205,7 @@ public class SelectMenu extends SelectionMenu
{ {
public void actionPerformed(ActionEvent event) public void actionPerformed(ActionEvent event)
{ {
frame.setCursor(cbusy);
Vector diffs = null; Vector diffs = null;
if(alignQueryViewer == null || alignSubjectViewer == null) if(alignQueryViewer == null || alignSubjectViewer == null)
{ {
...@@ -213,6 +223,7 @@ public class SelectMenu extends SelectionMenu ...@@ -213,6 +223,7 @@ public class SelectMenu extends SelectionMenu
if(diffs != null) if(diffs != null)
selectAllFeatures(diffs); selectAllFeatures(diffs);
frame.setCursor(cdone);
} }
}); });
...@@ -436,6 +447,13 @@ public class SelectMenu extends SelectionMenu ...@@ -436,6 +447,13 @@ public class SelectMenu extends SelectionMenu
} }
} }
/**
*
* Select all features in a given collection of regions.
* @param regions Vector of coordinates.
*
*/
private void selectAllFeatures(final Vector regions) private void selectAllFeatures(final Vector regions)
{ {
...@@ -444,6 +462,10 @@ public class SelectMenu extends SelectionMenu ...@@ -444,6 +462,10 @@ public class SelectMenu extends SelectionMenu
public boolean testPredicate(final Feature feature) public boolean testPredicate(final Feature feature)
{ {
final Location loc = feature.getLocation(); final Location loc = feature.getLocation();
Key key = feature.getKey();
if(key.equals("source"))
return false;
final int feat_start = loc.getFirstBase(); final int feat_start = loc.getFirstBase();
final int feat_end = loc.getLastBase(); final int feat_end = loc.getLastBase();
...@@ -453,9 +475,13 @@ public class SelectMenu extends SelectionMenu ...@@ -453,9 +475,13 @@ public class SelectMenu extends SelectionMenu
final Integer coords[] = (Integer[])eDiffs.nextElement(); final Integer coords[] = (Integer[])eDiffs.nextElement();
final int start = coords[0].intValue(); final int start = coords[0].intValue();
final int end = coords[1].intValue(); final int end = coords[1].intValue();
if( (start > feat_start && start < feat_end) || if( (feat_start >= start && feat_start <= end) ||
(end > feat_start && end < feat_end) ) (feat_end >= start && feat_end <= end) ||
(start >= feat_start && start <= feat_end) ||
(end >= feat_start&& end <= feat_end ) )
return true; return true;
else if(start > feat_end)
return false;
} }
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