📄 gm_surface.java
字号:
/*
* This file is part of the GeOxygene project source files.
*
* GeOxygene aims at providing an open framework which implements OGC/ISO specifications for
* the development and deployment of geographic (GIS) applications. It is a open source
* contribution of the COGIT laboratory at the Institut G閛graphique National (the French
* National Mapping Agency).
*
* See: http://oxygene-project.sourceforge.net
*
* Copyright (C) 2005 Institut G閛graphique National
*
* This library is free software; you can redistribute it and/or modify it under the terms
* of the GNU Lesser General Public License as published by the Free Software Foundation;
* either version 2.1 of the License, or any later version.
*
* This library is distributed in the hope that it will be useful, but WITHOUT ANY
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License along with
* this library (see file LICENSE if present); if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
package fr.ign.cogit.geoxygene.spatial.geomprim;
import java.util.ArrayList;
import java.util.List;
import fr.ign.cogit.geoxygene.spatial.coordgeom.DirectPositionList;
import fr.ign.cogit.geoxygene.spatial.coordgeom.GM_LineString;
import fr.ign.cogit.geoxygene.spatial.coordgeom.GM_Polygon;
import fr.ign.cogit.geoxygene.spatial.coordgeom.GM_SurfacePatch;
/**
* Surface, compos閑 de morceaux de surface. L'orientation vaut n閏essairement +1.
*
* <P> Modification de la norme suite au retour d'utilisation : on fait h閞iter GM_SurfacePatch de GM_Surface.
* Du coup, on n'impl閙ente plus l'interface GM_GenericSurface.
*
* @author Thierry Badard & Arnaud Braun
* @version 1.0
*
*/
public class GM_Surface extends GM_OrientableSurface
/*implements GM_GenericSurface*/ {
//////////////////////////////////////////////////////////////////////////////////
// Attribut "patch" et m閠hodes pour le traiter //////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////
// A FAIRE : validate : pour que les patch soient contigue ?
// pour cela il faut regarder que l'union est du type GM_Surface et non GM_MultiSurface
/**Liste des morceaux constituant la surface.*/
protected List patch;
/** Renvoie la liste des patch. */
public List getPatch () {return this.patch;}
/** Renvoie le patch de rang i. */
public GM_SurfacePatch getPatch (int i) {
if ((GM_SurfacePatch.class).isAssignableFrom(this.getClass()))
if (i != 0) {
System.out.println("Recherche d'un patch avec i<>0 alors qu'un GM_SurfacePatch ne contient qu'un segment qui est lui-meme");
return null;
} else return (GM_SurfacePatch)this.patch.get(i);
else return (GM_SurfacePatch)this.patch.get(i);
}
/** Affecte un patch au rang i. */
public void setPatch (int i, GM_SurfacePatch value) {
if ((GM_SurfacePatch.class).isAssignableFrom(this.getClass()))
if (i != 0)
System.out.println("Affection d'un patch avec i<>0 alors qu'un GM_SurfacePatch ne contient qu'un segment qui est lui-meme. La m閠hode ne fait rien.");
else this.patch.set(i, value);
else this.patch.set(i, value);
}
/** Ajoute un patch en fin de liste. */
public void addPatch (GM_SurfacePatch value) {
if ((GM_SurfacePatch.class).isAssignableFrom(this.getClass()))
if (sizePatch() > 0)
System.out.println("Ajout d'un patch alors qu'un GM_SurfacePatch ne contient qu'un segment qui est lui-meme. La m閠hode ne fait rien.");
else this.patch.add(value);
else this.patch.add(value);
}
/** Ajoute un patch au rang i. */
public void addPatch (int i, GM_SurfacePatch value) {
if ((GM_SurfacePatch.class).isAssignableFrom(this.getClass()))
if (i != 0)
System.out.println("Ajout d'un patch avec i<>0 alors qu'un GM_SurfacePatch ne contient qu'un segment qui est lui-meme. La m閠hode ne fait rien.");
else this.patch.add(value);
else this.patch.add(i, value);
}
/** Efface le patch de valeur value. */
public void removePatch (GM_SurfacePatch value) {
if ((GM_SurfacePatch.class).isAssignableFrom(this.getClass()))
System.out.println("removePatch() : Ne fait rien car un GM_SurfacePatch ne contient qu'un segment qui est lui-meme.");
else this.patch.remove(value);
}
/** Efface le patch de rang i. */
public void removePatch (int i) {
if ((GM_SurfacePatch.class).isAssignableFrom(this.getClass()))
System.out.println("removePatch() : Ne fait rien car un GM_SurfacePatch ne contient qu'un segment qui est lui-meme.");
else this.patch.remove(i);
}
/** Renvoie le nombre de patch. */
public int sizePatch () {return this.patch.size();}
//////////////////////////////////////////////////////////////////////////////////
// Constructeurs /////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////
/** Constructeur par d閒aut */
public GM_Surface () {
patch = new ArrayList();
orientation = +1;
primitive = this;
proxy[0] = this;
GM_OrientableSurface proxy1 = new GM_OrientableSurface();
proxy1.orientation = -1;
proxy1.proxy[0] = this;
proxy1.proxy[1] = proxy1;
proxy1.primitive = new GM_Surface(this);
proxy[1] = proxy1;
}
/** Constructeur
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -