/// <summary> /// Resetting this data source /// </summary> public override void Reset() { _current = null; if (_cachedPrimitives != null) { _cachedPrimitives.Clear(); } _stream.Seek(0, SeekOrigin.Begin); }
/// <summary> /// Resetting this data source /// </summary> public override void Reset() { _current = null; _stream.Seek(0, SeekOrigin.Begin); }
/// <summary> /// Moves to the next object. /// </summary> /// <returns></returns> public override bool MoveNext() { KeyValuePair<PrimitiveBlock, object> nextPBFPrimitive = this.MoveToNextPrimitive(); if (nextPBFPrimitive.Value != null) { // there is a primitive. _current = this.Convert(nextPBFPrimitive); return true; } return false; }
/// <summary> /// Move to the next item in the stream. /// </summary> /// <param name="ignoreNodes">Makes this source skip all nodes.</param> /// <param name="ignoreWays">Makes this source skip all ways.</param> /// <param name="ignoreRelations">Makes this source skip all relations.</param> /// <returns></returns> public override bool MoveNext(bool ignoreNodes, bool ignoreWays, bool ignoreRelations) { var nextPBFPrimitive = this.MoveToNextPrimitive(ignoreNodes, ignoreWays, ignoreRelations); while(nextPBFPrimitive.Value != null) { OsmSharp.Osm.PBF.Node node = (nextPBFPrimitive.Value as OsmSharp.Osm.PBF.Node); if(node != null && !ignoreNodes) { // next primitve is a node. _current = this.ConvertNode(nextPBFPrimitive.Key, node); return true; } OsmSharp.Osm.PBF.Way way = (nextPBFPrimitive.Value as OsmSharp.Osm.PBF.Way); if(way != null && !ignoreWays) { // next primitive is a way. _current = this.ConvertWay(nextPBFPrimitive.Key, way); return true; } OsmSharp.Osm.PBF.Relation relation = (nextPBFPrimitive.Value as OsmSharp.Osm.PBF.Relation); if (relation != null && !ignoreRelations) { // next primitive is a relation. _current = this.ConvertRelation(nextPBFPrimitive.Key, relation); return true; } nextPBFPrimitive = this.MoveToNextPrimitive(ignoreNodes, ignoreWays, ignoreRelations); } return false; }
/// <summary> /// Returns true when the given osmGeo object has an uneven id. /// </summary> /// <param name="osmGeo"></param> /// <returns></returns> public override bool Include(OsmSharp.Osm.OsmGeo osmGeo) { return(osmGeo.Id.Value % 2 == 1); }