Example #1
0
    bool operator()(liblas::Point const& p)
    {
        double const dx = x - p.GetX();
        double const dy = y - p.GetY();

        return ((dx <= t && dx >= -t) && (dy <= t && dy >= -t));
    }
Example #2
0
	LidarPoint(const LidarMetadata& theMetadata, const liblas::Point& theLasPoint)	
		: mMetadata(&theMetadata),
		  mCoords(wykobi::make_point(static_cast<long>(theLasPoint.GetRawX()), 
			static_cast<long>(theLasPoint.GetRawY()), 
			static_cast<long>(theLasPoint.GetRawZ()))),
		  mCls(theLasPoint.GetClassification().GetClass())
	{
	}
Example #3
0
    void operator()(liblas::Point const& p)
    {
        if (0 == bbox)
            throw std::invalid_argument("bbox is null");

        // Box initialization during first iteration only
        if (empty)
        {
            bbox->min(0, p.GetX());
            bbox->max(0, p.GetX());
            bbox->min(1, p.GetY());
            bbox->max(1, p.GetY());
            bbox->min(2, p.GetZ());
            bbox->max(2, p.GetZ());
            empty = false;
        }

        // Expand bounding box to include given point
        bbox->min(0, std::min(bbox->min(0), p.GetX()));
        bbox->min(1, std::min(bbox->min(1), p.GetY()));
        bbox->min(2, std::min(bbox->min(2), p.GetZ()));
        bbox->max(0, std::max(bbox->max(0), p.GetX()));
        bbox->max(1, std::max(bbox->max(1), p.GetY()));
        bbox->max(2, std::max(bbox->max(2), p.GetZ()));
    }
Example #4
0
void test_file10_point4(liblas::Point const& p)
{
    ensure_distance(p.GetX(), double(630346.83), 0.0001);
    ensure_distance(p.GetY(), double(4834500), 0.0001);
    ensure_distance(p.GetZ(), double(50.90), 0.0001);
    ensure_equals(p.GetIntensity(), 150);
    ensure_equals(p.GetClassification(), liblas::Classification::bitset_type(1));
    ensure_equals(p.GetScanAngleRank(), 0);
    ensure_equals(p.GetUserData(), 4);
    ensure_equals(p.GetPointSourceID(), 0);
    ensure_equals(p.GetScanFlags(), 18);
    ensure_distance(p.GetTime(), double(414093.84360000002), 0.0001);
}
Example #5
0
void test_file10_point1(liblas::Point const& p)
{
    ensure_distance(p.GetX(), double(630262.30), 0.0001);
    ensure_distance(p.GetY(), double(4834500), 0.0001);
    ensure_distance(p.GetZ(), double(51.53), 0.0001);
    ensure_equals(p.GetIntensity(), 670);
    ensure_equals(p.GetClassification(), liblas::Classification::bitset_type(1));
    ensure_equals(p.GetScanAngleRank(), 0);
    ensure_equals(p.GetUserData(), 3);
    ensure_equals(p.GetPointSourceID(), 0);
    ensure_equals(p.GetScanFlags(), 9);
    ensure_distance(p.GetTime(), double(413665.23360000004), 0.0001);
}
Example #6
0
bool ColorFilter::filter(const liblas::Point& p)
{

    liblas::Color const& c = p.GetColor();
    
    if (c.GetRed() < m_low.GetRed())
        return !DoExclude();
    
    if (c.GetRed() > m_high.GetRed())
        return !DoExclude();

    if (c.GetBlue() < m_low.GetBlue())
        return !DoExclude();
    
    if (c.GetBlue() > m_high.GetBlue())
        return !DoExclude();

    if (c.GetGreen() < m_low.GetGreen())
        return !DoExclude();
    
    if (c.GetGreen() > m_high.GetGreen())
        return !DoExclude();

    return DoExclude();
}
Example #7
0
void LidarPoint::setFromLasPoint(liblas::Point const& theLasPoint)
{
	mX = theLasPoint.GetX();
	mY = theLasPoint.GetY();
	mZ = theLasPoint.GetZ();
	mIntensity = theLasPoint.GetIntensity();
	mClassification = theLasPoint.GetClassification().GetClass();
	mRed = theLasPoint.GetColor().GetRed();
	mGreen = theLasPoint.GetColor().GetGreen();
	mBlue = theLasPoint.GetColor().GetBlue();
}
Example #8
0
bool ValidationFilter::filter(const liblas::Point& p)
{

    bool output = false;
    if (p.IsValid()){
        if (GetType() == eInclusion) {
            output = true;
        } else {
            output = false;
        }    
    }

    return output;
}
Example #9
0
void test_default_point(liblas::Point const& p)
{
    ensure_equals("wrong default X coordinate",
        p.GetX(), double(0));
    ensure_equals("wrong default Y coordinate",
        p.GetY(), double(0));
    ensure_equals("wrong default Z coordinate",
        p.GetZ(), double(0));
    ensure_equals("wrong defualt intensity",
        p.GetIntensity(), 0);
    ensure_equals("wrong defualt return number",
        p.GetReturnNumber(), 0);
    ensure_equals("wrong defualt number of returns",
        p.GetNumberOfReturns(), 0);
    ensure_equals("wrong defualt scan direction",
        p.GetScanDirection(), 0);
    ensure_equals("wrong defualt edge of flight line",
        p.GetFlightLineEdge(), 0);
    ensure_equals("wrong defualt classification",
        p.GetClassification(), liblas::Classification::bitset_type());
    ensure_equals("wrong defualt scan angle rank",
        p.GetScanAngleRank(), 0);
    ensure_equals("wrong defualt file marker/user data value",
        p.GetUserData(), 0);
    ensure_equals("wrong defualt user bit field/point source id value",
        p.GetPointSourceID(), 0);
    ensure_equals("wrong defualt time",
        p.GetTime(), double(0));

    ensure_equals("invalid default red color",
        p.GetColor().GetRed(), 0);
    ensure_equals("invalid default green color",
        p.GetColor().GetGreen(), 0);
    ensure_equals("invalid default blue color",
        p.GetColor().GetBlue(), 0);
            
    ensure("invalid defualt point record", p.IsValid());
}
Example #10
0
void test_file_12Color_point2(liblas::Point const& p)
{
    ensure_distance(p.GetX(), double(636784.740000), 0.0001);
    ensure_distance(p.GetY(), double(849106.660000), 0.0001);
    ensure_distance(p.GetZ(), double(426.710000), 0.0001);
    ensure_distance(p.GetTime(), double(245382.135950), 0.0001);

    ensure_equals(p.GetReturnNumber(), 1);
    ensure_equals(p.GetNumberOfReturns(), 1);
    ensure_equals(p.GetFlightLineEdge(), 0);
    ensure_equals(p.GetIntensity(), 118);
    ensure_equals(p.GetScanDirection(), 0);
    ensure_equals(p.GetScanAngleRank(), -10);

    ensure_equals(p.GetClassification().GetClass(), 1);
    ensure_equals(p.GetClassification().IsWithheld(), false);
    ensure_equals(p.GetClassification().IsKeyPoint(), false);
    ensure_equals(p.GetClassification().IsSynthetic(), false);

    ensure_equals(p.GetColor().GetRed(), 112);
    ensure_equals(p.GetColor().GetGreen(), 97);
    ensure_equals(p.GetColor().GetBlue(), 114);
}
Example #11
0
void test_file_12Color_point1(liblas::Point const& p)
{
    ensure_distance(p.GetX(), double(636896.330000), 0.0001);
    ensure_distance(p.GetY(), double(849087.700000), 0.0001);
    ensure_distance(p.GetZ(), double(446.390000), 0.0001);
    ensure_distance(p.GetTime(), double(245381.452799), 0.0001);

    ensure_equals(p.GetReturnNumber(), 1);
    ensure_equals(p.GetNumberOfReturns(), 2);
    ensure_equals(p.GetFlightLineEdge(), 0);
    ensure_equals(p.GetIntensity(), 18);
    ensure_equals(p.GetScanDirection(), 1);
    ensure_equals(p.GetScanAngleRank(), -11);

    ensure_equals(p.GetClassification().GetClass(), 1);
    ensure_equals(p.GetClassification().IsWithheld(), false);
    ensure_equals(p.GetClassification().IsKeyPoint(), false);
    ensure_equals(p.GetClassification().IsSynthetic(), false);

    ensure_equals(p.GetColor().GetRed(), 54);
    ensure_equals(p.GetColor().GetGreen(), 66);
    ensure_equals(p.GetColor().GetBlue(), 68);
}
Example #12
0
void test_file_12Color_point0(liblas::Point const& p)
{
    ensure_distance(p.GetX(), double(637012.240000), 0.0001);
    ensure_distance(p.GetY(), double(849028.310000), 0.0001);
    ensure_distance(p.GetZ(), double(431.660000), 0.0001);
    ensure_distance(p.GetTime(), double(245380.782550), 0.0001);

    ensure_equals(p.GetReturnNumber(), 1);
    ensure_equals(p.GetNumberOfReturns(), 1);
    ensure_equals(p.GetFlightLineEdge(), 0);
    ensure_equals(p.GetIntensity(), 143);
    ensure_equals(p.GetScanDirection(), 1);
    ensure_equals(p.GetScanAngleRank(), -9);

    ensure_equals(p.GetClassification().GetClass(), 1);
    ensure_equals(p.GetClassification().IsWithheld(), false);
    ensure_equals(p.GetClassification().IsKeyPoint(), false);
    ensure_equals(p.GetClassification().IsSynthetic(), false);

    ensure_equals(p.GetColor().GetRed(), 68);
    ensure_equals(p.GetColor().GetGreen(), 77);
    ensure_equals(p.GetColor().GetBlue(), 88);
}
Example #13
0
void ZipWriterImpl::WritePoint(liblas::Point const& point)
{
    //if (m_point_writer.get() == 0) {
    //    m_point_writer = PointWriterPtr(new writer::Point(m_ofs, m_pointCount, m_header));
    //}
    //m_point_writer->write(point);

    if (m_zipper==NULL)
    {
        try
        {
            m_zipper = new LASzipper();
        }
        catch(...)
        {
            throw liblas_error("Error opening compression engine (1)");
        }

        PointFormatName format = m_header->GetDataFormatId();
        m_zipPoint = new ZipPoint(format);

        unsigned int stat = 1;
        try
        {
            stat = m_zipper->open(m_ofs, m_zipPoint->m_num_items, m_zipPoint->m_items, LASzip::DEFAULT_COMPRESSION);
        }
        catch(...)
        {
            throw liblas_error("Error opening compression engine (3)");
        }
        if (stat != 0)
        {
            throw liblas_error("Error opening compression engine (2)");
        }
    }

    bool ok = false;
    try
    {
        const std::vector<boost::uint8_t>* data;

        data = &point.GetData();

        if (data->size() != m_zipPoint->m_lz_point_size)
        {
            // We need to repack the data.
            liblas::Point p(point);
            p.SetHeaderPtr(m_header);
            data = &p.GetData();
            //      m_zipPoint->m_lz_point_data = const_cast<unsigned char*>(&(data->front()));
            for (unsigned int i=0; i<m_zipPoint->m_lz_point_size; i++)
            {
                m_zipPoint->m_lz_point_data[i] = data->at(i);
                //printf("%d %d\n", v[i], i);
            }
            ok = m_zipper->write(m_zipPoint->m_lz_point);
        } else
        {
//          m_zipPoint->m_lz_point_data = const_cast<unsigned char*>(&(data->front()));
            for (unsigned int i=0; i<m_zipPoint->m_lz_point_size; i++)
            {
                m_zipPoint->m_lz_point_data[i] = data->at(i);
                //printf("%d %d\n", v[i], i);
            }

            ok = m_zipper->write(m_zipPoint->m_lz_point);
        }

    }
    catch(...)
    {
        throw liblas_error("Error writing compressed point data (1)");
    }
    if (!ok)
    {
        throw liblas_error("Error writing compressed point data (2)");
    }
    ++m_pointCount;
    m_header->SetPointRecordsCount(m_pointCount);
}
Example #14
0
std::string GetPointString( std::string const& parse_string,
                            std::string const& delimiter,
                            liblas::Point const& p, 
                            boost::array<boost::uint32_t, 4> precisions, 
                            boost::uint32_t index)
{
    
    std::ostringstream output;
    

    output.setf(std::ios_base::fixed, std::ios_base::floatfield);
    

    boost::uint32_t i = 0;
    liblas::Color const& c = p.GetColor();
    for (;;)
    {
        
        switch (parse_string[i])
        {
        /* // the x coordinate */      
        case 'x':
            output.setf(std::ios_base::fixed, std::ios_base::floatfield);
            output.precision(precisions[0]); //x precision
            output << p.GetX();
            // lidardouble2string(printstring, LASPoint_GetX(p)); fprintf(file_out, "%s", printstring);
            break;
        /* // the y coordinate */
        case 'y':
            output.setf(std::ios_base::fixed, std::ios_base::floatfield);
            output.precision(precisions[1]); //y precision
            output << p.GetY();
            break;
        /* // the z coordinate */ 
        case 'z':
            output.setf(std::ios_base::fixed, std::ios_base::floatfield);
            output.precision(precisions[2]); //z precision
            output << p.GetZ();
            break;
        /* // the raw x coordinate */      
        case 'X':
            output << p.GetRawX();
            break;
        /* // the raw y coordinate */
        case 'Y':
            output << p.GetRawY();
            break;
        /* // the raw z coordinate */ 
        case 'Z':
            output << p.GetRawZ();
            break;
        /* // the gps-time */
        case 't': 
            output.setf(std::ios_base::fixed, std::ios_base::floatfield);
            output.precision(precisions[3]); //t precision
            output << p.GetTime();
            break;
        /* // the intensity */
        case 'i':
            output << p.GetIntensity();
            break;
        /* the scan angle */
        case 'a':
            output << p.GetScanAngleRank();
            break;
        /* the number of the return */
        case 'r': 
            output << p.GetReturnNumber();
            break;
        /* the classification */
        case 'c':
            output << static_cast<boost::uint32_t>(p.GetClassification().GetClass());
            break;
        /* the classification name */
        case 'C':
            output << p.GetClassification().GetClassName();
            break;
        /* the user data */
        case 'u': 
            output << p.GetUserData();
            break;
        /* the number of returns of given pulse */
        case 'n':
            output << p.GetNumberOfReturns();
            break;
        /* the red channel color */
        case 'R':
            output << c.GetRed();
            break;            
        /* the green channel color */
        case 'G': 
            output << c.GetGreen();
            break;            
        /* the blue channel color */
        case 'B': 
            output << c.GetBlue();
            break;            
        case 'M':
            output << index;
            break;
        case 'p':
            output << p.GetPointSourceID();
            break;
        /* the edge of flight line flag */
        case 'e': 
            output << p.GetFlightLineEdge();
            break;
        /* the direction of scan flag */
        case 'd': 
            output << p.GetScanDirection();
            break;
        }

        i++;

        if (parse_string[i])
        {
            output << delimiter;
        }
        else
        {
            output << std::endl;
            break;
        }

    }

    
    return output.str();
}