/// <summary> /// This is the method that actually does the work. /// </summary> /// <param name="DA">The DA object can be used to retrieve data from input parameters and /// to store data in output parameters.</param> protected override void SolveInstance(IGH_DataAccess DA) { // Get the Rhino Units to properly scale the lat/lon data into Rhino units double unitScale = CommonGHProcessors.GetRhinoUnitScale(Rhino.RhinoDoc.ActiveDoc); List <OSMPointData> outPoints = new List <OSMPointData>(); List <OSMPoint> osmPoints = new List <OSMPoint>(); LINE.Geometry.Interval2d latlon = new LINE.Geometry.Interval2d(); string dataStream = string.Empty; Interval latDomain = new Interval(); Interval lonDomain = new Interval(); string path = null; DA.GetData(0, ref path); if (path != null && System.IO.File.Exists(path)) { ElkLib.NodePreProcess(path, unitScale, out dataStream, out osmPoints, out latlon); foreach (OSMPoint op in osmPoints) { OSMPointData od = new OSMPointData(op); outPoints.Add(od); } } lonDomain = new Interval(latlon.UMin, latlon.UMax); latDomain = new Interval(latlon.VMin, latlon.VMax); // Output the data DA.SetDataList(0, outPoints); DA.SetData(1, path); DA.SetData(2, lonDomain); DA.SetData(3, latDomain); }
public static Dictionary <string, object> Location(string filePath) { List <OSMPoint> osmPoints = new List <OSMPoint>(); LINE.Geometry.Interval2d latlon = new LINE.Geometry.Interval2d(); string dataStream = string.Empty; // Get the Revit Units for scale double scale = 1.0; string exception = null; try { scale = Elk.DynamoCommon.GetRevitUnitScale(); } catch (Exception ex) { exception = ex.Message; } if (exception == null) { exception = scale.ToString(); } string path = filePath; if (path != null && System.IO.File.Exists(path)) { ElkLib.NodePreProcess(path, scale, out dataStream, out osmPoints, out latlon); } return(new Dictionary <string, object> { { "OSM", osmPoints }, { "XML", path }, { "Loc", latlon } //{"test", exception} }); }