mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-13 00:03:09 -04:00
fix windows build
This commit is contained in:
parent
06167d4f78
commit
173ee45405
@ -36,7 +36,6 @@ if ! type -p flip >/dev/null; then
|
||||
fi
|
||||
|
||||
if ! type -p pep8 >/dev/null; then
|
||||
echo "pep8 not found" >&2
|
||||
pep8() {
|
||||
:
|
||||
}
|
||||
|
@ -151,9 +151,9 @@ class CORE_EXPORT QgsRectangle
|
||||
};
|
||||
|
||||
/** Writes the list rectangle to stream out. QGIS version compatibility is not guaranteed. */
|
||||
QDataStream& operator<<( QDataStream& out, const QgsRectangle& rectangle );
|
||||
CORE_EXPORT QDataStream& operator<<( QDataStream& out, const QgsRectangle& rectangle );
|
||||
/** Reads a rectangle from stream in into rectangle. QGIS version compatibility is not guaranteed. */
|
||||
QDataStream& operator>>( QDataStream& in, QgsRectangle& rectangle );
|
||||
CORE_EXPORT QDataStream& operator>>( QDataStream& in, QgsRectangle& rectangle );
|
||||
|
||||
inline QgsRectangle::~QgsRectangle()
|
||||
{
|
||||
|
@ -23,29 +23,29 @@
|
||||
#include "qgslogger.h"
|
||||
#include "qgsnewnamedialog.h"
|
||||
|
||||
QgsNewNameDialog::QgsNewNameDialog(const QString& source, const QString& initial,
|
||||
const QStringList& extensions, const QStringList& existing,
|
||||
const QRegExp& regexp, Qt::CaseSensitivity cs,
|
||||
QWidget *parent, Qt::WindowFlags flags )
|
||||
: QgsDialog(parent, flags, QDialogButtonBox::Ok | QDialogButtonBox::Cancel)
|
||||
, mExiting(existing)
|
||||
, mExtensions(extensions)
|
||||
, mCaseSensitivity(cs)
|
||||
, mNamesLabel(0)
|
||||
QgsNewNameDialog::QgsNewNameDialog( const QString& source, const QString& initial,
|
||||
const QStringList& extensions, const QStringList& existing,
|
||||
const QRegExp& regexp, Qt::CaseSensitivity cs,
|
||||
QWidget *parent, Qt::WindowFlags flags )
|
||||
: QgsDialog( parent, flags, QDialogButtonBox::Ok | QDialogButtonBox::Cancel )
|
||||
, mExiting( existing )
|
||||
, mExtensions( extensions )
|
||||
, mCaseSensitivity( cs )
|
||||
, mNamesLabel( 0 )
|
||||
{
|
||||
setWindowTitle( tr("New name") );
|
||||
QDialog::layout()->setSizeConstraint(QLayout::SetMinimumSize);
|
||||
layout()->setSizeConstraint(QLayout::SetMinimumSize);
|
||||
mOkString = buttonBox()->button(QDialogButtonBox::Ok)->text();
|
||||
setWindowTitle( tr( "New name" ) );
|
||||
QDialog::layout()->setSizeConstraint( QLayout::SetMinimumSize );
|
||||
layout()->setSizeConstraint( QLayout::SetMinimumSize );
|
||||
mOkString = buttonBox()->button( QDialogButtonBox::Ok )->text();
|
||||
QString hintString;
|
||||
QString nameDesc = mExtensions.isEmpty() ? tr("name") : tr("base name");
|
||||
QString nameDesc = mExtensions.isEmpty() ? tr( "name" ) : tr( "base name" );
|
||||
if ( source.isEmpty() )
|
||||
{
|
||||
hintString = tr("Enter new %1").arg(nameDesc);
|
||||
hintString = tr( "Enter new %1" ).arg( nameDesc );
|
||||
}
|
||||
else
|
||||
{
|
||||
hintString = tr("Enter new %1 for %2").arg(nameDesc).arg(source);
|
||||
hintString = tr( "Enter new %1 for %2" ).arg( nameDesc ).arg( source );
|
||||
}
|
||||
QLabel* hintLabel = new QLabel( hintString, this );
|
||||
layout()->addWidget( hintLabel );
|
||||
@ -60,22 +60,22 @@ QgsNewNameDialog::QgsNewNameDialog(const QString& source, const QString& initial
|
||||
layout()->addWidget( mLineEdit );
|
||||
|
||||
mNamesLabel = new QLabel( " ", this );
|
||||
mNamesLabel->setSizePolicy(QSizePolicy::Minimum,QSizePolicy::Minimum);
|
||||
mNamesLabel->setSizePolicy( QSizePolicy::Minimum, QSizePolicy::Minimum );
|
||||
if ( !mExtensions.isEmpty() )
|
||||
{
|
||||
mNamesLabel->setWordWrap(true);
|
||||
mNamesLabel->setWordWrap( true );
|
||||
layout()->addWidget( mNamesLabel );
|
||||
}
|
||||
|
||||
mErrorLabel = new QLabel( " ", this );
|
||||
mErrorLabel->setSizePolicy(QSizePolicy::Minimum,QSizePolicy::Minimum);
|
||||
mErrorLabel->setWordWrap(true);
|
||||
mErrorLabel->setSizePolicy( QSizePolicy::Minimum, QSizePolicy::Minimum );
|
||||
mErrorLabel->setWordWrap( true );
|
||||
layout()->addWidget( mErrorLabel );
|
||||
|
||||
nameChanged();
|
||||
}
|
||||
|
||||
QString QgsNewNameDialog::highlightText(const QString& text)
|
||||
QString QgsNewNameDialog::highlightText( const QString& text )
|
||||
{
|
||||
return "<b>" + text + "</b>";
|
||||
}
|
||||
@ -84,13 +84,13 @@ void QgsNewNameDialog::nameChanged()
|
||||
{
|
||||
QgsDebugMsg( "entered" );
|
||||
|
||||
QString namesString = tr("Full names") + ": ";
|
||||
QString namesString = tr( "Full names" ) + ": ";
|
||||
if ( !mExtensions.isEmpty() )
|
||||
{
|
||||
mNamesLabel->setText( namesString );
|
||||
}
|
||||
mErrorLabel->setText( " " ); // space to keep vertical space
|
||||
QPushButton* okButton = buttonBox()->button(QDialogButtonBox::Ok);
|
||||
QPushButton* okButton = buttonBox()->button( QDialogButtonBox::Ok );
|
||||
okButton->setText( mOkString );
|
||||
okButton->setEnabled( true );
|
||||
|
||||
@ -103,18 +103,18 @@ void QgsNewNameDialog::nameChanged()
|
||||
return;
|
||||
}
|
||||
|
||||
QStringList newNames = fullNames(newName, mExtensions);
|
||||
QStringList newNames = fullNames( newName, mExtensions );
|
||||
if ( !mExtensions.isEmpty() )
|
||||
{
|
||||
namesString += " " + newNames.join(", ");
|
||||
namesString += " " + newNames.join( ", " );
|
||||
mNamesLabel->setText( namesString );
|
||||
}
|
||||
|
||||
QStringList conflicts = matching(newNames, mExiting, mCaseSensitivity );
|
||||
QStringList conflicts = matching( newNames, mExiting, mCaseSensitivity );
|
||||
|
||||
if ( !conflicts.isEmpty() )
|
||||
{
|
||||
mErrorLabel->setText( highlightText( tr( "Name(s) %1 exists", 0, conflicts.size()).arg( conflicts.join(", ") ) ) );
|
||||
mErrorLabel->setText( highlightText( tr( "Name(s) %1 exists", 0, conflicts.size() ).arg( conflicts.join( ", " ) ) ) );
|
||||
okButton->setText( tr( "Overwrite" ) );
|
||||
return;
|
||||
}
|
||||
@ -125,10 +125,10 @@ QString QgsNewNameDialog::name() const
|
||||
return mLineEdit->text().trimmed();
|
||||
}
|
||||
|
||||
QStringList QgsNewNameDialog::fullNames(const QString& name, const QStringList& extensions)
|
||||
QStringList QgsNewNameDialog::fullNames( const QString& name, const QStringList& extensions )
|
||||
{
|
||||
QStringList list;
|
||||
foreach ( QString ext, extensions)
|
||||
foreach ( QString ext, extensions )
|
||||
{
|
||||
list << name + ext;
|
||||
|
||||
@ -140,16 +140,16 @@ QStringList QgsNewNameDialog::fullNames(const QString& name, const QStringList&
|
||||
return list;
|
||||
}
|
||||
|
||||
QStringList QgsNewNameDialog::matching(const QStringList& newNames, const QStringList& existingNames,
|
||||
Qt::CaseSensitivity cs)
|
||||
QStringList QgsNewNameDialog::matching( const QStringList& newNames, const QStringList& existingNames,
|
||||
Qt::CaseSensitivity cs )
|
||||
{
|
||||
QStringList list;
|
||||
|
||||
foreach ( QString newName, newNames)
|
||||
foreach ( QString newName, newNames )
|
||||
{
|
||||
foreach ( QString existingName, existingNames)
|
||||
foreach ( QString existingName, existingNames )
|
||||
{
|
||||
if ( existingName.compare(newName, cs) == 0 )
|
||||
if ( existingName.compare( newName, cs ) == 0 )
|
||||
{
|
||||
list << existingName;
|
||||
}
|
||||
@ -158,10 +158,10 @@ QStringList QgsNewNameDialog::matching(const QStringList& newNames, const QStrin
|
||||
return list;
|
||||
}
|
||||
|
||||
bool QgsNewNameDialog::exists(const QString& name, const QStringList& extensions,
|
||||
const QStringList& existing, Qt::CaseSensitivity cs)
|
||||
bool QgsNewNameDialog::exists( const QString& name, const QStringList& extensions,
|
||||
const QStringList& existing, Qt::CaseSensitivity cs )
|
||||
{
|
||||
QStringList newNames = fullNames(name, extensions);
|
||||
QStringList conflicts = matching(newNames, existing, cs );
|
||||
QStringList newNames = fullNames( name, extensions );
|
||||
QStringList conflicts = matching( newNames, existing, cs );
|
||||
return conflicts.size() > 0;
|
||||
}
|
||||
|
@ -57,8 +57,8 @@ class GUI_EXPORT QgsNewNameDialog : public QgsDialog
|
||||
* @param existing existing names
|
||||
* @return true if name exists
|
||||
*/
|
||||
static bool exists(const QString& name, const QStringList& extensions,
|
||||
const QStringList& existing, Qt::CaseSensitivity cs = Qt::CaseSensitive );
|
||||
static bool exists( const QString& name, const QStringList& extensions,
|
||||
const QStringList& existing, Qt::CaseSensitivity cs = Qt::CaseSensitive );
|
||||
public slots:
|
||||
void nameChanged();
|
||||
|
||||
@ -70,11 +70,11 @@ class GUI_EXPORT QgsNewNameDialog : public QgsDialog
|
||||
QLabel *mNamesLabel; // list of names with extensions
|
||||
QLabel *mErrorLabel;
|
||||
QString mOkString;
|
||||
QString highlightText(const QString& text);
|
||||
static QStringList fullNames(const QString& name, const QStringList& extensions);
|
||||
QString highlightText( const QString& text );
|
||||
static QStringList fullNames( const QString& name, const QStringList& extensions );
|
||||
// get list of existing names
|
||||
static QStringList matching(const QStringList& newNames, const QStringList& existingNames,
|
||||
Qt::CaseSensitivity cs = Qt::CaseSensitive);
|
||||
static QStringList matching( const QStringList& newNames, const QStringList& existingNames,
|
||||
Qt::CaseSensitivity cs = Qt::CaseSensitive );
|
||||
};
|
||||
|
||||
#endif // QGSNEWNAMEDIALOG_H
|
||||
|
@ -84,9 +84,9 @@ MACRO(ADD_GRASSLIB GRASS_BUILD_VERSION)
|
||||
SET_TARGET_PROPERTIES(grassprovider${GRASS_BUILD_VERSION} PROPERTIES
|
||||
COMPILE_FLAGS "-DGRASS_BASE=\\\"${GRASS_PREFIX}\\\" \"-DGRASS_EXPORT=${DLLEXPORT}\" \"-DGRASS_LIB_EXPORT=${DLLIMPORT}\""
|
||||
)
|
||||
TARGET_LINK_LIBRARIES(grassprovider${GRASS_BUILD_VERSION}
|
||||
TARGET_LINK_LIBRARIES(grassprovider${GRASS_BUILD_VERSION}
|
||||
qgisgrass${GRASS_BUILD_VERSION}
|
||||
qgis_gui
|
||||
qgis_gui
|
||||
)
|
||||
|
||||
#
|
||||
|
@ -86,9 +86,9 @@ int main( int argc, char **argv )
|
||||
name = map->answer;
|
||||
|
||||
QFile stdinFile;
|
||||
stdinFile.open(0, QIODevice::ReadOnly);
|
||||
stdinFile.open( 0, QIODevice::ReadOnly );
|
||||
|
||||
QDataStream stdinStream(&stdinFile);
|
||||
QDataStream stdinStream( &stdinFile );
|
||||
|
||||
QgsRectangle extent;
|
||||
qint32 rows, cols;
|
||||
@ -97,10 +97,10 @@ int main( int argc, char **argv )
|
||||
//G_fatal_error("i = %d", i);
|
||||
//G_fatal_error( extent.toString().toAscii().data() );
|
||||
|
||||
QString err = QgsGrass::setRegion( &window, extent, rows, cols);
|
||||
QString err = QgsGrass::setRegion( &window, extent, rows, cols );
|
||||
if ( !err.isEmpty() )
|
||||
{
|
||||
G_fatal_error("Cannot set region: %s", err.toUtf8().data());
|
||||
G_fatal_error( "Cannot set region: %s", err.toUtf8().data() );
|
||||
}
|
||||
|
||||
G_set_window( &window );
|
||||
@ -108,11 +108,12 @@ int main( int argc, char **argv )
|
||||
QGis::DataType qgis_type;
|
||||
qint32 type;
|
||||
//stdinStream >> grass_type;
|
||||
stdinStream >>type;
|
||||
qgis_type = (QGis::DataType)type;
|
||||
stdinStream >> type;
|
||||
qgis_type = ( QGis::DataType )type;
|
||||
|
||||
RASTER_MAP_TYPE grass_type;
|
||||
switch ( qgis_type ) {
|
||||
switch ( qgis_type )
|
||||
{
|
||||
case QGis::Int32:
|
||||
grass_type = CELL_TYPE;
|
||||
break;
|
||||
@ -123,55 +124,57 @@ int main( int argc, char **argv )
|
||||
grass_type = DCELL_TYPE;
|
||||
break;
|
||||
default:
|
||||
G_fatal_error("QGIS data type %d not supported", qgis_type);
|
||||
G_fatal_error( "QGIS data type %d not supported", qgis_type );
|
||||
}
|
||||
|
||||
cf = G_open_raster_new(name, grass_type);
|
||||
if (cf < 0)
|
||||
cf = G_open_raster_new( name, grass_type );
|
||||
if ( cf < 0 )
|
||||
{
|
||||
G_fatal_error( "Unable to create raster map <%s>", name);
|
||||
G_fatal_error( "Unable to create raster map <%s>", name );
|
||||
}
|
||||
|
||||
void *buf = G_allocate_raster_buf(grass_type);
|
||||
void *buf = G_allocate_raster_buf( grass_type );
|
||||
|
||||
int expectedSize = cols * QgsRasterBlock::typeSize( qgis_type );
|
||||
QByteArray byteArray;
|
||||
for ( int row = 0; row < rows; row++ ) {
|
||||
for ( int row = 0; row < rows; row++ )
|
||||
{
|
||||
stdinStream >> byteArray;
|
||||
if ( byteArray.size() != expectedSize ) {
|
||||
G_fatal_error("Wrong byte array size, expected %d bytes, got %d", expectedSize, byteArray.size());
|
||||
if ( byteArray.size() != expectedSize )
|
||||
{
|
||||
G_fatal_error( "Wrong byte array size, expected %d bytes, got %d", expectedSize, byteArray.size() );
|
||||
}
|
||||
|
||||
qint32 *cell;
|
||||
float *fcell;
|
||||
double *dcell;
|
||||
if ( grass_type == CELL_TYPE )
|
||||
cell = (qint32*) byteArray.data();
|
||||
cell = ( qint32* ) byteArray.data();
|
||||
else if ( grass_type == FCELL_TYPE )
|
||||
fcell = (float*) byteArray.data();
|
||||
fcell = ( float* ) byteArray.data();
|
||||
else if ( grass_type == DCELL_TYPE )
|
||||
dcell = (double*) byteArray.data();
|
||||
dcell = ( double* ) byteArray.data();
|
||||
|
||||
void *ptr = buf;
|
||||
for ( int col = 0; col < cols; col++ )
|
||||
{
|
||||
if ( grass_type == CELL_TYPE )
|
||||
G_set_raster_value_c(ptr, (CELL)cell[col], grass_type);
|
||||
G_set_raster_value_c( ptr, ( CELL )cell[col], grass_type );
|
||||
else if ( grass_type == FCELL_TYPE )
|
||||
G_set_raster_value_f(ptr, (FCELL)fcell[col], grass_type);
|
||||
G_set_raster_value_f( ptr, ( FCELL )fcell[col], grass_type );
|
||||
else if ( grass_type == DCELL_TYPE )
|
||||
G_set_raster_value_d(ptr, (DCELL)dcell[col], grass_type);
|
||||
G_set_raster_value_d( ptr, ( DCELL )dcell[col], grass_type );
|
||||
|
||||
ptr = G_incr_void_ptr( ptr, G_raster_size(grass_type) );
|
||||
ptr = G_incr_void_ptr( ptr, G_raster_size( grass_type ) );
|
||||
}
|
||||
G_put_raster_row(cf, buf, grass_type);
|
||||
G_put_raster_row( cf, buf, grass_type );
|
||||
}
|
||||
|
||||
G_close_cell(cf);
|
||||
G_close_cell( cf );
|
||||
struct History history;
|
||||
G_short_history(name, "raster", &history);
|
||||
G_command_history(&history);
|
||||
G_write_history(name, &history);
|
||||
G_short_history( name, "raster", &history );
|
||||
G_command_history( &history );
|
||||
G_write_history( name, &history );
|
||||
|
||||
exit( EXIT_SUCCESS );
|
||||
}
|
||||
|
@ -1155,13 +1155,13 @@ QString GRASS_LIB_EXPORT QgsGrass::regionString( const struct Cell_head *window
|
||||
|
||||
|
||||
bool GRASS_LIB_EXPORT QgsGrass::defaultRegion( const QString& gisdbase, const QString& location,
|
||||
struct Cell_head *window )
|
||||
struct Cell_head *window )
|
||||
{
|
||||
initRegion(window);
|
||||
initRegion( window );
|
||||
QgsGrass::setLocation( gisdbase, location );
|
||||
try
|
||||
{
|
||||
G_get_default_window(window);
|
||||
G_get_default_window( window );
|
||||
return true;
|
||||
}
|
||||
catch ( QgsGrass::Exception &e )
|
||||
@ -1315,11 +1315,11 @@ QString GRASS_LIB_EXPORT QgsGrass::setRegion( struct Cell_head *window, QgsRecta
|
||||
|
||||
QgsRectangle GRASS_LIB_EXPORT QgsGrass::extent( struct Cell_head *window )
|
||||
{
|
||||
if (!window)
|
||||
if ( !window )
|
||||
{
|
||||
return QgsRectangle();
|
||||
}
|
||||
return QgsRectangle( window->west, window->south, window->east, window->north);
|
||||
return QgsRectangle( window->west, window->south, window->east, window->north );
|
||||
}
|
||||
|
||||
bool GRASS_LIB_EXPORT QgsGrass::mapRegion( QgsGrassObject::Type type, QString gisdbase,
|
||||
|
@ -240,7 +240,7 @@ class QgsGrass
|
||||
|
||||
// ! Read location default region (DEFAULT_WIND)
|
||||
static GRASS_LIB_EXPORT bool defaultRegion( const QString& gisdbase, const QString& location,
|
||||
struct Cell_head *window );
|
||||
struct Cell_head *window );
|
||||
|
||||
// ! Read current mapset region
|
||||
static GRASS_LIB_EXPORT bool region( const QString& gisdbase, const QString& location, const QString& mapset,
|
||||
@ -363,7 +363,7 @@ class QgsGrass
|
||||
#endif
|
||||
|
||||
// path to QGIS GRASS modules like qgis.g.info etc.
|
||||
static QString qgisGrassModulePath() { return QgsApplication::libexecPath() + "grass/modules"; }
|
||||
static GRASS_LIB_EXPORT QString qgisGrassModulePath() { return QgsApplication::libexecPath() + "grass/modules"; }
|
||||
|
||||
private:
|
||||
static int initialized; // Set to 1 after initialization
|
||||
|
@ -25,7 +25,7 @@
|
||||
|
||||
#include "qgsgrass.h"
|
||||
|
||||
class QgsGrassImport : public QObject
|
||||
class GRASS_LIB_EXPORT QgsGrassImport : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
@ -47,14 +47,14 @@ class QgsGrassImport : public QObject
|
||||
QString mError;
|
||||
};
|
||||
|
||||
class QgsGrassRasterImport : public QgsGrassImport
|
||||
class GRASS_LIB_EXPORT QgsGrassRasterImport : public QgsGrassImport
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
// takes pipe ownership
|
||||
//QgsGrassRasterImport( QgsRasterDataProvider* provider, const QgsGrassObject& grassObject );
|
||||
QgsGrassRasterImport( QgsRasterPipe* pipe, const QgsGrassObject& grassObject,
|
||||
const QgsRectangle &extent, int xSize, int ySize);
|
||||
const QgsRectangle &extent, int xSize, int ySize );
|
||||
~QgsGrassRasterImport();
|
||||
bool import();
|
||||
void importInThread();
|
||||
|
@ -99,7 +99,7 @@ void TestQgsGrassProvider::initTestCase()
|
||||
// in version different form which we are testing here and it would also load GRASS libs in different version
|
||||
// and result in segfault when __do_global_dtors_aux() is called.
|
||||
// => we must set QGIS_PROVIDER_FILE before QgsApplication::initQgis() to avoid loading GRASS provider in different version
|
||||
setenv( "QGIS_PROVIDER_FILE", "gdal|ogr", 1 );
|
||||
QgsGrass::putEnv( "QGIS_PROVIDER_FILE", "gdal|ogr" );
|
||||
QgsApplication::initQgis();
|
||||
QString mySettings = QgsApplication::showSettings();
|
||||
mySettings = mySettings.replace( "\n", "<br />\n" );
|
||||
|
Loading…
x
Reference in New Issue
Block a user