Skip to content

Commit

Permalink
Fixes the regression casuing all the extent issues
Browse files Browse the repository at this point in the history
  • Loading branch information
capooti committed Mar 29, 2018
1 parent 714e5d2 commit 1be90de
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 102 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,6 @@ gxp.plugins.GeoNodeSource = Ext.extend(gxp.plugins.WMSSource, {
this.url,
params, {
maxExtent: maxExtent,
restrictedExtent2: maxExtent,
restrictedExtent: maxExtent,
singleTile: ("tiled" in config) ? !config.tiled : false,
ratio: config.ratio || 1,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ gxp.plugins.ZoomToLayerExtent = Ext.extend(gxp.plugins.ZoomToExtent, {
dataExtent = layer instanceof OpenLayers.Layer.Vector &&
layer.getDataExtent();
}
return layer.restrictedExtent2 || dataExtent || layer.maxExtent || map.maxExtent;
return layer.restrictedExtent || dataExtent || layer.maxExtent || map.maxExtent;
},

/** api: method[addActions]
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -186,99 +186,6 @@
{% endif %}

authorizedRoles: "{{ user.is_authenticated|yesno:"ROLE_ADMINISTRATOR,ROLE_ANONYMOUS" }}",

listeners: {
"ready": function() {
l = app.selectedLayer.getLayer();
l.addOptions({wrapDateLine:true, displayOutsideMaxExtent: true});
if(app.selectedLayer.data.queryable) {
app.mapPanel.map.getMaxExtent = function() {
return new OpenLayers.Bounds(-80150033.36/2,-80150033.36/2,80150033.36/2,80150033.36/2);
}
app.mapPanel.map.getMaxResolution = function() {
return 626172.135625/2;
}
l.addOptions({maxExtent:app.mapPanel.map.getMaxExtent(), restrictedExtent:app.mapPanel.map.getMaxExtent()});
}
{% if 'access_token' in request.session %}
try {
if(l.url != undefined && (typeof l.url) == "string") {
l.url += ( !l.url.match(/\b\?/gi) || l.url.match(/\b\?/gi).length == 0 ? '?' : '&');
if((!l.url.match(/\baccess_token/gi))) {
l.url += "access_token={{request.session.access_token}}";
} else {
l.url =
l.url.replace(/(access_token)(.+?)(?=\&)/, "$1={{request.session.access_token}}");
}
}
} catch(err) {
console.log(err);
}
{% endif %}

for (var ll in app.mapPanel.map.layers) {
l = app.mapPanel.map.layers[ll];
if (l.url != undefined && (typeof l.url) == "string" && l.url.indexOf('{{GEOSERVER_BASE_URL}}') !== -1) {
l.addOptions({wrapDateLine:true, displayOutsideMaxExtent: true});
l.addOptions({maxExtent:app.mapPanel.map.getMaxExtent(), restrictedExtent:app.mapPanel.map.getMaxExtent()});
{% if 'access_token' in request.session %}
try {
l.url += ( !l.url.match(/\b\?/gi) || l.url.match(/\b\?/gi).length == 0 ? '?' : '&');
if((!l.url.match(/\baccess_token/gi))) {
l.url += "access_token={{request.session.access_token}}";
} else {
l.url =
l.url.replace(/(access_token)(.+?)(?=\&)/, "$1={{request.session.access_token}}");
}
} catch(err) {
console.log(err);
}
{% endif %}
}
}

var map = app.mapPanel.map;
var layer = app.map.layers.slice(-1)[0];
var bbox = layer.bbox;
var crs = layer.crs
if (bbox != undefined)
{
if (!Array.isArray(bbox) && Object.keys(layer.srs) in bbox) {
bbox = bbox[Object.keys(layer.srs)].bbox;
}

var extent = new OpenLayers.Bounds();

if(map.projection != 'EPSG:900913' && crs && crs.properties) {
extent.left = bbox[0];
extent.right = bbox[1];
extent.bottom = bbox[2];
extent.top = bbox[3];

if (crs.properties != map.projection) {
extent = extent.clone().transform(crs.properties, map.projection);
}
} else {
extent = OpenLayers.Bounds.fromArray(bbox);
}

var zoomToData = function()
{
map.zoomToExtent(extent, false);
app.mapPanel.center = map.center;
app.mapPanel.zoom = map.zoom;
map.events.unregister('changebaselayer', null, zoomToData);
};
map.events.register('changebaselayer',null, zoomToData);
if(map.baseLayer){
map.zoomToExtent(extent, false);
}
}
},
'save': function(obj_id) {
createMapThumbnail(obj_id);
}
}
}, {{ config }});

app = new GeoExplorer(config, true);
Expand Down
4 changes: 3 additions & 1 deletion geonode/contrib/worldmap/wm_extra/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -488,6 +488,7 @@ def add_layers_to_map_config(request, map_obj, layer_names, add_base_layers=True

config["srs"] = getattr(
settings, 'DEFAULT_MAP_CRS', 'EPSG:900913')

config["bbox"] = bbox if config["srs"] != 'EPSG:900913' \
else llbbox_to_mercator([float(coord) for coord in bbox])

Expand Down Expand Up @@ -534,7 +535,7 @@ def add_layers_to_map_config(request, map_obj, layer_names, add_base_layers=True
layers.append(maplayer)

if bbox is not None:
minx, miny, maxx, maxy = [float(coord) for coord in bbox]
minx, maxx, miny, maxy = [float(coord) for coord in bbox]
x = (minx + maxx) / 2
y = (miny + maxy) / 2

Expand Down Expand Up @@ -764,6 +765,7 @@ def gxp2wm(config, map_obj=None):
'restUrl': '/gs/rest', 'ptype': 'gxp_gnsource'
}

del(config['map']['layers'][0])
if config_is_string:
config = json.dumps(config)

Expand Down

0 comments on commit 1be90de

Please sign in to comment.