Changeset 1593:e5e48da9f267


Ignore:
Timestamp:
02/23/10 11:37:23 (5 months ago)
Author:
Howard Butler <hobu.inc@…>
Branch:
default
Message:

more array consolidation

File:
1 edited

Legend:

Unmodified
Added
Removed
  • apps/las2oci.cpp

    r1592 r1593  
    400400} 
    401401 
    402 extent* GetExtent(  const LASQueryResult& result, 
     402extent* GetExtent(  const SpatialIndex::Region* b, 
    403403                    bool bUse3d, 
    404404                    bool bGeographic 
     
    406406{ 
    407407    double x0, x1, y0, y1, z0, z1; 
    408     const SpatialIndex::Region* b = result.GetBounds(); 
     408    // const SpatialIndex::Region* b = result.GetBounds(); 
    409409    if (bUse3d) { 
    410410        try { 
     
    459459                int srid,  
    460460                long pc_id, 
    461                 long block_id, 
    462                 long num_points, 
    463461                long gtype, 
    464462                bool bUseSolidGeometry, 
     
    508506    } 
    509507         
    510     extent* e = GetExtent(result, bUse3d, bGeographic); 
     508    extent* e = GetExtent(result.GetBounds(), bUse3d, bGeographic); 
    511509    SetOrdinates(statement, sdo_ordinates, e); 
    512510 
     
    538536} 
    539537 
     538bool BindBlock(OWStatement statement, blocks* b, OCILobLocator** locator) 
     539{ 
     540    return true; 
     541} 
    540542bool InsertBlock(OWConnection* connection,  
    541543                const LASQueryResult& result,  
     544                blocks* block, 
     545                long block_index, 
    542546                int srid,  
    543547                LASReader* reader,  
     
    638642    connection->CreateType(&sdo_ordinates, connection->GetOrdinateType()); 
    639643     
    640     extent* e = GetExtent(result, bUse3d, bGeographic); 
     644    extent* e = GetExtent(result.GetBounds(), bUse3d, bGeographic); 
    641645 
    642646     
     
    672676                long pc_id, 
    673677                bool bUseSolidGeometry, 
    674                 bool bUse3d 
     678                bool bUse3d, 
     679                long nDimensions 
    675680                ) 
    676681{ 
     
    679684    std::list<LASQueryResult>::const_iterator i; 
    680685 
     686 
     687 
     688    long commit_interval = 1000; 
     689    blocks* b = CreateBlock(commit_interval); 
     690 
     691    ostringstream oss; 
     692    oss << "INSERT INTO "<< table_name <<  
     693            "(OBJ_ID, BLK_ID, NUM_POINTS, POINTS,   " 
     694            "PCBLK_MIN_RES, BLK_EXTENT, PCBLK_MAX_RES, NUM_UNSORTED_POINTS, PT_SORT_DIM) " 
     695            "VALUES ( :1, :2, :3, :4, 1, mdsys.sdo_geometry(:5, :6, null,:7, :8)"  
     696            ", 1, 0, 1)"; 
     697           
     698    OWStatement* statement = 0; 
     699    OCILobLocator** locator =(OCILobLocator**) VSIMalloc( sizeof(OCILobLocator*) * 1000 ); 
     700 
     701    statement = con->CreateStatement(oss.str().c_str()); 
     702    long j = 0; 
    681703 
    682704    for (i=results.begin(); i!=results.end(); i++) 
    683705    { 
     706        j++; 
     707 
     708        FillBlock( con,  
     709                        statement, 
     710                        *i,  
     711                        reader2, 
     712                        b, 
     713                        j, 
     714                        srid,  
     715                         pc_id, 
     716                         GetGType(bUse3d, bUseSolidGeometry), 
     717                         bUseSolidGeometry, 
     718                         bUse3d, 
     719                         nDimensions 
     720                         ); 
     721         
    684722        bool inserted = InsertBlock(con,  
    685                                     *i,  
     723                                    *i, 
     724                                    b, 
     725                                    j,  
    686726                                    srid,  
    687727                                    reader2,  
     
    950990        //     bUse3d = true; 
    951991    } 
    952      
     992 
     993    long gtype = GetGType(bUse3d, bUseSolidGeometry); 
     994    s_gtype << gtype; 
    953995    if (bUse3d) { 
    954996        if (bUseSolidGeometry == true) { 
    955             s_gtype << "3008"; 
     997            // s_gtype << "3008"; 
    956998            s_eleminfo << "(1,1007,3)"; 
    957999 
    9581000        } else { 
    959             s_gtype << "3003"; 
     1001            // s_gtype << "3003"; 
    9601002            s_eleminfo  << "(1,1003,3)"; 
    9611003 
     
    9631005    } else { 
    9641006        if (bUseSolidGeometry == true) { 
    965             s_gtype << "2008"; 
     1007            // s_gtype << "2008"; 
    9661008            s_eleminfo << "(1,1007,3)"; 
    9671009 
    9681010        } else { 
    969             s_gtype << "2003"; 
     1011            // s_gtype << "2003"; 
    9701012            s_eleminfo  << "(1,1003,3)"; 
    9711013 
     
    9741016     
    9751017 
    976  
    977     double x0, x1, y0, y1, z0, z1; 
     1018    extent* e = GetExtent(  &(query->bounds), bUse3d, bGeographic ); 
     1019 
     1020    // double x0, x1, y0, y1, z0, z1; 
    9781021    double tolerance = 0.05; 
    9791022     
     
    9831026    //     z0 = zmin; z1 = zmax; 
    9841027    // } else { 
    985         x0 = query->bounds.getLow(0); 
    986         x1 = query->bounds.getHigh(0); 
    987         y0 = query->bounds.getLow(1); 
    988         y1 = query->bounds.getHigh(1); 
    989          
    990         if (bUse3d) { 
    991             try { 
    992                 z0 = query->bounds.getLow(2); 
    993                 z1 = query->bounds.getHigh(2); 
    994             } catch (Tools::IndexOutOfBoundsException& e) { 
    995                 z0 = 0; 
    996                 z1 = 20000; 
    997             } 
    998         } else if (bGeographic) { 
    999             x0 = -180.0; 
    1000             y0 = 180.0; 
    1001             y0 = -90.0; 
    1002             y1 = 90.0; 
    1003             z0 = 0.0; 
    1004             z1 = 20000.0; 
    1005             tolerance = 0.000000005; 
    1006         } else { 
    1007             z0 = 0.0; 
    1008             z1 = 20000.0;             
    1009         } 
     1028        // x0 = query->bounds.getLow(0); 
     1029        //  x1 = query->bounds.getHigh(0); 
     1030        //  y0 = query->bounds.getLow(1); 
     1031        //  y1 = query->bounds.getHigh(1); 
     1032        //   
     1033        //  if (bUse3d) { 
     1034        //      try { 
     1035        //          z0 = query->bounds.getLow(2); 
     1036        //          z1 = query->bounds.getHigh(2); 
     1037        //      } catch (Tools::IndexOutOfBoundsException& e) { 
     1038        //          z0 = 0; 
     1039        //          z1 = 20000; 
     1040        //      } 
     1041        //  } else if (bGeographic) { 
     1042        //      x0 = -180.0; 
     1043        //      y0 = 180.0; 
     1044        //      y0 = -90.0; 
     1045        //      y1 = 90.0; 
     1046        //      z0 = 0.0; 
     1047        //      z1 = 20000.0; 
     1048        //      tolerance = 0.000000005; 
     1049        //  } else { 
     1050        //      z0 = 0.0; 
     1051        //      z1 = 20000.0;             
     1052        //  } 
    10101053    // }     
    10111054 
     
    10141057"              mdsys.sdo_ordinate_array(\n"; 
    10151058 
    1016     s_geom << x0 << "," << y0 << ","; 
     1059    s_geom << e->x0 << "," << e->y0 << ","; 
    10171060 
    10181061    if (bUse3d) { 
    1019         s_geom << z0 << ","; 
    1020     } 
    1021      
    1022     s_geom << x1 << "," << y1; 
     1062        s_geom << e->z0 << ","; 
     1063    } 
     1064     
     1065    s_geom << e->x1 << "," << e->y1; 
    10231066 
    10241067    if (bUse3d) { 
    1025         s_geom << "," << z1; 
     1068        s_geom << "," << e->z1; 
    10261069    } 
    10271070 
     
    15361579    } 
    15371580     
    1538     InsertBlocks(con, results, nCommitInterval, srid, reader2, table_name.c_str(), precision, pc_id, bUseSolidGeometry, bUse3d); 
    1539     //  
    1540     // for (i=results.begin(); i!=results.end(); i++) 
    1541     // { 
    1542     //     bool inserted = InsertBlock(con,  
    1543     //                                 *i,  
    1544     //                                 srid,  
    1545     //                                 reader2,  
    1546     //                                 table_name.c_str(),  
    1547     //                                 precision,  
    1548     //                                 pc_id,  
    1549     //                                 bUseSolidGeometry,  
    1550     //                                 bUse3d); 
    1551     // } 
     1581    long nDimensions = 3; 
     1582    InsertBlocks(con, results, nCommitInterval, srid, reader2, table_name.c_str(), precision, pc_id, bUseSolidGeometry, bUse3d, nDimensions); 
     1583  
    15521584     
    15531585    if (!bUseExistingBlockTable) { 
Note: See TracChangeset for help on using the changeset viewer.