[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
| Re: [udig-devel] Question on Renderers | 
Ugo,
Here is my attempt to explain some of the rendering stuff.
Renderers are responsible for drawing data on an image.  Each Renderer 
has a RenderMetrics which is used to determine "how well" the 
corresponding renderer can render a given georesource.  The 
RenderMetricsFactories are used to create the RenderMetrics.
Udig uses all this information to draw layers on the map.  When UDig 
opens a map it gets a list of all available RenderMetricsFactories by 
processing the extension point.
When it goes to render a given layer (for example a shapefile layer); it 
goes though all the possible rendermetricsfactories; creates render 
metrics; and then rates the render metrics based on the information 
provided in that class.  Then the render metrics with the highest rating 
is used to create a renderer for that given layer.  (Some of this 
information is cached; so all this processing does not necessarily 
happen for each draw).
So a layer can have multiple renderer, but by using the render metrics 
uDig determines which one to use.  In uDig there are multiple renderers 
that can render a shapefile: BasicFeatureRenderer and 
ShapefileFeatureRenderer; however because of the way the render metrics 
are set up for a shapefile the ShapefileFeatureRenderer will be picked 
over the other renderer to render shapefiles.
>I cannot see any other renderes.
My first guess would be to ensure the plug-ins for all renderers are 
included when you run your project.  If the RenderMetricFactories are 
not included when running then uDig won't know about them and won't be 
able to find any render metric factories when processing the extension 
point.
I hope this is of some help.
Emily
Ugo Taddei wrote:
Hello,
I'm hopelessly trying to understand the rationale behind all those 
Renderers, RenderMetrics and RenderMetricsFactories. For that, I've 
adapted the code from StaticGISWidget and I'm trying to render onto an 
image I created.
I use ApplicationGIS.drawMap( drawParameters ) to render the image. It's 
not working because
Renderer renderer = decisive.getRenderer(context); (around line 855)
returns a net.refractions.udig.project.internal.render.impl.PlaceHolder, 
which apparently is some sort of dummy renderer, that is, does nothing.
In my application I read a project, and try to render a map (with the 
adapted code from StatcGisWidget). In the printlns I added, I only see a 
MapGraphicRenderMetricsFactory (which I assume is always there, as I 
don't have explicitely instantiated on or created one within the 
project). I cannot see any other renderes.
How does udig figures out, what sort of layer it has, say a shapefile, 
and when does it do that?
What renderer is responsible for the shapefiles, is it 
ShapefileFeatureRenderer?
Do I have to set the renderer myself?
Thanks in advance,
Ugo