[Liblas-commits] r1307 - trunk/apps
liblas-commits at liblas.org
liblas-commits at liblas.org
Wed Jul 8 12:20:35 EDT 2009
Author: hobu
Date: Wed Jul 8 12:20:34 2009
New Revision: 1307
URL: http://liblas.org/changeset/1307
Log:
use reference to a list instead of creating a new one every time
Modified:
trunk/apps/las2oci.cpp
Modified: trunk/apps/las2oci.cpp
==============================================================================
--- trunk/apps/las2oci.cpp (original)
+++ trunk/apps/las2oci.cpp Wed Jul 8 12:20:34 2009
@@ -173,14 +173,14 @@
return true;
}
-std::vector<liblas::uint8_t>* GetPointData(LASPoint const& p, bool bTime)
+bool GetPointData(LASPoint const& p, bool bTime, std::vector<liblas::uint8_t>& point_data)
{
// This function returns an array of bytes describing the
// x,y,z and optionally time values for the point. The caller owns
// the array.
std::vector<liblas::uint8_t>* data = new std::vector<liblas::uint8_t>;
- data->resize(24);
- if (bTime) data->resize(data->size()+8); // Add the time bytes too
+ point_data.resize(24);
+ if (bTime) point_data.resize(data->size()+8); // Add the time bytes too
double x = p.GetX();
double y = p.GetY();
@@ -196,19 +196,19 @@
// doubles are 8 bytes long. For each double, push back the
// byte. We do this for all four values (x,y,z,t)
for (int i=0; i<8; i++) {
- data->push_back(x_b[i]);
+ point_data.push_back(x_b[i]);
}
for (int i=0; i<8; i++) {
- data->push_back(y_b[i]);
+ point_data.push_back(y_b[i]);
}
for (int i=0; i<8; i++) {
- data->push_back(z_b[i]);
+ point_data.push_back(z_b[i]);
}
if (bTime)
{
for (int i=0; i<8; i++) {
- data->push_back(t_b[i]);
+ point_data.push_back(t_b[i]);
}
}
return data;
@@ -243,6 +243,8 @@
liblas::uint32_t block_id = result.GetID();
+
+ std::vector<liblas::uint8_t> point_data;
for (i=ids.begin(); i!=ids.end(); i++)
{
@@ -251,14 +253,13 @@
bool doRead = reader->ReadPointAt(id);
if (doRead) {
LASPoint const& p = reader->GetPoint();
- std::vector<liblas::uint8_t> *point_data = GetPointData(p, bTime);
+ bool gotdata = GetPointData(p, bTime, point_data);
std::vector<liblas::uint8_t>::const_iterator d;
- for (d = point_data->begin(); d!=point_data->end(); d++) {
+ for (d = point_data.begin(); d!=point_data.end(); d++) {
output->push_back(*d);
}
// pi = std::copy(point_data->begin(), point_data->end(), pi);
- delete point_data;
liblas::uint8_t* id_b = reinterpret_cast<liblas::uint8_t*>(&id);
liblas::uint8_t* block_b = reinterpret_cast<liblas::uint8_t*>(&block_id);
@@ -409,7 +410,7 @@
LASQuery* query,
const char* blkTableName,
const char* pcTableName,
- const char* cloudName,
+ const char* cloudColumnName,
int nDimension,
int srid,
int blk_capacity)
@@ -426,7 +427,7 @@
" -- Initialize the Point Cloud object.\n"
" pc := sdo_pc_pkg.init( \n"
" '"<< pcTableName<<"', -- Table that has the SDO_POINT_CLOUD column defined\n"
-" '"<< cloudName<<"', -- Column name of the SDO_POINT_CLOUD object\n"
+" '"<< cloudColumnName<<"', -- Column name of the SDO_POINT_CLOUD object\n"
" '"<<blkTableName<<"', -- Table to store blocks of the point cloud\n"
" 'blk_capacity="<<blk_capacity<<"', -- max # of points per block\n"
" mdsys.sdo_geometry(2003, "<<srid<<", null,\n"
@@ -540,6 +541,7 @@
}
}
+
string::size_type slash_pos = connection.find("/",0);
username = connection.substr(0,slash_pos);
string::size_type at_pos = connection.find("@",slash_pos);
More information about the Liblas-commits
mailing list