Source Code Cross Referenced for RenderExecutorMultiLayer.java in  » GIS » udig-1.1 » net » refractions » udig » project » internal » render » impl » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » GIS » udig 1.1 » net.refractions.udig.project.internal.render.impl 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


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.impl;
010:
011:        import java.awt.Point;
012:        import java.util.List;
013:
014:        import net.refractions.udig.project.ILayer;
015:        import net.refractions.udig.project.internal.Layer;
016:        import net.refractions.udig.project.internal.render.CompositeRenderContext;
017:        import net.refractions.udig.project.internal.render.ExecutorVisitor;
018:        import net.refractions.udig.project.internal.render.MultiLayerRenderer;
019:        import net.refractions.udig.project.internal.render.RenderContext;
020:        import net.refractions.udig.project.internal.render.RenderExecutor;
021:        import net.refractions.udig.project.internal.render.Renderer;
022:        import net.refractions.udig.project.render.IRenderContext;
023:
024:        import org.eclipse.emf.common.notify.Notification;
025:
026:        import com.vividsolutions.jts.geom.Envelope;
027:
028:        /**
029:         * A RenderExecutor that runs MultiLayerRenderers such as WMSRenderer and MapGraphic Renderers.
030:         * 
031:         * @author   Jesse
032:         * @since   1.0.0
033:         */
034:        public class RenderExecutorMultiLayer extends RenderExecutorImpl {
035:
036:            protected final static class MultiLayerRendererLayerListener extends
037:                    LayerListener {
038:
039:                /**
040:                 * Construct <code>CompositeRendererLayerListener</code>.
041:                 * 
042:                 * @param executor
043:                 */
044:                MultiLayerRendererLayerListener(
045:                        RenderExecutorMultiLayer executor) {
046:                    super (executor);
047:                }
048:
049:                /**
050:                 * @see net.refractions.udig.project.internal.render.impl.RenderExecutorAdapters.ILayerListener#styleBlackboardChanged(org.eclipse.emf.common.notify.Notification)
051:                 */
052:                protected void styleBlackboardChanged(Notification msg) {
053:                    if (executor.getRenderer() instanceof  MultiLayerRenderer)
054:                        return;
055:
056:                    executor.getContext().getRenderManager().refresh(
057:                            (ILayer) msg.getNotifier(), (Envelope) null);
058:
059:                }
060:
061:                /**
062:                 * @see net.refractions.udig.project.internal.render.impl.RenderExecutorAdapters.ILayerListener#layerNotVisible(net.refractions.udig.project.Layer,
063:                 *      org.eclipse.emf.common.notify.Notification)
064:                 */
065:                protected void layerNotVisible(Layer layer, Notification msg) {
066:                    executor.getContext().getLabelPainter()
067:                            .disableLayer(
068:                                    executor.getContext().getLayer().getID()
069:                                            .toString());
070:                    CompositeRenderContext context = ((RenderExecutorMultiLayer) executor)
071:                            .getContext();
072:                    if (context.isVisible() && context.getContexts().size() > 1) {
073:                        executor.getContext().getRenderManager().refresh(layer,
074:                                (Envelope) null);
075:                    } else {
076:                        super .layerNotVisible(layer, msg);
077:                    }
078:                }
079:
080:                /**
081:                 * @see net.refractions.udig.project.internal.render.impl.RenderExecutorAdapters.ILayerListener#layerVisible(net.refractions.udig.project.Layer,
082:                 *      org.eclipse.emf.common.notify.Notification)
083:                 */
084:                protected void layerVisible(Layer layer, Notification msg) {
085:                    CompositeRenderContext context = ((RenderExecutorMultiLayer) executor)
086:                            .getContext();
087:
088:                    executor.getContext().getLabelPainter()
089:                            .disableLayer(
090:                                    executor.getContext().getLayer().getID()
091:                                            .toString());
092:                    if (context.getContexts().size() > 1)
093:                        executor.getContext().getRenderManager().refresh(layer,
094:                                (Envelope) null);
095:                    else
096:                        super .layerVisible(layer, msg);
097:                }
098:            }
099:
100:            protected class ContextListener implements  CompositeContextListener {
101:
102:                public void notifyChanged(CompositeRenderContext context,
103:                        List<RenderContext> contexts, boolean added) {
104:                    if (added) {
105:                        for (RenderContext context2 : contexts) {
106:                            addLayerListener(context2);
107:                        }
108:                    } else {
109:                        for (RenderContext context2 : contexts) {
110:                            removeLayerListener(context2);
111:                        }
112:                    }
113:                }
114:            }
115:
116:            protected static class MultiLayerRendererListener extends
117:                    RendererListener {
118:                /**
119:                 * Construct <code>CompositeRendererListener</code>.
120:                 * 
121:                 * @param executor
122:                 */
123:                MultiLayerRendererListener(RenderExecutor executor) {
124:                    super (executor);
125:                }
126:
127:                /**
128:                 * @see net.refractions.udig.project.internal.render.impl.RenderExecutorAdapters.RendererListener#stateChanged(org.eclipse.emf.common.notify.Notification)
129:                 */
130:                protected void stateChanged(Notification msg) {
131:                    super .stateChanged(msg);
132:                }
133:            }
134:
135:            /**
136:             * Construct <code>CompositeRendererExecutor</code>.
137:             */
138:            public RenderExecutorMultiLayer() {
139:                renderJob = new RenderJob(this );
140:            }
141:
142:            String jobName;
143:
144:            ContextListener listener = new ContextListener();
145:
146:            /**
147:             * @see net.refractions.udig.project.internal.render.impl.RenderExecutorImpl#getRenderJobName()
148:             */
149:            protected String getRenderJobName() {
150:                if (jobName == null) {
151:                    synchronized (this ) {
152:                        if (jobName == null) {
153:                            StringBuffer buffer = new StringBuffer("["); //$NON-NLS-1$
154:                            CompositeRenderContext context = (CompositeRenderContext) getContext();
155:                            for (IRenderContext rc : context.getContexts()) {
156:                                buffer.append(rc.getLayer().getName());
157:                                buffer.append(","); //$NON-NLS-1$
158:                            }
159:                            buffer.replace(buffer.length() - 1,
160:                                    buffer.length(), "]"); //$NON-NLS-1$
161:                            jobName = buffer.toString();
162:                        }
163:                    }
164:                }
165:                return jobName;
166:            }
167:
168:            /**
169:             * @see net.refractions.udig.project.internal.render.impl.RenderExecutorImpl#setRenderer(net.refractions.udig.project.render.Renderer)
170:             */
171:            @SuppressWarnings("unchecked")
172:            public void setRenderer(Renderer newRenderer) {
173:                if (getContext() != null)
174:                    for (IRenderContext context : getContext().getContexts()) {
175:                        removeLayerListener(context);
176:                    }
177:
178:                if (getContext() != null)
179:                    getContext().removeListener(listener);
180:                setRendererInternal(newRenderer);
181:                if (getContext() != null)
182:                    getContext().addListener(listener);
183:                for (IRenderContext context : ((CompositeRenderContext) newRenderer
184:                        .getContext()).getContexts()) {
185:                    addLayerListener(context);
186:                }
187:            }
188:
189:            protected void setRendererInternal(Renderer newRenderer) {
190:                super .setRenderer(newRenderer);
191:            }
192:
193:            /**
194:             * @see net.refractions.udig.project.internal.render.impl.RenderExecutorImpl#getContext()
195:             */
196:            public CompositeRenderContext getContext() {
197:                return (CompositeRenderContext) super .getContext();
198:            }
199:
200:            protected void resyncState(Renderer renderer) {
201:                //        if (getContext() == null)
202:                //            return;
203:                //        List<IRenderContext> contexts = getContext().getContexts();
204:                //        synchronized (contexts) {
205:                //            for( IRenderContext context : contexts ) {
206:                //                setLayerState(context, renderer.getState());
207:                //            }
208:                //        }
209:
210:            }
211:
212:            /**
213:             * @see net.refractions.udig.project.internal.render.impl.RendererImpl#getInfo(Point, Layer)
214:             *      public InfoList getInfo(Point screenLocation) throws IOException { return
215:             *      renderer.getInfo(screenLocation); }
216:             */
217:
218:            protected LayerListener getLayerListener() {
219:                return new MultiLayerRendererLayerListener(this );
220:            }
221:
222:            protected RendererListener getRendererListener() {
223:                return new MultiLayerRendererListener(this );
224:            }
225:
226:            /**
227:             * @see net.refractions.udig.project.internal.render.impl.RenderExecutorImpl#visit(net.refractions.udig.project.render.ExecutorVisitor)
228:             */
229:            public void visit(ExecutorVisitor visitor) {
230:                visitor.visit(this );
231:            }
232:
233:            @Override
234:            public String toString() {
235:                return super .toString();
236:            }
237:
238:            @Override
239:            public void dispose() {
240:
241:                for (Layer layer : getContext().getMapInternal()
242:                        .getLayersInternal()) {
243:                    layer.eAdapters().remove(listener);
244:                }
245:                super.dispose();
246:            }
247:        }
w__w_w_.__j_a___v__a___2s___._c__o___m___ | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.