Revision 22037 branches/Mobile_Compatible_Hito_1/libFMap_mobile_shp_driver/src-file/org/gvsig/data/datastores/vectorial/file/shp_mem/simplify/MemoryShpDriver.java
MemoryShpDriver.java | ||
---|---|---|
104 | 104 |
import java.util.ArrayList; |
105 | 105 |
|
106 | 106 |
import org.apache.log4j.Logger; |
107 |
import org.gvsig.data.datastores.vectorial.file.FalseByteBuffer; |
|
108 |
import org.gvsig.data.datastores.vectorial.file.Utils; |
|
107 |
import org.gvsig.data.datastores.vectorial.file.shp_util.FalseByteBuffer; |
|
109 | 108 |
import org.gvsig.data.datastores.vectorial.file.shp_util.SHP; |
109 |
import org.gvsig.data.datastores.vectorial.file.shp_util.Utils; |
|
110 | 110 |
import org.gvsig.fmap.geom.Geometry; |
111 | 111 |
import org.gvsig.fmap.geom.GeometryFactory; |
112 | 112 |
import org.gvsig.fmap.geom.GeometryManager; |
... | ... | |
128 | 128 |
|
129 | 129 |
private static String tempDirectoryPath = System |
130 | 130 |
.getProperty("java.io.tmpdir"); |
131 |
|
|
131 |
|
|
132 | 132 |
private File fileShp; |
133 | 133 |
|
134 | 134 |
private FalseByteBuffer bb; |
... | ... | |
149 | 149 |
|
150 | 150 |
// point bound box tol: |
151 | 151 |
public static final double POINT_TOL = 0.000001; |
152 |
|
|
152 |
|
|
153 |
private boolean featInMem = false; |
|
154 |
|
|
153 | 155 |
/** |
154 | 156 |
* @return gets the fiel path |
155 | 157 |
*/ |
... | ... | |
612 | 614 |
* |
613 | 615 |
* @see com.iver.cit.gvsig.fmap.drivers.VectorialFileDriver#initialize() |
614 | 616 |
*/ |
615 |
public void initialize() throws IOException { |
|
617 |
public void initialize(long shape_count) throws IOException {
|
|
616 | 618 |
// logger.debug(Utils.time() + "Empieza initialize() del driver shp."); |
617 | 619 |
|
618 | 620 |
ShapeFileHeader myHeader = new ShapeFileHeader(); |
... | ... | |
645 | 647 |
h = 0.2; |
646 | 648 |
} |
647 | 649 |
|
648 |
boolean done = false;
|
|
650 |
numReg = (int) shape_count;
|
|
649 | 651 |
|
650 |
File dbf_file = getDataFile(fileShp); |
|
651 |
DbfMemoryDataSource dbf_ds = new DbfMemoryDataSource(dbf_file); |
|
652 |
|
|
653 |
try { |
|
654 |
dbf_ds.start(); |
|
655 |
numReg = (int) dbf_ds.getRowCount(); |
|
656 |
dbf_ds.stop(); |
|
657 |
|
|
658 |
done = true; |
|
659 |
} catch (Exception ex) { |
|
660 |
logger.error("While getting row count: " + ex.getMessage()); |
|
661 |
} |
|
662 |
|
|
663 |
if (done) { |
|
664 |
// logger.debug("NUMREG del DBF: " + numReg); |
|
665 |
} else { |
|
666 |
logger.debug("No se ha obtenido NUMREG, vale 0"); |
|
667 |
numReg = 0; |
|
668 |
} |
|
669 |
|
|
670 | 652 |
/* |
671 | 653 |
* logger.debug(Utils.time() + "Intentando: ShpReader.openShpFile()"); |
672 | 654 |
* |
... | ... | |
900 | 882 |
*/ |
901 | 883 |
public void reload() throws IOException { |
902 | 884 |
open(fileShp); |
903 |
initialize(); |
|
885 |
initialize(numReg);
|
|
904 | 886 |
} |
905 | 887 |
|
906 | 888 |
/** |
Also available in: Unified diff