[Liblas-commits] hg: 3 new changesets

liblas-commits at liblas.org liblas-commits at liblas.org
Tue Aug 24 23:00:07 EDT 2010


changeset 6ab991ce5d5f in /Volumes/Data/www/liblas.org/hg
details: http://hg.liblas.orghg?cmd=changeset;node=6ab991ce5d5f
summary: clean up block insertion items

changeset 4e823a251dd1 in /Volumes/Data/www/liblas.org/hg
details: http://hg.liblas.orghg?cmd=changeset;node=4e823a251dd1
summary: more cleanups.  clean filters/transforms.

changeset 929452aa9488 in /Volumes/Data/www/liblas.org/hg
details: http://hg.liblas.orghg?cmd=changeset;node=929452aa9488
summary: more cleanups, prune dead code

diffstat:

 apps/las2oci.cpp  |  167 ++++++++++++++++++++++++++++++-----------------------
 apps/oci_util.cpp |    1 +
 2 files changed, 94 insertions(+), 74 deletions(-)

diffs (226 lines):

diff -r e98b5787c403 -r 929452aa9488 apps/las2oci.cpp
--- a/apps/las2oci.cpp	Tue Aug 24 21:14:31 2010 -0500
+++ b/apps/las2oci.cpp	Tue Aug 24 21:59:58 2010 -0500
@@ -69,79 +69,79 @@
 }
 
 
-bool FillBlock( OWStatement* statement,
-                IndexResult& result, 
-                liblas::Reader* reader,
-                blocks* b,
-                long index,
-                int srid, 
-                long pc_id,
-                long gtype,
-                bool bUseSolidGeometry,
-                bool bUse3d,
-                long nDimensions
-              )
-{
+// bool FillBlock( OWStatement* statement,
+//                 IndexResult& result, 
+//                 liblas::Reader* reader,
+//                 blocks* b,
+//                 long index,
+//                 int srid, 
+//                 long pc_id,
+//                 long gtype,
+//                 bool bUseSolidGeometry,
+//                 bool bUse3d,
+//                 long nDimensions
+//               )
+// {
+// 
+// 
+//     // list<SpatialIndex::id_type> const& ids = result.GetIDs();
+//     IDVector const& ids = result.GetIDs();
+//     
+//     b->pc_ids[index] = pc_id;
+//     b->srids[index] = (long)srid;
+//     b->block_ids[index] = result.GetID();
+//     b->num_points[index] = (long)ids.size();
+//     
+//     std::vector<uint8_t>* blob = new std::vector<uint8_t>;
+//     result.GetData(reader, *blob);
+// 
+//     
+//     b->blobs[index] = blob;
+//     // // FIXME: null srids not supported 
+//     b->srids[index] = srid;
+//     b->gtypes[index] = gtype;
+//     // 
+//     OCIArray* sdo_elem_info=0;
+//     statement->GetConnection()->CreateType(&sdo_elem_info, statement->GetConnection()->GetElemInfoType());
+//     SetElements(statement, sdo_elem_info, bUseSolidGeometry);
+//     // 
+//     b->element_arrays[index] = sdo_elem_info;
+//     
+//     OCIArray* sdo_ordinates=0;
+//     statement->GetConnection()->CreateType(&sdo_ordinates, statement->GetConnection()->GetOrdinateType());
+//     // 
+//     // 
+//     // 
+//     SetOrdinates(statement, sdo_ordinates, result.GetBounds());
+//     
+//     b->coordinate_arrays[index] = sdo_ordinates;
+//     
+// 
+//     return true;
+// }
 
 
-    // list<SpatialIndex::id_type> const& ids = result.GetIDs();
-    IDVector const& ids = result.GetIDs();
-    
-    b->pc_ids[index] = pc_id;
-    b->srids[index] = (long)srid;
-    b->block_ids[index] = result.GetID();
-    b->num_points[index] = (long)ids.size();
-    
-    std::vector<uint8_t>* blob = new std::vector<uint8_t>;
-    result.GetData(reader, *blob);
-
-    
-    b->blobs[index] = blob;
-    // // FIXME: null srids not supported 
-    b->srids[index] = srid;
-    b->gtypes[index] = gtype;
-    // 
-    OCIArray* sdo_elem_info=0;
-    statement->GetConnection()->CreateType(&sdo_elem_info, statement->GetConnection()->GetElemInfoType());
-    SetElements(statement, sdo_elem_info, bUseSolidGeometry);
-    // 
-    b->element_arrays[index] = sdo_elem_info;
-    
-    OCIArray* sdo_ordinates=0;
-    statement->GetConnection()->CreateType(&sdo_ordinates, statement->GetConnection()->GetOrdinateType());
-    // 
-    // 
-    // 
-    SetOrdinates(statement, sdo_ordinates, result.GetBounds());
-    
-    b->coordinate_arrays[index] = sdo_ordinates;
-    
-
-    return true;
-}
-
-
-blocks* CreateBlock(int size)
-{
-    blocks* b = (blocks*) malloc( sizeof(blocks));
-    
-    b->pc_ids = (long*) malloc( size * sizeof(long));
-    b->block_ids = (long*) malloc ( size * sizeof(long));
-    b->num_points = (long*) malloc ( size * sizeof(long));
-    b->blobs = (std::vector<uint8_t>**) malloc ( size * sizeof(std::vector<uint8_t>*));
-    b->locators =(OCILobLocator**) malloc( sizeof(OCILobLocator*) * size );
-
-    b->srids = (long*) malloc ( size * sizeof(long));
-    b->gtypes = (long*) malloc ( size * sizeof(long));
-
-    b->element_arrays = (OCIArray**) malloc ( size * sizeof(OCIArray*));
-
-    b->coordinate_arrays = (OCIArray**) malloc ( size * sizeof(OCIArray*));
-
-    b->size = size;
-    
-    return b;
-}
+// blocks* CreateBlock(int size)
+// {
+//     blocks* b = (blocks*) malloc( sizeof(blocks));
+//     
+//     b->pc_ids = (long*) malloc( size * sizeof(long));
+//     b->block_ids = (long*) malloc ( size * sizeof(long));
+//     b->num_points = (long*) malloc ( size * sizeof(long));
+//     b->blobs = (std::vector<uint8_t>**) malloc ( size * sizeof(std::vector<uint8_t>*));
+//     b->locators =(OCILobLocator**) malloc( sizeof(OCILobLocator*) * size );
+// 
+//     b->srids = (long*) malloc ( size * sizeof(long));
+//     b->gtypes = (long*) malloc ( size * sizeof(long));
+// 
+//     b->element_arrays = (OCIArray**) malloc ( size * sizeof(OCIArray*));
+// 
+//     b->coordinate_arrays = (OCIArray**) malloc ( size * sizeof(OCIArray*));
+// 
+//     b->size = size;
+//     
+//     return b;
+// }
 
 long GetGType(  bool bUse3d,
                 bool bUseSolidGeometry)
@@ -167,7 +167,6 @@
 
 bool InsertBlock(OWConnection* connection, 
                 IndexResult& result, 
-                blocks* block,
                 long block_index,
                 int srid, 
                 liblas::Reader* reader, 
@@ -275,6 +274,14 @@
     OWStatement::Free(locator, 1);
 
     delete statement;
+    if (p_pc_id != 0) free(p_pc_id);
+    if (p_result_id != 0) free(p_result_id);
+    if (p_num_points != 0) free(p_num_points);
+    if (p_gtype != 0) free(p_gtype);
+    if (p_srid != 0) free(p_srid);    
+
+    connection->DestroyType(&sdo_elem_info);
+    connection->DestroyType(&sdo_ordinates);
     
     return true;
 
@@ -298,7 +305,7 @@
     ResultsVector::iterator i;
 
 
-    blocks* b = CreateBlock(nCommitInterval);
+    // blocks* b = CreateBlock(nCommitInterval);
 
     ostringstream oss;
     oss << "INSERT INTO "<< table_name << 
@@ -320,7 +327,6 @@
     {        
         inserted = InsertBlock(con, 
                                     *i,
-                                    b,
                                     j, 
                                     srid, 
                                     reader2, 
@@ -1244,7 +1250,20 @@
         }
 
         con->Commit();
+
+        for(std::vector<liblas::FilterI*>::iterator i=filters.begin(); i!=filters.end(); i++)
+        {
+            delete *i;
+        }
+            
+        for(std::vector<liblas::TransformI*>::iterator i=transforms.begin(); i!=transforms.end(); i++)
+        {
+            delete *i;
+        }
         
+        delete reader2;
+        delete istrm2;
+        delete con;
     }
     catch(std::exception& e) {
         std::cerr << "error: " << e.what() << "\n";
diff -r e98b5787c403 -r 929452aa9488 apps/oci_util.cpp
--- a/apps/oci_util.cpp	Tue Aug 24 21:14:31 2010 -0500
+++ b/apps/oci_util.cpp	Tue Aug 24 21:59:58 2010 -0500
@@ -104,6 +104,7 @@
     }
 
     free(kind);
+    free(p_srid);
 
     return false;
 }


More information about the Liblas-commits mailing list