Source Code Cross Referenced for RendererImpl.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:         * <copyright></copyright> $Id: RendererImpl.java 23718 2007-01-09 00:46:46Z jeichar $
003:         */package net.refractions.udig.project.internal.render.impl;
004:
005:        import java.awt.Graphics2D;
006:        import java.awt.Rectangle;
007:        import java.text.MessageFormat;
008:
009:        import net.refractions.udig.project.ILayer;
010:        import net.refractions.udig.project.internal.Messages;
011:        import net.refractions.udig.project.internal.ProjectPlugin;
012:        import net.refractions.udig.project.internal.Trace;
013:        import net.refractions.udig.project.internal.render.RenderPackage;
014:        import net.refractions.udig.project.internal.render.Renderer;
015:        import net.refractions.udig.project.internal.render.SelectionLayer;
016:        import net.refractions.udig.project.render.IRenderContext;
017:        import net.refractions.udig.project.render.IRenderer;
018:        import net.refractions.udig.project.render.RenderException;
019:
020:        import org.eclipse.core.runtime.IProgressMonitor;
021:        import org.eclipse.emf.common.notify.Notification;
022:        import org.eclipse.emf.ecore.EClass;
023:        import org.eclipse.emf.ecore.EStructuralFeature;
024:        import org.eclipse.emf.ecore.impl.ENotificationImpl;
025:        import org.eclipse.emf.ecore.impl.EObjectImpl;
026:
027:        import com.vividsolutions.jts.geom.Coordinate;
028:        import com.vividsolutions.jts.geom.Envelope;
029:
030:        /**
031:         * Abstract class for Renderers to extend.
032:         * @author Jesse
033:         * @since 1.0.0
034:         * @generated
035:         */
036:        public abstract class RendererImpl extends EObjectImpl implements 
037:                Renderer {
038:            /**
039:             * <!-- begin-user-doc --> <!-- end-user-doc -->
040:             * 
041:             * @generated
042:             */
043:            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$
044:
045:            /**
046:             * The default value of the '{@link #getState() <em>State</em>}' attribute. <!--
047:             * begin-user-doc --> <!-- end-user-doc -->
048:             * 
049:             * @see #getState()
050:             * @generated NOT
051:             * @ordered
052:             */
053:            protected static final int STATE_EDEFAULT = NEVER;
054:
055:            /**
056:             * The cached value of the '{@link #getState() <em>State</em>}' attribute. <!-- begin-user-doc
057:             * --> <!-- end-user-doc -->
058:             * 
059:             * @see #getState()
060:             * @generated
061:             * @ordered
062:             */
063:            protected int state = STATE_EDEFAULT;
064:
065:            /**
066:             * The default value of the '{@link #getName() <em>Name</em>}' attribute. <!-- begin-user-doc
067:             * --> <!-- end-user-doc -->
068:             * 
069:             * @see #getName()
070:             * @generated
071:             * @ordered
072:             */
073:            protected static final String NAME_EDEFAULT = null;
074:
075:            /**
076:             * The cached value of the '{@link #getName() <em>Name</em>}' attribute. <!-- begin-user-doc
077:             * --> <!-- end-user-doc -->
078:             * 
079:             * @see #getName()
080:             * @generated
081:             * @ordered
082:             */
083:            protected String name = NAME_EDEFAULT;
084:
085:            /**
086:             * The cached value of the '{@link #getContext() <em>Context</em>}' reference. <!--
087:             * begin-user-doc --> <!-- end-user-doc -->
088:             * 
089:             * @see #getContext()
090:             * @generated
091:             * @ordered
092:             */
093:            protected volatile IRenderContext context = null;
094:
095:            private volatile Envelope renderbounds;
096:
097:            /**
098:             * <!-- begin-user-doc --> <!-- end-user-doc -->
099:             * 
100:             * @generated
101:             */
102:            protected RendererImpl() {
103:                super ();
104:            }
105:
106:            /**
107:             * <!-- begin-user-doc --> <!-- end-user-doc -->
108:             * 
109:             * @generated
110:             */
111:            protected EClass eStaticClass() {
112:                return RenderPackage.eINSTANCE.getRenderer();
113:            }
114:
115:            /**
116:             * @see net.refractions.udig.project.internal.render.Renderer#getName()
117:             * @uml.property name="name"
118:             */
119:            public String getName() {
120:                if (name == null) {
121:                    ILayer layer = getContext().getLayer();
122:                    if (layer == null)
123:                        return ""; //$NON-NLS-1$
124:                    if (layer instanceof  SelectionLayer)
125:                        return MessageFormat.format(
126:                                Messages.RendererImpl_selectionFor,
127:                                new Object[] { layer.getName() });
128:                    else
129:                        return layer.getName();
130:                } else
131:                    return name;
132:            }
133:
134:            /**
135:             * <!-- begin-user-doc --> <!-- end-user-doc -->
136:             * 
137:             * @generated
138:             */
139:            public void setName(String newName) {
140:                String oldName = name;
141:                name = newName;
142:                if (eNotificationRequired())
143:                    eNotify(new ENotificationImpl(this , Notification.SET,
144:                            RenderPackage.RENDERER__NAME, oldName, name));
145:            }
146:
147:            /**
148:             * <!-- begin-user-doc --> <!-- end-user-doc -->
149:             * 
150:             * @generated
151:             */
152:            public int getState() {
153:                return state;
154:            }
155:
156:            /**
157:             * <!-- begin-user-doc --> <!-- end-user-doc -->
158:             * 
159:             * @generated
160:             */
161:            public void setState(int newState) {
162:                //        if( newState==state)
163:                //            return;
164:                int oldState = state;
165:                state = newState;
166:                if (eNotificationRequired())
167:                    eNotify(new ENotificationImpl(this , Notification.SET,
168:                            RenderPackage.RENDERER__STATE, oldState, state));
169:            }
170:
171:            public IRenderContext getContext() {
172:                return context;
173:            }
174:
175:            public void setContext(IRenderContext newContext) {
176:                ProjectPlugin
177:                        .trace(
178:                                Trace.RENDER,
179:                                getClass(),
180:                                "RenderContext changed. \nOld:" + context + "\nNew:" + newContext, null); //$NON-NLS-1$ //$NON-NLS-2$
181:                context = newContext;
182:            }
183:
184:            /**
185:             * <!-- begin-user-doc -->
186:             * <!-- end-user-doc -->
187:             * 
188:             * @throws RenderException
189:             * @generated NOT
190:             */
191:            public abstract void render(Graphics2D destination,
192:                    IProgressMonitor monitor) throws RenderException;
193:
194:            public abstract void render(IProgressMonitor monitor)
195:                    throws RenderException;
196:
197:            /**
198:             * <!-- begin-user-doc --> <!-- end-user-doc -->
199:             * 
200:             * @generated public InfoList getInfo(Point screenLocation) { // TODO: implement this method //
201:             *            Ensure that you remove
202:             * @generated or mark it
203:             * @generated NOT throw new UnsupportedOperationException(); }
204:             */
205:
206:            /**
207:             * <!-- begin-user-doc --> <!-- end-user-doc -->
208:             * 
209:             * @generated NOT
210:             */
211:            public void dispose() {
212:                // do nothing
213:            }
214:
215:            /**
216:             * <!-- begin-user-doc --> <!-- end-user-doc -->
217:             * 
218:             * @generated
219:             */
220:            public Object eGet(EStructuralFeature eFeature, boolean resolve) {
221:                switch (eDerivedStructuralFeatureID(eFeature)) {
222:                case RenderPackage.RENDERER__STATE:
223:                    return new Integer(getState());
224:                case RenderPackage.RENDERER__NAME:
225:                    return getName();
226:                case RenderPackage.RENDERER__CONTEXT:
227:                    return getContext();
228:                }
229:                return eDynamicGet(eFeature, resolve);
230:            }
231:
232:            /**
233:             * <!-- begin-user-doc --> <!-- end-user-doc -->
234:             * 
235:             * @generated
236:             */
237:            public void eSet(EStructuralFeature eFeature, Object newValue) {
238:                switch (eDerivedStructuralFeatureID(eFeature)) {
239:                case RenderPackage.RENDERER__STATE:
240:                    setState(((Integer) newValue).intValue());
241:                    return;
242:                case RenderPackage.RENDERER__NAME:
243:                    setName((String) newValue);
244:                    return;
245:                case RenderPackage.RENDERER__CONTEXT:
246:                    setContext((IRenderContext) newValue);
247:                    return;
248:                }
249:                eDynamicSet(eFeature, newValue);
250:            }
251:
252:            /**
253:             * <!-- begin-user-doc --> <!-- end-user-doc -->
254:             * 
255:             * @generated
256:             */
257:            public void eUnset(EStructuralFeature eFeature) {
258:                switch (eDerivedStructuralFeatureID(eFeature)) {
259:                case RenderPackage.RENDERER__STATE:
260:                    setState(STATE_EDEFAULT);
261:                    return;
262:                case RenderPackage.RENDERER__NAME:
263:                    setName(NAME_EDEFAULT);
264:                    return;
265:                case RenderPackage.RENDERER__CONTEXT:
266:                    setContext((IRenderContext) null);
267:                    return;
268:                }
269:                eDynamicUnset(eFeature);
270:            }
271:
272:            /**
273:             * <!-- begin-user-doc --> <!-- end-user-doc -->
274:             * 
275:             * @generated
276:             */
277:            public boolean eIsSet(EStructuralFeature eFeature) {
278:                switch (eDerivedStructuralFeatureID(eFeature)) {
279:                case RenderPackage.RENDERER__STATE:
280:                    return state != STATE_EDEFAULT;
281:                case RenderPackage.RENDERER__NAME:
282:                    return NAME_EDEFAULT == null ? name != null
283:                            : !NAME_EDEFAULT.equals(name);
284:                case RenderPackage.RENDERER__CONTEXT:
285:                    return context != null;
286:                }
287:                return eDynamicIsSet(eFeature);
288:            }
289:
290:            /**
291:             * <!-- begin-user-doc --> <!-- end-user-doc -->
292:             * 
293:             * @generated
294:             */
295:            public String toString() {
296:                if (eIsProxy())
297:                    return super .toString();
298:
299:                StringBuffer result = new StringBuffer(super .toString());
300:                result.append(" (state: "); //$NON-NLS-1$
301:                result.append(state);
302:                result.append(", name: "); //$NON-NLS-1$
303:                result.append(name);
304:                result.append(')');
305:                return result.toString();
306:            }
307:
308:            /**
309:             * Default renderer may be cached.
310:             */
311:            public boolean isCacheable() {
312:                return true;
313:            }
314:
315:            public synchronized void setRenderBounds(Envelope boundsToRender) {
316:                if (state == IRenderer.RENDERING || state == IRenderer.NEVER
317:                        || state == IRenderer.STARTING) {
318:                    if (boundsToRender == null || renderbounds != null
319:                            && !renderbounds.contains(boundsToRender)) {
320:                        renderbounds = boundsToRender;
321:                    }
322:                } else
323:                    renderbounds = boundsToRender;
324:            }
325:
326:            public synchronized void setRenderBounds(Rectangle screenArea) {
327:
328:                Coordinate min = getContext().pixelToWorld(screenArea.x,
329:                        screenArea.y);
330:                Coordinate max = getContext().pixelToWorld(
331:                        screenArea.width + screenArea.x,
332:                        screenArea.height + screenArea.y);
333:                setRenderBounds(new Envelope(min, max));
334:            }
335:
336:            public synchronized Envelope getRenderBounds() {
337:                return renderbounds;
338:            }
339:
340:        } // RendererImpl
ww_w._java___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.