提交 b1162949 编写于 作者: 首席大数据架构师's avatar 首席大数据架构师

Merge branch 'develop' of git@gitcode.net:coloreaglestdio/qplanetosm.git into develop

......@@ -13,11 +13,13 @@ __pycache__
[Rr]elease/
[Rr]eleases/
x64/
build/
build*/
bld/
[Bb]in/
[Oo]bj/
*.kdev*
.kdev*
kdev*.*
# Roslyn cache directories
*.ide/
......
此差异已折叠。
Project:
https://gitcode.com/colorEagleStdio/geocalc
\ No newline at end of file
......@@ -74,8 +74,8 @@ int main(int argc, char *argv[])
std::string strCmd = map_to_string(mp).toStdString()+"\n";
if (w.stdio_is_on())
{
fputs(strCmd.c_str(),stdout);
fflush(stdout);
//fputs(strCmd.c_str(),stdout);
//fflush(stdout);
}
});
......
......@@ -190,13 +190,13 @@ namespace QTVOSM{
if (!m_pViewer || m_bVisible==false || m_bActive==false) return false;
int nLevel = m_pViewer->level();
const int ad = event->angleDelta().x() + event->angleDelta().y();
if (ad<0)
if (ad>0)
{
nLevel++;
if (nLevel>20)
nLevel=20;
}
else if (ad>0)
else if (ad<0)
{
nLevel--;
if (nLevel<0)
......
......@@ -15,33 +15,34 @@ find_package(QT NAMES Qt6 Qt5 COMPONENTS Widgets REQUIRED)
find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Widgets REQUIRED)
set(PRJ_HEADERS
../qtviewer_planetosm/osmtiles/layer_interface.h
../qtviewer_planetosm/osmtiles/viewer_interface.h
qtvplugin_grid.h
../qtviewer_planetosm/osmtiles/layer_interface.h
../qtviewer_planetosm/osmtiles/viewer_interface.h
../geocalc/geocalc.h
qtvplugin_grid.h
)
set(PRJ_SOURCES
qtvplugin_grid.cpp
qtvplugin_grid.cpp
)
set(PRJ_FORMS
qtvplugin_grid.ui
qtvplugin_grid.ui
)
set(PRJ_RESOURCES
resources.qrc
qtvplugin_grid_zh_CN.ts
resources.qrc
qtvplugin_grid_zh_CN.ts
)
add_library(qtvplugin_grid SHARED
${PRJ_HEADERS}
${PRJ_SOURCES}
${PRJ_FORMS}
${PRJ_RESOURCES}
${PRJ_HEADERS}
${PRJ_SOURCES}
${PRJ_FORMS}
${PRJ_RESOURCES}
)
target_compile_definitions(qtvplugin_grid PRIVATE PLANETOSM_EXPORT_DLL)
target_link_libraries(qtvplugin_grid PRIVATE
Qt${QT_VERSION_MAJOR}::Widgets
Qt${QT_VERSION_MAJOR}::Widgets
)
......@@ -13,6 +13,7 @@
#include <QMessageBox>
#include <QSettings>
#include <math.h>
#include "../geocalc/geocalc.h"
#include "../qtviewer_planetosm/interface_utils.h"
/*!
* The plugin dynamic library (.dll in windows or .so in linux) will be loaded into memory only once.
......@@ -132,8 +133,8 @@ QWidget * qtvplugin_grid::load_prop_window()
void qtvplugin_grid::cb_paintEvent( QPainter * pImage )
{
int step_level[12] = {20,20,10,10,5,5,2,1,1,1,1,1};
double dstep_level[12] = {0.5,0.2,0.1,0.05,0.02,0.01,0.005,0.002,0.001,0.0005,0.0005/2,0.0005/4};
int step_level[12] = {20,20,10,10,5,5,2,1,1,1,1,1};
double dstep_level[12] = {0.5,0.2,0.1,0.05,0.02,0.01,0.005,0.002,0.001,0.0005,0.0005/2,0.0005/4};
if (!m_pVi || m_bVisible==false)
return ;
QRect rect = m_pVi->windowRect();
......@@ -208,7 +209,7 @@ void qtvplugin_grid::cb_paintEvent( QPainter * pImage )
if (false==m_pVi->CV_LLA2DP(lat,lon_right,&DP_right,&DP_bottom))
continue;
pImage->drawLine(DP_left,DP_top,DP_right,DP_bottom);
sprintf(str,"%-9.4f",lat);
sprintf(str,"%-9.4f",lat);
pImage->drawText(DP_left,DP_top-8,str);
}
for (double lon=int(lon_left*(1/step)-1.5)*step;lon<=int(lon_right*(1/step)+1.5)*step&&m_pVi->level()>0;lon+=step)
......@@ -227,7 +228,7 @@ void qtvplugin_grid::cb_paintEvent( QPainter * pImage )
dLon+=360;
while (dLon>180)
dLon-=360;
sprintf(str,"%-9.4f",(float)dLon);
sprintf(str,"%-9.4f",(float)dLon);
pImage->drawText(DP_left,DP_bottom-16,str);
}
......@@ -245,37 +246,67 @@ void qtvplugin_grid::cb_paintEvent( QPainter * pImage )
}
//ellips_geodesic
static const int maxBufSize = 65536*4;
static std::shared_ptr<double [][3]> lla_buf(new double [maxBufSize][3]);
static std::shared_ptr<double> dis_buf(new double [maxBufSize]);
static std::shared_ptr<double> ang_buf(new double [maxBufSize]);
double (*pLLAbuf)[3] = lla_buf.get();
double *pDisbuf = dis_buf.get();
double *pAngbuf = ang_buf.get();
using CES_GEOCALC::ellips_geodesic;
int x1,y1,x2,y2;
int sz = m_list_points.size();
QPen pen_text(QColor(0,0,255));
for (int i=0;i<sz-1;++i)
int m_nZoom = m_pVi->level();
for (int i=0;i<sz;++i)
{
m_pVi->CV_LLA2DP(m_list_points[i].x(),m_list_points[i].y(),&x1,&y1);
m_pVi->CV_LLA2DP(m_list_points[i+1].x(),m_list_points[i+1].y(),&x2,&y2);
pImage->setPen(pen_area);
pImage->drawLine(x1,y1,x2,y2);
if (i==sz-1 && bFinished)
break;
QPointF startP = m_list_points[i];
QPointF endP = (i<sz-1)?m_list_points[i+1]:m_pt_end;
//Calc rough dis using spere.
double sita;
double dis = CalDistance(m_list_points[i].x(),m_list_points[i+1].x(),m_list_points[i].y(),m_list_points[i+1].y(), &sita);
sprintf(str,"%.2lfkm",dis/1000.0);
pImage->setPen(pen_text);
QPointF pos = QLineF(x1,y1,x2,y2).pointAt(i*0.8 / sz+0.1);
pImage->drawText(pos,str);
}
if (bFinished==false && sz>0)
{
m_pVi->CV_LLA2DP(m_list_points.last().x(),m_list_points.last().y(),&x1,&y1);
m_pVi->CV_LLA2DP(m_pt_end.x(),m_pt_end.y(),&x2,&y2);
double roughDis = CalDistance(startP.x(),endP.x(),startP.y(),endP.y(), &sita);
//Calc span
int span = roughDis/1000/100;
if (span<1)
span = 1;
double llaA[3]{startP.x(),startP.y(),0},llaB[3]{endP.x(),endP.y(),0};
pImage->setPen(pen_area);
pImage->drawLine(x1,y1,x2,y2);
double sita;
double dis = CalDistance(m_list_points.last().x(),m_pt_end.x(),m_list_points.last().y(),m_pt_end.y(), &sita);
sprintf(str,"%.1lfkm",dis/1000.0);
pImage->setPen(pen_text);
QPointF pos = QLineF(x1,y1,x2,y2).pointAt(1*0.8 / sz+0.1);
pImage->drawText(pos,str);
int nRes = ellips_geodesic(llaA,llaB,maxBufSize,span,pLLAbuf,nullptr,pDisbuf,pAngbuf,nullptr,false,true,1000);
if (nRes)
{
for (int j=0;j<nRes-1;++j)
{
for (int k=-1;k<2;++k)
{
m_pVi->CV_LLA2DP(pLLAbuf[j][0],pLLAbuf[j][1]+k*360,&x1,&y1);
m_pVi->CV_LLA2DP(pLLAbuf[j+1][0],pLLAbuf[j+1][1]+k*360,&x2,&y2);
if (fabs(pLLAbuf[j][1] - pLLAbuf[j+1][1])<90)
{
pImage->drawLine(x1,y1,x2,y2);
if ((((j+1)%20==0) && (j+20<nRes-2))|| j==nRes-2)
{
pImage->setPen(pen_text);
pImage->drawEllipse(x2-3,y2-3,7,7);
sprintf(str,"%.1lf",pDisbuf[j-1<0?0:j-1]/1000.0);
pImage->drawText(QPoint(x2,y2-8),str);
sprintf(str,"%.1lf",pAngbuf[j-1<0?0:j-1]);
pImage->drawText(QPoint(x2,y2+16),str);
pImage->setPen(pen_area);
}
}
}
}
}
}
pImage->setPen(oldpen);
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册