// 將分割後的檔案內容,針對Component跟Connection做加入 void ERModel::recoveryAllComponent( vector<string> componentsSet, vector<string> connectionsSet ) { vector<string> componentData; vector<pair<int, int>> positionSet = loadPosition(); int connectionSetCount = 0; int positionSetCount = 0; for(int i = 0; i < componentsSet.size(); i++) { componentData = Toolkit::splitFunction(componentsSet[i], TEXT_COMMASPACE); if ( componentData[PARAMETER_TYPE] == PARAMETER_CONNECTOR && componentData.size() > PARAMETER_HAVETYPEANDTEXT ) // Connector有Cardinality connectionSetCount = recoveryConnection(connectionsSet, connectionSetCount, componentData[1]); else if ( componentData[PARAMETER_TYPE] == PARAMETER_CONNECTOR ) // Connector沒有Cardinality connectionSetCount = recoveryConnection(connectionsSet, connectionSetCount, PARAMETER_NULL); else // Component是Attribute, Entity或Relationship其中一種 { if (positionSet.size() > 0) { addNode(componentData[PARAMETER_TYPE],componentData[PARAMETER_TEXT], positionSet[positionSetCount].first, positionSet[positionSetCount].second); positionSetCount++; } else addNode(componentData[PARAMETER_TYPE],componentData[PARAMETER_TEXT], PARAMETER_TEXTUI_COORDINATES, PARAMETER_TEXTUI_COORDINATES); } } }
void Dialog::scanFolderPosition(const QDir &dir) { if(!dir.exists()) return; QFileInfoList list = dir.entryInfoList(QDir::AllEntries|QDir::NoDotAndDotDot|QDir::Hidden|QDir::System,QDir::DirsFirst); for (int i = 0; i < list.size(); ++i) { QFileInfo fileInfo(list.at(i)); if(!fileInfo.isDir()) { if(fileInfo.fileName().endsWith(".tmx")) loadPosition(dir.absolutePath()+'/'+fileInfo.fileName()); } else { //return the fonction for scan the new folder scanFolderPosition(dir.absolutePath()+'/'+fileInfo.fileName()+'/'); } } }
void HardwareEstimatorOdo::preloadTask(void) { try { jblas::vec row(7); Position pos1; while (true) { boost::unique_lock<boost::mutex> l(mutex_data, boost::defer_lock_t()); if (mode == 2) { pos1 = loadPosition(index_load_); l.lock(); if (write_position == read_position) cond_offline.notify_all(); while (write_position == read_position) cond_data.wait(l); if (!pos1.m_date) std::cout << " Failed to read position " << std::endl; row(0) = pos1.m_date; row(1) = pos1.m_mainToBase(0); //x row(2) = pos1.m_mainToBase(1); //y row(3) = pos1.m_mainToBase(2); //z row(4) = pos1.m_mainToBase(5); //roll row(5) = pos1.m_mainToBase(4); //pitch row(6) = pos1.m_mainToBase(3); //yaw index_load_++; } else { std::cout << "Read pom poster position: work in progress" << std::endl; } ublas::matrix_row<jblas::mat>(buffer, write_position) = row; // buffer(write_position,0) += timestamps_correction; ++write_position; if (write_position >= bufferSize) write_position = 0; l.unlock(); } } catch (kernel::Exception &e) { std::cout << e.what(); throw e; } }
LaunchyWidget::LaunchyWidget(CommandFlags command) : #ifdef Q_WS_WIN QWidget(NULL, Qt::FramelessWindowHint | Qt::Tool), #endif #ifdef Q_WS_X11 QWidget(NULL, Qt::FramelessWindowHint), #endif #ifdef Q_WS_MAC QWidget(NULL, Qt::FramelessWindowHint), #endif frameGraphic(NULL), trayIcon(NULL), alternatives(NULL), updateTimer(NULL), dropTimer(NULL), condensedTempIcon(NULL) { setObjectName("launchy"); setWindowTitle(tr("Launchy")); #ifdef Q_WS_WIN setWindowIcon(QIcon(":/resources/launchy128.png")); #endif #ifdef Q_WS_MAC setWindowIcon(QIcon("../Resources/launchy_icon_mac.icns")); //setAttribute(Qt::WA_MacAlwaysShowToolWindow); #endif setAttribute(Qt::WA_AlwaysShowToolTips); setAttribute(Qt::WA_InputMethodEnabled); if (platform->supportsAlphaBorder()) { setAttribute(Qt::WA_TranslucentBackground); } setFocusPolicy(Qt::ClickFocus); createActions(); gMainWidget = this; menuOpen = false; optionsOpen = false; dragging = false; gSearchText = ""; alwaysShowLaunchy = false; connect(&iconExtractor, SIGNAL(iconExtracted(int, QIcon)), this, SLOT(iconExtracted(int, QIcon))); fader = new Fader(this); connect(fader, SIGNAL(fadeLevel(double)), this, SLOT(setFadeLevel(double))); optionsButton = new QPushButton(this); optionsButton->setObjectName("opsButton"); optionsButton->setToolTip(tr("Launchy Options")); optionsButton->setGeometry(QRect()); connect(optionsButton, SIGNAL(clicked()), this, SLOT(showOptionsDialog())); closeButton = new QPushButton(this); closeButton->setObjectName("closeButton"); closeButton->setToolTip(tr("Close Launchy")); closeButton->setGeometry(QRect()); connect(closeButton, SIGNAL(clicked()), qApp, SLOT(quit())); output = new QLabel(this); output->setObjectName("output"); output->setAlignment(Qt::AlignHCenter); input = new CharLineEdit(this); #ifdef Q_WS_MAC QMacStyle::setFocusRectPolicy(input, QMacStyle::FocusDisabled); #endif input->setObjectName("input"); connect(input, SIGNAL(keyPressed(QKeyEvent*)), this, SLOT(inputKeyPressEvent(QKeyEvent*))); connect(input, SIGNAL(focusIn(QFocusEvent*)), this, SLOT(focusInEvent(QFocusEvent*))); connect(input, SIGNAL(focusOut(QFocusEvent*)), this, SLOT(focusOutEvent(QFocusEvent*))); connect(input, SIGNAL(inputMethod(QInputMethodEvent*)), this, SLOT(inputMethodEvent(QInputMethodEvent*))); outputIcon = new QLabel(this); outputIcon->setObjectName("outputIcon"); workingAnimation = new AnimationLabel(this); workingAnimation->setObjectName("workingAnimation"); workingAnimation->setGeometry(QRect()); // Load settings settings.load(); // If this is the first time running or a new version, call updateVersion if (gSettings->value("version", 0).toInt() != LAUNCHY_VERSION) { updateVersion(gSettings->value("version", 0).toInt()); command |= ShowLaunchy; } alternatives = new CharListWidget(this); alternatives->setObjectName("alternatives"); alternatives->setWindowFlags(Qt::Window | Qt::Tool | Qt::FramelessWindowHint); alternatives->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); alternatives->setTextElideMode(Qt::ElideLeft); alternatives->setUniformItemSizes(true); listDelegate = new IconDelegate(this); defaultListDelegate = alternatives->itemDelegate(); setSuggestionListMode(gSettings->value("GenOps/condensedView", 0).toInt()); altScroll = alternatives->verticalScrollBar(); altScroll->setObjectName("altScroll"); connect(alternatives, SIGNAL(currentRowChanged(int)), this, SLOT(alternativesRowChanged(int))); connect(alternatives, SIGNAL(keyPressed(QKeyEvent*)), this, SLOT(alternativesKeyPressEvent(QKeyEvent*))); connect(alternatives, SIGNAL(focusOut(QFocusEvent*)), this, SLOT(focusOutEvent(QFocusEvent*))); alternativesPath = new QLabel(alternatives); alternativesPath->setObjectName("alternativesPath"); alternativesPath->hide(); listDelegate->setAlternativesPathWidget(alternativesPath); // Load the plugins plugins.loadPlugins(); // Set the general options if (setAlwaysShow(gSettings->value("GenOps/alwaysshow", false).toBool())) command |= ShowLaunchy; setAlwaysTop(gSettings->value("GenOps/alwaystop", false).toBool()); // Check for udpates? if (gSettings->value("GenOps/updatecheck", true).toBool()) { checkForUpdate(); } // Set the hotkey QKeySequence hotkey = getHotkey(); if (!setHotkey(hotkey)) { QMessageBox::warning(this, tr("Launchy"), tr("The hotkey %1 is already in use, please select another.").arg(hotkey.toString())); command = ShowLaunchy | ShowOptions; } // Set the timers updateTimer = new QTimer(this); dropTimer = new QTimer(this); dropTimer->setSingleShot(true); connect(updateTimer, SIGNAL(timeout()), this, SLOT(updateTimeout())); connect(dropTimer, SIGNAL(timeout()), this, SLOT(dropTimeout())); int time = gSettings->value("GenOps/updatetimer", 10).toInt(); if (time > 0) updateTimer->start(time * 60000); // Load the catalog catalog.reset(CatalogBuilder::createCatalog()); catalog->load(settings.catalogFilename()); // Load the history history.load(settings.historyFilename()); // Load the skin applySkin(gSettings->value("GenOps/skin", "Default").toString()); // Move to saved position loadPosition(gSettings->value("Display/pos", QPoint(0,0)).toPoint()); loadOptions(); executeStartupCommand(command); }
Position HardwareEstimatorOdo::loadPosition(unsigned int index_) const { Position pos; loadPosition(index_, pos); return pos; }
void dispatchFixedMessage(int operation, unsigned long param) { if (VERBOSE) { fprintf(stderr,"Calling base operation %d\n",operation); } confirmCommandToClient(operation, param); /* sends a message back to all * baseClients, confirming the * command, sebastian 7-97 */ switch(operation) { /**** GENERAL ****/ case BASE_baseKill: baseKill(); break; case BASE_loadHeading: loadHeading(param); break; case BASE_loadPosition: loadPosition(param); break; case BASE_statusReportData: statusReportData(param);break; case BASE_statusReportPeriod: statusReportPeriod(param);break; case BASE_batteryVoltage: batteryVoltage();break; case BASE_batteryCurrent: batteryCurrent();break; case BASE_watchdogTimer: watchdogTimer(param);break; case BASE_assumeWatchdog: assumeWatchdog();break; /**** ROTATION ****/ case BASE_rotateLimp: rotateLimp(); break; case BASE_rotateHalt: rotateHalt(); break; case BASE_rotateVelocityPos: rotateVelocityPos(); break; case BASE_rotateVelocityNeg: rotateVelocityNeg(); break; case BASE_rotateRelativePos: rotateRelativePos(param); break; case BASE_rotateRelativeNeg: rotateRelativeNeg(param); break; case BASE_rotateTorquePos: rotateTorquePos(param); break; case BASE_rotateTorqueNeg: rotateTorqueNeg(param); break; case BASE_rotatePowerPos: rotatePowerPos(param); break; case BASE_rotatePowerNeg: rotatePowerNeg(param); break; case BASE_rotateToPosition: rotateToPosition(param); break; case BASE_findRotIndex: if (bRobot.base_hasIndex) { findRotIndex(); } else { sendClientFixed(BASE_indexReport, 0xFFFFFF); } break; case BASE_setRotateVelocity: setRotateVelocity(param); break; case BASE_setRotateAcceleration: setRotateAcceleration(param); break; case BASE_setRotateFriction: setRotateFriction(param); break; case BASE_setRotateSlope: setRotateSlope(param); break; case BASE_setRotateTorque: setRotateTorque(param); break; case BASE_setRotateZero: setRotateZero(param); break; case BASE_rotateCurrent: rotateCurrent(); break; case BASE_rotateWhere: rotateWhere(); break; /**** TRANSLATION ****/ case BASE_translateLimp: translateLimp(); break; case BASE_translateHalt: translateHalt(); break; case BASE_translateVelocityPos: translateVelocityPos(); break; case BASE_translateVelocityNeg: translateVelocityNeg(); break; case BASE_translateRelativePos: translateRelativePos(param); break; case BASE_translateRelativeNeg: translateRelativeNeg(param); break; case BASE_translateTorquePos: translateTorquePos(param); break; case BASE_translateTorqueNeg: translateTorqueNeg(param); break; case BASE_translatePowerPos: translatePowerPos(param); break; case BASE_translatePowerNeg: translatePowerNeg(param); break; case BASE_translateToPosition: translateToPosition(param); break; case BASE_setTranslateVelocity: setTranslateVelocity(param); break; case BASE_setTranslateAcceleration: setTranslateAcceleration(param); break; case BASE_setTranslateSlope: setTranslateSlope(param); break; case BASE_setTranslateTorque: setTranslateTorque(param); break; case BASE_setTranslateZero: setTranslateZero(param); break; case BASE_translateCurrent: translateCurrent(); break; case BASE_translateWhere: translateWhere(); break; /**** SONARS ****/ case BASE_sonarStart: SIM_sonarStart(); break; case BASE_sonarStop: SIM_sonarStop(); break; /**** Odometry stuff ****/ case BASE_odometryChangeX: ntohf(param, bOriginX); sendClientFixed(BASE_odometryChangeX, param); break; case BASE_odometryChangeY: ntohf(param, bOriginY); sendClientFixed(BASE_odometryChangeY, param); break; case BASE_odometryChangeH: ntohf(param, bOriginHeading); sendClientFixed(BASE_odometryChangeH, param); break; /**** Odometry lock requests ****/ case BASE_requestOdometryLock: requestOdometryLock((unsigned short)param); break; case BASE_releaseOdometryLock: releaseOdometryLock(); break; default: fprintf(stderr, "BaseServer: Operation %d not yet implemented.\n", operation); } if (VERBOSE) { fprintf(stderr,"Operation %d complete\n",operation); } }
void ParametersPage::trackingChanged() { loadPosition(); }
void ParametersPage::positionChanged() { loadPosition(); }
void keyboard(uint8_t key, int32_t x, int32_t y) { FILE *file; int32_t base = 10; switch (key) { case 27: // ESC stopThreads(); exit(0); break; case 105: // i maxIterations+=iterDelta; printf("Iterationen: %u\n",maxIterations); restart(); break; case 111: // o maxIterations-=iterDelta; if (maxIterations <= 0) { maxIterations+=iterDelta; } printf("Iterationen: %u\n",maxIterations); restart(); break; case 115: // s printf("Speichere Position\n"); file = fopen("minRe.val", "w"); mpf_out_str(file, base, 0, mandelRange.minRe); fclose(file); file = fopen("maxRe.val", "w"); mpf_out_str(file, base, 0, mandelRange.maxRe); fclose(file); file = fopen("minIm.val", "w"); mpf_out_str(file, base, 0, mandelRange.minIm); fclose(file); file = fopen("iter.val", "wb"); fwrite(&maxIterations, sizeof(maxIterations), 1, file); fclose(file); file = fopen("bits.val", "wb"); fwrite(&gmpBit, sizeof(gmpBit), 1, file); fclose(file); printf("Position gespeichert\n"); break; case 108: // l loadPosition(); restart(); break; case 98: //b gmpBit+=1; printf("Bit: %i\n",gmpBit); setBits(gmpBit); restart(); break; case 99: // c printf("aktuelle Bits: %lu\n",mpf_get_prec(mandelRange.minRe)); break; // case 103: // g // useGMP = useGMP ? 0 : 1; // printf("benutze GMP: %i\n",useGMP); // break; default: printf("%i\n",key); break; } }