[Liblas-commits] r1278 - in trunk: apps src
liblas-commits at liblas.org
liblas-commits at liblas.org
Mon Jun 8 21:52:13 EDT 2009
Author: hobu
Date: Wed May 20 15:29:40 2009
New Revision: 1278
URL: http://liblas.org/changeset/1278
Log:
clean up some leaks
Modified:
trunk/apps/lasindex.cpp
trunk/src/lasindex.cpp
Modified: trunk/apps/lasindex.cpp
==============================================================================
--- trunk/apps/lasindex.cpp (original)
+++ trunk/apps/lasindex.cpp Wed May 20 15:29:40 2009
@@ -119,6 +119,7 @@
delete idxstrm;
delete index;
delete reader;
+ delete istrm;
LASIndex* idx = new LASIndex(input);
@@ -142,77 +143,7 @@
}
+ if (ids != 0) delete ids;
+ if (idx != 0) delete idx;
-// std::cout << "Vec length" << ids->size() << std::endl;
-// delete idx;
-//
-// LASIndexDataStream* idstrm = new LASIndexDataStream(reader);
-//
-// LASIndex* index = new LASIndex("MEMORY");
-//
-// in
-//
-// //doing it in memory
-//
-// std::vector<liblas::uint32_t>* ids = 0;
-//
-// try{
-// // ids = idx->intersects(289815.12,4320979.06, 289818.01,4320982.59,46.83,170.65);
-//
-// // _zoom
-// // ids = idx->intersects(630355.0,4834609.0,630395.0,4834641.0,0.0,200.0);
-//
-// // _clip
-// // 630346.830000,4834500.000000,55.260000
-// ids = index->intersects(630262.300000,4834500.000000,630346.830000,4834500.000000,50.900000,55.260000);
-// // ids = idx->intersects(630297.0,4834497.0,630302.0,4834501.0,0.0,200.0);
-//
-// } catch (Tools::Exception& e) {
-// std::string s = e.what();
-// std::cout << "error querying index value" << s <<std::endl; exit(1);
-// }
-
-
- // LASPoint* p
- // liblas::uint32_t num_points = reader->GetHeader().GetPointRecordsCount();
- // for (int i =0; i < num_points ; i++) {
- //
- // bool bInserted = index->insert(*p, i);
- // }
-
- // reader->Index(input);
- //
- // LASHeader header = reader->GetHeader();
- // std::cout << "number of points: " << header.GetPointRecordsCount() << std::endl;
- //
- // for (int i=0; i< header.GetPointRecordsCount(); i++) {
- //
- // try{
- // bool read = reader->ReadPointAt(i);
- // LASPoint p = reader->GetPoint();
- // } catch (Tools::IllegalStateException& e) {
- // std::string s = e.what();
- // std::cout << "error creating index" << s <<std::endl; exit(1);
- // }
- //
- // std::cout.precision(2);
- // std::cout.setf(std::ios_base::fixed);
- // // std::cout << "x: " << p.GetX() << " y: " << p.GetY() << std::endl;
- // }
- //
- // LASIndex* idx = reader->GetIndex();
- //
- // std::vector<liblas::uint32_t>* ids = 0;
- // try{
- // ids = idx->intersects(289815.12,4320979.06, 289818.01,4320982.59,46.83,170.65);
- // } catch (Tools::IllegalArgumentException& e) {
- // std::string s = e.what();
- // std::cout << "error querying index value" << s <<std::endl; exit(1);
- // }
- //
- //
- //
- // std::cout << "Vec length" << ids->size() << std::endl;
- // delete reader;
- // delete istrm;
}
Modified: trunk/src/lasindex.cpp
==============================================================================
--- trunk/src/lasindex.cpp (original)
+++ trunk/src/lasindex.cpp Wed May 20 15:29:40 2009
@@ -350,15 +350,19 @@
std::vector<uint32_t>* vect = new std::vector<uint32_t>;
LASVisitor* visitor = new LASVisitor(vect);
+ SpatialIndex::Region* region = new SpatialIndex::Region(min, max, 3);
+
try {
- m_rtree->intersectsWithQuery(SpatialIndex::Region(min, max, 3), *visitor);
+ m_rtree->intersectsWithQuery(*region, *visitor);
} catch (Tools::Exception& e) {
std::ostringstream os;
os << "Spatial Index Error: " << e.what();
+ delete region;
delete visitor;
throw std::runtime_error(os.str());
}
+ delete region;
delete visitor;
return vect;
More information about the Liblas-commits
mailing list