Skip to content

Commit bda8d4a

Browse files
author
mhugent
committed
saver string list handling
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@10236 c8812cc2-4d05-0410-92ff-de0c093fc19c
1 parent 083422c commit bda8d4a

13 files changed

+91
-12
lines changed

python/configure.py.in

+1-1
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ for mk in [ makefile_core, makefile_gui ]:
136136
mk.extra_lib_dirs.append(geos_library_path)
137137
if gdal_library_path!="":
138138
mk.extra_lib_dirs.append(gdal_library_path)
139-
mk.extra_include_dirs = [src_path+"/src/core",
139+
mk.extra_include_dirs = [src_path+"/src/core", src_path+"/src/core/composer",
140140
src_path+"/src/core/raster",
141141
src_path+"/src/core/renderer",
142142
src_path+"/src/core/spatialindex",

python/core/core.sip

+10
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,13 @@
1111

1212
%Include qgis.sip
1313
%Include qgsapplication.sip
14+
%Include qgscomposeritem.sip
15+
%Include qgscomposerlabel.sip
16+
%Include qgscomposerlegend.sip
17+
%Include qgscomposermap.sip
18+
%Include qgscomposerpicture.sip
19+
%Include qgscomposerscalebar.sip
20+
%Include qgscomposition.sip
1421
%Include qgscontexthelp.sip
1522
%Include qgscontinuouscolorrenderer.sip
1623
%Include qgscontrastenhancement.sip
@@ -25,13 +32,15 @@
2532
%Include qgsgraduatedsymbolrenderer.sip
2633
%Include qgslabel.sip
2734
%Include qgslabelattributes.sip
35+
%Include qgslegendmodel.sip
2836
%Include qgslogger.sip
2937
%Include qgsmaplayer.sip
3038
%Include qgsmaplayerregistry.sip
3139
%Include qgsmaprenderer.sip
3240
%Include qgsmaptopixel.sip
3341
%Include qgsmarkercatalogue.sip
3442
%Include qgsmessageoutput.sip
43+
%Include qgspaperitem.sip
3544
%Include qgspoint.sip
3645
%Include qgsproject.sip
3746
%Include qgsprovidermetadata.sip
@@ -47,6 +56,7 @@
4756
%Include qgsrect.sip
4857
%Include qgsrendercontext.sip
4958
%Include qgsrenderer.sip
59+
%Include qgsscalebarstyle.sip
5060
%Include qgsscalecalculator.sip
5161
%Include qgssinglesymbolrenderer.sip
5262
%Include qgssnapper.sip

python/gui/gui.sip

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77

88
%Import core/core.sip
99

10-
1110
%Include qgisinterface.sip
11+
%Include qgscomposerview.sip
1212
%Include qgsencodingfiledialog.sip
1313
%Include qgsgenericprojectionselector.sip
1414
%Include qgsmapcanvas.sip

python/gui/qgisinterface.sip

+5
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,11 @@ class QgisInterface : QObject
7373
/** Return a pointer to the main window (instance of QgisApp in case of QGIS) */
7474
virtual QWidget * mainWindow()=0;
7575

76+
/** Return pointers to the composer views of the running instance (currently only one)*/
77+
//virtual QList<QgsComposerView*> composerViews()=0;
78+
79+
virtual QList< QPair<QMainWindow*, QgsComposerView*> > composerList() = 0;
80+
7681
/** Add action to the plugins menu */
7782
virtual void addPluginToMenu(QString name, QAction* action)=0;
7883
/** Remove action from the plugins menu */

src/app/composer/qgscomposerscalebarwidget.cpp

+7-1
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,13 @@ void QgsComposerScaleBarWidget::on_mMapComboBox_activated( const QString& text )
103103
//extract id
104104
int id;
105105
bool conversionOk;
106-
QString idString = text.split( " " ).at( 1 );
106+
QStringList textSplit = text.split( " " );
107+
if(textSplit.size() < 1)
108+
{
109+
return;
110+
}
111+
112+
QString idString = textSplit.at( textSplit.size() - 1 );
107113
id = idString.toInt( &conversionOk );
108114

109115
if ( !conversionOk )

src/app/qgisapp.h

+3
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,9 @@ class QgisApp : public QMainWindow
137137
void saveMapAsImage( QString, QPixmap * );
138138
/** Get the mapcanvas object from the app */
139139
QgsMapCanvas * mapCanvas() { return mMapCanvas; };
140+
141+
QgsComposer* printComposer() {return mComposer;}
142+
140143
//! Set theme (icons)
141144
void setTheme( QString themeName = "default" );
142145
//! Setup the toolbar popup menus for a given theme

src/app/qgisappinterface.cpp

+40
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424

2525
#include "qgisappinterface.h"
2626
#include "qgisapp.h"
27+
#include "qgscomposer.h"
2728
#include "qgsmaplayer.h"
2829
#include "qgsmaplayerregistry.h"
2930
#include "qgsmapcanvas.h"
@@ -138,6 +139,45 @@ QWidget * QgisAppInterface::mainWindow()
138139
return qgis;
139140
}
140141

142+
#if 0
143+
QList<QgsComposerView*> QgisAppInterface::composerViews()
144+
{
145+
QList<QgsComposerView*> composerViewList;
146+
if(qgis)
147+
{
148+
QgsComposer* c = qgis->printComposer();
149+
if(c)
150+
{
151+
QgsComposerView* v = c->view();
152+
if(v)
153+
{
154+
composerViewList.push_back(v);
155+
}
156+
}
157+
}
158+
return composerViewList;
159+
}
160+
#endif //0
161+
162+
QList< QPair<QMainWindow*, QgsComposerView*> > QgisAppInterface::composerList()
163+
{
164+
165+
QList< QPair<QMainWindow*, QgsComposerView*> > composerList;
166+
if(qgis)
167+
{
168+
QgsComposer* c = qgis->printComposer();
169+
if(c)
170+
{
171+
QgsComposerView* v = c->view();
172+
if(v)
173+
{
174+
composerList.push_back(qMakePair((QMainWindow*)(c), v));
175+
}
176+
}
177+
}
178+
return composerList;
179+
}
180+
141181
void QgisAppInterface::addDockWidget( Qt::DockWidgetArea area, QDockWidget * dockwidget )
142182
{
143183
qgis->addDockWidget( area, dockwidget );

src/app/qgisappinterface.h

+5
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,11 @@ class QgisAppInterface : public QgisInterface
9292
*/
9393
QWidget * mainWindow();
9494

95+
/** Return pointers to the composer views of the running instance (currently only one)*/
96+
//QList<QgsComposerView*> composerViews();
97+
98+
QList< QPair<QMainWindow*, QgsComposerView*> > composerList();
99+
95100
/** Add action to the plugins menu */
96101
void addPluginToMenu( QString name, QAction* action );
97102
/** Remove action from the plugins menu */

src/core/composer/qgscomposermap.h

-6
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,6 @@ class CORE_EXPORT QgsComposerMap : /*public QWidget, private Ui::QgsComposerMapB
5555
Rectangle // Display only rectangle
5656
};
5757

58-
/** \brief Initialise GUI and other settings, shared by constructors */
59-
void init( void );
60-
6158
/** \brief Draw to paint device
6259
@param extent map extent
6360
@param size size in scene coordinates
@@ -67,9 +64,6 @@ class CORE_EXPORT QgsComposerMap : /*public QWidget, private Ui::QgsComposerMapB
6764
/** \brief Reimplementation of QCanvasItem::paint - draw on canvas */
6865
void paint( QPainter* painter, const QStyleOptionGraphicsItem* itemStyle, QWidget* pWidget );
6966

70-
/** \brief Recalculate rectangle/extent/scale according to current rule */
71-
void recalculate( void );
72-
7367
/** \brief Create cache image */
7468
void cache( void );
7569

src/gui/qgisinterface.h

+10
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,16 @@ class QAction;
2323
class QMenu;
2424
class QToolBar;
2525
class QDockWidget;
26+
class QMainWindow;
2627
class QWidget;
2728
#include <QObject>
29+
#include <QPair>
2830

2931
#include <map>
3032

33+
3134
class QgisApp;
35+
class QgsComposerView;
3236
class QgsMapLayer;
3337
class QgsMapCanvas;
3438
class QgsRasterLayer;
@@ -103,6 +107,12 @@ class GUI_EXPORT QgisInterface : public QObject
103107
/** Return a pointer to the main window (instance of QgisApp in case of QGIS) */
104108
virtual QWidget * mainWindow() = 0;
105109

110+
/** Return pointers to composer main windows*/
111+
//virtual QList<QgsComposerView*> composerViews() = 0;
112+
113+
/**Return mainwindows / composer views of running composer instances (currently only one)*/
114+
virtual QList< QPair<QMainWindow*, QgsComposerView*> > composerList() = 0;
115+
106116
/** Add action to the plugins menu */
107117
virtual void addPluginToMenu( QString name, QAction* action ) = 0;
108118
/** Remove action from the plugins menu */

src/plugins/CMakeLists.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
SUBDIRS (copyright_label delimited_text interpolation north_arrow scale_bar)
1+
SUBDIRS (copyright_label delimited_text interpolation north_arrow scale_bar beata)
22

33
IF (POSTGRES_FOUND)
44
SUBDIRS (spit)

src/plugins/interpolation/qgsinterpolator.cpp

+7-1
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,8 @@ int QgsInterpolator::cacheBaseData()
7676

7777
QgsFeature theFeature;
7878
double attributeValue = 0.0;
79+
bool attributeConversionOk = false;
80+
7981
while ( provider->nextFeature( theFeature ) )
8082
{
8183
if ( !zCoordInterpolation )
@@ -86,7 +88,11 @@ int QgsInterpolator::cacheBaseData()
8688
{
8789
return 3;
8890
}
89-
attributeValue = att_it.value().toDouble();
91+
attributeValue = att_it.value().toDouble(&attributeConversionOk);
92+
if(!attributeConversionOk) //don't consider vertices with attributes like 'nan' for the interpolation
93+
{
94+
continue;
95+
}
9096
}
9197

9298
if ( addVerticesToCache( theFeature.geometry(), attributeValue ) != 0 )

src/providers/CMakeLists.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11

2-
SUBDIRS (memory ogr wms delimitedtext)
2+
SUBDIRS (memory ogr wms delimitedtext osm_provider)
33

44
IF (POSTGRES_FOUND)
55
SUBDIRS (postgres)

0 commit comments

Comments
 (0)