Skip to content

Commit

Permalink
issue planetfederal#230 - add WFSSource for AddLayers (first stab)
Browse files Browse the repository at this point in the history
  • Loading branch information
justb4 committed Apr 1, 2014
1 parent 7ab722b commit 7713bd2
Show file tree
Hide file tree
Showing 3 changed files with 831 additions and 23 deletions.
11 changes: 8 additions & 3 deletions src/script/plugins/AddLayers.js
Original file line number Diff line number Diff line change
Expand Up @@ -659,7 +659,7 @@ gxp.plugins.AddLayers = Ext.extend(gxp.plugins.Tool, {
capGridPanel.getSelectionModel().selectRow(rowIndex);
var record = capGridPanel.getSelectionModel().getSelections()[0];
self.selectedSource = self.target.layerSources[record.store.sourceId];
addLayers.apply(self);
self.addLayers([record], false);
}
},
scope: this
Expand Down Expand Up @@ -770,6 +770,10 @@ gxp.plugins.AddLayers = Ext.extend(gxp.plugins.Tool, {
config.ptype = 'gxp_wmssource';
config.owsPreviewStrategies = this.owsPreviewStrategies;
break;
case 'WFS':
config.ptype = 'gxp_wfssource';
config.owsPreviewStrategies = this.owsPreviewStrategies;
break;
default:
config.ptype = 'gxp_wmscsource';
}
Expand Down Expand Up @@ -900,7 +904,7 @@ gxp.plugins.AddLayers = Ext.extend(gxp.plugins.Tool, {
addLayers: function(records, isUpload) {
var source = this.selectedSource;
var layerStore = this.target.mapPanel.layers,
extent, record, layer;
extent, record, layer, isVisible;
for (var i=0, ii=records.length; i<ii; ++i) {
// If the source is lazy, then createLayerRecord will not return
// a record, and we take the preconfigured record.
Expand All @@ -910,6 +914,7 @@ gxp.plugins.AddLayers = Ext.extend(gxp.plugins.Tool, {
}) || records[i];
if (record) {
layer = record.getLayer();
isVisible = layer.getVisibility();
if (layer.maxExtent) {
if (!extent) {
extent = record.getLayer().maxExtent.clone();
Expand All @@ -926,7 +931,7 @@ gxp.plugins.AddLayers = Ext.extend(gxp.plugins.Tool, {
}
}
}
if (extent) {
if (extent && isVisible) {
this.target.mapPanel.map.zoomToExtent(extent);
}
if (records.length === 1 && record) {
Expand Down
Loading

0 comments on commit 7713bd2

Please sign in to comment.