public static byte[] GeoProcessingWay(Way way, GeoTypeOGC geoTypeOgc) { switch (geoTypeOgc) { case GeoTypeOGC.LineString: return GeoProcessing.ConstructLineString(way.Nodes, way); break; case GeoTypeOGC.Polygon: return GeoProcessing.ConstructPolygon(way.Nodes, way); break; } throw new TypeLoadException("Geo type " + geoTypeOgc + " using Way not supported"); }
public static byte[] GeoProcessingWay(Way way, GeoTypeOGC geoTypeOgc) { switch (geoTypeOgc) { case GeoTypeOGC.LineString: return(GeoProcessing.ConstructLineString(way.Nodes, way)); break; case GeoTypeOGC.Polygon: return(GeoProcessing.ConstructPolygon(way.Nodes, way)); break; } throw new TypeLoadException("Geo type " + geoTypeOgc + " using Way not supported"); }
private void ProcessSectionGeoTypeOsm(XElement xGeoOsm, Dictionary <string, GeoTypeOGC> geoOsm) { if (XmlUtility.IsExistAttributesInXElement(xGeoOsm)) { foreach (XElement xTags in xGeoOsm.Elements()) { if (xTags.Attribute("geography") != null) { GeoTypeOGC geoTypeOgc = this.GetTypeOGCFromSectionGeo(xTags.Attribute("geography").Value); geoOsm.Add(xTags.Name.ToString(), geoTypeOgc); } else { throw new XmlException("A tag " + xGeoOsm.Name.ToString() + @"/" + xTags.Name.ToString() + " attribute 'geography' is not found"); } } } }
private void ImportGeoWays() { if (_waysOsm.Count > 0) { DataTable waysOsm = this.GetTableGeo(); int countRow = 0; foreach (KeyValuePair <Int64, Way> keyValuePair in _waysOsm) { countRow++; if (keyValuePair.Value.GeoType == null) { continue; } GeoTypeOGC geoTypeOgc = keyValuePair.Value.GeoType.GeoTypeOGC; byte[] way = GeoProcessing.GeoProcessingWay(keyValuePair.Value, geoTypeOgc); if (way == null) { continue; } DataRow dataRow = waysOsm.NewRow(); dataRow["idGeo"] = keyValuePair.Key; dataRow["bin"] = way; dataRow["typeGeo"] = (Int16)geoTypeOgc; waysOsm.Rows.Add(dataRow); if (countRow == COUNT_ROW) { this.ImportDataTableInDb(ref waysOsm, new GetTable(GetTableGeo)); countRow = 0; } } if (waysOsm.Rows.Count > 0) { this.ImportDataTableInDb(ref waysOsm, new GetTable(GetTableGeo)); } } }
public GeoType(GeoTypeOGC geoTypeOgc) { _geoTypeOgc = geoTypeOgc; }