Пример #1
0
void InPlaceReprojection::processBuffer(PointBuffer& data) const
{
    const boost::uint32_t numPoints = data.getNumPoints();

    const Schema& schema = this->getSchema();
    
    Dimension const& d_x = schema.getDimension(getOptions().getValueOrDefault<std::string>("x_dim", "X"));
    Dimension const& d_y = schema.getDimension(getOptions().getValueOrDefault<std::string>("y_dim", "Y"));
    Dimension const& d_z = schema.getDimension(getOptions().getValueOrDefault<std::string>("z_dim", "Z"));
    
    for (boost::uint32_t pointIndex=0; pointIndex<numPoints; pointIndex++)
    {
        double x = getScaledValue(data, m_x, pointIndex);
        double y = getScaledValue(data, m_y, pointIndex);
        double z = getScaledValue(data, m_z, pointIndex);
        
        // std::cout << "input: " << x << " y: " << y << " z: " << z << std::endl;
        this->transform(x,y,z);
        // std::cout << "output: " << x << " y: " << y << " z: " << z << std::endl;
        
        setScaledValue(data, x, d_x, pointIndex);
        setScaledValue(data, y, d_y, pointIndex);
        setScaledValue(data, z, d_z, pointIndex);

        // std::cout << "set: " << getScaledValue(data, d_x, pointIndex, indexX) 
        //           << " y: " << getScaledValue(data, d_y, pointIndex, indexY) 
        //           << " z: " << getScaledValue(data, d_z, pointIndex, indexZ) << std::endl;
        
        data.setNumPoints(pointIndex+1);
    }

    return;
}
Пример #2
0
boost::uint32_t Colorization::readBufferImpl(PointBuffer& data)
{
    const boost::uint32_t numRead = getPrevIterator().read(data);

#ifdef PDAL_HAVE_GDAL

    boost::int32_t pixel(0);
    boost::int32_t line(0);
    double x(0.0);
    double y(0.0);
    bool fetched(false);

    boost::array<double, 2> pix;
    pix.assign(0.0);

    for (boost::uint32_t pointIndex=0; pointIndex<numRead; pointIndex++)
    {
        x = getScaledValue(data, *m_dimX, pointIndex);
        y = getScaledValue(data, *m_dimY, pointIndex);

        fetched = getPixelAndLinePosition(x, y, m_inverse_transform, pixel, line, m_ds);
        if (!fetched)
            continue;

        for (std::vector<boost::int32_t>::size_type i = 0;
                i < m_bands.size(); i++)
        {
            GDALRasterBandH hBand = GDALGetRasterBand(m_ds, m_bands[i]);
            if (hBand == NULL)
            {
                std::ostringstream oss;
                oss << "Unable to get band " << m_bands[i] << " from data source!";
                throw pdal_error(oss.str());
            }
            if (GDALRasterIO(hBand, GF_Read, pixel, line, 1, 1,
                             &pix[0], 1, 1, GDT_CFloat64, 0, 0) == CE_None)
            {

                double output = pix[0];
                output = output * m_scales[i];
                setScaledValue(data, output, *m_dimensions[i], pointIndex);
            }
        }

    }

#endif
    return numRead;
}
//==========================================================================
//      Constructor and Destructor
//==========================================================================
SAFEParameter::SAFEParameter (String nameInit, float& valueRef, float initialValue, float minValueInit, float maxValueInit, String unitsInit, float skewFactorInit, bool convertDBToGainValue, double interpolationTimeInit, float UIScaleFactorInit)
    : outputValue (valueRef),
      convertToGain (convertDBToGainValue)
{
    name = nameInit;
    minValue = minValueInit;
    maxValue = maxValueInit;
    defaultValue = initialValue;
    skewFactor = skewFactorInit;
    units = unitsInit;

    interpolating = false;
    initialised = false;
    sampleRate = 44100;
    controlRate = 64;
    interpolationTime = interpolationTimeInit;
    updateBlockSizes();

    UIScaleFactor = UIScaleFactorInit;

    setScaledValue (defaultValue);
}