Telogis.GeoBase |
The encompassing namespace for the entire GeoStream v2.0 JavaScript API. This serves largely as a container for other packages targeted for a more specific role, but also contains common types and utility functions that affect the functionality of the entire library. There are two main types of entity in this library: classes and namespaces. Classes are constructor functions that should be called with the new keyword (managed classes will throw an exception if they are called without it) to create an object with all the properties specified by the class. Most GeoBase classes are managed: they can be inherited from, and undergo several small automatic validations. However, some small classes that are intended to be constructed repeatedly in performance-critical contexts (such as LatLon and Point) are unmanaged, and lack these features. Methods of a class instance should only be called as properties of that instance (or with an apply or call scope adjustment). The following usage is invalid and will generally result in an error:
var instance = new SomeClass (); var writeCallback = instance.write; ... writeCallback ('text');
and instead, the following should be written:
var instance = new SomeClass (); var writeCallback = function (text) {instance.write (text);}; ... writeCallback ('text');
Namespaces are groupings of items with a common purpose. Functions in a namespace are scope-independent, so they may be called by direct reference rather than as properties of the namespace itself (although this latter approach is more common). That is, the following is valid (though it would not be for a class instance):
var writeCallback = SomeNamespace.write; ... writeCallback ('text');
Notice that many GeoBase objects and classes contain internal properties, marked with a leading '_' character. These objects and classes should never be used directly. Such properties are made inaccessible wherever possible, but sometimes true-private variables are not viable with the use of JavaScript prototypes, in order to allow faster class instantiation.
Name | Description |
---|---|
AbstractDOMEntity | An abstract base class for constructs that are based on a DOM element, such as map layers and widgets. Primarily, this combines the features of MapLayers.AbstractLayer and Widgets.AbstractWidget to allow code re-use. Note that because of the varying treatments of top-level DOM nodes between these, creation of a base element is left to the derived class. |
Authenticator | Used to provide authentication services with GeoStream servers using only JavaScript. Necessary when providing GeoStream authentication from non .NET environments or services. |
BoundingBox | Represents a rectangular area between top-left and bottom-right corners, specified as latitude-longitude
coordinates. Potentially useful for zooming, or hit-testing a given area.
JavaScript // Create a BoundingBox in Los Angeles, Ca var BBox = new Telogis.GeoBase.BoundingBox( new Telogis.GeoBase.LatLon(33.587137,-117.742878), new Telogis.GeoBase.LatLon(33.575037,-117.724762) ); |
Canvas | A utility for managing and rendering primitive shapes to a VML (Internet Explorer v8 or less) or SVG (Webkit)
element. Shapes are managed as individual entities, as is the style of vector-graphics implementations like VML
and SVG, for performance reasons. That is, to draw on a canvas once it has been created, methods to create these
primitives should be called (e.g. Canvas.circle,
Canvas.rect), but if further manipulation of them is desired (e.g. to clear the
Canvas), references to the objects returned by these functions should be kept and
have appropriate methods called.
JavaScript // Create a Canvas instance on a parent DOM element (DIV 'main_map') var myCanvas = new Telogis.GeoBase.Canvas({ fillColor: new Telogis.GeoBase.Color(0,18,255,0.5), id: 'new_canvas', lineColor: new Telogis.GeoBase.Color(0,18,255,0.9), lineWidth: 1, parent: 'main_map', // DOM entity. In this example the DIV 'main_map' size: new Telogis.GeoBase.Size(640,480) // Not needed if already defined }); |
Color | Represents a set of color components in RGB-space, with an optional alpha-value. |
DataSet | Contains information about a data set available on the current GeoStream server. |
EventHandler | Provides a way to organize a collection of functions and call them all at once when a certain event occurs. Other EventHandlers can also be queued for execution once the calling handler has been triggered, but less flexibility is available than for functions. |
FeatureInfo | A wrapper class to contain information about a point of interest in the map data. |
GeomUtil | Contains mathematical utility functions for manipulating spatial data. |
LatLon | Represents a latitude-longitude coordinate pair, expressed in degrees (WGS84 World Geodetic System projection). |
Line | Represents a non-street line feature, such as a railway, stream or custom line data. |
POI | A description of a point of interest returned by the server, grouping additional information about it such as
name and phone number.
JavaScript // Create a BoundingBox in Los Angeles var QueryBox = new Telogis.GeoBase.BoundingBox( new Telogis.GeoBase.LatLon(33.893487,-118.252747), new Telogis.GeoBase.LatLon(33.886426,-118.234481) ); var list = ''; var myQuery = ''; // An empty string or null returns all POIs. // Also accepts partial matches to POI names (not types), for example 'Airport' or 'Museum'. // Or a full name, such as 'Acme Fish Market' or 'Tasty Cupcakes By Angelo'. // Query every POI within the BoundingBox Telogis.GeoBase.DataQuery.queryPOI(QueryBox, null, myQuery, function (result) { for (var i = 0; i < result.length; i++) { var checkFood = result[i].getFoodType(); if (checkFood == 'UNKNOWN'){ checkFood = ' Unknown (this POI does not serve food, or the food available is unknown)'; } list += '' + result[i].getName() + ' at ' + result[i].getLocation() + ' is a POI of type ' + result[i].getType() + '\n' + ' -- POI summary with phone number: ' + result[i].toString() + '\n' + ' -- POI food type: ' + checkFood + '\n' ; } alert (list); }, function (error) {alert(error)}); |
Point | Represents a 2D spatial coordinate pair. |
PointFeature | A PointFeature may be a city from a GeoBase data file, or a point feature from a custom dataset. |
Polygon | Represents a closed polygonal map feature such as a lake or national park. Not to be confused with a Geometry.Polygon, which is the physical shape of the Geometry object contained in the geometries array. |
Rectangle | A class to contain a pair of x- and y- coordinates that represent the corners of a rectangle. Analogous to the Rectangle .NET class. |
RemoteStreetLink | A wrapper class for containing data about a single street link. |
Size | Represents the 2D spatial dimensions of an object. |
Skin | An abstract base class defining functionality common to all types of more specific skin. Primarily, it will manage loading the skin's constituent images. |
Street | Represents a physical street. |
XMLDoc | A class that provides a wrapper around all of the basic required XML functionality to abstract the differences in implementations between web browsers. |
Name | Description |
---|---|
addDataSet (String dataSet) | Adds a named dataset to be used by the GeoStream server that this page obtains its map data from. If no data sets have been manually specified, the server will use its default one, which depends on its configuration. Arguments
|
addDataSets () | Adds named datasets to be used by the GeoStream server that this page obtains its map data from. If no data sets have been manually specified, the server will use its default one, which depends on its configuration. |
clearDataSets () | Clears the list of manually-specified data-sets, causing the GeoStream server to fall back upon its default one. |
destroy () | A global cleanup function that is automatically called when the page unloads. This invokes the destroy functions of the various active GeoBase subsystems, ensuring that memory cycles are broken to avoid leaks, and flushes the event cache. |
getAvailableData (Function callback, Object server) | Requests the list of available datasets for the currently authenticated user Arguments
|
getCopyright (Function callback, Object server) | Requests the copyright string that is displayed on map widgets. Arguments
|
getCultures (Function callback, Object server) | Gets the cultures offered by the server. Arguments
|
getDefaultDataSet (Function callback, Object server) | Requests the default dataset for the currently authenticated user Arguments
|
getDefaultServers () | Returns the URLs used to retrieve data from GeoStream servers. |
getGeoStreamRenderers (Function callback, Object server) | Get an Array containing all GeoStreamRenderer layers offered by the server. Arguments
|
getServerLayers (Function callback, Object server) | Get an Array containing all layers offered by the server. Arguments
|
getUnitSystems () | Gets the Telogis.GeoBase.Navigation.UnitSystem available. ReturnsArray - An array of valid Telogis.GeoBase.Navigation.UnitSystem strings. |
getWMSLayers (Function callback, Object server) | Get an Array containing all Web Map Service (WMS) layers offered by the server. Arguments
|
removeDataSet (String dataSet) | Removes a named dataset from the list that is used by the GeoStream server that this page obtains its map data from. If no data sets have been manually specified, the server will use its default one, which depends on its configuration. Arguments
|
removeDataSets (Array dataSets) | Removes a collection of named datasets from the list that is used by the GeoStream server that this page obtains its map data from. If no data sets have been manually specified, the server will use its default one, which depends on its configuration. Arguments
|
setAuthToken (String token, Number duration, boolean setCookie) | Sets the authentication token to be sent with all GeoStream requests. This should be called by the webserver when the page is loaded with an appropriately generated token. Arguments
|
setDataSet (String dataSet) | Sets the single named dataset that will be used by the GeoStream server when serving map data to this application. If no data sets have been manually specified, the server will use its default one, which depends on its configuration. Arguments
|
setDataSets (Array dataSets) | Sets the collection of named datasets that will be used by the GeoStream server when serving map data to this application. If no data sets have been manually specified, the server will use its default one, which depends on its configuration. Arguments
|
setService (Array service) | Changes the URLs used to retrieve data from GeoStream servers. By default, only 'http://localhost/geostream/' is used, but if an array is passed, multiple servers can be queried alternately. Arguments
|
Name | Type | Description |
---|---|---|
AuthExpiry | EventHandler | An event triggered when the authorization token generated with the page expires, which could potentially occur during the page's lifetime, or otherwise fails. |
AuthToken | String | Authentication token returned by the server after successful authentication. |