From e51731b255a33f382d2cfc7ad76d5fc7d21cb5dd Mon Sep 17 00:00:00 2001 From: goldenhawking Date: Wed, 29 Apr 2020 18:59:51 +0800 Subject: [PATCH] Reduce warp items CPU cost . --- .../qtviewer_planetosm_zh_CN.ts | 2 +- qtvplugin_geomarker/qtvplugin_geomarker.cpp | 27 ++++++++++++++----- .../qtvplugin_geomarker_zh_CN.ts | 2 +- 3 files changed, 23 insertions(+), 8 deletions(-) diff --git a/qtviewer_planetosm/qtviewer_planetosm_zh_CN.ts b/qtviewer_planetosm/qtviewer_planetosm_zh_CN.ts index 6a01d5d..9342616 100644 --- a/qtviewer_planetosm/qtviewer_planetosm_zh_CN.ts +++ b/qtviewer_planetosm/qtviewer_planetosm_zh_CN.ts @@ -194,7 +194,7 @@ 可见 - + save to image 保存到图像 diff --git a/qtvplugin_geomarker/qtvplugin_geomarker.cpp b/qtvplugin_geomarker/qtvplugin_geomarker.cpp index f93bd7e..940eae5 100644 --- a/qtvplugin_geomarker/qtvplugin_geomarker.cpp +++ b/qtvplugin_geomarker/qtvplugin_geomarker.cpp @@ -235,23 +235,38 @@ void qtvplugin_geomarker::cb_paintEvent( QPainter * pImage ) rect.width(), rect.height() ); - //Warpping 180, -180. because longitude +180 and -180 is the same point, - // but the map is plat, -180 and + 180 is quite different positions, we - // should draw 3 times, to slove cross 180 drawing problems. - for (int p = -1; p<=1 ;++p) + if (!too_many_items()) + { + //Warpping 180, -180. because longitude +180 and -180 is the same point, + // but the map is plat, -180 and + 180 is quite different positions, we + // should draw 3 times, to slove cross 180 drawing problems. + for (int p = -1; p<=1 ;++p) + { + QRectF source( + leftcenx + p * winsz, + topceny, + (rightcenx - leftcenx), + (bottomceny - topceny) + ); + + m_pScene->render(pImage,destin,source); + + } + } + else { QRectF source( - leftcenx + p * winsz, + leftcenx , topceny, (rightcenx - leftcenx), (bottomceny - topceny) ); - m_pScene->render(pImage,destin,source); } + //draw current tools switch (m_currentTools) { diff --git a/qtvplugin_geomarker/qtvplugin_geomarker_zh_CN.ts b/qtvplugin_geomarker/qtvplugin_geomarker_zh_CN.ts index 0a0ef14..c518144 100644 --- a/qtvplugin_geomarker/qtvplugin_geomarker_zh_CN.ts +++ b/qtvplugin_geomarker/qtvplugin_geomarker_zh_CN.ts @@ -308,7 +308,7 @@ Level Re-Coord %1 %% - 正在重新计算坐标,完成 %1 %% + 正在重新计算坐标,完成 %1 %% name could not be empty. -- GitLab