Exemplo n.º 1
0
bool Q3DataBrowser::deleteCurrent()
{
    if (isReadOnly())
        return false;
    QSqlRecord* buf = d->frm.record();
    Q3SqlCursor* cur = d->cur.cursor();
    if (!buf || !cur)
        return false;
    writeFields();
    int n = cur->at();
    emit beforeDelete(buf);
    int ar = cur->del();
    if (ar) {
        refresh();
        updateBoundary();
        cursorChanged(Q3SqlCursor::Delete);
        if (!cur->seek(n))
            last();
        if (cur->isValid()) {
            cur->editBuffer(true);
            readFields();
        } else {
            clearValues();
        }
        return true;
    } else {
        if (!cur->isActive()) {
            handleError(cur->lastError());
            refresh();
            updateBoundary();
        }
    }
    return false;
}
Exemplo n.º 2
0
bool Q3DataBrowser::updateCurrent()
{
    if (isReadOnly())
        return false;
    QSqlRecord* buf = d->frm.record();
    Q3SqlCursor* cur = d->cur.cursor();
    if (!buf || !cur)
        return false;
    writeFields();
    emit beforeUpdate(buf);
    int ar = cur->update();
    if (!ar || !cur->isActive()) {
        handleError(cur->lastError());
        refresh();
        updateBoundary();
    } else {
        refresh();
        d->cur.findBuffer(cur->primaryIndex());
        updateBoundary();
        cur->editBuffer(true);
        cursorChanged(Q3SqlCursor::Update);
        readFields();
        return true;
    }
    return false;
}
double Advect3D::simulateAdvection(HaloArray3D *u, ProcGrid3D *g, double dtA) {
  timer->start("simulateAdvection", u->l.prod(), 0);
  double t = 0.0;  
  int s = 0;
  if (is2D()) // check that u, g have been set up appropriately
    assert (u->halo.z == 0  &&  u->l.z <= 1  &&  g->P.z == 1);
  while (t < dtA) {
    if (method == 0)
      updateGodunov(u);
    else if (method == 1)
      updateLW(u);
    else
      updateMacCormack(u);
    updateBoundary(u, g);

    t += dt; s++;
    if (verbosity > 3) {
      char s[64];
      sprintf(s, "after time %.4e, field is:\n", t);
      u->print(g->myrank, s);
    }
  }
  timer->stop("simulateAdvection");
  return t;
} //simulateAdvection()
Exemplo n.º 4
0
bool sageRect::isInRect(float x, float y) 
{
   updateBoundary();
   
   if (left <= x && right >= x && bottom <= y && top >= y)
      return true;
   else
      return false;
}   
Exemplo n.º 5
0
bool sageRect::isInRect(sageRect &rect) 
{
   updateBoundary();
   rect.updateBoundary();
   
   if (left <= rect.left && right >= rect.right && bottom <= rect.bottom && top >= rect.top)
      return true;
   else
      return false;
}
Exemplo n.º 6
0
void Q3DataBrowser::postNav(bool primeUpd)
{
    if (primeUpd) {
        QSqlRecord* buf = d->frm.record();
        Q3SqlCursor* cur = d->cur.cursor();
        if (!buf || !cur)
            return;
        currentChanged(cur);
        cur->primeUpdate();
        emit primeUpdate(buf);
        readFields();
    }
    updateBoundary();
}
Exemplo n.º 7
0
int sageMontage::init(sageRect &viewPort, sageRect &blockLayout, sageRotation orientation)
{
   texCoord = viewPort;
   texCoord.setOrientation(orientation);
   texInfo = blockLayout;
   texInfo.x = texInfo.y = 0;

   updateBoundary();
   //std::cout << "pt6");
   renewTexture();
   
   genTexCoord();
   //std::cerr << "gen tex coord " << texCoord.left << " " << texCoord.right << " " << texCoord.bottom << " " << texCoord.top << std::endl;   
   return 0;
}
Exemplo n.º 8
0
bool QDataBrowser::insertCurrent()
{
    if ( isReadOnly() )
	return FALSE;
    QSqlRecord* buf = d->frm.record();
    QSqlCursor* cur = d->cur.cursor();
    if ( !buf || !cur )
	return FALSE;
    writeFields();
    emit beforeInsert( buf );
    int ar = cur->insert();
    if ( !ar || !cur->isActive() ) {
	handleError( cur->lastError() );
	refresh();
	updateBoundary();
    } else {
	refresh();
	d->cur.findBuffer( cur->primaryIndex() );
	updateBoundary();
	cursorChanged( QSqlCursor::Insert );
	return TRUE;
    }
    return FALSE;
}