The main purpose of this widget is to act as an API for GeoPrisma. It can be used as a single point of entry for external JavaScript libraries to interact with GeoPrisma and its widgets. It is done so using methods and events, which are described in details below.
Note
Each method receives a list of arguments and delegate them to an event they trigger. Widgets that need to interact with an event need to listen to it and then react accordingly.
Here’s the list of the currently supported methods, each defining their required arguments, an example of use and the widgets using them.
This method fires the ‘applyfilters’ event.
Arguments :
(Array): | An array of hash objects containing the following keys and values :
|
---|
Example :
GeoPrisma.applyFilters([{
resource: "R_Park",
filter: new OpenLayers.Filter.Comparison({
type: OpenLayers.Filter.Comparison.LIKE,
property: "REG_CODE",
value: "24"
}),
params: {'datestart': "2011-05-01"}
}]);
Widgets :
This method fires the ‘applyfilters’ event.
Arguments :
(Object): | A hash object containing the following keys and values :
|
---|
Example :
GeoPrisma.applyFilter({
resource: "R_Park",
filter: new OpenLayers.Filter.Comparison({
type: OpenLayers.Filter.Comparison.LIKE,
property: "REG_CODE",
value: "24"
}),
params: {'datestart': "2011-05-01"}
});
Widgets :
Note
This method fires the same event as the applyFilters one. Its used to apply a single filter to a single resource using the object as the argument instead of an array.
This method returns a JavaScript object that contains the information about the map center.
Arguments :
(String): | The projection code we want to have the coordinates displayed in. Defaults to the map ‘displayProjection’ or ‘projection’ if not set. |
---|
Returns :
(Object): | A hash object containing the information about the map center. See the ‘setCenter’ method to know its list of possible keys and values. |
---|
Example :
var center = GeoPrisma.getCenter("EPSG:4326");
Note
This method doesn’t trigger any event. No external widgets takes action for this method.
This method fires the ‘setcenter’ event. Widgets listening to it will set the map current center using user parameters sent and may perform other widget-related actions.
If there are no widgets currently defined that could do so, the API widget takes care of recentering the map, but nothing more.
Arguments :
(Object): | A hash object containing the following keys and values :
|
---|
Example :
GeoPrisma.setCenter({
x: -7912983,
y: 6176194,
zoom: 10,
projection: "EPSG:900913"
});
Widgets :
The following methods are available for use internally in GeoPrisma API and is destined for development use.
Returns :
(Array) of OpenLayers.Layer objects that match the specified search options.
Arguments :
(Object): | A hash option that can have any or all of the following search criteria :
|
---|
Example :
var matchLayers = GeoPrisma.getLayers({
resourceName: "R_Park",
serviceType: "wms"
});
See in code for more documentation.
In addition to methods, you can use the API widget events to collect information specific to GeoPrisma and its components. They extend the Ext events, so listening to them is done the same way.
Some of the events of the API widgets are managed and used internally and are not meant to be used externally. They are considered private. Those that can be used to collect informations are considered public and are mentionned below.
Fired everytime the map center changes, whether by using the setCenter method, navigating the map, changing it programmatically, etc.
Callback arguments :
(Object): | A hash object containing the information about the map center. See the ‘setCenter’ method to know its list of possible keys and values. |
---|
Example :
GeoPrisma.on("centerchanged", function(values) {
// do whatever you want with the "values" object
}, this);
Fired everytime the center marker of a GeoExtux_ZoomTo widget changes, whether by using the setCenter method of the API widget, by dragging it around or when it’s removed.
Callback arguments :
(Object): | A hash object containing the information about the marker. Same as ‘setCenter’ method to know its list of possible keys and values. |
---|
Example :
GeoPrisma.on("centermarkerchanged", function(values) {
// do whatever you want with the "values" object
}, this);
N/A
read