Re: [JPP-Devel] how to refresh a layer in run time

2010-07-02 Thread Larry Becker
Hi Elton,

  I think you are going to have to restructure you code from a loop to be an
event handler that triggers itself until the end of some counter.  That is
the only sure way to play nice with the GUI.

Larry

On Fri, Jul 2, 2010 at 12:06 PM, Elton Chan  wrote:

> Hi Larry,
>
> I've tried the LayerView Panel().repaint() with InvokeAndWait(). However,
> the layerpanel still cannot refesh and the for loop continues until all
> finishing all the Recordset.
>
> The following code is added after attribute update:
> if (SwingUtilities.isEventDispatchThread()) {
> context.getLayerViewPanel().repaint();
> System.out.println("repaint!!");  Always hit this line.
> }
> else {
> SwingUtilities.invokeAndWait(new Runnable( ) {
> public void run( ) {
> context.getLayerViewPanel().repaint();
> System.out.println("repaint!!!");
>}
> });
> }
>
> Any idea?
>
>
> --- On *Thu, 7/1/10, Larry Becker * wrote:
>
>
> From: Larry Becker 
> Subject: Re: [JPP-Devel] how to refresh a layer in run time
> To: "OpenJump develop and use" 
> Date: Thursday, July 1, 2010, 2:30 PM
>
>
> Sorry, Elton, not NIls.  I answered so many questions that I got confused
> about who I was answering.  :-)
>
> On Thu, Jul 1, 2010 at 8:24 AM, Larry Becker 
> http://mc/compose?to=becker.la...@gmail.com>
> > wrote:
>
>> Hi Nils,
>>
>>   I believe you might be running into problems updating because your loop
>> is blocking the GUI thread.  You might try a LayerViewPanel.repaint() using
>> invokeAndWait().
>>
>> Larry
>>
>>
>> On Thu, Jul 1, 2010 at 6:42 AM, Elton Chan 
>> http://mc/compose?to=elton.c...@yahoo.com>
>> > wrote:
>>
>>> Hi there,
>>>
>>> I would like to refresh a layer after changing attribute of each feature
>>> in the layer based on an event table. The event table records attribute
>>> assigned to each feature at specified stage. Following is the schema of the
>>> event table:
>>>
>>> Event(
>>> StageID int, // StageID defines sequence of the event
>>> Feature01 int, // value to be assigned to feature 01
>>> Feature02 int, // value to be assigned to feature 02
>>> ...
>>> Feature10 int)
>>>
>>> Based on the StageID sequence, values for each feature would be retrieved
>>> and updated to corresponding feature. Finally,  update value would be
>>> visualized by unique colortheming. However, it seems the layer refreshing
>>> can only be effective outside the ResultSet loop of the event table.
>>>
>>> The following is the program codes:
>>>
>>> Inside execute(PlugInContext context)
>>> // get a layer
>>> lyr = context.getLayerManager().getLayer("postgis");
>>> //create a Resultset RS
>>> ResultSet RS stat.executeQuery("select * from Event");
>>> while (RS.next())
>>> {
>>> updatePostgisLayer(lyr, RS);//This function updates feature in the layer
>>> }
>>> < layer refreshes after the looping all the resultset.
>>>
>>> My question is how to refresh the layer once attribute values are updated
>>> for each each row of the RecordSet, i.e. immediately after the
>>> updatePostgisLayer function.
>>>
>>> If I change the query to retrieve specify row (i.e. single row only),
>>> layer can be refreshed. But it requires to activate it manually for each
>>> update.
>>>
>>> I tried to add lyr.fireLayerChanged(LayerEventType.APPEARANCE_CHANGED);
>>> or lyr.fireAppearanceChanged() after the updatePostgisLayer function but
>>> it didn't work.
>>>
>>> Anyone can help?
>>>
>>> thanks,
>>> Elton
>>>
>>>
>>>
>>>
>>>
>>> --
>>> This SF.net email is sponsored by Sprint
>>> What will you do first with EVO, the first 4G phone?
>>> Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
>>> ___
>>> Jump-pilot-devel mailing list
>>> Jump-pilot-devel@lists.sourceforge.net
>>> https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel
>>>
>>
>>
>
> -Inline Attachment Follows-
>
>
>
> --
> This SF.net email is sponsored by Sprint
> What will you do first with EVO, the first 4G phone?
> Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
>
> -Inline Attachment Follows-
>
>
> ___
> Jump-pilot-devel mailing list
> Jump-pilot-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel
>
>
>
>
> --
> This SF.net email is sponsored by Sprint
> What will you do first with EVO, the first 4G phone?
> Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
> 

Re: [JPP-Devel] how to refresh a layer in run time

2010-07-02 Thread Elton Chan
Hi Larry,

I've tried the LayerView Panel().repaint() with InvokeAndWait(). However, the 
layerpanel still cannot refesh and the for loop continues until all finishing 
all the Recordset.

The following code is added after attribute update:
if (SwingUtilities.isEventDispatchThread()) {
                context.getLayerViewPanel().repaint();
                System.out.println("repaint!!");  Always hit this line.
            }
            else {
        SwingUtilities.invokeAndWait(new Runnable( ) {
        public void run( ) {
            context.getLayerViewPanel().repaint();
            System.out.println("repaint!!!");
       }
        });
            }

Any idea?


--- On Thu, 7/1/10, Larry Becker  wrote:

From: Larry Becker 
Subject: Re: [JPP-Devel] how to refresh a layer in run time
To: "OpenJump develop and use" 
Date: Thursday, July 1, 2010, 2:30 PM

Sorry, Elton, not NIls.  I answered so many questions that I got confused about 
who I was answering.  :-)

On Thu, Jul 1, 2010 at 8:24 AM, Larry Becker  wrote:

Hi Nils,

  I believe you might be running into problems updating because your loop is 
blocking the GUI thread.  You might try a LayerViewPanel.repaint() using 
invokeAndWait().


Larry


On Thu, Jul 1, 2010 at 6:42 AM, Elton Chan  wrote:


Hi there,



I would like to refresh a layer after changing attribute of each feature in the 
layer based on an event table. The event table records attribute assigned to 
each feature at specified stage. Following is the schema of the event table:





Event(

StageID int, // StageID defines sequence of the event

Feature01 int, // value to be assigned to feature 01

Feature02 int, // value to be assigned to feature 02

...

Feature10 int)



Based on the StageID sequence, values for each feature would be retrieved and 
updated to corresponding feature. Finally,  update value would be visualized by 
unique colortheming. However, it seems the layer refreshing can only be 
effective outside the ResultSet loop of the event table.





The following is the program codes:



Inside execute(PlugInContext context)

// get a layer

lyr = context.getLayerManager().getLayer("postgis");

//create a Resultset RS

ResultSet RS stat.executeQuery("select * from Event");

while (RS.next())

{

updatePostgisLayer(lyr, RS);//This function updates feature in the layer

}

< layer refreshes after the looping all the resultset.



My question is how to refresh the layer once attribute values are updated for 
each each row of the RecordSet, i.e. immediately after the updatePostgisLayer 
function.



If I change the query to retrieve specify row (i.e. single row only), layer can 
be refreshed. But it requires to activate it manually for each update.



I tried to add lyr.fireLayerChanged(LayerEventType.APPEARANCE_CHANGED);

or lyr.fireAppearanceChanged() after the updatePostgisLayer function but it 
didn't work.



Anyone can help?



thanks,

Elton









--

This SF.net email is sponsored by Sprint

What will you do first with EVO, the first 4G phone?

Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first

___

Jump-pilot-devel mailing list

Jump-pilot-devel@lists.sourceforge.net

https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel






-Inline Attachment Follows-

--
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
-Inline Attachment Follows-

___
Jump-pilot-devel mailing list
Jump-pilot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel



  --
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first___
Jump-pilot-devel mailing list
Jump-pilot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel


Re: [JPP-Devel] exploding GeometryCollections?

2010-07-02 Thread Nils Kuhn




Hi Michaël,
thank you very much! 
That's exactly what I was searching for. I have to confess that I never
right-clicked to the LayerViewPanel...
That's great.
Regards, Nils


Michaël Michaud schrieb:

  Hi,

When I have to achieve such a think I do it that way :
- Union
- Make the new layer editable
- Edition > Selection > Select by geometry type...
- choose MultiPolygon, GeometryColletion types
- right click on the layer view
- Explode selected features

Is that what you want to get ?

OK, I agree an option in the union (and union by attributes) plugins or 
a generic function available in Tools > Edit geometry > Geometry 
functions would be nice.

Michaël


Larry Becker a écrit :
  
  
Hi Nils,

If you mean an explode utility method you are correct - I don't think 
there is one.  There is code in the ExplodeSelectedFeaturesPlugIn.  
Also, there is support for recursive parsing of GeometryCollections 
when using an EditTransaction. 

If you do add a utility function, it should probably go in 
org.openjump.core.geomutils.

Larry

On Thu, Jul 1, 2010 at 2:54 AM, Nils Kuhn  wrote:

Hi,
we don't have a standard-function to "explode" GeometryCollections
to single Geometries in OpenJUMP, am I right?
To have an option "don't allow GeometryCollections" in the
main-menu-function Tools>>Analysis>>One Layer>>Union would be nice
, too.
Maybe I could try to implement something like that (I don't have
as much time, so that could last a while...).
Regards, Nils

--
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first  --
http://p.sf.net/sfu/sprint-com-first
___
Jump-pilot-devel mailing list
Jump-pilot-devel@lists.sourceforge.net

https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel




--
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first


___
Jump-pilot-devel mailing list
Jump-pilot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel
  

  
  

--
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
___
Jump-pilot-devel mailing list
Jump-pilot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel


  



-- 
Dipl.-Biol. Nils Kuhn
Email: nils.k...@bws-gmbh.de
Fon: +49 (0)40 - 23 16 65-26
Fax: +49 (0)40 - 23 16 65-01

BWS GmbH 
Gotenstraße 14
D-20097 Hamburg
Sitz der Gesellschaft: Hamburg
Amtsgericht Hamburg: HRB 87830
Geschäftsführer:
Dipl.-Geol. Robert Dési
Dipl.-Geogr. Hydr. Lutz Krob


*

HINWEIS: 
Diese E-Mail und beigefügte Dateien dienen nur der Vorabstimmung und stellen 
keine rechtswirksame Willenserklärungen oder Beratungsleistungen dar. Es können 
keine Haftungsansprüche gegenüber der BWS GmbH geltend gemacht werden. 
Alle rechtswirksamen Äußerungen (Verträge, Stellungnahmen, Berechnungen, Vermerke etc.)
erhalten Sie von uns in schriftlicher Form und gegebenenfalls auf separatem Datenträger.
Wenn Sie nicht der richtige Adressat sind oder diese E-Mail irrtümlich erhalten haben, 
informieren Sie bitte den Absender und vernichten Sie diese E-Mail. 
Unerlaubtes Kopieren und Weiterleiten dieser E-Mail sind nicht gestattet.

*




--
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first___
Jump-pilot-devel mailing list
Jump-pilot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel