int PID::goToDestination(Location& _currentLocation) { if (!updateLocation()) { for(int i = 0 ; i <= 1000 ; i++) { usleep(1000); if (updateLocation()) { break; } else { if(i == 1000) { tx->halt(); return 0; } } } } updateRatios(); int controlIndices[] = {2, 3, 0}; int index; control_vals[2] = ratios.X * trim[2]; control_vals[3] = ratios.Y * trim[3]; control_vals[0] = ratios.Z * STARTPOW; for (int i = 0 ; i < 3 ; i++) { index = controlIndices[i]; if (control_vals[index] > 250) control_vals[index] = 250; if (control_vals[index] <= 5) control_vals[index] = 5; } if(control_vals[THROTTLE - 1] > MAXTHROTTLE) { std::cout << "Throttle: " << control_vals[THROTTLE] << std::endl; control_vals[THROTTLE - 1] = MAXTHROTTLE; } std::cout << time_diff << "ms :: " << "[" << control_vals[AILERON - 1] << ", " << control_vals[ELEVATOR - 1] << ", " << control_vals[THROTTLE - 1] << "] :: (" << location.X << ", " << location.Y << ", " << location.Z << ")" << std::endl; tx->setValues(control_vals); _currentLocation.setValues(location.X, location.Y, location.Z); return 1; }
bool Weather::processLocationInfo(double latitude, double longitude, double elevation) { // Do not update if not necessary if (latitude == LocationN[LOCATION_LATITUDE].value && longitude == LocationN[LOCATION_LONGITUDE].value && elevation == LocationN[LOCATION_ELEVATION].value) { LocationNP.s = IPS_OK; IDSetNumber(&LocationNP, nullptr); } if (updateLocation(latitude, longitude, elevation)) { LocationNP.s = IPS_OK; LocationN[LOCATION_LATITUDE].value = latitude; LocationN[LOCATION_LONGITUDE].value = longitude; LocationN[LOCATION_ELEVATION].value = elevation; // Update client display IDSetNumber(&LocationNP, nullptr); return true; } else { LocationNP.s = IPS_ALERT; // Update client display IDSetNumber(&LocationNP, nullptr); return false; } }
//If it's a new layer then we return true and we update the location bool isNewLayer(std::istringstream &iss, vector3D *currentLoc) { bool isNewLayer = false; std::string s; iss >> s; if (s == "G1") { float oldZ = currentLoc->z; updateLocation(iss, currentLoc); bool layerChange = fabs(currentLoc->z - oldZ) > .09 && fabs(currentLoc->z - oldZ) < 100.0; // NSLog(@"%f", ABS(currentLocation.z - oldZ)); //std::cout << abs(currentLoc.z - oldZ); if(layerChange) { // NSLog(@"New layer created at z = %f", currentLocation.z); //std::cout << "New Layer created at = " << currentLoc.z; isNewLayer = true; } } // Reset scan of line return isNewLayer; }
MainWindow::MainWindow(const QUrl& url) { QNetworkProxyFactory::setUseSystemConfiguration(true); view = new QWebView(this); connect(view, SIGNAL(linkClicked()), SLOT(updateLocation())); locationEdit = new QLineEdit(this); locationEdit->setText(url.toString()); locationEdit->setSizePolicy(QSizePolicy::Expanding, locationEdit->sizePolicy().verticalPolicy()); connect(locationEdit, SIGNAL(returnPressed()), SLOT(changeLocation())); QToolBar *toolBar = addToolBar(tr("Navigation")); toolBar->addAction(view->pageAction(QWebPage::Back)); toolBar->addAction(view->pageAction(QWebPage::Forward)); toolBar->addAction(view->pageAction(QWebPage::Reload)); toolBar->addAction(view->pageAction(QWebPage::Stop)); toolBar->addWidget(locationEdit); showFullScreen(); setCentralWidget(view); setUnifiedTitleAndToolBarOnMac(true); changeLocation(); }
bool ClientCursor::prepareToYield( YieldData &data ) { if ( ! _c->supportYields() ) return false; // need to store in case 'this' gets deleted data._id = _cursorid; data._doingDeletes = _doingDeletes; _doingDeletes = false; updateLocation(); { /* a quick test that our temprelease is safe. todo: make a YieldingCursor class and then make the following code part of a unit test. */ const int test = 0; static bool inEmpty = false; if( test && !inEmpty ) { inEmpty = true; log() << "TEST: manipulate collection during cc:yield" << endl; if( test == 1 ) Helpers::emptyCollection(_ns.c_str()); else if( test == 2 ) { BSONObjBuilder b; string m; dropCollection(_ns.c_str(), m, b); } else { dropDatabase(_ns.c_str()); } } } return true; }
void LH_CursorController::loadPersistedSelection() { if (!setup_persistent_->value()) return; if (setup_persistent_file_->value().isFile()) { QFile persistFile ( setup_persistent_file_->value().absoluteFilePath() ); persistFile.open(QIODevice::ReadOnly); QString selString = QString(persistFile.readAll()); persistFile.close(); QStringList selData = selString.split(','); if (selData.count()>=5) { updateLocation(selData[0].toInt(), selData[1].toInt(), true); cursor_data_.lastSelSet = true; cursor_data_.lastSelX = cursor_data_.x; cursor_data_.lastSelY = cursor_data_.y; cursor_data_.lastSelX2 = cursor_data_.x; cursor_data_.lastSelY2 = cursor_data_.y; if(setup_persistent_autoselect_->value()) { cursor_data_.selState = (selData[2] == "1"); cursor_data_.selX = selData[3].toInt(); cursor_data_.selY = selData[4].toInt(); } } } }
void ProxyEntity::validated(ProxyObjectPtr ptr) { mDestroyTimer->cancel(); // Because this could be a new ProxyEntity, created after a bunch // of updates have been received by the ProxyObject, we need to // refresh its important data updateLocation( mProxy, mProxy->getTimedMotionVector(), mProxy->getTimedMotionQuaternion(), mProxy->getBounds(),SpaceObjectReference::null() ); }
void LH_CursorController::doReselect(QString key,int flags,int value) { if( cursor_data_.active ) { updateLocation(cursor_data_.lastSelX, cursor_data_.lastSelY, true); doSelect(key,flags,value); } }
void LH_CursorController::doMoveRight(QString key,int flags,int value) { Q_UNUSED(key); Q_UNUSED(flags); Q_UNUSED(value); if( cursor_data_.active ) { updateLocation(1,0); } }
void DiscoverabilityManager::setDiscoverabilityMode(Discoverability::Mode discoverabilityMode) { if (static_cast<Discoverability::Mode>(_mode.get()) != discoverabilityMode) { // update the setting to the new value _mode.set(static_cast<int>(discoverabilityMode)); updateLocation(); // update right away emit discoverabilityModeChanged(discoverabilityMode); } }
bool ClientCursor::prepareToYield( YieldData &data ) { if (!_c->supportYields()) { return false; } // need to store in case 'this' gets deleted data._id = _cursorid; data._doingDeletes = _doingDeletes; _doingDeletes = false; updateLocation(); return true; }
void LH_CursorController::changeCursorData() { if(!updating_link_data_) { cursor_data_.active = setup_cursor_active_->value(); cursor_data_.selX = setup_cursor_sel_x_->value(); cursor_data_.selY = setup_cursor_sel_y_->value(); cursor_data_.x = setup_cursor_x_->value(); cursor_data_.y = setup_cursor_y_->value(); updateLocation(0,0); } }
GpsLocation::GpsLocation(QObject *parent) : QObject(parent), Location("0", "0", "GPS", "GPS"), m_gps(QGeoPositionInfoSource::createDefaultSource(this)), m_active(false), latitude(0), longitude(0) { m_valid = false; m_gps->setUpdateInterval(20000); connect(m_gps, SIGNAL(positionUpdated(QGeoPositionInfo)), this, SLOT(updateLocation(QGeoPositionInfo))); connect(m_gps, SIGNAL(updateTimeout()), this, SLOT(timeout())); }
bool ClientCursor::yield( int micros ) { // need to store on the stack in case this gets deleted CursorId id = cursorid; bool doingDeletes = _doingDeletes; _doingDeletes = false; updateLocation(); { /* a quick test that our temprelease is safe. todo: make a YieldingCursor class and then make the following code part of a unit test. */ const int test = 0; static bool inEmpty = false; if( test && !inEmpty ) { inEmpty = true; log() << "TEST: manipulate collection during cc:yield" << endl; if( test == 1 ) Helpers::emptyCollection(ns.c_str()); else if( test == 2 ) { BSONObjBuilder b; string m; dropCollection(ns.c_str(), m, b); } else { dropDatabase(ns.c_str()); } } } { dbtempreleasecond unlock; if ( unlock.unlocked() ){ if ( micros == -1 ) micros = Client::recommendedYieldMicros(); if ( micros > 0 ) sleepmicros( micros ); } else { log( LL_WARNING ) << "ClientCursor::yield can't unlock b/c of recursive lock" << endl; } } if ( ClientCursor::find( id , false ) == 0 ){ // i was deleted return false; } _doingDeletes = doingDeletes; return true; }
void LH_CursorController::processPostback() { QString key = setup_link_json_data_->link().remove(QRegExp("^(@|=)")); //qDebug() << "INCOMING Postback:" << key; if(postback_data.contains(key)) { //qDebug() << "CURSOR POSTBACK: " << cursor_data_.deserialize(postback_data.value(key)); postback_data.remove(key); if(cursor_data_.sendSelect) doSelect("",0,0); updateLocation(0,0); //setup_coordinate_->setValue(QString("%1,%2").arg(cursor_data_.x).arg(cursor_data_.y)); } }
void LH_CursorController::doActivate(QString key,int flags,int value) { Q_UNUSED(key); Q_UNUSED(flags); Q_UNUSED(value); if(setup_mode_->value()==-1) return; if( cursorModes[setup_mode_->value()].activate ) { cursor_data_.active = !cursor_data_.active; updateLocation(0,0); } }
void QmlCommerce::replaceContentSet(const QString& itemHref, const QString& certificateID) { if (!certificateID.isEmpty()) { auto ledger = DependencyManager::get<Ledger>(); ledger->updateLocation( certificateID, DependencyManager::get<AddressManager>()->getPlaceName(), true); } qApp->replaceDomainContent(itemHref); QJsonObject messageProperties = { { "status", "SuccessfulRequestToReplaceContent" }, { "content_set_url", itemHref } }; UserActivityLogger::getInstance().logAction("replace_domain_content", messageProperties); emit contentSetChanged(itemHref); }
void LH_CursorController::changeMode() { if(setup_mode_->value()==-1) return; if(cursorModes[setup_mode_->value()].select!=smSelectDeselect) { cursor_data_.selX = cursor_data_.x; cursor_data_.selY = cursor_data_.y; cursor_data_.selState = true; } cursor_data_.active = !cursorModes[setup_mode_->value()].activate; setup_select_->setFlag(LH_FLAG_HIDDEN, cursorModes[setup_mode_->value()].select==smNone); setup_reselect_->setFlag(LH_FLAG_HIDDEN, cursorModes[setup_mode_->value()].select!=smSelectDeselect); setup_activate_->setFlag(LH_FLAG_HIDDEN, !cursorModes[setup_mode_->value()].activate); updateLocation(0,0); }
void DiscoverabilityManager::setDiscoverabilityMode(Discoverability::Mode discoverabilityMode) { if (static_cast<Discoverability::Mode>(_mode.get()) != discoverabilityMode) { // update the setting to the new value _mode.set(static_cast<int>(discoverabilityMode)); if (static_cast<int>(_mode.get()) == Discoverability::None) { // if we just got set to no discoverability, make sure that we delete our location in DB removeLocation(); } else { // we have a discoverability mode that says we should send a location, do that right away updateLocation(); } emit discoverabilityModeChanged(discoverabilityMode); } }
void Speedometer::initialize () { if ( !m_widgetItem ) { QWidget *widget = new QWidget; m_widget.setupUi( widget ); m_widgetItem = new WidgetGraphicsItem( this ); m_widgetItem->setWidget( widget ); MarbleGraphicsGridLayout *layout = new MarbleGraphicsGridLayout( 1, 1 ); layout->addItem( m_widgetItem, 0, 0 ); setLayout( layout ); setPadding( 0 ); m_locale = MarbleGlobal::getInstance()->locale(); connect( marbleModel()->positionTracking(), SIGNAL(gpsLocation(GeoDataCoordinates,qreal)), this, SLOT(updateLocation(GeoDataCoordinates,qreal)) ); } }
void FaceTemplate::updateTemplate(cv::Mat t, cv::Mat &parent, int _x, int _y) { face_template = t; updateLocation(_x, _y); updateDims(t.rows, t.cols, parent); }
void SubassemblyView::init ( void ) { setObjectName( subassembly_->name().toLatin1() ); drawer_ = Space3D::OCSubassemblyDrawFactory::drawer( subassembly_, view() ); modify_input_ = new SubassemblyModifyInput( this ); dimensions_[0] = dimensions_[1] = dimensions_[2] = 0; dimension_name_ = view()->genSelectionName(); ListViewItem* previous_item = parent()->previousItem( parent()->listViewItem(), subassembly_->id() ); list_view_item_ = new ListViewItem( parent()->listViewItem(), previous_item ); list_view_item_->setData( lC::formatName( subassembly_->name() ) + QString( " <%1>" ).arg( subassembly_->id() ), lC::NAME ); list_view_item_->setData( trC( subassembly_->type() ), lC::TYPE ); list_view_item_->setData( tr( "Model: %1.%2 <%3>" ). arg( lC::formatName( subassembly_->subassembly()->name()) ). arg( trC( subassembly_->subassembly()->type() ) ). arg( lC::idToString( subassembly_->subassembly()->ID() ) ), lC::DETAIL ); //TODO //list_view_item_->listView()->ensureItemVisible( list_view_item_ ); QListIterator<std::shared_ptr<AssemblyConstraint>> constraint = subassembly_->constraints().constraints(); ListViewItem* constraint_item = 0; while ( constraint.hasNext() ) { constraint_item = new ListViewItem( list_view_item_, constraint_item ); constraint_item->setData( trC( lC::STR::CONSTRAINT ), lC::NAME ); constraint_item->setData( trC( constraint.peekNext()->type() ), lC::TYPE ); constraint_item->setData( QVariant(), lC::DETAIL ); updateChangedConstraint( 0, constraint.peekNext().get() ); // Are there any offset constraints which need dimensions? if ( constraint.peekNext()->type() == lC::STR::MATE_OFFSET || constraint.peekNext()->type() == lC::STR::ALIGN_OFFSET ) updateChangedOffset( constraint.peekNext().get() ); constraint.next(); } #if 0 connect( subassembly_, SIGNAL( locationChanged() ), SLOT( updateLocation() ) ); connect( subassembly_, SIGNAL( solidChanged() ), SLOT( updateTessellation() ) ); #else connect( subassembly_, SIGNAL( locationChanged() ), SLOT( updateTessellation() ) ); #endif connect( subassembly_, SIGNAL( materialChanged() ), SLOT( updateMaterial() ) ); connect( subassembly_, SIGNAL( constraintCreated( const AssemblyConstraint*) ), SLOT( updateNewConstraint( const AssemblyConstraint* ) ) ); connect( subassembly_, SIGNAL( constraintChanged( const AssemblyConstraint*, const AssemblyConstraint*) ), SLOT( updateChangedConstraint( const AssemblyConstraint*, const AssemblyConstraint* ) ) ); connect( subassembly_, SIGNAL( constraintOffsetChanged( const AssemblyConstraint*) ), SLOT( updateChangedOffset( const AssemblyConstraint* ) ) ); connect( subassembly_, SIGNAL( constraintCanceled() ), SLOT( updateCanceledConstraint() ) ); connect( subassembly_->subassembly(), SIGNAL( nameChanged(const QString&) ), SLOT( updateModelName( const QString& ) ) ); connect( parent(), SIGNAL( orientationChanged( const GLdouble* ) ), SLOT( updateViewNormal( const GLdouble* ) ) ); if ( offset_info_dialog_ == 0 ) offset_info_dialog_ = new OffsetInfoDialog( parent()->lCMW() ); }
void MainWindow::_setShowMode() { setMenuBar(m_show_menuBar); /*--CentralWidget--*/ QObject::connect(m_show_droneList, SIGNAL(locationUpdated(uint,int32_t,int32_t,int32_t)), m_show_centralWidget, SLOT(updateLocation(uint,int32_t,int32_t,int32_t))); QObject::connect(m_show_centralWidget, SIGNAL(goTo(uint,int32_t,int32_t,int32_t)), m_show_droneList, SLOT(moveUAVTo(uint,int32_t,int32_t,int32_t))); setCentralWidget(m_show_centralWidget); /*----DroneList----*/ m_show_dockUAVList->setWidget(m_show_droneList); m_show_dockUAVList->setFeatures(QDockWidget::NoDockWidgetFeatures); m_show_dockUAVList->setFloating(false); m_show_dockUAVList->setMinimumWidth(400); addDockWidget(Qt::LeftDockWidgetArea, m_show_dockUAVList); QObject::connect(m_show_droneList, SIGNAL(connected(bool)), this, SLOT(_show_droneListConnected(bool))); QObject::connect(m_show_actionResearchUAVs, SIGNAL(triggered()), m_show_droneList, SLOT(searchUAVs())); _show_droneListConnected(false); /*--Connectivity---*/ for(unsigned int i = 0; i < 8; ++i) m_show_baudActionGroup->addAction(m_show_arrayBaudActions[i]); QObject::connect(m_show_baudActionGroup, SIGNAL(triggered(QAction*)), this, SLOT(_show_setSerialPortBaudRate(QAction *))); QObject::connect(m_show_serialPortActionGroup, SIGNAL(triggered(QAction*)), this, SLOT(_show_setSerialPortName(QAction*))); QObject::connect(m_show_actionConnect, SIGNAL(triggered()), this, SLOT(_show_connectLink())); /*---SerialPort----*/ _show_updatePortNames(); //auto-selecting the first serial port if(m_show_arraySerialPortActions.size() > 0) { m_show_arraySerialPortActions[0]->setChecked(true); _show_setSerialPortName(m_show_arraySerialPortActions[0]); } //auto-selecting 57600 bauds (telemetry default) m_show_arrayBaudActions[6]->setChecked(true); _show_setSerialPortBaudRate(m_show_arrayBaudActions[6]); }
// virtual void LLFloaterWorldMap::draw() { // Hide/Show Mature Events controls childSetVisible("events_mature_icon", !gAgent.isTeen()); childSetVisible("events_mature_label", !gAgent.isTeen()); childSetVisible("event_mature_chk", !gAgent.isTeen()); // On orientation island, users don't have a home location yet, so don't // let them teleport "home". It dumps them in an often-crowed welcome // area (infohub) and they get confused. JC LLViewerRegion* regionp = gAgent.getRegion(); bool agent_on_prelude = (regionp && regionp->isPrelude()); bool enable_go_home = gAgent.isGodlike() || !agent_on_prelude; childSetEnabled("Go Home", enable_go_home); updateLocation(); LLTracker::ETrackingStatus tracking_status = LLTracker::getTrackingStatus(); if (LLTracker::TRACKING_AVATAR == tracking_status) { childSetColor("avatar_icon", gTrackColor); } else { childSetColor("avatar_icon", gDisabledTrackColor); } if (LLTracker::TRACKING_LANDMARK == tracking_status) { childSetColor("landmark_icon", gTrackColor); } else { childSetColor("landmark_icon", gDisabledTrackColor); } if (LLTracker::TRACKING_LOCATION == tracking_status) { childSetColor("location_icon", gTrackColor); } else { if (mCompletingRegionName != "") { F64 seconds = LLTimer::getElapsedSeconds(); double value = fmod(seconds, 2); value = 0.5 + 0.5*cos(value * 3.14159f); LLColor4 loading_color(0.0, F32(value/2), F32(value), 1.0); childSetColor("location_icon", loading_color); } else { childSetColor("location_icon", gDisabledTrackColor); } } // check for completion of tracking data if (mWaitingForTracker) { centerOnTarget(TRUE); } // childSetEnabled("Clear", (BOOL)tracking_status); childSetEnabled("Show Destination", (BOOL)tracking_status || LLWorldMap::getInstance()->mIsTrackingUnknownLocation); childSetEnabled("copy_slurl", (mSLURL.size() > 0) ); setMouseOpaque(TRUE); getDragHandle()->setMouseOpaque(TRUE); //RN: snaps to zoom value because interpolation caused jitter in the text rendering if (!mZoomTimer.getStarted() && mCurZoomVal != (F32)childGetValue("zoom slider").asReal()) { mZoomTimer.start(); } F32 interp = mZoomTimer.getElapsedTimeF32() / MAP_ZOOM_TIME; if (interp > 1.f) { interp = 1.f; mZoomTimer.stop(); } mCurZoomVal = lerp(mCurZoomVal, (F32)childGetValue("zoom slider").asReal(), interp); F32 map_scale = 256.f*pow(2.f, mCurZoomVal); LLWorldMapView::setScale( map_scale ); LLFloater::draw(); }
LH_CursorController::LH_CursorController() { updating_link_data_ = false; setup_link_json_data_ = new LH_Qt_QString(this, "Cursor Data", "", LH_FLAG_NOSAVE_DATA | LH_FLAG_NOSINK | LH_FLAG_READONLY | LH_FLAG_HIDEVALUE /*| LH_FLAG_HIDDEN*/); setup_link_json_data_->setHelp("<p>This field holds the data for this cursor; all cursor objects by default link themselves to \"Primary Cursor\".</p>" "<p>You only need change the name of this link if your layout needs more than one cursor."); setup_link_postback_ = new LH_Qt_QString(this, "Cursor Postback", "", LH_FLAG_NOSAVE_DATA | LH_FLAG_NOSOURCE | LH_FLAG_READONLY | LH_FLAG_HIDDEN); setup_link_current_pos = new LH_Qt_QString(this, "Cursor Position", "", LH_FLAG_NOSAVE_DATA | LH_FLAG_NOSINK | LH_FLAG_READONLY /* | LH_FLAG_HIDDEN*/); setup_link_current_pos->setHelp("<p>Displays the coordinates of the cursor at present, as well as whether the controller is currently active:</p>" "<p>(x,y) [active]</p>" "<p>This is mainly provided for advanced layout designers if they want to link something to the current cursor position.</p>"); setup_link_selected_pos = new LH_Qt_QString(this, "Selected Position", "", LH_FLAG_NOSAVE_DATA | LH_FLAG_NOSINK | LH_FLAG_READONLY /* | LH_FLAG_HIDDEN*/); setup_link_selected_pos->setHelp("<p>Displays the coordinates of the selected point at present, as well as whether the controller is currently active:</p>" "<p>(x,y) [active]</p>" "<p>This is mainly provided for advanced layout designers if they want to link something to the current selection position.</p>"); //setup_link_postback_->setLinkFilter("CursorPostback"); //setup_link_json_data_->setLinkFilter("Cursors"); setup_cursor_active_ = new LH_Qt_bool(this, "Active", cursor_data_.active, LH_FLAG_NOSAVE_DATA | LH_FLAG_NOSINK | LH_FLAG_READONLY | LH_FLAG_HIDDEN); setup_cursor_sel_x_ = new LH_Qt_int(this, "X (Selected)", cursor_data_.x, LH_FLAG_NOSAVE_DATA | LH_FLAG_NOSINK | LH_FLAG_READONLY | LH_FLAG_HIDDEN); setup_cursor_sel_y_ = new LH_Qt_int(this, "Y (Selected)", cursor_data_.y, LH_FLAG_NOSAVE_DATA | LH_FLAG_NOSINK | LH_FLAG_READONLY | LH_FLAG_HIDDEN); setup_cursor_x_ = new LH_Qt_int(this, "X (Current)", cursor_data_.x, LH_FLAG_NOSAVE_DATA | LH_FLAG_NOSINK | LH_FLAG_READONLY | LH_FLAG_HIDDEN); setup_cursor_y_ = new LH_Qt_int(this, "Y (Current)", cursor_data_.y, LH_FLAG_NOSAVE_DATA | LH_FLAG_NOSINK | LH_FLAG_READONLY | LH_FLAG_HIDDEN); new LH_Qt_QString(this, "hr1", "<hr>", LH_FLAG_NOSOURCE | LH_FLAG_NOSINK | LH_FLAG_HIDETITLE, lh_type_string_html ); setup_coordinate_ = new LH_Qt_QString(this, "Coordinate", "1,1", LH_FLAG_NOSAVE_DATA | LH_FLAG_READONLY | LH_FLAG_FIRST | LH_FLAG_HIDDEN); setup_coordinate_->setHelp("The current cursor location."); cursorModes.append((cursorMode){smSelectDeselect, true , "Activate, Move & Select / Deselect"}); cursorModes.append((cursorMode){smSelect , true , "Activate, Move & Select Only (one is always selected)"}); cursorModes.append((cursorMode){smNone , true , "Activate & Move Only (Highlighted option is selected)"}); cursorModes.append((cursorMode){smNone , false, "Move Only (Highlighted option is selected, always activated)"}); cursorModes.append((cursorMode){smSelectDeselect, false, "Move & Select / Deselect Only (Always activated)"}); cursorModes.append((cursorMode){smSelect , false, "Move & Select Only (Always activated)"}); //cursor_data_ = (cursorData){1,1,false,0,0,false,0,0,false,false,0,0,(bounds){(minmax){0,0},(minmax){0,0}}}; QStringList modeNames = QStringList(); foreach(cursorMode cm, cursorModes) modeNames.append(cm.description); setup_mode_ = new LH_Qt_QStringList(this,"Cursor Mode",modeNames,LH_FLAG_AUTORENDER); setup_mode_->setHelp("This allows the user to select how the cursor should behave. Each cursor mode is a combination of several options:<br/>" "<br/>" "<ul>" "<li><b>Activate</b></br>" "If a mode includes \"activation\" then in it's default state the cursor is hidden and nothing happens when using the movement or selection keys. Insetad the user must first press the activation key to display the cursor. Whilst active the cursor is visible, can be moved and, if appropriate, items can be selected and deselected. If activation is not included in the mode, then the cursor is assumed to always be active.</li>" "<li><b>Select</b></br>" "For modes that include selecting, the user must first move the cursor over the desired option and then press the select key before anything happens. If a mode does not include selection, then simply moving the cursor changes the selection immediately.</li>" "</li>" "<li><b>Deselect</b></br>" "Some modes have select/deselect behaviour, specified by this option. With this ability the user can \"turn off\" everything; without it there will always be one item selected.</li>" "</li>" "</ul>"); connect( setup_mode_, SIGNAL(changed()), this, SLOT(changeMode()) ); setup_boundry_ = new LH_Qt_QString(this,"Boundries","1,1,3,3",0); setup_boundry_->setHelp("This box should contain the borders of the \"box\" the cusror can move in.</br></br>The format is [left],[top],[right],[bottom] <br/><br/>e.g.:<br/>\"1,1,1,4\" would denote a box one column wide and four rows high<br/>\"1,1,3,3\" would be a square of three columns and three rows."); connect( setup_boundry_, SIGNAL(changed()), this, SLOT(changeBounds()) ); setup_boundry_loop_ = new LH_Qt_bool(this, "Loop at edges", false); setup_boundry_loop_->setHelp("By default when at the furthest edge of the box the cursor stops. Ticking this however will change that so that moving off one edge will bring the cursor back in on the opposite side."); setup_invalid_coordinates_ = new LH_Qt_QString(this,"Invalid Points\n(x,y;x,y;x,y)","",0); setup_invalid_coordinates_->setHelp("If you wish to create a \"void\" in the cusrsor space, this allows you to do so. List all the points here that the cursor is not allowed to land on and it will be prevented from doing so either by jumping over the invlid points to the next valid one or simply by blocking its movement.<br/><br/>The format is [x1],[y1];[x2],[y2];[x3][y3]; etc...<br/>e.g.: for the boundry \"1,1,2,5\" the invalid points \"1,2;1,3;1,4\" would prevent the cursor landing on any of the top three middle cells, creating a \"U\"-like shape."); setup_jump_invalid_ = new LH_Qt_bool(this, "Jump over invalid points", true); setup_jump_invalid_->setHelp("By default when the cursor tries to move onto an invlid point it \"jumps\" the cell in question, and keeps moving in the same direction until reaching one where it is allowed to be. Alternatively, checking this box will prevent this, turning invalid points into \"walls\" that have to be moved around manually."); setup_move_up_ = new LH_Qt_InputState(this,"Up","",0); setup_move_up_->setHelp("The key used to move the cursor up, usually the up key from the LCD control"); connect( setup_move_up_, SIGNAL(input(QString,int,int)), this, SLOT(doMoveUp(QString,int,int)) ); setup_move_down_ = new LH_Qt_InputState(this,"Down","",0); setup_move_down_->setHelp("The key used to move the cursor down, usually the down key from the LCD control"); connect( setup_move_down_, SIGNAL(input(QString,int,int)), this, SLOT(doMoveDown(QString,int,int)) ); setup_move_left_ = new LH_Qt_InputState(this,"Left","",0); setup_move_left_->setHelp("The key used to move the cursor left, usually the left key from the LCD control"); connect( setup_move_left_, SIGNAL(input(QString,int,int)), this, SLOT(doMoveLeft(QString,int,int)) ); setup_move_right_ = new LH_Qt_InputState(this,"Right","",0); setup_move_right_->setHelp("The key used to move the cursor right, usually the right key from the LCD control"); connect( setup_move_right_, SIGNAL(input(QString,int,int)), this, SLOT(doMoveRight(QString,int,int)) ); setup_select_ = new LH_Qt_InputState(this,"Select","",0); setup_select_->setHelp("The key used to select the currently highlighted option, usually the Ok key from the LCD control"); connect( setup_select_, SIGNAL(input(QString,int,int)), this, SLOT(doSelect(QString,int,int)) ); setup_reselect_ = new LH_Qt_InputState(this,"Reselect","",0); setup_reselect_->setHelp("The key used to reselect the previously selected highlighted option. Usually this is unused, but is very useful for menu layouts where it acts as a \"return to last layout\" (or cancel) command"); connect( setup_reselect_, SIGNAL(input(QString,int,int)), this, SLOT(doReselect(QString,int,int)) ); setup_activate_ = new LH_Qt_InputState(this,"Enable","",0); setup_activate_->setHelp("The key used to activate the cursor control"); connect( setup_activate_, SIGNAL(input(QString,int,int)), this, SLOT(doActivate(QString,int,int)) ); setup_persistent_ = new LH_Qt_bool(this,"Persistent Selection",false); setup_persistent_->setHelp("Ticking this box will cause the system to automatically recall the cursor's last position whether you save the layout or not.<br/><br/>This is mainly of use within menu layouts and allows the menu to open with the last selected option still highlighted."); setup_persistent_autoselect_ = new LH_Qt_bool(this,"Auto-reselect",false, LH_FLAG_HIDDEN); setup_persistent_autoselect_->setHelp("When recovering a persited selection, this option determins if the option is merely highlighed (i.e. the cursor is positioned on it) or if the option is actually selected."); setup_persistent_file_ = new LH_Qt_QFileInfo(this, "Persistence File", QFileInfo(), LH_FLAG_HIDDEN); setup_persistent_file_->setHelp("The file in which to save the persisted location.<br/><br/>Note that you can use this to make serveral layouts work together as though they were all parts of the same layout by pointing them all to this file, thus causing the cursor position to persist accross them."); #ifdef ENABLE_VIRTUAL_CURSOR_KEYS setup_virtual_keys_ = new LH_Qt_html(this, 0, LH_FLAG_NOSOURCE | LH_FLAG_NOSINK | LH_FLAG_LAST ); setup_virtual_keys_->setTitle("<hr><center><table>" "<tr><td> </td><td style='background-color:silver;'><center><a href='up'>[ Up ]</a></center></td><td> </td><td> </td><td style='background-color:silver;'><center><a href='act'>[ Act ]</a></center></td></tr>" "<tr><td style='background-color:silver;'><center><a href='left'>[Left]</a></center></td><td style='background-color:silver;'><center><a href='sel'>[ OK ]</a></center></td><td style='background-color:silver;'><center><a href='right'>[Right]</a></center></td><td> </td></tr>" "<tr><td> </td><td style='background-color:silver;'><center><a href='down'>[Down]</a></center></td><td> </td><td> </td><td style='background-color:silver;'><center><a href='resel'>[ Re ]</a></center></td></tr>" "</table></center>"); connect(setup_virtual_keys_, SIGNAL(change(QString)), this, SLOT(virtualKeyPress(QString)) ); #endif connect(setup_link_postback_,SIGNAL(set()),this,SLOT(processPostback())); connect(setup_link_postback_,SIGNAL(changed()),this,SLOT(processPostback())); connect(setup_persistent_, SIGNAL(changed()), this, SLOT(changePersistent())); connect(setup_persistent_file_, SIGNAL(changed()), this, SLOT(loadPersistedSelection())); connect(setup_cursor_active_, SIGNAL(changed()), this, SLOT(changeCursorData())); connect(setup_cursor_sel_x_, SIGNAL(changed()), this, SLOT(changeCursorData())); connect(setup_cursor_sel_y_, SIGNAL(changed()), this, SLOT(changeCursorData())); connect(setup_cursor_x_, SIGNAL(changed()), this, SLOT(changeCursorData())); connect(setup_cursor_y_, SIGNAL(changed()), this, SLOT(changeCursorData())); connect(setup_cursor_active_, SIGNAL(set()), this, SLOT(changeCursorData())); connect(setup_cursor_sel_x_, SIGNAL(set()), this, SLOT(changeCursorData())); connect(setup_cursor_sel_y_, SIGNAL(set()), this, SLOT(changeCursorData())); connect(setup_cursor_x_, SIGNAL(set()), this, SLOT(changeCursorData())); connect(setup_cursor_y_, SIGNAL(set()), this, SLOT(changeCursorData())); connect(this, SIGNAL(initialized()), this, SLOT(initialiseLinking())); updateLocation(0,0); #ifdef LH_CF add_cf_target(setup_cursor_active_); add_cf_source(setup_cursor_active_); add_cf_target(setup_cursor_sel_x_); add_cf_source(setup_cursor_sel_x_); add_cf_target(setup_cursor_sel_y_); add_cf_source(setup_cursor_sel_y_); add_cf_target(setup_cursor_x_); add_cf_source(setup_cursor_x_); add_cf_target(setup_cursor_y_); add_cf_source(setup_cursor_y_); #endif }
void mouseDrag (const MouseEvent& e) { if (e.originalComponent != this) updateLocation (true, e.getScreenPosition()); }
int main(int argc, char const *argv[]) { int rc = -1; int x=0; ManagedDevice client; char *configFilePath = "./device.cfg"; rc = initialize_configfile(&deviceClient, configFilePath); if(rc != SUCCESS){ printf("initialize failed and returned rc = %d.\n Quitting..", rc); scanf("%d",&x); return 0; } rc = connectiotf_dm(&client); if(rc != SUCCESS){ printf("Connection; failed and returned rc = %d.\n Quitting..", rc); scanf("%d",&x); return 0; } setCommandHandler_dm(&client, myCallback); setManagedHandler_dm(&client,managedCallBack ); subscribeCommands_dm(&client); populateMgmtConfig(&client); int exit = 0; char reqId[40]; while (!exit){ printOptions(); int val; scanf("%d",&val); switch (val) { case 1: printf("\n publish manage ..\n"); publishManageEvent(&client,4000,1,1, reqId); printf("\n Manage Event Exited: %s",reqId); break; case 2: printf("\n publish unmanaged..\n"); publishUnManageEvent(&client, reqId); printf("\nunmanaged Request Exit : %s",reqId); break; case 3: printf("\n publish addErrorCode ..\n"); addErrorCode(&client, 121 , reqId); printf("\n addErrorCode Request Exit : %s",reqId); break; case 4: printf("\n publish clearErrorCodes ..\n"); clearErrorCodes(&client, reqId); printf("\n clearErrorCodes Request Exit :");// %s",reqId); break; case 5: printf("\n publish addLog ..\n"); addLog(&client, "test","",1, reqId); printf("\n addLog Request Exit : %s",reqId); break; case 6: printf("\n publish clearLogs ..\n"); clearLogs(&client,reqId); printf("\n clearLogs Request Exit : %s",reqId); break; case 7: printf("\n publish updateLocation ..\n"); time_t t = time(NULL); char updatedDateTime[50];//"2016-03-01T07:07:56.323Z" strftime(updatedDateTime, sizeof(updatedDateTime), "%Y-%m-%dT%TZ", localtime(&t)); updateLocation(&client, 77.5667,12.9667, 0,updatedDateTime, 0, reqId) ; printf("updateLocation Request Exit : %s",reqId); break; case 8: printf("\n publish Event To WIoTP ..\n"); publishEventToIot(&client); break; default: disconnect_dm(&client); printf("\n Quitting!!\n"); exit = 1; break; } } return 0; }
// virtual void LLFloaterWorldMap::draw() { static LLUIColor map_track_color = LLUIColorTable::instance().getColor("MapTrackColor", LLColor4::white); static LLUIColor map_track_disabled_color = LLUIColorTable::instance().getColor("MapTrackDisabledColor", LLColor4::white); // Hide/Show Mature Events controls childSetVisible("events_mature_icon", gAgent.canAccessMature()); childSetVisible("events_mature_label", gAgent.canAccessMature()); childSetVisible("event_mature_chk", gAgent.canAccessMature()); childSetVisible("events_adult_icon", gAgent.canAccessMature()); childSetVisible("events_adult_label", gAgent.canAccessMature()); childSetVisible("event_adult_chk", gAgent.canAccessMature()); bool adult_enabled = gAgent.canAccessAdult(); if (!adult_enabled) { childSetValue("event_adult_chk", FALSE); } childSetEnabled("event_adult_chk", adult_enabled); // On orientation island, users don't have a home location yet, so don't // let them teleport "home". It dumps them in an often-crowed welcome // area (infohub) and they get confused. JC LLViewerRegion* regionp = gAgent.getRegion(); bool agent_on_prelude = (regionp && regionp->isPrelude()); bool enable_go_home = gAgent.isGodlike() || !agent_on_prelude; childSetEnabled("Go Home", enable_go_home); updateLocation(); LLTracker::ETrackingStatus tracking_status = LLTracker::getTrackingStatus(); if (LLTracker::TRACKING_AVATAR == tracking_status) { childSetColor("avatar_icon", map_track_color); } else { childSetColor("avatar_icon", map_track_disabled_color); } if (LLTracker::TRACKING_LANDMARK == tracking_status) { childSetColor("landmark_icon", map_track_color); } else { childSetColor("landmark_icon", map_track_disabled_color); } if (LLTracker::TRACKING_LOCATION == tracking_status) { childSetColor("location_icon", map_track_color); } else { if (mCompletingRegionName != "") { F64 seconds = LLTimer::getElapsedSeconds(); double value = fmod(seconds, 2); value = 0.5 + 0.5*cos(value * F_PI); LLColor4 loading_color(0.0, F32(value/2), F32(value), 1.0); childSetColor("location_icon", loading_color); } else { childSetColor("location_icon", map_track_disabled_color); } } // check for completion of tracking data if (mWaitingForTracker) { centerOnTarget(TRUE); } childSetEnabled("Teleport", (BOOL)tracking_status); // childSetEnabled("Clear", (BOOL)tracking_status); childSetEnabled("Show Destination", (BOOL)tracking_status || LLWorldMap::getInstance()->isTracking()); childSetEnabled("copy_slurl", (mSLURL.size() > 0) ); setMouseOpaque(TRUE); getDragHandle()->setMouseOpaque(TRUE); //RN: snaps to zoom value because interpolation caused jitter in the text rendering if (!mZoomTimer.getStarted() && mCurZoomVal != (F32)childGetValue("zoom slider").asReal()) { mZoomTimer.start(); } F32 interp = mZoomTimer.getElapsedTimeF32() / MAP_ZOOM_TIME; if (interp > 1.f) { interp = 1.f; mZoomTimer.stop(); } mCurZoomVal = lerp(mCurZoomVal, (F32)childGetValue("zoom slider").asReal(), interp); F32 map_scale = 256.f*pow(2.f, mCurZoomVal); LLWorldMapView::setScale( map_scale ); // Enable/disable checkboxes depending on the zoom level // If above threshold level (i.e. low res) -> Disable all checkboxes // If under threshold level (i.e. high res) -> Enable all checkboxes bool enable = LLWorldMapView::showRegionInfo(); childSetEnabled("people_chk", enable); childSetEnabled("infohub_chk", enable); childSetEnabled("telehub_chk", enable); childSetEnabled("land_for_sale_chk", enable); childSetEnabled("event_chk", enable); childSetEnabled("event_mature_chk", enable); childSetEnabled("event_adult_chk", enable); LLFloater::draw(); }
void down_single_click_handler(ClickRecognizerRef recognizer, Window *window) { (void)recognizer; (void)window; updateLocation(false); }
void main(void) { init(); STOP(); lcd_set_cursor(0x00); lcd_write_string("(-,-) - -- --- -"); //x/y of robot, explore/return, zone of victim/got victim, walls, way went lcd_set_cursor(0x40); lcd_write_string("- - - (3,1) GREG"); //orientation, cliff detected, v.wall detected, x/y of final destination char victimIndicator = 0; while(!home) { if(start.pressed && ready == FALSE) { findWalls(); if(leftWall && rightWall && frontWall) //if facing east turnAround(); //turn to face west else if (rightWall && frontWall) //if facing north turnLeft90(); //turn to face west else if(leftWall && frontWall) //if facing south turnRight90(); //turn to face west ready = TRUE; //commence exploring the map lcd_set_cursor(0x06); lcd_write_data('E'); //Explore mode play_iCreate_song(1); } //EEPROM Serial Transfer if(eepromSerial.pressed && ready == FALSE) { eepromSerial.pressed = FALSE; lcd_set_cursor(0x00); lcd_write_string("EEPROM Serial "); lcd_set_cursor(0x40); lcd_write_string("Please Wait... "); writeEEPROMTestData(); EEPROMToSerial(); lcd_set_cursor(0x40); lcd_write_string("Complete "); } if(start.pressed) { ready = TRUE; checkForFinalDestination(); lookForVictim(); findWalls(); play_iCreate_song(5); if(leftWall) { rotateIR(24,CCW); leftAngleCorrect(); rotateIR(24,CW); } play_iCreate_song(5); if(frontWall) frontWallCorrect(); play_iCreate_song(5); switch(node) // Gives the Create specific movement instructions for certain squares to go shortest path home and collecting the victim { case 0: goToNextCell(); break; case 1: if (goingHome) { if (victimZone == 1) goRight(); else if (getOrientation() == EAST) goForward(); else if (getOrientation() == SOUTH) goRight(); else goToNextCell(); } else goToNextCell(); break; case 2: if (goingHome) { if (victimZone == 2) goForward(); else if (getOrientation() == SOUTH) goRight(); else if (getOrientation() == NORTH) goLeft(); else goToNextCell(); } else goToNextCell(); break; case 3: if (goingHome) { if (victimZone == 3) goRight(); else if (getOrientation() == EAST) goForward(); else if (getOrientation() == SOUTH) goLeft(); else goToNextCell(); } else goToNextCell(); break; case 4: if (getOrientation() == EAST) goRight(); else goToNextCell(); break; case 5: if (getOrientation() == NORTH) goRight(); else goToNextCell(); break; case 6: if (getOrientation() == WEST) { play_iCreate_song(6); goForward(); } else goToNextCell(); break; default: break; } play_iCreate_song(5); if(getSuccessfulDrive()) { //Send EEPROM data for current cell if(xVictim == xCoord && yVictim == yCoord) { victimIndicator = 1; } /*if(xVirtual == xCoord && yVirtual == yCoord) { switch(dVirtual) { case WEST: { updateMapData(1,0,0,0,victimIndicator,getOrientation()); break; } case SOUTH: { updateMapData(0,1,0,0,victimIndicator,getOrientation()); break; } case EAST: { updateMapData(0,0,1,0,victimIndicator,getOrientation()); break; } case NORTH: { updateMapData(0,0,0,1,victimIndicator,getOrientation()); break; } default: updateMapData(0,0,0,0,victimIndicator,getOrientation()); } }*/ updateMapData(0,0,0,0,victimIndicator,getOrientation()); victimIndicator = 0; updateLocation(); updateNode(); if(goingHome) checkIfHome(); } } } }