Revision 3052 trunk/extensions/extGeoProcessing/src/com/iver/gvsig/geoprocessing/gui/GeoProcessingPanel.java

View differences:

GeoProcessingPanel.java
1421 1421
            for (int i=0;i<geometriesToUnionAux.size();i++) {
1422 1422
                for (int j=0;j<geometriesUned.size();j++) {
1423 1423
                    if (((Geometry)geometriesToUnionAux.get(i)).equals((Geometry)geometriesUned.get(j))) {
1424
                        //geometriesToUnionAux.remove(i);
1425
                        //i--;
1426 1424
                    } else {
1427
                        // Para evitar el error topol?gico del agujero en el borde y a
1428
                        // la vez no cagarla en el resto de casos ...
1429
                        GeometryFactory gf = new GeometryFactory(new PrecisionModel());
1430
                        LineString toUnionShell = gf.createLineString(((Geometry)geometriesToUnionAux.get(i)).getCoordinates());
1431
                        LineString unedShell = gf.createLineString(((Geometry)geometriesUned.get(j)).getCoordinates());
1432
                        //if (((Geometry)geometriesToUnionAux.get(i)).crosses(((Geometry)geometriesUned.get(j)))) {
1433
                        if (toUnionShell.crosses(unedShell)) {
1434
                            Geometry difPol = null;
1435
                            for (int k=0;k<uningGeometriesAux.size();k++) {
1436
                                if (((Geometry)uningGeometriesAux.get(k)).intersects(((Geometry)geometriesUned.get(j)))) {
1437
                                    difPol = ((Geometry)uningGeometriesAux.get(k));
1438
                                    break;
1439
                                }
1440
                            }
1441
                            geometriesToUnionAux.set(i,((Geometry)geometriesToUnionAux.get(i)).difference(difPol));
1442
                        } else {
1443
                            geometriesToUnionAux.set(i,((Geometry)geometriesToUnionAux.get(i)).difference((Geometry)geometriesUned.get(j)));
1444
                        }
1425
                        geometriesToUnionAux.set(i,((Geometry)geometriesToUnionAux.get(i)).difference((Geometry)geometriesUned.get(j)));
1445 1426
                    }
1446 1427
                }
1447 1428
            }
1448 1429
            for (int i=0;i<uningGeometriesAux.size();i++) {
1449 1430
                for (int j=0;j<geometriesUned.size();j++) {
1450 1431
                    if (((Geometry)uningGeometriesAux.get(i)).equals((Geometry)geometriesUned.get(j))) {
1451
                        //uningGeometriesAux.remove(i);
1452
                        //i--;
1453 1432
                    } else {
1454
                        GeometryFactory gf = new GeometryFactory(new PrecisionModel());
1455
                        LineString uningShell = gf.createLineString(((Geometry)uningGeometriesAux.get(i)).getCoordinates());
1456
                        LineString unedShell = gf.createLineString(((Geometry)geometriesUned.get(j)).getCoordinates());
1457
                        //if (((Geometry)uningGeometriesAux.get(i)).crosses(((Geometry)geometriesUned.get(j)))) {
1458
                        if (uningShell.crosses(unedShell)) {
1459
                            Geometry difPol = null;
1460
                            for (int k=0;k<geometriesToUnionAux.size();k++) {
1461
                                if (((Geometry)geometriesToUnionAux.get(k)).intersects(((Geometry)geometriesUned.get(j)))) {
1462
                                    difPol = ((Geometry)geometriesToUnionAux.get(k));
1463
                                    break;
1464
                                }
1465
                            }
1466
                            uningGeometriesAux.set(i,((Geometry)uningGeometriesAux.get(i)).difference(difPol));
1467
                        } else {
1468
                            uningGeometriesAux.set(i,((Geometry)uningGeometriesAux.get(i)).difference((Geometry)geometriesUned.get(j)));
1469
                        }
1433
                        uningGeometriesAux.set(i,((Geometry)uningGeometriesAux.get(i)).difference((Geometry)geometriesUned.get(j)));
1470 1434
                    }
1471 1435
                }
1472 1436
            }

Also available in: Unified diff