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.List;
030:
031: /**
032: * Noeud topologique orienté. Supporte la classe TP_Node pour les TP_Expression.
033: * Dans notre implémentation, l'identifiant d'un TP_DirectedTopo est celui de sa primitive avec le signe de l'orientation.
034: * EXPLIQUER QUE C'EST PAS PERSISTANT et que A PRIORI ca n'a pas de GEOMETRIE
035: *
036: * @author Thierry Badard, Arnaud Braun & Audrey Simon
037: * @version 1.0
038: *
039: */
040:
041: public class TP_DirectedNode extends TP_DirectedTopo {
042:
043: /////////////////////////////////////////////////////////////////////////////////////
044: // constructeur /////////////////////////////////////////////////////////////////////
045: /////////////////////////////////////////////////////////////////////////////////////
046: /** Constructeur par défaut. */
047: public TP_DirectedNode() {
048: }
049:
050: /////////////////////////////////////////////////////////////////////////////////////
051: // topo /////////////////////////////////////////////////////////////////////////////
052: /////////////////////////////////////////////////////////////////////////////////////
053: /** Primitive de this. */
054: protected TP_Node topo;
055:
056: /** Primitive de this. */
057: public TP_Node topo() {
058: return topo;
059: }
060:
061: /////////////////////////////////////////////////////////////////////////////////////
062: // negate ///////////////////////////////////////////////////////////////////////////
063: /////////////////////////////////////////////////////////////////////////////////////
064: /** Renvoie le TP_DirectedNode d'orientation opposée. */
065: public TP_DirectedNode negate() {
066: if (orientation < 0)
067: return topo.proxy[0];
068: else
069: return topo.proxy[1];
070: }
071:
072: /////////////////////////////////////////////////////////////////////////////////////
073: // boundary /////////////////////////////////////////////////////////////////////////
074: /////////////////////////////////////////////////////////////////////////////////////
075: /** Renvoie null. */
076: public TP_Boundary boundary() {
077: return null;
078: }
079:
080: /////////////////////////////////////////////////////////////////////////////////////
081: // coBoundary ///////////////////////////////////////////////////////////////////////
082: /////////////////////////////////////////////////////////////////////////////////////
083: public List coBoundary() {
084: if (orientation == +1)
085: return this .topo().coBoundary();
086:
087: // pour un noeud negatif, on retourne tous les brins
088: else if (orientation == -1) {
089: List coBoundary = this .topo().coBoundary();
090: for (int i = 0; i < coBoundary.size(); i++) {
091: TP_DirectedEdge directedEdge1 = (TP_DirectedEdge) coBoundary
092: .get(i);
093: TP_DirectedEdge directedEdge2 = (TP_DirectedEdge) directedEdge1
094: .negate();
095: coBoundary.set(i, directedEdge2);
096: }
097: return coBoundary;
098: } else
099: return null;
100: }
101:
102: }
|