001: /*
002: * uDig - User Friendly Desktop Internet GIS client http://udig.refractions.net (C) 2004,
003: * Refractions Research Inc. This library is free software; you can redistribute it and/or modify it
004: * under the terms of the GNU Lesser General Public License as published by the Free Software
005: * Foundation; version 2.1 of the License. This library is distributed in the hope that it will be
006: * useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
007: * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
008: */
009: package net.refractions.udig.project.internal.render;
010:
011: import java.util.Collection;
012: import java.util.Map;
013: import java.util.SortedSet;
014:
015: import net.refractions.udig.project.ILayer;
016: import net.refractions.udig.project.internal.Layer;
017:
018: import org.eclipse.emf.common.notify.Notification;
019:
020: /**
021: * Creates Renderers and RenderContexts.
022: *
023: * @author Jesse
024: * @since 1.0.0
025: */
026: public interface RendererCreator {
027:
028: /**
029: * Provides a way to influence the choice of renderers. The value of a blackboard entry must a string which is the
030: * id of the Renderer as declared in the Extension definition. For example "BasicFeatureRenderer".
031: * <ul>
032: * <li>If an entry is on a Layer's blackboard with this key then that renderer will be preferred for that layer over other renderers.</li>
033: * <li>If an entry is on the Map's blackboard with this key then that renderer will be preferred over other renderers unless
034: * there is also an entry on a layer. In that case the layer's renderer still has precidence.</li>
035: * </ul>
036: * <p><b>IMPORTANT:</b> don't forget to append the plugin ID to the id entered into the id field.</p>
037: */
038: public static final String PREFERRED_RENDERER_ID = "PREFERRED_RENDERER_ID"; //$NON-NLS-1$
039:
040: /**
041: * Provides a way to influence the choice of renderers. The value of a blackboard entry must a string which is the
042: * id of the Renderer as declared in the Extension definition. For example "BasicFeatureRenderer".
043: * <ul>
044: * <li>If an entry is on a Layer's blackboard with this key then that renderer will be negatively weighted for that layer compared other renderers.</li>
045: * <li>If an entry is on the Map's blackboard with this key then that renderer will be negatively weighted compared to other renderers.</li>
046: * </ul>
047: * <p><b>IMPORTANT:</b> don't forget to append the plugin ID to the id entered into the id field.</p>
048: */
049: public static final String LAST_RESORT_RENDERER_ID = "LAST_RESORT_RENDERER_ID"; //$NON-NLS-1$
050:
051: /**
052: * Returns the value of the '<em><b>Toolkit</b></em>' attribute. <!-- begin-user-doc -->
053: * <p>
054: * If the meaning of the '<em>Toolkit</em>' attribute isn't clear, there really should be
055: * more of a description here...
056: * </p>
057: *
058: * @return the value of the '<em>Toolkit</em>' attribute.
059: */
060: RenderContext getContext();
061:
062: /**
063: * Sets the value of the '{@link net.refractions.udig.project.internal.render.RendererCreator#getContext <em>Context</em>}'
064: * reference.
065: *
066: * @param value the new value of the '<em>Context</em>' reference.
067: * @see #getContext()
068: */
069: void setContext(RenderContext value);
070:
071: /**
072: * Creates a Renderer which can render the provided layer
073: *
074: * @param context A context object with a layer to be rendered. The layer will be used to
075: * determine which renderer will be created
076: * @return a Renderer which can render the provided layer null if the layer type is not known
077: * (for example a decorator with an unknown renderer)
078: */
079: public Renderer getRenderer(RenderContext context);
080:
081: /**
082: * @return List <RenderContext>all the RenderContexts required for rendering all the layers in
083: * the ContextModel.
084: */
085: public RenderContext getRenderContext(Layer layer);
086:
087: /**
088: * Causes the RendererCreator to be updated as a result of a Map event.
089: */
090: void changed(Notification msg);
091:
092: /**
093: * Rebuilds the configurations.
094: */
095: public void reset();
096:
097: /**
098: * Locates the selection layer for layer or returns null;
099: *
100: * @return the selection layer for layer or returns null;
101: */
102: public SelectionLayer findSelectionLayer(ILayer targetLayer);
103:
104: /**
105: * @return The list of layers that the RendererCreator is responsible for creating renderers
106: */
107: SortedSet<Layer> getLayers();
108:
109: /**
110: * Returns the current configuration of Contexts objects.
111: *
112: * @return the current configuration of Contexts objects
113: */
114: Collection<RenderContext> getConfiguration();
115:
116: /**
117: * Returns The name and description of all the renderers that are capable of rendering the provided layer.
118: *
119: * @return The name and description of all the renderers that are capable of rendering the provided layer.
120: */
121: public Map<String, String> getAvailableRenderersInfo(Layer layer);
122:
123: }
|