国产亚洲精品福利在线无卡一,国产精久久一区二区三区,亚洲精品无码国模,精品久久久久久无码专区不卡

當(dāng)前位置: 首頁(yè) > news >正文

wordpress 導(dǎo)入幻燈片優(yōu)化網(wǎng)站建設(shè)

wordpress 導(dǎo)入幻燈片,優(yōu)化網(wǎng)站建設(shè),建設(shè)網(wǎng)站用英文怎么說,做百度推廣的網(wǎng)絡(luò)公司前文鏈接:QGraphicsView實(shí)現(xiàn)簡(jiǎn)易地圖3『局部加載-地圖縮放』 當(dāng)鼠標(biāo)拖動(dòng)地圖移動(dòng)時(shí),需要實(shí)時(shí)增補(bǔ)和刪減瓦片地圖,大致思路是計(jì)算地圖從各方向移動(dòng)時(shí)進(jìn)出視口的瓦片坐標(biāo)值,根據(jù)變化后的瓦片坐標(biāo)值來增減地圖瓦片,以下將…

前文鏈接:QGraphicsView實(shí)現(xiàn)簡(jiǎn)易地圖3『局部加載-地圖縮放』
當(dāng)鼠標(biāo)拖動(dòng)地圖移動(dòng)時(shí),需要實(shí)時(shí)增補(bǔ)和刪減瓦片地圖,大致思路是計(jì)算地圖從各方向移動(dòng)時(shí)進(jìn)出視口的瓦片坐標(biāo)值,根據(jù)變化后的瓦片坐標(biāo)值來增減地圖瓦片,以下將提供實(shí)現(xiàn)此需求的核心代碼。
1、動(dòng)態(tài)演示效果


2、靜態(tài)展示圖片
在這里插入圖片描述

核心代碼

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();// 計(jì)算呈現(xiàn)的瓦片地圖左上角的場(chǎng)景坐標(biāo)和視口坐標(biāo)、呈現(xiàn)的瓦片地圖右下角的場(chǎng)景坐標(biāo)和視口坐標(biāo)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、水平瓦片坐標(biāo)控制:判斷最左側(cè)瓦片是否完全進(jìn)入視口、最右側(cè)瓦片是否完全離開視口if (topLeftViewPos.x() > 0){int count = qCeil(topLeftViewPos.x() / PIXMAP_SIZE);	// 左側(cè)進(jìn)入視口瓦片數(shù)量int oldLeftTileCoordX = m_topLeftTileCoord.x;			// 保存原左側(cè)瓦片坐標(biāo)Xm_topLeftTileCoord.x -= count;							// 更新現(xiàn)左側(cè)瓦片坐標(biāo)X// 增加從左側(cè)進(jìn)入視口的圖片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;	// 右側(cè)離開視口瓦片數(shù)量int oldRightTileCoordX = m_bottomRightTileCoord.x;					// 保存原右側(cè)瓦片坐標(biāo)Xm_bottomRightTileCoord.x -= count;									// 更新現(xiàn)右側(cè)瓦片坐標(biāo)X// 刪除從右側(cè)離開視口的圖片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、水平瓦片坐標(biāo)控制:判斷最右側(cè)瓦片是否完全進(jìn)入視口、最左側(cè)瓦片是否完全離開視口if (bottomRightViewPos.x() + 255 < w){int count = qCeil((w - (bottomRightViewPos.x() + 255)) / PIXMAP_SIZE);	// 右側(cè)進(jìn)入視口瓦片數(shù)量int oldRightTileCoordX = m_bottomRightTileCoord.x;						// 保存原右側(cè)瓦片坐標(biāo)Xm_bottomRightTileCoord.x += count;										// 保存現(xiàn)右側(cè)瓦片坐標(biāo)X// 增加從右側(cè)進(jìn)入視口的圖片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);	// 左側(cè)離開視口瓦片數(shù)量int oldLeftTileCoordX = m_topLeftTileCoord.x;				// 保存原左側(cè)瓦片坐標(biāo)Xm_topLeftTileCoord.x += count;								// 保存現(xiàn)左側(cè)瓦片坐標(biāo)X// 刪除從左側(cè)離開視口的圖片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、垂直瓦片坐標(biāo)控制:判斷最上側(cè)瓦片是否完全進(jìn)入視口,最下側(cè)瓦片是否完全離開視口if (topLeftViewPos.y() > 0){int count = qCeil(topLeftViewPos.y() / PIXMAP_SIZE);	// 上側(cè)進(jìn)入視口瓦片數(shù)量int oldTopTileCoordY = m_topLeftTileCoord.y;			// 保存原上側(cè)瓦片坐標(biāo)Ym_topLeftTileCoord.y -= count;							// 保存現(xiàn)上側(cè)瓦片坐標(biāo)Y// 增加從上側(cè)進(jìn)入視口的圖片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;	// 下側(cè)離開視口瓦片數(shù)量int oldBottomTileCoordY = m_bottomRightTileCoord.y;					// 保存原下側(cè)瓦片坐標(biāo)Ym_bottomRightTileCoord.y -= count;									// 保存現(xiàn)下側(cè)瓦片坐標(biāo)Y// 刪除從下側(cè)離開視口的圖片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、垂直瓦片坐標(biāo)控制:判斷最下側(cè)瓦片是否完全進(jìn)入視口,最上側(cè)瓦片是否完全離開視口if (bottomRightViewPos.y() + 255 < h){int count = qCeil((h - (bottomRightViewPos.y() + 255)) / PIXMAP_SIZE);	// 下側(cè)進(jìn)入視口瓦片數(shù)量int oldBottomTileCoordY = m_bottomRightTileCoord.y;						// 保存原下側(cè)瓦片坐標(biāo)Ym_bottomRightTileCoord.y += count;										// 保存現(xiàn)下側(cè)瓦片坐標(biāo)Y// 增加從下側(cè)進(jìn)入視口的圖片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);	// 上側(cè)離開視口瓦片數(shù)量int oldTopTileCoordY = m_topLeftTileCoord.y;				// 保存原上側(cè)瓦片坐標(biāo)Ym_topLeftTileCoord.y += count;								// 保存現(xiàn)上側(cè)瓦片坐標(biāo)Y// 刪除從上側(cè)離開視口的圖片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://m.aloenet.com.cn/news/35053.html

相關(guān)文章:

  • 杭州設(shè)計(jì)網(wǎng)站最好的公司東莞seo建站排名
  • 網(wǎng)絡(luò)服務(wù)合同糾紛定義簡(jiǎn)述影響關(guān)鍵詞優(yōu)化的因素
  • 海南做房地產(chǎn)網(wǎng)站的網(wǎng)絡(luò)公司seo公司官網(wǎng)
  • 制作官網(wǎng)需要什么條件茶葉seo網(wǎng)站推廣與優(yōu)化方案
  • 網(wǎng)站制作手機(jī)網(wǎng)站成人培訓(xùn)班有哪些課程
  • 網(wǎng)站制作價(jià)格和流程云浮新增確診病例30例
  • 建網(wǎng)站的外包公司百度推廣怎么做步驟
  • wordpress花生殼lamp南京百度seo代理
  • 員工做違法網(wǎng)站seo顧問賺錢嗎
  • 企業(yè)網(wǎng)站內(nèi)容運(yùn)營(yíng)方案策劃網(wǎng)絡(luò)廣告怎么做
  • 網(wǎng)站建設(shè)項(xiàng)目國(guó)內(nèi)外分析報(bào)告長(zhǎng)春網(wǎng)站推廣公司
  • 網(wǎng)站建設(shè)優(yōu)化廣告流量關(guān)鍵詞搜索排行榜
  • 做網(wǎng)站引流推廣賺錢一個(gè)2元
  • 網(wǎng)站建設(shè)實(shí)用教程企業(yè)郵箱申請(qǐng)
  • 網(wǎng)站做seo屏蔽搜索關(guān)鍵詞排名監(jiān)控批量查詢
  • 河北涿州網(wǎng)站建設(shè)網(wǎng)絡(luò)營(yíng)銷是指什么
  • 網(wǎng)站開發(fā)的對(duì)聯(lián)株洲疫情最新情況
  • 多種成都網(wǎng)站建設(shè)全網(wǎng)推廣外包公司
  • 珠寶 網(wǎng)站模板免費(fèi)seo快速收錄工具
  • 網(wǎng)站logo怎么修改北京網(wǎng)絡(luò)推廣有哪些公司
  • 建站平臺(tái)選擇建議全球訪問量top100網(wǎng)站
  • 網(wǎng)站開發(fā)服務(wù)費(fèi)入什么科目重慶網(wǎng)站快速排名提升
  • 西安專業(yè)網(wǎng)站建設(shè)價(jià)格引擎搜索對(duì)人類記憶的影響
  • 門戶網(wǎng)站建設(shè)和檢務(wù)公開情況自查報(bào)告免費(fèi)建一個(gè)自己的網(wǎng)站
  • 網(wǎng)站開發(fā) 保修期網(wǎng)絡(luò)推廣文案怎么寫
  • 會(huì)計(jì)實(shí)帳培訓(xùn)上海百度搜索優(yōu)化
  • 怎么用自己的電腦做網(wǎng)站主機(jī)企業(yè)管理培訓(xùn)課程視頻
  • 別人做的網(wǎng)站怎么打開2022網(wǎng)站seo
  • 網(wǎng)站開發(fā)人員職位晉升空間深圳龍崗區(qū)布吉街道
  • 小程序開發(fā)價(jià)格深圳百度seo公司