Skip to content

Commit

Permalink
Entwine Point Tile (#98)
Browse files Browse the repository at this point in the history
  • Loading branch information
connormanning authored Jul 3, 2018
1 parent facd525 commit 1b641b1
Show file tree
Hide file tree
Showing 204 changed files with 7,630 additions and 14,376 deletions.
11 changes: 0 additions & 11 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,7 @@ build/*
dev/*

test/data/*
!test/data/generate
!test/data/CMakeLists.txt
!test/data/generate-ellipsoid.cpp

*.vcxproj
*.vcxproj.filters
*.sln

# Visual Studio 2015/2017 cache/options directory
.vs/

# Visual C++ cache files
ipch/

CMakeSettings.json
13 changes: 6 additions & 7 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,17 @@ services: docker
compiler:
- g++
- clang
before_install: "./scripts/ci/before_install.sh"
script: docker run -v $TRAVIS_BUILD_DIR:/entwine -t --entrypoint /bin/sh connormanning/entwine -c "/entwine/scripts/ci/build.sh"
script: docker run -v $TRAVIS_BUILD_DIR:/entwine -t --entrypoint /bin/sh connormanning/entwine:ept -c "/entwine/scripts/ci/build.sh"
after_success:
- echo "secure travis:" "$TRAVIS_SECURE_ENV_VARS"
#- echo "secure travis:" "$TRAVIS_SECURE_ENV_VARS"
# Update the TRAVIS_BRANCH value as necessary to force the build/deploy of the website
# if both CXX==g++ and TRAVIS_BRANCH==value
- sh -c 'if test "$TRAVIS_SECURE_ENV_VARS" = "true" -a "$CXX" = "g++"; then echo "publish website"; ./scripts/ci/build_docs.sh; ./scripts/ci/deploy_website.sh
$TRAVIS_BUILD_DIR/doc/build; fi'
#- sh -c 'if test "$TRAVIS_SECURE_ENV_VARS" = "true" -a "$CXX" = "g++"; then echo "publish website"; ./scripts/ci/build_docs.sh; ./scripts/ci/deploy_website.sh
#$TRAVIS_BUILD_DIR/doc/build; fi'
notifications:
email: false
on_success: always
on_failure: always
on_success: change
on_failure: change
slack:
secure: qAzPWkpLugFrGFDLQzoYnrziR8RS+24ILcwuXJha2blTqBi5/TdbfafnUMlaBwvaIxDiz0je4LOjTT7tJ7HYfJRW6YnXDPJ4uy1vHwxtVCEmIU+JoWvkTwWffAH0j49davyHlNwUh0ogM3iL5GU15oQCHMpZnElaEw1QntF/liYyIswYdlg1kTjhqwaPt9Q1nw46Yfb+i9iCFrARQ+gdOOSLZ6ZjJYYP9dNH+Z0qWQBDT33Trmh8W8V7flzCKLHdWH2dBJ3RxG1QMe3Gljxkc0OOub+o5ziZyGCGf8ILk9cIGjysgXd8j6WpU5mJzj4DKc2hgRUiHHepOFwlwOIO+NBBWa4tqSm+7WFGya5jDvIZj4fJNwUPuU3i7T9lUlYIMVMmGAiDB8VfM3iRuQwY2rcToNXvYFrVRveMImSkOOtCyN6BHMm925jyqk99/pcjasjADSWuSNLaD7sXuZB+qgay7ddJ3jjG231INvu6M/qO7SWOKSG20Gh2F+mbWqzAkC5nAo5eHYapk5uFpmD51kUcXN59mWaaBmuoOckxPwEEgmjANpoO9SjWPsPTfindMySUrqD8M7+M9bUB0o31PIvP8p4D3lTI262PBrJQX3wwgQacaP/lB35DAo/58jnKGJXV3yydarysFWO35urAdT5tFL9JftIF1diEj7aqSPI=
env:
Expand Down
30 changes: 7 additions & 23 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ cmake_minimum_required(VERSION 2.8.8)
project(entwine)
set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/modules" ${CMAKE_MODULE_PATH})

set(ENTWINE_VERSION_MAJOR 1 CACHE STRING "Entwine major version" FORCE)
set(ENTWINE_VERSION_MINOR 1 CACHE STRING "Entwine minor version" FORCE)
set(ENTWINE_VERSION_MAJOR 2 CACHE STRING "Entwine major version" FORCE)
set(ENTWINE_VERSION_MINOR 0 CACHE STRING "Entwine minor version" FORCE)
set(ENTWINE_VERSION_PATCH 0 CACHE STRING "Entwine patch version" FORCE)
set(ENTWINE_VERSION_STRING
"${ENTWINE_VERSION_MAJOR}.${ENTWINE_VERSION_MINOR}.${ENTWINE_VERSION_PATCH}"
Expand Down Expand Up @@ -123,14 +123,15 @@ endif()
include_directories(BEFORE "${CMAKE_CURRENT_SOURCE_DIR}")

add_subdirectory(entwine)
add_subdirectory(kernel)
add_subdirectory(app)

set(OBJS
$<TARGET_OBJECTS:formats>
$<TARGET_OBJECTS:reader>
$<TARGET_OBJECTS:chunk-storage>
# $<TARGET_OBJECTS:reader>
$<TARGET_OBJECTS:new-reader>
$<TARGET_OBJECTS:io>
$<TARGET_OBJECTS:third>
$<TARGET_OBJECTS:tree>
$<TARGET_OBJECTS:builder>
$<TARGET_OBJECTS:types>
$<TARGET_OBJECTS:util>
)
Expand All @@ -142,22 +143,10 @@ else()
add_library(entwine SHARED ${OBJS})
endif()

if (MSVC)
find_library(LZMA_LIBRARY liblzma PATHS "${CMAKE_INSTALL_PREFIX}/lib")
target_include_directories(util PRIVATE ${LIBLZMA_INCLUDE_DIR})
else()
target_link_libraries(entwine lzma)
endif()

target_link_libraries(entwine PUBLIC pdalcpp pdal_util ${LZMA_LIBRARY} ${CMAKE_DL_LIBS})

target_link_libraries(entwine ${JSON_CPP_LINK_TYPE} ${ENTWINE_JSONCPP_LIB_NAME})

if (${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU")
target_link_libraries(entwine atomic)
endif()


target_link_libraries(entwine PRIVATE ${CURL_LIBRARIES})
target_include_directories(entwine PRIVATE "${CURL_INCLUDE_DIR}")

Expand Down Expand Up @@ -190,15 +179,10 @@ install(
FILES "${PROJECT_BINARY_DIR}/entwine-config.cmake"
DESTINATION lib/cmake/entwine)

add_subdirectory(test/data)

add_subdirectory(test/gtest-1.8.0)
include_directories(entwine test/gtest-1.8.0/include test/gtest-1.8.0)

add_subdirectory(test)



include("${CMAKE_CURRENT_SOURCE_DIR}/cmake/cpack.cmake")
add_custom_target(dist COMMAND ${CMAKE_MAKE_PROGRAM} package_source)

34 changes: 0 additions & 34 deletions README.md

This file was deleted.

19 changes: 19 additions & 0 deletions app/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
set(BASE "${CMAKE_CURRENT_SOURCE_DIR}")

set(
SOURCES
"${BASE}/build.cpp"
"${BASE}/convert.cpp"
"${BASE}/entwine.cpp"
"${BASE}/merge.cpp"
"${BASE}/scan.cpp"
)

add_executable(app ${SOURCES})
add_dependencies(app entwine)

target_link_libraries(app entwine ${Backtrace_LIBRARIES})
set_target_properties(app PROPERTIES OUTPUT_NAME entwine)

install(TARGETS app DESTINATION bin)

199 changes: 199 additions & 0 deletions app/arg-parser.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,199 @@
/******************************************************************************
* Copyright (c) 2018, Connor Manning ([email protected])
*
* Entwine -- Point cloud indexing
*
* Entwine is available under the terms of the LGPL2 license. See COPYING
* for specific license text and more information.
*
******************************************************************************/

#pragma once

#include <functional>
#include <string>
#include <vector>

#include <json/json.h>

#include <entwine/util/json.hpp>

using Args = std::vector<std::string>;
using Handler = std::function<void(Json::Value)>;

class ArgParser
{
public:
void setUsage(std::string usage)
{
m_usage = usage;
}

void logUsage() const
{
std::cout << "\nUsage: " << m_usage << "\n" << std::endl;
for (const std::string d : m_descriptions)
{
std::cout << d << std::endl;
}
}

bool handle(Args args) const
{
if (args.empty())
{
logUsage();
return false;
}
if (args.size() == 1)
{
const auto arg(args.front());
if (arg == "help" || arg == "--help" || arg == "-h")
{
logUsage();
return false;
}
}

uint64_t i(0);
while (i < args.size())
{
std::string flag = args.at(i);

if (!i && flag.front() != '-')
{
flag = "";
--i;
}

if (!m_handlers.count(flag))
{
throw std::runtime_error("Invalid argument: " + flag);
}

Json::Value val;
while (++i < args.size() && args.at(i).front() != '-')
{
val.append(args.at(i));
}

if (!val.isNull() && val.size() == 1) val = val[0];

try
{
m_handlers.at(flag)(val);
}
catch (std::exception& e)
{
std::string valString(entwine::toFastString(val));
valString.pop_back();

throw std::runtime_error(
"Error handling argument '" + flag + "' with value " +
valString + ": " + e.what());
}
}

return true;
}

void addDescription(std::string a, std::string description)
{
m_descriptions.push_back(
tab(1) + a + "\n" + buildDescription(description));
}

void addDescription(std::string a, std::string b, std::string description)
{
m_descriptions.push_back(
tab(1) + a + ", " + b + "\n" + buildDescription(description));
}

void add(std::string flag, std::string description, Handler h)
{
m_handlers[flag] = h;
addDescription(flag, description);
}

void add(std::string a, std::string b, std::string description, Handler h)
{
m_handlers[a] = h;
m_handlers[b] = h;
addDescription(a, b, description);
}

void addDefault(
std::string a,
std::string b,
std::string description,
Handler h)
{
add(a, b, description, h);
m_handlers[""] = h;
}

private:
std::string tab(uint64_t n) const { return std::string(n * 4, ' '); }

std::vector<std::string> split(std::string in, char delim) const
{
std::vector<std::string> tokens;
std::size_t pos(0);
while (pos != std::string::npos)
{
std::size_t end(in.find_first_of(delim, pos));

if (end == std::string::npos)
{
tokens.push_back(in.substr(pos));
pos = end;
}
else
{
tokens.push_back(in.substr(pos, end - pos));
pos = end + 1;
if (pos >= in.size()) pos = std::string::npos;
}
}
return tokens;
}

std::string buildDescription(std::string in) const
{
std::string out;
std::vector<std::string> lines(split(in, '\n'));
for (const auto line : lines) out += formatLine(line) + '\n';
return out;
}

std::string formatLine(std::string in) const
{
std::vector<std::string> words(split(in, ' '));
const auto pre(tab(2));

std::string out;
std::string line;
for (std::size_t i(0); i < words.size(); ++i)
{
const auto word(words[i]);

if (line.size() + word.size() > 80)
{
out += line + '\n';
line.clear();
}

line += (line.empty() ? pre : " ") + word;
}

if (line.size()) out += line;
out += '\n';

return out;
}

std::string m_usage;
std::map<std::string, Handler> m_handlers;
std::vector<std::string> m_descriptions;
};

Loading

0 comments on commit 1b641b1

Please sign in to comment.