Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [udig-devel] raster should permit select tool

On Monday, 24 October 2011 at 3:00 PM, andrea antonello wrote:

I agree the raster should permit selection. I would even be keen TO implement the selection export.

Can you ma ke the change or explain me were those default attributes area set?

I can think of two ways....
 
a) Quick

1. Right now the selection tool simply updates the layer.setFilter( filter ). It does so pretty blindly with no thought or processing.
2. You could make a FilterVisitor to go through that filter and extract the Geometry or ReferencedEnvelope used 
3. You could then turn that into some kind of raster clipping area thing that you could use for a) a quick histogram or b)  copy an image to the clipboard etc...

b) Clean

If you think about step 1 above the tool does two things:
- allows the user to draw a geometry (in this case a simple box)
- processes that geometry into a Filter for the layer

If we spit that functionality into two we will have a chance to save out the geometry cleanly; indeed we could place the geometry on the layer blackboard and only bother to make a Filter with it if there is a FeatureSource around.


-- code review --

1. The BBoxSelection tool has the 

  command = new BBoxSelectionCommand(bounds, BBoxSelectionCommand.NONE);

2. BBoxSelectionCommand turns around and calls ...

3. MapImpl.select 

  public void select( Envelope boundingBox ) {
        Layer selected = getEditManagerInternal().getSelectedLayer();
        LAYERS: for( Layer layer : getLayersInternal() ) {
            if (layer == selected) {
                Filter newFilter = layer.createBBoxFilter(boundingBox, null);
                if (newFilter == null)
                    continue LAYERS;
                layer.setFilter(newFilter);
            } else {
                layer.setFilter(Filter.EXCLUDE);
            }
        }
        notifyBatchNotification(ProjectPackage.LAYER__FILTER, Notification.SET);
    }

So we could either:
- updated this code to place the boundingBox on the layer blackboard; or
- provide a layer.setSelected( ReferencedEnvelope ) and layer.setSelected( Geometry ) method and make the MapImpl a bit more simple



Back to the top