[Liblas-commits] hg-main-tree: touching SDO_PC.PC_EXTENT without
disabling the tr...
liblas-commits at liblas.org
liblas-commits at liblas.org
Thu Aug 4 12:06:50 EDT 2011
details: http://hg.libpc.orghg-main-tree/rev/4291f674c28d
changeset: 1004:4291f674c28d
user: Howard Butler <hobu.inc at gmail.com>
date: Thu Aug 04 11:02:01 2011 -0500
description:
touching SDO_PC.PC_EXTENT without disabling the trigger will nuke the cloud's blocks. Add code to temporarily shut this trigger off if enabled when updating the SDO_PC.PC_EXTENT
Subject: hg-main-tree: remove dead code
details: http://hg.libpc.orghg-main-tree/rev/30b32d488aab
changeset: 1005:30b32d488aab
user: Howard Butler <hobu.inc at gmail.com>
date: Thu Aug 04 11:02:16 2011 -0500
description:
remove dead code
diffstat:
include/pdal/drivers/oci/Writer.hpp | 3 +-
src/drivers/oci/Reader.cpp | 176 +-----------------------------------
src/drivers/oci/Writer.cpp | 82 ++++++++++++++++-
3 files changed, 87 insertions(+), 174 deletions(-)
diffs (truncated from 333 to 300 lines):
diff -r 2c68227bc3a5 -r 30b32d488aab include/pdal/drivers/oci/Writer.hpp
--- a/include/pdal/drivers/oci/Writer.hpp Wed Aug 03 13:52:24 2011 -0500
+++ b/include/pdal/drivers/oci/Writer.hpp Thu Aug 04 11:02:16 2011 -0500
@@ -106,7 +106,8 @@
bool isSolid() const;
boost::int32_t getPCID() const;
void UpdatePCExtent();
-
+ std::string ShutOff_SDO_PC_Trigger();
+ void TurnOn_SDO_PC_Trigger(std::string trigger_name);
pdal::Bounds<double> CalculateBounds(PointBuffer const& buffer);
Stage& m_stage;
diff -r 2c68227bc3a5 -r 30b32d488aab src/drivers/oci/Reader.cpp
--- a/src/drivers/oci/Reader.cpp Wed Aug 03 13:52:24 2011 -0500
+++ b/src/drivers/oci/Reader.cpp Thu Aug 04 11:02:16 2011 -0500
@@ -125,6 +125,10 @@
const Options& Reader::s_getDefaultOptions()
{
static Options options;
+
+
+
+
return options;
}
@@ -169,178 +173,6 @@
}
}
-void Reader::registerFields()
-{
- Schema& schema = getSchemaRef();
-
- Dimension x(Dimension::Field_X, Dimension::Int32);
- Dimension y(Dimension::Field_Y, Dimension::Int32);
- Dimension z(Dimension::Field_Z, Dimension::Int32);
-
- boost::property_tree::ptree tree = m_optionsOld.GetPTree();
- double scalex = tree.get<double>("scale.x");
- double scaley = tree.get<double>("scale.y");
- double scalez = tree.get<double>("scale.z");
-
- double offsetx = tree.get<double>("offset.x");
- double offsety = tree.get<double>("offset.y");
- double offsetz = tree.get<double>("offset.z");
-
- x.setNumericScale(scalex);
- y.setNumericScale(scaley);
- z.setNumericScale(scalez);
- x.setNumericOffset(offsetx);
- y.setNumericOffset(offsety);
- z.setNumericOffset(offsetz);
-
-
- std::ostringstream text;
-
- text << "x coordinate as a long integer. You must use the scale and "
- << "offset information of the header to determine the double value.";
- x.setDescription(text.str());
- schema.addDimension(x);
- text.str("");
-
- text << "y coordinate as a long integer. You must use the scale and "
- << "offset information of the header to determine the double value.";
- y.setDescription(text.str());
- schema.addDimension(y);
- text.str("");
-
- text << "z coordinate as a long integer. You must use the scale and "
- << "offset information of the header to determine the double value.";
- z.setDescription(text.str());
- schema.addDimension(z);
- text.str("");
-
- Dimension intensity(Dimension::Field_Intensity, Dimension::Uint16);
- text << "The intensity value is the integer representation of the pulse "
- "return magnitude. This value is optional and system specific. "
- "However, it should always be included if available.";
- intensity.setDescription(text.str());
- schema.addDimension(intensity);
- text.str("");
-
- Dimension return_no(Dimension::Field_ReturnNumber, Dimension::Uint8); // 3 bits only
- text << "Return Number: The Return Number is the pulse return number for "
- "a given output pulse. A given output laser pulse can have many "
- "returns, and they must be marked in sequence of return. The first "
- "return will have a Return Number of one, the second a Return "
- "Number of two, and so on up to five returns.";
- return_no.setDescription(text.str());
- schema.addDimension(return_no);
- text.str("");
-
- Dimension no_returns(Dimension::Field_NumberOfReturns, Dimension::Uint8); // 3 bits only
- text << "Number of Returns (for this emitted pulse): The Number of Returns "
- "is the total number of returns for a given pulse. For example, "
- "a laser data point may be return two (Return Number) within a "
- "total number of five returns.";
- no_returns.setDescription(text.str());
- schema.addDimension(no_returns);
- text.str("");
-
- Dimension scan_dir(Dimension::Field_ScanDirectionFlag, Dimension::Uint8); // 1 bit only
- text << "The Scan Direction Flag denotes the direction at which the "
- "scanner mirror was traveling at the time of the output pulse. "
- "A bit value of 1 is a positive scan direction, and a bit value "
- "of 0 is a negative scan direction (where positive scan direction "
- "is a scan moving from the left side of the in-track direction to "
- "the right side and negative the opposite). ";
- scan_dir.setDescription(text.str());
- schema.addDimension(scan_dir);
- text.str("");
-
- Dimension edge(Dimension::Field_EdgeOfFlightLine, Dimension::Uint8); // 1 bit only
- text << "The Edge of Flight Line data bit has a value of 1 only when "
- "the point is at the end of a scan. It is the last point on "
- "a given scan line before it changes direction.";
- edge.setDescription(text.str());
- schema.addDimension(edge);
- text.str("");
-
- Dimension classification(Dimension::Field_Classification, Dimension::Uint8);
- text << "Classification in LAS 1.0 was essentially user defined and optional. "
- "LAS 1.1 defines a standard set of ASPRS classifications. In addition, "
- "the field is now mandatory. If a point has never been classified, this "
- "byte must be set to zero. There are no user defined classes since "
- "both point format 0 and point format 1 supply 8 bits per point for "
- "user defined operations. Note that the format for classification is a "
- "bit encoded field with the lower five bits used for class and the "
- "three high bits used for flags.";
- classification.setDescription(text.str());
- schema.addDimension(classification);
- text.str("");
-
- Dimension scan_angle(Dimension::Field_ScanAngleRank, Dimension::Int8);
- text << "The Scan Angle Rank is a signed one-byte number with a "
- "valid range from -90 to +90. The Scan Angle Rank is the "
- "angle (rounded to the nearest integer in the absolute "
- "value sense) at which the laser point was output from the "
- "laser system including the roll of the aircraft. The scan "
- "angle is within 1 degree of accuracy from +90 to ñ90 degrees. "
- "The scan angle is an angle based on 0 degrees being nadir, "
- "and ñ90 degrees to the left side of the aircraft in the "
- "direction of flight.";
- scan_angle.setDescription(text.str());
- schema.addDimension(scan_angle);
- text.str("");
-
- Dimension user_data(Dimension::Field_UserData, Dimension::Uint8);
- text << "This field may be used at the userÃs discretion";
- user_data.setDescription(text.str());
- schema.addDimension(user_data);
- text.str("");
-
- Dimension point_source_id(Dimension::Field_PointSourceId, Dimension::Uint16);
- text << "This value indicates the file from which this point originated. "
- "Valid values for this field are 1 to 65,535 inclusive with zero "
- "being used for a special case discussed below. The numerical value "
- "corresponds to the File Source ID from which this point originated. "
- "Zero is reserved as a convenience to system implementers. A Point "
- "Source ID of zero implies that this point originated in this file. "
- "This implies that processing software should set the Point Source "
- "ID equal to the File Source ID of the file containing this point "
- "at some time during processing. ";
- point_source_id.setDescription(text.str());
- schema.addDimension(point_source_id);
- text.str("");
-
- Dimension t(Dimension::Field_Time, Dimension::Double);
- text << "The GPS Time is the double floating point time tag value at "
- "which the point was acquired. It is GPS Week Time if the "
- "Global Encoding low bit is clear and Adjusted Standard GPS "
- "Time if the Global Encoding low bit is set (see Global Encoding "
- "in the Public Header Block description).";
- t.setDescription(text.str());
- schema.addDimension(t);
- text.str("");
-
- Dimension red(Dimension::Field_Red, Dimension::Uint16);
- text << "The red image channel value associated with this point";
- red.setDescription(text.str());
- schema.addDimension(red);
- text.str("");
-
- Dimension green(Dimension::Field_Green, Dimension::Uint16);
- text << "The green image channel value associated with this point";
- green.setDescription(text.str());
- schema.addDimension(green);
- text.str("");
-
- Dimension blue(Dimension::Field_Blue, Dimension::Uint16);
- text << "The blue image channel value associated with this point";
- blue.setDescription(text.str());
- schema.addDimension(blue);
- text.str("");
-
-
-
- return;
-}
-
-
Reader::~Reader()
{
diff -r 2c68227bc3a5 -r 30b32d488aab src/drivers/oci/Writer.cpp
--- a/src/drivers/oci/Writer.cpp Wed Aug 03 13:52:24 2011 -0500
+++ b/src/drivers/oci/Writer.cpp Thu Aug 04 11:02:16 2011 -0500
@@ -850,13 +850,15 @@
void Writer::writeEnd(boost::uint64_t actualNumPointsWritten)
{
+ m_connection->Commit();
if (m_doCreateIndex)
{
CreateSDOEntry();
CreateBlockIndex();
}
-
+
+
// Update extent of SDO_PC entry
UpdatePCExtent();
@@ -1302,6 +1304,71 @@
return true;
}
+std::string Writer::ShutOff_SDO_PC_Trigger()
+{
+ boost::property_tree::ptree& tree = m_optionsOld.GetPTree();
+ std::string base_table_name = to_upper(tree.get<std::string>("base_table_name"));
+ std::string cloud_column_name = to_upper(tree.get<std::string>("cloud_column_name"));
+
+ std::ostringstream oss;
+
+ char szTrigger[OWNAME] = "";
+ char szStatus[OWNAME] = "";
+
+ oss << "select trigger_name, status from all_triggers where table_name = '" << base_table_name << "' AND TRIGGER_NAME like upper('%%MDTNPC_%%') ";
+ Statement statement = Statement(m_connection->CreateStatement(oss.str().c_str()));
+
+ statement->Define(szTrigger);
+ statement->Define(szStatus);
+
+ statement->Execute();
+ std::cout << "Trigger: " << szTrigger << " status: " << szStatus << std::endl;
+
+ // Yes, we're assuming there's only one trigger that met these criteria.
+
+ if (!strlen(szStatus))
+ {
+ // No rows returned, no trigger exists
+ return std::string("");
+ }
+
+
+ if (compare_no_case(szStatus, "ENABLED") == 0)
+ {
+ oss.str("");
+ oss << "ALTER TRIGGER " << szTrigger << " DISABLE ";
+
+ statement = Statement(m_connection->CreateStatement(oss.str().c_str()));
+ statement->Execute();
+
+ return std::string(szTrigger);
+ } else
+ {
+ return std::string("");
+ }
+
+
+
+}
+
+void Writer::TurnOn_SDO_PC_Trigger(std::string trigger_name)
+{
+
+ if (!trigger_name.size()) return;
+
+ std::ostringstream oss;
+ boost::property_tree::ptree& tree = m_optionsOld.GetPTree();
+
+ std::string base_table_name = to_upper(tree.get<std::string>("base_table_name"));
+
+ oss << "ALTER TRIGGER " << trigger_name << " ENABLE ";
+
+ Statement statement = Statement(m_connection->CreateStatement(oss.str().c_str()));
+ statement->Execute();
+
+
+}
+
void Writer::UpdatePCExtent()
{
@@ -1330,7 +1397,14 @@
More information about the Liblas-commits
mailing list