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.cartetopo.exemple;
28:
29: import fr.ign.cogit.geoxygene.contrib.cartetopo.CarteTopo;
30: import fr.ign.cogit.geoxygene.feature.Population;
31:
32: /**
33: * Exemple de construction et d'utilisation d'une carte topo simple, héritée
34: * du schéma générique de la cartetopo.
35: *
36: * La carte topo en question est definie par heritage à partir des
37: * classes du package : MonNoeud, MonArc, MaFace, MaCarteTopo (on n'utilise
38: * pas de groupes dans cet exemple).
39: *
40: * La seule petite difficulté est d'indiquer dans le code que
41: * MaCarteTopo est constitueé d'objets MonNoeud, MonArc et MaFace
42: * plutôt que les génériques Noeud, Arc et Face. Cette opération doit
43: * se faire par un constructeur spécial dans la classe MaCarteTopo.
44: *
45: * NB: il est bien entendu possible d'uiliser une cartetopo par défaut si
46: * la surcharge des classes arcs, noeuds et faces n'est pas necessaire
47: * dans l'application.
48: *
49: * @author Bonin
50: * @version 1.0
51: */
52:
53: public class MaCarteTopo extends CarteTopo {
54:
55: public MaCarteTopo() {
56: }
57:
58: public MaCarteTopo(String nom_logique) {
59: this .ojbConcreteClass = this .getClass().getName(); // nécessaire pour ojb
60: this .setNom(nom_logique);
61: this .setPersistant(false);
62:
63: /* Declaration des type de noeuds, arcs et face que la cartetopo va contenir */
64: Population noeuds = new Population(false, "Noeud",
65: MonNoeud.class, true);
66: this .addPopulation(noeuds);
67: Population arcs = new Population(false, "Arc", MonArc.class,
68: true);
69: this .addPopulation(arcs);
70: Population faces = new Population(false, "Face", MaFace.class,
71: true);
72: this.addPopulation(faces);
73: }
74:
75: }
|