Revision 37805

View differences:

branches/v2_0_0_prep/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/shp/SHPNewStoreParameters.java
28 28
package org.gvsig.fmap.dal.store.shp;
29 29

  
30 30
import org.gvsig.fmap.dal.feature.EditableFeatureType;
31
import org.gvsig.fmap.dal.feature.FeatureAttributeDescriptor;
31 32
import org.gvsig.fmap.dal.feature.FeatureType;
32 33
import org.gvsig.fmap.dal.feature.NewFeatureStoreParameters;
33 34
import org.gvsig.fmap.dal.store.dbf.DBFNewStoreParameters;
......
81 82
    public void fixParameters() {
82 83
        super.fixParameters();
83 84
        EditableFeatureType featureType = getDefaultFeatureType();
84
        if (this.getDynValue(GEOMETRYTYPE_PARAMETER_NAME) == null
85
            && featureType != null) {
86
            int geometryType =
87
                featureType.getAttributeDescriptor(
88
                    featureType.getDefaultGeometryAttributeName())
89
                    .getGeometryType();
90
            setGeometryType(geometryType);
91
        }
85
        if (featureType != null) {
86
            FeatureAttributeDescriptor geometryAttribute =
87
                featureType.getDefaultGeometryAttribute();
88
            if (geometryAttribute != null) {                
89
                if (this.getDynValue(GEOMETRYTYPE_PARAMETER_NAME) == null) {
90
                    //Set the geometryType parameter              
91
                    int geometryType =
92
                        featureType.getAttributeDescriptor(
93
                            geometryAttribute.getName())
94
                            .getGeometryType();
95
                    setGeometryType(geometryType);
96
                }
97
             
98
                //If the CRS parameter has not been fixed, but there is 
99
                //a geometric attribute with the CRS, this attribute
100
                //can be used.
101
                if (getCRS() == null) {               
102
                    setCRS(geometryAttribute.getSRS());
103
                }
104
            }
105
        }      
92 106
    }
93 107
}

Also available in: Unified diff