Fixed nasty bugwhere x and y dim for raster were both assigned raster x dim value. Added X, Y and Nodata info to general tab of properties dialog. Added placeholder that will in future be used to show a thumbnail preview on general tab.

git-svn-id: http://svn.osgeo.org/qgis/trunk@644 c8812cc2-4d05-0410-92ff-de0c093fc19c
This commit is contained in:
timlinux 2004-01-30 06:10:39 +00:00
parent 0c43d76dec
commit 201e5e8b6e
3 changed files with 129 additions and 14 deletions

View File

@ -110,7 +110,7 @@ QgsRasterLayer::QgsRasterLayer(QString path, QString baseName)
// Set up the x and y dimensions of this raster layer
//
rasterXDimInt = gdalDataset->GetRasterBand( 1 )->GetXSize();
rasterYDimInt = gdalDataset->GetRasterBand( 1 )->GetXSize();
rasterYDimInt = gdalDataset->GetRasterBand( 1 )->GetYSize();
//
// Determin the no data value
//
@ -391,6 +391,7 @@ void QgsRasterLayer::draw(QPainter * theQPainter, QgsRect * theViewExtent, QgsCo
}
// a "Palette" layer drawn in gray scale (using only one of the color components)
case PALETTED_SINGLE_BAND_GRAY:
std::cout << "PALETTED_SINGLE_BAND_GRAY drawing type detected..." << std::endl;
//check the band is set!
if (grayBandNameQString==tr("Not Set"))
{
@ -499,7 +500,7 @@ void QgsRasterLayer::drawSingleBandGray(QPainter * theQPainter,
QImage myQImage=QImage(theRasterViewPort->drawableAreaXDimInt,theRasterViewPort->drawableAreaYDimInt,32);
myQImage.setAlphaBuffer(true);
std::cout << "draw gray band Retrieving stats" << std::endl;
RasterBandStats myRasterBandStats = getRasterBandStats(1);
RasterBandStats myRasterBandStats = getRasterBandStats(theBandNoInt);
std::cout << "draw gray band Git stats" << std::endl;
double myRangeDouble=myRasterBandStats.rangeDouble;
// print each point in myGdalScanData with equal parts R, G ,B o make it show as gray
@ -701,7 +702,7 @@ void QgsRasterLayer::drawPalettedSingleBandGray(QPainter * theQPainter,
// read entire clipped area of raster band
// treat myGdalScanData as a pseudo-multidimensional array
// RasterIO() takes care of scaling down image
GDALRasterBand *myGdalBand = gdalDataset->GetRasterBand( theBandNoInt );
GDALRasterBand *myGdalBand = gdalDataset->GetRasterBand( 1 ); //always 1 !!!
uint *myGdalScanData = (uint*) CPLMalloc(sizeof(uint)*theRasterViewPort->drawableAreaXDimInt * sizeof(uint)*theRasterViewPort->drawableAreaYDimInt);
CPLErr myResultCPLerr = myGdalBand->RasterIO(
GF_Read, theRasterViewPort->rectXOffsetInt,
@ -782,7 +783,7 @@ void QgsRasterLayer::drawPalettedSingleBandPseudoColor(QPainter * theQPainter,
// read entire clipped area of raster band
// treat myGdalScanData as a pseudo-multidimensional array
// RasterIO() takes care of scaling down image
GDALRasterBand *myGdalBand = gdalDataset->GetRasterBand( theBandNoInt );
GDALRasterBand *myGdalBand = gdalDataset->GetRasterBand( 1 ); //always one!
uint *myGdalScanData = (uint*) CPLMalloc(sizeof(uint)*theRasterViewPort->drawableAreaXDimInt * sizeof(uint)*theRasterViewPort->drawableAreaYDimInt);
CPLErr myResultCPLerr = myGdalBand->RasterIO(
GF_Read, theRasterViewPort->rectXOffsetInt,
@ -800,13 +801,13 @@ void QgsRasterLayer::drawPalettedSingleBandPseudoColor(QPainter * theQPainter,
myQImage.setAlphaBuffer(true);
RasterBandStats myRasterBandStats = getRasterBandStats(1);
RasterBandStats myRasterBandStats = getRasterBandStats(theBandNoInt);
double myRangeDouble=myRasterBandStats.rangeDouble;
int myRedInt=0;
int myGreenInt=0;
int myBlueInt=0;
//calculate the adjusted matrix stats - which come into affect if the user has chosen
RasterBandStats myAdjustedRasterBandStats = getRasterBandStats(1);
RasterBandStats myAdjustedRasterBandStats = getRasterBandStats(theBandNoInt);
//to histogram stretch to a given number of std deviations
//see if we are using histogram stretch using stddev and plot only within the selected number of deviations if we are

View File

@ -48,6 +48,11 @@ QgsRasterLayerProperties::QgsRasterLayerProperties(QgsMapLayer * lyr) : QgsRaste
//downcast the maplayer to rasterlayer
rasterLayer = (QgsRasterLayer *) lyr;
//display the raster dimensions and no data value
lblColumns->setText(tr("<p align=\"center\">Columns:") + QString::number(rasterLayer->getRasterXDim()) + "</p>");
lblRows->setText(tr("<p align=\"right\">Rows:") + QString::number(rasterLayer->getRasterYDim()) + "</p>");
lblNoData->setText(tr("No Data:") + QString::number(rasterLayer->getNoDataValue()));
//these properties (layername and label) are provided by the qgsmaplayer superclass
leLayerSource->setText(rasterLayer->source());
leDisplayName->setText(lyr->name());

View File

@ -116,7 +116,7 @@
<property name="name">
<cstring>unnamed</cstring>
</property>
<widget class="QLabel" row="0" column="0">
<widget class="QLabel" row="0" column="0" rowspan="1" colspan="3">
<property name="name">
<cstring>lblLayerSource</cstring>
</property>
@ -124,12 +124,12 @@
<string>Layer Source:</string>
</property>
</widget>
<widget class="QLineEdit" row="3" column="0" rowspan="1" colspan="2">
<widget class="QLineEdit" row="3" column="0" rowspan="1" colspan="5">
<property name="name">
<cstring>leDisplayName</cstring>
</property>
</widget>
<widget class="QLineEdit" row="1" column="0" rowspan="1" colspan="2">
<widget class="QLineEdit" row="1" column="0" rowspan="1" colspan="5">
<property name="name">
<cstring>leLayerSource</cstring>
</property>
@ -137,7 +137,7 @@
<bool>false</bool>
</property>
</widget>
<widget class="QLabel" row="2" column="0">
<widget class="QLabel" row="2" column="0" rowspan="1" colspan="3">
<property name="name">
<cstring>lblDisplayName</cstring>
</property>
@ -145,7 +145,7 @@
<string>Display Name:</string>
</property>
</widget>
<widget class="QLabel" row="4" column="0">
<widget class="QLabel" row="4" column="0" rowspan="1" colspan="3">
<property name="name">
<cstring>lblDisplayName_2</cstring>
</property>
@ -153,7 +153,7 @@
<string>Legend:</string>
</property>
</widget>
<widget class="QLabel" row="5" column="0" rowspan="1" colspan="2">
<widget class="QLabel" row="5" column="0" rowspan="1" colspan="5">
<property name="name">
<cstring>pixmapLegend</cstring>
</property>
@ -167,7 +167,7 @@
<bool>true</bool>
</property>
</widget>
<widget class="QCheckBox" row="6" column="0" rowspan="1" colspan="2">
<widget class="QCheckBox" row="6" column="0" rowspan="1" colspan="5">
<property name="name">
<cstring>cboxShowDebugInfo</cstring>
</property>
@ -175,7 +175,116 @@
<string>Show debug info as overlay on raster?</string>
</property>
</widget>
<widget class="QLabel" row="7" column="2">
<property name="name">
<cstring>lblColumns</cstring>
</property>
<property name="text">
<string>&lt;p align="center"&gt;Columns: &lt;/p&gt;</string>
</property>
</widget>
<widget class="QLabel" row="8" column="2">
<property name="name">
<cstring>pixmapThumbnail</cstring>
</property>
<property name="minimumSize">
<size>
<width>120</width>
<height>120</height>
</size>
</property>
<property name="frameShape">
<enum>StyledPanel</enum>
</property>
<property name="scaledContents">
<bool>true</bool>
</property>
</widget>
<widget class="QLabel" row="8" column="1">
<property name="name">
<cstring>lblRows</cstring>
</property>
<property name="text">
<string>&lt;p align="right"&gt;Rows: &lt;/p&gt;</string>
</property>
</widget>
<widget class="QLabel" row="8" column="3">
<property name="name">
<cstring>lblNoData</cstring>
</property>
<property name="text">
<string>No Data:</string>
</property>
</widget>
<spacer row="7" column="3">
<property name="name">
<cstring>spacer6</cstring>
</property>
<property name="orientation">
<enum>Horizontal</enum>
</property>
<property name="sizeType">
<enum>Expanding</enum>
</property>
<property name="sizeHint">
<size>
<width>81</width>
<height>21</height>
</size>
</property>
</spacer>
<spacer row="7" column="1">
<property name="name">
<cstring>spacer7</cstring>
</property>
<property name="orientation">
<enum>Horizontal</enum>
</property>
<property name="sizeType">
<enum>Expanding</enum>
</property>
<property name="sizeHint">
<size>
<width>121</width>
<height>21</height>
</size>
</property>
</spacer>
<spacer row="8" column="4">
<property name="name">
<cstring>spacer8</cstring>
</property>
<property name="orientation">
<enum>Horizontal</enum>
</property>
<property name="sizeType">
<enum>Expanding</enum>
</property>
<property name="sizeHint">
<size>
<width>41</width>
<height>21</height>
</size>
</property>
</spacer>
<spacer row="8" column="0">
<property name="name">
<cstring>spacer9</cstring>
</property>
<property name="orientation">
<enum>Horizontal</enum>
</property>
<property name="sizeType">
<enum>Expanding</enum>
</property>
<property name="sizeHint">
<size>
<width>21</width>
<height>20</height>
</size>
</property>
</spacer>
<spacer row="9" column="2">
<property name="name">
<cstring>spacer2</cstring>
</property>
@ -188,7 +297,7 @@
<property name="sizeHint">
<size>
<width>21</width>
<height>70</height>
<height>20</height>
</size>
</property>
</spacer>