Mercurial > dive4elements > gnv-client
comparison geo-backend/src/main/java/de/intevation/gnv/geobackend/sde/datasources/ArcSDEStatement.java @ 555:825781a39c70
Fixed gnv/issue107
geo-backend/trunk@632 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Tue, 26 Jan 2010 16:33:36 +0000 |
parents | 7615ee5d1345 |
children | 9bcc423d8d76 |
comparison
equal
deleted
inserted
replaced
554:0ee3c0ed40e4 | 555:825781a39c70 |
---|---|
1 /** | |
2 * | |
3 */ | |
4 package de.intevation.gnv.geobackend.sde.datasources; | 1 package de.intevation.gnv.geobackend.sde.datasources; |
5 | 2 |
6 import com.esri.sde.sdk.client.SDEPoint; | 3 import com.esri.sde.sdk.client.SDEPoint; |
7 import com.esri.sde.sdk.client.SeColumnDefinition; | 4 import com.esri.sde.sdk.client.SeColumnDefinition; |
8 import com.esri.sde.sdk.client.SeConnection; | 5 import com.esri.sde.sdk.client.SeConnection; |
25 import com.vividsolutions.jts.geom.Geometry; | 22 import com.vividsolutions.jts.geom.Geometry; |
26 import com.vividsolutions.jts.geom.Point; | 23 import com.vividsolutions.jts.geom.Point; |
27 import com.vividsolutions.jts.geom.Polygon; | 24 import com.vividsolutions.jts.geom.Polygon; |
28 | 25 |
29 import com.vividsolutions.jts.io.WKTReader; | 26 import com.vividsolutions.jts.io.WKTReader; |
27 | |
28 import de.intevation.gnv.geobackend.util.RedundancyRemover; | |
30 | 29 |
31 import java.sql.Connection; | 30 import java.sql.Connection; |
32 import java.sql.ResultSet; | 31 import java.sql.ResultSet; |
33 import java.sql.SQLException; | 32 import java.sql.SQLException; |
34 import java.sql.SQLWarning; | 33 import java.sql.SQLWarning; |
489 if (debug) { | 488 if (debug) { |
490 log.debug("ArcSDEStatement.handleResultSet()"); | 489 log.debug("ArcSDEStatement.handleResultSet()"); |
491 } | 490 } |
492 | 491 |
493 SDEResultSet lSet = new SDEResultSet(); | 492 SDEResultSet lSet = new SDEResultSet(); |
494 SeRow row = null;; | 493 SeRow row = null; |
495 int lCount; | 494 int lCount; |
496 if (!isRaster){ | 495 if (!isRaster){ |
496 RedundancyRemover [] removers = null; | |
497 SeColumnDefinition [] lCols = null; | |
498 | |
497 for (lCount = 0; (row = pSeQuery.fetch()) != null; lCount++) { | 499 for (lCount = 0; (row = pSeQuery.fetch()) != null; lCount++) { |
498 // one time execution | 500 // one time execution |
499 if (lCount == 0) { | 501 if (lCount == 0) { |
500 // analyze cols of result set | 502 // analyze cols of result set |
501 SeColumnDefinition[] lCols = row.getColumns(); | 503 lCols = row.getColumns(); |
502 for (SeColumnDefinition lCol : lCols) { | 504 for (SeColumnDefinition lCol : lCols) { |
503 lSet.addCol(new ColDefinition(lCol.getName(), lCol.getType())); | 505 lSet.addCol(new ColDefinition(lCol.getName(), lCol.getType())); |
504 // notice: esri-types have been copied into colDefinition class! | 506 // notice: esri-types have been copied into colDefinition class! |
507 } | |
508 removers = new RedundancyRemover[lCols.length]; | |
509 for (int i = 0; i < removers.length; ++i) { | |
510 removers[i] = new RedundancyRemover(); | |
505 } | 511 } |
506 } | 512 } |
507 short lNumCols = row.getNumColumns(); | 513 short lNumCols = row.getNumColumns(); |
508 Row lBackingRow = new Row(lNumCols); | 514 Row lBackingRow = new Row(lNumCols); |
509 for (int i = 0; i < lNumCols; i++) { | 515 for (int i = 0; i < lNumCols; i++) { |
510 lBackingRow.addObject(row.getObject(i), i); | 516 lBackingRow.addObject( |
517 removers[i].filter(row.getObject(i)), | |
518 i); | |
511 } | 519 } |
512 lSet.addRow(lBackingRow); | 520 lSet.addRow(lBackingRow); |
521 } | |
522 | |
523 if (debug && removers != null) { | |
524 log.debug("datasets: " + lCount); | |
525 StringBuilder sb = new StringBuilder("removed redundancy: "); | |
526 float percent = 100f/lCount; | |
527 for (int i = 0; i < removers.length; ++i) { | |
528 if (i > 0) sb.append(", "); | |
529 sb.append(lCols[i].getName()) | |
530 .append(": ").append(removers[i].numRemoved()) | |
531 .append(" (").append(removers[i].numRemoved()*percent) | |
532 .append("%)"); | |
533 } | |
534 log.debug(sb.toString()); | |
513 } | 535 } |
514 }else{ | 536 }else{ |
515 try { | 537 try { |
516 pSeQuery.execute(); | 538 pSeQuery.execute(); |
517 row = pSeQuery.fetch(); | 539 row = pSeQuery.fetch(); |