if (clist != null)
{
ContactGeometry cgeom = new ContactGeometry(clist, ann.graphHeight);
- ContactGeometry.contactInterval ci = cgeom.mapFor(rowAndOffset,
- rowAndOffset);
+ ContactGeometry.contactInterval ci = cgeom.mapFor(rowAndOffset);
ContactRange cr = clist.getRangeFor(ci.cStart, ci.cEnd);
tooltip = "Contact from " + clist.getPosition() + ", [" + ci.cStart
+ " - " + ci.cEnd + "]" + "<br/>Mean:" + cr.getMean();
-
- // ap.getStructureSelectionManager().mouseOverSequence(ann.sequenceRef,
- // new int[] {column, ci.cStart,ci.cEnd}, -1, null)
+ int col = ann.sequenceRef.findPosition(column);
+ ap.getStructureSelectionManager()
+ .highlightPositionsOn(ann.sequenceRef, new int[][]
+ { new int[] { col, col },
+ new int[]
+ { ci.cStart, ci.cEnd } }, null);
}
}
return tooltip;
final int contact_height;
+ final int graphHeight;
+
public ContactGeometry(ContactListI contacts, int graphHeight)
{
+ this.graphHeight = graphHeight;
contact_height = contacts.getContactHeight();
// fractional number of contacts covering each pixel
contacts_per_pixel = (graphHeight < 1) ? contact_height
return ci;
}
+ /**
+ * return the cell containing given pixel
+ *
+ * @param pCentre
+ * @return range for pCEntre
+ */
+ public contactInterval mapFor(int pCentre)
+ {
+ int pStart = Math.max(pCentre - pixels_step, 0);
+ int pEnd = Math.min(pStart + pixels_step, graphHeight);
+ int cStart = (int) Math.floor(pStart * contacts_per_pixel);
+ contactInterval ci = new contactInterval(cStart,
+ (int) Math.min(contact_height,
+ Math.ceil(cStart + (pixels_step) * contacts_per_pixel)),
+ pStart, pEnd);
+
+ return ci;
+ }
+
public Iterator<contactInterval> iterateOverContactIntervals(
int graphHeight)
{
}
/**
+ * hack to highlight a range of positions at once on any structure views
+ *
+ * @param sequenceRef
+ * @param is
+ * - series of int start-end ranges as positions on sequenceRef
+ * @param i
+ * @param object
+ */
+ public void highlightPositionsOn(SequenceI sequenceRef, int[][] is,
+ Object source)
+ {
+ boolean hasSequenceListeners = handlingVamsasMo
+ || !seqmappings.isEmpty();
+ SearchResultsI results = null;
+ ArrayList<Integer> listOfPositions = new ArrayList<Integer>();
+ for (int[] s_e : is)
+ {
+ for (int p = s_e[0]; p <= s_e[1]; listOfPositions.add(p++))
+ ;
+ }
+ int seqpos[] = new int[listOfPositions.size()];
+ int i = 0;
+ for (Integer p : listOfPositions)
+ {
+ seqpos[i++] = p;
+ }
+
+ for (i = 0; i < listeners.size(); i++)
+ {
+ Object listener = listeners.elementAt(i);
+ if (listener == source)
+ {
+ // TODO listener (e.g. SeqPanel) is never == source (AlignViewport)
+ // Temporary fudge with SequenceListener.getVamsasSource()
+ continue;
+ }
+ if (listener instanceof StructureListener)
+ {
+ highlightStructure((StructureListener) listener, sequenceRef,
+ seqpos);
+ }
+
+ }
+ }
+
+ /**
* Propagate mouseover of a single position in a structure
*
* @param pdbResNum