예제 #1
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()));
    }
예제 #2
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();
}
예제 #3
0
파일: common.cpp 프로젝트: Airphrame/libLAS
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);
}
예제 #4
0
파일: common.cpp 프로젝트: Airphrame/libLAS
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);
}
예제 #5
0
파일: common.cpp 프로젝트: Airphrame/libLAS
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());
}
예제 #6
0
파일: common.cpp 프로젝트: Airphrame/libLAS
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);
}
예제 #7
0
파일: common.cpp 프로젝트: Airphrame/libLAS
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);
}
예제 #8
0
파일: common.cpp 프로젝트: Airphrame/libLAS
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);
}
예제 #9
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();
}