Dashboard > uDig > Home > Developer > Programmers Guide > Styles
uDig
Styles
Added by jeichar@refractions.net , last edited by jeichar@refractions.net on Oct 01, 2004  (view change)
Labels: 
(None)

UDIG Styles and Styling

Styling in UDIG is designed to be flexible because different renderers require styles. For example, a renderer based on Geotools requires Geotool's SLD objects. Since SLD is the standard style it is tempting to only support SLD styles. However, doing so requires all renderers to support SLD styles, which would require extreme refactoring for some rendering.

One of the goals of UDIG is to be flexible and provide many options for extension. Therefore, style objects are unknown to UDIG. The only requirement is a style much implement the net.refractions.udig.project.render.Style interface. The Style interface has only one method, createMemento(), which creates a net.refractions.udig.project.render.StyleMemento object. StyleMemento objects are the only style objects that UDIG is concerned with. StyleMemento is an implementation of the Eclipse IMemento interface and is used to persist the style information. When a renderer is created it is passed the StyleMemento interface and is evaluated to determine whether the renderer can use the memento.

Style Extension Point

A plugin that defines a style (Note: a single plugin could define a style and a renderer) must implement a net.refractions.udig.project.render.StyleEditor and a class that implements the Style interface. The StyleEditor interface extends eclipse's IDialogPage interface and contains an additional init() method that accepts a StyleMemento object as a parameter. The StyleMemento contains the style information that the editor can edit. The other method is getMemento which returns a StyleMemento object.

Style Examples included in UDIG

SLDStyle is the Style included with uDig. It is essentially a adapter for Geotool's Style objects. The StyleMemento created by SLDStyle contains two properties: a ?type? property which is set to ?SLDStyle? and a ?version? property which at the time of the UDIG version 1.0 release is set to ?1.0?. The StyleMemento contains an SLD document formatted string in its text field. The SLD document can be retrieved using the getTextData() method call.
SLDEditor is the default Style Editor class has been included since the 0.5 release.

Powered by a free Atlassian Confluence Open Source Project License granted to uDig. Evaluate Confluence today.
Powered by Atlassian Confluence 2.7.1, the Enterprise Wiki. Bug/feature request - Atlassian news - Contact administrators
User-friendly Desktop Internet GIS