Revision 3045
trunk/extensions/extGeoProcessing/src/com/iver/gvsig/geoprocessing/gui/GeoProcessingPanel.java | ||
---|---|---|
1361 | 1361 |
for (int i=0;i<geometriesUned.size();i++) { |
1362 | 1362 |
geometriesUned2.add(geometriesUned.get(i)); |
1363 | 1363 |
} |
1364 |
//int num = geometriesUned.size(); |
|
1365 | 1364 |
// A?ado a geometriesUned2 las geometr?as de geometriesToUnion que no |
1366 | 1365 |
// intersectan con uningGeometries. |
1367 |
// los arrays originales han cambiado en los pasos anteriores? |
|
1368 |
// debuggear con el inverso a ver que pasa ... |
|
1369 |
// ?el intersect funciona como creo que funciona? |
|
1370 | 1366 |
for (int i=0;i<geometriesToUnion.length;i++) { |
1371 | 1367 |
Geometry geometryToUnion = geometriesToUnion[i]; |
1372 | 1368 |
boolean intersectsWithAnyGeometry = false; |
1373 |
for (int j=0;j<geometriesUned.size();j++) {
|
|
1374 |
Geometry geometryUned = (Geometry)geometriesUned.get(j);
|
|
1375 |
if (geometryToUnion.intersects(geometryUned)) intersectsWithAnyGeometry = true;
|
|
1369 |
for (int j=0;j<uningGeometries.length;j++) {
|
|
1370 |
Geometry uningGeometry = uningGeometries[j];
|
|
1371 |
if (geometryToUnion.intersects(uningGeometry)) intersectsWithAnyGeometry = true;
|
|
1376 | 1372 |
} |
1377 | 1373 |
if (intersectsWithAnyGeometry) { |
1378 | 1374 |
//Geometry difference = geometryToUnion.difference(geometryUned); |
... | ... | |
1395 | 1391 |
for (int i=0;i<uningGeometries.length;i++) { |
1396 | 1392 |
Geometry uningGeometry = uningGeometries[i]; |
1397 | 1393 |
boolean intersectsWithAnyGeometry = false; |
1398 |
for (int j=0;j<geometriesUned.size();j++) {
|
|
1399 |
Geometry geometryUned = (Geometry)geometriesUned.get(j);
|
|
1400 |
if (uningGeometry.intersects(geometryUned)) intersectsWithAnyGeometry = true;
|
|
1394 |
for (int j=0;j<geometriesToUnion.length;j++) {
|
|
1395 |
Geometry geometryToUnion = geometriesToUnion[j];
|
|
1396 |
if (uningGeometry.intersects(geometryToUnion)) intersectsWithAnyGeometry = true;
|
|
1401 | 1397 |
} |
1402 | 1398 |
if (intersectsWithAnyGeometry) { |
1403 | 1399 |
//Geometry difference = jtsUningGeometry.difference(jtsGeometryUned); |
... | ... | |
1417 | 1413 |
} |
1418 | 1414 |
// Le quito los cachos que ya tengo a las geometrias que faltan de |
1419 | 1415 |
// geometriesToUnion. |
1420 |
// Esto de las kas es una irregularidad ... ver que pasa ... |
|
1421 |
// ?y si uso geometriesUned en vez del 2? |
|
1422 |
// y la k creo que deber?a estar dentro ... |
|
1423 | 1416 |
BitSet bitSet1 = new BitSet(); |
1424 | 1417 |
bitSet1.clear(); |
1425 |
//int k1=0; |
|
1426 |
for (int i=0;i<geometriesUned.size();i++) { |
|
1418 |
/*for (int i=0;i<geometriesUned.size();i++) { |
|
1427 | 1419 |
Geometry geometryUned = (Geometry)geometriesUned.get(i); |
1428 | 1420 |
for (int j=0;j<geometriesToUnion.length;j++) { |
1429 | 1421 |
if (geometriesToUnion[j].intersects(geometryUned) && !geometriesToUnion[j].equals(geometryUned)) { |
1430 | 1422 |
geometriesToUnion[j] = geometriesToUnion[j].difference(geometryUned); |
1431 |
//bitSet1.set(k1); |
|
1432 | 1423 |
bitSet1.set(j); |
1433 |
//k1++; |
|
1434 | 1424 |
} |
1435 | 1425 |
} |
1426 |
}*/ |
|
1427 |
Geometry[] geometriesToUnionAux = new Geometry[geometriesToUnion.length]; |
|
1428 |
for (int i=0;i<geometriesToUnion.length;i++) { |
|
1429 |
geometriesToUnionAux[i] = geometriesToUnion[i]; |
|
1436 | 1430 |
} |
1431 |
Geometry[] uningGeometriesAux = new Geometry[uningGeometries.length]; |
|
1432 |
for (int i=0;i<uningGeometries.length;i++) { |
|
1433 |
uningGeometriesAux[i] = geometriesToUnion[i]; |
|
1434 |
} |
|
1435 |
for (int i=0;i<geometriesToUnion.length;i++) { |
|
1436 |
//Geometry geometryToUnion = geometriesToUnion[i]; |
|
1437 |
for (int j=0;j<geometriesUned.size();j++) { |
|
1438 |
if (((Geometry)geometriesUned.get(j)).intersects(geometriesToUnion[i]) && !((Geometry)geometriesUned.get(j)).equals(geometriesToUnion[i])) { |
|
1439 |
// Buscar el cacho grande para utilizarlo en la resta y evitar el pol?gono con un |
|
1440 |
// agujero en el borde |
|
1441 |
Geometry difPol = null; |
|
1442 |
for (int k=0;k<uningGeometries.length;k++) { |
|
1443 |
if (uningGeometries[k].intersects(((Geometry)geometriesUned.get(j)))) { |
|
1444 |
difPol = uningGeometries[k]; |
|
1445 |
break; |
|
1446 |
} |
|
1447 |
} |
|
1448 |
geometriesToUnion[i] = geometriesToUnion[i].difference(difPol); |
|
1449 |
//geometriesToUnion[i] = geometriesToUnion[i].difference(((Geometry)geometriesUned.get(j))); |
|
1450 |
bitSet1.set(i); |
|
1451 |
} else { |
|
1452 |
bitSet1.set(i, false); |
|
1453 |
} |
|
1454 |
} |
|
1455 |
} |
|
1456 |
/*for (int i=0;i<geometriesUned.size();i++) { |
|
1457 |
Geometry geometryUned = (Geometry)geometriesUned.get(i); |
|
1458 |
for (int j=0;j<geometriesToUnion.length;j++) { |
|
1459 |
if (geometriesToUnion[j].intersects(geometryUned) && !geometriesToUnion[j].equals(geometryUned)) { |
|
1460 |
Geometry difPol = null; |
|
1461 |
for (int k=0;k<uningGeometries.length;k++) { |
|
1462 |
if (uningGeometries[k].intersects(geometryUned)) { |
|
1463 |
difPol = uningGeometries[k]; |
|
1464 |
break; |
|
1465 |
} |
|
1466 |
} |
|
1467 |
geometriesToUnion[j] = geometriesToUnion[j].difference(difPol); |
|
1468 |
geometriesToUnion[j] = geometriesToUnion[j].difference(geometryUned); |
|
1469 |
bitSet1.set(j); |
|
1470 |
} else { |
|
1471 |
//bitSet1.set(j, false); |
|
1472 |
} |
|
1473 |
} |
|
1474 |
}*/ |
|
1437 | 1475 |
// Le quito los cachos que ya tengo a las geometrias que faltan de |
1438 | 1476 |
// uningGeometries. |
1439 | 1477 |
BitSet bitSet2 = new BitSet(); |
1440 | 1478 |
bitSet2.clear(); |
1441 |
//int k2=0; |
|
1442 |
for (int i=0;i<geometriesUned.size();i++) { |
|
1479 |
/*for (int i=0;i<geometriesUned.size();i++) { |
|
1443 | 1480 |
Geometry geometryUned = (Geometry)geometriesUned.get(i); |
1444 | 1481 |
for (int j=0;j<uningGeometries.length;j++) { |
1445 | 1482 |
if (uningGeometries[j].intersects(geometryUned) && !uningGeometries[j].equals(geometryUned)) { |
1446 | 1483 |
uningGeometries[j] = uningGeometries[j].difference(geometryUned); |
1447 |
//bitSet2.set(k2); |
|
1448 | 1484 |
bitSet2.set(j); |
1449 |
//k2++; |
|
1450 | 1485 |
} |
1451 | 1486 |
} |
1487 |
}*/ |
|
1488 |
for (int i=0;i<uningGeometries.length;i++) { |
|
1489 |
//Geometry uningGeometry = uningGeometries[i]; |
|
1490 |
for (int j=0;j<geometriesUned.size();j++) { |
|
1491 |
if (((Geometry)geometriesUned.get(j)).intersects(uningGeometries[i]) && !((Geometry)geometriesUned.get(j)).equals(uningGeometries[i])) { |
|
1492 |
// Buscar el cacho grande para utilizarlo en la resta y evitar el pol?gono con un |
|
1493 |
// agujero en el borde |
|
1494 |
Geometry difPol = null; |
|
1495 |
for (int k=0;k<geometriesToUnionAux.length;k++) { |
|
1496 |
if (geometriesToUnionAux[k].intersects(((Geometry)geometriesUned.get(j)))) { |
|
1497 |
difPol = geometriesToUnionAux[k]; |
|
1498 |
break; |
|
1499 |
} |
|
1500 |
} |
|
1501 |
uningGeometries[i] = uningGeometries[i].difference(difPol); |
|
1502 |
//uningGeometries[i] = uningGeometries[i].difference(((Geometry)geometriesUned.get(j))); |
|
1503 |
bitSet2.set(i); |
|
1504 |
} else { |
|
1505 |
bitSet2.set(i, false); |
|
1506 |
} |
|
1507 |
} |
|
1452 | 1508 |
} |
1509 |
/*for (int i=0;i<geometriesUned.size();i++) { |
|
1510 |
Geometry geometryUned = (Geometry)geometriesUned.get(i); |
|
1511 |
for (int j=0;j<uningGeometries.length;j++) { |
|
1512 |
if (uningGeometries[j].intersects(geometryUned) && !uningGeometries[j].equals(geometryUned)) { |
|
1513 |
Geometry difPol = null; |
|
1514 |
for (int k=0;k<geometriesToUnionAux.length;k++) { |
|
1515 |
if (geometriesToUnionAux[k].intersects(geometryUned)) { |
|
1516 |
difPol = geometriesToUnionAux[k]; |
|
1517 |
break; |
|
1518 |
} |
|
1519 |
} |
|
1520 |
uningGeometries[j] = uningGeometries[j].difference(difPol); |
|
1521 |
uningGeometries[j] = uningGeometries[j].difference(geometryUned); |
|
1522 |
bitSet2.set(j); |
|
1523 |
} else { |
|
1524 |
bitSet2.set(j, false); |
|
1525 |
} |
|
1526 |
} |
|
1527 |
}*/ |
|
1453 | 1528 |
// Ahora que les he quitado los cachos que ya ten?a, le meto los features que |
1454 | 1529 |
// faltaban de geometriesToUnion |
1455 | 1530 |
for (int i=0;i<geometriesToUnion.length;i++) { |
Also available in: Unified diff