本文整理汇总了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;
}
示例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);
}
示例3: mapWidget
void PanTool::dragFinish()
{
MapView* view = mapWidget()->getMapView();
view->finishPanning(cur_pos - click_pos);
cur_map_widget->setCursor(Qt::OpenHandCursor);
}
示例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();
}
示例5: currentMapView
void DocumentManager::centerViewOn(qreal x, qreal y)
{
MapView *view = currentMapView();
if (!view)
return;
view->centerOn(currentDocument()->renderer()->tileToPixelCoords(x, y));
}
示例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);
}
示例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();
}
示例8: GetOwnerDerived
void PlaceToolInputState::OnDraw()
{
if( mUnitPlacementSprite )
{
EditorState* owner = GetOwnerDerived();
MapView* mapView = owner->GetMapView();
// Draw the Unit placement sprite.
mUnitPlacementSprite->OnDraw( *mapView->GetCamera() );
}
}
示例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);
}
}
示例10:
MapView * MapView::create()
{
MapView *ret = new MapView;
if (ret && ret->init())
{
ret->autorelease();
}
else
{
delete ret;
ret = nullptr;
}
return ret;
}
示例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);
}
示例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();
}
示例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);
}
示例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);
}
}
}
}
}
示例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();
}