Commit 2601b482 authored by Valentin Platzgummer's avatar Valentin Platzgummer

SnakeWorker added

parent 5ac59ffd
......@@ -92,11 +92,6 @@ exists($$MAVLINKPATH/common) {
INCLUDEPATH += libs/eigen
DEFINES += NOMINMAX
#
# [REQUIRED] snake library (Wima)
INCLUDEPATH += libs/snake
INCLUDEPATH += libs/or-tools/include
#
# [REQUIRED] shapelib library
INCLUDEPATH += libs/shapelib
......@@ -200,3 +195,13 @@ contains (DEFINES, DISABLE_AIRMAP) {
$${AIRMAPD_PATH}/include
}
}
# GeograpicLib (TODO: add Windows support!)
LinuxBuild {
LIBS += -L/usr/local/lib -lGeographic # libGeograpic.so
}
# google or-tools (TODO: add Windows support!)
LinuxBuild {
LIBS += -L/usr/local/lib -lortools # libortools.so
}
cmake_minimum_required(VERSION 3.14)
project(polyclipping)
add_library(polyclipping
STATIC
clipper.cpp)
target_include_directories(polyclipping PUBLIC include)
This diff is collapsed.
# This file is used to ignore files which are generated
# ----------------------------------------------------------------------------
*~
*.autosave
*.a
*.core
*.moc
*.o
*.obj
*.orig
*.rej
*.so
*.so.*
*_pch.h.cpp
*_resource.rc
*.qm
.#*
*.*#
core
!core/
tags
.DS_Store
.directory
*.debug
Makefile*
*.prl
*.app
moc_*.cpp
ui_*.h
qrc_*.cpp
Thumbs.db
*.res
*.rc
/.qmake.cache
/.qmake.stash
# qtcreator generated files
*.pro.user*
# xemacs temporary files
*.flc
# Vim temporary files
.*.swp
# Visual Studio generated files
*.ib_pdb_index
*.idb
*.ilk
*.pdb
*.sln
*.suo
*.vcproj
*vcproj.*.*.user
*.ncb
*.sdf
*.opensdf
*.vcxproj
*vcxproj.*
# MinGW generated files
*.Debug
*.Release
# Python byte code
*.pyc
# Binaries
# --------
*.dll
*.exe
CONFIG -= qt
TEMPLATE = lib
DEFINES += CLIPPER_LIBRARY
CONFIG += c++11
# The following define makes your compiler emit warnings if you use
# any Qt feature that has been marked deprecated (the exact warnings
# depend on your compiler). Please consult the documentation of the
# deprecated API in order to know how to port your code away from it.
DEFINES += QT_DEPRECATED_WARNINGS
# You can also make your code fail to compile if it uses deprecated APIs.
# In order to do so, uncomment the following line.
# You can also select to disable deprecated APIs only up to a certain version of Qt.
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
SOURCES += \
clipper.cpp
HEADERS += \
clipper.hpp \
clipper_global.h
# Default rules for deployment.
unix {
target.path = /usr/lib
}
!isEmpty(target.path): INSTALLS += target
#ifndef CLIPPER_GLOBAL_H
#define CLIPPER_GLOBAL_H
#if defined(_MSC_VER) || defined(WIN64) || defined(_WIN64) || defined(__WIN64__) || defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__NT__)
# define Q_DECL_EXPORT __declspec(dllexport)
# define Q_DECL_IMPORT __declspec(dllimport)
#else
# define Q_DECL_EXPORT __attribute__((visibility("default")))
# define Q_DECL_IMPORT __attribute__((visibility("default")))
#endif
#if defined(CLIPPER_LIBRARY)
# define CLIPPER_EXPORT Q_DECL_EXPORT
#else
# define CLIPPER_EXPORT Q_DECL_IMPORT
#endif
#endif // CLIPPER_GLOBAL_H
# Install script for directory: /home/valentin/Desktop/drones/qgroundcontrol/libs/clipper
# Set the install prefix
if(NOT DEFINED CMAKE_INSTALL_PREFIX)
set(CMAKE_INSTALL_PREFIX "/usr/local")
endif()
string(REGEX REPLACE "/$" "" CMAKE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}")
# Set the install configuration name.
if(NOT DEFINED CMAKE_INSTALL_CONFIG_NAME)
if(BUILD_TYPE)
string(REGEX REPLACE "^[^A-Za-z0-9_]+" ""
CMAKE_INSTALL_CONFIG_NAME "${BUILD_TYPE}")
else()
set(CMAKE_INSTALL_CONFIG_NAME "RelWithDebInfo")
endif()
message(STATUS "Install configuration: \"${CMAKE_INSTALL_CONFIG_NAME}\"")
endif()
# Set the component getting installed.
if(NOT CMAKE_INSTALL_COMPONENT)
if(COMPONENT)
message(STATUS "Install component: \"${COMPONENT}\"")
set(CMAKE_INSTALL_COMPONENT "${COMPONENT}")
else()
set(CMAKE_INSTALL_COMPONENT)
endif()
endif()
# Install shared libraries without execute permission?
if(NOT DEFINED CMAKE_INSTALL_SO_NO_EXE)
set(CMAKE_INSTALL_SO_NO_EXE "1")
endif()
# Is this installation the result of a crosscompile?
if(NOT DEFINED CMAKE_CROSSCOMPILING)
set(CMAKE_CROSSCOMPILING "FALSE")
endif()
# Set default install directory permissions.
if(NOT DEFINED CMAKE_OBJDUMP)
set(CMAKE_OBJDUMP "/usr/bin/objdump")
endif()
// This file is autogenerated. Changes will be overwritten.
#include "EWIEGA46WW/moc_qwt_abstract_legend.cpp"
#include "EWIEGA46WW/moc_qwt_abstract_scale.cpp"
#include "EWIEGA46WW/moc_qwt_abstract_slider.cpp"
#include "EWIEGA46WW/moc_qwt_analog_clock.cpp"
#include "EWIEGA46WW/moc_qwt_compass.cpp"
#include "EWIEGA46WW/moc_qwt_counter.cpp"
#include "EWIEGA46WW/moc_qwt_dial.cpp"
#include "EWIEGA46WW/moc_qwt_dyngrid_layout.cpp"
#include "EWIEGA46WW/moc_qwt_knob.cpp"
#include "EWIEGA46WW/moc_qwt_legend.cpp"
#include "EWIEGA46WW/moc_qwt_legend_label.cpp"
#include "EWIEGA46WW/moc_qwt_magnifier.cpp"
#include "EWIEGA46WW/moc_qwt_panner.cpp"
#include "EWIEGA46WW/moc_qwt_picker.cpp"
#include "EWIEGA46WW/moc_qwt_plot.cpp"
#include "EWIEGA46WW/moc_qwt_plot_canvas.cpp"
#include "EWIEGA46WW/moc_qwt_plot_magnifier.cpp"
#include "EWIEGA46WW/moc_qwt_plot_panner.cpp"
#include "EWIEGA46WW/moc_qwt_plot_picker.cpp"
#include "EWIEGA46WW/moc_qwt_plot_zoomer.cpp"
#include "EWIEGA46WW/moc_qwt_scale_widget.cpp"
#include "EWIEGA46WW/moc_qwt_slider.cpp"
#include "EWIEGA46WW/moc_qwt_text_label.cpp"
#include "EWIEGA46WW/moc_qwt_thermo.cpp"
#include "EWIEGA46WW/moc_qwt_wheel.cpp"
// This file is autogenerated. Changes will be overwritten.
// No files found that require moc or the moc files are included
enum some_compilers { need_more_than_nothing };
// This file is autogenerated. Changes will be overwritten.
// No files found that require moc or the moc files are included
enum some_compilers { need_more_than_nothing };
// This file is autogenerated. Changes will be overwritten.
// No files found that require moc or the moc files are included
enum some_compilers { need_more_than_nothing };
// This file is autogenerated. Changes will be overwritten.
// No files found that require moc or the moc files are included
enum some_compilers { need_more_than_nothing };
// This file is autogenerated. Changes will be overwritten.
// No files found that require moc or the moc files are included
enum some_compilers { need_more_than_nothing };
// This file is autogenerated. Changes will be overwritten.
// No files found that require moc or the moc files are included
enum some_compilers { need_more_than_nothing };
// This file is autogenerated. Changes will be overwritten.
// No files found that require moc or the moc files are included
enum some_compilers { need_more_than_nothing };
// This file is autogenerated. Changes will be overwritten.
// No files found that require moc or the moc files are included
enum some_compilers { need_more_than_nothing };
// This file is autogenerated. Changes will be overwritten.
// No files found that require moc or the moc files are included
enum some_compilers { need_more_than_nothing };
# This file is used to ignore files which are generated
# ----------------------------------------------------------------------------
*~
*.autosave
*.a
*.core
*.moc
*.o
*.obj
*.orig
*.rej
*.so
*.so.*
*_pch.h.cpp
*_resource.rc
*.qm
.#*
*.*#
core
!core/
tags
.DS_Store
.directory
*.debug
Makefile*
*.prl
*.app
moc_*.cpp
ui_*.h
qrc_*.cpp
Thumbs.db
*.res
*.rc
/.qmake.cache
/.qmake.stash
# qtcreator generated files
*.pro.user*
# xemacs temporary files
*.flc
# Vim temporary files
.*.swp
# Visual Studio generated files
*.ib_pdb_index
*.idb
*.ilk
*.pdb
*.sln
*.suo
*.vcproj
*vcproj.*.*.user
*.ncb
*.sdf
*.opensdf
*.vcxproj
*vcxproj.*
# MinGW generated files
*.Debug
*.Release
# Python byte code
*.pyc
# Binaries
# --------
*.dll
*.exe
add_library(snake
STATIC
snake.cpp
snake_geometry.cpp
)
find_package(GeographicLib REQUIRED)
find_package(ortools CONFIG REQUIRED)
target_link_libraries (snake ${GeographicLib_LIBRARIES} polyclipping ${ORTOOLS_LIBRARIES})
target_include_directories(snake PRIVATE polylabel) # polylabel
target_include_directories(snake PUBLIC include) # polylabel
add_subdirectory(test)
This diff is collapsed.
# Install script for directory: /home/valentin/Desktop/drones/qgroundcontrol/libs/snake
# Set the install prefix
if(NOT DEFINED CMAKE_INSTALL_PREFIX)
set(CMAKE_INSTALL_PREFIX "/usr/local")
endif()
string(REGEX REPLACE "/$" "" CMAKE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}")
# Set the install configuration name.
if(NOT DEFINED CMAKE_INSTALL_CONFIG_NAME)
if(BUILD_TYPE)
string(REGEX REPLACE "^[^A-Za-z0-9_]+" ""
CMAKE_INSTALL_CONFIG_NAME "${BUILD_TYPE}")
else()
set(CMAKE_INSTALL_CONFIG_NAME "RelWithDebInfo")
endif()
message(STATUS "Install configuration: \"${CMAKE_INSTALL_CONFIG_NAME}\"")
endif()
# Set the component getting installed.
if(NOT CMAKE_INSTALL_COMPONENT)
if(COMPONENT)
message(STATUS "Install component: \"${COMPONENT}\"")
set(CMAKE_INSTALL_COMPONENT "${COMPONENT}")
else()
set(CMAKE_INSTALL_COMPONENT)
endif()
endif()
# Install shared libraries without execute permission?
if(NOT DEFINED CMAKE_INSTALL_SO_NO_EXE)
set(CMAKE_INSTALL_SO_NO_EXE "1")
endif()
# Is this installation the result of a crosscompile?
if(NOT DEFINED CMAKE_CROSSCOMPILING)
set(CMAKE_CROSSCOMPILING "FALSE")
endif()
# Set default install directory permissions.
if(NOT DEFINED CMAKE_OBJDUMP)
set(CMAKE_OBJDUMP "/usr/bin/objdump")
endif()
if(NOT CMAKE_INSTALL_LOCAL_ONLY)
# Include the install script for each subdirectory.
include("/home/valentin/Desktop/drones/qgroundcontrol/libs/snake/test/cmake_install.cmake")
endif()
#include <iostream>
#include "snake.h"
#include <clipper.hpp>
#include "clipper.hpp"
#define CLIPPER_SCALE 10000
using namespace snake_geometry;
......
CONFIG -= qt
TEMPLATE = lib
DEFINES += SNAKE_LIBRARY
CONFIG += c++14
# The following define makes your compiler emit warnings if you use
# any Qt feature that has been marked deprecated (the exact warnings
# depend on your compiler). Please consult the documentation of the
# deprecated API in order to know how to port your code away from it.
DEFINES += QT_DEPRECATED_WARNINGS
# You can also make your code fail to compile if it uses deprecated APIs.
# In order to do so, uncomment the following line.
# You can also select to disable deprecated APIs only up to a certain version of Qt.
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
SOURCES += \
snake.cpp \
snake_geometry.cpp \
test/test_snake.cpp \
test/test_snake_geometry.cpp
HEADERS += \
catch.hpp \
polylabel/mapbox/feature.hpp \
polylabel/mapbox/geometry.hpp \
polylabel/mapbox/geometry/box.hpp \
polylabel/mapbox/geometry/empty.hpp \
polylabel/mapbox/geometry/envelope.hpp \
polylabel/mapbox/geometry/for_each_point.hpp \
polylabel/mapbox/geometry/geometry.hpp \
polylabel/mapbox/geometry/line_string.hpp \
polylabel/mapbox/geometry/multi_line_string.hpp \
polylabel/mapbox/geometry/multi_point.hpp \
polylabel/mapbox/geometry/multi_polygon.hpp \
polylabel/mapbox/geometry/point.hpp \
polylabel/mapbox/geometry/point_arithmetic.hpp \
polylabel/mapbox/geometry/polygon.hpp \
polylabel/mapbox/geometry_io.hpp \
polylabel/mapbox/optional.hpp \
polylabel/mapbox/polylabel/polylabel.hpp \
polylabel/mapbox/recursive_wrapper.hpp \
polylabel/mapbox/variant.hpp \
polylabel/mapbox/variant_io.hpp \
snake_geometry.h \
snake_global.h \
snake.h
# Default rules for deployment.
unix {
target.path = /usr/lib
}
!isEmpty(target.path): INSTALLS += target
win32:CONFIG(release, debug|release): LIBS += -L$$OUT_PWD/./release/ -lsnake
else:win32:CONFIG(debug, debug|release): LIBS += -L$$OUT_PWD/./debug/ -lsnake
else:unix: LIBS += -L$$OUT_PWD/./ -lsnake
INCLUDEPATH += $$PWD/../clipper/clipper
DEPENDPATH += $$PWD/../clipper/clipper
......@@ -308,10 +308,7 @@ bool dijkstraAlgorithm(const size_t numElements,
std::vector<size_t> &elementPath,
std::function<double (const size_t, const size_t)> distanceDij)
{
if ( numElements < 0
|| startIndex < 0
|| endIndex < 0
|| startIndex >= numElements
if ( startIndex >= numElements
|| endIndex >= numElements
|| endIndex == startIndex) {
return false;
......
#pragma once
#include <vector>
#include <array>
#include "WGS84toCartesian.hpp"
namespace snake_geometry {
typedef std::array<double, 2> Point2D;
typedef std::vector<Point2D> Point2DList;
typedef std::array<double, 3> Point3D;
typedef std::vector<Point3D> Point3DList;
typedef std::array<double, 2> GeoPoint2D;
typedef std::vector<GeoPoint2D> GeoPoint2DList;
typedef std::array<double, 3> GeoPoint3D;
typedef std::vector<GeoPoint3D> GeoPoint3DList;
typedef struct {
double width;
double height;
double angle;
std::array<Point2D,4> corners;
}min_bbox_rt;
<<<<<<< HEAD
Point3D toENU(const GeoPoint3D &WGS84Reference, const GeoPoint3D &WGS84Position);
GeoPoint3D fromENU(const Point3D &WGS84Reference, const Point3D &CartesianPosition);
=======
Point3D toENU(const Point3D &WGS84Reference, const Point3D &WGS84Position);
Point3D fromENU(const Point3D &WGS84Reference, const Point3D &CartesianPosition);
>>>>>>> 5687fb4553282f37531aa25fac4d66ec9a84932e
Point2D polygonCenter(const Point2DList &polygon);
min_bbox_rt minimalBoundingBox(const Point2DList &polygon);
}
#ifndef SNAKE_GLOBAL_H
#define SNAKE_GLOBAL_H
#if defined(_MSC_VER) || defined(WIN64) || defined(_WIN64) || defined(__WIN64__) || defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__NT__)
# define Q_DECL_EXPORT __declspec(dllexport)
# define Q_DECL_IMPORT __declspec(dllimport)
#else
# define Q_DECL_EXPORT __attribute__((visibility("default")))
# define Q_DECL_IMPORT __attribute__((visibility("default")))
#endif
#if defined(SNAKE_LIBRARY)
# define SNAKE_EXPORT Q_DECL_EXPORT
#else
# define SNAKE_EXPORT Q_DECL_IMPORT
#endif
#endif // SNAKE_GLOBAL_H
This diff is collapsed.
#pragma once
#include <mapbox/geometry.hpp>
#include <mapbox/variant.hpp>
#include <cstdint>
#include <string>
#include <vector>
#include <unordered_map>
namespace mapbox {
namespace feature {
struct value;
struct null_value_t
{
};
constexpr bool operator==(const null_value_t&, const null_value_t&) { return true; }
constexpr bool operator!=(const null_value_t&, const null_value_t&) { return false; }
constexpr bool operator<(const null_value_t&, const null_value_t&) { return false; }
constexpr null_value_t null_value = null_value_t();
// Multiple numeric types (uint64_t, int64_t, double) are present in order to support
// the widest possible range of JSON numbers, which do not have a maximum range.
// Implementations that produce `value`s should use that order for type preference,
// using uint64_t for positive integers, int64_t for negative integers, and double
// for non-integers and integers outside the range of 64 bits.
using value_base = mapbox::util::variant<null_value_t, bool, uint64_t, int64_t, double, std::string,
mapbox::util::recursive_wrapper<std::vector<value>>,
mapbox::util::recursive_wrapper<std::unordered_map<std::string, value>>>;
struct value : value_base
{
using value_base::value_base;
};
using property_map = std::unordered_map<std::string, value>;
// The same considerations and requirement for numeric types apply as for `value_base`.
using identifier = mapbox::util::variant<null_value_t, uint64_t, int64_t, double, std::string>;
template <class T>
struct feature
{
using coordinate_type = T;
using geometry_type = mapbox::geometry::geometry<T>; // Fully qualified to avoid GCC -fpermissive error.
geometry_type geometry;
property_map properties;
identifier id;
feature()
: geometry(),
properties(),
id() {}
feature(geometry_type const& geom_)
: geometry(geom_),
properties(),
id() {}
feature(geometry_type&& geom_)