void ModelPlotter::loadModels() { App * app = App::getInstance(); if(_xml.loadFile(XML_FILE)) { for(int i = 0; i< app->getPageModelsSize(); i++) { app->removePageModel(i); } //app->models.clear(); if(_xml.pushTag(PAGES, 0)) { for(int i = 0; i < _xml.getNumTags(PAGE); i++) { _xml.pushTag(PAGE, i); Page * page = new Page(); page->id = _idCounter; for(int j = 0; j < _xml.getNumTags(POINT); j++) { float x = (float) _xml.getAttribute(POINT, X, 0, j); float y = (float) _xml.getAttribute(POINT, Y, 0, j); cout << "X: " << x << endl; cout << "Y: " << y << endl; page->pts.push_back(ofxVec2f(x, y)); } _xml.popTag(); app->addPageModel(page); _idCounter++; } _xml.popTag(); } } app->flagPageModelsChanged(); cout << ":::::::::::: Models were loaded ::::::::::::" << endl; }
void ModelPlotter::mousePressed(int xPos, int yPos, int button) { if(_recordMode) { if(!isClickWithinModel(xPos, yPos)) { if (_selectedModel == DISABLED) { App * app = App::getInstance(); Page * model = new Page(); model->addDefaultPoints(xPos, yPos); model->id = _idCounter; app->addPageModel(model); _idCounter++; } else { _selectedModel = DISABLED; } } } }