Index: trunk/BNC/qwt/qwt_compass.cpp
===================================================================
--- trunk/BNC/qwt/qwt_compass.cpp	(revision 9383)
+++ trunk/BNC/qwt/qwt_compass.cpp	(revision 11158)
@@ -1,3 +1,3 @@
-/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
+/******************************************************************************
  * Qwt Widget Library
  * Copyright (C) 1997   Josef Wilgen
@@ -10,93 +10,107 @@
 #include "qwt_compass.h"
 #include "qwt_compass_rose.h"
-#include "qwt_math.h"
-#include "qwt_scale_draw.h"
-#include "qwt_painter.h"
-#include "qwt_dial_needle.h"
-#include <qpainter.h>
-#include <qpixmap.h>
+#include "qwt_text.h"
+
 #include <qevent.h>
-
-/*!
-  \brief Constructor
-
-  Initializes a label map for multiples of 45 degrees
+#include <qmap.h>
+
+class QwtCompassScaleDraw::PrivateData
+{
+  public:
+    QMap< double, QString > labelMap;
+};
+
+/*!
+   \brief Constructor
+
+   Initializes a label map for multiples of 45 degrees
  */
 QwtCompassScaleDraw::QwtCompassScaleDraw()
 {
+    m_data = new PrivateData;
+
     enableComponent( QwtAbstractScaleDraw::Backbone, false );
     enableComponent( QwtAbstractScaleDraw::Ticks, false );
 
-    d_labelMap.insert( 0.0, QString::fromLatin1( "N" ) );
-    d_labelMap.insert( 45.0, QString::fromLatin1( "NE" ) );
-    d_labelMap.insert( 90.0, QString::fromLatin1( "E" ) );
-    d_labelMap.insert( 135.0, QString::fromLatin1( "SE" ) );
-    d_labelMap.insert( 180.0, QString::fromLatin1( "S" ) );
-    d_labelMap.insert( 225.0, QString::fromLatin1( "SW" ) );
-    d_labelMap.insert( 270.0, QString::fromLatin1( "W" ) );
-    d_labelMap.insert( 315.0, QString::fromLatin1( "NW" ) );
+    QMap< double, QString >& map = m_data->labelMap;
+
+    map.insert( 0.0, QString::fromLatin1( "N" ) );
+    map.insert( 45.0, QString::fromLatin1( "NE" ) );
+    map.insert( 90.0, QString::fromLatin1( "E" ) );
+    map.insert( 135.0, QString::fromLatin1( "SE" ) );
+    map.insert( 180.0, QString::fromLatin1( "S" ) );
+    map.insert( 225.0, QString::fromLatin1( "SW" ) );
+    map.insert( 270.0, QString::fromLatin1( "W" ) );
+    map.insert( 315.0, QString::fromLatin1( "NW" ) );
 
 #if 0
-    d_labelMap.insert( 22.5, QString::fromLatin1( "NNE" ) );
-    d_labelMap.insert( 67.5, QString::fromLatin1( "NEE" ) );
-    d_labelMap.insert( 112.5, QString::fromLatin1( "SEE" ) );
-    d_labelMap.insert( 157.5, QString::fromLatin1( "SSE" ) );
-    d_labelMap.insert( 202.5, QString::fromLatin1( "SSW" ) );
-    d_labelMap.insert( 247.5, QString::fromLatin1( "SWW" ) );
-    d_labelMap.insert( 292.5, QString::fromLatin1( "NWW" ) );
-    d_labelMap.insert( 337.5, QString::fromLatin1( "NNW" ) );
+    map.insert( 22.5, QString::fromLatin1( "NNE" ) );
+    map.insert( 67.5, QString::fromLatin1( "NEE" ) );
+    map.insert( 112.5, QString::fromLatin1( "SEE" ) );
+    map.insert( 157.5, QString::fromLatin1( "SSE" ) );
+    map.insert( 202.5, QString::fromLatin1( "SSW" ) );
+    map.insert( 247.5, QString::fromLatin1( "SWW" ) );
+    map.insert( 292.5, QString::fromLatin1( "NWW" ) );
+    map.insert( 337.5, QString::fromLatin1( "NNW" ) );
 #endif
 }
 
 /*!
-  \brief Constructor
-
-  \param map Value to label map
- */
-QwtCompassScaleDraw::QwtCompassScaleDraw( const QMap<double, QString> &map ):
-    d_labelMap( map )
-{
+   \brief Constructor
+
+   \param map Value to label map
+ */
+QwtCompassScaleDraw::QwtCompassScaleDraw( const QMap< double, QString >& map )
+{
+    m_data = new PrivateData;
+    m_data->labelMap = map;
+
     enableComponent( QwtAbstractScaleDraw::Backbone, false );
     enableComponent( QwtAbstractScaleDraw::Ticks, false );
 }
 
-/*!
-  \brief Set a map, mapping values to labels
-  \param map Value to label map
-
-  The values of the major ticks are found by looking into this
-  map. The default map consists of the labels N, NE, E, SE, S, SW, W, NW.
-
-  \warning The map will have no effect for values that are no major
+//!  Destructor
+QwtCompassScaleDraw::~QwtCompassScaleDraw()
+{
+    delete m_data;
+}
+
+/*!
+   \brief Set a map, mapping values to labels
+   \param map Value to label map
+
+   The values of the major ticks are found by looking into this
+   map. The default map consists of the labels N, NE, E, SE, S, SW, W, NW.
+
+   \warning The map will have no effect for values that are no major
            tick values. Major ticks can be changed by QwtScaleDraw::setScale
 
-  \sa labelMap(), scaleDraw(), setScale()
-*/
-void QwtCompassScaleDraw::setLabelMap( const QMap<double, QString> &map )
-{
-    d_labelMap = map;
-}
-
-
-/*!
-  \return map, mapping values to labels
-  \sa setLabelMap()
-*/
-QMap<double, QString> QwtCompassScaleDraw::labelMap() const
-{
-    return d_labelMap;
-}
-
-/*!
-  Map a value to a corresponding label
-
-  \param value Value that will be mapped
-
-  label() looks in the labelMap() for a corresponding label for value
-  or returns an null text.
-
-  \return Label
-  \sa labelMap(), setLabelMap()
-*/
+   \sa labelMap(), scaleDraw(), setScale()
+ */
+void QwtCompassScaleDraw::setLabelMap( const QMap< double, QString >& map )
+{
+    m_data->labelMap = map;
+}
+
+/*!
+   \return map, mapping values to labels
+   \sa setLabelMap()
+ */
+QMap< double, QString > QwtCompassScaleDraw::labelMap() const
+{
+    return m_data->labelMap;
+}
+
+/*!
+   Map a value to a corresponding label
+
+   \param value Value that will be mapped
+
+   label() looks in the labelMap() for a corresponding label for value
+   or returns an null text.
+
+   \return Label
+   \sa labelMap(), setLabelMap()
+ */
 
 QwtText QwtCompassScaleDraw::label( double value ) const
@@ -108,6 +122,9 @@
         value += 360.0;
 
-    if ( d_labelMap.contains( value ) )
-        return d_labelMap[value];
+    QMap< double, QString >::const_iterator it =
+        m_data->labelMap.constFind( value );
+
+    if ( it != m_data->labelMap.constEnd() )
+        return *it;
 
     return QwtText();
@@ -116,5 +133,5 @@
 class QwtCompass::PrivateData
 {
-public:
+  public:
     PrivateData():
         rose( NULL )
@@ -127,20 +144,20 @@
     }
 
-    QwtCompassRose *rose;
+    QwtCompassRose* rose;
 };
 
 /*!
-  \brief Constructor
-  \param parent Parent widget
-
-  Create a compass widget with a scale, no needle and no rose.
-  The default origin is 270.0 with no valid value. It accepts
-  mouse and keyboard inputs and has no step size. The default mode
-  is QwtDial::RotateNeedle.
-*/
-QwtCompass::QwtCompass( QWidget* parent ):
-    QwtDial( parent )
-{
-    d_data = new PrivateData;
+   \brief Constructor
+   \param parent Parent widget
+
+   Create a compass widget with a scale, no needle and no rose.
+   The default origin is 270.0 with no valid value. It accepts
+   mouse and keyboard inputs and has no step size. The default mode
+   is QwtDial::RotateNeedle.
+ */
+QwtCompass::QwtCompass( QWidget* parent )
+    : QwtDial( parent )
+{
+    m_data = new PrivateData;
 
     setScaleDraw( new QwtCompassScaleDraw() );
@@ -159,5 +176,5 @@
 QwtCompass::~QwtCompass()
 {
-    delete d_data;
+    delete m_data;
 }
 
@@ -169,7 +186,7 @@
    \param center Center of the content circle
    \param radius Radius of the content circle
-*/
-void QwtCompass::drawScaleContents( QPainter *painter,
-    const QPointF &center, double radius ) const
+ */
+void QwtCompass::drawScaleContents( QPainter* painter,
+    const QPointF& center, double radius ) const
 {
     QPalette::ColorGroup cg;
@@ -191,34 +208,34 @@
 
 /*!
-  Draw the compass rose
-
-  \param painter Painter
-  \param center Center of the compass
-  \param radius of the circle, where to paint the rose
-  \param north Direction pointing north, in degrees counter clockwise
-  \param cg Color group
-*/
-void QwtCompass::drawRose( QPainter *painter, const QPointF &center,
+   Draw the compass rose
+
+   \param painter Painter
+   \param center Center of the compass
+   \param radius of the circle, where to paint the rose
+   \param north Direction pointing north, in degrees counter clockwise
+   \param cg Color group
+ */
+void QwtCompass::drawRose( QPainter* painter, const QPointF& center,
     double radius, double north, QPalette::ColorGroup cg ) const
 {
-    if ( d_data->rose )
-        d_data->rose->draw( painter, center, radius, north,  cg );
-}
-
-/*!
-  Set a rose for the compass
-  \param rose Compass rose
-  \warning The rose will be deleted, when a different rose is
+    if ( m_data->rose )
+        m_data->rose->draw( painter, center, radius, north,  cg );
+}
+
+/*!
+   Set a rose for the compass
+   \param rose Compass rose
+   \warning The rose will be deleted, when a different rose is
     set or in ~QwtCompass
-  \sa rose()
-*/
-void QwtCompass::setRose( QwtCompassRose *rose )
-{
-    if ( rose != d_data->rose )
-    {
-        if ( d_data->rose )
-            delete d_data->rose;
-
-        d_data->rose = rose;
+   \sa rose()
+ */
+void QwtCompass::setRose( QwtCompassRose* rose )
+{
+    if ( rose != m_data->rose )
+    {
+        if ( m_data->rose )
+            delete m_data->rose;
+
+        m_data->rose = rose;
         update();
     }
@@ -226,31 +243,31 @@
 
 /*!
-  \return rose
-  \sa setRose()
-*/
-const QwtCompassRose *QwtCompass::rose() const
-{
-    return d_data->rose;
-}
-
-/*!
-  \return rose
-  \sa setRose()
-*/
-QwtCompassRose *QwtCompass::rose()
-{
-    return d_data->rose;
-}
-
-/*!
-  Handles key events
-
-  Beside the keys described in QwtDial::keyPressEvent numbers
-  from 1-9 (without 5) set the direction according to their
-  position on the num pad.
-
-  \sa isReadOnly()
-*/
-void QwtCompass::keyPressEvent( QKeyEvent *kev )
+   \return rose
+   \sa setRose()
+ */
+const QwtCompassRose* QwtCompass::rose() const
+{
+    return m_data->rose;
+}
+
+/*!
+   \return rose
+   \sa setRose()
+ */
+QwtCompassRose* QwtCompass::rose()
+{
+    return m_data->rose;
+}
+
+/*!
+   Handles key events
+
+   Beside the keys described in QwtDial::keyPressEvent numbers
+   from 1-9 (without 5) set the direction according to their
+   position on the num pad.
+
+   \sa isReadOnly()
+ */
+void QwtCompass::keyPressEvent( QKeyEvent* kev )
 {
     if ( isReadOnly() )
@@ -307,2 +324,4 @@
     }
 }
+
+#include "moc_qwt_compass.cpp"
