Statistics
| Revision:

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

History | View | Annotate | Download (3.21 KB)

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

    
3
import java.util.ArrayList;
4
import java.util.LinkedHashMap;
5

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

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

    
79
        public GPEFeature(){
80
                elements = new LinkedHashMap();
81
        }
82

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

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

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

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

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

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

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

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

    
155
        public void addMetadata(GPEMetadata metadata) {
156
                metaDataList.add(metadata);
157
        }
158
}