[FEATURE] add support for nested layers

git-svn-id: http://svn.osgeo.org/qgis/trunk@14394 c8812cc2-4d05-0410-92ff-de0c093fc19c
This commit is contained in:
jef 2010-10-18 00:13:51 +00:00
parent aacf2f7dfd
commit 0c5ebf7cee
40 changed files with 958 additions and 993 deletions

File diff suppressed because it is too large Load Diff

View File

@ -20,10 +20,9 @@
#ifndef QGSLEGEND_H
#define QGSLEGEND_H
#include <deque>
#include <map>
#include <set>
#include <QTreeWidget>
#include <QPair>
#include <set>
class QgsLegendGroup;
class QgsLegendLayer;
@ -89,7 +88,6 @@ class QgsLegend : public QTreeWidget
// declaration was public while the definition was private
class QgsLegendPixmaps;
public:
/*! Constructor.
* @param qgis_app link to qgisapp
@ -162,7 +160,7 @@ class QgsLegend : public QTreeWidget
void removeItem( QTreeWidgetItem* item );
/**Returns the ids of the layers contained in this legend. The order is bottom->top*/
std::deque<QString> layerIDs();
QStringList layerIDs();
/**Updates layer set of map canvas*/
void updateMapCanvasLayerSet();
@ -191,9 +189,10 @@ class QgsLegend : public QTreeWidget
/**Returns a layers check state*/
Qt::CheckState layerCheckState( QgsMapLayer * layer );
void updateCheckStates( QTreeWidgetItem* item, Qt::CheckState state ) { item->setData( 0, Qt::UserRole, state ); }
void updateGroupCheckStates( QTreeWidgetItem *item );
public slots:
/*!Adds a new layer group with the maplayer to the canvas*/
@ -270,6 +269,7 @@ class QgsLegend : public QTreeWidget
/** Remove selected layers */
void removeSelectedLayers();
protected:
/*!Event handler for mouse movements.
@ -312,13 +312,6 @@ class QgsLegend : public QTreeWidget
void mouseReleaseEvent( QMouseEvent * e );
void mouseDoubleClickEvent( QMouseEvent* e );
/**Stores the necessary information about the position of an item in the hierarchy. Afterwards,
this item may be moved back to the original position with resetToInitialPosition()*/
void storeInitialPosition( QTreeWidgetItem* li );
/**Moves an item back to the position where storeInitialPosition has been called*/
void resetToInitialPosition( QTreeWidgetItem* li );
/**Returns the legend layer to which a map layer belongs to*/
QgsLegendLayer* findLegendLayer( const QString& layerKey );
@ -334,18 +327,23 @@ class QgsLegend : public QTreeWidget
/**This function compares the layer order before a drag with the current layer ordering and triggers a canvas repaint if it has changed*/
bool checkLayerOrderUpdate();
/**The target that the mouse is over when dragging */
// mouse is pressed
bool mMousePressedFlag;
// position of mouse when it is pressed at the start of a drag event.
QPoint mLastPressPos;
// layer our prior to move
QStringList mLayersPriorToMove;
// keep track of the items being dragged
QList< QTreeWidgetItem * > mItemsBeingMoved;
// The target that the mouse is over when dragging
QTreeWidgetItem *mDropTarget;
enum DROP_ACTION_TYPE
{
BEFORE,
AFTER,
INTO_GROUP,
NO_ACTION
};
/** Set when mouse is moved over different kind of items, depending opn what they accept() */
DROP_ACTION_TYPE mDropAction;
// The action when the mouse is released
enum { BEFORE, INSERT, AFTER } mDropAction;
/** Hide the line that indicates insertion position */
void hideLine();
@ -374,8 +372,8 @@ class QgsLegend : public QTreeWidget
void expandAll();
/**Sets all listview items to closed*/
void collapseAll();
/**Just for a test*/
void handleItemChange( QTreeWidgetItem* item, int row );
void propagateItemChange( QTreeWidgetItem *item, Qt::CheckState state );
/** delegates current layer to map canvas */
void handleCurrentItemChanged( QTreeWidgetItem* current, QTreeWidgetItem* previous );
/**Calls openPersistentEditor for the current item*/
@ -384,6 +382,8 @@ class QgsLegend : public QTreeWidget
void makeToTopLevelItem();
private:
bool readXML( QgsLegendGroup *parent, const QDomNode &node );
bool writeXML( QList<QTreeWidgetItem *> items, QDomNode &node, QDomDocument &document );
/*! Prevent the copying of QgsLegends
* @todo See if this is really required - we may want multiple map, canvas and
@ -398,38 +398,6 @@ class QgsLegend : public QTreeWidget
*/
QgsLegend & operator=( QgsLegend const & );
/*!
* Position of mouse when it is pressed at the start of a drag event.
*/
QPoint mLastPressPos;
/**True if the mouse is pressed*/
bool mMousePressedFlag;
/// keep track of the Item being dragged
QTreeWidgetItem* mItemBeingMoved;
/*!
* Position in the list of the item being moved as it was at the start of a drag event.
* An item at the top of the list will be 0 and each successive item below it
* will be 1,2 3 etc... regardless of nesting level.
*/
int mItemBeingMovedOrigPos;
/**Information needed by 'storeInitialPosition' and 'resetToInitialPosition'*/
enum HIERARCHY_POSITION_TYPE
{
FIRST_ITEM,
FIRST_CHILD,
YOUNGER_SIBLING
};
HIERARCHY_POSITION_TYPE mRestoreInformation;
QTreeWidgetItem* mRestoreItem;
/**Stores the layer ordering before a mouse Move. After the move, this is used to
decide if the mapcanvas really has to be refreshed*/
std::deque<QString> mLayersPriorToMove;
/*!
* A function to determine how far down in the list an item is (starting with one for the first Item).
*If the item is not in the legend, -1 is returned
@ -472,6 +440,10 @@ class QgsLegend : public QTreeWidget
//! Widget that holds the indicator line //
QWidget *mInsertionLine;
#ifdef QGISDEBUG
void showItem( QString msg, QTreeWidgetItem *item );
#endif
signals:
void itemMoved( QModelIndex oldIndex, QModelIndex newIndex );

View File

@ -57,47 +57,10 @@ QgsLegendGroup::~QgsLegendGroup()
{}
bool QgsLegendGroup::isLeafNode()
{
return mLeafNodeFlag;
}
QgsLegendItem::DRAG_ACTION QgsLegendGroup::accept( LEGEND_ITEM_TYPE type )
{
if ( type == LEGEND_GROUP )
{
return REORDER;
}
if ( type == LEGEND_LAYER )
{
return INSERT;
}
else
{
return NO_ACTION;
}
}
QgsLegendItem::DRAG_ACTION QgsLegendGroup::accept( const QgsLegendItem* li ) const
{
if ( li )
{
LEGEND_ITEM_TYPE type = li->type();
if ( type == LEGEND_GROUP )
{
return REORDER;
}
if ( type == LEGEND_LAYER )
{
return INSERT;
}
}
return NO_ACTION;
}
bool QgsLegendGroup::insert( QgsLegendItem* theItem )
{
if ( theItem->type() == LEGEND_LAYER )
if ( theItem->type() == LEGEND_GROUP ||
theItem->type() == LEGEND_LAYER )
{
// Always insert at top of list
insertChild( 0, theItem );
@ -107,15 +70,24 @@ bool QgsLegendGroup::insert( QgsLegendItem* theItem )
return true;
}
std::list<QgsLegendLayer*> QgsLegendGroup::legendLayers()
QList<QgsLegendLayer*> QgsLegendGroup::legendLayers( bool recurse )
{
std::list<QgsLegendLayer*> result;
QList<QgsLegendLayer*> result;
for ( int i = 0; i < childCount(); ++i )
{
QgsLegendLayer* childItem = dynamic_cast<QgsLegendLayer *>( child( i ) );
if ( childItem )
QgsLegendLayer *layer = dynamic_cast<QgsLegendLayer *>( child( i ) );
if ( layer )
{
result.push_back( childItem );
result.push_back( layer );
}
if ( !recurse )
continue;
QgsLegendGroup *group = dynamic_cast<QgsLegendGroup *>( child( i ) );
if ( group )
{
result << group->legendLayers( true );
}
}
return result;
@ -123,17 +95,28 @@ std::list<QgsLegendLayer*> QgsLegendGroup::legendLayers()
void QgsLegendGroup::updateCheckState()
{
std::list<QgsLegendLayer*> llayers = legendLayers();
if ( llayers.size() == 0 )
QList<QgsLegendItem *> elements;
for ( int i = 0; i < childCount(); i++ )
{
return;
QgsLegendItem *li = dynamic_cast<QgsLegendItem *>( child( i ) );
if ( !li )
continue;
if ( dynamic_cast<QgsLegendGroup *>( li ) || dynamic_cast<QgsLegendLayer *>( li ) )
{
elements << li;
}
}
std::list<QgsLegendLayer*>::iterator iter = llayers.begin();
Qt::CheckState theState = ( *iter )->checkState( 0 );
for ( ; iter != llayers.end(); ++iter )
if ( elements.isEmpty() )
return;
Qt::CheckState theState = elements[0]->checkState( 0 );
foreach( QgsLegendItem *li, elements )
{
if ( theState != ( *iter )->checkState( 0 ) )
if ( theState != li->checkState( 0 ) )
{
theState = Qt::PartiallyChecked;
break;

View File

@ -37,12 +37,9 @@ class QgsLegendGroup : public QgsLegendItem
QgsLegendGroup( QString name );
~QgsLegendGroup();
QgsLegendItem::DRAG_ACTION accept( LEGEND_ITEM_TYPE type );
QgsLegendItem::DRAG_ACTION accept( const QgsLegendItem* li ) const;
bool isLeafNode();
bool insert( QgsLegendItem* theItem );
/**Returns all legend layers under this group*/
std::list<QgsLegendLayer*> legendLayers();
/**Returns all legend layers under this group (including those of subgroups by default)*/
QList<QgsLegendLayer*> legendLayers( bool recurse = true );
/**Goes through all the legendlayers and sets check state to checked/partially checked/unchecked*/
void updateCheckState();
};

View File

@ -62,13 +62,8 @@ class QgsLegendItem : public QTreeWidgetItem, public QObject
NO_ACTION //do nothing
};
virtual bool isLeafNode() = 0;
virtual LEGEND_ITEM_TYPE type() const {return mType;}
/**Returns the type of action that will be done if a drag, originating at a certain
item type, will be released at this item*/
virtual DRAG_ACTION accept( LEGEND_ITEM_TYPE type ) = 0;
/**Retrns the type of action that will be done if a legend item is dragged over this item*/
virtual DRAG_ACTION accept( const QgsLegendItem* li ) const = 0;
/**Subclasses which allow insertion of other items may implement this method.
@param theItem legend item to insert into this item
@param changesettings Some insert actions may change the state of the layers or the map canvas.
@ -111,7 +106,6 @@ class QgsLegendItem : public QTreeWidgetItem, public QObject
virtual void release( QgsLegendItem* formerChild ) {}
protected:
bool mLeafNodeFlag;
LEGEND_ITEM_TYPE mType;
/**Stores expanded property when storeAppearanceSettings is called*/
bool mExpanded;

View File

@ -99,48 +99,6 @@ void QgsLegendLayer::setupFont() //private method
setFont( 0, myFont );
}
bool QgsLegendLayer::isLeafNode()
{
return false;
}
QgsLegendItem::DRAG_ACTION QgsLegendLayer::accept( LEGEND_ITEM_TYPE type )
{
if ( type == LEGEND_LAYER || type == LEGEND_GROUP )
{
return REORDER;
}
else
{
return NO_ACTION;
}
}
QgsLegendItem::DRAG_ACTION QgsLegendLayer::accept( const QgsLegendItem* li ) const
{
if ( li && li != this )
{
LEGEND_ITEM_TYPE type = li->type();
if ( type == LEGEND_LAYER )
{
//if(parent() == li->parent())
//{
return REORDER;
//}
}
else if ( type == LEGEND_GROUP )
{
//only parent legend layers can change positions with groups
if ( parent() == 0 )
{
return REORDER;
}
}
}
return NO_ACTION;
}
QgsMapLayer* QgsLegendLayer::layer()
{
return mLyr.layer();
@ -456,6 +414,7 @@ void QgsLegendLayer::addToPopupMenu( QMenu& theMenu )
saveSelectionAsAction->setEnabled( false );
}
if ( !vlayer->isEditable() && vlayer->dataProvider()->supportsSubsetString() )
theMenu.addAction( tr( "&Query..." ), QgisApp::instance(), SLOT( layerSubsetString() ) );
theMenu.addSeparator();

View File

@ -48,9 +48,6 @@ class QgsLegendLayer : public QgsLegendItem
QgsLegendLayer( QgsMapLayer* layer );
~QgsLegendLayer();
bool isLeafNode();
QgsLegendItem::DRAG_ACTION accept( LEGEND_ITEM_TYPE type );
QgsLegendItem::DRAG_ACTION accept( const QgsLegendItem* li ) const;
/**Returns the map layer associated the item*/
QgsMapLayer* layer();
QgsMapCanvasLayer& canvasLayer();

View File

@ -37,14 +37,3 @@ QgsLegendPropertyGroup::~QgsLegendPropertyGroup()
{
}
QgsLegendItem::DRAG_ACTION QgsLegendPropertyGroup::accept( LEGEND_ITEM_TYPE type )
{
return NO_ACTION;
}
QgsLegendItem::DRAG_ACTION QgsLegendPropertyGroup::accept( const QgsLegendItem* li ) const
{
return NO_ACTION;
}

View File

@ -34,9 +34,6 @@ class QgsLegendPropertyGroup : public QgsLegendItem
~QgsLegendPropertyGroup();
bool isLeafNode() {return mLeafNodeFlag;}
DRAG_ACTION accept( LEGEND_ITEM_TYPE type );
QgsLegendItem::DRAG_ACTION accept( const QgsLegendItem* li ) const;
/** Overloads cmpare function of QListViewItem
* @note The property group must always be the first in the list
*/

View File

@ -34,15 +34,3 @@ QgsLegendPropertyItem::~QgsLegendPropertyItem()
{
mType = LEGEND_PROPERTY_ITEM;
}
QgsLegendItem::DRAG_ACTION QgsLegendPropertyItem::accept( LEGEND_ITEM_TYPE type )
{
return NO_ACTION;
}
QgsLegendItem::DRAG_ACTION QgsLegendPropertyItem::accept( const QgsLegendItem* li ) const
{
return NO_ACTION;
}

View File

@ -31,12 +31,7 @@ class QgsLegendPropertyItem : public QgsLegendItem
{
public:
QgsLegendPropertyItem( QTreeWidgetItem * theItem, QString theString );
~QgsLegendPropertyItem();
bool isLeafNode() {return mLeafNodeFlag;}
DRAG_ACTION accept( LEGEND_ITEM_TYPE type );
QgsLegendItem::DRAG_ACTION accept( const QgsLegendItem* li ) const;
};
#endif

View File

@ -37,16 +37,6 @@ QgsLegendSymbologyGroup::QgsLegendSymbologyGroup( QTreeWidgetItem * theItem, QSt
QgsLegendSymbologyGroup::~QgsLegendSymbologyGroup()
{}
QgsLegendItem::DRAG_ACTION QgsLegendSymbologyGroup::accept( LEGEND_ITEM_TYPE type )
{
return NO_ACTION;
}
QgsLegendItem::DRAG_ACTION QgsLegendSymbologyGroup::accept( const QgsLegendItem* li ) const
{
return NO_ACTION;
}
/** Overloads cmpare function of QListViewItem
* @note The symbology group must always be the second in the list
*/

View File

@ -32,9 +32,7 @@ class QgsLegendSymbologyGroup : public QgsLegendItem
public:
QgsLegendSymbologyGroup( QTreeWidgetItem * theItem, QString theString );
~QgsLegendSymbologyGroup();
bool isLeafNode() {return false;}
DRAG_ACTION accept( LEGEND_ITEM_TYPE type );
QgsLegendItem::DRAG_ACTION accept( const QgsLegendItem* li ) const;
/** Overloads cmpare function of QListViewItem
* @note The symbology group must always be the second in the list
*/

View File

@ -49,16 +49,6 @@ QgsLegendSymbologyItem::~QgsLegendSymbologyItem()
}
}
QgsLegendItem::DRAG_ACTION QgsLegendSymbologyItem::accept( LEGEND_ITEM_TYPE type )
{
return NO_ACTION;
}
QgsLegendItem::DRAG_ACTION QgsLegendSymbologyItem::accept( const QgsLegendItem* li ) const
{
return NO_ACTION;
}
void QgsLegendSymbologyItem::setLegend( QgsLegend* theLegend )
{
mLegend = theLegend;

View File

@ -33,8 +33,6 @@ class QgsLegendSymbologyItem : public QgsLegendItem
QgsLegendSymbologyItem( int pixmapWidth, int pixmapHeight );
~QgsLegendSymbologyItem();
bool isLeafNode() {return true;}
DRAG_ACTION accept( LEGEND_ITEM_TYPE type );
QgsLegendItem::DRAG_ACTION accept( const QgsLegendItem* li ) const;
int pixmapWidth() const {return mPixmapWidth;}
int pixmapHeight() const {return mPixmapHeight;}
void setLegend( QgsLegend* theLegend );

View File

@ -18,7 +18,7 @@
#ifndef QGSLEGENDVECTORSYMBOLOGYITEM_H
#define QGSLEGENDVECTORSYMBOLOGYITEM_H
#include <list>
#include <QList>
#include "qgslegendsymbologyitem.h"
class QgsSymbol;
@ -33,7 +33,7 @@ class QgsLegendVectorSymbologyItem: public QgsLegendSymbologyItem
void handleDoubleClickEvent();
private:
/**Collection of pointers to the vector layer symbols associated with this item*/
std::list<QgsSymbol*> mSymbols;
QList<QgsSymbol*> mSymbols;
};
#endif

View File

@ -85,7 +85,7 @@ class CORE_EXPORT QgsComposition: public QGraphicsScene
void setGridStyle( GridStyle s );
GridStyle gridStyle() const {return mGridStyle;}
/**Returns the topmose composer item. Ignores mPaperItem*/
/**Returns the topmost composer item. Ignores mPaperItem*/
QgsComposerItem* composerItemAt( const QPointF & position );
QList<QgsComposerItem*> selectedComposerItems();

View File

@ -101,10 +101,10 @@ QString QgsMapLayer::getLayerID() const
}
/** Write property of QString layerName. */
void QgsMapLayer::setLayerName( const QString & _newVal )
void QgsMapLayer::setLayerName( const QString & name )
{
QgsDebugMsg( "new name is '" + _newVal + "'" );
mLayerName = capitaliseLayerName( _newVal );
QgsDebugMsg( "new name is '" + name + "'" );
mLayerName = capitaliseLayerName( name );
emit layerNameChanged();
}
@ -763,7 +763,6 @@ QString QgsMapLayer::saveNamedStyle( const QString theURI, bool & theResultFlag
}
else
{
// try an update
theResultFlag = false;
myErrorMessage = tr( "The style %1 could not be inserted into database." ).arg( theURI );
}

View File

@ -744,13 +744,12 @@ bool QgsProject::read( QFileInfo const &file )
imp_->file.setFileName( file.filePath() );
return read();
} // QgsProject::read( QFile & file )
} // QgsProject::read
/*
@note it's presumed that the caller has already reset the map canvas, map
registry, and legend
@note it's presumed that the caller has already reset the map canvas, map registry, and legend
*/
bool QgsProject::read()
{
@ -775,9 +774,10 @@ bool QgsProject::read()
if ( !doc->setContent( &imp_->file, &errorMsg, &line, &column ) )
{
// want to make this class as GUI independent as possible; so commented out
// QMessageBox::critical( 0x0, "Project File Read Error",
// errorMsg + " at line " + QString::number( line ) +
// " column " + QString::number( column ) );
#if 0
QMessageBox::critical( 0, tr( "Project File Read Error" ),
tr( "%1 at line %2 column %3" ).arg( errorMsg ).arg( line ).arg( column ) );
#endif
QString errorString = tr( "Project file read error: %1 at line %2 column %3" )
.arg( errorMsg ).arg( line ).arg( column );

View File

@ -375,7 +375,7 @@ bool QgsSearchTreeNode::needsGeometry()
}
}
bool QgsSearchTreeNode::checkAgainst( const QMap<int, QgsField>& fields, const QMap<int, QVariant>& attributes, QgsGeometry* geom )
bool QgsSearchTreeNode::checkAgainst( const QgsFieldMap& fields, const QgsAttributeMap &attributes, QgsGeometry* geom )
{
QgsFeature f;
f.setAttributeMap( attributes );
@ -524,7 +524,11 @@ bool QgsSearchTreeNode::checkAgainst( const QgsFieldMap& fields, QgsFeature &f )
return false;
}
bool QgsSearchTreeNode::getValue( QgsSearchTreeValue& value, QgsSearchTreeNode* node, const QgsFieldMap& fields, const QMap<int, QVariant>& attributes, QgsGeometry* geom )
bool QgsSearchTreeNode::getValue( QgsSearchTreeValue& value,
QgsSearchTreeNode* node,
const QgsFieldMap &fields,
const QgsAttributeMap &attributes,
QgsGeometry* geom )
{
QgsFeature f;
f.setAttributeMap( attributes );
@ -533,7 +537,10 @@ bool QgsSearchTreeNode::getValue( QgsSearchTreeValue& value, QgsSearchTreeNode*
return getValue( value, node, fields, f );
}
bool QgsSearchTreeNode::getValue( QgsSearchTreeValue& value, QgsSearchTreeNode* node, const QgsFieldMap& fields, QgsFeature &f )
bool QgsSearchTreeNode::getValue( QgsSearchTreeValue& value,
QgsSearchTreeNode* node,
const QgsFieldMap& fields,
QgsFeature &f )
{
value = node->valueAgainst( fields, f );
if ( value.isError() )
@ -563,7 +570,9 @@ bool QgsSearchTreeNode::getValue( QgsSearchTreeValue& value, QgsSearchTreeNode*
return true;
}
QgsSearchTreeValue QgsSearchTreeNode::valueAgainst( const QgsFieldMap& fields, const QMap<int, QVariant>& attributes, QgsGeometry* geom )
QgsSearchTreeValue QgsSearchTreeNode::valueAgainst( const QgsFieldMap& fields,
const QgsAttributeMap &attributes,
QgsGeometry* geom )
{
QgsFeature f;
f.setAttributeMap( attributes );

View File

@ -151,7 +151,7 @@ class CORE_EXPORT QgsSearchTreeNode
bool checkAgainst( const QgsFieldMap& fields, QgsFeature &f );
//! @note deprecated
bool checkAgainst( const QMap<int, QgsField>& fields, const QMap<int, QVariant>& attributes, QgsGeometry* geom = 0 );
bool checkAgainst( const QgsFieldMap& fields, const QgsAttributeMap& attributes, QgsGeometry* geom = 0 );
//! checks if there were errors during evaluation
bool hasError() { return ( !mError.isEmpty() ); }
@ -161,12 +161,17 @@ class CORE_EXPORT QgsSearchTreeNode
//! wrapper around valueAgainst()
//! @note added in 1.4
bool getValue( QgsSearchTreeValue& value, QgsSearchTreeNode* node,
const QgsFieldMap& fields, QgsFeature &f );
bool getValue( QgsSearchTreeValue& value,
QgsSearchTreeNode* node,
const QgsFieldMap& fields,
QgsFeature &f );
//! @note deprecated
bool getValue( QgsSearchTreeValue& value, QgsSearchTreeNode* node,
const QMap<int, QgsField>& fields, const QMap<int, QVariant>& attributes, QgsGeometry* geom = 0 );
bool getValue( QgsSearchTreeValue& value,
QgsSearchTreeNode* node,
const QgsFieldMap &fields,
const QgsAttributeMap &attributes,
QgsGeometry* geom = 0 );
//! return a list of referenced columns in the tree
//! @note added in 1.5
@ -202,7 +207,7 @@ class CORE_EXPORT QgsSearchTreeNode
QgsSearchTreeValue valueAgainst( const QgsFieldMap& fields, QgsFeature &f );
//! @note deprecated
QgsSearchTreeValue valueAgainst( const QMap<int, QgsField>& fields, const QMap<int, QVariant>& attributes, QgsGeometry* geom = 0 );
QgsSearchTreeValue valueAgainst( const QgsFieldMap& fields, const QgsAttributeMap& attributes, QgsGeometry* geom = 0 );
//! strips mText when node is of string type
void stripText();

View File

@ -74,7 +74,6 @@ class GUI_EXPORT QgsLegendInterface : public QObject
virtual bool isLayerVisible( QgsMapLayer * ml ) = 0;
signals:
//! emitted when a group index has changed
void groupIndexChanged( int oldIndex, int newIndex );

View File

@ -13,10 +13,8 @@ QgsProjectBadLayerGuiHandler::QgsProjectBadLayerGuiHandler()
{
}
void QgsProjectBadLayerGuiHandler::handleBadLayers( QList<QDomNode> layers, QDomDocument projectDom )
{
QgsDebugMsg( QString( "%1 bad layers found" ).arg( layers.size() ) );
// make sure we have arrow cursor (and not a wait cursor)
@ -39,7 +37,6 @@ void QgsProjectBadLayerGuiHandler::handleBadLayers( QList<QDomNode> layers, QDom
QApplication::restoreOverrideCursor();
}
QgsProjectBadLayerGuiHandler::DataType QgsProjectBadLayerGuiHandler::dataType( QDomNode & layerNode )
{
QString type = layerNode.toElement().attribute( "type" );

View File

@ -6,17 +6,12 @@ IF (NOT FCGI_FOUND)
MESSAGE (SEND_ERROR "Fast CGI dependency was not found!")
ENDIF (NOT FCGI_FOUND)
# We need to define the qgis base dir so we can pass it
# into the main entry point for the app so that at
# runtime it can find plugins and srs.db etc
ADD_DEFINITIONS(-DQGIS_LIB_DIR="\\"${QGIS_LIB_DIR}\\"")
#MH: for this we need to locate the headers of the diagram and interpolation plugin
#ADD_DEFINITIONS(-DDIAGRAMSERVER=1)
ADD_DEFINITIONS(-DDIAGRAMSERVER=1)
IF (CMAKE_BUILD_TYPE MATCHES Debug OR CMAKE_BUILD_TYPE MATCHES RelWithDebInfo)
ADD_DEFINITIONS(-DQGSMSDEBUG=1)
ENDIF (CMAKE_BUILD_TYPE MATCHES Debug OR CMAKE_BUILD_TYPE MATCHES RelWithDebInfo)
########################################################
# Files
@ -49,6 +44,15 @@ SET ( qgis_mapserv_SRCS
qgsremotedatasourcebuilder.cpp
qgssentdatasourcebuilder.cpp
qgsmsutils.cpp
../plugins/diagram_overlay/qgsdiagramcategory.cpp
../plugins/diagram_overlay/qgsdiagramfactory.cpp
../plugins/diagram_overlay/qgswkndiagramfactory.cpp
../plugins/diagram_overlay/qgsbardiagramfactory.cpp
../plugins/diagram_overlay/qgspiediagramfactory.cpp
../plugins/diagram_overlay/qgssvgdiagramfactory.cpp
../plugins/diagram_overlay/qgsdiagramoverlay.cpp
../plugins/diagram_overlay/qgsdiagramrenderer.cpp
)
# SET (qgis_mapserv_UIS
@ -93,6 +97,7 @@ INCLUDE_DIRECTORIES(
../core/symbology-ng
../core/composer
../analysis/interpolation
../plugins/diagram_overlay
.
)

View File

@ -170,18 +170,18 @@ int main( int argc, char * argv[] )
{
if ( strcmp( requestMethod, "POST" ) == 0 )
{
QgsMSDebugMsg( "qgis_wms_serv.cpp: Creating QgsSOAPRequestHandler" )
QgsMSDebugMsg( "Creating QgsSOAPRequestHandler" )
theRequestHandler = new QgsSOAPRequestHandler();
}
else
{
QgsMSDebugMsg( "qgis_wms_serv.cpp: Creating QgsGetRequestHandler" )
QgsMSDebugMsg( "Creating QgsGetRequestHandler" )
theRequestHandler = new QgsGetRequestHandler();
}
}
else
{
QgsMSDebugMsg( "qgis_wms_serv.cpp: Creating QgsGetRequestHandler" )
QgsMSDebugMsg( "Creating QgsGetRequestHandler" )
theRequestHandler = new QgsGetRequestHandler();
}
@ -193,7 +193,7 @@ int main( int argc, char * argv[] )
}
catch ( QgsMapServiceException& e )
{
QgsMSDebugMsg( "qgis_wms_serv.cpp: An exception was thrown during input parsing" )
QgsMSDebugMsg( "An exception was thrown during input parsing" )
theRequestHandler->sendServiceException( e );
continue;
}
@ -209,6 +209,7 @@ int main( int argc, char * argv[] )
QgsConfigParser* adminConfigParser = configCache.searchConfiguration( configFilePath );
if ( !adminConfigParser )
{
QgsMSDebugMsg( "parse error on config file " + configFilePath );
theRequestHandler->sendServiceException( QgsMapServiceException( "", "Configuration file problem" ) );
continue;
}
@ -221,7 +222,7 @@ int main( int argc, char * argv[] )
if ( serviceIt == parameterMap.end() )
{
//tell the user that service parameter is mandatory
QgsMSDebugMsg( "qgis_wms_serv.cpp: unable to find 'SERVICE' parameter, exiting..." )
QgsMSDebugMsg( "unable to find 'SERVICE' parameter, exiting..." )
theRequestHandler->sendServiceException( QgsMapServiceException( "ServiceNotSpecified", "Service not specified. The SERVICE parameter is mandatory" ) );
delete theRequestHandler;
continue;
@ -246,7 +247,7 @@ int main( int argc, char * argv[] )
if ( requestIt == parameterMap.end() )
{
//do some error handling
QgsMSDebugMsg( "qgis_wms_serv.cpp: unable to find 'REQUEST' parameter, exiting..." )
QgsMSDebugMsg( "unable to find 'REQUEST' parameter, exiting..." )
theRequestHandler->sendServiceException( QgsMapServiceException( "OperationNotSupported", "Please check the value of the REQUEST parameter" ) );
delete theRequestHandler;
delete theServer;
@ -267,7 +268,7 @@ int main( int argc, char * argv[] )
delete theServer;
continue;
}
QgsMSDebugMsg( "qgis_wms_serv.cpp: sending GetCapabilities response" )
QgsMSDebugMsg( "sending GetCapabilities response" )
theRequestHandler->sendGetCapabilitiesResponse( capabilitiesDocument );
delete theRequestHandler;
delete theServer;
@ -291,13 +292,13 @@ int main( int argc, char * argv[] )
if ( result )
{
QgsMSDebugMsg( "qgis_wms_serv.cpp: Sending GetMap response" )
QgsMSDebugMsg( "Sending GetMap response" )
theRequestHandler->sendGetMapResponse( serviceIt->second, result );
}
else
{
//do some error handling
QgsMSDebugMsg( "qgis_wms_serv.cpp: result image is 0" )
QgsMSDebugMsg( "result image is 0" )
}
delete result;
delete theRequestHandler;
@ -367,13 +368,13 @@ int main( int argc, char * argv[] )
if ( result )
{
QgsMSDebugMsg( "qgis_wms_serv.cpp: Sending GetLegendGraphics response" )
QgsMSDebugMsg( "Sending GetLegendGraphics response" )
//sending is the same for GetMap and GetLegendGraphics
theRequestHandler->sendGetMapResponse( serviceIt->second, result );
}
else
{
QgsMSDebugMsg( "qgis_wms_serv.cpp: Error, 0 image in GetLegendGraphics" )
QgsMSDebugMsg( "Error, 0 image in GetLegendGraphics" )
}
delete result;
delete theRequestHandler;

View File

@ -22,7 +22,10 @@
#include <sqlite3.h>
QgsConfigParser::QgsConfigParser(): mFallbackParser( 0 ), mScaleDenominator( 0 ), mOutputUnits( QgsMapRenderer::Millimeters )
QgsConfigParser::QgsConfigParser()
: mFallbackParser( 0 )
, mScaleDenominator( 0 )
, mOutputUnits( QgsMapRenderer::Millimeters )
{
setDefaultLegendSettings();
}
@ -61,7 +64,10 @@ void QgsConfigParser::addExternalGMLData( const QString& layerName, QDomDocument
mExternalGMLDatasets.insert( layerName, gmlDoc );
}
void QgsConfigParser::appendExGeographicBoundingBox( QDomElement& layerElem, QDomDocument& doc, const QgsRectangle& layerExtent, const QgsCoordinateReferenceSystem& layerCRS ) const
void QgsConfigParser::appendExGeographicBoundingBox( QDomElement& layerElem,
QDomDocument& doc,
const QgsRectangle& layerExtent,
const QgsCoordinateReferenceSystem& layerCRS ) const
{
if ( layerElem.isNull() )
{

View File

@ -24,7 +24,7 @@ std::map<QString, QString> QgsGetRequestHandler::parseInput()
if ( qs )
{
queryString = QString( qs );
QgsMSDebugMsg( "qgsgetrequesthandler.cpp: query string is: " + queryString )
QgsMSDebugMsg( "query string is: " + queryString )
}
else
{
@ -80,7 +80,7 @@ std::map<QString, QString> QgsGetRequestHandler::parseInput()
}
parameters.insert( std::make_pair( key.toUpper(), value ) );
QgsMSDebugMsg( "qgsgetrequesthandler.cpp: inserting pair " + key.toUpper() + " // " + value + " into the parameter map" )
QgsMSDebugMsg( "inserting pair " + key.toUpper() + " // " + value + " into the parameter map" )
}
//feature info format?
@ -160,7 +160,6 @@ void QgsGetRequestHandler::sendGetStyleResponse( const QDomDocument& doc ) const
void QgsGetRequestHandler::sendGetFeatureInfoResponse( const QDomDocument& infoDoc, const QString& infoFormat ) const
{
QByteArray ba;
QgsMSDebugMsg( "In sendGetFeatureInfoResponse" )
QgsMSDebugMsg( "Info format is:" + infoFormat )
if ( infoFormat == "text/xml" )

View File

@ -35,7 +35,7 @@ QgsHostedRDSBuilder::~QgsHostedRDSBuilder()
QgsMapLayer* QgsHostedRDSBuilder::createMapLayer( const QDomElement& elem, const QString& layerName, QList<QTemporaryFile*>& filesToRemove, QList<QgsMapLayer*>& layersToRemove, bool allowCaching ) const
{
QgsMSDebugMsg( "Entering QgsHostedRDSBuilder::rasterLayerFromHostedRDS" )
QgsMSDebugMsg( "entering." )
if ( elem.isNull() )
{

View File

@ -44,7 +44,7 @@ QgsMapLayer* QgsHostedVDSBuilder::createMapLayer( const QDomElement& elem, const
if ( providerType == "not found" || uri == "not found" )
{
QgsMSDebugMsg( "QgsHostedVDSBuilder::createMapLayer: error, provider type not found" )
QgsMSDebugMsg( "error, provider type not found" )
return 0;
}
@ -63,7 +63,7 @@ QgsMapLayer* QgsHostedVDSBuilder::createMapLayer( const QDomElement& elem, const
if ( !ml || !ml->isValid() )
{
QgsMSDebugMsg( "QgsHostedVDSBuilder::createMapLayer: error, VectorLayer is 0 or invalid" )
QgsMSDebugMsg( "error, VectorLayer is 0 or invalid" )
delete ml;
return 0;
}

View File

@ -57,3 +57,13 @@ void QgsMapServerLogger::printChar( QChar c )
{
mTextStream << c;
}
#ifdef QGSMSDEBUG
void QgsMapServerLogger::printMessage( const char *file, const char *function, int line, const QString& message )
{
mTextStream
<< QString( "%1: %2: (%3) " ).arg( file ).arg( function ).arg( line )
<< message
<< endl;
}
#endif

View File

@ -22,7 +22,7 @@
#include <QTextStream>
#ifdef QGSMSDEBUG
#define QgsMSDebugMsg(str) QgsMapServerLogger::instance()->printMessage(str);
#define QgsMSDebugMsg(str) QgsMapServerLogger::instance()->printMessage(__FILE__, __FUNCTION__, __LINE__, str);
#else
#define QgsMSDebugMsg(str)
#endif
@ -41,6 +41,10 @@ class QgsMapServerLogger
void printMessage( const QString& message );
/**Prints only one char*/
void printChar( QChar c );
#ifdef QGSMSDEBUG
/**Print a message to the Logfile*/
void printMessage( const char *file, const char *function, int line, const QString& message );
#endif
private:
static QgsMapServerLogger* mInstance;
QgsMapServerLogger();

View File

@ -39,7 +39,7 @@ QgsMSLayerCache::QgsMSLayerCache()
QgsMSLayerCache::~QgsMSLayerCache()
{
QgsMSDebugMsg( "Destructor QgsMSLayerCache: removing all entries" )
QgsMSDebugMsg( "removing all entries" )
QMap<QPair<QString, QString>, QgsMSLayerCacheEntry>::iterator it;
for ( it = mEntries.begin(); it != mEntries.end(); ++it )
{
@ -147,7 +147,7 @@ void QgsMSLayerCache::freeEntryRessources( QgsMSLayerCacheEntry& entry )
QFile removeFile( *it );
if ( !removeFile.remove() )
{
QgsMSDebugMsg( "QgsMSLayerCache::freeEntryRessources: could not remove file: " + *it )
QgsMSDebugMsg( "could not remove file: " + *it )
QgsMSDebugMsg( removeFile.errorString() )
}
}

View File

@ -36,7 +36,6 @@ QgsProjectParser::~QgsProjectParser()
void QgsProjectParser::layersAndStylesCapabilities( QDomElement& parentElement, QDomDocument& doc ) const
{
QList<QDomElement> layerElems = projectLayerElements();
QgsMapLayer* currentLayer = 0;
QStringList nonIdentifiableLayers = identifyDisabledLayers();
@ -45,6 +44,28 @@ void QgsProjectParser::layersAndStylesCapabilities( QDomElement& parentElement,
return;
}
QMap<QString, QgsMapLayer *> layerMap;
QList<QDomElement>::const_iterator layerIt = layerElems.constBegin();
for ( ; layerIt != layerElems.constEnd(); ++layerIt )
{
QgsMapLayer *layer = createLayerFromElement( *layerIt );
if ( layer )
{
QgsMSDebugMsg( QString( "add layer %1 to map" ).arg( layer->getLayerID() ) );
layerMap.insert( layer->getLayerID(), layer );
}
#if QGSMSDEBUG
else
{
QString buf;
QTextStream s( &buf );
layerIt->save( s, 0 );
QgsMSDebugMsg( QString( "layer %1 not found" ).arg( buf ) );
}
#endif
}
//According to the WMS spec, there can be only one toplevel layer.
//So we create an artificial one here to be in accordance with the schema
QString projTitle = projectTitle();
@ -57,7 +78,6 @@ void QgsProjectParser::layersAndStylesCapabilities( QDomElement& parentElement,
QDomText layerParentTitleText = doc.createTextNode( projTitle );
layerParentTitleElem.appendChild( layerParentTitleText );
layerParentElem.appendChild( layerParentTitleElem );
parentElement.appendChild( layerParentElem );
//Map rectangle. If not empty, this will be set for every layer (instead of the bbox that comes from the data)
QgsRectangle mapExtent = mapRectangle();
@ -72,22 +92,110 @@ void QgsProjectParser::layersAndStylesCapabilities( QDomElement& parentElement,
}
}
QMap< QString, QDomElement > layerElemMap; //key: layer id, value: layer dom element ( used to apply legend groups )
QDomElement legendElem = mXMLDoc->documentElement().firstChildElement( "legend" );
QList<QDomElement>::const_iterator layerIt = layerElems.constBegin();
for ( ; layerIt != layerElems.constEnd(); ++layerIt )
addLayers( doc, layerParentElem, legendElem, layerMap, nonIdentifiableLayers, mapExtent, mapCRS );
parentElement.appendChild( layerParentElem );
}
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
{
QDomNodeList legendChildren = legendElem.childNodes();
for ( int i = 0; i < legendChildren.size(); ++i )
{
currentLayer = createLayerFromElement( *layerIt );
if ( currentLayer )
QDomElement currentChildElem = legendChildren.at( i ).toElement();
QDomElement layerElem = doc.createElement( "Layer" );
if ( currentChildElem.tagName() == "legendgroup" )
{
QDomElement currentLayerElem = doc.createElement( "Layer" );
if ( nonIdentifiableLayers.contains( currentLayer->getLayerID() ) )
QString name = currentChildElem.attribute( "name" );
QDomElement nameElem = doc.createElement( "Name" );
QDomText nameText = doc.createTextNode( name );
nameElem.appendChild( nameText );
layerElem.appendChild( nameElem );
QDomElement titleElem = doc.createElement( "Title" );
QDomText titleText = doc.createTextNode( name );
titleElem.appendChild( titleText );
layerElem.appendChild( titleElem );
addLayers( doc, layerElem, currentChildElem, layerMap, nonIdentifiableLayers, mapExtent, mapCRS );
// combine bounding boxes of childs (groups/layers)
QgsRectangle combinedGeographicBBox;
QSet<int> combinedCRSSet;
bool firstBBox = true;
bool firstCRSSet = true;
QDomNodeList layerChildren = layerElem.childNodes();
for ( int j = 0; j < layerChildren.size(); ++j )
{
currentLayerElem.setAttribute( "queryable", "0" );
QDomElement childElem = layerChildren.at( j ).toElement();
if ( childElem.tagName() != "Layer" )
continue;
QgsRectangle bbox;
if ( exGeographicBoundingBox( childElem, bbox ) )
{
if ( firstBBox )
{
combinedGeographicBBox = bbox;
firstBBox = false;
}
else
{
currentLayerElem.setAttribute( "queryable", "1" );
combinedGeographicBBox.combineExtentWith( &bbox );
}
}
//combine crs set
QSet<int> crsSet;
if ( crsSetForLayer( childElem, crsSet ) )
{
if ( firstCRSSet )
{
combinedCRSSet = crsSet;
firstCRSSet = false;
}
else
{
combinedCRSSet.intersect( crsSet );
}
}
}
appendCRSElementsToLayer( layerElem, doc, combinedCRSSet.toList() );
const QgsCoordinateReferenceSystem& groupCRS = QgsEPSGCache::instance()->searchCRS( 4326 );
appendExGeographicBoundingBox( layerElem, doc, combinedGeographicBBox, groupCRS );
}
else if ( currentChildElem.tagName() == "legendlayer" )
{
QString id = layerIdFromLegendLayer( currentChildElem );
QgsMapLayer *currentLayer = layerMap[ id ];
if ( !currentLayer )
{
QgsMSDebugMsg( QString( "layer %1 not found" ).arg( id ) );
continue;
}
if ( nonIdentifiableLayers.contains( currentLayer->getLayerID() ) )
{
layerElem.setAttribute( "queryable", "0" );
}
else
{
layerElem.setAttribute( "queryable", "1" );
}
QDomElement nameElem = doc.createElement( "Name" );
@ -95,29 +203,28 @@ void QgsProjectParser::layersAndStylesCapabilities( QDomElement& parentElement,
//Because the id sometimes contains user/pw information and the name is more descriptive
QDomText nameText = doc.createTextNode( currentLayer->name() );
nameElem.appendChild( nameText );
currentLayerElem.appendChild( nameElem );
layerElem.appendChild( nameElem );
QDomElement titleElem = doc.createElement( "Title" );
QDomText titleText = doc.createTextNode( currentLayer->name() );
titleElem.appendChild( titleText );
currentLayerElem.appendChild( titleElem );
layerElem.appendChild( titleElem );
QDomElement abstractElem = doc.createElement( "Abstract" );
currentLayerElem.appendChild( abstractElem );
layerElem.appendChild( abstractElem );
//CRS
QList<int> crsList = createCRSListForLayer( currentLayer );
appendCRSElementsToLayer( currentLayerElem, doc, crsList );
layerElemMap.insert( currentLayer->getLayerID(), currentLayerElem );
appendCRSElementsToLayer( layerElem, doc, crsList );
//Ex_GeographicBoundingBox
if ( mapExtent.isEmpty() )
{
appendExGeographicBoundingBox( currentLayerElem, doc, currentLayer->extent(), currentLayer->srs() );
appendExGeographicBoundingBox( layerElem, doc, currentLayer->extent(), currentLayer->srs() );
}
else
{
appendExGeographicBoundingBox( currentLayerElem, doc, mapExtent, mapCRS );
appendExGeographicBoundingBox( layerElem, doc, mapExtent, mapCRS );
}
//only one default style in project file mode
@ -130,118 +237,27 @@ void QgsProjectParser::layersAndStylesCapabilities( QDomElement& parentElement,
styleTitleElem.appendChild( styleTitleText );
styleElem.appendChild( styleNameElem );
styleElem.appendChild( styleTitleElem );
currentLayerElem.appendChild( styleElem );
layerElem.appendChild( styleElem );
}
}
//apply legend settings (groups and layer in proper order)
QList< GroupLayerInfo > groupLayerRelationship = groupLayerRelationshipFromProject();
QList< GroupLayerInfo >::const_iterator groupIt = groupLayerRelationship.constBegin();
QDomElement layerElem;
QString entryName;
QList< QString > layerIdList;
for ( ; groupIt != groupLayerRelationship.constEnd(); ++groupIt )
{
entryName = groupIt->first;
layerIdList = groupIt->second;
if ( layerIdList.isEmpty() )
else
{
QgsMSDebugMsg( "unexpected child element" );
continue;
}
if ( entryName.isNull() ) //a toplevel layer
{
layerElem = layerElemMap.take( layerIdList.first() );
if ( !layerElem.isNull() )
{
layerParentElem.appendChild( layerElem );
}
}
else //a group
{
QDomElement layerGroupElem = doc.createElement( "Layer" );
//name
QDomElement groupNameElem = doc.createElement( "Name" );
QDomText groupNameText = doc.createTextNode( entryName );
groupNameElem.appendChild( groupNameText );
layerGroupElem.appendChild( groupNameElem );
//title
QDomElement groupTitleElem = doc.createElement( "Title" );
QDomText groupTitleText = doc.createTextNode( entryName );
groupTitleElem.appendChild( groupTitleText );
layerGroupElem.appendChild( groupTitleElem );
QgsRectangle combinedGeographicBBox;
QSet<int> combinedCRSSet;
bool firstBBox = true;
bool firstCRSSet = true;
#if QGSMSDEBUG
QString buf;
QTextStream s( &buf );
layerElem.save( s, 0 );
QgsMSDebugMsg( QString( "adding layer: %1" ).arg( buf ) );
#endif
QList<QDomElement> childLayerList;
QList< QString >::const_iterator layerIt = layerIdList.constBegin();
for ( ; layerIt != layerIdList.constEnd(); ++layerIt )
{
layerElem = layerElemMap.take( *layerIt );
QgsRectangle layerBBox;
QSet<int> layerCRSSet;
if ( !layerElem.isNull() )
{
//combine layer bbox with group bbox
if ( exGeographicBoundingBox( layerElem, layerBBox ) )
{
if ( firstBBox )
{
combinedGeographicBBox = layerBBox;
firstBBox = false;
}
else
{
combinedGeographicBBox.combineExtentWith( &layerBBox );
}
}
//combine crs set
if ( crsSetForLayer( layerElem, layerCRSSet ) )
{
if ( firstCRSSet )
{
combinedCRSSet = layerCRSSet;
firstCRSSet = false;
}
else
{
combinedCRSSet.intersect( layerCRSSet );
}
}
//and insert layer element under this group element
//layerGroupElem.appendChild( layerElem );
childLayerList.append( layerElem );
}
}
//write CRS elements
appendCRSElementsToLayer( layerGroupElem, doc, combinedCRSSet.toList() );
//write group EX_GeographicBoundingBox
const QgsCoordinateReferenceSystem& groupCRS = QgsEPSGCache::instance()->searchCRS( 4326 );
appendExGeographicBoundingBox( layerGroupElem, doc, combinedGeographicBBox, groupCRS );
//append child layer elements
QList<QDomElement>::const_iterator childIt = childLayerList.constBegin();
for ( ; childIt != childLayerList.constEnd(); ++childIt )
{
layerGroupElem.appendChild( *childIt );
}
//and append Layer element of the group to the document
layerParentElem.appendChild( layerGroupElem );
}
parentElem.appendChild( layerElem );
}
}
QList<QgsMapLayer*> QgsProjectParser::mapLayerFromStyle( const QString& lName, const QString& styleName, bool allowCaching ) const
{
QList<QgsMapLayer*> layerList;

View File

@ -110,6 +110,14 @@ class QgsProjectParser: public QgsConfigParser
QList< GroupLayerInfo > groupLayerRelationshipFromProject() const;
/**Returns the layer id under a <legendlayer> tag in the QGIS projectfile*/
QString layerIdFromLegendLayer( const QDomElement& legendLayer ) const;
void addLayers( QDomDocument &doc,
QDomElement &parentLayer,
const QDomElement &legendElem,
const QMap<QString, QgsMapLayer *> &layerMap,
const QStringList &nonIdentifiableLayers,
const QgsRectangle &mapExtent,
const QgsCoordinateReferenceSystem &mapCRS ) const;
};
#endif // QGSPROJECTPARSER_H

View File

@ -37,7 +37,7 @@ QgsRemoteDataSourceBuilder::~QgsRemoteDataSourceBuilder()
QgsMapLayer* QgsRemoteDataSourceBuilder::createMapLayer( const QDomElement& elem, const QString& layerName, QList<QTemporaryFile*>& filesToRemove, QList<QgsMapLayer*>& layersToRemove, bool allowCaching ) const
{
QgsMSDebugMsg( "QgsRDSBuilder::createMapLayer" );
QgsMSDebugMsg( "entering." );
QgsMapLayer* theLayer = 0;
if ( elem.tagName() == "RemoteRDS" )
{
@ -56,7 +56,7 @@ QgsMapLayer* QgsRemoteDataSourceBuilder::createMapLayer( const QDomElement& elem
QgsRasterLayer* QgsRemoteDataSourceBuilder::rasterLayerFromRemoteRDS( const QDomElement& remoteRDSElem, const QString& layerName, QList<QTemporaryFile*>& filesToRemove, QList<QgsMapLayer*>& layersToRemove, bool allowCaching ) const
{
QgsMSDebugMsg( "QgsRDSBuilder::rasterLayerFromRemoteRDS" );
QgsMSDebugMsg( "entering." );
//load file with QgsHttpTransaction or QgsFtpTransaction
QByteArray fileContents;
QString uri = remoteRDSElem.text();

View File

@ -145,7 +145,7 @@ QgsMapLayer* QgsRemoteOWSBuilder::createMapLayer( const QDomElement& elem, const
QgsRasterLayer* QgsRemoteOWSBuilder::wmsLayerFromUrl( const QString& url, const QString& layerName, QList<QgsMapLayer*>& layersToRemove, bool allowCaching ) const
{
QgsMSDebugMsg( "Entering QgsRemoteOWSBuilder::::wmsLayerFromUrl" )
QgsMSDebugMsg( "Entering" )
QgsRasterLayer* result = 0;
QString baseUrl, format, crs;
QStringList layerList, styleList;
@ -219,7 +219,7 @@ QgsRasterLayer* QgsRemoteOWSBuilder::wmsLayerFromUrl( const QString& url, const
QgsRasterLayer* QgsRemoteOWSBuilder::wcsLayerFromUrl( const QString& url, const QString& layerName, QList<QTemporaryFile*>& filesToRemove, QList<QgsMapLayer*>& layersToRemove, bool allowCaching ) const
{
QgsMSDebugMsg( "Entering QgsRemoteOWSBuilder::wcsLayerFromUrl" )
QgsMSDebugMsg( "Entering" )
//write server url and coverage name to a temporary file
QString fileName = createTempFile();

View File

@ -66,10 +66,10 @@ QgsVectorLayer* QgsSentDataSourceBuilder::vectorLayerFromSentVDS( const QDomElem
QgsVectorLayer* theVectorLayer = new QgsVectorLayer( tmpFile->fileName(), layerNameFromUri( tmpFile->fileName() ), "WFS" );
if ( !theVectorLayer || !theVectorLayer->isValid() )
{
QgsMSDebugMsg( "vectorLayerFromGML: invalid maplayer" )
QgsMSDebugMsg( "invalid maplayer" )
return 0;
}
QgsMSDebugMsg( "vectorLayerFromGML: returning maplayer" )
QgsMSDebugMsg( "returning maplayer" )
layersToRemove.push_back( theVectorLayer ); //make sure the layer gets deleted after each request
@ -84,7 +84,7 @@ QgsVectorLayer* QgsSentDataSourceBuilder::vectorLayerFromSentVDS( const QDomElem
QgsRasterLayer* QgsSentDataSourceBuilder::rasterLayerFromSentRDS( const QDomElement& sentRDSElem, QList<QTemporaryFile*>& filesToRemove, QList<QgsMapLayer*>& layersToRemove ) const
{
QgsMSDebugMsg( "Entering rasterLayerFromSentRDS" )
QgsMSDebugMsg( "Entering" )
QString tempFilePath = createTempFile();
if ( tempFilePath.isEmpty() )
{

View File

@ -407,7 +407,7 @@ QgsRenderer* QgsSLDParser::rendererFromUserStyle( const QDomElement& userStyleEl
return 0;
}
QgsMSDebugMsg( "Entering rendererFromUserStyle" )
QgsMSDebugMsg( "Entering" )
QgsSLDRenderer* theRenderer = new QgsSLDRenderer( vec->geometryType() );
theRenderer->setScaleDenominator( mScaleDenominator );
@ -438,7 +438,7 @@ QgsRenderer* QgsSLDParser::rendererFromUserStyle( const QDomElement& userStyleEl
bool QgsSLDParser::rasterSymbologyFromUserStyle( const QDomElement& userStyleElement, QgsRasterLayer* r ) const
{
QgsMSDebugMsg( "Entering rasterSymbologyFromUserStyle" )
QgsMSDebugMsg( "Entering" )
if ( !r )
{
return false;
@ -979,7 +979,7 @@ QDomElement QgsSLDParser::findUserStyleElement( const QDomElement& userLayerElem
int QgsSLDParser::layersAndStyles( QStringList& layers, QStringList& styles ) const
{
QgsMSDebugMsg( "Entering QgsSLDParser::layersAndStyles" )
QgsMSDebugMsg( "Entering." )
layers.clear();
styles.clear();
@ -1075,7 +1075,7 @@ int QgsSLDParser::layersAndStyles( QStringList& layers, QStringList& styles ) co
QgsMapLayer* QgsSLDParser::mapLayerFromUserLayer( const QDomElement& userLayerElem, const QString& layerName, bool allowCaching ) const
{
QgsMSDebugMsg( "mapLayerFromUserLayer" )
QgsMSDebugMsg( "Entering." )
QgsMSLayerBuilder* layerBuilder = 0;
QDomElement builderRootElement;
@ -1191,7 +1191,7 @@ QgsMapLayer* QgsSLDParser::mapLayerFromUserLayer( const QDomElement& userLayerEl
QgsVectorLayer* QgsSLDParser::vectorLayerFromGML( const QDomElement gmlRootElement ) const
{
QgsMSDebugMsg( "Entering vectorLayerFromSentVDS" )
QgsMSDebugMsg( "Entering." )
//QString tempFilePath = QgsMSUtils::createTempFilePath();
//QFile tempFile(tempFilePath);
@ -1212,10 +1212,10 @@ QgsVectorLayer* QgsSLDParser::vectorLayerFromGML( const QDomElement gmlRootEleme
QgsVectorLayer* theVectorLayer = new QgsVectorLayer( tmpFile->fileName(), layerNameFromUri( tmpFile->fileName() ), "WFS" );
if ( !theVectorLayer || !theVectorLayer->isValid() )
{
QgsMSDebugMsg( "vectorLayerFromGML: invalid maplayer" )
QgsMSDebugMsg( "invalid maplayer" )
return 0;
}
QgsMSDebugMsg( "vectorLayerFromGML: returning maplayer" )
QgsMSDebugMsg( "returning maplayer" )
mLayersToRemove.push_back( theVectorLayer ); //make sure the layer gets deleted after each request
@ -1224,7 +1224,7 @@ QgsVectorLayer* QgsSLDParser::vectorLayerFromGML( const QDomElement gmlRootEleme
QgsVectorLayer* QgsSLDParser::contourLayerFromRaster( const QDomElement& userStyleElem, QgsRasterLayer* rasterLayer ) const
{
QgsMSDebugMsg( "In method QgsSLDParser::contourLayerFromRaster" )
QgsMSDebugMsg( "Entering." )
if ( !rasterLayer )
{
@ -1793,7 +1793,6 @@ int QgsSLDParser::diagramItemsFromCategorize( const QDomElement& categorizeEleme
return 4;
}
int currentSize;
QVariant currentThreshold;
QgsDiagramItem currentItem;

View File

@ -53,7 +53,7 @@ std::map<QString, QString> QgsSOAPRequestHandler::parseInput()
bool conversionSuccess = false;
lengthQString = QString( lengthString );
length = lengthQString.toInt( &conversionSuccess );
QgsMSDebugMsg( "qgssoaprequesthandler.cpp: length is: " + lengthQString )
QgsMSDebugMsg( "length is: " + lengthQString )
if ( conversionSuccess )
{
input = ( char* )malloc( length + 1 );
@ -76,24 +76,24 @@ std::map<QString, QString> QgsSOAPRequestHandler::parseInput()
}
else
{
QgsMSDebugMsg( "qgssoaprequesthandler.cpp: input is NULL " )
QgsMSDebugMsg( "input is NULL " )
}
free( input );
}
else
{
QgsMSDebugMsg( "qgssoaprequesthandler.cpp: could not convert CONTENT_LENGTH to int" )
QgsMSDebugMsg( "could not convert CONTENT_LENGTH to int" )
}
}
//QgsMSDebugMsg("qgssoaprequesthandler.cpp: input string is: " + inputString)
//QgsMSDebugMsg("input string is: " + inputString)
//inputString to QDomDocument
QDomDocument inputXML;
QString errorMsg;
if ( !inputXML.setContent( inputString, true, &errorMsg ) )
{
QgsMSDebugMsg( "qgssoaprequesthandler.cpp: soap request parse error" )
QgsMSDebugMsg( "soap request parse error" )
QgsMSDebugMsg( "error message: " + errorMsg )
QgsMSDebugMsg( "the xml string was:" )
QgsMSDebugMsg( inputString )
@ -114,7 +114,7 @@ std::map<QString, QString> QgsSOAPRequestHandler::parseInput()
QDomNodeList envelopeNodeList = inputXML.elementsByTagNameNS( "http://schemas.xmlsoap.org/soap/envelope/", "Envelope" );
if ( envelopeNodeList.size() < 1 )
{
QgsMSDebugMsg( "qgssoaprequesthandler.cpp: Envelope element not found" )
QgsMSDebugMsg( "Envelope element not found" )
throw QgsMapServiceException( "SOAPError", "Element <Envelope> not found" );
return result;
}
@ -122,7 +122,7 @@ std::map<QString, QString> QgsSOAPRequestHandler::parseInput()
QDomNodeList bodyNodeList = envelopeNodeList.item( 0 ).toElement().elementsByTagNameNS( "http://schemas.xmlsoap.org/soap/envelope/", "Body" );
if ( bodyNodeList.size() < 1 )
{
QgsMSDebugMsg( "qgssoaprequesthandler.cpp: body node not found" )
QgsMSDebugMsg( "body node not found" )
throw QgsMapServiceException( "SOAPError", "Element <Body> not found" );
return result;
}
@ -279,7 +279,7 @@ void QgsSOAPRequestHandler::sendGetCapabilitiesResponse( const QDomDocument& doc
if ( !common.open( QIODevice::ReadOnly ) )
{
//throw an exception...
QgsMSDebugMsg( "qgissoaprequesthandler.cpp: external orchestra common capabilities not found" )
QgsMSDebugMsg( "external orchestra common capabilities not found" )
}
else
{
@ -288,7 +288,7 @@ void QgsSOAPRequestHandler::sendGetCapabilitiesResponse( const QDomDocument& doc
int errorLineNo;
if ( !externCapDoc.setContent( &common, false, &parseError, &errorLineNo ) )
{
QgsMSDebugMsg( "qgissoaprequesthandler.cpp: parse error at setting content of external orchestra common capabilities: "\
QgsMSDebugMsg( "parse error at setting content of external orchestra common capabilities: "
+ parseError + " at line " + QString::number( errorLineNo ) );
common.close();
}
@ -353,7 +353,7 @@ void QgsSOAPRequestHandler::sendGetCapabilitiesResponse( const QDomDocument& doc
if ( !wmsService.open( QIODevice::ReadOnly ) )
{
//throw an exception...
QgsMSDebugMsg( "qgissoaprequesthandler.cpp: external wms service capabilities not found" )
QgsMSDebugMsg( "external wms service capabilities not found" )
}
else
{
@ -362,7 +362,7 @@ void QgsSOAPRequestHandler::sendGetCapabilitiesResponse( const QDomDocument& doc
int errorLineNo;
if ( !externServiceDoc.setContent( &wmsService, false, &parseError, &errorLineNo ) )
{
QgsMSDebugMsg( "qgissoaprequesthandler.cpp: parse error at setting content of external wms service capabilities: "\
QgsMSDebugMsg( "parse error at setting content of external wms service capabilities: "
+ parseError + " at line " + QString::number( errorLineNo ) )
wmsService.close();
}
@ -400,7 +400,7 @@ void QgsSOAPRequestHandler::sendGetCapabilitiesResponse( const QDomDocument& doc
if ( !common.open( QIODevice::ReadOnly ) )
{
//throw an exception...
QgsMSDebugMsg( "qgissoaprequesthandler.cpp: external orchestra common capabilities not found" )
QgsMSDebugMsg( "external orchestra common capabilities not found" )
}
else
{
@ -409,7 +409,7 @@ void QgsSOAPRequestHandler::sendGetCapabilitiesResponse( const QDomDocument& doc
int errorLineNo;
if ( !externCapDoc.setContent( &common, false, &parseError, &errorLineNo ) )
{
QgsMSDebugMsg( "qgissoaprequesthandler.cpp: parse error at setting content of external orchestra common capabilities: "\
QgsMSDebugMsg( "parse error at setting content of external orchestra common capabilities: "
+ parseError + " at line " + QString::number( errorLineNo ) )
common.close();
}
@ -702,7 +702,7 @@ int QgsSOAPRequestHandler::parseOutputAttributesElement( std::map<QString, QStri
int QgsSOAPRequestHandler::sendSOAPWithAttachments( QImage* img ) const
{
QgsMSDebugMsg( "In sendSOAPWithAttachments" )
QgsMSDebugMsg( "Entering." )
//create response xml document
QDomDocument xmlResponse; //response xml, save this into mimeString
QDomElement envelopeElement = xmlResponse.createElementNS( "http://schemas.xmlsoap.org/soap/envelope/", "Envelope" );
@ -760,7 +760,7 @@ int QgsSOAPRequestHandler::sendUrlToFile( QImage* img ) const
QFile theFile;
QDir tmpDir;
QgsMSDebugMsg( "Entering sendUrlToFile" )
QgsMSDebugMsg( "Entering." )
if ( findOutHostAddress( uri ) != 0 )
{

View File

@ -45,7 +45,10 @@
#include <QTextStream>
#include <QDir>
QgsWMSServer::QgsWMSServer( std::map<QString, QString> parameters, QgsMapRenderer* renderer ): mParameterMap( parameters ), mConfigParser( 0 ), mMapRenderer( renderer )
QgsWMSServer::QgsWMSServer( std::map<QString, QString> parameters, QgsMapRenderer* renderer )
: mParameterMap( parameters )
, mConfigParser( 0 )
, mMapRenderer( renderer )
{
}
@ -59,7 +62,7 @@ QgsWMSServer::QgsWMSServer()
QDomDocument QgsWMSServer::getCapabilities()
{
QgsMSDebugMsg( "Entering QgsWMSServer::getCapabilities" )
QgsMSDebugMsg( "Entering." )
QDomDocument doc;
//wms:WMS_Capabilities element
QDomElement wmsCapabilitiesElement = doc.createElement( "WMS_Capabilities"/*wms:WMS_Capabilities*/ );
@ -73,7 +76,7 @@ QDomDocument QgsWMSServer::getCapabilities()
if ( !wmsService.open( QIODevice::ReadOnly ) )
{
//throw an exception...
QgsMSDebugMsg( "qgissoaprequesthandler.cpp: external wms service capabilities not found" )
QgsMSDebugMsg( "external wms service capabilities not found" )
}
else
{
@ -82,7 +85,7 @@ QDomDocument QgsWMSServer::getCapabilities()
int errorLineNo;
if ( !externServiceDoc.setContent( &wmsService, false, &parseError, &errorLineNo ) )
{
QgsMSDebugMsg( "qgissoaprequesthandler.cpp: parse error at setting content of external wms service capabilities: "\
QgsMSDebugMsg( "parse error at setting content of external wms service capabilities: "
+ parseError + " at line " + QString::number( errorLineNo ) )
wmsService.close();
}
@ -197,9 +200,6 @@ QDomDocument QgsWMSServer::getCapabilities()
getFeatureInfoElem.appendChild( getFeatureInfoDhcTypeElement );
requestElement.appendChild( getFeatureInfoElem );
//Exception element is mandatory
QDomElement exceptionElement = doc.createElement( "Exception" );
QDomElement exFormatElement = doc.createElement( "Format" );
@ -209,9 +209,9 @@ QDomDocument QgsWMSServer::getCapabilities()
capabilityElement.appendChild( exceptionElement );
//add the xml content for the individual layers/styles
QgsMSDebugMsg( "Entering layersAndStylesCapabilities" )
QgsMSDebugMsg( "calling layersAndStylesCapabilities" )
mConfigParser->layersAndStylesCapabilities( capabilityElement, doc );
QgsMSDebugMsg( "Entering layersAndStylesCapabilities" )
QgsMSDebugMsg( "layersAndStylesCapabilities returned" )
//for debugging: save the document to disk
QFile capabilitiesFile( QDir::tempPath() + "/capabilities.txt" );
@ -234,7 +234,7 @@ QImage* QgsWMSServer::getLegendGraphics()
if ( readLayersAndStyles( layersList, stylesList ) != 0 )
{
QgsMSDebugMsg( "QgsWMSServer: error reading layers and styles" )
QgsMSDebugMsg( "error reading layers and styles" )
return 0;
}
@ -291,7 +291,7 @@ QImage* QgsWMSServer::getLegendGraphics()
QgsComposerLayerItem* layerItem = dynamic_cast<QgsComposerLayerItem*>( rootItem->child( i ) );
if ( layerItem )
{
drawLegendLayerItem( layerItem, 0, maxX, currentY, layerFont, itemFont, boxSpace, layerSpace, symbolSpace, \
drawLegendLayerItem( layerItem, 0, maxX, currentY, layerFont, itemFont, boxSpace, layerSpace, symbolSpace,
iconLabelSpace, symbolWidth, symbolHeight, fontOversamplingFactor, theImage->dotsPerMeterX() * 0.0254 );
}
}
@ -310,7 +310,7 @@ QImage* QgsWMSServer::getLegendGraphics()
QgsComposerLayerItem* layerItem = dynamic_cast<QgsComposerLayerItem*>( rootItem->child( i ) );
if ( layerItem )
{
drawLegendLayerItem( layerItem, &p, maxX, currentY, layerFont, itemFont, boxSpace, layerSpace, symbolSpace, \
drawLegendLayerItem( layerItem, &p, maxX, currentY, layerFont, itemFont, boxSpace, layerSpace, symbolSpace,
iconLabelSpace, symbolWidth, symbolHeight, fontOversamplingFactor, theImage->dotsPerMeterX() * 0.0254 );
}
}
@ -342,7 +342,7 @@ QDomDocument QgsWMSServer::getStyle()
QImage* QgsWMSServer::getMap()
{
QgsMSDebugMsg( "Entering QgsWMSServer::getMap" )
QgsMSDebugMsg( "Entering" )
if ( !mConfigParser )
{
QgsMSDebugMsg( "Error: mSLDParser is 0" )
@ -360,7 +360,7 @@ QImage* QgsWMSServer::getMap()
if ( readLayersAndStyles( layersList, stylesList ) != 0 )
{
QgsMSDebugMsg( "QgsWMSServer: error reading layers and styles" )
QgsMSDebugMsg( "error reading layers and styles" )
return 0;
}
@ -654,7 +654,9 @@ QImage* QgsWMSServer::createImage( int width, int height ) const
std::map<QString, QString>::const_iterator formatIt = mParameterMap.find( "FORMAT" );
if ( formatIt != mParameterMap.end() )
{
if ( formatIt->second.compare( "jpg", Qt::CaseInsensitive ) == 0 || formatIt->second.compare( "jpeg", Qt::CaseInsensitive ) == 0 || formatIt->second.compare( "image/jpeg", Qt::CaseInsensitive ) == 0 )
if ( formatIt->second.compare( "jpg", Qt::CaseInsensitive ) == 0
|| formatIt->second.compare( "jpeg", Qt::CaseInsensitive ) == 0
|| formatIt->second.compare( "image/jpeg", Qt::CaseInsensitive ) == 0 )
{
jpeg = true;
}
@ -877,7 +879,7 @@ int QgsWMSServer::initializeSLDParser( QStringList& layersList, QStringList& sty
return 0;
}
int QgsWMSServer::infoPointToLayerCoordinates( int i, int j, QgsPoint& layerCoords, QgsMapRenderer* mapRender, \
int QgsWMSServer::infoPointToLayerCoordinates( int i, int j, QgsPoint& layerCoords, QgsMapRenderer* mapRender,
QgsMapLayer* layer ) const
{
if ( !mapRender || !layer || !mapRender->coordinateTransform() )
@ -892,8 +894,14 @@ int QgsWMSServer::infoPointToLayerCoordinates( int i, int j, QgsPoint& layerCoor
return 0;
}
int QgsWMSServer::featureInfoFromVectorLayer( QgsVectorLayer* layer, const QgsPoint& infoPoint, int nFeatures, QDomDocument& infoDocument, QDomElement& layerElement, QgsMapRenderer* mapRender, \
QMap<int, QString>& aliasMap, QSet<QString>& hiddenAttributes ) const
int QgsWMSServer::featureInfoFromVectorLayer( QgsVectorLayer* layer,
const QgsPoint& infoPoint,
int nFeatures,
QDomDocument& infoDocument,
QDomElement& layerElement,
QgsMapRenderer* mapRender,
QMap<int, QString>& aliasMap,
QSet<QString>& hiddenAttributes ) const
{
if ( !layer || !mapRender )
{
@ -904,7 +912,7 @@ int QgsWMSServer::featureInfoFromVectorLayer( QgsVectorLayer* layer, const QgsPo
QgsRectangle mapRect = mapRender->extent();
QgsRectangle layerRect = mapRender->mapToLayerCoordinates( layer, mapRect );
double searchRadius = ( layerRect.xMaximum() - layerRect.xMinimum() ) / 200;
QgsRectangle searchRect( infoPoint.x() - searchRadius, infoPoint.y() - searchRadius, \
QgsRectangle searchRect( infoPoint.x() - searchRadius, infoPoint.y() - searchRadius,
infoPoint.x() + searchRadius, infoPoint.y() + searchRadius );
//do a select with searchRect and go through all the features
@ -972,7 +980,10 @@ int QgsWMSServer::featureInfoFromVectorLayer( QgsVectorLayer* layer, const QgsPo
return 0;
}
int QgsWMSServer::featureInfoFromRasterLayer( QgsRasterLayer* layer, const QgsPoint& infoPoint, QDomDocument& infoDocument, QDomElement& layerElement ) const
int QgsWMSServer::featureInfoFromRasterLayer( QgsRasterLayer* layer,
const QgsPoint& infoPoint,
QDomDocument& infoDocument,
QDomElement& layerElement ) const
{
if ( !layer )
{
@ -992,7 +1003,9 @@ int QgsWMSServer::featureInfoFromRasterLayer( QgsRasterLayer* layer, const QgsPo
return 0;
}
QStringList QgsWMSServer::layerSet( const QStringList& layersList, const QStringList& stylesList, const QgsCoordinateReferenceSystem& destCRS ) const
QStringList QgsWMSServer::layerSet( const QStringList& layersList,
const QStringList& stylesList,
const QgsCoordinateReferenceSystem& destCRS ) const
{
QStringList layerKeys;
QStringList::const_iterator llstIt;
@ -1047,9 +1060,9 @@ QStringList QgsWMSServer::layerSet( const QStringList& layersList, const QString
return layerKeys;
}
void QgsWMSServer::drawLegendLayerItem( QgsComposerLayerItem* item, QPainter* p, double& maxX, double& currentY, const QFont& layerFont, \
const QFont& itemFont, double boxSpace, double layerSpace, double symbolSpace, \
double iconLabelSpace, double symbolWidth, double symbolHeight, double fontOversamplingFactor, \
void QgsWMSServer::drawLegendLayerItem( QgsComposerLayerItem* item, QPainter* p, double& maxX, double& currentY, const QFont& layerFont,
const QFont& itemFont, double boxSpace, double layerSpace, double symbolSpace,
double iconLabelSpace, double symbolWidth, double symbolHeight, double fontOversamplingFactor,
double dpi ) const
{
if ( !item )
@ -1139,7 +1152,7 @@ void QgsWMSServer::drawLegendLayerItem( QgsComposerLayerItem* item, QPainter* p,
{
p->save();
p->scale( 1.0 / fontOversamplingFactor, 1.0 / fontOversamplingFactor );
p->drawText(( boxSpace + currentSymbolWidth + iconLabelSpace ) * fontOversamplingFactor, \
p->drawText(( boxSpace + currentSymbolWidth + iconLabelSpace ) * fontOversamplingFactor,
( currentY + symbolItemHeight / 2.0 ) * fontOversamplingFactor + itemFontMetrics.ascent() / 2.0, currentComposerItem->text() );
p->restore();
}
@ -1155,7 +1168,7 @@ void QgsWMSServer::drawLegendLayerItem( QgsComposerLayerItem* item, QPainter* p,
}
}
void QgsWMSServer::drawLegendSymbol( QgsComposerLegendItem* item, QPainter* p, double boxSpace, double currentY, double& symbolWidth, double& symbolHeight, double layerOpacity, \
void QgsWMSServer::drawLegendSymbol( QgsComposerLegendItem* item, QPainter* p, double boxSpace, double currentY, double& symbolWidth, double& symbolHeight, double layerOpacity,
double dpi, double yDownShift ) const
{
if ( !p )
@ -1263,7 +1276,7 @@ void QgsWMSServer::drawLineSymbol( QPainter* p, QgsSymbol* s, double boxSpace, d
p->restore();
}
void QgsWMSServer::drawLegendSymbolV2( QgsComposerLegendItem* item, QPainter* p, double boxSpace, double currentY, double symbolWidth, \
void QgsWMSServer::drawLegendSymbolV2( QgsComposerLegendItem* item, QPainter* p, double boxSpace, double currentY, double symbolWidth,
double symbolHeight, double dpi, double yDownShift ) const
{
if ( !p )
@ -1314,7 +1327,8 @@ void QgsWMSServer::drawRasterSymbol( QgsComposerLegendItem* item, QPainter* p, d
p->setPen( QPen( Qt::NoPen ) );
QgsRasterLayer::DrawingStyle drawingStyle = layer->drawingStyle();
if ( drawingStyle == QgsRasterLayer::SingleBandGray || drawingStyle == QgsRasterLayer::PalettedSingleBandGray \
if ( drawingStyle == QgsRasterLayer::SingleBandGray
|| drawingStyle == QgsRasterLayer::PalettedSingleBandGray
|| drawingStyle == QgsRasterLayer::MultiBandSingleGandGray )
{
int grayValue = 0;