Virginie,

FWIW:
I've taken a similar approach to Aaron, but with one caveat:
context.removeLayer did not appear to work for me when I wanted to
remove GridCoverage layers (for normal layers it works fine).  In that
case of removing GridCoverage layers, the best I could come up with was
to trash the entire context and rebuild.

HTH,

Peter


Parks, Aaron B. wrote:

Virginie:

I've done quite a bit of layer inter-changing and I have never managed to get any of the removeAll() functions to work. I ended up creating a hash-map to store my layers, then looking them up either individually and taking the from the context, or just using this function to remove them all (layers is a java.util.HashMap): if(layers!=null){
   Collection colVal=layers.values();
   Iterator itVal=colVal.iterator();
   while(itVal.hasNext()){
//remove one layer at a time context.removeLayer((MapLayer)itVal.next());

} //clean out the Hashmap for the new layers
   layers.clear();
  }
AP

    -----Original Message-----
    *From:* [EMAIL PROTECTED]
    [mailto:[EMAIL PROTECTED] *On Behalf
    Of *Virginie BERRE
    *Sent:* Friday, September 16, 2005 4:43 AM
    *To:* Peter Balland; Virginie BERRE;
    [email protected]
    *Subject:* RE: [Geotools-gt2-users] How to remove the zoom default
    behavior of a StyledMapPane

    Hi Peter!

    I've made a class that extends StyledMapPane and I have overridden
    the method protected void mouseSelectionPerformed(final Shape
    area). When I click or draw a rectangle on the map (zoom in), I
    would like to remove all the layers and add new layers (created
    with the new bounding box). I manage to calculate the new
    coordinates but don't manage to remove the layers. I use
    separately the methods removeAll() or
    getRenderer().removeAllLayers() but it doesn't work.

    Could you help me to remove the old layers and to add new ones?

    Thanks!

    Virginie

    -----Message d'origine-----
    De : Peter Balland [mailto:[EMAIL PROTECTED]
    Envoyé : jeudi 15 septembre 2005 19:34
    À : Virginie BERRE; [email protected]
    Objet : Re: [Geotools-gt2-users] How to remove the zoom default
    behavior of a StyledMapPane

    If you make a new class that extends StyledMapPane, you can
    override the
    method:
    protected abstract void selectionPerformed(int ox, int oy, int px,
    int py);
    I think that should accomplish what you want.

    As a side note to any developers that may be listening, I would
    love it
    if the selectionPerformed method could also provide the original
    mouse
    event (e.g. protected abstract void selectionPerformed(MouseEvent
    oEvent, int ox, int oy, int px, int py)). I would extend
    MouseSelectionTracker myself, but it is not declared public.

    Peter

    Virginie BERRE wrote:

Hi All !

The data displayed in my StyledMapPane result from a WMS request. I
would like to remove the default behaviour of the zoom by making
    a new
request with the new bounding box etc.

I have added a zoomChangeListener, the code written in the
    zoomChanged
method doesn't work: mapPane.getRenderer().removeAllLayers();

and then I add new layers to the mapPane.

Someone could help me ?!

Thanks!

** Virginie Berre / Ingénieur étude et développement **

Générale d'Infographie

ZA Les Erables - Bâtiment 4

66, route de Sartrouville - F-78230 - LE PECQ

Tél : (33) (0)1.30.15.40.50 - Fax : (33) (0)1.30.15.40.60

mailto:[EMAIL PROTECTED]

http://www.generale-infographie.fr/






-------------------------------------------------------
SF.Net email is sponsored by:
Tame your development challenges with Apache's Geronimo App Server.
Download it for free - -and be entered to win a 42" plasma tv or your very
own Sony(tm)PSP.  Click here to play: http://sourceforge.net/geronimo.php
_______________________________________________
Geotools-gt2-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to