Revision 28223 trunk/extensions/extQuickInfo/src/org/gvsig/quickInfo/tools/QuickInfoListener.java
QuickInfoListener.java | ||
---|---|---|
45 | 45 |
import org.gvsig.quickInfo.FormatDecimalNumber; |
46 | 46 |
import org.gvsig.quickInfo.GeometryIDInfo; |
47 | 47 |
import org.gvsig.quickInfo.QuickInfoFLayerSelected; |
48 |
import org.gvsig.quickInfo.utils.geometries.GeometryInfo; |
|
49 |
import org.gvsig.quickInfo.utils.geometries.GeometryUtilities; |
|
50 | 48 |
|
51 | 49 |
import com.hardcode.gdbms.driver.exceptions.ReadDriverException; |
52 | 50 |
import com.hardcode.gdbms.engine.data.DataSource; |
... | ... | |
63 | 61 |
import com.iver.cit.gvsig.fmap.core.FPolyline2D; |
64 | 62 |
import com.iver.cit.gvsig.fmap.core.FPolyline3D; |
65 | 63 |
import com.iver.cit.gvsig.fmap.core.FShape; |
64 |
import com.iver.cit.gvsig.fmap.core.GeometryUtilities; |
|
66 | 65 |
import com.iver.cit.gvsig.fmap.core.IGeometry; |
67 | 66 |
import com.iver.cit.gvsig.fmap.layers.FBitSet; |
68 | 67 |
import com.iver.cit.gvsig.fmap.layers.FLyrVect; |
... | ... | |
277 | 276 |
|
278 | 277 |
Vector cFieldsToRestore = null; |
279 | 278 |
GeometryIDInfo gIDInfo = null; |
280 |
GeometryInfo gInfo = null; |
|
281 | 279 |
|
282 | 280 |
for (int j = bs.nextSetBit(0); j >= 0; j = bs.nextSetBit(j + 1)) { |
283 | 281 |
if (infoSelected.getLayerFields().size() > 0) { |
... | ... | |
303 | 301 |
ReadableVectorial rv = ((FLyrVect)layer).getSource(); |
304 | 302 |
|
305 | 303 |
rv.start(); |
306 |
IGeometry geometry = (IGeometry) rv.getShape(j);
|
|
304 |
IGeometry geometry = rv.getShape(j); |
|
307 | 305 |
rv.stop(); |
308 | 306 |
|
309 | 307 |
Shape shape = null; |
... | ... | |
393 | 391 |
key = PluginServices.getText(this, "Length"); |
394 | 392 |
values = ((Vector)infoSelected.getCalculatedLayerFields().get(key)); |
395 | 393 |
if (values != null) { |
396 |
gInfo = GeometryUtilities.getGeometryPoints(mapControl, geometry); |
|
397 |
|
|
398 | 394 |
try { |
399 |
perimeter = GeometryUtilities.getLength(infoSelected.getLayer(), shape, gInfo);
|
|
395 |
perimeter = GeometryUtilities.getLength(infoSelected.getLayer().getMapContext().getViewPort(), geometry);
|
|
400 | 396 |
|
401 | 397 |
values.add(FormatDecimalNumber.formatDecimal(perimeter / relationDistanceUnitsToMeters) + " " + nameDistanceUnits); |
402 | 398 |
// values.add(FormatDecimalNumber.formatDecimal(perimeter / relationDistanceUnitsToMeters, "?10", true) + " " + nameDistanceUnits); |
... | ... | |
413 | 409 |
// |
414 | 410 |
// xs_ar = ys_ar = null; |
415 | 411 |
// pls_n_points = null; |
416 |
|
|
417 |
gInfo = null; |
|
418 | 412 |
} |
419 | 413 |
break; |
420 | 414 |
case FShape.POLYGON: |
... | ... | |
422 | 416 |
key = PluginServices.getText(this, "Area"); |
423 | 417 |
values = ((Vector)infoSelected.getCalculatedLayerFields().get(key)); |
424 | 418 |
if (values != null) { |
425 |
gInfo = GeometryUtilities.getGeometryPoints(mapControl, geometry); |
|
426 |
|
|
427 | 419 |
try { |
428 |
area = GeometryUtilities.getArea(infoSelected.getLayer(), shape, gInfo);
|
|
420 |
area = GeometryUtilities.getArea(infoSelected.getLayer(), geometry);
|
|
429 | 421 |
|
430 | 422 |
values.add(FormatDecimalNumber.formatDecimal(area / relationAreaUnitsToMeters2) + " " + nameAreaUnits); |
431 | 423 |
// values.add(FormatDecimalNumber.formatDecimal(area / relationAreaUnitsToMeters2, "?10", true) + " " + nameAreaUnits); |
... | ... | |
442 | 434 |
key = PluginServices.getText(this, "Perimeter"); |
443 | 435 |
values = ((Vector)infoSelected.getCalculatedLayerFields().get(key)); |
444 | 436 |
if (values != null) { |
445 |
if (gInfo != null) |
|
446 |
gInfo = GeometryUtilities.getGeometryPoints(mapControl, geometry); |
|
447 |
|
|
448 | 437 |
try { |
449 |
perimeter = GeometryUtilities.getLength(infoSelected.getLayer(), shape, gInfo);
|
|
438 |
perimeter = GeometryUtilities.getLength(infoSelected.getLayer().getMapContext().getViewPort(), geometry);
|
|
450 | 439 |
|
451 | 440 |
values.add(FormatDecimalNumber.formatDecimal(perimeter / relationDistanceUnitsToMeters) + " " + nameDistanceUnits); |
452 | 441 |
// values.add(FormatDecimalNumber.formatDecimal(perimeter / relationDistanceUnitsToMeters, "?10", true) + " " + nameDistanceUnits); |
... | ... | |
458 | 447 |
return; |
459 | 448 |
} |
460 | 449 |
} |
461 |
|
|
462 |
gInfo = null; |
|
463 | 450 |
break; |
464 | 451 |
case FShape.TEXT: |
465 | 452 |
break; |
... | ... | |
513 | 500 |
key = PluginServices.getText(this, "Area"); |
514 | 501 |
values = ((Vector)infoSelected.getCalculatedLayerFields().get(key)); |
515 | 502 |
if (values != null) { |
516 |
gInfo = GeometryUtilities.getGeometryPoints(mapControl, geometry); |
|
517 | 503 |
|
518 | 504 |
try { |
519 |
area = GeometryUtilities.getArea(infoSelected.getLayer(), shape, gInfo);
|
|
505 |
area = GeometryUtilities.getArea(infoSelected.getLayer(), geometry);
|
|
520 | 506 |
|
521 | 507 |
values.add(FormatDecimalNumber.formatDecimal(area / relationAreaUnitsToMeters2) + " " + nameAreaUnits); |
522 | 508 |
// values.add(FormatDecimalNumber.formatDecimal(area / relationAreaUnitsToMeters2, "?10", true) + " " + nameAreaUnits); |
... | ... | |
535 | 521 |
key = PluginServices.getText(this, "Perimeter"); |
536 | 522 |
values = ((Vector)infoSelected.getCalculatedLayerFields().get(key)); |
537 | 523 |
if (values != null) { |
538 |
if (gInfo != null) |
|
539 |
gInfo = GeometryUtilities.getGeometryPoints(mapControl, geometry); |
|
540 | 524 |
|
541 | 525 |
try { |
542 |
perimeter = GeometryUtilities.getLength(infoSelected.getLayer(), shape, gInfo);
|
|
526 |
perimeter = GeometryUtilities.getLength(infoSelected.getLayer().getMapContext().getViewPort(), geometry);
|
|
543 | 527 |
|
544 | 528 |
values.add(FormatDecimalNumber.formatDecimal(perimeter / relationDistanceUnitsToMeters) + " " + nameDistanceUnits); |
545 | 529 |
// values.add(FormatDecimalNumber.formatDecimal(perimeter / relationDistanceUnitsToMeters, "?10", true) + " " + nameDistanceUnits); |
... | ... | |
575 | 559 |
cFieldsToRestore.add(text); |
576 | 560 |
map.remove(text); |
577 | 561 |
|
578 |
gInfo = null; |
|
579 | 562 |
continue; |
580 | 563 |
} |
581 | 564 |
else { |
... | ... | |
585 | 568 |
key = PluginServices.getText(this, "Length"); |
586 | 569 |
values = ((Vector)infoSelected.getCalculatedLayerFields().get(key)); |
587 | 570 |
if (values != null) { |
588 |
gInfo = GeometryUtilities.getGeometryPoints(mapControl, geometry); |
|
589 | 571 |
|
590 | 572 |
try { |
591 |
perimeter = GeometryUtilities.getLength(infoSelected.getLayer(), shape, gInfo);
|
|
573 |
perimeter = GeometryUtilities.getLength(infoSelected.getLayer().getMapContext().getViewPort(), geometry);
|
|
592 | 574 |
|
593 | 575 |
values.add(FormatDecimalNumber.formatDecimal(perimeter / relationDistanceUnitsToMeters) + " " + nameDistanceUnits); |
594 | 576 |
// values.add(FormatDecimalNumber.formatDecimal(perimeter / relationDistanceUnitsToMeters, "?10", true) + " " + nameDistanceUnits); |
... | ... | |
625 | 607 |
cFieldsToRestore.add(text); |
626 | 608 |
map.remove(text); |
627 | 609 |
|
628 |
gInfo = null; |
|
629 | 610 |
continue; |
630 | 611 |
} |
631 | 612 |
else { |
Also available in: Unified diff