Source Code Cross Referenced for ExempleConstruction.java in  » GIS » GeOxygene-1.3 » fr » ign » cogit » geoxygene » contrib » cartetopo » exemple » 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.cartetopo.exemple 
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.cartetopo.exemple;
028:
029:        import fr.ign.cogit.geoxygene.spatial.coordgeom.DirectPosition;
030:        import fr.ign.cogit.geoxygene.spatial.coordgeom.DirectPositionList;
031:        import fr.ign.cogit.geoxygene.util.viewer.ObjectViewer;
032:
033:        /**
034:         * Exemple de construction et d'utilisation d'une carte topo simple, héritée
035:         * du schéma générique de la cartetopo.
036:         * 
037:         * La carte topo en question est definie par heritage à partir des
038:         * classes du package : MonNoeud, MonArc, MaFace, MaCarteTopo (on n'utilise
039:         * pas de groupes dans cet exemple).
040:         * 
041:         * La seule petite difficulté est d'indiquer dans le code que
042:         * MaCarteTopo est constitueé d'objets MonNoeud, MonArc et MaFace
043:         * plutôt que les génériques Noeud, Arc et Face. Cette opération doit
044:         * se faire par un constructeur spécial dans la classe MaCarteTopo.
045:         * 
046:         * NB: il est bien entendu possible d'uiliser une cartetopo par défaut si
047:         * la surcharge des classes arcs, noeuds et faces n'est pas necessaire
048:         * dans l'application.
049:         * 
050:         * English: Example of cartetopo construction.
051:         * 
052:         * 
053:         * @author Bonin
054:         * @version 1.0
055:         */
056:
057:        public class ExempleConstruction {
058:
059:            public static void main(String[] args) {
060:                // On crée une carte de type MaCarteTopo
061:                MaCarteTopo ct = new MaCarteTopo("Exemple");
062:
063:                // On ajoute à la carte ct des noeuds et des arcs
064:                MonNoeud n1 = new MonNoeud();
065:                n1.setCoord(new DirectPosition(0., 0., 0.));
066:                ct.addNoeud(n1);
067:                MonNoeud n2 = new MonNoeud();
068:                n2.setCoord(new DirectPosition(3., 1., 0.));
069:                ct.addNoeud(n2);
070:                MonNoeud n3 = new MonNoeud();
071:                n3.setCoord(new DirectPosition(1., 1., 0.));
072:                ct.addNoeud(n3);
073:                MonNoeud n4 = new MonNoeud();
074:                n4.setCoord(new DirectPosition(1., -1., 0.));
075:                ct.addNoeud(n4);
076:
077:                MonArc a1 = new MonArc();
078:                DirectPositionList dpl1 = new DirectPositionList();
079:                dpl1.add(new DirectPosition(1., -1., 0.));
080:                dpl1.add(new DirectPosition(1., 1., 0.));
081:                a1.setCoord(dpl1);
082:                ct.addArc(a1);
083:
084:                MonArc a2 = new MonArc();
085:                DirectPositionList dpl2 = new DirectPositionList();
086:                dpl2.add(new DirectPosition(0., 0., 0.));
087:                dpl2.add(new DirectPosition(1., 1., 0.));
088:                a2.setCoord(dpl2);
089:                ct.addArc(a2);
090:
091:                MonArc a3 = new MonArc();
092:                DirectPositionList dpl3 = new DirectPositionList();
093:                dpl3.add(new DirectPosition(1., 1., 0.));
094:                dpl3.add(new DirectPosition(3., 1., 0.));
095:                a3.setCoord(dpl3);
096:                ct.addArc(a3);
097:
098:                MonArc a4 = new MonArc();
099:                DirectPositionList dpl4 = new DirectPositionList();
100:                dpl4.add(new DirectPosition(3., 1., 0.));
101:                dpl4.add(new DirectPosition(1., -1., 0.));
102:                a4.setCoord(dpl4);
103:                ct.addArc(a4);
104:
105:                MonArc a5 = new MonArc();
106:                DirectPositionList dpl5 = new DirectPositionList();
107:                dpl5.add(new DirectPosition(1., -1., 0.));
108:                dpl5.add(new DirectPosition(0., 0., 0.));
109:                a5.setCoord(dpl5);
110:                ct.addArc(a5);
111:
112:                // Calcul de la topologie arc/noeuds (relations noeud initial/noeud final
113:                // pour chaque arete) a l'aide de la géometrie.
114:                ct.creeTopologieArcsNoeuds(0.1);
115:
116:                // Calcul de la topologie de carte topologique (relations face gauche /
117:                // face droite pour chaque arete) avec les faces définies comme des 
118:                // cycles du graphe.
119:                ct.creeTopologieFaces();
120:
121:                // Affichage du nombre de faces
122:                System.out.println("Nombre de faces de la carte : "
123:                        + ct.getListeFaces().size());
124:
125:                // Affichage des coordonnees du noeud initial et du noeud final du premier arc
126:                MonArc arc = (MonArc) ct.getListeArcs().get(0);
127:                System.out.println("Noeud initial de a0 : "
128:                        + arc.getNoeudIni().getCoord());
129:                System.out.println("Noeud final de a0   : "
130:                        + arc.getNoeudFin().getCoord());
131:
132:                // Calcul de la superficie des deux faces
133:                MaFace face = (MaFace) ct.getListeFaces().get(0);
134:                System.out.println("Superficie de f0 : "
135:                        + face.getGeom().area());
136:                face = (MaFace) ct.getListeFaces().get(1);
137:                System.out.println("Superficie de f1 : "
138:                        + face.getGeom().area());
139:
140:                // Visualisation des données
141:                ObjectViewer obj = new ObjectViewer();
142:                // Note : on utilise ici ct.getPopNoeuds() pour afficher. Pour la manipulation,
143:                // il est préférable d'utiliser ct.getListenoeuds() 
144:                // (=ct.getPopNoeuds().getElements()) qui renvoie directement une liste.
145:                obj.addFeatureCollection(ct.getPopFaces(), "Faces");
146:                obj.addFeatureCollection(ct.getPopArcs(), "Arcs");
147:                obj.addFeatureCollection(ct.getPopNoeuds(), "Noeuds");
148:
149:            }
150:
151:        }
w_ww__._j_a__v___a___2s___.com___ | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.