[Commits] r200 - sandbox/opengeo/drake/trunk/apps/drake
commits at geoext.org
commits at geoext.org
Wed Feb 18 22:51:20 CET 2009
Author: tcoulter
Date: 2009-02-18 22:51:20 +0100 (Wed, 18 Feb 2009)
New Revision: 200
Added:
sandbox/opengeo/drake/trunk/apps/drake/MaxFeaturesWarning.js
Modified:
sandbox/opengeo/drake/trunk/apps/drake/index.html
Log:
Adding maxFeatures and the MaxFeaturesWarning message. Note that there's a bug in the GeoExt.tree.TreeNode (local to Drake) class where activatelayer gets called twice. I'll soon be writing this up.
Added: sandbox/opengeo/drake/trunk/apps/drake/MaxFeaturesWarning.js
===================================================================
--- sandbox/opengeo/drake/trunk/apps/drake/MaxFeaturesWarning.js (rev 0)
+++ sandbox/opengeo/drake/trunk/apps/drake/MaxFeaturesWarning.js 2009-02-18 21:51:20 UTC (rev 200)
@@ -0,0 +1,25 @@
+GeoExt.drake.MaxFeaturesWarning = Ext.extend(Ext.Window, {
+
+ // Must be set on initialization.
+ maxFeatures: null,
+
+ autoHeight: true,
+ width: 350,
+
+ bodyStyle: "padding: 5px; background-color: #FFFFFF;",
+
+ title: "Warning: Maximum Features Encountered",
+
+ initComponent: function() {
+ this.html = "You have encountered the maximum allowed features for the active layer (" + this.maxFeatures + " allowed). If I was a nicer application, I'd tell you something fluffier and more caring, about how you need to refine your search to overcome some technical nonsense. But I'm not. So deal with it.";
+ this.buttons = [
+ new Ext.Button({
+ text: "I'll deal.",
+ handler: function() {
+ this.close();
+ },
+ scope: this
+ })
+ ];
+ }
+});
\ No newline at end of file
Modified: sandbox/opengeo/drake/trunk/apps/drake/index.html
===================================================================
--- sandbox/opengeo/drake/trunk/apps/drake/index.html 2009-02-18 21:48:18 UTC (rev 199)
+++ sandbox/opengeo/drake/trunk/apps/drake/index.html 2009-02-18 21:51:20 UTC (rev 200)
@@ -20,6 +20,7 @@
<script type="text/javascript" src="./CustomFilterBuilder.js"></script>
<script type="text/javascript" src="./LayerTree.js"></script>
<script type="text/javascript" src="./LayerNodeUI.js"></script>
+ <script type="text/javascript" src="./MaxFeaturesWarning.js"></script>
<script>
@@ -164,7 +165,8 @@
featureNS: ns,
featurePrefix: prefix,
srsName: "EPSG:4326",
- version: "1.1.0"
+ version: "1.1.0",
+ maxFeatures: this.maxFeatures
});
return new GeoExt.data.ProtocolProxy({protocol: proto});
@@ -177,6 +179,16 @@
remoteSort: true,
reader: new Ext.data.JsonReader({}, [])
});
+
+ this.featureStore.on("load", function() {
+ if (this.featureStore.getTotalCount() >= this.maxFeatures) {
+ var maxFeaturesWarning = new GeoExt.drake.MaxFeaturesWarning({
+ maxFeatures: this.maxFeatures
+ });
+
+ maxFeaturesWarning.show();
+ }
+ }, this);
},
initWMSStore: function() {
@@ -210,6 +222,7 @@
this.featureStore.proxy.setOGCFilter(null);
this.filterBuilder.un("change", this.updateQueryFilter, this);
}
+ console.log("Use Filter handler");
this.reloadFeatureStore();
},
scope: this
@@ -535,6 +548,7 @@
},
activateLayer: function(layer) {
+ console.log("activateLayer");
this.filterBuilder.attributes = new GeoExt.data.AttributesStore({
url: this.getWFSLayerURL(layer.name),
ignore: {name: "the_geom"}
@@ -573,16 +587,23 @@
this.grid.setTitle(typename + " - " + namespace);
this.grid.colModel.setConfig(columnize(this.fields));
+ console.log("finishActivating");
this.reloadFeatureStore();
},
updateQueryFilter: function(builder){
this.featureStore.proxy.setOGCFilter(builder.getFilter());
+ console.log("updateQueryFilter");
this.reloadFeatureStore();
},
reloadFeatureStore: function() {
- this.featureStore.load({params: {start: 0, limit: this.featuresPerPage}});
+ this.featureStore.load({
+ params: {
+ start: 0,
+ limit: this.featuresPerPage
+ }
+ });
}
};
More information about the Commits
mailing list