当前位置: 首页>>代码示例>>C++>>正文


C++ MapView类代码示例

本文整理汇总了C++中MapView的典型用法代码示例。如果您正苦于以下问题:C++ MapView类的具体用法?C++ MapView怎么用?C++ MapView使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了MapView类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: while

MapView* SampleLapViewer::createLapView(int refRace, int refLap)
{
    QVector<QPointF> positions;
    QSqlQuery posQuery;
    posQuery.prepare("select longitude, latitude from POSITION where ref_lap_race = ? and ref_lap_num = ?");
    posQuery.addBindValue(refRace);
    posQuery.addBindValue(refLap);

    if (posQuery.exec())
    {
        while (posQuery.next())
        {
            GeoCoordinate tmp;
            tmp.setLongitude(posQuery.value(0).toFloat());
            tmp.setLatitude(posQuery.value(1).toFloat());

            positions << tmp.projection();
        }
    }

    MapScene* sc = new MapScene(50 * 1000, this);
    sc->addTrack(positions);

    MapView* view = new MapView(this);
    view->setDragMode(QGraphicsView::ScrollHandDrag);
    view->setScene(sc);
    connect(view, SIGNAL(zoomedAround(int,QPointF)), this, SLOT(zoomView(int)));

    return view;
}
开发者ID:xaviermawet,项目名称:EcoManager2013,代码行数:30,代码来源:SampleLapViewer.cpp

示例2: worldToPixel

QPoint ApplicationUI::worldToPixel(QObject* mapObject, double latitude, double longitude) const
{
    MapView* mapview = qobject_cast<MapView*>(mapObject);
    const Point worldCoordinates = Point(latitude, longitude);

    return mapview->worldToWindow(worldCoordinates);
}
开发者ID:pabrou,项目名称:bb-pro,代码行数:7,代码来源:applicationui.cpp

示例3: mapWidget

void PanTool::dragFinish()
{
	MapView* view = mapWidget()->getMapView();
	view->finishPanning(cur_pos - click_pos);
	
	cur_map_widget->setCursor(Qt::OpenHandCursor);
}
开发者ID:999999333,项目名称:mapper,代码行数:7,代码来源:tool_pan.cpp

示例4: worldToPixelInvokable

QVariantList ApplicationUI::worldToPixelInvokable(QObject* mapObject, double latitude, double longitude) const
{
    MapView* mapview = qobject_cast<MapView*>(mapObject);
    const Point worldCoordinates = Point(latitude, longitude);
    const QPoint pixels = mapview->worldToWindow(worldCoordinates);

    return QVariantList() << pixels.x() << pixels.y();
}
开发者ID:pabrou,项目名称:bb-pro,代码行数:8,代码来源:applicationui.cpp

示例5: currentMapView

void DocumentManager::centerViewOn(qreal x, qreal y)
{
    MapView *view = currentMapView();
    if (!view)
        return;

    view->centerOn(currentDocument()->renderer()->tileToPixelCoords(x, y));
}
开发者ID:Birmania,项目名称:tiled,代码行数:8,代码来源:documentmanager.cpp

示例6: addMarker

void ApplicationUI::addMarker(QObject* mapObject, double lat, double lon, QString nombre){

	MapView* mapview = qobject_cast<MapView*>(mapObject);

	GeoLocation* loc = new GeoLocation(lat, lon, mapview);
	loc->setName(nombre);
	mapview->mapData()->clear();
	mapview->mapData()->add(loc);

}
开发者ID:pabrou,项目名称:bb-pro,代码行数:10,代码来源:applicationui.cpp

示例7: recentFiles

void MainWindow::openLastFiles()
{
    const QStringList files = recentFiles();

    mSettings.beginGroup(QLatin1String("recentFiles"));

    int openCount = mSettings.value(QLatin1String("recentOpenedFiles"), 1).toInt();

    QStringList mapScales = mSettings.value(
                            QLatin1String("mapScale")).toStringList();
    QStringList scrollX = mSettings.value(
                          QLatin1String("scrollX")).toStringList();
    QStringList scrollY = mSettings.value(
                          QLatin1String("scrollY")).toStringList();
    QStringList selectedLayer = mSettings.value(
                                QLatin1String("selectedLayer")).toStringList();

    for (int i = 0; i < openCount; i++) {
        if (!(i < files.size()))
            break;
        if (!(i < mapScales.size()))
            continue;
        if (!(i < scrollX.size()))
            continue;
        if (!(i < scrollY.size()))
            continue;
        if (!(i < selectedLayer.size()))
            continue;

        if (openFile(files.at(i))) {
            MapView *mapView = mDocumentManager->currentMapView();

            // Restore camera to the previous position
            qreal scale = mapScales.at(i).toDouble();
            if (scale > 0)
                mapView->zoomable()->setScale(scale);

            const int hor = scrollX.at(i).toInt();
            const int ver = scrollY.at(i).toInt();
            mapView->horizontalScrollBar()->setSliderPosition(hor);
            mapView->verticalScrollBar()->setSliderPosition(ver);

            int layer = selectedLayer.at(i).toInt();
            if (layer > 0 && layer < mMapDocument->map()->layerCount())
                mMapDocument->setCurrentLayerIndex(layer);
        }
    }
    QString lastActiveDocument =
            mSettings.value(QLatin1String("lastActive")).toString();
    int documentIndex = mDocumentManager->findDocument(lastActiveDocument);
    if (documentIndex != -1)
        mDocumentManager->switchToDocument(documentIndex);

    mSettings.endGroup();
}
开发者ID:Laiff,项目名称:tiled,代码行数:55,代码来源:mainwindow.cpp

示例8: GetOwnerDerived

void PlaceToolInputState::OnDraw()
{
	if( mUnitPlacementSprite )
	{
		EditorState* owner = GetOwnerDerived();
		MapView* mapView = owner->GetMapView();

		// Draw the Unit placement sprite.
		mUnitPlacementSprite->OnDraw( *mapView->GetCamera() );
	}
}
开发者ID:andrewtc,项目名称:AndroidWars,代码行数:11,代码来源:EditorInputStates.cpp

示例9: OnToolsMapview

void MainWnd::OnToolsMapview()
{
  if(theApp.cartridgeType == 0) {
    MapView *dlg = new MapView;
    dlg->Create(IDD_MAP_VIEW, this);
    dlg->ShowWindow(SW_SHOW);
  } else {
    GBMapView *dlg = new GBMapView;
    dlg->Create(IDD_GB_MAP_VIEW, this);
    dlg->ShowWindow(SW_SHOW);
  }
}
开发者ID:MrSwiss,项目名称:visualboyadvance-m,代码行数:12,代码来源:MainWndTools.cpp

示例10:

MapView * MapView::create()
{
	MapView *ret = new MapView;
	if (ret && ret->init())
	{
		ret->autorelease();
	}
	else
	{
		delete ret;
		ret = nullptr;
	}
	return ret;
}
开发者ID:RayRiver,项目名称:LinkWar,代码行数:14,代码来源:MapView.cpp

示例11: zoomView

void SampleLapViewer::zoomView(int increment)
{
    QMatrix scaling;
    MapView* currentView = dynamic_cast<MapView*>(
                this->ui->lapsViewStack->currentWidget());

    if (currentView == NULL)
        return;

    this->_zoomLevel += increment;
    qreal scale =  qPow(2, this->_zoomLevel / 10.0);
    scaling.scale(scale, scale);
    currentView->setMatrix(scaling);
}
开发者ID:xaviermawet,项目名称:EcoManager2013,代码行数:14,代码来源:SampleLapViewer.cpp

示例12: main

int main(int argc, char *argv[])
{
  std::cerr << "Justina Robocar City Emulator, Copyright (C) 2015 András Mamenyák" << std::endl
            << "This program comes with ABSOLUTELY NO WARRANTY;" << std::endl
            << "This is free software, and you are welcome to redistribute it" << std::endl
            << "under certain conditions." << std::endl
            << std::endl;

  if (argc < 2)
  {
    std::cerr << "Usage: Monitor OSM_FILE\n";
    exit(1);
  }

  QApplication app(argc, argv);

  MapView mapview;
  mapview.init(argv[1]);
  mapview.show();

  return app.exec();
}
开发者ID:rbesenczi,项目名称:Crowd-sourced-Traffic-Simulator,代码行数:22,代码来源:main.cpp

示例13: Q_ASSERT

void DocumentManager::addDocument(MapDocument *mapDocument)
{
    Q_ASSERT(mapDocument);
    Q_ASSERT(!mDocuments.contains(mapDocument));

    mDocuments.append(mapDocument);
    mUndoGroup->addStack(mapDocument->undoStack());

    MapView *view = new MapView(mTabWidget);
    MapScene *scene = new MapScene(view); // scene is owned by the view

    scene->setMapDocument(mapDocument);
    view->setScene(scene);

    const int documentIndex = mDocuments.size() - 1;

    mTabWidget->addTab(view, mapDocument->displayName());
    mTabWidget->setTabToolTip(documentIndex, mapDocument->fileName());
    connect(mapDocument, SIGNAL(fileNameChanged()), SLOT(updateDocumentTab()));
    connect(mapDocument, SIGNAL(modifiedChanged()), SLOT(updateDocumentTab()));

    switchToDocument(documentIndex);
    centerViewOn(0, 0);
}
开发者ID:Birmania,项目名称:tiled,代码行数:24,代码来源:documentmanager.cpp

示例14: chunkGeneration

void ChunkGenerator::chunkGeneration(Map& map, Vec3i spectatorPos, MapView& mapView) {

  // chunkPos ist Position des Chunks, in dem der Spectator steht in Chunkkoordinaten
  Vec2i chunkPos = map.getChunkPos(spectatorPos);

  for(int x = chunkPos.x - 8; x <= chunkPos.x + 8; x++) {
    for(int z = chunkPos.y - 8; z <= chunkPos.y + 8; z++) {

      if(!map.exists({x * 16, 0, z * 16})) {

        map.addChunk({x, z});
        Chunk chunk = map.getChunk({x, z});
        double simpBiomeNoise = SimplexNoise::noise(0.01*x, 0.01*z, m_biome_seed);
        int biomeNoise = SimplexNoise::noiseInt(0, 126, simpBiomeNoise);

        if(0 <= biomeNoise && biomeNoise <= 44){
          chunk.setBiomeType(BiomeType::Desert);
        }
        if(45 <= biomeNoise && biomeNoise <= 46){
          chunk.setBiomeType(BiomeType::DesertPlain);
        }
        if(47 <= biomeNoise && biomeNoise <= 54){
          chunk.setBiomeType(BiomeType::Plains);
        }
        if(55 <= biomeNoise && biomeNoise <= 56){
          chunk.setBiomeType(BiomeType::PlainForest);
        }
        if(57 <= biomeNoise && biomeNoise <= 69){
          chunk.setBiomeType(BiomeType::Forest);
        }
        // Biome ohne Wasser 
        if(!m_setWater) {
          if(70 <= biomeNoise && biomeNoise <= 74){
            chunk.setBiomeType(BiomeType::Hillside);
          }
          if(75 <= biomeNoise && biomeNoise <= 126){
            chunk.setBiomeType(BiomeType::Mountains);
          } 
        } else {
          if(70 <= biomeNoise && biomeNoise <= 74){
            chunk.setBiomeType(BiomeType::WaterHillside);
          }
          if(75 <= biomeNoise && biomeNoise <= 126){
            chunk.setBiomeType(BiomeType::WaterMountains);
          } 
        }
        
        
        
        
        setBiomes(map, chunk, x, z, biomeNoise);
        
        Vec2i chuPos = Vec2i(x + 1, z);
        if(mapView.exists(chuPos)) {
          mapView.deleteChunkView(chuPos);
        }
        chuPos = Vec2i(x - 1, z);
        if(mapView.exists(chuPos)) {
          mapView.deleteChunkView(chuPos);
        }
        chuPos = Vec2i(x, z + 1);
        if(mapView.exists(chuPos)) {
          mapView.deleteChunkView(chuPos);
        }
        chuPos = Vec2i(x,   z - 1);
        if(mapView.exists(chuPos)) {
          mapView.deleteChunkView(chuPos);
        }
      }
    }
  }
}
开发者ID:NikoKrause,项目名称:cg-14,代码行数:72,代码来源:ChunkGenerator.cpp

示例15: display

	virtual void display()
	{
		map_view->update();
		
		glClear(GL_COLOR_BUFFER_BIT);

		prog->enable();
		prog->setProjectionMatrix(projection_matrix);
		prog->enableAttribs();
		
		map_view->draw(prog,spect,projection_matrix);

		prog->disableAttribs();
		prog->disable();
	}
开发者ID:nthend,项目名称:ait,代码行数:15,代码来源:render.hpp


注:本文中的MapView类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。