Statistics
| Revision:

svn-gvsig-desktop / trunk / extensions / extGPE-gvSIG / src / org / gvsig / fmap / drivers / gpe / model / GPEFeature.java @ 27067

History | View | Annotate | Download (3.05 KB)

1
package org.gvsig.fmap.drivers.gpe.model;
2

    
3
import java.util.LinkedHashMap;
4

    
5
import com.hardcode.gdbms.engine.values.Value;
6
import com.hardcode.gdbms.engine.values.ValueFactory;
7

    
8
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
9
 *
10
 * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
11
 *
12
 * This program is free software; you can redistribute it and/or
13
 * modify it under the terms of the GNU General Public License
14
 * as published by the Free Software Foundation; either version 2
15
 * of the License, or (at your option) any later version.
16
 *
17
 * This program is distributed in the hope that it will be useful,
18
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
20
 * GNU General Public License for more details.
21
 *
22
 * You should have received a copy of the GNU General Public License
23
 * along with this program; if not, write to the Free Software
24
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
25
 *
26
 * For more information, contact:
27
 *
28
 *  Generalitat Valenciana
29
 *   Conselleria d'Infraestructures i Transport
30
 *   Av. Blasco Ib??ez, 50
31
 *   46010 VALENCIA
32
 *   SPAIN
33
 *
34
 *      +34 963862235
35
 *   gvsig@gva.es
36
 *      www.gvsig.gva.es
37
 *
38
 *    or
39
 *
40
 *   IVER T.I. S.A
41
 *   Salamanca 50
42
 *   46005 Valencia
43
 *   Spain
44
 *
45
 *   +34 963163400
46
 *   dac@iver.es
47
 */
48
/* CVS MESSAGES:
49
 *
50
 * $Id$
51
 * $Log$
52
 *
53
 */
54
/**
55
 * @author Jorge Piera LLodr? (jorge.piera@iver.es)
56
 */
57
public class GPEFeature {
58
        private static int idFeature = 0;
59
        private GPEGeometry geometry = null;
60
        private LinkedHashMap elements = null;
61
        private Value id = null;
62
        private String name = null;
63
        private String typeName = null;
64
        
65
        public GPEFeature(Value id, String name, String typeName) {
66
                this();
67
                if ((id == null) || (id.toString() == null)){
68
                        this.id = ValueFactory.createValue(String.valueOf(idFeature));
69
                        idFeature++;
70
                }else{
71
                        this.id = id;
72
                }
73
                this.name = name;
74
                this.typeName = typeName;                
75
        }        
76

    
77
        public GPEFeature(){
78
                elements = new LinkedHashMap();
79
        }
80

    
81
        /**
82
         * @return the id
83
         */
84
        public Value getId() {
85
                return id;
86
        }
87

    
88
        /**
89
         * @param id the id to set
90
         */
91
        public void setId(Value id) {
92
                this.id = id;
93
        }
94

    
95
        /**
96
         * @return the geometry
97
         */
98
        public GPEGeometry getGeometry() {
99
                return geometry;
100
        }
101

    
102
        /**
103
         * @param geometry the geometry to set
104
         */
105
        public void setGeometry(GPEGeometry geometry) {
106
                this.geometry = geometry;
107
        }
108

    
109
        /**
110
         * @return the elements
111
         */
112
        public LinkedHashMap getelements() {
113
                return elements;
114
        }
115

    
116
        /**
117
         * @param elements the elements to set
118
         */
119
        public void setElements(LinkedHashMap elements) {
120
                this.elements = elements;
121
        }
122
        
123
        /**
124
         * It adds a new element
125
         * @param element
126
         * The element to add
127
         */
128
        public void addElement(GPEElement element){
129
                elements.put(element.getName(), element);
130
        }
131

    
132
        /**
133
         * @return the name
134
         */
135
        public String getName() {
136
                return name;
137
        }
138

    
139
        /**
140
         * @return the typeName
141
         */
142
        public String getTypeName() {
143
                return typeName;
144
        }
145
        
146
        /**
147
         * Initialize the feature id
148
         */
149
        public static void initIdFeature(){
150
                idFeature = 0;
151
        }
152
}