/*! Removes the mapping from application \a app to its process id. \internal */ void OomPrivate::remove(const QString& app) { if (app.isEmpty()) return; int pid = 0; QMap<QString,int>::iterator i; i = important_procs_.find(app); if (i != important_procs_.end()) { pid = i.value(); important_procs_.erase(i); qLog(OOM) << "Removed important proc:" << app << pid; return; } i = critical_procs_.find(app); if (i != critical_procs_.end()) { pid = i.value(); critical_procs_.erase(i); qLog(OOM) << "Removed critical proc:" << app << pid; return; } i = expendable_procs_.find(app); if (i != expendable_procs_.end()) { pid = i.value(); expendable_procs_.erase(i); qLog(OOM) << "Removed expendable proc:" << app << pid; return; } }
void SetFixNodeStateExecutor::execute_server() { int id; bool state; *stream >> id >> state; Data::Graph * currentGraph = Manager::GraphManager::getInstance()->getActiveGraph(); QMap<qlonglong, osg::ref_ptr<Data::Node> >* nodes = currentGraph -> getNodes(); if (nodes->contains(id)) { this->SetFixNodeState(*nodes->find(id), state); } else { QMap<qlonglong, osg::ref_ptr<Data::Node> >* mergeNodes = currentGraph->getMetaNodes(); if (mergeNodes->contains(id)) { this->SetFixNodeState(*mergeNodes->find(id),state); } } Server * server = Server::getInstance(); server->sendFixNodeState(id, state); if (((QOSG::CoreWindow *)server->getCoreWindowReference())->playing()) { server->getLayoutThread()->play(); } }
void MagicTowerLoader::addPresetNPCDialogData(const QMap<QString, QString>& parameters) { NPCDialogData* object = new NPCDialogData(); QString presetName = parameters["name"]; for(int i=1;;i++) { QString pattern = QString("page%1_").arg(i); if(parameters.find(pattern+"title")==parameters.end()) break; QString title = parameters[pattern+"title"]; QString titlePixmap = parameters[pattern+"titlePixmap"]; QString content = parameters[pattern+"content"]; if(parameters.find(pattern+"options")==parameters.end()) { object->addPage(titlePixmap,title,content); continue; } QStringList listOption = parameters[pattern+"options"].trimmed().split("|"); QStringList listProp = parameters[pattern+"purchasedProperties"].trimmed().split("|"); QString costProperty = parameters[pattern+"costProperty"]; int costValues = parameters[pattern+"costValues"].toInt(); int costIncreaseMode = parameters[pattern+"costIncreaseMode"].toInt(); int costIncreaseRate = parameters[pattern+"costIncreaseRate"].toInt(); QStringList listValueString = parameters[pattern+"purchasedValues"].trimmed().split("|"); QList<int> listValue; for(int i=0;i<listValueString.size();i++) { listValue << listValueString[i].toInt(); } object->addPage(titlePixmap,title,content,costProperty,costValues,costIncreaseMode,costIncreaseRate,listOption,listProp,listValue); } objectPreset[presetName] = object; }
void MoveNodeExecutor::execute_client() { int id; float x,y,z; *stream >> id >> x >> y >> z; Data::Graph * currentGraph = Manager::GraphManager::getInstance()->getActiveGraph(); QMap<qlonglong, osg::ref_ptr<Data::Node> >* nodes = currentGraph -> getNodes(); //qDebug() << "Moving" << id << "to" << x << y << z; if (nodes->contains(id)) { this->moveNode(*nodes->find(id), osg::Vec3(x,y,z)); } else { QMap<qlonglong, osg::ref_ptr<Data::Node> >* mergeNodes = currentGraph->getMetaNodes(); if (mergeNodes->contains(id)) { this->moveNode(*mergeNodes->find(id), osg::Vec3(x,y,z)); } else { qDebug() << "Nepoznam uzol" << id; } } //TODO: refactor // Stupid way to fix restriction shape refreshing ((QOSG::CoreWindow *)Client::getInstance()->getCoreWindowReference())->getLayoutThread()->pause(); ((QOSG::CoreWindow *)Client::getInstance()->getCoreWindowReference())->getLayoutThread()->play(); }
void NewEdgeExecutor::execute_server() { Server* server = Server::getInstance(); QString name; int from, to; bool oriented; *stream >> name >> from >> to >> oriented; //qDebug()<< "[NEW NODE]" << "[" << x << "," << y << "," << z << "]"; Data::Graph* currentGraph = Manager::GraphManager::getInstance()->getActiveGraph(); QMap<qlonglong, osg::ref_ptr<Data::Node> >* nodes = currentGraph -> getNodes(); osg::ref_ptr<Data::Node> node_from = *nodes->find( from ); osg::ref_ptr<Data::Node> node_to = *nodes->find( to ); Data::Type* type = currentGraph->addType( Data::GraphLayout::META_EDGE_TYPE ); osg::ref_ptr<Data::Edge> newEdge = currentGraph->addEdge( "NewEdge",node_from,node_to,type,oriented ); if ( ( ( QOSG::CoreWindow* )server->getCoreWindowReference() )->playing() ) { server->getLayoutThread()->play(); } server->sendNewEdge( newEdge ); }
QString QNetworkManagerSettingsConnection::getMacAddress() { if(getType() == DEVICE_TYPE_802_3_ETHERNET) { QNmSettingsMap::const_iterator i = d->settingsMap.find(QLatin1String("802-3-ethernet")); while (i != d->settingsMap.end() && i.key() == QLatin1String("802-3-ethernet")) { QMap<QString,QVariant> innerMap = i.value(); QMap<QString,QVariant>::const_iterator ii = innerMap.find(QLatin1String("mac-address")); while (ii != innerMap.end() && ii.key() == QLatin1String("mac-address")) { return ii.value().toString(); ii++; } i++; } } else if(getType() == DEVICE_TYPE_802_11_WIRELESS) { QNmSettingsMap::const_iterator i = d->settingsMap.find(QLatin1String("802-11-wireless")); while (i != d->settingsMap.end() && i.key() == QLatin1String("802-11-wireless")) { QMap<QString,QVariant> innerMap = i.value(); QMap<QString,QVariant>::const_iterator ii = innerMap.find(QLatin1String("mac-address")); while (ii != innerMap.end() && ii.key() == QLatin1String("mac-address")) { return ii.value().toString(); ii++; } i++; } } return QString(); }
void NetworkAccount::setCheckingMail(bool checking) { mCheckingMail = checking; if(host().isEmpty()) return; if(checking) { if(s_serverConnections.find(host()) != s_serverConnections.end()) s_serverConnections[host()] += 1; else s_serverConnections[host()] = 1; kdDebug(5006) << "check mail started - connections for host " << host() << " now is " << s_serverConnections[host()] << endl; } else { if(s_serverConnections.find(host()) != s_serverConnections.end() && s_serverConnections[host()] > 0) { s_serverConnections[host()] -= 1; kdDebug(5006) << "connections to server " << host() << " now " << s_serverConnections[host()] << endl; } } }
void StringClient::generete_doc(QMap<QString, QString> message) { rapidjson::Document d; d.SetObject(); rapidjson::Document::AllocatorType& allocator = d.GetAllocator(); auto name = message.find("name"); rapidjson::Value name_value; name_value.SetString(name.value().toUtf8().constData(), name.value().toUtf8().size(), allocator); d.AddMember("name", name_value, allocator); auto type = message.find("type"); rapidjson::Value type_value; type_value.SetString(type.value().toUtf8().constData(), type.value().toUtf8().size(), allocator); d.AddMember("type", type_value, allocator); auto msg = message.find("msg"); rapidjson::Value msg_value; msg_value.SetString(msg.value().toUtf8().constData(), msg.value().toUtf8().size(), allocator); d.AddMember("msg", msg_value, allocator); auto addressee = message.find("addressee"); rapidjson::Value addressee_value; addressee_value.SetString(addressee.value().toUtf8().constData(), addressee.value().toUtf8().size(), allocator); d.AddMember("addressee", addressee_value, allocator); rapidjson::StringBuffer buffer; rapidjson::Writer<rapidjson::StringBuffer, rapidjson::Document::EncodingType, rapidjson::ASCII<> > writer(buffer); d.Accept(writer); tcp_socket_->write(buffer.GetString()); tcp_socket_->write("\n"); }
void ITranslatable::fromText(QStringList &text) { //Get Translation map QMap <QString,QWidget*> paramMap = getParameterMap(); for (int i=0; i<text.count(); ++i) { QString t = text.at(i); //Get param key QString key = t.section("=",0,0).trimmed(); if (paramMap.find(key) != paramMap.end()) { QWidget* p = paramMap.find(key).value(); //Is text type. QLineEdit* l = dynamic_cast<QLineEdit*>(p); if (l) { l->setText(t.section("=",1,1).trimmed()); continue; } //Is checkbox type. QCheckBox* b = dynamic_cast<QCheckBox*>(p); if (b) { if (t.section("=",1,1).trimmed() == "yes") b->setChecked(true); else b->setChecked(false); continue; } } } }
void SetFixNodeStateExecutor::execute_client() { int id; bool state; *stream >> id >> state; Data::Graph * currentGraph = Manager::GraphManager::getInstance()->getActiveGraph(); QMap<qlonglong, osg::ref_ptr<Data::Node> >* nodes = currentGraph -> getNodes(); Client * client = Client::getInstance(); if (nodes->contains(id)) { Data::Node * node = *nodes->find(id); this->SetFixNodeState(node, state); if (client->selected_nodes.contains(node)) { client->selected_nodes.removeOne(node); } } else { QMap<qlonglong, osg::ref_ptr<Data::Node> >* mergeNodes = currentGraph->getMetaNodes(); if (mergeNodes->contains(id)) { Data::Node * node = *mergeNodes->find(id); this->SetFixNodeState(node,state); if (client->selected_nodes.contains(node)) { client->selected_nodes.removeOne(node); } } } }
ConfCertDialog::~ConfCertDialog() { QMap<RsPeerId, ConfCertDialog*>::iterator it = instances_ssl.find(peerId); if (it != instances_ssl.end()) instances_ssl.erase(it); QMap<RsPgpId, ConfCertDialog*>::iterator it2 = instances_pgp.find(pgpId); if (it2 != instances_pgp.end()) instances_pgp.erase(it2); }
QMap<qlonglong, osg::Vec4f> Model::EdgeDAO::getColors( QSqlDatabase* conn, bool* error, qlonglong graphID, qlonglong layoutID ) { *error = FALSE; bool error2 = false; osg::Vec4f color; qlonglong id; QMap<qlonglong, osg::Vec4f> colors; QMap<qlonglong, QString> edgeColorR; QMap<qlonglong, QString> edgeColorG; QMap<qlonglong, QString> edgeColorB; QMap<qlonglong, QString> edgeColorA; QMap<qlonglong, QString>::iterator iter_r; QMap<qlonglong, QString>::iterator iter_g; QMap<qlonglong, QString>::iterator iter_b; QMap<qlonglong, QString>::iterator iter_a; edgeColorR = getSettings( conn, &error2, graphID, layoutID, "color_r" ); if ( error2 ) { qDebug() << "[Model::EdgeDAO::getColors] Could not get color_r setting"; *error = error2; return colors; } edgeColorG = getSettings( conn, &error2, graphID, layoutID, "color_g" ); if ( error2 ) { qDebug() << "[Model::EdgeDAO::getColors] Could not get color_g setting"; *error = error2; return colors; } edgeColorB = getSettings( conn, &error2, graphID, layoutID, "color_b" ); if ( error2 ) { qDebug() << "[Model::EdgeDAO::getColors] Could not get color_b setting"; *error = error2; return colors; } edgeColorA = getSettings( conn, &error2, graphID, layoutID, "color_a" ); if ( error2 ) { qDebug() << "[Model::NodeDAO::getColors] Could not get color_a setting"; *error = error2; return colors; } //nacitavame ulozene farby v databaze for ( iter_r = edgeColorR.begin(); iter_r != edgeColorR.end(); ++iter_r ) { id = iter_r.key(); iter_g = edgeColorG.find( id ); iter_b = edgeColorB.find( id ); iter_a = edgeColorA.find( id ); color = osg::Vec4f( iter_r.value().toFloat(), iter_g.value().toFloat(), iter_b.value().toFloat(), iter_a.value().toFloat() ); colors.insert( id, color ); } return colors; }
/*! * \brief calcExpansion estimates the thermal expansion value for corrections. * \param tp * \param SET */ void SimpleTemperatureCompensation::calcExpansion(TrafoParam &tp) { FunctionConfiguration myConfig = this->getFunctionConfiguration(); QMap<QString,QString> stringParameter = myConfig.stringParameter; QMap<QString,double> doubleParameter = myConfig.doubleParameter; QString material = ""; double actTemp = 20.0; double refTemp = 20.0; double tempAccuracy = 0.0; double expansionCoefficient = 0.0; if(stringParameter.contains("material")){ material = static_cast<QString>(stringParameter.find("material").value()); protMaterial = material; expansionCoefficient = Materials::getExpansionCoefficient(material); protExpansionCoeff = QString::number(expansionCoefficient,'f',6); } if(doubleParameter.contains("actualTemperature")){ actTemp = static_cast<double>(doubleParameter.find("actualTemperature").value()); protActTemp = QString::number(actTemp,'f',2); } if(doubleParameter.contains("referenceTemperature")){ refTemp = static_cast<double>(doubleParameter.find("referenceTemperature").value()); protRefTemp = QString::number(refTemp,'f',2); } if(doubleParameter.contains("temperatureAccuracy")){ tempAccuracy = static_cast<double>(doubleParameter.find("temperatureAccuracy").value()); protTempAccuracy = QString::number(tempAccuracy,'f',2); } double expansion = (actTemp-refTemp)*expansionCoefficient; protExpansion = QString::number(expansion,'f',6); double m = 1.0/(1+ (expansion)); OiMat eMat(4,4); for(int i = 0; i < 4; i++){ eMat.setAt(i,i, 1.0); } OiMat scale(4,4); scale.setAt(0,0,m); scale.setAt(1,1,m); scale.setAt(2,2,m); scale.setAt(3,3,1.0); tp.setHomogenMatrix(eMat, eMat, scale); this->calcAccuracy(tp,tempAccuracy,expansion); this->calcAccuracy(tp,tempAccuracy,expansion); }
ConfCertDialog::~ConfCertDialog() { // if(peerId.isNull()) { QMap<RsPeerId, ConfCertDialog*>::iterator it = instances_ssl.find(peerId); if (it != instances_ssl.end()) instances_ssl.erase(it); } // else { QMap<RsPgpId, ConfCertDialog*>::iterator it = instances_pgp.find(pgpId); if (it != instances_pgp.end()) instances_pgp.erase(it); } }
int main(int argc,char *argv[]) { QCoreApplication a(argc,argv); QMap<QString,QString> map; map.insert("beijing","111"); map.insert("shanghai","021"); map.insert("tianjing","022"); map.insert("chongqing","0222"); map.insert("changchun","0431"); QMap<QString,QString>::const_iterator i; for(i = map.constBegin();i!=map.constEnd();++i) { qDebug()<<i.key()<<" "<<i.value(); } QMap<QString,QString>::iterator mi; mi = map.find("chongqing"); if(mi!=map.end()) { mi.value()="043200"; } QMap<QString,QString>::const_iterator modi; qDebug()<<""; for(modi = map.constBegin();modi!=map.constEnd();++modi) { qDebug()<<modi.key()<<" "<<modi.value(); } return a.exec(); }
bool QgsPointSample::checkMinDistance( QgsPoint& pt, QgsSpatialIndex& index, double minDistance, QMap< QgsFeatureId, QgsPoint >& pointMap ) { if ( minDistance <= 0 ) { return true; } QList<QgsFeatureId> neighborList = index.nearestNeighbor( pt, 1 ); if ( neighborList.isEmpty() ) { return true; } QMap< QgsFeatureId, QgsPoint >::const_iterator it = pointMap.find( neighborList[0] ); if ( it == pointMap.constEnd() ) //should not happen { return true; } QgsPoint neighborPt = it.value(); if ( neighborPt.sqrDist( pt ) < ( minDistance * minDistance ) ) { return false; } return true; }
void writeAsDxf( QgsServerInterface *serverIface, const QgsProject *project, const QString &version, const QgsServerRequest &request, QgsServerResponse &response ) { Q_UNUSED( version ); QgsServerRequest::Parameters params = request.parameters(); QgsWmsParameters wmsParameters( QUrlQuery( request.url() ) ); QgsRenderer renderer( serverIface, project, wmsParameters ); QMap<QString, QString> formatOptionsMap = parseFormatOptions( params.value( QStringLiteral( "FORMAT_OPTIONS" ) ) ); QgsDxfExport dxf = renderer.getDxf( formatOptionsMap ); QString codec = QStringLiteral( "ISO-8859-1" ); QMap<QString, QString>::const_iterator codecIt = formatOptionsMap.find( QStringLiteral( "CODEC" ) ); if ( codecIt != formatOptionsMap.constEnd() ) { codec = formatOptionsMap.value( QStringLiteral( "CODEC" ) ); } // Write output response.setHeader( "Content-Type", "application/dxf" ); dxf.writeToFile( response.io(), codec ); }
const QIcon& getIcon(const QString & name) { QString plainName(name); if (plainName.endsWith(".svg", Qt::CaseInsensitive)) plainName.chop(4); const QMap<QString, QIcon>::const_iterator i = iconCache.find(plainName); if (i != iconCache.end()) return *i; const QString iconDir = util::directory::getIconDir().canonicalPath(); QString iconFileName = iconDir + "/" + plainName + ".svg"; if (QFile(iconFileName).exists()) return *iconCache.insert(plainName, QIcon(iconFileName)); iconFileName = iconDir + "/" + plainName + ".png"; if (QFile(iconFileName).exists()) return *iconCache.insert(plainName, QIcon(iconFileName)); if (plainName != "default") { qWarning() << "Cannot find icon file" << iconFileName << ", using default icon."; return getIcon("default"); } qWarning() << "Cannot find default icon" << iconFileName << ", using null icon."; return nullIcon; }
std::shared_ptr<OsmAnd::RoutePlannerContext::RouteCalculationSegment> OsmAnd::RoutePlannerContext::RoutingSubsectionContext::loadRouteCalculationSegment( uint32_t x31, uint32_t y31, QMap<uint64_t, std::shared_ptr<const Model::Road> >& processed, const std::shared_ptr<RouteCalculationSegment>& original_) { uint64_t id = (static_cast<uint64_t>(x31) << 31) | y31; auto itSegment = _roadSegments.find(id); if(itSegment == _roadSegments.end()) return original_; this->_access++; auto original = original_; auto segment = *itSegment; while(segment) { auto road = segment->road; auto roadPointId = RoutePlanner::encodeRoutePointId(road, segment->pointIndex); auto itOtherRoad = processed.find(roadPointId); if(itOtherRoad == processed.end() || (*itOtherRoad)->points.size() < road->points.size()) { processed.insert(roadPointId, road); std::shared_ptr<RouteCalculationSegment> newSegment(new RouteCalculationSegment(road, segment->pointIndex)); newSegment->_next = original; original = newSegment; } segment = segment->next; } return original; }
void SeparateNodesExecutor::execute_server() { int count, id; *stream >>count; Data::Graph* currentGraph = Manager::GraphManager::getInstance()->getActiveGraph(); QMap<qlonglong, osg::ref_ptr<Data::Node> >* nodes = currentGraph -> getMetaNodes(); QLinkedList<osg::ref_ptr<Data::Node> >* selectedNodes = new QLinkedList<osg::ref_ptr<Data::Node> >(); for ( int i = 0; i < count; i++ ) { *stream >> id; if ( nodes->contains( id ) ) { selectedNodes->append( *nodes->find( id ) ); } } Server* server = Server::getInstance(); currentGraph->separateNodes( selectedNodes ); server->sendSeparateNodes( selectedNodes ); if ( ( ( QOSG::CoreWindow* )server->getCoreWindowReference() )->playing() ) { server->getLayoutThread()->play(); } return; }
/*! Convenience function that attempts to unlock the file with identifier \a id that was locked by \c QMail::fileLock. Returns \c true for success or \c false otherwise. \sa QMail::fileLock() */ bool QMail::fileUnlock(int id) { #ifdef Q_OS_WIN QMap<int, HANDLE>::iterator it = lockedFiles.find(id); if (it != lockedFiles.end()) { if (::UnlockFile(it.value(), 0, 0, 1, 0) == FALSE) { qWarning() << "Unable to unlock file:" << lastSystemErrorMessage(); } else { if (::CloseHandle(it.value()) == FALSE) { qWarning() << "Unable to close handle:" << lastSystemErrorMessage(); } lockedFiles.erase(it); return true; } } return false; #else int result = -1; result = ::close(id); if (result == -1) return false; return true; #endif }
ConfCertDialog::~ConfCertDialog() { QMap<std::string, ConfCertDialog*>::iterator it = instances.find(mId); if (it != instances.end()) { instances.erase(it); } }
void TableEditor::newColumnClicked() { #ifndef QT_NO_TABLE table->setNumCols( table->numCols() + 1 ); QMap<QString, bool> m; for ( int i = 0; i < table->numCols() - 1; ++i ) m.insert( table->horizontalHeader()->label( i ), TRUE ); int n = table->numCols() - 1; QString t = QString::number( n ); while ( m.find( t ) != m.end() ) t = QString::number( ++n ); table->horizontalHeader()->setLabel( table->numCols() - 1, t ); listColumns->insertItem( t ); QListBoxItem *item = listColumns->item( listColumns->count() - 1 ); listColumns->setCurrentItem( item ); listColumns->setSelected( item, TRUE ); #ifndef QT_NO_SQL if ( ::qt_cast<QDataTable*>(editTable) ) { comboFields->setFocus(); } else #endif { editColumnText->setFocus(); editColumnText->selectAll(); } #endif }
QString EvaluateSubExpression(const QString& subexpr, const QVariant& v) { if (subexpr.size() == 0) { // limit the displayed decimal places if ((QMetaType::Type)v.type() == QMetaType::Double) { return QString::number(v.toDouble(), 'f', 2); } return v.toString(); } else if (subexpr.at(0) == '[') { int rightbracket = subexpr.indexOf(']'); if (rightbracket > 0) { bool ok = false; int index = subexpr.mid(1, rightbracket-1).toInt(&ok); if (ok && (QMetaType::Type)v.type() == QMetaType::QVariantList) { return EvaluateSubExpression(subexpr.mid(rightbracket + 1), v.toList().at(index)); } } } else { int dot = subexpr.indexOf('.'); QString key = subexpr.mid(0, dot); if ((QMetaType::Type)v.type() == QMetaType::QVariantHash) { QHash<QString, QVariant> h = v.toHash(); QHash<QString, QVariant>::const_iterator it = h.find(key); if (it != h.end()) return EvaluateSubExpression(subexpr.mid(key.length() + 1), *it); } else if ((QMetaType::Type)v.type() == QMetaType::QVariantMap) { QMap<QString, QVariant> h = v.toMap(); QMap<QString, QVariant>::const_iterator it = h.find(key); if (it != h.end()) return EvaluateSubExpression(subexpr.mid(key.length() + 1), *it); } } return ""; }
void ExpressionType::assumptionsUnion(QMap<QString, ExpressionType>& data, const QMap<QString, ExpressionType>& newmap) { // qDebug() << "-----------" << data << newmap; QMap<QString, ExpressionType>::const_iterator it=newmap.constBegin(), itEnd=newmap.constEnd(); for(; it!=itEnd; ++it) { QMap<QString, ExpressionType>::iterator current = data.find(it.key()); if(current!=data.end()) { if(current->canReduceTo(*it)) { data.insert(it.key(), minimumType(*current, *it)); } else { bool correct=false; ExpressionType t(Many); ExpressionType t1(*it); correct= t1.addAssumption(it.key(), *it); ExpressionType t2(*current); correct|=t2.addAssumption(it.key(), *current); Q_ASSERT(correct); t.addAlternative(t1); t.addAlternative(t2); data.insert(it.key(), t); } } else data.insert(it.key(), it.value()); } // qDebug() << "leeeeee" << data; }
bool ExpressionType::assumptionsMerge(QMap<QString, ExpressionType>& data, const QMap<QString, ExpressionType>& newmap) { if(data.isEmpty() && newmap.isEmpty()) return true; // static int i=0; // qDebug() << "merging!" << i++ << data << newmap; QMap<int, ExpressionType> stars; QMap<QString, ExpressionType>::const_iterator it=newmap.constBegin(), itEnd=newmap.constEnd(); for(; it!=itEnd; ++it) { QMap<QString, ExpressionType>::iterator current = data.find(it.key()); if(current!=data.end()) { if(!current->isError()) { ExpressionType t=ExpressionType::minimumType(*it, *current); // qDebug() << "miiiiiiin" << it.key() << *it << *current << t << "|||" << it->assumptions() << current->assumptions() << t.assumptions(); if(t.isError()) return false; stars=computeStars(stars, *it, *current); *current = t.starsToType(stars); } } else data.insert(it.key(), it.value()); } // qDebug() << "merging_" << data; for(QMap<QString, ExpressionType>::iterator it=data.begin(); it!=data.end(); ++it) { *it=it->starsToType(stars); } // i--; return true; }
bool Model::EdgeDAO::addEdgesColorToDB( QSqlDatabase* conn, QMap<qlonglong, osg::ref_ptr<Data::Edge> >* edges, Data::GraphLayout* layout, QMap<qlonglong, qlonglong> newMetaEdgeID, bool meta ) { QMap< qlonglong,osg::ref_ptr<Data::Edge> >::const_iterator iEdges = edges->constBegin(); qlonglong edgeID; QMap<qlonglong, qlonglong>::iterator edgeIdIter; while ( iEdges != edges->constEnd() ) { //ulozime farbu len hranam, ktore maju farbu inu nez default if ( iEdges.value()->getEdgeColor()[0] != 1.f || iEdges.value()->getEdgeColor()[1] != 1.f ||iEdges.value()->getEdgeColor()[2] != 1.f ||iEdges.value()->getEdgeColor()[3] != 1.f ) { if ( meta ) { if ( newMetaEdgeID.contains( iEdges.value()->getId() ) ) { edgeIdIter = newMetaEdgeID.find( iEdges.value()->getId() ); edgeID = edgeIdIter.value(); } else { qDebug() << "[Model::NodeDAO::addEdgesColorToDB] Edge ID: " << iEdges.value()->getId() << " mismatch"; } } else { edgeID = iEdges.value()->getId(); } addSetings( conn, iEdges.value()->getGraph()->getId(), layout->getId(), edgeID, "color_r", iEdges.value()->getEdgeColor()[0] ); addSetings( conn, iEdges.value()->getGraph()->getId(), layout->getId(), edgeID, "color_g", iEdges.value()->getEdgeColor()[1] ); addSetings( conn, iEdges.value()->getGraph()->getId(), layout->getId(), edgeID, "color_b", iEdges.value()->getEdgeColor()[2] ); addSetings( conn, iEdges.value()->getGraph()->getId(), layout->getId(), edgeID, "color_a", iEdges.value()->getEdgeColor()[3] ); } ++iEdges; } return true; }
bool Model::EdgeDAO::addEdgesScaleToDB( QSqlDatabase* conn, QMap<qlonglong, osg::ref_ptr<Data::Edge> >* edges, Data::GraphLayout* layout, QMap<qlonglong, qlonglong> newMetaEdgeID, bool meta, double defaultScale ) { QMap< qlonglong,osg::ref_ptr<Data::Edge> >::const_iterator iEdges = edges->constBegin(); qlonglong edgeID; QMap<qlonglong, qlonglong>::iterator edgeIdIter; while ( iEdges != edges->constEnd() ) { //ulozime scale len hranam, ktore maju scale ine nez default bool isNotDefault = !qFuzzyCompare( iEdges.value()->getScale(),defaultScale ); if ( isNotDefault ) { if ( meta ) { if ( newMetaEdgeID.contains( iEdges.value()->getId() ) ) { edgeIdIter = newMetaEdgeID.find( iEdges.value()->getId() ); edgeID = edgeIdIter.value(); } else { qDebug() << "[Model::NodeDAO::addEdgesScaleToDB] Edge ID: " << iEdges.value()->getId() << " mismatch"; } } else { edgeID = iEdges.value()->getId(); } addSetings( conn, iEdges.value()->getGraph()->getId(), layout->getId(), edgeID, "scale", iEdges.value()->getScale() ); } ++iEdges; } return true; }
QStringList QgsServerProjectParser::wcsLayerNames() const { QStringList layerNameList; QMap<QString, QgsMapLayer*> layerMap; projectLayerMap( layerMap ); QgsMapLayer* currentLayer = nullptr; QStringList wcsIdList = wcsLayers(); QStringList::const_iterator wcsIdIt = wcsIdList.constBegin(); for ( ; wcsIdIt != wcsIdList.constEnd(); ++wcsIdIt ) { QMap<QString, QgsMapLayer*>::const_iterator layerMapIt = layerMap.find( *wcsIdIt ); if ( layerMapIt != layerMap.constEnd() ) { currentLayer = layerMapIt.value(); if ( currentLayer ) { layerNameList.append( mUseLayerIDs ? currentLayer->id() : currentLayer->name() ); } } } return layerNameList; }
QMap<qlonglong, osg::Vec4f> Model::EdgeDAO::getColors(QSqlDatabase* conn, bool* error, qlonglong graphID, qlonglong layoutID) { *error = FALSE; bool error2 = false; osg::Vec4f color; qlonglong id; QMap<qlonglong, osg::Vec4f> colors; QMap<qlonglong, QString> edgeColorR; QMap<qlonglong, QString> edgeColorG; QMap<qlonglong, QString> edgeColorB; QMap<qlonglong, QString> edgeColorA; QMap<qlonglong, QString>::iterator iter_r; QMap<qlonglong, QString>::iterator iter_g; QMap<qlonglong, QString>::iterator iter_b; QMap<qlonglong, QString>::iterator iter_a; edgeColorR = getSettings(conn, &error2, graphID, layoutID, "color_r"); edgeColorG = getSettings(conn, &error2, graphID, layoutID, "color_g"); edgeColorB = getSettings(conn, &error2, graphID, layoutID, "color_b"); edgeColorA = getSettings(conn, &error2, graphID, layoutID, "color_a"); for(iter_r = edgeColorR.begin(); iter_r != edgeColorR.end(); iter_r++) { id = iter_r.key(); iter_g = edgeColorG.find(id); iter_b = edgeColorB.find(id); iter_a = edgeColorA.find(id); color = osg::Vec4f(iter_r.value().toFloat(), iter_g.value().toFloat(), iter_b.value().toFloat(), iter_a.value().toFloat()); colors.insert(id, color); } return colors; }