void Reprojection::initialize() { Filter::initialize(); checkImpedance(); if (m_inferInputSRS) { m_inSRS = getPrevStage().getSpatialReference(); } #ifdef PDAL_HAVE_GDAL m_gdal_debug = boost::shared_ptr<pdal::gdal::Debug>( new pdal::gdal::Debug(isDebug(), log())); m_in_ref_ptr = ReferencePtr(OSRNewSpatialReference(0), OGRSpatialReferenceDeleter()); m_out_ref_ptr = ReferencePtr(OSRNewSpatialReference(0), OGRSpatialReferenceDeleter()); int result = OSRSetFromUserInput(m_in_ref_ptr.get(), m_inSRS.getWKT(pdal::SpatialReference::eCompoundOK).c_str()); if (result != OGRERR_NONE) { std::ostringstream msg; msg << "Could not import input spatial reference for ReprojectionFilter:: " << CPLGetLastErrorMsg() << " code: " << result << " wkt: '" << m_inSRS.getWKT() << "'"; throw std::runtime_error(msg.str()); } result = OSRSetFromUserInput(m_out_ref_ptr.get(), m_outSRS.getWKT(pdal::SpatialReference::eCompoundOK).c_str()); if (result != OGRERR_NONE) { std::ostringstream msg; msg << "Could not import output spatial reference for ReprojectionFilter:: " << CPLGetLastErrorMsg() << " code: " << result << " wkt: '" << m_outSRS.getWKT() << "'"; std::string message(msg.str()); throw std::runtime_error(message); } m_transform_ptr = TransformPtr(OCTNewCoordinateTransformation( m_in_ref_ptr.get(), m_out_ref_ptr.get()), OSRTransformDeleter()); if (!m_transform_ptr.get()) { std::ostringstream msg; msg << "Could not construct CoordinateTransformation in ReprojectionFilter:: "; std::string message(msg.str()); throw std::runtime_error(message); } #endif setSpatialReference(m_outSRS); updateBounds(); return; }
void InPlaceReprojection::initialize() { Filter::initialize(); if (m_inferInputSRS) { m_inSRS = getPrevStage().getSpatialReference(); } #ifdef PDAL_HAVE_GDAL pdal::GlobalEnvironment::get().getGDALDebug()->addLog(log()); m_in_ref_ptr = ReferencePtr(OSRNewSpatialReference(0), OGRSpatialReferenceDeleter()); m_out_ref_ptr = ReferencePtr(OSRNewSpatialReference(0), OGRSpatialReferenceDeleter()); int result = OSRSetFromUserInput(m_in_ref_ptr.get(), m_inSRS.getWKT(pdal::SpatialReference::eCompoundOK).c_str()); if (result != OGRERR_NONE) { std::ostringstream msg; msg << "Could not import input spatial reference for InPlaceReprojection:: " << CPLGetLastErrorMsg() << " code: " << result << " wkt: '" << m_inSRS.getWKT() << "'"; throw std::runtime_error(msg.str()); } result = OSRSetFromUserInput(m_out_ref_ptr.get(), m_outSRS.getWKT(pdal::SpatialReference::eCompoundOK).c_str()); if (result != OGRERR_NONE) { std::ostringstream msg; msg << "Could not import output spatial reference for InPlaceReprojection:: " << CPLGetLastErrorMsg() << " code: " << result << " wkt: '" << m_outSRS.getWKT() << "'"; std::string message(msg.str()); throw std::runtime_error(message); } m_transform_ptr = TransformPtr(OCTNewCoordinateTransformation(m_in_ref_ptr.get(), m_out_ref_ptr.get()), OSRTransformDeleter()); if (!m_transform_ptr.get()) { std::ostringstream msg; msg << "Could not construct CoordinateTransformation in InPlaceReprojection:: "; std::string message(msg.str()); throw std::runtime_error(message); } #endif setSpatialReference(m_outSRS); Schema& s = getSchemaRef(); s = alterSchema(s); return; }
CameraNode::CameraNode( const Vec3& eye, const Vec3& center, const Vec3& up, Frustum const &frustum ) : SceneNode( INVALID_ACTOR_ID, NULL, RenderPass_0, TransformPtr( ENG_NEW Transform( Mat4x4::LookAtToTransform( eye, center, up ).Inverse() ) ) ), m_Frustum( frustum ), m_IsActive( true ), m_IsDebugCamera( false ), m_pTarget( shared_ptr<SceneNode>() ), m_CamOffsetVector( 0.0f, 1.0f, -10.0f, 0.0f ), m_View( Mat4x4::LookAt( eye, center, up ) ) { }
void ReprojectionFilter::ready(PointTableRef table) { if (m_inferInputSRS) { m_inSRS = table.spatialRef(); if (m_inSRS.getWKT().empty()) throw pdal_error("Source data has no spatial reference and none " "is specified with the 'in_srs' option."); } m_in_ref_ptr = ReferencePtr(OSRNewSpatialReference(0), OGRSpatialReferenceDeleter()); m_out_ref_ptr = ReferencePtr(OSRNewSpatialReference(0), OGRSpatialReferenceDeleter()); int result = OSRSetFromUserInput(m_in_ref_ptr.get(), m_inSRS.getWKT(pdal::SpatialReference::eCompoundOK).c_str()); if (result != OGRERR_NONE) { std::ostringstream msg; msg << "Invalid input spatial reference '" << m_inSRS.getWKT() << "'. This is usually caused by a bad value for the 'in_srs'" "option or an invalid spatial reference in the source file."; throw pdal_error(msg.str()); } result = OSRSetFromUserInput(m_out_ref_ptr.get(), m_outSRS.getWKT(pdal::SpatialReference::eCompoundOK).c_str()); if (result != OGRERR_NONE) { std::ostringstream msg; msg << "Invalid output spatial reference '" << m_outSRS.getWKT() << "'. This is usually caused by a bad value for the 'out_srs'" "option."; throw pdal_error(msg.str()); } m_transform_ptr = TransformPtr( OCTNewCoordinateTransformation(m_in_ref_ptr.get(), m_out_ref_ptr.get()), OSRTransformDeleter()); if (!m_transform_ptr.get()) { std::string msg = "Could not construct CoordinateTransformation in " "ReprojectionFilter:: "; throw std::runtime_error(msg); } setSpatialReference(m_outSRS); }
void bindCamera() { RunTimeTypedClass<Camera>() .def( init< optional< const std::string &, TransformPtr, CompoundDataPtr > > ( ( arg( "name" ) = std::string( "default" ), arg( "transform" ) = TransformPtr(), /// We need to explicitly make this a CompoundData::Ptr so that boost.python finds the correct to_python converter arg( "parameters" ) = CompoundData::Ptr( new CompoundData() ) ) ) ) .def( "setName", &Camera::setName ) .def( "getName", &Camera::getName, return_value_policy<copy_const_reference>() ) .def( "setTransform", &Camera::setTransform ) .def( "getTransform", (Transform *(Camera::*)())&Camera::getTransform, return_value_policy<CastToIntrusivePtr>() ) .def( "parameters", (CompoundData *(Camera::*)())&Camera::parametersData, return_value_policy<CastToIntrusivePtr>() ) .def( "addStandardParameters", &Camera::addStandardParameters ) ; }