Revision 42533 trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.file/org.gvsig.fmap.dal.file.shp/src/main/java/org/gvsig/fmap/dal/store/shp/SHPStoreProviderFactory.java
SHPStoreProviderFactory.java | ||
---|---|---|
43 | 43 |
import org.gvsig.fmap.dal.feature.FeatureType; |
44 | 44 |
import org.gvsig.fmap.dal.feature.spi.AbstractFeatureStoreProviderFactory; |
45 | 45 |
import org.gvsig.fmap.dal.spi.DataStoreProviderServices; |
46 |
import org.gvsig.fmap.dal.store.dbf.utils.DbaseFile; |
|
46 | 47 |
import org.gvsig.fmap.geom.Geometry; |
47 | 48 |
import org.gvsig.fmap.geom.GeometryLocator; |
48 | 49 |
import org.gvsig.fmap.geom.type.GeometryType; |
... | ... | |
53 | 54 |
public class SHPStoreProviderFactory extends AbstractFeatureStoreProviderFactory implements FeatureStoreProviderFactory{ |
54 | 55 |
|
55 | 56 |
private static final Logger logger = LoggerFactory.getLogger(SHPStoreProviderFactory.class); |
56 |
|
|
57 |
|
|
57 | 58 |
public static final String DEFAULT_GEOMETRY_FIELD_NAME = "GEOMETRY"; |
58 | 59 |
public static final int DEFAULT_GEOMETRY_TYPE = Geometry.TYPES.SURFACE; |
59 | 60 |
public static final int DEFAULT_GEOMETRY_SUBTYPE = Geometry.SUBTYPES.GEOM2D; |
60 |
|
|
61 |
|
|
61 | 62 |
protected SHPStoreProviderFactory(String name, String description) { |
62 | 63 |
super(name, description); |
63 | 64 |
} |
... | ... | |
71 | 72 |
public DynObject createParameters() { |
72 | 73 |
return new SHPStoreParameters(); |
73 | 74 |
} |
74 |
|
|
75 |
|
|
75 | 76 |
public int allowCreate() { |
76 | 77 |
return YES; |
77 | 78 |
} |
78 |
|
|
79 |
|
|
79 | 80 |
public int allowWrite() { |
80 | 81 |
return YES; |
81 | 82 |
} |
... | ... | |
83 | 84 |
public int allowRead() { |
84 | 85 |
return YES; |
85 | 86 |
} |
86 |
|
|
87 |
|
|
87 | 88 |
public int hasRasterSupport() { |
88 | 89 |
return NO; |
89 | 90 |
} |
90 |
|
|
91 |
|
|
91 | 92 |
public int hasTabularSupport() { |
92 | 93 |
return YES; |
93 | 94 |
} |
94 |
|
|
95 |
|
|
95 | 96 |
public int hasVectorialSupport() { |
96 | 97 |
return YES; |
97 | 98 |
} |
... | ... | |
99 | 100 |
public int allowMultipleGeometryTypes() { |
100 | 101 |
return NO; |
101 | 102 |
} |
102 |
|
|
103 |
|
|
103 |
|
|
104 |
|
|
104 | 105 |
public int allowEditableFeatureType() { |
105 | 106 |
return YES; |
106 | 107 |
} |
... | ... | |
108 | 109 |
public int useLocalIndexesCanImprovePerformance() { |
109 | 110 |
return YES; |
110 | 111 |
} |
111 |
|
|
112 |
|
|
112 | 113 |
public List getSupportedDataTypes() { |
113 |
|
|
114 |
|
|
114 | 115 |
DataTypesManager manager = ToolsLocator.getDataTypesManager(); |
115 | 116 |
|
116 | 117 |
List resp = new ArrayList<Integer>(); |
... | ... | |
121 | 122 |
resp.add(manager.get(DataTypes.GEOMETRY)); |
122 | 123 |
return resp; |
123 | 124 |
} |
124 |
|
|
125 |
|
|
125 | 126 |
public List getSupportedGeometryTypesSubtypes() { |
126 | 127 |
// null means all supported |
127 | 128 |
int[] item = null; |
... | ... | |
131 | 132 |
item[0] = Geometry.TYPES.POINT; |
132 | 133 |
item[1] = Geometry.SUBTYPES.GEOM2D; |
133 | 134 |
resp.add(item); |
134 |
|
|
135 |
|
|
135 | 136 |
item = new int[2]; |
136 | 137 |
item[0] = Geometry.TYPES.CURVE; |
137 | 138 |
item[1] = Geometry.SUBTYPES.GEOM2D; |
138 | 139 |
resp.add(item); |
139 |
|
|
140 |
|
|
140 | 141 |
item = new int[2]; |
141 | 142 |
item[0] = Geometry.TYPES.SURFACE; |
142 | 143 |
item[1] = Geometry.SUBTYPES.GEOM2D; |
143 | 144 |
resp.add(item); |
144 |
|
|
145 |
|
|
145 | 146 |
item = new int[2]; |
146 | 147 |
item[0] = Geometry.TYPES.MULTIPOINT; |
147 | 148 |
item[1] = Geometry.SUBTYPES.GEOM2D; |
... | ... | |
151 | 152 |
item[0] = Geometry.TYPES.POINT; |
152 | 153 |
item[1] = Geometry.SUBTYPES.GEOM3D; |
153 | 154 |
resp.add(item); |
154 |
|
|
155 |
|
|
155 | 156 |
item = new int[2]; |
156 | 157 |
item[0] = Geometry.TYPES.CURVE; |
157 | 158 |
item[1] = Geometry.SUBTYPES.GEOM3D; |
158 | 159 |
resp.add(item); |
159 |
|
|
160 |
|
|
160 | 161 |
item = new int[2]; |
161 | 162 |
item[0] = Geometry.TYPES.SURFACE; |
162 | 163 |
item[1] = Geometry.SUBTYPES.GEOM3D; |
163 | 164 |
resp.add(item); |
164 |
|
|
165 |
|
|
165 | 166 |
item = new int[2]; |
166 | 167 |
item[0] = Geometry.TYPES.MULTIPOINT; |
167 | 168 |
item[1] = Geometry.SUBTYPES.GEOM3D; |
... | ... | |
171 | 172 |
item[0] = Geometry.TYPES.POINT; |
172 | 173 |
item[1] = Geometry.SUBTYPES.GEOM2DM; |
173 | 174 |
resp.add(item); |
174 |
|
|
175 |
|
|
175 | 176 |
item = new int[2]; |
176 | 177 |
item[0] = Geometry.TYPES.CURVE; |
177 | 178 |
item[1] = Geometry.SUBTYPES.GEOM2DM; |
178 | 179 |
resp.add(item); |
179 |
|
|
180 |
|
|
180 | 181 |
item = new int[2]; |
181 | 182 |
item[0] = Geometry.TYPES.SURFACE; |
182 | 183 |
item[1] = Geometry.SUBTYPES.GEOM2DM; |
183 | 184 |
resp.add(item); |
184 |
|
|
185 |
|
|
185 | 186 |
item = new int[2]; |
186 | 187 |
item[0] = Geometry.TYPES.MULTIPOINT; |
187 | 188 |
item[1] = Geometry.SUBTYPES.GEOM2DM; |
188 | 189 |
resp.add(item); |
189 | 190 |
// ====================================== |
190 |
|
|
191 |
|
|
191 | 192 |
return resp; |
192 | 193 |
} |
193 |
|
|
194 |
|
|
194 | 195 |
public boolean allowsMandatoryAttributes() { |
195 | 196 |
return false; |
196 | 197 |
} |
197 |
|
|
198 |
|
|
198 | 199 |
public boolean allowsPrimaryKeyAttributes() { |
199 | 200 |
return false; |
200 | 201 |
} |
201 | 202 |
|
202 | 203 |
/** |
203 | 204 |
* @return dummy feature type. Must be overridden by subclasses |
204 |
*
|
|
205 |
* |
|
205 | 206 |
*/ |
206 | 207 |
public FeatureType createDefaultFeatureType() { |
207 | 208 |
DataManager dm = DALLocator.getDataManager(); |
208 | 209 |
EditableFeatureType eft = dm.createFeatureType(); |
209 |
|
|
210 |
|
|
210 | 211 |
EditableFeatureAttributeDescriptor efatd = |
211 | 212 |
eft.add(DEFAULT_GEOMETRY_FIELD_NAME, DataTypes.GEOMETRY); |
212 | 213 |
|
... | ... | |
226 | 227 |
return eft.getNotEditableCopy(); |
227 | 228 |
} |
228 | 229 |
|
229 |
|
|
230 |
@Override |
|
231 |
public int getMaxAttributeNameSize() { |
|
232 |
return DbaseFile.MAX_FIELD_NAME_LENGTH; |
|
233 |
} |
|
230 | 234 |
} |
Also available in: Unified diff