void ContactCluster::init() { _ignoreSignals = false; _titleSingular = tr("Contact"); _titlePlural = tr("Contacts"); _query = "SELECT cntct.*, crmacct_name " "FROM cntct LEFT OUTER JOIN crmacct ON (cntct_crmacct_id = crmacct_id) "; _layoutDone = false; _minimalLayout = false; _grid->removeWidget(_label); // will be reinserted _grid->removeWidget(_description); _grid->removeWidget(_list); // will be reinserted _grid->removeWidget(_info); // will be reinserted delete _description; _grid->setMargin(0); _grid->setSpacing(2); _nameBox = new QHBoxLayout; _nameBox->setSpacing(2); _titleBox = new QHBoxLayout; _titleBox->setSpacing(2); _change = new QLineEdit(this); _numberLit = new QLabel(tr("Number:"), this, "_numberLit"); _number = new QLineEdit(this, "_number"); _change->hide(); _number->hide(); _numberLit->hide(); _honorific = new XComboBox(this, "_honorific"); _firstLit = new QLabel(tr("First:"), this, "_firstLit"); _first = new QLineEdit(this, "_first"); _lastLit = new QLabel(tr("Last:"), this, "_lastLit"); _last = new QLineEdit(this, "_last"); _initialsLit = new QLabel(tr("Initials:"), this, "_initialsLit"); _initials = new QLineEdit(this, "_initials"); _initials->resize(_initials->size().width() / 3, _initials->size().height()); _titleLit = new QLabel(tr("Job Title:"), this, "_titleLit"); _title = new QLineEdit(this, "_title"); _mapper = new XDataWidgetMapper(this); _nameBox->addWidget(_honorific, 0); _nameBox->addWidget(_firstLit, 0); _nameBox->addWidget(_first, 1); _nameBox->addWidget(_lastLit, 0); _nameBox->addWidget(_last, 2); _nameBox->addWidget(_initialsLit, 0); _nameBox->addWidget(_initials, 0); _nameBox->addWidget(_list, 0, Qt::AlignRight); _nameBox->addWidget(_info, 0, Qt::AlignRight); _titleBox->addWidget(_titleLit, 0); _titleBox->addWidget(_title, 2); _buttonBox = new QHBoxLayout; _crmAcct = new CRMAcctCluster(this, "_crmAcct"); _active = new QCheckBox(tr("Active"), this, "_active"); _buttonBox->addWidget(_crmAcct, 1, Qt::AlignLeft); _buttonBox->addStretch(); _buttonBox->addWidget(_active, 0); _phoneLit = new QLabel(tr("Voice:"), this, "_phoneLit"); _phone = new QLineEdit(this, "_phone"); _phone2Lit = new QLabel(tr("Alternate:"), this, "_phone2Lit"); _phone2 = new QLineEdit(this, "_phone2"); _faxLit = new QLabel(tr("Fax:"), this, "_faxLit"); _fax = new QLineEdit(this, "_fax"); _emailLit = new QLabel(tr("E-Mail:"), this, "_emailLit"); _email = new QLineEdit(this, "_email"); _webaddrLit = new QLabel(tr("Web:"), this, "_webaddrLit"); _webaddr = new QLineEdit(this, "_webaddr"); _address = new AddressCluster(this, "_address"); _numberLit->setAlignment(Qt::AlignRight | Qt::AlignVCenter); _label->setAlignment(Qt::AlignLeft | Qt::AlignVCenter); _firstLit->setAlignment(Qt::AlignRight | Qt::AlignVCenter); _lastLit->setAlignment(Qt::AlignRight | Qt::AlignVCenter); _titleLit->setAlignment(Qt::AlignRight | Qt::AlignVCenter); _phoneLit->setAlignment(Qt::AlignRight | Qt::AlignVCenter); _phone2Lit->setAlignment(Qt::AlignRight | Qt::AlignVCenter); _faxLit->setAlignment(Qt::AlignRight | Qt::AlignVCenter); _emailLit->setAlignment(Qt::AlignRight | Qt::AlignVCenter); _initialsLit->setAlignment(Qt::AlignRight | Qt::AlignVCenter); _webaddrLit->setAlignment(Qt::AlignRight | Qt::AlignVCenter); _honorific->setEditable(true); _honorific->setType(XComboBox::Honorifics); _crmAcct->setLabel(tr("CRM Account:")); layout(); connect(_list, SIGNAL(clicked()), this, SLOT(sEllipses())); connect(_info, SIGNAL(clicked()), this, SLOT(sInfo())); connect(_honorific, SIGNAL(newID(int)), this, SIGNAL(changed())); connect(_first, SIGNAL(textChanged(const QString&)), this, SIGNAL(changed())); connect(_last, SIGNAL(textChanged(const QString&)), this, SIGNAL(changed())); connect(_initials, SIGNAL(textChanged(const QString&)), this, SIGNAL(changed())); connect(_crmAcct, SIGNAL(newId(int)), this, SIGNAL(changed())); connect(_phone, SIGNAL(textChanged(const QString&)), this, SIGNAL(changed())); connect(_phone2, SIGNAL(textChanged(const QString&)), this, SIGNAL(changed())); connect(_fax, SIGNAL(textChanged(const QString&)), this, SIGNAL(changed())); connect(_email, SIGNAL(textChanged(const QString&)), this, SIGNAL(changed())); connect(_webaddr, SIGNAL(textChanged(const QString&)), this, SIGNAL(changed())); connect(_address, SIGNAL(changed()), this, SIGNAL(changed())); connect(_honorific, SIGNAL(newID(int)), this, SLOT(sCheck())); connect(_first, SIGNAL(lostFocus()), this, SLOT(sCheck())); connect(_last, SIGNAL(lostFocus()), this, SLOT(sCheck())); connect(_initials, SIGNAL(lostFocus()), this, SLOT(sCheck())); connect(_crmAcct, SIGNAL(newId(int)), this, SLOT(sCheck())); connect(_phone, SIGNAL(lostFocus()), this, SLOT(sCheck())); connect(_phone2, SIGNAL(lostFocus()), this, SLOT(sCheck())); connect(_fax, SIGNAL(lostFocus()), this, SLOT(sCheck())); connect(_email, SIGNAL(lostFocus()), this, SLOT(sCheck())); connect(_webaddr, SIGNAL(lostFocus()), this, SLOT(sCheck())); connect(_address, SIGNAL(changed()), this, SLOT(sCheck())); setFocusPolicy(Qt::StrongFocus); setFocusProxy(_honorific); setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); setLabel(""); _limits = 0; setInfoVisible(false); // TODO - remove this and implement Info button silentSetId(-1); }
Name(const ChannelID &id) : LineEditSetting(this), ChannelDBStorage(this, id, "name") { setLabel(QObject::tr("Channel Name")); }
Hue(const ChannelID &id) : SliderSetting(this, 0, 65535, 655), ChannelDBStorage(this, id, "hue") { setLabel(QObject::tr("Hue")); }
kernelWindowComponent *kernelWindowNewIcon(objectKey parent, image *imageCopy, const char *label, componentParameters *params) { // Formats a kernelWindowComponent as a kernelWindowIcon kernelWindowComponent *component = NULL; kernelWindowIcon *icon = NULL; pixel *pix = NULL; unsigned count; // Check params if (!parent || !imageCopy || !label || !params) { kernelError(kernel_error, "NULL parameter"); return (component = NULL); } if (!imageCopy->data) { kernelError(kernel_error, "Image data is NULL"); return (component = NULL); } // Get the basic component structure component = kernelWindowComponentNew(parent, params); if (!component) return (component); component->type = iconComponentType; // Set the functions component->draw = &draw; component->focus = &focus; component->setData = &setData; component->mouseEvent = &mouseEvent; component->keyEvent = &keyEvent; component->destroy = &destroy; // If default colors are requested, override the standard component colors // with the ones we prefer if (!(component->params.flags & WINDOW_COMPFLAG_CUSTOMFOREGROUND)) { component->params.foreground.red = 0x28; component->params.foreground.green = 0x5D; component->params.foreground.blue = 0xAB; component->params.flags |= WINDOW_COMPFLAG_CUSTOMFOREGROUND; } if (!(component->params.flags & WINDOW_COMPFLAG_CUSTOMBACKGROUND)) { memcpy((color *) &component->params.background, &COLOR_WHITE, sizeof(color)); component->params.flags |= WINDOW_COMPFLAG_CUSTOMBACKGROUND; } // Always use our font component->params.font = windowVariables->font.varWidth.small.font; // Copy all the relevant data into our memory icon = kernelMalloc(sizeof(kernelWindowIcon)); if (!icon) { kernelWindowComponentDestroy(component); return (component = NULL); } component->data = (void *) icon; // Copy the image to kernel memory if (kernelImageCopyToKernel(imageCopy, (image *) &icon->iconImage) < 0) { kernelWindowComponentDestroy(component); return (component = NULL); } // Icons use pure green as the transparency color icon->iconImage.transColor.blue = 0; icon->iconImage.transColor.green = 255; icon->iconImage.transColor.red = 0; // When the icon is selected, we do a little effect that makes the image // appear yellowish. if (kernelImageCopyToKernel(imageCopy, (image *) &icon->selectedImage) < 0) { kernelWindowComponentDestroy(component); return (component = NULL); } // Icons use pure green as the transparency color icon->selectedImage.transColor.blue = 0; icon->selectedImage.transColor.green = 255; icon->selectedImage.transColor.red = 0; for (count = 0; count < icon->selectedImage.pixels; count ++) { pix = &((pixel *) icon->selectedImage.data)[count]; if (!PIXELS_EQ(pix, &icon->selectedImage.transColor)) { pix->red = ((pix->red + 255) / 2); pix->green = ((pix->green + 255) / 2); pix->blue /= 2; } } if (component->params.font) setLabel(icon, label, (asciiFont *) component->params.font); // Now populate the main component component->width = max(imageCopy->width, ((unsigned)(icon->labelWidth + 3))); component->height = (imageCopy->height + 5); if (component->params.font) component->height += (((asciiFont *) component->params.font)->glyphHeight * icon->labelLines); component->minWidth = component->width; component->minHeight = component->height; return (component); }
Callsign(const ChannelID &id) : LineEditSetting(this), ChannelDBStorage(this, id, "callsign") { setLabel(QObject::tr("Callsign")); }
void AddressCluster::init() { _list = new QPushButton(tr("..."), this); _list->setObjectName("_list"); _list->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); #ifndef Q_WS_MAC _list->setMaximumWidth(25); #else _list->setMinimumWidth(60); _list->setMinimumHeight(32); #endif _titleSingular = tr("Address"); _titlePlural = tr("Addresses"); _query = "SELECT * FROM address "; _searchAcctId = -1; // handle differences between VirtualCluster and AddressCluster _grid->removeWidget(_label); _grid->removeWidget(_description); delete _description; _description = 0; _addrChange = new XLineEdit(this); _number = new XLineEdit(this); _addrLit = new QLabel(tr("Street\nAddress:"), this); _addr1 = new XLineEdit(this); _addr2 = new XLineEdit(this); _addr3 = new XLineEdit(this); _cityLit = new QLabel(tr("City:"), this); _city = new XLineEdit(this); _stateLit = new QLabel(tr("State:")); _state = new XComboBox(this, "_state"); _postalcodeLit = new QLabel(tr("Postal Code:")); _postalcode = new XLineEdit(this); _countryLit = new QLabel(tr("Country:")); _country = new XComboBox(this, "_country"); _active = new QCheckBox(tr("Active"), this); _mapper = new XDataWidgetMapper(this); _addrChange->hide(); #if defined Q_OS_MAC _city->setMinimumWidth(110); #else _city->setMinimumWidth(85); #endif if (! DEBUG) _number->hide(); _addrLit->setAlignment(Qt::AlignRight | Qt::AlignVCenter); _cityLit->setAlignment(Qt::AlignRight | Qt::AlignVCenter); _stateLit->setAlignment(Qt::AlignRight | Qt::AlignVCenter); _state->setEditable(true); _state->setAllowNull(true); _country->setMaximumWidth(250); _country->setEditable(! (_x_metrics && _x_metrics->boolean("StrictAddressCountry"))); if (DEBUG) qDebug("%s::_country.isEditable() = %d", (objectName().isEmpty() ? "AddressCluster":qPrintable(objectName())), _country->isEditable()); _postalcodeLit->setAlignment(Qt::AlignRight | Qt::AlignVCenter); _countryLit->setAlignment(Qt::AlignRight | Qt::AlignVCenter); _grid->setMargin(0); _grid->setSpacing(2); _grid->addWidget(_label, 0, 0, 1, -1); _grid->addWidget(_addrLit, 1, 0, 3, 1); _grid->addWidget(_addr1, 1, 1, 1, -1); _grid->addWidget(_addr2, 2, 1, 1, -1); _grid->addWidget(_addr3, 3, 1, 1, -1); _grid->addWidget(_cityLit, 4, 0); _grid->addWidget(_city, 4, 1); _grid->addWidget(_stateLit, 4, 2); _grid->addWidget(_state, 4, 3); _grid->addWidget(_postalcodeLit, 4, 4); _grid->addWidget(_postalcode, 4, 5, 1, 2); _grid->addWidget(_countryLit, 5, 0); _grid->addWidget(_country, 5, 1, 1, 3); _grid->addWidget(_active, 5, 4); QHBoxLayout* hbox = new QHBoxLayout; hbox->addWidget(_list); _grid->addLayout(hbox, 5, 5, 1, -1, Qt::AlignRight); _grid->setColumnStretch(0, 0); _grid->setColumnStretch(1, 3); _grid->setColumnStretch(2, 0); _grid->setColumnStretch(3, 1); _grid->setColumnStretch(4, 0); _grid->setColumnStretch(5, 2); #if defined Q_WS_MAC setMinimumSize(_grid->columnCount() * 60, 132); #endif connect(_list, SIGNAL(clicked()), this, SLOT(sEllipses())); connect(_addr1, SIGNAL(textChanged(const QString&)), this, SIGNAL(changed())); connect(_addr2, SIGNAL(textChanged(const QString&)), this, SIGNAL(changed())); connect(_addr3, SIGNAL(textChanged(const QString&)), this, SIGNAL(changed())); connect(_city, SIGNAL(textChanged(const QString&)), this, SIGNAL(changed())); connect(_state, SIGNAL(editTextChanged(const QString&)), this, SIGNAL(changed())); connect(_state, SIGNAL(newID(int)), this, SIGNAL(changed())); connect(_postalcode,SIGNAL(textChanged(const QString&)), this, SIGNAL(changed())); connect(_country,SIGNAL(editTextChanged(const QString&)),this, SLOT(setCountry(const QString&))); connect(_country, SIGNAL(newID(int)), this, SIGNAL(changed())); connect(_country, SIGNAL(newID(int)), this, SLOT(populateStateComboBox())); connect(_addr1, SIGNAL(requestList()), this, SLOT(sList())); connect(_addr2, SIGNAL(requestList()), this, SLOT(sList())); connect(_addr3, SIGNAL(requestList()), this, SLOT(sList())); connect(_city, SIGNAL(requestList()), this, SLOT(sList())); connect(_postalcode, SIGNAL(requestList()), this, SLOT(sList())); connect(_addr1, SIGNAL(requestSearch()), this, SLOT(sSearch())); connect(_addr2, SIGNAL(requestSearch()), this, SLOT(sSearch())); connect(_addr3, SIGNAL(requestSearch()), this, SLOT(sSearch())); connect(_city, SIGNAL(requestSearch()), this, SLOT(sSearch())); connect(_postalcode, SIGNAL(requestSearch()), this, SLOT(sSearch())); connect(_addr1, SIGNAL(textChanged(QString)), this, SLOT(emitAddressChanged())); connect(_addr2, SIGNAL(textChanged(QString)), this, SLOT(emitAddressChanged())); connect(_addr3, SIGNAL(textChanged(QString)), this, SLOT(emitAddressChanged())); connect(_city, SIGNAL(textChanged(QString)), this, SLOT(emitAddressChanged())); connect(_postalcode,SIGNAL(textChanged(QString)), this, SLOT(emitAddressChanged())); setFocusProxy(_addr1); setFocusPolicy(Qt::StrongFocus); setLabel(""); setActiveVisible(false); silentSetId(-1); _list->show(); _mode = Edit; }
int main(void) { // seed pseudorandom number generator srand48(time(NULL)); // instantiate window GWindow window = newGWindow(WIDTH, HEIGHT); // instantiate bricks initBricks(window); // instantiate ball, centered in middle of window GOval ball = initBall(window); // instantiate paddle, centered at bottom of window GRect paddle = initPaddle(window); // instantiate scoreboard, centered in middle of window, just above ball GLabel label = initScoreboard(window); // number of bricks initially int bricks = COLS * ROWS; // number of lives initially int lives = LIVES; // number of points initially int points = 0; // keep playing until game over double velocity_x = drand48() * 3; double velocity_y = 2.5; double x = getX(ball); double y = getY(ball); waitForClick(); while (lives > 0 && bricks > 0) { GEvent event = getNextEvent(MOUSE_EVENT); if (event != NULL) if(getEventType(event) == MOUSE_MOVED) { double x = getX(event) - getWidth(paddle) / 2; double y = 500; setLocation(paddle, x, y); } move(ball, velocity_x, velocity_y); if (getY(ball) + getHeight(ball) > getHeight(window)) { velocity_y = -velocity_y; } else if (getY(ball) <= 0) { velocity_y = -velocity_y; } else if (getX(ball) + getWidth(ball) > getWidth(window)) { velocity_x = -velocity_x; } else if (getX(ball) <= 0) { velocity_x = -velocity_x; } GObject object = detectCollision(window, ball); if (object == paddle) { velocity_y = -velocity_y; } if ((strcmp(getType(object), "GRect") == 0) && (object != paddle)) { points = points + 1; removeGWindow(window, object); velocity_y = -velocity_y; char s[12]; sprintf(s, "Score: %i", points); setLabel(label, s); } if (points == 50) { char s[12]; sprintf(s, "Well Done!"); setLabel(label, s); pause(10); break; } if (getY(ball) + 95 >= getHeight(window)) { lives = lives -1; removeGWindow(window, ball); waitForClick(); ball = initBall(window); char t[12]; sprintf(t, "Lives: %i", lives); setLabel(label, t); } if (lives == 0) { char s[12]; sprintf(s, "Score: %i", points); sprintf(s,"Nice try!"); setLabel(label, s); pause(20); break; } pause(10); } waitForClick(); pause(10); // game over closeGWindow(window); return 0; }
VSceneJumpEvent::VSceneJumpEvent( void ) : mTarget( String::EmptyString ) { setLabel( "SceneJumpEvent" ); }
void ofxUILabel::setFont(ofxUIFont *_font) { font = _font; setLabel(label); }
Axis::Axis( const Name name, const float value, const bool incremental ) : _name{ name }, _inc{ incremental } { setLabel( axisName() ); setValue( value ); }
Axis::Axis( const Name name, const uint8_t q, const Dir qdir ) : Field{ q, qdir }, _name{ name }, _inc{ false } { setLabel( axisName() ); }
Axis::Axis( const Name name, const float value ) : _name{ name }, _inc{ false } { setLabel( axisName() ); setValue( value ); }
Axis::Axis() : _name{ Name::X }, _inc{ false } { setLabel( axisName() ); }
void Altimeter::setUnit(DistanceUnit unit) { units = unit; setLabel(Units::unitName(units)); repaintPixmap(); }
//============================================================================= Object::Object(const char* label_in, int tracebackModeIn) : label_(0) { setLabel(label_in); tracebackMode = (tracebackModeIn != -1) ? tracebackModeIn : tracebackMode; }
LMPacket LMHandler::handle( cv::Point2f borderPoints[ 3 ] , MazeData mazeData , bool debugMode ) { if( debugMode ) { std::cout << std::endl ; std::cout << "<!---------------------------------------------" ; std::cout << std::endl ; std::cout << "LMHandler.handle() called. handling..." ; std::cout << std::endl ; } if ( IsNull( mazeData ) ) { std::cerr << "LMHandler: mazeData of type MazeData is Null" ; std::cerr << std::endl ; return LMPacketNull ; } if ( !mazeData.image.data ) { std::cerr << "LMHandler: No mazeImage data!" ; std::cerr << std::endl ; return LMPacketNull ; } // Declare local variables cv::Mat annotatedImage ; cv::Mat processingImage ; cv::Point2f startLocation ; cv::Point2f endLocation ; cv::Point2f ballLocation ; cv::Point2f centerLocation ; cv::Point2f criticalPoints[ 6 ] ; float criticalAngles[ 6 ] ; float zeroAngle ; float ballAngle ; int sextantIndex ; float scalingArray[ 5 ] ; float normalizedBallAngle ; // our guy! std::vector< std::vector< cv::Point > > contours ; std::vector< std::vector< cv::Point > > approxContours ; std::vector< cv::Vec4i > hierarchy ; //std::vector< cv::Point > boundingTriangleVertices ; int boundingTriangleIndex ; // Initialize local variables annotatedImage = mazeData.image.clone( ) ; startLocation = mazeData.mazePoints[ 0 ] ; endLocation = mazeData.mazePoints[ 1 ] ; ballLocation = mazeData.mazePoints[ 2 ] ; centerLocation = startLocation ; criticalPoints[ 0 ] = borderPoints[ 0 ] ; // one end of upos criticalPoints[ 2 ] = borderPoints[ 1 ] ; // one end of vpos criticalPoints[ 4 ] = borderPoints[ 2 ] ; // one end of wpos criticalPoints[ 1 ] = findMidPoint( criticalPoints[ 0 ] , criticalPoints[ 2 ] ); // one end of wneg criticalPoints[ 3 ] = findMidPoint( criticalPoints[ 2 ] , criticalPoints[ 4 ] ); // one end of uneg criticalPoints[ 5 ] = findMidPoint( criticalPoints[ 0 ] , criticalPoints[ 4 ] ); // one end of vneg for ( int i = 0 ; i < 6 ; i++ ) { std::stringstream ss; ss << std::to_string( i ) << std::fixed << std::setprecision( 0 ) << "("; ss << criticalPoints[ i ].x << "," << criticalPoints[ i ].y << ")"; std::string label = ss.str(); /* std::string label ; label.assign( std::to_string( i ) ); label += "- ( "; label += std::to_string( criticalPoints[ i ].x ); label += " , "; label += std::to_string( criticalPoints[ i ].y ); label += " )"; */ setLabel( annotatedImage , label , criticalPoints[ i ] ) ; // start } /* setLabel( annotatedImage , "0" , criticalPoints[ 0 ] ) ; // start setLabel( annotatedImage , "1" , criticalPoints[ 1 ] ) ; // start setLabel( annotatedImage , "2" , criticalPoints[ 2 ] ) ; // start setLabel( annotatedImage , "3" , criticalPoints[ 3 ] ) ; // start setLabel( annotatedImage , "4" , criticalPoints[ 4 ] ) ; // start setLabel( annotatedImage , "5" , criticalPoints[ 5 ] ) ; // start */ // Draw a line in between S & B cv::line( annotatedImage , centerLocation , criticalPoints[ 0 ] , CV_RGB ( 0 , 255 , 255 ) , 1 ) ; cv::line( annotatedImage , centerLocation , criticalPoints[ 1 ] , CV_RGB ( 0 , 255 , 255 ) , 1 ) ; cv::line( annotatedImage , centerLocation , criticalPoints[ 2 ] , CV_RGB ( 0 , 255 , 255 ) , 1 ) ; cv::line( annotatedImage , centerLocation , criticalPoints[ 3 ] , CV_RGB ( 0 , 255 , 255 ) , 1 ) ; cv::line( annotatedImage , centerLocation , criticalPoints[ 4 ] , CV_RGB ( 0 , 255 , 255 ) , 1 ) ; cv::line( annotatedImage , centerLocation , criticalPoints[ 5 ] , CV_RGB ( 0 , 255 , 255 ) , 1 ) ; ballAngle = findRelativeAngle( centerLocation, ballLocation); if( debugMode ) { std::cout << "Critical points importing complete. " ; std::cout << std::endl; std::cout << "Critical points:"; std::cout << std::endl; for( int i = 0 ; i < 6 ; i++ ) { std::cout << "[ " << i << " ] : "; std::cout << criticalPoints[ i ]; std::cout << std::endl; } std::cout << "Ball angle:"; std::cout << ballAngle << std::endl; } if( debugMode ) { std::cout << "Calculating critical angles. " ; std::cout << std::endl; } criticalAngles[ 0 ] = findRelativeAngle( centerLocation, criticalPoints[ 0 ]); // upos criticalAngles[ 1 ] = findRelativeAngle( centerLocation, criticalPoints[ 1 ]); // wneg criticalAngles[ 2 ] = findRelativeAngle( centerLocation, criticalPoints[ 2 ]); // vpos criticalAngles[ 3 ] = findRelativeAngle( centerLocation, criticalPoints[ 3 ]); // uneg criticalAngles[ 4 ] = findRelativeAngle( centerLocation, criticalPoints[ 4 ]); // wpos criticalAngles[ 5 ] = findRelativeAngle( centerLocation, criticalPoints[ 5 ]); // vneg zeroAngle = criticalAngles[ 0 ]; // uneg is our zero if( debugMode ) { std::cout << "Calculating critical angles complete. " ; std::cout << std::endl; std::cout << "Critical angles:"; std::cout << std::endl; for( int i = 0 ; i < 6 ; i++ ) { std::cout << "[ " << i << " ] : "; std::cout << criticalAngles[ i ]; std::cout << std::endl; } std::cout << "Zero angle: "; std::cout << zeroAngle; std::cout << std::endl; } if( debugMode ) { std::cout << "Finding sextant index. " ; std::cout << std::endl; } sextantIndex = -1 ; for( int i = 0 ; i < 6 ; i++ ) { if( ballAngle >= criticalAngles[ i ] ) { sextantIndex = i ; } } if( sextantIndex == -1 ) { std::cerr << "LMHandler: sextantIndex estimation failed" ; std::cerr << std::endl ; return LMPacketNull ; } if( debugMode ) { std::cout << "Finding sextant index complete. " ; std::cout << std::endl; std::cout << "Sextant index: "; std::cout << sextantIndex; std::cout << std::endl; } if( debugMode ) { std::cout << "Updating critical angles. " ; std::cout << std::endl; } for( int i = 0 ; i < 6 ; i++) { criticalAngles[ i ] -= zeroAngle ; criticalAngles[ i ] = ( criticalAngles[ i ] >= 0 ? 0 : 360 ) + criticalAngles[ i ]; } ballAngle -= zeroAngle ; ballAngle = ( ballAngle >= 0 ? 0 : 360 ) + ballAngle; if( debugMode ) { std::cout << "Updating critical angles complete. " ; std::cout << std::endl; std::cout << "Updated critical angles:"; std::cout << std::endl; for( int i = 0 ; i < 6 ; i++ ) { std::cout << "[ " << i << " ] : "; std::cout << criticalAngles[ i ]; std::cout << std::endl; } } if( debugMode ) { std::cout << "Finding scaling parameters. " ; std::cout << std::endl; } for( int i = 0; i < 6; i++ ) { scalingArray[ i ] = 60 / ( criticalAngles[ (i + 1) % 6 ] - criticalAngles[ i ] ) ; } if( debugMode ) { std::cout << "Finding scaling parameters complete. " ; std::cout << std::endl; std::cout << "Scaling parameters:"; std::cout << std::endl; for( int i = 0 ; i < 5 ; i++ ) { std::cout << "[ " << i << " ] : "; std::cout << scalingArray[ i ]; std::cout << std::endl; } } if( debugMode ) { std::cout << "Finding normalized ball angle. " ; std::cout << std::endl; } normalizedBallAngle = sextantIndex * 60 + ( ballAngle - criticalAngles[ sextantIndex ] ) * scalingArray[ sextantIndex ]; if( debugMode ) { std::cout << "Finding normalized ball angle complete. " ; std::cout << std::endl; std::cout << "Ball angle: "; std::cout << ballAngle; std::cout << std::endl; std::cout << "Normalized ball angle: "; std::cout << normalizedBallAngle; std::cout << std::endl; } if( normalizedBallAngle < 0 || normalizedBallAngle > 360 ) { std::cerr << "LMHandler: normalizedBallAngle is out of bounds!" ; std::cerr << std::endl ; return LMPacketNull ; } extractContours( mazeData.image , processingImage , contours, approxContours, hierarchy ); if( debugMode ) { std::cout << "Contour extraction complete. Number of approx. contours found: " ; std::cout << approxContours.size() ; std::cout << std::endl; } /* boundingTriangleIndex = findBoundingTriangle( approxContours ) ; if( boundingTriangleIndex == -1 ) { return LMPacketNull; } if( debugMode ) { std::cout << "The bounding triangle found at index: " ; std::cout << std::to_string( boundingTriangleIndex ) ; std::cout << std::endl; std::cout << "The related hierarchy record: " ; std::cout << hierarchy[ boundingTriangleIndex ] ; std::cout << std::endl; std::cout << "The child record: " ; std::cout << hierarchy[ boundingTriangleIndex ][ 2 ] ; std::cout << std::endl; } // Annote all vertices of the approximation curve vector and extract the vertices for( std::vector< cv::Point >::size_type i = 0 ; i != 3 ; i++ ) { setLabel( annotatedImage , "V" , approxContours[ boundingTriangleIndex ] ); } */ /* // Annote all vertices of the approximation curve vector and extract the vertices // hierarchy[i][2] -> first child int mazeBoundIndex = hierarchy[ boundingTriangleIndex ][ 2 ]; for( std::vector< cv::Point >::size_type i = 0 ; i != 3 ; i++ ) { setLabel( annotatedImage , "M" , approxContours[ mazeBoundIndex ] ); } */ cv::Mat dummyImage ; // Delete everything outside the triangle cv::Mat mask = cv::Mat::zeros( processingImage.size( ) , CV_8UC1 ); //std::vector< std::vector< cv::Point > > dummyContours ; //dummyContours.push_back( contours ); //cv::drawContours( mask , contours , -1 , cv::Scalar( 255 ) , CV_FILLED ); cv::drawContours( mask , contours , -1 , cv::Scalar( 255 ) , CV_FILLED ); if( debugMode ) { std::cout << "Search for contours is complete. Displaying the results:" ; std::cout << std::endl; showImage( "LM-mask" , mask ); } processingImage.copyTo( dummyImage , mask ) ; processingImage = dummyImage.clone( ) ; //processingImage.copyTo( processingImage , mask ) ; //annotatedImage.copyTo( dummyImage , mask ) ; //annotatedImage = dummyImage.clone( ) ; //setLabel( annotatedImage , "0" , contours[ 0 ] ) ; if( debugMode ) { std::cout << "Masking complete. Displaying the results:" ; std::cout << std::endl; showImage( "LM-maskedProcessingImage" , processingImage ); } //ballLocation centerocation if( debugMode ) { //std::cout << "Search for contours is complete. Displaying the results:" ; //std::cout << std::endl; /* displayContours( "LM-Contours on processingImage" , processingImage.clone() , contours , hierarchy , // approxContours false , true ); // true ); // for enumeration , for contour only mode */ /* displayContours( "LM-Contours on mazeImage" , mazeData.image.clone() , contours , hierarchy , // approxContours false , false ); */ /* displayContours( "LM-approxContours on processingImage" , processingImage.clone() , approxContours , hierarchy , // approxContours false , true ); // true ); // for enumeration , for contour only mode displayContours( "LM-approxContours on mazeImage" , mazeData.image.clone() , approxContours , hierarchy , // approxContours false , false ); */ } //slope = startLocation.y - ballLocation //Point2f a(0.3f, 0.f), b(0.f, 0.4f); //Point pt = (a + b)*10.f; // Label the annotatedImage setLabel( annotatedImage , "S" , centerLocation ) ; // start setLabel( annotatedImage , "E" , endLocation ) ; // end setLabel( annotatedImage , "B" , ballLocation ) ; // ball // Draw a line in between S & B cv::line( annotatedImage , centerLocation , ballLocation , CV_RGB ( 0 , 255 , 255 ) , 1 ) ; //double radius = cv::norm( startLocation - ballLocation ) ;//Euclidian distance //cv::circle( annotatedImage, startLocation, radius, CV_RGB ( 0 , 255 , 0 ) , 1 ) ; if( debugMode ) { std::cout << "Annotating feature points and drawing line complete." ; std::cout << std::endl; } /* CountNonZero(bitwise_and(ShapeAImage,ShapeBImage)). */ //////////////////////////////////////////////////////// /////////////////////// EXPORTING ////////////////////// //////////////////////////////////////////////////////// // Export private variables this -> annotatedImage = annotatedImage.clone( ) ; // Exporting state variables state.ballLocationData.wayBlocked[ 0 ] = false ; state.ballLocationData.wayBlocked[ 1 ] = false ; state.ballLocationData.wayBlocked[ 2 ] = false ; state.ballLocationData.wayBlocked[ 3 ] = false ; state.ballLocationData.currentPathNo = 5 ; state.ballPositionAngle = normalizedBallAngle ; //////////////////////////////////////////////////////// ////////////////// EXPORTING COMPLETE ////////////////// //////////////////////////////////////////////////////// if( debugMode ) { std::cout << "State exporting complete." ; std::cout << std::endl; std::cout << "---------------------------------------------->"; std::cout << std::endl; std::cout << std::endl; } return state; }
//============================================================================= Object::Object(const Object& Obj) : label_(0) { setLabel(Obj.label()); }
VPostEffectToggleTrack::VPostEffectToggleTrack( void ) : mPostEffect( NULL ) { setLabel( "PostEffectTrack" ); }
ToolBar::ToolBar(Slag* slag) : slag(slag), pattern_box(new QComboBox) { setLabel(tr("Playback controls")); // Play button QAction* play_action = new QAction(this); play_action->setAccel( Qt::Key_Space ); play_action->setIconSet( QPixmap(":/icons/play.png") ); addAction(play_action); connect(play_action, SIGNAL(activated()), slag, SLOT(play())); // Stop button QAction* stop_action = new QAction(this); stop_action->setAccel( Qt::Key_Space ); stop_action->setIconSet( QPixmap(":/icons/stop.png") ); addAction(stop_action); connect(stop_action, SIGNAL(activated()), slag, SLOT(stop())); // Pattern choice box addSeparator(); pattern_box->setMinimumWidth(100); addWidget(pattern_box); connect(pattern_box, SIGNAL(activated(const QString &)), slag, SLOT(patternChange(const QString &))); // Play mode: pattern or song QButtonGroup* mode_group = new QButtonGroup; mode_group->setExclusive(true); //mode_group->setLineWidth(0); //mode_group->setInsideMargin(2); pattern_mode_radio = new QRadioButton; pattern_mode_radio->setText(tr("Pattern")); mode_group->addButton(pattern_mode_radio); connect(pattern_mode_radio, SIGNAL(clicked()), slag, SLOT(setPatternMode())); addWidget(pattern_mode_radio); song_mode_radio = new QRadioButton; song_mode_radio->setText(tr("Song")); mode_group->addButton(song_mode_radio); connect(song_mode_radio, SIGNAL(clicked()), slag, SLOT(setSongMode())); addWidget(song_mode_radio); QCheckBox* loopCheckBox = new QCheckBox(tr("Loop")); loopCheckBox->setCheckState(Qt::Checked); connect(loopCheckBox, SIGNAL(stateChanged(int)), slag, SLOT(setLoopMode(int))); addWidget(loopCheckBox); // Tempo box addSeparator(); tempoControl = new SpinSlider( tr( "<font size=\"-1\">BPM:</font>" ) ); tempoControl->setMinimum(20); tempoControl->setMaximum(300); tempoControl->setValue(slag->song()->tempo()); connect(tempoControl, SIGNAL(valueChanged(int)), slag, SLOT(setTempo(int))); addWidget(tempoControl); // Volume box volumeControl = new SpinSlider(tr( "<font size=\"-1\">Vol:</font>" ) ); volumeControl->setValue(slag->song()->volumePercent()); connect(volumeControl, SIGNAL(valueChanged(int)), slag, SLOT(setVolume(int))); addWidget(volumeControl); }
VSceneJumpTrack::VSceneJumpTrack( void ) { setLabel( "SceneJumpTrack" ); }
void PlotZozMarker::setFont(const QFont Font) { QwtText qwttMark(label()); qwttMark.setFont(Font); setLabel(qwttMark); }
ContactCluster::ContactCluster(QWidget* pParent, const char* pName) : VirtualCluster(pParent, pName) { addNumberWidget(new ContactClusterLineEdit(this, pName)); _crmAcctId = -1; _minLayout = true; _fname = new QStringList(); for (int i = 0; i < 5; ++i) _fname->append(""); _name->setVisible(false); _description->setVisible(true); QSpacerItem* _cntctSpacer = new QSpacerItem(15, 3,QSizePolicy::Fixed,QSizePolicy::Fixed); _grid->addItem(_cntctSpacer, 1, 1, 1, 1); _grid->removeWidget(_description); _grid->removeWidget(_name); _grid->setVerticalSpacing(0); setLabel(tr("Name:")); _titleLit = new QLabel(tr("Title:"),this); _phoneLit = new QLabel(tr("Phone:"),this); _phone2Lit = new QLabel(tr("Alternate:"),this); _faxLit = new QLabel(tr("Fax:"),this); _emailLit = new QLabel(tr("Email:"),this); _webaddrLit = new QLabel(tr("Web:"),this); _phone = new QLabel(this); _phone2 = new QLabel(this); _fax = new QLabel(this); _email = new XURLLabel(this); _webaddr = new XURLLabel(this); _addr = new QLabel(this); _titleLit->setObjectName("_titleLit"); _phoneLit->setObjectName("_phoneLit"); _phone2Lit->setObjectName("_phone2Lit"); _faxLit->setObjectName("_faxLit"); _emailLit->setObjectName("_emailLit"); _webaddrLit->setObjectName("_webaddrLit"); _phone->setObjectName("_phone"); _phone2->setObjectName("_phone2"); _fax->setObjectName("_fax"); _email->setObjectName("_email"); _webaddr->setObjectName("_webaddr"); _addr->setObjectName("_addr"); _phone->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Preferred); _description->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Preferred); _addr->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Preferred); _titleLit->setAlignment(Qt::AlignRight); _phoneLit->setAlignment(Qt::AlignRight); _phone2Lit->setAlignment(Qt::AlignRight); _faxLit->setAlignment(Qt::AlignRight); _emailLit->setAlignment(Qt::AlignRight); _webaddrLit->setAlignment(Qt::AlignRight); _addrLayout = new QVBoxLayout; QSpacerItem* _addrSpacer = new QSpacerItem(20,0,QSizePolicy::Preferred,QSizePolicy::Expanding); _addrLayout->addWidget(_addr); _addrLayout->addSpacerItem(_addrSpacer); connect(this, SIGNAL(valid(bool)), this, SLOT(populate())); connect(_email, SIGNAL(leftClickedURL(QString)), this, SLOT(openUrl(QString))); connect(_webaddr, SIGNAL(leftClickedURL(QString)), this, SLOT(openUrl(QString))); connect(this, SIGNAL(newId(int)), this, SIGNAL(changed())); setMinimalLayout(false); }
void GLabel::setText(const std::string& str) { setLabel(str); }
void SelectionPointer::handleDrawerChange() { m_cachedTheme = m_drawer->theme(); setLabel(m_label, true); }
Brightness(const ChannelID &id) : SliderSetting(this, 0, 65535, 655), ChannelDBStorage(this, id, "brightness") { setLabel(QObject::tr("Brightness")); }
CLabel::CLabel (CRect &size, char *text): CParamDisplay (size) { strcpy (label, ""); setLabel (text); }
Colour(const ChannelID &id) : SliderSetting(this, 0, 65535, 655), ChannelDBStorage(this, id, "colour") { setLabel(QObject::tr("Color")); }
//============================================================================= Object::Object(int tracebackModeIn) : label_(0) { setLabel("Teuchos::Object"); tracebackMode = (tracebackModeIn != -1) ? tracebackModeIn : tracebackMode; }
Channum(const ChannelID &id) : LineEditSetting(this), ChannelDBStorage(this, id, "channum") { setLabel(QObject::tr("Channel Number")); }
void DlgUpdate::beginUpdateCheck() { progress->setMinimum(0); progress->setMaximum(0); setLabel("Checking for updates..."); uChecker->check(); }