コード例 #1
0
ファイル: GeoJSONNetwork.cs プロジェクト: flowmatters/Veneer
        public GeoJSONNetwork(Network source)
        {
            IList<ICatchment> catchments = new List<ICatchment>(source.Catchments);
            bool schematicAsCoordinates =
                source.Nodes.OfType<Node>()
                    .All(n => n.location.E.EqualWithTolerance(0.0) && n.location.N.EqualWithTolerance(0.0));

            List<GeoJSONFeature> featureList = new List<GeoJSONFeature>();
            featureList.AddRange(from Node n in source.nodes select new GeoJSONFeature(n,source.Scenario,schematicAsCoordinates));
            foreach (Link link in source.links)
            {
                if (link.Network == null)
                    link.Network = source;
            }

            featureList.AddRange(from Link l in source.links select new GeoJSONFeature(l,source.Scenario,schematicAsCoordinates));
            featureList.AddRange(catchments.Select(c => new GeoJSONFeature((Catchment)c,source.Scenario.BoundaryForCatchment(c))));
            features = featureList.ToArray();
        }
コード例 #2
0
        public GeoJSONNetwork(Network source)
        {
            IList <ICatchment> catchments = new List <ICatchment>(source.Catchments);
            bool schematicAsCoordinates   =
                source.Nodes.OfType <Node>()
                .All(n => n.location.E.EqualWithTolerance(0.0) && n.location.N.EqualWithTolerance(0.0));

            List <GeoJSONFeature> featureList = new List <GeoJSONFeature>();

            featureList.AddRange(from Node n in source.nodes select new GeoJSONFeature(n, source.Scenario, schematicAsCoordinates));
            foreach (Link link in source.links)
            {
                if (link.Network == null)
                {
                    link.Network = source;
                }
            }

            featureList.AddRange(from Link l in source.links select new GeoJSONFeature(l, source.Scenario, schematicAsCoordinates));
            featureList.AddRange(catchments.Select(c => new GeoJSONFeature((Catchment)c, source.Scenario.BoundaryForCatchment(c))));
            features = featureList.ToArray();
        }
コード例 #3
0
 private static string NodeURL(Node n, Network network)
 {
     return(UriTemplates.Node.Replace("{nodeId}", network.nodes.indexOf(n).ToString()));//n.id.ToString());
 }