Statistics
| Revision:

root / org.gvsig.toolbox / trunk / org.gvsig.toolbox / org.gvsig.toolbox.core / src / main / java / es / unex / sextante / dataObjects / IVectorLayer.java @ 341

History | View | Annotate | Download (4.82 KB)

1
package es.unex.sextante.dataObjects;
2

    
3
import java.util.List;
4

    
5
import com.vividsolutions.jts.geom.Geometry;
6

    
7
import org.gvsig.tools.exception.BaseException;
8

    
9
import es.unex.sextante.dataObjects.vectorFilters.IVectorLayerFilter;
10
import org.gvsig.fmap.dal.feature.FeatureStore;
11

    
12
/**
13
 * This is the base interface that all vector layers have to implement to be able to be used by SEXTANTE algorithms.
14
 *
15
 * Instead of implementing this class directly, it is recommended to extend {@link AbstractVectorLayer}.
16
 *
17
 * @author Victor Olaya. volaya@unex.es
18
 *
19
 */
20
public interface IVectorLayer
21
         extends
22
            ILayer {
23

    
24
   public static final int SHAPE_TYPE_POINT        = 0;
25
   public static final int SHAPE_TYPE_LINE         = 1;
26
   public static final int SHAPE_TYPE_POLYGON      = 2;
27
   public static final int SHAPE_TYPE_MIXED        = 3;
28

    
29
   //Types to create a multilayer in gvSIG. Don't use for anything more
30
   public static final int SHAPE_TYPE_MULTIPOINT   = 4;
31
   public static final int SHAPE_TYPE_MULTILINE    = 5;
32
   public static final int SHAPE_TYPE_MULTIPOLYGON = 6;
33

    
34
   /**
35
    * this constant indicates that the shape type is not compatible with SEXTANTE (for example a layer with multiple types if that
36
    * is not supported), and should be used to filter out layers
37
    */
38
   public static final int SHAPE_TYPE_WRONG   = -1;
39

    
40

    
41
   /**
42
    * Adds a new feature to the layer
43
    *
44
    * @param geometry
45
    *                the geometry
46
    * @param attributes
47
    *                the attributes associated with the geometry
48
    */
49
   public void addFeature(Geometry geometry,
50
                          Object[] attributes);
51

    
52

    
53
   /**
54
    * Adds a new feature to the layer
55
    *
56
    * @param feature
57
    *                the feature to add
58
    */
59
   public void addFeature(IFeature feature);
60

    
61

    
62
   /**
63
    * Returns an iterator to iterate through the entities of this layer
64
    *
65
    * @return an iterator to iterate the layer
66
    */
67
   public IFeatureIterator iterator();
68

    
69

    
70
   /**
71
    * Returns the name of a given field in the attributes table
72
    *
73
    * @param index
74
    *                the zero-based field index
75
    * @return the name of the selected attribute field
76
    */
77
   public String getFieldName(int index);
78

    
79

    
80
   /**
81
    * Return a class representing the data type of a given field
82
    *
83
    * @param index
84
    *                the zero-based field index
85
    * @return the data type of the selected attribute field
86
    */
87
   public Class getFieldType(int index);
88

    
89

    
90
   /**
91
    *
92
    * @return the number of attributes associates to each geometry
93
    */
94
   public int getFieldCount();
95

    
96

    
97
   /**
98
    * Returns an array of classes representing the data types of the fields in the attributes table
99
    *
100
    * @return the data types of attribute fields
101
    */
102
   public Class[] getFieldTypes();
103

    
104

    
105
   /**
106
    * Returns the names of the fields in the attributes table
107
    *
108
    * @return the names of the attribute fields
109
    */
110
   public String[] getFieldNames();
111

    
112

    
113
   /**
114
    * Returns the number of features in this layer
115
    *
116
    * @return the number of features in this layer
117
    */
118
   public int getShapesCount();
119

    
120

    
121
   /**
122
    * Returns the type of geometries in this layer
123
    *
124
    * @return the type of geometries in this layer
125
    */
126
   public int getShapeType();
127

    
128
   /**
129
    * Returns the subtype of geometries in this layer
130
    *
131
    * @return the subtype of geometries in this layer
132
 * @throws ReadException
133
    */
134
   public int getSubType() throws BaseException;
135

    
136

    
137
   /**
138
    * Returns the index of a field from its name. Returns -1 if there is not a field with that name.
139
    *
140
    * @param fieldName
141
    *                the name of the field
142
    * @return the index of the given field
143
    */
144
   public int getFieldIndexByName(String fieldName);
145

    
146

    
147
   /**
148
    * Adds a new filter to this layer. When iterating the features in this layer, only those that pass the filter will be
149
    * returned.
150
    *
151
    * @param filter
152
    *                the filter to add
153
    */
154
   public void addFilter(IVectorLayerFilter filter);
155

    
156

    
157
   /**
158
    * Removes all filters previously added to this layer
159
    */
160
   public void removeFilters();
161

    
162

    
163
   /**
164
    * Returns a list of all the filters currently added to this layer
165
    *
166
    * @return a list of all the filters currently added to this layer
167
    */
168
   public List<IVectorLayerFilter> getFilters();
169

    
170

    
171
   /**
172
    * Returns true if the layer can be edited. This includes editing while the layer is being read, so it can be overwritten by
173
    * algorithms that allow overwriting of input layers
174
    *
175
    * @return true if the layer can be edited
176
    */
177
   public boolean canBeEdited();
178
   
179
   public boolean hasSelection();
180

    
181
   public FeatureStore getFeatureStore();
182
}