Clang_format, enabling e57unpack again (#27)
- Re-enabled e57unpack as tool - Improved Conan recipe, including tools - Added formatting target with clang-format - Minor improvements in CMake - Minor improvements in CPack - Removed custom option to build with PIC on Unix, using CMAKE_POSITION_INDEPENDENT_CODE
This commit is contained in:
@@ -1,10 +1,13 @@
|
||||
# openE57
|
||||
|
||||
## [1.6.2] -
|
||||
## [1.6.2] - 2022-02-19
|
||||
|
||||
## Changed
|
||||
- Re-enabled e57unpack as tool
|
||||
- Improved Conan recipe, including tools
|
||||
- Added formatting target with clang-format
|
||||
- Minor improvements in CMake
|
||||
- Minor improvements in CPack
|
||||
|
||||
## Removed
|
||||
- Removed custom option to build with PIC on Unix, using CMAKE_POSITION_INDEPENDENT_CODE
|
||||
|
||||
@@ -86,10 +86,12 @@ install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/CHANGELOG.md
|
||||
DESTINATION .)
|
||||
|
||||
set(CPACK_PACKAGE_VENDOR "Michele Adduci <adduci@tutanota.com>")
|
||||
set(CPACK_PACKAGE_VERSION_MAJOR "${${PROJECT_NAME}_MAJOR_VERSION}")
|
||||
set(CPACK_PACKAGE_VERSION_MINOR "${${PROJECT_NAME}_MINOR_VERSION}")
|
||||
set(CPACK_PACKAGE_VERSION_PATCH "${${PROJECT_NAME}_BUILD_VERSION}")
|
||||
set(CPACK_SYSTEM_NAME "${${PROJECT_NAME}_BUILD_TAG}")
|
||||
set(CPACK_PACKAGE_DESCRIPTION "${PROJECT_DESCRIPTION}")
|
||||
set(CPACK_PACKAGE_CHECKSUM SHA256)
|
||||
set(CPACK_PACKAGE_VERSION_MAJOR "${PROJECT_VERSION_MAJOR}")
|
||||
set(CPACK_PACKAGE_VERSION_MINOR "${PROJECT_VERSION_MINOR}")
|
||||
set(CPACK_PACKAGE_VERSION_PATCH "${PROJECT_VERSION_PATCH}")
|
||||
set(CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}-src")
|
||||
set(CPACK_GENERATOR "ZIP")
|
||||
set(CPACK_STRIP_FILES "TRUE")
|
||||
|
||||
|
||||
@@ -82,3 +82,11 @@ conan install .. --build=missing
|
||||
cmake .. -DCMAKE_BUILD_TYPE=Release -DBUILD_WITH_MT=ON
|
||||
cmake --build . --config Release --target install
|
||||
```
|
||||
|
||||
#### Autoformatting
|
||||
|
||||
The Project offers the possibility to run the auto-formatter (clang-format) on the sources. As prerequisite, you need to install `clang-format` on your machine and then run the following cmake target:
|
||||
|
||||
```sh
|
||||
cmake --build . --target clangformat
|
||||
```
|
||||
@@ -3,20 +3,16 @@
|
||||
#
|
||||
|
||||
# Set a private module find path
|
||||
set(CMAKE_MODULE_PATH ${CMAKE_BINARY_DIR} ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules/")
|
||||
set(CMAKE_PREFIX_PATH ${CMAKE_BINARY_DIR} ${CMAKE_PREFIX_PATH})
|
||||
list(APPEND CMAKE_MODULE_PATH ${CMAKE_BINARY_DIR} "${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules/")
|
||||
list(APPEND CMAKE_PREFIX_PATH ${CMAKE_BINARY_DIR})
|
||||
|
||||
include(GNUInstallDirs)
|
||||
include(CMakePackageConfigHelpers)
|
||||
include(GenerateExportHeader)
|
||||
|
||||
# Check if we are building a conan recipe
|
||||
#if(NOT EXISTS ${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
|
||||
#include(InstallRequiredSystemLibraries)
|
||||
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/compiler_options.cmake)
|
||||
#endif()
|
||||
|
||||
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/dependencies.cmake)
|
||||
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/clang_format.cmake)
|
||||
|
||||
set(CONFIG_PACKAGE_INSTALL_DIR lib/cmake/${PROJECT_NAME})
|
||||
|
||||
|
||||
@@ -1,21 +1,53 @@
|
||||
find_program(E57_CLANG_FORMAT_BIN NAMES clang-format)
|
||||
# Inspired By https://github.com/zemasoft/clangformat-cmake
|
||||
# Copyright Tomas Zeman 2019-2020.
|
||||
# Distributed under the Boost Software License, Version 1.0.
|
||||
# (See accompanying file LICENSE_1_0.txt or copy at
|
||||
# http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
if(E57_CLANG_FORMAT_BIN)
|
||||
get_target_property(openE57_files ${PROJECT_NAME} SOURCES)
|
||||
get_target_property(openE57las_files ${PROJECT_NAME}las SOURCES)
|
||||
function(prefix_clangformat_setup prefix)
|
||||
if(NOT CLANGFORMAT_EXECUTABLE)
|
||||
set(CLANGFORMAT_EXECUTABLE clang-format)
|
||||
endif()
|
||||
|
||||
add_custom_target(
|
||||
format-openE57
|
||||
COMMAND clang-format --style=file -i ${openE57_files}
|
||||
COMMAND_EXPAND_LISTS VERBATIM)
|
||||
if(NOT EXISTS ${CLANGFORMAT_EXECUTABLE})
|
||||
find_program(clangformat_executable_tmp ${CLANGFORMAT_EXECUTABLE})
|
||||
if(clangformat_executable_tmp)
|
||||
set(CLANGFORMAT_EXECUTABLE ${clangformat_executable_tmp})
|
||||
unset(clangformat_executable_tmp)
|
||||
else()
|
||||
message(STATUS "${CLANGFORMAT_EXECUTABLE} executable not found! Ignoring action for ${prefix}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
add_custom_target(
|
||||
format-openE57las
|
||||
COMMAND clang-format --style=file -i ${openE57las_files}
|
||||
COMMAND_EXPAND_LISTS VERBATIM)
|
||||
foreach(clangformat_source ${ARGN})
|
||||
get_filename_component(clangformat_source ${clangformat_source} ABSOLUTE)
|
||||
list(APPEND clangformat_sources ${clangformat_source})
|
||||
endforeach()
|
||||
|
||||
add_custom_target(
|
||||
format
|
||||
COMMENT "Running clang-format..."
|
||||
DEPENDS format-openE57 format-openE57las)
|
||||
endif()
|
||||
add_custom_target(${prefix}_clangformat
|
||||
COMMAND
|
||||
${CLANGFORMAT_EXECUTABLE}
|
||||
-style=file
|
||||
-i
|
||||
${clangformat_sources}
|
||||
WORKING_DIRECTORY
|
||||
${CMAKE_SOURCE_DIR}
|
||||
COMMENT
|
||||
"Formatting ${prefix} with ${CLANGFORMAT_EXECUTABLE} ..."
|
||||
)
|
||||
|
||||
if(TARGET clangformat)
|
||||
add_dependencies(clangformat ${prefix}_clangformat)
|
||||
else()
|
||||
add_custom_target(clangformat DEPENDS ${prefix}_clangformat)
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
function(clangformat_setup)
|
||||
prefix_clangformat_setup(${PROJECT_NAME} ${ARGN})
|
||||
endfunction()
|
||||
|
||||
function(target_clangformat_setup target)
|
||||
get_target_property(target_sources ${target} SOURCES)
|
||||
prefix_clangformat_setup(${target} ${target_sources})
|
||||
endfunction()
|
||||
@@ -21,4 +21,5 @@ foreach(EXAMPLE ${EXAMPLES})
|
||||
${XML_LIBRARIES}
|
||||
${CMAKE_THREAD_LIBS_INIT}
|
||||
)
|
||||
target_clangformat_setup(${EXAMPLE})
|
||||
endforeach()
|
||||
@@ -31,6 +31,7 @@ target_include_directories(${PROJECT_NAME}
|
||||
)
|
||||
|
||||
target_link_libraries(${PROJECT_NAME} PUBLIC ${XML_LIBRARIES})
|
||||
target_clangformat_setup(${PROJECT_NAME})
|
||||
|
||||
#
|
||||
# Extension Library for LAS I/O support
|
||||
@@ -54,6 +55,7 @@ target_include_directories(${PROJECT_NAME}las
|
||||
)
|
||||
|
||||
target_link_libraries(${PROJECT_NAME}las PUBLIC ${XML_LIBRARIES})
|
||||
target_clangformat_setup(${PROJECT_NAME}las)
|
||||
|
||||
#
|
||||
# Install Artifacts
|
||||
|
||||
@@ -115,14 +115,14 @@ const int E57_FOUNDATION_API_MINOR = 51;
|
||||
// Minimum and maximum values for integers
|
||||
// see https://en.cppreference.com/w/cpp/types/numeric_limits
|
||||
|
||||
const int8_t E57_INT8_MIN = std::numeric_limits<int8_t>::lowest();
|
||||
const int8_t E57_INT8_MAX = std::numeric_limits<int8_t>::max();
|
||||
const int16_t E57_INT16_MIN = std::numeric_limits<int16_t>::lowest();
|
||||
const int16_t E57_INT16_MAX = std::numeric_limits<int16_t>::max();
|
||||
const int32_t E57_INT32_MIN = std::numeric_limits<int32_t>::lowest();
|
||||
const int32_t E57_INT32_MAX = std::numeric_limits<int32_t>::max();
|
||||
const int64_t E57_INT64_MIN = std::numeric_limits<int64_t>::lowest();
|
||||
const int64_t E57_INT64_MAX = std::numeric_limits<int64_t>::max();
|
||||
const int8_t E57_INT8_MIN = std::numeric_limits<int8_t>::lowest();
|
||||
const int8_t E57_INT8_MAX = std::numeric_limits<int8_t>::max();
|
||||
const int16_t E57_INT16_MIN = std::numeric_limits<int16_t>::lowest();
|
||||
const int16_t E57_INT16_MAX = std::numeric_limits<int16_t>::max();
|
||||
const int32_t E57_INT32_MIN = std::numeric_limits<int32_t>::lowest();
|
||||
const int32_t E57_INT32_MAX = std::numeric_limits<int32_t>::max();
|
||||
const int64_t E57_INT64_MIN = std::numeric_limits<int64_t>::lowest();
|
||||
const int64_t E57_INT64_MAX = std::numeric_limits<int64_t>::max();
|
||||
|
||||
const uint8_t E57_UINT8_MIN = std::numeric_limits<uint8_t>::lowest();
|
||||
const uint8_t E57_UINT8_MAX = std::numeric_limits<uint8_t>::max();
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
//
|
||||
// Copyright (c) 2010 Stan Coleby (scoleby@intelisum.com)
|
||||
// Copyright (c) 2020 - 2022 Michele Adduci (adduci@tutanota.com)
|
||||
//
|
||||
//
|
||||
// All rights reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person or organization
|
||||
@@ -438,16 +438,19 @@ public:
|
||||
ustring sensorSoftwareVersion; //!< The version number for the software used for the data collection.
|
||||
ustring sensorFirmwareVersion; //!< The version number for the firmware installed in the sensor at the time of data collection.
|
||||
|
||||
float temperature; //!< The ambient temperature, measured at the sensor, at the time of data collection (in degrees Celsius). Shall be ? ?273.15<EFBFBD> (absolute zero).
|
||||
float
|
||||
temperature; //!< The ambient temperature, measured at the sensor, at the time of data collection (in degrees Celsius). Shall be ? ?273.15<EFBFBD> (absolute zero).
|
||||
float relativeHumidity; //!< The percentage relative humidity, measured at the sensor, at the time of data collection. Shall be in the interval [0, 100].
|
||||
float atmosphericPressure; //!< The atmospheric pressure, measured at the sensor, at the time of data collection (in Pascals). Shall be positive.
|
||||
|
||||
e57::DateTime acquisitionStart; //!< The start date and time that the data was acquired.
|
||||
e57::DateTime acquisitionEnd; //!< The end date and time that the data was acquired.
|
||||
|
||||
e57::RigidBodyTransform pose; //!< A rigid body transform that describes the coordinate frame of the 3D imaging system origin in the file-level coordinate system.
|
||||
e57::RigidBodyTransform
|
||||
pose; //!< A rigid body transform that describes the coordinate frame of the 3D imaging system origin in the file-level coordinate system.
|
||||
e57::IndexBounds indexBounds; //!< The bounds of the row, column, and return number of all the points in this Data3D.
|
||||
e57::CartesianBounds cartesianBounds; //!< The bounding region (in cartesian coordinates) of all the points in this Data3D (in the local coordinate system of the points).
|
||||
e57::CartesianBounds
|
||||
cartesianBounds; //!< The bounding region (in cartesian coordinates) of all the points in this Data3D (in the local coordinate system of the points).
|
||||
e57::SphericalBounds
|
||||
sphericalBounds; //!< The bounding region (in spherical coordinates) of all the points in this Data3D (in the local coordinate system of the points).
|
||||
e57::IntensityLimits intensityLimits; //!< The limits for the value of signal intensity that the sensor is capable of producing.
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
*
|
||||
* Copyright (c) 2009 - 2010 Kevin Ackley (kackley@gwi.net)
|
||||
* Copyright (c) 2020 - 2022 Michele Adduci (adduci@tutanota.com)
|
||||
*
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person or organization
|
||||
* obtaining a copy of the software and accompanying documentation covered by
|
||||
* this license (the "Software") to use, reproduce, display, distribute,
|
||||
|
||||
@@ -58,9 +58,9 @@
|
||||
# error "no supported OS platform defined"
|
||||
#endif
|
||||
|
||||
#include <cmath> // floor()
|
||||
#include <cstdint>
|
||||
#include <sstream>
|
||||
#include <cmath> // floor()
|
||||
|
||||
#ifdef E57_MAX_VERBOSE
|
||||
# include <iostream>
|
||||
@@ -69,8 +69,8 @@ using std::cout;
|
||||
using std::endl;
|
||||
#endif
|
||||
|
||||
#include <openE57/impl/openE57Impl.h>
|
||||
#include <openE57/impl/crc.h>
|
||||
#include <openE57/impl/openE57Impl.h>
|
||||
|
||||
const auto CRC32C_LOOKUP_TABLE = CRC::CRC_32_C().MakeTable();
|
||||
|
||||
@@ -357,8 +357,8 @@ std::shared_ptr<NodeImpl> NodeImpl::get(const ustring& pathName)
|
||||
checkImageFileOpen(__FILE__, __LINE__, __FUNCTION__);
|
||||
|
||||
/// Parse to determine if pathName is absolute
|
||||
bool isRelative;
|
||||
vector<ustring> fields;
|
||||
bool isRelative;
|
||||
vector<ustring> fields;
|
||||
std::shared_ptr<ImageFileImpl> imf(destImageFile_);
|
||||
imf->pathNameParse(pathName, isRelative, fields); // throws if bad pathName
|
||||
|
||||
@@ -392,8 +392,8 @@ void NodeImpl::set(const ustring& pathName, std::shared_ptr<NodeImpl> ni, bool a
|
||||
checkImageFileOpen(__FILE__, __LINE__, __FUNCTION__);
|
||||
|
||||
/// Parse to determine if pathName is absolute
|
||||
bool isRelative;
|
||||
vector<ustring> fields;
|
||||
bool isRelative;
|
||||
vector<ustring> fields;
|
||||
std::shared_ptr<ImageFileImpl> imf(destImageFile_);
|
||||
imf->pathNameParse(pathName, isRelative, fields); // throws if bad pathName
|
||||
|
||||
@@ -617,8 +617,8 @@ std::shared_ptr<NodeImpl> StructureNodeImpl::lookup(const ustring& pathName)
|
||||
{
|
||||
/// don't checkImageFileOpen
|
||||
//??? use lookup(fields, level) instead, for speed.
|
||||
bool isRelative;
|
||||
vector<ustring> fields;
|
||||
bool isRelative;
|
||||
vector<ustring> fields;
|
||||
std::shared_ptr<ImageFileImpl> imf(destImageFile_);
|
||||
imf->pathNameParse(pathName, isRelative, fields); // throws if bad pathName
|
||||
|
||||
@@ -1055,8 +1055,8 @@ SourceDestBufferImpl::SourceDestBufferImpl(std::weak_ptr<ImageFileImpl> destImag
|
||||
checkState_();
|
||||
}
|
||||
|
||||
SourceDestBufferImpl::SourceDestBufferImpl(std::weak_ptr<ImageFileImpl> destImageFile, const ustring pathName, bool* base, const size_t capacity, bool doConversion,
|
||||
bool doScaling, size_t stride)
|
||||
SourceDestBufferImpl::SourceDestBufferImpl(std::weak_ptr<ImageFileImpl> destImageFile, const ustring pathName, bool* base, const size_t capacity,
|
||||
bool doConversion, bool doScaling, size_t stride)
|
||||
: destImageFile_(destImageFile), pathName_(pathName), memoryRepresentation_(E57_BOOL), base_(reinterpret_cast<char*>(base)), capacity_(capacity),
|
||||
doConversion_(doConversion), doScaling_(doScaling), stride_(stride), nextIndex_(0), ustrings_(0)
|
||||
{
|
||||
@@ -1064,8 +1064,8 @@ SourceDestBufferImpl::SourceDestBufferImpl(std::weak_ptr<ImageFileImpl> destImag
|
||||
checkState_();
|
||||
}
|
||||
|
||||
SourceDestBufferImpl::SourceDestBufferImpl(std::weak_ptr<ImageFileImpl> destImageFile, const ustring pathName, float* base, const size_t capacity, bool doConversion,
|
||||
bool doScaling, size_t stride)
|
||||
SourceDestBufferImpl::SourceDestBufferImpl(std::weak_ptr<ImageFileImpl> destImageFile, const ustring pathName, float* base, const size_t capacity,
|
||||
bool doConversion, bool doScaling, size_t stride)
|
||||
: destImageFile_(destImageFile), pathName_(pathName), memoryRepresentation_(E57_REAL32), base_(reinterpret_cast<char*>(base)), capacity_(capacity),
|
||||
doConversion_(doConversion), doScaling_(doScaling), stride_(stride), nextIndex_(0), ustrings_(0)
|
||||
{
|
||||
@@ -3647,7 +3647,7 @@ void E57XmlParser::endElement(const XMLCh* const uri, const XMLCh* const localNa
|
||||
break;
|
||||
case E57_COMPRESSED_VECTOR: {
|
||||
std::shared_ptr<CompressedVectorNodeImpl> cv_ni = std::dynamic_pointer_cast<CompressedVectorNodeImpl>(parent_ni);
|
||||
ustring uQName = toUString(qName);
|
||||
ustring uQName = toUString(qName);
|
||||
|
||||
/// n can be either prototype or codecs
|
||||
if (uQName == "prototype")
|
||||
@@ -5739,7 +5739,7 @@ CompressedVectorWriterImpl::CompressedVectorWriterImpl(std::shared_ptr<Compresse
|
||||
|
||||
/// Calc which stream the given path belongs to. This depends on position of the node in the proto tree.
|
||||
std::shared_ptr<NodeImpl> readNode = proto_->get(sbufs.at(i).pathName());
|
||||
uint64_t bytestreamNumber = 0;
|
||||
uint64_t bytestreamNumber = 0;
|
||||
if (!proto_->findTerminalPosition(readNode, bytestreamNumber))
|
||||
throw E57_EXCEPTION2(E57_ERROR_INTERNAL, "sbufIndex=" + toString(i));
|
||||
|
||||
@@ -6160,7 +6160,7 @@ uint64_t CompressedVectorWriterImpl::packetWrite()
|
||||
/// Prepare header in dataPacket_, now that we are sure of packetLength
|
||||
dataPacket_.packetType = E57_DATA_PACKET;
|
||||
dataPacket_.packetFlags = 0;
|
||||
dataPacket_.packetLogicalLengthMinus1 = static_cast<uint16_t>(packetLength - 1); // %%% Truncation
|
||||
dataPacket_.packetLogicalLengthMinus1 = static_cast<uint16_t>(packetLength - 1); // %%% Truncation
|
||||
dataPacket_.bytestreamCount = static_cast<std::uint16_t>(bytestreams_.size()); // %%% Truncation
|
||||
|
||||
/// Double check that data packet is well formed
|
||||
@@ -6313,7 +6313,7 @@ CompressedVectorReaderImpl::CompressedVectorReaderImpl(std::shared_ptr<Compresse
|
||||
|
||||
/// Calc which stream the given path belongs to. This depends on position of the node in the proto tree.
|
||||
std::shared_ptr<NodeImpl> readNode = proto_->get(dbufs.at(i).pathName());
|
||||
uint64_t bytestreamNumber = 0;
|
||||
uint64_t bytestreamNumber = 0;
|
||||
if (!proto_->findTerminalPosition(readNode, bytestreamNumber))
|
||||
throw E57_EXCEPTION2(E57_ERROR_INTERNAL, "dbufIndex=" + toString(i));
|
||||
|
||||
@@ -6768,7 +6768,7 @@ void CompressedVectorReaderImpl::dump(int indent, std::ostream& os)
|
||||
//================================================================
|
||||
|
||||
std::shared_ptr<Encoder> Encoder::EncoderFactory(unsigned bytestreamNumber, std::shared_ptr<CompressedVectorNodeImpl> cVector, vector<SourceDestBuffer>& sbufs,
|
||||
ustring& /*codecPath*/)
|
||||
ustring& /*codecPath*/)
|
||||
{
|
||||
//??? For now, only handle one input
|
||||
if (sbufs.size() != 1)
|
||||
@@ -6777,7 +6777,7 @@ std::shared_ptr<Encoder> Encoder::EncoderFactory(unsigned bytestreamNumber, std:
|
||||
|
||||
/// Get node we are going to encode from the CompressedVector's prototype
|
||||
std::shared_ptr<NodeImpl> prototype = cVector->getPrototype();
|
||||
ustring path = sbuf.pathName();
|
||||
ustring path = sbuf.pathName();
|
||||
std::shared_ptr<NodeImpl> encodeNode = prototype->get(path);
|
||||
|
||||
#ifdef E57_MAX_VERBOSE
|
||||
@@ -6788,7 +6788,7 @@ std::shared_ptr<Encoder> Encoder::EncoderFactory(unsigned bytestreamNumber, std:
|
||||
{
|
||||
case E57_INTEGER: {
|
||||
std::shared_ptr<IntegerNodeImpl> ini = std::dynamic_pointer_cast<IntegerNodeImpl>(encodeNode); // downcast to correct type
|
||||
if (!ini) // check if failed
|
||||
if (!ini) // check if failed
|
||||
throw E57_EXCEPTION2(E57_ERROR_INTERNAL, "elementName=" + encodeNode->elementName());
|
||||
|
||||
/// Get pointer to parent ImageFileImpl, to call bitsNeeded()
|
||||
@@ -6830,7 +6830,7 @@ std::shared_ptr<Encoder> Encoder::EncoderFactory(unsigned bytestreamNumber, std:
|
||||
}
|
||||
case E57_SCALED_INTEGER: {
|
||||
std::shared_ptr<ScaledIntegerNodeImpl> sini = std::dynamic_pointer_cast<ScaledIntegerNodeImpl>(encodeNode); // downcast to correct type
|
||||
if (!sini) // check if failed
|
||||
if (!sini) // check if failed
|
||||
throw E57_EXCEPTION2(E57_ERROR_INTERNAL, "elementName=" + encodeNode->elementName());
|
||||
|
||||
/// Get pointer to parent ImageFileImpl, to call bitsNeeded()
|
||||
@@ -6848,31 +6848,31 @@ std::shared_ptr<Encoder> Encoder::EncoderFactory(unsigned bytestreamNumber, std:
|
||||
else if (bitsPerRecord <= 8)
|
||||
{
|
||||
std::shared_ptr<Encoder> encoder(new BitpackIntegerEncoder<uint8_t>(true, bytestreamNumber, sbuf, E57_DATA_PACKET_MAX /*!!!*/, sini->minimum(),
|
||||
sini->maximum(), sini->scale(), sini->offset()));
|
||||
sini->maximum(), sini->scale(), sini->offset()));
|
||||
return (encoder);
|
||||
}
|
||||
else if (bitsPerRecord <= 16)
|
||||
{
|
||||
std::shared_ptr<Encoder> encoder(new BitpackIntegerEncoder<uint16_t>(true, bytestreamNumber, sbuf, E57_DATA_PACKET_MAX /*!!!*/, sini->minimum(),
|
||||
sini->maximum(), sini->scale(), sini->offset()));
|
||||
sini->maximum(), sini->scale(), sini->offset()));
|
||||
return (encoder);
|
||||
}
|
||||
else if (bitsPerRecord <= 32)
|
||||
{
|
||||
std::shared_ptr<Encoder> encoder(new BitpackIntegerEncoder<uint32_t>(true, bytestreamNumber, sbuf, E57_DATA_PACKET_MAX /*!!!*/, sini->minimum(),
|
||||
sini->maximum(), sini->scale(), sini->offset()));
|
||||
sini->maximum(), sini->scale(), sini->offset()));
|
||||
return (encoder);
|
||||
}
|
||||
else
|
||||
{
|
||||
std::shared_ptr<Encoder> encoder(new BitpackIntegerEncoder<uint64_t>(true, bytestreamNumber, sbuf, E57_DATA_PACKET_MAX /*!!!*/, sini->minimum(),
|
||||
sini->maximum(), sini->scale(), sini->offset()));
|
||||
sini->maximum(), sini->scale(), sini->offset()));
|
||||
return (encoder);
|
||||
}
|
||||
}
|
||||
case E57_FLOAT: {
|
||||
std::shared_ptr<FloatNodeImpl> fni = std::dynamic_pointer_cast<FloatNodeImpl>(encodeNode); // downcast to correct type
|
||||
if (!fni) // check if failed
|
||||
if (!fni) // check if failed
|
||||
throw E57_EXCEPTION2(E57_ERROR_INTERNAL, "elementName=" + encodeNode->elementName());
|
||||
|
||||
//!!! need to pick smarter channel buffer sizes, here and elsewhere
|
||||
@@ -7284,14 +7284,15 @@ void BitpackStringEncoder::dump(int indent, std::ostream& os)
|
||||
|
||||
//================================================================
|
||||
|
||||
std::shared_ptr<Decoder> Decoder::DecoderFactory(unsigned bytestreamNumber, //!!! name ok?
|
||||
std::shared_ptr<CompressedVectorNodeImpl> cVector, vector<SourceDestBuffer>& dbufs, const ustring& /*codecPath*/)
|
||||
std::shared_ptr<Decoder> Decoder::DecoderFactory(unsigned bytestreamNumber, //!!! name ok?
|
||||
std::shared_ptr<CompressedVectorNodeImpl> cVector, vector<SourceDestBuffer>& dbufs,
|
||||
const ustring& /*codecPath*/)
|
||||
{
|
||||
//!!! verify single dbuf
|
||||
|
||||
/// Get node we are going to decode from the CompressedVector's prototype
|
||||
std::shared_ptr<NodeImpl> prototype = cVector->getPrototype();
|
||||
ustring path = dbufs.at(0).pathName();
|
||||
ustring path = dbufs.at(0).pathName();
|
||||
std::shared_ptr<NodeImpl> decodeNode = prototype->get(path);
|
||||
|
||||
#ifdef E57_MAX_VERBOSE
|
||||
@@ -7305,7 +7306,7 @@ std::shared_ptr<Decoder> Decoder::DecoderFactory(unsigned
|
||||
{
|
||||
case E57_INTEGER: {
|
||||
std::shared_ptr<IntegerNodeImpl> ini = std::dynamic_pointer_cast<IntegerNodeImpl>(decodeNode); // downcast to correct type
|
||||
if (!ini) // check if failed
|
||||
if (!ini) // check if failed
|
||||
throw E57_EXCEPTION2(E57_ERROR_INTERNAL, "elementName=" + decodeNode->elementName());
|
||||
|
||||
/// Get pointer to parent ImageFileImpl, to call bitsNeeded()
|
||||
@@ -7347,7 +7348,7 @@ std::shared_ptr<Decoder> Decoder::DecoderFactory(unsigned
|
||||
}
|
||||
case E57_SCALED_INTEGER: {
|
||||
std::shared_ptr<ScaledIntegerNodeImpl> sini = std::dynamic_pointer_cast<ScaledIntegerNodeImpl>(decodeNode); // downcast to correct type
|
||||
if (!sini) // check if failed
|
||||
if (!sini) // check if failed
|
||||
throw E57_EXCEPTION2(E57_ERROR_INTERNAL, "elementName=" + decodeNode->elementName());
|
||||
|
||||
/// Get pointer to parent ImageFileImpl, to call bitsNeeded()
|
||||
@@ -7366,31 +7367,31 @@ std::shared_ptr<Decoder> Decoder::DecoderFactory(unsigned
|
||||
else if (bitsPerRecord <= 8)
|
||||
{
|
||||
std::shared_ptr<Decoder> decoder(new BitpackIntegerDecoder<uint8_t>(true, bytestreamNumber, dbufs.at(0), sini->minimum(), sini->maximum(), sini->scale(),
|
||||
sini->offset(), maxRecordCount));
|
||||
sini->offset(), maxRecordCount));
|
||||
return (decoder);
|
||||
}
|
||||
else if (bitsPerRecord <= 16)
|
||||
{
|
||||
std::shared_ptr<Decoder> decoder(new BitpackIntegerDecoder<uint16_t>(true, bytestreamNumber, dbufs.at(0), sini->minimum(), sini->maximum(), sini->scale(),
|
||||
sini->offset(), maxRecordCount));
|
||||
sini->offset(), maxRecordCount));
|
||||
return (decoder);
|
||||
}
|
||||
else if (bitsPerRecord <= 32)
|
||||
{
|
||||
std::shared_ptr<Decoder> decoder(new BitpackIntegerDecoder<uint32_t>(true, bytestreamNumber, dbufs.at(0), sini->minimum(), sini->maximum(), sini->scale(),
|
||||
sini->offset(), maxRecordCount));
|
||||
sini->offset(), maxRecordCount));
|
||||
return (decoder);
|
||||
}
|
||||
else
|
||||
{
|
||||
std::shared_ptr<Decoder> decoder(new BitpackIntegerDecoder<uint64_t>(true, bytestreamNumber, dbufs.at(0), sini->minimum(), sini->maximum(), sini->scale(),
|
||||
sini->offset(), maxRecordCount));
|
||||
sini->offset(), maxRecordCount));
|
||||
return (decoder);
|
||||
}
|
||||
}
|
||||
case E57_FLOAT: {
|
||||
std::shared_ptr<FloatNodeImpl> fni = std::dynamic_pointer_cast<FloatNodeImpl>(decodeNode); // downcast to correct type
|
||||
if (!fni) // check if failed
|
||||
if (!fni) // check if failed
|
||||
throw E57_EXCEPTION2(E57_ERROR_INTERNAL, "elementName=" + decodeNode->elementName());
|
||||
|
||||
std::shared_ptr<Decoder> decoder(new BitpackFloatDecoder(bytestreamNumber, dbufs.at(0), fni->precision(), maxRecordCount));
|
||||
|
||||
@@ -796,8 +796,8 @@ DEALINGS IN THE SOFTWARE.
|
||||
# error "no supported OS platform defined"
|
||||
#endif
|
||||
|
||||
#include <openE57/openE57Simple.h>
|
||||
#include <openE57/impl/openE57SimpleImpl.h>
|
||||
#include <openE57/openE57Simple.h>
|
||||
|
||||
using namespace e57;
|
||||
|
||||
|
||||
@@ -57,62 +57,68 @@
|
||||
#elif defined(LINUX) || defined(__APPLE__) || defined(__unix__)
|
||||
# define _LARGEFILE64_SOURCE
|
||||
# define __LARGE64_FILES
|
||||
# include <cstring>
|
||||
# include <sys/types.h>
|
||||
# include <unistd.h>
|
||||
# include <cstring>
|
||||
#else
|
||||
# error "no supported OS platform defined"
|
||||
#endif
|
||||
|
||||
#include <openE57/impl/openE57SimpleImpl.h>
|
||||
#include <sstream>
|
||||
#include <random>
|
||||
#include <sstream>
|
||||
|
||||
using namespace e57;
|
||||
using namespace std;
|
||||
|
||||
namespace e57
|
||||
{
|
||||
|
||||
// inspired by https://stackoverflow.com/a/15764679/2369389
|
||||
template <typename T>
|
||||
void ignore(T &&)
|
||||
{ }
|
||||
void ignore(T&&)
|
||||
{}
|
||||
|
||||
// inspired by https://stackoverflow.com/a/60198074/2369389
|
||||
namespace uuid {
|
||||
static std::random_device rd;
|
||||
static std::mt19937_64 gen(rd());
|
||||
static std::uniform_int_distribution<> distribution(0, 15);
|
||||
static std::uniform_int_distribution<> distribution2(8, 11);
|
||||
namespace uuid
|
||||
{
|
||||
static std::random_device rd;
|
||||
static std::mt19937_64 gen(rd());
|
||||
static std::uniform_int_distribution<> distribution(0, 15);
|
||||
static std::uniform_int_distribution<> distribution2(8, 11);
|
||||
|
||||
std::string generate_uuid() {
|
||||
std::stringstream ss;
|
||||
int i;
|
||||
ss << std::hex;
|
||||
for (i = 0; i < 8; i++) {
|
||||
ss << distribution(gen);
|
||||
}
|
||||
ss << "-";
|
||||
for (i = 0; i < 4; i++) {
|
||||
ss << distribution(gen);
|
||||
}
|
||||
ss << "-4";
|
||||
for (i = 0; i < 3; i++) {
|
||||
ss << distribution(gen);
|
||||
}
|
||||
ss << "-";
|
||||
ss << distribution2(gen);
|
||||
for (i = 0; i < 3; i++) {
|
||||
ss << distribution(gen);
|
||||
}
|
||||
ss << "-";
|
||||
for (i = 0; i < 12; i++) {
|
||||
ss << distribution(gen);
|
||||
};
|
||||
return ss.str();
|
||||
std::string generate_uuid()
|
||||
{
|
||||
std::stringstream ss;
|
||||
int i;
|
||||
ss << std::hex;
|
||||
for (i = 0; i < 8; i++)
|
||||
{
|
||||
ss << distribution(gen);
|
||||
}
|
||||
}
|
||||
ss << "-";
|
||||
for (i = 0; i < 4; i++)
|
||||
{
|
||||
ss << distribution(gen);
|
||||
}
|
||||
ss << "-4";
|
||||
for (i = 0; i < 3; i++)
|
||||
{
|
||||
ss << distribution(gen);
|
||||
}
|
||||
ss << "-";
|
||||
ss << distribution2(gen);
|
||||
for (i = 0; i < 3; i++)
|
||||
{
|
||||
ss << distribution(gen);
|
||||
}
|
||||
ss << "-";
|
||||
for (i = 0; i < 12; i++)
|
||||
{
|
||||
ss << distribution(gen);
|
||||
};
|
||||
return ss.str();
|
||||
}
|
||||
} // namespace uuid
|
||||
|
||||
char* GetNewGuid(void);
|
||||
double GetGPSTime(void);
|
||||
@@ -154,7 +160,6 @@ double e57::GetGPSTime(void)
|
||||
#else
|
||||
return 0.0;
|
||||
#endif
|
||||
|
||||
}
|
||||
#if defined(WIN32)
|
||||
////////////////////////////////////////////////////////////////////
|
||||
@@ -192,8 +197,8 @@ void e57::GetSystemTimeFromGPSDateTime(double gpsTime, //!< GPS Date Time
|
||||
SYSTEMTIME& sysTim //!< Windows System Time
|
||||
)
|
||||
{
|
||||
gpsTime -= 15.; // Sub utc offset leap seconds
|
||||
gpsTime *= 10000000.; // convert to 100 nanoseconds;
|
||||
gpsTime -= 15.; // Sub utc offset leap seconds
|
||||
gpsTime *= 10000000.; // convert to 100 nanoseconds;
|
||||
|
||||
SYSTEMTIME gpsSystemTime = {1980, 1, 0, 6, 0, 0, 0, 0}; // GPS started in Jan. 6, 1980
|
||||
FILETIME gpsFileTime;
|
||||
@@ -233,7 +238,7 @@ double e57::GetGPSDateTimeFromUTC(int utc_year, //!< The year 1900-9999
|
||||
sysTim.wHour = utc_hour;
|
||||
sysTim.wMinute = utc_minute;
|
||||
sysTim.wSecond = (WORD)(floor(utc_seconds));
|
||||
sysTim.wMilliseconds = (WORD)((utc_seconds) * 1000);
|
||||
sysTim.wMilliseconds = (WORD)((utc_seconds)*1000);
|
||||
|
||||
return e57::GetGPSDateTimeFromSystemTime(sysTim);
|
||||
#else
|
||||
@@ -272,12 +277,12 @@ void e57::GetUTCFromGPSDateTime(double gpsTime, //!< GPS Date Time
|
||||
utc_seconds += sysTim.wMilliseconds / 1000;
|
||||
#else
|
||||
ignore(gpsTime);
|
||||
utc_Year = 2022; //!< The year 1900-9999
|
||||
utc_Month = 1; //!< The month 0-11
|
||||
utc_Day = 1; //!< The day 1-31
|
||||
utc_Hour = 0; //!< The hour 0-23
|
||||
utc_Minute = 0; //!< The minute 0-59
|
||||
utc_seconds = 0.0; //!< The seconds 0.0 - 59.999
|
||||
utc_Year = 2022; //!< The year 1900-9999
|
||||
utc_Month = 1; //!< The month 0-11
|
||||
utc_Day = 1; //!< The day 1-31
|
||||
utc_Hour = 0; //!< The hour 0-23
|
||||
utc_Minute = 0; //!< The minute 0-59
|
||||
utc_seconds = 0.0; //!< The seconds 0.0 - 59.999
|
||||
#endif
|
||||
}
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -28,13 +28,14 @@ target_link_libraries(time_conversion
|
||||
$<$<OR:$<C_COMPILER_ID:GNU>,$<C_COMPILER_ID:Clang>>:m>
|
||||
$<$<OR:$<C_COMPILER_ID:GNU>,$<C_COMPILER_ID:Clang>>:c>
|
||||
)
|
||||
target_clangformat_setup(time_conversion)
|
||||
|
||||
#
|
||||
# Build executables
|
||||
#
|
||||
list(APPEND TOOLS
|
||||
e57fields
|
||||
#e57unpack
|
||||
e57unpack
|
||||
e57validate
|
||||
e57xmldump
|
||||
)
|
||||
@@ -56,13 +57,14 @@ foreach(TOOL ${TOOLS})
|
||||
${Boost_INCLUDE_DIR}
|
||||
)
|
||||
|
||||
target_link_libraries(${TOOL}
|
||||
target_link_libraries(${TOOL}
|
||||
PRIVATE
|
||||
${PROJECT_NAME}
|
||||
${XML_LIBRARIES}
|
||||
${Boost_LIBRARIES}
|
||||
${CMAKE_THREAD_LIBS_INIT}
|
||||
)
|
||||
target_clangformat_setup(${TOOL})
|
||||
endforeach()
|
||||
|
||||
#
|
||||
@@ -95,12 +97,11 @@ target_link_libraries(las2e57
|
||||
${CMAKE_THREAD_LIBS_INIT}
|
||||
)
|
||||
|
||||
target_clangformat_setup(las2e57)
|
||||
|
||||
install(
|
||||
TARGETS
|
||||
e57fields
|
||||
e57xmldump
|
||||
#e57unpack
|
||||
e57validate
|
||||
${TOOLS}
|
||||
las2e57
|
||||
RUNTIME DESTINATION bin
|
||||
ARCHIVE DESTINATION lib
|
||||
|
||||
@@ -33,8 +33,8 @@
|
||||
#include <memory>
|
||||
#include <sstream>
|
||||
|
||||
#include <openE57/openE57.h>
|
||||
#include <openE57/impl/openE57Impl.h> //??? for exceptions, should be in separate file
|
||||
#include <openE57/openE57.h>
|
||||
|
||||
#include <boost/math/special_functions/fpclassify.hpp>
|
||||
using boost::math::fpclassify;
|
||||
|
||||
@@ -117,13 +117,13 @@ inline std::string toString(bool x) {std::ostringstream ss; ss << x; return(
|
||||
/// printMessage is called when messageCount is < 2 beyond allowed to allow suppression message to be printed.
|
||||
#define PRINT_MESSAGE(messageNumber, n, msg, cvp, index) \
|
||||
{ \
|
||||
if constexpr ((messageNumber) >= 0 && (messageNumber) < E57ValidatorOptions::MessageNumberCount) \
|
||||
if constexpr ((messageNumber) >= 0 && (messageNumber) < E57ValidatorOptions::MessageNumberCount) \
|
||||
{ \
|
||||
messageCount_[(messageNumber)]++; \
|
||||
if (messageCount_[(messageNumber)] < options_.messagesAllowed[(messageNumber)] + 2) \
|
||||
printMessage((messageNumber), (n), (msg), (cvp), (index)); \
|
||||
} \
|
||||
}
|
||||
}
|
||||
|
||||
//================================================================
|
||||
|
||||
@@ -1828,7 +1828,7 @@ void E57Validator::validatePointRecordContents(CompressedVectorNode cv, Structur
|
||||
BoundingBox indexBounds;
|
||||
if (data3D.isDefined("indexBounds"))
|
||||
{
|
||||
indexBounds = BoundingBox(StructureNode(data3D.get("indexBounds")), "indexBounds");
|
||||
indexBounds = BoundingBox(StructureNode(data3D.get("indexBounds")), "indexBounds");
|
||||
// cout << "indexBounds:" << endl; //???
|
||||
// indexBounds.dump(4); //???
|
||||
}
|
||||
@@ -1990,7 +1990,6 @@ void E57Validator::validatePointRecordContents(CompressedVectorNode cv, Structur
|
||||
{
|
||||
PRINT_MESSAGE(1000 /*???*/, proto.get("columnIndex"), "no line group for column number " + toString(lineIndex), &cv, blockStart + i);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -27,8 +27,8 @@
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
#include <iostream>
|
||||
#include <openE57/openE57.h>
|
||||
#include <openE57/impl/openE57Impl.h> //??? for exceptions, should be in separate file
|
||||
#include <openE57/openE57.h>
|
||||
using namespace e57;
|
||||
using namespace std;
|
||||
// using namespace std::tr1; //??? is this really needed, gives error on gcc <roland>
|
||||
|
||||
@@ -43,12 +43,12 @@ OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <math.h> /* for fmod() */
|
||||
#include <constants.h>
|
||||
#include <gnss_error.h>
|
||||
#include <time_conversion.h>
|
||||
#include <math.h> /* for fmod() */
|
||||
#include <sys/timeb.h>
|
||||
#include <time.h>
|
||||
#include <time_conversion.h>
|
||||
|
||||
#if 0
|
||||
# ifndef WIN32
|
||||
|
||||
Reference in New Issue
Block a user