Пример #1
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();
}
Пример #2
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();
}
Пример #3
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());
}
Пример #4
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);
}
Пример #5
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);
}
Пример #6
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);
}
Пример #7
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();
}