1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
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];
}
});
});
|