[OpenLayers-Users] TileCache problem in IE6/7 when using
Map.setCenter
zsuRuby
yuanrong303 at yeah.net
Wed Dec 2 03:24:06 EST 2009
hi:
everyone,I got a problem when using Map.setCenter to changing my map's
center;
i extend Map.js as follows:
/**
* @class CNavMap
* a class to create base map for developing.
*
* @extends OpenLayers.Map
* @param{
* div - container for map images.
* option - additional configuration for map.
* }
*
* case:
* var option = {
*
* }
* var style=new CNavMap($('mapdiv'),option);
*
* @see OpenLayers.Map.js
*/
CNavMap = OpenLayers.Class(OpenLayers.Map,{
/**
* @Description
* @See OpenLayers.Layer.Vector
*/
dynamicVectorLayer:null,
/**
* @Description
* @See OpenLayers.Layer.Vector
*/
staticVectorLayer:null,
/**
*
*/
dynamicMarkerLayer:null,
/**
*
*/
staticMarkerLayer:null,
initialize: function (div, options){
var option=options;
if(!option)
option={};
OpenLayers.Util.extend(option,{
controls:[
new OpenLayers.Control.Navigation(),
new OpenLayers.Control.ArgParser(),
new OpenLayers.Control.Attribution()
]
}
);
OpenLayers.Map.prototype.initialize.apply(this ,[div,option]);
this.projection=new OpenLayers.Projection("EPSG:900913");
this.displayProjection=new OpenLayers.Projection("EPSG:4326");
this.units="m";
this.numZoomLevels=15;
this.maxResolution=19567.8792375;
this.maxExtent=new OpenLayers.Bounds(-20037508,
-20037508,20037508*2,20037508);
this.restrictedExtent=new OpenLayers.Bounds(-20037508,
-20037508,20037508*2,13358338.667);
this.addLayer(new
CNavTileCache("baseMap",TILE_PIV_URL,{isBaseLayer:true}));
this.div.oncontextmenu = function () { return false;};
if(CENTER_LONLAT){
this.zoomToLonLat(new
OpenLayers.LonLat(CENTER_LONLAT[0],CENTER_LONLAT[1]),DEFAULT_ZOOM);
}
this._initLayer();
},
_initLayer:function(){
var layer=[
this.dynamicVectorLayer=new OpenLayers.Layer.Vector("featureLayer"),
this.dynamicMarkerLayer=new CNavDynamicMarkerLayer("dynamicMarkerLayer"),
this.staticMarkerLayer=new OpenLayers.Layer.Markers("staticMarkerLayer")
]
this.addLayers(layer);
},
///////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////
/**
* method:zoomToLonLat
*
* @param {
* lonlat - {LonLat}
* zoom - {int}
* }
* @return
*/
zoomToLonLat: function(lonlat,zoom){
var p=CNavUtil._toMerc(lonlat);//"EPSG:4326"->"EPSG:900913"
this.setCenter(p,zoom,false,true);
},
CLASS_NAME:"CNavMap"
});
CNavTileCache class is a class extends OpenLayers.Layer.TileCache.js
every works fine when CNavMap initialize;it show tiles correctly;
but when i click:
<\a href="javascript:;" onclick="zoomToLonLat();">zoomToLonLat</\a>
function zoomToLonLat(){
map.zoomToLonLat(new LonLat(113.2663,23.1489),8);
}
magic happens:
it works in firefox but IE6/7 ;it seems IE8 works too;
In Ie6/7 :
tiles are not show on map;
when i use fillder2 to see the requests ,it seems the requests response 200
Ok;
when i check the DOM the tiles seem had add to the container with
displsy:none;
and the Previous Tiles also in the container too.
does anybody can see wha's happening?
--
View this message in context: http://n2.nabble.com/TileCache-problem-in-IE6-7-when-using-Map-setCenter-tp4098569p4098569.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.
More information about the Users
mailing list