public ConvertToSHP(osm infile) { areas = 0; ways = 0; points = 0; this.infile = infile; foreach (way nWay in infile.wayCollection) { if (nWay.ndCollection[0].reff == nWay.ndCollection[nWay.ndCollection.Count - 1].reff) { areas++; } else { ways++; } foreach (nd nNd in nWay.ndCollection) { node nNode = infile.nodeCollection.GetByRef(nNd.reff); nNode.InWay = true; } } foreach (node nNode in infile.nodeCollection) { if (!nNode.InWay) { points++; } } }
private void tsbOpen_Click(object sender, EventArgs e) { if (openFileDialog1.ShowDialog() == DialogResult.OK) { content = new osm(); OSMFile = openFileDialog1.FileName; content.ReadFromFile(OSMFile); } else return; export = new ConvertToSHP(content); txtOpen.Clear(); txtOpen.Text = "File '" + OSMFile + "' opened successfully!" + Environment.NewLine; txtOpen.Text += "It contains " + content.nodeCollection.Count.ToString(); txtOpen.Text += " nodes and " + content.wayCollection.Count.ToString()+" ways."; txtOpen.Text += Environment.NewLine + Environment.NewLine; //txtOpen.Text += "In terms of shapefiles there are:" + Environment.NewLine; //txtOpen.Text += " -" + areas.ToString() + " polygons" + Environment.NewLine; //txtOpen.Text += " -" + ways.ToString() + " polylines" + Environment.NewLine; //txtOpen.Text += " -" + points.ToString() + " points" + Environment.NewLine; }
private void tsbOpen_Click(object sender, EventArgs e) { if (openFileDialog1.ShowDialog() == DialogResult.OK) { content = new osm(); OSMFile = openFileDialog1.FileName; content.ReadFromFile(OSMFile); } else { return; } export = new ConvertToSHP(content); txtOpen.Clear(); txtOpen.Text = "File '" + OSMFile + "' opened successfully!" + Environment.NewLine; txtOpen.Text += "It contains " + content.nodeCollection.Count.ToString(); txtOpen.Text += " nodes and " + content.wayCollection.Count.ToString() + " ways."; txtOpen.Text += Environment.NewLine + Environment.NewLine; //txtOpen.Text += "In terms of shapefiles there are:" + Environment.NewLine; //txtOpen.Text += " -" + areas.ToString() + " polygons" + Environment.NewLine; //txtOpen.Text += " -" + ways.ToString() + " polylines" + Environment.NewLine; //txtOpen.Text += " -" + points.ToString() + " points" + Environment.NewLine; }
public void Remove(osm item) { _list.Remove(item); }
public void Add(osm item) { _list.Add(item); }