Revision 41127 trunk/org.gvsig.desktop/org.gvsig.desktop.library/org.gvsig.exportto/org.gvsig.exportto.swing/org.gvsig.exportto.swing.prov/org.gvsig.exportto.swing.prov.jdbc/src/main/java/org/gvsig/exportto/swing/prov/jdbc/ExporrtoJDBCService.java
ExporrtoJDBCService.java | ||
---|---|---|
43 | 43 |
import org.gvsig.fmap.dal.feature.EditableFeatureAttributeDescriptor; |
44 | 44 |
import org.gvsig.fmap.dal.feature.EditableFeatureType; |
45 | 45 |
import org.gvsig.fmap.dal.feature.Feature; |
46 |
import org.gvsig.fmap.dal.feature.FeatureAttributeDescriptor; |
|
46 | 47 |
import org.gvsig.fmap.dal.feature.FeatureSet; |
47 | 48 |
import org.gvsig.fmap.dal.feature.FeatureStore; |
48 | 49 |
import org.gvsig.fmap.dal.feature.FeatureType; |
... | ... | |
136 | 137 |
EditableFeatureAttributeDescriptor eatt = |
137 | 138 |
(EditableFeatureAttributeDescriptor) |
138 | 139 |
ef_type.getDefaultGeometryAttribute(); |
139 |
eatt.setSRS(this.targetProjection); |
|
140 |
if (eatt != null) { |
|
141 |
eatt.setSRS(this.targetProjection); |
|
142 |
} |
|
140 | 143 |
// ====================================== |
141 | 144 |
|
142 | 145 |
newFeatureStoreParameters.setDefaultFeatureType(ef_type); |
... | ... | |
144 | 147 |
|
145 | 148 |
// ====================================== |
146 | 149 |
// Reprojection |
147 |
IProjection sourceProjection = |
|
148 |
featureStore.getDefaultFeatureType().getDefaultGeometryAttribute().getSRS(); |
|
149 |
|
|
150 |
FeatureAttributeDescriptor geo_att = f_type.getDefaultGeometryAttribute(); |
|
151 |
IProjection sourceProjection = null; |
|
150 | 152 |
ICoordTrans coord_trans = null; |
151 |
// this comparison is perhaps too preventive |
|
152 |
// we could have two instances of same projection |
|
153 |
// so we would do more computations than needed |
|
154 |
if (sourceProjection != this.targetProjection) { |
|
155 |
coord_trans = sourceProjection.getCT(this.targetProjection); |
|
153 |
if (geo_att != null) { |
|
154 |
sourceProjection = geo_att.getSRS(); |
|
155 |
// this comparison is perhaps too preventive |
|
156 |
// we could have two instances of same projection |
|
157 |
// so we would do more computations than needed |
|
158 |
if (sourceProjection != this.targetProjection) { |
|
159 |
coord_trans = sourceProjection.getCT(this.targetProjection); |
|
160 |
} |
|
156 | 161 |
} |
157 | 162 |
// ============================================ |
158 | 163 |
|
... | ... | |
176 | 181 |
edit_feat = target.createNewFeature(targetType, feature); |
177 | 182 |
// ================================================ |
178 | 183 |
// Reprojection |
179 |
if (coord_trans != null) { |
|
184 |
if (geo_att != null && coord_trans != null) {
|
|
180 | 185 |
reproj_geom = edit_feat.getDefaultGeometry(); |
181 | 186 |
reproj_geom = reproj_geom.cloneGeometry(); |
182 | 187 |
reproj_geom.reProject(coord_trans); |
... | ... | |
200 | 205 |
*/ |
201 | 206 |
String storename = newFeatureStoreParameters.getDataStoreName(); |
202 | 207 |
JDBCStoreParameters params = getParams(explorer, tableName, schema, storename); |
203 |
params.setCRS(targetProjection); |
|
204 |
params.setDefaultGeometryField(targetType.getDefaultGeometryAttributeName()); |
|
205 | 208 |
|
209 |
if (geo_att != null) { |
|
210 |
params.setCRS(targetProjection); |
|
211 |
params.setDefaultGeometryField(targetType.getDefaultGeometryAttributeName()); |
|
212 |
} |
|
213 |
|
|
206 | 214 |
if (exporttoServiceFinishAction != null) { |
207 |
exporttoServiceFinishAction.finished(storename, params); |
|
215 |
exporttoServiceFinishAction.finished( |
|
216 |
tableName + " (" + storename + ")", |
|
217 |
params); |
|
208 | 218 |
} |
209 | 219 |
|
210 | 220 |
} catch (Exception e) { |
Also available in: Unified diff