当前位置: 首页>>代码示例>>C++>>正文


C++ QDomElement::elementsByTagName方法代码示例

本文整理汇总了C++中QDomElement::elementsByTagName方法的典型用法代码示例。如果您正苦于以下问题:C++ QDomElement::elementsByTagName方法的具体用法?C++ QDomElement::elementsByTagName怎么用?C++ QDomElement::elementsByTagName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在QDomElement的用法示例。


在下文中一共展示了QDomElement::elementsByTagName方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: doc_insert_geometric_object

int QilexDoc::doc_insert_geometric_object(QDomElement geom_element)
{
   int error = 0;
   const char * buffer;
    
   SbVec3f joinax;
   SoTransform *pos_rot = new SoTransform;

   float joinangle;
   float pos_x, pos_y, pos_z, pos_rx, pos_ry, pos_rz;

   QString data, name;

   QDomNode node;
   QDomElement element;
   QDomNodeList list;

   SoSeparator *geomelement = new SoSeparator;
   SoSeparator *geomtest = new SoSeparator;
   
   name = geom_element.attribute ("name", QString::null);

   data = geom_element.attribute ("pos_x", QString::null);
   pos_x = data.toFloat();

   data = geom_element.attribute ("pos_y", QString::null);
   pos_y = data.toFloat();

   data = geom_element.attribute ("pos_z", QString::null);
   pos_z = data.toFloat();

   data = geom_element.attribute ("pos_rx", QString::null);
   pos_rx = data.toFloat();

   data = geom_element.attribute ("pos_ry", QString::null);
   pos_ry = data.toFloat();

   data = geom_element.attribute ("pos_rz", QString::null);
   pos_rz = data.toFloat();

   data = geom_element.attribute ("pos_angle", QString::null);
   joinangle = data.toFloat();

   joinax.setValue(SbVec3f( pos_x, pos_y, pos_z));
   pos_rot->translation.setValue(joinax);
   pos_rot->rotation.setValue(SbVec3f(pos_rx, pos_ry, pos_rz), (float) rad((double)joinangle));
   
   list = geom_element.elementsByTagName ("model3d");
   if (list.length() == 1)
   {
      node = list.item(0);
      element = node.toElement();

      data = element.attribute ("format", QString::null);
      // some stuff to take care about the format

      data = element.attribute ("size", QString::null);
      size_t size = (size_t)data.toULong(0,10);
      buffer = new char[size];

      data = element.text();
      buffer = data.ascii();

      SoInput input;
      input.setBuffer((void*) buffer, size);

      if (input.isValidBuffer())
      {
         geomelement = SoDB::readAll(&input);
         if (geomelement == NULL)
            error = 10;
      }
      else
         {error = 8;} //   assigno un nombre diferent de 0
   }
   else
   { error =9; }// assigno un nombre diferent de 0

   if (error == 0)
   {
      geomelement->ref();
      geomtest = (SoSeparator*)SoNode::getByName(name.latin1());

      if (geomtest==NULL)
      {
         //we need to put it in a buffer to write the xml file
         // if is Ok
         geomelement->insertChild(pos_rot, 0);
         geomelement->setName(name.latin1());
         view->addObjectCell(geomelement);
      }
   }
   return error; 
}
开发者ID:BackupTheBerlios,项目名称:qilex-svn,代码行数:94,代码来源:qilexdoc.cpp

示例2: deleteCurrentPlot

void plotsDialog::deleteCurrentPlot()
{
    QMessageBox * askBox = new QMessageBox(this);
    askBox->addButton("Delete",QMessageBox::YesRole);
    askBox->addButton("Cancel",QMessageBox::NoRole);
    askBox->setText("Confirm to delete the plot?");
    askBox->setWindowTitle("Warning");
    askBox->exec();
    if(askBox->buttonRole(askBox->clickedButton())==QMessageBox::YesRole)
    {
        Plot* plotToDelete = dynamic_cast<Plot*>(tabs->currentWidget());
#ifdef Q_OS_WIN32
        QFile file("plotTemp.xml");
#endif
#ifdef Q_OS_MAC
        QDir dir = qApp->applicationDirPath();
        /*dir.cdUp();*/
        /*dir.cdUp();*/
        /*dir.cdUp();*/
        QString bundleDir(dir.absolutePath());
        QFile file(bundleDir+"/plotTemp.xml");
#endif
        if(!file.open(QIODevice::ReadWrite|QIODevice::Text))
        {
            return;
            globalpara.reportError("Fail to open xml file for plots!",this);
        }
        else
        {
            QDomDocument doc;
            QTextStream stream;
            stream.setDevice(&file);
            if(!doc.setContent(&file))
            {
                globalpara.reportError("Fail to load xml document for plots!",this);
                file.close();
                return;
            }
            else
            {
                QDomElement plotData = doc.elementsByTagName("plotData").at(0).toElement();
                plotData.removeChild(plotData.elementsByTagName(tabs->tabText(tabs->currentIndex())).at(0));
            }
            file.resize(0);
            doc.save(stream,4);
            file.close();
            stream.flush();
        }


        if(tabs->count()>1)
        {
            tabs->removeTab(tabs->currentIndex());
        }
        else if(tabs->count()==1)
        {
            this->close();
        }
    }
    else return;
}
开发者ID:oabdelaziz,项目名称:SorpSim,代码行数:61,代码来源:plotsdialog.cpp

示例3: handleProviderData

void NewstuffModelPrivate::handleProviderData(QNetworkReply *reply)
{
    if ( reply->operation() == QNetworkAccessManager::HeadOperation ) {
        const QVariant redirectionAttribute = reply->attribute( QNetworkRequest::RedirectionTargetAttribute );
        if ( !redirectionAttribute.isNull() ) {
            for ( int i=0; i<m_items.size(); ++i ) {
                NewstuffItem &item = m_items[i];
                if ( item.m_payloadUrl == reply->url() ) {
                    item.m_payloadUrl = redirectionAttribute.toUrl();
                }
            }
            m_networkAccessManager.head( QNetworkRequest( redirectionAttribute.toUrl() ) );
            return;
        }

        QVariant const size = reply->header( QNetworkRequest::ContentLengthHeader );
        if ( size.isValid() ) {
            qint64 length = size.value<qint64>();
            for ( int i=0; i<m_items.size(); ++i ) {
                NewstuffItem &item = m_items[i];
                if ( item.m_payloadUrl == reply->url() ) {
                    item.m_payloadSize = length;
                    QModelIndex const affected = m_parent->index( i );
                    emit m_parent->dataChanged( affected, affected );
                }
            }
        }
        return;
    }

    FetchPreviewJob *const job = m_networkJobs.take( reply );

    // check if we are redirected
    const QVariant redirectionAttribute = reply->attribute( QNetworkRequest::RedirectionTargetAttribute );
    if ( !redirectionAttribute.isNull() ) {
        QNetworkReply *redirectReply = m_networkAccessManager.get( QNetworkRequest( QUrl( redirectionAttribute.toUrl() ) ) );
        if ( job ) {
            m_networkJobs.insert( redirectReply, job );
        }
        return;
    }

    if ( job ) {
        job->run( reply->readAll() );
        delete job;
        return;
    }

    QDomDocument xml;
    if ( !xml.setContent( reply->readAll() ) ) {
        mDebug() << "Cannot parse newstuff xml data ";
        return;
    }

    m_items.clear();

    QDomElement root = xml.documentElement();
    QDomNodeList items = root.elementsByTagName( "stuff" );
#if QT_VERSION < 0x050000
    unsigned int i=0;
#else
    int i=0;
#endif
    for ( ; i < items.length(); ++i ) {
        m_items << importNode( items.item( i ) );
    }

    updateModel();
}
开发者ID:abhgangwar,项目名称:marble,代码行数:69,代码来源:NewstuffModel.cpp

示例4: createTransactionDocument

  QDomDocument createTransactionDocument( QgsServerInterface* serverIface, const QString& version,
                                          const QgsServerRequest& request )
  {
    Q_UNUSED( version );

    QDomDocument doc;

    QgsWfsProjectParser* configParser = getConfigParser( serverIface );
#ifdef HAVE_SERVER_PYTHON_PLUGINS
    QgsAccessControl* accessControl = serverIface->accessControls();
#endif
    const QString requestBody = request.getParameter( QStringLiteral( "REQUEST_BODY" ) );

    QString errorMsg;
    if ( !doc.setContent( requestBody, true, &errorMsg ) )
    {
      throw QgsRequestNotWellFormedException( errorMsg );
    }

    QDomElement docElem = doc.documentElement();
    QDomNodeList docChildNodes = docElem.childNodes();

    // Re-organize the transaction document
    QDomDocument mDoc;
    QDomElement mDocElem = mDoc.createElement( QStringLiteral( "myTransactionDocument" ) );
    mDocElem.setAttribute( QStringLiteral( "xmlns" ), QGS_NAMESPACE );
    mDocElem.setAttribute( QStringLiteral( "xmlns:wfs" ), WFS_NAMESPACE );
    mDocElem.setAttribute( QStringLiteral( "xmlns:gml" ), GML_NAMESPACE );
    mDocElem.setAttribute( QStringLiteral( "xmlns:ogc" ), OGC_NAMESPACE );
    mDocElem.setAttribute( QStringLiteral( "xmlns:qgs" ), QGS_NAMESPACE );
    mDocElem.setAttribute( QStringLiteral( "xmlns:xsi" ), QStringLiteral( "http://www.w3.org/2001/XMLSchema-instance" ) );
    mDoc.appendChild( mDocElem );

    QDomElement actionElem;
    QString actionName;
    QDomElement typeNameElem;
    QString typeName;

    for ( int i = docChildNodes.count(); 0 < i; --i )
    {
      actionElem = docChildNodes.at( i - 1 ).toElement();
      actionName = actionElem.localName();

      if ( actionName == QLatin1String( "Insert" ) )
      {
        QDomElement featureElem = actionElem.firstChild().toElement();
        typeName = featureElem.localName();
      }
      else if ( actionName == QLatin1String( "Update" ) )
      {
        typeName = actionElem.attribute( QStringLiteral( "typeName" ) );
      }
      else if ( actionName == QLatin1String( "Delete" ) )
      {
        typeName = actionElem.attribute( QStringLiteral( "typeName" ) );
      }

      if ( typeName.contains( QLatin1String( ":" ) ) )
        typeName = typeName.section( QStringLiteral( ":" ), 1, 1 );

      QDomNodeList typeNameList = mDocElem.elementsByTagName( typeName );
      if ( typeNameList.count() == 0 )
      {
        typeNameElem = mDoc.createElement( typeName );
        mDocElem.appendChild( typeNameElem );
      }
      else
        typeNameElem = typeNameList.at( 0 ).toElement();

      typeNameElem.appendChild( actionElem );
    }

    // It's time to make the transaction
    // Create the response document
    QDomDocument resp;
    //wfs:WFS_TransactionRespone element
    QDomElement respElem = resp.createElement( QStringLiteral( "WFS_TransactionResponse" )/*wfs:WFS_TransactionResponse*/ );
    respElem.setAttribute( QStringLiteral( "xmlns" ), WFS_NAMESPACE );
    respElem.setAttribute( QStringLiteral( "xmlns:xsi" ), QStringLiteral( "http://www.w3.org/2001/XMLSchema-instance" ) );
    respElem.setAttribute( QStringLiteral( "xsi:schemaLocation" ), WFS_NAMESPACE + " http://schemas.opengis.net/wfs/1.0.0/wfs.xsd" );
    respElem.setAttribute( QStringLiteral( "xmlns:ogc" ), OGC_NAMESPACE );
    respElem.setAttribute( QStringLiteral( "version" ), QStringLiteral( "1.0.0" ) );
    resp.appendChild( respElem );

    // Store the created feature id for WFS
    QStringList insertResults;
    // Get the WFS layers id
    QStringList wfsLayersId = configParser->wfsLayers();;

    QList<QgsMapLayer*> layerList;
    QgsMapLayer* currentLayer = nullptr;

    // Loop through the layer transaction elements
    docChildNodes = mDocElem.childNodes();
    for ( int i = 0; i < docChildNodes.count(); ++i )
    {
      // Get the vector layer
      typeNameElem = docChildNodes.at( i ).toElement();
      typeName = typeNameElem.tagName();

//.........这里部分代码省略.........
开发者ID:wongjimsan,项目名称:QGIS,代码行数:101,代码来源:qgswfstransaction.cpp

示例5: sublayersOfEmbeddedGroup

QSet<QString> QgsServerProjectParser::findRestrictedLayers() const
{
  QSet<QString> restrictedLayerSet;

  if ( !mXMLDoc )
  {
    return restrictedLayerSet;
  }

  //names of unpublished layers / groups
  QDomElement propertiesElem = mXMLDoc->documentElement().firstChildElement( "properties" );
  if ( !propertiesElem.isNull() )
  {
    QDomElement wmsLayerRestrictionElem = propertiesElem.firstChildElement( "WMSRestrictedLayers" );
    if ( !wmsLayerRestrictionElem.isNull() )
    {
      QStringList restrictedLayersAndGroups;
      QDomNodeList wmsLayerRestrictionValues = wmsLayerRestrictionElem.elementsByTagName( "value" );
      for ( int i = 0; i < wmsLayerRestrictionValues.size(); ++i )
      {
        restrictedLayerSet.insert( wmsLayerRestrictionValues.at( i ).toElement().text() );
      }
    }
  }

  //get legend dom element
  if ( restrictedLayerSet.size() < 1 || !mXMLDoc )
  {
    return restrictedLayerSet;
  }

  QDomElement legendElem = mXMLDoc->documentElement().firstChildElement( "legend" );
  if ( legendElem.isNull() )
  {
    return restrictedLayerSet;
  }

  //go through all legend groups and insert names of subgroups / sublayers if there is a match
  QDomNodeList legendGroupList = legendElem.elementsByTagName( "legendgroup" );
  for ( int i = 0; i < legendGroupList.size(); ++i )
  {
    //get name
    QDomElement groupElem = legendGroupList.at( i ).toElement();
    QString groupName = groupElem.attribute( "name" );
    if ( restrictedLayerSet.contains( groupName ) ) //match: add names of subgroups and sublayers to set
    {
      //embedded group? -> also get names of subgroups and sublayers from embedded projects
      if ( groupElem.attribute( "embedded" ) == "1" )
      {
        sublayersOfEmbeddedGroup( convertToAbsolutePath( groupElem.attribute( "project" ) ), groupName, restrictedLayerSet );
      }
      else //local group
      {
        QDomNodeList subgroupList = groupElem.elementsByTagName( "legendgroup" );
        for ( int j = 0; j < subgroupList.size(); ++j )
        {
          restrictedLayerSet.insert( subgroupList.at( j ).toElement().attribute( "name" ) );
        }
        QDomNodeList sublayerList = groupElem.elementsByTagName( "legendlayer" );
        for ( int k = 0; k < sublayerList.size(); ++k )
        {
          restrictedLayerSet.insert( sublayerList.at( k ).toElement().attribute( "name" ) );
        }
      }
    }
  }
  return restrictedLayerSet;
}
开发者ID:Jokenbol,项目名称:QGIS,代码行数:68,代码来源:qgsserverprojectparser.cpp

示例6: parseAndAssignInfos

/**
 * @brief Parses info XML data and assigns it to the given tv show object
 * @param xml XML data
 * @param show Tv Show object
 * @param updateAllEpisodes Update all child episodes (regardless if they already have infos or not)
 */
void TheTvDb::parseAndAssignInfos(QString xml, TvShow *show, TvShowUpdateType updateType, QList<int> infosToLoad)
{
    QDomDocument domDoc;
    domDoc.setContent(xml);

    if (updateType == UpdateShow || updateType == UpdateShowAndAllEpisodes || updateType == UpdateShowAndNewEpisodes) {
        show->clear(infosToLoad);
        if (!domDoc.elementsByTagName("Series").isEmpty()) {
            QDomElement elem = domDoc.elementsByTagName("Series").at(0).toElement();
            if (infosToLoad.contains(TvShowScraperInfos::Certification) && !elem.elementsByTagName("ContentRating").isEmpty())
                show->setCertification(Helper::mapCertification(elem.elementsByTagName("ContentRating").at(0).toElement().text()));
            if (infosToLoad.contains(TvShowScraperInfos::FirstAired) && !elem.elementsByTagName("FirstAired").isEmpty())
                show->setFirstAired(QDate::fromString(elem.elementsByTagName("FirstAired").at(0).toElement().text(), "yyyy-MM-dd"));
            if (infosToLoad.contains(TvShowScraperInfos::Genres) && !elem.elementsByTagName("Genre").isEmpty())
                show->setGenres(Helper::mapGenre(elem.elementsByTagName("Genre").at(0).toElement().text().split("|", QString::SkipEmptyParts)));
            if (infosToLoad.contains(TvShowScraperInfos::Network) && !elem.elementsByTagName("Network").isEmpty())
                show->setNetwork(elem.elementsByTagName("Network").at(0).toElement().text());
            if (infosToLoad.contains(TvShowScraperInfos::Overview) && !elem.elementsByTagName("Overview").isEmpty())
                show->setOverview(elem.elementsByTagName("Overview").at(0).toElement().text());
            if (infosToLoad.contains(TvShowScraperInfos::Rating) && !elem.elementsByTagName("Rating").isEmpty())
                show->setRating(elem.elementsByTagName("Rating").at(0).toElement().text().toFloat());
            if (infosToLoad.contains(TvShowScraperInfos::Title) && !elem.elementsByTagName("SeriesName").isEmpty())
                show->setName(elem.elementsByTagName("SeriesName").at(0).toElement().text());
        }
    }

    if (updateType == UpdateAllEpisodes || updateType == UpdateNewEpisodes || updateType == UpdateShowAndAllEpisodes || updateType == UpdateShowAndNewEpisodes) {
        for (int i=0, n=domDoc.elementsByTagName("Episode").count() ; i<n ; ++i) {
            QDomElement elem = domDoc.elementsByTagName("Episode").at(i).toElement();
            if (!elem.elementsByTagName("SeasonNumber").isEmpty() && !elem.elementsByTagName("EpisodeNumber").isEmpty()) {
                int seasonNumber = elem.elementsByTagName("SeasonNumber").at(0).toElement().text().toInt();
                int episodeNumber = elem.elementsByTagName("EpisodeNumber").at(0).toElement().text().toInt();
                TvShowEpisode *episode = show->episode(seasonNumber, episodeNumber);
                if (!episode->isValid())
                    continue;
                if (updateType == UpdateAllEpisodes || updateType == UpdateShowAndAllEpisodes ||
                        ((updateType == UpdateNewEpisodes || updateType == UpdateShowAndNewEpisodes) && !episode->infoLoaded())) {
                    episode->clear(infosToLoad);
                    parseAndAssignSingleEpisodeInfos(elem, episode, infosToLoad);
                }
            }
        }

    }
}
开发者ID:madsailor,项目名称:MediaElch,代码行数:51,代码来源:TheTvDb.cpp

示例7: parseAndAssignSingleEpisodeInfos

/**
 * @brief Parses XML data (dom element) and assigns it to the given episode object
 * @param elem Dom element
 * @param episode Episode object
 */
void TheTvDb::parseAndAssignSingleEpisodeInfos(QDomElement elem, TvShowEpisode *episode, QList<int> infosToLoad)
{
    if (infosToLoad.contains(TvShowScraperInfos::Director) && !elem.elementsByTagName("Director").isEmpty())
        episode->setDirectors(elem.elementsByTagName("Director").at(0).toElement().text().split("|", QString::SkipEmptyParts));
    if (infosToLoad.contains(TvShowScraperInfos::Title) && !elem.elementsByTagName("EpisodeName").isEmpty())
        episode->setName(elem.elementsByTagName("EpisodeName").at(0).toElement().text());
    if (infosToLoad.contains(TvShowScraperInfos::SeasonEpisode) && !elem.elementsByTagName("EpisodeNumber").isEmpty())
        episode->setEpisode(elem.elementsByTagName("EpisodeNumber").at(0).toElement().text().toInt());
    if (infosToLoad.contains(TvShowScraperInfos::FirstAired) && !elem.elementsByTagName("FirstAired").isEmpty())
        episode->setFirstAired(QDate::fromString(elem.elementsByTagName("FirstAired").at(0).toElement().text(), "yyyy-MM-dd"));
    if (infosToLoad.contains(TvShowScraperInfos::Overview) && !elem.elementsByTagName("Overview").isEmpty())
        episode->setOverview(elem.elementsByTagName("Overview").at(0).toElement().text());
    if (infosToLoad.contains(TvShowScraperInfos::Rating) && !elem.elementsByTagName("Rating").isEmpty())
        episode->setRating(elem.elementsByTagName("Rating").at(0).toElement().text().toFloat());
    if (infosToLoad.contains(TvShowScraperInfos::SeasonEpisode) && !elem.elementsByTagName("SeasonNumber").isEmpty())
        episode->setSeason(elem.elementsByTagName("SeasonNumber").at(0).toElement().text().toInt());
    if (infosToLoad.contains(TvShowScraperInfos::Writer) && !elem.elementsByTagName("Writer").isEmpty())
        episode->setWriters(elem.elementsByTagName("Writer").at(0).toElement().text().split("|", QString::SkipEmptyParts));
    if (infosToLoad.contains(TvShowScraperInfos::Thumbnail) && !elem.elementsByTagName("filename").isEmpty() &&
            !elem.elementsByTagName("filename").at(0).toElement().text().isEmpty()) {
        QString mirror = m_bannerMirrors.at(qrand()%m_bannerMirrors.count());
        episode->setThumbnail(QUrl(QString("%1/banners/%2").arg(mirror).arg(elem.elementsByTagName("filename").at(0).toElement().text())));
    }
    episode->setInfosLoaded(true);
}
开发者ID:madsailor,项目名称:MediaElch,代码行数:30,代码来源:TheTvDb.cpp

示例8: toSld

void QgsSingleBandGrayRenderer::toSld( QDomDocument &doc, QDomElement &element, const QgsStringMap &props ) const
{
  QgsStringMap newProps = props;

  // create base structure
  QgsRasterRenderer::toSld( doc, element, props );

  // look for RasterSymbolizer tag
  QDomNodeList elements = element.elementsByTagName( QStringLiteral( "sld:RasterSymbolizer" ) );
  if ( elements.size() == 0 )
    return;

  // there SHOULD be only one
  QDomElement rasterSymbolizerElem = elements.at( 0 ).toElement();

  // add Channel Selection tags
  // Need to insert channelSelection in the correct sequence as in SLD standard e.g.
  // after opacity or geometry or as first element after sld:RasterSymbolizer
  QDomElement channelSelectionElem = doc.createElement( QStringLiteral( "sld:ChannelSelection" ) );
  elements = rasterSymbolizerElem.elementsByTagName( QStringLiteral( "sld:Opacity" ) );
  if ( elements.size() != 0 )
  {
    rasterSymbolizerElem.insertAfter( channelSelectionElem, elements.at( 0 ) );
  }
  else
  {
    elements = rasterSymbolizerElem.elementsByTagName( QStringLiteral( "sld:Geometry" ) );
    if ( elements.size() != 0 )
    {
      rasterSymbolizerElem.insertAfter( channelSelectionElem, elements.at( 0 ) );
    }
    else
    {
      rasterSymbolizerElem.insertBefore( channelSelectionElem, rasterSymbolizerElem.firstChild() );
    }
  }

  // for gray band
  QDomElement channelElem = doc.createElement( QStringLiteral( "sld:GrayChannel" ) );
  channelSelectionElem.appendChild( channelElem );

  // set band
  QDomElement sourceChannelNameElem = doc.createElement( QStringLiteral( "sld:SourceChannelName" ) );
  sourceChannelNameElem.appendChild( doc.createTextNode( QString::number( grayBand() ) ) );
  channelElem.appendChild( sourceChannelNameElem );

  // set ContrastEnhancement
  if ( contrastEnhancement() )
  {
    QDomElement contrastEnhancementElem = doc.createElement( QStringLiteral( "sld:ContrastEnhancement" ) );
    contrastEnhancement()->toSld( doc, contrastEnhancementElem );

    // do changes to minValue/maxValues depending on stretching algorithm. This is necessary because
    // geoserver do a first stretch on min/max, then apply colo map rules. In some combination is necessary
    // to use real min/max values and in othere the actual edited min/max values
    switch ( contrastEnhancement()->contrastEnhancementAlgorithm() )
    {
      case QgsContrastEnhancement::StretchAndClipToMinimumMaximum:
      case QgsContrastEnhancement::ClipToMinimumMaximum:
      {
        // with this renderer export have to be check against real min/max values of the raster
        QgsRasterBandStats myRasterBandStats = mInput->bandStatistics( grayBand(), QgsRasterBandStats::Min | QgsRasterBandStats::Max );

        // if minimum range differ from the real minimum => set is in exported SLD vendor option
        if ( !qgsDoubleNear( contrastEnhancement()->minimumValue(), myRasterBandStats.minimumValue ) )
        {
          // look for VendorOption tag to look for that with minValue attribute
          QDomNodeList elements = contrastEnhancementElem.elementsByTagName( QStringLiteral( "sld:VendorOption" ) );
          for ( int i = 0; i < elements.size(); ++i )
          {
            QDomElement vendorOption = elements.at( i ).toElement();
            if ( vendorOption.attribute( QStringLiteral( "name" ) ) != QStringLiteral( "minValue" ) )
              continue;

            // remove old value and add the new one
            vendorOption.removeChild( vendorOption.firstChild() );
            vendorOption.appendChild( doc.createTextNode( QString::number( myRasterBandStats.minimumValue ) ) );
          }
        }
        break;
      }
      case QgsContrastEnhancement::UserDefinedEnhancement:
        break;
      case QgsContrastEnhancement::NoEnhancement:
        break;
      case QgsContrastEnhancement::StretchToMinimumMaximum:
        break;
    }

    channelElem.appendChild( contrastEnhancementElem );
  }

  // for each color set a ColorMapEntry tag nested into "sld:ColorMap" tag
  // e.g. <ColorMapEntry color="#EEBE2F" quantity="-300" label="label" opacity="0"/>
  QList< QPair< QString, QColor > > classes;
  legendSymbologyItems( classes );

  // add ColorMap tag
  QDomElement colorMapElem = doc.createElement( QStringLiteral( "sld:ColorMap" ) );
  rasterSymbolizerElem.appendChild( colorMapElem );
//.........这里部分代码省略.........
开发者ID:dmarteau,项目名称:QGIS,代码行数:101,代码来源:qgssinglebandgrayrenderer.cpp

示例9: createMapLayer

QgsMapLayer* QgsInterpolationLayerBuilder::createMapLayer( const QDomElement& elem, const QString& layerName, QList<QTemporaryFile*>& filesToRemove, QList<QgsMapLayer*>& layersToRemove, bool allowCaching ) const
{
  if ( !mVectorLayer )
  {
    return 0;
  }

  QDomNodeList interpolationList = elem.elementsByTagName( "Interpolation" );
  if ( interpolationList.size() < 1 )
  {
    QgsMSDebugMsg( "No Interpolation element found" );
    return 0;
  }
  QDomElement interpolationElem = interpolationList.at( 0 ).toElement();

  //create QgsInterpolator object from XML
  QDomNodeList tinList = interpolationElem.elementsByTagName( "TINMethod" );
  QDomNodeList idwList = interpolationElem.elementsByTagName( "IDWMethod" );

  QgsInterpolator* theInterpolator = 0;
  QList<QgsInterpolator::LayerData> layerDataList;
  QgsInterpolator::LayerData currentLayerData;
  currentLayerData.vectorLayer = mVectorLayer;
  QDomNodeList propertyNameList = interpolationElem.elementsByTagName( "PropertyName" );
  if ( propertyNameList.size() < 1 )
  {
    currentLayerData.zCoordInterpolation = true;
  }
  else
  {
    currentLayerData.zCoordInterpolation = false;

    //set attribute field interpolation or z-Coordinate interpolation
    QString attributeName = propertyNameList.at( 0 ).toElement().text();
    QgsVectorDataProvider* provider = mVectorLayer->dataProvider();
    if ( !provider )
    {
      return 0;
    }
    int attributeIndex = provider->fieldNameIndex( attributeName );
    if ( attributeIndex == -1 )
    {
      return 0; //attribute field not found
    }
    currentLayerData.interpolationAttribute = attributeIndex;
  }
  currentLayerData.mInputType = QgsInterpolator::POINTS;

  layerDataList.push_back( currentLayerData );

  if ( idwList.size() > 0 ) //inverse distance interpolator
  {
    theInterpolator = new QgsIDWInterpolator( layerDataList );

    //todo: parse <DistanceWeightingCoefficient>
  }
  else //tin is default
  {
    theInterpolator = new QgsTINInterpolator( layerDataList );
    //todo: parse <InterpolationFunction>
  }

  //Resolution
  int nCols, nRows;

  QDomNodeList resolutionNodeList = elem.elementsByTagName( "Resolution" );
  if ( resolutionNodeList.size() < 1 )
  {
    //use default values...
    nCols = 100;
    nRows = 100;
  }
  else
  {
    QDomElement resolutionElem = resolutionNodeList.at( 0 ).toElement();
    nCols = resolutionElem.attribute( "ncols" ).toInt();
    nRows = resolutionElem.attribute( "nrows" ).toInt();
    if ( nCols == 0 && nRows == 0 )
    {
      QgsMSDebugMsg( "Reading of resolution failed" );
      return 0;
    }
  }

  QTemporaryFile* tmpFile = new QTemporaryFile();
  if ( !tmpFile->open() )
  {
    delete tmpFile;
  }

  QgsRectangle extent = mVectorLayer->extent();
  QgsGridFileWriter gridWriter( theInterpolator, tmpFile->fileName(), extent, nCols, nRows, extent.width() / nCols, extent.height() / nRows );
  if ( gridWriter.writeFile( false ) != 0 )
  {
    QgsMSDebugMsg( "Interpolation of raster failed" );
    return 0;
  }

  filesToRemove.push_back( tmpFile ); //store raster in temporary file and remove after request
  QgsRasterLayer* theRaster = new QgsRasterLayer( tmpFile->fileName() );
//.........这里部分代码省略.........
开发者ID:RealworldSystems,项目名称:Quantum-GIS,代码行数:101,代码来源:qgsinterpolationlayerbuilder.cpp

示例10: log

/*static*/ QMenu* JMenuUtil::jMenuFromElement(QDomElement main, WindowInterface* wi, QObject* context)
{
 bool addSep = false;
 QString name = "<none>";
 Logger log("JMenuUtil");
 if (main.isNull())
 {
  log.warn("Menu from element called without an element");
  return new QMenu(name);
 }

 //name = LocaleSelector.getAttribute(main, "name");
 name = GuiUtilBase::getLocaleAttribute(main, "name");
 QMenu* menu = new QMenu(name);
 QList<int> mnemonicList = QList<int>();
 //QDomNodeList nodes = main.elementsByTagName("node");
 QDomNodeList nodes = main.childNodes();
 for(int i = 0; i < nodes.size(); i++)
 {
  QObject* menuItem = NULL;
  QDomElement child = nodes.at(i).toElement();
  if(child.tagName()!= "node")
   continue;
  if (child.elementsByTagName("node").size() == 0)
  {  // leaf
   //QAction* menuItem = NULL;
   if ((child.text().trimmed())==("separator"))
   {
    addSep = true;
   }
   else
   {
    if ((/*!SystemType.isMacOSX()*/
//                        && UIManager.getLookAndFeel().isNativeLookAndFeel() &&
         (!(child.firstChildElement("adapter").isNull()
        && child.firstChildElement("adapter").text()==("apps.gui3.TabbedPreferencesAction"))
        || !(child.firstChildElement("current").isNull()
        && child.firstChildElement("current").text()==("quit")))))
    {
     if (addSep)
     {
      menu->addSeparator();
      addSep = false;
     }
     QString leafName = child.attribute("name");
     Action* act = actionFromNode(child, wi, context);
     if(act !=NULL)
     {
      log.debug(tr("create action item '%1' in '%2' menu").arg(act->text()).arg(name));
      menu->addAction((QAction*)(menuItem = (QObject*)act));
      if(!child.firstChildElement("type").isNull())
      {
       if(child.firstChildElement("type").text() == "checkbox")
        act->setCheckable(true);
      }
      if (!child.firstChildElement("current").isNull())
      {
       //setMenuItemInterAction(context, child.firstChildElement("current").text(), menuItem);
       QString current = act->data().toString();
      ((RosterFrame*)wi)->currentMapper->setMapping(act,act);
      connect(act, SIGNAL(triggered(bool)), ((RosterFrame*)wi)->currentMapper, SLOT(map()));
      }
     }
    }
   }
  }
开发者ID:allenck,项目名称:DecoderPro_app,代码行数:66,代码来源:jmenuutil.cpp

示例11: sendGetFeatureInfoResponse

void QgsGetRequestHandler::sendGetFeatureInfoResponse( const QDomDocument& infoDoc, const QString& infoFormat ) const
{
  QByteArray ba;
  QgsMSDebugMsg( "Info format is:" + infoFormat );

  if ( infoFormat == "text/xml" )
  {
    ba = infoDoc.toByteArray();
  }
  else if ( infoFormat == "text/plain" || infoFormat == "text/html" )
  {
    //create string
    QString featureInfoString;

    if ( infoFormat == "text/plain" )
    {
      featureInfoString.append( "GetFeatureInfo results\n" );
      featureInfoString.append( "\n" );
    }
    else if ( infoFormat == "text/html" )
    {
      featureInfoString.append( "<HEAD>\n" );
      featureInfoString.append( "<TITLE> GetFeatureInfo results </TITLE>\n" );
      featureInfoString.append( "<meta http-equiv=\"Content-Type\" content=\"text/html;charset=utf-8\">\n" );
      featureInfoString.append( "</HEAD>\n" );
      featureInfoString.append( "<BODY>\n" );
    }

    QDomNodeList layerList = infoDoc.elementsByTagName( "Layer" );

    //layer loop
    for ( int i = 0; i < layerList.size(); ++i )
    {
      QDomElement layerElem = layerList.at( i ).toElement();
      if ( infoFormat == "text/plain" )
      {
        featureInfoString.append( "Layer '" + layerElem.attribute( "name" ) + "'\n" );
      }
      else if ( infoFormat == "text/html" )
      {
        featureInfoString.append( "<TABLE border=1 width=100%>\n" );
        featureInfoString.append( "<TR><TH width=25%>Layer</TH><TD>" + layerElem.attribute( "name" ) + "</TD></TR>\n" );
        featureInfoString.append( "</BR>" );
      }

      //feature loop (for vector layers)
      QDomNodeList featureNodeList = layerElem.elementsByTagName( "Feature" );
      QDomElement currentFeatureElement;

      if ( featureNodeList.size() < 1 ) //raster layer?
      {
        QDomNodeList attributeNodeList = layerElem.elementsByTagName( "Attribute" );
        for ( int j = 0; j < attributeNodeList.size(); ++j )
        {
          QDomElement attributeElement = attributeNodeList.at( j ).toElement();
          if ( infoFormat == "text/plain" )
          {
            featureInfoString.append( attributeElement.attribute( "name" ) + " = '" +
                                      attributeElement.attribute( "value" ) + "'\n" );
          }
          else if ( infoFormat == "text/html" )
          {
            featureInfoString.append( "<TR><TH>" + attributeElement.attribute( "name" ) + "</TH><TD>" +
                                      attributeElement.attribute( "value" ) + "</TD></TR>\n" );
          }
        }
      }
      else //vector layer
      {
        for ( int j = 0; j < featureNodeList.size(); ++j )
        {
          QDomElement featureElement = featureNodeList.at( j ).toElement();
          if ( infoFormat == "text/plain" )
          {
            featureInfoString.append( "Feature " + featureElement.attribute( "id" ) + "\n" );
          }
          else if ( infoFormat == "text/html" )
          {
            featureInfoString.append( "<TABLE border=1 width=100%>\n" );
            featureInfoString.append( "<TR><TH>Feature</TH><TD>" + featureElement.attribute( "id" ) + "</TD></TR>\n" );
          }
          //attribute loop
          QDomNodeList attributeNodeList = featureElement.elementsByTagName( "Attribute" );
          for ( int k = 0; k < attributeNodeList.size(); ++k )
          {
            QDomElement attributeElement = attributeNodeList.at( k ).toElement();
            if ( infoFormat == "text/plain" )
            {
              featureInfoString.append( attributeElement.attribute( "name" ) + " = '" +
                                        attributeElement.attribute( "value" ) + "'\n" );
            }
            else if ( infoFormat == "text/html" )
            {
              featureInfoString.append( "<TR><TH>" + attributeElement.attribute( "name" ) + "</TH><TD>" + attributeElement.attribute( "value" ) + "</TD></TR>\n" );
            }
          }

          if ( infoFormat == "text/html" )
          {
            featureInfoString.append( "</TABLE>\n</BR>\n" );
//.........这里部分代码省略.........
开发者ID:aaronr,项目名称:Quantum-GIS,代码行数:101,代码来源:qgsgetrequesthandler.cpp

示例12: loadDetailsFromXML

static bool loadDetailsFromXML(const QString &filename, FileDetails *details)
{
    QDomDocument doc("mydocument");
    QFile file(filename);
    if (!file.open(QIODevice::ReadOnly))
        return false;

    if (!doc.setContent(&file))
    {
        file.close();
        return false;
    }
    file.close();

    QString docType = doc.doctype().name();

    if (docType == "MYTHARCHIVEITEM")
    {
        QDomNodeList itemNodeList = doc.elementsByTagName("item");
        QString type, dbVersion;

        if (itemNodeList.count() < 1)
        {
            VERBOSE(VB_IMPORTANT, "Couldn't find an 'item' element in XML file");
            return false;
        }

        QDomNode n = itemNodeList.item(0);
        QDomElement e = n.toElement();
        type = e.attribute("type");
        dbVersion = e.attribute("databaseversion");
        if (type == "recording")
        {
            QDomNodeList nodeList = e.elementsByTagName("recorded");
            if (nodeList.count() < 1)
            {
                VERBOSE(VB_IMPORTANT,
                        "Couldn't find a 'recorded' element in XML file");
                return false;
            }

            n = nodeList.item(0);
            e = n.toElement();
            n = e.firstChild();
            while (!n.isNull())
            {
                e = n.toElement();
                if (!e.isNull())
                {
                    if (e.tagName() == "title")
                        details->title = e.text();

                    if (e.tagName() == "subtitle")
                        details->subtitle = e.text();

                    if (e.tagName() == "starttime")
                        details->startTime = QDateTime::fromString(e.text(), Qt::ISODate);

                    if (e.tagName() == "description")
                        details->description = e.text();
                }
                n = n.nextSibling();
            }

            // get channel info
            n = itemNodeList.item(0);
            e = n.toElement();
            nodeList = e.elementsByTagName("channel");
            if (nodeList.count() < 1)
            {
                VERBOSE(VB_IMPORTANT,
                        "Couldn't find a 'channel' element in XML file");
                details->chanID = "";
                details->chanNo = "";
                details->chanName = "";
                details->callsign =  "";
                return false;
            }

            n = nodeList.item(0);
            e = n.toElement();
            details->chanID = e.attribute("chanid");
            details->chanNo = e.attribute("channum");
            details->chanName = e.attribute("name");
            details->callsign =  e.attribute("callsign");
            return true;
        }
        else if (type == "video")
        {
            QDomNodeList nodeList = e.elementsByTagName("videometadata");
            if (nodeList.count() < 1)
            {
                VERBOSE(VB_IMPORTANT,
                        "Couldn't find a 'videometadata' element in XML file");
                return false;
            }

            n = nodeList.item(0);
            e = n.toElement();
            n = e.firstChild();
//.........这里部分代码省略.........
开发者ID:Openivo,项目名称:mythtv,代码行数:101,代码来源:importnative.cpp

示例13: serviceCapabilities

void QgsWCSProjectParser::serviceCapabilities( QDomElement& parentElement, QDomDocument& doc ) const
{
  QDomElement serviceElem = doc.createElement( "Service" );

  QDomElement propertiesElem = mProjectParser.propertiesElem();
  if ( propertiesElem.isNull() )
  {
    QgsConfigParserUtils::fallbackServiceCapabilities( parentElement, doc );
    return;
  }

  QDomElement serviceCapabilityElem = propertiesElem.firstChildElement( "WMSServiceCapabilities" );
  if ( serviceCapabilityElem.isNull() || serviceCapabilityElem.text().compare( "true", Qt::CaseInsensitive ) != 0 )
  {
    QgsConfigParserUtils::fallbackServiceCapabilities( parentElement, doc );
    return;
  }

  //Service name is always WCS
  QDomElement wcsNameElem = doc.createElement( "name" );
  QDomText wcsNameText = doc.createTextNode( "WCS" );
  wcsNameElem.appendChild( wcsNameText );
  serviceElem.appendChild( wcsNameElem );

  //WMS title
  QDomElement titleElem = propertiesElem.firstChildElement( "WMSServiceTitle" );
  if ( !titleElem.isNull() )
  {
    QDomElement wcsLabelElem = doc.createElement( "label" );
    QDomText wcsLabelText = doc.createTextNode( titleElem.text() );
    wcsLabelElem.appendChild( wcsLabelText );
    serviceElem.appendChild( wcsLabelElem );
  }

  //WMS abstract
  QDomElement abstractElem = propertiesElem.firstChildElement( "WMSServiceAbstract" );
  if ( !abstractElem.isNull() )
  {
    QDomElement wcsDescriptionElem = doc.createElement( "description" );
    QDomText wcsDescriptionText = doc.createTextNode( abstractElem.text() );
    wcsDescriptionElem.appendChild( wcsDescriptionText );
    serviceElem.appendChild( wcsDescriptionElem );
  }

  //keyword list
  QDomElement keywordListElem = propertiesElem.firstChildElement( "WMSKeywordList" );
  if ( !keywordListElem.isNull() && !keywordListElem.text().isEmpty() )
  {
    QDomNodeList keywordList = keywordListElem.elementsByTagName( "value" );
    if ( keywordList.size() > 0 )
    {
      QDomElement wcsKeywordsElem = doc.createElement( "keywords" );
      for ( int i = 0; i < keywordList.size(); ++i )
      {
        QDomElement wcsKeywordElem = doc.createElement( "keyword" );
        QDomText keywordText = doc.createTextNode( keywordList.at( i ).toElement().text() );
        wcsKeywordElem.appendChild( keywordText );
        wcsKeywordsElem.appendChild( wcsKeywordElem );
      }
      serviceElem.appendChild( wcsKeywordsElem );
    }
  }

  //Fees
  QDomElement feesElem = propertiesElem.firstChildElement( "WMSFees" );
  if ( !feesElem.isNull() )
  {
    QDomElement wcsFeesElem = doc.createElement( "fees" );
    QDomText wcsFeesText = doc.createTextNode( feesElem.text() );
    wcsFeesElem.appendChild( wcsFeesText );
    serviceElem.appendChild( wcsFeesElem );
  }

  //AccessConstraints
  QDomElement accessConstraintsElem = propertiesElem.firstChildElement( "WMSAccessConstraints" );
  if ( !accessConstraintsElem.isNull() )
  {
    QDomElement wcsAccessConstraintsElem = doc.createElement( "accessConstraints" );
    QDomText wcsAccessConstraintsText = doc.createTextNode( accessConstraintsElem.text() );
    wcsAccessConstraintsElem.appendChild( wcsAccessConstraintsText );
    serviceElem.appendChild( wcsAccessConstraintsElem );
  }

  parentElement.appendChild( serviceElem );
}
开发者ID:Jokenbol,项目名称:QGIS,代码行数:85,代码来源:qgswcsprojectparser.cpp

示例14: importMnemosyne

bool Deck::importMnemosyne(QString fileName)
{
    QFileInfo fi(fileName);
    QString baseName = fi.baseName().toLower();

    QString tempFolder = utils::combinePaths(tempPath(), baseName);
    QString metadataPath = utils::combinePaths(tempFolder, "METADATA"); 
    QString cardsPath = utils::combinePaths(tempFolder, "cards.xml"); 

    utils::createDirectory(tempFolder);

    Compressor c;
    if(!c.decompressFolder(fileName, tempFolder)) {
        return false;
    }

    /// import metadata
    ///
    QTextStream s;
    QFile metadataFile(metadataPath);

    metadataFile.open(QIODevice::ReadOnly | QIODevice::Text);

    if(!metadataFile.isOpen())
        return false;

    s.setDevice(&metadataFile);
    s.setCodec("UTF-8");

    QStringList sl;
    QString l = s.readLine();
    while (!s.atEnd()) {
        sl = l.split(":");

        if(sl.size()>1) {
            if(sl[0]=="tags")
                setTags(sl[1]);
            else if(sl[0]=="notes")
                setDesc(sl[1]);
            else if(sl[0]=="author_name")
                setAuthor(sl[1]);
            else if(sl[0]=="card_set_name")
                setName(sl[1]);
        }

        l = s.readLine();
    }

    /// read cards
    QDomDocument domDocument;
    QString errorStr;
    int errorLine;
    int errorColumn;
    QString front, back, level;
    QFile cardsFile(cardsPath);

    cardsFile.open(QIODevice::ReadOnly | QIODevice::Text);

    if(!cardsFile.isOpen())
        return false;

    if (!domDocument.setContent(&cardsFile, true, &errorStr, &errorLine,
        &errorColumn)) {
            qDebug() << QString("Parse error at line %1, column %2:\n%3")
                .arg(errorLine)
                .arg(errorColumn)
                .arg(errorStr);
            return false;
    }

    QDomElement root = domDocument.documentElement();
    QString rootName = root.tagName().toLower();

    if (rootName == "opensm2sync") {
        QDomNodeList nodes = root.elementsByTagName("log");
        QDomNode node;
        QDomElement elnode;
        
        int count = nodes.count();

        for(int no = 0; no < count; no++) {
            node = nodes.at(no);

            if(node.attributes().namedItem("type").nodeValue()=="16") {
                elnode = node.firstChildElement("f");
                front = elnode.text();

                elnode = node.firstChildElement("b");
                back = elnode.text();

                if(!front.isEmpty()) {
                    Card *card = new Card();

                    card->updateFront(front);
                    card->updateBack(back);

                    addCard(card);
                }
            }
        }
//.........这里部分代码省略.........
开发者ID:m-o-s-t-a-f-a,项目名称:dana,代码行数:101,代码来源:deck.cpp

示例15: readXml

void QgsDiagramSettings::readXml( const QDomElement& elem, const QgsVectorLayer* layer )
{
  Q_UNUSED( layer );

  enabled = ( elem.attribute( "enabled", "1" ) != "0" );
  if ( !QgsFontUtils::setFromXmlChildNode( font, elem, "fontProperties" ) )
  {
    font.fromString( elem.attribute( "font" ) );
  }
  backgroundColor.setNamedColor( elem.attribute( "backgroundColor" ) );
  backgroundColor.setAlpha( elem.attribute( "backgroundAlpha" ).toInt() );
  size.setWidth( elem.attribute( "width" ).toDouble() );
  size.setHeight( elem.attribute( "height" ).toDouble() );
  transparency = elem.attribute( "transparency", "0" ).toInt();
  penColor.setNamedColor( elem.attribute( "penColor" ) );
  int penAlpha = elem.attribute( "penAlpha", "255" ).toInt();
  penColor.setAlpha( penAlpha );
  penWidth = elem.attribute( "penWidth" ).toDouble();

  minScaleDenominator = elem.attribute( "minScaleDenominator", "-1" ).toDouble();
  maxScaleDenominator = elem.attribute( "maxScaleDenominator", "-1" ).toDouble();
  if ( elem.hasAttribute( "scaleBasedVisibility" ) )
  {
    scaleBasedVisibility = ( elem.attribute( "scaleBasedVisibility", "1" ) != "0" );
  }
  else
  {
    scaleBasedVisibility = minScaleDenominator >= 0 && maxScaleDenominator >= 0;
  }

  //diagram size unit type and scale
  if ( elem.attribute( "sizeType" ) == "MapUnits" )
  {
    //compatibility with pre-2.16 project files
    sizeType = QgsUnitTypes::RenderMapUnits;
  }
  else
  {
    sizeType = QgsUnitTypes::decodeRenderUnit( elem.attribute( "sizeType" ) );
  }
  sizeScale = QgsSymbolLayerUtils::decodeMapUnitScale( elem.attribute( "sizeScale" ) );

  //line width unit type and scale
  lineSizeUnit = QgsUnitTypes::decodeRenderUnit( elem.attribute( "lineSizeType" ) );
  lineSizeScale = QgsSymbolLayerUtils::decodeMapUnitScale( elem.attribute( "lineSizeScale" ) );

  //label placement method
  if ( elem.attribute( "labelPlacementMethod" ) == "Height" )
  {
    labelPlacementMethod = Height;
  }
  else
  {
    labelPlacementMethod = XHeight;
  }

  // orientation
  if ( elem.attribute( "diagramOrientation" ) == "Left" )
  {
    diagramOrientation = Left;
  }
  else if ( elem.attribute( "diagramOrientation" ) == "Right" )
  {
    diagramOrientation = Right;
  }
  else if ( elem.attribute( "diagramOrientation" ) == "Down" )
  {
    diagramOrientation = Down;
  }
  else
  {
    diagramOrientation = Up;
  }

  // scale dependency
  if ( elem.attribute( "scaleDependency" ) == "Diameter" )
  {
    scaleByArea = false;
  }
  else
  {
    scaleByArea = true;
  }

  barWidth = elem.attribute( "barWidth" ).toDouble();

  angleOffset = elem.attribute( "angleOffset" ).toInt();

  minimumSize = elem.attribute( "minimumSize" ).toDouble();

  //colors
  categoryColors.clear();
  QDomNodeList attributes = elem.elementsByTagName( "attribute" );

  if ( attributes.length() > 0 )
  {
    for ( int i = 0; i < attributes.size(); i++ )
    {
      QDomElement attrElem = attributes.at( i ).toElement();
      QColor newColor( attrElem.attribute( "color" ) );
//.........这里部分代码省略.........
开发者ID:V17nika,项目名称:QGIS,代码行数:101,代码来源:qgsdiagramrenderer.cpp


注:本文中的QDomElement::elementsByTagName方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。