01: /*
02: * This file is part of the GeOxygene project source files.
03: *
04: * GeOxygene aims at providing an open framework which implements OGC/ISO specifications for
05: * the development and deployment of geographic (GIS) applications. It is a open source
06: * contribution of the COGIT laboratory at the Institut Géographique National (the French
07: * National Mapping Agency).
08: *
09: * See: http://oxygene-project.sourceforge.net
10: *
11: * Copyright (C) 2005 Institut Géographique National
12: *
13: * This library is free software; you can redistribute it and/or modify it under the terms
14: * of the GNU Lesser General Public License as published by the Free Software Foundation;
15: * either version 2.1 of the License, or any later version.
16: *
17: * This library is distributed in the hope that it will be useful, but WITHOUT ANY
18: * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
19: * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
20: *
21: * You should have received a copy of the GNU Lesser General Public License along with
22: * this library (see file LICENSE if present); if not, write to the Free Software
23: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24: *
25: */
26:
27: package fr.ign.cogit.geoxygene.contrib.delaunay;
28:
29: import java.util.Iterator;
30: import java.util.List;
31:
32: import fr.ign.cogit.geoxygene.contrib.cartetopo.Arc;
33: import fr.ign.cogit.geoxygene.contrib.cartetopo.Face;
34: import fr.ign.cogit.geoxygene.spatial.coordgeom.DirectPositionList;
35:
36: /**
37: * Classe des triangles de la triangulation.
38: * @author Bonin
39: * @version 1.0
40: */
41:
42: public class TriangleDelaunay extends Face {
43: public TriangleDelaunay() {
44: }
45:
46: public TriangleDelaunay(NoeudDelaunay n1, NoeudDelaunay n2,
47: NoeudDelaunay n3) {
48: DirectPositionList dpl = new DirectPositionList();
49: dpl.add(n1.getCoord());
50: dpl.add(n2.getCoord());
51: dpl.add(n3.getCoord());
52: dpl.add(n1.getCoord());
53: setCoord(dpl);
54: Arc arc;
55: List arcs;
56: Iterator iterarcs;
57: arcs = n1.arcs();
58: iterarcs = arcs.iterator();
59: while (iterarcs.hasNext()) {
60: arc = (Arc) iterarcs.next();
61: if ((arc.getNoeudIni() == n1) && (arc.getNoeudFin() == n2)) {
62: arc.setFaceGauche(this );
63: break;
64: } else if ((arc.getNoeudIni() == n2)
65: && (arc.getNoeudFin() == n1)) {
66: arc.setFaceDroite(this );
67: break;
68: }
69: }
70: arcs = n2.arcs();
71: iterarcs = arcs.iterator();
72: while (iterarcs.hasNext()) {
73: arc = (Arc) iterarcs.next();
74: if ((arc.getNoeudIni() == n2) && (arc.getNoeudFin() == n3)) {
75: arc.setFaceGauche(this );
76: break;
77: } else if ((arc.getNoeudIni() == n3)
78: && (arc.getNoeudFin() == n2)) {
79: arc.setFaceDroite(this );
80: break;
81: }
82: }
83: arcs = n3.arcs();
84: iterarcs = arcs.iterator();
85: while (iterarcs.hasNext()) {
86: arc = (Arc) iterarcs.next();
87: if ((arc.getNoeudIni() == n3) && (arc.getNoeudFin() == n1)) {
88: arc.setFaceGauche(this);
89: break;
90: } else if ((arc.getNoeudIni() == n1)
91: && (arc.getNoeudFin() == n3)) {
92: arc.setFaceDroite(this);
93: break;
94: }
95: }
96: }
97:
98: }
|