Skip to content

Instantly share code, notes, and snippets.

@mibe
Created February 5, 2011 23:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mibe/812914 to your computer and use it in GitHub Desktop.
Save mibe/812914 to your computer and use it in GitHub Desktop.
Patch for Srtm2Osm to work with 64 bit integers instead of 32 bit.
Index: OsmUtils.Framework/OsmDatabase.cs
===================================================================
--- OsmUtils.Framework/OsmDatabase.cs (revision 25226)
+++ OsmUtils.Framework/OsmDatabase.cs (working copy)
@@ -8,12 +8,12 @@
{
public class OsmDatabase
{
- public IDictionary<int, OsmNode> Nodes
+ public IDictionary<long, OsmNode> Nodes
{
get { return nodes; }
}
- public IDictionary<int, OsmWay> Ways
+ public IDictionary<long, OsmWay> Ways
{
get { return ways; }
}
@@ -22,7 +22,7 @@
/// Gets a dictionary of OSM relations in the OSM database.
/// </summary>
/// <value>A dictionary of OSM relations.</value>
- public IDictionary<int, OsmRelation> Relations
+ public IDictionary<long, OsmRelation> Relations
{
get { return relations; }
}
@@ -256,9 +256,9 @@
return osmObjectActionStringConstants[(int)action];
}
- private Dictionary<int, OsmNode> nodes = new Dictionary<int, OsmNode> ();
- private Dictionary<int, OsmWay> ways = new Dictionary<int, OsmWay> ();
- private Dictionary<int, OsmRelation> relations = new Dictionary<int, OsmRelation> ();
+ private Dictionary<long, OsmNode> nodes = new Dictionary<long, OsmNode> ();
+ private Dictionary<long, OsmWay> ways = new Dictionary<long, OsmWay> ();
+ private Dictionary<long, OsmRelation> relations = new Dictionary<long, OsmRelation> ();
static private string[] osmObjectActionStringConstants = new string[] { null, "delete", "modify" };
static private string[] osmReferenceTypeStringConstants = new string[] { null, "node", "way", "relation" };
Index: OsmUtils.Framework/OsmNode.cs
===================================================================
--- OsmUtils.Framework/OsmNode.cs (revision 25226)
+++ OsmUtils.Framework/OsmNode.cs (working copy)
@@ -16,7 +16,7 @@
get { return longitude; }
}
- public OsmNode (int nodeId, double latitude, double longitude)
+ public OsmNode (long nodeId, double latitude, double longitude)
: base (nodeId)
{
this.latitude = latitude;
Index: OsmUtils.Framework/OsmObjectBase.cs
===================================================================
--- OsmUtils.Framework/OsmObjectBase.cs (revision 25226)
+++ OsmUtils.Framework/OsmObjectBase.cs (working copy)
@@ -13,7 +13,7 @@
public abstract class OsmObjectBase
{
- public int ObjectId
+ public long ObjectId
{
get { return objectId; }
}
@@ -49,7 +49,7 @@
public IDictionary<string, OsmTag> Tags { get { return tags; } }
- protected OsmObjectBase (int objectId)
+ protected OsmObjectBase (long objectId)
{
this.objectId = objectId;
}
@@ -128,7 +128,7 @@
}
}
- private int objectId;
+ private long objectId;
private DateTime timestamp;
private string user;
private bool visible;
Index: OsmUtils.Framework/OsmRelation.cs
===================================================================
--- OsmUtils.Framework/OsmRelation.cs (revision 25226)
+++ OsmUtils.Framework/OsmRelation.cs (working copy)
@@ -14,7 +14,7 @@
/// a specified ID.
/// </summary>
/// <param name="relationId">The relation ID.</param>
- public OsmRelation (int relationId)
+ public OsmRelation (long relationId)
: base (relationId)
{
}
@@ -26,7 +26,7 @@
/// <param name="referenceId">The ID of the referenced OSM object.</param>
/// <param name="role">The role of the relation's member.</param>
/// <exception cref="ArgumentException">A member with the same key already exists in the relation.</exception>
- public void AddMember (OsmReferenceType referenceType, int referenceId, string role)
+ public void AddMember (OsmReferenceType referenceType, long referenceId, string role)
{
OsmRelationMember member = new OsmRelationMember (referenceType, referenceId, role);
members.Add (member.MemberReference, member);
Index: OsmUtils.Framework/OsmRelationMember.cs
===================================================================
--- OsmUtils.Framework/OsmRelationMember.cs (revision 25226)
+++ OsmUtils.Framework/OsmRelationMember.cs (working copy)
@@ -60,7 +60,7 @@
/// <param name="referenceId">The ID of the referenced OSM object.</param>
/// <param name="role">The role of the relation's member.</param>
public OsmRelationMember (OsmReferenceType referenceType,
- int referenceId,
+ long referenceId,
string role)
: this (new OsmRelationMemberReference (referenceType, referenceId), role)
{
Index: OsmUtils.Framework/OsmRelationMemberReference.cs
===================================================================
--- OsmUtils.Framework/OsmRelationMemberReference.cs (revision 25226)
+++ OsmUtils.Framework/OsmRelationMemberReference.cs (working copy)
@@ -23,7 +23,7 @@
/// Gets the ID of the referenced OSM object.
/// </summary>
/// <value>The ID of the referenced OSM object.</value>
- public int ReferenceId
+ public long ReferenceId
{
get { return referenceId; }
}
@@ -34,7 +34,7 @@
/// </summary>
/// <param name="referenceType">Type of the referenced OSM object.</param>
/// <param name="referenceId">The ID of the referenced OSM object.</param>
- public OsmRelationMemberReference (OsmReferenceType referenceType, int referenceId)
+ public OsmRelationMemberReference (OsmReferenceType referenceType, long referenceId)
{
this.referenceType = referenceType;
this.referenceId = referenceId;
@@ -84,6 +84,6 @@
}
private OsmReferenceType referenceType;
- private int referenceId;
+ private long referenceId;
}
}
Index: OsmUtils.Framework/OsmSchema.cs
===================================================================
--- OsmUtils.Framework/OsmSchema.cs (revision 25226)
+++ OsmUtils.Framework/OsmSchema.cs (working copy)
@@ -289,7 +289,7 @@
private System.Collections.Generic.List<tag> tag;
/// <remarks/>
- private int id;
+ private long id;
/// <remarks/>
private bool idSpecified;
@@ -325,7 +325,7 @@
{
}
- public osmNode(System.Collections.Generic.List<tag> tag, int id, bool idSpecified, string timestamp, string user, bool visible, bool visibleSpecified, double lat, bool latSpecified, double lon, bool lonSpecified, string action)
+ public osmNode(System.Collections.Generic.List<tag> tag, long id, bool idSpecified, string timestamp, string user, bool visible, bool visibleSpecified, double lat, bool latSpecified, double lon, bool lonSpecified, string action)
{
this.tag = tag;
this.id = id;
@@ -358,7 +358,7 @@
}
[System.Xml.Serialization.XmlAttributeAttribute(AttributeName="id")]
- public int Id
+ public long Id
{
get
{
@@ -555,7 +555,7 @@
private System.Collections.Generic.List<tag> tag;
/// <remarks/>
- private int id;
+ private long id;
/// <remarks/>
private bool idSpecified;
@@ -625,7 +625,7 @@
}
[System.Xml.Serialization.XmlAttributeAttribute(AttributeName="id")]
- public int Id
+ public long Id
{
get
{
@@ -750,7 +750,7 @@
{
/// <remarks/>
- private int @ref;
+ private long @ref;
/// <remarks/>
private bool refSpecified;
@@ -759,14 +759,14 @@
{
}
- public osmWayND(int @ref, bool refSpecified)
+ public osmWayND(long @ref, bool refSpecified)
{
this.@ref = @ref;
this.refSpecified = refSpecified;
}
[System.Xml.Serialization.XmlAttributeAttribute(AttributeName="ref")]
- public int Ref
+ public long Ref
{
get
{
@@ -816,7 +816,7 @@
private System.Collections.Generic.List<tag> tag;
/// <remarks/>
- private int id;
+ private long id;
/// <remarks/>
private bool idSpecified;
@@ -840,7 +840,7 @@
{
}
- public osmRelation(System.Collections.Generic.List<osmRelationMember> member, System.Collections.Generic.List<tag> tag, int id, bool idSpecified, string timestamp, string user, bool visible, bool visibleSpecified, string action)
+ public osmRelation(System.Collections.Generic.List<osmRelationMember> member, System.Collections.Generic.List<tag> tag, long id, bool idSpecified, string timestamp, string user, bool visible, bool visibleSpecified, string action)
{
this.member = member;
this.tag = tag;
@@ -886,7 +886,7 @@
}
[System.Xml.Serialization.XmlAttributeAttribute(AttributeName="id")]
- public int Id
+ public long Id
{
get
{
@@ -1014,7 +1014,7 @@
private string type;
/// <remarks/>
- private int @ref;
+ private long @ref;
/// <remarks/>
private bool refSpecified;
@@ -1051,7 +1051,7 @@
}
[System.Xml.Serialization.XmlAttributeAttribute(AttributeName="ref")]
- public int Ref
+ public long Ref
{
get
{
Index: OsmUtils.Framework/OsmWay.cs
===================================================================
--- OsmUtils.Framework/OsmWay.cs (revision 25226)
+++ OsmUtils.Framework/OsmWay.cs (working copy)
@@ -7,7 +7,7 @@
{
public class OsmWay : OsmObjectBase, ICloneable
{
- public IList<int> NodesList
+ public IList<long> NodesList
{
get { return nodesList; }
}
@@ -23,17 +23,17 @@
}
}
- public OsmWay (int wayId)
+ public OsmWay (long wayId)
: base (wayId)
{
}
- public void AddNode (int nodeId)
+ public void AddNode (long nodeId)
{
nodesList.Add (nodeId);
}
- public IEnumerable<int> EnumerateNodesIds ()
+ public IEnumerable<long> EnumerateNodesIds ()
{
return nodesList;
}
@@ -94,7 +94,7 @@
{
base.CopyToClone (clone);
- ((OsmWay)clone).nodesList = new List<int> (nodesList);
+ ((OsmWay)clone).nodesList = new List<long> (nodesList);
}
#region ICloneable Members
@@ -109,12 +109,12 @@
{
OsmWay clone = new OsmWay (ObjectId);
CopyToClone (clone);
- clone.nodesList = new List<int> (nodesList);
+ clone.nodesList = new List<long> (nodesList);
return clone;
}
#endregion
- private List<int> nodesList = new List<int> ();
+ private List<long> nodesList = new List<long> ();
}
}
Index: Srtm2Osm/Srtm2OsmCommand.cs
===================================================================
--- Srtm2Osm/Srtm2OsmCommand.cs (revision 25229)
+++ Srtm2Osm/Srtm2OsmCommand.cs (working copy)
@@ -94,7 +94,7 @@
double elevationStepInUnits = elevationStep * elevationUnits;
contourMarker.Configure (elevationUnits);
- int wayId = 1000000000, nodeId = 2000000000;
+ long wayId = 1000000000, nodeId = 2000000000;
if (largeAreaMode)
{
@@ -128,7 +128,7 @@
way.Id = wayId++;
way.Nd = new List<osmWayND> ();
- int firstNodeId = 0;
+ long firstNodeId = 0;
for (int i = 0; i < polyline.Vertices.Count; i++)
{
@@ -178,7 +178,7 @@
contourMarker.MarkContour (isohypseWay, isohypse);
osmDb.AddWay (isohypseWay);
- int firstNodeId = nodeId;
+ long firstNodeId = nodeId;
for (int i = 0; i < polyline.VerticesCount; i++)
{
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment