mirror of
https://github.com/qgis/QGIS.git
synced 2025-02-27 00:33:48 -05:00
Remove unused files
This commit is contained in:
parent
730d10a153
commit
0ecba446c5
@ -1,164 +0,0 @@
|
||||
/***************************************************************************
|
||||
qgsopenrasterdialog.cpp
|
||||
--------------------------------------
|
||||
Date : 14-Feb-2010
|
||||
Copyright : (C) 2010 by Jack R, Maxim Dubinin (GIS-Lab)
|
||||
Email : sim@gis-lab.info
|
||||
***************************************************************************
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
#include <QFileDialog>
|
||||
#include <QMessageBox>
|
||||
#include <QPushButton>
|
||||
|
||||
#include "qgssettings.h"
|
||||
#include "qgsrasterlayer.h"
|
||||
#include "qgsproject.h"
|
||||
|
||||
#include "qgsopenrasterdialog.h"
|
||||
|
||||
QgsOpenRasterDialog::QgsOpenRasterDialog( QWidget *parent ) :
|
||||
QDialog( parent )
|
||||
{
|
||||
setupUi( this );
|
||||
|
||||
QPushButton *okPushButton = buttonBox->button( QDialogButtonBox::Ok );
|
||||
okPushButton->setEnabled( false );
|
||||
}
|
||||
|
||||
// ------------------------------- public ---------------------------------- //
|
||||
void QgsOpenRasterDialog::getRasterOptions( QString &rasterFileName, QString &modifiedFileName, QString &worldFileName )
|
||||
{
|
||||
rasterFileName = leRasterFileName->text();
|
||||
modifiedFileName = leModifiedRasterFileName->text();
|
||||
worldFileName = mWorldFileName;
|
||||
}
|
||||
|
||||
// ------------------------------ protected -------------------------------- //
|
||||
void QgsOpenRasterDialog::changeEvent( QEvent *e )
|
||||
{
|
||||
QDialog::changeEvent( e );
|
||||
switch ( e->type() )
|
||||
{
|
||||
case QEvent::LanguageChange:
|
||||
retranslateUi( this );
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// --------------------------- private slots ------------------------------- //
|
||||
void QgsOpenRasterDialog::on_tbnSelectRaster_clicked()
|
||||
{
|
||||
QgsSettings settings;
|
||||
QString dir = settings.value( "/Plugin-GeoReferencer/rasterdirectory" ).toString();
|
||||
if ( dir.isEmpty() )
|
||||
dir = ".";
|
||||
|
||||
QString lastUsedFilter = settings.value( "/Plugin-GeoReferencer/lastusedfilter" ).toString();
|
||||
|
||||
QString filters = QgsProviderRegistry::instance()->fileRasterFilters();
|
||||
filters.prepend( "(*.*);;" );
|
||||
QString rasterFileName = QFileDialog::getOpenFileName( this, tr( "Choose a name of the raster" ), dir,
|
||||
filters, &lastUsedFilter );
|
||||
|
||||
if ( rasterFileName.isEmpty() )
|
||||
{
|
||||
return;
|
||||
}
|
||||
leRasterFileName->setText( rasterFileName );
|
||||
|
||||
// do we think that this is a valid raster?
|
||||
if ( !QgsRasterLayer::isValidRasterFileName( rasterFileName ) )
|
||||
{
|
||||
QMessageBox::critical( this, tr( "Error" ),
|
||||
tr( "The selected file is not a valid raster file." ) );
|
||||
return;
|
||||
}
|
||||
|
||||
QFileInfo fileInfo( rasterFileName );
|
||||
settings.setValue( "/Plugin-GeoReferencer/rasterdirectory", fileInfo.path() );
|
||||
settings.setValue( "/Plugin-GeoReferencer/lastusedfilter", lastUsedFilter );
|
||||
|
||||
QString modifiedFileName = generateModifiedRasterFileName();
|
||||
leModifiedRasterFileName->setText( modifiedFileName );
|
||||
|
||||
// What DOING this code?
|
||||
QgsProject *prj = QgsProject::instance();
|
||||
QString projBehavior = settings.value( "/Projections/defaultBehavior", "prompt" ).toString();
|
||||
QString projectCRS = prj->readEntry( "SpatialRefSys", "/ProjectCRSProj4String" );
|
||||
int projectCrsId = prj->readNumEntry( "SpatialRefSys", "/ProjectCrsId" );
|
||||
|
||||
settings.setValue( "/Projections/defaultBehavior", "useProject" );
|
||||
prj->writeEntry( "SpatialRefSys", "/ProjectCRSProj4String", GEOPROJ4 );
|
||||
prj->writeEntry( "SpatialRefSys", "/ProjectCrsId", int( GEOCRS_ID ) );
|
||||
|
||||
settings.setValue( "/Projections/defaultBehavior", projBehavior );
|
||||
prj->writeEntry( "SpatialRefSys", "/ProjectCRSProj4String", projectCRS );
|
||||
prj->writeEntry( "SpatialRefSys", "/ProjectCrsId", projectCrsId );
|
||||
}
|
||||
|
||||
void QgsOpenRasterDialog::on_tbnSelectModifiedRaster_clicked()
|
||||
{
|
||||
QgsSettings settings;
|
||||
QString dir = settings.value( "/Plugin-GeoReferencer/rasterdirectory" ).toString();
|
||||
if ( dir.isEmpty() )
|
||||
dir = ".";
|
||||
|
||||
QString modifiedFileName = QFileDialog::getSaveFileName( this, tr( "Choose a name for the modified raster" ), dir );
|
||||
if ( modifiedFileName.right( 4 ) != ".tif" )
|
||||
modifiedFileName += ".tif";
|
||||
|
||||
// do we think that this is a valid raster?
|
||||
if ( !QgsRasterLayer::isValidRasterFileName( modifiedFileName ) )
|
||||
{
|
||||
QMessageBox::critical( this, tr( "Error" ),
|
||||
tr( "The selected file is not a valid raster file." ) );
|
||||
return;
|
||||
}
|
||||
|
||||
QFileInfo fileInfo( modifiedFileName );
|
||||
settings.setValue( "/Plugin-GeoReferencer/rasterdirectory", fileInfo.path() );
|
||||
|
||||
leModifiedRasterFileName->setText( modifiedFileName );
|
||||
}
|
||||
|
||||
void QgsOpenRasterDialog::on_leModifiedRasterFileName_textChanged( const QString name )
|
||||
{
|
||||
mWorldFileName = guessWorldFileName( name );
|
||||
|
||||
bool enable = ( leModifiedRasterFileName->text().size() != 0 && leRasterFileName->text().size() != 0 );
|
||||
QPushButton *okPushButton = buttonBox->button( QDialogButtonBox::Ok );
|
||||
okPushButton->setEnabled( enable );
|
||||
}
|
||||
|
||||
// ------------------------------ private ---------------------------------- //
|
||||
QString QgsOpenRasterDialog::generateModifiedRasterFileName()
|
||||
{
|
||||
QString modifiedFileName = leRasterFileName->text();
|
||||
QFileInfo modifiedFileInfo( modifiedFileName );
|
||||
int pos = modifiedFileName.size() - modifiedFileInfo.suffix().size() - 1;
|
||||
modifiedFileName.insert( pos, tr( "-modified", "Georeferencer:QgsOpenRasterDialog.cpp - used to modify a user given file name" ) );
|
||||
|
||||
pos = modifiedFileName.size() - modifiedFileInfo.suffix().size();
|
||||
modifiedFileName.replace( pos, modifiedFileName.size(), "tif" );
|
||||
|
||||
return modifiedFileName;
|
||||
}
|
||||
|
||||
QString QgsOpenRasterDialog::guessWorldFileName( const QString rasterFileName )
|
||||
{
|
||||
QString worldFileName = "";
|
||||
int point = rasterFileName.lastIndexOf( '.' );
|
||||
if ( point != -1 && point != rasterFileName.length() - 1 )
|
||||
worldFileName = rasterFileName.left( point + 1 ) + "wld";
|
||||
|
||||
return worldFileName;
|
||||
}
|
@ -1,44 +0,0 @@
|
||||
/***************************************************************************
|
||||
qgsopenrasterdialog.h
|
||||
--------------------------------------
|
||||
Date : 14-Feb-2010
|
||||
Copyright : (C) 2010 by Jack R, Maxim Dubinin (GIS-Lab)
|
||||
Email : sim@gis-lab.info
|
||||
***************************************************************************
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef QGSOPENRASTERDIALOG_H
|
||||
#define QGSOPENRASTERDIALOG_H
|
||||
|
||||
#include "ui_qgsopenrasterdialogbase.h"
|
||||
|
||||
class QgsOpenRasterDialog : public QDialog, private Ui::QgsOpenRasterDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit QgsOpenRasterDialog( QWidget *parent = 0 );
|
||||
void getRasterOptions( QString &rasterFileName, QString &modifiedFileName, QString &worldFileName );
|
||||
|
||||
protected:
|
||||
void changeEvent( QEvent *e );
|
||||
|
||||
private slots:
|
||||
void on_tbnSelectRaster_clicked();
|
||||
void on_tbnSelectModifiedRaster_clicked();
|
||||
|
||||
void on_leModifiedRasterFileName_textChanged( const QString name );
|
||||
|
||||
private:
|
||||
QString generateModifiedRasterFileName();
|
||||
QString guessWorldFileName( const QString rasterFileName );
|
||||
|
||||
QString mWorldFileName;
|
||||
};
|
||||
|
||||
#endif // QGSOPENRASTERDIALOG_H
|
@ -1,142 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>QgsOpenRasterDialog</class>
|
||||
<widget class="QDialog" name="QgsOpenRasterDialog">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>292</width>
|
||||
<height>102</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Open raster</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<layout class="QFormLayout" name="formLayout">
|
||||
<property name="fieldGrowthPolicy">
|
||||
<enum>QFormLayout::ExpandingFieldsGrow</enum>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="textLabel1_2">
|
||||
<property name="text">
|
||||
<string>Raster file</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QLineEdit" name="leRasterFileName">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="tbnSelectRaster">
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset>
|
||||
<normalon>:/icons/mPushButtonFileOpen.png</normalon>
|
||||
</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>18</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="lblSelectModifiedRaster">
|
||||
<property name="text">
|
||||
<string>Save raster as</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<widget class="QLineEdit" name="leModifiedRasterFileName"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="tbnSelectModifiedRaster">
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset>
|
||||
<normalon>:/icons/mPushButtonFileOpen.png</normalon>
|
||||
</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>18</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>accepted()</signal>
|
||||
<receiver>QgsOpenRasterDialog</receiver>
|
||||
<slot>accept()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>252</x>
|
||||
<y>161</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>157</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>rejected()</signal>
|
||||
<receiver>QgsOpenRasterDialog</receiver>
|
||||
<slot>reject()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>289</x>
|
||||
<y>161</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>286</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
</ui>
|
Loading…
x
Reference in New Issue
Block a user