当前位置: 首页 > news >正文

沧州到黄骅谷歌seo排名技巧

沧州到黄骅,谷歌seo排名技巧,wordpress写真图片主题,政府网站建设招标前文链接:QGraphicsView实现简易地图3『局部加载-地图缩放』 当鼠标拖动地图移动时,需要实时增补和删减瓦片地图,大致思路是计算地图从各方向移动时进出视口的瓦片坐标值,根据变化后的瓦片坐标值来增减地图瓦片,以下将…

前文链接:QGraphicsView实现简易地图3『局部加载-地图缩放』
当鼠标拖动地图移动时,需要实时增补和删减瓦片地图,大致思路是计算地图从各方向移动时进出视口的瓦片坐标值,根据变化后的瓦片坐标值来增减地图瓦片,以下将提供实现此需求的核心代码。
1、动态演示效果


2、静态展示图片
在这里插入图片描述

核心代码

void MapView::moveScene()
{QString appPath = QApplication::applicationDirPath();QString dirPath = QString("%1/MapData/GaoDeMap/Map/MapPng/L0%2").arg(appPath).arg(m_curLevel + 1);// 视口宽度和高度int w = viewport()->width();int h = viewport()->height();// 计算呈现的瓦片地图左上角的场景坐标和视口坐标、呈现的瓦片地图右下角的场景坐标和视口坐标QPoint topLeftScenePos(m_topLeftTileCoord.x * PIXMAP_SIZE, m_topLeftTileCoord.y * PIXMAP_SIZE);QPointF topLeftViewPos = mapFromScene(topLeftScenePos);QPoint bottomRightScenePos(m_bottomRightTileCoord.x * PIXMAP_SIZE, m_bottomRightTileCoord.y * PIXMAP_SIZE);QPointF bottomRightViewPos = mapFromScene(bottomRightScenePos);// 1、水平瓦片坐标控制:判断最左侧瓦片是否完全进入视口、最右侧瓦片是否完全离开视口if (topLeftViewPos.x() > 0){int count = qCeil(topLeftViewPos.x() / PIXMAP_SIZE);	// 左侧进入视口瓦片数量int oldLeftTileCoordX = m_topLeftTileCoord.x;			// 保存原左侧瓦片坐标Xm_topLeftTileCoord.x -= count;							// 更新现左侧瓦片坐标X// 增加从左侧进入视口的图片for (int row = m_topLeftTileCoord.y; row <= m_bottomRightTileCoord.y; ++row){for (int col = m_topLeftTileCoord.x; col < oldLeftTileCoordX; ++col){QString fileName = QString("%1/Map_%2-%3.png").arg(dirPath).arg(QString::number(row + 1).rightJustified(2, '0')).arg(QString::number(col + 1).rightJustified(2, '0'));QPixmap pixmap(fileName);QGraphicsPixmapItem *item = new QGraphicsPixmapItem(pixmap);item->setPos(PIXMAP_SIZE * col, PIXMAP_SIZE * row);m_scene->addItem(item);m_mapItems[row][col] = item;}}}if (bottomRightViewPos.x() > w){int count = qFloor((bottomRightViewPos.x() - w) / PIXMAP_SIZE) + 1;	// 右侧离开视口瓦片数量int oldRightTileCoordX = m_bottomRightTileCoord.x;					// 保存原右侧瓦片坐标Xm_bottomRightTileCoord.x -= count;									// 更新现右侧瓦片坐标X// 删除从右侧离开视口的图片for (int row = m_topLeftTileCoord.y; row <= m_bottomRightTileCoord.y; ++row){for (int col = oldRightTileCoordX; col > m_bottomRightTileCoord.x; --col){QGraphicsPixmapItem *item = m_mapItems[row][col];m_scene->removeItem(item);m_mapItems[row].remove(col);delete item;}}}// 2、水平瓦片坐标控制:判断最右侧瓦片是否完全进入视口、最左侧瓦片是否完全离开视口if (bottomRightViewPos.x() + 255 < w){int count = qCeil((w - (bottomRightViewPos.x() + 255)) / PIXMAP_SIZE);	// 右侧进入视口瓦片数量int oldRightTileCoordX = m_bottomRightTileCoord.x;						// 保存原右侧瓦片坐标Xm_bottomRightTileCoord.x += count;										// 保存现右侧瓦片坐标X// 增加从右侧进入视口的图片for (int row = m_topLeftTileCoord.y; row <= m_bottomRightTileCoord.y; ++row){for (int col = m_bottomRightTileCoord.x; col > oldRightTileCoordX; --col){QString fileName = QString("%1/Map_%2-%3.png").arg(dirPath).arg(QString::number(row + 1).rightJustified(2, '0')).arg(QString::number(col + 1).rightJustified(2, '0'));QPixmap pixmap(fileName);QGraphicsPixmapItem *item = new QGraphicsPixmapItem(pixmap);item->setPos(PIXMAP_SIZE * col, PIXMAP_SIZE * row);m_scene->addItem(item);m_mapItems[row][col] = item;}}}if (topLeftViewPos.x() + 255 < 0){int count = qFloor(fabs(topLeftViewPos.x()) / PIXMAP_SIZE);	// 左侧离开视口瓦片数量int oldLeftTileCoordX = m_topLeftTileCoord.x;				// 保存原左侧瓦片坐标Xm_topLeftTileCoord.x += count;								// 保存现左侧瓦片坐标X// 删除从左侧离开视口的图片for (int row = m_topLeftTileCoord.y; row <= m_bottomRightTileCoord.y; ++row){for (int col = oldLeftTileCoordX; col < m_topLeftTileCoord.x; ++col){QGraphicsPixmapItem *item = m_mapItems[row][col];m_scene->removeItem(item);m_mapItems[row].remove(col);delete item;}}}// 3、垂直瓦片坐标控制:判断最上侧瓦片是否完全进入视口,最下侧瓦片是否完全离开视口if (topLeftViewPos.y() > 0){int count = qCeil(topLeftViewPos.y() / PIXMAP_SIZE);	// 上侧进入视口瓦片数量int oldTopTileCoordY = m_topLeftTileCoord.y;			// 保存原上侧瓦片坐标Ym_topLeftTileCoord.y -= count;							// 保存现上侧瓦片坐标Y// 增加从上侧进入视口的图片for (int row = m_topLeftTileCoord.y; row < oldTopTileCoordY; ++row){for (int col = m_topLeftTileCoord.x; col <= m_bottomRightTileCoord.x; ++col){QString fileName = QString("%1/Map_%2-%3.png").arg(dirPath).arg(QString::number(row + 1).rightJustified(2, '0')).arg(QString::number(col + 1).rightJustified(2, '0'));QPixmap pixmap(fileName);QGraphicsPixmapItem *item = new QGraphicsPixmapItem(pixmap);item->setPos(PIXMAP_SIZE * col, PIXMAP_SIZE * row);m_scene->addItem(item);m_mapItems[row][col] = item;}}}if (bottomRightViewPos.y() > h){int count = qFloor((bottomRightViewPos.y() - h) / PIXMAP_SIZE) + 1;	// 下侧离开视口瓦片数量int oldBottomTileCoordY = m_bottomRightTileCoord.y;					// 保存原下侧瓦片坐标Ym_bottomRightTileCoord.y -= count;									// 保存现下侧瓦片坐标Y// 删除从下侧离开视口的图片for (int row = oldBottomTileCoordY; row > m_bottomRightTileCoord.y; --row){for (int col = m_topLeftTileCoord.x; col <= m_bottomRightTileCoord.x; ++col){QGraphicsPixmapItem *item = m_mapItems[row][col];m_scene->removeItem(item);m_mapItems[row].remove(col);delete item;}}}// 4、垂直瓦片坐标控制:判断最下侧瓦片是否完全进入视口,最上侧瓦片是否完全离开视口if (bottomRightViewPos.y() + 255 < h){int count = qCeil((h - (bottomRightViewPos.y() + 255)) / PIXMAP_SIZE);	// 下侧进入视口瓦片数量int oldBottomTileCoordY = m_bottomRightTileCoord.y;						// 保存原下侧瓦片坐标Ym_bottomRightTileCoord.y += count;										// 保存现下侧瓦片坐标Y// 增加从下侧进入视口的图片for (int row = m_bottomRightTileCoord.y; row > oldBottomTileCoordY; --row){for (int col = m_topLeftTileCoord.x; col <= m_bottomRightTileCoord.x; ++col){QString fileName = QString("%1/Map_%2-%3.png").arg(dirPath).arg(QString::number(row + 1).rightJustified(2, '0')).arg(QString::number(col + 1).rightJustified(2, '0'));QPixmap pixmap(fileName);QGraphicsPixmapItem *item = new QGraphicsPixmapItem(pixmap);item->setPos(PIXMAP_SIZE * col, PIXMAP_SIZE * row);m_scene->addItem(item);m_mapItems[row][col] = item;}}}if (topLeftViewPos.y() + 255 < 0){int count = qFloor(fabs(topLeftViewPos.y()) / PIXMAP_SIZE);	// 上侧离开视口瓦片数量int oldTopTileCoordY = m_topLeftTileCoord.y;				// 保存原上侧瓦片坐标Ym_topLeftTileCoord.y += count;								// 保存现上侧瓦片坐标Y// 删除从上侧离开视口的图片for (int row = oldTopTileCoordY; row < m_topLeftTileCoord.y; ++row){for (int col = m_topLeftTileCoord.x; col <= m_bottomRightTileCoord.x; ++col){QGraphicsPixmapItem *item = m_mapItems[row][col];m_scene->removeItem(item);m_mapItems[row].remove(col);delete item;}}}
}
http://www.tj-hxxt.cn/news/27538.html

相关文章:

  • 阿里云做网站送服务器郑州seo线下培训
  • 做电影网站有哪些seo外包公司兴田德润官方地址
  • 中国广东手机网站建设应用商店下载安装
  • 成都网站建设杨勇seo网站优化助理
  • 淮南seo临沂网站seo
  • 网络营销的方法有哪些方式关键词优化排名哪家好
  • 网站建设设计简介百度一下官网首页百度
  • 查询注册过的网站站长之家网站查询
  • vpsputty做网站上海网站seo外包
  • 来个网站奖励自己海外网站cdn加速
  • 拓者设计吧效果图网站产品怎么优化
  • 30个做设计的网站全国各城市感染高峰进度查询
  • 未来做那个网站能致富陕西网站设计
  • 多页网站制作经典软文推广案例
  • 怎么设置网站服务器竞价出价怎么出
  • 建设门户网站的目的和需求seo关键词推广案例
  • 宜宾建设教育培训中心网站厦门seo大佬
  • 会议网站建设的意义上海网站建设
  • 企业做网站多少钱不限次数观看视频的app
  • 扬州网站建设多少钱seo优缺点
  • 做网站在哪找靠谱百度seo服务公司
  • 专题探索网站开发模式特点谷歌搜索引擎下载安装
  • 不用编程做APP和响应式网站2024年最新一轮阳性症状
  • 用bluehost建设网站seo页面内容优化
  • 阿里云ecs部署网站阿里云建站费用
  • python基础教程第3版seo怎么做优化工作
  • 软件工程女生的悲哀海口seo网络公司
  • 企业网站设计分类营销软件
  • 接做图网站互联网营销策划方案
  • 线上线下推广是什么意思优化大师win10能用吗