diff options
| author | Tristan Zur <tzur@web.web.ccwn.org> | 2014-03-27 22:27:47 +0100 |
|---|---|---|
| committer | Tristan Zur <tzur@web.web.ccwn.org> | 2014-03-27 22:27:47 +0100 |
| commit | b62676ca5d3d6f6ba3f019ea3f99722e165a98d8 (patch) | |
| tree | 86722cb80f07d4569f90088eeaea2fc2f6e2ef94 /js/dojo-1.7.2/dojox/geo/openlayers/Feature.js | |
Diffstat (limited to 'js/dojo-1.7.2/dojox/geo/openlayers/Feature.js')
| -rw-r--r-- | js/dojo-1.7.2/dojox/geo/openlayers/Feature.js | 79 |
1 files changed, 79 insertions, 0 deletions
diff --git a/js/dojo-1.7.2/dojox/geo/openlayers/Feature.js b/js/dojo-1.7.2/dojox/geo/openlayers/Feature.js new file mode 100644 index 0000000..d6a37ca --- /dev/null +++ b/js/dojo-1.7.2/dojox/geo/openlayers/Feature.js @@ -0,0 +1,79 @@ +//>>built +define("dojox/geo/openlayers/Feature", ["dojo/_base/kernel", "dojo/_base/declare", "dojox/geo/openlayers/Map"], function(dojo, declare, Map){ + + return declare("dojox.geo.openlayers.Feature", null, { + // summary: + // A Feature encapsulates an item so that it can be added to a Layer. + // This class is not attended to be used as it, but serve as a base class + // for specific features such as GeometryFeature which can display georeferenced + // geometries and WidgetFeature which can display georeferenced widgets. + constructor : function(){ + // summary: + // Construct a new Feature + this._layer = null; + this._coordSys = dojox.geo.openlayers.EPSG4326; + }, + + getCoordinateSystem : function(){ + // summary: + // Returns the coordinate system in which coordinates of this feature are expressed. + // returns: OpenLayers.Projection + // The coordinate system in which coordinates of this feature are expressed. + return this._coordSys; + }, + + setCoordinateSystem : function(/* OpenLayers.Projection */cs){ + // summary: + // Set the coordinate system in which coordinates of this feature are expressed. + // cs: OpenLayers.Projection + // The coordinate system in which coordinates of this feature are expressed. + this._coordSys = cs; + }, + + getLayer : function(){ + // summary: + // Returns the Layer to which this feature belongs. + // returns: dojox.geo.openlayers.Layer + // The layer to which this feature belongs. + return this._layer; + }, + + _setLayer : function(/* dojox.geo.openlayers.Layer */l){ + // summary: + // Sets the layer to which this Feature belongs + // description: + // Called when the feature is added to the Layer. + // tags: + // private + this._layer = l; + }, + + render : function(){ + // summary: + // subclasses implements drawing specific behavior. + }, + + remove : function(){ + // summary: + // Subclasses implements specific behavior. + // Called when removed from the layer. + }, + + _getLocalXY : function(p){ + // summary: + // From projected coordinates to screen coordinates + // p: Object + // Object with x and y fields + // tags: + // private + var x = p.x; + var y = p.y; + var layer = this.getLayer(); + var resolution = layer.olLayer.map.getResolution(); + var extent = layer.olLayer.getExtent(); + var rx = (x / resolution + (-extent.left / resolution)); + var ry = ((extent.top / resolution) - y / resolution); + return [rx, ry]; + } + }); +}); |
