src/hg/hgTracks/netTrack.c 1.26

1.26 2009/06/12 22:19:35 hiram
Implement modes squish and pack for net tracks
Index: src/hg/hgTracks/netTrack.c
===================================================================
RCS file: /projects/compbio/cvsroot/kent/src/hg/hgTracks/netTrack.c,v
retrieving revision 1.25
retrieving revision 1.26
diff -b -B -U 4 -r1.25 -r1.26
--- src/hg/hgTracks/netTrack.c	18 Mar 2009 18:27:00 -0000	1.25
+++ src/hg/hgTracks/netTrack.c	12 Jun 2009 22:19:35 -0000	1.26
@@ -203,10 +203,10 @@
     orientation = orientFromChar(fill->qStrand);
     if (fill->children == NULL || fill->tSize * rScale < 2.5)
     /* Draw single solid box if no gaps or no room to draw gaps. */
         {
-	rNetBox(hvg, fill, fill->tStart, fill->tStart + fill->tSize, y, level,
-		color, invColor, orientation);
+	rNetBox(hvg, fill, fill->tStart, fill->tStart + fill->tSize,
+		y, level, color, invColor, orientation);
 	}
     else
         {
 	int fStart = fill->tStart;
@@ -255,9 +255,9 @@
 
     /* Compute a few other positional things for recursive routine. */
     rHeightPer = tg->heightPer;
     rMidLineOff = rHeightPer/2;
-    rIsFull = (vis == tvFull);
+    rIsFull = (vis == tvFull || vis == tvPack || vis == tvSquish);
     if (rIsFull)
 	rNextLine = tg->lineHeight;
     else
 	rNextLine = 0;
@@ -270,8 +270,33 @@
 if (vis == tvDense)
     mapBoxToggleVis(hvg, xOff, yOff, width, tg->heightPer, tg);
 }
 
+static int netTotalHeight(struct track *tg, enum trackVisibility vis)
+/* A copy of tgFixedTotalHeightNoOverflow() with visibility forced */
+{
+int ret = 0;
+switch (vis)
+    {
+    case tvSquish:
+	ret = tgFixedTotalHeightOptionalOverflow(tg, tvFull, (tl.fontHeight/3)+1, (tl.fontHeight/3), FALSE);
+	break;
+    case tvPack:
+	ret = tgFixedTotalHeightOptionalOverflow(tg, tvFull, (tl.fontHeight/2)+1, (tl.fontHeight/2), FALSE);
+	break;
+    case tvFull:
+	ret = tgFixedTotalHeightOptionalOverflow(tg, tvFull, tl.fontHeight+1, tl.fontHeight, FALSE);
+	break;
+    case tvDense:
+	ret = tgFixedTotalHeightOptionalOverflow(tg, tvDense, tl.fontHeight+1, tl.fontHeight, FALSE);
+	break;
+    case tvHide:
+    default:
+	break;
+    }
+return(ret);
+}
+
 void netMethods(struct track *tg)
 /* Make track group for chain/net alignment. */
 {
 struct cartOptions *netCart;
@@ -285,9 +310,9 @@
 tg->freeItems = netFree;
 tg->drawItems = netDraw;
 tg->itemName = netName;
 tg->mapItemName = netName;
-tg->totalHeight = tgFixedTotalHeightNoOverflow;
+tg->totalHeight = netTotalHeight;
 tg->itemHeight = tgFixedItemHeight;
 tg->itemStart = tgItemNoStart;
 tg->itemEnd = tgItemNoEnd;
 tg->mapsSelf = TRUE;