Revision 28223 trunk/extensions/extDerivedGeometries/src/es/iver/derivedGeom/process/AddGeometricInfoProcess.java

View differences:

AddGeometricInfoProcess.java
37 37
import org.gvsig.gui.beans.buttonspanel.ButtonsPanel;
38 38
import org.gvsig.gui.beans.incrementabletask.IncrementableProcess;
39 39
import org.gvsig.gui.beans.incrementabletask.IncrementableTask;
40
import org.gvsig.quickInfo.utils.geometries.GeometryInfo;
41
import org.gvsig.quickInfo.utils.geometries.GeometryUtilities;
42 40

  
43 41
import com.hardcode.gdbms.engine.values.Value;
44 42
import com.hardcode.gdbms.engine.values.ValueFactory;
......
55 53
import com.iver.cit.gvsig.fmap.core.FPoint2D;
56 54
import com.iver.cit.gvsig.fmap.core.FPoint3D;
57 55
import com.iver.cit.gvsig.fmap.core.FShape;
56
import com.iver.cit.gvsig.fmap.core.GeometryUtilities;
58 57
import com.iver.cit.gvsig.fmap.core.IGeometry;
59 58
import com.iver.cit.gvsig.fmap.drivers.FieldDescription;
60 59
import com.iver.cit.gvsig.fmap.drivers.ILayerDefinition;
......
327 326
			percentage = 33;
328 327

  
329 328
			GeomInfo field;
330
			GeometryInfo gInfo;
329
//			GeometryInfo gInfo;
331 330
			AddedFieldInfo addedField = null;
332 331
			int i, j;
333 332
			String operationName = PluginServices.getText(null, "setGeomInfo_");
......
554 553
							}
555 554
							else {
556 555
								try {
557
									gInfo = GeometryUtilities.getGeometryPoints(mapControl, geometry);
558

  
559
									c_value = GeometryUtilities.getLength(layer, shape, gInfo);
556
									c_value = GeometryUtilities.getLength(layer.getMapContext().getViewPort(), geometry);
560 557
								}
561 558
								catch (Exception e) {
562 559
									NotificationManager.showMessageError(PluginServices.getText(null, "Failed_calculating_perimeter_of_geometry"), e);
563
									gInfo = null;
564

  
565 560
									percentage += inc;
566 561
									continue;
567 562
								}
......
603 598
								/* 5.6- Disables the edition of the row */
604 599
								vea.endComplexRow(operationName);
605 600

  
606
								gInfo = null;
607

  
608 601
								/* 5.7- Increments the counter of the fields added */
609 602
								n_fields_added ++;
610 603
							}
......
636 629
								continue;
637 630
							}
638 631
							else {
639
								try {
640
									gInfo = GeometryUtilities.getGeometryPoints(mapControl, geometry);
641
								} catch (Exception e) {
642
									NotificationManager.showMessageError(PluginServices.getText(null, "Failed_calculating_geometry_points"), e);
643
									gInfo = null;
644 632

  
645
									percentage += inc;
646
									continue;
647
								}
648

  
649 633
								/* 5.2- Enables the edition of the row */
650 634
								if (cancelProcess.isCanceled()) {
651 635
									throw new InterruptedException();
......
669 653
									case GeomInfo.PERIMETER:
670 654
										/* PERIMETER */
671 655
										try {
672
											c_value = GeometryUtilities.getLength(layer, shape, gInfo);
656
											c_value = GeometryUtilities.getLength(layer.getMapContext().getViewPort(), geometry);
673 657
										}
674 658
										catch (Exception e) {
675 659
											NotificationManager.showMessageError(PluginServices.getText(null, "Failed_calculating_perimeter_of_geometry"), e);
676
											gInfo = null;
677

  
678 660
											percentage += inc;
679 661
											continue;
680 662
										}
......
684 666
									case GeomInfo.AREA:
685 667
										/* AREA */
686 668
										try {
687
											c_value = GeometryUtilities.getArea(layer, shape, gInfo);
669
											c_value = GeometryUtilities.getArea(layer, geometry);
688 670
										}
689 671
										catch (Exception e) {
690 672
											NotificationManager.showMessageError(PluginServices.getText(null, "Failed_calculating_area_of_geometry"), e);
691
											gInfo = null;
692
		
693 673
											percentage += inc;
694 674
											continue;
695 675
										}
......
716 696
								/* 5.6- Disables the edition of the row */
717 697
								vea.endComplexRow(operationName);
718 698

  
719
								gInfo = null;
720

  
721 699
								/* 5.7- Increments the counter of the fields added */
722 700
								n_fields_added ++;
723 701
							}

Also available in: Unified diff