Skip to content
Permalink
Browse files

add optional Qwt 6.0 support (including QwtPolar 1.0)

  • Loading branch information
jef-n committed Aug 12, 2011
1 parent 494c65b commit f71ecb90bff11856fd353562c6424ee2803c2320
Showing with 7,886 additions and 34 deletions.
  1. +3 −1 cmake/FindQwt.cmake
  2. +1 −1 debian/control.sid
  3. +64 −31 src/app/CMakeLists.txt
  4. +29 −1 src/app/gps/qgsgpsinformationwidget.cpp
  5. 0 src/app/gps/{qwtpolar → qwtpolar-0.1}/qwt_polar.h
  6. 0 src/app/gps/{qwtpolar → qwtpolar-0.1}/qwt_polar_canvas.cpp
  7. 0 src/app/gps/{qwtpolar → qwtpolar-0.1}/qwt_polar_canvas.h
  8. 0 src/app/gps/{qwtpolar → qwtpolar-0.1}/qwt_polar_curve.cpp
  9. 0 src/app/gps/{qwtpolar → qwtpolar-0.1}/qwt_polar_curve.h
  10. 0 src/app/gps/{qwtpolar → qwtpolar-0.1}/qwt_polar_fitter.cpp
  11. 0 src/app/gps/{qwtpolar → qwtpolar-0.1}/qwt_polar_fitter.h
  12. 0 src/app/gps/{qwtpolar → qwtpolar-0.1}/qwt_polar_global.h
  13. 0 src/app/gps/{qwtpolar → qwtpolar-0.1}/qwt_polar_grid.cpp
  14. 0 src/app/gps/{qwtpolar → qwtpolar-0.1}/qwt_polar_grid.h
  15. 0 src/app/gps/{qwtpolar → qwtpolar-0.1}/qwt_polar_item.cpp
  16. 0 src/app/gps/{qwtpolar → qwtpolar-0.1}/qwt_polar_item.h
  17. 0 src/app/gps/{qwtpolar → qwtpolar-0.1}/qwt_polar_itemdict.cpp
  18. 0 src/app/gps/{qwtpolar → qwtpolar-0.1}/qwt_polar_itemdict.h
  19. 0 src/app/gps/{qwtpolar → qwtpolar-0.1}/qwt_polar_layout.cpp
  20. 0 src/app/gps/{qwtpolar → qwtpolar-0.1}/qwt_polar_layout.h
  21. 0 src/app/gps/{qwtpolar → qwtpolar-0.1}/qwt_polar_magnifier.cpp
  22. 0 src/app/gps/{qwtpolar → qwtpolar-0.1}/qwt_polar_magnifier.h
  23. 0 src/app/gps/{qwtpolar → qwtpolar-0.1}/qwt_polar_marker.cpp
  24. 0 src/app/gps/{qwtpolar → qwtpolar-0.1}/qwt_polar_marker.h
  25. 0 src/app/gps/{qwtpolar → qwtpolar-0.1}/qwt_polar_panner.cpp
  26. 0 src/app/gps/{qwtpolar → qwtpolar-0.1}/qwt_polar_panner.h
  27. 0 src/app/gps/{qwtpolar → qwtpolar-0.1}/qwt_polar_plot.cpp
  28. 0 src/app/gps/{qwtpolar → qwtpolar-0.1}/qwt_polar_plot.h
  29. 0 src/app/gps/{qwtpolar → qwtpolar-0.1}/qwt_polar_point.cpp
  30. 0 src/app/gps/{qwtpolar → qwtpolar-0.1}/qwt_polar_point.h
  31. 0 src/app/gps/{qwtpolar → qwtpolar-0.1}/qwt_polar_spectrogram.cpp
  32. 0 src/app/gps/{qwtpolar → qwtpolar-0.1}/qwt_polar_spectrogram.h
  33. +84 −0 src/app/gps/qwtpolar-1.0/qwt_polar.h
  34. +298 −0 src/app/gps/qwtpolar-1.0/qwt_polar_canvas.cpp
  35. +79 −0 src/app/gps/qwtpolar-1.0/qwt_polar_canvas.h
  36. +635 −0 src/app/gps/qwtpolar-1.0/qwt_polar_curve.cpp
  37. +163 −0 src/app/gps/qwtpolar-1.0/qwt_polar_curve.h
  38. +100 −0 src/app/gps/qwtpolar-1.0/qwt_polar_fitter.cpp
  39. +40 −0 src/app/gps/qwtpolar-1.0/qwt_polar_fitter.h
  40. +43 −0 src/app/gps/qwtpolar-1.0/qwt_polar_global.h
  41. +1,129 −0 src/app/gps/qwtpolar-1.0/qwt_polar_grid.cpp
  42. +187 −0 src/app/gps/qwtpolar-1.0/qwt_polar_grid.h
  43. +444 −0 src/app/gps/qwtpolar-1.0/qwt_polar_item.cpp
  44. +176 −0 src/app/gps/qwtpolar-1.0/qwt_polar_item.h
  45. +169 −0 src/app/gps/qwtpolar-1.0/qwt_polar_itemdict.cpp
  46. +55 −0 src/app/gps/qwtpolar-1.0/qwt_polar_itemdict.h
  47. +444 −0 src/app/gps/qwtpolar-1.0/qwt_polar_layout.cpp
  48. +78 −0 src/app/gps/qwtpolar-1.0/qwt_polar_layout.h
  49. +167 −0 src/app/gps/qwtpolar-1.0/qwt_polar_magnifier.cpp
  50. +58 −0 src/app/gps/qwtpolar-1.0/qwt_polar_magnifier.h
  51. +233 −0 src/app/gps/qwtpolar-1.0/qwt_polar_marker.cpp
  52. +70 −0 src/app/gps/qwtpolar-1.0/qwt_polar_marker.h
  53. +118 −0 src/app/gps/qwtpolar-1.0/qwt_polar_panner.cpp
  54. +52 −0 src/app/gps/qwtpolar-1.0/qwt_polar_panner.h
  55. +245 −0 src/app/gps/qwtpolar-1.0/qwt_polar_picker.cpp
  56. +98 −0 src/app/gps/qwtpolar-1.0/qwt_polar_picker.h
  57. +1,269 −0 src/app/gps/qwtpolar-1.0/qwt_polar_plot.cpp
  58. +219 −0 src/app/gps/qwtpolar-1.0/qwt_polar_plot.h
  59. +421 −0 src/app/gps/qwtpolar-1.0/qwt_polar_renderer.cpp
  60. +71 −0 src/app/gps/qwtpolar-1.0/qwt_polar_renderer.h
  61. +527 −0 src/app/gps/qwtpolar-1.0/qwt_polar_spectrogram.cpp
  62. +95 −0 src/app/gps/qwtpolar-1.0/qwt_polar_spectrogram.h
  63. +22 −0 src/app/qgsrasterlayerproperties.cpp
@@ -32,8 +32,10 @@ IF (QWT_INCLUDE_DIR AND QWT_LIBRARY)
ENDIF (QWT_INCLUDE_DIR AND QWT_LIBRARY)

IF (QWT_FOUND)
FILE(READ ${QWT_INCLUDE_DIR}/qwt_global.h qwt_header)
STRING(REGEX REPLACE "^.*QWT_VERSION +(0x[0-9a-f]+).*$" "\\1" QWT_VERSION "${qwt_header}")
IF (NOT QWT_FIND_QUIETLY)
MESSAGE(STATUS "Found Qwt: ${QWT_LIBRARY}")
MESSAGE(STATUS "Found Qwt: ${QWT_LIBRARY} (${QWT_VERSION})")
ENDIF (NOT QWT_FIND_QUIETLY)
ELSE (QWT_FOUND)
IF (QWT_FIND_REQUIRED)
@@ -17,7 +17,7 @@ Build-Depends:
libproj-dev,
libqt4-dev (>=4.4.0),
libqtwebkit-dev,
libqwt5-qt4-dev,
libqwt-dev,
libspatialite-dev,
libsqlite3-dev,
pkg-config,
@@ -127,12 +127,12 @@ SET(QGIS_APP_SRCS
ogr/qgsnewogrconnection.cpp
ogr/qgsogrsublayersdialog.cpp
ogr/qgsvectorlayersaveasdialog.cpp

attributetable/qgsattributetabledialog.cpp

gps/qgsgpsinformationwidget.cpp
gps/qgsgpsmarker.cpp
)
)


SET (QGIS_APP_MOC_HDRS
@@ -231,44 +231,77 @@ SET (QGIS_APP_MOC_HDRS
legend/qgslegend.h
legend/qgsapplegendinterface.h
legend/qgslegendlayer.h

ogr/qgsopenvectorlayerdialog.h
ogr/qgsnewogrconnection.h
ogr/qgsogrsublayersdialog.h
ogr/qgsvectorlayersaveasdialog.h

attributetable/qgsattributetabledialog.h

gps/qgsgpsinformationwidget.h
)

IF(WITH_INTERNAL_QWTPOLAR)
SET(QGIS_APP_SRCS
${QGIS_APP_SRCS}
gps/qwtpolar/qwt_polar_canvas.cpp
gps/qwtpolar/qwt_polar_curve.cpp
gps/qwtpolar/qwt_polar_fitter.cpp
gps/qwtpolar/qwt_polar_grid.cpp
gps/qwtpolar/qwt_polar_itemdict.cpp
gps/qwtpolar/qwt_polar_item.cpp
gps/qwtpolar/qwt_polar_layout.cpp
gps/qwtpolar/qwt_polar_magnifier.cpp
gps/qwtpolar/qwt_polar_marker.cpp
gps/qwtpolar/qwt_polar_panner.cpp
gps/qwtpolar/qwt_polar_plot.cpp
gps/qwtpolar/qwt_polar_point.cpp
gps/qwtpolar/qwt_polar_spectrogram.cpp
)
IF(QWT_VERSION LESS 393216) # <6.0.0
SET(QGIS_APP_SRCS
${QGIS_APP_SRCS}
gps/qwtpolar-0.1/qwt_polar_canvas.cpp
gps/qwtpolar-0.1/qwt_polar_curve.cpp
gps/qwtpolar-0.1/qwt_polar_fitter.cpp
gps/qwtpolar-0.1/qwt_polar_grid.cpp
gps/qwtpolar-0.1/qwt_polar_itemdict.cpp
gps/qwtpolar-0.1/qwt_polar_item.cpp
gps/qwtpolar-0.1/qwt_polar_layout.cpp
gps/qwtpolar-0.1/qwt_polar_magnifier.cpp
gps/qwtpolar-0.1/qwt_polar_marker.cpp
gps/qwtpolar-0.1/qwt_polar_panner.cpp
gps/qwtpolar-0.1/qwt_polar_plot.cpp
gps/qwtpolar-0.1/qwt_polar_point.cpp
gps/qwtpolar-0.1/qwt_polar_spectrogram.cpp
)

SET (QGIS_APP_MOC_HDRS
${QGIS_APP_MOC_HDRS}
gps/qwtpolar/qwt_polar_canvas.h
gps/qwtpolar/qwt_polar_magnifier.h
gps/qwtpolar/qwt_polar_panner.h
gps/qwtpolar/qwt_polar_plot.h
)
SET (QGIS_APP_MOC_HDRS
${QGIS_APP_MOC_HDRS}
gps/qwtpolar-0.1/qwt_polar_canvas.h
gps/qwtpolar-0.1/qwt_polar_magnifier.h
gps/qwtpolar-0.1/qwt_polar_panner.h
gps/qwtpolar-0.1/qwt_polar_plot.h
)

SET(QWTPOLAR_INCLUDE_DIR gps/qwtpolar-0.1)
ELSE(QWT_VERSION LESS 393216)
SET(QGIS_APP_SRCS
${QGIS_APP_SRCS}
gps/qwtpolar-1.0/qwt_polar_canvas.cpp
gps/qwtpolar-1.0/qwt_polar_curve.cpp
gps/qwtpolar-1.0/qwt_polar_fitter.cpp
gps/qwtpolar-1.0/qwt_polar_grid.cpp
gps/qwtpolar-1.0/qwt_polar_item.cpp
gps/qwtpolar-1.0/qwt_polar_itemdict.cpp
gps/qwtpolar-1.0/qwt_polar_layout.cpp
gps/qwtpolar-1.0/qwt_polar_magnifier.cpp
gps/qwtpolar-1.0/qwt_polar_marker.cpp
gps/qwtpolar-1.0/qwt_polar_panner.cpp
gps/qwtpolar-1.0/qwt_polar_picker.cpp
gps/qwtpolar-1.0/qwt_polar_plot.cpp
gps/qwtpolar-1.0/qwt_polar_renderer.cpp
gps/qwtpolar-1.0/qwt_polar_spectrogram.cpp
)

SET (QGIS_APP_MOC_HDRS
${QGIS_APP_MOC_HDRS}
gps/qwtpolar-1.0/qwt_polar_canvas.h
gps/qwtpolar-1.0/qwt_polar_magnifier.h
gps/qwtpolar-1.0/qwt_polar_panner.h
gps/qwtpolar-1.0/qwt_polar_picker.h
gps/qwtpolar-1.0/qwt_polar_plot.h
gps/qwtpolar-1.0/qwt_polar_renderer.h
)

SET(QWTPOLAR_INCLUDE_DIR gps/qwtpolar-1.0)
ENDIF(QWT_VERSION LESS 393216)

SET(QWTPOLAR_INCLUDE_DIR gps/qwtpolar)
SET(QWTPOLAR_LIBRARY "")
ENDIF(WITH_INTERNAL_QWTPOLAR)

@@ -329,7 +362,7 @@ IF (WIN32)
# application icon
# resource compilation for MinGW
ADD_CUSTOM_COMMAND( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/icon.o
COMMAND ${WINDRES} -I${CMAKE_CURRENT_SOURCE_DIR} -i${CMAKE_CURRENT_SOURCE_DIR}/qgis_win32.rc
COMMAND ${WINDRES} -I${CMAKE_CURRENT_SOURCE_DIR} -i${CMAKE_CURRENT_SOURCE_DIR}/qgis_win32.rc
-o ${CMAKE_CURRENT_BINARY_DIR}/icon.o )
SET(QGIS_APP_SRCS ${QGIS_APP_SRCS} ${CMAKE_CURRENT_BINARY_DIR}/icon.o)
ENDIF (MSVC)
@@ -389,7 +422,7 @@ TARGET_LINK_LIBRARIES(${QGIS_APP_NAME}
${QT_QTSQL_LIBRARY}
${QT_QTUITOOLS_LIBRARY}
#should only be needed for win
${QT_QTMAIN_LIBRARY}
${QT_QTMAIN_LIBRARY}
${QWTPOLAR_LIBRARY}
qgis_core
qgis_gui
@@ -398,7 +431,7 @@ TARGET_LINK_LIBRARIES(${QGIS_APP_NAME}

IF( WIN32 )
ADD_DEFINITIONS(-DQWT_DLL)
ENDIF( WIN32 )
ENDIF( WIN32 )

IF(NOT WITH_INTERNAL_SPATIALITE)
TARGET_LINK_LIBRARIES(${QGIS_APP_NAME} ${SQLITE_LIBRARY})
@@ -34,13 +34,17 @@
#include "qgsmaptooladdfeature.h"

// QWT Charting widget
#include <qwt_global.h>
#if (QWT_VERSION<0x060000)
#include <qwt_array.h>
#include <qwt_data.h>
#endif
#include <qwt_legend.h>
#include <qwt_plot.h>
#include <qwt_plot_grid.h>

// QWT Polar plot add on
#include <qpen.h>
#include <qwt_data.h>
#include <qwt_symbol.h>
#include <qwt_polar_grid.h>
#include <qwt_polar_curve.h>
@@ -374,8 +378,12 @@ void QgsGPSInformationWidget::displayGPSInformation( const QgsGPSInformation& in
{
mGPSTextEdit->clear();

#if QWT_VERSION<0x060000
QwtArray<double> myXData;//qwtarray is just a wrapped qvector
QwtArray<double> mySignalData;//qwtarray is just a wrapped qvector
#else
QVector<QPointF> data;
#endif
mpPlot->setAxisScale( QwtPlot::xBottom, 0, info.satellitesInView.size() );
while ( !mMarkerList.isEmpty() )
{
@@ -386,6 +394,7 @@ void QgsGPSInformationWidget::displayGPSInformation( const QgsGPSInformation& in
{
QgsSatelliteInfo currentInfo = info.satellitesInView.at( i );

#if QWT_VERSION<0x060000
myXData.append( i );
mySignalData.append( 0 );
myXData.append( i );
@@ -394,6 +403,12 @@ void QgsGPSInformationWidget::displayGPSInformation( const QgsGPSInformation& in
mySignalData.append( currentInfo.signal );
myXData.append( i + 1 );
mySignalData.append( 0 );
#else
data << QPointF( i, 0 );
data << QPointF( i, currentInfo.signal );
data << QPointF( i + 1, currentInfo.signal );
data << QPointF( i + 1, currentInfo.signal );
#endif
mGPSTextEdit->append( "Satellite" );
if ( currentInfo.inUse )
{
@@ -409,7 +424,11 @@ void QgsGPSInformationWidget::displayGPSInformation( const QgsGPSInformation& in
mGPSTextEdit->append( "signal: " + QString::number( currentInfo.signal ) );
// Add a marker to the polar plot
QwtPolarMarker *mypMarker = new QwtPolarMarker();
#if (QWT_POLAR_VERSION<0x010000)
mypMarker->setPosition( QwtPolarPoint( currentInfo.azimuth, currentInfo.elevation ) );
#else
mypMarker->setPosition( QwtPointPolar( currentInfo.azimuth, currentInfo.elevation ) );
#endif
QColor myColour;
if ( currentInfo.signal < 30 ) //weak signal
{
@@ -419,8 +438,13 @@ void QgsGPSInformationWidget::displayGPSInformation( const QgsGPSInformation& in
{
myColour = Qt::black; //strong signal
}
#if (QWT_POLAR_VERSION<0x010000)
mypMarker->setSymbol( QwtSymbol( QwtSymbol::Ellipse,
QBrush( Qt::black ), QPen( myColour ), QSize( 9, 9 ) ) );
#else
mypMarker->setSymbol( new QwtSymbol( QwtSymbol::Ellipse,
QBrush( Qt::black ), QPen( myColour ), QSize( 9, 9 ) ) );
#endif
mypMarker->setLabelAlignment( Qt::AlignHCenter | Qt::AlignTop );
QwtText text( QString::number( currentInfo.id ) );
text.setColor( myColour );
@@ -431,7 +455,11 @@ void QgsGPSInformationWidget::displayGPSInformation( const QgsGPSInformation& in
mypMarker->attach( mpSatellitesWidget );
mMarkerList << mypMarker;
}
#if (QWT_VERSION<0x060000)
mpCurve->setData( myXData, mySignalData );
#else
mpCurve->setSamples( data );
#endif
mpPlot->replot();
if ( mpMapMarker )
delete mpMapMarker;
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -0,0 +1,84 @@
/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
* QwtPolar Widget Library
* Copyright (C) 2008 Uwe Rathmann
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the Qwt License, Version 1.0
*****************************************************************************/

#ifndef QWT_POLAR_H
#define QWT_POLAR_H 1

#include "qwt_polar_global.h"

namespace QwtPolar
{
//! Unit of an angle
enum AngleUnit
{
//! 0.0 -> 2_M_PI
Radians,

//! 0.0 -> 360.0
Degrees,

//! 0.0 - 400.0
Gradians,

//! 0.0 - 1.0
Turns
};

//! An enum, that identifies the type of a coordinate
enum Coordinate
{
//! Azimuth
Azimuth,

//! Radius
Radius
};

/*!
Indices used to identify an axis.
\sa Scale
*/
enum Axis
{
//! Azimuth axis
AxisAzimuth,

//! Left axis
AxisLeft,

//! Right axis
AxisRight,

//! Top axis
AxisTop,

//! Bottom axis
AxisBottom,

//! Number of available axis
AxesCount
};

/*!
Indices used to identify a scale.
\sa Axis
*/
enum Scale
{
//! Azimuth scale
ScaleAzimuth = Azimuth,

//! Radial scale
ScaleRadius = Radius,

//! Number of scales
ScaleCount
};
}

#endif

0 comments on commit f71ecb9

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