Skip to content

Commit

Permalink
Merge pull request #339 from opengisch/revert
Browse files Browse the repository at this point in the history
Revert to old SDK
  • Loading branch information
m-kuhn committed Aug 28, 2018
2 parents 8e14db8 + 6ce15f8 commit 3de484a
Show file tree
Hide file tree
Showing 30 changed files with 179 additions and 325 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ before_install:
- gem --version

script:
- export QFIELD_SDK_VERSION=20180815
- export QFIELD_SDK_VERSION=20180310
- echo "travis_fold:start:docker-pull"
- docker pull opengisch/qfield-sdk:${QFIELD_SDK_VERSION}
- echo "travis_fold:end:docker-pull"
Expand Down
2 changes: 1 addition & 1 deletion android/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
<!-- Background running -->
</activity>
</application>
<uses-sdk android:minSdkVersion="18" android:targetSdkVersion="26" />
<uses-sdk android:minSdkVersion="18" android:targetSdkVersion="22" />
<supports-screens android:largeScreens="true" android:normalScreens="true" android:anyDensity="true" android:smallScreens="true"/>

<!-- The following comment will be replaced upon deployment with default permissions based on the dependencies of the application.
Expand Down
5 changes: 0 additions & 5 deletions images/images.qrc
Original file line number Diff line number Diff line change
Expand Up @@ -159,10 +159,5 @@
<file>themes/qfield/xxhdpi/ic_gps_link_white_24dp.png</file>
<file>themes/qfield/xxxhdpi/ic_gps_link_activated_white_24dp.png</file>
<file>themes/qfield/xxxhdpi/ic_gps_link_white_24dp.png</file>
<file>themes/qfield/hdpi/ic_check_white_48dp.png</file>
<file>themes/qfield/xxxhdpi/ic_check_white_48dp.png</file>
<file>themes/qfield/mdpi/ic_check_white_48dp.png</file>
<file>themes/qfield/xhdpi/ic_check_white_48dp.png</file>
<file>themes/qfield/xxhdpi/ic_check_white_48dp.png</file>
</qresource>
</RCC>
5 changes: 1 addition & 4 deletions qfield.pri
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,8 @@ android {
$${OSGEO4A_STAGE_DIR}/$$ANDROID_TARGET_ARCH$$/lib/libwmsprovider.so \
$$QT_LIBS_DIR/libQt5OpenGL.so \
$$QT_LIBS_DIR/libQt5PrintSupport.so \
$$QT_LIBS_DIR/libQt5Concurrent.so \
$$QT_LIBS_DIR/libQt5Sensors.so \
$$QT_LIBS_DIR/libQt5Sql.so \
$$QT_LIBS_DIR/libQt5Svg.so \
$$QT_LIBS_DIR/libQt5SerialPort.so \
$$QT_LIBS_DIR/libQt5PrintSupport.so
$$QT_LIBS_DIR/libQt5Svg.so
}

6 changes: 4 additions & 2 deletions scripts/astyle.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
if ! hash astyle 2>/dev/null; then
echo "astyle not found - please install astyle on your system" >&2
exit 1
else
ASTYLE=astyle
fi

if ! type -p flip >/dev/null; then
Expand All @@ -27,7 +29,7 @@ fi

set -e

MY_ARTISTIC_STYLE_OPTIONS="\
export ARTISTIC_STYLE_OPTIONS="\
--style=allman \
--preserve-date \
--indent-preprocessor \
Expand All @@ -45,7 +47,7 @@ MY_ARTISTIC_STYLE_OPTIONS="\
for f in "$@"; do
case "$f" in
*.cpp|*.h|*.c|*.h|*.cxx|*.hxx|*.c++|*.h++|*.cc|*.hh|*.C|*.H|*.hpp)
cmd="astyle $MY_ARTISTIC_STYLE_OPTIONS"
cmd="$ASTYLE $ARTISTIC_STYLE_OPTIONS"
;;

*.ui|*.qgm|*.txt|*.t2t|*.sip|resources/context_help/*)
Expand Down
5 changes: 0 additions & 5 deletions src/appinterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,6 @@ void AppInterface::loadProject( const QString& path )
return mApp->loadProjectFile( QUrl( path ).path() );
}

void AppInterface::print( int layoutIndex )
{
return mApp->print( layoutIndex );
}

void AppInterface::openFeatureForm()
{
emit openFeatureFormRequested();
Expand Down
1 change: 0 additions & 1 deletion src/appinterface.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ class AppInterface : public QObject
}

Q_INVOKABLE void loadProject( const QString& path );
Q_INVOKABLE void print( int layoutIndex );

public slots:
void openFeatureForm();
Expand Down
56 changes: 56 additions & 0 deletions src/coordinatetransform.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
/***************************************************************************
coordinatetransform.cpp
----------------------------------------------------
date : 26.2.2015
copyright : (C) 2015 by Matthias Kuhn
email : matthias (at) opengis.ch
***************************************************************************
* *
* 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 "coordinatetransform.h"
#include "qgspoint.h"

CoordinateTransform::CoordinateTransform( QObject *parent ) :
QObject( parent )
{
}

QgsPointXY CoordinateTransform::transform( QgsPointXY pt ) const
{
pt = mTransform.transform( pt );
return pt;
}

QgsCoordinateReferenceSystem CoordinateTransform::sourceCRS() const
{
return mTransform.sourceCrs();
}

QgsCoordinateReferenceSystem CoordinateTransform::destinationCRS() const
{
return mTransform.destinationCrs();
}

void CoordinateTransform::setSourceCRS( QgsCoordinateReferenceSystem sourceCRS )
{
if ( mTransform.sourceCrs() == sourceCRS )
return;

mTransform.setSourceCrs( sourceCRS );
emit sourceCRSChanged();
}

void CoordinateTransform::setDestinationCRS( QgsCoordinateReferenceSystem destCRS )
{
if ( mTransform.destinationCrs() == destCRS )
return;

mTransform.setDestinationCrs( destCRS );
emit destinationCRSChanged();
}
51 changes: 51 additions & 0 deletions src/coordinatetransform.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
/***************************************************************************
coordinatetransform.h
----------------------------------------------------
date : 26.2.2015
copyright : (C) 2015 by Matthias Kuhn
email : matthias (at) opengis.ch
***************************************************************************
* *
* 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 COORDINATETRANSFORM_H
#define COORDINATETRANSFORM_H

#include <QObject>
#include <QPointF>
#include <qgspoint.h>

#include <qgscoordinatetransform.h>

class CoordinateTransform : public QObject
{
Q_OBJECT

Q_PROPERTY( QgsCoordinateReferenceSystem sourceCRS READ sourceCRS WRITE setSourceCRS NOTIFY sourceCRSChanged )
Q_PROPERTY( QgsCoordinateReferenceSystem destinationCRS READ destinationCRS WRITE setDestinationCRS NOTIFY destinationCRSChanged )

public:
explicit CoordinateTransform( QObject *parent = nullptr );

Q_INVOKABLE QgsPointXY transform( QgsPointXY pt ) const;

QgsCoordinateReferenceSystem sourceCRS() const;
QgsCoordinateReferenceSystem destinationCRS() const;

void setSourceCRS( QgsCoordinateReferenceSystem sourceCRS );
void setDestinationCRS( QgsCoordinateReferenceSystem destCRS );

signals:
void destinationCRSChanged();
void sourceCRSChanged();

private:
QgsCoordinateTransform mTransform;
};

#endif // COORDINATETRANSFORM_H
15 changes: 2 additions & 13 deletions src/coordinatetransformer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ QgsCoordinateReferenceSystem CoordinateTransformer::destinationCrs() const
return mCoordinateTransform.destinationCrs();
}

void CoordinateTransformer::setDestinationCrs( const QgsCoordinateReferenceSystem &destinationCrs )
void CoordinateTransformer::setDestinationCrs( const QgsCoordinateReferenceSystem& destinationCrs )
{
if ( destinationCrs == mCoordinateTransform.destinationCrs() )
return;
Expand All @@ -74,7 +74,7 @@ QgsCoordinateReferenceSystem CoordinateTransformer::sourceCrs() const
return mCoordinateTransform.sourceCrs();
}

void CoordinateTransformer::setSourceCrs( const QgsCoordinateReferenceSystem &sourceCrs )
void CoordinateTransformer::setSourceCrs( const QgsCoordinateReferenceSystem& sourceCrs )
{
if ( sourceCrs == mCoordinateTransform.sourceCrs() )
return;
Expand All @@ -85,17 +85,6 @@ void CoordinateTransformer::setSourceCrs( const QgsCoordinateReferenceSystem &so
updatePosition();
}

void CoordinateTransformer::setTransformContext( const QgsCoordinateTransformContext &context )
{
mCoordinateTransform.setContext( context );
emit transformContextChanged();
}

QgsCoordinateTransformContext CoordinateTransformer::transformContext() const
{
return mCoordinateTransform.context();
}

void CoordinateTransformer::updatePosition()
{
double x = mSourcePosition.longitude();
Expand Down
53 changes: 4 additions & 49 deletions src/coordinatetransformer.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,83 +21,38 @@

#include <qgspoint.h>

/**
* Helper class for transform of coordinates (QGeoCoordinate) to a different coordinate reference system.
*
* It requires connection of transformation context from mapSettings, source position and source CRS to
* calculate projected position in desired destination CRS.
*
* \note QML Type: CoordinateTransformer
*/
class CoordinateTransformer : public QObject
{
Q_OBJECT

//! Projected (destination) position (in destination CRS)
Q_PROPERTY( QgsPoint projectedPosition READ projectedPosition NOTIFY projectedPositionChanged )

//! Source position
Q_PROPERTY( QGeoCoordinate sourcePosition READ sourcePosition WRITE setSourcePosition NOTIFY sourcePositionChanged )

//! Destination CRS
Q_PROPERTY( QgsCoordinateReferenceSystem destinationCrs READ destinationCrs WRITE setDestinationCrs NOTIFY destinationCrsChanged )

//! Source CRS, default 4326
Q_PROPERTY( QgsCoordinateReferenceSystem sourceCrs READ sourceCrs WRITE setSourceCrs NOTIFY sourceCrsChanged )

//! Transformation context, can be set from MapSettings::transformContext()
Q_PROPERTY( QgsCoordinateTransformContext transformContext READ transformContext WRITE setTransformContext NOTIFY transformContextChanged )

public:
//! Creates new coordinate transformer
explicit CoordinateTransformer( QObject *parent = nullptr );

//!\copydoc CoordinateTransformer::projectedPosition
QgsPoint projectedPosition() const;

//!\copydoc CoordinateTransformer::sourcePosition
QGeoCoordinate sourcePosition() const;

//!\copydoc CoordinateTransformer::sourcePosition
void setSourcePosition( QGeoCoordinate sourcePosition );

//!\copydoc CoordinateTransformer::destinationCrs
QgsCoordinateReferenceSystem destinationCrs() const;
void setDestinationCrs( const QgsCoordinateReferenceSystem& destinationCrs );

//!\copydoc CoordinateTransformer::destinationCrs
void setDestinationCrs( const QgsCoordinateReferenceSystem &destinationCrs );

//!\copydoc CoordinateTransformer::sourceCrs
QgsCoordinateReferenceSystem sourceCrs() const;
void setSourceCrs( const QgsCoordinateReferenceSystem& sourceCrs );

//!\copydoc CoordinateTransformer::sourceCrs
void setSourceCrs( const QgsCoordinateReferenceSystem &sourceCrs );

//!\copydoc CoordinateTransformer::transformContext
void setTransformContext( const QgsCoordinateTransformContext &context );

//!\copydoc CoordinateTransformer::transformContext
QgsCoordinateTransformContext transformContext() const;
private:
void updatePosition();

signals:
//!\copydoc CoordinateTransformer::projectedPosition
void projectedPositionChanged();

//!\copydoc CoordinateTransformer::sourcePosition
void sourcePositionChanged();

//!\copydoc CoordinateTransformer::destinationCrs
void destinationCrsChanged();

//!\copydoc CoordinateTransformer::sourceCrs
void sourceCrsChanged();

//!\copydoc CoordinateTransformer::transformContext
void transformContextChanged();

private:
void updatePosition();

QgsPoint mProjectedPosition;
QGeoCoordinate mSourcePosition;
QgsCoordinateTransform mCoordinateTransform;
Expand Down
17 changes: 7 additions & 10 deletions src/featurelistextentcontroller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@

FeatureListExtentController::FeatureListExtentController( QObject* parent )
: QObject( parent )
, mModel( 0 )
, mSelection( 0 )
, mMapSettings( 0 )
, mAutoZoom( false )
{
connect( this, &FeatureListExtentController::autoZoomChanged, this, &FeatureListExtentController::zoomToSelected );
connect( this, &FeatureListExtentController::modelChanged, this, &FeatureListExtentController::onModelChanged );
Expand All @@ -41,17 +45,10 @@ void FeatureListExtentController::zoomToSelected() const
QgsGeometry geom( feat.geometry() );
geom.transform( transf );

if ( geom.type() == QgsWkbTypes::PointGeometry )
{
mMapSettings->setCenter( QgsPoint( geom.asPoint() ) );
}
else
{
QgsRectangle featureExtent = geom.boundingBox();
QgsRectangle bufferedExtent = featureExtent.buffered( qMax( featureExtent.width(), featureExtent.height() ) );
QgsRectangle featureExtent = geom.boundingBox();
QgsRectangle bufferedExtent = featureExtent.buffered( qMax( featureExtent.width(), featureExtent.height() ) );

mMapSettings->setExtent( bufferedExtent );
}
mMapSettings->setExtent( bufferedExtent );
}
}

Expand Down
8 changes: 4 additions & 4 deletions src/featurelistextentcontroller.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,10 @@ class FeatureListExtentController : public QObject
void onCurrentSelectionChanged();

private:
MultiFeatureListModel* mModel = nullptr;
FeatureListModelSelection* mSelection = nullptr;
MapSettings* mMapSettings = nullptr;
bool mAutoZoom = false;
MultiFeatureListModel* mModel;
FeatureListModelSelection* mSelection;
MapSettings* mMapSettings;
bool mAutoZoom;
};

#endif // FEATURELISTEXTENTCONTROLLER_H
8 changes: 1 addition & 7 deletions src/mapsettings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ MapSettings::MapSettings( QObject *parent )
{
// Connect signals for derived values
connect( this, &MapSettings::destinationCrsChanged, this, &MapSettings::mapUnitsPerPixelChanged );
connect( this, &MapSettings::destinationCrsChanged, this, &MapSettings::abbreviatedStringOfDistanceUnitChanged );
connect( this, &MapSettings::extentChanged, this, &MapSettings::mapUnitsPerPixelChanged );
connect( this, &MapSettings::outputSizeChanged, this, &MapSettings::mapUnitsPerPixelChanged );
connect( this, &MapSettings::extentChanged, this, &MapSettings::visibleExtentChanged );
Expand Down Expand Up @@ -87,7 +86,7 @@ QPointF MapSettings::coordinateToScreen( const QgsPoint &point ) const

QgsPoint MapSettings::screenToCoordinate( const QPointF &point ) const
{
const QgsPointXY pp = mMapSettings.mapToPixel().toMapCoordinatesF( point.x(), point.y() );
const QgsPointXY pp = mMapSettings.mapToPixel().toMapCoordinates( point.toPoint() );
return QgsPoint( pp );
}

Expand Down Expand Up @@ -149,11 +148,6 @@ void MapSettings::setLayers( const QList<QgsMapLayer *> &layers )
emit layersChanged();
}

QString MapSettings::abbreviatedStringOfDistanceUnit() const
{
return QgsUnitTypes::toAbbreviatedString( mMapSettings.destinationCrs().mapUnits() );
}

#if 0
void MapSettings::setMapTheme( QgsProject* project, const QString& mapThemeName )
{
Expand Down
Loading

0 comments on commit 3de484a

Please sign in to comment.