From c98aa7b5d6729922879e95f6c1403ae7405136ba Mon Sep 17 00:00:00 2001 From: yiyi Date: Sun, 5 Apr 2026 12:55:15 +0800 Subject: [PATCH] =?UTF-8?q?log4cpp=20arm=E4=B8=8B=E6=AF=AB=E7=A7=92?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CloudUtils/Inc/PointCloudImageUtils.h | 6 +++++- CloudUtils/Src/PointCloudImageUtils.cpp | 12 +++++++++++- VrUtils/CMakeLists.txt | 3 +++ VrUtils/Src/VrLog.cpp | 6 +----- VrUtils/log4cpp/include/log4cpp/Portability.hh | 6 ++++-- 5 files changed, 24 insertions(+), 9 deletions(-) diff --git a/CloudUtils/Inc/PointCloudImageUtils.h b/CloudUtils/Inc/PointCloudImageUtils.h index 026d250..2764635 100644 --- a/CloudUtils/Inc/PointCloudImageUtils.h +++ b/CloudUtils/Inc/PointCloudImageUtils.h @@ -63,7 +63,11 @@ public: // Workpiece点云和角点检测结果转图像 - 将角点画成圆点 static QImage GeneratePointCloudRetPointImage(const std::vector>& scanLines, const std::vector>& cornerPoints, - double margin = 0.0); + double margin = 0.0, + double* outXMin = nullptr, + double* outXMax = nullptr, + double* outYMin = nullptr, + double* outYMax = nullptr); // ParticleSize点云和颗粒检测结果转图像 - 生成带颗粒标记的点云图像 (直接返回QImage) static QImage GeneratePointCloudImageWithParticles( diff --git a/CloudUtils/Src/PointCloudImageUtils.cpp b/CloudUtils/Src/PointCloudImageUtils.cpp index b32d2ca..0b4f0d7 100644 --- a/CloudUtils/Src/PointCloudImageUtils.cpp +++ b/CloudUtils/Src/PointCloudImageUtils.cpp @@ -629,7 +629,11 @@ void PointCloudImageUtils::DrawLapWeldResults(QPainter& painter, // Workpiece点云和角点检测结果转图像 - 将角点画成圆点 QImage PointCloudImageUtils::GeneratePointCloudRetPointImage(const std::vector>& scanLines, const std::vector>& cornerPoints, - double margin) + double margin, + double* outXMin, + double* outXMax, + double* outYMin, + double* outYMax) { if (scanLines.empty()) { return QImage(); @@ -650,6 +654,12 @@ QImage PointCloudImageUtils::GeneratePointCloudRetPointImage(const std::vector 0.0) { xMin -= margin; diff --git a/VrUtils/CMakeLists.txt b/VrUtils/CMakeLists.txt index 041e178..2252999 100644 --- a/VrUtils/CMakeLists.txt +++ b/VrUtils/CMakeLists.txt @@ -1,4 +1,7 @@ ADD_DEFINITIONS(-D__OPENVMS__) #log4cpp 编译选项 +if(NOT WIN32) + ADD_DEFINITIONS(-DLOG4CPP_HAVE_GETTIMEOFDAY) #ARM/Linux 上直接启用 gettimeofday,确保毫秒正确 +endif() ADD_DEFINITIONS(-DVR_UTILS_EXPORTS) #VrUtils 导出宏定义 # ADD_COMPILE_OPTIONS(-Wno-deprecated-declarations) #auto_ptr警告消除 diff --git a/VrUtils/Src/VrLog.cpp b/VrUtils/Src/VrLog.cpp index 349bf14..02c20c3 100644 --- a/VrUtils/Src/VrLog.cpp +++ b/VrUtils/Src/VrLog.cpp @@ -290,11 +290,7 @@ void VrLogUtils::UninitLog() /// 开启/关闭时间戳 void VrLogUtils::EnableTime(bool bEnable) { - if (nullptr != m_pLayout) - { - m_pLayout->setConversionPattern(bEnable ? "%d{%Y-%m-%d %H:%M:%S.%l} [%p] %m" : "%p %m"); - } - g_isTimeEnabled = false; + g_isTimeEnabled = bEnable; } /// 输出log diff --git a/VrUtils/log4cpp/include/log4cpp/Portability.hh b/VrUtils/log4cpp/include/log4cpp/Portability.hh index e536079..59ebb45 100644 --- a/VrUtils/log4cpp/include/log4cpp/Portability.hh +++ b/VrUtils/log4cpp/include/log4cpp/Portability.hh @@ -37,8 +37,10 @@ #else # if defined(__MINGW32__) # include -//# else -//# include +# else + // Linux/ARM 等 POSIX 平台:启用 gettimeofday 以支持毫秒精度 +# define LOG4CPP_HAVE_GETTIMEOFDAY 1 +# define LOG4CPP_HAVE_SSTREAM 1 # endif #endif #endif