Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/qgis/QGIS
Browse files Browse the repository at this point in the history
  • Loading branch information
mach0 committed Feb 10, 2014
2 parents df0a443 + e67eb4a commit e6fe97f
Show file tree
Hide file tree
Showing 7 changed files with 175 additions and 43 deletions.
6 changes: 6 additions & 0 deletions src/core/composer/qgscomposermousehandles.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,12 @@ class CORE_EXPORT QgsComposerMouseHandles: public QObject, public QGraphicsRectI
/**Finds out which mouse move action to choose depending on the scene cursor position*/
QgsComposerMouseHandles::MouseAction mouseActionForScenePos( const QPointF& sceneCoordPos );

/**Returns true is user is currently dragging the handles */
bool isDragging() { return mIsDragging; }

/**Returns true is user is currently resizing with the handles */
bool isResizing() { return mIsResizing; }

protected:

void mouseMoveEvent( QGraphicsSceneMouseEvent* event );
Expand Down
13 changes: 10 additions & 3 deletions src/core/dxf/qgsdxfexport.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -834,8 +834,11 @@ void QgsDxfExport::writePolyline( const QgsPolyline& line, const QString& layer,
writeGroup( 66, 1 );
int type = polygon ? 1 : 0;
writeGroup( 70, type );
writeGroup( 40, width );
writeGroup( 41, width );
if ( width > 0 ) //width -1: use default width
{
writeGroup( 40, width );
writeGroup( 41, width );
}

QgsPolyline::const_iterator lineIt = line.constBegin();
for ( ; lineIt != line.constEnd(); ++lineIt )
Expand Down Expand Up @@ -955,7 +958,11 @@ void QgsDxfExport::addFeature( const QgsSymbolV2RenderContext& ctx, const QStrin
{
c = colorFromSymbolLayer( symbolLayer, ctx );
}
double width = symbolLayer->dxfWidth( *this, ctx );
double width = -1;
if ( mSymbologyExport != NoSymbology && symbolLayer )
{
width = symbolLayer->dxfWidth( *this, ctx );
}
QString lineStyleName = "CONTINUOUS";
if ( mSymbologyExport != NoSymbology )
{
Expand Down
29 changes: 20 additions & 9 deletions src/core/qgscoordinatereferencesystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,7 @@ QgsCoordinateReferenceSystem& QgsCoordinateReferenceSystem::operator=( const Qgs
mIsValidFlag = srs.mIsValidFlag;
mValidationHint = srs.mValidationHint;
mWkt = srs.mWkt;
mProj4 = srs.mProj4;
if ( mIsValidFlag )
{
OSRDestroySpatialReference( mCRS );
Expand Down Expand Up @@ -368,7 +369,7 @@ bool QgsCoordinateReferenceSystem::loadFromDb( QString db, QString expression, Q
myPreparedStatement, 1 ) );
mProjectionAcronym = QString::fromUtf8(( char * )sqlite3_column_text( myPreparedStatement, 2 ) );
mEllipsoidAcronym = QString::fromUtf8(( char * )sqlite3_column_text( myPreparedStatement, 3 ) );
QString toProj4 = QString::fromUtf8(( char * )sqlite3_column_text( myPreparedStatement, 4 ) );
mProj4 = QString::fromUtf8(( char * )sqlite3_column_text( myPreparedStatement, 4 ) );
mSRID = QString::fromUtf8(( char * )sqlite3_column_text( myPreparedStatement, 5 ) ).toLong();
mAuthId = QString::fromUtf8(( char * )sqlite3_column_text( myPreparedStatement, 6 ) );
mGeoFlag = QString::fromUtf8(( char * )sqlite3_column_text( myPreparedStatement, 7 ) ).toInt() != 0;
Expand All @@ -388,7 +389,7 @@ bool QgsCoordinateReferenceSystem::loadFromDb( QString db, QString expression, Q

if ( !mIsValidFlag )
{
setProj4String( toProj4 );
setProj4String( mProj4 );
}
}
else
Expand Down Expand Up @@ -430,6 +431,7 @@ bool QgsCoordinateReferenceSystem::createFromWkt( const QString &theWkt )
{
mIsValidFlag = false;
mWkt.clear();
mProj4.clear();

if ( theWkt.isEmpty() )
{
Expand Down Expand Up @@ -874,14 +876,16 @@ QString QgsCoordinateReferenceSystem::toProj4() const
if ( !mIsValidFlag )
return "";

QString toProj4;
char *proj4src = NULL;
OSRExportToProj4( mCRS, &proj4src );
toProj4 = proj4src;
CPLFree( proj4src );

if ( mProj4.isEmpty() )
{
QString toProj4;
char *proj4src = NULL;
OSRExportToProj4( mCRS, &proj4src );
mProj4 = proj4src;
CPLFree( proj4src );
}
// Stray spaces at the end?
return toProj4.trimmed();
return mProj4.trimmed();
}

bool QgsCoordinateReferenceSystem::geographicFlag() const
Expand Down Expand Up @@ -916,6 +920,7 @@ void QgsCoordinateReferenceSystem::setDescription( QString theDescription )
}
void QgsCoordinateReferenceSystem::setProj4String( QString theProj4String )
{
mProj4 = theProj4String;
char *oldlocale = setlocale( LC_NUMERIC, NULL );
/* the next setlocale() invalides the return of previous setlocale() */
if ( oldlocale )
Expand Down Expand Up @@ -1462,6 +1467,12 @@ bool QgsCoordinateReferenceSystem::saveAsUserCRS( QString name )

QString mySql;

QString proj4String=mProj4;
if ( proj4String.isEmpty() )
{
proj4String = toProj4();
}

//if this is the first record we need to ensure that its srs_id is 10000. For
//any rec after that sqlite3 will take care of the autonumering
//this was done to support sqlite 3.0 as it does not yet support
Expand Down
1 change: 1 addition & 0 deletions src/core/qgscoordinatereferencesystem.h
Original file line number Diff line number Diff line change
Expand Up @@ -465,6 +465,7 @@ class CORE_EXPORT QgsCoordinateReferenceSystem

QString mValidationHint;
mutable QString mWkt;
mutable QString mProj4;

static bool loadIDs( QHash<int, QString> &wkts );
static bool loadWkts( QHash<int, QString> &wkts, const char *filename );
Expand Down
19 changes: 18 additions & 1 deletion src/core/qgsgeometry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2530,6 +2530,9 @@ int QgsGeometry::addPart( const QList<QgsPoint> &points, QGis::GeometryType geom

int QgsGeometry::addPart( QgsGeometry *newPart )
{
if( !newPart )
return 4;

const GEOSGeometry * geosPart = newPart->asGeos();
return addPart( GEOSGeom_clone( geosPart ) );
}
Expand Down Expand Up @@ -3028,6 +3031,9 @@ int QgsGeometry::reshapeGeometry( const QList<QgsPoint>& reshapeWithLine )
int QgsGeometry::makeDifference( QgsGeometry* other )
{
//make sure geos geometry is up to date
if ( !other )
return 1;

if ( mDirtyGeos )
exportWkbToGeos();

Expand Down Expand Up @@ -3323,6 +3329,9 @@ bool QgsGeometry::intersects( const QgsRectangle& r ) const

bool QgsGeometry::intersects( const QgsGeometry* geometry ) const
{
if( !geometry )
return false;

try // geos might throw exception on error
{
// ensure that both geometries have geos geometry
Expand All @@ -3344,6 +3353,12 @@ bool QgsGeometry::contains( const QgsPoint* p ) const
{
exportWkbToGeos();

if ( !p )
{
QgsDebugMsg( "pointer p is 0" );
return false;
}

if ( !mGeos )
{
QgsDebugMsg( "GEOS geometry not available!" );
Expand Down Expand Up @@ -3376,6 +3391,9 @@ bool QgsGeometry::geosRelOp(
const QgsGeometry *a,
const QgsGeometry *b )
{
if( !a || !b )
return false;

try // geos might throw exception on error
{
// ensure that both geometries have geos geometry
Expand Down Expand Up @@ -4745,7 +4763,6 @@ GEOSGeometry* QgsGeometry::reshapePolygon( const GEOSGeometry* polygon, const GE
return 0;
}


GEOSGeometry* newOuterRing = 0;
if ( lastIntersectingRing == -1 )
newOuterRing = newRing;
Expand Down
Loading

0 comments on commit e6fe97f

Please sign in to comment.