Skip to content

Commit e4e4839

Browse files
committed
Add checkbox to only load wfs features intersecting the current canvas extent. Funded by Sourcepole QGIS Enterprise
1 parent c3321e5 commit e4e4839

File tree

3 files changed

+97
-83
lines changed

3 files changed

+97
-83
lines changed

src/providers/wfs/qgswfsprovider.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,11 +122,16 @@ QgsWFSProvider::QgsWFSProvider( const QString& uri )
122122
setDataSourceUri( bkUri );
123123
}
124124

125+
#if 0 //non-cached mode is broken
125126
mCached = !uri.contains( "BBOX=" );
126127
if ( mCached )
127128
{ //"Cache Features" option; get all features in layer immediately
128129
reloadData();
129130
} //otherwise, defer feature retrieval until layer is first rendered
131+
#endif //0
132+
133+
mCached = true;
134+
reloadData();
130135

131136
if ( mValid )
132137
{

src/providers/wfs/qgswfssourceselect.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -403,8 +403,10 @@ void QgsWFSSourceSelect::addLayer()
403403
layerName = titleName;
404404
}
405405
QgsDebugMsg( "Layer " + typeName + " Filter is " + filter );
406+
406407
//is "cache features" checked?
407-
if ( mModel->item( row, 3 )->checkState() == Qt::Checked )
408+
//non-cached mode does not work anymore
409+
if ( !cbxFeatureCurrentViewExtent->isChecked() && mModel->item( row, 3 )->checkState() == Qt::Checked )
408410
{ //yes: entire WFS layer will be retrieved and cached
409411
mUri = conn.uriGetFeature( typeName, pCrsString, filter );
410412
}

src/ui/qgswfssourceselectbase.ui

Lines changed: 89 additions & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
<string>Add WFS Layer from a Server</string>
1515
</property>
1616
<layout class="QGridLayout" name="gridLayout">
17-
<item row="5" column="0">
17+
<item row="6" column="0">
1818
<widget class="QDialogButtonBox" name="buttonBox">
1919
<property name="orientation">
2020
<enum>Qt::Horizontal</enum>
@@ -24,84 +24,6 @@
2424
</property>
2525
</widget>
2626
</item>
27-
<item row="4" column="0">
28-
<widget class="QGroupBox" name="gbCRS">
29-
<property name="title">
30-
<string>Coordinate reference system</string>
31-
</property>
32-
<layout class="QHBoxLayout">
33-
<property name="spacing">
34-
<number>6</number>
35-
</property>
36-
<property name="margin">
37-
<number>9</number>
38-
</property>
39-
<item>
40-
<widget class="QLabel" name="labelCoordRefSys">
41-
<property name="text">
42-
<string/>
43-
</property>
44-
</widget>
45-
</item>
46-
<item>
47-
<spacer>
48-
<property name="orientation">
49-
<enum>Qt::Horizontal</enum>
50-
</property>
51-
<property name="sizeType">
52-
<enum>QSizePolicy::Expanding</enum>
53-
</property>
54-
<property name="sizeHint" stdset="0">
55-
<size>
56-
<width>441</width>
57-
<height>23</height>
58-
</size>
59-
</property>
60-
</spacer>
61-
</item>
62-
<item>
63-
<widget class="QPushButton" name="btnChangeSpatialRefSys">
64-
<property name="enabled">
65-
<bool>false</bool>
66-
</property>
67-
<property name="text">
68-
<string>Change...</string>
69-
</property>
70-
</widget>
71-
</item>
72-
</layout>
73-
</widget>
74-
</item>
75-
<item row="1" column="0">
76-
<layout class="QHBoxLayout" name="horizontalLayoutFilter">
77-
<item>
78-
<widget class="QLabel" name="labelFilter">
79-
<property name="enabled">
80-
<bool>true</bool>
81-
</property>
82-
<property name="text">
83-
<string>Filter:</string>
84-
</property>
85-
<property name="buddy">
86-
<cstring>lineFilter</cstring>
87-
</property>
88-
</widget>
89-
</item>
90-
<item>
91-
<widget class="QLineEdit" name="lineFilter">
92-
<property name="enabled">
93-
<bool>true</bool>
94-
</property>
95-
<property name="toolTip">
96-
<string>Display WFS FeatureTypes containing this word in the title, name or abstract</string>
97-
</property>
98-
<property name="whatsThis">
99-
<string>Display WFS FeatureTypes containing this word in the title, name or abstract</string>
100-
</property>
101-
</widget>
102-
</item>
103-
</layout>
104-
</item>
10527
<item row="0" column="0">
10628
<widget class="QGroupBox" name="GroupBox1">
10729
<property name="title">
@@ -191,6 +113,61 @@
191113
</layout>
192114
</widget>
193115
</item>
116+
<item row="5" column="0">
117+
<widget class="QGroupBox" name="gbCRS">
118+
<property name="title">
119+
<string>Coordinate reference system</string>
120+
</property>
121+
<layout class="QHBoxLayout">
122+
<property name="spacing">
123+
<number>6</number>
124+
</property>
125+
<property name="margin">
126+
<number>9</number>
127+
</property>
128+
<item>
129+
<widget class="QLabel" name="labelCoordRefSys">
130+
<property name="text">
131+
<string/>
132+
</property>
133+
</widget>
134+
</item>
135+
<item>
136+
<spacer>
137+
<property name="orientation">
138+
<enum>Qt::Horizontal</enum>
139+
</property>
140+
<property name="sizeType">
141+
<enum>QSizePolicy::Expanding</enum>
142+
</property>
143+
<property name="sizeHint" stdset="0">
144+
<size>
145+
<width>441</width>
146+
<height>23</height>
147+
</size>
148+
</property>
149+
</spacer>
150+
</item>
151+
<item>
152+
<widget class="QPushButton" name="btnChangeSpatialRefSys">
153+
<property name="enabled">
154+
<bool>false</bool>
155+
</property>
156+
<property name="text">
157+
<string>Change...</string>
158+
</property>
159+
</widget>
160+
</item>
161+
</layout>
162+
</widget>
163+
</item>
164+
<item row="3" column="0">
165+
<widget class="QCheckBox" name="cbxUseTitleLayerName">
166+
<property name="text">
167+
<string>Use title for layer name</string>
168+
</property>
169+
</widget>
170+
</item>
194171
<item row="2" column="0">
195172
<widget class="QTreeView" name="treeView">
196173
<property name="editTriggers">
@@ -210,10 +187,40 @@
210187
</attribute>
211188
</widget>
212189
</item>
213-
<item row="3" column="0">
214-
<widget class="QCheckBox" name="cbxUseTitleLayerName">
190+
<item row="1" column="0">
191+
<layout class="QHBoxLayout" name="horizontalLayoutFilter">
192+
<item>
193+
<widget class="QLabel" name="labelFilter">
194+
<property name="enabled">
195+
<bool>true</bool>
196+
</property>
197+
<property name="text">
198+
<string>Filter:</string>
199+
</property>
200+
<property name="buddy">
201+
<cstring>lineFilter</cstring>
202+
</property>
203+
</widget>
204+
</item>
205+
<item>
206+
<widget class="QLineEdit" name="lineFilter">
207+
<property name="enabled">
208+
<bool>true</bool>
209+
</property>
210+
<property name="toolTip">
211+
<string>Display WFS FeatureTypes containing this word in the title, name or abstract</string>
212+
</property>
213+
<property name="whatsThis">
214+
<string>Display WFS FeatureTypes containing this word in the title, name or abstract</string>
215+
</property>
216+
</widget>
217+
</item>
218+
</layout>
219+
</item>
220+
<item row="4" column="0">
221+
<widget class="QCheckBox" name="cbxFeatureCurrentViewExtent">
215222
<property name="text">
216-
<string>Use title for layer name</string>
223+
<string>Only request features overlapping thencurrent view extent</string>
217224
</property>
218225
</widget>
219226
</item>

0 commit comments

Comments
 (0)