a number of attempts where made to get the labels to appear and not appear from 
a legend via layer setVisible(true) and setVisible(false)
the assumption is that after a window size that labels will then be changed.
unfortunately that will not work on my end

the issue is with the labelCache.clear() (which labelCache is unfortunately 
private) in JMapPane needs to be called.

The following is a solution:

before STEP #2 below I do the following:
Note: wrappedPane is my JMapPane
STEP #1
wrappedPane.dispatchEvent(
                new ComponentEvent(wrappedPane, 
ComponentEvent.COMPONENT_RESIZED));

doing the above line will get your displayArea and also call labelCache.clear();
which should eliminate the resize on the window

STEP #2
//i have timing related things going on so I have code for the repaint like 
this:

            ReferencedEnvelope displayArea = wrappedPane.getDisplayArea();
            if (displayArea == null) {
                wrappedPane.repaint();
            } else {
                System.out.println("FIRED DisplayArea refresh");
                wrappedPane.setDisplayArea(displayArea);
            }





-----Original Message-----
From: "Oliver Gottwald" <[email protected]>
Sent: Tuesday, January 12, 2010 11:34am
To: "geouser" <[email protected]>
Subject: [Geotools-gt2-users] JMapPane.repaint() label issue


hi,

currently i have a legend.
if i turn off the checkbox in the legend:
layer.setVisible(false);

later in the process:
wrappedPane.repaint();
.....wrappedPane is my JMapPane

if i turn on the checkbox in the legend
layer.setVisible(true)
later in the process:
wrappedPane.repaint();

oddly the points disappear and reappear but the labels do not.
i know there is a wrappedPane.reset(); but i think that gives full extent on 
reset.

does this have to do with the labelCache of JMapPane?
what steps should i take on a setVisible for a layer to get my JMapPane to 
repaint correctly?

oliver

------------------------------------------------------------------------------
This SF.Net email is sponsored by the Verizon Developer Community
Take advantage of Verizon's best-in-class app development support
A streamlined, 14 day to market process makes app distribution fast and easy
Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev 
_______________________________________________
Geotools-gt2-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to