[Liblas-commits] hg: 6 new changesets
liblas-commits at liblas.org
liblas-commits at liblas.org
Mon Nov 15 13:16:07 EST 2010
changeset f83aa09efe85 in /Volumes/Data/www/liblas.org/hg
details: http://hg.liblas.orghg?cmd=changeset;node=f83aa09efe85
summary: Tweak/cast to silence precision loss warnings
changeset fbb23d8a3a96 in /Volumes/Data/www/liblas.org/hg
details: http://hg.liblas.orghg?cmd=changeset;node=fbb23d8a3a96
summary: Use boost:: namespace for stdint types
changeset 2b11c822d283 in /Volumes/Data/www/liblas.org/hg
details: http://hg.liblas.orghg?cmd=changeset;node=2b11c822d283
summary: copy the C++ DLL too
changeset 74ef0eb47f86 in /Volumes/Data/www/liblas.org/hg
details: http://hg.liblas.orghg?cmd=changeset;node=74ef0eb47f86
summary: define LAS_DLL exports so we can use these in libs
changeset 6e4b7c52f3ee in /Volumes/Data/www/liblas.org/hg
details: http://hg.liblas.orghg?cmd=changeset;node=6e4b7c52f3ee
summary: put a copy of OpenInput in here for las2oci
changeset a3ebc4007bb9 in /Volumes/Data/www/liblas.org/hg
details: http://hg.liblas.orghg?cmd=changeset;node=a3ebc4007bb9
summary: merge
diffstat:
apps/chipper.cpp | 56 ++++++++++++++++++++++-----------
apps/chipper.hpp | 12 ++++---
apps/laskernel.cpp | 4 +-
apps/laskernel.hpp | 41 ++++++++++++------------
apps/oci_util.cpp | 24 ++++++++++++++
apps/oci_util.hpp | 24 +++++++-------
cmake/modules/BuildOSGeo4W.cmake | 1 +
include/liblas/lasspatialreference.hpp | 8 +++-
8 files changed, 109 insertions(+), 61 deletions(-)
diffs (truncated from 366 to 300 lines):
diff -r 1453239751b8 -r a3ebc4007bb9 apps/chipper.cpp
--- a/apps/chipper.cpp Thu Nov 11 15:14:03 2010 -0600
+++ b/apps/chipper.cpp Mon Nov 15 12:15:52 2010 -0600
@@ -136,17 +136,17 @@
void Chipper::Partition(uint32_t size)
{
- uint32_t num_partitions;
+ boost::uint32_t num_partitions;
num_partitions = size / m_threshold;
if ( size % m_threshold )
num_partitions++;
double total = 0;
- double partition_size = (double)size / num_partitions;
+ double partition_size = static_cast<double>(size) / num_partitions;
m_partitions.push_back(0);
- for (uint32_t i = 0; i < num_partitions; ++i) {
+ for (boost::uint32_t i = 0; i < num_partitions; ++i) {
total += partition_size;
- m_partitions.push_back((uint32_t)detail::sround(total));
+ m_partitions.push_back(static_cast<uint32_t>(detail::sround(total)));
}
}
@@ -200,7 +200,7 @@
// for the [left,right] partition.
lstart = left;
rstart = center;
- for (int64_t i = left; i <= right; ++i)
+ for (uint32_t i = left; i <= right; ++i)
{
if (narrow[i].m_oindex < center)
{
@@ -232,25 +232,32 @@
void Chipper::FinalSplit(RefList& wide, RefList& narrow,
uint32_t pleft, uint32_t pright)
{
- long left1 = -1;
- long left2 = -1;
- long right1 = -1;
- long right2 = -1;
+
+ boost::int64_t left1 = -1;
+ boost::int64_t left2 = -1;
+ boost::int64_t right1 = -1;
+ boost::int64_t right2 = -1;
- uint32_t left = m_partitions[pleft];
- uint32_t right = m_partitions[pright] - 1;
- uint32_t center = m_partitions[pright - 1];
+ // It appears we're using int64_t here because we're using -1 as
+ // an indicator. I'm not 100% sure that i ends up <0, but I don't
+ // think so. These casts will at least shut up the compiler, but
+ // I think this code should be revisited to use std::vector<boost::uint32_t>::const_iterator
+ // or std::vector<boost::uint32_t>::size_type instead of this int64_t stuff -- hobu 11/15/10
+ boost::int64_t left = static_cast<boost::int64_t>(m_partitions[pleft]);
+ boost::int64_t right = static_cast<boost::int64_t>(m_partitions[pright] - 1);
+ boost::int64_t center = static_cast<boost::int64_t>(m_partitions[pright - 1]);
// Find left values for the partitions.
for (int64_t i = left; i <= right; ++i)
- {
- if (left1 < 0 && (narrow[i].m_oindex < center))
+ {
+ boost::int64_t idx = static_cast<boost::int64_t>(narrow[static_cast<boost::uint32_t>(i)].m_oindex);
+ if (left1 < 0 && (idx < center))
{
left1 = i;
if (left2 >= 0)
break;
}
- else if (left2 < 0 && (narrow[i].m_oindex >= center))
+ else if (left2 < 0 && (idx >= center))
{
left2 = i;
if (left1 >= 0)
@@ -260,13 +267,14 @@
// Find right values for the partitions.
for (int64_t i = right; i >= left; --i)
{
- if (right1 < 0 && (narrow[i].m_oindex < center))
+ boost::int64_t idx = static_cast<boost::int64_t>(narrow[static_cast<boost::uint32_t>(i)].m_oindex);
+ if (right1 < 0 && (idx < center))
{
right1 = i;
if (right2 >= 0)
break;
}
- else if (right2 < 0 && (narrow[i].m_oindex >= center))
+ else if (right2 < 0 && (idx >= center))
{
right2 = i;
if (right1 >= 0)
@@ -275,8 +283,18 @@
}
// Emit results.
- Emit(wide, left, center - 1, narrow, left1, right1 );
- Emit(wide, center, right, narrow, left2, right2 );
+ Emit(wide,
+ static_cast<boost::uint32_t>(left),
+ static_cast<boost::uint32_t>(center - 1),
+ narrow,
+ static_cast<boost::uint32_t>(left1),
+ static_cast<boost::uint32_t>(right1) );
+ Emit(wide,
+ static_cast<boost::uint32_t>(center),
+ static_cast<boost::uint32_t>(right),
+ narrow,
+ static_cast<boost::uint32_t>(left2),
+ static_cast<boost::uint32_t>(right2) );
}
void Chipper::Emit(RefList& wide, uint32_t widemin, uint32_t widemax,
diff -r 1453239751b8 -r a3ebc4007bb9 apps/chipper.hpp
--- a/apps/chipper.hpp Thu Nov 11 15:14:03 2010 -0600
+++ b/apps/chipper.hpp Mon Nov 15 12:15:52 2010 -0600
@@ -2,6 +2,8 @@
#define LIBLAS_CHIPPER_H
#include <liblas/liblas.hpp>
+#include <liblas/export.hpp>
+
#include <vector>
namespace liblas
@@ -17,7 +19,7 @@
DIR_NONE
};
-class PtRef
+class LAS_DLL PtRef
{
public:
double m_pos;
@@ -28,7 +30,7 @@
{ return m_pos < pt.m_pos; }
};
-struct RefList
+struct LAS_DLL RefList
{
public:
std::vector<PtRef> m_vec;
@@ -61,9 +63,9 @@
}
};
-class Chipper;
+class LAS_DLL Chipper;
-class Block
+class LAS_DLL Block
{
friend class Chipper;
@@ -91,7 +93,7 @@
// { return m_ymax; }
};
-class Chipper
+class LAS_DLL Chipper
{
public:
Chipper(Reader *reader, boost::uint32_t max_partition_size) :
diff -r 1453239751b8 -r a3ebc4007bb9 apps/laskernel.cpp
--- a/apps/laskernel.cpp Thu Nov 11 15:14:03 2010 -0600
+++ b/apps/laskernel.cpp Mon Nov 15 12:15:52 2010 -0600
@@ -1264,12 +1264,12 @@
{
// make a displayable string for the bands list
std::ostringstream bnds;
- for (std::vector<uint32_t>::const_iterator i = bands.begin();
+ for (std::vector<boost::uint32_t>::const_iterator i = bands.begin();
i != bands.end();
i++)
{
bnds << *i;
- std::vector<uint32_t>::const_iterator i2 = i+1;
+ std::vector<boost::uint32_t>::const_iterator i2 = i+1;
if (i2 != bands.end())
bnds << ", ";
}
diff -r 1453239751b8 -r a3ebc4007bb9 apps/laskernel.hpp
--- a/apps/laskernel.hpp Thu Nov 11 15:14:03 2010 -0600
+++ b/apps/laskernel.hpp Mon Nov 15 12:15:52 2010 -0600
@@ -44,6 +44,7 @@
#include <liblas/liblas.hpp>
#include <liblas/utility.hpp>
+#include <liblas/export.hpp>
#include <liblas/external/property_tree/ptree.hpp>
#include <liblas/external/property_tree/xml_parser.hpp>
@@ -68,23 +69,23 @@
#define SEPARATORS ",| "
typedef boost::tokenizer<boost::char_separator<char> > tokenizer;
-bool IsDualRangeFilter(std::string parse_string) ;
+LAS_DLL bool IsDualRangeFilter(std::string parse_string) ;
-liblas::FilterPtr MakeReturnFilter(std::vector<boost::uint16_t> const& returns, liblas::FilterI::FilterType ftype) ;
-liblas::FilterPtr MakeClassFilter(std::vector<liblas::Classification> const& classes, liblas::FilterI::FilterType ftype) ;
-liblas::FilterPtr MakeBoundsFilter(liblas::Bounds<double> const& bounds, liblas::FilterI::FilterType ftype) ;
-liblas::FilterPtr MakeIntensityFilter(std::string intensities, liblas::FilterI::FilterType ftype) ;
-liblas::FilterPtr MakeTimeFilter(std::string times, liblas::FilterI::FilterType ftype) ;
-liblas::FilterPtr MakeScanAngleFilter(std::string intensities, liblas::FilterI::FilterType ftype) ;
-liblas::FilterPtr MakeColorFilter(liblas::Color const& low, liblas::Color const& high, liblas::FilterI::FilterType ftype);
+LAS_DLL liblas::FilterPtr MakeReturnFilter(std::vector<boost::uint16_t> const& returns, liblas::FilterI::FilterType ftype) ;
+LAS_DLL liblas::FilterPtr MakeClassFilter(std::vector<liblas::Classification> const& classes, liblas::FilterI::FilterType ftype) ;
+LAS_DLL liblas::FilterPtr MakeBoundsFilter(liblas::Bounds<double> const& bounds, liblas::FilterI::FilterType ftype) ;
+LAS_DLL liblas::FilterPtr MakeIntensityFilter(std::string intensities, liblas::FilterI::FilterType ftype) ;
+LAS_DLL liblas::FilterPtr MakeTimeFilter(std::string times, liblas::FilterI::FilterType ftype) ;
+LAS_DLL liblas::FilterPtr MakeScanAngleFilter(std::string intensities, liblas::FilterI::FilterType ftype) ;
+LAS_DLL liblas::FilterPtr MakeColorFilter(liblas::Color const& low, liblas::Color const& high, liblas::FilterI::FilterType ftype);
-po::options_description GetFilteringOptions();
-po::options_description GetTransformationOptions();
-po::options_description GetHeaderOptions();
+LAS_DLL po::options_description GetFilteringOptions();
+LAS_DLL po::options_description GetTransformationOptions();
+LAS_DLL po::options_description GetHeaderOptions();
-std::vector<liblas::FilterPtr> GetFilters(po::variables_map vm, bool verbose);
-std::vector<liblas::TransformPtr> GetTransforms(po::variables_map vm, bool verbose, liblas::Header& header);
+LAS_DLL std::vector<liblas::FilterPtr> GetFilters(po::variables_map vm, bool verbose);
+LAS_DLL std::vector<liblas::TransformPtr> GetTransforms(po::variables_map vm, bool verbose, liblas::Header& header);
#ifdef _WIN32
#define compare_no_case(a,b,n) _strnicmp( (a), (b), (n) )
@@ -93,13 +94,13 @@
#endif
// std::istream* OpenInput(std::string const& filename, bool bEnd);
-std::string TryReadFileData(std::string const& filename);
-std::vector<char> TryReadRawFileData(std::string const& filename);
-bool term_progress(std::ostream& os, double complete);
-void SetStreamPrecision(std::ostream& os, double scale);
+LAS_DLL std::string TryReadFileData(std::string const& filename);
+LAS_DLL std::vector<char> TryReadRawFileData(std::string const& filename);
+LAS_DLL bool term_progress(std::ostream& os, double complete);
+LAS_DLL void SetStreamPrecision(std::ostream& os, double scale);
-liblas::Header FetchHeader(std::string const& filename);
-void RewriteHeader(liblas::Header const& header, std::string const& filename);
-void RepairHeader(liblas::Summary const& summary, liblas::Header& header);
+LAS_DLL liblas::Header FetchHeader(std::string const& filename);
+LAS_DLL void RewriteHeader(liblas::Header const& header, std::string const& filename);
+LAS_DLL void RepairHeader(liblas::Summary const& summary, liblas::Header& header);
#endif // LIBLAS_ITERATOR_HPP_INCLUDED
diff -r 1453239751b8 -r a3ebc4007bb9 apps/oci_util.cpp
--- a/apps/oci_util.cpp Thu Nov 11 15:14:03 2010 -0600
+++ b/apps/oci_util.cpp Mon Nov 15 12:15:52 2010 -0600
@@ -1,6 +1,30 @@
#include "oci_util.hpp"
+std::istream* OpenInput(std::string const& filename, bool bEnd)
+{
+ std::ios::openmode mode = std::ios::in | std::ios::binary;
+ if (bEnd == true) {
+ mode = mode | std::ios::ate;
+ }
+ std::istream* istrm;
+ if (compare_no_case(filename.c_str(),"STDIN",5) == 0)
+ {
+ istrm = &std::cin;
+ }
+ else
+ {
+ istrm = new std::ifstream(filename.c_str(), mode);
+ }
+
+ if (!istrm->good())
+ {
+ delete istrm;
+ throw std::runtime_error("Reading stream was not able to be created");
+ }
+ return istrm;
+}
+
std::string ReadSQLData(std::string filename)
{
std::istream* infile = OpenInput(filename.c_str(), true);
diff -r 1453239751b8 -r a3ebc4007bb9 apps/oci_util.hpp
--- a/apps/oci_util.hpp Thu Nov 11 15:14:03 2010 -0600
+++ b/apps/oci_util.hpp Mon Nov 15 12:15:52 2010 -0600
@@ -3,7 +3,7 @@
#include "oci_wrapper.h"
-
+#include <liblas/export.hpp>
#include <fstream>
#include <string>
@@ -16,24 +16,24 @@
More information about the Liblas-commits
mailing list