001: /**
002: * <copyright></copyright> $Id: RenderManagerImpl.java 22467 2006-10-30 21:53:54Z jeichar $
003: */package net.refractions.udig.project.internal.render.impl;
004:
005: import java.awt.image.RenderedImage;
006: import java.io.IOException;
007: import java.util.ArrayList;
008: import java.util.Collections;
009: import java.util.Comparator;
010: import java.util.List;
011:
012: import net.refractions.udig.project.ILayer;
013: import net.refractions.udig.project.IMap;
014: import net.refractions.udig.project.internal.Map;
015: import net.refractions.udig.project.internal.ProjectPackage;
016: import net.refractions.udig.project.internal.ProjectPlugin;
017: import net.refractions.udig.project.internal.render.ExecutorVisitor;
018: import net.refractions.udig.project.internal.render.RenderContext;
019: import net.refractions.udig.project.internal.render.RenderExecutor;
020: import net.refractions.udig.project.internal.render.RenderFactory;
021: import net.refractions.udig.project.internal.render.RenderManager;
022: import net.refractions.udig.project.internal.render.RenderPackage;
023: import net.refractions.udig.project.internal.render.Renderer;
024: import net.refractions.udig.project.internal.render.RendererCreator;
025: import net.refractions.udig.project.internal.render.SelectionLayer;
026: import net.refractions.udig.project.internal.render.ViewportModel;
027: import net.refractions.udig.project.render.IRenderManager;
028: import net.refractions.udig.project.render.IRenderer;
029: import net.refractions.udig.project.render.displayAdapter.IMapDisplay;
030:
031: import org.eclipse.emf.common.notify.Notification;
032: import org.eclipse.emf.common.notify.NotificationChain;
033: import org.eclipse.emf.common.notify.impl.NotificationChainImpl;
034: import org.eclipse.emf.ecore.EClass;
035: import org.eclipse.emf.ecore.EStructuralFeature;
036: import org.eclipse.emf.ecore.InternalEObject;
037: import org.eclipse.emf.ecore.impl.ENotificationImpl;
038: import org.eclipse.emf.ecore.impl.EObjectImpl;
039:
040: import com.vividsolutions.jts.geom.Envelope;
041:
042: /**
043: * An unresponsive implementation of IRenderManager. It will not rerender if the viewport model changes.
044: * In fact it does not register for any events.
045: *
046: * @author Jesse
047: * @since 1.0.0
048: * @generated
049: */
050: public class RenderManagerImpl extends EObjectImpl implements
051: RenderManager {
052: /**
053: * <!-- begin-user-doc --> <!-- end-user-doc -->
054: *
055: * @generated
056: */
057: public static final String copyright = "uDig - User Friendly Desktop Internet GIS client http://udig.refractions.net (C) 2004, Refractions Research Inc. This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; version 2.1 of the License. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details."; //$NON-NLS-1$
058:
059: /**
060: * The cached value of the '{@link #getRenderExecutor() <em>Render Executor</em>}' reference.
061: * <!-- begin-user-doc --> <!-- end-user-doc -->
062: *
063: * @see #getRenderExecutor()
064: * @generated NOT
065: * @ordered
066: */
067: protected RenderExecutor renderExecutor;
068:
069: /**
070: * The cached value of the '{@link #getRendererCreator() <em>Renderer Creator</em>}'
071: * containment reference. <!-- begin-user-doc --> <!-- end-user-doc -->
072: *
073: * @see #getRendererCreator()
074: * @generated NOT
075: * @ordered
076: */
077: protected final RendererCreator rendererCreator;
078:
079: /**
080: * The default value of the '{@link #getMapDisplay() <em>Map Display</em>}' attribute. <!--
081: * begin-user-doc --> <!-- end-user-doc -->
082: *
083: * @see #getMapDisplay()
084: * @generated
085: * @ordered
086: */
087: protected static final IMapDisplay MAP_DISPLAY_EDEFAULT = null;
088:
089: /**
090: * The cached value of the '{@link #getMapDisplay() <em>Map Display</em>}' attribute. <!--
091: * begin-user-doc --> <!-- end-user-doc -->
092: *
093: * @see #getMapDisplay()
094: * @generated
095: * @ordered
096: */
097: protected IMapDisplay mapDisplay = MAP_DISPLAY_EDEFAULT;
098:
099: /**
100: * The cached value of the '{@link #getMapInternal() <em>Map Internal</em>}' reference. <!--
101: * begin-user-doc --> <!-- end-user-doc -->
102: *
103: * @see #getMapInternal()
104: * @generated
105: * @ordered
106: */
107: protected Map mapInternal = null;
108:
109: /**
110: * The cached value of the '{@link #getViewportModelInternal() <em>Viewport Model Internal</em>}'
111: * reference. <!-- begin-user-doc --> <!-- end-user-doc -->
112: *
113: * @see #getViewportModelInternal()
114: * @generated
115: * @ordered
116: */
117: protected ViewportModel viewportModelInternal = null;
118:
119: /**
120: * Indicate if the RenderManager has been disposed.
121: */
122: protected volatile boolean disposed = false;
123:
124: /**
125: * <!-- begin-user-doc --> <!-- end-user-doc -->
126: *
127: * @generated
128: */
129: protected RenderManagerImpl() {
130: super ();
131:
132: rendererCreator = new RendererCreatorImpl();
133: RenderContext context = new RenderContextImpl() {
134: @Override
135: public Map getMapInternal() {
136: return RenderManagerImpl.this .getMapInternal();
137: }
138:
139: @Override
140: public Map getMap() {
141: return RenderManagerImpl.this .getMapInternal();
142: }
143:
144: @Override
145: public RenderManager getRenderManagerInternal() {
146: return RenderManagerImpl.this ;
147: }
148:
149: @Override
150: public IRenderManager getRenderManager() {
151: return RenderManagerImpl.this ;
152: }
153: };
154: rendererCreator.setContext(context);
155: }
156:
157: /**
158: * <!-- begin-user-doc --> <!-- end-user-doc -->
159: *
160: * @generated
161: */
162: protected EClass eStaticClass() {
163: return RenderPackage.eINSTANCE.getRenderManager();
164: }
165:
166: /**
167: * Prints the current renderstack.
168: */
169: public void printRenderStack() {
170: checkState();
171: if (getRenderExecutor() != null) {
172: final StringBuffer msg = new StringBuffer();
173: getRenderExecutor().visit(new ExecutorVisitor() {
174: int i = 0;
175:
176: public void visit(RenderExecutor executor) {
177: i++;
178: String layername = executor.getContext().getLayer()
179: .getID().toString();
180: if (executor.getContext().getLayer() instanceof SelectionLayer) {
181: layername += "<Selection>"; //$NON-NLS-1$
182: }
183: msg.append("\n" + i + " - " + layername); //$NON-NLS-1$ //$NON-NLS-2$
184:
185: }
186:
187: public void visit(RenderExecutorMultiLayer executor) {
188: for (ILayer layer : executor.getContext()
189: .getLayers()) {
190: i++;
191: String layername = layer.getID().toString();
192: if (layer instanceof SelectionLayer) {
193: layername += "<Selection>"; //$NON-NLS-1$
194: }
195: msg.append("\n" + i + " - " + layername); //$NON-NLS-1$ //$NON-NLS-2$
196: }
197: }
198:
199: public void visit(RenderExecutorComposite executor) {
200: for (RenderExecutor renderer : executor
201: .getRenderer().getRenderExecutors()) {
202: renderer.visit(this );
203: }
204: }
205: });
206: ProjectPlugin.log(msg.toString(), null);
207: }
208: }
209:
210: /**
211: * <!-- begin-user-doc --> <!-- end-user-doc -->
212: *
213: * @generated
214: */
215: public Map getMapInternal() {
216: checkState();
217: if (mapInternal != null && mapInternal.eIsProxy()) {
218: Map oldMapInternal = mapInternal;
219: mapInternal = (Map) eResolveProxy((InternalEObject) mapInternal);
220: if (mapInternal != oldMapInternal) {
221: if (eNotificationRequired())
222: eNotify(new ENotificationImpl(this ,
223: Notification.RESOLVE,
224: RenderPackage.RENDER_MANAGER__MAP_INTERNAL,
225: oldMapInternal, mapInternal));
226: }
227: }
228: return mapInternal;
229: }
230:
231: /**
232: * <!-- begin-user-doc --> <!-- end-user-doc -->
233: *
234: * @generated
235: */
236: public Map basicGetMapInternal() {
237: return mapInternal;
238: }
239:
240: /**
241: * <!-- begin-user-doc --> <!-- end-user-doc -->
242: *
243: * @generated
244: */
245: public NotificationChain basicSetMapInternal(Map newMapInternal,
246: NotificationChain msgs) {
247: Map oldMapInternal = mapInternal;
248: mapInternal = newMapInternal;
249: if (eNotificationRequired()) {
250: ENotificationImpl notification = new ENotificationImpl(
251: this , Notification.SET,
252: RenderPackage.RENDER_MANAGER__MAP_INTERNAL,
253: oldMapInternal, newMapInternal);
254: if (msgs == null)
255: msgs = notification;
256: else
257: msgs.add(notification);
258: }
259: return msgs;
260: }
261:
262: /**
263: * <!-- begin-user-doc --> <!-- end-user-doc -->
264: *
265: * @generated
266: */
267: public void setMapInternalGen(Map newMapInternal) {
268: checkState();
269: if (newMapInternal != mapInternal) {
270: NotificationChain msgs = null;
271: if (mapInternal != null)
272: msgs = ((InternalEObject) mapInternal).eInverseRemove(
273: this ,
274: ProjectPackage.MAP__RENDER_MANAGER_INTERNAL,
275: Map.class, msgs);
276: if (newMapInternal != null)
277: msgs = ((InternalEObject) newMapInternal).eInverseAdd(
278: this ,
279: ProjectPackage.MAP__RENDER_MANAGER_INTERNAL,
280: Map.class, msgs);
281: msgs = basicSetMapInternal(newMapInternal, msgs);
282: if (msgs != null)
283: msgs.dispatch();
284: } else if (eNotificationRequired())
285: eNotify(new ENotificationImpl(this , Notification.SET,
286: RenderPackage.RENDER_MANAGER__MAP_INTERNAL,
287: newMapInternal, newMapInternal));
288: }
289:
290: boolean viewer = false;
291:
292: /**
293: * @return Returns the viewer.
294: * @uml.property name="viewer"
295: */
296: public boolean isViewer() {
297: checkState();
298: return viewer;
299: }
300:
301: /**
302: * @param viewer The viewer to set.
303: * @uml.property name="viewer"
304: */
305: public void setViewer(boolean viewer) {
306: checkState();
307: this .viewer = viewer;
308: }
309:
310: /**
311: * @see net.refractions.udig.project.internal.render.RenderManager#setMap(IMap)
312: * @uml.property name="mapInternal"
313: */
314: public void setMapInternal(Map newMap) {
315: checkState();
316: if (isViewer()) {
317: basicSetMapInternal(newMap, new NotificationChainImpl());
318: } else
319: setMapInternalGen(newMap);
320: }
321:
322: /**
323: * <!-- begin-user-doc --> <!-- end-user-doc -->
324: *
325: * @generated
326: */
327: public IMapDisplay getMapDisplay() {
328: checkState();
329: return mapDisplay;
330: }
331:
332: /**
333: * <!-- begin-user-doc --> <!-- end-user-doc -->
334: *
335: * @generated
336: */
337: public void setMapDisplay(IMapDisplay newMapDisplay) {
338: IMapDisplay oldMapDisplay = mapDisplay;
339: mapDisplay = newMapDisplay;
340: if (eNotificationRequired())
341: eNotify(new ENotificationImpl(this , Notification.SET,
342: RenderPackage.RENDER_MANAGER__MAP_DISPLAY,
343: oldMapDisplay, mapDisplay));
344: }
345:
346: /**
347: * <!-- begin-user-doc --> <!-- end-user-doc -->
348: *
349: * @generated NOT
350: */
351: public RendererCreator getRendererCreator() {
352: checkState();
353: return rendererCreator;
354: }
355:
356: /**
357: * <!-- begin-user-doc --> <!-- end-user-doc -->
358: *
359: * @generated
360: */
361: public ViewportModel getViewportModelInternal() {
362: checkState();
363: return viewportModelInternal;
364: }
365:
366: /**
367: * <!-- begin-user-doc --> <!-- end-user-doc -->
368: *
369: * @generated
370: */
371: public NotificationChain basicSetViewportModelInternal(
372: ViewportModel newViewportModelInternal,
373: NotificationChain msgs) {
374: ViewportModel oldViewportModelInternal = viewportModelInternal;
375: viewportModelInternal = newViewportModelInternal;
376: if (eNotificationRequired()) {
377: ENotificationImpl notification = new ENotificationImpl(
378: this ,
379: Notification.SET,
380: RenderPackage.RENDER_MANAGER__VIEWPORT_MODEL_INTERNAL,
381: oldViewportModelInternal, newViewportModelInternal);
382: if (msgs == null)
383: msgs = notification;
384: else
385: msgs.add(notification);
386: }
387: return msgs;
388: }
389:
390: /**
391: * <!-- begin-user-doc --> <!-- end-user-doc -->
392: *
393: * @generated
394: */
395: public void setViewportModelInternal(
396: ViewportModel newViewportModelInternal) {
397: if (newViewportModelInternal != viewportModelInternal) {
398: NotificationChain msgs = null;
399: if (viewportModelInternal != null)
400: msgs = ((InternalEObject) viewportModelInternal)
401: .eInverseRemove(
402: this ,
403: RenderPackage.VIEWPORT_MODEL__RENDER_MANAGER_INTERNAL,
404: ViewportModel.class, msgs);
405: if (newViewportModelInternal != null)
406: msgs = ((InternalEObject) newViewportModelInternal)
407: .eInverseAdd(
408: this ,
409: RenderPackage.VIEWPORT_MODEL__RENDER_MANAGER_INTERNAL,
410: ViewportModel.class, msgs);
411: msgs = basicSetViewportModelInternal(
412: newViewportModelInternal, msgs);
413: if (msgs != null)
414: msgs.dispatch();
415: } else if (eNotificationRequired())
416: eNotify(new ENotificationImpl(
417: this ,
418: Notification.SET,
419: RenderPackage.RENDER_MANAGER__VIEWPORT_MODEL_INTERNAL,
420: newViewportModelInternal, newViewportModelInternal));
421: }
422:
423: /**
424: * @throws IOException
425: * @see net.refractions.udig.project.internal.render.RenderManager#getInfo(java.awt.Point)
426: * public List getInfo(Point screenLocation) throws IOException { return
427: * getRenderExecutor().getInfo(screenLocation); }
428: */
429:
430: /**
431: * @throws IOException
432: * @see net.refractions.udig.project.internal.render.RenderManager#getInfo(java.awt.Point)
433: * public List getInfo(Point screenLocation) throws IOException { return
434: * getRenderExecutor().getInfo(screenLocation); }
435: * @uml.property name="renderExecutor"
436: * @generated
437: */
438: public RenderExecutor getRenderExecutor() {
439: checkState();
440: if (renderExecutor == null)
441: setRenderExecutor(RenderFactory.eINSTANCE
442: .createRenderExecutor());
443:
444: return renderExecutor;
445: }
446:
447: /**
448: * <!-- begin-user-doc --> <!-- end-user-doc -->
449: *
450: * @generated
451: */
452: public void setRenderExecutor(RenderExecutor newRenderExecutor) {
453: RenderExecutor oldRenderExecutor = renderExecutor;
454: renderExecutor = newRenderExecutor;
455: if (eNotificationRequired())
456: eNotify(new ENotificationImpl(this , Notification.SET,
457: RenderPackage.RENDER_MANAGER__RENDER_EXECUTOR,
458: oldRenderExecutor, renderExecutor));
459: }
460:
461: /**
462: * If subclasses override this method make sure that super.dispose() is called <b>AT THE END<b>
463: * of the overridding method.
464: *
465: * @generated NOT
466: */
467: public void dispose() {
468: checkState();
469: if (renderExecutor != null) {
470: ((RenderContextImpl) renderExecutor.getContext()).dispose();
471: getRenderExecutor().dispose();
472: }
473:
474: mapDisplay = null;
475:
476: renderExecutor = null;
477:
478: getMapInternal().setRenderManagerInternal(null);
479:
480: disposed = true;
481:
482: // Runtime.getRuntime().gc();
483: }
484:
485: public void checkState() throws IllegalStateException {
486: if (disposed)
487: throw new IllegalStateException("RenderManager is disposed"); //$NON-NLS-1$
488: }
489:
490: /**
491: * <!-- begin-user-doc --> <!-- end-user-doc -->
492: *
493: * @generated
494: */
495: public NotificationChain eInverseAdd(InternalEObject otherEnd,
496: int featureID, Class baseClass, NotificationChain msgs) {
497: if (featureID >= 0) {
498: switch (eDerivedStructuralFeatureID(featureID, baseClass)) {
499: case RenderPackage.RENDER_MANAGER__MAP_INTERNAL:
500: if (mapInternal != null)
501: msgs = ((InternalEObject) mapInternal)
502: .eInverseRemove(
503: this ,
504: ProjectPackage.MAP__RENDER_MANAGER_INTERNAL,
505: Map.class, msgs);
506: return basicSetMapInternal((Map) otherEnd, msgs);
507: case RenderPackage.RENDER_MANAGER__VIEWPORT_MODEL_INTERNAL:
508: if (viewportModelInternal != null)
509: msgs = ((InternalEObject) viewportModelInternal)
510: .eInverseRemove(
511: this ,
512: RenderPackage.VIEWPORT_MODEL__RENDER_MANAGER_INTERNAL,
513: ViewportModel.class, msgs);
514: return basicSetViewportModelInternal(
515: (ViewportModel) otherEnd, msgs);
516: default:
517: return eDynamicInverseAdd(otherEnd, featureID,
518: baseClass, msgs);
519: }
520: }
521: if (eContainer != null)
522: msgs = eBasicRemoveFromContainer(msgs);
523: return eBasicSetContainer(otherEnd, featureID, msgs);
524: }
525:
526: /**
527: * <!-- begin-user-doc --> <!-- end-user-doc -->
528: *
529: * @generated
530: */
531: public NotificationChain eInverseRemove(InternalEObject otherEnd,
532: int featureID, Class baseClass, NotificationChain msgs) {
533: if (featureID >= 0) {
534: switch (eDerivedStructuralFeatureID(featureID, baseClass)) {
535: case RenderPackage.RENDER_MANAGER__MAP_INTERNAL:
536: return basicSetMapInternal(null, msgs);
537: case RenderPackage.RENDER_MANAGER__VIEWPORT_MODEL_INTERNAL:
538: return basicSetViewportModelInternal(null, msgs);
539: default:
540: return eDynamicInverseRemove(otherEnd, featureID,
541: baseClass, msgs);
542: }
543: }
544: return eBasicSetContainer(null, featureID, msgs);
545: }
546:
547: /**
548: * <!-- begin-user-doc --> <!-- end-user-doc -->
549: *
550: * @generated
551: */
552: public Object eGet(EStructuralFeature eFeature, boolean resolve) {
553: switch (eDerivedStructuralFeatureID(eFeature)) {
554: case RenderPackage.RENDER_MANAGER__RENDER_EXECUTOR:
555: return getRenderExecutor();
556: case RenderPackage.RENDER_MANAGER__MAP_DISPLAY:
557: return getMapDisplay();
558: case RenderPackage.RENDER_MANAGER__MAP_INTERNAL:
559: if (resolve)
560: return getMapInternal();
561: return basicGetMapInternal();
562: case RenderPackage.RENDER_MANAGER__VIEWPORT_MODEL_INTERNAL:
563: return getViewportModelInternal();
564: }
565: return eDynamicGet(eFeature, resolve);
566: }
567:
568: /**
569: * <!-- begin-user-doc --> <!-- end-user-doc -->
570: *
571: * @generated
572: */
573: public void eSet(EStructuralFeature eFeature, Object newValue) {
574: switch (eDerivedStructuralFeatureID(eFeature)) {
575: case RenderPackage.RENDER_MANAGER__RENDER_EXECUTOR:
576: setRenderExecutor((RenderExecutor) newValue);
577: return;
578: case RenderPackage.RENDER_MANAGER__MAP_DISPLAY:
579: setMapDisplay((IMapDisplay) newValue);
580: return;
581: case RenderPackage.RENDER_MANAGER__MAP_INTERNAL:
582: setMapInternal((Map) newValue);
583: return;
584: case RenderPackage.RENDER_MANAGER__VIEWPORT_MODEL_INTERNAL:
585: setViewportModelInternal((ViewportModel) newValue);
586: return;
587: }
588: eDynamicSet(eFeature, newValue);
589: }
590:
591: /**
592: * <!-- begin-user-doc --> <!-- end-user-doc -->
593: *
594: * @generated
595: */
596: public void eUnset(EStructuralFeature eFeature) {
597: switch (eDerivedStructuralFeatureID(eFeature)) {
598: case RenderPackage.RENDER_MANAGER__RENDER_EXECUTOR:
599: setRenderExecutor((RenderExecutor) null);
600: return;
601: case RenderPackage.RENDER_MANAGER__MAP_DISPLAY:
602: setMapDisplay(MAP_DISPLAY_EDEFAULT);
603: return;
604: case RenderPackage.RENDER_MANAGER__MAP_INTERNAL:
605: setMapInternal((Map) null);
606: return;
607: case RenderPackage.RENDER_MANAGER__VIEWPORT_MODEL_INTERNAL:
608: setViewportModelInternal((ViewportModel) null);
609: return;
610: }
611: eDynamicUnset(eFeature);
612: }
613:
614: /**
615: * <!-- begin-user-doc --> <!-- end-user-doc -->
616: *
617: * @generated
618: */
619: public boolean eIsSet(EStructuralFeature eFeature) {
620: switch (eDerivedStructuralFeatureID(eFeature)) {
621: case RenderPackage.RENDER_MANAGER__RENDER_EXECUTOR:
622: return renderExecutor != null;
623: case RenderPackage.RENDER_MANAGER__MAP_DISPLAY:
624: return MAP_DISPLAY_EDEFAULT == null ? mapDisplay != null
625: : !MAP_DISPLAY_EDEFAULT.equals(mapDisplay);
626: case RenderPackage.RENDER_MANAGER__MAP_INTERNAL:
627: return mapInternal != null;
628: case RenderPackage.RENDER_MANAGER__VIEWPORT_MODEL_INTERNAL:
629: return viewportModelInternal != null;
630: }
631: return eDynamicIsSet(eFeature);
632: }
633:
634: /**
635: * <!-- begin-user-doc --> <!-- end-user-doc -->
636: *
637: * @generated
638: */
639: public String toString() {
640: checkState();
641: if (eIsProxy())
642: return super .toString();
643:
644: StringBuffer result = new StringBuffer(super .toString());
645: result.append(" (mapDisplay: "); //$NON-NLS-1$
646: result.append(mapDisplay);
647: result.append(')');
648: return result.toString();
649: }
650:
651: /**
652: * @see net.refractions.udig.project.internal.render.RenderManager#refresh(net.refractions.udig.project.Layer,
653: * com.vividsolutions.jts.geom.Envelope)
654: */
655: public void refresh(ILayer layer, Envelope bounds) {
656: throw new UnsupportedOperationException();
657:
658: }
659:
660: /**
661: * @see net.refractions.udig.project.internal.render.RenderManager#refresh(com.vividsolutions.jts.geom.Envelope)
662: */
663: public void refresh(Envelope bounds) {
664: throw new UnsupportedOperationException();
665: }
666:
667: /**
668: * @see net.refractions.udig.project.internal.render.RenderManager#refreshSelection(com.vividsolutions.jts.geom.Envelope)
669: */
670: public void refreshSelection(ILayer layer, Envelope bounds) {
671: throw new UnsupportedOperationException();
672: }
673:
674: /**
675: * @see net.refractions.udig.project.render.IRenderManager#getMap()
676: */
677: public IMap getMap() {
678: checkState();
679: return getMapInternal();
680: }
681:
682: /**
683: * @see net.refractions.udig.project.render.IRenderManager#getRenderers()
684: */
685: public List<IRenderer> getRenderers() {
686: checkState();
687: final List<IRenderer> renderers = new ArrayList<IRenderer>();
688: getRenderExecutor().visit(new ExecutorVisitor() {
689:
690: public void visit(RenderExecutor executor) {
691: if (!(executor.getContext().getLayer() instanceof SelectionLayer)) {
692: Renderer renderer = executor.getRenderer();
693: renderers.add(renderer);
694: }
695: }
696:
697: public void visit(RenderExecutorMultiLayer executor) {
698: renderers.add(executor.getRenderer());
699: }
700:
701: public void visit(RenderExecutorComposite executor) {
702: for (RenderExecutor currentExecutor : executor
703: .getRenderer().getRenderExecutors())
704: currentExecutor.visit(this );
705: }
706:
707: });
708:
709: Collections.sort(renderers, new Comparator<IRenderer>() {
710:
711: public int compare(IRenderer arg0, IRenderer arg1) {
712: return arg0.getContext().getLayer().compareTo(
713: arg1.getContext().getLayer());
714: }
715:
716: });
717: return renderers;
718: }
719:
720: public void stopRendering() {
721: checkState();
722: if (getRenderExecutor() != null)
723: getRenderExecutor().stopRendering();
724: }
725:
726: public boolean isDisposed() {
727: return disposed;
728: }
729:
730: public RenderedImage getImage() {
731: if (renderExecutor == null
732: || renderExecutor.getState() == IRenderer.NEVER
733: || getRenderExecutor().getContext() == null)
734: return null;
735: // try {
736: // ((CompositeRendererImpl)getRenderExecutor()).refreshImage();
737: // } catch (RenderException e) {
738: // throw (RuntimeException) new RuntimeException( e );
739: // }
740: return getRenderExecutor().getContext().getImage();
741: }
742:
743: public void clearSelection(ILayer layer) {
744: throw new UnsupportedOperationException();
745: }
746:
747: } // RenderManagerImpl
|