Revision 47524 trunk/org.gvsig.desktop/org.gvsig.desktop.library/org.gvsig.exportto/org.gvsig.exportto.lib/org.gvsig.exportto.lib.impl/src/main/java/org/gvsig/export/impl/service/DefaultExportGeometryHelper.java

View differences:

DefaultExportGeometryHelper.java
22 22
        private final int targetGeometryIndex;
23 23
        private final int sourceGeometryIndex;
24 24
        private final ICoordTrans coord_trans;
25
        private boolean isExtraColumn;
26
        private String sourceGeometryName;
25 27
        
26 28
        private final ExportServiceManager serviceManager;
27 29
        private final ExportParametersGeometry parameters;
......
38 40
            FeatureAttributeDescriptor sourceGeomAtt = theSourceFeatureType.getDefaultGeometryAttribute();
39 41
            FeatureAttributeDescriptor targetGeomAtt;
40 42

  
43
            this.isExtraColumn = false;
41 44
            String sourceGeometryFieldName = this.parameters.getSourceGeometryFieldName();
42 45
            if( !StringUtils.isEmpty(sourceGeometryFieldName) ) {
43 46
                sourceGeomAtt = theSourceFeatureType.getAttributeDescriptor(sourceGeometryFieldName);
47
                if (sourceGeomAtt == null) {
48
                    sourceGeomAtt = theSourceFeatureType.getExtraColumns().get(sourceGeometryFieldName);
49
                    this.isExtraColumn = (sourceGeomAtt!=null);
50
                }
44 51
            }
45 52
            if (sourceGeomAtt == null) {
46 53
                // Si el origen no tiene geometria, no haremos nada con las
......
96 103
            } else {
97 104
                this.coord_trans = null;
98 105
            }
99
            this.sourceGeometryIndex = sourceGeomAtt.getIndex();
106
            if( this.isExtraColumn ) {
107
                this.sourceGeometryIndex = theSourceFeatureType.getExtraColumns().getIndexOf(sourceGeomAtt.getName());
108
            } else {
109
                this.sourceGeometryIndex = sourceGeomAtt.getIndex();
110
            }
100 111
            this.targetGeometryIndex = targetGeomAtt.getIndex();
112
            this.sourceGeometryName = sourceGeomAtt.getName();
101 113
        }
102 114

  
103 115
        private int getGeometryColumnCount(FeatureType featureType) {
......
123 135
            if( this.sourceGeometryIndex<0 || this.targetGeometryIndex<0 ) {
124 136
                return ExportServiceManager.FixGeometryStatus.STATE_OK;
125 137
            }
126
            Geometry geometry = sourceFeature.getGeometry(this.sourceGeometryIndex);
138
            Geometry geometry;
139
            if( this.isExtraColumn ) {
140
                geometry = sourceFeature.getGeometry(this.sourceGeometryName);            
141
            } else {
142
                geometry = sourceFeature.getGeometry(this.sourceGeometryIndex);            
143
            }
127 144
            ExportServiceManager.FixGeometryStatus check = serviceManager.fixGeometry(
128 145
                    this.parameters, 
129 146
                    this.coord_trans, 

Also available in: Unified diff