Telogis.GeoBase.MapLayers.ImageObject |
MapLayers.ImageObject inherits from MapLayers.AbstractObject.
A class for displaying images on a map via an MapLayers.ObjectLayer.
// Render an image on the map ('map') with a balloon containing text var myImageObject = new Telogis.GeoBase.MapLayers.ImageObject({ scalable: true, // true to allow the image size to be changed, false to lock size src: 'images/pin-red.png', // The path to the image file used balloonConfig: { // Configuration options for the balloon content: 'Balloon Text', // text to display in the balloon show: true // true to display the balloon on load }, anchorPoint: new Telogis.GeoBase.Point(0.5,0.0), map: map, location: new Telogis.GeoBase.LatLon(33.587137,-117.742878), // Where the image will be drawn });
Name | Description | |||||||||
---|---|---|---|---|---|---|---|---|---|---|
MapLayers.ImageObject(config, beforeAttach) | Arguments
|
Name | Description |
---|---|
destroy () | Frees resources used by the MapLayers.ImageObject. JavaScript // Render an image on the map ('map') at a specified location var myImageObject = new Telogis.GeoBase.MapLayers.ImageObject({ scalable: true, src: 'images/pin-red.png', anchorPoint: new Telogis.GeoBase.Point(0.5,0.0), map: map, location: new Telogis.GeoBase.LatLon(33.587137,-117.742878), }); // Click the canvas to destroy the ImageObject document.onclick = myTestFunction; function myTestFunction() { myImageObject.destroy(); }; |
getImage () | Finds the URI of the image used as the icon to represent the object. JavaScript // Render an image on the map ('map') at a specified location var myImageObject = new Telogis.GeoBase.MapLayers.ImageObject({ scalable: true, src: 'http://localhost/GeoStream/scripts/images/pin-red.png', anchorPoint: new Telogis.GeoBase.Point(0.5,0.0), map: map, location: new Telogis.GeoBase.LatLon(33.587137,-117.742878), }); // Get the URI of the object image alert('URI of the image file used for this object is '+myImageObject.getImage()); // 'URI of the image file used for this object is http://localhost/GeoStream/scripts/images/pin-red.png' String - The image source. |
preloadImages (Array sources, Function callback) | Preloads the images from a list of sources so that MapLayers.ImageObjects constructed using them will be guaranteed to initialize in a synchronous manner, rather than waiting for the image to load. This is particularly useful when displaying many markers with the same icon. Arguments
|
setAnchorPoint (Point anchorPoint) | Changes the point on the object that should align with its designated map location. In addition to performing the MapLayers.AbstractObject alignment adjustments, this realigns the object's background image if it is not scalable. JavaScript // Render an image on the map ('map') at a specified location var myImageObject = new Telogis.GeoBase.MapLayers.ImageObject({ scalable: true, src: 'http://localhost/GeoStream/scripts/images/pin-red.png', anchorPoint: new Telogis.GeoBase.Point(0.5,0.0), map: map, location: new Telogis.GeoBase.LatLon(33.587137,-117.742878), }); // Click the canvas to change the anchor point of the ImageObject document.onclick = myTestFunction; function myTestFunction() { // Move the anchor point up and to the left myImageObject.setAnchorPoint(new Telogis.GeoBase.Point(1.5,1.0)); };
|
setImage (String src) | Changes the image displayed as the pushpin. If no other size has been specified, the natural dimensions of the image are calculated and used as the dimensions for the marker. JavaScript // Render an image on the map ('map') at a specified location var myImageObject = new Telogis.GeoBase.MapLayers.ImageObject({ scalable: true, src: 'http://localhost/GeoStream/scripts/images/pin-red.png', anchorPoint: new Telogis.GeoBase.Point(0.5,0.0), map: map, location: new Telogis.GeoBase.LatLon(33.587137,-117.742878), }); // Click the canvas to change the image used for the ImageObject document.onclick = myTestFunction; function myTestFunction() { // Change from a red icon to a green icon myImageObject.setImage('http://localhost/GeoStream/scripts/images/pin-green.png'); };
|