Skip to content
Permalink
Browse files
Further updates to flot graphing for raster histogram
  • Loading branch information
timlinux committed Nov 21, 2011
1 parent 4f0a35f commit d75d8b55ffb8e22595614648a329706e63750dda
Showing with 34 additions and 18 deletions.
  1. +1 −0 resources/CMakeLists.txt
  2. +15 −2 src/app/qgsrasterlayerproperties.cpp
  3. +18 −16 src/ui/qgsrasterlayerpropertiesbase.ui
@@ -3,3 +3,4 @@ INSTALL(FILES srs.db qgis.db qgis_help.db symbology-ng-style.xml spatialite.db c

ADD_SUBDIRECTORY(context_help)
ADD_SUBDIRECTORY(js)
ADD_SUBDIRECTORY(html)
@@ -52,6 +52,7 @@
#include <QMouseEvent>
#include <QVector>
#include <QWebView>
#include <QWebFrame>


QgsRasterLayerProperties::QgsRasterLayerProperties( QgsMapLayer* lyr, QgsMapCanvas* theCanvas, QWidget *parent, Qt::WFlags fl )
@@ -65,6 +66,8 @@ QgsRasterLayerProperties::QgsRasterLayerProperties( QgsMapLayer* lyr, QgsMapCanv
mRGBMinimumMaximumEstimated = true;

setupUi( this );
QString myChartPage = "file:///" + QgsApplication::pkgDataPath() + "/resources/html/chart.html";
mWebPlot->load(QUrl( myChartPage ));
connect( buttonBox, SIGNAL( accepted() ), this, SLOT( accept() ) );
connect( this, SIGNAL( accepted() ), this, SLOT( apply() ) );
connect( buttonBox->button( QDialogButtonBox::Apply ), SIGNAL( clicked() ), this, SLOT( apply() ) );
@@ -1855,14 +1858,13 @@ void QgsRasterLayerProperties::refreshHistogram()
mHistogramProgress->show();
connect( mRasterLayer, SIGNAL( progressUpdate( int ) ), mHistogramProgress, SLOT( setValue( int ) ) );
QApplication::setOverrideCursor( Qt::WaitCursor );
mWebPlot->setHtml("<h1>Hellow World</h1>");
// Explanation:
// We use the gdal histogram creation routine is called for each selected
// layer. Currently the hist is hardcoded
// to create 256 bins. Each bin stores the total number of cells that
// fit into the range defined by that bin.
//
// The graph routine below determines the greatest number of pixesl in any given
// The graph routine below determines the greatest number of pixels in any given
// bin in all selected layers, and the min. It then draws a scaled line between min
// and max - scaled to image height. 1 line drawn per selected band
//
@@ -1881,10 +1883,21 @@ void QgsRasterLayerProperties::refreshHistogram()
{
QgsRasterBandStats myRasterBandStats = mRasterLayer->bandStatistics( myIteratorInt );
mRasterLayer->populateHistogram( myIteratorInt, BINCOUNT, myIgnoreOutOfRangeFlag, myThoroughBandScanFlag );
QString mySeriesJS = "addSeries([";
bool myFirst = true;
for ( int myBin = 0; myBin < BINCOUNT; myBin++ )
{
if ( ! myFirst )
{
mySeriesJS += ",";
}
int myBinValue = myRasterBandStats.histogramVector->at( myBin );
mySeriesJS += QString("[%1,%2]").arg(myBin).arg(myBinValue);
myFirst = false;
}
mySeriesJS += "]);";
QgsDebugMsg( mySeriesJS );
mWebPlot->page()->mainFrame()->evaluateJavaScript( mySeriesJS );
}
disconnect( mRasterLayer, SIGNAL( progressUpdate( int ) ), mHistogramProgress, SLOT( setValue( int ) ) );
mHistogramProgress->hide();
@@ -15,8 +15,7 @@
</property>
<property name="windowIcon">
<iconset>
<normaloff/>
</iconset>
<normaloff>../../../../../.designer/backup</normaloff>../../../../../.designer/backup</iconset>
</property>
<property name="sizeGripEnabled">
<bool>true</bool>
@@ -234,7 +233,7 @@
</property>
<property name="icon">
<iconset>
<normaloff>../../images/themes/default/mActionFileSave.png</normaloff>../../images/themes/default/mActionFileSave.png</iconset>
<normaloff>../../../../../images/themes/default/mActionFileSave.png</normaloff>../../../../../images/themes/default/mActionFileSave.png</iconset>
</property>
</widget>
</item>
@@ -542,7 +541,7 @@
</property>
<property name="icon">
<iconset>
<normaloff>../../images/themes/default/mActionFileSave.png</normaloff>../../images/themes/default/mActionFileSave.png</iconset>
<normaloff>../../../../../images/themes/default/mActionFileSave.png</normaloff>../../../../../images/themes/default/mActionFileSave.png</iconset>
</property>
</widget>
</item>
@@ -898,7 +897,7 @@
</property>
<property name="icon">
<iconset>
<normaloff>../../images/themes/default/mActionFileSave.png</normaloff>../../images/themes/default/mActionFileSave.png</iconset>
<normaloff>../../../../../images/themes/default/mActionFileSave.png</normaloff>../../../../../images/themes/default/mActionFileSave.png</iconset>
</property>
</widget>
</item>
@@ -1093,7 +1092,7 @@
</property>
<property name="icon">
<iconset>
<normaloff>../../images/themes/default/mActionNewAttribute.png</normaloff>../../images/themes/default/mActionNewAttribute.png</iconset>
<normaloff>../../../../../images/themes/default/mActionNewAttribute.png</normaloff>../../../../../images/themes/default/mActionNewAttribute.png</iconset>
</property>
</widget>
</item>
@@ -1110,7 +1109,7 @@
</property>
<property name="icon">
<iconset>
<normaloff>../../images/themes/default/mActionContextHelp.png</normaloff>../../images/themes/default/mActionContextHelp.png</iconset>
<normaloff>../../../../../images/themes/default/mActionContextHelp.png</normaloff>../../../../../images/themes/default/mActionContextHelp.png</iconset>
</property>
</widget>
</item>
@@ -1124,7 +1123,7 @@
</property>
<property name="icon">
<iconset>
<normaloff>../../images/themes/default/mActionDeleteAttribute.png</normaloff>../../images/themes/default/mActionDeleteAttribute.png</iconset>
<normaloff>../../../../../images/themes/default/mActionDeleteAttribute.png</normaloff>../../../../../images/themes/default/mActionDeleteAttribute.png</iconset>
</property>
</widget>
</item>
@@ -1138,7 +1137,7 @@
</property>
<property name="icon">
<iconset>
<normaloff>../../images/themes/default/mActionCopySelected.png</normaloff>../../images/themes/default/mActionCopySelected.png</iconset>
<normaloff>../../../../../images/themes/default/mActionCopySelected.png</normaloff>../../../../../images/themes/default/mActionCopySelected.png</iconset>
</property>
</widget>
</item>
@@ -1165,7 +1164,7 @@
</property>
<property name="icon">
<iconset>
<normaloff>../../images/themes/default/mActionFolder.png</normaloff>../../images/themes/default/mActionFolder.png</iconset>
<normaloff>../../../../../images/themes/default/mActionFolder.png</normaloff>../../../../../images/themes/default/mActionFolder.png</iconset>
</property>
</widget>
</item>
@@ -1179,7 +1178,7 @@
</property>
<property name="icon">
<iconset>
<normaloff>../../images/themes/default/mActionFileSave.png</normaloff>../../images/themes/default/mActionFileSave.png</iconset>
<normaloff>../../../../../images/themes/default/mActionFileSave.png</normaloff>../../../../../images/themes/default/mActionFileSave.png</iconset>
</property>
</widget>
</item>
@@ -1350,7 +1349,7 @@
</property>
<property name="icon">
<iconset>
<normaloff>../../images/themes/default/mActionNewAttribute.png</normaloff>../../images/themes/default/mActionNewAttribute.png</iconset>
<normaloff>../../../../../images/themes/default/mActionNewAttribute.png</normaloff>../../../../../images/themes/default/mActionNewAttribute.png</iconset>
</property>
</widget>
</item>
@@ -1380,7 +1379,7 @@
</property>
<property name="icon">
<iconset>
<normaloff>../../images/themes/default/mActionFolder.png</normaloff>../../images/themes/default/mActionFolder.png</iconset>
<normaloff>../../../../../images/themes/default/mActionFolder.png</normaloff>../../../../../images/themes/default/mActionFolder.png</iconset>
</property>
</widget>
</item>
@@ -1394,7 +1393,7 @@
</property>
<property name="icon">
<iconset>
<normaloff>../../images/themes/default/mActionFileSave.png</normaloff>../../images/themes/default/mActionFileSave.png</iconset>
<normaloff>../../../../../images/themes/default/mActionFileSave.png</normaloff>../../../../../images/themes/default/mActionFileSave.png</iconset>
</property>
</widget>
</item>
@@ -1775,6 +1774,9 @@ p, li { white-space: pre-wrap; }
&lt;table border=&quot;0&quot; style=&quot;-qt-table-type: root; margin-top:4px; margin-bottom:4px; margin-left:4px; margin-right:4px;&quot;&gt;
&lt;tr&gt;
&lt;td style=&quot;border: none;&quot;&gt;
&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;/p&gt;
&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;/p&gt;
&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;/p&gt;
&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:10pt;&quot;&gt;&lt;/p&gt;
&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Sans'; font-size:10pt;&quot;&gt;&lt;/p&gt;
&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;/p&gt;
@@ -1880,11 +1882,11 @@ p, li { white-space: pre-wrap; }
</property>
<property name="icon">
<iconset>
<normaloff>../../images/themes/default/mActionFileSave.png</normaloff>../../images/themes/default/mActionFileSave.png</iconset>
<normaloff>../../../../../images/themes/default/mActionFileSave.png</normaloff>../../../../../images/themes/default/mActionFileSave.png</iconset>
</property>
</widget>
</item>
<item row="0" column="0">
<item row="0" column="0" colspan="2">
<widget class="QWebView" name="mWebPlot">
<property name="url">
<url>

0 comments on commit d75d8b5

Please sign in to comment.