Skip to content

Commit

Permalink
Merge branch 'master' of github.com:qgis/Quantum-GIS
Browse files Browse the repository at this point in the history
  • Loading branch information
mhugent committed Aug 30, 2011
2 parents 6c0f56c + 5e4e4f7 commit 7f8d388
Show file tree
Hide file tree
Showing 11 changed files with 99 additions and 110 deletions.
4 changes: 2 additions & 2 deletions CMakeLists.txt
Expand Up @@ -18,8 +18,8 @@ MESSAGE(STATUS "Quantum GIS version: ${COMPLETE_VERSION} ${RELEASE_NAME} (${QGIS
#############################################################
# CMake settings

# 2.6 required for QtWebkit
CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
# 2.6.2 required for VERSION_LESS
CMAKE_MINIMUM_REQUIRED(VERSION 2.6.2)

SET(CMAKE_COLOR_MAKEFILE ON)

Expand Down
4 changes: 2 additions & 2 deletions cmake/FindQwt.cmake
Expand Up @@ -33,9 +33,9 @@ ENDIF (QWT_INCLUDE_DIR AND QWT_LIBRARY)

IF (QWT_FOUND)
FILE(READ ${QWT_INCLUDE_DIR}/qwt_global.h qwt_header)
STRING(REGEX REPLACE "^.*QWT_VERSION +(0x[0-9a-f]+).*$" "\\1" QWT_VERSION "${qwt_header}")
STRING(REGEX REPLACE "^.*QWT_VERSION_STR +\"([^\"]+)\".*$" "\\1" QWT_VERSION_STR "${qwt_header}")
IF (NOT QWT_FIND_QUIETLY)
MESSAGE(STATUS "Found Qwt: ${QWT_LIBRARY} (${QWT_VERSION})")
MESSAGE(STATUS "Found Qwt: ${QWT_LIBRARY} (${QWT_VERSION_STR})")
ENDIF (NOT QWT_FIND_QUIETLY)
ELSE (QWT_FOUND)
IF (QWT_FIND_REQUIRED)
Expand Down
9 changes: 1 addition & 8 deletions debian/rules
Expand Up @@ -10,7 +10,7 @@ DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)

DISTRIBUTION := $(shell dpkg-parsechangelog --format rfc822 | sed -ne "s/^Distribution: //p")
ifneq ($(DISTRIBUTION),$(findstring $(DISTRIBUTION),"lenny squeeze hardy intrepid jaunty karmic lucid maverick natty oneiric"))
ifneq ($(DISTRIBUTION),$(findstring $(DISTRIBUTION),"squeeze hardy intrepid jaunty karmic lucid maverick natty oneiric"))
DISTRIBUTION := sid
endif

Expand Down Expand Up @@ -123,11 +123,7 @@ clean: cleantemplates
install: build
dh_testdir
dh_testroot
ifneq (,$(findstring $(DISTRIBUTION),"lenny hardy"))
dh_clean -k
else
dh_prep
endif
dh_installdirs

# Add here commands to install the package into debian/tmp.
Expand Down Expand Up @@ -171,9 +167,6 @@ else
endif
dh_installmenu
dh_icons
ifneq (,$(findstring $(DISTRIBUTION),"lenny hardy"))
dh_desktop
endif
dh_installman -pqgis qgis.1 qbrowser.1
dh_installmime -pqgis
dh_link
Expand Down
6 changes: 3 additions & 3 deletions src/app/CMakeLists.txt
Expand Up @@ -255,7 +255,7 @@ SET (QGIS_APP_MOC_HDRS
)

IF(WITH_INTERNAL_QWTPOLAR)
IF(QWT_VERSION LESS 393216) # <6.0.0
IF(QWT_VERSION_STR VERSION_LESS "6.0.0")
SET(QGIS_APP_SRCS
${QGIS_APP_SRCS}
gps/qwtpolar-0.1/qwt_polar_canvas.cpp
Expand All @@ -282,7 +282,7 @@ IF(WITH_INTERNAL_QWTPOLAR)
)

SET(QWTPOLAR_INCLUDE_DIR gps/qwtpolar-0.1)
ELSE(QWT_VERSION LESS 393216)
ELSE(QWT_VERSION_STR VERSION_LESS "6.0.0")
SET(QGIS_APP_SRCS
${QGIS_APP_SRCS}
gps/qwtpolar-1.0/qwt_polar_canvas.cpp
Expand Down Expand Up @@ -312,7 +312,7 @@ IF(WITH_INTERNAL_QWTPOLAR)
)

SET(QWTPOLAR_INCLUDE_DIR gps/qwtpolar-1.0)
ENDIF(QWT_VERSION LESS 393216)
ENDIF(QWT_VERSION_STR VERSION_LESS "6.0.0")

SET(QWTPOLAR_LIBRARY "")
ENDIF(WITH_INTERNAL_QWTPOLAR)
Expand Down
28 changes: 18 additions & 10 deletions src/app/qgssnappingdialog.cpp
Expand Up @@ -90,16 +90,7 @@ QgsSnappingDialog::QgsSnappingDialog( QWidget* parent, QgsMapCanvas* canvas ): Q
mLayerTreeWidget->resizeColumnToContents( 4 );
mLayerTreeWidget->setSortingEnabled( true );

// read the digitizing settings
int topologicalEditing = QgsProject::instance()->readNumEntry( "Digitizing", "/TopologicalEditing", 0 );
if ( topologicalEditing != 0 )
{
cbxEnableTopologicalEditingCheckBox->setCheckState( Qt::Checked );
}
else
{
cbxEnableTopologicalEditingCheckBox->setCheckState( Qt::Unchecked );
}
setTopologicalEditingState();
}

QgsSnappingDialog::QgsSnappingDialog()
Expand Down Expand Up @@ -182,6 +173,7 @@ void QgsSnappingDialog::apply()

void QgsSnappingDialog::show()
{
setTopologicalEditingState();
if ( mDock )
mDock->setVisible( true );
else
Expand Down Expand Up @@ -321,3 +313,19 @@ void QgsSnappingDialog::layerWillBeRemoved( QString theLayerId )
if ( item )
delete item;
}

void QgsSnappingDialog::setTopologicalEditingState()
{
// read the digitizing settings
int topologicalEditing = QgsProject::instance()->readNumEntry( "Digitizing", "/TopologicalEditing", 0 );
cbxEnableTopologicalEditingCheckBox->blockSignals( true );
if ( topologicalEditing != 0 )
{
cbxEnableTopologicalEditingCheckBox->setCheckState( Qt::Checked );
}
else
{
cbxEnableTopologicalEditingCheckBox->setCheckState( Qt::Unchecked );
}
cbxEnableTopologicalEditingCheckBox->blockSignals( false );
}
3 changes: 3 additions & 0 deletions src/app/qgssnappingdialog.h
Expand Up @@ -77,6 +77,9 @@ class QgsSnappingDialog: public QDialog, private Ui::QgsSnappingDialogBase
QgsMapCanvas* mMapCanvas;

QDockWidget *mDock;

/**Set checkbox value based on project setting*/
void setTopologicalEditingState();
};

#endif
11 changes: 7 additions & 4 deletions src/core/qgsexpression.cpp
Expand Up @@ -806,7 +806,7 @@ QVariant QgsExpression::NodeInOperator::eval( QgsExpression* parent, QgsFeature*

bool QgsExpression::NodeInOperator::prepare( QgsExpression* parent, const QgsFieldMap& fields )
{
bool res = true;
bool res = mNode->prepare( parent, fields );
foreach( Node* n, mList->list() )
{
res = res && n->prepare( parent, fields );
Expand Down Expand Up @@ -850,9 +850,12 @@ QVariant QgsExpression::NodeFunction::eval( QgsExpression* parent, QgsFeature* f
bool QgsExpression::NodeFunction::prepare( QgsExpression* parent, const QgsFieldMap& fields )
{
bool res = true;
foreach( Node* n, mArgs->list() )
if ( mArgs )
{
res = res && n->prepare( parent, fields );
foreach( Node* n, mArgs->list() )
{
res = res && n->prepare( parent, fields );
}
}
return res;
}
Expand All @@ -863,7 +866,7 @@ QString QgsExpression::NodeFunction::dump() const
if ( fd.mParams == 0 )
return fd.mName; // special column
else
return QString( "%1(%2)" ).arg( fd.mName ).arg( mArgs->dump() ); // function
return QString( "%1(%2)" ).arg( fd.mName ).arg( mArgs ? mArgs->dump() : QString() ); // function
}

//
Expand Down
4 changes: 1 addition & 3 deletions src/core/qgsexpressionlexer.ll
Expand Up @@ -45,10 +45,8 @@

#define B_OP(x) exp_lval.b_op = QgsExpression::x
#define U_OP(x) exp_lval.u_op = QgsExpression::x
//#define TEXT exp_lval.text = new QString(); *exp_lval.text = QString::fromUtf8(yytext);
#define TEXT exp_lval.text = new QString(); *exp_lval.text = QString::fromUtf8(yytext);
#define TEXT_FILTER(filter_fn) exp_lval.text = new QString(); *exp_lval.text = filter_fn( QString::fromUtf8(yytext) );
#define TEXT TEXT_FILTER()


static QString stripText(QString text)
{
Expand Down
133 changes: 58 additions & 75 deletions src/mapserver/qgsprojectparser.cpp
Expand Up @@ -104,32 +104,19 @@ void QgsProjectParser::layersAndStylesCapabilities( QDomElement& parentElement,
layerParentTitleElem.appendChild( layerParentTitleText );
layerParentElem.appendChild( layerParentTitleElem );

QStringList crsList = createCRSListForLayer( 0 );
appendCRSElementsToLayer( layerParentElem, doc, crsList );

//Map rectangle. If not empty, this will be set for every layer (instead of the bbox that comes from the data)
QgsRectangle mapExtent = mapRectangle();
QgsCoordinateReferenceSystem mapCRS;
if ( !mapExtent.isEmpty() )
{
mapCRS.createFromOgcWmsCrs( mapAuthid() );
appendExGeographicBoundingBox( layerParentElem, doc, mapExtent, mapCRS );
}

QDomElement legendElem = mXMLDoc->documentElement().firstChildElement( "legend" );

addLayers( doc, layerParentElem, legendElem, layerMap, nonIdentifiableLayers, mapExtent, mapCRS );
addLayers( doc, layerParentElem, legendElem, layerMap, nonIdentifiableLayers );

parentElement.appendChild( layerParentElem );
combineExtentAndCrsOfGroupChildren( layerParentElem, doc );
}

void QgsProjectParser::addLayers( QDomDocument &doc,
QDomElement &parentElem,
const QDomElement &legendElem,
const QMap<QString, QgsMapLayer *> &layerMap,
const QStringList &nonIdentifiableLayers,
const QgsRectangle &mapExtent,
const QgsCoordinateReferenceSystem &mapCRS ) const
const QStringList &nonIdentifiableLayers ) const
{
QDomNodeList legendChildren = legendElem.childNodes();
for ( int i = 0; i < legendChildren.size(); ++i )
Expand Down Expand Up @@ -183,63 +170,16 @@ void QgsProjectParser::addLayers( QDomDocument &doc,
pLayerMap.insert( layerId( *pLayerIt ), p->createLayerFromElement( *pLayerIt ) );
}

p->addLayers( doc, layerElem, embeddedGroupElem, pLayerMap, pIdDisabled, mapExtent, mapCRS );
p->addLayers( doc, layerElem, embeddedGroupElem, pLayerMap, pIdDisabled );
}
}
else //normal (not embedded) legend group
{
addLayers( doc, layerElem, currentChildElem, layerMap, nonIdentifiableLayers, mapExtent, mapCRS );
}

// combine bounding boxes of childs (groups/layers)

QgsRectangle combinedGeographicBBox;
QSet<QString> combinedCRSSet;
bool firstBBox = true;
bool firstCRSSet = true;

QDomNodeList layerChildren = layerElem.childNodes();
for ( int j = 0; j < layerChildren.size(); ++j )
{
QDomElement childElem = layerChildren.at( j ).toElement();

if ( childElem.tagName() != "Layer" )
continue;

QgsRectangle bbox;
if ( exGeographicBoundingBox( childElem, bbox ) )
{
if ( firstBBox )
{
combinedGeographicBBox = bbox;
firstBBox = false;
}
else
{
combinedGeographicBBox.combineExtentWith( &bbox );
}
}

//combine crs set
QSet<QString> crsSet;
if ( crsSetForLayer( childElem, crsSet ) )
{
if ( firstCRSSet )
{
combinedCRSSet = crsSet;
firstCRSSet = false;
}
else
{
combinedCRSSet.intersect( crsSet );
}
}
addLayers( doc, layerElem, currentChildElem, layerMap, nonIdentifiableLayers );
}

appendCRSElementsToLayer( layerElem, doc, combinedCRSSet.toList() );

const QgsCoordinateReferenceSystem& groupCRS = QgsEPSGCache::instance()->searchCRS( GEO_EPSG_CRS_ID );
appendExGeographicBoundingBox( layerElem, doc, combinedGeographicBBox, groupCRS );
// combine bounding boxes of children (groups/layers)
combineExtentAndCrsOfGroupChildren( layerElem, doc );
}
else if ( currentChildElem.tagName() == "legendlayer" )
{
Expand Down Expand Up @@ -284,14 +224,7 @@ void QgsProjectParser::addLayers( QDomDocument &doc,
appendCRSElementsToLayer( layerElem, doc, crsList );

//Ex_GeographicBoundingBox
if ( mapExtent.isEmpty() )
{
appendExGeographicBoundingBox( layerElem, doc, currentLayer->extent(), currentLayer->crs() );
}
else
{
appendExGeographicBoundingBox( layerElem, doc, mapExtent, mapCRS );
}
appendExGeographicBoundingBox( layerElem, doc, currentLayer->extent(), currentLayer->crs() );

//only one default style in project file mode
QDomElement styleElem = doc.createElement( "Style" );
Expand All @@ -315,6 +248,56 @@ void QgsProjectParser::addLayers( QDomDocument &doc,
}
}

void QgsProjectParser::combineExtentAndCrsOfGroupChildren( QDomElement& groupElem, QDomDocument& doc ) const
{
QgsRectangle combinedGeographicBBox;
QSet<QString> combinedCRSSet;
bool firstBBox = true;
bool firstCRSSet = true;

QDomNodeList layerChildren = groupElem.childNodes();
for ( int j = 0; j < layerChildren.size(); ++j )
{
QDomElement childElem = layerChildren.at( j ).toElement();

if ( childElem.tagName() != "Layer" )
continue;

QgsRectangle bbox;
if ( exGeographicBoundingBox( childElem, bbox ) )
{
if ( firstBBox )
{
combinedGeographicBBox = bbox;
firstBBox = false;
}
else
{
combinedGeographicBBox.combineExtentWith( &bbox );
}
}

//combine crs set
QSet<QString> crsSet;
if ( crsSetForLayer( childElem, crsSet ) )
{
if ( firstCRSSet )
{
combinedCRSSet = crsSet;
firstCRSSet = false;
}
else
{
combinedCRSSet.intersect( crsSet );
}
}
}

appendCRSElementsToLayer( groupElem, doc, combinedCRSSet.toList() );

const QgsCoordinateReferenceSystem& groupCRS = QgsEPSGCache::instance()->searchCRS( GEO_EPSG_CRS_ID );
appendExGeographicBoundingBox( groupElem, doc, combinedGeographicBBox, groupCRS );
}

QList<QgsMapLayer*> QgsProjectParser::mapLayerFromStyle( const QString& lName, const QString& styleName, bool allowCaching ) const
{
Expand Down
6 changes: 3 additions & 3 deletions src/mapserver/qgsprojectparser.h
Expand Up @@ -136,9 +136,9 @@ class QgsProjectParser: public QgsConfigParser
QDomElement &parentLayer,
const QDomElement &legendElem,
const QMap<QString, QgsMapLayer *> &layerMap,
const QStringList &nonIdentifiableLayers,
const QgsRectangle &mapExtent,
const QgsCoordinateReferenceSystem &mapCRS ) const;
const QStringList &nonIdentifiableLayers ) const;

void combineExtentAndCrsOfGroupChildren( QDomElement& groupElement, QDomDocument& doc ) const;

/**Returns dom element of composer (identified by composer title) or a null element in case of error*/
QDomElement composerByName( const QString& composerName ) const;
Expand Down
1 change: 1 addition & 0 deletions src/mapserver/qgswmsserver.cpp
Expand Up @@ -1221,6 +1221,7 @@ int QgsWMSServer::featureInfoFromVectorLayer( QgsVectorLayer* layer,
provider->select( provider->attributeIndexes(), searchRect, addWktGeometry || featureBBox, true );
while ( provider->nextFeature( feature ) )
{
++featureCounter;
if ( featureCounter > nFeatures )
{
break;
Expand Down

0 comments on commit 7f8d388

Please sign in to comment.