Changeset 1593:e5e48da9f267
- Timestamp:
- 02/23/10 11:37:23 (5 months ago)
- Branch:
- default
- File:
-
- 1 edited
-
apps/las2oci.cpp (modified) (14 diffs)
Legend:
- Unmodified
- Added
- Removed
-
apps/las2oci.cpp
r1592 r1593 400 400 } 401 401 402 extent* GetExtent( const LASQueryResult& result,402 extent* GetExtent( const SpatialIndex::Region* b, 403 403 bool bUse3d, 404 404 bool bGeographic … … 406 406 { 407 407 double x0, x1, y0, y1, z0, z1; 408 const SpatialIndex::Region* b = result.GetBounds();408 // const SpatialIndex::Region* b = result.GetBounds(); 409 409 if (bUse3d) { 410 410 try { … … 459 459 int srid, 460 460 long pc_id, 461 long block_id,462 long num_points,463 461 long gtype, 464 462 bool bUseSolidGeometry, … … 508 506 } 509 507 510 extent* e = GetExtent(result , bUse3d, bGeographic);508 extent* e = GetExtent(result.GetBounds(), bUse3d, bGeographic); 511 509 SetOrdinates(statement, sdo_ordinates, e); 512 510 … … 538 536 } 539 537 538 bool BindBlock(OWStatement statement, blocks* b, OCILobLocator** locator) 539 { 540 return true; 541 } 540 542 bool InsertBlock(OWConnection* connection, 541 543 const LASQueryResult& result, 544 blocks* block, 545 long block_index, 542 546 int srid, 543 547 LASReader* reader, … … 638 642 connection->CreateType(&sdo_ordinates, connection->GetOrdinateType()); 639 643 640 extent* e = GetExtent(result , bUse3d, bGeographic);644 extent* e = GetExtent(result.GetBounds(), bUse3d, bGeographic); 641 645 642 646 … … 672 676 long pc_id, 673 677 bool bUseSolidGeometry, 674 bool bUse3d 678 bool bUse3d, 679 long nDimensions 675 680 ) 676 681 { … … 679 684 std::list<LASQueryResult>::const_iterator i; 680 685 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; 681 703 682 704 for (i=results.begin(); i!=results.end(); i++) 683 705 { 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 684 722 bool inserted = InsertBlock(con, 685 *i, 723 *i, 724 b, 725 j, 686 726 srid, 687 727 reader2, … … 950 990 // bUse3d = true; 951 991 } 952 992 993 long gtype = GetGType(bUse3d, bUseSolidGeometry); 994 s_gtype << gtype; 953 995 if (bUse3d) { 954 996 if (bUseSolidGeometry == true) { 955 s_gtype << "3008";997 // s_gtype << "3008"; 956 998 s_eleminfo << "(1,1007,3)"; 957 999 958 1000 } else { 959 s_gtype << "3003";1001 // s_gtype << "3003"; 960 1002 s_eleminfo << "(1,1003,3)"; 961 1003 … … 963 1005 } else { 964 1006 if (bUseSolidGeometry == true) { 965 s_gtype << "2008";1007 // s_gtype << "2008"; 966 1008 s_eleminfo << "(1,1007,3)"; 967 1009 968 1010 } else { 969 s_gtype << "2003";1011 // s_gtype << "2003"; 970 1012 s_eleminfo << "(1,1003,3)"; 971 1013 … … 974 1016 975 1017 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; 978 1021 double tolerance = 0.05; 979 1022 … … 983 1026 // z0 = zmin; z1 = zmax; 984 1027 // } 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 // } 1010 1053 // } 1011 1054 … … 1014 1057 " mdsys.sdo_ordinate_array(\n"; 1015 1058 1016 s_geom << x0 << "," <<y0 << ",";1059 s_geom << e->x0 << "," << e->y0 << ","; 1017 1060 1018 1061 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; 1023 1066 1024 1067 if (bUse3d) { 1025 s_geom << "," << z1;1068 s_geom << "," << e->z1; 1026 1069 } 1027 1070 … … 1536 1579 } 1537 1580 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 1552 1584 1553 1585 if (!bUseExistingBlockTable) {
Note: See TracChangeset
for help on using the changeset viewer.
