MapHandler *SceneDisplayerWidget::openMap(const std::string &mapFilename)
	{
		closeMap();

		sceneDisplayer = new SceneDisplayer(this);
		sceneDisplayer->initializeFromExistingMap(mapEditorPath, mapFilename);
		sceneDisplayer->resize(this->geometry().width(), this->geometry().height());
		updateSceneDisplayerViewProperties();

		return sceneDisplayer->getMapHandler();
	}
	MapHandler *SceneDisplayerWidget::newMap(const std::string &mapFilename, const std::string &relativeWorkingDirectory)
	{
		closeMap();

		sceneDisplayer = new SceneDisplayer(this);
		sceneDisplayer->initializeFromNewMap(mapEditorPath, mapFilename, relativeWorkingDirectory);
		sceneDisplayer->resize(this->geometry().width(), this->geometry().height());
		updateSceneDisplayerViewProperties();

		return sceneDisplayer->getMapHandler();
	}
Example #3
0
void QgsGrassVectorMap::close()
{
  QgsDebugMsg( toString() );
  if ( !mOpen )
  {
    QgsDebugMsg( "is not open" );
    return;
  }
  lockOpenClose();
  closeAllIterators(); // blocking
  closeMap();
  mOpen = false;
  unlockOpenClose();
}
Example #4
0
/* MapEditorWindow::onClose
 * Called when the window is closed
 *******************************************************************/
void MapEditorWindow::onClose(wxCloseEvent& e)
{
	if (!tryClose())
	{
		e.Veto();
		return;
	}

	// Save current layout
	saveLayout();
	if (!IsMaximized())
		Misc::setWindowInfo(id, GetSize().x, GetSize().y, GetPosition().x, GetPosition().y);

	this->Show(false);
	closeMap();
}
Example #5
0
void WFrame::manageConnections() {
    
    QObject::connect(c,SIGNAL(exitProgram()),this,SLOT(onExit()));
    QObject::connect(c,SIGNAL(FileLoadedSignal(int)),this,SLOT(FileLoaded(int)));
    QObject::connect(c,SIGNAL(closeMap()),this,SLOT(onCloseMap()));
    QObject::connect(this,SIGNAL(closeMapButtonClicked()),c,SLOT(closeMapClicked()));
    QObject::connect(c,SIGNAL(loadMapSignal()),this,SLOT(loadMap()));
    QObject::connect(c,SIGNAL(noNodesSignal()),this,SLOT(errorNodes()));
    QObject::connect(c,SIGNAL(noOSMSignal()),this,SLOT(errorOSM()));
    QObject::connect(c,SIGNAL(multipleDropSignal()),this,SLOT(multipleDrop()));
    
    //ACTION CONNECTS
    QObject::connect(open,SIGNAL(triggered()),this,SLOT(getFile()));
    QObject::connect(exit,SIGNAL(triggered()),c,SLOT(exitClicked()));
    QObject::connect(closeFile,SIGNAL(triggered()),this,SLOT(checkMap()));
    QObject::connect(about,SIGNAL(triggered()),this,SLOT(showAbout()));
    QObject::connect(links,SIGNAL(triggered()),this,SLOT(showLinks()));
    
}
Example #6
0
/**
 * Dessine le plateau de jeu.
 * @param map Le fichier correspondant à la map
 * @param game L'état du jeu
 * @param board Le plateau à afficher
 */
void drawBoard(FILE* map, const GameState* game, char board[ROWS][COLS]) {
    unsigned short x, y;

    for (x = 0; x < ROWS; x++) {
        for (y = 0; y <= COLS; y++) {
            board[x][y] = fgetc(map);

            setColor(getCaseColor(board[x][y]));
            putchar(convertCase(board[x][y]));
        }
    }

    resetColor();

    drawToolbar(game);
    drawPanel();

    printf("\n");

    closeMap(map);
}
Example #7
0
/* MapEditorWindow::openMap
 * Opens [map] in the editor
 *******************************************************************/
bool MapEditorWindow::openMap(Archive::mapdesc_t map)
{
	// If a map is currently open and modified, prompt to save changes
	if (editor.getMap().isModified())
	{
		wxMessageDialog md(this, S_FMT("Save changes to map %s?", currentMapDesc().name), "Unsaved Changes", wxYES_NO | wxCANCEL);
		int answer = md.ShowModal();
		if (answer == wxID_YES)
			saveMap();
		else if (answer == wxID_CANCEL)
			return true;
	}

	// Show blank map
	this->Show(true);
	map_canvas->Refresh();
	Layout();
	Update();
	Refresh();

	// Clear current map data
	for (unsigned a = 0; a < map_data.size(); a++)
		delete map_data[a];
	map_data.clear();

	// Get map parent archive
	Archive* archive = NULL;
	if (map.head)
	{
		archive = map.head->getParent();

		// Load map data
		if (map.archive)
		{
			WadArchive temp;
			temp.open(map.head->getMCData());
			for (unsigned a = 0; a < temp.numEntries(); a++)
				map_data.push_back(new ArchiveEntry(*(temp.getEntry(a))));
		}
		else
		{
			ArchiveEntry* entry = map.head;
			while (entry)
			{
				bool end = (entry == map.end);
				map_data.push_back(new ArchiveEntry(*entry));
				entry = entry->nextEntry();
				if (end)
					break;
			}
		}
	}

	// Set texture manager archive
	tex_man.setArchive(archive);

	// Clear current map
	closeMap();

	// Attempt to open map
	theSplashWindow->show("Loading Map", true, this);
	bool ok = editor.openMap(map);
	theSplashWindow->hide();

	// Show window if opened ok
	if (ok)
	{
		mdesc_current = map;

		// Read DECORATE definitions if any
		theGameConfiguration->parseDecorateDefs(theArchiveManager->baseResourceArchive());
		for (int i = 0; i < theArchiveManager->numArchives(); ++i)
			theGameConfiguration->parseDecorateDefs(theArchiveManager->getArchive(i));

		// Load scripts if any
		loadMapScripts(map);

		// Lock map entries
		lockMapEntries();

		// Reset map checks panel
		panel_checks->reset();

		map_canvas->viewFitToMap(true);
		map_canvas->Refresh();

		// Set window title
		if (archive)
			SetTitle(S_FMT("SLADE - %s of %s", map.name, archive->getFilename(false)));
		else
			SetTitle(S_FMT("SLADE - %s (UNSAVED)", map.name));

		// Create backup
		if (map.head && !backup_manager->writeBackup(map_data, map.head->getTopParent()->getFilename(false), map.head->getName(true)))
			LOG_MESSAGE(1, "Warning: Failed to backup map data");
	}

	return ok;
}
Example #8
0
void MainController::closeMapClicked() {
        emit closeMap();
}
Example #9
0
GPIORelaisController::~GPIORelaisController()
{
	info_printf("~GPIORelaisController\n");
	setOffAllRelais();
	closeMap();
}