Skip to content

Commit 003f833

Browse files
committed
Merge branch 'master' of github.com:qgis/Quantum-GIS
2 parents 6ac8792 + dd36727 commit 003f833

11 files changed

+269
-161
lines changed

doc/index.dox

+10-8
Original file line numberDiff line numberDiff line change
@@ -19,19 +19,21 @@ fixes, bug reports, contributed documentation, advocacy and supporting other
1919
users on our mailing lists and forums. Financial contributions are also
2020
welcome.
2121

22-
\section index_APIStability API Stability
22+
\section index_APIStability Earlier versions of the API
2323

24-
Versions of QGIS prior to 1.0 did not guarantee API stability since the
25-
application was undergoing rapid development of new features and we did not
26-
want to commit ourselves to a fixed API. With the release of QGIS 1.0 we
27-
guarantee a backwards compatible API for the 1.x and 1.0.x release series. 1.x
28-
releases will be our 'unstable' development builds and 1.0.x releases our
29-
'stable' (bugfixes and very minor tweaks only).
24+
Earlier version of the documentation are also available on the Quantum GIS
25+
website:
26+
27+
<ul>
28+
<li><a href="http://qgis.org/api/1.8">1.8</a>
29+
<li><a href="http://qgis.org/api/1.7">1.7</a>
30+
<li><a href="http://qgis.org/api/1.6">1.6</a>
31+
</ul>
3032

3133
\section index_maillist Mailing Lists
3234
<ul>
3335
<li>For support we encourage you to join our <a
34-
href="http://qgis.osgeo.org/community/mailing-lists.html">mailing lists</a> for
36+
href="http://qgis.org/en/community/mailing-lists.html">mailing lists</a> for
3537
developers.</li> </ul>
3638

3739
\section index_bugs Bug Reporting

src/mapserver/qgsconfigparser.h

+2
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ class QgsConfigParser
4444

4545
virtual void featureTypeList( QDomElement& parentElement, QDomDocument& doc ) const = 0;
4646

47+
virtual void describeFeatureType( const QString& aTypeName, QDomElement& parentElement, QDomDocument& doc ) const = 0;
48+
4749
/**Returns one or possibly several maplayers for a given layer name and style. If there are several layers, the layers should be drawn in inverse list order.
4850
If no layers/style are found, an empty list is returned
4951
@param allowCache true if layer can be read from / written to cache*/

src/mapserver/qgsprojectparser.cpp

+146
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
#include "qgsrasterlayer.h"
2626
#include "qgsrenderer.h"
2727
#include "qgsvectorlayer.h"
28+
#include "qgsvectordataprovider.h"
2829

2930
#include "qgscomposition.h"
3031
#include "qgscomposerarrow.h"
@@ -206,6 +207,151 @@ void QgsProjectParser::featureTypeList( QDomElement& parentElement, QDomDocument
206207
return;
207208
}
208209

210+
void QgsProjectParser::describeFeatureType( const QString& aTypeName, QDomElement& parentElement, QDomDocument& doc ) const
211+
{
212+
if ( mProjectLayerElements.size() < 1 )
213+
{
214+
return;
215+
}
216+
217+
QStringList wfsLayersId = wfsLayers();
218+
QMap< QString, QMap< int, QString > > aliasInfo = layerAliasInfo();
219+
QMap< QString, QSet<QString> > hiddenAttrs = hiddenAttributes();
220+
221+
foreach( const QDomElement &elem, mProjectLayerElements )
222+
{
223+
QString type = elem.attribute( "type" );
224+
if ( type == "vector" )
225+
{
226+
QgsMapLayer *mLayer = createLayerFromElement( elem );
227+
QgsVectorLayer* layer = dynamic_cast<QgsVectorLayer*>( mLayer );
228+
if ( layer && wfsLayersId.contains( layer->id() ) && ( aTypeName == "" || layer->name() == aTypeName ) )
229+
{
230+
//do a select with searchRect and go through all the features
231+
QgsVectorDataProvider* provider = layer->dataProvider();
232+
if ( !provider )
233+
{
234+
continue;
235+
}
236+
237+
//is there alias info for this vector layer?
238+
QMap< int, QString > layerAliasInfo;
239+
QMap< QString, QMap< int, QString > >::const_iterator aliasIt = aliasInfo.find( mLayer->id() );
240+
if ( aliasIt != aliasInfo.constEnd() )
241+
{
242+
layerAliasInfo = aliasIt.value();
243+
}
244+
245+
//hidden attributes for this layer
246+
QSet<QString> layerHiddenAttributes;
247+
QMap< QString, QSet<QString> >::const_iterator hiddenIt = hiddenAttrs.find( mLayer->id() );
248+
if ( hiddenIt != hiddenAttrs.constEnd() )
249+
{
250+
layerHiddenAttributes = hiddenIt.value();
251+
}
252+
253+
QString typeName = layer->name();
254+
typeName = typeName.replace( QString( " " ), QString( "_" ) );
255+
256+
//xsd:element
257+
QDomElement elementElem = doc.createElement( "element"/*xsd:element*/ );
258+
elementElem.setAttribute( "name", typeName );
259+
elementElem.setAttribute( "type", "qgs:" + typeName + "Type" );
260+
elementElem.setAttribute( "substitutionGroup", "gml:_Feature" );
261+
parentElement.appendChild( elementElem );
262+
263+
//xsd:complexType
264+
QDomElement complexTypeElem = doc.createElement( "complexType"/*xsd:complexType*/ );
265+
complexTypeElem.setAttribute( "name", typeName + "Type" );
266+
parentElement.appendChild( complexTypeElem );
267+
268+
//xsd:complexType
269+
QDomElement complexContentElem = doc.createElement( "complexContent"/*xsd:complexContent*/ );
270+
complexTypeElem.appendChild( complexContentElem );
271+
272+
//xsd:extension
273+
QDomElement extensionElem = doc.createElement( "extension"/*xsd:extension*/ );
274+
extensionElem.setAttribute( "base", "gml:AbstractFeatureType" );
275+
complexContentElem.appendChild( extensionElem );
276+
277+
//xsd:sequence
278+
QDomElement sequenceElem = doc.createElement( "sequence"/*xsd:sequence*/ );
279+
extensionElem.appendChild( sequenceElem );
280+
281+
//xsd:element
282+
QDomElement geomElem = doc.createElement( "element"/*xsd:element*/ );
283+
geomElem.setAttribute( "name", "geometry" );
284+
QGis::WkbType wkbType = layer->wkbType();
285+
switch ( wkbType )
286+
{
287+
case QGis::WKBPoint25D:
288+
case QGis::WKBPoint:
289+
geomElem.setAttribute( "type", "gml:PointPropertyType" );
290+
break;
291+
case QGis::WKBLineString25D:
292+
case QGis::WKBLineString:
293+
geomElem.setAttribute( "type", "gml:LineStringPropertyType" );
294+
break;
295+
case QGis::WKBPolygon25D:
296+
case QGis::WKBPolygon:
297+
geomElem.setAttribute( "type", "gml:PolygonPropertyType" );
298+
break;
299+
case QGis::WKBMultiPoint25D:
300+
case QGis::WKBMultiPoint:
301+
geomElem.setAttribute( "type", "gml:MultiPointPropertyType" );
302+
break;
303+
case QGis::WKBMultiLineString25D:
304+
case QGis::WKBMultiLineString:
305+
geomElem.setAttribute( "type", "gml:MultiLineStringPropertyType" );
306+
break;
307+
case QGis::WKBMultiPolygon25D:
308+
case QGis::WKBMultiPolygon:
309+
geomElem.setAttribute( "type", "gml:MultiPolygonPropertyType" );
310+
break;
311+
default:
312+
geomElem.setAttribute( "type", "gml:GeometryPropertyType" );
313+
break;
314+
}
315+
geomElem.setAttribute( "minOccurs", "0" );
316+
geomElem.setAttribute( "maxOccurs", "1" );
317+
sequenceElem.appendChild( geomElem );
318+
319+
const QgsFieldMap& fields = provider->fields();
320+
for ( QgsFieldMap::const_iterator it = fields.begin(); it != fields.end(); ++it )
321+
{
322+
323+
QString attributeName = it.value().name();
324+
//skip attribute if it has edit type 'hidden'
325+
if ( layerHiddenAttributes.contains( attributeName ) )
326+
{
327+
continue;
328+
}
329+
330+
//xsd:element
331+
QDomElement geomElem = doc.createElement( "element"/*xsd:element*/ );
332+
geomElem.setAttribute( "name", attributeName );
333+
if ( it.value().type() == 2 )
334+
geomElem.setAttribute( "type", "integer" );
335+
else if ( it.value().type() == 6 )
336+
geomElem.setAttribute( "type", "double" );
337+
else
338+
geomElem.setAttribute( "type", "string" );
339+
340+
sequenceElem.appendChild( geomElem );
341+
342+
//check if the attribute name should be replaced with an alias
343+
QMap<int, QString>::const_iterator aliasIt = layerAliasInfo.find( it.key() );
344+
if ( aliasIt != layerAliasInfo.constEnd() )
345+
{
346+
geomElem.setAttribute( "alias", aliasIt.value() );
347+
}
348+
}
349+
}
350+
}
351+
}
352+
return;
353+
}
354+
209355
void QgsProjectParser::addLayers( QDomDocument &doc,
210356
QDomElement &parentElem,
211357
const QDomElement &legendElem,

src/mapserver/qgsprojectparser.h

+2
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ class QgsProjectParser: public QgsConfigParser
4040

4141
virtual void featureTypeList( QDomElement& parentElement, QDomDocument& doc ) const;
4242

43+
virtual void describeFeatureType( const QString& aTypeName, QDomElement& parentElement, QDomDocument& doc ) const;
44+
4345
int numberOfLayers() const;
4446

4547
/**Returns one or possibly several maplayers for a given layer name and style. If no layers/style are found, an empty list is returned*/

src/mapserver/qgssldparser.h

+2
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,8 @@ class QgsSLDParser: public QgsConfigParser
5757
void layersAndStylesCapabilities( QDomElement& parentElement, QDomDocument& doc ) const;
5858

5959
void featureTypeList( QDomElement &, QDomDocument & ) const {};
60+
61+
void describeFeatureType( const QString& aTypeName, QDomElement& parentElement, QDomDocument& doc ) const {};
6062

6163
/**Returns number of layers in configuration*/
6264
int numberOfLayers() const;

src/mapserver/qgswfsserver.cpp

+2-136
Original file line numberDiff line numberDiff line change
@@ -262,143 +262,9 @@ QDomDocument QgsWFSServer::describeFeatureType()
262262
}
263263
else
264264
{
265-
return doc;
265+
typeName = "";
266266
}
267-
268-
QStringList wfsLayersId = mConfigParser->wfsLayers();
269-
QMap< QString, QMap< int, QString > > aliasInfo = mConfigParser->layerAliasInfo();
270-
QMap< QString, QSet<QString> > hiddenAttributes = mConfigParser->hiddenAttributes();
271-
272-
QList<QgsMapLayer*> layerList;
273-
QgsMapLayer* currentLayer = 0;
274-
275-
layerList = mConfigParser->mapLayerFromStyle( typeName, "" );
276-
currentLayer = layerList.at( 0 );
277-
278-
QgsVectorLayer* layer = dynamic_cast<QgsVectorLayer*>( currentLayer );
279-
if ( layer && wfsLayersId.contains( layer->id() ) )
280-
{
281-
//is there alias info for this vector layer?
282-
QMap< int, QString > layerAliasInfo;
283-
QMap< QString, QMap< int, QString > >::const_iterator aliasIt = aliasInfo.find( currentLayer->id() );
284-
if ( aliasIt != aliasInfo.constEnd() )
285-
{
286-
layerAliasInfo = aliasIt.value();
287-
}
288-
289-
//hidden attributes for this layer
290-
QSet<QString> layerHiddenAttributes;
291-
QMap< QString, QSet<QString> >::const_iterator hiddenIt = hiddenAttributes.find( currentLayer->id() );
292-
if ( hiddenIt != hiddenAttributes.constEnd() )
293-
{
294-
layerHiddenAttributes = hiddenIt.value();
295-
}
296-
297-
//do a select with searchRect and go through all the features
298-
QgsVectorDataProvider* provider = layer->dataProvider();
299-
if ( !provider )
300-
{
301-
return doc;
302-
}
303-
304-
typeName = typeName.replace( QString( " " ), QString( "_" ) );
305-
306-
//xsd:element
307-
QDomElement elementElem = doc.createElement( "element"/*xsd:element*/ );
308-
elementElem.setAttribute( "name", typeName );
309-
elementElem.setAttribute( "type", "qgs:" + typeName + "Type" );
310-
elementElem.setAttribute( "substitutionGroup", "gml:_Feature" );
311-
schemaElement.appendChild( elementElem );
312-
313-
//xsd:complexType
314-
QDomElement complexTypeElem = doc.createElement( "complexType"/*xsd:complexType*/ );
315-
complexTypeElem.setAttribute( "name", typeName + "Type" );
316-
schemaElement.appendChild( complexTypeElem );
317-
318-
//xsd:complexType
319-
QDomElement complexContentElem = doc.createElement( "complexContent"/*xsd:complexContent*/ );
320-
complexTypeElem.appendChild( complexContentElem );
321-
322-
//xsd:extension
323-
QDomElement extensionElem = doc.createElement( "extension"/*xsd:extension*/ );
324-
extensionElem.setAttribute( "base", "gml:AbstractFeatureType" );
325-
complexContentElem.appendChild( extensionElem );
326-
327-
//xsd:sequence
328-
QDomElement sequenceElem = doc.createElement( "sequence"/*xsd:sequence*/ );
329-
extensionElem.appendChild( sequenceElem );
330-
331-
//xsd:element
332-
QDomElement geomElem = doc.createElement( "element"/*xsd:element*/ );
333-
geomElem.setAttribute( "name", "geometry" );
334-
QGis::WkbType wkbType = layer->wkbType();
335-
switch ( wkbType )
336-
{
337-
case QGis::WKBPoint25D:
338-
case QGis::WKBPoint:
339-
geomElem.setAttribute( "type", "gml:PointPropertyType" );
340-
break;
341-
case QGis::WKBLineString25D:
342-
case QGis::WKBLineString:
343-
geomElem.setAttribute( "type", "gml:LineStringPropertyType" );
344-
break;
345-
case QGis::WKBPolygon25D:
346-
case QGis::WKBPolygon:
347-
geomElem.setAttribute( "type", "gml:PolygonPropertyType" );
348-
break;
349-
case QGis::WKBMultiPoint25D:
350-
case QGis::WKBMultiPoint:
351-
geomElem.setAttribute( "type", "gml:MultiPointPropertyType" );
352-
break;
353-
case QGis::WKBMultiLineString25D:
354-
case QGis::WKBMultiLineString:
355-
geomElem.setAttribute( "type", "gml:MultiLineStringPropertyType" );
356-
break;
357-
case QGis::WKBMultiPolygon25D:
358-
case QGis::WKBMultiPolygon:
359-
geomElem.setAttribute( "type", "gml:MultiPolygonPropertyType" );
360-
break;
361-
default:
362-
geomElem.setAttribute( "type", "gml:GeometryPropertyType" );
363-
break;
364-
}
365-
geomElem.setAttribute( "minOccurs", "0" );
366-
geomElem.setAttribute( "maxOccurs", "1" );
367-
sequenceElem.appendChild( geomElem );
368-
369-
const QgsFieldMap& fields = provider->fields();
370-
for ( QgsFieldMap::const_iterator it = fields.begin(); it != fields.end(); ++it )
371-
{
372-
373-
QString attributeName = it.value().name();
374-
//skip attribute if it has edit type 'hidden'
375-
if ( layerHiddenAttributes.contains( attributeName ) )
376-
{
377-
continue;
378-
}
379-
380-
//xsd:element
381-
QDomElement geomElem = doc.createElement( "element"/*xsd:element*/ );
382-
geomElem.setAttribute( "name", attributeName );
383-
if ( it.value().type() == 2 )
384-
geomElem.setAttribute( "type", "integer" );
385-
else if ( it.value().type() == 6 )
386-
geomElem.setAttribute( "type", "double" );
387-
else
388-
geomElem.setAttribute( "type", "string" );
389-
390-
sequenceElem.appendChild( geomElem );
391-
392-
//check if the attribute name should be replaced with an alias
393-
QMap<int, QString>::const_iterator aliasIt = layerAliasInfo.find( it.key() );
394-
if ( aliasIt != layerAliasInfo.constEnd() )
395-
{
396-
geomElem.setAttribute( "alias", aliasIt.value() );
397-
}
398-
399-
}
400-
}
401-
267+
mConfigParser->describeFeatureType( typeName, schemaElement, doc);
402268
return doc;
403269
}
404270

src/providers/grass/qgis.d.rast.c

+10
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
#include <stdio.h>
2929
#include <string.h>
3030
#include <math.h>
31+
#include <assert.h>
3132
#ifdef WIN32
3233
#include <fcntl.h>
3334
#include <io.h>
@@ -36,6 +37,12 @@
3637
#include <grass/raster.h>
3738
#include <grass/display.h>
3839

40+
#ifdef _MSC_VER
41+
#include <float.h>
42+
#define INFINITY (DBL_MAX+DBL_MAX)
43+
#define NAN (INFINITY-INFINITY)
44+
#endif
45+
3946
int display( char *name, char *mapset, RASTER_MAP_TYPE data_type, char *format );
4047

4148
int main( int argc, char **argv )
@@ -151,6 +158,9 @@ static int cell_draw( char *name,
151158
// and 0./0. if all fails
152159
#endif
153160

161+
assert( dnul != dnul );
162+
assert( fnul != fnul );
163+
154164
big_endian = !( *(( char * )( &one ) ) );
155165

156166
ncols = G_window_cols();

0 commit comments

Comments
 (0)