6cbe864705942f1d802d552cbb8d09c7742015a0
braney
  Wed Sep 7 17:59:25 2016 -0700
make sure bigGeneDataUrl support does maxItems support correctly

diff --git src/hg/hgTracks/hgTracks.h src/hg/hgTracks/hgTracks.h
index d49a9c2..d8d5c9b 100644
--- src/hg/hgTracks/hgTracks.h
+++ src/hg/hgTracks/hgTracks.h
@@ -796,40 +796,47 @@
 void loadLinkedFeaturesWithLoaders(struct track *tg, struct slList *(*itemLoader)(char **row),
 				   struct linkedFeatures *(*lfFromWhatever)(struct slList *item),
 				   char *scoreColumn, char *moreWhere,
                                    boolean (*itemFilter)(struct slList *item));
 /* Make a linkedFeatures loader by providing three functions: (1) a regular */
 /* item loader found in all autoSql modules, (2) a custom myStruct->linkedFeatures */
 /* translating function, and (3) a function to free the thing loaded in (1). */
 
 struct linkedFeatures *linkedFeaturesFromGenePred(struct track *tg, struct genePred *gp, boolean extra);
 /* construct a linkedFeatures object from a genePred */
 
 struct linkedFeatures *bedMungToLinkedFeatures(struct bed **pBed, struct trackDb *tdb,
 	int fieldCount, int scoreMin, int scoreMax, boolean useItemRgb);
 /* Convert bed to a linkedFeature, destroying bed in the process. */
 
-struct bigBedInterval *bigBedSelectRange(struct track *track,
-	char *chrom, int start, int end, struct lm *lm);
+struct bigBedInterval *bigBedSelectRangeExt(struct track *track,
+	char *chrom, int start, int end, struct lm *lm, int maxItems);
 /* Return list of intervals in range. */
 
-void bigBedAddLinkedFeaturesFrom(struct track *track,
+#define bigBedSelectRange(track, chrom, start, end, lm)  \
+    bigBedSelectRangeExt(track, chrom,start, end, lm,  min(BIGBEDMAXIMUMITEMS, maximumTrackItems(track)))
+/* Return list of intervals in range. */
+
+void bigBedAddLinkedFeaturesFromExt(struct track *track,
 	char *chrom, int start, int end, int scoreMin, int scoreMax, boolean useItemRgb,
-	int fieldCount, struct linkedFeatures **pLfList);
+	int fieldCount, struct linkedFeatures **pLfList, int maxItems);
 /* Read in items in chrom:start-end from bigBed file named in track->bbiFileName, convert
  * them to linkedFeatures, and add to head of list. */
 
+#define bigBedAddLinkedFeaturesFrom(track, chrom, start, end, scoreMin, scoreMax, useItemRgb, fieldCount, pLfList) \
+    bigBedAddLinkedFeaturesFromExt(track, chrom, start, end, scoreMin, scoreMax, useItemRgb, fieldCount, pLfList, min(BIGBEDMAXIMUMITEMS, maximumTrackItems(track))) 
+
 boolean canDrawBigBedDense(struct track *tg);
 /* Return TRUE if conditions are such that can do the fast bigBed dense data fetch and
  * draw. */
 
 void bigBedDrawDense(struct track *tg, int seqStart, int seqEnd,
         struct hvGfx *hvg, int xOff, int yOff, int width,
         MgFont *font, Color color);
 /* Use big-bed summary data to quickly draw bigBed. */
 
 void adjustBedScoreGrayLevel(struct trackDb *tdb, struct bed *bed, int scoreMin, int scoreMax);
 /* For each distinct trackName passed in, check cart for trackName.minGrayLevel; if
  * that is different from the gray level implied by scoreMin's place in [0..scoreMax],
  * then linearly transform bed->score from the range of [scoreMin,scoreMax] to
  * [(cartMinGrayLevel*scoreMax)/maxShade,scoreMax].
  * Note: this assumes that scoreMin and scoreMax are constant for each track. */