[Liblas-commits] hg: 3 new changesets

liblas-commits at liblas.org liblas-commits at liblas.org
Tue Oct 26 09:19:41 EDT 2010


changeset 28f6ea8e4304 in /Volumes/Data/www/liblas.org/hg
details: http://hg.liblas.orghg?cmd=changeset;node=28f6ea8e4304
summary: remove _SECURE_SCL=0 definition, as this was causing Release builds to crash that had program_options in them

changeset 8d8c80718147 in /Volumes/Data/www/liblas.org/hg
details: http://hg.liblas.orghg?cmd=changeset;node=8d8c80718147
summary: Rejigger to use OSGeo4W's OCI client

changeset 51de9d42769f in /Volumes/Data/www/liblas.org/hg
details: http://hg.liblas.orghg?cmd=changeset;node=51de9d42769f
summary: merge

diffstat:

 CMakeLists.txt                            |   1 -
 apps/lasindex_test.cpp                    |  27 +++++++++++++-----
 hobu-config.bat                           |   9 +++--
 include/liblas/detail/index/indexcell.hpp |   7 ++--
 include/liblas/lasindex.hpp               |   3 +-
 src/detail/index/indexcell.cpp            |   4 +-
 src/lasindex.cpp                          |  43 +++++++++++++++---------------
 7 files changed, 53 insertions(+), 41 deletions(-)

diffs (298 lines):

diff -r 02df82d848f4 -r 51de9d42769f CMakeLists.txt
--- a/CMakeLists.txt	Mon Oct 25 10:40:08 2010 -0500
+++ b/CMakeLists.txt	Tue Oct 26 07:19:19 2010 -0600
@@ -82,7 +82,6 @@
       add_definitions(-D_CRT_SECURE_NO_WARNINGS)
       add_definitions(-D_CRT_NONSTDC_NO_WARNING)
       add_definitions(-D_SCL_SECURE_NO_WARNINGS)
-      add_definitions(-D_SECURE_SCL=0)
     endif()
     
     if(CMAKE_CXX_FLAGS MATCHES "/W[0-4]")
diff -r 02df82d848f4 -r 51de9d42769f apps/lasindex_test.cpp
--- a/apps/lasindex_test.cpp	Mon Oct 25 10:40:08 2010 -0500
+++ b/apps/lasindex_test.cpp	Tue Oct 26 07:19:19 2010 -0600
@@ -263,8 +263,8 @@
 	/*----------------------------build index-----------------------------------
 	const char* arggv[] = {"foo", "-t", "C:\\LibLAS\\Mount St Helens Oct 4 2004.tmp",
 		 "-i", "C:\\LibLAS\\Samples\\Mount St Helens Oct 4 2004.las", "-a", SAMPLE_AUTHOR, "-c", SAMPLE_COMMENT, "-d", SAMPLE_DATE,
-		 "-o", "C:\\LibLAS\\Samples\\Mount St Helens Oct 4 2004_idx.las"};
-	argc = 13;
+		 "-o", "C:\\LibLAS\\Samples\\Mount St Helens Oct 4 2004_idx.las", "-b", "100"};
+	argc = 15;
 	*/
 	/*------------------filter with embedded index------------------------------
 	const char* arggv[] = {"foo",
@@ -295,12 +295,23 @@
 		 "-i", "C:\\LibLAS\\Samples\\flatDataset_idx.las", "-r"};
 	argc = 4;
 	*/
-	///*------------filter with embedded index using iterator---------------------
+	/*------------filter with embedded index using iterator---------------------
 	const char* arggv[] = {"foo",
-		 "-i", "C:\\LibLAS\\Samples\\flatDataset_idx.las", "-r", "-it", "5"};
+		 "-i", "C:\\LibLAS\\Samples\\flatDataset_idx.las", "-r", "-it", "25"};
 	argc = 6;
-	//*/
-	/*------------------------------------------------------------------------*/
+	*/
+	/*---------------------------billion_points-------------------------------*/
+	/*-----------------build index in standalone file---------------------------
+	const char* arggv[] = {"foo", "-t", "K:\\FME\\billion_points.tmp",
+		 "-i", "D:\\Zips\\FME\\billion_points.las", "-a", SAMPLE_AUTHOR, "-c", SAMPLE_COMMENT, "-d", SAMPLE_DATE,
+		 "-o", "K:\\FME\\billion_points_idx.ldx", "-s", "-it", "5000000"};
+	argc = 16;
+	*/
+	/*-------------------filter from standalone file using iterator---------------
+	const char* arggv[] = {"foo", "-i", "D:\\Zips\\FME\\billion_points.las",
+		 "-n", "K:\\FME\\billion_points_idx.ldx", "-r", "-it", "5000000"};
+	argc = 8;
+	*/
 	
 	for (int i = 1; i < argc; i++)
     {
@@ -478,7 +489,7 @@
 										IndexIterator *indexIt2 = index.Filter(ParamSrc2, chunkSize);
 										if (indexIt && indexIt2)
 										{
-											for (boost::uint32_t step = 0; step < 3; ++step)
+											for (boost::uint32_t step = 0; step < 1000; ++step)
 											{
 												// use any of these to begin the vector with the next point that fits the filter criteria 
 												// that hasn't been scanned yet.
@@ -527,7 +538,7 @@
 												const std::vector<boost::uint32_t>& FilterResult5 = (*indexIt)+6;
 												if (!ReportIteratorResults(debugger, FilterResult5.size(), index.GetPointRecordsCount(), step))
 													break;
-												
+											
 											} // for
 										} // if
 										else
diff -r 02df82d848f4 -r 51de9d42769f hobu-config.bat
--- a/hobu-config.bat	Mon Oct 25 10:40:08 2010 -0500
+++ b/hobu-config.bat	Tue Oct 26 07:19:19 2010 -0600
@@ -4,9 +4,9 @@
 set LIBLAS=D:\liblas
 set OSGEO4W=C:\OSGeo4W
 set BOOST=D:\boost\boost_1_44
-set ORACLE_HOME=D:\instantclient_11_1
+set ORACLE_HOME=%OSGEO4W%
 
-set PATH=%ORACLE_HOME%;%OSGEO4W%\apps\gdal-dev\bin;%OSGEO4W%\bin;%PATH%
+set PATH=%OSGEO4W%\apps\gdal-dev\bin;%OSGEO4W%\bin;%PATH%
 
 cmake -G %G% ^
     -DBOOST_INCLUDEDIR=%BOOST% ^
@@ -19,6 +19,7 @@
     -DGEOTIFF_LIBRARY=%OSGEO4W%\lib\geotiff_i.lib ^
     -DGDAL_INCLUDE_DIR=%OSGEO4W%\apps\gdal-dev\include ^
     -DGDAL_LIBRARY=%OSGEO4W%\apps\gdal-dev\lib\gdal_i.lib ^
-    -DORACLE_INCLUDE_DIR=%ORACLE_HOME%\sdk\include ^
-    -DORACLE_OCI_LIBRARY=%ORACLE_HOME%\sdk\lib\msvc\oci.lib ^
+    -DORACLE_INCLUDE_DIR=%ORACLE_HOME%\include ^
+    -DORACLE_OCI_LIBRARY=%ORACLE_HOME%\lib\oci.lib ^
+    -DCMAKE_BUILD_TYPE=RelWithDebInfo ^
     %LIBLAS%
\ No newline at end of file
diff -r 02df82d848f4 -r 51de9d42769f include/liblas/detail/index/indexcell.hpp
--- a/include/liblas/detail/index/indexcell.hpp	Mon Oct 25 10:40:08 2010 -0500
+++ b/include/liblas/detail/index/indexcell.hpp	Tue Oct 26 07:19:19 2010 -0600
@@ -55,6 +55,7 @@
 typedef boost::uint8_t	ConsecPtAccumulator;
 typedef std::map<boost::uint32_t, ConsecPtAccumulator> IndexCellData;
 typedef std::map<boost::uint32_t, IndexCellData> IndexSubCellData;
+typedef boost::uint64_t	TempFileOffsetType;
 
 class IndexCell
 {
@@ -62,7 +63,7 @@
 	IndexCell();
 	
 private:
-	boost::uint32_t m_FileOffset;
+	TempFileOffsetType m_FileOffset;
 	boost::uint32_t m_NumPoints;
 	ElevExtrema m_MinZ, m_MaxZ;
 	IndexCellData m_PtRecords;
@@ -70,9 +71,9 @@
 	IndexSubCellData m_SubCellRecords;
 
 public:
-	void SetFileOffset(boost::uint32_t fos);
+	void SetFileOffset(TempFileOffsetType fos);
 	void SetNumPoints(boost::uint32_t nmp);
-	boost::uint32_t GetFileOffset(void) const;
+	TempFileOffsetType GetFileOffset(void) const;
 	boost::uint32_t GetNumRecords(void) const;
 	boost::uint32_t GetNumPoints(void) const;
 	boost::uint32_t GetNumSubCellRecords(void) const;
diff -r 02df82d848f4 -r 51de9d42769f include/liblas/lasindex.hpp
--- a/include/liblas/lasindex.hpp	Mon Oct 25 10:40:08 2010 -0500
+++ b/include/liblas/lasindex.hpp	Tue Oct 26 07:19:19 2010 -0600
@@ -140,7 +140,8 @@
 	int m_debugOutputLevel;
 	boost::uint8_t m_versionMajor, m_versionMinor;
     boost::uint32_t m_pointRecordsCount, m_maxMemoryUsage, m_cellsX, m_cellsY, m_cellsZ, m_totalCells, 
-		m_tempFileWrittenBytes, m_DataVLR_ID;
+		m_DataVLR_ID;
+    liblas::detail::TempFileOffsetType m_tempFileWrittenBytes;
     double m_rangeX, m_rangeY, m_rangeZ, m_cellSizeZ, m_cellSizeX, m_cellSizeY;
 	std::string m_tempFileName;	
 	std::string m_indexAuthor;
diff -r 02df82d848f4 -r 51de9d42769f src/detail/index/indexcell.cpp
--- a/src/detail/index/indexcell.cpp	Mon Oct 25 10:40:08 2010 -0500
+++ b/src/detail/index/indexcell.cpp	Tue Oct 26 07:19:19 2010 -0600
@@ -57,7 +57,7 @@
 } // IndexCell::IndexCell
 
 
-void IndexCell::SetFileOffset(boost::uint32_t fos)
+void IndexCell::SetFileOffset(TempFileOffsetType fos)
 {
 	m_FileOffset = fos;
 } // IndexCell::SetFileOffset
@@ -67,7 +67,7 @@
 	m_NumPoints = nmp;
 } // IndexCell::SetNumPoints
 
-boost::uint32_t IndexCell::GetFileOffset(void) const
+TempFileOffsetType IndexCell::GetFileOffset(void) const
 {
 	return(m_FileOffset);
 } // IndexCell::GetFileOffset
diff -r 02df82d848f4 -r 51de9d42769f src/lasindex.cpp
--- a/src/lasindex.cpp	Mon Oct 25 10:40:08 2010 -0500
+++ b/src/lasindex.cpp	Tue Oct 26 07:19:19 2010 -0600
@@ -122,7 +122,8 @@
 	m_DataVLR_ID = 43;
 	m_maxMemoryUsage = LIBLAS_INDEX_MAXMEMDEFAULT;
     m_rangeX = m_rangeY = m_rangeZ = m_cellSizeZ = m_cellSizeX = m_cellSizeY = 
-    m_pointRecordsCount = m_maxMemoryUsage = m_cellsX = m_cellsY = m_cellsZ = m_totalCells = m_tempFileWrittenBytes = 0;
+		m_pointRecordsCount = m_maxMemoryUsage = m_cellsX = m_cellsY = m_cellsZ = m_totalCells = 0;
+    m_tempFileWrittenBytes = 0;
 	m_indexBuilt = m_tempFileStarted = m_readerCreated = false;
 } // Index::SetValues
 
@@ -1025,8 +1026,7 @@
 	m_versionMinor = LIBLAS_INDEX_VERSIONMINOR;
 	
 	// reset to beginning of point data records in case points had been examined before index is built
-	m_reader->Reset();
-
+	m_reader->seek(0);
 	// need the header to get number of point records
     m_pointRecordsCount = m_pointheader.GetPointRecordsCount();
     // get the bounds of the data and scale factors in case they are needed for point translation
@@ -1164,11 +1164,9 @@
 		// If a cell contains too many points, subdivide the cell and save sub-cells within the cell structure
 		// If Z-binning is desired, define the bounds of each Z zone and subdivide sort each cell's points into Z bins
 		// Save Z bins within the cell structure.
-		// reset Reader to beginning of point data records in case points had been examined before index is built
 		
 		if (IndexOut.InitiateOutput())
 		{
-			m_reader->Reset();
 			for (boost::uint32_t x = 0; x < m_cellsX; ++x)
 			{
 				for (boost::uint32_t y = 0; y < m_cellsY; ++y)
@@ -1384,7 +1382,7 @@
 {
 	if (m_tempFile || OpenTempFile())
 	{
-		boost::uint32_t EmptyOffset = 0;	// this might not be large enough
+		liblas::detail::TempFileOffsetType EmptyOffset = 0;	// this might not be large enough
 		
 		if (! m_tempFileStarted)
 		{
@@ -1392,12 +1390,12 @@
 			// write out a block of file offsets the size of the number of cells
 			for (boost::uint32_t i = 0; i < m_totalCells; ++i)
 			{
-				if (fwrite(&EmptyOffset, sizeof(boost::uint32_t), 1, m_tempFile) < 1)
+				if (fwrite(&EmptyOffset, sizeof(liblas::detail::TempFileOffsetType), 1, m_tempFile) < 1)
 				{
 					return (FileError("Index::PurgePointsToTempFile"));
 				} // if error
 			} // for
-			m_tempFileWrittenBytes = m_totalCells * sizeof(boost::uint32_t);
+			m_tempFileWrittenBytes = m_totalCells * sizeof(liblas::detail::TempFileOffsetType);
 			m_tempFileStarted = true;
 		} // if
 		for (boost::uint32_t x = 0; x < m_cellsX; ++x)
@@ -1411,20 +1409,20 @@
 					// if cell block header is 0 write the current file location in the file header
 					// otherwise write the current file location at the file location specified in the 
 					// cell block header
-					boost::uint32_t LastWriteLocation = CellBlock[x][y].GetFileOffset();
+					liblas::detail::TempFileOffsetType LastWriteLocation = CellBlock[x][y].GetFileOffset();
 					if (LastWriteLocation == 0)
-						LastWriteLocation = (x * m_cellsY + y) * sizeof(boost::uint32_t);
-					fseek(m_tempFile, LastWriteLocation, SEEK_SET);
-					if (fwrite(&m_tempFileWrittenBytes, sizeof(boost::uint32_t), 1, m_tempFile) < 1)
+						LastWriteLocation = (x * m_cellsY + y) * sizeof(liblas::detail::TempFileOffsetType);
+					_fseeki64(m_tempFile, LastWriteLocation, SEEK_SET);
+					if (fwrite(&m_tempFileWrittenBytes, sizeof(liblas::detail::TempFileOffsetType), 1, m_tempFile) < 1)
 						return (FileError("Index::PurgePointsToTempFile"));
 					CellBlock[x][y].SetFileOffset(m_tempFileWrittenBytes);
 
 					// seek to end of file where next block of data will be written
-					fseek(m_tempFile, 0, SEEK_END);
+					_fseeki64(m_tempFile, 0, SEEK_END);
 					// write a blank space for later placement of next file block for this cell
-					if (fwrite(&EmptyOffset, sizeof(boost::uint32_t), 1, m_tempFile) < 1)
+					if (fwrite(&EmptyOffset, sizeof(liblas::detail::TempFileOffsetType), 1, m_tempFile) < 1)
 						return (FileError("Index::PurgePointsToTempFile"));
-					m_tempFileWrittenBytes += sizeof(boost::uint32_t);
+					m_tempFileWrittenBytes += sizeof(liblas::detail::TempFileOffsetType);
 					// write the number of records stored in this section
 					if (fwrite(&RecordsToWrite, sizeof(boost::uint32_t), 1, m_tempFile) < 1)
 						return (FileError("Index::PurgePointsToTempFile"));
@@ -1462,23 +1460,24 @@
 	boost::uint32_t CurCellX, boost::uint32_t CurCellY)
 {
 
-	boost::uint32_t FileOffset, RecordsToRead, FormerNumPts, NewNumPts = 0;
+	boost::uint32_t RecordsToRead, FormerNumPts, NewNumPts = 0;
+	liblas::detail::TempFileOffsetType FileOffset;
 	
 	FormerNumPts = CellBlock->GetNumPoints();
 	CellBlock->SetNumPoints(0);
 	
 	// load the cell as it was written
 	// read the first offset for this cell
-	if (fseek(m_tempFile, (CurCellX * m_cellsY + CurCellY) * sizeof (boost::uint32_t), SEEK_SET))
+	if (_fseeki64(m_tempFile, (CurCellX * m_cellsY + CurCellY) * sizeof (liblas::detail::TempFileOffsetType), SEEK_SET))
 		return (FileError("Index::LoadCellFromTempFile"));
-	if (fread(&FileOffset, sizeof (boost::uint32_t), 1, m_tempFile) < 1)
+	if (fread(&FileOffset, sizeof (liblas::detail::TempFileOffsetType), 1, m_tempFile) < 1)
 		return (FileError("Index::LoadCellFromTempFile"));
 	while (FileOffset > 0)
 	{
 		// jump to the first block for this cell, read the next offset
-		if (fseek(m_tempFile, FileOffset, SEEK_SET))
+		if (_fseeki64(m_tempFile, FileOffset, SEEK_SET))
 			return (FileError("Index::LoadCellFromTempFile"));
-		if (fread(&FileOffset, sizeof (boost::uint32_t), 1, m_tempFile) < 1)
+		if (fread(&FileOffset, sizeof (liblas::detail::TempFileOffsetType), 1, m_tempFile) < 1)
 			return (FileError("Index::LoadCellFromTempFile"));
 		// read the data for the cell in this block
 		// first is the number of items to read now
@@ -1534,7 +1533,7 @@
 {
 	try {
 		Writer writer(*m_ofs, m_idxheader);
-		m_reader->Reset();
+		m_reader->seek(0);
 		while (m_reader->ReadNextPoint())
 		{
 			Point CurPt = m_reader->GetPoint();
@@ -1553,7 +1552,7 @@
 	try {
 		Writer writer(*m_ofs, m_idxheader);
 		/* test block - uncommenting this makes it just like above version with included points
-		m_reader->Reset();
+		m_reader->seek(0);
 		while (m_reader->ReadNextPoint())
 		{
 			Point CurPt = m_reader->GetPoint();


More information about the Liblas-commits mailing list