Revision 38533 branches/v2_0_0_prep/extensions/extEditing/src/org/gvsig/editing/ExploitExtension.java
ExploitExtension.java | ||
---|---|---|
40 | 40 |
*/ |
41 | 41 |
package org.gvsig.editing; |
42 | 42 |
|
43 |
import java.util.List; |
|
44 |
|
|
43 | 45 |
import javax.swing.JOptionPane; |
44 | 46 |
|
45 | 47 |
import org.slf4j.Logger; |
... | ... | |
186 | 188 |
if (geotype.getType() == Geometry.TYPES.SURFACE |
187 | 189 |
|| geotype.getType() == Geometry.TYPES.MULTISURFACE) { |
188 | 190 |
|
189 |
// exploting a surface can give curves, so must allow multiple types |
|
190 |
return (factory.allowMultipleGeometryTypes() |
|
191 |
== FeatureStoreProviderFactory.YES); |
|
191 |
// exploting a surface can give curves: |
|
192 |
return allowsCurvesOfSubtype(factory, geotype.getSubType()); |
|
193 |
// (factory.allowMultipleGeometryTypes() |
|
194 |
// == FeatureStoreProviderFactory.YES); |
|
192 | 195 |
} |
193 | 196 |
|
194 | 197 |
if (geotype.isTypeOf(Geometry.TYPES.GEOMETRY)) { |
... | ... | |
199 | 202 |
// otherwise: (multi)points, etc, not allowed |
200 | 203 |
return false; |
201 | 204 |
} |
205 |
|
|
202 | 206 |
/** |
207 |
* @param factory |
|
208 |
* @param subType |
|
209 |
* @return whether given factory supports |
|
210 |
* curves of given subtype |
|
211 |
*/ |
|
212 |
private boolean allowsCurvesOfSubtype( |
|
213 |
FeatureStoreProviderFactory fact, |
|
214 |
int subt) { |
|
215 |
|
|
216 |
List arr2_list = fact.getSupportedGeometryTypesSubtypes(); |
|
217 |
int[] item = null; |
|
218 |
int sz = arr2_list.size(); |
|
219 |
for (int i=0; i<sz; i++) { |
|
220 |
item = (int[]) arr2_list.get(i); |
|
221 |
if (item != null && item.length == 2 |
|
222 |
&& item[0] == Geometry.TYPES.CURVE |
|
223 |
&& item[1] == subt) { |
|
224 |
// found curves of same subtype (dimensions) |
|
225 |
return true; |
|
226 |
} |
|
227 |
} |
|
228 |
return false; |
|
229 |
} |
|
230 |
|
|
231 |
/** |
|
203 | 232 |
* @see org.gvsig.andami.plugins.IExtension#isVisible() |
204 | 233 |
*/ |
205 | 234 |
public boolean isVisible() { |
Also available in: Unified diff