Skip to content
Permalink
Browse files

exclude pal headers from API and install qgsdiagramrendererv2.h

git-svn-id: http://svn.osgeo.org/qgis/trunk@15511 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
jef
jef committed Mar 16, 2011
1 parent a4ca521 commit 0cf70e0e9fc6ca194726047eececfbda770069b5
@@ -20,6 +20,7 @@
#include "qgsmaplayerregistry.h"
#include "qgsrubberband.h"
#include "qgsvectorlayer.h"
#include "qgsdiagramrendererv2.h"
#include <QMouseEvent>

QgsMapToolLabel::QgsMapToolLabel( QgsMapCanvas* canvas ): QgsMapTool( canvas ), mLabelRubberBand( 0 ), mFeatureRubberBand( 0 ), mFixPointRubberBand( 0 )
@@ -394,11 +395,11 @@ bool QgsMapToolLabel:: diagramMoveable( const QgsMapLayer* ml, int& xCol, int& y
const QgsVectorLayer* vlayer = dynamic_cast<const QgsVectorLayer*>( ml );
if ( vlayer && vlayer->diagramRenderer() )
{
QgsDiagramLayerSettings dls = vlayer->diagramLayerSettings();
if ( dls.xPosColumn >= 0 && dls.yPosColumn >= 0 )
const QgsDiagramLayerSettings *dls = vlayer->diagramLayerSettings();
if ( dls && dls->xPosColumn >= 0 && dls->yPosColumn >= 0 )
{
xCol = dls.xPosColumn;
yCol = dls.yPosColumn;
xCol = dls->xPosColumn;
yCol = dls->yPosColumn;
return true;
}
}
@@ -1628,7 +1628,7 @@ void QgsVectorLayerProperties::initDiagramTab()
break;
case QGis::UnknownGeometry:
case QGis::NoGeometry:
break;
break;
}
mBackgroundColorButton->setColor( QColor( 255, 255, 255, 255 ) );
}
@@ -1689,13 +1689,16 @@ void QgsVectorLayerProperties::initDiagramTab()
}
}

QgsDiagramLayerSettings dls = layer->diagramLayerSettings();
mDiagramDistanceSpinBox->setValue( dls.dist );
mPrioritySlider->setValue( dls.priority );
mDataDefinedXComboBox->setCurrentIndex( mDataDefinedXComboBox->findData( dls.xPosColumn ) );
mDataDefinedYComboBox->setCurrentIndex( mDataDefinedYComboBox->findData( dls.yPosColumn ) );
mPlacementComboBox->setCurrentIndex( mPlacementComboBox->findData( dls.placement ) );
mLineOptionsComboBox->setCurrentIndex( mLineOptionsComboBox->findData( dls.placementFlags ) );
const QgsDiagramLayerSettings *dls = layer->diagramLayerSettings();
if ( dls )
{
mDiagramDistanceSpinBox->setValue( dls->dist );
mPrioritySlider->setValue( dls->priority );
mDataDefinedXComboBox->setCurrentIndex( mDataDefinedXComboBox->findData( dls->xPosColumn ) );
mDataDefinedYComboBox->setCurrentIndex( mDataDefinedYComboBox->findData( dls->yPosColumn ) );
mPlacementComboBox->setCurrentIndex( mPlacementComboBox->findData( dls->placement ) );
mLineOptionsComboBox->setCurrentIndex( mLineOptionsComboBox->findData( dls->placementFlags ) );
}

if ( dr->diagram() )
{
@@ -472,6 +472,7 @@ SET(QGIS_CORE_HDRS
symbology-ng/qgssymbologyv2conversion.h
symbology-ng/qgssymbolv2.h
symbology-ng/qgsvectorcolorrampv2.h
qgsdiagramrendererv2.h

spatialindex/qgsspatialindex.h
)
@@ -3,6 +3,7 @@
#include "qgsrendercontext.h"

#include <QPainter>
#include <QBrush>

void QgsDiagram::setPenWidth( QPen& pen, const QgsDiagramSettings& s, const QgsRenderContext& c )
{
@@ -6,7 +6,6 @@
#include <QList>
#include <QPointF>
#include <QSizeF>
#include "pal/layer.h" //pal::Layer
#include "qgsfeature.h"
#include "qgspallabeling.h"

@@ -15,6 +14,7 @@ class QgsDiagramRendererV2;
class QgsFeature;
class QgsRenderContext;
class QDomElement;
namespace pal { class Layer; }

struct CORE_EXPORT QgsDiagramLayerSettings
{
@@ -753,18 +753,18 @@ int QgsPalLabeling::prepareLayer( QgsVectorLayer* layer, QSet<int>& attrIndices,
return 1; // init successful
}

int QgsPalLabeling::addDiagramLayer( QgsVectorLayer* layer, QgsDiagramLayerSettings& s )
int QgsPalLabeling::addDiagramLayer( QgsVectorLayer* layer, QgsDiagramLayerSettings *s )
{
Layer* l = mPal->addLayer( layer->id().append( "d" ).toLocal8Bit().data(), -1, -1, pal::Arrangement( s.placement ), METER, s.priority, s.obstacle, true, true );
l->setArrangementFlags( s.placementFlags );
Layer* l = mPal->addLayer( layer->id().append( "d" ).toLocal8Bit().data(), -1, -1, pal::Arrangement( s->placement ), METER, s->priority, s->obstacle, true, true );
l->setArrangementFlags( s->placementFlags );

s.palLayer = l;
s->palLayer = l;
if ( mMapRenderer->hasCrsTransformEnabled() )
s.ct = new QgsCoordinateTransform( layer->crs(), mMapRenderer->destinationCrs() );
s->ct = new QgsCoordinateTransform( layer->crs(), mMapRenderer->destinationCrs() );
else
s.ct = NULL;
s.xform = mMapRenderer->coordinateTransform();
mActiveDiagramLayers.insert( layer, s );
s->ct = NULL;
s->xform = mMapRenderer->coordinateTransform();
mActiveDiagramLayers.insert( layer, *s );
return 1;
}

@@ -200,7 +200,7 @@ class CORE_EXPORT QgsPalLabeling : public QgsLabelingEngineInterface
//! hook called when drawing layer before issuing select()
virtual int prepareLayer( QgsVectorLayer* layer, QSet<int>& attrIndices, QgsRenderContext& ctx );
//! adds a diagram layer to the labeling engine
virtual int addDiagramLayer( QgsVectorLayer* layer, QgsDiagramLayerSettings& s );
virtual int addDiagramLayer( QgsVectorLayer* layer, QgsDiagramLayerSettings *s );
//! hook called when drawing for every feature in a layer
virtual void registerFeature( QgsVectorLayer* layer, QgsFeature& feat, const QgsRenderContext& context = QgsRenderContext() );
virtual void registerDiagramFeature( QgsVectorLayer* layer, QgsFeature& feat, const QgsRenderContext& context = QgsRenderContext() );
@@ -78,6 +78,7 @@
#include "qgssymbolv2.h"
#include "qgssymbollayerv2.h"
#include "qgssinglesymbolrendererv2.h"
#include "qgsdiagramrendererv2.h"

#ifdef TESTPROVIDERLIB
#include <dlfcn.h>
@@ -95,24 +96,25 @@ QgsVectorLayer::QgsVectorLayer( QString vectorLayerPath,
QString baseName,
QString providerKey,
bool loadDefaultStyleFlag )
: QgsMapLayer( VectorLayer, baseName, vectorLayerPath ),
mUpdateThreshold( 0 ), // XXX better default value?
mDataProvider( NULL ),
mProviderKey( providerKey ),
mEditable( false ),
mReadOnly( false ),
mModified( false ),
mMaxUpdatedIndex( -1 ),
mActiveCommand( NULL ),
mRenderer( 0 ),
mRendererV2( NULL ),
mUsingRendererV2( false ),
mLabel( 0 ),
mLabelOn( false ),
mVertexMarkerOnlyForSelection( false ),
mFetching( false ),
mJoinBuffer( 0 ),
mDiagramRenderer( 0 )
: QgsMapLayer( VectorLayer, baseName, vectorLayerPath )
, mUpdateThreshold( 0 ) // XXX better default value?
, mDataProvider( NULL )
, mProviderKey( providerKey )
, mEditable( false )
, mReadOnly( false )
, mModified( false )
, mMaxUpdatedIndex( -1 )
, mActiveCommand( NULL )
, mRenderer( 0 )
, mRendererV2( NULL )
, mUsingRendererV2( false )
, mLabel( 0 )
, mLabelOn( false )
, mVertexMarkerOnlyForSelection( false )
, mFetching( false )
, mJoinBuffer( 0 )
, mDiagramRenderer( 0 )
, mDiagramLayerSettings( 0 )
{
mActions = new QgsAttributeAction( this );

@@ -187,6 +189,7 @@ QgsVectorLayer::~QgsVectorLayer()
delete mDataProvider;
delete mJoinBuffer;
delete mLabel;
delete mDiagramLayerSettings;

// Destroy any cached geometries and clear the references to them
deleteCachedGeometries();
@@ -2960,7 +2963,8 @@ bool QgsVectorLayer::readSymbology( const QDomNode& node, QString& errorMessage
QDomElement diagramSettingsElem = node.firstChildElement( "DiagramLayerSettings" );
if ( !diagramSettingsElem.isNull() )
{
mDiagramLayerSettings.readXML( diagramSettingsElem );
mDiagramLayerSettings = new QgsDiagramLayerSettings();
mDiagramLayerSettings->readXML( diagramSettingsElem );
}
}
}
@@ -3139,7 +3143,8 @@ bool QgsVectorLayer::writeSymbology( QDomNode& node, QDomDocument& doc, QString&
if ( mDiagramRenderer )
{
mDiagramRenderer->writeXML( mapLayerNode, doc );
mDiagramLayerSettings.writeXML( mapLayerNode, doc );
if ( mDiagramLayerSettings )
mDiagramLayerSettings->writeXML( mapLayerNode, doc );
}
}

@@ -5183,10 +5188,10 @@ void QgsVectorLayer::prepareLabelingAndDiagrams( QgsRenderContext& rendererConte
}

//register diagram layers
if ( mDiagramRenderer )
if ( mDiagramRenderer && mDiagramLayerSettings )
{
mDiagramLayerSettings.renderer = mDiagramRenderer;
rendererContext.labelingEngine()->addDiagramLayer( this, mDiagramLayerSettings );
mDiagramLayerSettings->renderer = mDiagramRenderer;
rendererContext.labelingEngine()->addDiagramLayer( this, *mDiagramLayerSettings );
//add attributes needed by the diagram renderer
QList<int> att = mDiagramRenderer->diagramAttributes();
QList<int>::const_iterator attIt = att.constBegin();
@@ -5198,14 +5203,21 @@ void QgsVectorLayer::prepareLabelingAndDiagrams( QgsRenderContext& rendererConte
}
}
//and the ones needed for data defined diagram positions
if ( mDiagramLayerSettings.xPosColumn >= 0 && !attributes.contains( mDiagramLayerSettings.xPosColumn ) )
if ( mDiagramLayerSettings->xPosColumn >= 0 && !attributes.contains( mDiagramLayerSettings->xPosColumn ) )
{
attributes << mDiagramLayerSettings.xPosColumn;
attributes << mDiagramLayerSettings->xPosColumn;
}
if ( mDiagramLayerSettings.yPosColumn >= 0 && !attributes.contains( mDiagramLayerSettings.yPosColumn ) )
if ( mDiagramLayerSettings->yPosColumn >= 0 && !attributes.contains( mDiagramLayerSettings->yPosColumn ) )
{
attributes << mDiagramLayerSettings.yPosColumn;
attributes << mDiagramLayerSettings->yPosColumn;
}
}
}
}

void QgsVectorLayer::setDiagramLayerSettings( const QgsDiagramLayerSettings& s )
{
if ( !mDiagramLayerSettings )
mDiagramLayerSettings = new QgsDiagramLayerSettings();
*mDiagramLayerSettings = s;
}
@@ -24,16 +24,12 @@
#include <QList>
#include <QStringList>



#include "qgis.h"
#include "qgsdiagramrendererv2.h"
#include "qgsmaplayer.h"
#include "qgsfeature.h"
#include "qgssnapper.h"
#include "qgsfield.h"


class QPainter;
class QImage;

@@ -52,6 +48,8 @@ class QgsSingleSymbolRendererV2;
class QgsRectangle;
class QgsVectorLayerJoinBuffer;
class QgsFeatureRendererV2;
class QgsDiagramRendererV2;
class QgsDiagramLayerSettings;

typedef QList<int> QgsAttributeList;
typedef QSet<int> QgsFeatureIds;
@@ -214,8 +212,8 @@ class CORE_EXPORT QgsVectorLayer : public QgsMapLayer
void setDiagramRenderer( QgsDiagramRendererV2* r );
const QgsDiagramRendererV2* diagramRenderer() const { return mDiagramRenderer; }

void setDiagramLayerSettings( const QgsDiagramLayerSettings& s ) { mDiagramLayerSettings = s; }
QgsDiagramLayerSettings diagramLayerSettings() const { return mDiagramLayerSettings; }
void setDiagramLayerSettings( const QgsDiagramLayerSettings& s );
const QgsDiagramLayerSettings *diagramLayerSettings() const { return mDiagramLayerSettings; }

/** Return renderer V2.
* @note added in 1.4 */
@@ -951,7 +949,7 @@ class CORE_EXPORT QgsVectorLayer : public QgsMapLayer
QgsDiagramRendererV2* mDiagramRenderer;

//stores infos about diagram placement (placement type, priority, position distance)
QgsDiagramLayerSettings mDiagramLayerSettings;
QgsDiagramLayerSettings *mDiagramLayerSettings;
};

#endif
@@ -39,7 +39,6 @@ INCLUDE_DIRECTORIES(
../../core/symbology
../../gui
..
${GEOS_INCLUDE_DIR}
)

TARGET_LINK_LIBRARIES(dxf2shpconverterplugin
@@ -38,7 +38,6 @@ INCLUDE_DIRECTORIES(
../../gui
..
${GDAL_INCLUDE_DIR}
${GEOS_INCLUDE_DIR}
)

TARGET_LINK_LIBRARIES(oracleplugin
@@ -59,7 +59,6 @@ INCLUDE_DIRECTORIES(
../../app
..
../../providers/sqlanywhere/sqlanyconnection
${GEOS_INCLUDE_DIR}
)

TARGET_LINK_LIBRARIES(sqlanywhereplugin

0 comments on commit 0cf70e0

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