void LookAlikeMainPrivate::onProposedContactPersonSelected(const QString &personId, const QString &displayName) { m_personSelected = personId; if (m_personSelected == UNKNOWN_CONTACT) { updateGrid(displayName); } else { updateGrid(displayName, m_confirmFaceAction); } updateUrnImages(m_faceDatabaseProvider->getRegions(m_personSelected)); m_trackerProvider->setContentType(TrackerContentProvider::ListImages); updateTrackerFilter(); showPage(m_gridPage, true); }
void GridWidget::searchCountry(QString text) { for (CountryWidget* widget : originalWidgets) { widget->setVisible(false); } countryWidgets.clear(); if (text.isEmpty()) { for (CountryWidget* widget : originalWidgets) { widget->setVisible(true); countryWidgets.append(widget); } } else { for (CountryWidget* widget : originalWidgets) { if (widget->getName().contains(text, Qt::CaseInsensitive) || widget->getNameEn().contains(text, Qt::CaseInsensitive)) { widget->setVisible(true); countryWidgets.append(widget); } } } updateGrid(); }
int main() { int grid[WIDTH][HEIGHT]; int next[WIDTH][HEIGHT]; for (int i = 0; i < WIDTH; i++) { for (int j = 0; j < HEIGHT; j++) { grid[i][j] = 0; next[i][j] = 0; } } init(grid); printGrid(grid); printf("Please press Enter to get the next generation"); while(1) { char c = getchar(); if (c == '\n') { updateGrid(grid, next); printGrid(next); memcpy(grid, next, sizeof(int)*WIDTH*HEIGHT); } } }
void ccVolumeCalcTool::updateGridAndDisplay() { bool success = updateGrid(); if (success && m_glWindow) { //convert grid to point cloud if (m_rasterCloud) { m_glWindow->removeFromOwnDB(m_rasterCloud); delete m_rasterCloud; m_rasterCloud = 0; } m_rasterCloud = convertGridToCloud(false); if (m_rasterCloud) { m_glWindow->addToOwnDB(m_rasterCloud); ccBBox box = m_rasterCloud->getDisplayBB_recursive(false, m_glWindow); update2DDisplayZoom(box); } else { ccLog::Error("Not enough memory!"); m_glWindow->redraw(); } } gridIsUpToDate(success); }
int main() { int select; int err=1; /* array of grid members */ GridMember** memberList; memberList = createGridList(); /* setting random generator */ srand(time(NULL)); /* create game grid members */ while(err) { /* clear screen and always show title */ displayTitle(); /* config game options */ configGame(&select); err = createGridMembers(memberList, select); } /* enter game loop */ while(1) { /* clear screen and always show title */ displayTitle(); /* show game grid */ showGrid(memberList); /* count neighbours */ countNeighbours(memberList); /* update status */ updateGrid(memberList); /* time tick */ timeTick(); } displayEnd(); freeGridList(memberList); return 0; }
Grid3DOverlay::Grid3DOverlay(const Grid3DOverlay* grid3DOverlay) : Planar3DOverlay(grid3DOverlay), _majorGridEvery(grid3DOverlay->_majorGridEvery), _minorGridEvery(grid3DOverlay->_minorGridEvery) { updateGrid(); }
/*! \property QGridView::numRows \brief The number of rows in the grid \sa numCols */ void QGridView::setNumRows( int numRows ) { int oldnrows = nrows; nrows = numRows; dimensionChange( oldnrows, ncols ); updateGrid(); }
void Quad::onUpdate(float dt) { RenderObject::onUpdate(dt); if (autoWidth == AUTO_VIRTUALWIDTH) width = core->getVirtualWidth(); else if (autoWidth == AUTO_VIRTUALHEIGHT) width = core->getVirtualHeight(); if (autoHeight == AUTO_VIRTUALWIDTH) height = core->getVirtualWidth(); else if (autoHeight == AUTO_VIRTUALHEIGHT) height = core->getVirtualHeight(); refreshRepeatTextureToFill(); lowerRightTextureCoordinates.update(dt); upperLeftTextureCoordinates.update(dt); if (drawGrid && alpha.x > 0 && alphaMod > 0) { updateGrid(dt); } }
int PCBNEW_CONTROL::GridFast2( const TOOL_EVENT& aEvent ) { m_frame->SetFastGrid2(); updateGrid(); return 0; }
/////////////////////////////////////////////////////////////////////////////// // Verlet integration /////////////////////////////////////////////////////////////////////////////// void PARTICLE_SYSTEM::stepVerlet(float dt) { calculateAcceleration(); for (unsigned int gridCellIndex = 0; gridCellIndex < (*grid).cellCount(); gridCellIndex++) { vector<PARTICLE>& particles = (*grid).data()[gridCellIndex]; for (unsigned int p = 0; p < particles.size(); p++) { PARTICLE& particle = particles[p]; vec3 newPosition = particle.position() + particle.velocity()*dt + particle.acceleration()*dt*dt; vec3 newVelocity = (newPosition - particle.position()) / dt; particle.position() = newPosition; particle.velocity() = newVelocity; } } if (scenario == SCENARIO_FAUCET && PARTICLE::count < MAX_PARTICLES) { generateFaucetParticleSet(); } updateGrid(); iteration++; }
int PCBNEW_CONTROL::GridNext( const TOOL_EVENT& aEvent ) { m_frame->SetNextGrid(); updateGrid(); return 0; }
int PCBNEW_CONTROL::GridPrev( const TOOL_EVENT& aEvent ) { m_frame->SetPrevGrid(); updateGrid(); return 0; }
void Terrain::drawValley(int x,int y) { int i,j,r=VALLEY_RAIUS; double dist, ca, alpha, h; for(i=y-r+1; i<y+r; i++) { for(j=x-r+1; j<x+r; j++) { if(i >= 0 && i < GRID_SIZE && j >= 0 && j < GRID_SIZE) { dist = sqrt(double(x-j) * (x-j) + (y-i)*(y-i) ); if(dist < r) { ca = dist/r; alpha = acos(ca); h = r * sin(alpha); h = (h/3); if(h > -5) { updateGrid(i,j, mGrid[i][j] - h); } } } } } mRoad->rebuild(); }
/*! \property QGridView::numCols \brief The number of columns in the grid \sa numRows */ void QGridView::setNumCols( int numCols ) { int oldncols = ncols; ncols = numCols; dimensionChange( nrows, oldncols ); updateGrid(); }
void GraphicsGridItem::setGrid(int rows, int columns, int verticalspacing, int horizontalspacing) { mRows = rows; mColumns = columns; mVSpacing = verticalspacing; mHSpacing = horizontalspacing; updateGrid(); }
int PCBNEW_CONTROL::GridPreset( const TOOL_EVENT& aEvent ) { long idx = aEvent.Parameter<long>(); m_frame->SetPresetGrid( idx ); updateGrid(); return 0; }
void TouchInputDevice::onEmuFunctionChanged() { m_converted = false; m_numPoints = 0; m_buttons = 0; m_mouseX = m_mouseY = 0; updateGrid(); updatePaintedButtons(); }
void LookAlikeMainPrivate::onAllTabActionToggled(bool toggled) { if (toggled) { m_personSelected = UNKNOWN_CONTACT; updateGrid(); m_trackerProvider->setContentType(TrackerContentProvider::AllImages); updateTrackerFilter(); showPage(m_gridPage); } }
//--------------------------------------------------------------------------- void __fastcall TForm1::includeButtonClick(TObject *Sender) { identifier* item = new identifier(); item->name = new AnsiString(Form1->identName->Text)->c_str(); item->attribute = Form1->identAttr->Text.ToInt(); include(item, table, 100); updateGrid(table, 100); identName->Text = "Имя"; identAttr->Text = "Аттрибут"; }
void ccVolumeCalcTool::updateGridAndDisplay() { bool success = updateGrid(); if (success && m_window) { //convert grid to point cloud if (m_rasterCloud) { m_window->removeFromOwnDB(m_rasterCloud); delete m_rasterCloud; m_rasterCloud = 0; } std::vector<ExportableFields> exportedFields; try { //we only compute the default 'height' layer exportedFields.push_back(PER_CELL_HEIGHT); m_rasterCloud = cc2Point5DimEditor::convertGridToCloud( exportedFields, false, false, false, 0, false, std::numeric_limits<double>::quiet_NaN()); if (m_rasterCloud && m_rasterCloud->hasScalarFields()) { m_rasterCloud->showSF(true); m_rasterCloud->setCurrentDisplayedScalarField(0); m_rasterCloud->getScalarField(0)->setName("Height above ground"); m_rasterCloud->showSFColorsScale(true); } } catch (const std::bad_alloc&) { //see below } if (m_rasterCloud) { m_window->addToOwnDB(m_rasterCloud); ccBBox box = m_rasterCloud->getDisplayBB_recursive(false,m_window); update2DDisplayZoom(box); } else { ccLog::Error("Not enough memory!"); m_window->redraw(); } } gridIsUpToDate(success); }
void LookAlikeMainPrivate::onLandscapeTabActionToggled(bool toggled) { if (toggled) { m_personSelected = UNKNOWN_CONTACT; updateGrid(); updateUrnImages(m_faceDatabaseProvider->getRegions()); m_trackerProvider->setContentType(TrackerContentProvider::FilterImagesNoFace); updateTrackerFilter(); showPage(m_gridPage); } }
void MonitorGraphicsView::setGridSize(QSize size) { m_gridSize = size; updateGrid(); QHashIterator <quint32, MonitorFixtureItem*> it(m_fixtures); while (it.hasNext() == true) { it.next(); updateFixture(it.key()); } }
void MonitorGraphicsView::resizeEvent(QResizeEvent *event) { QGraphicsView::resizeEvent(event); updateGrid(); QHashIterator <quint32, MonitorFixtureItem*> it(m_fixtures); while (it.hasNext() == true) { it.next(); updateFixture(it.key()); } }
int main (int argc, char* argv[]){ int nsteps = 2; int g1[WDEFAULT][HDEFAULT], g2[WDEFAULT][HDEFAULT]; for(int i = 0; i < WDEFAULT; i++) for(int j = 0; j < HDEFAULT; j++){ g1[i][j] = 0; g2[i][j] = 0; } const gsl_rng_type *T; gsl_rng *rand; gsl_rng_env_setup(); T = gsl_rng_default; rand = gsl_rng_alloc(T); gsl_rng_set(rand, get_seed_noblock()); randomInit(g1, 0.55, rand); printGrid(g1); updateGrid(g1,g2); printf("# updated \n"); printGrid(g2); for(int i = 0; i < nsteps; i++){ // blit g2 back into g1 memcpy(g1, g2, sizeof(int)*WDEFAULT*HDEFAULT); // now update g1 updateGrid(g1,g2); printGrid(g2); } gsl_rng_free(rand); return EXIT_SUCCESS; }
void CPIDCPDialog::OnBnClickedOpenCPBtn() { char szFilter[] = {"All Files (*.*)|*.*||"}; controlParameterVector.clear(); CFileDialog openDlg(TRUE, NULL, NULL, 0, szFilter); if (openDlg.DoModal() == IDOK) { CString fileName = openDlg.GetFileName(); controller->openControlParaFile(fileName, &controlParameterVector); // Update the grid updateGrid(&controlParameterVector); } }
void LookAlikeMainPrivate::onConfirmedContactSelected(const QString &personId, const QString &displayName) { m_personSelected = personId; updateGrid(displayName, m_deleteFaceAction); if (personId == EVERYBODY_CONTACT) { m_trackerProvider->setContact(QString()); } else { m_trackerProvider->setContact(personId); } m_trackerProvider->setContentType(TrackerContentProvider::WithContact); updateTrackerFilter(); showPage(m_gridPage, true); }
int GridModel::addGrid(Grid subcellsBegin, Grid subcellsEnd) { int i = size; this->core::CollisionModel::resize(size+1); elems.resize(size+1); //elems[i].subcells = std::make_pair(subcellsBegin, subcellsEnd); elems[i].subcells.first = subcellsBegin; elems[i].subcells.second = subcellsEnd; elems[i].children.first = core::CollisionElementIterator(); elems[i].children.second = core::CollisionElementIterator(); updateGrid(i); return i; }
void Element::update(float dt) { BBGE_PROF(Element_update); if (!core->particlesPaused) { updateLife(dt); updateEffects(dt); if (drawGrid) updateGrid(dt); } // updateCullVariables(); }
MonitorGraphicsView::MonitorGraphicsView(Doc *doc, QWidget *parent) : QGraphicsView(parent) , m_doc(doc) , m_unitValue(1000) , m_gridEnabled(true) , m_bgItem(NULL) { m_scene = new QGraphicsScene(); m_scene->setSceneRect(this->rect()); setScene(m_scene); m_gridSize = QSize(5, 5); updateGrid(); }
void ccRasterizeTool::updateGridAndDisplay() { bool activeLayerIsSF = activeLayerComboBox->currentIndex() != 0; bool interpolateSF = activeLayerIsSF || (getTypeOfSFInterpolation() != INVALID_PROJECTION_TYPE); bool success = updateGrid(interpolateSF); if (success && m_window) { //convert grid to point cloud if (m_rasterCloud) { m_window->removeFromOwnDB(m_rasterCloud); delete m_rasterCloud; m_rasterCloud = 0; } std::vector<ExportableFields> exportedFields; try { //we always compute the default 'height' layer exportedFields.push_back(PER_CELL_HEIGHT); //but we may also have to compute the 'original SF(s)' layer(s) QString activeLayerName = activeLayerComboBox->currentText(); m_rasterCloud = convertGridToCloud(exportedFields,activeLayerIsSF,activeLayerName); } catch (const std::bad_alloc&) { //see below } if (m_rasterCloud) { m_window->addToOwnDB(m_rasterCloud); ccBBox box = m_rasterCloud->getDisplayBB_recursive(false,m_window); update2DDisplayZoom(box); //update activeLayerChanged(activeLayerComboBox->currentIndex(),false); } else { ccLog::Error("Not enough memory!"); m_window->redraw(); } } gridIsUpToDate(success); }