Revision 17614

View differences:

trunk/extensions/extAnnotations/src/com/iver/cit/gvsig/project/documents/gui/Annotation_TaskCreate.java
206 206

  
207 207
                for (int i = 0; i < rowCount; i++) {
208 208
                    IGeometry geom = va.getShape(i);
209
                    if (geom != null) {
210
						if (geom.getGeometryType() != FShape.POINT) {
211
							Point2D p = FLabel.createLabelPoint((FShape) geom
212
									.getInternalShape());
213
							geom = ShapeFactory.createPoint2D(p.getX(), p
214
									.getY());
215
						}
209 216

  
210
                    if (geom.getGeometryType() != FShape.POINT) {
211
                        Point2D p = FLabel.createLabelPoint((FShape) geom.getInternalShape());
212
                        geom = ShapeFactory.createPoint2D(p.getX(), p.getY());
213
                    }
217
						if (ct != null) {
218
							if (bMustClone) {
219
								geom = geom.cloneGeometry();
220
							}
214 221

  
215
                    if (ct != null) {
216
                        if (bMustClone) {
217
                            geom = geom.cloneGeometry();
218
                        }
222
							geom.reProject(ct);
223
						}
219 224

  
220
                        geom.reProject(ct);
221
                    }
225
						reportStep();
226
						setNote(PluginServices.getText(this, "exporting_")
227
								+ " " + i + "    " + rowCount);
222 228

  
223
                    reportStep();
224
                    setNote(PluginServices.getText(this, "exporting_") + " " +
225
                        i + "    " + rowCount);
229
						if (isCanceled()) {
230
							break;
231
						}
226 232

  
227
                    if (isCanceled()) {
228
                        break;
229
                    }
233
						if (geom != null) {
234
							Value[] valuesAnnotation = getValuesAnnotation(i);
230 235

  
231
                    if (geom != null) {
232
                        Value[] valuesAnnotation = getValuesAnnotation(i);
233

  
234
                        IFeature feat = new DefaultFeature(geom,
235
                                valuesAnnotation, "" + i);
236
                        DefaultRowEdited edRow = new DefaultRowEdited(feat,
237
                                DefaultRowEdited.STATUS_ADDED, i);
238
                        writer.process(edRow);
239
                    }
236
							IFeature feat = new DefaultFeature(geom,
237
									valuesAnnotation, "" + i);
238
							DefaultRowEdited edRow = new DefaultRowEdited(feat,
239
									DefaultRowEdited.STATUS_ADDED, i);
240
							writer.process(edRow);
241
						}
242
					}
240 243
                }
241 244
            } else {
242 245
                int counter = 0;
243 246

  
244
                for (int i = bitSet.nextSetBit(0); i >= 0;
245
                        i = bitSet.nextSetBit(i + 1)) {
246
                    IGeometry geom = va.getShape(i);
247
                for (int i = bitSet.nextSetBit(0); i >= 0; i = bitSet
248
						.nextSetBit(i + 1)) {
249
					IGeometry geom = va.getShape(i);
250
					if (geom != null) {
251
						if (geom.getGeometryType() != FShape.POINT) {
252
							Point2D p = FLabel.createLabelPoint((FShape) geom
253
									.getInternalShape());
254
							geom = ShapeFactory.createPoint2D(p.getX(), p
255
									.getY());
256
						}
247 257

  
248
                    if (geom.getGeometryType() != FShape.POINT) {
249
                        Point2D p = FLabel.createLabelPoint((FShape) geom.getInternalShape());
250
                        geom = ShapeFactory.createPoint2D(p.getX(), p.getY());
251
                    }
258
						if (ct != null) {
259
							if (bMustClone) {
260
								geom = geom.cloneGeometry();
261
							}
252 262

  
253
                    if (ct != null) {
254
                        if (bMustClone) {
255
                            geom = geom.cloneGeometry();
256
                        }
263
							geom.reProject(ct);
264
						}
257 265

  
258
                        geom.reProject(ct);
259
                    }
266
						reportStep();
267
						setNote(PluginServices.getText(this, "exporting_")
268
								+ " " + counter + "    " + bitSet.cardinality());
260 269

  
261
                    reportStep();
262
                    setNote(PluginServices.getText(this, "exporting_") + " " +
263
                        counter + "    " + bitSet.cardinality());
270
						if (isCanceled()) {
271
							break;
272
						}
264 273

  
265
                    if (isCanceled()) {
266
                        break;
267
                    }
274
						if (geom != null) {
275
							Value[] valuesAnnotation = getValuesAnnotation(i);
276
							IFeature feat = new DefaultFeature(geom,
277
									valuesAnnotation, "" + i);
278
							DefaultRowEdited edRow = new DefaultRowEdited(feat,
279
									DefaultRowEdited.STATUS_ADDED, i);
268 280

  
269
                    if (geom != null) {
270
                        Value[] valuesAnnotation = getValuesAnnotation(i);
271
                        IFeature feat = new DefaultFeature(geom,
272
                                valuesAnnotation, "" + i);
273
                        DefaultRowEdited edRow = new DefaultRowEdited(feat,
274
                                DefaultRowEdited.STATUS_ADDED, i);
281
							writer.process(edRow);
282
						}
283
					}
275 284

  
276
                        writer.process(edRow);
277
                    }
278

  
279

  
280
                }
285
				}
281 286
            }
282 287
            va.stop();
283 288
        }
284 289

  
285 290
        writer.postProcess();
291
        setCurrentStep(getFinalStep());
286 292

  
287 293
        mapAttri.clear();
288 294
        mapGeom.clear();
......
537 543
     * @throws EditionException DOCUMENT ME!
538 544
     */
539 545
    private void modifyMap(IGeometry geom, int index) throws ReadDriverException {
540
        if (geom.getGeometryType() != FShape.POINT) {
546
        if (geom==null)
547
        	return;
548
    	if (geom.getGeometryType() != FShape.POINT) {
541 549
            Point2D p = FLabel.createLabelPoint(geom.getInternalShape());
542 550
            geom = ShapeFactory.createPoint2D(p.getX(), p.getY());
543 551
        }
544 552

  
545
        if (geom != null) {
546
            Value[] valuesAnnotation = getValuesAnnotation(index);
547
            String textValue = valuesAnnotation[0].toString();
548

  
549
            if (!mapAttri.containsKey(textValue)) {
550
                mapAttri.put(textValue, valuesAnnotation);
551
            }
552

  
553
            if (mapGeom.containsKey(textValue)) {
554
                IGeometry geometry2 = geom;
555
                Rectangle2D rectangle1 = (Rectangle2D) mapGeom.get(textValue);
556

  
557
                mapGeom.put(textValue,
558
                    rectangle1.createUnion(geometry2.getBounds2D()));
559
                reportStep();
560
                setNote(PluginServices.getText(this, "exporting_"));
561
            } else {
562
                mapGeom.put(textValue, geom.getBounds2D());
563
            }
553
        Value[] valuesAnnotation = getValuesAnnotation(index);
554
        String textValue = valuesAnnotation[0].toString();
555
        if (!mapAttri.containsKey(textValue)) {
556
           mapAttri.put(textValue, valuesAnnotation);
564 557
        }
558
        if (mapGeom.containsKey(textValue)) {
559
           IGeometry geometry2 = geom;
560
           Rectangle2D rectangle1 = (Rectangle2D) mapGeom.get(textValue);
561
           mapGeom.put(textValue,
562
           rectangle1.createUnion(geometry2.getBounds2D()));
563
           reportStep();
564
           setNote(PluginServices.getText(this, "exporting_"));
565
        } else {
566
           mapGeom.put(textValue, geom.getBounds2D());
567
        }
565 568
    }
566 569

  
567 570
	public void finished() {

Also available in: Unified diff