├── CC ├── CMakeLists.txt ├── cmake │ ├── CGALSupport.cmake │ └── FindTBB.cmake ├── doc │ ├── .gitignore │ ├── CCLib_doxygen_file │ └── cclib_logo.png ├── include │ ├── AutoSegmentationTools.h │ ├── BoundingBox.h │ ├── CCConst.h │ ├── CCCoreLib.h │ ├── CCCoreLibExport.h │ ├── CCGeom.h │ ├── CCMiscTools.h │ ├── CCPlatform.h │ ├── CCShareable.h │ ├── CCToolbox.h │ ├── CCTypes.h │ ├── ChamferDistanceTransform.h │ ├── CloudSamplingTools.h │ ├── ConjugateGradient.h │ ├── Delaunay2dMesh.h │ ├── DgmOctree.h │ ├── DgmOctreeReferenceCloud.h │ ├── DistanceComputationTools.h │ ├── ErrorFunction.h │ ├── FastMarching.h │ ├── FastMarchingForPropagation.h │ ├── Garbage.h │ ├── GenericCloud.h │ ├── GenericDistribution.h │ ├── GenericIndexedCloud.h │ ├── GenericIndexedCloudPersist.h │ ├── GenericIndexedMesh.h │ ├── GenericMesh.h │ ├── GenericOctree.h │ ├── GenericProgressCallback.h │ ├── GenericTriangle.h │ ├── GeometricalAnalysisTools.h │ ├── Grid3D.h │ ├── Jacobi.h │ ├── KdTree.h │ ├── LocalModel.h │ ├── ManualSegmentationTools.h │ ├── MathTools.h │ ├── MeshSamplingTools.h │ ├── Neighbourhood.h │ ├── NormalDistribution.h │ ├── ParallelSort.h │ ├── PointCloud.h │ ├── PointCloudTpl.h │ ├── PointProjectionTools.h │ ├── Polyline.h │ ├── RayAndBox.h │ ├── ReferenceCloud.h │ ├── RegistrationTools.h │ ├── SaitoSquaredDistanceTransform.h │ ├── ScalarField.h │ ├── ScalarFieldTools.h │ ├── SimpleMesh.h │ ├── SimpleTriangle.h │ ├── SquareMatrix.h │ ├── StatisticalTestingTools.h │ ├── TrueKdTree.h │ └── WeibullDistribution.h └── src │ ├── AutoSegmentationTools.cpp │ ├── BoundingBox.cpp │ ├── CCMiscTools.cpp │ ├── CCShareable.cpp │ ├── ChamferDistanceTransform.cpp │ ├── Chi2Helper.h │ ├── CloudSamplingTools.cpp │ ├── Delaunay2dMesh.cpp │ ├── DgmOctree.cpp │ ├── DgmOctreeReferenceCloud.cpp │ ├── DistanceComputationTools.cpp │ ├── ErrorFunction.cpp │ ├── FastMarching.cpp │ ├── FastMarchingForPropagation.cpp │ ├── GeometricalAnalysisTools.cpp │ ├── KdTree.cpp │ ├── LocalModel.cpp │ ├── ManualSegmentationTools.cpp │ ├── MeshSamplingTools.cpp │ ├── Neighbourhood.cpp │ ├── NormalDistribution.cpp │ ├── NormalizedProgress.cpp │ ├── PointProjectionTools.cpp │ ├── Polyline.cpp │ ├── ReferenceCloud.cpp │ ├── RegistrationTools.cpp │ ├── SaitoSquaredDistanceTransform.cpp │ ├── ScalarField.cpp │ ├── ScalarFieldTools.cpp │ ├── SimpleMesh.cpp │ ├── StatisticalTestingTools.cpp │ ├── TrueKdTree.cpp │ └── WeibullDistribution.cpp ├── CCFbo ├── CMakeLists.txt ├── include │ ├── ccBilateralFilter.h │ ├── ccFrameBufferObject.h │ ├── ccGlFilter.h │ └── ccShader.h ├── shaders │ └── Bilateral │ │ ├── bilateral.frag │ │ └── bilateral.vert └── src │ ├── ccBilateralFilter.cpp │ ├── ccFrameBufferObject.cpp │ └── ccShader.cpp ├── CMakeLists.txt ├── README.md ├── ccViewer ├── Mac │ ├── CMakeLists.txt │ ├── ccViewer.plist │ └── cc_viewer_icon.icns ├── bin_other │ ├── license.txt │ └── start.bat ├── ccViewerApplication.cpp ├── ccViewerApplication.h ├── ccviewer.cpp ├── ccviewer.h ├── ccviewerlog.h ├── images │ ├── cc.png │ ├── cc_lightParamsIcon.png │ └── icon │ │ ├── cc_viewer_icon.ico │ │ └── cc_viewer_icon.rc ├── main.cpp └── ui_templates │ ├── ccviewer.ui │ └── ccviewerAbout.ui ├── common ├── CMakeLists.txt ├── ccApplicationBase.cpp ├── ccApplicationBase.h ├── ccCameraParamEditDlg.cpp ├── ccCameraParamEditDlg.h ├── ccDisplayOptionsDlg.cpp ├── ccDisplayOptionsDlg.h ├── ccOptions.cpp ├── ccOptions.h ├── ccOverlayDialog.cpp ├── ccOverlayDialog.h ├── ccPickOneElementDlg.cpp ├── ccPickOneElementDlg.h ├── ccPickingHub.cpp ├── ccPickingHub.h ├── ccPickingListener.h ├── ccPluginManager.cpp ├── ccPluginManager.h ├── ccQtHelpers.h ├── ccStereoModeDlg.cpp ├── ccStereoModeDlg.h ├── ccTranslationManager.cpp ├── ccTranslationManager.h └── ui_templates │ ├── cameraParamDlg.ui │ ├── displayOptionsDlg.ui │ ├── pickOneElementDlg.ui │ └── stereoModeDlg.ui ├── pclutils ├── CMakeLists.txt ├── PCLCloud.h ├── PCLConv.h ├── cc2sm.cpp ├── cc2sm.h ├── copy.cpp ├── copy.h ├── my_point_types.h ├── sm2cc.cpp └── sm2cc.h ├── qCC_db ├── CMakeLists.txt ├── cc2DLabel.cpp ├── cc2DLabel.h ├── cc2DViewportLabel.cpp ├── cc2DViewportLabel.h ├── cc2DViewportObject.cpp ├── cc2DViewportObject.h ├── ccAdvancedTypes.cpp ├── ccAdvancedTypes.h ├── ccArray.h ├── ccBBox.cpp ├── ccBBox.h ├── ccBasicTypes.h ├── ccBox.cpp ├── ccBox.h ├── ccCameraSensor.cpp ├── ccCameraSensor.h ├── ccChunk.h ├── ccClipBox.cpp ├── ccClipBox.h ├── ccColorRampShader.cpp ├── ccColorRampShader.h ├── ccColorScale.cpp ├── ccColorScale.h ├── ccColorScalesManager.cpp ├── ccColorScalesManager.h ├── ccColorTypes.cpp ├── ccColorTypes.h ├── ccCone.cpp ├── ccCone.h ├── ccCustomObject.h ├── ccCylinder.cpp ├── ccCylinder.h ├── ccDepthBuffer.cpp ├── ccDepthBuffer.h ├── ccDish.cpp ├── ccDish.h ├── ccDrawableObject.cpp ├── ccDrawableObject.h ├── ccExternalFactory.cpp ├── ccExternalFactory.h ├── ccExtru.cpp ├── ccExtru.h ├── ccFacet.cpp ├── ccFacet.h ├── ccFastMarchingForNormsDirection.cpp ├── ccFastMarchingForNormsDirection.h ├── ccFileUtils.h ├── ccFlags.h ├── ccFrustum.h ├── ccGBLSensor.cpp ├── ccGBLSensor.h ├── ccGLDrawContext.h ├── ccGLMatrix.h ├── ccGLMatrixTpl.h ├── ccGenericGLDisplay.cpp ├── ccGenericGLDisplay.h ├── ccGenericMesh.cpp ├── ccGenericMesh.h ├── ccGenericPointCloud.cpp ├── ccGenericPointCloud.h ├── ccGenericPrimitive.cpp ├── ccGenericPrimitive.h ├── ccGriddedTools.cpp ├── ccGriddedTools.h ├── ccHObject.cpp ├── ccHObject.h ├── ccHObjectCaster.cpp ├── ccHObjectCaster.h ├── ccImage.cpp ├── ccImage.h ├── ccIncludeGL.h ├── ccIndexedTransformation.cpp ├── ccIndexedTransformation.h ├── ccIndexedTransformationBuffer.cpp ├── ccIndexedTransformationBuffer.h ├── ccInteractor.h ├── ccKdTree.cpp ├── ccKdTree.h ├── ccLog.cpp ├── ccLog.h ├── ccMaterial.cpp ├── ccMaterial.h ├── ccMaterialSet.cpp ├── ccMaterialSet.h ├── ccMesh.cpp ├── ccMesh.h ├── ccMeshGroup.cpp ├── ccMeshGroup.h ├── ccMinimumSpanningTreeForNormsDirection.cpp ├── ccMinimumSpanningTreeForNormsDirection.h ├── ccNormalCompressor.cpp ├── ccNormalCompressor.h ├── ccNormalVectors.cpp ├── ccNormalVectors.h ├── ccObject.cpp ├── ccObject.h ├── ccOctree.cpp ├── ccOctree.h ├── ccOctreeProxy.cpp ├── ccOctreeProxy.h ├── ccOctreeSpinBox.cpp ├── ccOctreeSpinBox.h ├── ccPlanarEntityInterface.cpp ├── ccPlanarEntityInterface.h ├── ccPlane.cpp ├── ccPlane.h ├── ccPointCloud.cpp ├── ccPointCloud.h ├── ccPointCloudInterpolator.cpp ├── ccPointCloudInterpolator.h ├── ccPointCloudLOD.cpp ├── ccPointCloudLOD.h ├── ccPolyline.cpp ├── ccPolyline.h ├── ccProgressDialog.cpp ├── ccProgressDialog.h ├── ccQuadric.cpp ├── ccQuadric.h ├── ccRasterGrid.cpp ├── ccRasterGrid.h ├── ccScalarField.cpp ├── ccScalarField.h ├── ccSensor.cpp ├── ccSensor.h ├── ccSerializableObject.h ├── ccShiftedObject.cpp ├── ccShiftedObject.h ├── ccSingleton.h ├── ccSphere.cpp ├── ccSphere.h ├── ccSubMesh.cpp ├── ccSubMesh.h ├── ccTorus.cpp ├── ccTorus.h ├── ccWaveform.cpp ├── ccWaveform.h ├── doc │ ├── .gitignore │ ├── cc_logo_v2l_qt_db.png │ └── qCC_db_doxygen_file └── qCC_db.h ├── qCC_glWindow ├── CMakeLists.txt ├── ccGLUtils.cpp ├── ccGLUtils.h ├── ccGLWidget.h ├── ccGLWindow.cpp ├── ccGLWindow.h ├── ccGuiParameters.cpp ├── ccGuiParameters.h ├── ccRenderingTools.cpp ├── ccRenderingTools.h ├── doc │ ├── .gitignore │ ├── cc_logo_v2l_qt_gl.png │ └── qCC_gl_doxygen_file └── oculus │ └── ccOculus.h └── qCC_io ├── AsciiFilter.cpp ├── AsciiFilter.h ├── AsciiOpenDlg.cpp ├── AsciiOpenDlg.h ├── AsciiSaveDlg.cpp ├── AsciiSaveDlg.h ├── BinFilter.cpp ├── BinFilter.h ├── CMakeLists.txt ├── DepthMapFileFilter.cpp ├── DepthMapFileFilter.h ├── DxfFilter.cpp ├── DxfFilter.h ├── FileIO.cpp ├── FileIO.h ├── FileIOFilter.cpp ├── FileIOFilter.h ├── ImageFileFilter.cpp ├── ImageFileFilter.h ├── PlyFilter.cpp ├── PlyFilter.h ├── PlyOpenDlg.cpp ├── PlyOpenDlg.h ├── RasterGridFilter.cpp ├── RasterGridFilter.h ├── ShpDBFFields.cpp ├── ShpDBFFields.h ├── ShpFilter.cpp ├── ShpFilter.h ├── Tests ├── CMakeLists.txt ├── Data │ └── shp │ │ ├── line.shp │ │ ├── linem.shp │ │ ├── linez.shp │ │ ├── multi_pointz.shp │ │ ├── multipatch.shp │ │ ├── multipoint.shp │ │ ├── point_z.shp │ │ ├── polygon.shp │ │ └── polygon_z.shp ├── TestData.qrc ├── TestShpFilter.cpp └── TestShpFilter.h ├── ccGlobalShiftManager.cpp ├── ccGlobalShiftManager.h ├── ccShiftAndScaleCloudDlg.cpp ├── ccShiftAndScaleCloudDlg.h ├── doc ├── .gitignore ├── cc_logo_v2l_qt_io.png └── qCC_io_doxygen_file ├── qCC_io.h ├── rply.c ├── rply.h └── ui_templates ├── globalShiftAndScaleAboutDlg.ui ├── globalShiftAndScaleDlg.ui ├── importDBFFieldDlg.ui ├── openAsciiFileDlg.ui ├── openPlyFileDlg.ui ├── saveAsciiFileDlg.ui └── saveSHPFileDlg.ui /CC/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.0) 2 | 3 | # to compile CCLib only! (CMake implicitly imposes to declare a project before anything...) 4 | project( CC_CORE_LIB ) 5 | 6 | set(CMAKE_POSITION_INDEPENDENT_CODE ON) 7 | 8 | set(CMAKE_AUTOMOC ON) 9 | set(CMAKE_INCLUDE_CURRENT_DIR ON) 10 | 11 | # find qt5 components 12 | # find_package(Qt5 COMPONENTS OpenGL Widgets Core Gui PrintSupport Concurrent REQUIRED) 13 | find_package(Qt5Widgets REQUIRED) 14 | find_package(Qt5Core REQUIRED) 15 | find_package(Qt5Gui REQUIRED) 16 | find_package(Qt5PrintSupport REQUIRED) 17 | find_package(Qt5Concurrent REQUIRED) 18 | find_package(Qt5OpenGL REQUIRED) 19 | find_package(Qt5OpenGLExtensions REQUIRED) 20 | find_package(Qt5Svg REQUIRED) 21 | 22 | # ScalarType as float (default) or double 23 | option( OPTION_SCALAR_DOUBLE "Check to define ScalarType as double" OFF ) 24 | 25 | if ( OPTION_SCALAR_DOUBLE ) 26 | add_definitions( -DSCALAR_TYPE_DOUBLE ) 27 | set (USE_SCALAR_TYPE_DOUBLE ON PARENT_SCOPE) 28 | else() 29 | add_definitions( -DSCALAR_TYPE_FLOAT ) 30 | endif() 31 | 32 | if (COMPILE_CC_CORE_LIB_WITH_CGAL) 33 | include( cmake/CGALSupport.cmake ) 34 | endif() 35 | 36 | if (COMPILE_CC_CORE_LIB_WITH_TBB) 37 | include( cmake/FindTBB.cmake ) 38 | else() 39 | if (NOT WIN32) 40 | message( WARNING "CCLib configured without parallel algorithm capabilities - see COMPILE_CC_CORE_LIB_WITH_TBB" ) 41 | endif() 42 | endif() 43 | 44 | # Additional dependencies (only Qt in fact) 45 | if (COMPILE_CC_CORE_LIB_WITH_QT) 46 | #include( CMakeExternalLibs ) 47 | endif() 48 | 49 | include_directories( ${CMAKE_CURRENT_SOURCE_DIR}/include ) 50 | 51 | file( GLOB header_list include/*.h) 52 | file( GLOB source_list src/*.cpp src/*.h) 53 | 54 | if ( WIN32 ) 55 | # Add Qt5 natvis file 56 | if ( COMPILE_CC_CORE_LIB_WITH_QT ) 57 | list( APPEND header_list ${CMAKE_CURRENT_SOURCE_DIR}/../scripts/windows/qt5.natvis ) 58 | #message(${header_list}) 59 | endif() 60 | endif() 61 | 62 | #if (COMPILE_CC_CORE_LIB_SHARED) 63 | if (FALSE) 64 | #set( CMAKE_CXX_VISIBILITY_PRESET hidden ) 65 | #set( CMAKE_VISIBILITY_INLINES_HIDDEN 1 ) 66 | 67 | add_library( ${PROJECT_NAME} SHARED ${header_list} ${source_list} ) 68 | 69 | # Qt 70 | target_link_libraries(${PROJECT_NAME} Qt5::Core Qt5::Gui Qt5::Widgets Qt5::OpenGL) 71 | 72 | # Add custom preprocessor definitions 73 | target_compile_definitions( ${PROJECT_NAME} PRIVATE QCC_DB_LIBRARY_BUILD ) 74 | 75 | else() 76 | add_library( ${PROJECT_NAME} STATIC ${header_list} ${source_list} ) 77 | 78 | target_compile_definitions( ${PROJECT_NAME} PRIVATE CC_CORE_LIB_STATIC_DEFINE ) 79 | endif() 80 | 81 | # generate the export header file 82 | include( GenerateExportHeader ) 83 | 84 | generate_export_header( ${PROJECT_NAME} 85 | EXPORT_FILE_NAME ${CMAKE_CURRENT_SOURCE_DIR}/include/CCCoreLibExport.h 86 | EXPORT_MACRO_NAME CC_CORE_LIB_API 87 | ) -------------------------------------------------------------------------------- /CC/cmake/CGALSupport.cmake: -------------------------------------------------------------------------------- 1 | # ------------------------------------------------------------------------------ 2 | # CGAL+CMake support for CloudCompare 3 | # ------------------------------------------------------------------------------ 4 | 5 | FIND_PACKAGE( CGAL QUIET COMPONENTS Core ) # implies findGMP 6 | 7 | if (CGAL_FOUND) 8 | if(${CGAL_MAJOR_VERSION} LESS 4) 9 | message(SEND_ERROR "CC Lib requires at least CGAL 4.3") 10 | endif() 11 | if(${CGAL_MAJOR_VERSION} EQUAL 4 AND CGAL_MINOR_VERSION LESS 3) 12 | message(SEND_ERROR "CC Lib requires at least CGAL 4.3") 13 | endif() 14 | 15 | # We need to get rid of CGAL CXX flags 16 | set(CGAL_DONT_OVERRIDE_CMAKE_FLAGS ON CACHE INTERNAL "override CGAL flags" FORCE) 17 | set(CGAL_DO_NOT_WARN_ABOUT_CMAKE_BUILD_TYPE TRUE CACHE INTERNAL "turn off warning") 18 | 19 | include( ${CGAL_USE_FILE} ) 20 | include_directories(${CGAL_INCLUDE_DIR}) 21 | 22 | # Take care of GMP and MPFR DLLs on Windows! 23 | if( WIN32 ) 24 | # message(${GMP_LIBRARIES}) 25 | list(GET GMP_LIBRARIES 0 FIRST_GMP_LIB_FILE) 26 | get_filename_component(GMP_LIB_FOLDER ${FIRST_GMP_LIB_FILE} DIRECTORY) 27 | # message(${GMP_LIB_FOLDER}) 28 | 29 | file( GLOB GMP_DLL_FILES ${GMP_LIB_FOLDER}/*.dll ) 30 | foreach( dest ${INSTALL_DESTINATIONS} ) 31 | copy_files( "${GMP_DLL_FILES}" ${dest} ) # Mind the quotes! 32 | endforeach() 33 | endif() 34 | 35 | else() 36 | 37 | message(SEND_ERROR "Could not find CGAL") 38 | 39 | endif() 40 | -------------------------------------------------------------------------------- /CC/doc/.gitignore: -------------------------------------------------------------------------------- 1 | /html/ 2 | -------------------------------------------------------------------------------- /CC/doc/cclib_logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yaoli1992/ccCloudViewer/94211298a3b0382f816c7c2d8a803eb5dd22d305/CC/doc/cclib_logo.png -------------------------------------------------------------------------------- /CC/include/CCCoreLib.h: -------------------------------------------------------------------------------- 1 | //########################################################################## 2 | //# # 3 | //# CCLIB # 4 | //# # 5 | //# This program is free software; you can redistribute it and/or modify # 6 | //# it under the terms of the GNU Library General Public License as # 7 | //# published by the Free Software Foundation; version 2 or later of the # 8 | //# License. # 9 | //# # 10 | //# This program is distributed in the hope that it will be useful, # 11 | //# but WITHOUT ANY WARRANTY; without even the implied warranty of # 12 | //# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # 13 | //# GNU General Public License for more details. # 14 | //# # 15 | //# COPYRIGHT: EDF R&D / TELECOM ParisTech (ENST-TSI) # 16 | //# # 17 | //########################################################################## 18 | 19 | #ifndef CC_CORE_LIB_HEADER 20 | #define CC_CORE_LIB_HEADER 21 | 22 | #ifdef _MSC_VER 23 | //To get rid of the really annoying warnings about template class exportation 24 | #pragma warning( disable: 4251 ) 25 | #pragma warning( disable: 4530 ) 26 | #endif 27 | 28 | // this file is generated by cmake 29 | #include "CCCoreLibExport.h" 30 | 31 | #endif //CC_CORE_LIB_HEADER -------------------------------------------------------------------------------- /CC/include/CCCoreLibExport.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef CC_CORE_LIB_API_H 3 | #define CC_CORE_LIB_API_H 4 | 5 | #ifdef CC_CORE_LIB_STATIC_DEFINE 6 | # define CC_CORE_LIB_API 7 | # define CC_CORE_LIB_NO_EXPORT 8 | #else 9 | # ifndef CC_CORE_LIB_API 10 | # ifdef CC_CORE_LIB_EXPORTS 11 | /* We are building this library */ 12 | # define CC_CORE_LIB_API 13 | # else 14 | /* We are using this library */ 15 | # define CC_CORE_LIB_API 16 | # endif 17 | # endif 18 | 19 | # ifndef CC_CORE_LIB_NO_EXPORT 20 | # define CC_CORE_LIB_NO_EXPORT 21 | # endif 22 | #endif 23 | 24 | #ifndef CC_CORE_LIB_DEPRECATED 25 | # define CC_CORE_LIB_DEPRECATED __declspec(deprecated) 26 | #endif 27 | 28 | #ifndef CC_CORE_LIB_DEPRECATED_EXPORT 29 | # define CC_CORE_LIB_DEPRECATED_EXPORT CC_CORE_LIB_API CC_CORE_LIB_DEPRECATED 30 | #endif 31 | 32 | #ifndef CC_CORE_LIB_DEPRECATED_NO_EXPORT 33 | # define CC_CORE_LIB_DEPRECATED_NO_EXPORT CC_CORE_LIB_NO_EXPORT CC_CORE_LIB_DEPRECATED 34 | #endif 35 | 36 | #if 0 /* DEFINE_NO_DEPRECATED */ 37 | # ifndef CC_CORE_LIB_NO_DEPRECATED 38 | # define CC_CORE_LIB_NO_DEPRECATED 39 | # endif 40 | #endif 41 | 42 | #endif /* CC_CORE_LIB_API_H */ 43 | -------------------------------------------------------------------------------- /CC/include/CCPlatform.h: -------------------------------------------------------------------------------- 1 | //########################################################################## 2 | //# # 3 | //# CCLIB # 4 | //# # 5 | //# This program is free software; you can redistribute it and/or modify # 6 | //# it under the terms of the GNU Library General Public License as # 7 | //# published by the Free Software Foundation; version 2 or later of the # 8 | //# License. # 9 | //# # 10 | //# This program is distributed in the hope that it will be useful, # 11 | //# but WITHOUT ANY WARRANTY; without even the implied warranty of # 12 | //# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # 13 | //# GNU General Public License for more details. # 14 | //# # 15 | //# COPYRIGHT: EDF R&D / TELECOM ParisTech (ENST-TSI) # 16 | //# # 17 | //########################################################################## 18 | 19 | #ifndef CC_PLATFORM_HEADER 20 | #define CC_PLATFORM_HEADER 21 | 22 | //Defines the following macros (depending on the compilation platform/settings) 23 | // - CC_WINDOWS / CC_MAC_OS / CC_LINUX 24 | // - CC_ENV32 / CC_ENV64 25 | #if defined(_WIN32) || defined(_WIN64) || defined(WIN32) 26 | #define CC_WINDOWS 27 | #if defined(_WIN64) 28 | #define CC_ENV_64 29 | #else 30 | #define CC_ENV_32 31 | #endif 32 | #else 33 | #if defined(__APPLE__) 34 | #define CC_MAC_OS 35 | #else 36 | #define CC_LINUX 37 | #endif 38 | #if defined(__x86_64__) || defined(__ppc64__) 39 | #define CC_ENV_64 40 | #else 41 | #define CC_ENV_32 42 | #endif 43 | #endif 44 | 45 | 46 | #endif //CC_PLATFORM_HEADER 47 | -------------------------------------------------------------------------------- /CC/include/CCShareable.h: -------------------------------------------------------------------------------- 1 | //########################################################################## 2 | //# # 3 | //# CCLIB # 4 | //# # 5 | //# This program is free software; you can redistribute it and/or modify # 6 | //# it under the terms of the GNU Library General Public License as # 7 | //# published by the Free Software Foundation; version 2 or later of the # 8 | //# License. # 9 | //# # 10 | //# This program is distributed in the hope that it will be useful, # 11 | //# but WITHOUT ANY WARRANTY; without even the implied warranty of # 12 | //# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # 13 | //# GNU General Public License for more details. # 14 | //# # 15 | //# COPYRIGHT: EDF R&D / TELECOM ParisTech (ENST-TSI) # 16 | //# # 17 | //########################################################################## 18 | 19 | #ifndef CC_SHAREABLE_HEADER 20 | #define CC_SHAREABLE_HEADER 21 | 22 | //Local 23 | #include "CCCoreLib.h" 24 | 25 | //system 26 | #include 27 | 28 | //Activate shared objects tracking (for debug purposes) 29 | #ifdef CC_DEBUG 30 | //#define CC_TRACK_ALIVE_SHARED_OBJECTS 31 | #endif 32 | 33 | //CCShareable object (with counter) 34 | class CC_CORE_LIB_API CCShareable 35 | { 36 | public: 37 | 38 | //! Default constructor 39 | CCShareable(); 40 | 41 | //! Increase counter 42 | /** Should be called when this object is 'attached' to another one. 43 | **/ 44 | virtual void link(); 45 | 46 | //! Decrease counter and deletes object when 0 47 | /** Should be called when this object is 'detached'. 48 | **/ 49 | virtual void release(); 50 | 51 | //! Returns the current link count 52 | /** \return current link count 53 | **/ 54 | inline virtual unsigned getLinkCount() const { return m_linkCount; } 55 | 56 | #ifdef CC_TRACK_ALIVE_SHARED_OBJECTS 57 | //! Get alive shared objects count 58 | static unsigned GetAliveCount(); 59 | #endif 60 | 61 | protected: 62 | 63 | //! Destructor 64 | /** private to avoid deletion with 'delete' operator 65 | **/ 66 | virtual ~CCShareable(); 67 | 68 | //! Links counter 69 | unsigned m_linkCount; 70 | }; 71 | 72 | #endif //CC_SHAREABLE_HEADER 73 | -------------------------------------------------------------------------------- /CC/include/CCToolbox.h: -------------------------------------------------------------------------------- 1 | //########################################################################## 2 | //# # 3 | //# CCLIB # 4 | //# # 5 | //# This program is free software; you can redistribute it and/or modify # 6 | //# it under the terms of the GNU Library General Public License as # 7 | //# published by the Free Software Foundation; version 2 or later of the # 8 | //# License. # 9 | //# # 10 | //# This program is distributed in the hope that it will be useful, # 11 | //# but WITHOUT ANY WARRANTY; without even the implied warranty of # 12 | //# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # 13 | //# GNU General Public License for more details. # 14 | //# # 15 | //# COPYRIGHT: EDF R&D / TELECOM ParisTech (ENST-TSI) # 16 | //# # 17 | //########################################################################## 18 | 19 | #ifndef CC_TOOLBOX_HEADER 20 | #define CC_TOOLBOX_HEADER 21 | 22 | //Local 23 | #include "CCCoreLib.h" 24 | 25 | namespace CCLib 26 | { 27 | //! Empty class - for classification purpose only 28 | class CC_CORE_LIB_API CCToolbox {}; 29 | 30 | } //namespace CCLib 31 | 32 | #endif //CC_TOOLBOX_HEADER 33 | -------------------------------------------------------------------------------- /CC/include/CCTypes.h: -------------------------------------------------------------------------------- 1 | //########################################################################## 2 | //# # 3 | //# CCLIB # 4 | //# # 5 | //# This program is free software; you can redistribute it and/or modify # 6 | //# it under the terms of the GNU Library General Public License as # 7 | //# published by the Free Software Foundation; version 2 or later of the # 8 | //# License. # 9 | //# # 10 | //# This program is distributed in the hope that it will be useful, # 11 | //# but WITHOUT ANY WARRANTY; without even the implied warranty of # 12 | //# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # 13 | //# GNU General Public License for more details. # 14 | //# # 15 | //# COPYRIGHT: EDF R&D / TELECOM ParisTech (ENST-TSI) # 16 | //# # 17 | //########################################################################## 18 | 19 | #ifndef CC_TYPES_HEADER 20 | #define CC_TYPES_HEADER 21 | 22 | //! Type of the coordinates of a (N-D) point 23 | using PointCoordinateType = float; 24 | 25 | #define SCALAR_TYPE_DOUBLE 26 | 27 | //! Type of a single scalar field value 28 | #if defined SCALAR_TYPE_DOUBLE 29 | using ScalarType = double; 30 | #elif defined SCALAR_TYPE_FLOAT 31 | using ScalarType = float; 32 | #else 33 | static_assert(false, "type for ScalarType has not been declared"); 34 | #endif //SCALAR_TYPE_DOUBLE 35 | 36 | #endif //CC_TYPES_HEADER 37 | -------------------------------------------------------------------------------- /CC/include/ChamferDistanceTransform.h: -------------------------------------------------------------------------------- 1 | //########################################################################## 2 | //# # 3 | //# CCLIB # 4 | //# # 5 | //# This program is free software; you can redistribute it and/or modify # 6 | //# it under the terms of the GNU Library General Public License as # 7 | //# published by the Free Software Foundation; version 2 or later of the # 8 | //# License. # 9 | //# # 10 | //# This program is distributed in the hope that it will be useful, # 11 | //# but WITHOUT ANY WARRANTY; without even the implied warranty of # 12 | //# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # 13 | //# GNU General Public License for more details. # 14 | //# # 15 | //# COPYRIGHT: EDF R&D / TELECOM ParisTech (ENST-TSI) # 16 | //# # 17 | //########################################################################## 18 | 19 | #ifndef CHAMFER_DISTANCE_TRANSFORM_HEADER 20 | #define CHAMFER_DISTANCE_TRANSFORM_HEADER 21 | 22 | //Local 23 | #include "Grid3D.h" 24 | #include "MathTools.h" 25 | 26 | namespace CCLib 27 | { 28 | 29 | class GenericProgressCallback; 30 | class NormalizedProgress; 31 | 32 | //! Class to compute a Chamfer distance field on a 3D grid 33 | /** Internally we use 'unsigned short' value to limit memory consumption. 34 | For computational reasons, the max computable 'distance' is 0xFAFA = 64250. 35 | **/ 36 | class CC_CORE_LIB_API ChamferDistanceTransform : public Grid3D, public MathTools 37 | { 38 | 39 | public: 40 | 41 | //! Max possible 'distance' 42 | /** \warning Never pass a 'constant initializer' by reference 43 | **/ 44 | static const unsigned short MAX_DIST = 0xFAFA; 45 | 46 | //! Initializes the grid 47 | /** 'Zero' cells must be initialized with setValue(0). 48 | The grid must be explicitelty initialized prior to any action. 49 | \return true if the initialization succeeded 50 | **/ 51 | inline bool init(const Tuple3ui& gridSize) 52 | { 53 | return Grid3D::init(gridSize.x, gridSize.y, gridSize.z, 1, MAX_DIST); 54 | } 55 | 56 | //! Computes the Chamfer distance on the whole grid 57 | /** Propagates the distances on the whole grid. The 'zeros' should 58 | have already been initialized before calling this method (see 59 | ChamferDistanceTransform::setZero). 60 | \param type the Chamfer distance type 61 | \param progressCb the client application can get some notification of the process 62 | progress through this callback mechanism (see GenericProgressCallback) 63 | \return max distance (or -1 if an error occurred) 64 | **/ 65 | int propagateDistance(CC_CHAMFER_DISTANCE_TYPE type, GenericProgressCallback* progressCb = nullptr); 66 | 67 | }; 68 | 69 | } 70 | 71 | #endif //CHAMFER_DISTANCE_TRANSFORM_HEADER 72 | -------------------------------------------------------------------------------- /CC/include/ErrorFunction.h: -------------------------------------------------------------------------------- 1 | //########################################################################## 2 | //# # 3 | //# CCLIB # 4 | //# # 5 | //# This program is free software; you can redistribute it and/or modify # 6 | //# it under the terms of the GNU Library General Public License as # 7 | //# published by the Free Software Foundation; version 2 or later of the # 8 | //# License. # 9 | //# # 10 | //# This program is distributed in the hope that it will be useful, # 11 | //# but WITHOUT ANY WARRANTY; without even the implied warranty of # 12 | //# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # 13 | //# GNU General Public License for more details. # 14 | //# # 15 | //# COPYRIGHT: EDF R&D / TELECOM ParisTech (ENST-TSI) # 16 | //# # 17 | //########################################################################## 18 | 19 | #ifndef ERROR_FUNCTION_HEADER 20 | #define ERROR_FUNCTION_HEADER 21 | 22 | //Local 23 | #include "CCCoreLib.h" 24 | #include "MathTools.h" 25 | 26 | namespace CCLib 27 | { 28 | 29 | //! Relative error for Error Function computation 30 | /** You can adjust it to trade off between accuracy and speed 31 | but don't ask for more than 15 figures (assuming usual 52 bit mantissa 32 | in a double). Example: 1E-12 <--> calculate 12 significant figures 33 | **/ 34 | static const double c_erfRelativeError = 1e-12; 35 | 36 | //! A class to compute the Error function (erf) 37 | /** See for example http://mathworld.wolfram.com/Erf.html. 38 | Most of the code comes from "erf.cpp" by Steve Strand 39 | (29-Jan-04). 40 | **/ 41 | class CC_CORE_LIB_API ErrorFunction : MathTools 42 | { 43 | public: 44 | 45 | 46 | //! Computes erfc(x) 47 | /** erfc(x) = 2/sqrt(pi)*integral(exp(-t^2),t,x,inf) 48 | = exp(-x^2)/sqrt(pi) * [1/x+ (1/2)/x+ (2/2)/x+ (3/2)/x+ (4/2)/x+ ...] 49 | = 1-erf(x) 50 | (expression inside [] is a continued fraction so '+' means add to denominator 51 | only). 52 | \param x a real variable 53 | \return erfc(x) 54 | **/ 55 | static double erfc(double x); 56 | 57 | //! Computes erf(x) 58 | /** erf(x) = 2/sqrt(pi)*integral(exp(-t^2),t,0,x) 59 | = 2/sqrt(pi)*[x - x^3/3 + x^5/5*2! - x^7/7*3! + ...] 60 | = 1-erfc(x) 61 | \param x a real variable 62 | \return erf(x) 63 | **/ 64 | static double erf(double x); 65 | }; 66 | 67 | } 68 | 69 | #endif //ERROR_FUNCTION_HEADER 70 | -------------------------------------------------------------------------------- /CC/include/GenericIndexedCloud.h: -------------------------------------------------------------------------------- 1 | //########################################################################## 2 | //# # 3 | //# CCLIB # 4 | //# # 5 | //# This program is free software; you can redistribute it and/or modify # 6 | //# it under the terms of the GNU Library General Public License as # 7 | //# published by the Free Software Foundation; version 2 or later of the # 8 | //# License. # 9 | //# # 10 | //# This program is distributed in the hope that it will be useful, # 11 | //# but WITHOUT ANY WARRANTY; without even the implied warranty of # 12 | //# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # 13 | //# GNU General Public License for more details. # 14 | //# # 15 | //# COPYRIGHT: EDF R&D / TELECOM ParisTech (ENST-TSI) # 16 | //# # 17 | //########################################################################## 18 | 19 | #ifndef GENERIC_INDEXED_CLOUD_HEADER 20 | #define GENERIC_INDEXED_CLOUD_HEADER 21 | 22 | //Local 23 | #include "GenericCloud.h" 24 | 25 | namespace CCLib 26 | { 27 | 28 | //! A generic 3D point cloud with index-based point access 29 | /** Implements the GenericCloud interface. 30 | **/ 31 | class CC_CORE_LIB_API GenericIndexedCloud : virtual public GenericCloud 32 | { 33 | 34 | public: 35 | //! Default destructor 36 | ~GenericIndexedCloud() override = default; 37 | 38 | //! Returns the ith point 39 | /** Virtual method to request a point with a specific index. 40 | WARNINGS: 41 | - the returned object may not be persistent! 42 | - THIS METHOD MAY NOT BE COMPATIBLE WITH PARALLEL STRATEGIES 43 | (see the DgmOctree::executeFunctionForAllCellsAtLevel_MT and 44 | DgmOctree::executeFunctionForAllCellsAtStartingLevel_MT methods). 45 | Consider the other version of getPoint instead or the 46 | GenericIndexedCloudPersist class. 47 | \param index of the requested point (between 0 and the cloud size minus 1) 48 | \return the requested point (undefined behavior if index is invalid) 49 | **/ 50 | virtual const CCVector3* getPoint(unsigned index) const = 0; 51 | 52 | //! Returns the ith point 53 | /** Virtual method to request a point with a specific index. 54 | Index must be valid (undefined behavior if index is invalid) 55 | \param index of the requested point (between 0 and the cloud size minus 1) 56 | \param P output point 57 | **/ 58 | virtual void getPoint(unsigned index, CCVector3& P) const = 0; 59 | }; 60 | 61 | } 62 | 63 | #endif //GENERIC_INDEXED_CLOUD_HEADER 64 | -------------------------------------------------------------------------------- /CC/include/GenericIndexedCloudPersist.h: -------------------------------------------------------------------------------- 1 | //########################################################################## 2 | //# # 3 | //# CCLIB # 4 | //# # 5 | //# This program is free software; you can redistribute it and/or modify # 6 | //# it under the terms of the GNU Library General Public License as # 7 | //# published by the Free Software Foundation; version 2 or later of the # 8 | //# License. # 9 | //# # 10 | //# This program is distributed in the hope that it will be useful, # 11 | //# but WITHOUT ANY WARRANTY; without even the implied warranty of # 12 | //# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # 13 | //# GNU General Public License for more details. # 14 | //# # 15 | //# COPYRIGHT: EDF R&D / TELECOM ParisTech (ENST-TSI) # 16 | //# # 17 | //########################################################################## 18 | 19 | #ifndef GENERIC_INDEXED_PERSIST_CLOUD_HEADER 20 | #define GENERIC_INDEXED_PERSIST_CLOUD_HEADER 21 | 22 | //Local 23 | #include "GenericIndexedCloud.h" 24 | 25 | namespace CCLib 26 | { 27 | 28 | //! A generic 3D point cloud with index-based and presistent access to points 29 | /** Implements the GenericIndexedCloud interface. 30 | **/ 31 | class CC_CORE_LIB_API GenericIndexedCloudPersist : virtual public GenericIndexedCloud 32 | { 33 | public: 34 | //! Default constructor 35 | GenericIndexedCloudPersist() : GenericIndexedCloud() {} 36 | 37 | //! Mock constructor for compatibility with the PointCloudTpl interface 38 | /** \warning Parameters are simply ignored 39 | \param name ignored 40 | \param ID ignored 41 | **/ 42 | GenericIndexedCloudPersist(const char* name, unsigned ID) : GenericIndexedCloud() { /* input parameters are ignored */ } 43 | 44 | 45 | //! Default destructor 46 | ~GenericIndexedCloudPersist() override = default; 47 | 48 | //! Returns the ith point as a persistent pointer 49 | /** Virtual method to request a point with a specific index. 50 | WARNING: the returned object MUST be persistent in order 51 | to be compatible with parallel strategies! 52 | \param index of the requested point (between 0 and the cloud size minus 1) 53 | \return the requested point (or 0 if index is invalid) 54 | **/ 55 | virtual const CCVector3* getPointPersistentPtr(unsigned index) const = 0; 56 | }; 57 | 58 | } 59 | 60 | #endif //GENERIC_INDEXED_PERSIST_CLOUD_HEADER 61 | -------------------------------------------------------------------------------- /CC/include/GenericOctree.h: -------------------------------------------------------------------------------- 1 | //########################################################################## 2 | //# # 3 | //# CCLIB # 4 | //# # 5 | //# This program is free software; you can redistribute it and/or modify # 6 | //# it under the terms of the GNU Library General Public License as # 7 | //# published by the Free Software Foundation; version 2 or later of the # 8 | //# License. # 9 | //# # 10 | //# This program is distributed in the hope that it will be useful, # 11 | //# but WITHOUT ANY WARRANTY; without even the implied warranty of # 12 | //# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # 13 | //# GNU General Public License for more details. # 14 | //# # 15 | //# COPYRIGHT: EDF R&D / TELECOM ParisTech (ENST-TSI) # 16 | //# # 17 | //########################################################################## 18 | 19 | #ifndef GENERIC_OCTREE_HEADER 20 | #define GENERIC_OCTREE_HEADER 21 | 22 | //Local 23 | #include "CCGeom.h" 24 | 25 | namespace CCLib 26 | { 27 | 28 | //! A generic octree interface for data communication between library and client applications 29 | class CC_CORE_LIB_API GenericOctree 30 | { 31 | public: 32 | 33 | //! Default destructor 34 | virtual ~GenericOctree() = default; 35 | }; 36 | 37 | } 38 | 39 | #endif //GENERIC_OCTREE_HEADER 40 | -------------------------------------------------------------------------------- /CC/include/GenericTriangle.h: -------------------------------------------------------------------------------- 1 | //########################################################################## 2 | //# # 3 | //# CCLIB # 4 | //# # 5 | //# This program is free software; you can redistribute it and/or modify # 6 | //# it under the terms of the GNU Library General Public License as # 7 | //# published by the Free Software Foundation; version 2 or later of the # 8 | //# License. # 9 | //# # 10 | //# This program is distributed in the hope that it will be useful, # 11 | //# but WITHOUT ANY WARRANTY; without even the implied warranty of # 12 | //# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # 13 | //# GNU General Public License for more details. # 14 | //# # 15 | //# COPYRIGHT: EDF R&D / TELECOM ParisTech (ENST-TSI) # 16 | //# # 17 | //########################################################################## 18 | 19 | #ifndef GENERIC_TRIANGLE_HEADER 20 | #define GENERIC_TRIANGLE_HEADER 21 | 22 | //Local 23 | #include "CCGeom.h" 24 | 25 | namespace CCLib 26 | { 27 | 28 | //! A generic triangle interface 29 | /** Returns (temporary) references to each vertex. 30 | **/ 31 | class CC_CORE_LIB_API GenericTriangle 32 | { 33 | public: 34 | 35 | //! Default destructor 36 | virtual ~GenericTriangle() = default; 37 | 38 | //! Returns the first vertex (A) 39 | virtual const CCVector3* _getA() const = 0; 40 | 41 | //! Returns the second vertex (B) 42 | virtual const CCVector3* _getB() const = 0; 43 | 44 | //! Returns the third vertex (C) 45 | virtual const CCVector3* _getC() const = 0; 46 | }; 47 | 48 | } 49 | 50 | #endif //GENERIC_TRIANGLE_HEADER 51 | -------------------------------------------------------------------------------- /CC/include/LocalModel.h: -------------------------------------------------------------------------------- 1 | //########################################################################## 2 | //# # 3 | //# CCLIB # 4 | //# # 5 | //# This program is free software; you can redistribute it and/or modify # 6 | //# it under the terms of the GNU Library General Public License as # 7 | //# published by the Free Software Foundation; version 2 or later of the # 8 | //# License. # 9 | //# # 10 | //# This program is distributed in the hope that it will be useful, # 11 | //# but WITHOUT ANY WARRANTY; without even the implied warranty of # 12 | //# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # 13 | //# GNU General Public License for more details. # 14 | //# # 15 | //# COPYRIGHT: EDF R&D / TELECOM ParisTech (ENST-TSI) # 16 | //# # 17 | //########################################################################## 18 | 19 | #ifndef LOCAL_MODEL_HEADER 20 | #define LOCAL_MODEL_HEADER 21 | 22 | #include "Neighbourhood.h" 23 | 24 | namespace CCLib 25 | { 26 | 27 | //! Local modelization (generic interface) 28 | /** Local surface approximation of a point cloud 29 | **/ 30 | class LocalModel 31 | { 32 | public: 33 | 34 | //! Factory 35 | /** \param type the model type 36 | \param subset (small) set of points from which to compute the local model 37 | \param center model "center" 38 | \param squaredRadius model max radius (squared) 39 | **/ 40 | static LocalModel* New( CC_LOCAL_MODEL_TYPES type, 41 | Neighbourhood& subset, 42 | const CCVector3 ¢er, 43 | PointCoordinateType squaredRadius); 44 | 45 | //! Destructor 46 | virtual ~LocalModel() = default; 47 | 48 | //! Returns the model type 49 | virtual CC_LOCAL_MODEL_TYPES getType() const = 0; 50 | 51 | //! Returns the model center 52 | inline const CCVector3& getCenter() const { return m_modelCenter; } 53 | 54 | //! Returns the model max radius (squared) 55 | inline PointCoordinateType getSquareSize() const { return m_squaredRadius; } 56 | 57 | //! Compute the (unsigned) distance between a 3D point and this model 58 | /** \param[in] P the query point 59 | \param[out] nearestPoint returns the nearest point (optional) 60 | \return the (unsigned) distance (or NAN_VALUE if the computation failed) 61 | **/ 62 | virtual ScalarType computeDistanceFromModelToPoint(const CCVector3* P, CCVector3* nearestPoint = nullptr) const = 0; 63 | 64 | protected: 65 | 66 | //! Constructor 67 | /** \param center model "center" 68 | \param squaredRadius model max "radius" (squared) 69 | **/ 70 | LocalModel(const CCVector3 ¢er, PointCoordinateType squaredRadius); 71 | 72 | //! Center 73 | CCVector3 m_modelCenter; 74 | 75 | //! Max radius (squared) 76 | PointCoordinateType m_squaredRadius; 77 | }; 78 | 79 | } 80 | 81 | #endif //LOCAL_MODEL_HEADER 82 | -------------------------------------------------------------------------------- /CC/include/MathTools.h: -------------------------------------------------------------------------------- 1 | //########################################################################## 2 | //# # 3 | //# CCLIB # 4 | //# # 5 | //# This program is free software; you can redistribute it and/or modify # 6 | //# it under the terms of the GNU Library General Public License as # 7 | //# published by the Free Software Foundation; version 2 or later of the # 8 | //# License. # 9 | //# # 10 | //# This program is distributed in the hope that it will be useful, # 11 | //# but WITHOUT ANY WARRANTY; without even the implied warranty of # 12 | //# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # 13 | //# GNU General Public License for more details. # 14 | //# # 15 | //# COPYRIGHT: EDF R&D / TELECOM ParisTech (ENST-TSI) # 16 | //# # 17 | //########################################################################## 18 | 19 | #ifndef MATH_TOOLS_HEADER 20 | #define MATH_TOOLS_HEADER 21 | 22 | //Local 23 | #include "CCTypes.h" 24 | 25 | namespace CCLib 26 | { 27 | //! Empty class - for classification purpose only 28 | class MathTools {}; 29 | } 30 | 31 | #endif //MATH_TOOLS_HEADER 32 | -------------------------------------------------------------------------------- /CC/include/ParallelSort.h: -------------------------------------------------------------------------------- 1 | //########################################################################## 2 | //# # 3 | //# CLOUDCOMPARE # 4 | //# # 5 | //# This program is free software; you can redistribute it and/or modify # 6 | //# it under the terms of the GNU General Public License as published by # 7 | //# the Free Software Foundation; version 2 or later of the License. # 8 | //# # 9 | //# This program is distributed in the hope that it will be useful, # 10 | //# but WITHOUT ANY WARRANTY; without even the implied warranty of # 11 | //# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # 12 | //# GNU General Public License for more details. # 13 | //# # 14 | //# COPYRIGHT: CloudCompare project # 15 | //# # 16 | //########################################################################## 17 | 18 | #ifndef PARALLEL_SORT_HEADER 19 | #define PARALLEL_SORT_HEADER 20 | 21 | #ifdef ParallelSort 22 | #undef ParallelSort 23 | #pragma message "Replacing preprocessor symbol 'ParallelSort' with the one defined in Parallel.h" 24 | #endif 25 | 26 | #if defined(_MSC_VER) && (_MSC_VER >= 1800) 27 | 28 | //Parallel Patterns Library (for parallel sort) 29 | #include 30 | 31 | #define ParallelSort Concurrency::parallel_sort 32 | 33 | #elif USE_TBB 34 | 35 | #include 36 | 37 | #define ParallelSort tbb::parallel_sort 38 | 39 | #else 40 | 41 | #include 42 | 43 | #define ParallelSort std::sort 44 | 45 | #endif 46 | 47 | #endif 48 | -------------------------------------------------------------------------------- /CC/include/PointCloud.h: -------------------------------------------------------------------------------- 1 | //########################################################################## 2 | //# # 3 | //# CCLIB # 4 | //# # 5 | //# This program is free software; you can redistribute it and/or modify # 6 | //# it under the terms of the GNU Library General Public License as # 7 | //# published by the Free Software Foundation; version 2 or later of the # 8 | //# License. # 9 | //# # 10 | //# This program is distributed in the hope that it will be useful, # 11 | //# but WITHOUT ANY WARRANTY; without even the implied warranty of # 12 | //# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # 13 | //# GNU General Public License for more details. # 14 | //# # 15 | //# COPYRIGHT: EDF R&D / TELECOM ParisTech (ENST-TSI) # 16 | //# # 17 | //########################################################################## 18 | 19 | #ifndef CC_LIB_POINT_CLOUD_HEADER 20 | #define CC_LIB_POINT_CLOUD_HEADER 21 | 22 | //Local 23 | #include "GenericIndexedCloudPersist.h" 24 | #include "PointCloudTpl.h" 25 | 26 | namespace CCLib 27 | { 28 | //! A storage-efficient point cloud structure that can also handle an unlimited number of scalar fields 29 | class CC_CORE_LIB_API PointCloud : public PointCloudTpl 30 | { 31 | public: 32 | //! Default constructor 33 | PointCloud() = default; 34 | 35 | //! Default destructor 36 | ~PointCloud() override = default; 37 | }; 38 | } 39 | 40 | #endif //CC_LIB_POINT_CLOUD_HEADER 41 | -------------------------------------------------------------------------------- /CC/include/Polyline.h: -------------------------------------------------------------------------------- 1 | //########################################################################## 2 | //# # 3 | //# CCLIB # 4 | //# # 5 | //# This program is free software; you can redistribute it and/or modify # 6 | //# it under the terms of the GNU Library General Public License as # 7 | //# published by the Free Software Foundation; version 2 or later of the # 8 | //# License. # 9 | //# # 10 | //# This program is distributed in the hope that it will be useful, # 11 | //# but WITHOUT ANY WARRANTY; without even the implied warranty of # 12 | //# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # 13 | //# GNU General Public License for more details. # 14 | //# # 15 | //# COPYRIGHT: EDF R&D / TELECOM ParisTech (ENST-TSI) # 16 | //# # 17 | //########################################################################## 18 | 19 | #ifndef CC_POLYLINE_HEADER 20 | #define CC_POLYLINE_HEADER 21 | 22 | //Local 23 | #include "ReferenceCloud.h" 24 | 25 | namespace CCLib 26 | { 27 | 28 | //! A simple polyline class 29 | /** The polyline is considered as a cloud of points 30 | (in a specific order) with a open/closed state 31 | information. 32 | **/ 33 | class CC_CORE_LIB_API Polyline : public ReferenceCloud 34 | { 35 | public: 36 | 37 | //! Polyline constructor 38 | explicit Polyline(GenericIndexedCloudPersist* associatedCloud); 39 | 40 | //! Returns whether the polyline is closed or not 41 | inline bool isClosed() const { return m_isClosed; } 42 | 43 | //! Sets whether the polyline is closed or not 44 | inline void setClosed(bool state) { m_isClosed = state; } 45 | 46 | //inherited from ReferenceCloud 47 | void clear(bool unusedParam = true) override; 48 | 49 | protected: 50 | 51 | //! Closing state 52 | bool m_isClosed; 53 | }; 54 | 55 | } 56 | 57 | #endif //CC_POLYLINE_HEADER 58 | -------------------------------------------------------------------------------- /CC/src/CCMiscTools.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yaoli1992/ccCloudViewer/94211298a3b0382f816c7c2d8a803eb5dd22d305/CC/src/CCMiscTools.cpp -------------------------------------------------------------------------------- /CC/src/CCShareable.cpp: -------------------------------------------------------------------------------- 1 | //########################################################################## 2 | //# # 3 | //# CCLIB # 4 | //# # 5 | //# This program is free software; you can redistribute it and/or modify # 6 | //# it under the terms of the GNU Library General Public License as # 7 | //# published by the Free Software Foundation; version 2 or later of the # 8 | //# License. # 9 | //# # 10 | //# This program is distributed in the hope that it will be useful, # 11 | //# but WITHOUT ANY WARRANTY; without even the implied warranty of # 12 | //# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # 13 | //# GNU General Public License for more details. # 14 | //# # 15 | //# COPYRIGHT: EDF R&D / TELECOM ParisTech (ENST-TSI) # 16 | //# # 17 | //########################################################################## 18 | 19 | #include "CCShareable.h" 20 | 21 | #ifdef CC_TRACK_ALIVE_SHARED_OBJECTS 22 | 23 | #ifdef _MSC_VER 24 | //To get rid of the really annoying warnings about template class exportation 25 | #pragma warning( disable: 4530 ) 26 | #endif 27 | 28 | //system 29 | #include 30 | 31 | //set of all currently 'alived' shared objects 32 | static std::vector s_aliveSharedObjects; 33 | 34 | unsigned CCShareable::GetAliveCount() 35 | { 36 | return s_aliveSharedObjects.size(); 37 | } 38 | 39 | #endif 40 | 41 | CCShareable::CCShareable() : m_linkCount(0) 42 | { 43 | #ifdef CC_TRACK_ALIVE_SHARED_OBJECTS 44 | s_aliveSharedObjects.push_back(this); 45 | #endif 46 | } 47 | 48 | void CCShareable::link() 49 | { 50 | ++m_linkCount; 51 | } 52 | 53 | void CCShareable::release() 54 | { 55 | if (m_linkCount > 1) 56 | --m_linkCount; 57 | else 58 | delete this; 59 | } 60 | 61 | CCShareable::~CCShareable() 62 | { 63 | #ifdef CC_TRACK_ALIVE_SHARED_OBJECTS 64 | std::vector::iterator it; 65 | for (it=s_aliveSharedObjects.begin(); it!=s_aliveSharedObjects.end(); ++it) 66 | { 67 | if (*it == this) 68 | { 69 | std::swap(*it,s_aliveSharedObjects.back()); 70 | s_aliveSharedObjects.pop_back(); 71 | return; 72 | } 73 | } 74 | #endif 75 | } 76 | -------------------------------------------------------------------------------- /CC/src/DgmOctreeReferenceCloud.cpp: -------------------------------------------------------------------------------- 1 | //########################################################################## 2 | //# # 3 | //# CCLIB # 4 | //# # 5 | //# This program is free software; you can redistribute it and/or modify # 6 | //# it under the terms of the GNU Library General Public License as # 7 | //# published by the Free Software Foundation; version 2 or later of the # 8 | //# License. # 9 | //# # 10 | //# This program is distributed in the hope that it will be useful, # 11 | //# but WITHOUT ANY WARRANTY; without even the implied warranty of # 12 | //# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # 13 | //# GNU General Public License for more details. # 14 | //# # 15 | //# COPYRIGHT: EDF R&D / TELECOM ParisTech (ENST-TSI) # 16 | //# # 17 | //########################################################################## 18 | 19 | #include "DgmOctreeReferenceCloud.h" 20 | 21 | using namespace CCLib; 22 | 23 | DgmOctreeReferenceCloud::DgmOctreeReferenceCloud(DgmOctree::NeighboursSet* associatedSet, unsigned size/*=0*/) 24 | : m_globalIterator(0) 25 | , m_validBB(false) 26 | , m_set(associatedSet) 27 | , m_size(size == 0 && associatedSet ? static_cast(m_set->size()) : size) 28 | { 29 | assert(associatedSet); 30 | } 31 | 32 | void DgmOctreeReferenceCloud::computeBB() 33 | { 34 | //empty cloud?! 35 | unsigned count = size(); 36 | if (count) 37 | { 38 | m_bbMin = m_bbMax = CCVector3(0,0,0); 39 | return; 40 | } 41 | 42 | //initialize BBox with first point 43 | m_bbMin = m_bbMax = *m_set->at(0).point; 44 | 45 | for (unsigned i=1; iat(i).point; 48 | //X boundaries 49 | if (m_bbMin.x > P.x) 50 | m_bbMin.x = P.x; 51 | else if (m_bbMax.x < P.x) 52 | m_bbMax.x = P.x; 53 | 54 | //Y boundaries 55 | if (m_bbMin.y > P.y) 56 | m_bbMin.y = P.y; 57 | else if (m_bbMax.y < P.y) 58 | m_bbMax.y = P.y; 59 | 60 | //Z boundaries 61 | if (m_bbMin.z > P.z) 62 | m_bbMin.z = P.z; 63 | else if (m_bbMax.z < P.z) 64 | m_bbMax.z = P.z; 65 | } 66 | 67 | m_validBB = true; 68 | } 69 | 70 | void DgmOctreeReferenceCloud::getBoundingBox(CCVector3& bbMin, CCVector3& bbMax) 71 | { 72 | if (!m_validBB) 73 | computeBB(); 74 | 75 | bbMin = m_bbMin; 76 | bbMax = m_bbMax; 77 | } 78 | 79 | void DgmOctreeReferenceCloud::forEach(genericPointAction action) 80 | { 81 | unsigned count = size(); 82 | for (unsigned i=0; i(m_set->at(i).squareDistd); 86 | action(*m_set->at(i).point,sqDist); 87 | m_set->at(i).squareDistd = static_cast(sqDist); 88 | } 89 | } 90 | -------------------------------------------------------------------------------- /CC/src/Polyline.cpp: -------------------------------------------------------------------------------- 1 | //########################################################################## 2 | //# # 3 | //# CCLIB # 4 | //# # 5 | //# This program is free software; you can redistribute it and/or modify # 6 | //# it under the terms of the GNU Library General Public License as # 7 | //# published by the Free Software Foundation; version 2 or later of the # 8 | //# License. # 9 | //# # 10 | //# This program is distributed in the hope that it will be useful, # 11 | //# but WITHOUT ANY WARRANTY; without even the implied warranty of # 12 | //# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # 13 | //# GNU General Public License for more details. # 14 | //# # 15 | //# COPYRIGHT: EDF R&D / TELECOM ParisTech (ENST-TSI) # 16 | //# # 17 | //########################################################################## 18 | 19 | #include "Polyline.h" 20 | 21 | using namespace CCLib; 22 | 23 | Polyline::Polyline(GenericIndexedCloudPersist* associatedCloud) 24 | : ReferenceCloud(associatedCloud) 25 | , m_isClosed(false) 26 | { 27 | } 28 | 29 | void Polyline::clear(bool /*unusedParam*/) 30 | { 31 | ReferenceCloud::clear(); 32 | m_isClosed = false; 33 | } 34 | -------------------------------------------------------------------------------- /CCFbo/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.0) 2 | 3 | include_directories( ${CMAKE_CURRENT_SOURCE_DIR}/include ) 4 | 5 | project( CC_FBO_LIB ) 6 | set(CMAKE_POSITION_INDEPENDENT_CODE ON) 7 | 8 | file( GLOB header_list include/*.h ) 9 | file( GLOB source_list src/*.cpp ) 10 | 11 | add_library( ${PROJECT_NAME} STATIC ${header_list} ${source_list} ) 12 | 13 | target_link_libraries(${PROJECT_NAME} Qt5::Core Qt5::OpenGL Qt5::OpenGLExtensions ) 14 | -------------------------------------------------------------------------------- /CCFbo/include/ccShader.h: -------------------------------------------------------------------------------- 1 | //########################################################################## 2 | //# # 3 | //# CCFBO # 4 | //# # 5 | //# This program is free software; you can redistribute it and/or modify # 6 | //# it under the terms of the GNU Library General Public License as # 7 | //# published by the Free Software Foundation; version 2 or later of the License. # 8 | //# # 9 | //# This program is distributed in the hope that it will be useful, # 10 | //# but WITHOUT ANY WARRANTY; without even the implied warranty of # 11 | //# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # 12 | //# GNU General Public License for more details. # 13 | //# # 14 | //# COPYRIGHT: EDF R&D / TELECOM ParisTech (ENST-TSI) # 15 | //# # 16 | //########################################################################## 17 | 18 | #ifndef CC_SHADER_HEADER 19 | #define CC_SHADER_HEADER 20 | 21 | //Qt 22 | #include 23 | #include 24 | 25 | class QObject; 26 | 27 | //! Shader program 28 | /** Now a simple encapsulation of QOpenGLShaderProgram providing two helper functions. 29 | **/ 30 | class ccShader : public QOpenGLShaderProgram 31 | { 32 | Q_OBJECT 33 | 34 | public: 35 | 36 | //! Default constructor 37 | ccShader(QObject* parent = 0); 38 | 39 | //! Destructor 40 | virtual ~ccShader() = default; 41 | 42 | //! Creates program from two shader files with same base filename 43 | /** Path and extensions (.vert and .frag) are automatically 44 | added to shader base filename (shortcut to ccShader::loadProgram). 45 | \param shaderBasePath shader files path 46 | \param shaderBaseFilename shader base filename 47 | \param error error string (if any error occurred) 48 | \return success 49 | **/ 50 | virtual bool fromFile(QString shaderBasePath, QString shaderBaseFilename, QString& error); 51 | 52 | //! Creates program from one or two shader files 53 | /** Filenames must be absolute (full path). 54 | \param vertShaderFile vertex shader filename 55 | \param fragShaderFile fragment shader filename 56 | \param error error string (if any error occurred) 57 | **/ 58 | virtual bool loadProgram(QString vertShaderFile, QString fragShaderFile, QString& error); 59 | }; 60 | 61 | #endif 62 | -------------------------------------------------------------------------------- /CCFbo/shaders/Bilateral/bilateral.frag: -------------------------------------------------------------------------------- 1 | ////////////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // 4 | // Bilateral filtering 5 | // 6 | // C.B. - 08/16/2008 7 | // D.G-M. - 10/20/2010 8 | // D.G-M. - 02/18/2014 9 | // 10 | // IN: 11 | // s2_I - Image to blur 12 | // s2_D - Modulating depth image 13 | // 14 | // OUT: 15 | // Filtered image 16 | // 17 | /////////////////////////////////////////////////////////////////////////////////////// 18 | //#extension GL_ARB_draw_buffers : enable 19 | 20 | 21 | /****************************************************/ 22 | uniform sampler2D s2_I; 23 | uniform sampler2D s2_D; 24 | uniform float SX; 25 | uniform float SY; 26 | uniform int NHalf; // half filter size (<= 7!) 27 | uniform float DistCoefs[64]; // pixel distance based damping coefs (max = 8*8). 28 | uniform float SigmaDepth; // pixel depth distribution variance 29 | /****************************************************/ 30 | 31 | void main (void) 32 | { 33 | float z = texture2D(s2_D,gl_TexCoord[0].st).r; 34 | 35 | float wsum = 0.0; // sum of all weights 36 | vec3 csum = vec3(0.0); // sum of all contributions 37 | vec2 coordi = vec2(0.0,0.0); // ith neighbor position 38 | 39 | for(int c=-NHalf; c<=NHalf; c++) 40 | { 41 | //neighbor position (X) 42 | coordi.x = float(c)/SX; 43 | int cabs; 44 | if (c < 0) 45 | cabs = -c; 46 | else 47 | cabs = c; 48 | 49 | for(int d=-NHalf; d<=NHalf; d++) 50 | { 51 | //neighbor position (Y) 52 | coordi.y = float(d)/SY; 53 | 54 | //neighbor color 55 | vec3 ci = texture2D(s2_I,gl_TexCoord[0].st+coordi).rgb; 56 | 57 | //pixel distance based damping 58 | int dabs; 59 | if (d < 0) 60 | dabs = -d; 61 | else 62 | dabs = d; 63 | float fi = DistCoefs[cabs*(NHalf+1)+dabs]; 64 | 65 | //pixel depth difference based damping 66 | if (SigmaDepth > 0.0) 67 | { 68 | //neighbor depth 69 | float zi = texture2D(s2_D,gl_TexCoord[0].st+coordi).r; 70 | float dz = (z-zi)/SigmaDepth; 71 | fi *= exp(-dz*dz/2.0); 72 | } 73 | 74 | csum += ci * fi; 75 | wsum += fi; 76 | } 77 | } 78 | 79 | //output 80 | gl_FragColor = vec4(csum/wsum,1.0); 81 | } 82 | 83 | -------------------------------------------------------------------------------- /CCFbo/shaders/Bilateral/bilateral.vert: -------------------------------------------------------------------------------- 1 | ////////////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // 4 | // Bilateral filtering 5 | // 6 | // C.B. - 08/16/2008 7 | // D.G-M. - 10/20/2010 8 | // 9 | // IN: 10 | // s2_I - Image to blur 11 | // s2_D - Modulating depth image 12 | // 13 | // OUT: 14 | // Filtered image 15 | // 16 | /////////////////////////////////////////////////////////////////////////////////////// 17 | //#extension GL_EXT_gpu_shader4 : enable 18 | //#version 110 19 | //#extension GL_ARB_draw_buffers : enable 20 | 21 | void main () 22 | { 23 | gl_TexCoord[0] = gl_MultiTexCoord0; 24 | gl_Position = ftransform (); 25 | } 26 | -------------------------------------------------------------------------------- /CCFbo/src/ccShader.cpp: -------------------------------------------------------------------------------- 1 | //########################################################################## 2 | //# # 3 | //# CCFBO # 4 | //# # 5 | //# This program is free software; you can redistribute it and/or modify # 6 | //# it under the terms of the GNU Library General Public License as # 7 | //# published by the Free Software Foundation; version 2 or later of the License. # 8 | //# # 9 | //# This program is distributed in the hope that it will be useful, # 10 | //# but WITHOUT ANY WARRANTY; without even the implied warranty of # 11 | //# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # 12 | //# GNU General Public License for more details. # 13 | //# # 14 | //# COPYRIGHT: EDF R&D / TELECOM ParisTech (ENST-TSI) # 15 | //# # 16 | //########################################################################## 17 | 18 | #include "ccShader.h" 19 | 20 | //Qt 21 | #include 22 | 23 | //system 24 | #include 25 | #include 26 | #include 27 | 28 | ccShader::ccShader(QObject* parent/*=0*/) 29 | : QOpenGLShaderProgram(parent) 30 | {} 31 | 32 | bool ccShader::fromFile(QString shaderBasePath, QString shaderBaseFilename, QString& error) 33 | { 34 | if (shaderBasePath.isEmpty() || shaderBaseFilename.isEmpty()) 35 | { 36 | error = "Missing input argument for ccShader::fromFile"; 37 | return false; 38 | } 39 | 40 | QString vertFilename = QString("%1/%2.vert").arg(shaderBasePath, shaderBaseFilename); 41 | QString fragFilename = QString("%1/%2.frag").arg(shaderBasePath, shaderBaseFilename); 42 | 43 | return loadProgram(vertFilename, fragFilename, error); 44 | } 45 | 46 | bool ccShader::loadProgram(QString vertexShaderFile, QString fragShaderFile, QString& error) 47 | { 48 | if (!vertexShaderFile.isEmpty() && !addShaderFromSourceFile(QOpenGLShader::Vertex, vertexShaderFile)) 49 | { 50 | error = log(); 51 | return false; 52 | } 53 | 54 | if (!fragShaderFile.isEmpty() && !addShaderFromSourceFile(QOpenGLShader::Fragment, fragShaderFile)) 55 | { 56 | error = log(); 57 | return false; 58 | } 59 | 60 | if (!link()) 61 | { 62 | error = log(); 63 | return false; 64 | } 65 | 66 | return true; 67 | } 68 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 2 | # 记录每次更新了哪些内容 # 3 | 4 | # 20230414版本 5 | 1. 修改了每个模块中的CMakeLists.txt 6 | 2. 删除了ccViewer模块中用到Plugion代码 7 | 3. 编译成功,但拖拉点云文件不能可视化 8 | 9 | # 20230418 10 | 1. 添加了PCL库,编译成功 11 | 12 | 13 | # 20230421 14 | 1. 添加了PCL库点云格式转换到CC点云格式的实现pclutils 15 | 2. 添加action实现打开pcd文件并可视化 16 | 17 | 18 | -------------------------------------------------------------------------------- /ccViewer/Mac/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Put together our App bundle on macOS 2 | if( APPLE ) 3 | set_target_properties( ${PROJECT_NAME} PROPERTIES 4 | INSTALL_RPATH "@executable_path/../Frameworks" 5 | MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/ccViewer.plist 6 | MACOSX_BUNDLE_ICON_FILE cc_viewer_icon.icns 7 | MACOSX_BUNDLE_SHORT_VERSION_STRING "${PROJECT_VERSION}" 8 | MACOSX_BUNDLE_LONG_VERSION_STRING "${PROJECT_VERSION}" 9 | MACOSX_BUNDLE_BUNDLE_VERSION "${PROJECT_VERSION}" ) 10 | 11 | set( CCVIEWER_MAC_BASE_DIR ${CMAKE_INSTALL_PREFIX}/${CCVIEWER_DEST_FOLDER}/ccViewer.app CACHE INTERNAL "ccViewer bundle dir") 12 | set( CCVIEWER_MAC_FRAMEWORK_DIR ${CCVIEWER_MAC_BASE_DIR}/Contents/Frameworks CACHE INTERNAL "CCViewer framework dir" ) 13 | set( CCVIEWER_MAC_PLUGIN_DIR ${CCVIEWER_MAC_BASE_DIR}/Contents/PlugIns/ccPlugins CACHE INTERNAL "CCViewer plugin dir" ) 14 | 15 | # this will install all the Qt libs and the necessary plugins 16 | install( CODE "execute_process( COMMAND \"${MACDEPLOYQT}\" \"${CCVIEWER_MAC_BASE_DIR}\" -verbose=1 )" COMPONENT Runtime ) 17 | 18 | # install icons 19 | install( FILES cc_viewer_icon.icns DESTINATION ${CCVIEWER_MAC_BASE_DIR}/Contents/Resources COMPONENT Runtime ) 20 | 21 | # Export common shader files to all install destinations 22 | install( FILES ${CMAKE_CURRENT_SOURCE_DIR}/../../qCC/shaders/ColorRamp/color_ramp.frag DESTINATION ${CCVIEWER_MAC_BASE_DIR}/Contents/Shaders/ColorRamp ) 23 | endif( APPLE ) 24 | -------------------------------------------------------------------------------- /ccViewer/Mac/cc_viewer_icon.icns: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yaoli1992/ccCloudViewer/94211298a3b0382f816c7c2d8a803eb5dd22d305/ccViewer/Mac/cc_viewer_icon.icns -------------------------------------------------------------------------------- /ccViewer/bin_other/license.txt: -------------------------------------------------------------------------------- 1 | //########################################################################## 2 | //# # 3 | //# CLOUDCOMPARE LIGHT VIEWER # 4 | //# # 5 | //# This project has been initated under funding from ANR/CIFRE # 6 | //# This program is free software; you can redistribute it and/or modify # 7 | //# # 8 | //# it under the terms of the GNU General Public License as published by # 9 | //# the Free Software Foundation; version 2 of the License. # 10 | //# # 11 | //# This program is distributed in the hope that it will be useful, # 12 | //# but WITHOUT ANY WARRANTY; without even the implied warranty of # 13 | //# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # 14 | //# GNU General Public License for more details. # 15 | //# # 16 | //# +++ COPYRIGHT: EDF R&D + TELECOM ParisTech (ENST-TSI) +++ # 17 | //# # 18 | //########################################################################## -------------------------------------------------------------------------------- /ccViewer/bin_other/start.bat: -------------------------------------------------------------------------------- 1 | @set PATH=. 2 | ccViewer.exe 3 | -------------------------------------------------------------------------------- /ccViewer/ccViewerApplication.cpp: -------------------------------------------------------------------------------- 1 | //########################################################################## 2 | //# # 3 | //# CLOUDCOMPARE # 4 | //# # 5 | //# This program is free software; you can redistribute it and/or modify # 6 | //# it under the terms of the GNU General Public License as published by # 7 | //# the Free Software Foundation; version 2 or later of the License. # 8 | //# # 9 | //# This program is distributed in the hope that it will be useful, # 10 | //# but WITHOUT ANY WARRANTY; without even the implied warranty of # 11 | //# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # 12 | //# GNU General Public License for more details. # 13 | //# # 14 | //# COPYRIGHT: CloudCompare project # 15 | //# # 16 | //########################################################################## 17 | 18 | #include 19 | 20 | #ifdef Q_OS_MAC 21 | #include 22 | #endif 23 | 24 | #include "ccviewer.h" 25 | #include "ccViewerApplication.h" 26 | 27 | 28 | ccViewerApplication::ccViewerApplication( int &argc, char **argv, bool isCommandLine ) 29 | : ccApplicationBase( argc, argv, isCommandLine, QStringLiteral( "dianyunPCL" ) ) 30 | { 31 | setApplicationName( "CloudCompareViewer" ); 32 | } 33 | 34 | void ccViewerApplication::setViewer(ccViewer *inViewer) 35 | { 36 | mViewer = inViewer; 37 | } 38 | 39 | bool ccViewerApplication::event(QEvent *inEvent) 40 | { 41 | #ifdef Q_OS_MAC 42 | switch ( inEvent->type() ) 43 | { 44 | case QEvent::FileOpen: 45 | { 46 | if ( mViewer == nullptr ) 47 | { 48 | return false; 49 | } 50 | 51 | mViewer->addToDB( { static_cast(inEvent)->file() } ); 52 | return true; 53 | } 54 | 55 | default: 56 | break; 57 | } 58 | #endif 59 | 60 | return ccApplicationBase::event( inEvent ); 61 | } 62 | -------------------------------------------------------------------------------- /ccViewer/ccViewerApplication.h: -------------------------------------------------------------------------------- 1 | #ifndef CCVIEWERAPPLICATION_H 2 | #define CCVIEWERAPPLICATION_H 3 | 4 | //########################################################################## 5 | //# # 6 | //# CLOUDCOMPARE # 7 | //# # 8 | //# This program is free software; you can redistribute it and/or modify # 9 | //# it under the terms of the GNU General Public License as published by # 10 | //# the Free Software Foundation; version 2 or later of the License. # 11 | //# # 12 | //# This program is distributed in the hope that it will be useful, # 13 | //# but WITHOUT ANY WARRANTY; without even the implied warranty of # 14 | //# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # 15 | //# GNU General Public License for more details. # 16 | //# # 17 | //# COPYRIGHT: CloudCompare project # 18 | //# # 19 | //########################################################################## 20 | 21 | //Common 22 | #include 23 | 24 | class ccViewer; 25 | 26 | class ccViewerApplication : public ccApplicationBase 27 | { 28 | Q_OBJECT 29 | 30 | public: 31 | ccViewerApplication( int &argc, char **argv, bool isCommandLine ); 32 | 33 | void setViewer( ccViewer *inViewer ); 34 | 35 | protected: 36 | bool event( QEvent *inEvent ) override; 37 | 38 | private: 39 | ccViewer *mViewer; 40 | }; 41 | 42 | #endif 43 | -------------------------------------------------------------------------------- /ccViewer/ccviewer.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yaoli1992/ccCloudViewer/94211298a3b0382f816c7c2d8a803eb5dd22d305/ccViewer/ccviewer.cpp -------------------------------------------------------------------------------- /ccViewer/ccviewer.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yaoli1992/ccCloudViewer/94211298a3b0382f816c7c2d8a803eb5dd22d305/ccViewer/ccviewer.h -------------------------------------------------------------------------------- /ccViewer/ccviewerlog.h: -------------------------------------------------------------------------------- 1 | //########################################################################## 2 | //# # 3 | //# CLOUDCOMPARE LIGHT VIEWER # 4 | //# # 5 | //# This project has been initiated under funding from ANR/CIFRE # 6 | //# # 7 | //# This program is free software; you can redistribute it and/or modify # 8 | //# it under the terms of the GNU General Public License as published by # 9 | //# the Free Software Foundation; version 2 or later of the License. # 10 | //# # 11 | //# This program is distributed in the hope that it will be useful, # 12 | //# but WITHOUT ANY WARRANTY; without even the implied warranty of # 13 | //# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # 14 | //# GNU General Public License for more details. # 15 | //# # 16 | //# +++ COPYRIGHT: EDF R&D + TELECOM ParisTech (ENST-TSI) +++ # 17 | //# # 18 | //########################################################################## 19 | 20 | #ifndef CCVIEWER_LOG_HEADER 21 | #define CCVIEWER_LOG_HEADER 22 | 23 | //Qt 24 | #include 25 | #include 26 | 27 | //qCC_db 28 | #include 29 | 30 | //! Minimalist logger (only displays error messages) 31 | class ccViewerLog : public ccLog 32 | { 33 | public: 34 | //! Default constructor 35 | explicit ccViewerLog(QMainWindow* parentWindow = 0) : ccLog(), m_parentWindow(parentWindow) {} 36 | 37 | protected: 38 | //inherited from ccLog 39 | virtual void logMessage(const QString& message, int level) 40 | { 41 | if (level & LOG_ERROR) 42 | { 43 | QMessageBox::warning(m_parentWindow, "Error", message); 44 | } 45 | } 46 | 47 | //! Associated window 48 | QMainWindow* m_parentWindow; 49 | }; 50 | 51 | #endif // CCVIEWER_LOG_HEADER 52 | -------------------------------------------------------------------------------- /ccViewer/images/cc.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yaoli1992/ccCloudViewer/94211298a3b0382f816c7c2d8a803eb5dd22d305/ccViewer/images/cc.png -------------------------------------------------------------------------------- /ccViewer/images/cc_lightParamsIcon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yaoli1992/ccCloudViewer/94211298a3b0382f816c7c2d8a803eb5dd22d305/ccViewer/images/cc_lightParamsIcon.png -------------------------------------------------------------------------------- /ccViewer/images/icon/cc_viewer_icon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yaoli1992/ccCloudViewer/94211298a3b0382f816c7c2d8a803eb5dd22d305/ccViewer/images/icon/cc_viewer_icon.ico -------------------------------------------------------------------------------- /ccViewer/images/icon/cc_viewer_icon.rc: -------------------------------------------------------------------------------- 1 | IDI_ICON1 ICON DISCARDABLE "cc_viewer_icon.ico" 2 | -------------------------------------------------------------------------------- /ccViewer/ui_templates/ccviewerAbout.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | AboutDialog 4 | 5 | 6 | 7 | 0 8 | 0 9 | 280 10 | 190 11 | 12 | 13 | 14 | About CCViewer 15 | 16 | 17 | 18 | 19 | 20 | true 21 | 22 | 23 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> 24 | <html><head><meta name="qrichtext" content="1" /><style type="text/css"> 25 | p, li { white-space: pre-wrap; } 26 | </style></head><body style=" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;"> 27 | <p align="center" style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:8pt;"><br /></p> 28 | <p align="center" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><img src=":/CC/Icons/images/icon/cc_viewer_icon_64.png" /></p> 29 | <p align="center" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:14pt; font-weight:600;">CloudCompare Viewer</span></p> 30 | <p align="center" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><a href="(http://www.danielgm.net/cc"><span style=" font-size:8pt; text-decoration: underline; color:#0000ff;">http://www.danielgm.net/cc</span></a></p> 31 | <p align="center" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:8pt;">License: GNU GPL (General Public Licence)</span></p> 32 | <p align="center" style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:8pt;"><br /></p> 33 | <p align="center" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:8pt;">Version: %1</span></p></body></html> 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /common/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(header_list 2 | ${header_list} 3 | ${CMAKE_CURRENT_SOURCE_DIR}/ccApplicationBase.h 4 | ${CMAKE_CURRENT_SOURCE_DIR}/ccCameraParamEditDlg.h 5 | ${CMAKE_CURRENT_SOURCE_DIR}/ccDisplayOptionsDlg.h 6 | ${CMAKE_CURRENT_SOURCE_DIR}/ccOptions.h 7 | ${CMAKE_CURRENT_SOURCE_DIR}/ccOverlayDialog.h 8 | ${CMAKE_CURRENT_SOURCE_DIR}/ccPickingListener.h 9 | ${CMAKE_CURRENT_SOURCE_DIR}/ccPickingHub.h 10 | ${CMAKE_CURRENT_SOURCE_DIR}/ccPickOneElementDlg.h 11 | ${CMAKE_CURRENT_SOURCE_DIR}/ccPluginManager.h 12 | ${CMAKE_CURRENT_SOURCE_DIR}/ccStereoModeDlg.h 13 | ${CMAKE_CURRENT_SOURCE_DIR}/ccQtHelpers.h 14 | ${CMAKE_CURRENT_SOURCE_DIR}/ccTranslationManager.h 15 | PARENT_SCOPE 16 | ) 17 | 18 | set(source_list 19 | ${source_list} 20 | ${CMAKE_CURRENT_SOURCE_DIR}/ccApplicationBase.cpp 21 | ${CMAKE_CURRENT_SOURCE_DIR}/ccCameraParamEditDlg.cpp 22 | ${CMAKE_CURRENT_SOURCE_DIR}/ccDisplayOptionsDlg.cpp 23 | ${CMAKE_CURRENT_SOURCE_DIR}/ccOptions.cpp 24 | ${CMAKE_CURRENT_SOURCE_DIR}/ccOverlayDialog.cpp 25 | ${CMAKE_CURRENT_SOURCE_DIR}/ccPickingHub.cpp 26 | ${CMAKE_CURRENT_SOURCE_DIR}/ccPickOneElementDlg.cpp 27 | ${CMAKE_CURRENT_SOURCE_DIR}/ccPluginManager.cpp 28 | ${CMAKE_CURRENT_SOURCE_DIR}/ccStereoModeDlg.cpp 29 | ${CMAKE_CURRENT_SOURCE_DIR}/ccTranslationManager.cpp 30 | PARENT_SCOPE 31 | ) 32 | 33 | set(ui_list 34 | ${ui_list} 35 | ${CMAKE_CURRENT_SOURCE_DIR}/ui_templates/cameraParamDlg.ui 36 | ${CMAKE_CURRENT_SOURCE_DIR}/ui_templates/displayOptionsDlg.ui 37 | ${CMAKE_CURRENT_SOURCE_DIR}/ui_templates/pickOneElementDlg.ui 38 | ${CMAKE_CURRENT_SOURCE_DIR}/ui_templates/stereoModeDlg.ui 39 | PARENT_SCOPE 40 | ) 41 | -------------------------------------------------------------------------------- /common/ccApplicationBase.h: -------------------------------------------------------------------------------- 1 | #ifndef CCAPPLICATIONBASE_H 2 | #define CCAPPLICATIONBASE_H 3 | 4 | //########################################################################## 5 | //# # 6 | //# CLOUDCOMPARE # 7 | //# # 8 | //# This program is free software; you can redistribute it and/or modify # 9 | //# it under the terms of the GNU General Public License as published by # 10 | //# the Free Software Foundation; version 2 or later of the License. # 11 | //# # 12 | //# This program is distributed in the hope that it will be useful, # 13 | //# but WITHOUT ANY WARRANTY; without even the implied warranty of # 14 | //# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # 15 | //# GNU General Public License for more details. # 16 | //# # 17 | //# COPYRIGHT: CloudCompare project # 18 | //# # 19 | //########################################################################## 20 | 21 | //Qt 22 | #include 23 | 24 | //! Mimic Qt's qApp for easy access to the application instance 25 | #define ccApp (static_cast( QCoreApplication::instance() )) 26 | 27 | class ccApplicationBase : public QApplication 28 | { 29 | public: 30 | //! This must be called before instantiating the application class so it 31 | //! can setup OpenGL first. 32 | static void initOpenGL(); 33 | 34 | ccApplicationBase( int &argc, char **argv, bool isCommandLine, const QString &version ); 35 | 36 | bool isCommandLine() const { return c_CommandLine; } 37 | 38 | QString versionStr() const; 39 | QString versionLongStr( bool includeOS ) const; 40 | 41 | const QString &translationPath() const; 42 | 43 | private: 44 | void setupPaths(); 45 | 46 | const QString c_VersionStr; 47 | 48 | QString m_ShaderPath; 49 | QString m_TranslationPath; 50 | QStringList m_PluginPaths; 51 | 52 | const bool c_CommandLine; 53 | }; 54 | 55 | #endif 56 | -------------------------------------------------------------------------------- /common/ccOptions.cpp: -------------------------------------------------------------------------------- 1 | //########################################################################## 2 | //# # 3 | //# CLOUDCOMPARE # 4 | //# # 5 | //# This program is free software; you can redistribute it and/or modify # 6 | //# it under the terms of the GNU General Public License as published by # 7 | //# the Free Software Foundation; version 2 or later of the License. # 8 | //# # 9 | //# This program is distributed in the hope that it will be useful, # 10 | //# but WITHOUT ANY WARRANTY; without even the implied warranty of # 11 | //# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # 12 | //# GNU General Public License for more details. # 13 | //# # 14 | //# COPYRIGHT: Daniel Girardeau-Montaut # 15 | //# # 16 | //########################################################################## 17 | 18 | #include "ccOptions.h" 19 | 20 | //Qt 21 | #include 22 | 23 | //qCC_db 24 | #include 25 | 26 | //! Unique instance of ccOptions 27 | static ccSingleton s_options; 28 | 29 | ccOptions& ccOptions::InstanceNonConst() 30 | { 31 | if (!s_options.instance) 32 | { 33 | s_options.instance = new ccOptions(); 34 | s_options.instance->fromPersistentSettings(); 35 | } 36 | 37 | return *s_options.instance; 38 | } 39 | 40 | void ccOptions::ReleaseInstance() 41 | { 42 | s_options.release(); 43 | } 44 | 45 | void ccOptions::Set(const ccOptions& params) 46 | { 47 | InstanceNonConst() = params; 48 | } 49 | 50 | ccOptions::ccOptions() 51 | { 52 | reset(); 53 | } 54 | 55 | void ccOptions::reset() 56 | { 57 | normalsDisplayedByDefault = false; 58 | useNativeDialogs = true; 59 | } 60 | 61 | void ccOptions::fromPersistentSettings() 62 | { 63 | QSettings settings; 64 | settings.beginGroup("Options"); 65 | { 66 | normalsDisplayedByDefault = settings.value("normalsDisplayedByDefault", false).toBool(); 67 | useNativeDialogs = settings.value("useNativeDialogs", true).toBool(); 68 | } 69 | settings.endGroup(); 70 | } 71 | 72 | void ccOptions::toPersistentSettings() const 73 | { 74 | QSettings settings; 75 | settings.beginGroup("Options"); 76 | { 77 | settings.setValue("normalsDisplayedByDefault", normalsDisplayedByDefault); 78 | settings.setValue("useNativeDialogs", useNativeDialogs); 79 | } 80 | settings.endGroup(); 81 | } 82 | -------------------------------------------------------------------------------- /common/ccOptions.h: -------------------------------------------------------------------------------- 1 | //########################################################################## 2 | //# # 3 | //# CLOUDCOMPARE # 4 | //# # 5 | //# This program is free software; you can redistribute it and/or modify # 6 | //# it under the terms of the GNU General Public License as published by # 7 | //# the Free Software Foundation; version 2 or later of the License. # 8 | //# # 9 | //# This program is distributed in the hope that it will be useful, # 10 | //# but WITHOUT ANY WARRANTY; without even the implied warranty of # 11 | //# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # 12 | //# GNU General Public License for more details. # 13 | //# # 14 | //# COPYRIGHT: Daniel Girardeau-Montaut # 15 | //# # 16 | //########################################################################## 17 | 18 | #ifndef CC_OPTIONS_HEADER 19 | #define CC_OPTIONS_HEADER 20 | 21 | //Qt 22 | #include 23 | 24 | //! Main application options 25 | class ccOptions 26 | { 27 | public: //parameters 28 | 29 | //! Whether to display the normals by default or not 30 | bool normalsDisplayedByDefault; 31 | 32 | //! Use native load/save dialogs 33 | bool useNativeDialogs; 34 | 35 | public: //methods 36 | 37 | //! Default constructor 38 | ccOptions(); 39 | 40 | //! Resets parameters to default values 41 | void reset(); 42 | 43 | //! Loads from persistent DB 44 | void fromPersistentSettings(); 45 | 46 | //! Saves to persistent DB 47 | void toPersistentSettings() const; 48 | 49 | public: //static methods 50 | 51 | //! Returns the stored values of each parameter. 52 | static const ccOptions& Instance() { return InstanceNonConst(); } 53 | 54 | //! Release unique instance (if any) 55 | static void ReleaseInstance(); 56 | 57 | //! Sets parameters 58 | static void Set(const ccOptions& options); 59 | 60 | protected: //methods 61 | 62 | //! Returns the stored values of each parameter. 63 | static ccOptions& InstanceNonConst(); 64 | }; 65 | 66 | #endif //CC_OPTIONS_HEADER 67 | -------------------------------------------------------------------------------- /common/ccPickOneElementDlg.cpp: -------------------------------------------------------------------------------- 1 | //########################################################################## 2 | //# # 3 | //# CLOUDCOMPARE # 4 | //# # 5 | //# This program is free software; you can redistribute it and/or modify # 6 | //# it under the terms of the GNU General Public License as published by # 7 | //# the Free Software Foundation; version 2 or later of the License. # 8 | //# # 9 | //# This program is distributed in the hope that it will be useful, # 10 | //# but WITHOUT ANY WARRANTY; without even the implied warranty of # 11 | //# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # 12 | //# GNU General Public License for more details. # 13 | //# # 14 | //# COPYRIGHT: EDF R&D / TELECOM ParisTech (ENST-TSI) # 15 | //# # 16 | //########################################################################## 17 | 18 | #include "ccPickOneElementDlg.h" 19 | 20 | //UI file 21 | #include 22 | 23 | ccPickOneElementDlg::ccPickOneElementDlg( const QString &label, 24 | const QString &windowTitle/*=QString()*/, 25 | QWidget* parent/*=0*/) 26 | : QDialog(parent, Qt::Tool) 27 | , m_ui(new Ui_PickOneElementDialog) 28 | { 29 | m_ui->setupUi(this); 30 | 31 | if (!windowTitle.isNull()) 32 | { 33 | setWindowTitle(windowTitle); 34 | } 35 | 36 | m_ui->comboLabel->setText(label); 37 | } 38 | 39 | ccPickOneElementDlg::~ccPickOneElementDlg() 40 | { 41 | delete m_ui; 42 | m_ui = nullptr; 43 | } 44 | 45 | void ccPickOneElementDlg::addElement(const QString &elementName) 46 | { 47 | m_ui->comboBox->addItem(elementName); 48 | } 49 | 50 | void ccPickOneElementDlg::setDefaultIndex(int index) 51 | { 52 | m_ui->comboBox->setCurrentIndex(index); 53 | } 54 | 55 | int ccPickOneElementDlg::getSelectedIndex() 56 | { 57 | return m_ui->comboBox->currentIndex(); 58 | } 59 | -------------------------------------------------------------------------------- /common/ccPickOneElementDlg.h: -------------------------------------------------------------------------------- 1 | //########################################################################## 2 | //# # 3 | //# CLOUDCOMPARE # 4 | //# # 5 | //# This program is free software; you can redistribute it and/or modify # 6 | //# it under the terms of the GNU General Public License as published by # 7 | //# the Free Software Foundation; version 2 or later of the License. # 8 | //# # 9 | //# This program is distributed in the hope that it will be useful, # 10 | //# but WITHOUT ANY WARRANTY; without even the implied warranty of # 11 | //# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # 12 | //# GNU General Public License for more details. # 13 | //# # 14 | //# COPYRIGHT: EDF R&D / TELECOM ParisTech (ENST-TSI) # 15 | //# # 16 | //########################################################################## 17 | 18 | #ifndef CC_PICK_ONE_ELEMENT_DLG_HEADER 19 | #define CC_PICK_ONE_ELEMENT_DLG_HEADER 20 | 21 | //Qt 22 | #include 23 | 24 | class Ui_PickOneElementDialog; 25 | 26 | //! Minimal dialog to pick one element in a list (combox box) 27 | class ccPickOneElementDlg : public QDialog 28 | { 29 | Q_OBJECT 30 | 31 | public: 32 | 33 | //! Default constructor 34 | ccPickOneElementDlg(const QString &label, 35 | const QString &windowTitle = QString(), 36 | QWidget* parent = nullptr); 37 | 38 | //! Destructor 39 | ~ccPickOneElementDlg() override; 40 | 41 | //! Add an element to the combo box 42 | void addElement(const QString &elementName); 43 | //! Sets the combo box default index 44 | void setDefaultIndex(int index); 45 | //! Returns the combo box current index (after completion) 46 | int getSelectedIndex(); 47 | 48 | protected: 49 | 50 | //! Associated UI 51 | Ui_PickOneElementDialog* m_ui; 52 | }; 53 | 54 | #endif //CC_PICK_ONE_ELEMENT_DLG_HEADER 55 | -------------------------------------------------------------------------------- /common/ccPickingListener.h: -------------------------------------------------------------------------------- 1 | //########################################################################## 2 | //# # 3 | //# CLOUDCOMPARE # 4 | //# # 5 | //# This program is free software; you can redistribute it and/or modify # 6 | //# it under the terms of the GNU General Public License as published by # 7 | //# the Free Software Foundation; version 2 or later of the License. # 8 | //# # 9 | //# This program is distributed in the hope that it will be useful, # 10 | //# but WITHOUT ANY WARRANTY; without even the implied warranty of # 11 | //# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # 12 | //# GNU General Public License for more details. # 13 | //# # 14 | //# COPYRIGHT: CloudCompare project # 15 | //# # 16 | //########################################################################## 17 | 18 | #ifndef CC_PICKING_LISTENER_HEADER 19 | #define CC_PICKING_LISTENER_HEADER 20 | 21 | //CCLib 22 | #include 23 | 24 | //Qt 25 | #include 26 | 27 | class ccHObject; 28 | 29 | //! Point/triangle picking listener interface 30 | class ccPickingListener 31 | { 32 | public: 33 | virtual ~ccPickingListener() = default; 34 | 35 | //! Picked item 36 | struct PickedItem 37 | { 38 | PickedItem() 39 | : entity(nullptr) 40 | , itemIndex(0) 41 | , entityCenter(false) 42 | {} 43 | 44 | QPoint clickPoint; //position of the user click 45 | ccHObject* entity; //picked entity (if any) 46 | unsigned itemIndex; //e.g. point or triangle index 47 | CCVector3 P3D; //picked point in 3D (if any) 48 | CCVector3d uvw; //picked point barycentric coordinates (if picked on a triangle) 49 | bool entityCenter; //the point doesn't correspond to a real 'item' but to the entity center 50 | }; 51 | 52 | //! Method called whenever an item is picked 53 | virtual void onItemPicked(const PickedItem& pi) = 0; 54 | }; 55 | 56 | #endif //CC_PICKING_LISTENER_HEADER 57 | -------------------------------------------------------------------------------- /common/ccPluginManager.h: -------------------------------------------------------------------------------- 1 | //#ifndef CCPLUGINMANAGER_H 2 | //#define CCPLUGINMANAGER_H 3 | // 4 | ////########################################################################## 5 | ////# # 6 | ////# CLOUDCOMPARE # 7 | ////# # 8 | ////# This program is free software; you can redistribute it and/or modify # 9 | ////# it under the terms of the GNU General Public License as published by # 10 | ////# the Free Software Foundation; version 2 or later of the License. # 11 | ////# # 12 | ////# This program is distributed in the hope that it will be useful, # 13 | ////# but WITHOUT ANY WARRANTY; without even the implied warranty of # 14 | ////# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # 15 | ////# GNU General Public License for more details. # 16 | ////# # 17 | ////# COPYRIGHT: CloudCompare project # 18 | ////# # 19 | ////########################################################################## 20 | // 21 | //#include 22 | //#include 23 | // 24 | //class ccPluginInterface; 25 | // 26 | ////! Simply a list of \see ccPluginInterface 27 | //using ccPluginInterfaceList = QVector; 28 | // 29 | // 30 | //class ccPluginManager : public QObject 31 | //{ 32 | // Q_OBJECT 33 | // 34 | //public: 35 | // ~ccPluginManager() override = default; 36 | // 37 | // static ccPluginManager& get(); 38 | // 39 | // void setPaths( const QStringList& paths ); 40 | // QStringList pluginPaths(); 41 | // 42 | // void loadPlugins(); 43 | // 44 | // ccPluginInterfaceList& pluginList(); 45 | // 46 | // void setPluginEnabled( const ccPluginInterface* plugin, bool enabled ); 47 | // bool isEnabled( const ccPluginInterface* plugin ) const; 48 | // 49 | //protected: 50 | // explicit ccPluginManager( QObject* parent = nullptr ); 51 | // 52 | //private: 53 | // void loadFromPathsAndAddToList(); 54 | // 55 | // QStringList disabledPluginIIDs() const; 56 | // 57 | // QStringList m_pluginPaths; 58 | // ccPluginInterfaceList m_pluginList; 59 | //}; 60 | // 61 | //#endif -------------------------------------------------------------------------------- /common/ccQtHelpers.h: -------------------------------------------------------------------------------- 1 | //########################################################################## 2 | //# # 3 | //# CLOUDCOMPARE # 4 | //# # 5 | //# This program is free software; you can redistribute it and/or modify # 6 | //# it under the terms of the GNU General Public License as published by # 7 | //# the Free Software Foundation; version 2 or later of the License. # 8 | //# # 9 | //# This program is distributed in the hope that it will be useful, # 10 | //# but WITHOUT ANY WARRANTY; without even the implied warranty of # 11 | //# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # 12 | //# GNU General Public License for more details. # 13 | //# # 14 | //# COPYRIGHT: EDF R&D / TELECOM ParisTech (ENST-TSI) # 15 | //# # 16 | //########################################################################## 17 | 18 | #ifndef CC_QT_HELPERS_HEADER 19 | #define CC_QT_HELPERS_HEADER 20 | 21 | //Qt 22 | #include 23 | 24 | class ccQtHelpers 25 | { 26 | public: 27 | 28 | //! Sets a button background color 29 | inline static void SetButtonColor(QAbstractButton* button, const QColor &col) 30 | { 31 | if (button) 32 | button->setStyleSheet(QString("* { background-color: rgb(%1,%2,%3) }").arg(col.red()).arg(col.green()).arg(col.blue())); 33 | } 34 | 35 | }; 36 | 37 | #endif //CC_QT_HELPERS_HEADER -------------------------------------------------------------------------------- /common/ccStereoModeDlg.h: -------------------------------------------------------------------------------- 1 | //########################################################################## 2 | //# # 3 | //# CLOUDCOMPARE # 4 | //# # 5 | //# This program is free software; you can redistribute it and/or modify # 6 | //# it under the terms of the GNU General Public License as published by # 7 | //# the Free Software Foundation; version 2 or later of the License. # 8 | //# # 9 | //# This program is distributed in the hope that it will be useful, # 10 | //# but WITHOUT ANY WARRANTY; without even the implied warranty of # 11 | //# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # 12 | //# GNU General Public License for more details. # 13 | //# # 14 | //# COPYRIGHT: EDF R&D / TELECOM ParisTech (ENST-TSI) # 15 | //# # 16 | //########################################################################## 17 | 18 | #ifndef CC_STEREO_MODE_DLG_HEADER 19 | #define CC_STEREO_MODE_DLG_HEADER 20 | 21 | //qCC_gl 22 | #include 23 | 24 | //Qt 25 | #include 26 | 27 | namespace Ui 28 | { 29 | class StereoModeDialog; 30 | } 31 | 32 | //! Dialog to define the parameters of the stereo mode (for 3D views) 33 | class ccStereoModeDlg : public QDialog 34 | { 35 | Q_OBJECT 36 | 37 | public: 38 | 39 | //! Default constructor 40 | explicit ccStereoModeDlg(QWidget* parent); 41 | ~ccStereoModeDlg() override; 42 | 43 | //! Returns the current parameters 44 | ccGLWindow::StereoParams getParameters() const; 45 | 46 | //! Sets the current parameters 47 | void setParameters(const ccGLWindow::StereoParams& params); 48 | 49 | //! Returns whether the FOV should be updated or not 50 | bool updateFOV() const; 51 | 52 | protected slots: 53 | 54 | //! Slot called when the glass type is modified 55 | void glassTypeChanged(int); 56 | 57 | private: 58 | Ui::StereoModeDialog* m_ui; 59 | }; 60 | 61 | #endif //CC_STEREO_MODE_DLG_HEADER 62 | -------------------------------------------------------------------------------- /common/ccTranslationManager.h: -------------------------------------------------------------------------------- 1 | #ifndef CCTRANSLATIONMANAGER_H 2 | #define CCTRANSLATIONMANAGER_H 3 | 4 | //########################################################################## 5 | //# # 6 | //# CLOUDCOMPARE # 7 | //# # 8 | //# This program is free software; you can redistribute it and/or modify # 9 | //# it under the terms of the GNU General Public License as published by # 10 | //# the Free Software Foundation; version 2 or later of the License. # 11 | //# # 12 | //# This program is distributed in the hope that it will be useful, # 13 | //# but WITHOUT ANY WARRANTY; without even the implied warranty of # 14 | //# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # 15 | //# GNU General Public License for more details. # 16 | //# # 17 | //# COPYRIGHT: CloudCompare project # 18 | //# # 19 | //########################################################################## 20 | 21 | #include 22 | #include 23 | #include 24 | 25 | 26 | class ccTranslationManager : public QObject 27 | { 28 | Q_OBJECT 29 | 30 | public: 31 | static ccTranslationManager &get(); 32 | 33 | ~ccTranslationManager() override = default; 34 | 35 | /** Register a file prefix for translation files. 36 | * The files should be named _.ts where is the 2-letter ISO 639 37 | * language code in lowercase. 38 | * e.g. CloudCompare_fr.ts 39 | * @param prefix The prefix of the file to register 40 | * @param path The path to look for the files in 41 | */ 42 | void registerTranslatorFile( const QString &prefix, const QString &path ); 43 | 44 | //! Using the translation file prefixes that were registered, load the actual translations 45 | void loadTranslations(); 46 | 47 | //! Populate the menu with a list of languages found using files in 'pathToTranslationFiles' 48 | void populateMenu( QMenu *menu, const QString &pathToTranslationFiles ); 49 | 50 | protected: 51 | explicit ccTranslationManager() = default; 52 | 53 | private: 54 | struct TranslatorFile { 55 | QString prefix; 56 | QString path; 57 | }; 58 | using TranslatorFileList = QVector; 59 | 60 | using TranslationInfo = QPair; 61 | using LanguageList = QVector; 62 | 63 | const QString languagePref(); 64 | 65 | //! Generate a list of available languages based on the files in the "translation" directory. 66 | LanguageList availableLanguages( const QString &appName, const QString &pathToTranslationFiles ); 67 | 68 | void setLanguagePref( const QString &languageCode ); 69 | 70 | TranslatorFileList mTranslatorFileInfo; 71 | }; 72 | 73 | #endif //CCTRANSLATIONMANAGER_H 74 | -------------------------------------------------------------------------------- /common/ui_templates/pickOneElementDlg.ui: -------------------------------------------------------------------------------- 1 | 2 | PickOneElementDialog 3 | 4 | 5 | 6 | 0 7 | 0 8 | 200 9 | 80 10 | 11 | 12 | 13 | 14 | 200 15 | 80 16 | 17 | 18 | 19 | 20 | 200 21 | 80 22 | 23 | 24 | 25 | Choose parameter 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | Elements 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | Qt::Horizontal 46 | 47 | 48 | QDialogButtonBox::Cancel|QDialogButtonBox::NoButton|QDialogButtonBox::Ok 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | buttonBox 58 | accepted() 59 | PickOneElementDialog 60 | accept() 61 | 62 | 63 | 248 64 | 254 65 | 66 | 67 | 157 68 | 274 69 | 70 | 71 | 72 | 73 | buttonBox 74 | rejected() 75 | PickOneElementDialog 76 | reject() 77 | 78 | 79 | 316 80 | 260 81 | 82 | 83 | 286 84 | 274 85 | 86 | 87 | 88 | 89 | 90 | -------------------------------------------------------------------------------- /pclutils/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(header_list 2 | ${header_list} 3 | ${CMAKE_CURRENT_SOURCE_DIR}/cc2sm.h 4 | ${CMAKE_CURRENT_SOURCE_DIR}/copy.h 5 | ${CMAKE_CURRENT_SOURCE_DIR}/my_point_types.h 6 | ${CMAKE_CURRENT_SOURCE_DIR}/PCLCloud.h 7 | ${CMAKE_CURRENT_SOURCE_DIR}/PCLConv.h 8 | ${CMAKE_CURRENT_SOURCE_DIR}/sm2cc.h 9 | PARENT_SCOPE 10 | ) 11 | 12 | set(source_list 13 | ${source_list} 14 | ${CMAKE_CURRENT_SOURCE_DIR}/cc2sm.cpp 15 | ${CMAKE_CURRENT_SOURCE_DIR}/copy.cpp 16 | ${CMAKE_CURRENT_SOURCE_DIR}/sm2cc.cpp 17 | PARENT_SCOPE 18 | ) 19 | 20 | 21 | -------------------------------------------------------------------------------- /pclutils/PCLCloud.h: -------------------------------------------------------------------------------- 1 | //########################################################################## 2 | //# # 3 | //# CLOUDCOMPARE PLUGIN: qPCL # 4 | //# # 5 | //# This program is free software; you can redistribute it and/or modify # 6 | //# it under the terms of the GNU General Public License as published by # 7 | //# the Free Software Foundation; version 2 or later of the License. # 8 | //# # 9 | //# This program is distributed in the hope that it will be useful, # 10 | //# but WITHOUT ANY WARRANTY; without even the implied warranty of # 11 | //# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # 12 | //# GNU General Public License for more details. # 13 | //# # 14 | //# COPYRIGHT: Luca Penasa # 15 | //# # 16 | //########################################################################## 17 | // 18 | #ifndef PCL_CLOUD_H 19 | #define PCL_CLOUD_H 20 | 21 | //PCL V1.6 or older 22 | #ifdef PCL_VER_1_6_OR_OLDER 23 | 24 | #include 25 | typedef sensor_msgs::PointCloud2 PCLCloud; 26 | 27 | #else //Version 1.7 or newer 28 | 29 | #include 30 | typedef pcl::PCLPointCloud2 PCLCloud; 31 | 32 | #endif 33 | 34 | #endif // PCL_CLOUD_H 35 | -------------------------------------------------------------------------------- /pclutils/PCLConv.h: -------------------------------------------------------------------------------- 1 | //########################################################################## 2 | //# # 3 | //# CLOUDCOMPARE PLUGIN: qPCL # 4 | //# # 5 | //# This program is free software; you can redistribute it and/or modify # 6 | //# it under the terms of the GNU General Public License as published by # 7 | //# the Free Software Foundation; version 2 or later of the License. # 8 | //# # 9 | //# This program is distributed in the hope that it will be useful, # 10 | //# but WITHOUT ANY WARRANTY; without even the implied warranty of # 11 | //# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # 12 | //# GNU General Public License for more details. # 13 | //# # 14 | //# COPYRIGHT: Luca Penasa # 15 | //# # 16 | //########################################################################## 17 | // 18 | #ifndef PCL_CONVERSIONS_H 19 | #define PCL_CONVERSIONS_H 20 | 21 | //PCL V1.6 or older 22 | #ifdef PCL_VER_1_6_OR_OLDER 23 | 24 | #include 25 | #define FROM_PCL_CLOUD pcl::fromROSMsg 26 | #define TO_PCL_CLOUD pcl::toROSMsg 27 | 28 | #else //Version 1.7 or newer 29 | 30 | #include 31 | #define FROM_PCL_CLOUD pcl::fromPCLPointCloud2 32 | #define TO_PCL_CLOUD pcl::toPCLPointCloud2 33 | 34 | #endif 35 | 36 | #endif // PCL_CONVERSIONS_H 37 | -------------------------------------------------------------------------------- /pclutils/cc2sm.h: -------------------------------------------------------------------------------- 1 | //########################################################################## 2 | //# # 3 | //# CLOUDCOMPARE PLUGIN: qPCL # 4 | //# # 5 | //# This program is free software; you can redistribute it and/or modify # 6 | //# it under the terms of the GNU General Public License as published by # 7 | //# the Free Software Foundation; version 2 or later of the License. # 8 | //# # 9 | //# This program is distributed in the hope that it will be useful, # 10 | //# but WITHOUT ANY WARRANTY; without even the implied warranty of # 11 | //# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # 12 | //# GNU General Public License for more details. # 13 | //# # 14 | //# COPYRIGHT: Luca Penasa # 15 | //# # 16 | //########################################################################## 17 | // 18 | #ifndef Q_PCL_PLUGIN_CC2SM_H 19 | #define Q_PCL_PLUGIN_CC2SM_H 20 | 21 | //Local 22 | #include "PCLCloud.h" 23 | 24 | //PCL 25 | #include 26 | #include 27 | 28 | //system 29 | #include 30 | #include 31 | 32 | class ccPointCloud; 33 | 34 | //! CC to PCL cloud converter 35 | class cc2smReader 36 | { 37 | public: 38 | explicit cc2smReader(const ccPointCloud* cc_cloud); 39 | 40 | PCLCloud::Ptr getGenericField(std::string field_name) const; 41 | 42 | PCLCloud::Ptr getXYZ() const; 43 | pcl::PointCloud::Ptr getXYZ2() const; 44 | 45 | PCLCloud::Ptr getNormals() const; 46 | 47 | PCLCloud::Ptr getColors() const; 48 | 49 | enum Fields { COORD_X, COORD_Y, COORD_Z, NORM_X, NORM_Y, NORM_Z }; 50 | PCLCloud::Ptr getOneOf(Fields field) const; 51 | 52 | PCLCloud::Ptr getFloatScalarField(const std::string& field_name) const; 53 | 54 | PCLCloud::Ptr getAsSM(std::list& requested_fields) const; 55 | 56 | //! Converts all the data in a ccPointCloud to a sesor_msgs::PointCloud2 57 | /** This is useful for saving a ccPointCloud into a PCD file. 58 | For pcl filters other methods are suggested (to get only the necessary bits of data) 59 | **/ 60 | PCLCloud::Ptr getAsSM() const; 61 | 62 | static std::string GetSimplifiedSFName(const std::string& ccSfName); 63 | 64 | protected: 65 | 66 | bool checkIfFieldExists(const std::string& field_name) const; 67 | 68 | //! Associated cloud 69 | const ccPointCloud* m_cc_cloud; 70 | 71 | }; 72 | 73 | #endif // Q_PCL_PLUGIN_CC2SM_H 74 | -------------------------------------------------------------------------------- /pclutils/copy.h: -------------------------------------------------------------------------------- 1 | //########################################################################## 2 | //# # 3 | //# CLOUDCOMPARE PLUGIN: qPCL # 4 | //# # 5 | //# This program is free software; you can redistribute it and/or modify # 6 | //# it under the terms of the GNU General Public License as published by # 7 | //# the Free Software Foundation; version 2 or later of the License. # 8 | //# # 9 | //# This program is distributed in the hope that it will be useful, # 10 | //# but WITHOUT ANY WARRANTY; without even the implied warranty of # 11 | //# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # 12 | //# GNU General Public License for more details. # 13 | //# # 14 | //# COPYRIGHT: Luca Penasa # 15 | //# # 16 | //########################################################################## 17 | // 18 | //#ifdef LP_PCL_PATCH_ENABLED 19 | 20 | #ifndef qPCL_COPY_H 21 | #define qPCL_COPY_H 22 | 23 | //Local 24 | #include "PCLCloud.h" 25 | 26 | //PCL 27 | #include 28 | 29 | class ccPointCloud; 30 | 31 | //! Makes a copy of all scalar fields from one cloud to another 32 | /** This algorithm simply copy the scalar fields from a cloud 33 | to another using the the mapping contained in a pcl::PointIndicesPtr. 34 | \param inCloud the input cloud from which to copy scalars 35 | \param outCloud the output cloud in which to copy the scalar fields 36 | \param in2outMapping indices of the input cloud for each point in the output 37 | \param overwrite you can chose to not overwrite existing fields 38 | **/ 39 | void copyScalarFields( const ccPointCloud *inCloud, 40 | ccPointCloud *outCloud, 41 | pcl::PointIndicesPtr &in2outMapping, 42 | bool overwrite = true); 43 | 44 | //! Makes a copy of RGB colors from one cloud to another 45 | void copyRGBColors( const ccPointCloud *inCloud, 46 | ccPointCloud *outCloud, 47 | pcl::PointIndicesPtr &in2outMapping, 48 | bool overwrite = true); 49 | 50 | #endif // qPCL_COPY_H 51 | 52 | //#endif // LP_PCL_PATCH_ENABLED 53 | -------------------------------------------------------------------------------- /pclutils/sm2cc.h: -------------------------------------------------------------------------------- 1 | //########################################################################## 2 | //# # 3 | //# CLOUDCOMPARE PLUGIN: qPCL # 4 | //# # 5 | //# This program is free software; you can redistribute it and/or modify # 6 | //# it under the terms of the GNU General Public License as published by # 7 | //# the Free Software Foundation; version 2 or later of the License. # 8 | //# # 9 | //# This program is distributed in the hope that it will be useful, # 10 | //# but WITHOUT ANY WARRANTY; without even the implied warranty of # 11 | //# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # 12 | //# GNU General Public License for more details. # 13 | //# # 14 | //# COPYRIGHT: Luca Penasa # 15 | //# # 16 | //########################################################################## 17 | 18 | #ifndef Q_PCL_PLUGIN_SM2CC_H 19 | #define Q_PCL_PLUGIN_SM2CC_H 20 | 21 | //Local 22 | #include "PCLCloud.h" 23 | 24 | //system 25 | #include 26 | 27 | class ccPointCloud; 28 | 29 | //! PCL to CC cloud converter 30 | /** NOTE: THIS METHOD HAS SOME PROBLEMS. IT CANNOT CORRECTLY LOAD NON-FLOAT FIELDS! 31 | THIS IS DUE TO THE FACT THE POINT TYPE WITH A SCALAR WE USE HERE IS FLOAT 32 | IF YOU TRY TO LOAD A FIELD THAT IS INT YOU GET A PCL WARN! 33 | **/ 34 | class sm2ccConverter 35 | { 36 | public: 37 | 38 | //! Default constructor 39 | sm2ccConverter(PCLCloud::Ptr sm_cloud); 40 | 41 | //! Converts input cloud (see constructor) to a ccPointCloud 42 | ccPointCloud* getCloud(); 43 | 44 | bool addXYZ (ccPointCloud *cloud); 45 | bool addNormals (ccPointCloud *cloud); 46 | bool addRGB (ccPointCloud *cloud); 47 | bool addScalarField(ccPointCloud *cloud, const std::string& name, bool overwrite_if_exist = true); 48 | 49 | private: 50 | 51 | //! Associated PCL cloud 52 | PCLCloud::Ptr m_sm_cloud; 53 | 54 | }; 55 | 56 | #endif // Q_PCL_PLUGIN_SM2CC_H 57 | -------------------------------------------------------------------------------- /qCC_db/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.0) 2 | 3 | project( QCC_DB_LIB ) 4 | set(CMAKE_POSITION_INDEPENDENT_CODE ON) 5 | 6 | set(CMAKE_AUTOMOC ON) 7 | set(CMAKE_INCLUDE_CURRENT_DIR ON) 8 | 9 | find_package(Qt5 COMPONENTS Core Gui Widgets OpenGL OpenGLExtensions REQUIRED) 10 | 11 | include_directories( ${CC_CORE_LIB_SOURCE_DIR}/include ) 12 | include_directories( ${CC_FBO_LIB_SOURCE_DIR}/include ) 13 | 14 | include_directories(${QCC_DB_LIB_SOURCE_DIR}) 15 | message(${QCC_DB_LIB_SOURCE_DIR}) 16 | 17 | file( GLOB header_list *.h) 18 | file( GLOB source_list *.cpp) 19 | 20 | 21 | #QT5_WRAP_CPP(ccPointCloudLOD_MOC ccPointCloudLOD.h) 22 | 23 | #add_library(my_widget ${SOURCES} ${MY_WIDGET_MOC}) 24 | 25 | #file( GLOB ui_list ../common/ui_templates/*.ui ) 26 | 27 | #set( CMAKE_CXX_VISIBILITY_PRESET hidden ) 28 | 29 | #qt5_wrap_ui( generated_ui_list ${ui_list} ) 30 | 31 | 32 | add_library( ${PROJECT_NAME} SHARED ${header_list} ${source_list} ${generated_ui_list}) 33 | 34 | target_link_libraries( ${PROJECT_NAME} 35 | CC_CORE_LIB 36 | CC_FBO_LIB 37 | 38 | ) 39 | 40 | # Qt 41 | target_link_libraries(${PROJECT_NAME} Qt5::Core Qt5::Gui Qt5::Widgets Qt5::OpenGL) 42 | 43 | # Add custom preprocessor definitions 44 | target_compile_definitions( ${PROJECT_NAME} PRIVATE QCC_DB_LIBRARY_BUILD ) 45 | -------------------------------------------------------------------------------- /qCC_db/cc2DViewportLabel.h: -------------------------------------------------------------------------------- 1 | //########################################################################## 2 | //# # 3 | //# CLOUDCOMPARE # 4 | //# # 5 | //# This program is free software; you can redistribute it and/or modify # 6 | //# it under the terms of the GNU General Public License as published by # 7 | //# the Free Software Foundation; version 2 or later of the License. # 8 | //# # 9 | //# This program is distributed in the hope that it will be useful, # 10 | //# but WITHOUT ANY WARRANTY; without even the implied warranty of # 11 | //# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # 12 | //# GNU General Public License for more details. # 13 | //# # 14 | //# COPYRIGHT: EDF R&D / TELECOM ParisTech (ENST-TSI) # 15 | //# # 16 | //########################################################################## 17 | 18 | #ifndef CC_2D_VIEWPORT_LABEL_HEADER 19 | #define CC_2D_VIEWPORT_LABEL_HEADER 20 | 21 | //Local 22 | #include "cc2DViewportObject.h" 23 | 24 | //! 2D viewport label 25 | class QCC_DB_LIB_API cc2DViewportLabel : public cc2DViewportObject 26 | { 27 | public: 28 | 29 | //! Default constructor 30 | explicit cc2DViewportLabel(QString name = QString()); 31 | 32 | //inherited from ccHObject 33 | virtual CC_CLASS_ENUM getClassID() const override { return CC_TYPES::VIEWPORT_2D_LABEL; } 34 | virtual bool isSerializable() const override { return true; } 35 | 36 | //! Returns ROI (relative to screen) 37 | const float* roi() const { return m_roi; } 38 | 39 | //! Sets ROI (relative to screen) 40 | void setRoi(const float* roi); 41 | 42 | protected: 43 | 44 | //inherited from ccHObject 45 | virtual bool toFile_MeOnly(QFile& out) const override; 46 | virtual bool fromFile_MeOnly(QFile& in, short dataVersion, int flags, LoadedIDMap& oldToNewIDMap) override; 47 | 48 | //! Draws the entity only (not its children) 49 | virtual void drawMeOnly(CC_DRAW_CONTEXT& context) override; 50 | 51 | //! label ROI 52 | /** ROI is relative to screen 53 | **/ 54 | float m_roi[4]; 55 | }; 56 | 57 | #endif //CC_2D_VIEWPORT_LABEL_HEADER 58 | -------------------------------------------------------------------------------- /qCC_db/cc2DViewportObject.cpp: -------------------------------------------------------------------------------- 1 | //########################################################################## 2 | //# # 3 | //# CLOUDCOMPARE # 4 | //# # 5 | //# This program is free software; you can redistribute it and/or modify # 6 | //# it under the terms of the GNU General Public License as published by # 7 | //# the Free Software Foundation; version 2 or later of the License. # 8 | //# # 9 | //# This program is distributed in the hope that it will be useful, # 10 | //# but WITHOUT ANY WARRANTY; without even the implied warranty of # 11 | //# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # 12 | //# GNU General Public License for more details. # 13 | //# # 14 | //# COPYRIGHT: EDF R&D / TELECOM ParisTech (ENST-TSI) # 15 | //# # 16 | //########################################################################## 17 | 18 | //Local 19 | #include "cc2DViewportObject.h" 20 | 21 | cc2DViewportObject::cc2DViewportObject(QString name/*=QString()*/) 22 | : ccHObject(name) 23 | {} 24 | 25 | bool cc2DViewportObject::toFile_MeOnly(QFile& out) const 26 | { 27 | if (!ccHObject::toFile_MeOnly(out)) 28 | return false; 29 | 30 | //ccViewportParameters (dataVersion>=20) 31 | if (!m_params.toFile(out)) 32 | return false; 33 | 34 | return true; 35 | } 36 | 37 | bool cc2DViewportObject::fromFile_MeOnly(QFile& in, short dataVersion, int flags, LoadedIDMap& oldToNewIDMap) 38 | { 39 | if (!ccHObject::fromFile_MeOnly(in, dataVersion, flags, oldToNewIDMap)) 40 | return false; 41 | 42 | //ccViewportParameters (dataVersion>=20) 43 | if (!m_params.fromFile(in, dataVersion, flags, oldToNewIDMap)) 44 | return false; 45 | 46 | return true; 47 | } 48 | -------------------------------------------------------------------------------- /qCC_db/cc2DViewportObject.h: -------------------------------------------------------------------------------- 1 | //########################################################################## 2 | //# # 3 | //# CLOUDCOMPARE # 4 | //# # 5 | //# This program is free software; you can redistribute it and/or modify # 6 | //# it under the terms of the GNU General Public License as published by # 7 | //# the Free Software Foundation; version 2 or later of the License. # 8 | //# # 9 | //# This program is distributed in the hope that it will be useful, # 10 | //# but WITHOUT ANY WARRANTY; without even the implied warranty of # 11 | //# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # 12 | //# GNU General Public License for more details. # 13 | //# # 14 | //# COPYRIGHT: EDF R&D / TELECOM ParisTech (ENST-TSI) # 15 | //# # 16 | //########################################################################## 17 | 18 | #ifndef CC_2D_VIEWPORT_OBJECT_HEADER 19 | #define CC_2D_VIEWPORT_OBJECT_HEADER 20 | 21 | //Local 22 | #include "ccHObject.h" 23 | #include "ccGenericGLDisplay.h" 24 | 25 | //! 2D viewport object 26 | class QCC_DB_LIB_API cc2DViewportObject : public ccHObject 27 | { 28 | public: 29 | 30 | //! Default constructor 31 | cc2DViewportObject(QString name = QString()); 32 | 33 | //inherited from ccHObject 34 | virtual CC_CLASS_ENUM getClassID() const override { return CC_TYPES::VIEWPORT_2D_OBJECT; } 35 | virtual bool isSerializable() const override { return true; } 36 | 37 | //! Sets perspective view state 38 | void setParameters(const ccViewportParameters& params) { m_params = params; } 39 | 40 | //! Gets parameters 41 | const ccViewportParameters& getParameters() const { return m_params; } 42 | 43 | protected: 44 | 45 | //inherited from ccHObject 46 | virtual bool toFile_MeOnly(QFile& out) const override; 47 | virtual bool fromFile_MeOnly(QFile& in, short dataVersion, int flags, LoadedIDMap& oldToNewIDMap) override; 48 | 49 | //! Viewport parameters 50 | ccViewportParameters m_params; 51 | }; 52 | 53 | #endif //CC_2D_VIEWPORT_OBJECT_HEADER 54 | -------------------------------------------------------------------------------- /qCC_db/ccAdvancedTypes.cpp: -------------------------------------------------------------------------------- 1 | //########################################################################## 2 | //# # 3 | //# CLOUDCOMPARE # 4 | //# # 5 | //# This program is free software; you can redistribute it and/or modify # 6 | //# it under the terms of the GNU General Public License as published by # 7 | //# the Free Software Foundation; version 2 or later of the License. # 8 | //# # 9 | //# This program is distributed in the hope that it will be useful, # 10 | //# but WITHOUT ANY WARRANTY; without even the implied warranty of # 11 | //# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # 12 | //# GNU General Public License for more details. # 13 | //# # 14 | //# COPYRIGHT: EDF R&D / TELECOM ParisTech (ENST-TSI) # 15 | //# # 16 | //########################################################################## 17 | 18 | #include "ccAdvancedTypes.h" 19 | 20 | NormsIndexesTableType::NormsIndexesTableType() 21 | : ccArray("Compressed normals") 22 | { 23 | } 24 | 25 | bool NormsIndexesTableType::fromFile_MeOnly(QFile& in, short dataVersion, int flags, LoadedIDMap& oldToNewIDMap) 26 | { 27 | if (dataVersion < 41) 28 | { 29 | //in previous versions (< 41) the normals were compressed on 15 bytes (2*6+3) as unsigned short 30 | static const unsigned OLD_QUANTIZE_LEVEL = 6; 31 | 32 | ccArray* oldNormals = new ccArray(); 33 | if (!ccSerializationHelper::GenericArrayFromFile(*oldNormals, in, dataVersion)) 34 | { 35 | oldNormals->release(); 36 | return false; 37 | } 38 | 39 | bool success = false; 40 | try 41 | { 42 | resize(oldNormals->size()); 43 | } 44 | catch (const std::bad_alloc&) 45 | { 46 | oldNormals->release(); 47 | return false; 48 | } 49 | 50 | //convert old normals to new ones 51 | for (size_t i = 0; i < oldNormals->size(); ++i) 52 | { 53 | CCVector3 N; 54 | //decompress (with the old parameters) 55 | { 56 | unsigned short n = oldNormals->at(i); 57 | ccNormalCompressor::Decompress(n, N.u, OLD_QUANTIZE_LEVEL); 58 | } 59 | //and recompress 60 | CompressedNormType index = static_cast(ccNormalCompressor::Compress(N.u)); 61 | at(i) = index; 62 | } 63 | 64 | oldNormals->release(); 65 | return true; 66 | } 67 | else 68 | { 69 | return ccSerializationHelper::GenericArrayFromFile(*this, in, dataVersion); 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /qCC_db/ccBBox.h: -------------------------------------------------------------------------------- 1 | //########################################################################## 2 | //# # 3 | //# CLOUDCOMPARE # 4 | //# # 5 | //# This program is free software; you can redistribute it and/or modify # 6 | //# it under the terms of the GNU General Public License as published by # 7 | //# the Free Software Foundation; version 2 or later of the License. # 8 | //# # 9 | //# This program is distributed in the hope that it will be useful, # 10 | //# but WITHOUT ANY WARRANTY; without even the implied warranty of # 11 | //# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # 12 | //# GNU General Public License for more details. # 13 | //# # 14 | //# COPYRIGHT: EDF R&D / TELECOM ParisTech (ENST-TSI) # 15 | //# # 16 | //########################################################################## 17 | 18 | #ifndef CC_BBOX_HEADER 19 | #define CC_BBOX_HEADER 20 | 21 | //Local 22 | #include "ccDrawableObject.h" 23 | 24 | //CCLib 25 | #include 26 | 27 | //! Bounding box structure 28 | /** Supports several operators such as addition (to a matrix or a vector) and 29 | multiplication (by a matrix or a scalar). 30 | **/ 31 | class QCC_DB_LIB_API ccBBox : public CCLib::BoundingBox 32 | { 33 | public: 34 | 35 | //! Default constructor 36 | ccBBox() : CCLib::BoundingBox() {} 37 | //! Constructor from two vectors (lower min. and upper max. corners) 38 | ccBBox(const CCVector3& bbMinCorner, const CCVector3& bbMaxCorner) : CCLib::BoundingBox(bbMinCorner, bbMaxCorner) {} 39 | //! Constructor from two vectors (lower min. and upper max. corners) 40 | ccBBox(const CCLib::BoundingBox& bbox) : CCLib::BoundingBox(bbox) {} 41 | 42 | //! Applies transformation to the bounding box 43 | const ccBBox operator * (const ccGLMatrix& mat); 44 | //! Applies transformation to the bounding box 45 | const ccBBox operator * (const ccGLMatrixd& mat); 46 | 47 | //! Draws bounding box (OpenGL) 48 | /** \param context OpenGL context 49 | * \param col (R,G,B) color 50 | **/ 51 | void draw(CC_DRAW_CONTEXT& context, const ccColor::Rgb& col) const; 52 | }; 53 | 54 | #endif //CC_BBOX_HEADER 55 | -------------------------------------------------------------------------------- /qCC_db/ccBasicTypes.h: -------------------------------------------------------------------------------- 1 | //########################################################################## 2 | //# # 3 | //# CLOUDCOMPARE # 4 | //# # 5 | //# This program is free software; you can redistribute it and/or modify # 6 | //# it under the terms of the GNU General Public License as published by # 7 | //# the Free Software Foundation; version 2 or later of the License. # 8 | //# # 9 | //# This program is distributed in the hope that it will be useful, # 10 | //# but WITHOUT ANY WARRANTY; without even the implied warranty of # 11 | //# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # 12 | //# GNU General Public License for more details. # 13 | //# # 14 | //# COPYRIGHT: EDF R&D / TELECOM ParisTech (ENST-TSI) # 15 | //# # 16 | //########################################################################## 17 | 18 | #ifndef CC_BASIC_TYPES_HEADER 19 | #define CC_BASIC_TYPES_HEADER 20 | 21 | //CCLib 22 | #include 23 | 24 | //! Compressed normals type 25 | /** Should be set accordingly to ccNormalCompressor::QUANTIZE_LEVEL 26 | **/ 27 | using CompressedNormType = unsigned int; 28 | 29 | #endif //CC_BASIC_TYPES_HEADER 30 | -------------------------------------------------------------------------------- /qCC_db/ccBox.h: -------------------------------------------------------------------------------- 1 | //########################################################################## 2 | //# # 3 | //# CLOUDCOMPARE # 4 | //# # 5 | //# This program is free software; you can redistribute it and/or modify # 6 | //# it under the terms of the GNU General Public License as published by # 7 | //# the Free Software Foundation; version 2 or later of the License. # 8 | //# # 9 | //# This program is distributed in the hope that it will be useful, # 10 | //# but WITHOUT ANY WARRANTY; without even the implied warranty of # 11 | //# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # 12 | //# GNU General Public License for more details. # 13 | //# # 14 | //# COPYRIGHT: EDF R&D / TELECOM ParisTech (ENST-TSI) # 15 | //# # 16 | //########################################################################## 17 | 18 | #ifndef CC_BOX_PRIMITIVE_HEADER 19 | #define CC_BOX_PRIMITIVE_HEADER 20 | 21 | //Local 22 | #include "ccGenericPrimitive.h" 23 | 24 | //! Box (primitive) 25 | /** 3D box primitive 26 | **/ 27 | class QCC_DB_LIB_API ccBox : public ccGenericPrimitive 28 | { 29 | public: 30 | 31 | //! Default constructor 32 | /** Box dimensions axis along each dimension are defined in a single 3D vector. 33 | A box is in fact composed of 6 planes (ccPlane). 34 | \param dims box dimensions 35 | \param transMat optional 3D transformation (can be set afterwards with ccDrawableObject::setGLTransformation) 36 | \param name name 37 | **/ 38 | ccBox( const CCVector3& dims, 39 | const ccGLMatrix* transMat = 0, 40 | QString name = QString("Box")); 41 | 42 | //! Simplified constructor 43 | /** For ccHObject factory only! 44 | **/ 45 | ccBox(QString name = QString("Box")); 46 | 47 | //! Returns class ID 48 | virtual CC_CLASS_ENUM getClassID() const override { return CC_TYPES::BOX; } 49 | 50 | //inherited from ccGenericPrimitive 51 | virtual QString getTypeName() const override { return "Box"; } 52 | virtual ccGenericPrimitive* clone() const override; 53 | 54 | //! Sets box dimensions 55 | inline void setDimensions(CCVector3& dims) { m_dims = dims; updateRepresentation(); } 56 | 57 | //! Returns box dimensions 58 | const CCVector3& getDimensions() const { return m_dims; } 59 | 60 | protected: 61 | 62 | //inherited from ccGenericPrimitive 63 | virtual bool toFile_MeOnly(QFile& out) const override; 64 | virtual bool fromFile_MeOnly(QFile& in, short dataVersion, int flags, LoadedIDMap& oldToNewIDMap) override; 65 | virtual bool buildUp() override; 66 | 67 | //! Box dimensions 68 | CCVector3 m_dims; 69 | 70 | }; 71 | 72 | #endif //CC_BOX_PRIMITIVE_HEADER 73 | -------------------------------------------------------------------------------- /qCC_db/ccChunk.h: -------------------------------------------------------------------------------- 1 | //########################################################################## 2 | //# # 3 | //# CLOUDCOMPARE # 4 | //# # 5 | //# This program is free software; you can redistribute it and/or modify # 6 | //# it under the terms of the GNU General Public License as published by # 7 | //# the Free Software Foundation; version 2 or later of the License. # 8 | //# # 9 | //# This program is distributed in the hope that it will be useful, # 10 | //# but WITHOUT ANY WARRANTY; without even the implied warranty of # 11 | //# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # 12 | //# GNU General Public License for more details. # 13 | //# # 14 | //# COPYRIGHT: Daniel Girardeau-Montaut # 15 | //# # 16 | //########################################################################## 17 | 18 | #ifndef CC_CHUNK_HEADER 19 | #define CC_CHUNK_HEADER 20 | 21 | //System 22 | #include 23 | 24 | //! Fake chunked array management 25 | class ccChunk 26 | { 27 | public: 28 | static const size_t SIZE_POWER = 16; 29 | static const size_t SIZE = (1 << SIZE_POWER); //~ 64K 30 | 31 | inline static size_t Count(size_t elementCount) { return (elementCount >> SIZE_POWER) + ((elementCount & (SIZE - 1)) ? 1 : 0); } 32 | inline static size_t Size(size_t chunkIndex, size_t elementCount) { return (chunkIndex + 1 < Count(elementCount) ? SIZE : elementCount - chunkIndex * SIZE); } 33 | inline static size_t Size(size_t chunkIndex, size_t chunkCount, size_t elementCount) { return (chunkIndex + 1 < chunkCount ? SIZE : elementCount - chunkIndex * SIZE); } 34 | inline static size_t StartPos(size_t chunkIndex) { return chunkIndex * SIZE; } 35 | template inline static T* Start(std::vector& buffer, size_t chunkIndex) { return buffer.data() + StartPos(chunkIndex); } 36 | template inline static const T* Start(const std::vector& buffer, size_t chunkIndex) { return buffer.data() + StartPos(chunkIndex); } 37 | template inline static size_t Count(const std::vector& buffer) { return Count(buffer.size()); } 38 | template inline static size_t Size(size_t chunkIndex, const std::vector& buffer) { return Size(chunkIndex, buffer.size()); } 39 | }; 40 | 41 | #endif //CC_CHUNK_HEADER 42 | -------------------------------------------------------------------------------- /qCC_db/ccColorRampShader.h: -------------------------------------------------------------------------------- 1 | //########################################################################## 2 | //# # 3 | //# CLOUDCOMPARE # 4 | //# # 5 | //# This program is free software; you can redistribute it and/or modify # 6 | //# it under the terms of the GNU General Public License as published by # 7 | //# the Free Software Foundation; version 2 or later of the License. # 8 | //# # 9 | //# This program is distributed in the hope that it will be useful, # 10 | //# but WITHOUT ANY WARRANTY; without even the implied warranty of # 11 | //# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # 12 | //# GNU General Public License for more details. # 13 | //# # 14 | //# COPYRIGHT: EDF R&D / TELECOM ParisTech (ENST-TSI) # 15 | //# # 16 | //########################################################################## 17 | 18 | #ifndef CC_COLOR_RAMP_SHADER_HEADER 19 | #define CC_COLOR_RAMP_SHADER_HEADER 20 | 21 | //Always on top! 22 | #include "ccIncludeGL.h" 23 | 24 | //CCFbo 25 | #include 26 | 27 | //Local 28 | #include "ccColorScale.h" 29 | 30 | class QCC_DB_LIB_API ccColorRampShader : public ccShader 31 | { 32 | Q_OBJECT 33 | 34 | public: 35 | 36 | //! Default constructor 37 | ccColorRampShader(); 38 | 39 | //! Destructor 40 | virtual ~ccColorRampShader() {} 41 | 42 | //! Setups shader 43 | /** Shader must have already been stared! 44 | **/ 45 | bool setup(QOpenGLFunctions_2_1* glFunc, float minSatRel, float maxSatRel, unsigned colorSteps, const ccColorScale::Shared& colorScale); 46 | 47 | //! Returns the maximum color ramp size 48 | static unsigned MaxColorRampSize(); 49 | 50 | //! Returns the minimum memory required on the shader side 51 | /** See GL_MAX_FRAGMENT_UNIFORM_COMPONENTS 52 | **/ 53 | static GLint MinRequiredBytes(); 54 | 55 | }; 56 | 57 | #endif //CC_COLOR_RAMP_SHADER_HEADER 58 | -------------------------------------------------------------------------------- /qCC_db/ccColorScalesManager.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yaoli1992/ccCloudViewer/94211298a3b0382f816c7c2d8a803eb5dd22d305/qCC_db/ccColorScalesManager.cpp -------------------------------------------------------------------------------- /qCC_db/ccColorScalesManager.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yaoli1992/ccCloudViewer/94211298a3b0382f816c7c2d8a803eb5dd22d305/qCC_db/ccColorScalesManager.h -------------------------------------------------------------------------------- /qCC_db/ccColorTypes.cpp: -------------------------------------------------------------------------------- 1 | //########################################################################## 2 | //# # 3 | //# CLOUDCOMPARE # 4 | //# # 5 | //# This program is free software; you can redistribute it and/or modify # 6 | //# it under the terms of the GNU General Public License as published by # 7 | //# the Free Software Foundation; version 2 or later of the License. # 8 | //# # 9 | //# This program is distributed in the hope that it will be useful, # 10 | //# but WITHOUT ANY WARRANTY; without even the implied warranty of # 11 | //# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # 12 | //# GNU General Public License for more details. # 13 | //# # 14 | //# COPYRIGHT: EDF R&D / TELECOM ParisTech (ENST-TSI) # 15 | //# # 16 | //########################################################################## 17 | 18 | #include 19 | #include 20 | 21 | #include "ccColorTypes.h" 22 | 23 | 24 | namespace ccColor 25 | { 26 | 27 | Rgb Generator::Random(bool lightOnly) 28 | { 29 | std::random_device rd; // non-deterministic generator 30 | std::mt19937 gen(rd()); // to seed mersenne twister. 31 | std::uniform_int_distribution dist(0, MAX); //1-byte types are not allowed 32 | 33 | Rgb col; 34 | col.r = static_cast(dist(gen)); 35 | col.g = static_cast(dist(gen)); 36 | if (lightOnly) 37 | { 38 | col.b = MAX - static_cast((static_cast(col.r) + static_cast(col.g)) / 2); //cast to double to avoid overflow (whatever the type of ColorCompType!!!) 39 | } 40 | else 41 | { 42 | col.b = static_cast(dist(gen)); 43 | } 44 | 45 | return col; 46 | } 47 | 48 | Rgb Convert::hsv2rgb(float H, float S, float V) 49 | { 50 | float hi = 0; 51 | float f = std::modf(H / 60.0f, &hi); 52 | 53 | float l = V*(1.0f - S); 54 | float m = V*(1.0f - f*S); 55 | float n = V*(1.0f - (1.0f - f)*S); 56 | 57 | Rgbf rgb(0, 0, 0); 58 | 59 | switch (static_cast(hi) % 6) 60 | { 61 | case 0: 62 | rgb.r = V; rgb.g = n; rgb.b = l; 63 | break; 64 | case 1: 65 | rgb.r = m; rgb.g = V; rgb.b = l; 66 | break; 67 | case 2: 68 | rgb.r = l; rgb.g = V; rgb.b = n; 69 | break; 70 | case 3: 71 | rgb.r = l; rgb.g = m; rgb.b = V; 72 | break; 73 | case 4: 74 | rgb.r = n; rgb.g = l; rgb.b = V; 75 | break; 76 | case 5: 77 | rgb.r = V; rgb.g = l; rgb.b = m; 78 | break; 79 | } 80 | 81 | return Rgb (static_cast(rgb.r * ccColor::MAX), 82 | static_cast(rgb.g * ccColor::MAX), 83 | static_cast(rgb.b * ccColor::MAX)); 84 | } 85 | 86 | }; 87 | -------------------------------------------------------------------------------- /qCC_db/ccCustomObject.h: -------------------------------------------------------------------------------- 1 | //########################################################################## 2 | //# # 3 | //# CLOUDCOMPARE # 4 | //# # 5 | //# This program is free software; you can redistribute it and/or modify # 6 | //# it under the terms of the GNU General Public License as published by # 7 | //# the Free Software Foundation; version 2 or later of the License. # 8 | //# # 9 | //# This program is distributed in the hope that it will be useful, # 10 | //# but WITHOUT ANY WARRANTY; without even the implied warranty of # 11 | //# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # 12 | //# GNU General Public License for more details. # 13 | //# # 14 | //# COPYRIGHT: EDF R&D / TELECOM ParisTech (ENST-TSI) # 15 | //# # 16 | //########################################################################## 17 | 18 | #ifndef CC_CUSTOM_OBJECT_HEADER 19 | #define CC_CUSTOM_OBJECT_HEADER 20 | 21 | //Local 22 | #include "ccHObject.h" 23 | 24 | //! Custom hierarchy object 25 | /** Used internally for deserialization of plugin-defined hierarchy objects 26 | (see CC_TYPES::CUSTOM_H_OBJECT). 27 | **/ 28 | class QCC_DB_LIB_API ccCustomHObject : public ccHObject 29 | { 30 | public: 31 | 32 | //! Default constructor 33 | /** \param name object name (optional) 34 | **/ 35 | ccCustomHObject(QString name = QString()) 36 | : ccHObject(name) 37 | {} 38 | 39 | //inherited from ccHObject 40 | bool isSerializable() const override { return true; } 41 | 42 | // inherited from ccObject 43 | CC_CLASS_ENUM getClassID() const override { return CC_TYPES::CUSTOM_H_OBJECT; } 44 | 45 | //! Returns the default key for the "class name" metadata 46 | /** See ccHObject::New. 47 | **/ 48 | static QString DefautMetaDataClassName() { return QString("class_name"); } 49 | //! Returns the default key for the "plugin name" metadata 50 | /** See ccHObject::New. 51 | **/ 52 | static QString DefautMetaDataPluginName() { return QString("plugin_name"); } 53 | }; 54 | 55 | //! Custom leaf object 56 | /** Used internally for deserialization of plugin-defined leaf objects 57 | (see CC_TYPES::CUSTOM_LEAF_OBJECT). 58 | **/ 59 | class QCC_DB_LIB_API ccCustomLeafObject : public ccCustomHObject 60 | { 61 | public: 62 | 63 | //! Default constructor 64 | /** \param name object name (optional) 65 | **/ 66 | ccCustomLeafObject(QString name = QString()) : ccCustomHObject(name) {} 67 | 68 | // inherited from ccCustomHObject 69 | CC_CLASS_ENUM getClassID() const override { return CC_TYPES::CUSTOM_LEAF_OBJECT; } 70 | }; 71 | 72 | #endif //CC_CUSTOM_OBJECT_HEADER 73 | -------------------------------------------------------------------------------- /qCC_db/ccCylinder.cpp: -------------------------------------------------------------------------------- 1 | //########################################################################## 2 | //# # 3 | //# CLOUDCOMPARE # 4 | //# # 5 | //# This program is free software; you can redistribute it and/or modify # 6 | //# it under the terms of the GNU General Public License as published by # 7 | //# the Free Software Foundation; version 2 or later of the License. # 8 | //# # 9 | //# This program is distributed in the hope that it will be useful, # 10 | //# but WITHOUT ANY WARRANTY; without even the implied warranty of # 11 | //# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # 12 | //# GNU General Public License for more details. # 13 | //# # 14 | //# COPYRIGHT: EDF R&D / TELECOM ParisTech (ENST-TSI) # 15 | //# # 16 | //########################################################################## 17 | 18 | #include "ccCylinder.h" 19 | 20 | ccCylinder::ccCylinder( PointCoordinateType radius, 21 | PointCoordinateType height, 22 | const ccGLMatrix* transMat/*=0*/, 23 | QString name/*=QString("Cylinder")*/, 24 | unsigned precision/*=DEFAULT_DRAWING_PRECISION*/, 25 | unsigned uniqueID/*=ccUniqueIDGenerator::InvalidUniqueID*/) 26 | : ccCone(radius, radius, height, 0, 0, transMat, name, precision, uniqueID) 27 | { 28 | } 29 | 30 | ccCylinder::ccCylinder(QString name/*=QString("Cylinder")*/) 31 | : ccCone(name) 32 | { 33 | } 34 | 35 | ccGenericPrimitive* ccCylinder::clone() const 36 | { 37 | return finishCloneJob(new ccCylinder(m_bottomRadius, m_height, &m_transformation, getName(), m_drawPrecision)); 38 | } 39 | 40 | void ccCylinder::setBottomRadius(PointCoordinateType radius) 41 | { 42 | //we set the top radius as well! 43 | m_topRadius = radius; 44 | ccCone::setBottomRadius(radius); 45 | } 46 | 47 | -------------------------------------------------------------------------------- /qCC_db/ccDepthBuffer.h: -------------------------------------------------------------------------------- 1 | //########################################################################## 2 | //# # 3 | //# CLOUDCOMPARE # 4 | //# # 5 | //# This program is free software; you can redistribute it and/or modify # 6 | //# it under the terms of the GNU General Public License as published by # 7 | //# the Free Software Foundation; version 2 or later of the License. # 8 | //# # 9 | //# This program is distributed in the hope that it will be useful, # 10 | //# but WITHOUT ANY WARRANTY; without even the implied warranty of # 11 | //# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # 12 | //# GNU General Public License for more details. # 13 | //# # 14 | //# COPYRIGHT: EDF R&D / TELECOM ParisTech (ENST-TSI) # 15 | //# # 16 | //########################################################################## 17 | 18 | #ifndef CC_DEPTH_BUFFER_HEADER 19 | #define CC_DEPTH_BUFFER_HEADER 20 | 21 | //local 22 | #include "qCC_db.h" 23 | #include 24 | 25 | //System 26 | #include 27 | 28 | //! Sensor "depth map" 29 | /** Contains an array of depth values (along each scanned direction) and its dimensions. 30 | This array corresponds roughly to what have been "seen" by the sensor during 31 | acquisition (the 3D points are simply projected in the sensor frame). 32 | **/ 33 | class QCC_DB_LIB_API ccDepthBuffer 34 | { 35 | public: 36 | //! Default constructor 37 | ccDepthBuffer(); 38 | //! Destructor 39 | virtual ~ccDepthBuffer(); 40 | 41 | //! Z-Buffer grid 42 | std::vector zBuff; 43 | //! Pitch step (may differ from the sensor's) 44 | PointCoordinateType deltaPhi; 45 | //! Yaw step (may differ from the sensor's) 46 | PointCoordinateType deltaTheta; 47 | //! Buffer width 48 | unsigned width; 49 | //! Buffer height 50 | unsigned height; 51 | 52 | //! Clears the buffer 53 | void clear(); 54 | 55 | //! Applies a mean filter to fill small holes (= lack of information) of the depth map. 56 | /** The depth buffer must have been created before (see GroundBasedLidarSensor::computeDepthBuffer). 57 | \return a negative value if an error occurs, 0 otherwise 58 | **/ 59 | int fillHoles(); 60 | }; 61 | 62 | #endif //CC_DEPTH_BUFFER_HEADER 63 | -------------------------------------------------------------------------------- /qCC_db/ccExternalFactory.cpp: -------------------------------------------------------------------------------- 1 | //########################################################################## 2 | //# # 3 | //# CLOUDCOMPARE # 4 | //# # 5 | //# This program is free software; you can redistribute it and/or modify # 6 | //# it under the terms of the GNU General Public License as published by # 7 | //# the Free Software Foundation; version 2 or later of the License. # 8 | //# # 9 | //# This program is distributed in the hope that it will be useful, # 10 | //# but WITHOUT ANY WARRANTY; without even the implied warranty of # 11 | //# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # 12 | //# GNU General Public License for more details. # 13 | //# # 14 | //# COPYRIGHT: EDF R&D / TELECOM ParisTech (ENST-TSI) # 15 | //# # 16 | //########################################################################## 17 | 18 | #include "ccExternalFactory.h" 19 | 20 | //! Container singleton 21 | static QSharedPointer s_externalFactoryContainer(nullptr); 22 | 23 | ccExternalFactory::ccExternalFactory(QString factoryName) 24 | : m_factoryName(factoryName) 25 | {} 26 | 27 | ccExternalFactory* ccExternalFactory::Container::getFactoryByName(const QString& factoryName) const 28 | { 29 | if (m_factories.contains(factoryName)) 30 | return m_factories.value(factoryName); 31 | else 32 | return nullptr; 33 | } 34 | 35 | void ccExternalFactory::Container::addFactory(ccExternalFactory *factory) 36 | { 37 | if (!factory) //do nothing 38 | return; 39 | 40 | QString name = factory->getFactoryName(); 41 | 42 | m_factories[name] = factory; 43 | } 44 | 45 | ccExternalFactory::Container::Shared ccExternalFactory::Container::GetUniqueInstance() 46 | { 47 | if (!s_externalFactoryContainer) 48 | { 49 | s_externalFactoryContainer = Container::Shared(new ccExternalFactory::Container()); 50 | } 51 | return s_externalFactoryContainer; 52 | } 53 | 54 | void ccExternalFactory::Container::SetUniqueInstance(Container::Shared container) 55 | { 56 | s_externalFactoryContainer = container; 57 | } 58 | -------------------------------------------------------------------------------- /qCC_db/ccFileUtils.h: -------------------------------------------------------------------------------- 1 | #ifndef CCFILEUTILS_H 2 | #define CCFILEUTILS_H 3 | //########################################################################## 4 | //# # 5 | //# CLOUDCOMPARE # 6 | //# # 7 | //# This program is free software; you can redistribute it and/or modify # 8 | //# it under the terms of the GNU General Public License as published by # 9 | //# the Free Software Foundation; version 2 or later of the License. # 10 | //# # 11 | //# This program is distributed in the hope that it will be useful, # 12 | //# but WITHOUT ANY WARRANTY; without even the implied warranty of # 13 | //# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # 14 | //# GNU General Public License for more details. # 15 | //# # 16 | //# COPYRIGHT: CloudCompare project # 17 | //# # 18 | //########################################################################## 19 | 20 | #include 21 | 22 | namespace ccFileUtils 23 | { 24 | //! Shortcut for getting the documents location path 25 | inline QString defaultDocPath() 26 | { 27 | // note that according to the docs the QStandardPaths::DocumentsLocation path is never empty 28 | return QStandardPaths::standardLocations( QStandardPaths::DocumentsLocation ).first(); 29 | } 30 | } 31 | #endif 32 | -------------------------------------------------------------------------------- /qCC_db/ccFlags.h: -------------------------------------------------------------------------------- 1 | //########################################################################## 2 | //# # 3 | //# CLOUDCOMPARE # 4 | //# # 5 | //# This program is free software; you can redistribute it and/or modify # 6 | //# it under the terms of the GNU General Public License as published by # 7 | //# the Free Software Foundation; version 2 or later of the License. # 8 | //# # 9 | //# This program is distributed in the hope that it will be useful, # 10 | //# but WITHOUT ANY WARRANTY; without even the implied warranty of # 11 | //# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # 12 | //# GNU General Public License for more details. # 13 | //# # 14 | //# COPYRIGHT: EDF R&D / TELECOM ParisTech (ENST-TSI) # 15 | //# # 16 | //########################################################################## 17 | 18 | #ifndef CC_FLAGS_HEADER 19 | #define CC_FLAGS_HEADER 20 | 21 | //System 22 | #include 23 | 24 | //! Flags 25 | class ccFlags 26 | { 27 | public: 28 | 29 | //! Sets all bits to 0 30 | void reset() 31 | { 32 | memset(table,0,sizeof(bool)*8); 33 | } 34 | 35 | //! Converts a byte to this structure 36 | void fromByte(unsigned char byte) 37 | { 38 | unsigned char i,mask = 1; 39 | for (i=0;i<8;++i) 40 | { 41 | table[i] = ((byte & mask) == mask); 42 | mask <<= 1; 43 | } 44 | } 45 | 46 | //! Converts this structure to a byte 47 | unsigned char toByte() const 48 | { 49 | unsigned char i,byte = 0,mask = 1; 50 | for (i=0;i<8;++i) 51 | { 52 | if (table[i]) 53 | byte |= mask; 54 | mask <<= 1; 55 | } 56 | 57 | return byte; 58 | } 59 | 60 | //! Table of 8 booleans (one per bit) 61 | bool table[8]; 62 | }; 63 | 64 | #endif //CC_FLAGS_HEADER 65 | -------------------------------------------------------------------------------- /qCC_db/ccInteractor.h: -------------------------------------------------------------------------------- 1 | //########################################################################## 2 | //# # 3 | //# CLOUDCOMPARE # 4 | //# # 5 | //# This program is free software; you can redistribute it and/or modify # 6 | //# it under the terms of the GNU General Public License as published by # 7 | //# the Free Software Foundation; version 2 or later of the License. # 8 | //# # 9 | //# This program is distributed in the hope that it will be useful, # 10 | //# but WITHOUT ANY WARRANTY; without even the implied warranty of # 11 | //# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # 12 | //# GNU General Public License for more details. # 13 | //# # 14 | //# COPYRIGHT: EDF R&D / TELECOM ParisTech (ENST-TSI) # 15 | //# # 16 | //########################################################################## 17 | 18 | #ifndef CC_INTERACTOR_HEADER 19 | #define CC_INTERACTOR_HEADER 20 | 21 | //Local 22 | #include "qCC_db.h" 23 | 24 | #include "CCGeom.h" 25 | 26 | //Qt 27 | #include 28 | 29 | //! Interactor interface (entity that can be dragged or clicked in a 3D view) 30 | class QCC_DB_LIB_API ccInteractor 31 | { 32 | public: 33 | 34 | virtual ~ccInteractor() = default; 35 | 36 | //! Called on mouse click 37 | virtual bool acceptClick(int x, int y, Qt::MouseButton button) { return false; } 38 | 39 | //! Called on mouse move (for 2D interactors) 40 | /** \return true if a movement occurs 41 | **/ 42 | virtual bool move2D(int x, int y, int dx, int dy, int screenWidth, int screenHeight) { return false; } 43 | 44 | //! Called on mouse move (for 3D interactors) 45 | /** \return true if a movement occurs 46 | **/ 47 | virtual bool move3D(const CCVector3d& u) { return false; } 48 | 49 | }; 50 | 51 | #endif //CC_INTERACTOR_HEADER 52 | -------------------------------------------------------------------------------- /qCC_db/ccMinimumSpanningTreeForNormsDirection.h: -------------------------------------------------------------------------------- 1 | //########################################################################## 2 | //# # 3 | //# CLOUDCOMPARE # 4 | //# # 5 | //# This program is free software; you can redistribute it and/or modify # 6 | //# it under the terms of the GNU General Public License as published by # 7 | //# the Free Software Foundation; version 2 or later of the License. # 8 | //# # 9 | //# This program is distributed in the hope that it will be useful, # 10 | //# but WITHOUT ANY WARRANTY; without even the implied warranty of # 11 | //# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # 12 | //# GNU General Public License for more details. # 13 | //# # 14 | //# COPYRIGHT: EDF R&D / TELECOM ParisTech (ENST-TSI) # 15 | //# # 16 | //########################################################################## 17 | 18 | #ifndef CC_MST_FOR_NORMS_DIRECTION_HEADER 19 | #define CC_MST_FOR_NORMS_DIRECTION_HEADER 20 | 21 | class ccPointCloud; 22 | class ccProgressDialog; 23 | 24 | //! Minimum Spanning Tree for normals direction resolution 25 | /** See http://people.maths.ox.ac.uk/wendland/research/old/reconhtml/node3.html 26 | **/ 27 | class ccMinimumSpanningTreeForNormsDirection 28 | { 29 | public: 30 | 31 | //! Main entry point 32 | static bool OrientNormals( ccPointCloud* cloud, 33 | unsigned kNN = 6, 34 | ccProgressDialog* progressDlg = 0); 35 | }; 36 | 37 | #endif //CC_MST_FOR_NORMS_DIRECTION_HEADER 38 | -------------------------------------------------------------------------------- /qCC_db/ccNormalCompressor.h: -------------------------------------------------------------------------------- 1 | //########################################################################## 2 | //# # 3 | //# CLOUDCOMPARE # 4 | //# # 5 | //# This program is free software; you can redistribute it and/or modify # 6 | //# it under the terms of the GNU General Public License as published by # 7 | //# the Free Software Foundation; version 2 or later of the License. # 8 | //# # 9 | //# This program is distributed in the hope that it will be useful, # 10 | //# but WITHOUT ANY WARRANTY; without even the implied warranty of # 11 | //# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # 12 | //# GNU General Public License for more details. # 13 | //# # 14 | //# COPYRIGHT: EDF R&D / TELECOM ParisTech (ENST-TSI) # 15 | //# # 16 | //########################################################################## 17 | 18 | #ifndef CC_NORMAL_COMPRESSOR_HEADER 19 | #define CC_NORMAL_COMPRESSOR_HEADER 20 | 21 | //Local 22 | #include "qCC_db.h" 23 | #include "ccBasicTypes.h" 24 | 25 | //! Normal compressor 26 | class QCC_DB_LIB_API ccNormalCompressor 27 | { 28 | public: 29 | 30 | //! Compressed normals quantization level (number of directions: 2^(2*N+3)) 31 | /** \warning Never pass a 'constant initializer' by reference 32 | **/ 33 | static const unsigned char QUANTIZE_LEVEL = 9; //2097152 normals * 12 bytes = 24 Mb of memory 34 | 35 | //! Last valid normal code 36 | static const unsigned MAX_VALID_NORM_CODE = (1 << (QUANTIZE_LEVEL * 2 + 3)) - 1; 37 | //! Null normal code 38 | static const unsigned NULL_NORM_CODE = MAX_VALID_NORM_CODE + 1; 39 | 40 | //! Compression algorithm 41 | static unsigned Compress(const PointCoordinateType N[3]); 42 | 43 | //! Decompression algorithm 44 | static void Decompress(unsigned index, PointCoordinateType N[3], unsigned char level = QUANTIZE_LEVEL); 45 | 46 | //! Inverts a (compressed) normal 47 | static void InvertNormal(CompressedNormType &code); 48 | 49 | }; 50 | 51 | #endif //CC_NORMAL_COMPRESSOR_HEADER 52 | -------------------------------------------------------------------------------- /qCC_db/ccOctreeProxy.cpp: -------------------------------------------------------------------------------- 1 | //########################################################################## 2 | //# # 3 | //# CLOUDCOMPARE # 4 | //# # 5 | //# This program is free software; you can redistribute it and/or modify # 6 | //# it under the terms of the GNU General Public License as published by # 7 | //# the Free Software Foundation; version 2 or later of the License. # 8 | //# # 9 | //# This program is distributed in the hope that it will be useful, # 10 | //# but WITHOUT ANY WARRANTY; without even the implied warranty of # 11 | //# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # 12 | //# GNU General Public License for more details. # 13 | //# # 14 | //# COPYRIGHT: EDF R&D / TELECOM ParisTech (ENST-TSI) # 15 | //# # 16 | //########################################################################## 17 | 18 | //Always first 19 | //#include "ccIncludeGL.h" 20 | 21 | #include "ccOctreeProxy.h" 22 | 23 | //Local 24 | //#include "ccCameraSensor.h" 25 | //#include "ccNormalVectors.h" 26 | //#include "ccBox.h" 27 | 28 | //CCLib 29 | //#include 30 | //#include 31 | 32 | ccOctreeProxy::ccOctreeProxy( ccOctree::Shared octree/*=ccOctree::Shared(0)*/, 33 | QString name/*="Octree"*/) 34 | : ccHObject(name) 35 | , m_octree(octree) 36 | { 37 | setVisible(false); 38 | lockVisibility(false); 39 | } 40 | 41 | ccBBox ccOctreeProxy::getOwnBB(bool withGLFeatures/*=false*/) 42 | { 43 | if (!m_octree) 44 | { 45 | assert(false); 46 | return ccBBox(); 47 | } 48 | 49 | return withGLFeatures ? m_octree->getSquareBB() : m_octree->getPointsBB(); 50 | } 51 | 52 | void ccOctreeProxy::drawMeOnly(CC_DRAW_CONTEXT& context) 53 | { 54 | if (!m_octree) 55 | { 56 | assert(false); 57 | return; 58 | } 59 | 60 | if (!MACRO_Draw3D(context)) 61 | return; 62 | 63 | //get the set of OpenGL functions (version 2.1) 64 | QOpenGLFunctions_2_1 *glFunc = context.glFunctions(); 65 | assert(glFunc != nullptr); 66 | 67 | if (glFunc == nullptr) 68 | return; 69 | 70 | bool pushName = MACRO_DrawEntityNames(context); 71 | 72 | if (pushName) 73 | { 74 | //not fast at all! 75 | if (MACRO_DrawFastNamesOnly(context)) 76 | return; 77 | glFunc->glPushName(getUniqueIDForDisplay()); 78 | } 79 | 80 | m_octree->draw(context); 81 | 82 | if (pushName) 83 | { 84 | glFunc->glPopName(); 85 | } 86 | } 87 | -------------------------------------------------------------------------------- /qCC_db/ccOctreeProxy.h: -------------------------------------------------------------------------------- 1 | //########################################################################## 2 | //# # 3 | //# CLOUDCOMPARE # 4 | //# # 5 | //# This program is free software; you can redistribute it and/or modify # 6 | //# it under the terms of the GNU General Public License as published by # 7 | //# the Free Software Foundation; version 2 or later of the License. # 8 | //# # 9 | //# This program is distributed in the hope that it will be useful, # 10 | //# but WITHOUT ANY WARRANTY; without even the implied warranty of # 11 | //# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # 12 | //# GNU General Public License for more details. # 13 | //# # 14 | //# COPYRIGHT: EDF R&D / TELECOM ParisTech (ENST-TSI) # 15 | //# # 16 | //########################################################################## 17 | 18 | #ifndef CC_OCTREE_PROXY_HEADER 19 | #define CC_OCTREE_PROXY_HEADER 20 | 21 | //Local 22 | #include "ccHObject.h" 23 | 24 | //CCLib 25 | #include 26 | 27 | //! Octree structure proxy 28 | /** Implements ccHObject while holding a (shared) pointer on the octree instance (--> safer) 29 | **/ 30 | class QCC_DB_LIB_API ccOctreeProxy : public ccHObject 31 | { 32 | public: 33 | 34 | //! Default constructor 35 | ccOctreeProxy(ccOctree::Shared octree = ccOctree::Shared(0), QString name = "Octree"); 36 | 37 | //! Destructor 38 | virtual ~ccOctreeProxy() = default; 39 | 40 | //! Sets the associated octree 41 | inline void setOctree(ccOctree::Shared octree) { m_octree = octree; } 42 | 43 | //! Returns the associated octree 44 | inline ccOctree::Shared getOctree() const { return m_octree; } 45 | 46 | //Inherited from ccHObject 47 | virtual CC_CLASS_ENUM getClassID() const override { return CC_TYPES::POINT_OCTREE; } 48 | virtual ccBBox getOwnBB(bool withGLFeatures = false) override; 49 | 50 | protected: 51 | 52 | //Inherited from ccHObject 53 | virtual void drawMeOnly(CC_DRAW_CONTEXT& context) override; 54 | 55 | protected: //members 56 | 57 | //! Associated octree 58 | ccOctree::Shared m_octree; 59 | }; 60 | 61 | #endif //CC_OCTREE_PROXY_HEADER 62 | -------------------------------------------------------------------------------- /qCC_db/ccOctreeSpinBox.cpp: -------------------------------------------------------------------------------- 1 | //########################################################################## 2 | //# # 3 | //# CLOUDCOMPARE # 4 | //# # 5 | //# This program is free software; you can redistribute it and/or modify # 6 | //# it under the terms of the GNU General Public License as published by # 7 | //# the Free Software Foundation; version 2 or later of the License. # 8 | //# # 9 | //# This program is distributed in the hope that it will be useful, # 10 | //# but WITHOUT ANY WARRANTY; without even the implied warranty of # 11 | //# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # 12 | //# GNU General Public License for more details. # 13 | //# # 14 | //# COPYRIGHT: EDF R&D / TELECOM ParisTech (ENST-TSI) # 15 | //# # 16 | //########################################################################## 17 | 18 | #include "ccOctreeSpinBox.h" 19 | 20 | //CCLib 21 | #include 22 | 23 | //qCC_db 24 | #include 25 | #include 26 | #include 27 | 28 | ccOctreeSpinBox::ccOctreeSpinBox(QWidget* parent/*=0*/) 29 | : QSpinBox(parent) 30 | , m_octreeBoxWidth(0) 31 | { 32 | setRange(0, CCLib::DgmOctree::MAX_OCTREE_LEVEL); 33 | 34 | //we'll catch any modification of the spinbox value and update the suffix consequently 35 | connect(this, static_cast(&ccOctreeSpinBox::valueChanged), this, &ccOctreeSpinBox::onValueChange); 36 | } 37 | 38 | void ccOctreeSpinBox::setCloud(ccGenericPointCloud* cloud) 39 | { 40 | if (!cloud) 41 | { 42 | assert(false); 43 | return; 44 | } 45 | 46 | if (cloud->getOctree()) 47 | { 48 | setOctree(cloud->getOctree().data()); 49 | } 50 | else 51 | { 52 | ccBBox box = cloud->getOwnBB(false); 53 | CCLib::CCMiscTools::MakeMinAndMaxCubical(box.minCorner(), box.maxCorner()); 54 | m_octreeBoxWidth = box.getMaxBoxDim(); 55 | onValueChange(value()); 56 | } 57 | } 58 | 59 | void ccOctreeSpinBox::setOctree(CCLib::DgmOctree* octree) 60 | { 61 | if (octree) 62 | { 63 | m_octreeBoxWidth = static_cast(octree->getCellSize(0)); 64 | onValueChange(value()); 65 | } 66 | else 67 | { 68 | m_octreeBoxWidth = 0; 69 | setSuffix(QString()); 70 | } 71 | } 72 | 73 | void ccOctreeSpinBox::onValueChange(int level) 74 | { 75 | if (m_octreeBoxWidth > 0) 76 | { 77 | if (level >= 0/* && level <= CCLib::DgmOctree::MAX_OCTREE_LEVEL*/) 78 | { 79 | double cs = m_octreeBoxWidth / pow(2.0, static_cast(level)); 80 | setSuffix(QString(" (grid step = %1)").arg(cs)); 81 | } 82 | else 83 | { 84 | //invalid level?! 85 | setSuffix(QString()); 86 | } 87 | } 88 | } 89 | -------------------------------------------------------------------------------- /qCC_db/ccOctreeSpinBox.h: -------------------------------------------------------------------------------- 1 | //########################################################################## 2 | //# # 3 | //# CLOUDCOMPARE # 4 | //# # 5 | //# This program is free software; you can redistribute it and/or modify # 6 | //# it under the terms of the GNU General Public License as published by # 7 | //# the Free Software Foundation; version 2 or later of the License. # 8 | //# # 9 | //# This program is distributed in the hope that it will be useful, # 10 | //# but WITHOUT ANY WARRANTY; without even the implied warranty of # 11 | //# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # 12 | //# GNU General Public License for more details. # 13 | //# # 14 | //# COPYRIGHT: EDF R&D / TELECOM ParisTech (ENST-TSI) # 15 | //# # 16 | //########################################################################## 17 | 18 | #ifndef CC_OCTREE_SPIN_BOX_HEADER 19 | #define CC_OCTREE_SPIN_BOX_HEADER 20 | 21 | //Local 22 | #include "qCC_db.h" 23 | 24 | //CCLib 25 | #include 26 | 27 | //Qt 28 | #include 29 | 30 | class ccGenericPointCloud; 31 | 32 | //! Octree level editor dialog 33 | class QCC_DB_LIB_API ccOctreeSpinBox : public QSpinBox 34 | { 35 | Q_OBJECT 36 | 37 | public: 38 | 39 | //! Default constructor 40 | explicit ccOctreeSpinBox(QWidget* parent = 0); 41 | 42 | //! Inits the dialog with a cloud (on which the octree has been or will be computed) 43 | /** Alternative to ccOctreeSpinBox::setOctree 44 | **/ 45 | void setCloud(ccGenericPointCloud* cloud); 46 | 47 | //! Inits the dialog with an octree 48 | /** Alternative to ccOctreeSpinBox::setCloud 49 | **/ 50 | void setOctree(CCLib::DgmOctree* octree); 51 | 52 | protected slots: 53 | 54 | //! Called each time the spinbox value changes 55 | void onValueChange(int); 56 | 57 | protected: 58 | 59 | //! Corresponding octree base size 60 | double m_octreeBoxWidth; 61 | 62 | }; 63 | 64 | #endif //CC_OCTREE_SPIN_BOX_HEADER 65 | -------------------------------------------------------------------------------- /qCC_db/ccPlanarEntityInterface.cpp: -------------------------------------------------------------------------------- 1 | #include "ccPlanarEntityInterface.h" 2 | 3 | //Local 4 | #include 5 | #include 6 | 7 | //Qt 8 | #include 9 | 10 | ccPlanarEntityInterface::ccPlanarEntityInterface() 11 | : m_showNormalVector(false) 12 | { 13 | } 14 | 15 | //unit normal representation 16 | static QSharedPointer c_unitNormalSymbol(nullptr); 17 | static QSharedPointer c_unitNormalHeadSymbol(nullptr); 18 | 19 | void ccPlanarEntityInterface::glDrawNormal(CC_DRAW_CONTEXT& context, const CCVector3& pos, float scale, const ccColor::Rgb* color/*=0*/) 20 | { 21 | //get the set of OpenGL functions (version 2.1) 22 | QOpenGLFunctions_2_1 *glFunc = context.glFunctions(); 23 | assert(glFunc != nullptr); 24 | 25 | if (glFunc == nullptr) 26 | return; 27 | 28 | if (!c_unitNormalSymbol) 29 | { 30 | c_unitNormalSymbol = QSharedPointer(new ccCylinder(0.02f, 0.9f, nullptr, "UnitNormal", 12)); 31 | c_unitNormalSymbol->showColors(true); 32 | c_unitNormalSymbol->setVisible(true); 33 | c_unitNormalSymbol->setEnabled(true); 34 | c_unitNormalSymbol->setTempColor(ccColor::green); 35 | } 36 | if (!c_unitNormalHeadSymbol) 37 | { 38 | c_unitNormalHeadSymbol = QSharedPointer(new ccCone(0.05f, 0.0f, 0.1f, 0, 0, nullptr, "UnitNormalHead", 12)); 39 | c_unitNormalHeadSymbol->showColors(true); 40 | c_unitNormalHeadSymbol->setVisible(true); 41 | c_unitNormalHeadSymbol->setEnabled(true); 42 | c_unitNormalHeadSymbol->setTempColor(ccColor::green); 43 | } 44 | 45 | //build-up the normal representation own 'context' 46 | CC_DRAW_CONTEXT normalContext = context; 47 | normalContext.drawingFlags &= (~CC_DRAW_ENTITY_NAMES); //we must remove the 'push name flag' so that the primitives don't push their own! 48 | normalContext.display = nullptr; 49 | 50 | if (color) 51 | { 52 | c_unitNormalSymbol->setTempColor(*color, true); 53 | c_unitNormalHeadSymbol->setTempColor(*color, true); 54 | } 55 | else 56 | { 57 | c_unitNormalSymbol->enableTempColor(false); 58 | c_unitNormalHeadSymbol->enableTempColor(false); 59 | } 60 | 61 | glFunc->glMatrixMode(GL_MODELVIEW); 62 | glFunc->glPushMatrix(); 63 | ccGL::Translate(glFunc, pos.x, pos.y, pos.z); 64 | ccGLMatrix mat = ccGLMatrix::FromToRotation(CCVector3(0, 0, PC_ONE), getNormal()); 65 | glFunc->glMultMatrixf(mat.data()); 66 | ccGL::Scale(glFunc, scale, scale, scale); 67 | glFunc->glTranslatef(0, 0, 0.45f); 68 | c_unitNormalSymbol->draw(normalContext); 69 | glFunc->glTranslatef(0, 0, 0.45f); 70 | c_unitNormalHeadSymbol->draw(normalContext); 71 | glFunc->glPopMatrix(); 72 | } -------------------------------------------------------------------------------- /qCC_db/ccPlanarEntityInterface.h: -------------------------------------------------------------------------------- 1 | #ifndef PLANAR_ENTITY_INTERFACE_HEADER 2 | #define PLANAR_ENTITY_INTERFACE_HEADER 3 | 4 | //CCLib 5 | #include 6 | 7 | //qCC_gl 8 | #include 9 | 10 | //! Interface for a planar entity 11 | class ccPlanarEntityInterface 12 | { 13 | public: 14 | 15 | //! Default constructor 16 | ccPlanarEntityInterface(); 17 | 18 | //! Show normal vector 19 | inline void showNormalVector(bool state) { m_showNormalVector = state; } 20 | //! Whether normal vector is shown or not 21 | inline bool normalVectorIsShown() const { return m_showNormalVector; } 22 | 23 | //! Returns the entity normal 24 | virtual CCVector3 getNormal() const = 0; 25 | 26 | protected: //members 27 | 28 | //! Draws a normal vector (OpenGL) 29 | void glDrawNormal(CC_DRAW_CONTEXT& context, const CCVector3& pos, float scale, const ccColor::Rgb* color = 0); 30 | 31 | //! Whether the facet normal vector should be displayed or not 32 | bool m_showNormalVector; 33 | 34 | }; 35 | 36 | #endif //PLANAR_ENTITY_INTERFACE_HEADER 37 | -------------------------------------------------------------------------------- /qCC_db/ccPointCloudInterpolator.h: -------------------------------------------------------------------------------- 1 | //########################################################################## 2 | //# # 3 | //# CLOUDCOMPARE # 4 | //# # 5 | //# This program is free software; you can redistribute it and/or modify # 6 | //# it under the terms of the GNU General Public License as published by # 7 | //# the Free Software Foundation; version 2 or later of the License. # 8 | //# # 9 | //# This program is distributed in the hope that it will be useful, # 10 | //# but WITHOUT ANY WARRANTY; without even the implied warranty of # 11 | //# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # 12 | //# GNU General Public License for more details. # 13 | //# # 14 | //# COPYRIGHT: Daniel Girardeau-Montaut # 15 | //# # 16 | //########################################################################## 17 | 18 | #ifndef CC_POINT_CLOUD_INTERPOLATOR 19 | #define CC_POINT_CLOUD_INTERPOLATOR 20 | 21 | class ccPointCloud; 22 | 23 | //Local 24 | #include "qCC_db.h" 25 | 26 | //System 27 | #include 28 | 29 | namespace CCLib 30 | { 31 | class GenericProgressCallback; 32 | } 33 | 34 | class QCC_DB_LIB_API ccPointCloudInterpolator 35 | { 36 | public: 37 | 38 | //! Generic interpolation parameters 39 | struct Parameters 40 | { 41 | enum Method { NEAREST_NEIGHBOR, K_NEAREST_NEIGHBORS, RADIUS }; 42 | enum Algo { AVERAGE, MEDIAN, NORMAL_DIST }; 43 | 44 | Method method = NEAREST_NEIGHBOR; 45 | Algo algo = AVERAGE; 46 | unsigned knn = 0; 47 | float radius = 0; 48 | double sigma = 0; 49 | }; 50 | 51 | //! Interpolate scalar fields from another cloud 52 | static bool InterpolateScalarFieldsFrom(ccPointCloud* destCloud, 53 | ccPointCloud* srccloud, 54 | const std::vector& sfIndexes, 55 | const Parameters& params, 56 | CCLib::GenericProgressCallback* progressCb = 0, 57 | unsigned char octreeLevel = 0); 58 | 59 | 60 | }; 61 | 62 | #endif //CC_POINT_CLOUD_INTERPOLATOR 63 | -------------------------------------------------------------------------------- /qCC_db/ccShiftedObject.cpp: -------------------------------------------------------------------------------- 1 | //########################################################################## 2 | //# # 3 | //# CLOUDCOMPARE # 4 | //# # 5 | //# This program is free software; you can redistribute it and/or modify # 6 | //# it under the terms of the GNU General Public License as published by # 7 | //# the Free Software Foundation; version 2 or later of the License. # 8 | //# # 9 | //# This program is distributed in the hope that it will be useful, # 10 | //# but WITHOUT ANY WARRANTY; without even the implied warranty of # 11 | //# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # 12 | //# GNU General Public License for more details. # 13 | //# # 14 | //# COPYRIGHT: EDF R&D / TELECOM ParisTech (ENST-TSI) # 15 | //# # 16 | //########################################################################## 17 | 18 | #include "ccShiftedObject.h" 19 | 20 | //local 21 | #include "ccLog.h" 22 | #include "ccSerializableObject.h" 23 | 24 | ccShiftedObject::ccShiftedObject(QString name, unsigned uniqueID/*=ccUniqueIDGenerator::InvalidUniqueID*/) 25 | : ccHObject(name, uniqueID) 26 | , m_globalShift(0, 0, 0) 27 | , m_globalScale(1.0) 28 | { 29 | } 30 | 31 | void ccShiftedObject::setGlobalShift(const CCVector3d& shift) 32 | { 33 | m_globalShift = shift; 34 | } 35 | 36 | void ccShiftedObject::setGlobalShift(double x, double y, double z) 37 | { 38 | m_globalShift.x = x; 39 | m_globalShift.y = y; 40 | m_globalShift.z = z; 41 | } 42 | 43 | void ccShiftedObject::setGlobalScale(double scale) 44 | { 45 | if (scale == 0) 46 | { 47 | ccLog::Warning("[setGlobalScale] Invalid scale (zero)!"); 48 | m_globalScale = 1.0; 49 | } 50 | else 51 | { 52 | m_globalScale = scale; 53 | } 54 | } 55 | 56 | bool ccShiftedObject::saveShiftInfoToFile(QFile& out) const 57 | { 58 | //'coordinates shift' 59 | if (out.write((const char*)m_globalShift.u, sizeof(double) * 3) < 0) 60 | return ccSerializableObject::WriteError(); 61 | //'global scale' 62 | if (out.write((const char*)&m_globalScale, sizeof(double)) < 0) 63 | return ccSerializableObject::WriteError(); 64 | 65 | return true; 66 | } 67 | 68 | bool ccShiftedObject::loadShiftInfoFromFile(QFile& in) 69 | { 70 | //'coordinates shift' 71 | if (in.read((char*)m_globalShift.u, sizeof(double) * 3) < 0) 72 | return ccSerializableObject::ReadError(); 73 | //'global scale' 74 | if (in.read((char*)&m_globalScale, sizeof(double)) < 0) 75 | return ccSerializableObject::ReadError(); 76 | 77 | return true; 78 | } 79 | 80 | bool ccShiftedObject::getGlobalBB(CCVector3d& minCorner, CCVector3d& maxCorner) 81 | { 82 | ccBBox box = getOwnBB(false); 83 | minCorner = toGlobal3d(box.minCorner()); 84 | maxCorner = toGlobal3d(box.maxCorner()); 85 | return box.isValid(); 86 | } 87 | -------------------------------------------------------------------------------- /qCC_db/ccSingleton.h: -------------------------------------------------------------------------------- 1 | //########################################################################## 2 | //# # 3 | //# CLOUDCOMPARE # 4 | //# # 5 | //# This program is free software; you can redistribute it and/or modify # 6 | //# it under the terms of the GNU General Public License as published by # 7 | //# the Free Software Foundation; version 2 or later of the License. # 8 | //# # 9 | //# This program is distributed in the hope that it will be useful, # 10 | //# but WITHOUT ANY WARRANTY; without even the implied warranty of # 11 | //# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # 12 | //# GNU General Public License for more details. # 13 | //# # 14 | //# COPYRIGHT: EDF R&D / TELECOM ParisTech (ENST-TSI) # 15 | //# # 16 | //########################################################################## 17 | 18 | #ifndef CC_SINGLETON_HEADER 19 | #define CC_SINGLETON_HEADER 20 | 21 | //! Generic singleton encapsulation structure 22 | template struct ccSingleton 23 | { 24 | //! Default constructor 25 | ccSingleton() : instance(nullptr) {} 26 | //! Destructor 27 | ~ccSingleton() { release(); } 28 | //! Releases the current instance 29 | inline void release() { if (instance) { delete instance; instance = nullptr; } } 30 | 31 | //! Current instance 32 | T* instance; 33 | }; 34 | 35 | #endif //CC_SINGLETON_HEADER 36 | -------------------------------------------------------------------------------- /qCC_db/doc/.gitignore: -------------------------------------------------------------------------------- 1 | /html/ 2 | -------------------------------------------------------------------------------- /qCC_db/doc/cc_logo_v2l_qt_db.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yaoli1992/ccCloudViewer/94211298a3b0382f816c7c2d8a803eb5dd22d305/qCC_db/doc/cc_logo_v2l_qt_db.png -------------------------------------------------------------------------------- /qCC_db/qCC_db.h: -------------------------------------------------------------------------------- 1 | //########################################################################## 2 | //# # 3 | //# QCC_DB # 4 | //# # 5 | //# This program is free software; you can redistribute it and/or modify # 6 | //# it under the terms of the GNU Library General Public License as # 7 | //# published by the Free Software Foundation; version 2 or later of the # 8 | //# License. # 9 | //# # 10 | //# This program is distributed in the hope that it will be useful, # 11 | //# but WITHOUT ANY WARRANTY; without even the implied warranty of # 12 | //# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # 13 | //# GNU General Public License for more details. # 14 | //# # 15 | //# COPYRIGHT: EDF R&D / TELECOM ParisTech (ENST-TSI) # 16 | //# # 17 | //########################################################################## 18 | 19 | #ifndef CC_DB_HEADER 20 | #define CC_DB_HEADER 21 | 22 | #include 23 | 24 | #if defined( QCC_DB_LIBRARY_BUILD ) 25 | # define QCC_DB_LIB_API Q_DECL_EXPORT 26 | #else 27 | # define QCC_DB_LIB_API Q_DECL_IMPORT 28 | #endif 29 | 30 | #endif //CC_DB_HEADER -------------------------------------------------------------------------------- /qCC_glWindow/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.0) 2 | 3 | #include_directories( ${CMAKE_CURRENT_SOURCE_DIR} ) 4 | 5 | include_directories( ${CC_CORE_LIB_SOURCE_DIR}/include ) 6 | include_directories( ${CC_FBO_LIB_SOURCE_DIR}/include ) 7 | include_directories( ${QCC_DB_LIB_SOURCE_DIR} ) 8 | if( MSVC ) 9 | include_directories( ${QCC_DB_LIB_SOURCE_DIR}/msvc ) 10 | endif() 11 | 12 | project( QCC_GL_LIB ) 13 | 14 | include_directories( ${QCC_GL_LIB_SOURCE_DIR} ) 15 | 16 | file( GLOB header_list *.h) 17 | file( GLOB source_list *.cpp) 18 | 19 | add_library( ${PROJECT_NAME} STATIC ${header_list} ${source_list} ) 20 | 21 | target_link_libraries( ${PROJECT_NAME} 22 | CC_CORE_LIB 23 | QCC_DB_LIB 24 | CC_FBO_LIB ) 25 | 26 | if(FALSE) 27 | # OCULUS support 28 | target_link_OCULUS_SDK( ${PROJECT_NAME} ) 29 | 30 | # Qt 31 | target_link_libraries(${PROJECT_NAME} Qt5::Core Qt5::Gui Qt5::Widgets Qt5::OpenGL Qt5::OpenGLExtensions) 32 | 33 | # Add custom preprocessor definitions 34 | if (OPTION_GL_QUAD_BUFFER_SUPPORT) 35 | target_compile_definitions( ${PROJECT_NAME} PRIVATE CC_GL_WINDOW_USE_QWINDOW ) 36 | endif() 37 | endif() 38 | -------------------------------------------------------------------------------- /qCC_glWindow/ccGLUtils.h: -------------------------------------------------------------------------------- 1 | //########################################################################## 2 | //# # 3 | //# CLOUDCOMPARE # 4 | //# # 5 | //# This program is free software; you can redistribute it and/or modify # 6 | //# it under the terms of the GNU General Public License as published by # 7 | //# the Free Software Foundation; version 2 or later of the License. # 8 | //# # 9 | //# This program is distributed in the hope that it will be useful, # 10 | //# but WITHOUT ANY WARRANTY; without even the implied warranty of # 11 | //# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # 12 | //# GNU General Public License for more details. # 13 | //# # 14 | //# COPYRIGHT: EDF R&D / TELECOM ParisTech (ENST-TSI) # 15 | //# # 16 | //########################################################################## 17 | 18 | #ifndef CC_GL_UTILS_HEADER 19 | #define CC_GL_UTILS_HEADER 20 | 21 | //qCC_db 22 | #include //Always first! 23 | 24 | //Qt 25 | #include 26 | 27 | //! View orientation 28 | enum CC_VIEW_ORIENTATION { CC_TOP_VIEW, /**< Top view (eye: +Z) **/ 29 | CC_BOTTOM_VIEW, /**< Bottom view **/ 30 | CC_FRONT_VIEW, /**< Front view **/ 31 | CC_BACK_VIEW, /**< Back view **/ 32 | CC_LEFT_VIEW, /**< Left view **/ 33 | CC_RIGHT_VIEW, /**< Right view **/ 34 | CC_ISO_VIEW_1, /**< Isometric view 1: front, right and top **/ 35 | CC_ISO_VIEW_2, /**< Isometric view 2: back, left and top **/ 36 | }; 37 | 38 | class ccGLUtils 39 | { 40 | public: 41 | 42 | /*************************************************** 43 | OpenGL Textures 44 | ***************************************************/ 45 | 46 | static void DisplayTexture2DPosition(QImage image, int x, int y, int w, int h, unsigned char alpha = 255); 47 | inline static void DisplayTexture2D(QImage image, int w, int h, unsigned char alpha = 255) { DisplayTexture2DPosition(image, -w / 2, -h / 2, w, h, alpha); } 48 | 49 | static void DisplayTexture2DPosition(GLuint texID, int x, int y, int w, int h, unsigned char alpha = 255); 50 | inline static void DisplayTexture2D(GLuint texID, int w, int h, unsigned char alpha = 255) { DisplayTexture2DPosition(texID, -w / 2, -h / 2, w, h, alpha); } 51 | 52 | /*************************************************** 53 | OpenGL Matrices 54 | ***************************************************/ 55 | 56 | //! Returns a 4x4 'OpenGL' matrix corresponding to a default 'view' orientation 57 | /** \param orientation view orientation 58 | \return corresponding GL matrix 59 | **/ 60 | static ccGLMatrixd GenerateViewMat(CC_VIEW_ORIENTATION orientation); 61 | 62 | }; 63 | 64 | #endif //CC_GL_UTILS_HEADER 65 | -------------------------------------------------------------------------------- /qCC_glWindow/ccRenderingTools.h: -------------------------------------------------------------------------------- 1 | //########################################################################## 2 | //# # 3 | //# CLOUDCOMPARE # 4 | //# # 5 | //# This program is free software; you can redistribute it and/or modify # 6 | //# it under the terms of the GNU General Public License as published by # 7 | //# the Free Software Foundation; version 2 or later of the License. # 8 | //# # 9 | //# This program is distributed in the hope that it will be useful, # 10 | //# but WITHOUT ANY WARRANTY; without even the implied warranty of # 11 | //# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # 12 | //# GNU General Public License for more details. # 13 | //# # 14 | //# COPYRIGHT: EDF R&D / TELECOM ParisTech (ENST-TSI) # 15 | //# # 16 | //########################################################################## 17 | 18 | #ifndef CC_RENDERING_TOOLS_HEADER 19 | #define CC_RENDERING_TOOLS_HEADER 20 | 21 | //qCC_db 22 | #include 23 | 24 | class QWidget; 25 | class ccGBLSensor; 26 | class ccScalarField; 27 | class ccGLWindow; 28 | 29 | //! Misc. tools for rendering of advanced structures 30 | class ccRenderingTools 31 | { 32 | public: 33 | 34 | //! Displays a depth buffer as an image 35 | static void ShowDepthBuffer(ccGBLSensor* lidar, QWidget* parent = nullptr, unsigned maxDim = 1024); 36 | 37 | //! Displays the colored scale corresponding to the currently activated context scalar field 38 | /** Its appearance depends on the scalar fields min and max displayed 39 | values, min and max saturation values, and also the selected 40 | color ramp. 41 | \param context OpenGL context description 42 | **/ 43 | static void DrawColorRamp(const CC_DRAW_CONTEXT& context); 44 | 45 | //! See other version of DrawColorRamp 46 | static void DrawColorRamp(const CC_DRAW_CONTEXT& context, const ccScalarField* sf, ccGLWindow* win, int glW, int glH, float renderZoom = 1.0f); 47 | }; 48 | 49 | #endif //CC_RENDERING_TOOLS_HEADER 50 | -------------------------------------------------------------------------------- /qCC_glWindow/doc/.gitignore: -------------------------------------------------------------------------------- 1 | /html/ 2 | -------------------------------------------------------------------------------- /qCC_glWindow/doc/cc_logo_v2l_qt_gl.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yaoli1992/ccCloudViewer/94211298a3b0382f816c7c2d8a803eb5dd22d305/qCC_glWindow/doc/cc_logo_v2l_qt_gl.png -------------------------------------------------------------------------------- /qCC_io/AsciiFilter.h: -------------------------------------------------------------------------------- 1 | //########################################################################## 2 | //# # 3 | //# CLOUDCOMPARE # 4 | //# # 5 | //# This program is free software; you can redistribute it and/or modify # 6 | //# it under the terms of the GNU General Public License as published by # 7 | //# the Free Software Foundation; version 2 or later of the License. # 8 | //# # 9 | //# This program is distributed in the hope that it will be useful, # 10 | //# but WITHOUT ANY WARRANTY; without even the implied warranty of # 11 | //# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # 12 | //# GNU General Public License for more details. # 13 | //# # 14 | //# COPYRIGHT: EDF R&D / TELECOM ParisTech (ENST-TSI) # 15 | //# # 16 | //########################################################################## 17 | 18 | #ifndef CC_ASCII_FILTER_HEADER 19 | #define CC_ASCII_FILTER_HEADER 20 | 21 | #include "FileIOFilter.h" 22 | 23 | //dialogs 24 | #include "AsciiOpenDlg.h" 25 | #include "AsciiSaveDlg.h" 26 | 27 | //! ASCII point cloud I/O filter 28 | class QCC_IO_LIB_API AsciiFilter : public FileIOFilter 29 | { 30 | public: 31 | AsciiFilter(); 32 | 33 | //static accessors 34 | static inline QString GetFileFilter() { return "ASCII cloud (*.txt *.asc *.neu *.xyz *.pts *.csv)"; } 35 | 36 | //inherited from FileIOFilter 37 | CC_FILE_ERROR loadFile(const QString& filename, ccHObject& container, LoadParameters& parameters) override; 38 | 39 | bool canSave(CC_CLASS_ENUM type, bool& multiple, bool& exclusive) const override; 40 | CC_FILE_ERROR saveToFile(ccHObject* entity, const QString& filename, const SaveParameters& parameters) override; 41 | 42 | //! Loads an ASCII file with a predefined format 43 | CC_FILE_ERROR loadCloudFromFormatedAsciiFile( const QString& filename, 44 | ccHObject& container, 45 | const AsciiOpenDlg::Sequence& openSequence, 46 | char separator, 47 | bool commaAsDecimal, 48 | unsigned approximateNumberOfLines, 49 | qint64 fileSize, 50 | unsigned maxCloudSize, 51 | unsigned skipLines, 52 | LoadParameters& parameters, 53 | bool showLabelsIn2D = false); 54 | 55 | //! Returns associated dialog (creates it if necessary) 56 | static AsciiOpenDlg* GetOpenDialog(QWidget* parentWidget = nullptr); 57 | //! Returns associated dialog (creates it if necessary) 58 | static AsciiSaveDlg* GetSaveDialog(QWidget* parentWidget = nullptr); 59 | 60 | private: 61 | //! Internal use only 62 | CC_FILE_ERROR saveFile(ccHObject* entity, FILE *theFile); 63 | }; 64 | 65 | #endif //CC_ASCII_FILTER_HEADER 66 | -------------------------------------------------------------------------------- /qCC_io/BinFilter.h: -------------------------------------------------------------------------------- 1 | //########################################################################## 2 | //# # 3 | //# CLOUDCOMPARE # 4 | //# # 5 | //# This program is free software; you can redistribute it and/or modify # 6 | //# it under the terms of the GNU General Public License as published by # 7 | //# the Free Software Foundation; version 2 or later of the License. # 8 | //# # 9 | //# This program is distributed in the hope that it will be useful, # 10 | //# but WITHOUT ANY WARRANTY; without even the implied warranty of # 11 | //# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # 12 | //# GNU General Public License for more details. # 13 | //# # 14 | //# COPYRIGHT: EDF R&D / TELECOM ParisTech (ENST-TSI) # 15 | //# # 16 | //########################################################################## 17 | 18 | #ifndef CC_BIN_FILTER_HEADER 19 | #define CC_BIN_FILTER_HEADER 20 | 21 | #include "FileIOFilter.h" 22 | 23 | 24 | //! CloudCompare dedicated binary point cloud I/O filter 25 | class QCC_IO_LIB_API BinFilter : public FileIOFilter 26 | { 27 | public: 28 | BinFilter(); 29 | 30 | //static accessors 31 | static inline QString GetFileFilter() { return "CloudCompare entities (*.bin)"; } 32 | static inline QString GetDefaultExtension() { return "bin"; } 33 | 34 | //inherited from FileIOFilter 35 | CC_FILE_ERROR loadFile(const QString& filename, ccHObject& container, LoadParameters& parameters) override; 36 | 37 | bool canSave(CC_CLASS_ENUM type, bool& multiple, bool& exclusive) const override; 38 | CC_FILE_ERROR saveToFile(ccHObject* entity, const QString& filename, const SaveParameters& parameters) override; 39 | 40 | //! old style BIN loading 41 | static CC_FILE_ERROR LoadFileV1(QFile& in, ccHObject& container, unsigned nbScansTotal, const LoadParameters& parameters); 42 | 43 | //! new style BIN loading 44 | static CC_FILE_ERROR LoadFileV2(QFile& in, ccHObject& container, int flags); 45 | 46 | //! new style BIN saving 47 | static CC_FILE_ERROR SaveFileV2(QFile& out, ccHObject* object); 48 | }; 49 | 50 | #endif //CC_BIN_FILTER_HEADER 51 | -------------------------------------------------------------------------------- /qCC_io/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.0) 2 | 3 | set(CMAKE_AUTOMOC ON) 4 | set(CMAKE_INCLUDE_CURRENT_DIR ON) 5 | 6 | 7 | include_directories( ${CMAKE_CURRENT_SOURCE_DIR} ) 8 | 9 | include_directories( ${CC_CORE_LIB_SOURCE_DIR}/include ) 10 | 11 | include_directories( ${CC_FBO_LIB_SOURCE_DIR}/include ) 12 | 13 | include_directories( ${QCC_DB_LIB_SOURCE_DIR} ) 14 | 15 | if( MSVC ) 16 | include_directories( ${QCC_DB_LIB_SOURCE_DIR}/msvc ) 17 | endif() 18 | 19 | include_directories( ${CMAKE_CURRENT_BINARY_DIR} ) 20 | 21 | project( QCC_IO_LIB ) 22 | set(CMAKE_POSITION_INDEPENDENT_CODE ON) 23 | 24 | 25 | file( GLOB header_list *.h) 26 | file( GLOB source_list *.cpp *.c) 27 | file( GLOB ui_list ui_templates/*.ui ) 28 | 29 | set( CMAKE_CXX_VISIBILITY_PRESET hidden ) 30 | 31 | qt5_wrap_ui( generated_ui_list ${ui_list} ) 32 | add_library( ${PROJECT_NAME} SHARED ${header_list} ${source_list} ${generated_ui_list} ) 33 | 34 | target_link_libraries( ${PROJECT_NAME} 35 | CC_CORE_LIB 36 | CC_FBO_LIB 37 | QCC_DB_LIB ) 38 | 39 | # Qt 40 | target_link_libraries(${PROJECT_NAME} Qt5::Core) 41 | 42 | target_compile_options( ${PROJECT_NAME} PRIVATE /Zc:wchar_t-) 43 | target_compile_definitions( ${PROJECT_NAME} PRIVATE QCC_IO_LIBRARY_BUILD ) 44 | -------------------------------------------------------------------------------- /qCC_io/DepthMapFileFilter.h: -------------------------------------------------------------------------------- 1 | //########################################################################## 2 | //# # 3 | //# CLOUDCOMPARE # 4 | //# # 5 | //# This program is free software; you can redistribute it and/or modify # 6 | //# it under the terms of the GNU General Public License as published by # 7 | //# the Free Software Foundation; version 2 or later of the License. # 8 | //# # 9 | //# This program is distributed in the hope that it will be useful, # 10 | //# but WITHOUT ANY WARRANTY; without even the implied warranty of # 11 | //# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # 12 | //# GNU General Public License for more details. # 13 | //# # 14 | //# COPYRIGHT: EDF R&D / TELECOM ParisTech (ENST-TSI) # 15 | //# # 16 | //########################################################################## 17 | 18 | #ifndef CC_DEPTH_MAP_FILE_FILTER_HEADER 19 | #define CC_DEPTH_MAP_FILE_FILTER_HEADER 20 | 21 | #include "FileIOFilter.h" 22 | 23 | class ccGBLSensor; 24 | 25 | //! Depth map I/O filter 26 | class QCC_IO_LIB_API DepthMapFileFilter : public FileIOFilter 27 | { 28 | public: 29 | DepthMapFileFilter(); 30 | 31 | //static accessors 32 | static inline QString GetFileFilter() { return "Depth Map [ascii] (*.txt *.asc)"; } 33 | 34 | //inherited from FileIOFilter 35 | bool canSave(CC_CLASS_ENUM type, bool& multiple, bool& exclusive) const override; 36 | CC_FILE_ERROR saveToFile(ccHObject* entity, const QString& filename, const SaveParameters& parameters) override; 37 | 38 | //direct method to save a sensor (depth map) 39 | CC_FILE_ERROR saveToFile(const QString& filename, ccGBLSensor* sensor); 40 | }; 41 | 42 | #endif //CC_DEPTH_MAP_FILE_FILTER_HEADER 43 | -------------------------------------------------------------------------------- /qCC_io/DxfFilter.h: -------------------------------------------------------------------------------- 1 | //########################################################################## 2 | //# # 3 | //# CLOUDCOMPARE # 4 | //# # 5 | //# This program is free software; you can redistribute it and/or modify # 6 | //# it under the terms of the GNU General Public License as published by # 7 | //# the Free Software Foundation; version 2 or later of the License. # 8 | //# # 9 | //# This program is distributed in the hope that it will be useful, # 10 | //# but WITHOUT ANY WARRANTY; without even the implied warranty of # 11 | //# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # 12 | //# GNU General Public License for more details. # 13 | //# # 14 | //# COPYRIGHT: EDF R&D / TELECOM ParisTech (ENST-TSI) # 15 | //# # 16 | //########################################################################## 17 | 18 | #ifndef CC_DXF_FILTER_HEADER 19 | #define CC_DXF_FILTER_HEADER 20 | 21 | #include "FileIOFilter.h" 22 | 23 | //! Autocad DXF file I/O filter 24 | class QCC_IO_LIB_API DxfFilter : public FileIOFilter 25 | { 26 | public: 27 | DxfFilter(); 28 | 29 | //inherited from FileIOFilter 30 | CC_FILE_ERROR loadFile(const QString& filename, ccHObject& container, LoadParameters& parameters) override; 31 | 32 | bool canSave(CC_CLASS_ENUM type, bool& multiple, bool& exclusive) const override; 33 | CC_FILE_ERROR saveToFile(ccHObject* entity, const QString& filename, const SaveParameters& parameters) override; 34 | }; 35 | 36 | #endif //CC_DXF_FILTER_HEADER 37 | -------------------------------------------------------------------------------- /qCC_io/FileIO.cpp: -------------------------------------------------------------------------------- 1 | //########################################################################## 2 | //# # 3 | //# CLOUDCOMPARE # 4 | //# # 5 | //# This program is free software; you can redistribute it and/or modify # 6 | //# it under the terms of the GNU General Public License as published by # 7 | //# the Free Software Foundation; version 2 or later of the License. # 8 | //# # 9 | //# This program is distributed in the hope that it will be useful, # 10 | //# but WITHOUT ANY WARRANTY; without even the implied warranty of # 11 | //# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # 12 | //# GNU General Public License for more details. # 13 | //# # 14 | //# COPYRIGHT: CloudCompare project # 15 | //# # 16 | //########################################################################## 17 | 18 | #include 19 | #include 20 | 21 | #include "FileIO.h" 22 | 23 | 24 | QString FileIO::s_applicationName; 25 | QString FileIO::s_version; 26 | QString FileIO::s_writerInfo; 27 | 28 | void FileIO::setWriterInfo( const QString &applicationName, const QString &version ) 29 | { 30 | s_applicationName = applicationName; 31 | s_version = version; 32 | s_writerInfo = QStringLiteral( "%1 v%2" ).arg( applicationName, version ); 33 | } 34 | 35 | QString FileIO::writerInfo() 36 | { 37 | if ( s_writerInfo.isNull() ) 38 | { 39 | qWarning() << "FileIO::setWriterInfo has not been called"; 40 | 41 | return QStringLiteral( "(writer info not set)" ); 42 | } 43 | 44 | return s_writerInfo; 45 | } 46 | 47 | QString FileIO::applicationName() 48 | { 49 | return s_applicationName; 50 | } 51 | 52 | QString FileIO::version() 53 | { 54 | return s_version; 55 | } 56 | 57 | QString FileIO::createdBy() 58 | { 59 | return QStringLiteral( "Created by %1" ).arg( FileIO::writerInfo() ); 60 | } 61 | 62 | QString FileIO::createdDateTime() 63 | { 64 | return QStringLiteral( "Created %1" ).arg( QDateTime::currentDateTime().toString( Qt::SystemLocaleShortDate ) ); 65 | } 66 | -------------------------------------------------------------------------------- /qCC_io/FileIO.h: -------------------------------------------------------------------------------- 1 | #ifndef FILEIO_H 2 | #define FILEIO_H 3 | 4 | //########################################################################## 5 | //# # 6 | //# CLOUDCOMPARE # 7 | //# # 8 | //# This program is free software; you can redistribute it and/or modify # 9 | //# it under the terms of the GNU General Public License as published by # 10 | //# the Free Software Foundation; version 2 or later of the License. # 11 | //# # 12 | //# This program is distributed in the hope that it will be useful, # 13 | //# but WITHOUT ANY WARRANTY; without even the implied warranty of # 14 | //# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # 15 | //# GNU General Public License for more details. # 16 | //# # 17 | //# COPYRIGHT: CloudCompare project # 18 | //# # 19 | //########################################################################## 20 | 21 | #include 22 | 23 | #include "qCC_io.h" 24 | 25 | class FileIO 26 | { 27 | public: 28 | FileIO() = delete; 29 | 30 | QCC_IO_LIB_API static void setWriterInfo( const QString &applicationName, const QString &version ); 31 | QCC_IO_LIB_API static QString writerInfo(); 32 | 33 | QCC_IO_LIB_API static QString applicationName(); 34 | QCC_IO_LIB_API static QString version(); 35 | 36 | QCC_IO_LIB_API static QString createdBy(); 37 | QCC_IO_LIB_API static QString createdDateTime(); 38 | 39 | private: 40 | static QString s_applicationName; 41 | static QString s_version; 42 | static QString s_writerInfo; 43 | }; 44 | #endif 45 | -------------------------------------------------------------------------------- /qCC_io/ImageFileFilter.h: -------------------------------------------------------------------------------- 1 | //########################################################################## 2 | //# # 3 | //# CLOUDCOMPARE # 4 | //# # 5 | //# This program is free software; you can redistribute it and/or modify # 6 | //# it under the terms of the GNU General Public License as published by # 7 | //# the Free Software Foundation; version 2 or later of the License. # 8 | //# # 9 | //# This program is distributed in the hope that it will be useful, # 10 | //# but WITHOUT ANY WARRANTY; without even the implied warranty of # 11 | //# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # 12 | //# GNU General Public License for more details. # 13 | //# # 14 | //# COPYRIGHT: EDF R&D / TELECOM ParisTech (ENST-TSI) # 15 | //# # 16 | //########################################################################## 17 | 18 | #ifndef CC_IMAGE_FILE_FILTER_HEADER 19 | #define CC_IMAGE_FILE_FILTER_HEADER 20 | 21 | #include "FileIOFilter.h" 22 | 23 | //! Filter to load or save an image (all types supported by Qt) 24 | class QCC_IO_LIB_API ImageFileFilter : public FileIOFilter 25 | { 26 | public: 27 | ImageFileFilter(); 28 | 29 | //inherited from FileIOFilter 30 | CC_FILE_ERROR loadFile(const QString& filename, ccHObject& container, LoadParameters& parameters) override; 31 | 32 | bool canSave(CC_CLASS_ENUM type, bool& multiple, bool& exclusive) const override; 33 | CC_FILE_ERROR saveToFile(ccHObject* entity, const QString& filename, const SaveParameters& parameters) override; 34 | 35 | //! Helper: select an input image filename 36 | static QString GetLoadFilename( const QString& dialogTitle, 37 | const QString& imageLoadPath, 38 | QWidget* parentWidget = nullptr); 39 | 40 | //! Helper: select an output image filename 41 | static QString GetSaveFilename( const QString& dialogTitle, 42 | const QString& baseName, 43 | const QString& imageSavePath, 44 | QWidget* parentWidget = nullptr); 45 | }; 46 | 47 | #endif //CC_IMAGE_FILE_FILTER_HEADER 48 | -------------------------------------------------------------------------------- /qCC_io/RasterGridFilter.h: -------------------------------------------------------------------------------- 1 | //########################################################################## 2 | //# # 3 | //# CLOUDCOMPARE # 4 | //# # 5 | //# This program is free software; you can redistribute it and/or modify # 6 | //# it under the terms of the GNU General Public License as published by # 7 | //# the Free Software Foundation; version 2 or later of the License. # 8 | //# # 9 | //# This program is distributed in the hope that it will be useful, # 10 | //# but WITHOUT ANY WARRANTY; without even the implied warranty of # 11 | //# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # 12 | //# GNU General Public License for more details. # 13 | //# # 14 | //# COPYRIGHT: EDF R&D / TELECOM ParisTech (ENST-TSI) # 15 | //# # 16 | //########################################################################## 17 | 18 | #ifndef CC_RASTER_FILTER_HEADER 19 | #define CC_RASTER_FILTER_HEADER 20 | 21 | #include "FileIOFilter.h" 22 | 23 | #ifdef CC_GDAL_SUPPORT 24 | 25 | //! Raster grid format file I/O filter 26 | /** Multiple formats are handled: see GDAL (http://www.gdal.org/) 27 | **/ 28 | class QCC_IO_LIB_API RasterGridFilter : public FileIOFilter 29 | { 30 | public: 31 | RasterGridFilter(); 32 | 33 | //inherited from FileIOFilter 34 | CC_FILE_ERROR loadFile(const QString& filename, ccHObject& container, LoadParameters& parameters) override; 35 | }; 36 | 37 | #endif //CC_GDAL_SUPPORT 38 | 39 | #endif //CC_RASTER_FILTER_HEADER 40 | -------------------------------------------------------------------------------- /qCC_io/ShpDBFFields.cpp: -------------------------------------------------------------------------------- 1 | //########################################################################## 2 | //# # 3 | //# CLOUDCOMPARE # 4 | //# # 5 | //# This program is free software; you can redistribute it and/or modify # 6 | //# it under the terms of the GNU General Public License as published by # 7 | //# the Free Software Foundation; version 2 or later of the License. # 8 | //# # 9 | //# This program is distributed in the hope that it will be useful, # 10 | //# but WITHOUT ANY WARRANTY; without even the implied warranty of # 11 | //# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # 12 | //# GNU General Public License for more details. # 13 | //# # 14 | //# COPYRIGHT: EDF R&D / TELECOM ParisTech (ENST-TSI) # 15 | //# # 16 | //########################################################################## 17 | 18 | #ifdef CC_SHP_SUPPORT 19 | 20 | #include "ShpDBFFields.h" 21 | 22 | //system 23 | #include 24 | 25 | bool IntegerDBFField::save(DBFHandle handle, int fieldIndex) const 26 | { 27 | if (!handle || fieldIndex < 0) 28 | { 29 | assert(false); 30 | return false; 31 | } 32 | 33 | for (size_t i = 0; i < values.size(); ++i) 34 | DBFWriteIntegerAttribute(handle, static_cast(i), fieldIndex, values[i]); 35 | 36 | return true; 37 | } 38 | 39 | bool DoubleDBFField::save(DBFHandle handle, int fieldIndex) const 40 | { 41 | if (!handle || fieldIndex < 0) 42 | { 43 | assert(false); 44 | return false; 45 | } 46 | 47 | for (size_t i = 0; i < values.size(); ++i) 48 | DBFWriteDoubleAttribute(handle, static_cast(i), fieldIndex, values[i]); 49 | 50 | return true; 51 | } 52 | 53 | bool DoubleDBFField3D::save(DBFHandle handle, int xFieldIndex, int yFieldIndex, int zFieldIndex) const 54 | { 55 | if (!handle || xFieldIndex < 0 || yFieldIndex < 0 || zFieldIndex < 0) 56 | { 57 | assert(false); 58 | return false; 59 | } 60 | 61 | for (size_t i = 0; i < values.size(); ++i) 62 | { 63 | DBFWriteDoubleAttribute(handle, static_cast(i), xFieldIndex, values[i].x); 64 | DBFWriteDoubleAttribute(handle, static_cast(i), yFieldIndex, values[i].y); 65 | DBFWriteDoubleAttribute(handle, static_cast(i), zFieldIndex, values[i].z); 66 | } 67 | 68 | return true; 69 | } 70 | 71 | #endif //CC_SHP_SUPPORT 72 | -------------------------------------------------------------------------------- /qCC_io/Tests/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | find_package(Qt5Test REQUIRED) 2 | 3 | 4 | QT5_ADD_RESOURCES(TestDataResources_SRCS TestData.qrc) 5 | 6 | set(TEST_LIBRARIES Qt5::Test Qt5::Core CC_CORE_LIB QCC_DB_LIB QCC_IO_LIB) 7 | 8 | if (WIN_32) 9 | SET(CMAKE_WIN32_EXECUTABLE False) 10 | set(TEST_LIBRARIES ${TEST_LIBRARIES} Qt5::WinMain) 11 | endif() 12 | 13 | if (OPTION_USE_SHAPE_LIB) 14 | SET(TestShpFilter_SRC TestShpFilter.cpp) 15 | ADD_EXECUTABLE(TestShpFilter ${TestShpFilter_SRC} ${TestDataResources_SRCS}) 16 | TARGET_LINK_LIBRARIES(TestShpFilter ${TEST_LIBRARIES}) 17 | set_property( TARGET TestShpFilter APPEND PROPERTY COMPILE_DEFINITIONS CC_SHP_SUPPORT ) 18 | ADD_TEST(NAME TestShpFilter COMMAND TestShpFilter) 19 | endif() 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /qCC_io/Tests/Data/shp/line.shp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yaoli1992/ccCloudViewer/94211298a3b0382f816c7c2d8a803eb5dd22d305/qCC_io/Tests/Data/shp/line.shp -------------------------------------------------------------------------------- /qCC_io/Tests/Data/shp/linem.shp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yaoli1992/ccCloudViewer/94211298a3b0382f816c7c2d8a803eb5dd22d305/qCC_io/Tests/Data/shp/linem.shp -------------------------------------------------------------------------------- /qCC_io/Tests/Data/shp/linez.shp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yaoli1992/ccCloudViewer/94211298a3b0382f816c7c2d8a803eb5dd22d305/qCC_io/Tests/Data/shp/linez.shp -------------------------------------------------------------------------------- /qCC_io/Tests/Data/shp/multi_pointz.shp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yaoli1992/ccCloudViewer/94211298a3b0382f816c7c2d8a803eb5dd22d305/qCC_io/Tests/Data/shp/multi_pointz.shp -------------------------------------------------------------------------------- /qCC_io/Tests/Data/shp/multipatch.shp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yaoli1992/ccCloudViewer/94211298a3b0382f816c7c2d8a803eb5dd22d305/qCC_io/Tests/Data/shp/multipatch.shp -------------------------------------------------------------------------------- /qCC_io/Tests/Data/shp/multipoint.shp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yaoli1992/ccCloudViewer/94211298a3b0382f816c7c2d8a803eb5dd22d305/qCC_io/Tests/Data/shp/multipoint.shp -------------------------------------------------------------------------------- /qCC_io/Tests/Data/shp/point_z.shp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yaoli1992/ccCloudViewer/94211298a3b0382f816c7c2d8a803eb5dd22d305/qCC_io/Tests/Data/shp/point_z.shp -------------------------------------------------------------------------------- /qCC_io/Tests/Data/shp/polygon.shp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yaoli1992/ccCloudViewer/94211298a3b0382f816c7c2d8a803eb5dd22d305/qCC_io/Tests/Data/shp/polygon.shp -------------------------------------------------------------------------------- /qCC_io/Tests/Data/shp/polygon_z.shp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yaoli1992/ccCloudViewer/94211298a3b0382f816c7c2d8a803eb5dd22d305/qCC_io/Tests/Data/shp/polygon_z.shp -------------------------------------------------------------------------------- /qCC_io/Tests/TestData.qrc: -------------------------------------------------------------------------------- 1 | 2 | 3 | Data/shp/line.shp 4 | Data/shp/linem.shp 5 | Data/shp/linez.shp 6 | Data/shp/polygon.shp 7 | Data/shp/polygon_z.shp 8 | Data/shp/multipoint.shp 9 | Data/shp/multi_pointz.shp 10 | Data/shp/point_z.shp 11 | Data/shp/multipatch.shp 12 | 13 | -------------------------------------------------------------------------------- /qCC_io/Tests/TestShpFilter.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef CC_TEST_SHAPEFILE_HEADER 3 | #define CC_TEST_SHAPEFILE_HEADER 4 | 5 | #include 6 | #include 7 | 8 | #define LINE_FILE ":/TestFiles/Data/shp/line.shp" 9 | #define LINEM_FILE ":/TestFiles/Data/shp/linem.shp" 10 | #define LINEZ_FILE ":/TestFiles/Data/shp/linez.shp" 11 | #define MULTIPOINT_FILE ":/TestFiles/Data/shp/multipoint.shp" 12 | #define MULTIPOINT_Z ":/TestFiles/Data/shp/multi_pointz.shp" 13 | #define MULTIPATCH_FILE ":/TestFiles/Data/shp/multipatch.shp" 14 | #define POLYGON_FILE ":/TestFiles/Data/shp/polygon.shp" 15 | #define POLYGONZ_FILE ":/TestFiles/Data/shp/polygon_z.shp" 16 | #define POINTZ_FILE ":/TestFiles/Data/shp/point_z.shp" 17 | 18 | class TestShpFilter : public QObject 19 | { 20 | Q_OBJECT 21 | private slots: 22 | /* Reading tests */ 23 | void readPolylineFile(const QString &filePath = LINE_FILE) const; 24 | 25 | void readPolylineMFile(const QString &filePath = LINEM_FILE) const; 26 | 27 | void readPolylineZFile(const QString &filePath = LINEZ_FILE) const; 28 | 29 | void readMultiPointFile(const QString &filePath = MULTIPOINT_FILE) const; 30 | 31 | void readMultiPointZFile(const QString &filePath = MULTIPOINT_Z) const; 32 | 33 | void readMultipatchFile(const QString &filePath = MULTIPATCH_FILE) const; 34 | 35 | void readPolygonFile(const QString &filePath = POLYGON_FILE) const; 36 | 37 | void readPolygonZFile(const QString &filePath = POLYGONZ_FILE) const; 38 | 39 | void readSinglePointZFile(const QString &filePath = POINTZ_FILE) const; 40 | 41 | /* 42 | * Writing Tests, these tests do a cycle: 43 | * 1) read original file 44 | * 2) write it back 45 | * 3) use its corresponding read test (functions above) to check the result of the writer 46 | */ 47 | void testWritePolyline() const; 48 | 49 | void testWritePolylineM() const; 50 | 51 | void testWritePolylineZ() const; 52 | 53 | void testWriteMultiPointFile() const; 54 | 55 | void testWriteMultiPointZFile() const; 56 | 57 | void testWriteMultpatchFile() const; 58 | 59 | void testWritePolygonFile() const; 60 | 61 | void testWritePolygonZFile() const; 62 | }; 63 | 64 | 65 | #endif //CC_TEST_SHAPEFILE_HEADER 66 | -------------------------------------------------------------------------------- /qCC_io/doc/.gitignore: -------------------------------------------------------------------------------- 1 | /html/ 2 | -------------------------------------------------------------------------------- /qCC_io/doc/cc_logo_v2l_qt_io.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yaoli1992/ccCloudViewer/94211298a3b0382f816c7c2d8a803eb5dd22d305/qCC_io/doc/cc_logo_v2l_qt_io.png -------------------------------------------------------------------------------- /qCC_io/qCC_io.h: -------------------------------------------------------------------------------- 1 | //########################################################################## 2 | //# # 3 | //# QCC_IO # 4 | //# # 5 | //# This program is free software; you can redistribute it and/or modify # 6 | //# it under the terms of the GNU Library General Public License as # 7 | //# published by the Free Software Foundation; version 2 or later of the # 8 | //# License. # 9 | //# # 10 | //# This program is distributed in the hope that it will be useful, # 11 | //# but WITHOUT ANY WARRANTY; without even the implied warranty of # 12 | //# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # 13 | //# GNU General Public License for more details. # 14 | //# # 15 | //# COPYRIGHT: EDF R&D / TELECOM ParisTech (ENST-TSI) # 16 | //# # 17 | //########################################################################## 18 | 19 | #ifndef CC_IO_HEADER 20 | #define CC_IO_HEADER 21 | 22 | #include 23 | 24 | #if defined( QCC_IO_LIBRARY_BUILD ) 25 | # define QCC_IO_LIB_API Q_DECL_EXPORT 26 | #else 27 | # define QCC_IO_LIB_API Q_DECL_IMPORT 28 | #endif 29 | 30 | #endif //CC_IO_HEADER --------------------------------------------------------------------------------