Ejemplo n.º 1
0
void NewsSite::parseAtom(QDomDocument domDoc)
{
    QDomNodeList entries = domDoc.elementsByTagName("entry");

    for (unsigned int i = 0; i < (unsigned) entries.count(); i++)
    {
        QDomNode itemNode = entries.item(i);
        QString title =  ReplaceHtmlChar(itemNode.namedItem("title").toElement()
                                         .text().simplified());

        QDomNode summNode = itemNode.namedItem("summary");
        QString description = QString::null;
        if (!summNode.isNull())
        {
            description = ReplaceHtmlChar(
                summNode.toElement().text().simplified());
        }

        QDomNode linkNode = itemNode.namedItem("link");
        QString url = QString::null;
        if (!linkNode.isNull())
        {
            QDomAttr linkHref = linkNode.toElement().attributeNode("href");
            if (!linkHref.isNull())
                url = linkHref.value();
        }

        insertNewsArticle(NewsArticle(title, description, url));
    }
}
Ejemplo n.º 2
0
// Recursively add all devices and embedded devices to the deviceServices_ map
void RootService::addDeviceServices(const QDomNode &device)
{
	qDebug() << "UPnP discovered device " << XmlFunctions::getNodeValue(device, "/UDN") << endl;

	if(XmlFunctions::getNodeValue(device, "/deviceType") == InternetGatewayDeviceType)
	{
		QString description;
		description = XmlFunctions::getNodeValue(device, "/friendlyName");
		if(description.isNull())
			description = XmlFunctions::getNodeValue(device, "/modelDescription");
		if(description.isNull())
			description = XmlFunctions::getNodeValue(device, "/modelName") + " " + XmlFunctions::getNodeValue(device, "/modelNumber");
		if(description.isNull())
			description = __tr2qs("Unknown");

		qDebug() << "Model: " << description << endl;

		g_pApp->activeConsole()->output(KVI_OUT_GENERICSTATUS,__tr2qs_ctx("[UPNP]: found gateway device: %s","upnp"), description.toUtf8().data());


	}
	// Insert the given device node
	// The "key" is the device/UDN tag, the value is a list of device/serviceList/service nodes
	m_deviceServices.insert(XmlFunctions::getNodeValue(device, "/UDN"),
				device.namedItem("serviceList").childNodes());

	// Find all embedded device nodes
	QDomNodeList embeddedDevices = device.namedItem("deviceList").childNodes();
	for(int i = 0; i < embeddedDevices.count(); i++)
	{
		if(embeddedDevices.item(i).nodeName() != "device") continue;
		addDeviceServices(embeddedDevices.item(i));
	}
}
Ejemplo n.º 3
0
void QgsMapSettings::readXml( QDomNode &node )
{
  // set destination CRS
  QgsCoordinateReferenceSystem srs;
  QDomNode srsNode = node.namedItem( QStringLiteral( "destinationsrs" ) );
  if ( !srsNode.isNull() )
  {
    srs.readXml( srsNode );
  }
  setDestinationCrs( srs );

  // set extent
  QDomNode extentNode = node.namedItem( QStringLiteral( "extent" ) );
  QgsRectangle aoi = QgsXmlUtils::readRectangle( extentNode.toElement() );
  setExtent( aoi );

  // set rotation
  QDomNode rotationNode = node.namedItem( QStringLiteral( "rotation" ) );
  QString rotationVal = rotationNode.toElement().text();
  if ( ! rotationVal.isEmpty() )
  {
    double rot = rotationVal.toDouble();
    setRotation( rot );
  }

  //render map tile
  QDomElement renderMapTileElem = node.firstChildElement( QStringLiteral( "rendermaptile" ) );
  if ( !renderMapTileElem.isNull() )
  {
    setFlag( QgsMapSettings::RenderMapTile, renderMapTileElem.text() == QLatin1String( "1" ) );
  }
}
bool BasicmLearningEditor::loadBundleData(const QString &bundle_data) {
  QDomDocument bundle_document;
  bundle_document.setContent(bundle_data);

  QDomNodeList items = bundle_document.documentElement().elementsByTagName("item");

  for (int i = 0; i < items.size(); i++) {
    QDomNode item = items.at(i);

    if (item.isElement()) {
      QString title = item.namedItem("item_title").toElement().text();
      QString description = item.namedItem("item_description").toElement().text();

      if (title.isEmpty() || description.isEmpty()) {
        // TODO: error
        continue;
      }
      else {
        addNewItem(title, description);
      }
    }
    else {
      continue;
    }
  }

  // Load author & name.
  m_ui->m_txtAuthor->lineEdit()->setText(bundle_document.documentElement().namedItem("author").namedItem("name").toElement().text());
  m_ui->m_txtName->lineEdit()->setText(bundle_document.documentElement().namedItem("title").toElement().text());

  return true;
}
Ejemplo n.º 5
0
static QgsOldSymbolMeta readSymbolMeta( const QDomNode& synode )
{
  QgsOldSymbolMeta meta;

  QDomNode lvalnode = synode.namedItem( "lowervalue" );
  if ( ! lvalnode.isNull() )
  {
    QDomElement lvalelement = lvalnode.toElement();
    if ( lvalelement.attribute( "null" ).toInt() == 1 )
    {
      meta.lowerValue = QString::null;
    }
    else
    {
      meta.lowerValue = lvalelement.text();
    }
  }

  QDomNode uvalnode = synode.namedItem( "uppervalue" );
  if ( ! uvalnode.isNull() )
  {
    QDomElement uvalelement = uvalnode.toElement();
    meta.upperValue = uvalelement.text();
  }

  QDomNode labelnode = synode.namedItem( "label" );
  if ( ! labelnode.isNull() )
  {
    QDomElement labelelement = labelnode.toElement();
    meta.label = labelelement.text();
  }

  return meta;
}
Ejemplo n.º 6
0
// Helper function, get a specific node
QDomNode XmlFunctions::getNode( const QDomNode &rootNode, const QString &path )
{

  QStringList pathItems = path.split( "/", QString::SkipEmptyParts );
  QDomNode    childNode = rootNode.namedItem( pathItems[0] );  // can be a null node

  int i = 1;
  while( i < pathItems.count() )
  {
    if( childNode.isNull() )
    {
      break;
    }

    childNode = childNode.namedItem( pathItems[ i ] );
    i++;  // not using for loop so i is always correct for kdDebug() below.
  }

  if( childNode.isNull() ) {
      qDebug() << "XmlFunctions::getNode() - Notice: node '" << pathItems[ i - 1 ] << "'"
                << " does not exist (root=" << rootNode.nodeName() << " path=" << path << ")." << endl;
  }

  return childNode;
}
Ejemplo n.º 7
0
bool KOfficePlugin::writeTextNode(QDomDocument & doc,
				  QDomNode & parentNode,
				  const QString  &nodeName,
				  const QString  &value) const
{
  if (parentNode.toElement().isNull()){
    kdDebug(7034) << "Parent node is Null or not an Element, cannot write node "
		  << nodeName << endl;
    return false;
  }

  // If the node does not exist, we create it...
  if (parentNode.namedItem(nodeName).isNull())
    QDomNode ex = parentNode.appendChild(doc.createElement(nodeName));

  // Now, we are sure we have a node
  QDomElement nodeA = parentNode.namedItem(nodeName).toElement();

  // Ooops... existing node were not of the good type...
  if (nodeA.isNull()){
    kdDebug(7034) << "Wrong type of node " << nodeName << ", should be Element"
		  << endl;
    return false;
  }

  QDomText txtNode = doc.createTextNode(value);

  // If the node has already Text Child, we replace it.
  if (nodeA.firstChild().isNull())
    nodeA.appendChild(txtNode);
  else
    nodeA.replaceChild( txtNode, nodeA.firstChild());
  return true;
}
int QgsUniqueValueRenderer::readXML( const QDomNode& rnode, QgsVectorLayer& vl )
{
  mGeometryType = vl.geometryType();
  QDomNode classnode = rnode.namedItem( "classificationfield" );
  QString classificationField = classnode.toElement().text();

  QgsVectorDataProvider* theProvider = vl.dataProvider();
  if ( !theProvider )
  {
    return 1;
  }

  int classificationId = vl.fieldNameIndex( classificationField );
  if ( classificationId == -1 )
  {
    //go on. Because with joins, it might be the joined layer is not loaded yet
  }
  setClassificationField( classificationId );

  QDomNode symbolnode = rnode.namedItem( "symbol" );
  while ( !symbolnode.isNull() )
  {
    QgsSymbol* msy = new QgsSymbol( mGeometryType );
    msy->readXML( symbolnode, &vl );
    insertValue( msy->lowerValue(), msy );
    symbolnode = symbolnode.nextSibling();
  }
  updateSymbolAttributes();
  vl.setRenderer( this );
  return 0;
}
void RegistrationImplService::parseXml(QDomNode& dataNode)
{
	QString fixedData = dataNode.namedItem("fixedDataUid").toElement().text();
	this->setFixedData(fixedData);

	QString movingData = dataNode.namedItem("movingDataUid").toElement().text();
	this->setMovingData(movingData);
}
Ejemplo n.º 10
0
void Search::process()
{
    Parse parse;
    m_videoList = parse.parseRSS(m_document);

    QDomNodeList entries = m_document.elementsByTagName("channel");

    if (entries.count() == 0)
    {
        m_numResults = 0;
        m_numReturned = 0;
        m_numIndex = 0;
        return;
    }

    QDomNode itemNode = entries.item(0);

    QDomNode Node = itemNode.namedItem(QString("numresults"));
    if (!Node.isNull())
    {
        m_numResults = Node.toElement().text().toUInt();
    }
    else
    {
        QDomNodeList count = m_document.elementsByTagName("item");

        if (count.count() == 0)
            m_numResults = 0;
        else
            m_numResults = count.count();
    }

    Node = itemNode.namedItem(QString("returned"));
    if (!Node.isNull())
    {
        m_numReturned = Node.toElement().text().toUInt();
    }
    else
    {
        QDomNodeList entries = m_document.elementsByTagName("item");

        if (entries.count() == 0)
            m_numReturned = 0;
        else
            m_numReturned = entries.count();
    }

    Node = itemNode.namedItem(QString("startindex"));
    if (!Node.isNull())
    {
        m_numIndex = Node.toElement().text().toUInt();
    }
    else
        m_numIndex = 0;

}
Ejemplo n.º 11
0
configInfo::configInfo(DomCfgItem *item,QWidget * parent , Qt::WindowFlags f ): QDialog(parent,f),node(item)
{
    setupUi(this);
    node = item;
    QDomNode info = node->root()->node().namedItem(md_root).namedItem(md_info);
    editInfo->setText(info.namedItem(md_info_name).toElement().text());
    autorEdit->setText(info.namedItem(md_info_author).toElement().text());
    dateEdit->setDate(QDate::fromString(info.namedItem(md_info_date).toElement().text()));
    commentEdit->setText(info.namedItem(md_info_remark).toElement().text());
}
Ejemplo n.º 12
0
void YoutubeModel::parseResults(KJob *job)
{
    if (!m_datas.contains(static_cast<KIO::Job*>(job))) {
        return;
    }

    QDomDocument document;
    document.setContent(m_datas[static_cast<KIO::Job*>(job)]);

    QDomNodeList entries = document.elementsByTagName("entry");
    for (int i = 0; i < entries.count(); i++) {
        QString id = entries.at(i).namedItem("id").toElement().text().split(':').last();
        QString title = entries.at(i).namedItem("title").toElement().text();
        QDomNode mediaNode = entries.at(i).namedItem("media:group");
        QString description = mediaNode.namedItem("media:description").toElement().text();
        QString keywords = mediaNode.namedItem("media:keywords").toElement().text();
        QString mediaUrl = mediaNode.namedItem("media:player").toElement().attribute("url");
	uint mediaDuration = mediaNode.namedItem("yt:duration").toElement().attribute("seconds").toInt();
        // FIXME: more than one media:thumbnail exists
        QString thumbnail = mediaNode.namedItem("media:thumbnail").toElement().attribute("url");

        QDomNode n = mediaNode.firstChild();
        QString MEDIA_CONTENT_URL;
        QString MEDIA_CONTENT_TYPE;
        do {
            if (n.nodeName() == "media:content" && n.toElement().attribute("yt:format") == "5") {
                MEDIA_CONTENT_URL = n.toElement().attribute("url");
                MEDIA_CONTENT_TYPE = n.toElement().attribute("type");
                break;
            }
            n = n.nextSibling();
        } while (n != mediaNode.lastChild());

        QString embeddedHTML = QString(
        "<object width=\"425\" height=\"350\">\n"
        "<param name=\"movie\" value=\"%1\"></param>\n"
        "<embed src=\"%2\"\n"
        "type=\"%3\" width=\"425\" height=\"350\">\n"
        "</embed>\n"
        "</object>\n").arg(MEDIA_CONTENT_URL, MEDIA_CONTENT_URL, MEDIA_CONTENT_TYPE);

        VideoPackage video;
        video.title = title;
        video.description = description;
        video.keywords = keywords.split(", ");
        video.id = id;
        video.duration = mediaDuration;
        video.embeddedHTML = embeddedHTML;
        video.thumbnail = thumbnail;
        video.url = mediaUrl;

        m_videos << video;
        reset();
    }
}
/**
\param formula
\param valoract
\param valorant
\return
**/
bool BcCuentasAnualesImprimirView::valorItem ( const QDomNode &formula, QString &valoract, QString &valorant )
{
    BL_FUNC_DEBUG
    QDomElement valor = formula.namedItem ( "VALORACT" ).toElement();
    if ( valor.isNull() ) {
        return false;
    } // end if
    valoract = valor.text();
    valorant = formula.namedItem ( "VALORANT" ).toElement().text();
    
    return true;
}
Ejemplo n.º 14
0
bool QgsCoordinateTransform::readXML( QDomNode & theNode )
{

  QgsDebugMsg( "Reading Coordinate Transform from xml ------------------------!" );

  QDomNode mySrcNode = theNode.namedItem( "sourcesrs" );
  mSourceCRS.readXML( mySrcNode );

  QDomNode myDestNode = theNode.namedItem( "destinationsrs" );
  mDestCRS.readXML( myDestNode );

  initialise();

  return true;
}
QString RegexpHandler::handleResponse(const QString &raw, QDomNode arguments) const
{
  QString result;
  QRegExp e(arguments.namedItem("match").toElement().text());
  
  if (e.exactMatch(raw.trimmed())) {
    result = arguments.namedItem("display").toElement().text();
    
    for (int i = 1; i <= e.numCaptures(); i++) {
      result.replace(QString("\\%1").arg(i), e.cap(i));
    }
  }
  
  return result;
}
Ejemplo n.º 16
0
QDomNode QDomNodeProto:: namedItem(const QString& name) const
{
  QDomNode *item = qscriptvalue_cast<QDomNode*>(thisObject());
  if (item)
    return item->namedItem(name);
  return QDomNode();
}
Ejemplo n.º 17
0
void Parser3::UserRecived( BasePtr bInfo, QDomDocument Page ) {
    if( !bInfo )
    {
        Error( "Null Pointer to Info!" );
        return;
    }
    if( bInfo->getType() != IT_UserInfo )
    {
        Error( "Info is not UserInfo!" );
        return;
    }
    UserPtr Info = bInfo->cast_UserInfo();

    QDomNode Entry = Page.namedItem("entry");

    if( Entry.isNull() ) {
        Error( "Entry is null!, maybe page is not a userEntry?" );
        return;
    }

    QStringList IDString = Entry.namedItem("id").namedItem("#text").nodeValue().split(':', QString::SkipEmptyParts );
    if( IDString.size() != 4 || IDString.at(2) != "user" ) {
        Error( "Page is not a user Entry!!" );
        return;
    }

    ParseUserEntry(Entry, Info );

    const_cast<QString&>(Info->ID) = Info->Author.toLower();

    UserParsed( Info );
    return;
}
Ejemplo n.º 18
0
void Parser3::VideoRecived( BasePtr bInfo, QDomDocument Page ) {
    if( !bInfo )
    {
        Error( "Null pointer to Info!");
        return;
    }
    if( bInfo->getType() != IT_VideoInfo ) {
        Error( "Info is not videoInfo! type("+QString::number(bInfo->getType())+")" );
        return;
    }
    VideoPtr Info = bInfo->cast_VideoInfo();

    QDomNode Entry = Page.namedItem("entry");

    if( Entry.isNull() ) {
        Error( "Entry is null!, maybe page is not a videoEntry?" );
        return;
    }

    QStringList IDString = Entry.namedItem("id").namedItem("#text").nodeValue().split(':', QString::SkipEmptyParts );
    if( IDString.size() != 4 || IDString.at(2) != "video" ) {
        Error( "Page is not a video Entry!!" );
        return;
    }
    ParseVideoEntry(Entry, Info);
    //(*Info) = vInfo;

    VideoParsed( Info );

    return;
}
Ejemplo n.º 19
0
void PathMapper::addHistory(const QString &localpath, const QString &serverpath, bool saveinproject)
{
  bool exists = false;
  for (unsigned int cnt = 0; cnt < m_serverlist.count() && !exists; cnt++ )
    if(m_serverlist[cnt] == serverpath &&  m_locallist[cnt] == localpath)
      exists = true;

  if(!exists)
  {
    if(saveinproject)
    {
      QDomNode node = pathMapperNode();
      QDomNode newnode = Project::ref()->dom()->createElement("mapping");
  
      QDomAttr serverattr = Project::ref()->dom()->createAttribute("serverpath");
      serverattr.setValue(serverpath);
      QDomAttr localattr = Project::ref()->dom()->createAttribute("localpath");
      localattr.setValue(localpath);
  
      newnode.attributes().setNamedItem(serverattr);
      newnode.attributes().setNamedItem(localattr);
  
      node = node.namedItem("mappings");
      node.insertAfter(newnode, node.lastChild());
    }
    
    m_serverlist.append(serverpath);
    m_locallist.append(localpath);
  }

}
Ejemplo n.º 20
0
bool QgsMeshLayer::readXml( const QDomNode &layer_node, QgsReadWriteContext &context )
{
  Q_UNUSED( context );

  QgsDebugMsgLevel( QStringLiteral( "Datasource in QgsMeshLayer::readXml: %1" ).arg( mDataSource.toLocal8Bit().data() ), 3 );

  //process provider key
  QDomNode pkeyNode = layer_node.namedItem( QStringLiteral( "provider" ) );

  if ( pkeyNode.isNull() )
  {
    mProviderKey.clear();
  }
  else
  {
    QDomElement pkeyElt = pkeyNode.toElement();
    mProviderKey = pkeyElt.text();
  }

  QgsDataProvider::ProviderOptions providerOptions;
  if ( !setDataProvider( mProviderKey, providerOptions ) )
  {
    return false;
  }

  return mValid; // should be true if read successfully
}
Ejemplo n.º 21
0
bool QgsCoordinateTransform::readXml( const QDomNode &node )
{
  d.detach();

  QgsDebugMsg( "Reading Coordinate Transform from xml ------------------------!" );

  QDomNode mySrcNode = node.namedItem( QStringLiteral( "sourcesrs" ) );
  d->mSourceCRS.readXml( mySrcNode );

  QDomNode myDestNode = node.namedItem( QStringLiteral( "destinationsrs" ) );
  d->mDestCRS.readXml( myDestNode );

  d->mSourceDatumTransform = node.toElement().attribute( QStringLiteral( "sourceDatumTransform" ), QStringLiteral( "-1" ) ).toInt();
  d->mDestinationDatumTransform = node.toElement().attribute( QStringLiteral( "destinationDatumTransform" ), QStringLiteral( "-1" ) ).toInt();

  return d->initialize();
}
int QgsGraduatedSymbolRenderer::readXML( const QDomNode& rnode, QgsVectorLayer& vl )
{
  mGeometryType = vl.geometryType();
  QDomNode modeNode = rnode.namedItem( "mode" );
  QString modeValue = modeNode.toElement().text();
  QDomNode classnode = rnode.namedItem( "classificationfield" );
  QString classificationField = classnode.toElement().text();

  QgsVectorDataProvider* theProvider = vl.dataProvider();
  if ( !theProvider )
  {
    return 1;
  }
  if ( modeValue == "Empty" )
  {
    mMode = QgsGraduatedSymbolRenderer::Empty;
  }
  else if ( modeValue == "Quantile" )
  {
    mMode = QgsGraduatedSymbolRenderer::Quantile;
  }
  else //default
  {
    mMode = QgsGraduatedSymbolRenderer::EqualInterval;
  }

  int classificationId = vl.fieldNameIndex( classificationField );
  if ( classificationId == -1 )
  {
    //go on. Because with joins, it might be the joined layer is not loaded yet
  }
  setClassificationField( classificationId );

  QDomNode symbolnode = rnode.namedItem( "symbol" );
  while ( !symbolnode.isNull() )
  {
    QgsSymbol* sy = new QgsSymbol( mGeometryType );
    sy->readXML( symbolnode, &vl );
    addSymbol( sy );

    symbolnode = symbolnode.nextSibling();
  }
  updateSymbolAttributes();
  vl.setRenderer( this );
  return 0;
}
int QgsGraduatedSymbolRenderer::readXML( const QDomNode& rnode, QgsVectorLayer& vl )
{
  mGeometryType = vl.geometryType();
  QDomNode modeNode = rnode.namedItem( "mode" );
  QString modeValue = modeNode.toElement().text();
  QDomNode classnode = rnode.namedItem( "classificationfield" );
  QString classificationField = classnode.toElement().text();

  QgsVectorDataProvider* theProvider = vl.dataProvider();
  if ( !theProvider )
  {
    return 1;
  }
  if ( modeValue == "Empty" )
  {
    mMode = QgsGraduatedSymbolRenderer::Empty;
  }
  else if ( modeValue == "Quantile" )
  {
    mMode = QgsGraduatedSymbolRenderer::Quantile;
  }
  else //default
  {
    mMode = QgsGraduatedSymbolRenderer::EqualInterval;
  }

  int classificationId = theProvider->fieldNameIndex( classificationField );
  if ( classificationId == -1 )
  {
    return 2; //@todo: handle gracefully in gui situation where user needs to nominate field
  }
  setClassificationField( classificationId );

  QDomNode symbolnode = rnode.namedItem( "symbol" );
  while ( !symbolnode.isNull() )
  {
    QgsSymbol* sy = new QgsSymbol( mGeometryType );
    sy->readXML( symbolnode, &vl );
    addSymbol( sy );

    symbolnode = symbolnode.nextSibling();
  }
  updateSymbolAttributes();
  vl.setRenderer( this );
  return 0;
}
Ejemplo n.º 24
0
ImgSource* ColorSchemeParser::parseFilters(QDomNode filt) {

    // TODO: Move this code into ImgSource
    if (!filt.hasChildNodes()) {
        return 0;
    }

    ImgSource * ret = new ImgLoader();

    QDomNode f = filt.firstChild();

    while (!f.isNull()) {
        QString name = f.nodeName().toLower();
        if (name == "invert") {
            ret = new ImgInvert(ret);
        } else if (name == "hueinv") {
            ret = new ImgHueInv(ret);
        } else if (name == "add") {
            ret = new ImgAdd(ret, XmlParse::selectNodeInt(f, "Amount"));
        } else if (name == "scalewhite") {
            ret = new ImgScaleWhite(ret, XmlParse::selectNodeFloat(f, "Amount"));
        } else if (name == "hsvtweak") {
            int hmin = 0;
            int hmax = 359;
            int smin = 0;
            int smax = 255;
            int vmin = 0;
            int vmax = 255;
            float hfact = 1.0f;
            float sfact = 1.0f;
            float vfact = 1.0f;
            int hconst = 0;
            int sconst = 0;
            int vconst = 0;

            if (!f.namedItem("HMin").isNull()) { hmin = XmlParse::selectNodeInt(f, "HMin"); }
            if (!f.namedItem("HMax").isNull()) { hmax = XmlParse::selectNodeInt(f, "HMax"); }
            if (!f.namedItem("SMin").isNull()) { smin = XmlParse::selectNodeInt(f, "SMin"); }
            if (!f.namedItem("SMax").isNull()) { smax = XmlParse::selectNodeInt(f, "SMax"); }
            if (!f.namedItem("VMin").isNull()) { vmin = XmlParse::selectNodeInt(f, "VMin"); }
            if (!f.namedItem("VMax").isNull()) { vmax = XmlParse::selectNodeInt(f, "VMax"); }

            if (!f.namedItem("HConst").isNull()) { hconst = XmlParse::selectNodeInt(f, "HConst"); }
            if (!f.namedItem("SConst").isNull()) { sconst = XmlParse::selectNodeInt(f, "SConst"); }
            if (!f.namedItem("VConst").isNull()) { vconst = XmlParse::selectNodeInt(f, "VConst"); }

            if (!f.namedItem("HFact").isNull()) { hfact = XmlParse::selectNodeFloat(f, "HFact"); }
            if (!f.namedItem("SFact").isNull()) { sfact = XmlParse::selectNodeFloat(f, "SFact"); }
            if (!f.namedItem("VFact").isNull()) { vfact = XmlParse::selectNodeFloat(f, "VFact"); }

            ret = new ImgHSVTweak(ret, hmin, hmax, smin, smax, vmin, vmax, hfact, hconst,
                                  sfact, sconst, vfact, vconst);
        } else {
            qDebug() << "Unkown image filter:" << name;
        }
        f = f.nextSibling();
    }

    return ret;
}
Ejemplo n.º 25
0
static QColor readSymbolColor( const QDomNode& synode, bool fillColor )
{
  QDomNode cnode = synode.namedItem( fillColor ? "fillcolor" : "outlinecolor" );
  QDomElement celement = cnode.toElement();
  int red = celement.attribute( "red" ).toInt();
  int green = celement.attribute( "green" ).toInt();
  int blue = celement.attribute( "blue" ).toInt();
  return QColor( red, green, blue );
}
Ejemplo n.º 26
0
bool QgsCoordinateTransform::readXML( QDomNode & theNode )
{

    QgsDebugMsg( "Reading Coordinate Transform from xml ------------------------!" );

    QDomNode mySrcNode = theNode.namedItem( "sourcesrs" );
    mSourceCRS.readXML( mySrcNode );

    QDomNode myDestNode = theNode.namedItem( "destinationsrs" );
    mDestCRS.readXML( myDestNode );

    mSourceDatumTransform = theNode.toElement().attribute( "sourceDatumTransform", "-1" ).toInt();
    mDestinationDatumTransform = theNode.toElement().attribute( "destinationDatumTransform", "-1" ).toInt();

    initialise();

    return true;
}
QString SubstituteHandler::handleResponse(const QString &raw, QDomNode arguments) const
{
  QString text = arguments.namedItem("text").toElement().text();
  
  if (text.contains("%1"))
    return text.arg(raw);
  
  return text;
}
Ejemplo n.º 28
0
bool GroupDavGlobals::getFolderHasSubs(const QDomNode &folderNode)
{
    // a folder is identified by the collection item in the resourcetype:
    // <a:resourcetype xmlns:a="DAV:"><a:collection xmlns:a="DAV:"/>...</a:resourcetype>
    QDomElement e = folderNode.namedItem("resourcetype").toElement();
    if(!e.namedItem("collection").isNull())
        return true;
    else return false;
}
Ejemplo n.º 29
0
static float readMarkerSymbolSize( const QDomNode& synode )
{
  QDomNode psizenode = synode.namedItem( "pointsize" );
  if ( ! psizenode.isNull() )
  {
    QDomElement psizeelement = psizenode.toElement();
    return psizeelement.text().toFloat();
  }
  return DEFAULT_POINT_SIZE;
}
Ejemplo n.º 30
0
static QString readMarkerSymbolName( const QDomNode& synode )
{
  QDomNode psymbnode = synode.namedItem( "pointsymbol" );
  if ( ! psymbnode.isNull() )
  {
    QDomElement psymbelement = psymbnode.toElement();
    return psymbelement.text();
  }
  return QString( "hard:circle" );
}