Perhaps we could explicitly distable the action if the filter is EXCLUDE; and 
save checking the feature collection bounds until the button is clicked.
No sense being slow.

-- 
Jody Garnett

On Thursday, 19 May 2011 at 4:59 PM, Frank Gasdorf wrote: 
> Actually not. But I guess we could add this capability to the 
> net.refractions.udig.tool.select.internal.LayerHasSelectionProperty class 
> that would return true if 
> 
> layer.getFilter()!=Filter.EXCLUDE AND (psydo-code) NOT 
> layer.collection.query(Filter).isEmpty()
> 
> I'd like to check, whether the enablement is used somewhere else 
> (propertyId="net.refractions.udig.tool.select.layerHasSelectionProperty) 
> 
> see also plugin.xml in n.r.u.tool.select : 
> <extension
> point="net.refractions.udig.ui.objectProperty">
> <object targetClass="net.refractions.udig.project.ILayer">
> <property
> id="layerHasSelectionProperty"
> class="net.refractions.udig.tool.select.internal.LayerHasSelectionProperty"/>
> </object>
> </extension>
> <extension
> <actionTool
>  categoryId="net.refractions.udig.tool.category.zoom"
>  class="net.refractions.udig.tool.select.internal.ZoomSelection"
>  icon="icons/elcl16/zoom_select_co.png"
>  id="net.refractions.udig.tool.default.show.selection"
>  menuPath="navigate/zoom.ext"
>  name="%zoom.select.name"
>  onToolbar="true"
>  tooltip="%zoom.select.tooltip">
> <enablement>
> <property
>  expectedValue="unimportant"
>  propertyId="net.refractions.udig.tool.select.layerHasSelectionProperty"/>
> </enablement>
> </actionTool>
> </extension>
> 
> In result it could lead into slow applications if the filters where complex 
> and each time the selection changes the resource is filtered more than once 
> (enablement, renderer, ..) I would avoid this .. 
> 
> What about you?
> 
> Cheers, Frank
> 
> 
> 
> ---------- Forwarded message ----------
> From: jive 
> <reply+i-920697-30ed3e13674a88520dba131bb56d3e975210b...@reply.github.com>
>  Date: 2011/5/19
> Subject: Re: [udig-platform] Fix for ZoomSelection, if Query on FC returns 
> empty Collection and therefore an invalid ReferenceEnvelope (#17)
> To: [email protected]
> 
> 
> Sounds good; would your patch disable the zoom to selection tool? Do nothing? 
> place a "map bubble" feedback indicating that zoom to selection was possible?
> 
> --
> Jody Garnett
> 
> On Wednesday, 18 May 2011 at 6:29 PM, fgdrf wrote:
> > Hello developers,
> >
> > I just run into troubles with the ZoomSelection Tool which should perform a 
> > zoom to the selection of the current selected layer. It works quite perfect 
> > if the Query-Filter matches any features and therefor a ReferencedEnvelope 
> > can be calculated from the (Sub)FeatureCollection.
> >
> > To reproduce, I've done the following steps:
> >
> > create a new map and add a shapefile per drag&drop
> > use the "Select rectangle Tool
> > define a rectangle in map in empty space (the tool "Zoom to selection" was 
> > disabled and changes to enabled)
> > use the "Zoom to selection" Tool and voila : the extend of the map changes 
> > although there is no feature selected!
> > And that's because of an empty ReferencedEnvelope with smaller values for 
> > the maxX/maxY values than the min-Values [0.0 : -1.0, 0.0 : -1.0]
> >
> > Therefore I would like to apply a patch to check the min/max values and of 
> > course null bounds before perform the SetViewportBBoxCommand Task.
> >
> > Frank
> >
> > --
> > Reply to this email directly or view it on GitHub:
> > https://github.com/uDig/udig-platform/pull/17
> >
> 
> --
> Reply to this email directly or view it on GitHub:
> https://github.com/uDig/udig-platform/pull/17#issuecomment-1201136
> 
> 
_______________________________________________
User-friendly Desktop Internet GIS (uDig)
http://udig.refractions.net
http://lists.refractions.net/mailman/listinfo/udig-devel

Reply via email to