Beispiel #1
0
DialogMBR::DialogMBR(QWidget *parent)
{
QStringList filters;
	setupUi(this); // this sets up GUI
        connect( bt_end, SIGNAL( clicked() ), this, SLOT(close()));
        connect( bt_save, SIGNAL( clicked() ), this, SLOT(mbr()));
        connect( bt_dummy, SIGNAL( clicked() ), this, SLOT(disk_art()));
        dirModel = new QFileSystemModel;
   	selModel = new QItemSelectionModel(dirModel);
   	treeView->setModel(dirModel);
   	treeView->setSelectionModel(selModel);
   	QModelIndex cwdIndex = dirModel->index(QDir::rootPath());
        dirModel->setRootPath(QDir::rootPath());
   	treeView->setRootIndex(cwdIndex);
   	disk_exist();
        if (dialog_auswertung == 4){
            bt_save->setText (tr("MBR/GPT save", "MBR/GPT sichern"));
            dirModel->setFilter(QDir::AllDirs  | QDir::NoDotAndDotDot);
   	    dirModel->setNameFilters(filters); 
            } 
        if (dialog_auswertung == 5){
            bt_save->setText (tr("MBR/GPT restore", "MBR/GPT zurückschreiben"));  
	    filters << "*_gpt_sd*" << "*_mbr_sd*" ;
   	    dirModel->setFilter(QDir::AllDirs | QDir::Files | QDir::NoDotAndDotDot);
   	    dirModel->setNameFilters(filters);  
            }
         disk_art();
}
QString QgsSpatiaLiteFeatureIterator::whereClauseRect()
{
  QgsRectangle rect = mRequest.filterRect();
  QString whereClause;

  if ( mRequest.flags() & QgsFeatureRequest::ExactIntersect )
  {
    // we are requested to evaluate a true INTERSECT relationship
    whereClause += QString( "Intersects(%1, BuildMbr(%2)) AND " ).arg( QgsSpatiaLiteProvider::quotedIdentifier( mSource->mGeometryColumn ), mbr( rect ) );
  }
  if ( mSource->mVShapeBased )
  {
    // handling a VirtualShape layer
    whereClause += QString( "MbrIntersects(%1, BuildMbr(%2))" ).arg( QgsSpatiaLiteProvider::quotedIdentifier( mSource->mGeometryColumn ), mbr( rect ) );
  }
  else if ( rect.isFinite() )
  {
    if ( mSource->spatialIndexRTree )
    {
      // using the RTree spatial index
      QString mbrFilter = QString( "xmin <= %1 AND " ).arg( qgsDoubleToString( rect.xMaximum() ) );
      mbrFilter += QString( "xmax >= %1 AND " ).arg( qgsDoubleToString( rect.xMinimum() ) );
      mbrFilter += QString( "ymin <= %1 AND " ).arg( qgsDoubleToString( rect.yMaximum() ) );
      mbrFilter += QString( "ymax >= %1" ).arg( qgsDoubleToString( rect.yMinimum() ) );
      QString idxName = QString( "idx_%1_%2" ).arg( mSource->mIndexTable, mSource->mIndexGeometry );
      whereClause += QString( "%1 IN (SELECT pkid FROM %2 WHERE %3)" )
                     .arg( quotedPrimaryKey(),
                           QgsSpatiaLiteProvider::quotedIdentifier( idxName ),
                           mbrFilter );
    }
    else if ( mSource->spatialIndexMbrCache )
    {
      // using the MbrCache spatial index
      QString idxName = QString( "cache_%1_%2" ).arg( mSource->mIndexTable, mSource->mIndexGeometry );
      whereClause += QString( "%1 IN (SELECT rowid FROM %2 WHERE mbr = FilterMbrIntersects(%3))" )
                     .arg( quotedPrimaryKey(),
                           QgsSpatiaLiteProvider::quotedIdentifier( idxName ),
                           mbr( rect ) );
    }
    else
    {
      // using simple MBR filtering
      whereClause += QString( "MbrIntersects(%1, BuildMbr(%2))" ).arg( QgsSpatiaLiteProvider::quotedIdentifier( mSource->mGeometryColumn ), mbr( rect ) );
    }
  }
  else
  {
    whereClause = "1";
  }
  return whereClause;
}
Beispiel #3
0
TEST(Varint, Interface) {
  // Make sure decodeVarint() accepts all of StringPiece, MutableStringPiece,
  // ByteRange, and MutableByteRange.
  char c = 0;

  StringPiece sp(&c, 1);
  EXPECT_EQ(decodeVarint(sp), 0);

  MutableStringPiece msp(&c, 1);
  EXPECT_EQ(decodeVarint(msp), 0);

  ByteRange br(reinterpret_cast<unsigned char*>(&c), 1);
  EXPECT_EQ(decodeVarint(br), 0);

  MutableByteRange mbr(reinterpret_cast<unsigned char*>(&c), 1);
  EXPECT_EQ(decodeVarint(mbr), 0);
}
void UsrGlblMgrEditDialog::Save()
{
    wxString path(cSets + m_CurrentSet + _T('/') + m_CurrentVar + _T('/'));
    wxString mbr(_T('#') + m_CurrentVar + _T('.'));

    m_CfgMan->DeleteSubPath(path);

    wxString s, t;
    for (unsigned int i = 0; i < builtinMembers.GetCount(); ++i)
    {
        t = ((wxTextCtrl*) FindWindow(builtinMembers[i]))->GetValue();

        if (   i == 0
            && (   (   !m_CurrentVar.IsEmpty()
                    && t.IsEmpty() )
                || t.Contains(_T('#') + m_CurrentVar) ) )
        {
            if (cbMessageBox(_("Are you sure you want to save an invalid global variable?"), _("Global variables"),
                             wxYES_NO | wxICON_QUESTION) == wxID_YES)
            {
                t.assign(_T("(invalid)"));
            }
        }

        if (t.Contains(mbr + builtinMembers[i]))
            t.assign(_T("(invalid)"));

        if (!t.IsEmpty())
            m_CfgMan->Write(path + builtinMembers[i], t);
    }

    for (unsigned int i = 0; i < 7; ++i)
    {
        s = m_Name[i]->GetValue();
        t = m_Value[i]->GetValue();

        if (t.Contains(mbr + s))
            t.assign(_T("(invalid)"));

        if (!s.IsEmpty() && !t.IsEmpty())
            m_CfgMan->Write(path + s, t);
    }
}
Beispiel #5
0
void anti_restr_fnc(lv,le,lq,newlv,newle)
{register int i,v ;
  itr(lv,i,v,if( mbr(lq,v)==FALSE ){
               psh(newlv,v);
               psh(newle,val(le,i));
            });
Beispiel #6
0
    void Polygon::push(const Ring &v, int beg, bool within)
    {
        int sz = v.size();
        double coords[2];

        mbr(v.xa(), v.ya(), v.xb(), v.yb());

        int f = 0, offset = 0;
        bool turn = false;
        double xa, ya, xb, yb;

        for (int i = beg; i < beg + sz; ) {

            int ind = i % sz;
            OuterRing rng;

            xa = xb = v[ind].x();
            ya = yb = v[ind].y();

            rng.push(xa, ya);

            if (turn && 0 == offset) {
                if (0 == f % 2) b_[f].push_back(index_t(xa, -f));
                else b_[f].push_back(index_t(ya, -f));
            }

            offset = 0;
            turn = false;

            for (int j = (ind+1) % sz; true; j = (j+1) % sz) {
                const point_t &p = v[j];
                rng.push(p.x(), p.y());

                if (p.x() < xa) xa = p.x();
                if (p.x() > xb) xb = p.x();
                if (p.y() < ya) ya = p.y();
                if (p.y() > yb) yb = p.y();

                coords[(f+1)%2] = p.x();
                coords[f%2] = p.y();

                if (fuzzy_eq(coords[0], mbr_[f])) {
                    turn = fuzzy_eq(coords[1], mbr_[(f+1)%4]);
                    break;
                } else if (fuzzy_eq(coords[1], mbr_[(f+1)%4])) {
                    rng.push(corner_[f].x(), corner_[f].y());
                    offset = 1;
                    turn = true;
                    break;
                }
            }

            int bak = rng.size() - 1 - offset;

            if (within) {
                int t = (f + offset) % 4;
                int kk = (1 == offset || !turn) ? outer_.size() : -f-1;

                if (0 == t % 2) b_[t].push_back(index_t(rng[bak].x(), kk));
                else b_[t].push_back(index_t(rng[bak].y(), kk));

                if (1 == offset) rng.corner();
            }

            if (turn) f = (f+1) % 4;
            i += bak;

            rng.mbr(xa, ya, xb, yb);
            outer_.push_back(rng);
        }

        if (within) _sort(f%4);
    }