// recursively write clusters and nodes static void write_ogml_graph(const ClusterGraphAttributes &A, cluster c, int level, ostream &os) { if(level > 0) { GraphIO::indent(os,2+level) << "<node id=\"c" << c->index() << "\">\n"; if (A.has(GraphAttributes::nodeLabel)) { GraphIO::indent(os,4) << "<label id=\"lc" << c->index() << "\">\n"; GraphIO::indent(os,5) << "<content>" << formatLabel(A.label(c)) << "</content>\n"; GraphIO::indent(os,4) << "</label>\n"; } } ListConstIterator<node> itn; for (itn = c->nBegin(); itn.valid(); ++itn) { node v = *itn; GraphIO::indent(os,3+level) << "<node id=\"n" << v->index() << "\">\n"; if (A.has(GraphAttributes::nodeLabel)) { GraphIO::indent(os,4) << "<label id=\"ln" << v->index() << "\">\n"; GraphIO::indent(os,5) << "<content>" << formatLabel(A.label(v)) << "</content>\n"; GraphIO::indent(os,4) << "</label>\n"; } GraphIO::indent(os,3+level) << "</node>\n"; } for (cluster child : c->children) { write_ogml_graph(child, level+1, os); } if(level > 0) { GraphIO::indent(os,2+level) << "</node>\n"; } }
void QgsSpatialQueryDialog::on_cbTypeItems_currentIndexChanged( int index ) { // Get Value type Item QVariant qtypItem = cbTypeItems->itemData( index ); TypeItems typeItem = ( TypeItems ) qtypItem.toInt(); QgsFeatureIds *setItems = 0; int totalFeat = mLayerTarget->featureCount(); switch ( typeItem ) { case itemsResult: setItems = &mFeatureResult; break; case itemsInvalidTarget: setItems = &mFeatureInvalidTarget; break; case itemsInvalidReference: setItems = &mFeatureInvalidReference; totalFeat = mLayerReference->featureCount(); break; default: return; } lwFeatures->blockSignals( true ); lwFeatures->clear(); int totalItens = setItems->size(); if ( totalItens > 0 ) { // Populate lwFeatures QSetIterator <QgsFeatureId> item( *setItems ); QListWidgetItem *lwItem = NULL; while ( item.hasNext() ) { lwItem = new QListWidgetItem( lwFeatures ); QVariant fid = QVariant( item.next() ); lwItem->setData( Qt::UserRole, fid ); // Data lwItem->setData( Qt::DisplayRole, fid ); // Label lwFeatures->addItem( lwItem ); } lwFeatures->sortItems(); lwFeatures->blockSignals( false ); lwFeatures->setCurrentRow( 0 ); // Has signal/slot for change current item in ListWidget } else { mRubberSelectId->reset(); lwFeatures->blockSignals( false ); } // Set lbStatusItems and pbCreateLayer QString formatLabel( tr( "%1 of %2 identified" ) ); lbStatusItems->setText( formatLabel.arg( totalItens ).arg( totalFeat ) ); pbCreateLayerItems->setEnabled( totalItens > 0 ); ckbZoomItem->setEnabled( totalItens > 0 ); }
void QgsSpatialQueryDialog::setSelectedGui() { int selectedFeat = mLayerTarget->selectedFeatureCount(); int totalFeat = mLayerTarget->featureCount(); QString formatLabel( tr( "%1 of %2 selected by \"%3\"" ) ); if ( ! mIsSelectedOperator ) { mSourceSelected = tr( "user" ); } lbStatusSelected->setText( formatLabel.arg( selectedFeat ).arg( totalFeat ).arg( mSourceSelected ) ); mIsSelectedOperator = false; pbCreateLayerSelected->setEnabled( selectedFeat > 0 ); } // void QgsSpatialQueryDialog::setSelectedGui()
static void write_ogml_graph_edges(const GraphAttributes &A, ostream &os) { const Graph &G = A.constGraph(); for(edge e : G.edges) { GraphIO::indent(os,3) << "<edge id=\"e" << e->index() << "\">\n"; if (A.has(GraphAttributes::edgeLabel)) { GraphIO::indent(os,4) << "<label id=\"le" << e->index() << "\">\n"; GraphIO::indent(os,5) << "<content>" << formatLabel(A.label(e)) << "</content>\n"; GraphIO::indent(os,4) << "</label>\n"; } GraphIO::indent(os,4) << "<source idRef=\"n" << e->source()->index() << "\" />\n"; GraphIO::indent(os,4) << "<target idRef=\"n" << e->target()->index() << "\" />\n"; GraphIO::indent(os,3) << "</edge>\n"; } }
void MainWindow::setParamatersLabels() { ui->lblPopulation->setText(formatLabel("Population size: ", QString::number(simulator.getParameters().populationSize))); ui->lblBitCount->setText(formatLabel("Bit count: ", QString::number(simulator.getParameters().bitCount))); ui->lblFinishCond->setText(formatLabel("Finish condition: ",EnumParser<FinishCondition>::instance(). toString(simulator.getParameters().finishCondition))); ui->lblMutationType->setText(formatLabel("Mutation type: ",EnumParser<MutationType>::instance(). toString(simulator.getParameters().mutationType))); ui->lblSelectionType->setText(formatLabel("Selection type: ",EnumParser<SelectionType>::instance(). toString(simulator.getParameters().selectionType))); ui->lblFinishCondCoeff->setText(formatLabel("Finish point: ",QString::number(simulator.getParameters().finishCoefficient))); ui->lblMutationCoeff->setText(formatLabel("Mutation coefficient: ",QString::number(simulator.getParameters().mutationCoefficient))); QString mutatedBit = simulator.getParameters().mutationType == MutationType::ChosenBit ? QString::number(simulator.getParameters().mutationBit) : "random"; ui->lblMutationBit->setText(formatLabel("Mutated bit: ", mutatedBit)); }
// write graph structure with attributes static void write_ogml_graph(const GraphAttributes &A, ostream &os) { const Graph &G = A.constGraph(); GraphIO::indent(os,2) << "<structure>\n"; for(node v : G.nodes) { GraphIO::indent(os,3) << "<node id=\"n" << v->index() << "\">\n"; if (A.has(GraphAttributes::nodeLabel)) { GraphIO::indent(os,4) << "<label id=\"ln" << v->index() << "\">\n"; GraphIO::indent(os,5) << "<content>" << formatLabel(A.label(v)) << "</content>\n"; GraphIO::indent(os,4) << "</label>\n"; } GraphIO::indent(os,3) << "</node>\n"; } write_ogml_graph_edges(A, os); GraphIO::indent(os,2) << "</structure>\n"; }
QString RDimAlignedData::getAutoLabel() const { double distance = getMeasuredValue(); distance *= linearFactor; return formatLabel(distance); }
QString RDimOrdinateData::getAutoLabel() const { double distance = getMeasuredValue(); return formatLabel(distance); }
//------------------------------------------------------------------------------ void ThorneTreeWriter::WriteLeaf () { *f << formatLabel (cur->GetLabel()); }