Add support for reprojection of vector formats when loading data. This allows
for the definition of a 'projection' option on a layer. IF this projection object exists, it will be used to create the format's internal/external projection options, making it such that any data loaded will be reprojected to the map's projection automatically. r=pagameba (Closes #1273, #1225, #1269) git-svn-id: http://svn.openlayers.org/trunk/openlayers@5828 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
@@ -53,6 +53,27 @@ OpenLayers.Layer.WFS = OpenLayers.Class(
|
||||
* sent, this should be a subclass of OpenLayers.Feature
|
||||
*/
|
||||
featureClass: null,
|
||||
|
||||
/**
|
||||
* APIProperty: format
|
||||
* {<OpenLayers.Format>} The format you want the data to be parsed with.
|
||||
* Must be passed in the constructor. Should be a class, not an instance.
|
||||
*/
|
||||
format: null,
|
||||
|
||||
/**
|
||||
* Property: formatObject
|
||||
* {<OpenLayers.Format>} Internally created/managed format object, used by
|
||||
* the Tile to parse data.
|
||||
*/
|
||||
formatObject: null,
|
||||
|
||||
/**
|
||||
* APIProperty: formatOptions
|
||||
* {Object} Hash of options which should be passed to the format when it is
|
||||
* created. Must be passed in the constructor.
|
||||
*/
|
||||
formatOptions: null,
|
||||
|
||||
/**
|
||||
* Property: vectorMode
|
||||
@@ -146,6 +167,18 @@ OpenLayers.Layer.WFS = OpenLayers.Class(
|
||||
setMap: function(map) {
|
||||
if (this.vectorMode) {
|
||||
OpenLayers.Layer.Vector.prototype.setMap.apply(this, arguments);
|
||||
|
||||
var options = {
|
||||
'extractAttributes': this.extractAttributes
|
||||
};
|
||||
|
||||
OpenLayers.Util.extend(options, this.formatOptions);
|
||||
if (this.map && !this.projection.equals(this.map.getProjectionObject())) {
|
||||
options.externalProjection = this.projection;
|
||||
options.internalProjection = this.map.getProjectionObject();
|
||||
}
|
||||
|
||||
this.formatObject = this.format ? new this.format(options) : new OpenLayers.Format.GML(options);
|
||||
} else {
|
||||
OpenLayers.Layer.Markers.prototype.setMap.apply(this, arguments);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user