Changeset 1592:bdc2854f7e5a
- Timestamp:
- 02/23/10 08:30:48 (5 months ago)
- Branch:
- default
- Location:
- apps
- Files:
-
- 3 edited
-
las2oci.cpp (modified) (10 diffs)
-
oci_wrapper.cpp (modified) (1 diff)
-
oci_wrapper.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
apps/las2oci.cpp
r1591 r1592 435 435 return e; 436 436 } 437 blocks* CreateBlock(int size) 438 { 439 blocks* b = (blocks*) malloc( sizeof(blocks)); 440 441 b->pc_ids = (long*) malloc( size * sizeof(long)); 442 b->block_ids = (long*) malloc ( size * sizeof(long)); 443 b->num_points = (long*) malloc ( size * sizeof(long)); 444 b->blobs = (std::vector<liblas::uint8_t>**) malloc ( size * sizeof(std::vector<liblas::uint8_t>*)); 445 446 b->srids = (long*) malloc ( size * sizeof(long)); 447 b->gtypes = (long*) malloc ( size * sizeof(long)); 448 449 b->element_arrays = (OCIArray**) malloc ( size * sizeof(OCIArray*)); 450 b->coordinate_arrays = (OCIArray**) malloc ( size * sizeof(OCIArray*)); 451 452 } 437 453 bool FillBlock( OWConnection* connection, 438 454 OWStatement* statement, … … 441 457 blocks* b, 442 458 long index, 443 444 459 int srid, 445 460 long pc_id, … … 450 465 bool bUse3d, 451 466 long nDimensions 452 453 467 ) 454 468 { … … 479 493 OCIArray* sdo_ordinates=0; 480 494 connection->CreateType(&sdo_ordinates, connection->GetOrdinateType()); 481 482 extent* e = (extent*) malloc(sizeof(extent)); 495 496 497 bool bGeographic = false; 498 499 if (srid == 4326) { 500 bGeographic = true; 501 } 502 else { 503 // s_srid << srid; 504 // bUse3d = false; 505 // If the user set an srid and set it to solid, we're still 3d 506 // if (bUseSolidGeometry == true) 507 // bUse3d = true; 508 } 509 510 extent* e = GetExtent(result, bUse3d, bGeographic); 483 511 SetOrdinates(statement, sdo_ordinates, e); 484 512 … … 524 552 list<SpatialIndex::id_type> const& ids = result.GetIDs(); 525 553 const SpatialIndex::Region* b = result.GetBounds(); 526 liblas::uint32_t num_points =ids.size(); 527 528 529 long gtype = GetGType(bUse3d, bUseSolidGeometry); 554 liblas::uint32_t num_points = ids.size(); 530 555 531 556 … … 545 570 } 546 571 547 548 double x0, x1, y0, y1, z0, z1; 549 550 551 x0 = b->getLow(0); 552 x1 = b->getHigh(0); 553 y0 = b->getLow(1); 554 y1 = b->getHigh(1); 555 556 if (bUse3d) { 557 try { 558 z0 = b->getLow(2); 559 z1 = b->getHigh(2); 560 } catch (Tools::IndexOutOfBoundsException& e) { 561 z0 = 0; 562 z1 = 20000; 563 } 564 } else if (bGeographic) { 565 x0 = -180.0; 566 x1 = 180.0; 567 y0 = -90.0; 568 y1 = 90.0; 569 z0 = 0.0; 570 z1 = 20000.0; 571 } else { 572 z0 = 0.0; 573 z1 = 20000.0; 574 } 575 576 577 // oss_geom.setf(std::ios_base::fixed, std::ios_base::floatfield); 578 // oss_geom.precision(precision); 572 long gtype = GetGType(bUse3d, bUseSolidGeometry); 579 573 580 574 oss << "INSERT INTO "<< tableName << … … 626 620 627 621 // :6 628 629 622 long* p_srid = 0; 630 623 … … 664 657 665 658 delete statement; 666 667 668 659 669 660 return true; … … 1075 1066 return 0; 1076 1067 } 1068 1069 connection->Commit(); 1077 1070 output = *pc_id; 1078 1071 … … 1428 1421 } 1429 1422 1423 con->StartTransaction(); 1430 1424 1431 1425 std::istream* istrm; -
apps/oci_wrapper.cpp
r1589 r1592 408 408 } 409 409 410 bool OWConnection::StartTransaction() 411 { 412 CheckError( OCITransStart ( 413 hSvcCtx, 414 hError, 415 (uword) 30, 416 OCI_TRANS_NEW), 417 hError ); 418 419 return true; 420 } 421 422 bool OWConnection::Commit() 423 { 424 CheckError( OCITransCommit ( 425 hSvcCtx, 426 hError, 427 OCI_DEFAULT), 428 hError ); 429 430 return true; 431 } 432 410 433 /*****************************************************************************/ 411 434 /* OWStatement */ -
apps/oci_wrapper.h
r1589 r1592 249 249 OCIType* GetElemInfoType() {return hElemArrayTDO; } 250 250 OCIType* GetOrdinateType() {return hOrdinateArrayTDO; } 251 252 bool Commit(); // OCITransCommit() 253 bool StartTransaction(); // //OCITransStart() 254 bool EndTransaction() {Commit(); } 251 255 252 256 };
Note: See TracChangeset
for help on using the changeset viewer.
