7d6743d521ae0f87134820a6ef0943c915649e1e galt Sat Dec 6 09:35:15 2014 -0800 changing references to gif to png; fix documentation referring to slices to mention the newly-separated button slice diff --git src/hg/hgTracks/imageV2.h src/hg/hgTracks/imageV2.h index 06b8711..44e4174 100644 --- src/hg/hgTracks/imageV2.h +++ src/hg/hgTracks/imageV2.h @@ -70,56 +70,56 @@ // Initially pass in NULL pointer to a dyString to properly begin building void jsonTdbSettingsUse(struct jsonElement *settings); // Closes and returns the contents of the jsonTdbSettingsString ///////////////////////// // IMAGEv2 // The new way to do images // Terms: // "image box": The new version of the image on the html page. It is a table with rows that // contain tracks which are made up of parts of images. // "imgBox": This C struct contains all information to render the image box on the html page. // "imgTbl": The HTML structure that contains individual track images. // The javascript client controls the imgTbl. // Thus cgi knows imgBox while html/js knows imgTbl. -// "image": A single gif. An image may contain mutilple tracks. -// Even as a single track and image may contain a data image, sideLabel and centerLabel +// "image": A single png. An image may contain mutilple tracks. +// Even as a single track and image may contain a data image, centerLabel, sideLabel and button. // "map": (or "mapSet") The image map for providing links to items in a data image. // An image and map are a 1 to 1 pair and pixel coordinates are always image relative. // "slice": (or "imgSlice") The cgi concept of the portion of an image that is sent to the // html/js side. If we are sending a 3X sized image, the "slice" spans the entire 3X. // Almost always a subset of an image, but possibly the whole image. // Even if the image is of a single track, it will still be cut into data image, // sideLabel and centerLabel slices. // "sliceMap": The portion of a map that belongs to a slice. The pixel coordinates are always // image relative, not slice relative. // "portal": (or "imgPortal") The html/js concept of the portion of a data slice that is visible in // the browser. Thus, if we are sending a 3X sized data image slice, the "portal" seen // in the browser spans only 1X. // "imgTrack": (or track image) The cgi side whole shabang for rendering one track. It contains -// track specific information and three slices: data, sideLabel and centerLabel +// track specific information and four slices: data, centerLabel, sideLabel and button // The imgBox contains N imgTracks. Typically an ajax/JSON request gets a single // imgTrack returned, which then is updated in the imgTbl containing multiple tracks. // image box support: This can contain all the support variables that are global to the image box // (like font size, box width, etc.). At this point, lets not talk structure // or cgi vs. html/js but leave this container as a concept that we know // needs filling. // imgBox is the top level and contains all info to draw the image in HTML // - contains slList of all imgTrack structs shown // imgTrack contains all info to display one track/subtrack in the imgBox -// - contains 3 imgSlice structs (data, centerLabel, sideLabel) +// - contains 4 imgSlice structs (data, centerLabel, sideLabel, button) // imgSlice contains all info to display a portion of an image file // - contains 1 image struct // image contains all information about an image file and associated map box ///////////////////////// /////////////////////// Maps struct mapItem // IMAGEv2: single map item in an image map. { struct mapItem *next; // slList char *linkVar; // the get variables associated with the map link char *title; // item title int topLeftX; // in pixels relative to image int topLeftY; // in pixels relative to image int bottomRightX; // in pixels relative to image int bottomRightY; // in pixels relative to image @@ -181,31 +181,31 @@ // frees all memory (including items) assocated with a single mapSet /////////////////////// Images struct image // IMAGEv2: single image which may have multiple imgSlices focused on it { struct image *next; // slList (Not yet used) char *file; // name of file that hold the image char *title; // image wide title int width; // in pixels int height; // in pixels struct mapSet *map; // map assocated with this image (may be NULL) }; -struct image *imgCreate(char *gif,char *title,int width,int height); +struct image *imgCreate(char *png,char *title,int width,int height); // Creates a single image container. // A map map be added with imgMapStart(),mapSetItemAdd() struct mapSet *imgMapStart(struct image *img,char *name,char *linkRoot); // Starts a map associated with an image. // Map items can then be added to the returned pointer with mapSetItemAdd() struct mapSet *imgGetMap(struct image *img); // Gets the map associated with this image. // Map items can then be added to the map with mapSetItemAdd() void imgFree(struct image **pImg); // frees all memory assocated with an image (including a map) @@ -215,31 +215,31 @@ { stUnknown=0, // Invalid stData=1, // Data or track slice of an image stCenter=2, // Top or centerLabel slice of an image stButton=3, // Config button (by separating from side label, can have // separate image which is colored/zipped by javascript) stSide=4, // Side or leftLabel slice of an image stInvalid=5 // Invalid }; #define stMaxSliceTypes stInvalid struct imgSlice // IMAGEv2: the portion of an image that is displayable for one track { struct imgSlice *next; // slList enum sliceType type; // Type of slice (currently only 3) - struct image *parentImg; // the actual image/gif + struct image *parentImg; // the actual image/png char *title; // slice wide title struct mapSet *map; // A slice specific map. It contains a subset of the img->map. // Coordinates must be img relative NOT slice relative! char *link; // If a slice has no map, it may have a whole slice link int width; // in pixels (differs from img->width if img contains sideLabel) int height; // in pixels (differs from img->height if // img contains centerLabel and/or multiple tracks) int offsetX; // offset from left (when img->width > slice->width) int offsetY; // offset from top (when img->height > slice->height) }; struct imgSlice *sliceCreate(enum sliceType type,struct image *img,char *title, int width,int height,int offsetX,int offsetY); // Creates of a slice which is a portion of an image. // A slice specific map map be added with sliceMapStart(),mapSetItemAdd() @@ -292,32 +292,32 @@ struct trackDb *tdb; // trackDb entry (should this be struct track* entry?) char *name; // It is possible to have an imgTrack without a tdb, // but then it must have a name char *db; // Image for db (species) (assert imgTrack matches imgBox) char *chrom; // Image for chrom (assert imgTrack matches imgBox) int chromStart; // Image start (absolute, not portal position) int chromEnd; // Image end (absolute, not portal position) boolean plusStrand; // Image covers plus strand, not minus strand boolean hasCenterLabel; // A track may have a center label but not show it enum centerLabelSeen centerLabelSeen; // Conditionally displayed center labels are always // there but sometimes hidden boolean reorderable; // Is this track reorderable (by drag and drop) ? boolean ajaxRetrieval; // This track needs to be retrieved via ajax int order; // Image order: This keeps track of dragReorder enum trackVisibility vis; // Current visibility of track image - struct imgSlice *slices; // Currently there should be three slices for every track: - // data, centerLabel, sideLabel + struct imgSlice *slices; // Currently there should be four slices for every track: + // data, centerLabel, sideLabel, button }; #define IMG_ANYORDER -2 #define IMG_FIXEDPOS -1 #define IMG_ORDERTOP 10000 #define IMG_ORDEREND 20000 #define IMG_ORDER_VAR "imgOrd" struct imgTrack *imgTrackStart(struct trackDb *tdb,char *name,char *db, char *chrom,int chromStart,int chromEnd,boolean plusStrand, boolean hasCenterLabel,enum trackVisibility vis,int order); // Starts an image track which will contain all image slices needed to render one track // Must completed by adding slices with imgTrackAddSlice() struct imgTrack *imgTrackUpdate(struct imgTrack *imgTrack,struct trackDb *tdb,char *name, @@ -419,35 +419,35 @@ // Defines the portal of the imgBox. The portal is the initial viewable region when dragScroll // is being used. The new chromStart,chromEnd and imgWidth are returned as OUTs, while the // portal becomes the initial defined size // Returns TRUE if successfully defined as having a portal. boolean imgBoxPortalRemove(struct imgBox *imgBox,int *chromStart,int *chromEnd,int *imgWidth); // Will redefine the imgBox as the portal dimensions and return the dimensions as OUTs. // Returns TRUE if a portal was defined in the first place boolean imgBoxPortalDimensions(struct imgBox *imgBox,int *chromStart,int *chromEnd, int *imgWidth,int *sideLabelWidth, int *portalStart,int *portalEnd,int *portalWidth, double *basesPerPixel); // returns the imgBox portal dimensions in the OUTs returns TRUE if portal defined -struct image *imgBoxImageAdd(struct imgBox *imgBox,char *gif,char *title,int width,int height, +struct image *imgBoxImageAdd(struct imgBox *imgBox,char *png,char *title,int width,int height, boolean backGround); // Adds an image to an imgBox. The image may be extended with imgMapStart(),mapSetItemAdd() -struct image *imgBoxImageFind(struct imgBox *imgBox,char *gif); +struct image *imgBoxImageFind(struct imgBox *imgBox,char *png); // Finds a specific image already added to this imgBox struct imgTrack *imgBoxTrackAdd(struct imgBox *imgBox,struct trackDb *tdb,char *name, enum trackVisibility vis,boolean hasCenterLabel,int order); // Adds an imgTrack to an imgBox. The imgTrack needs to be extended with imgTrackAddSlice() struct imgTrack *imgBoxTrackFind(struct imgBox *imgBox,struct trackDb *tdb,char *name); // Finds a specific imgTrack already added to this imgBox struct imgTrack *imgBoxTrackFindOrAdd(struct imgBox *imgBox,struct trackDb *tdb,char *name, enum trackVisibility vis,boolean hasCenterLabel,int order); // Find the imgTrack, or adds it if not found struct imgTrack *imgBoxTrackUpdateOrAdd(struct imgBox *imgBox,struct trackDb *tdb,char *name, enum trackVisibility vis,boolean hasCenterLabel,int order);