svn-gvsig-desktop / trunk / extensions / extGPE-gvSIG / src / org / gvsig / fmap / drivers / gpe / reader / AddFeatureToDriver.java @ 27067
History | View | Annotate | Download (2.67 KB)
1 |
package org.gvsig.fmap.drivers.gpe.reader; |
---|---|
2 |
|
3 |
import org.gvsig.fmap.drivers.gpe.model.GPEFeature; |
4 |
import org.gvsig.xmlschema.som.IXSSchemaDocument; |
5 |
import org.gvsig.xmlschema.som.IXSTypeDefinition; |
6 |
|
7 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
|
8 |
*
|
9 |
* Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
|
10 |
*
|
11 |
* This program is free software; you can redistribute it and/or
|
12 |
* modify it under the terms of the GNU General Public License
|
13 |
* as published by the Free Software Foundation; either version 2
|
14 |
* of the License, or (at your option) any later version.
|
15 |
*
|
16 |
* This program is distributed in the hope that it will be useful,
|
17 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
18 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
19 |
* GNU General Public License for more details.
|
20 |
*
|
21 |
* You should have received a copy of the GNU General Public License
|
22 |
* along with this program; if not, write to the Free Software
|
23 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA.
|
24 |
*
|
25 |
* For more information, contact:
|
26 |
*
|
27 |
* Generalitat Valenciana
|
28 |
* Conselleria d'Infraestructures i Transport
|
29 |
* Av. Blasco Ib??ez, 50
|
30 |
* 46010 VALENCIA
|
31 |
* SPAIN
|
32 |
*
|
33 |
* +34 963862235
|
34 |
* gvsig@gva.es
|
35 |
* www.gvsig.gva.es
|
36 |
*
|
37 |
* or
|
38 |
*
|
39 |
* IVER T.I. S.A
|
40 |
* Salamanca 50
|
41 |
* 46005 Valencia
|
42 |
* Spain
|
43 |
*
|
44 |
* +34 963163400
|
45 |
* dac@iver.es
|
46 |
*/
|
47 |
/* CVS MESSAGES:
|
48 |
*
|
49 |
* $Id$
|
50 |
* $Log$
|
51 |
*
|
52 |
*/
|
53 |
/**
|
54 |
* @author Jorge Piera LLodr? (jorge.piera@iver.es)
|
55 |
*/
|
56 |
public class AddFeatureToDriver { |
57 |
private IXSSchemaDocument schema = null; |
58 |
|
59 |
public AddFeatureToDriver(){
|
60 |
|
61 |
} |
62 |
|
63 |
/**
|
64 |
* Add a feature to a layer
|
65 |
* @param driver
|
66 |
* The driver
|
67 |
* @param feature
|
68 |
* The feature to add
|
69 |
*/
|
70 |
public void addFeatureToLayer(GPEVectorialDriver driver, GPEFeature feature){ |
71 |
addFeatureToLayer_(driver, feature); |
72 |
} |
73 |
|
74 |
/**
|
75 |
* Add a feature to a layer
|
76 |
* @param layer
|
77 |
* The layer
|
78 |
* @param feature
|
79 |
* The feature to add
|
80 |
*/
|
81 |
private void addFeatureToLayer_(GPEVectorialDriver driver, GPEFeature feature){ |
82 |
IXSTypeDefinition elementType = null;
|
83 |
//If the feature has a type it will try to retrieve it
|
84 |
// if (feature.getTypeName() != null){
|
85 |
// elementType = schema.getTypeByName(feature.getTypeName());
|
86 |
// }
|
87 |
//If the type exists in the schema
|
88 |
if (elementType != null){ |
89 |
//layer.addFeature(feature, elementType);
|
90 |
driver.addFeature(feature); |
91 |
//If the type doesn't exist in the XML schema
|
92 |
}else{
|
93 |
driver.addFeature(feature); |
94 |
} |
95 |
} |
96 |
|
97 |
/**
|
98 |
* @return the schema
|
99 |
*/
|
100 |
public IXSSchemaDocument getSchema() {
|
101 |
return schema;
|
102 |
} |
103 |
|
104 |
/**
|
105 |
* @param schema the schema to set
|
106 |
*/
|
107 |
public void setSchema(IXSSchemaDocument schema) { |
108 |
this.schema = schema;
|
109 |
} |
110 |
|
111 |
|
112 |
|
113 |
} |