Source Code Cross Referenced for ObjectViewerThemeProperties.java in  » GIS » GeOxygene-1.3 » fr » ign » cogit » geoxygene » util » viewer » 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 » GeOxygene 1.3 » fr.ign.cogit.geoxygene.util.viewer 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * This file is part of the GeOxygene project source files. 
003:         * 
004:         * GeOxygene aims at providing an open framework which implements OGC/ISO specifications for 
005:         * the development and deployment of geographic (GIS) applications. It is a open source 
006:         * contribution of the COGIT laboratory at the Institut Géographique National (the French 
007:         * National Mapping Agency).
008:         * 
009:         * See: http://oxygene-project.sourceforge.net 
010:         *  
011:         * Copyright (C) 2005 Institut Géographique National
012:         *
013:         * This library is free software; you can redistribute it and/or modify it under the terms
014:         * of the GNU Lesser General Public License as published by the Free Software Foundation; 
015:         * either version 2.1 of the License, or any later version.
016:         *
017:         * This library is distributed in the hope that it will be useful, but WITHOUT ANY 
018:         * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A 
019:         * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
020:         *
021:         * You should have received a copy of the GNU Lesser General Public License along with 
022:         * this library (see file LICENSE if present); if not, write to the Free Software 
023:         * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
024:         *  
025:         */
026:
027:        package fr.ign.cogit.geoxygene.util.viewer;
028:
029:        import java.awt.Color;
030:        import java.util.Random;
031:
032:        import uk.ac.leeds.ccg.geotools.DataSource;
033:        import uk.ac.leeds.ccg.geotools.HSVShader;
034:        import uk.ac.leeds.ccg.geotools.HighlightManager;
035:        import uk.ac.leeds.ccg.geotools.LineLayer;
036:        import uk.ac.leeds.ccg.geotools.MonoShader;
037:        import uk.ac.leeds.ccg.geotools.PolygonLayer;
038:        import uk.ac.leeds.ccg.geotools.RandomShader;
039:        import uk.ac.leeds.ccg.geotools.SelectionManager;
040:        import uk.ac.leeds.ccg.geotools.ShadeStyle;
041:        import uk.ac.leeds.ccg.geotools.Shader;
042:        import uk.ac.leeds.ccg.geotools.Theme;
043:        import uk.ac.leeds.ccg.geotools.UniqueShader;
044:        import uk.ac.leeds.ccg.geotools.satShader;
045:
046:        /**
047:         * This class allow to handle properties of themes to be displayed in the (Geo)Object viewer.  
048:         *
049:         * @author Thierry Badard & Arnaud Braun
050:         * @version 1.0
051:         * 
052:         */
053:
054:        class ObjectViewerThemeProperties {
055:
056:            //Default
057:            public static final Color DEFAULT_OUTLINE_THEME_COLOR = Color.BLACK;
058:            public static final Color DEFAULT_SELECTION_COLOR = Color.YELLOW;
059:            public static final Color DEFAULT_HIGHLIGHT_COLOR = Color.GREEN;
060:            public static final Color DEFAULT_MISSING_VALUE_SHADER_COLOR = Color.WHITE;
061:            public static final int DEFAULT_MISSING_VALUE_SHADER = -999999999;
062:
063:            private ObjectViewerInterface objectViewerInterface;
064:            private Theme objectViewerTheme;
065:
066:            private String dataSourceType;
067:            private DataSource dataSource;
068:
069:            private Shader shader;
070:            private String shadedBy = null;
071:
072:            private Color fillInThemeColor;
073:            private Color outlineThemeColor;
074:            private Color fillInHighlightColor;
075:            private Color outlineHighlightColor;
076:            private Color fillInSelectionColor;
077:            private Color outlineSelectionColor;
078:
079:            private SelectionManager themeSelectionManager;
080:            private HighlightManager themeHighlightManager;
081:
082:            private boolean active;
083:            private boolean visible;
084:
085:            private ObjectViewerThemeProperties() {
086:
087:                // random color for filling it
088:                Random randomColor = new Random();
089:                float randomRed = randomColor.nextFloat();
090:                float randomGreen = randomColor.nextFloat();
091:                float randomBlue = randomColor.nextFloat();
092:                System.out.println("Theme Color (R: " + randomRed * 255
093:                        + ";G: " + randomGreen * 255 + ";B: " + randomBlue
094:                        * 255 + ")");
095:                Color randomShaderColor = new Color(randomRed, randomGreen,
096:                        randomBlue);
097:                setFillInThemeColor(randomShaderColor);
098:
099:                // default color
100:                setOutlineThemeColor(DEFAULT_OUTLINE_THEME_COLOR);
101:                setFillInHighlightColor(DEFAULT_HIGHLIGHT_COLOR);
102:                setOutlineHighlightColor(DEFAULT_HIGHLIGHT_COLOR);
103:                setFillInSelectionColor(DEFAULT_SELECTION_COLOR);
104:                setOutlineSelectionColor(DEFAULT_SELECTION_COLOR);
105:
106:            }
107:
108:            public ObjectViewerThemeProperties(
109:                    ObjectViewerInterface objectViewerInterface,
110:                    Theme objectViewerTheme, String dataSourceType,
111:                    DataSource datasource, boolean IsActive, boolean IsVisible) {
112:                this ();
113:                setObjectViewerInterface(objectViewerInterface);
114:                setObjectViewerTheme(objectViewerTheme);
115:                setDataSource(datasource);
116:                setDataSourceType(dataSourceType);
117:                setActive(IsActive);
118:                setVisible(IsVisible);
119:            }
120:
121:            public void setChanged() {
122:                Theme t = getObjectViewerTheme();
123:
124:                if ((t.getLayer() instanceof  PolygonLayer)
125:                        && (!(t.getLayer() instanceof  LineLayer))) {
126:                    ShadeStyle updatedThemeShadeStyle = new ShadeStyle();
127:                    updatedThemeShadeStyle.setLineColor(getOutlineThemeColor());
128:                    t.setStyle(updatedThemeShadeStyle);
129:                }
130:
131:                ShadeStyle updatedHighlightShadeStyle = new ShadeStyle();
132:                updatedHighlightShadeStyle
133:                        .setFillColor(getFillInHighlightColor());
134:                updatedHighlightShadeStyle
135:                        .setLineColor(getOutlineHighlightColor());
136:                t.setHighlightStyle(updatedHighlightShadeStyle);
137:
138:                ShadeStyle updatedSelectionShadeStyle = new ShadeStyle();
139:                updatedSelectionShadeStyle
140:                        .setFillColor(getFillInSelectionColor());
141:                updatedSelectionShadeStyle
142:                        .setLineColor(getOutlineSelectionColor());
143:                t.setSelectionStyle(updatedSelectionShadeStyle);
144:
145:                if (shader instanceof  MonoShader) {
146:                    MonoShader updatedShader = new MonoShader(
147:                            getFillInThemeColor());
148:                    t.setShader(updatedShader);
149:
150:                } else if (shader instanceof  RandomShader) {
151:                    RandomShader updatedShader = new RandomShader();
152:                    t.setShader(updatedShader);
153:
154:                } else if (shader instanceof  HSVShader) {
155:                    //HSVShader updatedShader = new HSVShader(DEFAULT_LOW_HSVSHADER_COLOR, DEFAULT_HIGH_HSVSHADER_COLOR); marche pas
156:                    satShader updatedShader = new satShader(
157:                            getFillInThemeColor());
158:                    updatedShader
159:                            .setMissingValueCode(DEFAULT_MISSING_VALUE_SHADER);
160:                    updatedShader
161:                            .setMissingValueColor(DEFAULT_MISSING_VALUE_SHADER_COLOR);
162:                    /*if (dataSourceType.equals(Utils.SHAPEFILE)) {
163:                    	System.out.println("Shader HSV with field = "+shadedBy);
164:                    	ShapefileReader shpRd = (ShapefileReader) dataSource;
165:                    	t = shpRd.getTheme(updatedShader,shadedBy);		
166:                    } a faire
167:                    
168:                    else */if (dataSourceType.equals(Utils.GEOXYGENE)) {
169:                        GeOxygeneReader geOxyRd = (GeOxygeneReader) dataSource;
170:                        t = geOxyRd.getTheme(updatedShader, shadedBy);
171:                    }
172:
173:                } else if (shader instanceof  UniqueShader) {
174:                    UniqueShader updatedShader = new UniqueShader();
175:                    updatedShader
176:                            .setMissingValueCode(DEFAULT_MISSING_VALUE_SHADER);
177:                    updatedShader
178:                            .setMissingValueColor(DEFAULT_MISSING_VALUE_SHADER_COLOR);
179:                    /*if (dataSourceType.equals(Utils.SHAPEFILE)) {
180:                    	a faire
181:                    }
182:                    	
183:                    else */if (dataSourceType.equals(Utils.GEOXYGENE)) {
184:                        GeOxygeneReader geOxyRd = (GeOxygeneReader) dataSource;
185:                        t = geOxyRd.getTheme(updatedShader, shadedBy);
186:                    }
187:                }
188:
189:                getObjectViewerInterface().view
190:                        .setThemeIsVisible(t, true, true);
191:
192:            }
193:
194:            public void setObjectViewerInterface(
195:                    ObjectViewerInterface objectViewerInterface) {
196:                this .objectViewerInterface = objectViewerInterface;
197:            }
198:
199:            public ObjectViewerInterface getObjectViewerInterface() {
200:                return objectViewerInterface;
201:            }
202:
203:            public void setFillInThemeColor(Color color) {
204:                this .fillInThemeColor = color;
205:            }
206:
207:            public Color getFillInThemeColor() {
208:                return fillInThemeColor;
209:            }
210:
211:            public void setOutlineThemeColor(Color color) {
212:                this .outlineThemeColor = color;
213:            }
214:
215:            public Color getOutlineThemeColor() {
216:                return outlineThemeColor;
217:            }
218:
219:            public void setFillInHighlightColor(Color color) {
220:                this .fillInHighlightColor = color;
221:            }
222:
223:            public Color getFillInHighlightColor() {
224:                return fillInHighlightColor;
225:            }
226:
227:            public void setOutlineHighlightColor(Color color) {
228:                this .outlineHighlightColor = color;
229:            }
230:
231:            public Color getOutlineHighlightColor() {
232:                return outlineHighlightColor;
233:            }
234:
235:            public void setFillInSelectionColor(Color color) {
236:                this .fillInSelectionColor = color;
237:            }
238:
239:            public Color getFillInSelectionColor() {
240:                return fillInSelectionColor;
241:            }
242:
243:            public void setOutlineSelectionColor(Color color) {
244:                this .outlineSelectionColor = color;
245:            }
246:
247:            public Color getOutlineSelectionColor() {
248:                return outlineSelectionColor;
249:            }
250:
251:            public void setObjectViewerTheme(Theme t) {
252:                this .objectViewerTheme = t;
253:            }
254:
255:            public Theme getObjectViewerTheme() {
256:                return objectViewerTheme;
257:            }
258:
259:            public String getDataSourceType() {
260:                return dataSourceType;
261:            }
262:
263:            public void setDataSourceType(String string) {
264:                dataSourceType = string;
265:            }
266:
267:            public DataSource getDataSource() {
268:                return dataSource;
269:            }
270:
271:            public void setDataSource(DataSource source) {
272:                dataSource = source;
273:            }
274:
275:            public void setShader(Shader sh) {
276:                shader = sh;
277:            }
278:
279:            public void setShader(Shader sh, String field) {
280:                shader = sh;
281:                if (field != null)
282:                    shadedBy = field;
283:                else
284:                    field = null;
285:            }
286:
287:            public Shader getShader() {
288:                return shader;
289:            }
290:
291:            public String getShadedBy() {
292:                return shadedBy;
293:            }
294:
295:            public boolean isActive() {
296:                return active;
297:            }
298:
299:            public void setActive(boolean b) {
300:                active = b;
301:            }
302:
303:            public HighlightManager getThemeHighlightManager() {
304:                return themeHighlightManager;
305:            }
306:
307:            public void setThemeHighlightManager(HighlightManager manager) {
308:                themeHighlightManager = manager;
309:            }
310:
311:            public SelectionManager getThemeSelectionManager() {
312:                return themeSelectionManager;
313:            }
314:
315:            public void setThemeSelectionManager(SelectionManager manager) {
316:                themeSelectionManager = manager;
317:            }
318:
319:            public boolean isVisible() {
320:                return visible;
321:            }
322:
323:            public void setVisible(boolean b) {
324:                visible = b;
325:            }
326:
327:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.