Revision 46897
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/SHPStoreProvider.java | ||
---|---|---|
27 | 27 |
import java.util.ArrayList; |
28 | 28 |
import java.util.Iterator; |
29 | 29 |
import java.util.List; |
30 |
import java.util.logging.Level; |
|
30 | 31 |
|
31 | 32 |
import org.apache.commons.io.FileUtils; |
32 | 33 |
import org.apache.commons.io.FilenameUtils; |
... | ... | |
50 | 51 |
import org.gvsig.fmap.dal.feature.FeatureType; |
51 | 52 |
import org.gvsig.fmap.dal.feature.exception.PerformEditingException; |
52 | 53 |
import org.gvsig.fmap.dal.feature.spi.FeatureProvider; |
54 |
import org.gvsig.fmap.dal.feature.spi.FeatureStoreProviderServices; |
|
53 | 55 |
import org.gvsig.fmap.dal.resource.ResourceAction; |
54 | 56 |
import org.gvsig.fmap.dal.resource.exception.ResourceException; |
55 | 57 |
import org.gvsig.fmap.dal.resource.exception.ResourceExecuteException; |
... | ... | |
71 | 73 |
import org.gvsig.fmap.geom.exception.CreateEnvelopeException; |
72 | 74 |
import org.gvsig.fmap.geom.exception.CreateGeometryException; |
73 | 75 |
import org.gvsig.fmap.geom.primitive.Envelope; |
76 |
import org.gvsig.fmap.geom.type.GeometryType; |
|
74 | 77 |
import org.gvsig.tools.dispose.DisposableIterator; |
75 | 78 |
import org.gvsig.tools.dynobject.exception.DynFieldNotFoundException; |
76 | 79 |
import org.gvsig.tools.exception.BaseException; |
... | ... | |
620 | 623 |
return this.getShpParameters().getFile(); |
621 | 624 |
} |
622 | 625 |
|
626 |
@Override |
|
627 |
public void fixFeatureTypeFromParameters() { |
|
628 |
try { |
|
629 |
super.fixFeatureTypeFromParameters(); |
|
630 |
FeatureStoreProviderServices store = this.getStoreServices(); |
|
631 |
|
|
632 |
FeatureType ft = store.getDefaultFeatureType(); |
|
633 |
FeatureAttributeDescriptor geomAttr = ft.getDefaultGeometryAttribute(); |
|
634 |
|
|
635 |
GeometryType geomType = geomAttr.getGeomType(); |
|
636 |
if(geomType.getType() != this.shpFile.getGeometryType() || geomType.getSubType() != this.shpFile.getGeometrySubType()) { |
|
637 |
EditableFeatureType eft = ft.getEditable(); |
|
638 |
EditableFeatureAttributeDescriptor geomEditableAttr = (EditableFeatureAttributeDescriptor) eft.getDefaultGeometryAttribute(); |
|
639 |
geomEditableAttr.setGeometryType(this.shpFile.getGeometryType(), this.shpFile.getGeometrySubType()); |
|
640 |
this.setStoreFeatureType(eft.getNotEditableCopy()); |
|
641 |
} |
|
642 |
} catch (DataException ex) { |
|
643 |
LOGGER.warn("Can't fix feture type.", ex); |
|
644 |
} |
|
623 | 645 |
|
646 |
} |
|
647 |
|
|
648 |
|
|
649 |
|
|
624 | 650 |
} |
trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.file/org.gvsig.fmap.dal.file.dbf/src/main/java/org/gvsig/fmap/dal/store/dbf/DBFStoreProvider.java | ||
---|---|---|
116 | 116 |
private boolean allowDuplicatedFieldNames; |
117 | 117 |
private FilteredLogger logger; |
118 | 118 |
|
119 |
protected FeatureType featureType; |
|
119 |
protected EditableFeatureType featureType;
|
|
120 | 120 |
|
121 | 121 |
|
122 | 122 |
protected static void registerMetadataDefinition() throws MetadataException { |
... | ... | |
366 | 366 |
} |
367 | 367 |
|
368 | 368 |
protected void initFeatureType() throws InitializeException { |
369 |
FeatureType defaultType = this.getTheFeatureType().getNotEditableCopy(); |
|
370 |
this.setFeatureType(defaultType); |
|
369 |
this.featureType = this.getTheFeatureType(); |
|
370 |
FeatureType defaultType = this.featureType.getNotEditableCopy(); |
|
371 |
this.setStoreFeatureType(defaultType); |
|
371 | 372 |
} |
372 | 373 |
|
373 |
private void setFeatureType(FeatureType ftype) {
|
|
374 |
protected void setStoreFeatureType(FeatureType ftype) {
|
|
374 | 375 |
FeatureStoreProviderServices store = this.getStoreServices(); |
375 | 376 |
List<FeatureType> ftypes = new ArrayList<>(); |
376 | 377 |
ftypes.add(ftype); |
377 |
this.featureType = ftype; |
|
378 | 378 |
store.setFeatureTypes(ftypes, ftype); |
379 | 379 |
} |
380 | 380 |
|
... | ... | |
794 | 794 |
sizeWithoutComputed +=1; |
795 | 795 |
} |
796 | 796 |
if(this.featureType.size()!=sizeWithoutComputed) { |
797 |
this.setFeatureType(featureType);
|
|
797 |
this.setStoreFeatureType(featureType.getNotEditableCopy());
|
|
798 | 798 |
} |
799 | 799 |
} catch (DataException ex) { |
800 | 800 |
|
Also available in: Unified diff