[Users] Measure Length and Area UX Tools Give Error
IT Intern
itintern12 at gmail.com
Wed Dec 22 17:49:50 CET 2010
Good news Eric!
I got it working!!! And you led me to the right direction, so you were
indeed very helpful :)
I did what you said with FireBug and the minimal example, didn't understand
a thing that was going on in FireBug, but it stood out in my mind that some
kind of weird filtering was going on for my containers.
After a little while it dawned on me, I had applied a filter to my layer
container for a dynamic node that gets created in my map. This filter was
also being applied to the OpenLayers.Handler.Path and
OpenLayers.Handler.Polygon dynamic layers.
so I went from this:
function childContainer(text, layerStore, parent, iconCls){
parent.appendChild(new GeoExt.tree.OverlayLayerContainer({
text: text,
layerStore: layerStore,
expanded: true,
iconCls: iconCls, //If not specified, defaults to original
image
loader:{
filter: function(record) {
//return record.get("layer").name.indexOf("Tasmania")
!== -1
* return record.get("layer").name.indexOf("Photos") ==
-1;*
}
}
}));
}//end childContainer
to this:
function childContainer(text, layerStore, parent, iconCls){
parent.appendChild(new GeoExt.tree.OverlayLayerContainer({
text: text,
layerStore: layerStore,
expanded: true,
iconCls: iconCls, //If not specified, defaults to original
image
loader:{
filter: function(record) {
//return record.get("layer").name.indexOf("Tasmania")
!== -1
* return record.get("layer").name.indexOf("Photos") == -1
&& record.get("layer").name.indexOf("OpenLayers.Handler.Polygon") == -1 &&
record.get("layer").name.indexOf("OpenLayers.Handler.Path") == -1;*
}
}
}));
}//end childContainer
And everything is working perfectly! Thank you so much for this, I was
stuck on it quite awhile and could not find this problem Googling.
Happy Coding,
elshae
On Wed, Dec 22, 2010 at 12:41 AM, Eric Lemoine
<eric.lemoine at camptocamp.com>wrote:
> On Tuesday, December 21, 2010, IT Intern <itintern12 at gmail.com> wrote:
> > Thanks for the response Eric! Here is the code for my tree as you have
> requested :)
> >
> > layerRoot = new Ext.tree.TreeNode({
> > text: "All Layers",
> > expanded: true
> > });
> >
> > layerRoot.appendChild(new GeoExt.tree.BaseLayerContainer({
> > text: "Base Layers",
> > map: map,
> > layerStore: mapPanel.layers,
> > expanded: true
> > }));
> >
> > //A few other overlay containers are added similarly...
> >
> > //Tree menu for layers
> > var layerTree = new Ext.tree.TreePanel({
> > overflow: 'visible', // For the Combo popup
> > region: "west",
> > title: "Map Layers",
> > root: layerRoot,
> > loader: new Ext.tree.TreeLoader({applyLoader: false}),
> > enableDD: true,
> > collapsible: true,
> > width: 300,
> > autoScroll: true,
> > expanded: false
> > });
> >
> > //Adding tree to panel
> > var panel = new Ext.Panel({
> > //width: $(window).width(),
> > height: $(window).height() - 100,
> > //height: 700,
> > layout: "border",
> > id: 'myViewPort',
> > renderTo: document.body,
> > items: [layerTree, mapPanel]
> > //items: [layerTree, legend, mapPanel]
> > });
> >
> > "Vector layers created by Point, Path and Polygon handlers (used by the
> > Measure control) have displayInLayerSwitcher set to false, so they
> > should appear in the tree"
> >
> > If the displayInLayerSwitcher is set to false, then shouldn't it be that
> these layers should not show in my tree? :-/
>
> Right. Moreover, you're using a BaseLayerContainer, so only base
> layers with displayInLayerSwitcher set to true should appear in the
> tree.
>
> You can add a breakpoint into LayerLoader.js where the filter is
> applied (function addLayerNode) and see what's going.
>
> For further assistance here could you please come up with a small
> example (a map panel + a measure tool + a tree panel) demonstrating
> the issue.
>
> Sorry for not being more helpful here.
>
> --
> Eric Lemoine
>
> Camptocamp France SAS
> Savoie Technolac, BP 352
> 73377 Le Bourget du Lac, Cedex
>
> Tel : 00 33 4 79 44 44 96
> Mail : eric.lemoine at camptocamp.com
> http://www.camptocamp.com
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.geoext.org/pipermail/users/attachments/20101222/24873516/attachment.htm
More information about the Users
mailing list