bool ossimBandSelector::loadState(const ossimKeywordlist& kwl, const char* prefix) { ossimImageSourceFilter::loadState(kwl, prefix); // call ossimSource method to delete the list of objects theOutputBandList.clear(); ossimString copyPrefix = prefix; ossimString regExpression = ossimString("^(") + copyPrefix + "band[0-9]+)"; vector<ossimString> keys = kwl.getSubstringKeyList( regExpression ); long numberOfBands = (long)keys.size(); ossim_uint32 offset = (ossim_uint32)(copyPrefix+"band").size(); std::vector<int>::size_type idx = 0; std::vector<int> numberList(numberOfBands); for(idx = 0; idx < keys.size();++idx) { ossimString numberStr(keys[idx].begin() + offset, keys[idx].end()); numberList[idx] = numberStr.toInt(); } std::sort(numberList.begin(), numberList.end()); for(idx=0;idx < numberList.size();++idx) { const char* bandValue = kwl.find(copyPrefix, ("band"+ossimString::toString(numberList[idx])).c_str()); theOutputBandList.push_back( ossimString(bandValue).toLong()-1); } initialize(); return true; }
bool rspfGeoPolyCutter::loadState(const rspfKeywordlist& kwl, const char* prefix) { rspfString copyPrefix(prefix); rspfString polygons = rspfString("^(") + copyPrefix + "geo_polygon[0-9]+.)"; vector<rspfString> keys = kwl.getSubstringKeyList( polygons ); int offset = (int)(copyPrefix+"geo_polygon").size(); std::vector<int> numberList(keys.size()); for(int idx = 0; idx < (int)numberList.size();++idx) { rspfString numberStr(keys[idx].begin() + offset, keys[idx].end()); numberList[idx] = numberStr.toInt(); } std::sort(numberList.begin(), numberList.end()); rspfString newPrefix; thePolygonList.clear(); for(int i = 0; i < (int)numberList.size();++i) { theGeoPolygonList.push_back(rspfGeoPolygon()); newPrefix = copyPrefix+"geo_polygon"+rspfString::toString(numberList[i])+"."; theGeoPolygonList[i].loadState(kwl, newPrefix.c_str()); } const char* lookup = kwl.find(prefix, "cut_type"); if(lookup) { theCutType = RSPF_POLY_NULL_INSIDE; rspfString test = lookup; if(test == "null_outside") { theCutType = RSPF_POLY_NULL_OUTSIDE; } } else { theCutType = RSPF_POLY_NULL_OUTSIDE; } rspfString viewPrefix = prefix; viewPrefix += "view."; theViewProjection = new rspfImageGeometry(); if(theViewProjection->loadState(kwl, viewPrefix)) { transformVertices(); } return rspfImageSourceFilter::loadState(kwl, prefix); }
std::unique_ptr<SVGAnimatedType> SVGAnimatedNumberListAnimator::constructFromString(const String& string) { auto animatedType = SVGAnimatedType::createNumberList(std::make_unique<SVGNumberList>()); animatedType->numberList().parse(string); return animatedType; }
bool rspfApplanixEcefModel::loadState(const rspfKeywordlist& kwl, const char* prefix) { if(traceDebug()) { std::cout << "rspfApplanixEcefModel::loadState: ......... entered" << std::endl; } theImageClipRect = rspfDrect(0,0,4076,4091); theRefImgPt = rspfDpt(2046.0, 2038.5); rspfSensorModel::loadState(kwl, prefix); if(getNumberOfAdjustableParameters() < 1) { initAdjustableParameters(); } theEcefPlatformPosition = rspfGpt(0.0,0.0,1000.0); theAdjEcefPlatformPosition = rspfGpt(0.0,0.0,1000.0); theRoll = 0.0; thePitch = 0.0; theHeading = 0.0; // bool computeGsdFlag = false; const char* roll = kwl.find(prefix, "roll"); const char* pitch = kwl.find(prefix, "pitch"); const char* heading = kwl.find(prefix, "heading"); const char* principal_point = kwl.find(prefix, "principal_point"); const char* pixel_size = kwl.find(prefix, "pixel_size"); const char* focal_length = kwl.find(prefix, "focal_length"); const char* ecef_platform_position = kwl.find(prefix, "ecef_platform_position"); const char* latlonh_platform_position = kwl.find(prefix, "latlonh_platform_position"); const char* compute_gsd_flag = kwl.find(prefix, "compute_gsd_flag"); const char* eo_file = kwl.find(prefix, "eo_file"); const char* camera_file = kwl.find(prefix, "camera_file"); const char* eo_id = kwl.find(prefix, "eo_id"); bool result = true; if(eo_id) { theImageID = eo_id; } if(eo_file) { rspfApplanixEOFile eoFile; if(eoFile.parseFile(rspfFilename(eo_file))) { rspfRefPtr<rspfApplanixEORecord> record = eoFile.getRecordGivenId(theImageID); if(record.valid()) { rspf_int32 rollIdx = eoFile.getFieldIdx("ROLL"); rspf_int32 pitchIdx = eoFile.getFieldIdx("PITCH"); rspf_int32 headingIdx = eoFile.getFieldIdx("HEADING"); rspf_int32 xIdx = eoFile.getFieldIdx("X"); rspf_int32 yIdx = eoFile.getFieldIdx("Y"); rspf_int32 zIdx = eoFile.getFieldIdx("Z"); if((rollIdx >= 0)&& (pitchIdx >= 0)&& (headingIdx >= 0)&& (xIdx >= 0)&& (yIdx >= 0)&& (zIdx >= 0)) { theRoll = (*record)[rollIdx].toDouble(); thePitch = (*record)[pitchIdx].toDouble(); theHeading = (*record)[headingIdx].toDouble(); theEcefPlatformPosition = rspfEcefPoint((*record)[xIdx].toDouble(), (*record)[yIdx].toDouble(), (*record)[zIdx].toDouble()); theAdjEcefPlatformPosition = theEcefPlatformPosition; } else { return false; } } else { rspfNotify(rspfNotifyLevel_WARN) << "rspfApplanixEcefModel::loadState() Image id " << theImageID << " not found in eo file " << eo_file << std::endl; return false; } } else { return false; } // computeGsdFlag = true; } else { if(roll) { theRoll = rspfString(roll).toDouble(); } if(pitch) { thePitch = rspfString(pitch).toDouble(); } if(heading) { theHeading = rspfString(heading).toDouble(); } if(ecef_platform_position) { std::vector<rspfString> splitString; rspfString tempString(ecef_platform_position); tempString.split(splitString, rspfString(" ")); if(splitString.size() > 2) { theEcefPlatformPosition = rspfEcefPoint(splitString[0].toDouble(), splitString[1].toDouble(), splitString[2].toDouble()); } } else if(latlonh_platform_position) { std::vector<rspfString> splitString; rspfString tempString(latlonh_platform_position); tempString.split(splitString, rspfString(" ")); std::string datumString; double lat=0.0, lon=0.0, h=0.0; if(splitString.size() > 2) { lat = splitString[0].toDouble(); lon = splitString[1].toDouble(); h = splitString[2].toDouble(); } theEcefPlatformPosition = rspfGpt(lat,lon,h); } } if(camera_file) { rspfKeywordlist cameraKwl; rspfKeywordlist lensKwl; cameraKwl.add(camera_file); const char* sensor = cameraKwl.find("sensor"); const char* image_size = cameraKwl.find(prefix, "image_size"); principal_point = cameraKwl.find("principal_point"); focal_length = cameraKwl.find("focal_length"); pixel_size = cameraKwl.find(prefix, "pixel_size"); focal_length = cameraKwl.find(prefix, "focal_length"); const char* distortion_units = cameraKwl.find(prefix, "distortion_units"); rspfUnitConversionTool tool; rspfUnitType unitType = RSPF_MILLIMETERS; if(distortion_units) { unitType = (rspfUnitType)rspfUnitTypeLut::instance()->getEntryNumber(distortion_units); if(unitType == RSPF_UNIT_UNKNOWN) { unitType = RSPF_MILLIMETERS; } } if(image_size) { std::vector<rspfString> splitString; rspfString tempString(image_size); tempString.split(splitString, rspfString(" ")); double w=1, h=1; if(splitString.size() == 2) { w = splitString[0].toDouble(); h = splitString[1].toDouble(); } theImageClipRect = rspfDrect(0,0,w-1,h-1); theRefImgPt = rspfDpt(w/2.0, h/2.0); } if(sensor) { theSensorID = sensor; } if(principal_point) { std::vector<rspfString> splitString; rspfString tempString(principal_point); tempString.split(splitString, rspfString(" ")); if(splitString.size() == 2) { thePrincipalPoint.x = splitString[0].toDouble(); thePrincipalPoint.y = splitString[1].toDouble(); } } if(pixel_size) { std::vector<rspfString> splitString; rspfString tempString(pixel_size); tempString.split(splitString, rspfString(" ")); if(splitString.size() == 1) { thePixelSize.x = splitString[0].toDouble(); thePixelSize.y = thePixelSize.x; } else if(splitString.size() == 2) { thePixelSize.x = splitString[0].toDouble(); thePixelSize.y = splitString[1].toDouble(); } } if(focal_length) { theFocalLength = rspfString(focal_length).toDouble(); } cameraKwl.trimAllValues(); rspfString regExpression = rspfString("^(") + "d[0-9]+)"; vector<rspfString> keys; cameraKwl.getSubstringKeyList( keys, regExpression ); long numberOfDistortions = (long)keys.size(); int offset = (int)rspfString("d").size(); rspf_uint32 idx = 0; std::vector<int> numberList(numberOfDistortions); for(idx = 0; idx < (int)numberList.size();++idx) { rspfString numberStr(keys[idx].begin() + offset, keys[idx].end()); numberList[idx] = numberStr.toInt(); } std::sort(numberList.begin(), numberList.end()); double distance=0.0, distortion=0.0; for(idx = 0; idx < numberList.size(); ++idx) { rspfString value = cameraKwl.find(rspfString("d")+rspfString::toString(numberList[idx])); if(!value.empty()) { std::istringstream inStr(value.c_str()); inStr >> distance; rspf::skipws(inStr); inStr >> distortion; #if 0 std::vector<rspfString> splitString; rspfString tempString(value); tempString = tempString.trim(); tempString.split(splitString, " "); std::cout << splitString.size() << std::endl; if(splitString.size() >= 2) { distance = splitString[0].toDouble(); distortion = splitString[1].toDouble(); } #endif tool.setValue(distortion, unitType); lensKwl.add(rspfString("distance") + rspfString::toString(idx), distance, true); lensKwl.add(rspfString("distortion") + rspfString::toString(idx), tool.getMillimeters(), true); } lensKwl.add("convergence_threshold", .00001, true); if(pixel_size) { lensKwl.add("dxdy", rspfString(pixel_size) + " " + rspfString(pixel_size), true); } else { lensKwl.add("dxdy", ".009 .009", true); } } if(theLensDistortion.valid()) { theLensDistortion->loadState(lensKwl,""); } }
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { // open database connection db = QSqlDatabase::addDatabase("QSQLITE"); db.setDatabaseName("/Users/jdoud/dev/brainstorm.sqlite"); if(!db.open()) { qDebug() << db.lastError(); qFatal("Failed to connect."); } // setup UI ui->setupUi(this); ui->toolBar->addWidget(ui->comboFonts); ui->toolBar->addWidget(ui->comboFontSizes); ui->toolBar->addWidget(ui->comboColors); // set text editor defaults ui->textNote->document()->setIndentWidth(20); ui->textNote->setTabStopWidth(20); ui->textNote->setTabChangesFocus(false); ui->actionIncrease_Indent->setShortcut(Qt::Key_Tab); ui->actionDecrease_Indent->setShortcut(Qt::Key_Backtab); // setup comboColors QPixmap pix(16, 16); pix.fill(Qt::white); ui->comboColors->addItem(pix, ""); pix.fill(Qt::black); ui->comboColors->addItem(pix, ""); pix.fill(Qt::red); ui->comboColors->addItem(pix, ""); pix.fill(Qt::blue); ui->comboColors->addItem(pix, ""); pix.fill(Qt::darkGreen); ui->comboColors->addItem(pix, ""); pix.fill(Qt::gray); ui->comboColors->addItem(pix, ""); // create system tray icon createActions(); createTrayIcon(); // create models categoriesModel = new QSqlTableModel(); categoriesModel->setTable("categories"); categoriesModel->setSort(1, Qt::AscendingOrder); categoriesModel->select(); ui->listCategories->setModel(categoriesModel); ui->listCategories->setModelColumn(1); notesModel = new QSqlTableModel(); notesModel->setTable("notes"); ui->listNotes->setModel(notesModel); ui->listNotes->setModelColumn(2); // set splitter size QList<int> sizes; sizes << 230 << 150; ui->splitterLists->setSizes(sizes); sizes.clear(); sizes << 230 << 600; ui->splitterNote->setSizes(sizes); // connect File menu slots connect(ui->actionNew_Category, SIGNAL(triggered()), this, SLOT(newCategory())); connect(ui->actionRename_Category, SIGNAL(triggered()), this, SLOT(renameCategory())); connect(ui->actionDelete_Category, SIGNAL(triggered()), this, SLOT(deleteCategory())); connect(ui->actionNew_Note, SIGNAL(triggered()), this, SLOT(newNote())); connect(ui->actionRename_Note, SIGNAL(triggered()), this, SLOT(renameNote())); connect(ui->actionSave_Note, SIGNAL(triggered()), this, SLOT(saveNote())); connect(ui->actionDelete_Note, SIGNAL(triggered()), this, SLOT(deleteNote())); connect(ui->actionQuit, SIGNAL(triggered()), this, SLOT(quit())); // connect Edit menu slots connect(ui->actionFind_Replace, SIGNAL(triggered()), this, SLOT(findAndReplace())); // connect Format menu slots connect(ui->actionBold, SIGNAL(triggered()), this, SLOT(bold())); connect(ui->actionItalic, SIGNAL(triggered()), this, SLOT(italic())); connect(ui->actionUnderline, SIGNAL(triggered()), this, SLOT(underline())); connect(ui->actionStrikethrough, SIGNAL(triggered()), this, SLOT(strikethrough())); connect(ui->actionBullet_List, SIGNAL(triggered()), this, SLOT(bulletList())); connect(ui->actionNumber_List, SIGNAL(triggered()), this, SLOT(numberList())); connect(ui->actionIncrease_Indent, SIGNAL(triggered()), this, SLOT(increaseIndent())); connect(ui->actionDecrease_Indent, SIGNAL(triggered()), this, SLOT(decreaseIndent())); connect(ui->actionShow_Colors, SIGNAL(triggered()), this, SLOT(showColors())); connect(ui->actionShow_Fonts, SIGNAL(triggered()), this, SLOT(showFonts())); connect(ui->actionIncrease_Font, SIGNAL(triggered()), this, SLOT(increaseFont())); connect(ui->actionDecrease_Font, SIGNAL(triggered()), this, SLOT(decreaseFont())); connect(ui->actionReset_Font, SIGNAL(triggered()), this, SLOT(resetFont())); connect(ui->actionAlign_Left, SIGNAL(triggered()), this, SLOT(alignLeft())); connect(ui->actionAlign_Center, SIGNAL(triggered()), this, SLOT(alignCenter())); connect(ui->actionAlign_Right, SIGNAL(triggered()), this, SLOT(alignRight())); connect(ui->actionAlign_Justify, SIGNAL(triggered()), this, SLOT(alignJustify())); // connect View menu slots connect(ui->actionHide_Window, SIGNAL(triggered()), this, SLOT(hide())); connect(ui->actionPrevious_Category, SIGNAL(triggered()), this, SLOT(previousCategory())); connect(ui->actionNext_Category, SIGNAL(triggered()), this, SLOT(nextCategory())); connect(ui->actionPrevious_Note, SIGNAL(triggered()), this, SLOT(previousNote())); connect(ui->actionNext_Note, SIGNAL(triggered()), this, SLOT(nextNote())); // connect Help menu slots connect(ui->actionAbout_Brainstorm, SIGNAL(triggered()), this, SLOT(aboutBrainstorm())); connect(ui->actionAbout_Qt, SIGNAL(triggered()), this, SLOT(aboutQt())); // connect application slots connect(ui->textNote, SIGNAL(cursorPositionChanged()), this, SLOT(updateMenus())); connect(ui->textNote, SIGNAL(currentCharFormatChanged(QTextCharFormat)), this, SLOT(updateMenus())); connect(ui->comboFonts, SIGNAL(activated(QString)), this, SLOT(setFont(QString))); connect(ui->comboFontSizes, SIGNAL(activated(QString)), this, SLOT(setFontSize(QString))); connect(ui->comboColors, SIGNAL(activated(int)), this, SLOT(setFontColor(int))); // connect category list slots connect(ui->listCategories->selectionModel(), SIGNAL(currentChanged(QModelIndex,QModelIndex)), this, SLOT(updateNoteList(QModelIndex))); // connect note list slots connect(ui->listNotes->selectionModel(), SIGNAL(currentChanged(QModelIndex,QModelIndex)), this, SLOT(updateNoteText(QModelIndex))); // connect text slots ui->textNote->installEventFilter((this)); // connect system tray icon connect(trayIcon, SIGNAL(activated(QSystemTrayIcon::ActivationReason)), this, SLOT(iconActivated(QSystemTrayIcon::ActivationReason))); // initialize default data ui->listCategories->selectionModel()->setCurrentIndex(categoriesModel->index(0, 1), QItemSelectionModel::SelectCurrent); }