[Users] GeoExt2 Sublayer Example?
Dave Kliphon
davek at SCA-CORP.COM
Thu Feb 21 00:44:40 CET 2013
Francecso,
I greatly appreciate your help and the LayerFolderNode code.
I certainly could be wrong, but it seems that is still be a need for a LayerFolderLoader class, similar to the LayerParamLoader in v 1.1. I am trying to code an equivalent class, but please let me know if there is a simpler way to load/add/create the folder nodes from the group layer.
Thank you again,
Dave
From: Francesco D'Alesio [mailto:francesco.dalesio at r3-gis.com]
Sent: Wednesday, February 20, 2013 7:18 AM
To: Dave Kliphon
Cc: users at geoext.org
Subject: RE: RE: [Users] GeoExt2 Sublayer Example?
Hello Dave,
I'm sorry, I misunderstood your initial question.
I'm dealing with a layers container, so I built a plugin for a layergroup node that holds OpenLayers.Layer instances.
I'm not using the "layers" param of OpenLayers.Layer as in LayerParamLoader
However, here's the code
/**
* The LayerFolder plugin. This is used to create a node that holds multiple layers, keeping checkboxes syncd
* {plugins: ['gx_layerfolder'], ...}
*
*/
Ext.define('GeoExt.tree.LayerFolderNode', {
extend: 'Ext.AbstractPlugin',
alias: 'plugin.gx_layerfolder',
init: function(target) {
var me = this,
checked = true,
layer;
target.eachChild(function(node) {
layer = node.get('layer');
if(!layer.getVisibility()) checked = false;
layer.events.on({
'visibilitychanged' : me.onChildLayerVisibilityChanged,
scope: me
});
});
target.set('checked', checked);
target.on('afteredit', function(node, modifiedFields) {
if(~Ext.Array.indexOf(modifiedFields, 'checked')) {
me.onCheckChange();
}
});
me.target = target;
},
/**
* @private
* Updates the visibility of the child layers
* node.
*/
onCheckChange: function() {
var node = this.target,
checked = this.target.get('checked');
if(!node._visibilityChanging) return;
node._visibilityChanging = true;
node.eachChild(function(node) {
node.get('layer').setVisibility(checked);
});
delete node._visibilityChanging;
},
/**
* @private
* Updates the visibility this node, when children visibility changes
*
*/
onChildLayerVisibilityChanged: function() {
var node = this.target;
if(!node._visibilityChanging) return;
var checked = true;
node.eachChild(function(childNode) {
if(!childNode.get('layer').getVisibility()) checked = false;
});
node._visibilityChanging = true;
node.set('checked', checked);
delete node._visibilityChanging;
}
});
Francesco
-------Dave Kliphon <davek at SCA-CORP.COM> wrote--------
Subject: RE: [Users] GeoExt2 Sublayer Example?
Date: 19.02.2013 21:39
Francesco,
It seems that we would need to develop both layer node group and group loader classes, similar to the LayerParamNode and LayerParamLoader scripts in v1.1. Pass along any code examples if you have them, otherwise we will follow your lead in developing this custom sub-layer capability.
Do you or does anyone know if the sub-layer feature will ultimately be revived in GeoExt2, and is there a GeoExt2 release date?
Thanks for your help,
Dave
From: Francesco D'Alesio [mailto:francesco.dalesio at r3-gis.com]
Sent: Tuesday, February 19, 2013 2:00 AM
To: Dave Kliphon
Cc: users at geoext.org
Subject: Re: [Users] GeoExt2 Sublayer Example?
Hello Dave,
I've defined a layegroup plugin, similar to GeoExt.tree.LayerNode , that simply get "checked" from children and pass the "check change" event to children.
Francesco
Il 18/02/2013 22:59, Dave Kliphon ha scritto:
Does anyone have an example of sublayer creation in GeoExt2? It appears that examples/tree/tree.js is incomplete in this respect (the Tasmanian Group Layer is a single tier, unlike in 1.1).
If there are no examples, is there a timeframe for release, or advice on developing a temporary solution?
Thanks!
Dave
_______________________________________________
Users mailing list
Users at geoext.org
http://www.geoext.org/cgi-bin/mailman/listinfo/users
--
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.geoext.org/pipermail/users/attachments/20130220/ee03b3ae/attachment-0001.htm
More information about the Users
mailing list