Skip to content
Permalink
Browse files

merge from trunk r11300:11350

git-svn-id: http://svn.osgeo.org/qgis/branches/symbology-ng-branch@11886 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
wonder
wonder committed Nov 2, 2009
1 parent 5662cdb commit 6360c4609992f373a8a4a6a67732ceecadb6eb05
@@ -17,6 +17,8 @@ set BISON=%PROGRAMFILES%\GnuWin32\bin\bison.exe

set VERSION=%1
set PACKAGE=%2
if %VERSION%=="" goto error
if %PACKAGE%=="" goto error

PROMPT qgis%VERSION%$g

@@ -76,7 +78,8 @@ cmake -G "Visual Studio 9 2008" ^
-D BISON_EXECUTABLE=%BISON% ^
-D GDAL_INCLUDE_DIR=%OSGEO4W_ROOT%\apps\gdal-16\include -D GDAL_LIBRARY=%OSGEO4W_ROOT%\apps\gdal-16\lib\gdal_i.lib ^
-D PYTHON_EXECUTABLE=%OSGEO4W_ROOT%\bin\python.exe ^
-D PYTHON_INCLUDE_DIR=%OSGEO4W_ROOT%\apps\Python25\include -D PYTHON_LIBRARY=%OSGEO4W_ROOT%\apps\Python25\libs\python25.lib ^
-D PYTHON_INCLUDE_PATH=%OSGEO4W_ROOT%\apps\Python25\include ^
-D PYTHON_LIBRARY=%OSGEO4W_ROOT%\apps\Python25\libs\python25.lib ^
-D SIP_BINARY_PATH=%OSGEO4W_ROOT%\apps\Python25\sip.exe ^
-D GRASS_PREFIX=%OSGEO4W_ROOT%\apps\grass\grass-%GRASS_VERSION% ^
-D QT_BINARY_DIR=%OSGEO4W_ROOT%\bin -D QT_LIBRARY_DIR=%OSGEO4W_ROOT%\lib ^
@@ -87,6 +90,9 @@ cmake -G "Visual Studio 9 2008" ^
../../..>>%LOG% 2>&1
if errorlevel 1 goto error

egrep -vq "^(Python not being built|Could not find GRASS)" %LOG%
if errorlevel 1 goto error

:skipcmake

echo ZERO_CHECK: %DATE% %TIME%>>%LOG% 2>&1
@@ -18,6 +18,11 @@ class QgsComposerLabel: QgsComposerItem

QString text();
void setText( const QString& text );

/**Returns the text as it appears on screen (with replaced data field)
@note this function was added in version 1.2*/
QString displayText() const;

QFont font() const;
void setFont( const QFont& f );
double margin();

Large diffs are not rendered by default.

@@ -130,6 +130,7 @@ void QgsLegend::removeAll()
updateMapCanvasLayerSet();
setIconSize( mMinimumIconSize );
mItemBeingMoved = 0;
mDropTarget = 0;
}

void QgsLegend::selectAll( bool select )
@@ -4671,7 +4671,6 @@ void QgisApp::isInOverview()

void QgisApp::removeLayer()
{
QgsLegendLayerFile* currentLayerFile = mMapLegend->currentLayerFile();
mMapLegend->legendLayerRemove();
// notify the project we've made a change
QgsProject::instance()->dirty( true );
@@ -5450,7 +5449,9 @@ void QgisApp::projectProperties()
QApplication::restoreOverrideCursor();

//pass any refresg signals off to canvases
//connect (pp,SIGNAL(refresh()), mMapCanvas, SLOT(refresh()));
// Line below was commented out by wonder three years ago (r4949).
// It is needed to refresh scale bar after changing display units.
connect( pp, SIGNAL( refresh() ), mMapCanvas, SLOT( refresh() ) );

QgsMapRenderer* myRender = mMapCanvas->mapRenderer();
bool wasProjected = myRender->hasCrsTransformEnabled();
@@ -18,6 +18,7 @@
#include "qgsmeasuredialog.h"
#include "qgsmeasuretool.h"

#include "qgslogger.h"
#include "qgscontexthelp.h"
#include "qgsdistancearea.h"
#include "qgsmapcanvas.h"
@@ -96,9 +97,12 @@ void QgsMeasureDialog::mouseMove( QgsPoint &point )
QgsPoint p1( mTool->points().last() ), p2( point );

double d = mTool->canvas()->mapRenderer()->distanceArea()->measureLine( p1, p2 );
editTotal->setText( formatDistance( mTotal + d ) );
QGis::UnitType myDisplayUnits;
// Ignore units
convertMeasurement( d, myDisplayUnits, false );
QTreeWidgetItem *item = mTable->topLevelItem( mTable->topLevelItemCount() - 1 );
item->setText( 0, QLocale::system().toString( d, 'f', 2 ) );
editTotal->setText( formatDistance( mTotal + d ) );
}
}

@@ -121,6 +125,10 @@ void QgsMeasureDialog::addPoint( QgsPoint &point )
mTotal += d;
editTotal->setText( formatDistance( mTotal ) );

QGis::UnitType myDisplayUnits;
// Ignore units
convertMeasurement( d, myDisplayUnits, false );

QTreeWidgetItem *item = mTable->topLevelItem( mTable->topLevelItemCount() - 1 );
item->setText( 0, QLocale::system().toString( d, 'f', 2 ) );

@@ -173,24 +181,26 @@ void QgsMeasureDialog::on_btnHelp_clicked()

QString QgsMeasureDialog::formatDistance( double distance )
{
QString txt;
QString unitLabel;

QGis::UnitType myMapUnits = mTool->canvas()->mapUnits();
return QgsDistanceArea::textUnit( distance, 2, myMapUnits, false );
QGis::UnitType myDisplayUnits;
convertMeasurement( distance, myDisplayUnits, false );
return QgsDistanceArea::textUnit( distance, 2, myDisplayUnits, false );
}

QString QgsMeasureDialog::formatArea( double area )
{
QGis::UnitType myMapUnits = mTool->canvas()->mapUnits();
return QgsDistanceArea::textUnit( area, 2, myMapUnits, true );
QGis::UnitType myDisplayUnits;
convertMeasurement( area, myDisplayUnits, true );
return QgsDistanceArea::textUnit( area, 2, myDisplayUnits, true );
}

void QgsMeasureDialog::updateUi()
{
double dummy = 1.0;
QGis::UnitType myDisplayUnits;
// The dummy distance is ignored
convertMeasurement( dummy, myDisplayUnits, false );

QGis::UnitType myMapUnits = mTool->canvas()->mapUnits();
switch ( myMapUnits )
switch ( myDisplayUnits )
{
case QGis::Meters:
mTable->setHeaderLabels( QStringList( tr( "Segments (in meters)" ) ) );
@@ -218,3 +228,48 @@ void QgsMeasureDialog::updateUi()

}

void QgsMeasureDialog::convertMeasurement(double &measure, QGis::UnitType &u, bool isArea)
{
// Helper for converting between meters and feet
// The parameter &u is out only...

QGis::UnitType myUnits = mTool->canvas()->mapUnits();
if ( myUnits == QGis::Degrees &&
mTool->canvas()->mapRenderer()->distanceArea()->ellipsoid() != "NONE" &&
mTool->canvas()->mapRenderer()->distanceArea()->hasCrsTransformEnabled() )
{
// Measuring on an ellipsoid returns meters
myUnits = QGis::Meters;
QgsDebugMsg( "We're measuring on an ellipsoid, returning meters" );
}

// Get the units for display
QSettings settings;
QString myDisplayUnitsTxt = settings.value( "/qgis/measure/displayunits", "meters").toString();

// Only convert between meters and feet
if ( myUnits == QGis::Meters && myDisplayUnitsTxt == "feet" )
{
QgsDebugMsg( QString( "Converting %1 meters" ).arg( QString::number( measure ) ) );
measure /= 0.3048;
if ( isArea )
{
measure /= 0.3048;
}
QgsDebugMsg( QString( "to %1 feet" ).arg( QString::number( measure ) ) );
myUnits = QGis::Feet;
}
if ( myUnits == QGis::Feet && myDisplayUnitsTxt == "meters" )
{
QgsDebugMsg( QString( "Converting %1 feet" ).arg( QString::number( measure ) ) );
measure *= 0.3048;
if ( isArea )
{
measure *= 0.3048;
}
QgsDebugMsg( QString( "to %1 meters" ).arg( QString::number( measure ) ) );
myUnits = QGis::Meters;
}

u = myUnits;
}
@@ -20,6 +20,7 @@
#include "ui_qgsmeasurebase.h"

#include "qgspoint.h"
#include "qgsdistancearea.h"

class QCloseEvent;
class QgsMeasureTool;
@@ -72,6 +73,9 @@ class QgsMeasureDialog : public QDialog, private Ui::QgsMeasureBase
//! shows/hides table, shows correct units
void updateUi();

//! Converts the measurement, depending on settings in options and current transformation
void convertMeasurement(double &measure, QGis::UnitType &u, bool isArea);

double mTotal;

//! Help context id
@@ -113,6 +113,17 @@ QgsOptions::QgsOptions( QWidget *parent, Qt::WFlags fl ) :
getEllipsoidList();
QString myEllipsoidId = settings.value( "/qgis/measure/ellipsoid", "WGS84" ).toString();
cmbEllipsoid->setItemText( cmbEllipsoid->currentIndex(), getEllipsoidName( myEllipsoidId ) );

// Set the units for measuring
QString myUnitsTxt = settings.value( "/qgis/measure/displayunits", "meters").toString();
if ( myUnitsTxt == "feet" )
{
radFeet->setChecked( true );
} else {
radMeters->setChecked( true );
}


// add the themes to the combo box on the option dialog
QDir myThemeDir( QgsApplication::pkgDataPath() + "/themes/" );
myThemeDir.setFilter( QDir::Dirs );
@@ -405,6 +416,15 @@ void QgsOptions::saveOptions()

settings.setValue( "/qgis/measure/ellipsoid", getEllipsoidAcronym( cmbEllipsoid->currentText() ) );

if ( radFeet->isChecked() )
{
settings.setValue( "/qgis/measure/displayunits", "feet" );
}
else
{
settings.setValue( "/qgis/measure/displayunits", "meters" );
}
settings.setValue( "/qgis/measure/ellipsoid", getEllipsoidAcronym( cmbEllipsoid->currentText() ) );
//set the colour for selections
QColor myColor = pbnSelectionColour->color();
settings.setValue( "/qgis/default_selection_color_red", myColor.red() );
@@ -58,6 +58,7 @@ QgsProjectProperties::QgsProjectProperties( QgsMapCanvas* mapCanvas, QWidget *pa
//see if the user wants on the fly projection enabled
bool myProjectionEnabled = myRender->hasCrsTransformEnabled();
cbxProjectionEnabled->setChecked( myProjectionEnabled );
btnGrpMapUnits->setEnabled( !myProjectionEnabled );

long myCRSID = myRender->destinationSrs().srsid();
QgsDebugMsg( "Read project CRSID: " + QString::number( myCRSID ) );
@@ -430,3 +431,9 @@ void QgsProjectProperties::on_mSnappingOptionsPushButton_clicked()
d.layerSettings( mSnappingLayerSettings );
}
}

void QgsProjectProperties::on_cbxProjectionEnabled_stateChanged(int state)
{
btnGrpMapUnits->setEnabled( state == Qt::Unchecked );
}

@@ -93,6 +93,9 @@ class QgsProjectProperties : public QDialog, private Ui::QgsProjectPropertiesBas
*/
void on_mSnappingOptionsPushButton_clicked();

void on_cbxProjectionEnabled_stateChanged(int state);


signals:
//! Signal used to inform listeners that the mouse display precision may have changed
void displayPrecisionChanged();
@@ -210,7 +210,9 @@ bool QgsComposerItem::_readXML( const QDomElement& itemElem, const QDomDocument&
{
QDomElement frameColorElem = frameColorList.at( 0 ).toElement();
bool redOk, greenOk, blueOk, alphaOk, widthOk;
int penRed, penGreen, penBlue, penAlpha, penWidth;
int penRed, penGreen, penBlue, penAlpha;
double penWidth;

penWidth = itemElem.attribute( "outlineWidth" ).toDouble( &widthOk );
penRed = frameColorElem.attribute( "red" ).toDouble( &redOk );
penGreen = frameColorElem.attribute( "green" ).toDouble( &greenOk );
@@ -219,7 +221,7 @@ bool QgsComposerItem::_readXML( const QDomElement& itemElem, const QDomDocument&
if ( redOk && greenOk && blueOk && alphaOk && widthOk )
{
QPen framePen( QColor( penRed, penGreen, penBlue, penAlpha ) );
framePen.setWidth( penWidth );
framePen.setWidthF( penWidth );
setPen( framePen );
}
}
@@ -47,8 +47,9 @@ void QgsComposerLabel::paint( QPainter* painter, const QStyleOptionGraphicsItem*
double penWidth = pen().widthF();
QRectF painterRect( penWidth + mMargin, penWidth + mMargin, rect().width() - 2 * penWidth - 2 * mMargin,
rect().height() - 2 * penWidth - 2 * mMargin );
//painter->drawText( painterRect, Qt::AlignLeft | Qt::AlignTop | Qt::TextWordWrap, mText );
drawText( painter, painterRect, mText, mFont );


drawText( painter, painterRect, displayText(), mFont );

drawFrame( painter );
if ( isSelected() )
@@ -59,6 +60,9 @@ void QgsComposerLabel::paint( QPainter* painter, const QStyleOptionGraphicsItem*

void QgsComposerLabel::setText( const QString& text )
{
mText = text;

#if 0
//replace '$CURRENT_DATE<(FORMAT)>' with the current date
//e.g. $CURRENT_DATE(d 'June' yyyy)
mText = text;
@@ -79,6 +83,35 @@ void QgsComposerLabel::setText( const QString& text )
mText.replace( "$CURRENT_DATE", QDate::currentDate().toString() );
}
}
#endif //0
}

QString QgsComposerLabel::displayText() const
{
QString displayText = mText;
replaceDateText(displayText);
return displayText;
}

void QgsComposerLabel::replaceDateText(QString& text) const
{
int currentDatePos = text.indexOf( "$CURRENT_DATE" );
if ( currentDatePos != -1 )
{
//check if there is a bracket just after $CURRENT_DATE
QString formatText;
int openingBracketPos = text.indexOf( "(", currentDatePos );
int closingBracketPos = text.indexOf( ")", openingBracketPos + 1 );
if ( openingBracketPos != -1 && closingBracketPos != -1 && ( closingBracketPos - openingBracketPos ) > 1 )
{
formatText = text.mid( openingBracketPos + 1, closingBracketPos - openingBracketPos - 1 );
text.replace( currentDatePos, closingBracketPos - currentDatePos + 1, QDate::currentDate().toString( formatText ) );
}
else //no bracket
{
text.replace( "$CURRENT_DATE", QDate::currentDate().toString() );
}
}
}

void QgsComposerLabel::setFont( const QFont& f )
@@ -88,7 +121,7 @@ void QgsComposerLabel::setFont( const QFont& f )

void QgsComposerLabel::adjustSizeToText()
{
double textWidth = textWidthMillimeters( mFont, mText );
double textWidth = textWidthMillimeters( mFont, displayText() );
double fontAscent = fontAscentMillimeters( mFont );

setSceneRect( QRectF( transform().dx(), transform().dy(), textWidth + 2 * mMargin + 2 * pen().widthF() + 1, \
@@ -36,6 +36,11 @@ class CORE_EXPORT QgsComposerLabel: public QgsComposerItem

QString text() {return mText;}
void setText( const QString& text );

/**Returns the text as it appears on screen (with replaced data field)
@note this function was added in version 1.2*/
QString displayText() const;

QFont font() const;
void setFont( const QFont& f );
double margin() {return mMargin;}
@@ -61,6 +66,9 @@ class CORE_EXPORT QgsComposerLabel: public QgsComposerItem

// Border between text and fram (in mm)
double mMargin;

/**Replaces replace '$CURRENT_DATE<(FORMAT)>' with the current date (e.g. $CURRENT_DATE(d 'June' yyyy)*/
void replaceDateText(QString& text) const;
};

#endif
@@ -242,6 +242,8 @@ void QgsComposerMap::paint( QPainter* painter, const QStyleOptionGraphicsItem* i
mDrawing = false;
}

painter->setClipRect( thisPaintRect , Qt::NoClip);

drawFrame( painter );
if ( isSelected() )
{

0 comments on commit 6360c46

Please sign in to comment.
You can’t perform that action at this time.