[QGIS Commit] r8822 - in branches/advanced_printing_branch/src: app/composer ui

svn_qgis at osgeo.org svn_qgis at osgeo.org
Tue Jul 22 08:34:30 EDT 2008


Author: mhugent
Date: 2008-07-22 08:34:30 -0400 (Tue, 22 Jul 2008)
New Revision: 8822

Added:
   branches/advanced_printing_branch/src/app/composer/qgsticksdownscalebarstyle.cpp
   branches/advanced_printing_branch/src/app/composer/qgsticksdownscalebarstyle.h
Modified:
   branches/advanced_printing_branch/src/ui/qgscomposerlegendwidgetbase.ui
Log:
Saved legend widget with designer 4.3.4 and added missing files to svn

Added: branches/advanced_printing_branch/src/app/composer/qgsticksdownscalebarstyle.cpp
===================================================================
--- branches/advanced_printing_branch/src/app/composer/qgsticksdownscalebarstyle.cpp	                        (rev 0)
+++ branches/advanced_printing_branch/src/app/composer/qgsticksdownscalebarstyle.cpp	2008-07-22 12:34:30 UTC (rev 8822)
@@ -0,0 +1,74 @@
+/***************************************************************************
+                            qgsticksdownscalebarstyle.cpp
+                            ------------------------------
+    begin                : July 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 "qgsticksdownscalebarstyle.h"
+#include "qgscomposerscalebar.h"
+#include <QPainter>
+
+QgsTicksDownScaleBarStyle::QgsTicksDownScaleBarStyle(const QgsComposerScaleBar* bar): QgsScaleBarStyle(bar)
+{
+
+}
+
+QgsTicksDownScaleBarStyle::QgsTicksDownScaleBarStyle(): QgsScaleBarStyle(0)
+{
+
+}
+
+QgsTicksDownScaleBarStyle::~QgsTicksDownScaleBarStyle()
+{
+
+}
+
+QString QgsTicksDownScaleBarStyle::name() const
+{
+  return "Line Ticks Middle";
+}
+
+void QgsTicksDownScaleBarStyle::draw(QPainter* p) const
+{
+  if(!mScaleBar)
+    {
+      return;
+    }
+  double barTopPosition = mScaleBar->fontHeight() + mScaleBar->labelBarSpace() + mScaleBar->boxContentSpace();
+  double middlePosition = barTopPosition + mScaleBar->height()/2.0;
+
+  p->save();
+  p->setPen(mScaleBar->pen());
+
+  QList<QPair<double, double> > segmentInfo;
+  mScaleBar->segmentPositions(segmentInfo);
+
+  QList<QPair<double, double> >::const_iterator segmentIt = segmentInfo.constBegin();
+  for(; segmentIt != segmentInfo.constEnd(); ++segmentIt)
+    {
+      p->drawLine(segmentIt->first, barTopPosition, segmentIt->first, barTopPosition + mScaleBar->height());
+      p->drawLine(segmentIt->first, barTopPosition, segmentIt->first + mScaleBar->segmentMM(), barTopPosition); 
+    }
+
+  //draw last tick
+  if(!segmentInfo.isEmpty())
+    {
+      double lastTickPositionX = segmentInfo.last().first + mScaleBar->segmentMM();
+      p->drawLine(lastTickPositionX, barTopPosition, lastTickPositionX, barTopPosition + mScaleBar->height());
+    }
+
+  p->restore();
+
+  //draw labels using the default method
+  drawLabels(p);
+}

Added: branches/advanced_printing_branch/src/app/composer/qgsticksdownscalebarstyle.h
===================================================================
--- branches/advanced_printing_branch/src/app/composer/qgsticksdownscalebarstyle.h	                        (rev 0)
+++ branches/advanced_printing_branch/src/app/composer/qgsticksdownscalebarstyle.h	2008-07-22 12:34:30 UTC (rev 8822)
@@ -0,0 +1,37 @@
+/***************************************************************************
+                            qgsticksdownscalebarstyle.h
+                            -----------------------------
+    begin                : July 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 QGSTICKSDOWNSCALEBARSTYLE_H
+#define QGSTICKSDOWNSCALEBARSTYLE_H
+
+#include "qgsscalebarstyle.h"
+
+/**Scale bar style that draws a line and ticks down*/
+class QgsTicksDownScaleBarStyle: public QgsScaleBarStyle
+{
+  public:
+  QgsTicksDownScaleBarStyle(const QgsComposerScaleBar* bar);
+  ~QgsTicksDownScaleBarStyle();
+
+  QString name() const;
+
+  void draw(QPainter* p) const;
+
+ private:
+  QgsTicksDownScaleBarStyle(); //forbidden
+}
+
+#endif 

Modified: branches/advanced_printing_branch/src/ui/qgscomposerlegendwidgetbase.ui
===================================================================
--- branches/advanced_printing_branch/src/ui/qgscomposerlegendwidgetbase.ui	2008-07-22 06:10:02 UTC (rev 8821)
+++ branches/advanced_printing_branch/src/ui/qgscomposerlegendwidgetbase.ui	2008-07-22 12:34:30 UTC (rev 8822)
@@ -18,7 +18,7 @@
   <property name="windowTitle" >
    <string>Barscale Options</string>
   </property>
-  <layout class="QGridLayout" name="gridLayout_2" >
+  <layout class="QGridLayout" >
    <item row="0" column="0" >
     <widget class="QGroupBox" name="mGeneralGroupBox" >
      <property name="title" >
@@ -138,7 +138,7 @@
           <property name="orientation" >
            <enum>Qt::Horizontal</enum>
           </property>
-          <property name="sizeHint" stdset="0" >
+          <property name="sizeHint" >
            <size>
             <width>141</width>
             <height>20</height>
@@ -162,7 +162,7 @@
           <property name="orientation" >
            <enum>Qt::Horizontal</enum>
           </property>
-          <property name="sizeHint" stdset="0" >
+          <property name="sizeHint" >
            <size>
             <width>131</width>
             <height>20</height>
@@ -190,7 +190,7 @@
      <property name="title" >
       <string>Items</string>
      </property>
-     <layout class="QGridLayout" name="gridLayout" >
+     <layout class="QGridLayout" >
       <item row="0" column="0" >
        <widget class="QPushButton" name="mMoveDownPushButton" >
         <property name="text" >
@@ -227,11 +227,11 @@
        </widget>
       </item>
       <item row="0" column="5" >
-       <spacer name="horizontalSpacer" >
+       <spacer>
         <property name="orientation" >
          <enum>Qt::Horizontal</enum>
         </property>
-        <property name="sizeHint" stdset="0" >
+        <property name="sizeHint" >
          <size>
           <width>28</width>
           <height>20</height>
@@ -241,7 +241,7 @@
       </item>
       <item row="1" column="0" colspan="6" >
        <widget class="QTreeView" name="mItemTreeView" >
-        <property name="headerHidden" >
+        <property name="headerHidden" stdset="0" >
          <bool>true</bool>
         </property>
        </widget>



More information about the QGIS-commit mailing list