Example #1
0
 private void connectPOIsToPaths(Dictionary <string, Point3D> labeledPoints, List <LineStringDTO> paths, List <Point3D> pathPoints)
 {
     foreach (var item in labeledPoints.Values)
     {
         if (item.Name.ToLower().Contains("level"))
         {
             continue;
         }
         double  minToSource   = double.MaxValue;
         Point3D closestSource = null;
         foreach (Point3D pointFromAll in pathPoints)
         {
             if (item.Equals(pointFromAll) | item.Level != pointFromAll.Level)
             {
                 continue;
             }
             double toSource = GeoUtils.GetHaversineDistance(pointFromAll, item);
             if (toSource < minToSource)
             {
                 minToSource   = toSource;
                 closestSource = pointFromAll;
             }
         }
         LineStringDTO pointToNearestPath = new LineStringDTO
         {
             Level    = item.Level,
             Source   = closestSource,
             Target   = item,
             Distance = minToSource,
             Name     = "Edge To " + item.Name,
         };
         pointToNearestPath.setWktAndLocationG();
         paths.Add(pointToNearestPath);
     }
 }