9a49290fedc8b4f9c7a631dedcfe8ac3aa2b4cee chinhli Thu Oct 20 14:10:43 2011 -0700 merge conflict resolved diff --git src/hg/hgTracks/imageV2.c src/hg/hgTracks/imageV2.c index d78f0ce..87e3430 100644 --- src/hg/hgTracks/imageV2.c +++ src/hg/hgTracks/imageV2.c @@ -1033,56 +1033,59 @@ { struct imgSlice *slice = imgTrackSliceGetByType(imgTrack,type); if(slice == NULL) return NULL; return sliceGetMap(slice,FALSE); // Map could belong to image or could be slice specific } int imgTrackAddMapItem(struct imgTrack *imgTrack,char *link,char *title,int topLeftX,int topLeftY,int bottomRightX,int bottomRightY, char *id) /* Will add a map item to an imgTrack's appropriate slice's map. Since a map item may span * slices, the imgTrack is in the best position to determine where to put the map item * returns count of map items added, which could be 0, 1 or more than one if item spans slices * NOTE: Precedence is given to first map item when adding items with same coordinates! */ { struct imgSlice *slice; char *imgFile = NULL; // name of file that hold the image +char *neededId = NULL; // id is only added it it is NOT the trackId. +if (imgTrack->tdb == NULL || differentString(id,imgTrack->tdb->track)) + neededId = id; int count = 0; for(slice = imgTrack->slices;slice != NULL;slice=slice->next) { if(slice->type == stButton) // Buttons don't have maps. Overlap will be ignored! continue; if(slice->parentImg != NULL) { if(imgFile == NULL) imgFile = slice->parentImg->file; //else if(differentString(imgFile,slice->parentImg->file)) // { // char * name = (imgTrack->name != NULL ? imgTrack->name : imgTrack->tdb != NULL ? imgTrack->tdb->track : imgFile); // warn("imgTrackAddMapItem(%s) called, but not all slice images are the same for this track.",name); // } // Not a valid warning! Side image and data image may be different!!! } if(topLeftX < (slice->offsetX + slice->width-1) && bottomRightX > (slice->offsetX + 1) && topLeftY < (slice->offsetY + slice->height-1) && bottomRightY > (slice->offsetY + 1)) // Overlap of a pixel or 2 is tolerated { struct mapSet *map = sliceGetMap(slice,FALSE); if(map!=NULL) { // NOTE: using find or add gives precedence to first of same coordinate map items added - mapSetItemFindOrAdd(map,link,title,max(topLeftX,slice->offsetX),max(topLeftY,slice->offsetY),min(bottomRightX,slice->offsetX + slice->width),min(bottomRightY,slice->offsetY + slice->height), id); + mapSetItemFindOrAdd(map,link,title,max(topLeftX,slice->offsetX),max(topLeftY,slice->offsetY),min(bottomRightX,slice->offsetX + slice->width),min(bottomRightY,slice->offsetY + slice->height), neededId); count++; } else { // FIXME: This is assuming that if there is no map then the entire slice should get the link! char * name = (imgTrack->name != NULL ? imgTrack->name : imgTrack->tdb != NULL ? imgTrack->tdb->track : imgFile); warn("imgTrackAddMapItem(%s,%s) mapItem(lx:%d,rx:%d) is overlapping slice:%s(lx:%d,rx:%d)",name,title,topLeftX,bottomRightX, sliceTypeToString(slice->type),slice->offsetX,(slice->offsetX + slice->width - 1)); sliceAddLink(slice,link,title); count++; } } } //if(count>=2) // { // char * name = (imgTrack->name != NULL ? imgTrack->name : imgTrack->tdb != NULL ? imgTrack->tdb->track : imgFile);