Skip to content

Commit

Permalink
Merge branch 'master' of github.com:PDAL/PDAL into pipelinedocs
Browse files Browse the repository at this point in the history
  • Loading branch information
Paul Ramsey committed Jun 25, 2013
2 parents b7abe67 + 2ad737a commit 8dd5a74
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 11 deletions.
4 changes: 2 additions & 2 deletions src/drivers/nitf/Writer.cpp
Expand Up @@ -219,10 +219,10 @@ void Writer::writeEnd(boost::uint64_t actualNumPointsWritten)
);
subheader.getImageId().set("None");
// 64 char string
char* buffer = "0000000000000000000000000000000000000000000000000000000000000000";
const char* buffer = "0000000000000000000000000000000000000000000000000000000000000000";

::nitf::BandSource* band =
new ::nitf::MemorySource( buffer,
new ::nitf::MemorySource( (char*) buffer,
strlen(buffer) /* memory size */,
0 /* starting offset */,
1 /* bytes per pixel */,
Expand Down
26 changes: 17 additions & 9 deletions src/filters/InPlaceReprojection.cpp
Expand Up @@ -206,17 +206,17 @@ void InPlaceReprojection::setDimension( std::string const& name,

void InPlaceReprojection::reprojectOffsets( double& offset_x,
double& offset_y,
double& )
double& offset_z)
{

#ifdef PDAL_HAVE_GDAL
int ret = 0;

double dummy_x(0.0);
double dummy_z(0.0);
bool doOffsetZ = getOptions().getValueOrDefault<bool>("do_offset_z", false);

double* x = doOffsetZ ? &offset_x : &dummy_x;
ret = OCTTransform(m_transform_ptr.get(), 1, &offset_x, &offset_y, x);
double* z = doOffsetZ ? &offset_z : &dummy_z;
ret = OCTTransform(m_transform_ptr.get(), 1, &offset_x, &offset_y, z);
if (!ret)
{
std::ostringstream msg;
Expand Down Expand Up @@ -248,21 +248,29 @@ Schema InPlaceReprojection::alterSchema(Schema& schema)
log()->get(logDEBUG3) << "Fetched x_name: " << dimX;
log()->get(logDEBUG3) << "Fetched y_name: " << dimY;
log()->get(logDEBUG3) << "Fetched z_name: " << dimZ;

double offset_x = getOptions().getValueOrDefault<double>("offset_x", dimX.getNumericOffset());
double offset_y = getOptions().getValueOrDefault<double>("offset_y", dimY.getNumericOffset());
double offset_z = getOptions().getValueOrDefault<double>("offset_z", dimZ.getNumericOffset());

/* Start with the incoming dimension offsets */
double offset_x = dimX.getNumericOffset();
double offset_y = dimY.getNumericOffset();
double offset_z = dimZ.getNumericOffset();

/* Reproject incoming offsets to new coordinate system */
log()->floatPrecision(8);

log()->get(logDEBUG2) << "original offset x,y: " << offset_x <<"," << offset_y << std::endl;
reprojectOffsets(offset_x, offset_y, offset_z);
log()->get(logDEBUG2) << "reprojected offset x,y: " << offset_x <<"," << offset_y << std::endl;

/* If user-specified offsets exist, use those instead of the reprojected offsets */
offset_x = getOptions().getValueOrDefault<double>("offset_x", offset_x);
offset_y = getOptions().getValueOrDefault<double>("offset_y", offset_y);
offset_z = getOptions().getValueOrDefault<double>("offset_z", offset_z);

/* Read any user-specified scales */
double scale_x = getOptions().getValueOrDefault<double>("scale_x", dimX.getNumericScale());
double scale_y = getOptions().getValueOrDefault<double>("scale_y", dimY.getNumericScale());
double scale_z = getOptions().getValueOrDefault<double>("scale_z", dimZ.getNumericScale());

/* Apply scaling/offset to output schema */
setDimension(x_name, m_old_x_id, m_new_x_id, schema, scale_x, offset_x);
setDimension(y_name, m_old_y_id, m_new_y_id, schema, scale_y, offset_y);
setDimension(z_name, m_old_z_id, m_new_z_id, schema, scale_z, offset_z);
Expand Down

0 comments on commit 8dd5a74

Please sign in to comment.