Source Code Cross Referenced for LienSGBD.java in  » GIS » GeOxygene-1.3 » fr » ign » cogit » geoxygene » contrib » appariement » stockageLiens » 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.contrib.appariement.stockageLiens 
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.contrib.appariement.stockageLiens;
028:
029:        import java.util.Iterator;
030:        import java.util.List;
031:        import java.util.StringTokenizer;
032:
033:        import fr.ign.cogit.geoxygene.contrib.appariement.Lien;
034:        import fr.ign.cogit.geoxygene.feature.FT_Feature;
035:        import fr.ign.cogit.geoxygene.feature.Population;
036:
037:        /**
038:         * Liens stockables dans le SGBD
039:         * Resultat de l'appariement : lien entre objets de BDref et objets de BDcomp.
040:         * Un lien a aussi une géométrie qui est sa représentation graphique.
041:         * 
042:         * @author Eric Grosso - IGN / Laboratoire COGIT
043:         * @version 1.0
044:         * 
045:         */
046:
047:        public class LienSGBD extends FT_Feature {
048:
049:            /** Les objets de Reference pointés par le lien */
050:            protected String objetsRef;
051:
052:            public String getObjetsRef() {
053:                return objetsRef;
054:            }
055:
056:            public void setObjetsRef(String liste) {
057:                objetsRef = liste;
058:            }
059:
060:            /** Les objets de Comparaison pointés par le lien */
061:            protected String objetsComp;
062:
063:            public String getObjetsComp() {
064:                return objetsComp;
065:            }
066:
067:            public void setObjetsComp(String liste) {
068:                objetsComp = liste;
069:            }
070:
071:            /** Estimation de la qualité du lien d'appariement 
072:             * (mapping fait avec la table Representation_Lien au besoin)*/
073:            private double evaluation;
074:
075:            public double getEvaluation() {
076:                return evaluation;
077:            }
078:
079:            public void setEvaluation(double evaluation) {
080:                this .evaluation = evaluation;
081:            }
082:
083:            /** Liste d'indicateurs temporaires utilisés pendant les calculs d'appariement */
084:            protected String indicateurs;
085:
086:            public String getIndicateurs() {
087:                return indicateurs;
088:            }
089:
090:            public void setIndicateurs(String indicateurs) {
091:                this .indicateurs = indicateurs;
092:            }
093:
094:            /** Texte libre 
095:             * (mapping fait avec la table Representation_Lien au besoin)*/
096:            protected String commentaire = new String();
097:
098:            public String getCommentaire() {
099:                return commentaire;
100:            }
101:
102:            public void setCommentaire(String commentaire) {
103:                this .commentaire = commentaire;
104:            }
105:
106:            /** Texte libre pour décrire le nom de l'appariement.  
107:             * (mapping fait avec la table Representation_Lien au besoin)*/
108:            protected String nom = new String();
109:
110:            public String getNom() {
111:                return nom;
112:            }
113:
114:            public void setNom(String nom) {
115:                this .nom = nom;
116:            }
117:
118:            /** Texte libre pour décrire le type d'appariement (ex. "Noeud-Noeud"). 
119:             * (mapping fait avec la table Representation_Lien au besoin)*/
120:            protected String type = new String();
121:
122:            public String getType() {
123:                return type;
124:            }
125:
126:            public void setType(String type) {
127:                this .type = type;
128:            }
129:
130:            /** Texte libre pour décrire les objets de référence pointés. 
131:             * (mapping fait avec la table Representation_Lien au besoin)*/
132:            protected String reference = new String();
133:
134:            public String getReference() {
135:                return reference;
136:            }
137:
138:            public void setReference(String reference) {
139:                this .reference = reference;
140:            }
141:
142:            /** Texte libre pour décrire les objets de comparaison pointés.
143:             * (mapping fait avec la table Representation_Lien au besoin)*/
144:            protected String comparaison = new String();
145:
146:            public String getComparaison() {
147:                return comparaison;
148:            }
149:
150:            public void setComparaison(String comparaison) {
151:                this .comparaison = comparaison;
152:            }
153:
154:            /**Methode de conversion entre les liens d'appariement vers les liens SGBD */
155:            public LienSGBD conversionLiensVersSGBD(Lien lien) {
156:                List objetsRef = lien.getObjetsRef(), objetsComp = lien
157:                        .getObjetsComp(), indic = lien.getIndicateurs();
158:                Iterator itRef = objetsRef.iterator(), itComp = objetsComp
159:                        .iterator(), itIndic = indic.iterator();
160:
161:                FT_Feature feature;
162:                String formatRef = "", formatComp = "", formatIndic = "", classe = "";
163:
164:                //Reference
165:                while (itRef.hasNext()) {
166:                    feature = (FT_Feature) itRef.next();
167:                    classe = feature.getClass().getName();
168:                    if (formatRef.contains(classe) && formatRef.length() != 0)
169:                        formatRef = formatRef.replaceAll(classe, classe + " "
170:                                + feature.getId());
171:                    else {
172:                        formatRef = formatRef + classe + " " + feature.getId()
173:                                + "|";
174:                        this .getEnsembleLiensSGBD().getListePop().add(classe);
175:                    }
176:                }
177:                formatRef = formatRef.substring(0, formatRef.length() - 1);
178:                this .setObjetsRef(formatRef);
179:
180:                //Comparaison
181:                while (itComp.hasNext()) {
182:                    feature = (FT_Feature) itComp.next();
183:                    classe = feature.getClass().getName();
184:                    if (formatComp.contains(classe) && formatComp.length() != 0)
185:                        formatComp = formatComp.replaceAll(classe, classe + " "
186:                                + feature.getId());
187:                    else {
188:                        formatComp = formatComp + classe + " "
189:                                + feature.getId() + "|";
190:                        this .getEnsembleLiensSGBD().getListePop().add(classe);
191:                    }
192:                }
193:                formatComp = formatComp.substring(0, formatComp.length() - 1);
194:                this .setObjetsComp(formatComp);
195:
196:                //Indicateurs
197:                while (itIndic.hasNext()) {
198:                    formatIndic = formatIndic + (String) itIndic.next() + "|";
199:                }
200:                if (formatIndic.length() > 0)
201:                    this .setIndicateurs(formatIndic.substring(0, formatIndic
202:                            .length() - 1));
203:                else
204:                    this .setIndicateurs("Non renseigné");
205:
206:                //evaluation
207:                this .setEvaluation(lien.getEvaluation());
208:
209:                //commentaire
210:                if (lien.getCommentaire().length() == 0)
211:                    this .setCommentaire("Non renseigné");
212:                else
213:                    this .setCommentaire(lien.getCommentaire());
214:
215:                //nom
216:                if (lien.getNom().length() == 0)
217:                    this .setNom("Non renseigné");
218:                else
219:                    this .setNom(lien.getNom());
220:
221:                //type
222:                if (lien.getType().length() == 0)
223:                    this .setType("Non renseigné");
224:                else
225:                    this .setType(lien.getType());
226:
227:                //reference
228:                if (lien.getReference().length() == 0)
229:                    this .setReference("Non renseigné");
230:                else
231:                    this .setReference(lien.getReference());
232:
233:                //comparaison
234:                if (lien.getComparaison().length() == 0)
235:                    this .setComparaison("Non renseigné");
236:                else
237:                    this .setComparaison(lien.getComparaison());
238:
239:                //geometrie
240:                this .setGeom(lien.getGeom());
241:
242:                return this ;
243:            }
244:
245:            /**Methode de conversion entre les liens SGBD vers les liens d'appariement  */
246:            @SuppressWarnings("unchecked")
247:            public Lien conversionSGBDVersLiens() {
248:                Lien lien = new Lien();
249:
250:                //reference
251:                String formatRef = this .getObjetsRef(), valeurRef, valeurRefClass, valeurRefIds, valeurRefId;
252:                StringTokenizer tokenRef = new StringTokenizer(formatRef, "|");
253:                StringTokenizer tokenRefId;
254:                Population population;
255:                FT_Feature feature;
256:                List<Population> liste = this .getEnsembleLiensSGBD()
257:                        .getListePopulations();
258:                while (tokenRef.hasMoreElements()) {
259:                    valeurRef = tokenRef.nextToken();
260:                    valeurRefClass = valeurRef.substring(0, valeurRef
261:                            .indexOf(" "));
262:                    valeurRefIds = valeurRef.replaceFirst(valeurRefClass, "");
263:                    tokenRefId = new StringTokenizer(valeurRefIds, " ");
264:                    Iterator<Population> it = liste.iterator();
265:                    while (it.hasNext()) {
266:                        population = it.next();
267:                        if (valeurRefClass.equals(population.getNomClasse())) {
268:                            while (tokenRefId.hasMoreElements()) {
269:                                valeurRefId = tokenRefId.nextToken();
270:                                int id = new Integer(valeurRefId).intValue();
271:                                Iterator<FT_Feature> itPop = population
272:                                        .getElements().iterator();
273:                                while (itPop.hasNext()) {
274:                                    feature = itPop.next();
275:                                    if (id == feature.getId()) {
276:                                        lien.addObjetRef(feature);
277:                                        break;
278:                                    }
279:                                }
280:                            }
281:                            break;
282:                        }
283:                    }
284:                }
285:
286:                //comparaison
287:                String formatComp = this .getObjetsComp(), valeurComp, valeurCompClass, valeurCompIds, valeurCompId;
288:                StringTokenizer tokenComp = new StringTokenizer(formatComp, "|");
289:                StringTokenizer tokenCompId;
290:                while (tokenComp.hasMoreElements()) {
291:                    valeurComp = tokenComp.nextToken();
292:                    valeurCompClass = valeurComp.substring(0, valeurComp
293:                            .indexOf(" "));
294:                    valeurCompIds = valeurComp
295:                            .replaceFirst(valeurCompClass, "");
296:                    tokenCompId = new StringTokenizer(valeurCompIds, " ");
297:                    Iterator<Population> it = liste.iterator();
298:                    while (it.hasNext()) {
299:                        population = it.next();
300:                        if (valeurCompClass.equals(population.getNomClasse())) {
301:                            while (tokenCompId.hasMoreElements()) {
302:                                valeurCompId = tokenCompId.nextToken();
303:                                int id = new Integer(valeurCompId).intValue();
304:                                Iterator<FT_Feature> itPop = population
305:                                        .getElements().iterator();
306:                                while (itPop.hasNext()) {
307:                                    feature = itPop.next();
308:                                    if (id == feature.getId()) {
309:                                        lien.addObjetComp(feature);
310:                                        break;
311:                                    }
312:                                }
313:                            }
314:                            break;
315:                        }
316:                    }
317:                }
318:
319:                //Indicateurs
320:                String formatIndic = this .getIndicateurs(), valeurIndic;
321:                StringTokenizer tokenIndic = new StringTokenizer(formatIndic,
322:                        "|");
323:                while (tokenIndic.hasMoreElements()) {
324:                    valeurIndic = tokenIndic.nextToken();
325:                    lien.addIndicateur(valeurIndic);
326:                }
327:
328:                //evaluation
329:                lien.setEvaluation(this .getEvaluation());
330:
331:                //commentaire
332:                lien.setCommentaire(this .getCommentaire());
333:
334:                //nom
335:                lien.setNom(this .getNom());
336:
337:                //type
338:                lien.setType(this .getType());
339:
340:                //reference
341:                lien.setReference(this .getReference());
342:
343:                //comparaison
344:                lien.setComparaison(this .getComparaison());
345:
346:                //geometrie
347:                lien.setGeom(this .getGeom());
348:
349:                return lien;
350:            }
351:
352:            //////////////////////////////////////
353:            private EnsembleDeLiensSGBD ensembleLiensSGBD;
354:
355:            /** Récupère l'objet en relation. */
356:            public EnsembleDeLiensSGBD getEnsembleLiensSGBD() {
357:                return ensembleLiensSGBD;
358:            }
359:
360:            /** Définit l'objet en relation, et met à jour la relation inverse. */
361:            public void setEnsembleLiensSGBD(EnsembleDeLiensSGBD ensemble) {
362:                EnsembleDeLiensSGBD old = ensembleLiensSGBD;
363:                ensembleLiensSGBD = ensemble;
364:                if (old != null)
365:                    old.getLiensSGBD().remove(this);
366:                if (ensemble != null) {
367:                    if (!ensemble.getLiensSGBD().contains(this))
368:                        ensemble.getLiensSGBD().add(this);
369:                }
370:            }
371:
372:        }
ww___w_._j___a_va_2___s.__c_o__m___ | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.