Exemple #1
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);
}
Exemple #2
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);
}
Exemple #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());
}
Exemple #4
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();
}