Hi Gagan!

On 05/01/2012 09:30 PM, Gagan Bansal wrote:
Hi Vladimir,

You can read more detail about Tiled Feature Strategy here
http://gaganb.wordpress.com/2012/02/15/tile-feature-strategy-in-openlayers/

for any doubt, please let me know.
Is any work toward integration your changes in OpenLayers is done?

I think published version shouldn't work with recent OpenLayers out of the box, I patched Strategy_TFS.js it to get it work according to recent version of BBOX.js from OpenLayers distribution (attaching patch).

--
Vladimir Rutsky

>From 865f1ed9821048218394307a25417dc7dc61075d Mon Sep 17 00:00:00 2001
From: Vladimir Rutsky <[email protected]>
Date: Sat, 28 Apr 2012 19:54:56 +0400
Subject: fix for some boundary cases

---
 Strategy_TFS.js |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/Strategy_TFS.js b/Strategy_TFS.js
index 7b8dd4e..10e88f4 100644
--- a/Strategy_TFS.js
+++ b/Strategy_TFS.js
@@ -154,7 +154,7 @@ OpenLayers.Strategy.TFS = OpenLayers.Class(OpenLayers.Strategy, {
 		this.layer.events.triggerEvent("beforedataread");
 	//	console.log("Strategy_TFS.update");
         var mapBounds = this.getMapBounds();
-        if ( this.invalidBounds(mapBounds)) {
+        if (mapBounds !== null && this.invalidBounds(mapBounds)) {
             this.calculateBounds(mapBounds);
             this.resolution = this.layer.map.getResolution(); 
 			this.zoom = this.layer.map.getZoom();
@@ -173,8 +173,11 @@ OpenLayers.Strategy.TFS = OpenLayers.Class(OpenLayers.Strategy, {
      * {<OpenLayers.Bounds>} Map bounds in the projection of the layer.
      */
     getMapBounds: function() {
+        if (this.layer.maps === null) {
+            return null;
+        }
         var bounds = this.layer.map.getExtent();
-        if(!this.layer.projection.equals(this.layer.map.getProjectionObject())) {
+        if(bounds && !this.layer.projection.equals(this.layer.map.getProjectionObject())) {
             bounds = bounds.clone().transform(
                 this.layer.map.getProjectionObject(), this.layer.projection
             );
-- 
1.7.5.4

_______________________________________________
Dev mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/openlayers-dev

Reply via email to