src/hg/hgTracks/variation.c 1.142

1.142 2009/06/26 20:16:56 tdreszer
Inital checkin of imageV2, but ifdef'd out.
Index: src/hg/hgTracks/variation.c
===================================================================
RCS file: /projects/compbio/cvsroot/kent/src/hg/hgTracks/variation.c,v
retrieving revision 1.141
retrieving revision 1.142
diff -b -B -U 4 -r1.141 -r1.142
--- src/hg/hgTracks/variation.c	24 Oct 2008 17:53:54 -0000	1.141
+++ src/hg/hgTracks/variation.c	26 Jun 2009 20:16:56 -0000	1.142
@@ -1,8 +1,9 @@
 /* variation.c - hgTracks routines that are specific to the tracks in
  * the variation group */
 
 #include "variation.h"
+#include "imageV2.h"
 
 static char const rcsid[] = "$Id$";
 
 struct hash *snp125FuncCartColorHash = NULL;
@@ -1227,8 +1228,29 @@
 		  int xr, int yr, int xb, int yb, 
 		  char *name, char *shortLabel, char *trackName)
 /* Print out image map rectangle that invokes hgTrackUi. */
 {
+#ifdef IMAGEv2_UI
+if(curMap != NULL)
+    {
+    char link[512];
+    safef(link,sizeof(link),"%s?%s=%u&c=%s&g=%s&i=%s", hgTrackUiName(),
+	   cartSessionVarName(), cartSessionId(cart), chromName, trackName, name);
+    char title[128];
+    safef(title,sizeof(title),"%s controls", shortLabel);
+    // Add map item to currnent map (TODO: pass in map)
+    // FIXME: What am I going to do about poly cords???
+    // FIXME: What am I going to do about poly cords???
+    // FIXME: mapSetItemAdd(curMap,link,title,
+    // FIXME:     hvGfxAdjX(hvg, xl), yl,
+    // FIXME:     hvGfxAdjX(hvg, xt), yt,
+    // FIXME:     hvGfxAdjX(hvg, xr), yr,
+    // FIXME:    hvGfxAdjX(hvg, xb), yb));
+    // FIXME: What am I going to do about poly cords???
+    // FIXME: What am I going to do about poly cords???
+    warn("Track named %s has called for a POLY map titled '%s controls', but imageV2 doesn't yet support this. No map item made.",trackName,shortLabel);
+    }
+#else//ifndef IMAGEv2_UI
 hPrintf("<AREA SHAPE=POLY COORDS=\"%d,%d,%d,%d,%d,%d,%d,%d\" ", 
 	hvGfxAdjX(hvg, xl), yl, 
         hvGfxAdjX(hvg, xt), yt,
         hvGfxAdjX(hvg, xr), yr,
@@ -1237,21 +1259,35 @@
 hPrintf("HREF=\"%s?%s=%u&c=%s&g=%s&i=%s\"", hgTrackUiName(), 
 	cartSessionVarName(), cartSessionId(cart), chromName, trackName, name);
 mapStatusMessage("%s controls", shortLabel);
 hPrintf(">\n");
+#endif//ndef IMAGEv2_UI
 }
 
 void mapTrackBackground(struct track *tg, struct hvGfx *hvg, int xOff, int yOff)
 /* Print out image map rectangle that invokes hgTrackUi. */
 {
 xOff = hvGfxAdjXW(hvg, xOff, insideWidth);
+char *track = tg->tdb->parent ? tg->tdb->parent->tableName : tg->tdb->tableName;
+#ifdef IMAGEv2_UI
+if(curMap != NULL)
+    {
+    char link[512];
+    safef(link,sizeof(link),"%s?%s=%u&c=%s&g=%s&i=%s",hgTrackUiName(),
+	   cartSessionVarName(), cartSessionId(cart), chromName, track, track);
+    char title[128];
+    safef(title,sizeof(title),"%s controls", tg->mapName);
+    // Add map item to currnent map (TODO: pass in map)
+    mapSetItemAdd(curMap,link,title,xOff, yOff, xOff+insideWidth, yOff+tg->height);
+    }
+#else//ifndef IMAGEv2_UI
 hPrintf("<AREA SHAPE=RECT COORDS=\"%d,%d,%d,%d\" ", 
 	xOff, yOff, xOff+insideWidth, yOff+tg->height);
-char *track = tg->tdb->parent ? tg->tdb->parent->tableName : tg->tdb->tableName;
 hPrintf("HREF=\"%s?%s=%u&c=%s&g=%s&i=%s\"", hgTrackUiName(),
 	cartSessionVarName(), cartSessionId(cart), chromName, track, track);
 mapStatusMessage("%s controls", tg->mapName);
 hPrintf(">\n");
+#endif//ndef IMAGEv2_UI
 }
 
 int ldTotalHeight(struct track *tg, enum trackVisibility vis)
 /* Return total height. Called before and after drawItems.