mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-18 00:03:05 -04:00
indentation update
This commit is contained in:
parent
3e08931e40
commit
413e9dcd4e
@ -66,13 +66,13 @@ void QgsAppLegendInterface::updateIndex( QModelIndex oldIndex, QModelIndex newIn
|
|||||||
|
|
||||||
void QgsAppLegendInterface::setGroupExpanded( int groupIndex, bool expand )
|
void QgsAppLegendInterface::setGroupExpanded( int groupIndex, bool expand )
|
||||||
{
|
{
|
||||||
QTreeWidgetItem * item = getItem (groupIndex);
|
QTreeWidgetItem * item = getItem( groupIndex );
|
||||||
if ( !item )
|
if ( !item )
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
item->setExpanded(expand);
|
item->setExpanded( expand );
|
||||||
}
|
}
|
||||||
|
|
||||||
void QgsAppLegendInterface::setGroupVisible( int groupIndex, bool visible )
|
void QgsAppLegendInterface::setGroupVisible( int groupIndex, bool visible )
|
||||||
@ -82,29 +82,30 @@ void QgsAppLegendInterface::setGroupVisible( int groupIndex, bool visible )
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Qt::CheckState state = visible ? Qt::Checked : Qt::Unchecked;
|
Qt::CheckState state = visible ? Qt::Checked : Qt::Unchecked;
|
||||||
getItem (groupIndex)->setCheckState( 0, state );
|
getItem( groupIndex )->setCheckState( 0, state );
|
||||||
}
|
}
|
||||||
|
|
||||||
QTreeWidgetItem *QgsAppLegendInterface::getItem(int itemIndex)
|
QTreeWidgetItem *QgsAppLegendInterface::getItem( int itemIndex )
|
||||||
{
|
{
|
||||||
int itemCount = 0;
|
int itemCount = 0;
|
||||||
for (QTreeWidgetItem* theItem = mLegend->firstItem(); theItem; theItem = mLegend->nextItem( theItem ) )
|
for ( QTreeWidgetItem* theItem = mLegend->firstItem(); theItem; theItem = mLegend->nextItem( theItem ) )
|
||||||
{
|
{
|
||||||
QgsLegendItem* legendItem = dynamic_cast<QgsLegendItem *>( theItem );
|
QgsLegendItem* legendItem = dynamic_cast<QgsLegendItem *>( theItem );
|
||||||
if (legendItem->type() == QgsLegendItem::LEGEND_GROUP) {
|
if ( legendItem->type() == QgsLegendItem::LEGEND_GROUP )
|
||||||
if (itemCount == itemIndex)
|
{
|
||||||
{
|
if ( itemCount == itemIndex )
|
||||||
return theItem;
|
{
|
||||||
}
|
return theItem;
|
||||||
else
|
}
|
||||||
{
|
else
|
||||||
itemCount = itemCount + 1;
|
{
|
||||||
}
|
itemCount = itemCount + 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void QgsAppLegendInterface::setLayerVisible( QgsMapLayer * ml, bool visible )
|
void QgsAppLegendInterface::setLayerVisible( QgsMapLayer * ml, bool visible )
|
||||||
@ -128,24 +129,24 @@ QList< GroupLayerInfo > QgsAppLegendInterface::groupLayerRelationship()
|
|||||||
|
|
||||||
bool QgsAppLegendInterface::groupExists( int groupIndex )
|
bool QgsAppLegendInterface::groupExists( int groupIndex )
|
||||||
{
|
{
|
||||||
QTreeWidgetItem * item = getItem (groupIndex);
|
QTreeWidgetItem * item = getItem( groupIndex );
|
||||||
QgsLegendItem* legendItem = dynamic_cast<QgsLegendItem *>( item );
|
QgsLegendItem* legendItem = dynamic_cast<QgsLegendItem *>( item );
|
||||||
|
|
||||||
if ( !legendItem )
|
if ( !legendItem )
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return legendItem->type() == QgsLegendItem::LEGEND_GROUP;
|
return legendItem->type() == QgsLegendItem::LEGEND_GROUP;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool QgsAppLegendInterface::isGroupExpanded( int groupIndex )
|
bool QgsAppLegendInterface::isGroupExpanded( int groupIndex )
|
||||||
{
|
{
|
||||||
QTreeWidgetItem * item = getItem (groupIndex);
|
QTreeWidgetItem * item = getItem( groupIndex );
|
||||||
if ( !item )
|
if ( !item )
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return item->isExpanded();
|
return item->isExpanded();
|
||||||
}
|
}
|
||||||
|
@ -94,7 +94,7 @@ class QgsAppLegendInterface : public QgsLegendInterface
|
|||||||
|
|
||||||
//! Pointer to QgsLegend object
|
//! Pointer to QgsLegend object
|
||||||
QgsLegend *mLegend;
|
QgsLegend *mLegend;
|
||||||
QTreeWidgetItem *getItem(int itemIndex);
|
QTreeWidgetItem *getItem( int itemIndex );
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif //QGSLEGENDAPPIFACE_H
|
#endif //QGSLEGENDAPPIFACE_H
|
||||||
|
@ -43,20 +43,20 @@ class QgsDiagramLayerSettings;
|
|||||||
|
|
||||||
class CORE_EXPORT QgsLabelPosition
|
class CORE_EXPORT QgsLabelPosition
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
QgsLabelPosition( int id, double r, const QVector< QgsPoint >& corners, const QgsRectangle& rect, double w, double h, const QString& layer, bool upside_down, bool diagram = false, bool pinned = false ):
|
QgsLabelPosition( int id, double r, const QVector< QgsPoint >& corners, const QgsRectangle& rect, double w, double h, const QString& layer, bool upside_down, bool diagram = false, bool pinned = false ):
|
||||||
featureId( id ), rotation( r ), cornerPoints( corners ), labelRect( rect ), width( w ), height( h ), layerID( layer ), upsideDown( upside_down ), isDiagram( diagram ), isPinned( pinned ) {}
|
featureId( id ), rotation( r ), cornerPoints( corners ), labelRect( rect ), width( w ), height( h ), layerID( layer ), upsideDown( upside_down ), isDiagram( diagram ), isPinned( pinned ) {}
|
||||||
QgsLabelPosition(): featureId( -1 ), rotation( 0 ), labelRect( QgsRectangle() ), width( 0 ), height( 0 ), layerID( "" ), upsideDown( false ), isDiagram( false ), isPinned( false ) {}
|
QgsLabelPosition(): featureId( -1 ), rotation( 0 ), labelRect( QgsRectangle() ), width( 0 ), height( 0 ), layerID( "" ), upsideDown( false ), isDiagram( false ), isPinned( false ) {}
|
||||||
int featureId;
|
int featureId;
|
||||||
double rotation;
|
double rotation;
|
||||||
QVector< QgsPoint > cornerPoints;
|
QVector< QgsPoint > cornerPoints;
|
||||||
QgsRectangle labelRect;
|
QgsRectangle labelRect;
|
||||||
double width;
|
double width;
|
||||||
double height;
|
double height;
|
||||||
QString layerID;
|
QString layerID;
|
||||||
bool upsideDown;
|
bool upsideDown;
|
||||||
bool isDiagram;
|
bool isDiagram;
|
||||||
bool isPinned;
|
bool isPinned;
|
||||||
};
|
};
|
||||||
|
|
||||||
/** Labeling engine interface.
|
/** Labeling engine interface.
|
||||||
|
@ -198,11 +198,11 @@ void * QgsMultiBandColorRenderer::readBlock( int bandNo, QgsRectangle const & e
|
|||||||
if ( !bandData[*bandIt] )
|
if ( !bandData[*bandIt] )
|
||||||
{
|
{
|
||||||
// We should free the alloced mem from block().
|
// We should free the alloced mem from block().
|
||||||
QgsDebugMsg("No input band" );
|
QgsDebugMsg( "No input band" );
|
||||||
bandIt--;
|
bandIt--;
|
||||||
for ( ; bandIt != bands.constBegin(); bandIt-- )
|
for ( ; bandIt != bands.constBegin(); bandIt-- )
|
||||||
{
|
{
|
||||||
VSIFree( bandData[*bandIt] );
|
VSIFree( bandData[*bandIt] );
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -105,7 +105,7 @@ void * QgsPalettedRasterRenderer::readBlock( int bandNo, QgsRectangle const & e
|
|||||||
void* rasterData = mInput->block( bandNo, extent, width, height );
|
void* rasterData = mInput->block( bandNo, extent, width, height );
|
||||||
if ( ! rasterData )
|
if ( ! rasterData )
|
||||||
{
|
{
|
||||||
QgsDebugMsg("No raster data!" );
|
QgsDebugMsg( "No raster data!" );
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -64,7 +64,7 @@ void * QgsSingleBandColorDataRenderer::readBlock( int bandNo, QgsRectangle cons
|
|||||||
void* rasterData = mInput->block( bandNo, extent, width, height );
|
void* rasterData = mInput->block( bandNo, extent, width, height );
|
||||||
if ( ! rasterData )
|
if ( ! rasterData )
|
||||||
{
|
{
|
||||||
QgsDebugMsg("No raster data!" );
|
QgsDebugMsg( "No raster data!" );
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -218,7 +218,7 @@ void QgsProjectParser::describeFeatureType( const QString& aTypeName, QDomElemen
|
|||||||
QMap< QString, QMap< int, QString > > aliasInfo = layerAliasInfo();
|
QMap< QString, QMap< int, QString > > aliasInfo = layerAliasInfo();
|
||||||
QMap< QString, QSet<QString> > hiddenAttrs = hiddenAttributes();
|
QMap< QString, QSet<QString> > hiddenAttrs = hiddenAttributes();
|
||||||
|
|
||||||
foreach( const QDomElement &elem, mProjectLayerElements )
|
foreach ( const QDomElement &elem, mProjectLayerElements )
|
||||||
{
|
{
|
||||||
QString type = elem.attribute( "type" );
|
QString type = elem.attribute( "type" );
|
||||||
if ( type == "vector" )
|
if ( type == "vector" )
|
||||||
|
@ -57,7 +57,7 @@ class QgsSLDParser: public QgsConfigParser
|
|||||||
void layersAndStylesCapabilities( QDomElement& parentElement, QDomDocument& doc ) const;
|
void layersAndStylesCapabilities( QDomElement& parentElement, QDomDocument& doc ) const;
|
||||||
|
|
||||||
void featureTypeList( QDomElement &, QDomDocument & ) const {};
|
void featureTypeList( QDomElement &, QDomDocument & ) const {};
|
||||||
|
|
||||||
void describeFeatureType( const QString& aTypeName, QDomElement& parentElement, QDomDocument& doc ) const {};
|
void describeFeatureType( const QString& aTypeName, QDomElement& parentElement, QDomDocument& doc ) const {};
|
||||||
|
|
||||||
/**Returns number of layers in configuration*/
|
/**Returns number of layers in configuration*/
|
||||||
|
@ -264,7 +264,7 @@ QDomDocument QgsWFSServer::describeFeatureType()
|
|||||||
{
|
{
|
||||||
typeName = "";
|
typeName = "";
|
||||||
}
|
}
|
||||||
mConfigParser->describeFeatureType( typeName, schemaElement, doc);
|
mConfigParser->describeFeatureType( typeName, schemaElement, doc );
|
||||||
return doc;
|
return doc;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -511,7 +511,7 @@ void QgsWFSServer::startGetFeature( QgsRequestHandler& request, const QString& f
|
|||||||
if ( format == "GeoJSON" )
|
if ( format == "GeoJSON" )
|
||||||
{
|
{
|
||||||
fcString = "{\"type\": \"FeatureCollection\",\n";
|
fcString = "{\"type\": \"FeatureCollection\",\n";
|
||||||
fcString += " \"bbox\": [ "+ QString::number( rect->xMinimum(), 'f' ) +", "+ QString::number( rect->yMinimum(), 'f' ) +", "+ QString::number( rect->xMaximum(), 'f' ) +", "+ QString::number( rect->yMaximum(), 'f' ) +"],\n";
|
fcString += " \"bbox\": [ " + QString::number( rect->xMinimum(), 'f' ) + ", " + QString::number( rect->yMinimum(), 'f' ) + ", " + QString::number( rect->xMaximum(), 'f' ) + ", " + QString::number( rect->yMaximum(), 'f' ) + "],\n";
|
||||||
fcString += " \"features\": [\n";
|
fcString += " \"features\": [\n";
|
||||||
result = fcString.toUtf8();
|
result = fcString.toUtf8();
|
||||||
request.startGetFeatureResponse( &result, format );
|
request.startGetFeatureResponse( &result, format );
|
||||||
@ -599,7 +599,7 @@ void QgsWFSServer::startGetFeature( QgsRequestHandler& request, const QString& f
|
|||||||
fcString += " xmlns=\"http://www.opengis.net/wfs\"";
|
fcString += " xmlns=\"http://www.opengis.net/wfs\"";
|
||||||
fcString += " xmlns:wfs=\"http://www.opengis.net/wfs\"";
|
fcString += " xmlns:wfs=\"http://www.opengis.net/wfs\"";
|
||||||
fcString += " xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"";
|
fcString += " xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"";
|
||||||
fcString += " xsi:schemaLocation=\"http://www.opengis.net/wfs http://schemas.opengis.net/wfs/1.0.0/wfs.xsd http://www.opengis.net/gml "+ hrefString.replace( "&", "&" ) +"\"";
|
fcString += " xsi:schemaLocation=\"http://www.opengis.net/wfs http://schemas.opengis.net/wfs/1.0.0/wfs.xsd http://www.opengis.net/gml " + hrefString.replace( "&", "&" ) + "\"";
|
||||||
fcString += " xmlns:ogc=\"http://www.opengis.net/ogc\"";
|
fcString += " xmlns:ogc=\"http://www.opengis.net/ogc\"";
|
||||||
fcString += " xmlns:gml=\"http://www.opengis.net/gml\"";
|
fcString += " xmlns:gml=\"http://www.opengis.net/gml\"";
|
||||||
fcString += " xmlns:ows=\"http://www.opengis.net/ows\"";
|
fcString += " xmlns:ows=\"http://www.opengis.net/ows\"";
|
||||||
@ -691,7 +691,7 @@ QString QgsWFSServer::createFeatureGeoJSON( QgsFeature* feat, QgsCoordinateRefer
|
|||||||
{
|
{
|
||||||
QgsRectangle box = geom->boundingBox();
|
QgsRectangle box = geom->boundingBox();
|
||||||
|
|
||||||
fStr += " \"bbox\": [ "+ QString::number( box.xMinimum(), 'f' ) +", "+ QString::number( box.yMinimum(), 'f' ) +", "+ QString::number( box.xMaximum(), 'f' ) +", "+ QString::number( box.yMaximum(), 'f' ) +"],\n";
|
fStr += " \"bbox\": [ " + QString::number( box.xMinimum(), 'f' ) + ", " + QString::number( box.yMinimum(), 'f' ) + ", " + QString::number( box.xMaximum(), 'f' ) + ", " + QString::number( box.yMaximum(), 'f' ) + "],\n";
|
||||||
|
|
||||||
fStr += " \"geometry\": ";
|
fStr += " \"geometry\": ";
|
||||||
fStr += geom->exportToGeoJSON();
|
fStr += geom->exportToGeoJSON();
|
||||||
@ -1020,7 +1020,7 @@ QDomElement QgsWFSServer::createCoordinateElem( const QVector<QgsPoint> points,
|
|||||||
{
|
{
|
||||||
coordString += " ";
|
coordString += " ";
|
||||||
}
|
}
|
||||||
coordString += QString::number( pointIt->x(), 'f');
|
coordString += QString::number( pointIt->x(), 'f' );
|
||||||
coordString += ",";
|
coordString += ",";
|
||||||
coordString += QString::number( pointIt->y(), 'f' );
|
coordString += QString::number( pointIt->y(), 'f' );
|
||||||
}
|
}
|
||||||
|
@ -144,7 +144,7 @@ void QgsGCPListModel::updateModel()
|
|||||||
// interested in the residual in this direction
|
// interested in the residual in this direction
|
||||||
if ( mGeorefTransform->transformWorldToRaster( p->mapCoords(), dst ) )
|
if ( mGeorefTransform->transformWorldToRaster( p->mapCoords(), dst ) )
|
||||||
{
|
{
|
||||||
dX = ( dst.x() - pixel.x() );
|
dX = ( dst.x() - pixel.x() );
|
||||||
dY = -( dst.y() - pixel.y() );
|
dY = -( dst.y() - pixel.y() );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -632,10 +632,10 @@ void QgsGeorefPluginGui::showGeorefConfigDialog()
|
|||||||
// Histogram stretch slots
|
// Histogram stretch slots
|
||||||
void QgsGeorefPluginGui::fullHistogramStretch()
|
void QgsGeorefPluginGui::fullHistogramStretch()
|
||||||
{
|
{
|
||||||
mLayer->setContrastEnhancementAlgorithm( "StretchToMinimumMaximum" );
|
mLayer->setContrastEnhancementAlgorithm( "StretchToMinimumMaximum" );
|
||||||
mLayer->setMinimumMaximumUsingDataset();
|
mLayer->setMinimumMaximumUsingDataset();
|
||||||
mLayer->setCacheImage( NULL );
|
mLayer->setCacheImage( NULL );
|
||||||
mCanvas->refresh();
|
mCanvas->refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
void QgsGeorefPluginGui::localHistogramStretch()
|
void QgsGeorefPluginGui::localHistogramStretch()
|
||||||
@ -863,11 +863,11 @@ void QgsGeorefPluginGui::createActions()
|
|||||||
// Histogram stretch
|
// Histogram stretch
|
||||||
mActionLocalHistogramStretch->setIcon( getThemeIcon( "/mActionLocalHistogramStretch.png" ) );
|
mActionLocalHistogramStretch->setIcon( getThemeIcon( "/mActionLocalHistogramStretch.png" ) );
|
||||||
connect( mActionLocalHistogramStretch, SIGNAL( triggered() ), this, SLOT( localHistogramStretch() ) );
|
connect( mActionLocalHistogramStretch, SIGNAL( triggered() ), this, SLOT( localHistogramStretch() ) );
|
||||||
mActionLocalHistogramStretch->setEnabled(false);
|
mActionLocalHistogramStretch->setEnabled( false );
|
||||||
|
|
||||||
mActionFullHistogramStretch->setIcon( getThemeIcon( "/mActionFullHistogramStretch.png" ) );
|
mActionFullHistogramStretch->setIcon( getThemeIcon( "/mActionFullHistogramStretch.png" ) );
|
||||||
connect( mActionFullHistogramStretch, SIGNAL( triggered() ), this, SLOT( fullHistogramStretch() ) );
|
connect( mActionFullHistogramStretch, SIGNAL( triggered() ), this, SLOT( fullHistogramStretch() ) );
|
||||||
mActionFullHistogramStretch->setEnabled(false);
|
mActionFullHistogramStretch->setEnabled( false );
|
||||||
|
|
||||||
// Help actions
|
// Help actions
|
||||||
mActionHelp = new QAction( tr( "Help" ), this );
|
mActionHelp = new QAction( tr( "Help" ), this );
|
||||||
@ -1041,7 +1041,7 @@ void QgsGeorefPluginGui::createStatusBar()
|
|||||||
statusBar()->addPermanentWidget( mCoordsLabel, 0 );
|
statusBar()->addPermanentWidget( mCoordsLabel, 0 );
|
||||||
|
|
||||||
mEPSG = createBaseLabelStatus();
|
mEPSG = createBaseLabelStatus();
|
||||||
mEPSG->setText("EPSG:");
|
mEPSG->setText( "EPSG:" );
|
||||||
statusBar()->addPermanentWidget( mEPSG, 0 );
|
statusBar()->addPermanentWidget( mEPSG, 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1121,8 +1121,8 @@ void QgsGeorefPluginGui::addRaster( QString file )
|
|||||||
|
|
||||||
mAgainAddRaster = false;
|
mAgainAddRaster = false;
|
||||||
|
|
||||||
mActionLocalHistogramStretch->setEnabled(true);
|
mActionLocalHistogramStretch->setEnabled( true );
|
||||||
mActionFullHistogramStretch->setEnabled(true);
|
mActionFullHistogramStretch->setEnabled( true );
|
||||||
|
|
||||||
// Status Bar
|
// Status Bar
|
||||||
if ( mGeorefTransform.hasCrs() )
|
if ( mGeorefTransform.hasCrs() )
|
||||||
@ -1133,8 +1133,8 @@ void QgsGeorefPluginGui::addRaster( QString file )
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
mEPSG->setText( tr("None") );
|
mEPSG->setText( tr( "None" ) );
|
||||||
mEPSG->setToolTip( tr("Coordinate of image(column/line)") );
|
mEPSG->setToolTip( tr( "Coordinate of image(column/line)" ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -179,7 +179,7 @@ void QgsGeorefTransform::selectTransformParametrisation( TransformParametrisatio
|
|||||||
|
|
||||||
void QgsGeorefTransform::setRasterChangeCoords( const QString &fileRaster )
|
void QgsGeorefTransform::setRasterChangeCoords( const QString &fileRaster )
|
||||||
{
|
{
|
||||||
mRasterChangeCoords.setRaster( fileRaster );
|
mRasterChangeCoords.setRaster( fileRaster );
|
||||||
}
|
}
|
||||||
|
|
||||||
bool QgsGeorefTransform::providesAccurateInverseTransformation() const
|
bool QgsGeorefTransform::providesAccurateInverseTransformation() const
|
||||||
@ -210,13 +210,13 @@ bool QgsGeorefTransform::updateParametersFromGCPs( const std::vector<QgsPoint> &
|
|||||||
}
|
}
|
||||||
if ( mRasterChangeCoords.hasCrs() )
|
if ( mRasterChangeCoords.hasCrs() )
|
||||||
{
|
{
|
||||||
std::vector<QgsPoint> pixelCoordsCorrect = mRasterChangeCoords.getPixelCoords(pixelCoords);
|
std::vector<QgsPoint> pixelCoordsCorrect = mRasterChangeCoords.getPixelCoords( pixelCoords );
|
||||||
mParametersInitialized = mGeorefTransformImplementation->updateParametersFromGCPs( mapCoords, pixelCoordsCorrect );
|
mParametersInitialized = mGeorefTransformImplementation->updateParametersFromGCPs( mapCoords, pixelCoordsCorrect );
|
||||||
pixelCoordsCorrect.clear();
|
pixelCoordsCorrect.clear();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
mParametersInitialized = mGeorefTransformImplementation->updateParametersFromGCPs( mapCoords, pixelCoords );
|
mParametersInitialized = mGeorefTransformImplementation->updateParametersFromGCPs( mapCoords, pixelCoords );
|
||||||
}
|
}
|
||||||
return mParametersInitialized;
|
return mParametersInitialized;
|
||||||
}
|
}
|
||||||
|
@ -90,10 +90,10 @@ class QgsGeorefTransform : public QgsGeorefTransformInterface
|
|||||||
bool hasCrs() const { return mRasterChangeCoords.hasCrs(); }
|
bool hasCrs() const { return mRasterChangeCoords.hasCrs(); }
|
||||||
|
|
||||||
//! \returns Coordinates of image
|
//! \returns Coordinates of image
|
||||||
QgsPoint toColumnLine(const QgsPoint &pntMap) { return mRasterChangeCoords.toColumnLine( pntMap ); }
|
QgsPoint toColumnLine( const QgsPoint &pntMap ) { return mRasterChangeCoords.toColumnLine( pntMap ); }
|
||||||
|
|
||||||
//! \returns Bounding box of image(transform to coordinate of Map or Image )
|
//! \returns Bounding box of image(transform to coordinate of Map or Image )
|
||||||
QgsRectangle getBoundingBox(const QgsRectangle &rect, bool toPixel) { return mRasterChangeCoords.getBoundingBox( rect, toPixel); }
|
QgsRectangle getBoundingBox( const QgsRectangle &rect, bool toPixel ) { return mRasterChangeCoords.getBoundingBox( rect, toPixel ); }
|
||||||
|
|
||||||
//! \brief The transform parametrisation currently in use.
|
//! \brief The transform parametrisation currently in use.
|
||||||
TransformParametrisation transformParametrisation() const;
|
TransformParametrisation transformParametrisation() const;
|
||||||
|
@ -28,64 +28,64 @@
|
|||||||
|
|
||||||
QgsRasterChangeCoords::QgsRasterChangeCoords()
|
QgsRasterChangeCoords::QgsRasterChangeCoords()
|
||||||
{
|
{
|
||||||
mHasCrs = false;
|
mHasCrs = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void QgsRasterChangeCoords::setRaster( const QString &fileRaster )
|
void QgsRasterChangeCoords::setRaster( const QString &fileRaster )
|
||||||
{
|
{
|
||||||
GDALAllRegister();
|
GDALAllRegister();
|
||||||
GDALDatasetH hDS = GDALOpen( TO8F( fileRaster ), GA_ReadOnly );
|
GDALDatasetH hDS = GDALOpen( TO8F( fileRaster ), GA_ReadOnly );
|
||||||
double adfGeoTransform[6];
|
double adfGeoTransform[6];
|
||||||
if( GDALGetProjectionRef( hDS ) != NULL && GDALGetGeoTransform(hDS, adfGeoTransform) == CE_None)
|
if ( GDALGetProjectionRef( hDS ) != NULL && GDALGetGeoTransform( hDS, adfGeoTransform ) == CE_None )
|
||||||
//if ( false )
|
//if ( false )
|
||||||
{
|
{
|
||||||
mHasCrs = true;
|
mHasCrs = true;
|
||||||
mUL_X = adfGeoTransform[0];
|
mUL_X = adfGeoTransform[0];
|
||||||
mUL_Y = adfGeoTransform[3];
|
mUL_Y = adfGeoTransform[3];
|
||||||
mResX = adfGeoTransform[1];
|
mResX = adfGeoTransform[1];
|
||||||
mResY = adfGeoTransform[5];
|
mResY = adfGeoTransform[5];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
mHasCrs = false;
|
mHasCrs = false;
|
||||||
}
|
}
|
||||||
GDALClose( hDS );
|
GDALClose( hDS );
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<QgsPoint> QgsRasterChangeCoords::getPixelCoords(const std::vector<QgsPoint> &mapCoords)
|
std::vector<QgsPoint> QgsRasterChangeCoords::getPixelCoords( const std::vector<QgsPoint> &mapCoords )
|
||||||
{
|
{
|
||||||
const int size = mapCoords.size();
|
const int size = mapCoords.size();
|
||||||
std::vector<QgsPoint> pixelCoords( size );
|
std::vector<QgsPoint> pixelCoords( size );
|
||||||
for ( int i = 0; i < size; i++ )
|
for ( int i = 0; i < size; i++ )
|
||||||
{
|
{
|
||||||
pixelCoords[i] = toColumnLine( mapCoords.at( i ) );
|
pixelCoords[i] = toColumnLine( mapCoords.at( i ) );
|
||||||
}
|
}
|
||||||
return pixelCoords;
|
return pixelCoords;
|
||||||
}
|
}
|
||||||
|
|
||||||
QgsRectangle QgsRasterChangeCoords::getBoundingBox(const QgsRectangle &rect, bool toPixel)
|
QgsRectangle QgsRasterChangeCoords::getBoundingBox( const QgsRectangle &rect, bool toPixel )
|
||||||
{
|
{
|
||||||
QgsRectangle rectReturn;
|
QgsRectangle rectReturn;
|
||||||
QgsPoint p1( rect.xMinimum(), rect.yMinimum() );
|
QgsPoint p1( rect.xMinimum(), rect.yMinimum() );
|
||||||
QgsPoint p2( rect.xMaximum(), rect.yMaximum() );
|
QgsPoint p2( rect.xMaximum(), rect.yMaximum() );
|
||||||
QgsPoint ( QgsRasterChangeCoords::* func )( const QgsPoint & );
|
QgsPoint( QgsRasterChangeCoords::* func )( const QgsPoint & );
|
||||||
|
|
||||||
func = toPixel ? &QgsRasterChangeCoords::toColumnLine : &QgsRasterChangeCoords::toXY;
|
func = toPixel ? &QgsRasterChangeCoords::toColumnLine : &QgsRasterChangeCoords::toXY;
|
||||||
rectReturn.set( ( this->*func ) (p1), ( this->*func )(p2) );
|
rectReturn.set(( this->*func )( p1 ), ( this->*func )( p2 ) );
|
||||||
|
|
||||||
return rectReturn;
|
return rectReturn;
|
||||||
}
|
}
|
||||||
|
|
||||||
QgsPoint QgsRasterChangeCoords::toColumnLine(const QgsPoint &pntMap)
|
QgsPoint QgsRasterChangeCoords::toColumnLine( const QgsPoint &pntMap )
|
||||||
{
|
{
|
||||||
double col = ( pntMap.x() - mUL_X ) / mResX;
|
double col = ( pntMap.x() - mUL_X ) / mResX;
|
||||||
double line = ( mUL_Y - pntMap.y() ) / mResY;
|
double line = ( mUL_Y - pntMap.y() ) / mResY;
|
||||||
return QgsPoint(col, line);
|
return QgsPoint( col, line );
|
||||||
}
|
}
|
||||||
|
|
||||||
QgsPoint QgsRasterChangeCoords::toXY(const QgsPoint &pntPixel)
|
QgsPoint QgsRasterChangeCoords::toXY( const QgsPoint &pntPixel )
|
||||||
{
|
{
|
||||||
double x = mUL_X + ( pntPixel.x() * mResX );
|
double x = mUL_X + ( pntPixel.x() * mResX );
|
||||||
double y = mUL_Y + ( pntPixel.y() * -mResY );
|
double y = mUL_Y + ( pntPixel.y() * -mResY );
|
||||||
return QgsPoint(x, y);
|
return QgsPoint( x, y );
|
||||||
}
|
}
|
||||||
|
@ -27,10 +27,10 @@ class QgsRasterChangeCoords
|
|||||||
QgsRasterChangeCoords( );
|
QgsRasterChangeCoords( );
|
||||||
void setRaster( const QString &fileRaster );
|
void setRaster( const QString &fileRaster );
|
||||||
bool hasCrs() const { return mHasCrs; }
|
bool hasCrs() const { return mHasCrs; }
|
||||||
std::vector<QgsPoint> getPixelCoords(const std::vector<QgsPoint> &mapCoords);
|
std::vector<QgsPoint> getPixelCoords( const std::vector<QgsPoint> &mapCoords );
|
||||||
QgsRectangle getBoundingBox(const QgsRectangle &rect, bool toPixel);
|
QgsRectangle getBoundingBox( const QgsRectangle &rect, bool toPixel );
|
||||||
QgsPoint toColumnLine(const QgsPoint &pntMap);
|
QgsPoint toColumnLine( const QgsPoint &pntMap );
|
||||||
QgsPoint toXY(const QgsPoint &pntPixel);
|
QgsPoint toXY( const QgsPoint &pntPixel );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool mHasCrs;
|
bool mHasCrs;
|
||||||
|
@ -1029,7 +1029,7 @@ bool QgsPostgresProvider::loadFields()
|
|||||||
QString attnum = tresult.PQgetvalue( 0, 0 );
|
QString attnum = tresult.PQgetvalue( 0, 0 );
|
||||||
formattedFieldType = tresult.PQgetvalue( 0, 1 );
|
formattedFieldType = tresult.PQgetvalue( 0, 1 );
|
||||||
|
|
||||||
if( !attnum.isEmpty() )
|
if ( !attnum.isEmpty() )
|
||||||
{
|
{
|
||||||
sql = QString( "SELECT description FROM pg_description WHERE objoid=%1 AND objsubid=%2" )
|
sql = QString( "SELECT description FROM pg_description WHERE objoid=%1 AND objsubid=%2" )
|
||||||
.arg( tableoid ).arg( attnum );
|
.arg( tableoid ).arg( attnum );
|
||||||
|
@ -83,7 +83,7 @@ class TestQgsDiagram: public QObject
|
|||||||
QString myPointsFileName = mTestDataDir + "points.shp";
|
QString myPointsFileName = mTestDataDir + "points.shp";
|
||||||
QFileInfo myPointFileInfo( myPointsFileName );
|
QFileInfo myPointFileInfo( myPointsFileName );
|
||||||
mPointsLayer = new QgsVectorLayer( myPointFileInfo.filePath(),
|
mPointsLayer = new QgsVectorLayer( myPointFileInfo.filePath(),
|
||||||
myPointFileInfo.completeBaseName(), "ogr" );
|
myPointFileInfo.completeBaseName(), "ogr" );
|
||||||
|
|
||||||
// Register the layer with the registry
|
// Register the layer with the registry
|
||||||
QgsMapLayerRegistry::instance()->addMapLayers(
|
QgsMapLayerRegistry::instance()->addMapLayers(
|
||||||
@ -159,14 +159,14 @@ class TestQgsDiagram: public QObject
|
|||||||
dls.placement = QgsDiagramLayerSettings::OverPoint;
|
dls.placement = QgsDiagramLayerSettings::OverPoint;
|
||||||
dls.renderer = dr;
|
dls.renderer = dr;
|
||||||
|
|
||||||
dynamic_cast<QgsPalLabeling*> (mMapRenderer->labelingEngine())->setShowingAllLabels( true );
|
dynamic_cast<QgsPalLabeling*>( mMapRenderer->labelingEngine() )->setShowingAllLabels( true );
|
||||||
|
|
||||||
mPointsLayer->setDiagramLayerSettings( dls );
|
mPointsLayer->setDiagramLayerSettings( dls );
|
||||||
|
|
||||||
mComposerMap->setNewExtent( QgsRectangle( -122, -79, -70, 47 ) );
|
mComposerMap->setNewExtent( QgsRectangle( -122, -79, -70, 47 ) );
|
||||||
QgsCompositionChecker checker( "Composer map render", mComposition, QString( QString( TEST_DATA_DIR )
|
QgsCompositionChecker checker( "Composer map render", mComposition, QString( QString( TEST_DATA_DIR )
|
||||||
+ QDir::separator() + "control_images" + QDir::separator() + "expected_diagram" + QDir::separator()
|
+ QDir::separator() + "control_images" + QDir::separator() + "expected_diagram" + QDir::separator()
|
||||||
+ "expected_piediagram.png" ) );
|
+ "expected_piediagram.png" ) );
|
||||||
|
|
||||||
QVERIFY( checker.testComposition() );
|
QVERIFY( checker.testComposition() );
|
||||||
|
|
||||||
|
@ -32,7 +32,7 @@ class TestProjectionIssues: public QObject
|
|||||||
void cleanupTestCase();// will be called after the last testfunction was executed.
|
void cleanupTestCase();// will be called after the last testfunction was executed.
|
||||||
void init();// will be called before each testfunction is executed.
|
void init();// will be called before each testfunction is executed.
|
||||||
void cleanup();// will be called after every testfunction.
|
void cleanup();// will be called after every testfunction.
|
||||||
void issue5895();// test for #5895
|
void issue5895();// test for #5895
|
||||||
private:
|
private:
|
||||||
QgsRasterLayer* mRasterLayer;
|
QgsRasterLayer* mRasterLayer;
|
||||||
QgsMapCanvas* mMapCanvas;
|
QgsMapCanvas* mMapCanvas;
|
||||||
@ -50,8 +50,8 @@ void TestProjectionIssues::initTestCase()
|
|||||||
// Set to WGS84
|
// Set to WGS84
|
||||||
QgsCoordinateReferenceSystem sourceCRS;
|
QgsCoordinateReferenceSystem sourceCRS;
|
||||||
sourceCRS.createFromId( 4326, QgsCoordinateReferenceSystem::EpsgCrsId );
|
sourceCRS.createFromId( 4326, QgsCoordinateReferenceSystem::EpsgCrsId );
|
||||||
mRasterLayer->setCrs( sourceCRS, false);
|
mRasterLayer->setCrs( sourceCRS, false );
|
||||||
|
|
||||||
QgsMultiBandColorRenderer* rasterRenderer = new QgsMultiBandColorRenderer( mRasterLayer->dataProvider(), 2, 3, 4 );
|
QgsMultiBandColorRenderer* rasterRenderer = new QgsMultiBandColorRenderer( mRasterLayer->dataProvider(), 2, 3, 4 );
|
||||||
mRasterLayer->setRenderer( rasterRenderer );
|
mRasterLayer->setRenderer( rasterRenderer );
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user