Statistics
| Revision:

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

History | View | Annotate | Download (4.45 KB)

1
package es.unex.sextante.dataObjects;
2

    
3
import java.util.List;
4

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

    
7
import es.unex.sextante.dataObjects.vectorFilters.IVectorLayerFilter;
8

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

    
21
   public static final int SHAPE_TYPE_POINT        = 0;
22
   public static final int SHAPE_TYPE_LINE         = 1;
23
   public static final int SHAPE_TYPE_POLYGON      = 2;
24
   public static final int SHAPE_TYPE_MIXED        = 3;
25
   
26
   //Types to create a multilayer in gvSIG. Don't use for anything more
27
   public static final int SHAPE_TYPE_MULTIPOINT   = 4;
28
   public static final int SHAPE_TYPE_MULTILINE    = 5;
29
   public static final int SHAPE_TYPE_MULTIPOLYGON = 6;
30

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

    
37

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

    
49

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

    
58

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

    
66

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

    
76

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

    
86

    
87
   /**
88
    * 
89
    * @return the number of attributes associates to each geometry
90
    */
91
   public int getFieldCount();
92

    
93

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

    
101

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

    
109

    
110
   /**
111
    * Returns the number of features in this layer
112
    * 
113
    * @return the number of features in this layer
114
    */
115
   public int getShapesCount();
116

    
117

    
118
   /**
119
    * Returns the type of geometries in this layer
120
    * 
121
    * @return the type of geometries in this layer
122
    */
123
   public int getShapeType();
124

    
125

    
126
   /**
127
    * Returns the index of a field from its name. Returns -1 if there is not a field with that name.
128
    * 
129
    * @param fieldName
130
    *                the name of the field
131
    * @return the index of the given field
132
    */
133
   public int getFieldIndexByName(String fieldName);
134

    
135

    
136
   /**
137
    * Adds a new filter to this layer. When iterating the features in this layer, only those that pass the filter will be
138
    * returned.
139
    * 
140
    * @param filter
141
    *                the filter to add
142
    */
143
   public void addFilter(IVectorLayerFilter filter);
144

    
145

    
146
   /**
147
    * Removes all filters previously added to this layer
148
    */
149
   public void removeFilters();
150

    
151

    
152
   /**
153
    * Returns a list of all the filters currently added to this layer
154
    * 
155
    * @return a list of all the filters currently added to this layer
156
    */
157
   public List<IVectorLayerFilter> getFilters();
158

    
159

    
160
   /**
161
    * Returns true if the layer can be edited. This includes editing while the layer is being read, so it can be overwritten by
162
    * algorithms that allow overwriting of input layers
163
    * 
164
    * @return true if the layer can be edited
165
    */
166
   public boolean canBeEdited();
167

    
168

    
169
}