Source Code Cross Referenced for TP_Face.java in  » GIS » GeOxygene-1.3 » fr » ign » cogit » geoxygene » spatial » topoprim » 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.spatial.topoprim 
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.spatial.topoprim;
028:
029:        import java.util.ArrayList;
030:        import java.util.Collection;
031:        import java.util.Iterator;
032:        import java.util.List;
033:
034:        /**
035:         * Face topologique (orientation positive).
036:         * <P> L'operation "CoBoundary" redefinie sur TP_Object renvoie ici une sequence de TP_DirectedSolid, indiquant quels solides ont self pour frontiere. 
037:         * Cette operation est aussi une association. Ceci n'est pas implemente.
038:         * <P> L'operation "Boundary" redefinie sur TP_Object renvoie une liste de TP_DirectedEdge avec les orientations adequates. Cette liste est structuree en TP_FaceBoundary.
039:         *
040:         * EXPLIQUER LA STRUCTURE DE GRAPHE
041:         * A REVOIR POUR LES TROUS (ne pas utliser le container)
042:         *
043:         * @author Thierry Badard, Arnaud Braun & Audrey Simon
044:         * @version 1.0
045:         * 
046:         */
047:
048:        public class TP_Face extends TP_DirectedFace {
049:
050:            /** Les 2 primitives orientees de this. */
051:            // hesitation sur le fait : proxy[0] = this ou proxy[0] = new TP_DirectedFace(id) + proxy[0].topo = this        
052:            protected TP_DirectedFace[] proxy;
053:
054:            /////////////////////////////////////////////////////////////////////////////////////
055:            // constructeur /////////////////////////////////////////////////////////////////////
056:            /////////////////////////////////////////////////////////////////////////////////////            
057:            public TP_Face() {
058:                orientation = +1;
059:                proxy = new TP_DirectedFace[2];
060:                proxy[0] = this ;
061:                topo = this ;
062:                proxy[1] = new TP_DirectedFace();
063:                proxy[1].topo = this ;
064:                proxy[1].orientation = -1;
065:            }
066:
067:            // redefinition pour affecter un bon id au proxy negatif       
068:            public void setId(int Id) {
069:                super .setId(Id);
070:                proxy[1].setId(-Id);
071:                //if (Id<0) System.out.println("TP_Face::setId(id) : L'identifiant doit être positif");
072:            }
073:
074:            /////////////////////////////////////////////////////////////////////////////////////
075:            // asTP_DirectedTopo() //////////////////////////////////////////////////////////////
076:            /////////////////////////////////////////////////////////////////////////////////////        
077:            /** Renvoie le TP_DirectedFace d'orientation "sign". "sign" doit valoir +1 ou -1, sinon renvoie null. */
078:            public TP_DirectedFace asTP_DirectedTopo(int sign) {
079:                if (sign == +1)
080:                    return proxy[0];
081:                else if (sign == -1)
082:                    return proxy[1];
083:                else {
084:                    System.out
085:                            .println("TP_Face::asTP_DirectedTopo(sign) : Passer +1 ou -1 en paramètre.");
086:                    return null;
087:                }
088:            }
089:
090:            /////////////////////////////////////////////////////////////////////////////////////
091:            // isolated in (relation inverse de container) //////////////////////////////////////
092:            /////////////////////////////////////////////////////////////////////////////////////     
093:            /** Relation inverse de container sur TP_Node. */
094:            public Collection isolated = new ArrayList();
095:
096:            public Collection getIsolated() {
097:                return isolated;
098:            };
099:
100:            public void setIsolated(Collection c) {
101:                isolated = c;
102:            }
103:
104:            public void addIsolated(TP_Node node) {
105:                if (node != null) {
106:                    isolated.add(node);
107:                    if (node.getContainer() != this )
108:                        node.setContainer(this );
109:                }
110:            }
111:
112:            /////////////////////////////////////////////////////////////////////////////////////
113:            // boundary /////////////////////////////////////////////////////////////////////////
114:            ///////////////////////////////////////////////////////////////////////////////////// 
115:            /** Les TP_Edge qui ont this pour face gauche. */
116:            public Collection left = new ArrayList();
117:
118:            public Collection getLeft() {
119:                return left;
120:            };
121:
122:            public void addLeft(TP_Edge edge) {
123:                if (edge != null) {
124:                    left.add(edge);
125:                    if (edge.getLeftface() != this )
126:                        edge.setLeftface(this );
127:                }
128:            }
129:
130:            /** Les TP_Edge qui ont this pour face droite. */
131:            public Collection right = new ArrayList();
132:
133:            public Collection getRight() {
134:                return right;
135:            }
136:
137:            public void addRight(TP_Edge edge) {
138:                if (edge != null) {
139:                    right.add(edge);
140:                    if (edge.getRightface() != this )
141:                        edge.setRightface(this );
142:                }
143:            }
144:
145:            /** Renvoie les TP_DirectedEdge associes au TP_Face, structures en TP_FaceBoundary. */
146:            public TP_FaceBoundary boundary() {
147:                TP_FaceBoundary result = null;
148:                Iterator it;
149:                try {
150:                    // liste des DirectedEdge qui ont this pour frontiere gauche
151:                    List theEdges = new ArrayList();
152:                    it = left.iterator();
153:                    while (it.hasNext()) {
154:                        TP_Edge edge = (TP_Edge) it.next();
155:                        theEdges.add(edge.asTP_DirectedTopo(+1));
156:                    }
157:                    it = right.iterator();
158:                    while (it.hasNext()) {
159:                        TP_Edge edge = (TP_Edge) it.next();
160:                        theEdges.add(edge.asTP_DirectedTopo(-1));
161:                    }
162:
163:                    // on cherche l'anneau exterieur
164:                    // on cherche les brins dont les noeud n'ont pas this comme container
165:                    // A REVOIR SANS UTILISER LE CONTAINER
166:                    List extEdges = new ArrayList();
167:                    for (int i = 0; i < theEdges.size(); i++) {
168:                        TP_DirectedEdge edge = (TP_DirectedEdge) theEdges
169:                                .get(i);
170:                        extEdges.add(edge);
171:                    }
172:
173:                    try {
174:                        TP_Ring extRing = new TP_Ring(extEdges);
175:                        result = new TP_FaceBoundary(extRing);
176:                    } catch (Exception e) {
177:                        e.printStackTrace(); // normalement il n'y a pas d'exception ici
178:                    }
179:
180:                    // il reste eventuellement des anneaux interieurs
181:                    // A REVOIR SANS UTILISER LE CONTAINER
182:                    /*  if (theEdges.size() > 0) {
183:
184:                       // necessite de cloner la liste car on risque de la modifier dans le try
185:                       List theEdgesBis = new ArrayList();
186:                       for (int i=0; i<theEdges.size(); i++) theEdgesBis.add(theEdges.get(i));
187:                       // on essaie de faire un TP_Ring avec le reste : si Exception, c'est qu'il y en a plusieurs
188:                       try {
189:                            TP_Ring intRing = new TP_Ring(theEdgesBis);
190:                            result.appendInterior(intRing);
191:                       } catch (Exception e) {
192:
193:                           // on cherche les cycles
194:                           while (theEdges.size() > 0) {
195:
196:                               List aCycle = new ArrayList();
197:                               TP_DirectedEdge dt0 = (TP_DirectedEdge)theEdges.get(0);
198:                               aCycle.add(dt0);
199:                               theEdges.remove(dt0);
200:                               if (theEdges.size() > 0) {
201:                                   int IDEndNode = dt0.endNode().topo().getId();
202:                                   int theIDStartNode = dt0.startNode().topo().getId();
203:                                   int i = 0;
204:                                   while (theIDStartNode != IDEndNode) {
205:                                        TP_DirectedEdge dt = (TP_DirectedEdge)theEdges.get(i);
206:                                        int IDStartNode = dt.startNode().topo().getId();
207:                                        if (IDEndNode == IDStartNode) {
208:                                        aCycle.add(dt);
209:                                        IDEndNode = dt.endNode().topo().getId();
210:                                        theEdges.remove(i);
211:                                        i = 0;
212:                                        continue;
213:                                        }
214:                                        i++;
215:                                        if (i == theEdges.size()) 
216:                                            throw new Exception("DrCogit - erreur 8.011");
217:                                   }
218:                                   TP_Ring intRing = new TP_Ring(aCycle);
219:                                   result.appendInterior(intRing);
220:                               }
221:                           }
222:                       }                
223:                    }*/
224:                    return result;
225:
226:                } catch (Exception e) {
227:                    e.printStackTrace();
228:                    return result;
229:                }
230:            }
231:
232:            /////////////////////////////////////////////////////////////////////////////////////
233:            // coBoundary ///////////////////////////////////////////////////////////////////////
234:            /////////////////////////////////////////////////////////////////////////////////////      
235:            /** non implemente (renvoie null). Les TP_DirectedSolid associes au TP_Face. */
236:            public List coBoundary() {
237:                return null;
238:            }
239:
240:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.