public Matches ( |
||
xmlReader | An XmlReader instance | |
Résultat | bool |
/// <summary> /// This method detects the geometry type from 'GetFeature' response and uses a geometry factory to create the /// appropriate geometries. /// </summary> /// <returns></returns> internal override Collection <Geometry> CreateGeometries(Features features) { GeometryFactory geomFactory = null; string geometryTypeString = string.Empty; if (_quickGeometries) { _multiGeometries = false; } IPathNode pointNode = new PathNode(Gmlns, "Point", (NameTable)XmlReader.NameTable); IPathNode lineStringNode = new PathNode(Gmlns, "LineString", (NameTable)XmlReader.NameTable); IPathNode polygonNode = new PathNode(Gmlns, "Polygon", (NameTable)XmlReader.NameTable); IPathNode multiPointNode = new PathNode(Gmlns, "MultiPoint", (NameTable)XmlReader.NameTable); IPathNode multiLineStringNode = new PathNode(Gmlns, "MultiLineString", (NameTable)XmlReader.NameTable); IPathNode multiCurveNode = new PathNode(Gmlns, "MultiCurve", (NameTable)XmlReader.NameTable); IPathNode multiLineStringNodeAlt = new AlternativePathNodesCollection(multiLineStringNode, multiCurveNode); IPathNode multiPolygonNode = new PathNode(Gmlns, "MultiPolygon", (NameTable)XmlReader.NameTable); IPathNode multiSurfaceNode = new PathNode(Gmlns, "MultiSurface", (NameTable)XmlReader.NameTable); IPathNode multiPolygonNodeAlt = new AlternativePathNodesCollection(multiPolygonNode, multiSurfaceNode); while (XmlReader.Read()) { if (XmlReader.NodeType == XmlNodeType.Element) { if (_multiGeometries) { if (multiPointNode.Matches(XmlReader)) { geomFactory = new MultiPointFactory(_httpClientUtil, FeatureTypeInfo); geometryTypeString = "MultiPointPropertyType"; break; } if (multiLineStringNodeAlt.Matches(XmlReader)) { geomFactory = new MultiLineStringFactory(_httpClientUtil, FeatureTypeInfo); geometryTypeString = "MultiLineStringPropertyType"; break; } if (multiPolygonNodeAlt.Matches(XmlReader)) { geomFactory = new MultiPolygonFactory(_httpClientUtil, FeatureTypeInfo); geometryTypeString = "MultiPolygonPropertyType"; break; } } if (pointNode.Matches(XmlReader)) { geomFactory = new PointFactory(_httpClientUtil, FeatureTypeInfo); geometryTypeString = "PointPropertyType"; break; } if (lineStringNode.Matches(XmlReader)) { geomFactory = new LineStringFactory(_httpClientUtil, FeatureTypeInfo); geometryTypeString = "LineStringPropertyType"; break; } if (polygonNode.Matches(XmlReader)) { geomFactory = new PolygonFactory(_httpClientUtil, FeatureTypeInfo); geometryTypeString = "PolygonPropertyType"; break; } if (ServiceExceptionNode.Matches(XmlReader)) { string serviceException = XmlReader.ReadInnerXml(); Trace.TraceError("A service exception occured: " + serviceException); throw new Exception("A service exception occured: " + serviceException); } } } FeatureTypeInfo.Geometry.GeometryType = geometryTypeString; if (geomFactory == null) { return(Geoms); } geomFactory.CreateGeometries(features); return(Geoms); }
/// <summary> /// This method detects the geometry type from 'GetFeature' response and uses a geometry factory to create the /// appropriate geometries. /// </summary> /// <returns></returns> internal override Collection<Geometry> CreateGeometries(Features features) { GeometryFactory geomFactory = null; string geometryTypeString = string.Empty; if (_quickGeometries) _multiGeometries = false; IPathNode pointNode = new PathNode(Gmlns, "Point", (NameTable) XmlReader.NameTable); IPathNode lineStringNode = new PathNode(Gmlns, "LineString", (NameTable) XmlReader.NameTable); IPathNode polygonNode = new PathNode(Gmlns, "Polygon", (NameTable) XmlReader.NameTable); IPathNode multiPointNode = new PathNode(Gmlns, "MultiPoint", (NameTable) XmlReader.NameTable); IPathNode multiLineStringNode = new PathNode(Gmlns, "MultiLineString", (NameTable) XmlReader.NameTable); IPathNode multiCurveNode = new PathNode(Gmlns, "MultiCurve", (NameTable) XmlReader.NameTable); IPathNode multiLineStringNodeAlt = new AlternativePathNodesCollection(multiLineStringNode, multiCurveNode); IPathNode multiPolygonNode = new PathNode(Gmlns, "MultiPolygon", (NameTable) XmlReader.NameTable); IPathNode multiSurfaceNode = new PathNode(Gmlns, "MultiSurface", (NameTable) XmlReader.NameTable); IPathNode multiPolygonNodeAlt = new AlternativePathNodesCollection(multiPolygonNode, multiSurfaceNode); while (XmlReader.Read()) { if (XmlReader.NodeType == XmlNodeType.Element) { if (_multiGeometries) { if (multiPointNode.Matches(XmlReader)) { geomFactory = new MultiPointFactory(_httpClientUtil, FeatureTypeInfo); geometryTypeString = "MultiPointPropertyType"; break; } if (multiLineStringNodeAlt.Matches(XmlReader)) { geomFactory = new MultiLineStringFactory(_httpClientUtil, FeatureTypeInfo); geometryTypeString = "MultiLineStringPropertyType"; break; } if (multiPolygonNodeAlt.Matches(XmlReader)) { geomFactory = new MultiPolygonFactory(_httpClientUtil, FeatureTypeInfo); geometryTypeString = "MultiPolygonPropertyType"; break; } } if (pointNode.Matches(XmlReader)) { geomFactory = new PointFactory(_httpClientUtil, FeatureTypeInfo); geometryTypeString = "PointPropertyType"; break; } if (lineStringNode.Matches(XmlReader)) { geomFactory = new LineStringFactory(_httpClientUtil, FeatureTypeInfo); geometryTypeString = "LineStringPropertyType"; break; } if (polygonNode.Matches(XmlReader)) { geomFactory = new PolygonFactory(_httpClientUtil, FeatureTypeInfo); geometryTypeString = "PolygonPropertyType"; break; } if (ServiceExceptionNode.Matches(XmlReader)) { string serviceException = XmlReader.ReadInnerXml(); Trace.TraceError("A service exception occured: " + serviceException); throw new Exception("A service exception occured: " + serviceException); } } } FeatureTypeInfo.Geometry.GeometryType = geometryTypeString; if (geomFactory == null) return Geoms; geomFactory.CreateGeometries(features); return Geoms; }