Skip to content

Commit

Permalink
get windows happier
Browse files Browse the repository at this point in the history
  • Loading branch information
hobu committed Sep 26, 2018
1 parent 6e2ba16 commit 1163f7b
Show file tree
Hide file tree
Showing 10 changed files with 124 additions and 52 deletions.
1 change: 1 addition & 0 deletions cmake/examples/hobu-windows.bat
Expand Up @@ -75,6 +75,7 @@ cmake -G %GENERATOR% ^
-DBUILD_PLUGIN_PCL=OFF ^
-DBUILD_PLUGIN_PGPOINTCLOUD=ON ^
-DBUILD_PLUGIN_SQLITE=ON ^
-DBUILD_PLUGIN_I3S=ON ^
-DBUILD_PLUGIN_RIVLIB=OFF ^
-DBUILD_PLUGIN_PYTHON=ON ^
-DENABLE_CTEST=OFF ^
Expand Down
1 change: 1 addition & 0 deletions plugins/i3s/CMakeLists.txt
Expand Up @@ -74,6 +74,7 @@ if (WITH_TESTS)
${slpk_reader_libname}
${i3s_reader_libname}
${PDAL_JSONCPP_LIB_NAME}
${GDAL_LIBRARY}
)
target_include_directories(pdal_io_i3s_reader_test PRIVATE
${PDAL_JSONCPP_INCLUDE_DIR}
Expand Down
18 changes: 9 additions & 9 deletions plugins/i3s/io/EsriReader.cpp
Expand Up @@ -276,8 +276,8 @@ BOX3D EsriReader::parseBox(Json::Value base)
Eigen::Quaterniond rotz = q * quatVecZ * q.inverse();

double minx, miny, minz, maxx, maxy, maxz;
minx = miny = minz = std::numeric_limits<double>::max();
maxx = maxy = maxz = std::numeric_limits<double>::lowest();
minx = miny = minz = (std::numeric_limits<double>::max)();
maxx = maxy = maxz = (std::numeric_limits<double>::lowest)();


for (std::size_t i(0); i < 8; ++i)
Expand All @@ -298,12 +298,12 @@ BOX3D EsriReader::parseBox(Json::Value base)

OCTTransform(m_toNativeTransform, 1, &a, &b, &c);

minx = std::min(minx, a);
miny = std::min(miny, b);
minz = std::min(minz, c);
maxx = std::max(maxx, a);
maxy = std::max(maxy, b);
maxz = std::max(maxz, c);
minx = (std::min)(minx, a);
miny = (std::min)(miny, b);
minz = (std::min)(minz, c);
maxx = (std::max)(maxx, a);
maxy = (std::max)(maxy, b);
maxz = (std::max)(maxz, c);
}
return BOX3D(minx, miny, minz, maxx, maxy, maxz);
}
Expand All @@ -315,7 +315,7 @@ void EsriReader::createView(std::string localUrl, PointView& view)
auto xyzFetch = fetchBinary(geomUrl, "0", ".bin.pccxyz");
std::vector<lepcc::Point3D> xyz = decompressXYZ(&xyzFetch);

std::vector<int> selected;
std::vector<point_count_t> selected;
uint64_t startId;

{
Expand Down
24 changes: 1 addition & 23 deletions plugins/i3s/io/EsriReader.hpp
Expand Up @@ -87,7 +87,7 @@ std::map<std::string, pdal::Dimension::Type> const dimTypes
};
}

class EsriReader : public Reader
class PDAL_DLL EsriReader : public Reader
{
public:
BOX3D createBounds();
Expand Down Expand Up @@ -151,29 +151,7 @@ class EsriReader : public Reader
BOX3D parseBox(Json::Value base);
};

class I3SReader : public EsriReader
{
public:
std::string getName() const override;

protected:
virtual void initInfo() override;
virtual void buildNodeList(std::vector<int>& nodes, int pageIndex) override;
virtual std::vector<char> fetchBinary(std::string url, std::string attNum,
std::string ext) const override;
};

class SlpkReader : public EsriReader
{
public:
std::string getName() const override;

protected:
virtual void initInfo() override;
virtual void buildNodeList(std::vector<int>& nodes, int pageIndex) override;
virtual std::vector<char> fetchBinary(std::string url, std::string attNum,
std::string ext) const override;
};

} // namespace pdal

19 changes: 2 additions & 17 deletions plugins/i3s/io/I3SReader.cpp
Expand Up @@ -32,22 +32,7 @@
* OF SUCH DAMAGE.
****************************************************************************/

#include "EsriReader.hpp"

#include <istream>
#include <cstdint>
#include <cstring>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <vector>
#include <algorithm>
#include <chrono>
#include <pdal/util/FileUtils.hpp>
#include <pdal/util/ProgramArgs.hpp>
#include <pdal/util/Bounds.hpp>
#include <pdal/pdal_features.hpp>
#include <gdal.h>
#include "I3SReader.hpp"

namespace pdal
{
Expand All @@ -68,7 +53,7 @@ namespace pdal
try
{
m_info = parse(m_arbiter->get(m_filename))["layers"][0];
}catch(pdal_error& e)
}catch(pdal_error& )
{
throwError(std::string("Error parsing Json object. "
"This could be due to a bad endpoint."));
Expand Down
52 changes: 52 additions & 0 deletions plugins/i3s/io/I3SReader.hpp
@@ -0,0 +1,52 @@
/******************************************************************************
* Copyright (c) 2018, Kyle Mann (kyle@hobu.co)
*
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following
* conditions are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided
* with the distribution.
* * Neither the name of Hobu, Inc. or Flaxen Geo Consulting nor the
* names of its contributors may be used to endorse or promote
* products derived from this software without specific prior
* written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
* OF SUCH DAMAGE.
****************************************************************************/
#pragma once

#include "EsriReader.hpp"

namespace pdal
{

class PDAL_DLL I3SReader : public EsriReader
{
public:
std::string getName() const override;

protected:
virtual void initInfo() override;
virtual void buildNodeList(std::vector<int>& nodes, int pageIndex) override;
virtual std::vector<char> fetchBinary(std::string url, std::string attNum,
std::string ext) const override;
};
}
3 changes: 2 additions & 1 deletion plugins/i3s/io/SlpkExtractor.cpp
Expand Up @@ -33,6 +33,7 @@
****************************************************************************/

#include <fstream>
#include <algorithm>

#include <pdal/util/IStream.hpp>
#include <pdal/util/FileUtils.hpp>
Expand Down Expand Up @@ -117,7 +118,7 @@ void SlpkExtractor::writeFile(std::string filename, ILeStream& in,
char buf[bufsize];
while (count)
{
size_t size = std::min(bufsize, count);
size_t size = (std::min)(bufsize, count);
in.get(buf, size);
out.write(buf, size);
count -= size;
Expand Down
2 changes: 1 addition & 1 deletion plugins/i3s/io/SlpkReader.cpp
Expand Up @@ -32,7 +32,7 @@
* OF SUCH DAMAGE.
****************************************************************************/

#include "EsriReader.hpp"
#include "SlpkReader.hpp"
#include "../lepcc/src/include/lepcc_c_api.h"
#include "../lepcc/src/include/lepcc_types.h"
#include "pool.hpp"
Expand Down
53 changes: 53 additions & 0 deletions plugins/i3s/io/SlpkReader.hpp
@@ -0,0 +1,53 @@
/******************************************************************************
* Copyright (c) 2018, Kyle Mann (kyle@hobu.co)
*
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following
* conditions are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided
* with the distribution.
* * Neither the name of Hobu, Inc. or Flaxen Geo Consulting nor the
* names of its contributors may be used to endorse or promote
* products derived from this software without specific prior
* written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
* OF SUCH DAMAGE.
****************************************************************************/

#pragma once
#include "EsriReader.hpp"

namespace pdal
{
class PDAL_DLL SlpkReader : public EsriReader
{
public:
std::string getName() const override;

protected:
virtual void initInfo() override;
virtual void buildNodeList(std::vector<int>& nodes, int pageIndex) override;
virtual std::vector<char> fetchBinary(std::string url, std::string attNum,
std::string ext) const override;
};

} // namespace pdal

3 changes: 2 additions & 1 deletion plugins/i3s/test/i3sReaderTest.cpp
Expand Up @@ -9,7 +9,8 @@

#include <io/LasReader.hpp>
#include <io/LasWriter.hpp>
#include "../io/EsriReader.hpp"
#include "../io/I3SReader.hpp"
#include "../io/SlpkReader.hpp"

using namespace pdal;
//test full autzen lidar i3s with bounds that hold the entire data
Expand Down

0 comments on commit 1163f7b

Please sign in to comment.