Skip to content

Commit

Permalink
Merge branch 'point-context' of github.com:PDAL/PDAL into point-context
Browse files Browse the repository at this point in the history
  • Loading branch information
hobu committed Aug 6, 2014
2 parents fc52dec + 8e53f0a commit a861487
Show file tree
Hide file tree
Showing 14 changed files with 72 additions and 70 deletions.
1 change: 1 addition & 0 deletions CMakeLists.txt
Expand Up @@ -164,6 +164,7 @@ if(WIN32)
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
add_definitions(-D_CRT_NONSTDC_NO_WARNING)
add_definitions(-D_SCL_SECURE_NO_WARNINGS)
add_definitions(-DNOMINMAX)
endif()

if(CMAKE_CXX_FLAGS MATCHES "/W[0-4]")
Expand Down
34 changes: 13 additions & 21 deletions cmake/examples/hobu-windows.bat
Expand Up @@ -18,7 +18,8 @@ REM set BUILD_TYPE=Debug
set PDAL_DIR=.

:: Where is your OSGeo4W installed (recommended basic way to satisfy dependent libs)
set OSGEO4W_DIR=C:\OSGeo4W
set OSGEO4W_DIR=C:\OSGeo4W64
set BOOST=c:\boost\1.55

:: Where is boost installed?
REM set PDAL_EMBED_BOOST=ON
Expand Down Expand Up @@ -53,8 +54,8 @@ set LASZIP_LIBRARY=%OSGEO4W_DIR%\lib\laszip.lib
:: Oracle
set ORACLE_ENABLED=ON
set ORACLE_HOME=%OSGEO4W_DIR%
REM set ORACLE_INCLUDE_DIR=%ORACLE_HOME%\include
REM set ORACLE_OCI_LIBRARY=%ORACLE_HOME%\lib\oci.lib
set ORACLE_INCLUDE_DIR=%ORACLE_HOME%\include
set ORACLE_OCI_LIBRARY=%ORACLE_HOME%\lib\oci.lib

:: LibXML2
set LIBXML2_ENABLED=ON
Expand All @@ -72,25 +73,15 @@ REM set PYTHON_EXECUTABLE=%OSGEO4W_DIR\bin\python27.exe
REM set PYTHON_INCLUDE_DIR=%OSGEO4W_DIR\apps\python27\include
REM set PYTHON_LIBRARY=%OSGEO4W_DIR\apps\python27\libs\python27.lib

:: Set this if you are building SWIG bindings for C#. Visual Studio
:: needs to use this env var to find where boost lives.
set PDAL_SWIG_ENABLED=OFF
set PDAL_SWIG_BOOST_HOME=%BOOST_DIR%

:: OpenGL support, for pcview
set FREEGLUT_ENABLED=OFF
:: special config for mpg
if %USERDOMAIN% == T5500 set FREEGLUT_LIBRARY=d:\dev\freeglut-2.6.0-3.mp\lib\freeglut.lib
if %USERDOMAIN% == T5500 set FREEGLUT_INCLUDE_DIR=d:\dev\freeglut-2.6.0-3.mp\include
if %USERDOMAIN% == T5500 set FREEGLUT_ENABLED=ON
if %USERDOMAIN% == PDC set FREEGLUT_LIBRARY=c:\dev\freeglut-2.6.0-3.mp\lib\freeglut.lib
if %USERDOMAIN% == PDC set FREEGLUT_INCLUDE_DIR=c:\dev\freeglut-2.6.0-3.mp\include
if %USERDOMAIN% == PDC set FREEGLUT_ENABLED=ON

rem if EXIST CMakeCache.txt del CMakeCache.txt


if EXIST CMakeCache.txt del CMakeCache.txt
del /S /Q CMakeFiles
cd %PDAL_DIR%/build
cmake -G %GENERATOR% ^
-DBOOST_INCLUDEDIR=%BOOST% ^
-DWITH_GDAL=%GDAL_ENABLED% ^
-DCMAKE_INSTALL_PREFIX=D:\PDAL\package ^
-DCMAKE_INSTALL_PREFIX=c:\dev\PDAL\package ^
-DWITH_GEOTIFF=%GEOTIFF_ENABLED% ^
-DWITH_ORACLE=%ORACLE_ENABLED% ^
-DWITH_PGPOINTCLOUD=ON ^
Expand All @@ -108,7 +99,8 @@ cmake -G %GENERATOR% ^
-DNUMPY_VERSION=1.5.1 ^
-DCMAKE_BUILD_TYPE=%BUILD_TYPE% ^
-DCMAKE_VERBOSE_MAKEFILE=OFF ^
%PDAL_DIR%
-DWITH_SQLITE=ON ^
..

rem -DBOOST_INCLUDEDIR=%BOOST_DIR% ^
rem -DNUMPY_INCLUDE_DIR=%OSGEO4W_DIR%\apps\python27\lib\site-packages\numpy\core\include ^
Expand Down
11 changes: 9 additions & 2 deletions cmake/modules/FindGEOS.cmake
Expand Up @@ -22,12 +22,19 @@ IF(WIN32)
ENDIF (MINGW)

IF (MSVC)
FIND_PATH(GEOS_INCLUDE_DIR geos_c.h $ENV{LIB_DIR}/include $ENV{INCLUDE})
FIND_LIBRARY(GEOS_LIBRARY NAMES geos geos_c_i PATHS
IF(DEFINED ENV{OSGEO4W_ROOT})
SET(OSGEO4W_ROOT_DIR $ENV{OSGEO4W_ROOT})
ELSE()
SET(OSGEO4W_ROOT_DIR c:/OSGeo4W64)
ENDIF()

FIND_PATH(GEOS_INCLUDE_DIR geos_c.h $ENV{LIB_DIR}/include $ENV{INCLUDE} ${OSGEO4W_ROOT_DIR}/include)
FIND_LIBRARY(GEOS_LIBRARY NAMES geos geos_c PATHS
"$ENV{LIB}/lib"
$ENV{LIB}
#mingw
c:/msys/local/lib
${OSGEO4W_ROOT_DIR}/lib
NO_DEFAULT_PATH
)
IF (GEOS_LIBRARY)
Expand Down
42 changes: 15 additions & 27 deletions cmake/modules/FindNitro.cmake
Expand Up @@ -23,19 +23,29 @@ IF(NITRO_INCLUDE_DIR)
SET(NITRO_FIND_QUIETLY TRUE)
ENDIF()

IF(WIN32)
IF(DEFINED ENV{OSGEO4W_ROOT})
SET(OSGEO4W_ROOT_DIR $ENV{OSGEO4W_ROOT})
ELSE()
SET(OSGEO4W_ROOT_DIR c:/OSGeo4W64)
ENDIF()
ENDIF()

FIND_PATH(NITRO_INCLUDE_DIR
nitro
PATHS
/usr/include
/usr/local/include)
/usr/local/include
${OSGEO4W_ROOT_DIR}/include)

SET(NITRO_C_NAME nitf-c)

FIND_LIBRARY(NITRO_C_LIBRARY
NAMES ${NITRO_C_NAME}
PATHS
/usr/lib
/usr/local/lib)
/usr/local/lib
${OSGEO4W_ROOT_DIR}/lib)

SET(NITRO_CPP_NAME nitf-cpp)

Expand All @@ -52,31 +62,9 @@ SET(NITRO_LIBRARIES ${NITRO_CPP_LIBRARY} ${NITRO_C_LIBRARY})
IF(NITRO_INCLUDE_DIR)
SET(NITRO_VERSION 0)

SET(NITRO_VERSION_H "${NITRO_INCLUDE_DIR}/nitro/c/nitf/Defines.h")
FILE(READ ${NITRO_VERSION_H} NITRO_VERSION_H_CONTENTS)
#
# IF (DEFINED NITRO_VERSION_H_CONTENTS)
# # STRING(REGEX REPLACE ".*#define[ \t]LIBGEOTIFF_VERSION[ \t]+([0-9]+).*" "\\1" GEOTIFF_VERSION_NUM "${GEOTIFF_VERSION_H_CONTENTS}")
#
# string(REGEX REPLACE "#define NITF_LIB_VERSION\w([0-9])\\.([0-9]).*" "\\1" NITRO_VERSION "${NITRO_VERSION_H_CONTENTS}")
#
# message(STATUS "NITRO_VERSION: ${NITRO_VERSION}")
# STRING(REGEX REPLACE "([0-9]+)\\.([0-9]+)" "\\1" NITRO_VERSION_MAJOR "${NITRO_VERSION}")
# STRING(REGEX REPLACE "([0-9]+)\\.([0-9]+)" "\\2" NITRO_VERSION_MINOR "${NITRO_VERSION}")
#
#
# SET(NITRO_VERSION "${NITRO_VERSION}"
# CACHE INTERNAL "The version string for Nitro library")
#
# IF (NITRO_VERSION VERSION_EQUAL Nitro_FIND_VERSION OR
# NITRO_VERSION VERSION_GREATER Nitro_FIND_VERSION)
# # MESSAGE(STATUS "Found Nitro version: ${NITRO_VERSION}")
# ELSE()
# MESSAGE(FATAL_ERROR "Nitro version check failed. Version ${NITRO_VERSION} was found, at least version ${Nitro_FIND_VERSION} is required")
# ENDIF()
# ELSE()
# MESSAGE(FATAL_ERROR "Failed to open ${NITRO_VERSION_H} file")
# ENDIF()
# SET(NITRO_VERSION_H "${NITRO_INCLUDE_DIR}/nitro/c/nitf/nitf/Defines.h")
# FILE(READ ${NITRO_VERSION_H} NITRO_VERSION_H_CONTENTS)


ENDIF()

Expand Down
2 changes: 1 addition & 1 deletion cmake/modules/FindPoints2Grid.cmake
Expand Up @@ -31,7 +31,7 @@ IF(WIN32)
SET(OSGEO4W_ROOT_DIR $ENV{OSGEO4W_ROOT})
#MESSAGE(STATUS " FindPoints2Grid: trying OSGeo4W using environment variable OSGEO4W_ROOT=$ENV{OSGEO4W_ROOT}")
ELSE()
SET(OSGEO4W_ROOT_DIR c:/OSGeo4W)
SET(OSGEO4W_ROOT_DIR c:/OSGeo4W64)
#MESSAGE(STATUS " FindPoints2Grid: trying OSGeo4W using default location OSGEO4W_ROOT=${OSGEO4W_ROOT_DIR}")
ENDIF()
ENDIF()
Expand Down
6 changes: 3 additions & 3 deletions include/pdal/Dimension.hpp
Expand Up @@ -199,19 +199,19 @@ class PDAL_DLL Dimension
/// @return should we read this dimension?
bool isRead() const
{
return (m_flags & dimension::IsRead);
return ((m_flags & dimension::IsRead) != 0);
}

/// @return should we write this dimension?
bool isWritten() const
{
return (m_flags & dimension::IsWritten);
return ((m_flags & dimension::IsWritten) != 0);
}

/// @return is this dimension ignored?
bool isIgnored() const
{
return (m_flags & dimension::IsIgnored);
return ((m_flags & dimension::IsIgnored) != 0);
}

/// @return Number of bytes required to serialize this dimension
Expand Down
2 changes: 1 addition & 1 deletion include/pdal/Filter.hpp
Expand Up @@ -73,7 +73,7 @@ class PDAL_DLL Filter : public Stage
pbSet.insert(buffer);
return pbSet;
}
virtual void filter(PointBuffer& buffer)
virtual void filter(PointBuffer& /*buffer*/)
{}
};

Expand Down
26 changes: 19 additions & 7 deletions include/pdal/PointBuffer.hpp
Expand Up @@ -41,6 +41,7 @@
#include <pdal/Schema.hpp>

#include <vector>
#include <set>

namespace pdal
{
Expand Down Expand Up @@ -306,7 +307,7 @@ inline T PointBuffer::getFieldAs(pdal::Dimension const& dim,

try
{
if (std::is_integral<T>::value)
if (std::is_integral<T>::value == true )
retval = boost::numeric_cast<T>(lround(val));
else
retval = boost::numeric_cast<T>(val);
Expand All @@ -328,11 +329,22 @@ void PointBuffer::convertAndSet(pdal::Dimension const& dim, PointId idx,
T_IN in)
{
T_OUT out;

if (std::is_integral<T_OUT>::value)

#ifdef PDAL_COMPILER_MSVC
// warning C4127: conditional expression is constant
#pragma warning(push)
#pragma warning(disable:4127)
#endif
if (std::is_integral<T_OUT>::value == true)
out = boost::numeric_cast<T_OUT>(lround(in));
else
out = boost::numeric_cast<T_OUT>(in);

#ifdef PDAL_COMPILER_MSVC
// warning C4127: conditional expression is constant
#pragma warning(pop)
#endif

setFieldInternal(dim, idx, (void *)&out);
}

Expand Down Expand Up @@ -401,7 +413,7 @@ void PointBuffer::setField(pdal::Dimension const& dim, uint32_t idx, T val)
throw pdal_error("Dimension data type unable to be set.");
}
}
catch (boost::numeric::bad_numeric_cast& e)
catch (boost::numeric::bad_numeric_cast& )
{
std::ostringstream oss;
oss << "Unable to set data and convert as requested: ";
Expand Down Expand Up @@ -449,9 +461,9 @@ inline void PointBuffer::appendPoint(PointBuffer& buffer, PointId id)
// FIXME: hobu -- what happens if id is out of range of m_index
// or m_index isn't ordered?
PointId rawId = buffer.m_index[id];
id = m_index.size();
m_index.resize(id + 1);
m_index[id] = rawId;
point_count_t newid = m_index.size();
m_index.resize(newid + 1);
m_index[newid] = rawId;
}

typedef std::shared_ptr<PointBuffer> PointBufferPtr;
Expand Down
4 changes: 2 additions & 2 deletions include/pdal/Stage.hpp
Expand Up @@ -85,7 +85,7 @@ class PDAL_DLL Stage
bool isDebug() const
{ return m_debug; }
bool isVerbose() const
{ return (bool)m_verbose; }
{ return (m_verbose != 0 ); }
boost::uint32_t getVerboseLevel() const
{ return m_verbose; }
virtual std::string getName() const = 0;
Expand Down Expand Up @@ -141,7 +141,7 @@ class PDAL_DLL Stage
Stage(const Stage&); // not implemented
void Construct();
void l_processOptions(const Options& options);
virtual void processOptions(const Options& options)
virtual void processOptions(const Options& /*options*/)
{}
void l_initialize(PointContext ctx);
void l_done(PointContext ctx);
Expand Down
4 changes: 2 additions & 2 deletions include/pdal/StageIterator.hpp
Expand Up @@ -160,7 +160,7 @@ class PDAL_DLL StageSequentialIterator : public StageIterator

protected:
// from Iterator
virtual point_count_t readImpl(PointBuffer& data, point_count_t count)
virtual point_count_t readImpl(PointBuffer& /*data*/, point_count_t /*count*/)
{ std::cerr << "No sequential readImpl for stage/iterator!\n"; return 0; }
virtual boost::uint32_t readBufferImpl(PointBuffer&) = 0;
virtual bool atEndImpl() const = 0;
Expand All @@ -185,7 +185,7 @@ class PDAL_DLL StageRandomIterator : public StageIterator

protected:
// from Iterator
virtual point_count_t readImpl(PointBuffer& data, point_count_t count)
virtual point_count_t readImpl(PointBuffer& /*data*/, point_count_t /*count*/)
{ std::cerr << "No random readImpl for stage/iterator!\n"; return 0; }
virtual boost::uint64_t seekImpl(boost::uint64_t position) = 0;
virtual boost::uint64_t skipImpl(boost::uint64_t position);
Expand Down
4 changes: 2 additions & 2 deletions include/pdal/drivers/oci/common.hpp
Expand Up @@ -146,8 +146,8 @@ class Block
};
typedef std::shared_ptr<Block> BlockPtr;

Connection connect(std::string connSpec);
Schema fetchSchema(Statement stmt, BlockPtr block);
PDAL_DLL Connection connect(std::string connSpec);
PDAL_DLL Schema fetchSchema(Statement stmt, BlockPtr block);

} // namespace oci
} // namespace drivers
Expand Down
2 changes: 1 addition & 1 deletion include/pdal/drivers/sbet/Common.hpp
Expand Up @@ -45,7 +45,7 @@ namespace drivers
namespace sbet
{

std::vector<Dimension> fileDimensions(const std::string& stageName);
PDAL_DLL std::vector<Dimension> fileDimensions(const std::string& stageName);

} // namespace sbet
} // namespace drivers
Expand Down
3 changes: 2 additions & 1 deletion include/pdal/pdal_types.hpp
Expand Up @@ -35,14 +35,15 @@
#pragma once

#include <stdint.h>
#include <vector>

#include <pdal/pdal_internal.hpp>

namespace pdal
{

typedef uint32_t point_count_t;
typedef uint32_t PointId;
typedef std::vector<PointId>::size_type point_count_t;

enum LogLevel
{
Expand Down
1 change: 1 addition & 0 deletions src/Schema.cpp
Expand Up @@ -44,6 +44,7 @@

#include <iostream>
#include <map>
#include <algorithm>

#include <boost/lexical_cast.hpp>
#include <boost/property_tree/json_parser.hpp>
Expand Down

0 comments on commit a861487

Please sign in to comment.