Changeset 7963
- Timestamp:
- 09/05/08 07:43:13 (3 months ago)
- Files:
-
- sandbox/camptocamp/unhcr/doc/authors.txt (modified) (1 diff)
- sandbox/camptocamp/unhcr/examples/behavior-fixed-http-gml.html (modified) (1 diff)
- sandbox/camptocamp/unhcr/examples/mapguide.html (modified) (3 diffs)
- sandbox/camptocamp/unhcr/examples/pan-zoom-panels.html (copied) (copied from trunk/openlayers/examples/pan-zoom-panels.html)
- sandbox/camptocamp/unhcr/examples/wfs-t.html (modified) (1 diff)
- sandbox/camptocamp/unhcr/lib/OpenLayers.js (modified) (2 diffs)
- sandbox/camptocamp/unhcr/lib/OpenLayers/Control/Pan.js (copied) (copied from trunk/openlayers/lib/OpenLayers/Control/Pan.js)
- sandbox/camptocamp/unhcr/lib/OpenLayers/Control/PanPanel.js (copied) (copied from trunk/openlayers/lib/OpenLayers/Control/PanPanel.js)
- sandbox/camptocamp/unhcr/lib/OpenLayers/Control/ZoomIn.js (copied) (copied from trunk/openlayers/lib/OpenLayers/Control/ZoomIn.js)
- sandbox/camptocamp/unhcr/lib/OpenLayers/Control/ZoomOut.js (copied) (copied from trunk/openlayers/lib/OpenLayers/Control/ZoomOut.js)
- sandbox/camptocamp/unhcr/lib/OpenLayers/Control/ZoomPanel.js (copied) (copied from trunk/openlayers/lib/OpenLayers/Control/ZoomPanel.js)
- sandbox/camptocamp/unhcr/lib/OpenLayers/Control/ZoomToMaxExtent.js (modified) (1 diff)
- sandbox/camptocamp/unhcr/lib/OpenLayers/Filter/Spatial.js (modified) (7 diffs)
- sandbox/camptocamp/unhcr/lib/OpenLayers/Format/Filter/v1.js (modified) (1 diff)
- sandbox/camptocamp/unhcr/lib/OpenLayers/Format/GML.js (modified) (3 diffs)
- sandbox/camptocamp/unhcr/lib/OpenLayers/Lang/en.js (modified) (1 diff)
- sandbox/camptocamp/unhcr/lib/OpenLayers/Layer/FixedZoomLevels.js (modified) (1 diff)
- sandbox/camptocamp/unhcr/lib/OpenLayers/Layer/KaMapCache.js (copied) (copied from trunk/openlayers/lib/OpenLayers/Layer/KaMapCache.js)
- sandbox/camptocamp/unhcr/lib/OpenLayers/Layer/MapGuide.js (modified) (7 diffs)
- sandbox/camptocamp/unhcr/lib/OpenLayers/Layer/Vector.js (modified) (12 diffs)
- sandbox/camptocamp/unhcr/lib/OpenLayers/Layer/VirtualEarth.js (modified) (1 diff)
- sandbox/camptocamp/unhcr/lib/OpenLayers/Protocol/HTTP.js (modified) (5 diffs)
- sandbox/camptocamp/unhcr/lib/OpenLayers/Renderer.js (modified) (3 diffs)
- sandbox/camptocamp/unhcr/lib/OpenLayers/Renderer/Elements.js (modified) (18 diffs)
- sandbox/camptocamp/unhcr/lib/OpenLayers/Renderer/SVG.js (modified) (18 diffs)
- sandbox/camptocamp/unhcr/lib/OpenLayers/Renderer/VML.js (modified) (16 diffs)
- sandbox/camptocamp/unhcr/lib/OpenLayers/Util.js (modified) (1 diff)
- sandbox/camptocamp/unhcr/tests/Filter/Spatial.html (modified) (3 diffs)
- sandbox/camptocamp/unhcr/tests/Format/GML.html (modified) (2 diffs)
- sandbox/camptocamp/unhcr/tests/Layer/Vector.html (modified) (4 diffs)
- sandbox/camptocamp/unhcr/tests/Renderer.html (modified) (1 diff)
- sandbox/camptocamp/unhcr/tests/Renderer/Elements.html (modified) (5 diffs)
- sandbox/camptocamp/unhcr/tests/Renderer/SVG.html (modified) (9 diffs)
- sandbox/camptocamp/unhcr/tests/Util.html (modified) (2 diffs)
- sandbox/camptocamp/unhcr/tests/manual/clip-features-svg.html (copied) (copied from trunk/openlayers/tests/manual/clip-features-svg.html)
- sandbox/camptocamp/unhcr/tests/manual/pan-redraw-svg.html (copied) (copied from trunk/openlayers/tests/manual/pan-redraw-svg.html)
- sandbox/camptocamp/unhcr/tests/manual/vector-features-performance.html (modified) (3 diffs)
- sandbox/camptocamp/unhcr/theme/default/ie6-style.css (copied) (copied from trunk/openlayers/theme/default/ie6-style.css)
- sandbox/camptocamp/unhcr/theme/default/img/pan-panel-NOALPHA.png (copied) (copied from trunk/openlayers/theme/default/img/pan-panel-NOALPHA.png)
- sandbox/camptocamp/unhcr/theme/default/img/pan-panel.png (copied) (copied from trunk/openlayers/theme/default/img/pan-panel.png)
- sandbox/camptocamp/unhcr/theme/default/img/zoom-panel-NOALPHA.png (copied) (copied from trunk/openlayers/theme/default/img/zoom-panel-NOALPHA.png)
- sandbox/camptocamp/unhcr/theme/default/img/zoom-panel.png (copied) (copied from trunk/openlayers/theme/default/img/zoom-panel.png)
- sandbox/camptocamp/unhcr/theme/default/style.css (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
sandbox/camptocamp/unhcr/doc/authors.txt
r7785 r7963 23 23 Christopher Schmidt 24 24 Cameron Shorter 25 Pedro Simonetti 25 26 Paul Spencer 26 27 Paul Smith sandbox/camptocamp/unhcr/examples/behavior-fixed-http-gml.html
r7937 r7963 31 31 </head> 32 32 <body onload="init()"> 33 <h1 id="title">Vector Behavior Example </h1>33 <h1 id="title">Vector Behavior Example (Fixed/HTTP/GML)</h1> 34 34 <p id="shortdesc"> 35 Uses a new strategy, protocol, and format combination.35 Vector layer with a Fixed strategy, HTTP protocol, and GML format. 36 36 </p> 37 37 <div id="map" class="smallmap"></div> 38 38 <div id="docs"> 39 <p>The vector layer shown uses the Fixed strategy, the HTTP protocol,40 and the GML format. </p>41 <p>The Fixed strategy is a simple strategy that fetches features once39 The vector layer shown uses the Fixed strategy, the HTTP protocol, 40 and the GML format. 41 The Fixed strategy is a simple strategy that fetches features once 42 42 and never re-requests new data. 43 <p>The HTTP protocol makes requests using HTTP verbs. It should be43 The HTTP protocol makes requests using HTTP verbs. It should be 44 44 constructed with a url that corresponds to a collection of features 45 (a resource on some server). </p>46 <p>The GML format is used to serialize features.</p>45 (a resource on some server). 46 The GML format is used to serialize features. 47 47 </div> 48 48 </body> sandbox/camptocamp/unhcr/examples/mapguide.html
r7785 r7963 22 22 23 23 var map, layer; 24 var url = "http://demo01.dmsolutions.ca/mapguide/mapagent/mapagent.fcgi ";24 var url = "http://demo01.dmsolutions.ca/mapguide/mapagent/mapagent.fcgi?USERNAME=Anonymous&"; 25 25 //you can use this URL when MapGuide OS is installed locally 26 26 //var url = "/mapguide/mapagent/mapagent.fcgi"; 27 28 //Adjust the scale assumptions for MapGuide layers 29 //Tiled layers MUST use a DPI value of 96, untiled layers can use a 30 //different DPI value which will be passed to the server as a parameter. 31 //Tiled and untiled layers must adjust the OL INCHES_PER_UNIT values 32 //for any degree-based projections. 33 var metersPerUnit = 111319.4908; //value returned from mapguide 34 var inPerUnit = OpenLayers.INCHES_PER_UNIT.m * metersPerUnit; 35 OpenLayers.INCHES_PER_UNIT["dd"] = inPerUnit; 36 OpenLayers.INCHES_PER_UNIT["degrees"] = inPerUnit; 37 OpenLayers.DOTS_PER_INCH = 96; 27 38 28 39 //tiled version 29 40 function initTiled(){ 30 41 31 OpenLayers.DOTS_PER_INCH = 96;32 42 var extent = new OpenLayers.Bounds(-3631568.75,-1293815.5,4491139.5833333321,4937122); 33 43 var tempScales = [50000000,23207944.16806,10772173.45016,5000000,2320794.41681,1077217.34502,500000,232079.44168,107721.7345,50000]; … … 56 66 function initUntiled() { 57 67 58 OpenLayers.DOTS_PER_INCH = 96;59 68 var extent = new OpenLayers.Bounds(-87.865114442365922,43.665065564837931,-87.595394059497067,43.823852564430069); 60 69 var mapOptions = { … … 98 107 mapName: 'Sheboygan', 99 108 session: '0b8cb80e-0000-1000-8003-0017a4e6ff5d_en_C0A802AD0AFC0AFB0AFA', 109 110 111 112 mapName: 'Sheboygan', 113 session: '0b8cb80e-0000-1000-8003-0017a4e6ff5d_en_C0A802AD0AFC0AFB0AFA', 114 version: '2.0.0', 115 selectioncolor: '0xFF0000', 116 behavior: 7 100 117 }; 101 118 layer = new OpenLayers.Layer.MapGuide( "MapGuide OS Overlay layer", url, params, options ); sandbox/camptocamp/unhcr/examples/wfs-t.html
r7241 r7963 17 17 ); 18 18 19 // 20 // Word to the Wise from an anonymous OpenLayers hacker: 21 // 22 // The typename in the options list when adding/loading a wfs 23 // layer not should contain the namespace before, (as in the 24 // first typename parameter to the wfs consctructor). 25 // 26 // Specifically, in the first parameter you write typename: 27 // 'topp:myLayerName', and in the following option list 28 // typeName: 'myLayerName'. 29 // 30 // If you have topp included in the second one you will get 31 // namespace 14 errors when trying to insert features. 32 // 19 33 wfs = new OpenLayers.Layer.WFS( 20 34 "Cities", sandbox/camptocamp/unhcr/lib/OpenLayers.js
r7962 r7963 112 112 "OpenLayers/Layer/MapServer/Untiled.js", 113 113 "OpenLayers/Layer/KaMap.js", 114 "OpenLayers/Layer/KaMapCache.js", 114 115 "OpenLayers/Layer/MultiMap.js", 115 116 "OpenLayers/Layer/Markers.js", … … 227 228 "OpenLayers/Control/MouseToolbar.js", 228 229 "OpenLayers/Control/NavToolbar.js", 230 "OpenLayers/Control/PanPanel.js", 231 "OpenLayers/Control/Pan.js", 232 "OpenLayers/Control/ZoomIn.js", 233 "OpenLayers/Control/ZoomOut.js", 234 "OpenLayers/Control/ZoomPanel.js", 229 235 "OpenLayers/Control/EditingToolbar.js", 230 236 "OpenLayers/Lang.js", sandbox/camptocamp/unhcr/lib/OpenLayers/Control/ZoomToMaxExtent.js
r5614 r7963 16 16 */ 17 17 OpenLayers.Control.ZoomToMaxExtent = OpenLayers.Class(OpenLayers.Control, { 18 18 19 /** 19 20 * Property: type 20 * TYPE_BUTTON. 21 * {String} The type of <OpenLayers.Control> -- When added to a 22 * <Control.Panel>, 'type' is used by the panel to determine how to 23 * handle our events. 21 24 */ 22 25 type: OpenLayers.Control.TYPE_BUTTON, sandbox/camptocamp/unhcr/lib/OpenLayers/Filter/Spatial.js
r7945 r7963 19 19 /** 20 20 * APIProperty: type 21 * {String} type: type of spatial filter. This is one of 22 * - OpenLayers.Filter.Spatial.BBOX = "BBOX"; 23 * - OpenLayers.Filter.Spatial.INTERSECTS = "INTERSECTS"; 24 * - OpenLayers.Filter.Spatial.DWITHIN = "DWITHIN"; 21 * {String} Type of spatial filter. 22 * 23 * The type should be one of: 24 * - OpenLayers.Filter.Spatial.BBOX 25 * - OpenLayers.Filter.Spatial.INTERSECTS 26 * - OpenLayers.Filter.Spatial.DWITHIN 25 27 */ 26 28 type: null, … … 28 30 /** 29 31 * APIProperty: property 30 * {String} 31 * name of the context property to compare 32 * {String} Name of the context property to compare. 32 33 */ 33 34 property: null, … … 35 36 /** 36 37 * APIProperty: value 37 * {<OpenLayers.Bounds>} 38 * The bounds to pass into the spatial filter 38 * {<OpenLayers.Bounds> || <OpenLayers.Geometry>} The bounds or geometry 39 * to be used by the filter. Use bounds for BBOX filters and geometry 40 * for INTERSECTS or DWITHIN filters. 39 41 */ 40 42 value: null, 41 43 42 /** b44 /** 43 45 * APIProperty: distance 44 * {Number} 45 * The distance to use in a DWithin spatial filter 46 * {Number} The distance to use in a DWithin spatial filter. 46 47 */ 47 48 distance: null, … … 49 50 /** 50 51 * APIProperty: distanceUnits 51 * {String} 52 * The units to use for the distance, e.g. m 52 * {String} The units to use for the distance, e.g. 'm'. 53 53 */ 54 54 distanceUnits: null, 55 56 55 57 56 /** … … 61 60 * Parameters: 62 61 * options - {Object} An optional object with properties to set on the 63 * filter62 * filter. 64 63 * 65 64 * Returns: … … 78 77 * 79 78 * Returns: 80 * {Boolean} false if the feature is filtered out, true otherwise.79 * {Boolean} The feature meets filter criteria. 81 80 */ 82 evaluate: function(feature) {81 evaluate: function(feature) { 83 82 var intersect = false; 84 83 switch(this.type) { … … 106 105 }); 107 106 108 109 OpenLayers.Filter.Spatial.BBOX = "BBOX"; 110 OpenLayers.Filter.Spatial.INTERSECTS = "INTERSECTS"; 111 OpenLayers.Filter.Spatial.DWITHIN = "DWITHIN"; 107 OpenLayers.Filter.Spatial.BBOX = "BBOX"; 108 OpenLayers.Filter.Spatial.INTERSECTS = "INTERSECTS"; 109 OpenLayers.Filter.Spatial.DWITHIN = "DWITHIN"; sandbox/camptocamp/unhcr/lib/OpenLayers/Format/Filter/v1.js
r7785 r7963 385 385 return node; 386 386 }, 387 "INTERSECTS": function(filter) {388 var node = this.createElementNSPlus("ogc:Intersects");389 this.writeNode(node, "PropertyName", filter);390 var gml = new OpenLayers.Format.GML();391 node.appendChild(gml.buildGeometryNode(filter.value));392 return node;393 },394 "Distance": function(filter) {395 return this.createElementNSPlus("ogc:Distance",396 {attributes: {units: filter.distanceUnits},397 value: filter.distance});398 }387 "INTERSECTS": function(filter) { 388 var node = this.createElementNSPlus("ogc:Intersects"); 389 this.writeNode(node, "PropertyName", filter); 390 var gml = new OpenLayers.Format.GML(); 391 node.appendChild(gml.buildGeometryNode(filter.value)); 392 return node; 393 }, 394 "Distance": function(filter) { 395 return this.createElementNSPlus("ogc:Distance", 396 {attributes: {units: filter.distanceUnits}, 397 value: filter.distance}); 398 } 399 399 } 400 400 }, sandbox/camptocamp/unhcr/lib/OpenLayers/Format/GML.js
r7826 r7963 140 140 var order = ["MultiPolygon", "Polygon", 141 141 "MultiLineString", "LineString", 142 "MultiPoint", "Point", "Envelope","Box"];142 "MultiPoint", "Point", "Envelope", "Box"]; 143 143 var type, nodeList, geometry, parser; 144 144 for(var i=0; i<order.length; ++i) { … … 830 830 return gml; 831 831 832 },832 }, 833 833 834 834 /** … … 837 837 * 838 838 * Parameters: 839 * geometry - {<OpenLayers.Geometry.Bounds>} A bound. 840 * 839 * bounds - {<OpenLayers.Geometry.Bounds>} A bounds object. 841 840 * 842 841 * Returns: 843 842 * {DOMElement} A GML box node. 844 843 */ 845 bounds: function( geometry) {844 bounds: function(bounds) { 846 845 var gml = this.createElementNS(this.gmlns, "gml:Box"); 847 gml.appendChild(this.buildCoordinatesNode( geometry));846 gml.appendChild(this.buildCoordinatesNode(bounds)); 848 847 return gml; 849 848 } sandbox/camptocamp/unhcr/lib/OpenLayers/Lang/en.js
r7946 r7963 120 120 121 121 // console message 122 ' evaluateNotImplemented': "evaluate is not implemented for this filter type"122 'filterEvaluateNotImplemented': "evaluate is not implemented for this filter type." 123 123 }; sandbox/camptocamp/unhcr/lib/OpenLayers/Layer/FixedZoomLevels.js
r7785 r7963 91 91 } 92 92 93 // 94 // At this point, we know what the minimum desired zoom level is, and 95 // we must calculate the total number of zoom levels. 96 // 97 // Because we allow for the setting of either the 'numZoomLevels' 98 // or the 'maxZoomLevel' properties... on either the layer or the 99 // map, we have to define some rules to see which we take into 100 // account first in this calculation. 101 // 102 // The following is the precedence list for these properties: 103 // 104 // (1) numZoomLevels set on layer 105 // (2) maxZoomLevel set on layer 106 // (3) numZoomLevels set on map 107 // (4) maxZoomLevel set on map* 108 // (5) none of the above* 109 // 110 // *Note that options (4) and (5) are only possible if the user 111 // _explicitly_ sets the 'numZoomLevels' property on the map to 112 // null, since it is set by default to 16. 113 // 114 115 // 116 // Note to future: In 3.0, I think we should remove the default 117 // value of 16 for map.numZoomLevels. Rather, I think that value 118 // should be set as a default on the Layer.WMS class. If someone 119 // creates a 3rd party layer and does not specify any 'minZoomLevel', 120 // 'maxZoomLevel', or 'numZoomLevels', and has not explicitly 121 // specified any of those on the map object either.. then I think 122 // it is fair to say that s/he wants all the zoom levels available. 123 // 124 // By making map.numZoomLevels *null* by default, that will be the 125 // case. As it is, I don't feel comfortable changing that right now 126 // as it would be a glaring API change and actually would probably 127 // break many peoples' codes. 128 // 129 130 //the number of zoom levels we'd like to have. 131 var desiredZoomLevels; 132 133 //this is the maximum number of zoom levels the layer will allow, 134 // given the specified starting minimum zoom level. 93 135 var limitZoomLevels = this.MAX_ZOOM_LEVEL - this.minZoomLevel + 1; 94 if (this.numZoomLevels != null) { 95 this.numZoomLevels = Math.min(this.numZoomLevels, limitZoomLevels); 136 137 if ( ((this.options.numZoomLevels == null) && 138 (this.options.maxZoomLevel != null)) // (2) 139 || 140 ((this.numZoomLevels == null) && 141 (this.maxZoomLevel != null)) // (4) 142 ) { 143 //calculate based on specified maxZoomLevel (on layer or map) 144 desiredZoomLevels = this.maxZoomLevel - this.minZoomLevel + 1; 96 145 } else { 97 if (this.maxZoomLevel != null) { 98 var zoomDiff = this.maxZoomLevel - this.minZoomLevel + 1; 99 this.numZoomLevels = Math.min(zoomDiff, limitZoomLevels); 100 } else { 101 this.numZoomLevels = limitZoomLevels; 102 } 103 } 104 146 //calculate based on specified numZoomLevels (on layer or map) 147 // this covers cases (1) and (3) 148 desiredZoomLevels = this.numZoomLevels; 149 } 150 151 if (desiredZoomLevels != null) { 152 //Now that we know what we would *like* the number of zoom levels 153 // to be, based on layer or map options, we have to make sure that 154 // it does not conflict with the actual limit, as specified by 155 // the constants on the layer itself (and calculated into the 156 // 'limitZoomLevels' variable). 157 this.numZoomLevels = Math.min(desiredZoomLevels, limitZoomLevels); 158 } else { 159 // case (5) -- neither 'numZoomLevels' not 'maxZoomLevel' was 160 // set on either the layer or the map. So we just use the 161 // maximum limit as calculated by the layer's constants. 162 this.numZoomLevels = limitZoomLevels 163 } 164 165 //now that the 'numZoomLevels' is appropriately, safely set, 166 // we go back and re-calculate the 'maxZoomLevel'. 105 167 this.maxZoomLevel = this.minZoomLevel + this.numZoomLevels - 1; 106 168 sandbox/camptocamp/unhcr/lib/OpenLayers/Layer/MapGuide.js
r7349 r7963 29 29 * singleTile *and* isBaseLayer false is *not recommend*: it uses synchronous 30 30 * XMLHttpRequests to load tiles, and this will *lock up users browsers* 31 * during requests .31 * during requests if the server fails to respond. 32 32 **/ 33 33 singleTile: false, … … 64 64 * Create a new Mapguide layer, either tiled or untiled. 65 65 * 66 * For tiled layers, the 'groupName' and 'mapDefnition' options 67 * must be specified as options. 68 * 69 * For untiled layers, specify either combination of 'mapName' and 70 * 'session', or 'mapDefinition' and 'locale'. 66 * For tiled layers, the 'groupName' and 'mapDefinition' values 67 * must be specified as parameters in the constructor. 68 * 69 * For untiled base layers, specify either combination of 'mapName' and 70 * 'session', or 'mapDefinition' and 'locale'. 71 * 72 * For untiled overlay layers (singleTile=true and isBaseLayer=false), 73 * mapName and session are required parameters for the Layer constructor. 74 * Also NOTE: untiled overlay layers issues a synchronous AJAX request 75 * before the image request can be issued so the users browser may lock 76 * up if the MG Web tier does not respond in a timely fashion. 77 * 78 * NOTE: MapGuide OS uses a DPI value and degrees to meters conversion 79 * factor that are different than the defaults used in OpenLayers, 80 * so these must be adjusted accordingly in your application. 81 * See the MapGuide example for how to set these values for MGOS. 71 82 * 72 83 * Parameters: … … 75 86 * (e.g. http://localhost:8008/mapguide/mapagent/mapagent.fcgi) 76 87 * params - {Object} hashtable of additional parameters to use. Some 77 * parameters may require additional code on the ser er. The ones that88 * parameters may require additional code on the server. The ones that 78 89 * you may want to use are: 79 90 * - mapDefinition - {String} The MapGuide resource definition … … 117 128 this.SINGLE_TILE_PARAMS 118 129 ); 130 119 131 } else { 120 132 //initialize for tiled layers … … 197 209 //but we first need to call GETVISIBLEMAPEXTENT to set the extent 198 210 var getVisParams = {}; 211 getVisParams = OpenLayers.Util.extend(getVisParams, params); 199 212 getVisParams.operation = "GETVISIBLEMAPEXTENT"; 200 213 getVisParams.version = "1.0.0"; … … 202 215 getVisParams.mapName = this.params.mapName; 203 216 getVisParams.format = 'text/xml'; 204 getVisParams = OpenLayers.Util.extend(getVisParams, params);217 url = this.getFullRequestString( getVisParams ); 205 218 206 OpenLayers.Request.GET({ 207 url: this.url, params: getVisParams, async: false 208 }); 219 OpenLayers.Request.GET({url: url, async: false}); 209 220 } 210 221 … … 226 237 scaleindex: this.resolutions.length - this.map.zoom - 1 227 238 }); 228 }239 } 229 240 230 241 return url; sandbox/camptocamp/unhcr/lib/OpenLayers/Layer/Vector.js
r7938 r7963 110 110 */ 111 111 selectedFeatures: null, 112 113 /** 114 * Property: unrenderedFeatures 115 * {Object} hash of features, keyed by feature.id, that the renderer 116 * failed to draw 117 */ 118 unrenderedFeatures: null, 112 119 113 120 /** … … 217 224 this.features = []; 218 225 this.selectedFeatures = []; 226 this.unrenderedFeatures = {}; 219 227 220 228 // Allow for custom layer behavior … … 251 259 this.features = null; 252 260 this.selectedFeatures = null; 261 this.unrenderedFeatures = null; 253 262 if (this.renderer) { 254 263 this.renderer.destroy(); … … 378 387 moveTo: function(bounds, zoomChanged, dragging) { 379 388 OpenLayers.Layer.prototype.moveTo.apply(this, arguments); 389 390 var coordSysUnchanged = true; 380 391 381 392 if (!dragging) { … … 385 396 this.div.style.top = -parseInt(this.map.layerContainerDiv.style.top) + "px"; 386 397 var extent = this.map.getExtent(); 387 this.renderer.setExtent(extent);398 coordSysUnchanged = this.renderer.setExtent(extent, zoomChanged); 388 399 389 400 this.renderer.root.style.visibility = "visible"; … … 395 406 this.div.scrollLeft = this.div.scrollLeft; 396 407 } 408 409 if(!zoomChanged && coordSysUnchanged) { 410 var unrenderedFeatures = {}; 411 for(var i in this.unrenderedFeatures) { 412 var feature = this.unrenderedFeatures[i]; 413 if(!this.drawFeature(feature)) { 414 unrenderedFeatures[i] = feature; 415 } 416 } 417 this.unrenderedFeatures = unrenderedFeatures; 418 } 397 419 } 398 420 399 if (!this.drawn || zoomChanged) { 421 if (!this.drawn || zoomChanged || !coordSysUnchanged) { 422 this.unrenderedFeatures = {}; 400 423 this.drawn = true; 424 var feature; 401 425 for(var i=0, len=this.features.length; i<len; i++) { 402 426 if (i != (this.features.length - 1)) { … … 405 429 this.renderer.locked = false; 406 430 } 407 this.drawFeature(this.features[i]); 431 feature = this.features[i]; 432 if (!this.drawFeature(feature)) { 433 this.unrenderedFeatures[feature.id] = feature; 434 }; 408 435 } 409 436 } … … 457 484 458 485 if (this.drawn) { 459 this.drawFeature(feature); 486 if(!this.drawFeature(feature)) { 487 this.unrenderedFeatures[feature.id] = feature; 488 } 460 489 } 461 490 … … 507 536 508 537 var feature = features[i]; 538 delete this.unrenderedFeatures[feature.id]; 509 539 510 540 if (notify) { … … 558 588 if(features) { 559 589 this.removeFeatures(features, options); 560 for (var i = 0; i < features.length; i++) {590 for(var i=features.length-1; i>=0; i--) { 561 591 features[i].destroy(); 562 592 } … … 574 604 * feature - {<OpenLayers.Feature.Vector>} 575 605 * style - {Object} Symbolizer hash or {String} renderIntent 606 * 607 * Returns: 608 * {Boolean} true if the renderer was able to draw the feature, false 609 * otherwise 576 610 */ 577 611 drawFeature: function(feature, style) { … … 585 619 } 586 620 587 this.renderer.drawFeature(feature, style);621 return this.renderer.drawFeature(feature, style); 588 622 }, 589 623 sandbox/camptocamp/unhcr/lib/OpenLayers/Layer/VirtualEarth.js
r7785 r7963 53 53 0.000171661376953125, 54 54 0.0000858306884765625, 55 0.00004291534423828125 55 0.00004291534423828125, 56 0.00002145767211914062 56 57 ], 57 58 sandbox/camptocamp/unhcr/lib/OpenLayers/Protocol/HTTP.js
r7937 r7963 20 20 /** 21 21 * Property: url 22 * {String} - Service URL 22 * {String} - Service URL, read-only, set through the options 23 * passed to constructor. 23 24 */ 24 25 url: null, … … 26 27 /** 27 28 * Property: headers 28 * {Object} - HTTP request headers 29 * {Object} - HTTP request headers, read-only, set through the options 30 * passed to the constructor, 29 31 * Example: {'Content-Type': 'plain/text'} 30 32 */ … … 33 35 /** 34 36 * Property: params 35 * {Object} - Parameters of GET requests 37 * {Object} - Parameters of GET requests, read-only, set through the options 38 * passed to the constructor, 36 39 * Example: {'bbox': '5,5,5,5'} 37 40 */ … … 39 42 40 43 /** 41 * Property: format42 * {<OpenLayers.Format>} Parser for reading and writing features.43 */44 format: null,45 46 /**47 44 * Property: callback 48 * {Object} - Function to be called when 45 * {Object} - Function to be called when the <read>, <create>, 46 * <update>, <delete> or <commit> operation completes, read-only, 47 * set through the options passed to the constructor. 49 48 */ 50 49 callback: null, … … 52 51 /** 53 52 * Property: scope 54 * {Object} - Callback execution scope. 53 * {Object} - Callback execution scope, read-only, set through the 54 * options passed to the constructor. 55 55 */ 56 56 scope: null, 57 57 58 /**59 * Property: options60 * {Object} - Optional properties to be set on the protocol.61 */62 options: null,63 64 58 /** 65 59 * Constructor: OpenLayers.Protocol.HTTP sandbox/camptocamp/unhcr/lib/OpenLayers/Renderer.js
r7875 r7963 104 104 * cache (this.resolution) -- this way it will be re-computed when 105 105 * next it is needed. 106 * 107 * Parameters: 108 * extent - {<OpenLayers.Bounds>} 109 */ 110 setExtent: function(extent) { 106 * We nullify the resolution cache (this.resolution) if resolutionChanged 107 * is set to true - this way it will be re-computed on the next 108 * getResolution() request. 109 * 110 * Parameters: 111 * extent - {<OpenLayers.Bounds>} 112 * resolutionChanged - {Boolean} 113 */ 114 setExtent: function(extent, resolutionChanged) { 111 115 this.extent = extent.clone(); 112 this.resolution = null; 116 if (resolutionChanged) { 117 this.resolution = null; 118 } 113 119 }, 114 120 … … 149 155 * Parameters: 150 156 * feature - {<OpenLayers.Feature.Vector>} 151 * style - {<Object>} 157 * style - {<Object>} 158 * 159 * Returns: 160 * {Boolean} true if the feature has been drawn completely, false if not, 161 * undefined if the feature had no geometry 152 162 */ 153 163 drawFeature: function(feature, style) { … … 156 166 } 157 167 if (feature.geometry) { 158 this.drawGeometry(feature.geometry, style, feature.id); 168 var bounds = feature.geometry.getBounds(); 169 if(bounds) { 170 if (!bounds.intersectsBounds(this.extent)) { 171 style = {display: "none"}; 172 } 173 return this.drawGeometry(feature.geometry, style, feature.id); 174 } 159 175 } 160 176 }, sandbox/camptocamp/unhcr/lib/OpenLayers/Renderer/Elements.js
r7920 r7963 451 451 * style - {Object} 452 452 * featureId - {String} 453 * 454 * Returns: 455 * {Boolean} true if the geometry has been drawn completely; null if 456 * incomplete; false otherwise 453 457 */ 454 458 drawGeometry: function(geometry, style, featureId) { 455 459 var className = geometry.CLASS_NAME; 460 var rendered = true; 456 461 if ((className == "OpenLayers.Geometry.Collection") || 457 462 (className == "OpenLayers.Geometry.MultiPoint") || … … 459 464 (className == "OpenLayers.Geometry.MultiPolygon")) { 460 465 for (var i = 0, len=geometry.components.length; i<len; i++) { 461 this.drawGeometry(geometry.components[i], style, featureId); 466 rendered = rendered && this.drawGeometry( 467 geometry.components[i], style, featureId); 462 468 } 463 return ;469 return rendered; 464 470 }; 465 471 472 rendered = false; 466 473 if (style.display != "none") { 467 474 if (style.backgroundGraphic) { 468 this.redrawBackgroundNode(geometry.id, geometry, style, featureId); 475 this.redrawBackgroundNode(geometry.id, geometry, style, 476 featureId); 469 477 } 470 this.redrawNode(geometry.id, geometry, style, featureId); 471 } else { 472 var node = OpenLayers.Util.getElement(geometry.id); 478 rendered = this.redrawNode(geometry.id, geometry, style, 479 featureId); 480 } 481 if (rendered == false) { 482 var node = document.getElementById(geometry.id); 473 483 if (node) { 474 484 if (node._style.backgroundGraphic) { … … 479 489 } 480 490 } 491 return rendered; 481 492 }, 482 493 …
