mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-12 00:06:43 -04:00
Further updates to flot graphing for raster histogram
This commit is contained in:
parent
4f0a35fd15
commit
d75d8b55ff
@ -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; }
|
||||
<table border="0" style="-qt-table-type: root; margin-top:4px; margin-bottom:4px; margin-left:4px; margin-right:4px;">
|
||||
<tr>
|
||||
<td style="border: none;">
|
||||
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"></p>
|
||||
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"></p>
|
||||
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"></p>
|
||||
<p style="-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;"></p>
|
||||
<p style="-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;"></p>
|
||||
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"></p>
|
||||
@ -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>
|
||||
|
Loading…
x
Reference in New Issue
Block a user