[QGIS Commit] r9124 - trunk/qgis/src/app/composer

svn_qgis at osgeo.org svn_qgis at osgeo.org
Sat Aug 23 03:45:13 EDT 2008


Author: mhugent
Date: 2008-08-23 03:45:12 -0400 (Sat, 23 Aug 2008)
New Revision: 9124

Removed:
   trunk/qgis/src/app/composer/qgscomposeritemgroup.cpp
   trunk/qgis/src/app/composer/qgscomposeritemgroup.h
   trunk/qgis/src/app/composer/qgscomposervectorlegend.cpp
   trunk/qgis/src/app/composer/qgscomposervectorlegend.h
   trunk/qgis/src/app/composer/qgsnumericscalebarstyle.cpp
   trunk/qgis/src/app/composer/qgsnumericscalebarstyle.h
Log:
Removed more files that are no longer necessary

Deleted: trunk/qgis/src/app/composer/qgscomposeritemgroup.cpp
===================================================================
--- trunk/qgis/src/app/composer/qgscomposeritemgroup.cpp	2008-08-23 07:18:39 UTC (rev 9123)
+++ trunk/qgis/src/app/composer/qgscomposeritemgroup.cpp	2008-08-23 07:45:12 UTC (rev 9124)
@@ -1,176 +0,0 @@
-/***************************************************************************
-                         qgscomposeritemgroup.cpp
-                         ------------------------
-    begin                : 2nd June 2008
-    copyright            : (C) 2008 by Marco Hugentobler
-    email                : marco dot hugentobler at karto dot baug dot ethz dot ch
- ***************************************************************************/
-
-/***************************************************************************
- *                                                                         *
- *   This program is free software; you can redistribute it and/or modify  *
- *   it under the terms of the GNU General Public License as published by  *
- *   the Free Software Foundation; either version 2 of the License, or     *
- *   (at your option) any later version.                                   *
- *                                                                         *
- ***************************************************************************/
-
-#include "qgscomposeritemgroup.h"
-#include "qgscomposition.h"
-#include "qgscomposer.h" //probably use other approach to delete items because including this in a composer class is ugly
-#include <QPen>
-#include <QPainter>
-
-QgsComposerItemGroup::QgsComposerItemGroup(QgsComposition* c): QgsComposerItem(c)
-{
-  setZValue(90);
-  show();
-}
-
-QgsComposerItemGroup::~QgsComposerItemGroup()
-{
-  QSet<QgsComposerItem*>::iterator itemIt = mItems.begin();
-  for(; itemIt != mItems.end(); ++itemIt)
-    {
-      emit childItemDeleted(*itemIt);
-      delete (*itemIt);
-    }
-}
- 
-void QgsComposerItemGroup::addItem(QgsComposerItem* item)
-{
-  if(!item)
-    {
-      return;
-    }
-
-  if(mItems.contains(item))
-    {
-      return;
-    }
-  mItems.insert(item);
-  item->setSelected(false);
-  item->setFlag(QGraphicsItem::ItemIsSelectable, false); //item in groups cannot be selected
-
-  //update extent (which is in scene coordinates)
-  double minXItem = item->transform().dx();
-  double minYItem = item->transform().dy();
-  double maxXItem = minXItem + item->rect().width();
-  double maxYItem = minYItem + item->rect().height();
-
-  if(mSceneBoundingRectangle.isEmpty()) //we add the first item
-    {
-      mSceneBoundingRectangle.setLeft(minXItem);
-      mSceneBoundingRectangle.setTop(minYItem);
-      mSceneBoundingRectangle.setRight(maxXItem);
-      mSceneBoundingRectangle.setBottom(maxYItem);
-    }
-
-  else
-    {
-      if(minXItem < mSceneBoundingRectangle.left())
-	{
-	  mSceneBoundingRectangle.setLeft(minXItem);
-	}
-      if(minYItem < mSceneBoundingRectangle.top())
-	{
-	  mSceneBoundingRectangle.setTop(minYItem);
-	}
-      if(maxXItem > mSceneBoundingRectangle.right())
-	{
-	  mSceneBoundingRectangle.setRight(maxXItem);
-	}
-      if(maxYItem > mSceneBoundingRectangle.bottom())
-	{
-	  mSceneBoundingRectangle.setBottom(maxYItem);
-	}
-    }
-
-  QgsComposerItem::setSceneRect(mSceneBoundingRectangle); //call method of superclass to avoid repositioning of items
-
-}
-
-void QgsComposerItemGroup::removeItems()
-{
-  QSet<QgsComposerItem*>::iterator item_it = mItems.begin();
-  for(; item_it != mItems.end(); ++item_it)
-    {
-      (*item_it)->setFlag(QGraphicsItem::ItemIsSelectable, true); //enable item selection again
-      (*item_it)->setSelected(true);
-    }
-  mItems.clear();
-}
-
-void QgsComposerItemGroup::paint( QPainter * painter, const QStyleOptionGraphicsItem * option, QWidget * widget)
-{
-  drawFrame(painter);
-  if(isSelected())
-    {
-      drawSelectionBoxes(painter);
-    }
-}
-
-void QgsComposerItemGroup::setSceneRect(const QRectF& rectangle)
-{
-  //calculate values between 0 and 1 for boundaries of all contained items, depending on their positions in the item group rectangle.
-  //then position the item boundaries in the new item group rect such that these values are the same
-  double xLeftCurrent = transform().dx();
-  double xRightCurrent = xLeftCurrent + rect().width();
-  double yTopCurrent = transform().dy();
-  double yBottomCurrent = yTopCurrent + rect().height();
-  
-  double xItemLeft, xItemRight, yItemTop, yItemBottom;
-  double xItemLeftNew, xItemRightNew, yItemTopNew, yItemBottomNew;
-  double xParamLeft, xParamRight, yParamTop, yParamBottom;
-  
-
-  QSet<QgsComposerItem*>::iterator item_it = mItems.begin();
-  for(; item_it != mItems.end(); ++item_it)
-    {
-      xItemLeft = (*item_it)->transform().dx();
-      xItemRight = xItemLeft + (*item_it)->rect().width();
-      yItemTop = (*item_it)->transform().dy();
-      yItemBottom = yItemTop + (*item_it)->rect().height();
-
-      xParamLeft = ( xItemLeft - xLeftCurrent) / (xRightCurrent - xLeftCurrent);
-      xParamRight = ( xItemRight - xLeftCurrent) / (xRightCurrent - xLeftCurrent);
-      yParamTop = (yItemTop - yTopCurrent) / (yBottomCurrent - yTopCurrent);
-      yParamBottom = (yItemBottom - yTopCurrent) / (yBottomCurrent - yTopCurrent);
-
-      xItemLeftNew = xParamLeft * rectangle.right()  + (1 - xParamLeft) * rectangle.left();
-      xItemRightNew = xParamRight * rectangle.right() + (1 - xParamRight) * rectangle.left();
-      yItemTopNew = yParamTop * rectangle.bottom() + (1 - yParamTop) * rectangle.top();
-      yItemBottomNew = yParamBottom * rectangle.bottom() + (1 - yParamBottom) * rectangle.top();
-
-      (*item_it)->setSceneRect(QRectF(xItemLeftNew, yItemTopNew, xItemRightNew - xItemLeftNew, yItemBottomNew - yItemTopNew));    
-    }
-  QgsComposerItem::setSceneRect(rectangle);
-}
-
-void QgsComposerItemGroup::drawFrame(QPainter* p)
-{
-  if(!mComposition)
-    {
-      return;
-    }
-
-  if(mFrame && mComposition->plotStyle() == QgsComposition::Preview)
-    {
-      QPen newPen(pen());
-      newPen.setStyle(Qt::DashLine);
-      newPen.setColor(QColor(128, 128, 128, 128));
-      p->setPen(newPen);
-      p->setRenderHint(QPainter::Antialiasing, true);
-      p->drawRect (QRectF( 0, 0, rect().width(), rect().height()));
-    }
-}
-
-bool QgsComposerItemGroup::writeXML(QDomElement& elem, QDomDocument & doc)
-{
-  return true; //soon...
-}
-
-bool QgsComposerItemGroup::readXML(const QDomElement& itemElem, const QDomDocument& doc)
-{
-  return false; //soon...
-}

Deleted: trunk/qgis/src/app/composer/qgscomposeritemgroup.h
===================================================================
--- trunk/qgis/src/app/composer/qgscomposeritemgroup.h	2008-08-23 07:18:39 UTC (rev 9123)
+++ trunk/qgis/src/app/composer/qgscomposeritemgroup.h	2008-08-23 07:45:12 UTC (rev 9124)
@@ -1,68 +0,0 @@
-/***************************************************************************
-                         qgscomposeritemgroup.h
-                         ----------------------
-    begin                : 2nd June 2008
-    copyright            : (C) 2008 by Marco Hugentobler
-    email                : marco dot hugentobler at karto dot baug dot ethz dot ch
- ***************************************************************************/
-
-/***************************************************************************
- *                                                                         *
- *   This program is free software; you can redistribute it and/or modify  *
- *   it under the terms of the GNU General Public License as published by  *
- *   the Free Software Foundation; either version 2 of the License, or     *
- *   (at your option) any later version.                                   *
- *                                                                         *
- ***************************************************************************/
-
-#include "qgscomposeritem.h"
-#include <QObject>
-#include <QSet>
-
-class QgsComposition;
-
-/** \ingroup MapComposer
- * A container for grouping several QgsComposerItems
- */
-class QgsComposerItemGroup: public QObject, public QgsComposerItem
-{
-  Q_OBJECT
- public:
-  QgsComposerItemGroup(QgsComposition* c);
-  ~QgsComposerItemGroup();
-  /**Adds an item to the group. All the group members are deleted 
-   if the group is deleted*/
-  void addItem(QgsComposerItem* item);
-  /**Removes the items but does not delete them*/
-  void removeItems();
-  /**Draw outline and ev. selection handles*/
-  void paint( QPainter * painter, const QStyleOptionGraphicsItem * option, QWidget * widget = 0);
-  /**Sets this items bound in scene coordinates such that 1 item size units
-     corresponds to 1 scene size unit*/
-  void setSceneRect(const QRectF& rectangle);
-  /** resizes an item in x- and y direction (scene coordinates)*/
-  void resize(double dx, double dy);
-
-  /** stores state in DOM node
-     * @param elem is DOM element corresponding to 'Composer' tag
-     * @param temp write template file
-     */
-  bool writeXML(QDomElement& elem, QDomDocument & doc);
-
-  /** sets state from DOM document
-     * @param itemElem is DOM node corresponding to item tag
-     */
-  bool readXML(const QDomElement& itemElem, const QDomDocument& doc);
-
- signals:
-  void childItemDeleted(QgsComposerItem* item);
-
- protected:
-  void drawFrame(QPainter* p);
-
- private:
-  QSet<QgsComposerItem*> mItems;
-  QRectF mSceneBoundingRectangle;
-};
-
-

Deleted: trunk/qgis/src/app/composer/qgscomposervectorlegend.cpp
===================================================================
--- trunk/qgis/src/app/composer/qgscomposervectorlegend.cpp	2008-08-23 07:18:39 UTC (rev 9123)
+++ trunk/qgis/src/app/composer/qgscomposervectorlegend.cpp	2008-08-23 07:45:12 UTC (rev 9124)
@@ -1,960 +0,0 @@
-/***************************************************************************
-                         qgscomposervectorlegend.cpp
-                             -------------------
-    begin                : January 2005
-    copyright            : (C) 2005 by Radim Blazek
-    email                : blazek at itc.it
- ***************************************************************************/
-
-/***************************************************************************
- *                                                                         *
- *   This program is free software; you can redistribute it and/or modify  *
- *   it under the terms of the GNU General Public License as published by  *
- *   the Free Software Foundation; either version 2 of the License, or     *
- *   (at your option) any later version.                                   *
- *                                                                         *
- ***************************************************************************/
-
-#include "qgscomposervectorlegend.h"
-#include "qgscomposermap.h"
-#include "qgscontinuouscolorrenderer.h"
-#include "qgsmapcanvas.h"
-#include "qgsmaplayer.h"
-#include "qgsproject.h"
-#include "qgsrenderer.h"
-#include "qgssymbol.h"
-#include "qgsvectorlayer.h"
-
-#include <QContextMenuEvent>
-#include <QFontDialog>
-#include <QGraphicsScene>
-#include <QHeaderView>
-#include <QMenu>
-#include <QPainter>
-#include <QTreeWidgetItem>
-
-#include <iostream>
-#include <vector>
-
-#if 0
-
-QgsComposerVectorLegend::QgsComposerVectorLegend ( QgsComposition *composition, int id, 
-                                              int x, int y, int fontSize )
-    : QWidget(composition), QgsComposerItem(x,y,10,10,0)
-{
-  setupUi(this);
-
-#ifdef QGISDEBUG
-  std::cout << "QgsComposerVectorLegend::QgsComposerVectorLegend()" << std::endl;
-#endif
-
-  mComposition = composition;
-  mId  = id;
-  mMapCanvas = mComposition->mapCanvas();
-
-  init();
-
-  // Font and pen
-  if(fontSize < 10){
-    fontSize = 10;
-  }
-  mFont.setPointSize ( fontSize );
-    
-  // Set map to the first available if any
-  std::vector<QgsComposerMap*> maps = mComposition->maps();
-  if ( maps.size() > 0 ) {
-    mMap = maps[0]->id();
-  }
-
-  // Calc size and cache
-  recalculate();
-
-  // Add to scene
-  mComposition->canvas()->addItem(this);
-  QGraphicsRectItem::show();
-  QGraphicsRectItem::update();
-
-     
-  writeSettings();
-}
-
-QgsComposerVectorLegend::QgsComposerVectorLegend ( QgsComposition *composition, int id ) 
-    : QgsComposerItem(0,0,10,10,0)
-{
-#ifdef QGISDEBUG
-    std::cout << "QgsComposerVectorLegend::QgsComposerVectorLegend()" << std::endl;
-#endif
-
-    setupUi(this);
-
-    mComposition = composition;
-    mId  = id;
-    mMapCanvas = mComposition->mapCanvas();
-
-    init();
-
-    readSettings();
-
-    // Calc size and cache
-    recalculate();
-
-    // Add to scene
-    mComposition->canvas()->addItem(this);
-
-    QGraphicsRectItem::show();
-    QGraphicsRectItem::update();
-}
-
-void QgsComposerVectorLegend::init ( void ) 
-{
-  setSelected(false);
-    mNumCachedLayers = 0;
-    mTitle = tr("Legend");
-    mMap = 0;
-    mNextLayerGroup = 1;
-    mFrame = true;
-
-    // Cache
-    mCacheUpdated = false;
-
-    // Rectangle
-    QGraphicsRectItem::setZValue(50);
-//    setActive(true);
-
-    // Layers list view
-//x    mLayersListView->setResizeMode(QTreeView::AllColumns);
-    mLayersListView->setColumnHidden(2, true);
-
-    connect ( mLayersListView, SIGNAL(itemClicked(QTreeWidgetItem *, int)), 
-                         this, SLOT(layerChanged(QTreeWidgetItem *)));
-
-    // Plot style
-    setPlotStyle ( QgsComposition::Preview );
-    
-    // Preview style
-    mPreviewMode = Render;
-    mPreviewModeComboBox->addItem ( tr("Cache"), Cache );
-    mPreviewModeComboBox->addItem ( tr("Render"), Render );
-    mPreviewModeComboBox->addItem ( tr("Rectangle"), Rectangle );
-    mPreviewModeComboBox->setCurrentIndex ( mPreviewMode );
-
-    connect ( mComposition, SIGNAL(mapChanged(int)), this, SLOT(mapChanged(int)) ); 
-}
-
-QgsComposerVectorLegend::~QgsComposerVectorLegend()
-{
-  //std::cerr << "QgsComposerVectorLegend::~QgsComposerVectorLegend()" << std::endl;
-}
-
-#define FONT_WORKAROUND_SCALE 10
-QRectF QgsComposerVectorLegend::render ( QPainter *p )
-{
-#ifdef QGISDEBUG
-  std::cout << "QgsComposerVectorLegend::render p = " << p << std::endl;
-#endif
-
-#if 0
-
-  // Painter can be 0, create dummy to avoid many if below
-  QPainter *painter = NULL;
-  QPixmap *pixmap = NULL;
-  if ( p ) {
-    painter = p;
-  } else {
-    pixmap = new QPixmap(1,1);
-    painter = new QPainter( pixmap );
-  }
-
-  //std::cout << "mComposition->scale() = " << mComposition->scale() << std::endl;
-
-  // Font size in canvas units
-  float titleSize = 25.4 * mComposition->scale() * mTitleFont.pointSizeF() / 72;
-  float sectionSize = 25.4 * mComposition->scale() * mSectionFont.pointSizeF() / 72;
-  float size = 25.4 * mComposition->scale() * mFont.pointSizeF() / 72;
-
-  //std::cout << "font sizes = " << titleSize << " " << sectionSize << " " << size << std::endl;
-
-  // Create fonts 
-  QFont titleFont ( mTitleFont );
-  QFont sectionFont ( mSectionFont );
-  QFont font ( mFont );
-
-  titleFont.setPointSizeF ( titleSize );
-  sectionFont.setPointSizeF ( sectionSize );
-  font.setPointSizeF ( size );
-
-  // Not sure about Style Strategy, QFont::PreferMatch?
-  titleFont.setStyleStrategy ( (QFont::StyleStrategy) (QFont::PreferOutline | QFont::PreferAntialias) );
-  sectionFont.setStyleStrategy ( (QFont::StyleStrategy) (QFont::PreferOutline | QFont::PreferAntialias) );
-  font.setStyleStrategy ( (QFont::StyleStrategy) (QFont::PreferOutline | QFont::PreferAntialias) );
-
-
-  QFontMetricsF titleMetrics ( titleFont );
-  QFontMetricsF sectionMetrics ( sectionFont );
-  QFontMetricsF metrics ( font );
-
-  if ( plotStyle() == QgsComposition::Postscript) //do we need seperate PostScript rendering settings?
-  {
-    // Fonts sizes for Postscript rendering
-    double psTitleSize = titleMetrics.ascent() * 72.0 / mComposition->resolution(); //What??
-    double psSectionSize = sectionMetrics.ascent() * 72.0 / mComposition->resolution();
-    double psSize = metrics.ascent() * 72.0 / mComposition->resolution();
-
-    titleFont.setPointSizeF ( psTitleSize * FONT_WORKAROUND_SCALE );
-    sectionFont.setPointSizeF ( psSectionSize * FONT_WORKAROUND_SCALE );
-    font.setPointSizeF ( psSize * FONT_WORKAROUND_SCALE );
-  }
-  else
-  {
-    titleFont.setPointSizeF ( titleSize * FONT_WORKAROUND_SCALE );
-    sectionFont.setPointSizeF ( sectionSize * FONT_WORKAROUND_SCALE );
-    font.setPointSizeF ( size * FONT_WORKAROUND_SCALE );
-  }
-
-  double x, y;
-
-  // Legend title  -if we do this later, we can center it
-  y = mMargin + titleMetrics.height();
-  painter->setPen ( mPen );
-  painter->setFont ( titleFont );
-
-
-  painter->save(); //Save the painter state so we can undo the scaling later
-  painter->scale(1./FONT_WORKAROUND_SCALE, 1./FONT_WORKAROUND_SCALE); //scale the painter to work around the font bug
-
-  painter->drawText( QPointF(2 * mMargin * FONT_WORKAROUND_SCALE, y * FONT_WORKAROUND_SCALE), mTitle );
-
-  painter->restore();
-
-  //used to keep track of total width and height 
-  double width = 4 * mMargin + titleMetrics.width ( mTitle ); 
-  double height = mMargin + mSymbolSpace + titleMetrics.height(); // mSymbolSpace?
-
-  // Layers
-  QgsComposerMap *map = mComposition->map ( mMap ); //Get the map from the composition by ID number
-  if ( map ) {
- 
-    std::map<int,int> doneGroups;
-      
-    int nlayers = mMapCanvas->layerCount();
-    for ( int i = nlayers - 1; i >= 0; i-- ) {
-      QgsMapLayer *layer = mMapCanvas->getZpos(i);
-//      if ( !layer->visible() ) continue; // skip non-visible layers
-      if ( layer->type() != QgsMapLayer::VECTOR ) continue; //skip raster layers
-
-      QString layerId = layer->getLayerID();
-
-//      if( ! layerOn(layerId) ) continue; //does this need to go away?
-
-      int group = layerGroup ( layerId );
-      if ( group > 0 ) { 
-        if ( doneGroups.find(group) != doneGroups.end() ) {
-          continue; 
-        } else {
-          doneGroups.insert(std::make_pair(group,1));
-        }
-      }
-
-      // Make list of all layers in the group and count section items
-      std::vector<int> groupLayers; // vector of layers
-      std::vector<double> itemHeights; // maximum item sizes
-      std::vector<QString> itemLabels; // item labels
-      int sectionItemsCount = 0;
-      QString sectionTitle;
-
-
-      for ( int j = nlayers - 1; j >= 0; j-- )
-      {
-        QgsMapLayer *layer2 = mMapCanvas->getZpos(j);
-//        if ( !layer2->visible() ) continue;
-        if ( layer2->type() != QgsMapLayer::VECTOR ) continue;
-	      
-        QString layerId2 = layer2->getLayerID();
-        if( ! layerOn(layerId2) ) continue;
-	    
-        int group2 = layerGroup ( layerId2 );
-	    
-        QgsVectorLayer *vector = dynamic_cast <QgsVectorLayer*> (layer2);
-        const QgsRenderer *renderer = vector->renderer();
-
-        if ( (group > 0 && group2 == group) || ( group == 0 && j == i )  ) {
-          groupLayers.push_back(j);
-
-          QList<QgsSymbol*> symbols = renderer->symbols();
-
-          if ( sectionTitle.length() == 0 ) {
-            sectionTitle = layer2->name();
-          }        
-		  
-          if ( symbols.size() > sectionItemsCount ) {
-            sectionItemsCount = symbols.size();
-            itemHeights.resize(sectionItemsCount);
-            itemLabels.resize(sectionItemsCount); 
-          }
-
-	  //          double widthScale = map->widthScale() * mComposition->scale();
-          if ( plotStyle() == QgsComposition::Preview && mPreviewMode == Render ) {
-            widthScale *= mComposition->viewScale();
-          }
-		
-          //double scale = map->symbolScale() * mComposition->scale();
-
-          int icnt = 0;
-          for ( QList<QgsSymbol*>::iterator it = symbols.begin(); it != symbols.end(); ++it ) {
-		
-            QgsSymbol* sym = (*it);
-	      
-            // height
-            if ( itemHeights[icnt] < mSymbolHeight ) { // init first
-              itemHeights[icnt] = mSymbolHeight;
-            }
-
-            QPixmap pic = QPixmap::fromImage(sym->getPointSymbolAsImage(widthScale, false));
-
-            double h = scale * pic.height();
-            if ( h > itemHeights[icnt] ) {
-              itemHeights[icnt] = h;
-            }
-
-            if ( itemLabels[icnt].length() == 0 ) {
-              if ( sym->label().length() > 0 ) {
-		            itemLabels[icnt] = sym->label();
-              } else {
-		            itemLabels[icnt] = sym->lowerValue();
-                if (sym->upperValue().length() > 0)
-                  itemLabels[icnt] += " - " + sym->upperValue();
-              }
-            }
-		  
-            icnt++;
-          }
-        }
-      }
-      //std::cout << "group size = " << groupLayers.size() << std::endl;
-      //std::cout << "sectionItemsCount = " << sectionItemsCount << std::endl;
-
-
-      // Section title 
-      if ( sectionItemsCount > 1 )
-      {
-        height += mSymbolSpace;
-
-        x = 2*mMargin;
-        y = height + sectionMetrics.height();
-        painter->setPen ( mPen );
-        painter->setFont ( sectionFont );
-
-        painter->save(); //Save the painter state so we can undo the scaling later
-        painter->scale(1./FONT_WORKAROUND_SCALE, 1./FONT_WORKAROUND_SCALE); //scale the painter to work around the font bug
-
-        painter->drawText(QPointF(x * FONT_WORKAROUND_SCALE, y * FONT_WORKAROUND_SCALE), sectionTitle );
-        painter->restore();
-
-        double w = 3*mMargin + sectionMetrics.width( sectionTitle );
-        if ( w > width ) width = w;
-        height += sectionMetrics.height();
-        height += (1.5*mSymbolSpace);
-      }
-
-
-      // Draw all layers in group 
-      double groupStartHeight = height;
-      for ( int j = groupLayers.size()-1; j >= 0; j-- )
-      {
-	    //std::cout << "layer = " << groupLayers[j] << std::endl;
-
-	    double localHeight = groupStartHeight;
-	
-	    layer = mMapCanvas->getZpos(groupLayers[j]);
-	    QgsVectorLayer *vector = dynamic_cast <QgsVectorLayer*> (layer);
-	    const QgsRenderer *renderer = vector->renderer();
-
-	    // Get a list of the symbols from the renderer - some renderers can have several symbols
-	    QList<QgsSymbol*> symbols = renderer->symbols();
-
-
-	    int icnt = 0;
-	    for ( QList<QgsSymbol*>::iterator it = symbols.begin(); it != symbols.end(); ++it ) {
-          localHeight += mSymbolSpace;
-
-          double symbolHeight = itemHeights[icnt];
-          QgsSymbol* sym = (*it);
-	    
-          QPen pen = sym->pen();
-          //double widthScale = map->widthScale();
-
-          pen.setWidthF( ( widthScale * pen.widthF() ) );
-          pen.setCapStyle(Qt::FlatCap); //make sure that the line doesn't extend past its endpoints
-          painter->setPen ( pen );
-          painter->setBrush ( sym->brush() );
-	    
-          if ( vector->vectorType() == QGis::Point ) {
-            double scale = map->symbolScale();
-
-            // Get the picture of appropriate size directly from catalogue
-            QPixmap pic = QPixmap::fromImage(sym->getPointSymbolAsImage(widthScale,false,sym->color()));
-
-            painter->save();
-            painter->scale(scale,scale);
-            painter->drawPixmap ( static_cast<int>( (1.*mMargin+mSymbolWidth/2)/scale-pic.width()/2),
-                                  static_cast<int>( (1.*localHeight+symbolHeight/2)/scale-1.*pic.height()/2),
-                                  pic );
-            painter->restore();
-
-          } else if ( vector->vectorType() == QGis::Line ) {
-            painter->drawLine (QPointF(mMargin, localHeight+mSymbolHeight/2), 
-                               QPointF(mMargin+mSymbolWidth, localHeight+mSymbolHeight/2));
-          } else if ( vector->vectorType() == QGis::Polygon ) {
-            pen.setCapStyle(Qt::FlatCap);
-            painter->setPen ( pen );
-            painter->drawRect (QRectF(mMargin, localHeight, mSymbolWidth, mSymbolHeight));
-          }
-
-          // Label 
-          painter->setPen ( mPen );
-          painter->setFont ( font );
-          QString lab;
-          if ( sectionItemsCount == 1 ) {
-            lab = sectionTitle;
-          } else { 
-            lab = itemLabels[icnt];
-          }
-	    
-          // drawText (x, y w, h, ...) was cutting last letter (the box was too small)
-          QRectF br = metrics.boundingRect ( lab );
-          x = 2*mMargin + mSymbolWidth;
-          y = localHeight + symbolHeight/2 + ( metrics.height()/2 - metrics.descent());
-          painter->save(); //Save the painter state so we can undo the scaling later
-          painter->scale(1./FONT_WORKAROUND_SCALE, 1./FONT_WORKAROUND_SCALE);//scale the painter to work around the font bug
-
-          painter->drawText(QPointF(x * FONT_WORKAROUND_SCALE, y * FONT_WORKAROUND_SCALE), lab );
-          painter->restore();
-          double w = 3*mMargin + mSymbolWidth + metrics.width(lab);
-          if ( w > width ) width = w;
-
-          localHeight += symbolHeight;
-          icnt++;
-
-	    }//End of iterating through the symbols in the renderer
-
-      }
-      // add height of section items to the total height
-      height = groupStartHeight;
-      for ( int j = 0; j < (int)itemHeights.size(); j++ ) {
-	    height += mSymbolSpace + itemHeights[j];
-      }
-      if ( sectionItemsCount > 1 ) { // add more space to separate section from next item
-        height += mSymbolSpace;
-      } 
-
-    }//End of iterating through the layers
-  }//END if(map)
-
-  height += mMargin;
-
-  if(mFrame)
-  {
-    QPen pen(QColor(0,0,0), 0.5);
-    painter->setPen( pen );
-    painter->setBrush( QBrush( QColor(255,255,255), Qt::NoBrush));
-    painter->setRenderHint(QPainter::Antialiasing, true);//turn on antialiasing
-    painter->drawRect(QRectF(0, 0, width, height));
-  }
-
-    
-//  QGraphicsRectItem::setRect(0, 0, width, height); //BUG! - calling this causes a re-draw, which means we are continuously re-drawing.
-    
-  if ( !p ) {
-    delete painter;
-    delete pixmap;
-  }
-
-  return QRectF ( 0, 0, width, height);
-#endif //0
-}
-
-void QgsComposerVectorLegend::cache ( void )
-{
-#ifdef QGISDEBUG
-    std::cout << "QgsComposerVectorLegend::cache()" << std::endl;
-#endif
-
-    //typical boundingRect size is 15 units wide,
-    mCachePixmap = QPixmap((int)QGraphicsRectItem::rect().width(), (int)QGraphicsRectItem::rect().height() );
-
-
-    QPainter p(&mCachePixmap);
-    
-    mCachePixmap.fill(QColor(255,255,255));
-    render ( &p );
-    p.end();
-
-    mNumCachedLayers = mMapCanvas->layerCount();
-    mCacheUpdated = true;    
-}
-
-void QgsComposerVectorLegend::paint( QPainter* painter, const QStyleOptionGraphicsItem* itemStyle, QWidget* pWidget )
-{
-#ifdef QGISDEBUG
-  std::cout << "paint mPlotStyle = " << plotStyle() << " mPreviewMode = " << mPreviewMode << std::endl;
-#endif
-
-  if ( plotStyle() == QgsComposition::Preview && mPreviewMode == Cache )
-  {
-    if ( !mCacheUpdated || mMapCanvas->layerCount() != mNumCachedLayers ) //If the cache is out of date, update it.
-    {
-      cache();
-    }
-    painter->drawPixmap(0,0, mCachePixmap);
-  }
-  else if(plotStyle() == QgsComposition::Preview && mPreviewMode == Rectangle)
-  {
-    QPen pen(QColor(0,0,0), 0.5);
-    painter->setPen( pen );
-    painter->setBrush( QBrush( QColor(255,255,255), Qt::NoBrush)); //use SolidPattern instead?
-    painter->drawRect(QRectF(0, 0, QGraphicsRectItem::rect().width(), QGraphicsRectItem::rect().height()));
-  }
-  else if ( (plotStyle() == QgsComposition::Preview && mPreviewMode == Render) || 
-              plotStyle() == QgsComposition::Print ||
-              plotStyle() == QgsComposition::Postscript ) 
-  //We're in render preview mode or printing, so do a full render of the legend. 
-  {
-    painter->save();
-    render(painter);
-    painter->restore();
-  }
-
-
-  // Draw the "selected highlight" boxes
-  if ( isSelected() && plotStyle() == QgsComposition::Preview ) {
-
-    painter->setPen( mComposition->selectionPen() );
-    painter->setBrush( mComposition->selectionBrush() );
-  
-    double s = mComposition->selectionBoxSize();
-
-    painter->drawRect(QRectF(0, 0, s, s)); //top left
-    painter->drawRect(QRectF(QGraphicsRectItem::rect().width()-s, 0, s, s)); //top right
-    painter->drawRect(QRectF(QGraphicsRectItem::rect().width()-s, QGraphicsRectItem::rect().height()-s, s, s)); //bottom right
-    painter->drawRect(QRectF(0, QGraphicsRectItem::rect().height()-s, s, s)); //bottom left
-  }
-}
-
-void QgsComposerVectorLegend::on_mFontButton_clicked ( void ) 
-{
-  bool result;
-
-  mFont = QFontDialog::getFont(&result, mFont, this );
-
-  if ( result ) {
-    recalculate();
-    QGraphicsRectItem::update();
-    QGraphicsRectItem::scene()->update();
-    writeSettings();
-  }
-}
-
-void QgsComposerVectorLegend::on_mTitleLineEdit_editingFinished ( void )
-{
-    mTitle = mTitleLineEdit->text();
-    recalculate();
-    QGraphicsRectItem::update();
-    QGraphicsRectItem::scene()->update();
-    writeSettings();
-}
-
-void QgsComposerVectorLegend::on_mPreviewModeComboBox_activated ( int i )
-{
-    mPreviewMode = (PreviewMode) i;
-#ifdef QGISDEBUG
-    std::cout << "mPreviewMode = " << mPreviewMode << std::endl;
-#endif
-    writeSettings();
-}
-
-void QgsComposerVectorLegend::on_mMapComboBox_activated ( int i )
-{
-    mMap = mMaps[i];
-    recalculate();
-    QGraphicsRectItem::update();
-    QGraphicsRectItem::scene()->update();
-    writeSettings();
-}
-
-void QgsComposerVectorLegend::mapChanged ( int id )
-{
-    if ( id != mMap ) return;
-
-    recalculate();
-    QGraphicsRectItem::update();
-    QGraphicsRectItem::scene()->update();
-}
-
-void QgsComposerVectorLegend::on_mFrameCheckBox_stateChanged ( int )
-{
-    mFrame = mFrameCheckBox->isChecked();
-
-    QGraphicsRectItem::update();
-    QGraphicsRectItem::scene()->update();
-
-    writeSettings();
-}
-
-void QgsComposerVectorLegend::recalculate ( void ) 
-{
-#ifdef QGISDEBUG
-    std::cout << "QgsComposerVectorLegend::recalculate" << std::endl;
-#endif
-    
-    // Recalculate sizes according to current font size
-    
-    // Title and section font 
-    mTitleFont = mFont;
-    mTitleFont.setPointSizeF ( 1.4 * mFont.pointSizeF());
-    mSectionFont = mFont;
-    mSectionFont.setPointSizeF ( 1.2 * mFont.pointSizeF() );
-    
-    // Font size in canvas units
-    float size = 25.4 * mComposition->scale() * mFont.pointSizeF() / 72;
-
-    mMargin = 0.9 * size;
-    mSymbolHeight = 1.3 * size;
-    mSymbolWidth = 3.5 * size;
-    mSymbolSpace = 0.4 * size;
-
-#ifdef QGISDEBUG
-    std::cout << "font size = " << mFont.pointSizeF() << std::endl;
-    std::cout << "title font size = " << mTitleFont.pointSizeF() << std::endl;
-
-    std::cout << "mMargin = " << mMargin << " mSymbolHeight = " << mSymbolHeight
-              << "mSymbolWidth = " << mSymbolWidth << " mSymbolSpace = " << mSymbolSpace << std::endl;
-#endif
-
-    QRectF r = render(0);
-
-    QGraphicsRectItem::setRect(0, 0, r.width(), r.height() );
-    
-    mCacheUpdated = false;
-}
-
-void QgsComposerVectorLegend::setOptions ( void )
-{ 
-  mTitleLineEdit->setText( mTitle );
-    
-  // Maps
-  mMapComboBox->clear();
-  std::vector<QgsComposerMap*> maps = mComposition->maps();
-
-  mMaps.clear();
-    
-  bool found = false;
-  mMapComboBox->addItem ( "" );
-  mMaps.push_back ( 0 );
-  for ( int i = 0; i < (int)maps.size(); i++ ) {
-    mMapComboBox->addItem ( maps[i]->name() );
-    mMaps.push_back ( maps[i]->id() );
-
-    if ( maps[i]->id() == mMap ) {
-      found = true;
-      mMapComboBox->setCurrentIndex ( i+1 );
-    }
-  }
-
-  if ( ! found ) {
-    mMap = 0;
-    mMapComboBox->setCurrentIndex ( 0 );
-  }
-
-  mFrameCheckBox->setChecked ( mFrame );
-    
-  // Layers
-  mLayersListView->clear();
-
-  if ( mMap != 0 ) {
-    QgsComposerMap *map = mComposition->map ( mMap );
-
-    if ( map ) {
-      int nlayers = mMapCanvas->layerCount();
-      for ( int i = 0; i < nlayers; i++ ) {
-        QgsMapLayer *layer = mMapCanvas->getZpos(i);
-
-//        if ( !layer->visible() ) continue;
-        //if ( layer->type() != QgsMapLayer::VECTOR ) continue;
-
-        QTreeWidgetItem *item = new QTreeWidgetItem(mLayersListView);
-
-        item->setText(0, layer->name() );
-
-        QString id = layer->getLayerID();
-        item->setText(2, id );
-
-        item->setCheckState(0, layerOn(id) ? Qt::Checked : Qt::Unchecked);
-
-        int group = layerGroup(id);
-        if ( group > 0 ) {
-          item->setText(1, QString::number(group) );
-        }
-      }
-      mLayersListView->header()->resizeSections(QHeaderView::Stretch);
-    }
-  }
-
-  mPreviewModeComboBox->setCurrentIndex( mPreviewMode );
-}
-
-void QgsComposerVectorLegend::setSelected (  bool s ) 
-{
-  QGraphicsRectItem::setSelected(s);
-  QGraphicsRectItem::update(); // show highlight
-}    
-
-bool QgsComposerVectorLegend::selected( void )
-{
-  return isSelected();
-}
-
-void QgsComposerVectorLegend::contextMenuEvent( QContextMenuEvent *event)
-{
-#ifdef QGISDEBUG
-  std::cout << "QgsComposerVectorLegend::contextMenuEvent" << std::endl;
-#endif
-
-  QMenu layersPopupMenu( this);
-  layersPopupMenu.addAction( tr("Combine selected layers"), this, SLOT(groupLayers()) );
-  layersPopupMenu.exec( event->globalPos());
-}
-
-bool QgsComposerVectorLegend::layerOn ( QString id ) 
-{
-  std::map<QString,bool>::iterator it = mLayersOn.find(id);
-
-  if(it != mLayersOn.end() ) {
-    return ( it->second );
-  }
-
-    return true;
-}
-
-void QgsComposerVectorLegend::setLayerOn ( QString id, bool on ) 
-{
-  std::map<QString,bool>::iterator it = mLayersOn.find(id);
-
-  if(it != mLayersOn.end() ) {
-    it->second = on;
-  } else {
-    mLayersOn.insert(std::make_pair(id,on));
-  }
-}
-
-int QgsComposerVectorLegend::layerGroup ( QString id ) 
-{
-  std::map<QString,int>::iterator it = mLayersGroups.find(id);
-
-  if(it != mLayersGroups.end() ) {
-    return ( it->second );
-  }
-
-  return 0;
-}
-
-void QgsComposerVectorLegend::setLayerGroup ( QString id, int group ) 
-{
-  std::map<QString,int>::iterator it = mLayersGroups.find(id);
-
-  if(it != mLayersGroups.end() ) {
-    it->second = group;
-  } else {
-    mLayersGroups.insert(std::make_pair(id,group));
-  }
-}
-
-void QgsComposerVectorLegend::layerChanged ( QTreeWidgetItem *lvi )
-{
-#ifdef QGISDEBUG
-    std::cout << "QgsComposerVectorLegend::layerChanged" << std::endl;
-#endif
-
-    if ( lvi == 0 ) return; 
-    
-    QString id = lvi->text(2);
-    setLayerOn(id, lvi->checkState(0) == Qt::Checked);
-
-    writeSettings();
-
-    recalculate();
-    QGraphicsRectItem::update();
-    QGraphicsRectItem::scene()->update();
-}
-
-void QgsComposerVectorLegend::groupLayers ( void ) 
-{
-#ifdef QGISDEBUG
-  std::cout << "QgsComposerVectorLegend::groupLayers" << std::endl;
-#endif
-
-  QTreeWidgetItemIterator it( mLayersListView );
-  int count = 0;
-  QTreeWidgetItem *lastItem = NULL;
-  QString id;
-  while ( *it ) {
-    if ( (*it)->isSelected() ) {
-      #ifdef QGISDEBUG
-      std::cout << "selected: " << (*it)->text(0).toLocal8Bit().data() << " " << (*it)->text(2).toLocal8Bit().data() << std::endl;
-      #endif
-
-      id = (*it)->text(2);
-      setLayerGroup ( id, mNextLayerGroup );
-      (*it)->setText(1,QString::number(mNextLayerGroup) );
-      lastItem = *it;
-      count++;
-    }
-    ++it;
-  }
-  if ( count == 1 ) { // one item only
-    setLayerGroup ( id, 0 );
-    lastItem->setText(1,"" );
-  }
-
-#ifdef QGISDEBUG
-  std::cout << "Groups:" << std::endl;
-
-  for ( std::map<QString,int>::iterator it3 = mLayersGroups.begin(); it3 != mLayersGroups.end(); ++it3 ) {
-    std::cout << "layer: " << (it3->first).toLocal8Bit().data() << " group: " << it3->second << std::endl;
-  }
-#endif
-    
-  mNextLayerGroup++;
-    
-  writeSettings();
-
-  recalculate();
-  QGraphicsRectItem::update();
-  QGraphicsRectItem::scene()->update();
-}    
-
-QWidget *QgsComposerVectorLegend::options ( void )
-{
-    setOptions ();
-    return ( dynamic_cast <QWidget *> (this) ); 
-}
-
-bool QgsComposerVectorLegend::writeSettings ( void )  
-{
-#ifdef QGISDEBUG
-  std::cout << "QgsComposerVectorLegend::writeSettings" << std::endl;
-#endif
-
-  QString path;
-  path.sprintf("/composition_%d/vectorlegend_%d/", mComposition->id(), mId ); 
-
-  QgsProject::instance()->writeEntry( "Compositions", path+"x", mComposition->toMM((int)QGraphicsRectItem::x()) );
-  QgsProject::instance()->writeEntry( "Compositions", path+"y", mComposition->toMM((int)QGraphicsRectItem::y()) );
-
-  QgsProject::instance()->writeEntry( "Compositions", path+"map", mMap );
-
-  QgsProject::instance()->writeEntry( "Compositions", path+"title", mTitle );
-
-  QgsProject::instance()->writeEntry( "Compositions", path+"font/size", mFont.pointSize() );
-  QgsProject::instance()->writeEntry( "Compositions", path+"font/family", mFont.family() );
-  QgsProject::instance()->writeEntry( "Compositions", path+"font/weight", mFont.weight() );
-  QgsProject::instance()->writeEntry( "Compositions", path+"font/underline", mFont.underline() );
-  QgsProject::instance()->writeEntry( "Compositions", path+"font/strikeout", mFont.strikeOut() );
-
-  QgsProject::instance()->writeEntry( "Compositions", path+"frame", mFrame );
-
-  // Layers: remove all, write new
-  path.sprintf("/composition_%d/vectorlegend_%d/layers/", mComposition->id(), mId ); 
-  QgsProject::instance()->removeEntry ( "Compositions", path );
-    
-  if ( mMap != 0 ) {
-    QgsComposerMap *map = mComposition->map ( mMap );
-
-    if ( map ) {
-      int nlayers = mMapCanvas->layerCount();
-      for ( int i = 0; i < nlayers; i++ ) {
-        QgsMapLayer *layer = mMapCanvas->getZpos(i);
-    
-//        if ( !layer->visible() ) continue;
-
-        QString id = layer->getLayerID();
-        path.sprintf("/composition_%d/vectorlegend_%d/layers/layer_%s/", mComposition->id(), mId, id.toLocal8Bit().data() ); 
-        QgsProject::instance()->writeEntry( "Compositions", path+"on", layerOn(id) );
-        QgsProject::instance()->writeEntry( "Compositions", path+"group", layerGroup(id) );
-      }
-    }
-  }
-
-  QgsProject::instance()->writeEntry( "Compositions", path+"previewmode", mPreviewMode );
-    
-  return true; 
-}
-
-bool QgsComposerVectorLegend::readSettings ( void )
-{
-  bool ok;
-  QString path;
-  path.sprintf("/composition_%d/vectorlegend_%d/", mComposition->id(), mId );
-
-  double x = mComposition->fromMM(QgsProject::instance()->readDoubleEntry( "Compositions", path+"x", 0, &ok));
-  double y = mComposition->fromMM(QgsProject::instance()->readDoubleEntry( "Compositions", path+"y", 0, &ok));
-
-  QGraphicsRectItem::setPos(x, y);
-
-  mMap = QgsProject::instance()->readNumEntry("Compositions", path+"map", 0, &ok);
-  mTitle = QgsProject::instance()->readEntry("Compositions", path+"title", "???", &ok);
-     
-  mFont.setFamily ( QgsProject::instance()->readEntry("Compositions", path+"font/family", "", &ok) );
-  mFont.setPointSize ( QgsProject::instance()->readNumEntry("Compositions", path+"font/size", 10, &ok) );
-  mFont.setWeight(  QgsProject::instance()->readNumEntry("Compositions", path+"font/weight", (int)QFont::Normal, &ok) );
-  mFont.setUnderline(  QgsProject::instance()->readBoolEntry("Compositions", path+"font/underline", false, &ok) );
-  mFont.setStrikeOut(  QgsProject::instance()->readBoolEntry("Compositions", path+"font/strikeout", false, &ok) );
-
-  mFrame = QgsProject::instance()->readBoolEntry("Compositions", path+"frame", true, &ok);
-
-  // Preview mode
-  mPreviewMode = (PreviewMode) QgsProject::instance()->readNumEntry("Compositions", path+"previewmode", Render, &ok);
-    
-  // Layers
-  path.sprintf("/composition_%d/vectorlegend_%d/layers/", mComposition->id(), mId );
-  QStringList el = QgsProject::instance()->subkeyList ( "Compositions", path );
-    
-  for ( QStringList::iterator it = el.begin(); it != el.end(); ++it ) {
-    int idx = (*it).indexOf('_');
-
-    QString id = (*it).right( (*it).length() - (idx+1) );
-  
-    path.sprintf("/composition_%d/vectorlegend_%d/layers/layer_%s/", mComposition->id(), mId, id.toLocal8Bit().data() );
-    bool on = QgsProject::instance()->readBoolEntry("Compositions", path+"on", true, &ok);
-    int group = QgsProject::instance()->readNumEntry("Compositions", path+"group", 0, &ok);
-    setLayerOn ( id , on );
-    setLayerGroup ( id, group );
-
-    if ( group >= mNextLayerGroup ) mNextLayerGroup = group+1;
-  }
-    
-    
-  recalculate();
-    
-  return true;
-}
-
-bool QgsComposerVectorLegend::removeSettings( void )
-{
-    std::cerr << "QgsComposerVectorLegend::deleteSettings" << std::endl;
-
-    QString path;
-    path.sprintf("/composition_%d/vectorlegend_%d", mComposition->id(), mId ); 
-    return QgsProject::instance()->removeEntry ( "Compositions", path );
-}
-
-bool QgsComposerVectorLegend::writeXML( QDomNode & node, QDomDocument & document, bool temp )
-{
-    return true;
-}
-
-bool QgsComposerVectorLegend::readXML( QDomNode & node )
-{
-    return true;
-}
-
-#endif //0

Deleted: trunk/qgis/src/app/composer/qgscomposervectorlegend.h
===================================================================
--- trunk/qgis/src/app/composer/qgscomposervectorlegend.h	2008-08-23 07:18:39 UTC (rev 9123)
+++ trunk/qgis/src/app/composer/qgscomposervectorlegend.h	2008-08-23 07:45:12 UTC (rev 9124)
@@ -1,220 +0,0 @@
-/***************************************************************************
-                         qgscomposervectorlegend.h
-                             -------------------
-    begin                : January 2005
-    copyright            : (C) 2005 by Radim Blazek
-    email                : blazek at itc.it
- ***************************************************************************/
-
-/***************************************************************************
- *                                                                         *
- *   This program is free software; you can redistribute it and/or modify  *
- *   it under the terms of the GNU General Public License as published by  *
- *   the Free Software Foundation; either version 2 of the License, or     *
- *   (at your option) any later version.                                   *
- *                                                                         *
- ***************************************************************************/
-#ifndef QGSCOMPOSERVECTORLEGEND_H
-#define QGSCOMPOSERVECTORLEGEND_H
-
-#if 0
-
-/*           
- *                    |<>| - mMargin         
- *           
- *                    +----------------------+
- *                    |                      |        
- *                    |    Legend Title      |
- *                    |                      |
- *                    |  Section             |
- *                    |                      |
- *                --  |  +-----+             |  __ 
- *  mSymbolHeight |   |  |     | Item Label  |  __| - mFont->pointSize()
- *                --  |  +-----+             |  --          
- *                    |                      |    | - mSymbolSpace (vertical space between symbol, boxes)
- *                    |  +-----+             |  --
- *                    |  |     | Item Label  |
- *                    |  +-----+             |            
- *                    |                      |
- *                    +----------------------+
- *
- *                             
- *                       |<--->| - mSymbolWidth (lines and areas)
- *                   
- */ 
- 
-
-#include "ui_qgscomposervectorlegendbase.h"
-#include "qgscomposeritem.h"
-
-#include <QGraphicsRectItem>
-#include <QPen>
-class QgsComposition;
-class QgsMapCanvas;
-class QDomNode;
-class QDomDocument;
-class QTreeWidgetItem;
-
-/** \ingroup MapComposer
- *  \class QgsComposerVectorLegend 
- *  \brief Object representing map window. 
- */
-// NOTE: QgsComposerVectorLegendBase must be first, otherwise does not compile
-class QgsComposerVectorLegend : public QWidget,
-                                private Ui::QgsComposerVectorLegendBase,  
-                                public QgsComposerItem
-{
-    Q_OBJECT
-
-public:
-    /** \brief Constructor  
-     *  \param id object id
-     *  \param fontSize font size in typographic points!
-     */
-    QgsComposerVectorLegend( QgsComposition *composition, int id, int x, int y, int fontSize = 0 );
-
-    /** \brief Constructor. Settings are read from project. 
-     *  \param id object id
-     */
-    QgsComposerVectorLegend( QgsComposition *composition, int id );
-    ~QgsComposerVectorLegend();
-
-    /** \brief Preview style  */
-    enum PreviewMode {
-	Cache = 0,   // Use raster cache 
-	Render,      // Render the map
-	Rectangle    // Display only rectangle
-    };
-
-    /** \brief Initialise GUI etc., share by constructors. */
-    void init(void);
-
-    // Reimplement QgsComposerItem:
-    void setSelected( bool s );
-    bool selected( void );
-    QWidget *options ( void );
-    bool writeSettings ( void );
-    bool readSettings ( void );
-    bool removeSettings ( void );
-    bool writeXML( QDomNode & node, QDomDocument & document, bool temp = false );
-    bool readXML( QDomNode & node );
-     
-    /** \brief Draw to paint device, internal use 
-     *  \param painter painter or 0
-     *  \return bounding box 
-     */
-    QRectF render (QPainter *painter);
-
-    /** \brief Reimplementation of QCanvasItem::paint - draw on canvas */
-    void paint ( QPainter*, const QStyleOptionGraphicsItem*, QWidget*);
-    
-    /** \brief Calculate size according to current settings */
-    void recalculate ( void );
-    
-    /** \brief Create cache image */
-    void cache ( void );
-
-    /** \brief Set values in GUI to current values */
-    void setOptions ( void );
-
-    /** \brief Is layer on/off ? */
-    bool layerOn ( QString id );
-
-    /** \brief set layer on/off */
-    void setLayerOn ( QString id, bool on );
-
-    /** \brief get layer group, 0 == no group */
-    int layerGroup ( QString id );
-
-    /** \brief set layer group, 0 == no group */
-    void setLayerGroup ( QString id, int group );
-
-public slots:
-    // Open font dialog
-    void on_mFontButton_clicked ( void );
-
-    // Title changed
-    void on_mTitleLineEdit_editingFinished ( void );
-    
-    // Called by GUI if preview style was changed
-    void on_mPreviewModeComboBox_activated ( int i );
-
-    // Called by GUI when map selection changed
-    void on_mMapComboBox_activated ( int i );
-
-    // Called when map was changed
-    void mapChanged ( int id );
-
-    // Layer status changed
-    void layerChanged ( QTreeWidgetItem *lvi );
-
-    // Combine selected layers
-    void groupLayers( void );
-
-    // Frame settings changed
-    void on_mFrameCheckBox_stateChanged ( int i );
-
-protected:
-    // Show popup menu
-    void contextMenuEvent ( QContextMenuEvent * event );
-
-private:
-    // Pointer to composition
-    QgsComposition *mComposition;
-    
-    // Pointer to map canvas
-    QgsMapCanvas *mMapCanvas;
-    
-    // Composer map id or 0
-    int mMap;
-
-    // Vector of map id for maps in combobox
-    std::vector<int> mMaps;
-
-    // Title 
-    QString mTitle;
-
-    // Font. Font size in typographic points!
-    QFont mTitleFont;
-    QFont mSectionFont;
-    QFont mFont;
-
-    // Pen
-    QPen  mPen;
-
-    double mMargin;
-    double mSymbolHeight;
-    double mSymbolWidth;
-    double mSymbolSpace;
-
-    // Cache used in composer preview
-    // NOTE:  QCanvasView is slow with bigger images but the spped does not decrease with image size.
-    //        It is very slow, with zoom in in QCanvasView, it seems, that QCanvas is stored as a big image
-    //        with resolution necessary for current zoom and so always a big image mus be redrawn. 
-    QPixmap mCachePixmap; 
-
-    // Is cache up to date
-    bool mCacheUpdated;
-    
-    /** \brief Preview style  */
-    PreviewMode mPreviewMode;
-
-    /** \brief Number of layers when cache was created  */
-    int mNumCachedLayers;
-
-    /** \brief Keeps info if the layer is on or off */
-    std::map<QString,bool> mLayersOn;
-
-    /** \brief layer groups */
-    std::map<QString,int> mLayersGroups;
-
-    /** \brief new layer group id */
-    int mNextLayerGroup;
-
-    /** \brief Draw frame  */
-    bool mFrame;
-};
-
-#endif //0
-
-#endif

Deleted: trunk/qgis/src/app/composer/qgsnumericscalebarstyle.cpp
===================================================================
--- trunk/qgis/src/app/composer/qgsnumericscalebarstyle.cpp	2008-08-23 07:18:39 UTC (rev 9123)
+++ trunk/qgis/src/app/composer/qgsnumericscalebarstyle.cpp	2008-08-23 07:45:12 UTC (rev 9124)
@@ -1,87 +0,0 @@
-/***************************************************************************
-                            qgsnumericscalebarstyle.cpp
-                            ---------------------------
-    begin                : June 2008
-    copyright            : (C) 2008 by Marco Hugentobler
-    email                : marco.hugentobler at karto.baug.ethz.ch
- ***************************************************************************/
-/***************************************************************************
- *                                                                         *
- *   This program is free software; you can redistribute it and/or modify  *
- *   it under the terms of the GNU General Public License as published by  *
- *   the Free Software Foundation; either version 2 of the License, or     *
- *   (at your option) any later version.                                   *
- *                                                                         *
- ***************************************************************************/
-
-#include "qgsnumericscalebarstyle.h"
-#include "qgscomposermap.h"
-#include "qgscomposerscalebar.h"
-#include <QList>
-#include <QPainter>
-
-QgsNumericScaleBarStyle::QgsNumericScaleBarStyle(QgsComposerScaleBar* bar): QgsScaleBarStyle(bar)
-{
-
-}
-
-QgsNumericScaleBarStyle::QgsNumericScaleBarStyle(): QgsScaleBarStyle(0)
-{
-
-}
-
-QgsNumericScaleBarStyle::~QgsNumericScaleBarStyle()
-{
-
-}
-
-QString QgsNumericScaleBarStyle::name() const
-{
-  return "Numeric";
-}
-
-void QgsNumericScaleBarStyle::draw(QPainter* p, double xOffset) const
-{
-  if(!p || !mScaleBar)
-    {
-      return;
-    }
-
-  p->save();
-
-  p->setFont(mScaleBar->font());
-  p->drawText(QPointF(mScaleBar->pen().widthF() + mScaleBar->boxContentSpace(), mScaleBar->boxContentSpace() \
-		      + mScaleBar->fontHeight()), scaleText());
-
-  p->restore();
-}
-
-QRectF QgsNumericScaleBarStyle::calculateBoxSize() const
-{
-  QRectF rect;
-  if(!mScaleBar)
-    {
-      return rect;
-    }
-
-  QFontMetricsF fontMetrics(mScaleBar->font());
-  return QRectF(mScaleBar->transform().dx(), mScaleBar->transform().dy(), 2 * mScaleBar->boxContentSpace() \
-		+ 2 * mScaleBar->pen().width() + fontMetrics.width(scaleText()), \
-		mScaleBar->fontHeight() + 2 * mScaleBar->boxContentSpace());
-}
-
-QString QgsNumericScaleBarStyle::scaleText() const
-{
-  QString scaleBarText;
-  if(mScaleBar)
-    {
-      //find out scale
-      const QgsComposerMap* composerMap = mScaleBar->composerMap();
-      if(composerMap)
-	{
-	  double scaleDenominator = composerMap->scale();
-	  scaleBarText = "1:" + QString::number(scaleDenominator);
-	}
-    }
-  return scaleBarText;
-}

Deleted: trunk/qgis/src/app/composer/qgsnumericscalebarstyle.h
===================================================================
--- trunk/qgis/src/app/composer/qgsnumericscalebarstyle.h	2008-08-23 07:18:39 UTC (rev 9123)
+++ trunk/qgis/src/app/composer/qgsnumericscalebarstyle.h	2008-08-23 07:45:12 UTC (rev 9124)
@@ -1,44 +0,0 @@
-/***************************************************************************
-                            qgsnumericscalebarstyle.h
-                            ---------------------------
-    begin                : June 2008
-    copyright            : (C) 2008 by Marco Hugentobler
-    email                : marco.hugentobler at karto.baug.ethz.ch
- ***************************************************************************/
-/***************************************************************************
- *                                                                         *
- *   This program is free software; you can redistribute it and/or modify  *
- *   it under the terms of the GNU General Public License as published by  *
- *   the Free Software Foundation; either version 2 of the License, or     *
- *   (at your option) any later version.                                   *
- *                                                                         *
- ***************************************************************************/
-
-#ifndef QGSNUMERICSCALEBARSTYLE_H
-#define QGSNUMERICSCALEBARSTYLE_H
-
-#include "qgsscalebarstyle.h"
-
-/** \ingroup MapComposer
- * A scale bar style that draws text in the form of '1:XXXXX'
- */
-class QgsNumericScaleBarStyle: public QgsScaleBarStyle
-{
- public:
-  QgsNumericScaleBarStyle(QgsComposerScaleBar* bar);
-  ~QgsNumericScaleBarStyle();
-
-  QString name() const;
-
-  void draw(QPainter* p, double xOffset = 0) const;
-
-  //calculation of box size is different compared to segment based scale bars
-  QRectF calculateBoxSize() const;
-
- private:
-  QgsNumericScaleBarStyle(); //forbidden
-  /**Returns the text for the scale bar or an empty string in case of error*/
-  QString scaleText() const;
-};
-
-#endif 



More information about the QGIS-commit mailing list