void EdLevelPropertyColorField::doReadParams(void) { blockSignals(true); keyButton()->disconnect(); // Has Key if (_data->plug()) { keyButton()->setIcon(QIcon(":/images/key.png")); connect( keyButton(), SIGNAL(pressed()), this, SLOT(doKeyframePressed()) ); } else { keyButton()->setIcon(QIcon(":/images/blank.png")); } // Has Input if (_data->plug() && _data->plug()->has_incoming_connection()) { hasInputButton()->setIcon(QIcon(":/images/has_input.png")); } else { hasInputButton()->setIcon(QIcon(":/images/blank.png")); } // Has Output if (_data->plug() && _data->plug()->has_outgoing_connection()) { hasOutputButton()->setIcon(QIcon(":/images/has_output.png")); } else { hasOutputButton()->setIcon(QIcon(":/images/blank.png")); } TextBufferStream stream; _data->value(stream); Color4f val; stream >> val; Color4b val_b(val); _r->setValue(val_b.r_as_byte()); _g->setValue(val_b.g_as_byte()); _b->setValue(val_b.b_as_byte()); _a->setValue(val_b.a_as_byte()); _r2->setText( MoreStrings::cast_to_string(val.r_as_float()).c_str() ); _g2->setText( MoreStrings::cast_to_string(val.g_as_float()).c_str() ); _b2->setText( MoreStrings::cast_to_string(val.b_as_float()).c_str() ); _a2->setText( MoreStrings::cast_to_string(val.a_as_float()).c_str() ); doColorChange(0); blockSignals(false); }
void MONEEWorldObserver::step() { int xa, ya, xb, yb, xo, yo, ds; // std::vector<RobotAgentPtr>* agents = _world->listAgents(); // Please use _world->getAgent instead of this. for (int i = 0; i < gAgentCounter - 1; i++) { for (int j = i + 1; j < gAgentCounter; j++) { _world->getAgent(i)->getCoord(xa, ya); _world->getAgent(j)->getCoord(xb, yb); xo = xb - xa; yo = yb - ya; ds = xo * xo + yo * yo; gDistSquared[i * gAgentCounter + j] = ds;//gDistSquared[j * gAgentCounter + i] = ds; gBoolRadioNetworkArray[i * gAgentCounter + j] = (ds <= gMaxCommDistSquared);//gRadioNetworkArray[j * gAgentCounter + i] = (ds <= gMaxCommDistSquared); } } int iteration = _world->getIterations(); if (iteration == _colorChangeIteration) { doColorChange(); } if (iteration % 1000 == 0) { double progress = (double)iteration / (double)gMaxIt * 100.0; std::cout << std::endl << "##########" << std::endl << "# "; std::cout.width(5); std::cout.precision(1); std::cout << std::fixed << progress; std::cout << "% #" << std::endl << "##########" << std::endl << std::endl; } if (_world->getIterations() == gMaxIt - 1) { printf("Took %d ms.\n", timer->get_ticks()); } }