18#ifndef QGSPALETTEDRENDERERWIDGET_H
19#define QGSPALETTEDRENDERERWIDGET_H
26#include "ui_qgspalettedrendererwidgetbase.h"
30#include <QSortFilterProxyModel>
33class QgsLocaleAwareNumericLineEditDelegate;
42class QgsPalettedRendererClassGatherer:
public QThread
55 mFeedbackMutex.lock();
58 mFeedbackMutex.unlock();
64 bool wasCanceled()
const {
return mWasCanceled; }
73 void collectedClasses();
79 void progressChanged(
double progress );
83 std::unique_ptr< QgsRasterDataProvider > mProvider;
85 std::unique_ptr< QgsColorRamp > mRamp;
89 QMutex mFeedbackMutex;
93class QgsPalettedRendererModel :
public QAbstractItemModel
106 QgsPalettedRendererModel( QObject *parent =
nullptr );
113 QModelIndex index(
int row,
int column,
const QModelIndex &parent = QModelIndex() )
const override;
114 QModelIndex parent(
const QModelIndex &index )
const override;
115 int columnCount(
const QModelIndex &parent = QModelIndex() )
const override;
116 int rowCount(
const QModelIndex &parent = QModelIndex() )
const override;
117 QVariant data(
const QModelIndex &index,
int role = Qt::DisplayRole )
const override;
118 QVariant headerData(
int section, Qt::Orientation orientation,
int role )
const override;
119 bool setData(
const QModelIndex &index,
const QVariant &value,
int role = Qt::EditRole )
override;
120 Qt::ItemFlags flags(
const QModelIndex &index )
const override;
121 bool removeRows(
int row,
int count,
const QModelIndex &parent = QModelIndex() )
override;
122 bool insertRows(
int row,
int count,
const QModelIndex &parent = QModelIndex() )
override;
123 Qt::DropActions supportedDropActions()
const override;
124 QStringList mimeTypes()
const override;
125 QMimeData *mimeData(
const QModelIndexList &indexes )
const override;
126 bool dropMimeData(
const QMimeData *data, Qt::DropAction action,
int row,
int column,
const QModelIndex &parent )
override;
128 QModelIndex addEntry(
const QColor &color );
136 void classesChanged();
145class QgsPalettedRendererProxyModel:
public QSortFilterProxyModel
151 QgsPalettedRendererProxyModel( QObject *parent = 0 )
152 : QSortFilterProxyModel( parent )
161 bool lessThan(
const QModelIndex &left,
const QModelIndex &right )
const override
163 const QModelIndex lv { left.model()->index( left.row(),
static_cast<int>( QgsPalettedRendererModel::Column::ValueColumn ), left.parent() ) };
164 const QModelIndex rv { right.model()->index( right.row(),
static_cast<int>( QgsPalettedRendererModel::Column::ValueColumn ), right.parent() ) };
165 const double leftData { sourceModel()->data( lv ).toDouble( ) };
166 const double rightData { sourceModel()->data( rv ).toDouble( ) };
167 return leftData < rightData;
198 QMenu *mContextMenu =
nullptr;
199 QMenu *mAdvancedMenu =
nullptr;
200 QgsPalettedRendererModel *mModel =
nullptr;
201 QgsPalettedRendererProxyModel *mProxyModel =
nullptr;
204 QgsPalettedRendererClassGatherer *mGatherer =
nullptr;
208 QgsLocaleAwareNumericLineEditDelegate *mValueDelegate =
nullptr;
210 void setSelectionColor( const QItemSelection &selection, const QColor &color );
217 void changeOpacity();
219 void applyColorRamp();
220 void loadColorTable();
221 void saveColorTable();
223 void loadFromLayer();
224 void bandChanged(
int band );
226 void gatheredClasses();
227 void gathererThreadFinished();
Abstract base class for color ramps.
Base class for all map layer types.
QList< QgsPalettedRasterRenderer::Class > ClassData
Map of value to class properties.
Feedback object tailored for raster block reading.
Represents a raster layer.
Raster renderer pipe that applies colors to a raster.
A rectangle specified with double values.
Properties of a single value class.