Logo Search packages:      
Sourcecode: qgis version File versions

bool QgsRasterLayer::readXML_ ( QDomNode &  layer_node  )  [protected, virtual]

reads vector layer specific state from project file DOM node.

Note:
Called by QgsMapLayer::readXML().

Raster layer project file XML of form:

<maplayer type="raster" visible="1" showinoverviewflag="1"> <layername>Wynoochee_dem</layername> <datasource>/home/mcoletti/mnt/MCOLETTIF8F9/c/Toolkit_Course/Answers/Training_Data/wynoochee_dem.img</datasource> <zorder>0</zorder> <rasterproperties> <showDebugOverlayFlag boolean="false"> <drawingStyle>SINGLE_BAND_GRAY</drawingStyle> <invertHistogramFlag boolean="false"> <stdDevsToPlotDouble>0</stdDevsToPlotDouble> <transparencyLevelInt>255</transparencyLevelInt> <redBandNameQString>Not Set</redBandNameQString> <greenBandNameQString>Not Set</greenBandNameQString> <blueBandNameQString>Not Set</blueBandNameQString> <grayBandNameQString>Undefined</grayBandNameQString> </rasterproperties> </maplayer>

Reimplemented from QgsMapLayer.

Definition at line 3293 of file qgsrasterlayer.cpp.

References readFile(), setBlueBandName(), setDrawingStyle(), setGrayBandName(), setGreenBandName(), setInvertHistogramFlag(), setRedBandName(), setShowDebugOverlayFlag(), setStdDevsToPlot(), setTransparency(), and QgsMapLayer::source().

{
    QDomNode mnl = layer_node.namedItem("rasterproperties");

    QDomNode snode = mnl.namedItem("showDebugOverlayFlag");
    QDomElement myElement = snode.toElement();
    QVariant myQVariant = (QVariant) myElement.attribute("boolean");
    setShowDebugOverlayFlag(myQVariant.toBool());

    snode = mnl.namedItem("drawingStyle");
    myElement = snode.toElement();
    setDrawingStyle(myElement.text());

    snode = mnl.namedItem("invertHistogramFlag");
    myElement = snode.toElement();
    myQVariant = (QVariant) myElement.attribute("boolean");
    setInvertHistogramFlag(myQVariant.toBool());

    snode = mnl.namedItem("stdDevsToPlotDouble");
    myElement = snode.toElement();
    setStdDevsToPlot(myElement.text().toDouble());

    snode = mnl.namedItem("transparencyLevelInt");
    myElement = snode.toElement();
    setTransparency(myElement.text().toInt());

    snode = mnl.namedItem("redBandNameQString");
    myElement = snode.toElement();
    setRedBandName(myElement.text());
    snode = mnl.namedItem("greenBandNameQString");
    myElement = snode.toElement();
    setGreenBandName(myElement.text());

    snode = mnl.namedItem("blueBandNameQString");
    myElement = snode.toElement();
    setBlueBandName(myElement.text());

    snode = mnl.namedItem("grayBandNameQString");
    myElement = snode.toElement();
    setGrayBandName(myElement.text());

    const char * sourceNameStr = source(); // debugger probe

    if ( ! readFile( source() ) )   // Data source name set in
                                    // QgsMapLayer::readXML()
    {
        std::cerr << __FILE__ << ":" << __LINE__
                  << " unable to read from raster file "
                  << source() << "\n";

        return false;
    }

    return true;

} // QgsRasterLayer::readXML_( QDomNode & layer_node )


Generated by  Doxygen 1.6.0   Back to index