|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.hd.d.pg2k.webSvr.location.LocationUtils
public class LocationUtils
Utilities to support Location display in Web pages.
| Field Summary | |
|---|---|
private static java.lang.ref.SoftReference<byte[]>[][] |
_gLTWC_cache
Private cache for getLocTNWithCrosshairs() accessed under the class lock. |
(package private) static java.lang.String |
BASE_ESTD_LOC_TN_URL
Basic root-relative URL for base thumbnail icon. |
static int |
DYN_LOC_TN_CROSSHAIR_RGB_COLOUR
Colour of cross-hairs to show location of item in RGB format. |
(package private) static int |
DYN_LOC_TN_IMG_TYPE
Type of thumbnail image that we dynamically generate. |
private static java.lang.String |
DYN_LOC_TN_MOUNT_POINT
Mount point for servlet, including usual suffix for given image type. |
(package private) static ExhibitMIME.ExhibitTypeParameters |
ETP
ExhibitMIME entry for the chosen output type. |
static int |
LOC_TN_HEIGHT
Height of (raw and modified) Estd thumbnail in pixels as returned by getEstdLocationThumbnailURL(). |
static int |
LOC_TN_WIDTH
Width of (raw and modified) Estd thumbnail in pixels as returned by getEstdLocationThumbnailURL(). |
| Constructor Summary | |
|---|---|
LocationUtils()
|
|
| Method Summary | |
|---|---|
static java.lang.String |
getEstdLocationThumbnailURL(Location.Estd loc,
boolean embedInHTML)
Return root-relative (starting with "/") URL for Estd location thumbnail. |
(package private) static byte[] |
getLocTNWithCrosshairs(javax.servlet.ServletContext context,
int x,
int y)
Returns a modified location thumbnail with crosshairs centred on x,y; never null. |
private static java.awt.Dimension |
getTNCrosshairCentre(Location.Estd loc)
Get cross-hair X,Y pixel centre on thumbnail given Estd location. |
static java.lang.String |
makeLocTNImgHTML(Location.Estd location)
Make HTML img for correct Estd location thumbnail with E/N crosshairs. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int LOC_TN_WIDTH
public static final int LOC_TN_HEIGHT
static final int DYN_LOC_TN_IMG_TYPE
Good types to use are PNG and GIF (when the LZW patent expires).
static final ExhibitMIME.ExhibitTypeParameters ETP
public static final int DYN_LOC_TN_CROSSHAIR_RGB_COLOUR
Make this available to (for example) Aloha Earth, so that we can use a common colour/style throughout.
static final java.lang.String BASE_ESTD_LOC_TN_URL
Assumed to be low-colour suitable for an index/palette representation such as GIF or PNG.
By default rendered n green (land) and blue (sea).
ON OE is assumed to be centered in the image, nominally between pixels for an even-pixel dimension.
private static final java.lang.String DYN_LOC_TN_MOUNT_POINT
This must correspond with where the servlet is actually mounted. (The servlet can be mounted to serve a tree that includes this.)
private static final java.lang.ref.SoftReference<byte[]>[][] _gLTWC_cache
| Constructor Detail |
|---|
public LocationUtils()
| Method Detail |
|---|
private static java.awt.Dimension getTNCrosshairCentre(Location.Estd loc)
The result is contrained to valid pixel coordinates [0, width[ and [0, height[.
public static java.lang.String getEstdLocationThumbnailURL(Location.Estd loc,
boolean embedInHTML)
loc - the location on Earth to link to the map for; never nullembedInHTML - if true, result will be embedded in HTML
so we will separate parameters with '&' rather than
an unprotected '&'
static byte[] getLocTNWithCrosshairs(javax.servlet.ServletContext context,
int x,
int y)
throws java.lang.IllegalArgumentException,
java.lang.RuntimeException,
java.io.IOException
The byte[] returned is not copied and so must not be altered. This routine is only package-visible.
This routine is synchronized primarily to make the cache thread-safe, but has the side-effect of ensuring that only one thumbnail can be generated at once, thus limiting peak CPU and memory demands.
context - context of current WAR; must not be nullx - x coordinate of crosshair centre within thumbnaily - x coordinate of crosshair centre within thumbnail
java.lang.IllegalArgumentException - if context is null
java.lang.RuntimeException - if x or y not valid pixel coords
within the thumbnail, ie where the crosshair could be centred.
java.io.IOException - if difficulty generating modified thumbnail
for example because the site is too busypublic static java.lang.String makeLocTNImgHTML(Location.Estd location)
The returned img has the alignment "top" and alt text "Aloha Earth!" and no spaces round it.
|
DHD Multimedia Gallery V1.57.21 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||