Logo Search packages:      
Sourcecode: qgis version File versions

bool QgsRasterLayer::writeXML_ ( QDomNode &  layer_node,
QDomDocument &  doc 
) [protected, virtual]

write vector layer specific state to project file DOM node.

Note:
Called by QgsMapLayer::writeXML().

Reimplemented from QgsMapLayer.

Definition at line 3352 of file qgsrasterlayer.cpp.

References getBlueBandName(), getDrawingStyleAsQString(), getGrayBandName(), getGreenBandName(), getInvertHistogramFlag(), getRedBandName(), getShowDebugOverlayFlag(), getStdDevsToPlot(), and getTransparency().

{
    // first get the layer element so that we can append the type attribute

    QDomElement mapLayerNode = layer_node.toElement();

    if ( mapLayerNode.isNull() || ("maplayer" != mapLayerNode.nodeName()) )
    {
        const char * nn = mapLayerNode.nodeName(); // debugger probe

        qDebug( "QgsRasterLayer::writeXML() can't find <maplayer>" );

        return false;
    }

    mapLayerNode.setAttribute( "type", "raster" );

    // <rasterproperties>
    QDomElement rasterPropertiesElement = document.createElement( "rasterproperties" );
    mapLayerNode.appendChild( rasterPropertiesElement );

    // <showDebugOverlayFlag>
    QDomElement showDebugOverlayFlagElement = document.createElement( "showDebugOverlayFlag" );

    if ( getShowDebugOverlayFlag() )
    {
        showDebugOverlayFlagElement.setAttribute( "boolean", "true" );
    }
    else
    {
        showDebugOverlayFlagElement.setAttribute( "boolean", "false" );
    }

    rasterPropertiesElement.appendChild( showDebugOverlayFlagElement );

    // <drawingStyle>
    QDomElement drawStyleElement = document.createElement( "drawingStyle" );
    QDomText    drawStyleText    = document.createTextNode( getDrawingStyleAsQString() );

    drawStyleElement.appendChild( drawStyleText );

    rasterPropertiesElement.appendChild( drawStyleElement );


    // <invertHistogramFlag>
    QDomElement invertHistogramFlagElement = document.createElement( "invertHistogramFlag" );

    if ( getInvertHistogramFlag() )
    {
        invertHistogramFlagElement.setAttribute( "boolean", "true" );
    }
    else
    {
        invertHistogramFlagElement.setAttribute( "boolean", "false" );
    }

    rasterPropertiesElement.appendChild( invertHistogramFlagElement );


    // <stdDevsToPlotDouble>
    QDomElement stdDevsToPlotDoubleElement = document.createElement( "stdDevsToPlotDouble" );
    QDomText    stdDevsToPlotDoubleText    = document.createTextNode( QString::number(getStdDevsToPlot()) );

    stdDevsToPlotDoubleElement.appendChild( stdDevsToPlotDoubleText );

    rasterPropertiesElement.appendChild( stdDevsToPlotDoubleElement );


    // <transparencyLevelInt>
    QDomElement transparencyLevelIntElement = document.createElement( "transparencyLevelInt" );
    QDomText    transparencyLevelIntText    = document.createTextNode( QString::number(getTransparency()) );

    transparencyLevelIntElement.appendChild( transparencyLevelIntText );

    rasterPropertiesElement.appendChild( transparencyLevelIntElement );


    // <redBandNameQString>
    QDomElement redBandNameQStringElement = document.createElement( "redBandNameQString" );
    QDomText    redBandNameQStringText    = document.createTextNode( getRedBandName() );

    redBandNameQStringElement.appendChild( redBandNameQStringText );

    rasterPropertiesElement.appendChild( redBandNameQStringElement );


    // <greenBandNameQString>
    QDomElement greenBandNameQStringElement = document.createElement( "greenBandNameQString" );
    QDomText    greenBandNameQStringText    = document.createTextNode( getGreenBandName() );

    greenBandNameQStringElement.appendChild( greenBandNameQStringText );

    rasterPropertiesElement.appendChild( greenBandNameQStringElement );


    // <blueBandNameQString>
    QDomElement blueBandNameQStringElement = document.createElement( "blueBandNameQString" );
    QDomText    blueBandNameQStringText    = document.createTextNode( getBlueBandName() );

    blueBandNameQStringElement.appendChild( blueBandNameQStringText );

    rasterPropertiesElement.appendChild( blueBandNameQStringElement );


    // <grayBandNameQString>
    QDomElement grayBandNameQStringElement = document.createElement( "grayBandNameQString" );
    QDomText    grayBandNameQStringText    = document.createTextNode( getGrayBandName() );

    grayBandNameQStringElement.appendChild( grayBandNameQStringText );

    rasterPropertiesElement.appendChild( grayBandNameQStringElement );


    return true;
} // bool QgsRasterLayer::writeXML_


Generated by  Doxygen 1.6.0   Back to index