Exemple #1
0
void UFface::checkIn(int i, int j)
{
    unsigned long long num0[3]={
        (unsigned long long)arrayFace[i][0]<<32 | (unsigned long long)arrayFace[i][1],
        (unsigned long long)arrayFace[i][1]<<32 | (unsigned long long)arrayFace[i][2],
        (unsigned long long)arrayFace[i][2]<<32 | (unsigned long long)arrayFace[i][0]
    };
    unsigned long long num1[3]={
        (unsigned long long)arrayFace[j][1]<<32 | (unsigned long long)arrayFace[j][0],
        (unsigned long long)arrayFace[j][2]<<32 | (unsigned long long)arrayFace[j][1],
        (unsigned long long)arrayFace[j][0]<<32 | (unsigned long long)arrayFace[j][2]
    };
    unsigned long long num2[3]={
        (unsigned long long)arrayFace[j][0]<<32 | (unsigned long long)arrayFace[j][1],
        (unsigned long long)arrayFace[j][1]<<32 | (unsigned long long)arrayFace[j][2],
        (unsigned long long)arrayFace[j][2]<<32 | (unsigned long long)arrayFace[j][0]
    };
    for(int i0 = 0; i0 < 3; i0++)
        for(int j0 = 0; j0 < 3 ; j0++)
        {
            if(num0[i0]==num1[j0])
                setRelation(i,j,3);
            else if(num0[i0]==num2[j0])
                setRelation(i,j,2);
        }
}
Exemple #2
0
QueueModel::QueueModel(QObject *parent, QSqlDatabase db) :
    QSqlRelationalTableModel(parent, db)
{
    setTable("queuesongs");
    setSinger(-1);
    setRelation(3, QSqlRelation("dbsongs", "songid", "artist"));
    setRelation(4, QSqlRelation("dbsongs", "songid", "title"));
    setRelation(5, QSqlRelation("dbsongs", "songid", "discid"));
    setRelation(6, QSqlRelation("dbsongs", "songid", "path"));
    setSort(9, Qt::AscendingOrder);
}
Exemple #3
0
// virtual
void GRowDistanceScaled::init(const GRelation* pRelation, bool own)
{
	setRelation(pRelation, own);
	delete[] m_pScaleFactors;
	m_pScaleFactors = new double[pRelation->size()];
	GVec::setAll(m_pScaleFactors, 1.0, pRelation->size());
}
Exemple #4
0
ServicesModel::ServicesModel(QObject *parent)
  : QSqlRelationalTableModel(parent)
{
  setTable("tb_services");
  setRelation(Type, QSqlRelation("tb_serviceTypes", "uid", "text"));
  setRelation(Operator, QSqlRelation("tb_operators", "uid", "text"));
  //relModel->setEditStrategy(QSqlTableModel::OnManualSubmit);
  select();

  setHeaderData(Text, Qt::Horizontal, trUtf8("Наименование"));
  setHeaderData(CostR, Qt::Horizontal, trUtf8("CostR"));
  setHeaderData(Cost, Qt::Horizontal, trUtf8("Cost"));
  setHeaderData(Type, Qt::Horizontal, trUtf8("Тип"));
  setHeaderData(PType, Qt::Horizontal, trUtf8("Беспл."));
  setHeaderData(Operator, Qt::Horizontal, trUtf8("Оператор"));
}
Exemple #5
0
void ZDataModel::parse(const ZConfig &el){
    if(el.hasAttribute("table")){
        setTable(el.attribute("table"));

        for(int i = 0; i < columnCount(); i++){
            _columns.insert(headerData(i,Qt::Horizontal).toString(), i);
        }

        foreach(const ZConfig &field, el.children("zee:field")){
            if(_columns.contains(field.attribute("name"))){
            //  set header title
                if(field.hasAttribute("title")){
                    setHeaderData(_columns.value(field.attribute("name")), Qt::Horizontal,
                                  QVariant(field.attribute("title")));
                }

                if(field.hasAttribute("belongsTo")){
                    QString relation = field.attribute("belongsTo");
                    QString rTable = relation.section(":",0,0);
                    QString rKey = relation.section(":",1,1);
                    QString rDisplay = relation.section(":",2,2);

                    if(!(rTable.isEmpty() && rKey.isEmpty() && rDisplay.isEmpty())){
                        setRelation(_columns.value(field.attribute("name")),
                                    QSqlRelation(rTable,rKey,rDisplay));
                    }
                }
            }
        }
    }
QmvSqlQuery::QmvSqlQuery( QmvClass * cls, const QString name )
        : QObject ( cls, name)
{
    setRelation( cls );
        // defaults
    setOffset( getRelation()->queryOffset().toInt() );
    setLimit( getRelation()->queryLimit().toInt() );
    setOrderby( getRelation()->orderBy() );
    controller = 0;
    
        // get a list of attribute titles and index them
    QmvAttList atlist = getRelation()->sortedAttlist( "mtat_view_order",
                                                      QmvClass::NoBlank|QmvClass::NoSystem );

    for ( QmvAttribute * at_ptr = atlist.first(); at_ptr != 0; at_ptr = atlist.next())
    {

#ifdef QMVSQLQUERY_DEBUG
        qDebug("printReport:%s, mtat_title = %s",
               at_ptr->find("mtat_name")->latin1(),
               at_ptr->find("mtat_title")->latin1());
#endif
        
            // load the label
        QString *title = at_ptr->find( "mtat_title");
        if ( !title )
            continue;
        
        attribute_titles += *title;
            // index a pointer to the QmvAttribute object
        attribute_index.insert( *title , at_ptr );
    }
}
Exemple #7
0
MTri::MTri( QObject *padre )
 : QSqlRelationalTableModel(padre)
{
 setTable( "car_tri" );
 setHeaderData( 0, Qt::Horizontal, "#ID" );
 setHeaderData( 1, Qt::Horizontal, "#DTA" );
 setHeaderData( 2, Qt::Horizontal, "Categoria" );
 setRelation  ( 2, QSqlRelation ( "car_categorias", "id_categoria", "nombre" ) );
 setHeaderData( 3, Qt::Horizontal, "Est. Destino" );
 setRelation  ( 3, QSqlRelation ( "car_establecimientos", "id_establecimiento", "nombre" ) );
 setHeaderData( 4, Qt::Horizontal, "Est. Origen" );
 setRelation  ( 4, QSqlRelation ( "car_establecimientos", "id_establecimiento", "nombre" ) );
 setHeaderData( 5, Qt::Horizontal, "Comprador" );
 setRelation  ( 5, QSqlRelation ( "clientes", "id", "nombre" ) );
 setHeaderData( 6, Qt::Horizontal, "Vendedor" );
 setRelation  ( 6, QSqlRelation ( "clientes", "id", "nombre" ) );
 setHeaderData( 7, Qt::Horizontal, "# Guia" );
}
Exemple #8
0
MealModel::MealModel(int meal, QObject *parent) : QSqlRelationalTableModel(parent), meal(meal)
{
    setTable("menu");
    setRelation(2, QSqlRelation("recipes", "id", "name"));
    setFilter(QString("meal='%1'").arg(meal));
    sort(2, Qt::AscendingOrder);
    select();

    setSupportedDragActions(Qt::MoveAction);
}
Exemple #9
0
MMascota::MMascota( QObject *parent )
 : QSqlRelationalTableModel( parent )
{
 setTable( "mascota" );
 setHeaderData( 0, Qt::Horizontal, "#ID" );
 setHeaderData( 1, Qt::Horizontal, "Dueño" );
   setRelation( 1, QSqlRelation( "dueno", "id", "apellido" ) );
 setHeaderData( 2, Qt::Horizontal, "Nombre" );
 setHeaderData( 3, Qt::Horizontal, "Raza" );
 setHeaderData( 4, Qt::Horizontal, "Genero" );
}
Exemple #10
0
MRecargos::MRecargos( QObject *parent, bool relaciones )
 : QSqlRelationalTableModel(parent), _precio_base(0.0)
{
 setTable( "recargos" );
 setHeaderData( 0, Qt::Horizontal, tr( "#ID" ) );
 setHeaderData( 1, Qt::Horizontal, tr( "Servicio" ) );
 setHeaderData( 2, Qt::Horizontal, tr( "Dias pasados" ) );
 setHeaderData( 3, Qt::Horizontal, tr( "Porcentaje" ) );
 setHeaderData( 4, Qt::Horizontal, tr( "Recargo" ) );
 setHeaderData( 5, Qt::Horizontal, tr( "Precio recargado" ) );
 if( relaciones ) {
     setRelation  ( 1, QSqlRelation( "servicios", "id_servicio", "nombre" ) );
 }
}
Exemple #11
0
MPeluqueria::MPeluqueria(QObject *parent , bool relacion )
 : QSqlRelationalTableModel(parent)
{
 setTable( "peluqueria" );
 setHeaderData( 0, Qt::Horizontal, "#ID" );
 setHeaderData( 1, Qt::Horizontal, "Mascota" );
 setHeaderData( 2, Qt::Horizontal, "Descripcion" );
 setHeaderData( 3, Qt::Horizontal, "Precio" );
 setHeaderData( 4, Qt::Horizontal, "Fecha" );
 limite = -1;
 if( relacion == true )
 {
  setRelation( 1, QSqlRelation( "mascota", "id", "nombre" ) );
 }
}
Exemple #12
0
MGasto::MGasto( QObject *parent, bool relaciones )
 : QSqlRelationalTableModel( parent )
{
 setTable( "gastos" );
 setHeaderData( 0, Qt::Horizontal, "ID#" );
 setHeaderData( 1, Qt::Horizontal, "Categoria" );
 setHeaderData( 2, Qt::Horizontal, "Descripcion" );
 setHeaderData( 3, Qt::Horizontal, "Costo" );
 setHeaderData( 4, Qt::Horizontal, "Fecha" );
 setHeaderData( 5, Qt::Horizontal, "Caja" );
 if( relaciones ) {
   setRelation( 1, QSqlRelation( "categoria_gastos", "id_categoria_gastos", "nombre" ) );
   //setRelation( 5, QSqlRelation( "movimiento_caja", "id_movimiento", "id_movimiento" ) );
 }
}
void Tableau::setConstraint(size_t row, const CompactArray<Real> &leftSide, SimplexRelation relation, const Real &rightSide) {
  if(row < 1 || (int)row > getConstraintCount()) {
    throwException(_T("Tableau::setConstraint:row=%s out of range. Legal interval=[1..%s]")
                  ,FSZ(row),FSZ(getConstraintCount()));
  }
  if(leftSide.size() != getXCount()) {
    throwException(_T("Tableau::setConstraint:Invalid number of values specified for leftside. leftSide.size=%s. Tableau.xCount=%s.")
                  ,FSZ(leftSide.size()),FSZ(getXCount()));
  }

  for(size_t col = 0; col < leftSide.size(); col++) {
    setLeftSide(row,col+1,leftSide[col]);
  }
  setRelation(row,relation);
  setRightSide(row,rightSide);
}
Exemple #14
0
MPresupuestos::MPresupuestos(QObject *parent, bool relacion, bool soloLectura )
 : QSqlRelationalTableModel(parent)
{
 setTable( "presupuesto" );
 setHeaderData( 0, Qt::Horizontal, "Num Presupuesto" );
 setHeaderData( 1, Qt::Horizontal, "Fecha" );
 setHeaderData( 2, Qt::Horizontal, "Kilometraje" );
 setHeaderData( 3, Qt::Horizontal, "Automovil" );
 setHeaderData( 4, Qt::Horizontal, "Total" );
 setHeaderData( 5, Qt::Horizontal, "Titulo" );
 setHeaderData( 6, Qt::Horizontal, "Contenido" );
 setHeaderData( 7, Qt::Horizontal, "Modificado" );
 if( relacion )
 {
  setRelation( 3, QSqlRelation( "autos", "id_auto", "patente" ) );
 }
 _soloLectura = soloLectura;
}
Exemple #15
0
MProductos::MProductos(QObject *parent)
 : QSqlRelationalTableModel(parent)
{
 setTable( "producto" );
 setHeaderData( 0, Qt::Horizontal, "#ID" );
 setHeaderData( 1, Qt::Horizontal, "Categoria" );
 if( preferencias::getInstancia()->value( "Preferencias/Productos/categorias" ).toBool() )
 {
  setRelation( 1, QSqlRelation( "categoria_producto", "id", "nombre" ) );
 }
 setHeaderData( 2, Qt::Horizontal, QString::fromUtf8( "#Código" ) );
 setHeaderData( 3, Qt::Horizontal, "Nombre" );
 setHeaderData( 4, Qt::Horizontal, "Precio de Costo" );
 setHeaderData( 5, Qt::Horizontal, "Precio de venta" );
 setHeaderData( 6, Qt::Horizontal, "Descripcion" );
 setHeaderData( 7, Qt::Horizontal, "Marca" );
 setHeaderData( 8, Qt::Horizontal, "Stock" );
 setHeaderData( 9, Qt::Horizontal, "Habilitado" );
 setSort( 0, Qt::AscendingOrder );
}
Exemple #16
0
ProductsModel::ProductsModel(QObject *parent) :
    QSqlRelationalTableModel(parent)
{

    //    Language setup
    QString app_path;
    app_path = QApplication::applicationDirPath() + QDir::separator() + "settings.ini";
    QSettings settings(app_path,QSettings::IniFormat);
    QString content = settings.value("s_language","").toString();
    QString lanCode;
    QString lanName;
    if(content == "tamil_language"){
        QTranslator translator;
        translator.load("tamilLanguage_la");
    //  QApplication::installTranslator(&translator);
        QApplication::instance()->installTranslator(&translator);
        lanCode = ProductForm::tr("Code");
        lanName = ProductForm::tr("Name");
     }else{
        QTranslator translator;
        translator.load("englishLanguage_la");
    //  QApplication::installTranslator(&translator);
        QApplication::instance()->installTranslator(&translator);
        lanCode = ProductForm::tr("Code");
        lanName = ProductForm::tr("Name");
    }

    setTable("products");
    setRelation(4, QSqlRelation("categories", "id", "name"));
    setEditStrategy(QSqlTableModel::OnManualSubmit);
    setHeaderData(fieldIndex("code"), Qt::Horizontal, lanCode);
    setHeaderData(fieldIndex("name"), Qt::Horizontal, lanName);
    setFilter("products.status = 'A'");
    relationModel(4)->setFilter("status = 'A'");
    setSort(fieldIndex("name"),Qt::AscendingOrder);
    select();
}
Exemple #17
0
// virtual
void GLNormDistance::init(const GRelation* pRelation, bool own)
{
	setRelation(pRelation, own);
}
Exemple #18
0
void WorldModel::update(const UpdateRequest& req)
{
    if (req.empty())
        return;

    // Increase revision number
    ++revision_;

    std::map<UUID, EntityPtr> new_entities;

    // Update poses
    for(std::map<UUID, geo::Pose3D>::const_iterator it = req.poses.begin(); it != req.poses.end(); ++it)
    {
        EntityPtr e = getOrAddEntity(it->first, new_entities);
        e->setPose(it->second);
    }

    // Update shapes
    for(std::map<UUID, geo::ShapeConstPtr>::const_iterator it = req.shapes.begin(); it != req.shapes.end(); ++it)
    {
        EntityPtr e = getOrAddEntity(it->first, new_entities);
        e->setShape(it->second);
    }

    // Update types
    for(std::map<UUID, std::string>::const_iterator it = req.types.begin(); it != req.types.end(); ++it)
    {
        EntityPtr e = getOrAddEntity(it->first, new_entities);
        e->setType(it->second);
    }

    // Update relations
    for(std::map<UUID, std::map<UUID, RelationConstPtr> >::const_iterator it = req.relations.begin(); it != req.relations.end(); ++it)
    {
        Idx idx1;
        if (findEntityIdx(it->first, idx1))
        {
            const std::map<UUID, RelationConstPtr>& rels = it->second;
            for(std::map<UUID, RelationConstPtr>::const_iterator it2 = rels.begin(); it2 != rels.end(); ++it2)
            {
                Idx idx2;
                if (findEntityIdx(it2->first, idx2))
                    setRelation(idx1, idx2, it2->second);
                else
                    std::cout << "WorldModel::update (relation): unknown entity: '" << it2->first << "'." << std::endl;
            }
        }
        else
            std::cout << "WorldModel::update (relation): unknown entity: '" << it->first << "'." << std::endl;
    }

    // Update additional info (data)
    for(std::map<UUID, tue::config::DataConstPointer>::const_iterator it = req.datas.begin(); it != req.datas.end(); ++it)
    {
        EntityPtr e = getOrAddEntity(it->first, new_entities);

        tue::config::DataPointer params;
        params.add(e->data());
        params.add(it->second);

        tue::config::Reader r(params);
        std::string type;
        if (r.value("type", type, tue::config::OPTIONAL))
            e->setType(type);

        e->setData(params);
    }

    // Remove entities
    for(std::set<UUID>::const_iterator it = req.removed_entities.begin(); it != req.removed_entities.end(); ++it)
    {
        removeEntity(*it);
    }
}
void myGaussian::setWidth(RooAbsReal* newWidth)
{
	setRelation("width",newWidth);
}
Exemple #20
0
int* UFface::unionFinal(std::vector<int> &indices,std::vector<int> &cs)
{
    setRelation();
//    freopen("realtion.txt","w",stdout);
//    for(int i=0;i<NUM_FACE*(NUM_FACE-1)/2;i++)
//        printf("%d %d\n",(int)relationGraph[i],i);
//    freopen("CON","w",stdout);
    printf("UFface setRelation done...\n");
    printf("unionFinal .... indices size %d\n",indices.size());
    for(int i=1;i<NUM_FACE;i++)
        for(int j=0;j<i;j++)
        {
            char tmpRelation = getRealtion(i,j);
            if(tmpRelation%2==1)
            {
                unionFace(i,j);
                unionFaceCommonEdge(i,j);
            }
            else if((tmpRelation>>1)%2==1)
                unionFaceCommonEdge(i,j);
        }
    setCateCommonEdgeSet();
    setCateSet();

    printf("unionFinal... num of Categories: %d\n",cateSet.size());
    printf("unionFinal... num of CategoriesCommonEdge: %d\n",cateSetCommonEdge.size());

    while(cateSet.size() != cateSetCommonEdge.size())
    {
        reArrange();
        setRelation();
        for(int i=1 ; i<NUM_FACE ; i++)
            for(int j=0 ; j<i ; j++)
                if(getRealtion(i,j)%2==1)
                    unionFace(i,j);
        setCateSet();
    }

    cs.clear();
    std::set<int>::iterator it = cateSet.begin();
    for(;it!=cateSet.end();it++)
        cs.push_back(*it);
    indices.clear();
    for(int i=0;i<3*NUM_FACE;i++)
        indices.push_back(arrayFace[i/3][i%3]);

    return id;
/*
    if(cateSet.size()==cateSetCommonEdge.size())
    {
        cs.clear();
        std::set<int>::iterator it = cateSet.begin();
        for(;it!=cateSet.end();it++)
            cs.push_back(*it);

        printf("unionFinal...cs size %d\n",cs.size());
        printf("unionFinal...id size %d\n",NUM_FACE);

        return id;
    }
    reArrange();
    do{
        setRelation();
        for(int i=1;i<NUM_FACE;i++)
            for(int j=0;j<i;j++)
                if(relationGraph[i][j]%2==1)
                    unionFace(i,j);
        setCateSet();
        printf("unionFinal... num of Categories: %d\n",cateSet.size());
        printf("unionFinal... num of CategoriesCommonEdge: %d\n",cateSetCommonEdge.size());
        if(cateSet.size() == cateSetCommonEdge.size())
        {
            cs.clear();
            std::set<int>::iterator it = cateSet.begin();
            for(;it!=cateSet.end();it++)
                cs.push_back(*it);
            indices.clear();
            for(int i=0;i<NUM_FACE*3;i++)
                indices.push_back(arrayFace[i/3][i%3]);
            return id;
        }
        else
            reArrange();
//        getchar();
    }while(cateSet.size() != cateSetCommonEdge.size());

    std::cout<<"union...."<<std::endl;
//    this->unionFinal();
    indices.clear();;
    for(int i=0;i<3*NUM_FACE;i++)
        indices.push_back(arrayFace[i/3][i%3]);

    cs.clear();
    setCateSet();
    std::set<int>::iterator it = cateSet.begin();
    for(;it!=cateSet.end();it++)
        cs.push_back(*it);

    return id;
*/
}
void DoubleGaussian::setMean(RooAbsReal* newMean)
{
	setRelation("mean",newMean);
}
void DoubleGaussian::setWidth(RooAbsReal* newSigma)
{
	setRelation("sigma1",newSigma);
}
Exemple #23
0
std::unique_ptr<CSSParserSelector> CSSParserSelector::releaseTagHistory() {
  setRelation(CSSSelector::SubSelector);
  return std::move(m_tagHistory);
}
void DoubleGaussian::setWidthRatio(RooAbsReal* newSigmaRatio)
{
	setRelation("sigma_ratio",newSigmaRatio);
}
Exemple #25
0
/*!
 * \brief MOrdenTrabajo::relacionarDatos
 */
void MOrdenTrabajo::relacionarDatos()
{
    setRelation( 1, QSqlRelation( "clientes"    , "id"             , "razon_social" ) );
    setRelation( 7, QSqlRelation( "equipamiento", "id_equipamiento", "descripcion"  ) );
    setRelation( 9, QSqlRelation( "tecnico"     , "id_tecnico"     , "razon_social" ) );
}
void DoubleGaussian::setFrac(RooAbsReal* newFrac)
{
	setRelation("frac",newFrac);
}
Exemple #27
0
// virtual
GDistanceMetric::~GDistanceMetric()
{
	setRelation(NULL, false);
}