Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [udig-users] (no subject)

I apologize for mixing the mailing lists. I think we would better move to udig-devel list.

Thanks; now lets see if I can help ...

Hi,
 
I’m the new guy in development using uDig so please, correct me if you see insufficiencies in my understanding.

Not to worry! Can I ask if you have gone through the tutorials? Some of the tutorials are only available as source code; including the one that answers your question.


Note: If you want to take a uDig training course; or are from an academic institution we can arrange access to these workbooks.

Currently I see the following workflow:
1). Render starts.
2). Style is set for current rendering process.
3). Some DataSource is loaded to uDig.
4). Rendering process.
5). Render ends.

Workflow is actually:
1) Map is created
2) Layer is created (using a GeoResource and using a default Style generated from the geoResource)

3) Layer is added to the Map
4) RenderManager watches the map; and now since things have changed it goes through and figures out what renderer to use for each layer
5) RenderManager passes the final list of renderers to the RenderExecutor
6) RenderExecutor uses the renders to draw on the screen (as the user pans and zooms around)
- Each renderer is responsible for drawing the content of its Layer
- How this is done is up to each renderer
- As an example the BasicFeatureRenderer calls geoResource.resolve( FeatureSource ) to get a GeoTools FeatureSource and grabs the GeoTools Style from the layer style blackboard;  tt then uses the GeoTools StreamingRenderer to draw featureSource+Style
6) Whenever the layers or styles change step (4) is run again

 
And the question is the following: is there any possibility to change the style on-fly to apply it to the current rendering process?
Yes; everytime you change anything on the "style blackboard" render occurs again - it is what it is for.

For example if there is some specific conditions in data that forces the style change.

No in the raw data (ie from the FeatureSource). But if you change the Style (and put the changed style on the style blackboard) the rendering engine will figure out what to do again.

So I need an update style command between sections 3 and 4 to force the rendering process to use the new style.

You can update the style from any thread; this will trigger the layer to redraw.

Accessing style via Blackboard causes the future renderings to use the proper style but the current render process still uses the old one.

You may need to call styleBlackboard.put( style ) to trigger the redraw. In general you don't modify the style in place (since it is being used by another thread). Grab a copy; modify; and replace.

Refreshing the whole layer seems to be the bad idea, because is too time expensive.

You can call layer.refresh( ReferencedEnvelope ) to only redraw part of the screen.

P.S. The main idea of style change is to change the drawing order of the features, if that can be useful.

Interesting; not sure how you plan to do that? You could make two feature type styles with two different filters. That would allow you to choose what features to draw into each group (and thus make some appear to be drawn over top of another).

Jody


Back to the top