2 changes: 1 addition & 1 deletion python/plugins/sextante/saga/SplitRGBBands.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def processAlgorithm(self, progress):
validChars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
safeBasename = ''.join(c for c in basename if c in validChars)
temp = os.path.join(os.path.dirname(temp), safeBasename)

r = self.getOutputValue(SplitRGBBands.R)
g = self.getOutputValue(SplitRGBBands.G)
b = self.getOutputValue(SplitRGBBands.B)
Expand Down
93 changes: 46 additions & 47 deletions python/plugins/sextante/tests/AlgTests.py

Large diffs are not rendered by default.

14 changes: 7 additions & 7 deletions python/plugins/sextante/tests/GeoAlgorithmTest.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,20 @@
from sextante.modeler.ModelerAlgorithm import ModelerAlgorithm

def testAlg(algname, *args):

#test simple execution
alg = Sextante.runAlgorithm(algname, None, *args)
assert alg is not None

out = alg.getOutputValuesAsDictionary()

return out

#test execution in a model

#===========================================================================
# model = ModelerAlgorithm()
# model.addAlgorithm(alg, parametersMap, valuesMap, outputsMap, dependencies)
#===========================================================================
#test

#test
24 changes: 12 additions & 12 deletions python/plugins/sextante/tests/ModelerAlgorithmTest.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,17 @@
from osgeo.gdalconst import GA_ReadOnly

class ModelerAlgorithmTest(unittest.TestCase):

def testCreateModel(self):
pass

def testRemoveParameter(self):
pass

def testRemoveAlgorithm(self):
pass


def test_modelersagagrass(self):
outputs=sextante.runalg("modeler:sagagrass",points(),None)
output=outputs['CENTROIDS_ALG1']
Expand All @@ -39,32 +39,32 @@ def test_modelersagagrass(self):
self.assertEqual(expectedvalues, values)
wkt='POINT(270839.65586926 4458983.16267036)'
self.assertEqual(wkt, str(feature.geometry().exportToWkt()))

def test_modelersimplemodel(self):
outputs=sextante.runalg("modeler:simplemodel",raster(),None)
output=outputs['SLOPE_ALG0']
self.assertTrue(os.path.isfile(output))
dataset=gdal.Open(output, GA_ReadOnly)
strhash=hash(str(dataset.ReadAsArray(0).tolist()))
self.assertEqual(strhash,1891122097)

def test_modelerfieldautoextent(self):
outputs=sextante.runalg("modeler:fieldautoextent",polygons(),"POLY_NUM_A",None)
output=outputs['USER_GRID_ALG0']
self.assertTrue(os.path.isfile(output))
dataset=gdal.Open(output, GA_ReadOnly)
strhash=hash(str(dataset.ReadAsArray(0).tolist()))
self.assertEqual(strhash,2026100494)



def suite():
suite = unittest.makeSuite(ModelerAlgorithmTest, 'test')
suite = unittest.makeSuite(ModelerAlgorithmTest, 'test')
return suite

def runtests():
result = unittest.TestResult()
result = unittest.TestResult()
testsuite = suite()
testsuite.run(result)
return result

40 changes: 20 additions & 20 deletions python/plugins/sextante/tests/ParametersTest.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,45 +14,45 @@ def testParameterNumber(self):
assert param.setValue(5)
assert param.value == 5
assert param.setValue(None)
assert param.value == param.default
assert param.value == param.default
s = param.serialize()
param2 = ParameterNumber()
param2.deserialize(s)
param2.deserialize(s)
assert param.default == param2.default
assert param.max == param2.max
assert param.min == param2.min
assert param.description == param2.description
assert param.name == param2.name
assert param.name == param2.name

def testParameterCRS(self):
param = ParameterCrs("name", "desc")
assert param.setValue("EPSG:12003")
param = ParameterCrs("name", "desc")
assert param.setValue("EPSG:12003")
assert param.value == "EPSG:12003"
assert param.setValue(None)
assert param.value == param.default
assert param.value == param.default
s = param.serialize()
param2 = ParameterCrs()
param2.deserialize(s)
assert param.default == param2.default
param2.deserialize(s)
assert param.default == param2.default
assert param.description == param2.description
assert param.name == param2.name
assert param.name == param2.name

def testParameterExtent(self):
param = ParameterExtent("name", "desc")
param = ParameterExtent("name", "desc")
assert not param.setValue("0,2,0")
assert not param.setValue("0,2,0,a")
assert not param.setValue("0,2,2,4")
assert not param.setValue("0,2,2,4")
assert param.value == "0,2,2,4"
assert param.setValue(None)
assert param.value == param.default
assert param.value == param.default
s = param.serialize()
param2 = ParameterExtent()
param2.deserialize(s)
assert param.default == param2.default
param2.deserialize(s)
assert param.default == param2.default
assert param.description == param2.description
assert param.name == param2.name
assert param.name == param2.name



if __name__ == '__main__':
unittest.main()
11 changes: 5 additions & 6 deletions python/plugins/sextante/tools/help.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
from sextante.core.SextanteUtils import mkdir
from sextante.parameters.ParameterSelection import ParameterSelection

def createBaseHelpFile(alg, folder):
def createBaseHelpFile(alg, folder):
folder = os.path.join(folder, alg.provider.getName().lower())
mkdir(folder)
cmdLineName = alg.commandLineName()[alg.commandLineName().find(":") + 1:].lower()
validChars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
safeFilename = ''.join(c for c in cmdLineName if c in validChars)
safeFilename = ''.join(c for c in cmdLineName if c in validChars)
filepath = os.path.join(folder, safeFilename + ".rst")
file = open(filepath, "w")
file.write(alg.name.upper())
Expand All @@ -24,9 +24,9 @@ def createBaseHelpFile(alg, folder):
file.write("\nOutputs\n")
file.write("-------\n\n")
for out in alg.outputs:
file.write("- ``" + out.description + "[" + out.outputTypeName()[6:] + "]``:\n")
file.write("- ``" + out.description + "[" + out.outputTypeName()[6:] + "]``:\n")
file.write("\nSee also\n")
file.write("---------\n\n")
file.write("---------\n\n")
file.write("\nConsole usage\n")
file.write("-------------\n\n")
file.write("\n::\n\n")
Expand All @@ -38,7 +38,7 @@ def createBaseHelpFile(alg, folder):
s+=str(out.name.lower().strip()) + ", "
s = s[:-2] +")\n"
file.write(s)

s =""
hasSelection = False
for param in alg.parameters:
Expand All @@ -59,4 +59,3 @@ def createBaseHelpFiles(folder):
for provider in Sextante.providers:
for alg in provider.algs:
createBaseHelpFile(alg, folder)

10 changes: 5 additions & 5 deletions src/app/composer/qgscomposer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -774,12 +774,12 @@ void QgsComposer::on_mActionExportAsPDF_triggered()
}
if ( !atlasOnASingleFile )
{
// bugs #7263 and #6856
// QPrinter does not seem to be reset correctly and may cause generated PDFs (all except the first) corrupted
// when transparent objects are rendered. We thus use a new QPrinter object here
QPrinter multiFilePrinter;
// bugs #7263 and #6856
// QPrinter does not seem to be reset correctly and may cause generated PDFs (all except the first) corrupted
// when transparent objects are rendered. We thus use a new QPrinter object here
QPrinter multiFilePrinter;
outputFileName = QDir( outputDir ).filePath( atlasMap->currentFilename() ) + ".pdf";
mComposition->beginPrintAsPDF( multiFilePrinter, outputFileName );
mComposition->beginPrintAsPDF( multiFilePrinter, outputFileName );
// set the correct resolution
mComposition->beginPrint( multiFilePrinter );
painter.begin( &multiFilePrinter );
Expand Down
2 changes: 1 addition & 1 deletion src/app/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -551,7 +551,7 @@ int main( int argc, char *argv[] )
if ( !customizationfile.isEmpty() )
{
customizationsettings = new QSettings( customizationfile, QSettings::IniFormat );
QgsCustomization::instance()->setEnabled(true);
QgsCustomization::instance()->setEnabled( true );
}

// Load and set possible default customization, must be done afterQgsApplication init and QSettings ( QCoreApplication ) init
Expand Down
4 changes: 2 additions & 2 deletions src/app/qgisappinterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -535,8 +535,8 @@ bool QgisAppInterface::openFeatureForm( QgsVectorLayer *vlayer, QgsFeature &f, b

QDialog* QgisAppInterface::getFeatureForm( QgsVectorLayer *l, QgsFeature &f )
{
QgsAttributeDialog *dialog = new QgsAttributeDialog( l, &f, false );
return dialog->dialog();
QgsAttributeDialog *dialog = new QgsAttributeDialog( l, &f, false );
return dialog->dialog();
}

QList<QgsMapLayer *> QgisAppInterface::editableLayers( bool modified ) const
Expand Down
2 changes: 1 addition & 1 deletion src/app/qgisappinterface.h
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,7 @@ class QgisAppInterface : public QgisInterface
// @added in 1.6
virtual bool openFeatureForm( QgsVectorLayer *l, QgsFeature &f, bool updateFeatureOnly = false );

virtual QDialog* getFeatureForm(QgsVectorLayer *l, QgsFeature &f);
virtual QDialog* getFeatureForm( QgsVectorLayer *l, QgsFeature &f );

/** Return vector layers in edit mode
* @param modified whether to return only layers that have been modified
Expand Down
18 changes: 9 additions & 9 deletions src/app/qgscustomization.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -909,15 +909,15 @@ void QgsCustomization::preNotify( QObject * receiver, QEvent * event, bool * don

QString QgsCustomization::splashPath()
{
if ( isEnabled() )
{
QString path = mSettings->value( "/Customization/splashpath", QgsApplication::splashPath() ).toString();
return path;
}
else
{
return QgsApplication::splashPath();
}
if ( isEnabled() )
{
QString path = mSettings->value( "/Customization/splashpath", QgsApplication::splashPath() ).toString();
return path;
}
else
{
return QgsApplication::splashPath();
}
}

void QgsCustomization::loadDefault()
Expand Down
2 changes: 1 addition & 1 deletion src/app/qgsdiagramproperties.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ QgsDiagramProperties::QgsDiagramProperties( QgsVectorLayer* layer, QWidget* pare
setupUi( this );


mBackgroundColorButton->setColorDialogTitle( tr( "Background color" ) );
mBackgroundColorButton->setColorDialogTitle( tr( "Background color" ) );
mBackgroundColorButton->setColorDialogOptions( QColorDialog::ShowAlphaChannel );
mDiagramPenColorButton->setColorDialogTitle( tr( "Pen color" ) );
mDiagramPenColorButton->setColorDialogOptions( QColorDialog::ShowAlphaChannel );
Expand Down
2 changes: 1 addition & 1 deletion src/app/qgspluginregistry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ void QgsPluginRegistry::loadPythonPlugin( QString packageName )
// if plugin is not compatible, disable it
if ( ! isPythonPluginCompatible( packageName ) )
{
QgsMessageLog::logMessage( QObject::tr("Plugin \"%1\" is not compatible with this version of Quantum GIS.\nIt will be disabled.").arg( packageName ),
QgsMessageLog::logMessage( QObject::tr( "Plugin \"%1\" is not compatible with this version of Quantum GIS.\nIt will be disabled." ).arg( packageName ),
QObject::tr( "Plugins" ) );
settings.setValue( "/PythonPlugins/" + packageName, false );
return;
Expand Down
200 changes: 102 additions & 98 deletions src/app/qtmain_android.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,128 +43,132 @@ static QSemaphore m_quitAppSemaphore;
static QList<QByteArray> m_applicationParams;
static const char * const QtNativeClassPathName = "org/kde/necessitas/industrius/QtNative";

extern "C" int main(int, char **); //use the standard main method to start the application
static void * startMainMethod(void * /*data*/)
extern "C" int main( int, char ** ); //use the standard main method to start the application
static void * startMainMethod( void * /*data*/ )
{

char ** params;
params=(char**)malloc(sizeof(char*)*m_applicationParams.length());
for (int i=0;i<m_applicationParams.size();i++)
params[i]= (char*)m_applicationParams[i].constData();

int ret = main(m_applicationParams.length(), params);

qDebug()<<"MainMethod finished, it's time to cleanup";
free(params);
Q_UNUSED(ret);

JNIEnv* env;
if (m_javaVM->AttachCurrentThread(&env, NULL)<0)
{
qCritical()<<"AttachCurrentThread failed";
return false;
}
jclass applicationClass = env->GetObjectClass(objptr);
if (applicationClass){
jmethodID quitApp = env->GetStaticMethodID(applicationClass, "quitApp", "()V");
env->CallStaticVoidMethod(applicationClass, quitApp);
}
m_javaVM->DetachCurrentThread();
return NULL;
char ** params;
params = ( char** )malloc( sizeof( char* ) * m_applicationParams.length() );
for ( int i = 0;i < m_applicationParams.size();i++ )
params[i] = ( char* )m_applicationParams[i].constData();

int ret = main( m_applicationParams.length(), params );

qDebug() << "MainMethod finished, it's time to cleanup";
free( params );
Q_UNUSED( ret );

JNIEnv* env;
if ( m_javaVM->AttachCurrentThread( &env, NULL ) < 0 )
{
qCritical() << "AttachCurrentThread failed";
return false;
}
jclass applicationClass = env->GetObjectClass( objptr );
if ( applicationClass )
{
jmethodID quitApp = env->GetStaticMethodID( applicationClass, "quitApp", "()V" );
env->CallStaticVoidMethod( applicationClass, quitApp );
}
m_javaVM->DetachCurrentThread();
return NULL;
}

static jboolean startQtApp(JNIEnv* env, jobject /*object*/, jstring paramsString, jstring environmentString)
static jboolean startQtApp( JNIEnv* env, jobject /*object*/, jstring paramsString, jstring environmentString )
{
qDebug()<<"startQtApp";
const char * nativeString = env->GetStringUTFChars(environmentString, 0);
QByteArray string=nativeString;
env->ReleaseStringUTFChars(environmentString, nativeString);
m_applicationParams=string.split('\t');
qDebug()<<"environmentString"<<string<<m_applicationParams;
foreach (string, m_applicationParams)
if (putenv(string.constData()))
qWarning()<<"Can't set environment"<<string;

nativeString = env->GetStringUTFChars(paramsString, 0);
string=nativeString;
env->ReleaseStringUTFChars(paramsString, nativeString);

qDebug()<<"paramsString"<<string;
m_applicationParams=string.split('\t');

// Go home
QDir::setCurrent(QDir::homePath());

pthread_t appThread;
return pthread_create(&appThread, NULL, startMainMethod, NULL)==0;
qDebug() << "startQtApp";
const char * nativeString = env->GetStringUTFChars( environmentString, 0 );
QByteArray string = nativeString;
env->ReleaseStringUTFChars( environmentString, nativeString );
m_applicationParams = string.split( '\t' );
qDebug() << "environmentString" << string << m_applicationParams;
foreach ( string, m_applicationParams )
if ( putenv( string.constData() ) )
qWarning() << "Can't set environment" << string;

nativeString = env->GetStringUTFChars( paramsString, 0 );
string = nativeString;
env->ReleaseStringUTFChars( paramsString, nativeString );

qDebug() << "paramsString" << string;
m_applicationParams = string.split( '\t' );

// Go home
QDir::setCurrent( QDir::homePath() );

pthread_t appThread;
return pthread_create( &appThread, NULL, startMainMethod, NULL ) == 0;
}


static JNINativeMethod methods[] = {
{"startQtApp", "(Ljava/lang/String;Ljava/lang/String;)V", (void *)startQtApp}
static JNINativeMethod methods[] =
{
{"startQtApp", "(Ljava/lang/String;Ljava/lang/String;)V", ( void * )startQtApp}
};

/*
* Register several native methods for one class.
*/
static int registerNativeMethods(JNIEnv* env, const char* className,
JNINativeMethod* gMethods, int numMethods)
static int registerNativeMethods( JNIEnv* env, const char* className,
JNINativeMethod* gMethods, int numMethods )
{
jclass clazz=env->FindClass(className);
if (clazz == NULL)
{
__android_log_print(ANDROID_LOG_FATAL,"Qt", "Native registration unable to find class '%s'", className);
return JNI_FALSE;
}
jmethodID constr = env->GetMethodID(clazz, "<init>", "()V");
if(!constr) {
__android_log_print(ANDROID_LOG_FATAL,"Qt", "Native registration unable to find constructor for class '%s'", className);
return JNI_FALSE;;
}
jobject obj = env->NewObject(clazz, constr);
objptr = env->NewGlobalRef(obj);
if (env->RegisterNatives(clazz, gMethods, numMethods) < 0)
{
__android_log_print(ANDROID_LOG_FATAL,"Qt", "RegisterNatives failed for '%s'", className);
return JNI_FALSE;
}
return JNI_TRUE;
jclass clazz = env->FindClass( className );
if ( clazz == NULL )
{
__android_log_print( ANDROID_LOG_FATAL, "Qt", "Native registration unable to find class '%s'", className );
return JNI_FALSE;
}
jmethodID constr = env->GetMethodID( clazz, "<init>", "()V" );
if ( !constr )
{
__android_log_print( ANDROID_LOG_FATAL, "Qt", "Native registration unable to find constructor for class '%s'", className );
return JNI_FALSE;;
}
jobject obj = env->NewObject( clazz, constr );
objptr = env->NewGlobalRef( obj );
if ( env->RegisterNatives( clazz, gMethods, numMethods ) < 0 )
{
__android_log_print( ANDROID_LOG_FATAL, "Qt", "RegisterNatives failed for '%s'", className );
return JNI_FALSE;
}
return JNI_TRUE;
}

/*
* Register native methods for all classes we know about.
*/
static int registerNatives(JNIEnv* env)
static int registerNatives( JNIEnv* env )
{
if (!registerNativeMethods(env, QtNativeClassPathName, methods, sizeof(methods) / sizeof(methods[0])))
return JNI_FALSE;
if ( !registerNativeMethods( env, QtNativeClassPathName, methods, sizeof( methods ) / sizeof( methods[0] ) ) )
return JNI_FALSE;

return JNI_TRUE;
return JNI_TRUE;
}

typedef union {
JNIEnv* nativeEnvironment;
void* venv;
typedef union
{
JNIEnv* nativeEnvironment;
void* venv;
} UnionJNIEnvToVoid;

Q_DECL_EXPORT jint JNICALL JNI_OnLoad(JavaVM* vm, void* /*reserved*/)
Q_DECL_EXPORT jint JNICALL JNI_OnLoad( JavaVM* vm, void* /*reserved*/ )
{
__android_log_print(ANDROID_LOG_INFO,"Qt", "qt start");
UnionJNIEnvToVoid uenv;
uenv.venv = NULL;
m_javaVM = 0;

if (vm->GetEnv(&uenv.venv, JNI_VERSION_1_4) != JNI_OK)
{
__android_log_print(ANDROID_LOG_FATAL,"Qt","GetEnv failed");
return -1;
}
m_env = uenv.nativeEnvironment;
if (!registerNatives(m_env))
{
__android_log_print(ANDROID_LOG_FATAL, "Qt", "registerNatives failed");
return -1;
}
m_javaVM = vm;
return JNI_VERSION_1_4;
__android_log_print( ANDROID_LOG_INFO, "Qt", "qt start" );
UnionJNIEnvToVoid uenv;
uenv.venv = NULL;
m_javaVM = 0;

if ( vm->GetEnv( &uenv.venv, JNI_VERSION_1_4 ) != JNI_OK )
{
__android_log_print( ANDROID_LOG_FATAL, "Qt", "GetEnv failed" );
return -1;
}
m_env = uenv.nativeEnvironment;
if ( !registerNatives( m_env ) )
{
__android_log_print( ANDROID_LOG_FATAL, "Qt", "registerNatives failed" );
return -1;
}
m_javaVM = vm;
return JNI_VERSION_1_4;
}
4 changes: 2 additions & 2 deletions src/core/composer/qgscomposeritem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ bool QgsComposerItem::_readXML( const QDomElement& itemElem, const QDomDocument&

//id
QString id = itemElem.attribute( "id", "" );
setId(id);
setId( id );

//frame
QString frame = itemElem.attribute( "frame" );
Expand Down Expand Up @@ -1268,7 +1268,7 @@ void QgsComposerItem::repaint()
}

void QgsComposerItem::setId( const QString& id )
{
{
setToolTip( id );
mId = id;
}
6 changes: 3 additions & 3 deletions src/core/qgsfeaturerequest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ QgsFeatureRequest::QgsFeatureRequest()
}

QgsFeatureRequest::QgsFeatureRequest( QgsFeatureId fid )
: mFilter( FilterFid )
, mFilterFid( fid )
, mFlags( 0 )
: mFilter( FilterFid )
, mFilterFid( fid )
, mFlags( 0 )
{
}

Expand Down
4 changes: 2 additions & 2 deletions src/core/qgsmaplayer.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class CORE_EXPORT QgsMapLayer : public QObject
RasterLayer,
PluginLayer // added in 1.5
};

/** Blending modes enum defining the available composition modes that can
* be used when rendering a layer
*/
Expand Down Expand Up @@ -492,7 +492,7 @@ class CORE_EXPORT QgsMapLayer : public QObject

/** Type of the layer (eg. vector, raster) */
QgsMapLayer::LayerType mLayerType;

/** Blend mode for the layer */
QgsMapLayer::BlendMode mBlendMode;

Expand Down
49 changes: 32 additions & 17 deletions src/core/qgsogcutils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,9 @@ QgsGeometry* QgsOgcUtils::geometryFromGMLPoint( const QDomElement& geometryEleme
{
return 0;
}
} else {
}
else
{
QDomNodeList posList = geometryElement.elementsByTagNameNS( GML_NAMESPACE, "pos" );
if ( posList.size() < 1 )
{
Expand Down Expand Up @@ -150,7 +152,9 @@ QgsGeometry* QgsOgcUtils::geometryFromGMLLineString( const QDomElement& geometry
{
return 0;
}
} else {
}
else
{
QDomNodeList posList = geometryElement.elementsByTagNameNS( GML_NAMESPACE, "posList" );
if ( posList.size() < 1 )
{
Expand Down Expand Up @@ -235,7 +239,9 @@ QgsGeometry* QgsOgcUtils::geometryFromGMLPolygon( const QDomElement& geometryEle
}
ringCoordinates.push_back( interiorPointList );
}
} else {
}
else
{
//read coordinates for exterior
QDomNodeList exteriorList = geometryElement.elementsByTagNameNS( GML_NAMESPACE, "exterior" );
if ( exteriorList.size() < 1 ) //outer ring is necessary
Expand Down Expand Up @@ -359,7 +365,9 @@ QgsGeometry* QgsOgcUtils::geometryFromGMLMultiPoint( const QDomElement& geometry
}
pointList.push_back(( *currentPoint.begin() ) );
continue;
} else {
}
else
{
//<pos> element
posList = pointNodeList.at( 0 ).toElement().elementsByTagNameNS( GML_NAMESPACE, "pos" );
if ( posList.size() < 1 )
Expand Down Expand Up @@ -455,7 +463,9 @@ QgsGeometry* QgsOgcUtils::geometryFromGMLMultiLineString( const QDomElement& geo
return 0;
}
lineCoordinates.push_back( currentPointList );
} else {
}
else
{
currentPosList = currentLineStringElement.elementsByTagNameNS( GML_NAMESPACE, "posList" );
if ( currentPosList.size() < 1 )
{
Expand Down Expand Up @@ -488,7 +498,9 @@ QgsGeometry* QgsOgcUtils::geometryFromGMLMultiLineString( const QDomElement& geo
}
lineCoordinates.push_back( currentPointList );
return 0;
} else {
}
else
{
currentPosList = currentLineStringElement.elementsByTagNameNS( GML_NAMESPACE, "posList" );
if ( currentPosList.size() < 1 )
{
Expand Down Expand Up @@ -646,7 +658,9 @@ QgsGeometry* QgsOgcUtils::geometryFromGMLMultiPolygon( const QDomElement& geomet
}
currentPolygonList.push_back( ringCoordinates );
}
} else {
}
else
{
//find exterior ring
exteriorList = currentPolygonElement.elementsByTagNameNS( GML_NAMESPACE, "exterior" );
if ( exteriorList.size() < 1 )
Expand Down Expand Up @@ -880,13 +894,14 @@ bool QgsOgcUtils::readGMLPositions( std::list<QgsPoint>& coords, const QDomEleme
}
}

for (int i=0; i<posSize/srsDimension; i++) {
x = pos.at( i*srsDimension ).toDouble( &conversionSuccess );
for ( int i = 0; i < posSize / srsDimension; i++ )
{
x = pos.at( i * srsDimension ).toDouble( &conversionSuccess );
if ( !conversionSuccess )
{
return 1;
}
y = pos.at( i*srsDimension+1 ).toDouble( &conversionSuccess );
y = pos.at( i * srsDimension + 1 ).toDouble( &conversionSuccess );
if ( !conversionSuccess )
{
return 1;
Expand Down Expand Up @@ -1054,18 +1069,18 @@ QDomElement QgsOgcUtils::geometryToGML( QgsGeometry* geometry, QDomDocument& doc
case QGis::WKBPoint:
case QGis::WKBMultiPoint25D:
case QGis::WKBMultiPoint:
baseCoordElem = doc.createElement( "gml:pos");;
baseCoordElem = doc.createElement( "gml:pos" );;
break;
default:
baseCoordElem = doc.createElement( "gml:posList");;
baseCoordElem = doc.createElement( "gml:posList" );;
break;
}
baseCoordElem.setAttribute( "srsDimension", "2" );
cs = " ";
}
else
{
baseCoordElem = doc.createElement( "gml:coordinates");;
baseCoordElem = doc.createElement( "gml:coordinates" );;
baseCoordElem.setAttribute( "cs", cs );
baseCoordElem.setAttribute( "ts", ts );
}
Expand Down Expand Up @@ -1341,11 +1356,11 @@ QDomElement QgsOgcUtils::geometryToGML( QgsGeometry* geometry, QDomDocument& doc

QDomElement QgsOgcUtils::geometryToGML( QgsGeometry* geometry, QDomDocument& doc )
{
return geometryToGML( geometry, doc, "GML2");
return geometryToGML( geometry, doc, "GML2" );
}

QDomElement QgsOgcUtils::createGMLCoordinates( const QVector<QgsPoint> points, QDomDocument& doc )
{
{
QDomElement coordElem = doc.createElement( "gml:coordinates" );
coordElem.setAttribute( "cs", "," );
coordElem.setAttribute( "ts", " " );
Expand All @@ -1369,7 +1384,7 @@ QDomElement QgsOgcUtils::createGMLCoordinates( const QVector<QgsPoint> points, Q
}

QDomElement QgsOgcUtils::createGMLPositions( const QVector<QgsPoint> points, QDomDocument& doc )
{
{
QDomElement posElem = doc.createElement( "gml:pos" );
if ( points.size() > 1 )
posElem = doc.createElement( "gml:posList" );
Expand Down Expand Up @@ -2076,7 +2091,7 @@ QDomElement QgsOgcUtils::expressionFunctionToOgcFilter( const QgsExpression::Nod
Q_ASSERT( argNodes.count() == 2 ); // binary spatial ops must have two args

QgsExpression::Node* otherNode = 0;
if ( isGeometryColumn( argNodes[0]) )
if ( isGeometryColumn( argNodes[0] ) )
otherNode = argNodes[1];
else if ( isGeometryColumn( argNodes[1] ) )
otherNode = argNodes[0];
Expand Down
146 changes: 73 additions & 73 deletions src/core/qgsogcutils.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,88 +29,88 @@ class CORE_EXPORT QgsOgcUtils
{
public:

/** static method that creates geometry from GML
@param XML representation of the geometry. GML elements are expected to be
in default namespace (<Point>...</Point>) or in "gml" namespace (<gml:Point>...</gml:Point>)
*/
static QgsGeometry* geometryFromGML( const QString& xmlString );

/** static method that creates geometry from GML
*/
static QgsGeometry* geometryFromGML( const QDomNode& geometryNode );

/** read rectangle from GML2 Box */
static QgsRectangle rectangleFromGMLBox( const QDomNode& boxNode );

/** read rectangle from GML3 Envelope */
static QgsRectangle rectangleFromGMLEnvelope( const QDomNode& envelopeNode );

/** Exports the geometry to GML2 or GML3
@return QDomELement
*/
static QDomElement geometryToGML( QgsGeometry* geometry, QDomDocument& doc, QString format );

/** Exports the geometry to GML2
@return QDomElement
*/
static QDomElement geometryToGML( QgsGeometry* geometry, QDomDocument& doc );

/** Exports the rectangle to GML2 Box
@return QDomElement
*/
static QDomElement rectangleToGMLBox( QgsRectangle* box, QDomDocument& doc );

/** Exports the rectangle to GML2 Envelope
@return QDomElement
*/
static QDomElement rectangleToGMLEnvelope( QgsRectangle* env, QDomDocument& doc );


/** Parse XML with OGC filter into QGIS expression */
static QgsExpression* expressionFromOgcFilter( const QDomElement& element );

/** Creates OGC filter XML element. Supports minimum standard filter according to the OGC filter specs (=,!=,<,>,<=,>=,AND,OR,NOT)
@return valid <Filter> QDomElement on success, otherwise null QDomElement
*/
static QDomElement expressionToOgcFilter( const QgsExpression& exp, QDomDocument& doc, QString* errorMessage = 0 );

private:
/** static method that creates geometry from GML Point */
static QgsGeometry* geometryFromGMLPoint( const QDomElement& geometryElement );
/** static method that creates geometry from GML LineString */
static QgsGeometry* geometryFromGMLLineString( const QDomElement& geometryElement );
/** static method that creates geometry from GML Polygon */
static QgsGeometry* geometryFromGMLPolygon( const QDomElement& geometryElement );
/** static method that creates geometry from GML MultiPoint */
static QgsGeometry* geometryFromGMLMultiPoint( const QDomElement& geometryElement );
/** static method that creates geometry from GML MultiLineString */
static QgsGeometry* geometryFromGMLMultiLineString( const QDomElement& geometryElement );
/** static method that creates geometry from GML MultiPolygon */
static QgsGeometry* geometryFromGMLMultiPolygon( const QDomElement& geometryElement );
/** Reads the <gml:coordinates> element and extracts the coordinates as points
@param coords list where the found coordinates are appended
@param elem the <gml:coordinates> element
@return boolean for success*/
static bool readGMLCoordinates( std::list<QgsPoint>& coords, const QDomElement elem );
/** Reads the <gml:pos> or <gml:posList> element and extracts the coordinates as points
@param coords list where the found coordinates are appended
@param elem the <gml:pos> or <gml:posList> element
@return boolean for success*/
static bool readGMLPositions( std::list<QgsPoint>& coords, const QDomElement elem );

/** static method that creates geometry from GML
@param XML representation of the geometry. GML elements are expected to be
in default namespace (<Point>...</Point>) or in "gml" namespace (<gml:Point>...</gml:Point>)
*/
static QgsGeometry* geometryFromGML( const QString& xmlString );

/** static method that creates geometry from GML
*/
static QgsGeometry* geometryFromGML( const QDomNode& geometryNode );

/** read rectangle from GML2 Box */
static QgsRectangle rectangleFromGMLBox( const QDomNode& boxNode );

/** read rectangle from GML3 Envelope */
static QgsRectangle rectangleFromGMLEnvelope( const QDomNode& envelopeNode );

/** Exports the geometry to GML2 or GML3
@return QDomELement
*/
static QDomElement geometryToGML( QgsGeometry* geometry, QDomDocument& doc, QString format );

/** Exports the geometry to GML2
@return QDomElement
*/
static QDomElement geometryToGML( QgsGeometry* geometry, QDomDocument& doc );

/** Exports the rectangle to GML2 Box
@return QDomElement
*/
static QDomElement rectangleToGMLBox( QgsRectangle* box, QDomDocument& doc );

/** Exports the rectangle to GML2 Envelope
@return QDomElement
*/
static QDomElement rectangleToGMLEnvelope( QgsRectangle* env, QDomDocument& doc );


/** Parse XML with OGC filter into QGIS expression */
static QgsExpression* expressionFromOgcFilter( const QDomElement& element );

/** Creates OGC filter XML element. Supports minimum standard filter according to the OGC filter specs (=,!=,<,>,<=,>=,AND,OR,NOT)
@return valid <Filter> QDomElement on success, otherwise null QDomElement
*/
static QDomElement expressionToOgcFilter( const QgsExpression& exp, QDomDocument& doc, QString* errorMessage = 0 );

private:
/** static method that creates geometry from GML Point */
static QgsGeometry* geometryFromGMLPoint( const QDomElement& geometryElement );
/** static method that creates geometry from GML LineString */
static QgsGeometry* geometryFromGMLLineString( const QDomElement& geometryElement );
/** static method that creates geometry from GML Polygon */
static QgsGeometry* geometryFromGMLPolygon( const QDomElement& geometryElement );
/** static method that creates geometry from GML MultiPoint */
static QgsGeometry* geometryFromGMLMultiPoint( const QDomElement& geometryElement );
/** static method that creates geometry from GML MultiLineString */
static QgsGeometry* geometryFromGMLMultiLineString( const QDomElement& geometryElement );
/** static method that creates geometry from GML MultiPolygon */
static QgsGeometry* geometryFromGMLMultiPolygon( const QDomElement& geometryElement );
/** Reads the <gml:coordinates> element and extracts the coordinates as points
@param coords list where the found coordinates are appended
@param elem the <gml:coordinates> element
@return boolean for success*/
static bool readGMLCoordinates( std::list<QgsPoint>& coords, const QDomElement elem );
/** Reads the <gml:pos> or <gml:posList> element and extracts the coordinates as points
@param coords list where the found coordinates are appended
@param elem the <gml:pos> or <gml:posList> element
@return boolean for success*/
static bool readGMLPositions( std::list<QgsPoint>& coords, const QDomElement elem );


/**Create a GML coordinates element from a point list.
@param points list of data points
@param the GML document
@return QDomElement */
static QDomElement createGMLCoordinates( const QVector<QgsPoint> points, QDomDocument& doc );
static QDomElement createGMLCoordinates( const QVector<QgsPoint> points, QDomDocument& doc );

/**Create a GML pos or posList element from a point list.
@param points list of data points
@param the GML document
@return QDomElement */
static QDomElement createGMLPositions( const QVector<QgsPoint> points, QDomDocument& doc );
static QDomElement createGMLPositions( const QVector<QgsPoint> points, QDomDocument& doc );

//! handle a generic sub-expression
static QgsExpression::Node* nodeFromOgcFilter( QDomElement &element, QString &errorMessage );
//! handle a generic binary operator
Expand Down
6 changes: 3 additions & 3 deletions src/core/symbology-ng/qgsgraduatedsymbolrendererv2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -195,8 +195,8 @@ QgsSymbolV2* QgsGraduatedSymbolRendererV2::symbolForFeature( QgsFeature& feature
// Null values should not be categorized
if ( attrs[mAttrNum].isNull() )
return NULL;
// find the right category

// find the right category
QgsSymbolV2* symbol = symbolForValue( attrs[mAttrNum].toDouble() );
if ( symbol == NULL )
return NULL;
Expand Down Expand Up @@ -806,7 +806,7 @@ QgsGraduatedSymbolRendererV2* QgsGraduatedSymbolRendererV2::createRenderer(
lst.append( attrNum );

QgsFeatureIterator fit = vlayer->getFeatures( QgsFeatureRequest().setFlags( QgsFeatureRequest::NoGeometry ).setSubsetOfAttributes( lst ) );

// create list of non-null attribute values
while ( fit.nextFeature( f ) )
if ( !f.attribute( attrNum ).isNull() )
Expand Down
2 changes: 1 addition & 1 deletion src/core/symbology-ng/qgssymbolv2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ QgsSymbolV2::~QgsSymbolV2()

QgsSymbolV2::OutputUnit QgsSymbolV2::outputUnit() const
{
QgsSymbolV2::OutputUnit unit;
QgsSymbolV2::OutputUnit unit( QgsSymbolV2::Mixed );

QgsSymbolLayerV2List::const_iterator it = mLayers.constBegin();
for ( ; it != mLayers.constEnd(); ++it )
Expand Down
16 changes: 8 additions & 8 deletions src/gui/qgscomposerview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -513,13 +513,13 @@ void QgsComposerView::keyPressEvent( QKeyEvent * e )
if ( e->matches( QKeySequence::Copy ) )
{
// remove all uuid attributes
QDomNodeList composerItemsNodes = doc.elementsByTagName("ComposerItem");
for (int i=0; i<composerItemsNodes.count(); ++i)
QDomNodeList composerItemsNodes = doc.elementsByTagName( "ComposerItem" );
for ( int i = 0; i < composerItemsNodes.count(); ++i )
{
QDomNode composerItemNode = composerItemsNodes.at(i);
if( composerItemNode.isElement() )
QDomNode composerItemNode = composerItemsNodes.at( i );
if ( composerItemNode.isElement() )
{
composerItemNode.toElement().removeAttribute("uuid");
composerItemNode.toElement().removeAttribute( "uuid" );
}
}
}
Expand All @@ -530,8 +530,8 @@ void QgsComposerView::keyPressEvent( QKeyEvent * e )
clipboard->setMimeData( mimeData );
}

//TODO : "Ctrl+Shift+V" is one way to paste, but on some platefoms you can use Shift+Ins and F18
if ( e->matches( QKeySequence::Paste ) || (e->key() == Qt::Key_V && e->modifiers() & Qt::ControlModifier && e->modifiers() & Qt::ShiftModifier) )
//TODO : "Ctrl+Shift+V" is one way to paste, but on some platefoms you can use Shift+Ins and F18
if ( e->matches( QKeySequence::Paste ) || ( e->key() == Qt::Key_V && e->modifiers() & Qt::ControlModifier && e->modifiers() & Qt::ShiftModifier ) )
{
QDomDocument doc;
QClipboard *clipboard = QApplication::clipboard();
Expand All @@ -543,7 +543,7 @@ void QgsComposerView::keyPressEvent( QKeyEvent * e )
if ( composition() )
{
QPointF pt = mapToScene( mapFromGlobal( QCursor::pos() ) );
bool pasteInPlace = (e->modifiers() & Qt::ShiftModifier);
bool pasteInPlace = ( e->modifiers() & Qt::ShiftModifier );
composition()->addItemsFromXML( docElem, doc, 0, true, &pt, pasteInPlace );
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/gui/qgscomposerview.h
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,8 @@ class GUI_EXPORT QgsComposerView: public QGraphicsView
/**Update rulers with current scene rect*/
void updateRulers();

void setHorizontalRuler( QgsComposerRuler* r ){ mHorizontalRuler = r; }
void setVerticalRuler( QgsComposerRuler* r ){ mVerticalRuler = r; }
void setHorizontalRuler( QgsComposerRuler* r ) { mHorizontalRuler = r; }
void setVerticalRuler( QgsComposerRuler* r ) { mVerticalRuler = r; }

protected:
void mousePressEvent( QMouseEvent* );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -441,7 +441,7 @@ void QgsGraduatedSymbolRendererV2Widget::populateColumns()
const QgsFields& flds = mLayer->pendingFields();
for ( int idx = 0; idx < flds.count(); ++idx )
{
if ( flds[idx].type() == QVariant::Double || flds[idx].type() == QVariant::Int || flds[idx].type() == QVariant::LongLong)
if ( flds[idx].type() == QVariant::Double || flds[idx].type() == QVariant::Int || flds[idx].type() == QVariant::LongLong )
cboGraduatedColumn->addItem( flds[idx].name() );
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/mapserver/qgswfsserver.h
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ class QgsWFSServer

//methods to write GML2
QDomElement createFeatureGML2( QgsFeature* feat, QDomDocument& doc, QgsCoordinateReferenceSystem& crs, QgsFields fields, QSet<QString> excludedAttributes ) /*const*/;

//methods to write GML3
QDomElement createFeatureGML3( QgsFeature* feat, QDomDocument& doc, QgsCoordinateReferenceSystem& crs, QgsFields fields, QSet<QString> excludedAttributes ) /*const*/;
};
Expand Down
4 changes: 2 additions & 2 deletions src/plugins/heatmap/heatmap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ void Heatmap::run()
// Handle different radius options
double radius;
double radiusToMapUnits = 1;
int myBuffer;
int myBuffer = 0;
if ( d.variableRadius() )
{
rField = d.radiusField();
Expand Down Expand Up @@ -367,7 +367,7 @@ double Heatmap::calculateKernelValue( double distance, int bandwidth, int kernel

double Heatmap::uniformKernel( double distance, int bandwidth )
{
Q_UNUSED(distance);
Q_UNUSED( distance );
// Normalizing constant
double k = 2. / ( M_PI * ( double )bandwidth );

Expand Down
2 changes: 1 addition & 1 deletion src/plugins/heatmap/heatmap.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ class Heatmap: public QObject, public QgisPlugin
Heatmap( QgisInterface * theInterface );
//! Destructor
virtual ~Heatmap();

// Kernel shape type
enum kernelShape
{
Expand Down
16 changes: 8 additions & 8 deletions src/providers/mssql/qgsmssqlgeometryparser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -107,10 +107,10 @@ ShapeType (1 byte)
#define PointOffset(iFigure) (ReadInt32(nFigurePos + (iFigure) * 5 + 1))
#define NextPointOffset(iFigure) (iFigure + 1 < nNumFigures? PointOffset((iFigure) +1) : nNumPoints)

#define ReadX(iPoint) (ReadDouble(nPointPos + 16 * (iPoint)))
#define ReadY(iPoint) (ReadDouble(nPointPos + 16 * (iPoint) + 8))
#define ReadZ(iPoint) (ReadDouble(nPointPos + 16 * nNumPoints + 8 * (iPoint)))
#define ReadM(iPoint) (ReadDouble(nPointPos + 24 * nNumPoints + 8 * (iPoint)))
#define ReadX(iPoint) (ReadDouble(nPointPos + 16 * (iPoint)))
#define ReadY(iPoint) (ReadDouble(nPointPos + 16 * (iPoint) + 8))
#define ReadZ(iPoint) (ReadDouble(nPointPos + 16 * nNumPoints + 8 * (iPoint)))
#define ReadM(iPoint) (ReadDouble(nPointPos + 24 * nNumPoints + 8 * (iPoint)))

/************************************************************************/
/* QgsMssqlGeometryParser() */
Expand Down Expand Up @@ -180,15 +180,15 @@ void QgsMssqlGeometryParser::CopyCoordinates( int iPoint )
{
if ( IsGeography )
{
CopyBytes(pszData + nPointPos + 16 * iPoint + 8, 8); // longitude
CopyBytes(pszData + nPointPos + 16 * iPoint, 8); // latitude
CopyBytes( pszData + nPointPos + 16 * iPoint + 8, 8 ); // longitude
CopyBytes( pszData + nPointPos + 16 * iPoint, 8 ); // latitude
}
else
// copy geometry coords
CopyBytes(pszData + nPointPos + 16 * iPoint, 16);
CopyBytes( pszData + nPointPos + 16 * iPoint, 16 );

if ( chProps & SP_HASZVALUES )
CopyBytes(pszData + nPointPos + 16 * nNumPoints + 8 * iPoint, 8); // copy z value
CopyBytes( pszData + nPointPos + 16 * nNumPoints + 8 * iPoint, 8 ); // copy z value
}

/************************************************************************/
Expand Down
2 changes: 1 addition & 1 deletion src/providers/mssql/qgsmssqlnewconnection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ QgsMssqlNewConnection::QgsMssqlNewConnection( QWidget *parent, const QString& co
{
txtUsername->setText( settings.value( key + "/username" ).toString() );
chkStoreUsername->setChecked( true );
cb_trustedConnection->setChecked (false);
cb_trustedConnection->setChecked( false );
}

if ( settings.value( key + "/savePassword" ).toString() == "true" )
Expand Down
14 changes: 7 additions & 7 deletions src/providers/mssql/qgsmssqlprovider.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -945,7 +945,7 @@ bool QgsMssqlProvider::changeAttributeValues( const QgsChangedAttributesMap & at
return true;

if ( mFidColName.isEmpty() )
return false;
return false;

for ( QgsChangedAttributesMap::const_iterator it = attr_map.begin(); it != attr_map.end(); ++it )
{
Expand Down Expand Up @@ -1056,7 +1056,7 @@ bool QgsMssqlProvider::changeGeometryValues( QgsGeometryMap & geometry_map )
return true;

if ( mFidColName.isEmpty() )
return false;
return false;

for ( QgsGeometryMap::iterator it = geometry_map.begin(); it != geometry_map.end(); ++it )
{
Expand Down Expand Up @@ -1129,8 +1129,8 @@ bool QgsMssqlProvider::changeGeometryValues( QgsGeometryMap & geometry_map )
bool QgsMssqlProvider::deleteFeatures( const QgsFeatureIds & id )
{
if ( mFidColName.isEmpty() )
return false;
return false;

QString featureIds;
for ( QgsFeatureIds::const_iterator it = id.begin(); it != id.end(); ++it )
{
Expand Down Expand Up @@ -1162,12 +1162,12 @@ bool QgsMssqlProvider::deleteFeatures( const QgsFeatureIds & id )

int QgsMssqlProvider::capabilities() const
{
if (mFidColName.isEmpty())
if ( mFidColName.isEmpty() )
return CreateSpatialIndex | CreateAttributeIndex | AddFeatures | AddAttributes;
else
return CreateSpatialIndex | CreateAttributeIndex | AddFeatures | DeleteFeatures |
ChangeAttributeValues | ChangeGeometries | AddAttributes | DeleteAttributes |
QgsVectorDataProvider::SelectAtId | QgsVectorDataProvider::SelectGeometryAtId;
ChangeAttributeValues | ChangeGeometries | AddAttributes | DeleteAttributes |
QgsVectorDataProvider::SelectAtId | QgsVectorDataProvider::SelectGeometryAtId;
}

bool QgsMssqlProvider::createSpatialIndex()
Expand Down
6 changes: 3 additions & 3 deletions tests/src/core/testqgsexpression.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -580,9 +580,9 @@ class TestQgsExpression: public QObject
QTest::newRow( "GML Box" ) << "geomFromGML('<gml:Box srsName=\"foo\"><gml:coordinates>135.2239,34.4879 135.8578,34.8471</gml:coordinates></gml:Box>')" << ( void * ) QgsGeometry::fromRect( rect ) << false;
// Envelope is from GML3 ?
QTest::newRow( "GML Envelope" ) << "geomFromGML('<gml:Envelope>"
"<gml:lowerCorner>135.2239 34.4879</gml:lowerCorner>"
"<gml:upperCorner>135.8578 34.8471</gml:upperCorner>"
"</gml:Envelope>')" << ( void * ) QgsGeometry::fromRect( rect ) << false;
"<gml:lowerCorner>135.2239 34.4879</gml:lowerCorner>"
"<gml:upperCorner>135.8578 34.8471</gml:upperCorner>"
"</gml:Envelope>')" << ( void * ) QgsGeometry::fromRect( rect ) << false;
}

void eval_geometry_constructor()
Expand Down
96 changes: 48 additions & 48 deletions tests/src/core/testqgsogcutils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -234,8 +234,8 @@ void TestQgsOgcUtils::testExpressionToOgcFilter()

doc.appendChild( filterElem );

qDebug("EXPR: %s", exp.dump().toAscii().data() );
qDebug("OGC : %s", doc.toString( -1 ).toAscii().data() );
qDebug( "EXPR: %s", exp.dump().toAscii().data() );
qDebug( "OGC : %s", doc.toString( -1 ).toAscii().data() );

QCOMPARE( xmlText, doc.toString( -1 ) );
}
Expand All @@ -258,74 +258,74 @@ void TestQgsOgcUtils::testExpressionToOgcFilter_data()
"</ogc:PropertyIsGreaterThan></ogc:Filter>" );

QTest::newRow( "and+or" ) << QString( "(FIELD1 = 10 OR FIELD1 = 20) AND STATUS = 'VALID'" ) << QString(
"<ogc:Filter>"
"<ogc:Filter>"
"<ogc:And>"
"<ogc:Or>"
"<ogc:PropertyIsEqualTo>"
"<ogc:PropertyName>FIELD1</ogc:PropertyName>"
"<ogc:Literal>10</ogc:Literal>"
"</ogc:PropertyIsEqualTo>"
"<ogc:PropertyIsEqualTo>"
"<ogc:PropertyName>FIELD1</ogc:PropertyName>"
"<ogc:Literal>20</ogc:Literal>"
"</ogc:PropertyIsEqualTo>"
"</ogc:Or>"
"<ogc:PropertyIsEqualTo>"
"<ogc:PropertyName>STATUS</ogc:PropertyName>"
"<ogc:Literal>VALID</ogc:Literal>"
"</ogc:PropertyIsEqualTo>"
"<ogc:Or>"
"<ogc:PropertyIsEqualTo>"
"<ogc:PropertyName>FIELD1</ogc:PropertyName>"
"<ogc:Literal>10</ogc:Literal>"
"</ogc:PropertyIsEqualTo>"
"<ogc:PropertyIsEqualTo>"
"<ogc:PropertyName>FIELD1</ogc:PropertyName>"
"<ogc:Literal>20</ogc:Literal>"
"</ogc:PropertyIsEqualTo>"
"</ogc:Or>"
"<ogc:PropertyIsEqualTo>"
"<ogc:PropertyName>STATUS</ogc:PropertyName>"
"<ogc:Literal>VALID</ogc:Literal>"
"</ogc:PropertyIsEqualTo>"
"</ogc:And>"
"</ogc:Filter>" );
"</ogc:Filter>" );

QTest::newRow( "is null" ) << QString( "X IS NULL" ) << QString(
"<ogc:Filter>"
"<ogc:Filter>"
"<ogc:PropertyIsNull>"
"<ogc:PropertyName>X</ogc:PropertyName>"
"<ogc:PropertyName>X</ogc:PropertyName>"
"</ogc:PropertyIsNull>"
"</ogc:Filter>" );
"</ogc:Filter>" );

QTest::newRow( "is not null" ) << QString( "X IS NOT NULL" ) << QString(
"<ogc:Filter>"
"<ogc:Filter>"
"<ogc:Not>"
"<ogc:PropertyIsNull>"
"<ogc:PropertyName>X</ogc:PropertyName>"
"</ogc:PropertyIsNull>"
"<ogc:PropertyIsNull>"
"<ogc:PropertyName>X</ogc:PropertyName>"
"</ogc:PropertyIsNull>"
"</ogc:Not>"
"</ogc:Filter>" );
"</ogc:Filter>" );

QTest::newRow( "in" ) << QString( "A IN (10,20,30)" ) << QString(
"<ogc:Filter>"
"<ogc:Filter>"
"<ogc:Or>"
"<ogc:PropertyIsEqualTo>"
"<ogc:PropertyName>A</ogc:PropertyName>"
"<ogc:Literal>10</ogc:Literal>"
"</ogc:PropertyIsEqualTo>"
"<ogc:PropertyIsEqualTo>"
"<ogc:PropertyName>A</ogc:PropertyName>"
"<ogc:Literal>20</ogc:Literal>"
"</ogc:PropertyIsEqualTo>"
"<ogc:PropertyIsEqualTo>"
"<ogc:PropertyName>A</ogc:PropertyName>"
"<ogc:Literal>30</ogc:Literal>"
"</ogc:PropertyIsEqualTo>"
"<ogc:PropertyIsEqualTo>"
"<ogc:PropertyName>A</ogc:PropertyName>"
"<ogc:Literal>10</ogc:Literal>"
"</ogc:PropertyIsEqualTo>"
"<ogc:PropertyIsEqualTo>"
"<ogc:PropertyName>A</ogc:PropertyName>"
"<ogc:Literal>20</ogc:Literal>"
"</ogc:PropertyIsEqualTo>"
"<ogc:PropertyIsEqualTo>"
"<ogc:PropertyName>A</ogc:PropertyName>"
"<ogc:Literal>30</ogc:Literal>"
"</ogc:PropertyIsEqualTo>"
"</ogc:Or>"
"</ogc:Filter>" );
"</ogc:Filter>" );

QTest::newRow( "intersects + wkt" ) << QString( "intersects($geometry, geomFromWKT('POINT (5 6)'))" ) << QString(
"<ogc:Filter>"
"<ogc:Filter>"
"<ogc:Intersects>"
"<ogc:PropertyName>geometry</ogc:PropertyName>"
"<gml:Point><gml:coordinates cs=\",\" ts=\" \">5.0,6.0</gml:coordinates></gml:Point>"
"<ogc:PropertyName>geometry</ogc:PropertyName>"
"<gml:Point><gml:coordinates cs=\",\" ts=\" \">5.0,6.0</gml:coordinates></gml:Point>"
"</ogc:Intersects>"
"</ogc:Filter>" );
"</ogc:Filter>" );

QTest::newRow( "contains + gml" ) << QString( "contains($geometry, geomFromGML('<Point><coordinates cs=\",\" ts=\" \">5.0,6.0</coordinates></Point>'))" ) << QString(
"<ogc:Filter>"
"<ogc:Filter>"
"<ogc:Contains>"
"<ogc:PropertyName>geometry</ogc:PropertyName>"
"<Point><coordinates cs=\",\" ts=\" \">5.0,6.0</coordinates></Point>"
"<ogc:PropertyName>geometry</ogc:PropertyName>"
"<Point><coordinates cs=\",\" ts=\" \">5.0,6.0</coordinates></Point>"
"</ogc:Contains>"
"</ogc:Filter>" );
"</ogc:Filter>" );

/*
QTest::newRow( "bbox with GML3 Envelope" )
Expand Down