// doDraw //--------------------------------------------------------------------------- void MapSelectionView::doDraw(Surface &viewArea, Surface &clientArea) { //iRect r(getViewRect()); //viewArea.bltLookup(r, Palette::darkGray256.getColorArray()); if (mapList.size() <= 0) { // Since there are no maps loaded, try to load some maps. int result = loadMaps(); if (result == 0) { clientArea.bltStringCenter(_("No Maps Found"), Color::white); } else if (result == 1) { clientArea.bltStringCenter(_("Outpost file error"), Color::white); } } if (mapList.size() > 0) { // Since maps were found, draw the selected map. mapList[curMap]->thumbnail.blt(clientArea, BORDER_SPACE, BORDER_SPACE); drawCurMapInfo(clientArea, iXY(MAP_SIZE + BORDER_SPACE * 2, BORDER_SPACE)); } View::doDraw(viewArea, clientArea); } // end MapSelectionView::doDraw
void UI::loadTextures() { // Load sprite sheet sheet = this->loadTexture("resources/sam_gfx.bmp",renderer); loadMaps(); }
/** * \brief Charge un espace de travail * \details Charge un espace de travail. Si le dossier spécifié n'était pas un espace de travail, ce dernier est transformé en espace de travail * \param path chemin vers le dosier de l'espace de travail */ void Workspace::load(const QString& path){ clear(); wspath = path; QFile xml_doc(path + "\\.workspace"); if(xml_doc.exists()){ if(!xml_doc.open(QIODevice::ReadOnly)){ xml_doc.close(); NoteException ne("Le fichier .workspace n'a pas pu être ouvert."); throw ne; } if (!dom->setContent(&xml_doc)){ xml_doc.close(); NoteException ne("Le fichier .workspace est corrompu."); throw ne; } loadMaps(); check(); xml_doc.close(); } else { // create the .workspace file xml_doc.open(QIODevice::ReadWrite); QTextStream out(&xml_doc); out.setCodec("UTF-8"); out << "<?xml version='1.0' encoding='UTF-8'?>\n<workspace>\n <notes></notes>\n <trash_notes></trash_notes>\n <tags></tags>\n</workspace>"; xml_doc.close(); dom->setContent(&xml_doc); } }
int main(int argc, char* argv[]) { printf("MYRESTART\n"); strcpy(ckpt_image, argv[1]); printf("Before loadMaps %s\n", ckpt_image); printf("restart\n"); printf("%s\n", ckpt_image); loadMaps(ckpt_image); }
SelectMenu::SelectMenu(void* callObject, void (*loadFunction) (void* object, const std::string& map), void (*backFunction) (void* object), ConfigReader* cReader, const sf::Vector2i& r, const sf::Font& font) : Menu(r, sf::Color(50, 80, 80, 150)) { createString("select", "SBE - Select stage", font, 30, sf::Vector2f(0, 0)); strings["select"].SetCenter(strings["select"].GetRect().GetWidth() / 2, strings["select"].GetRect().GetHeight() / 2); strings["select"].SetPosition(sf::Vector2f(res.x / 2 - 17, 108.5)); loadMaps(font, "scripts/maps.ast"); //createButton("map01", this, loadLevel, sf::String("Test level", font, 20), sf::Color(225, 225, 225, 255), sf::Vector2f(125, 175), sf::Vector2f(280, 215), sf::Color(30, 30, 50, 0), true, 1, sf::Color::White); createButton("back", callObject, backFunction, sf::String("Back", font, 20), sf::Color(225, 225, 225, 255), sf::Vector2f(125, res.y - 165), sf::Vector2f(280, res.y - 125), sf::Color(80, 30, 30, 80), true, 1, sf::Color::White); funcObject = callObject; loadFunc = loadFunction; }
// init //--------------------------------------------------------------------------- void MapSelectionView::init() { const int arrowButtonWidth = (getClientRect().getSizeX() - MAP_SIZE - BORDER_SPACE * 3) / 2; iXY pos(MAP_SIZE + BORDER_SPACE * 2, getClientRect().getSizeY() - 14 - BORDER_SPACE); add( Button::createTextButton( "<", pos, arrowButtonWidth - 1, new ChangeSelectedMapAction(this, -1))); pos.x += arrowButtonWidth + 2; add( Button::createTextButton( ">", pos, arrowButtonWidth - 1, new ChangeSelectedMapAction(this, 1))); loadMaps(); HostOptionsView::updateWindSpeedString(); } // end MapSelectionView::init
///////////////////////////////////////////////////////////////////////////// // setup ///////////////////////////////////////////////////////////////////////////// void CMapListCtrl::PreSubclassWindow() { CSortListCtrl::PreSubclassWindow(); //insert columns InsertColumn(0, "Map Name", LVCFMT_LEFT, 150); InsertColumn(1, "O", LVCFMT_CENTER, 20, 1); InsertColumn(2, "# Players", LVCFMT_CENTER, 60, 2); InsertColumn(3, "Points", LVCFMT_CENTER, 45, 3); InsertColumn(4, "Map Creator", LVCFMT_LEFT, 120, 4); //set the full row selection SetExtendedStyle(LVS_EX_FULLROWSELECT); //read the maps loadMaps(); }
Game::Game() : mState(State::Waiting) { loadMaps(); }
// main method int main(int argc, char** argv) { if (argc < 3) { std::cout << "Usage: MapMerger <filename_1> <filename_2>\n"; exit(1); } std::cout << "----------MapsMerger---------\n"; // load maps std::vector<Eigen::Vector3d> map1; std::vector<Eigen::Vector3d> map2; if (!loadMaps(argv[1], argv[2], &map1, &map2)) { std::cout << "problems loading the map files\nExiting...\n"; exit(1); } // std::cout << "Map1:\n"; // for(unsigned int i=0; i<map1.size(); i++){ // std::cout << map1[i][0] << " " << map1[i][1] << "\n"; // } std::cout << "Maps loaded\n"; double distance_threshold = computeDistanceTrigger(&map1, &map2); std::cout << "distance threshold computed: " << distance_threshold << "\n"; std::vector<Eigen::Vector3d> totalmap; Eigen::Matrix3d transformation; unsigned int offset_index = mergemaps(&map1, &map2, &totalmap, &transformation, distance_threshold); std::cout << "resulting POIs are in:\n"; for (unsigned int i = 0; i < totalmap.size(); i++) { std::cout << totalmap[i][0] << " " << totalmap[i][1] << "\n"; } // show images cvStartWindowThread(); const char * map1_window_name = "MAP1"; const char * map2_window_name = "MAP2"; const char * totalmap_window_name = "TOTALMAP"; const char * associations_window_name = "ASSOCIATIONS"; cv::namedWindow(map1_window_name, CV_WINDOW_NORMAL); cv::namedWindow(map2_window_name, CV_WINDOW_NORMAL); cv::namedWindow(totalmap_window_name, CV_WINDOW_NORMAL); cv::namedWindow(associations_window_name, CV_WINDOW_NORMAL); cv::Mat * map1_image = drawPOI(&map1); cv::Mat * map2_image = drawPOI(&map2); cv::Mat * totalmap_image = drawPOI(&totalmap); cv::Mat * associations_image = createAssociationsImage(map1_image, map2_image, &map1, &map2, &transformation, distance_threshold, offset_index); cv::imshow(map1_window_name, *map1_image); cv::imshow(map2_window_name, *map2_image); cv::imshow(totalmap_window_name, *totalmap_image); cv::imshow(associations_window_name, *associations_image); std::cout << "Displaying results, press ESC or Q to quit"; int button = cvWaitKey(0); while((button!=27) && ((char)button!='q')){ button = cvWaitKey(0); } // delete transformation; // delete map1_image; // delete map2_image; // delete totalmap_image; // delete associations_image; exit(0); }
void wikiPlot() /* wikiPlot - Quick plots of maps vs. each other. */ { boolean gotDir = cgiVarExists("contigDir"); double step; contigDir = cgiUsualString("contigDir", contigDir); mapX = cgiUsualString("mapX", mapX); mapY = cgiUsualString("mapY", mapY); pix = cgiUsualInt("pix", pix); xOff = cgiUsualDouble("xOff", xOff); yOff = cgiUsualDouble("yOff", yOff); zoom = cgiUsualDouble("zoom", zoom); step = 0.1 * 1/zoom; if (cgiVarExists("boxOut")) { double invZoom = 1.0/zoom; double xCen = xOff + invZoom*0.5; double yCen = yOff + invZoom*0.5; zoom /= 2; invZoom = 1.0/zoom; xOff = xCen - invZoom*0.5; yOff = yCen - invZoom*0.5; } else if (cgiVarExists("boxUp")) yOff -= step; else if (cgiVarExists("boxDown")) yOff += step; else if (cgiVarExists("boxLeft")) xOff -= step; else if (cgiVarExists("boxRight")) xOff += step; else if (cgiVarExists("boxUpLeft")) { yOff -= step; xOff -= step; } else if (cgiVarExists("boxUpRight")) { yOff -= step; xOff += step; } else if (cgiVarExists("boxDownLeft")) { yOff += step; xOff -= step; } else if (cgiVarExists("boxDownRight")) { yOff += step; xOff += step; } else if (cgiVarExists("unzoom")) { xOff = yOff = -0.05; zoom = 0.9; } printf("<FORM ACTION=\"../cgi-bin/wikiPlot\" METHOD=\"GET\">\n"); printf("<TABLE BORDER=0 WIDTH=\"100%%\">\n"); printf("<TR>\n"); printf("<TD WIDTH=\"78%%\">\n"); printf("<B>Wiki Plotter</B><BR>\n"); printf("<B>Contig: </B>"); cgiMakeTextVar("contigDir", contigDir, 0); if (gotDir) { cgiMakeButton("refresh", "refresh"); } else cgiMakeButton("submit", "submit"); printf("<BR>\n"); printf("<B>Map X: </B>"); cgiMakeTextVar("mapX", mapX, 12); printf("<B>Map Y: </B>"); cgiMakeTextVar("mapY", mapY, 12); printf("<B>Pixels: </B>"); cgiMakeIntVar("pix", pix, 4); printf("</TD>\n"); printf("<TD WIDTH=\"22%%\">\n"); if (gotDir) printBox(); printf("</TD>\n"); printf("</TR>\n"); printf("</TABLE>\n"); if (gotDir) { char xFile[512], yFile[512]; struct hash *xHash = NULL, *yHash = NULL; struct clonePos *xList = NULL, *yList = NULL; sprintf(xFile, "%s/%s", contigDir, mapX); sprintf(yFile, "%s/%s", contigDir, mapY); loadMaps(xFile, yFile, &xList, &yList, &xHash, &yHash); makePlot(xList, yList, yHash); } /* Save hidden vars. */ { char buf[256]; sprintf(buf, "%f", zoom); cgiMakeHiddenVar("zoom", buf); sprintf(buf, "%f", xOff); cgiMakeHiddenVar("xOff", buf); sprintf(buf, "%f", yOff); cgiMakeHiddenVar("yOff", buf); } printf("</FORM>\n"); }
void IMapManager::init () { loadMaps(); Commands.registerCommand(CMD_LIST_MAPS, bindFunction(IMapManager, listMaps)); }