${IS6_NetworkSetting_Title}

${IS6_NetworkSetting_Description}

        private void PathAnalyst_Click(object sender, RoutedEventArgs e)
        {
            //为最佳路径分析服务设置参数
            NetworkSetting networkSetting = new NetworkSetting
            {
                EdgeIDField = "SmEdgeID",
                NodeIDField = "SmNodeID",
                NetworkLayerName = "RoadNet@changchun",
                FTWeightField = "SmLength",
                TFWeightField = "SmLength",
                FromNodeIDField = "SmFNode",
                ToNodeIDField = "SmTNode",
            };

            NetworkParams networkParams = new NetworkParams
            {
                NetworkSetting = networkSetting,
                Tolerance = 30,
            };

            RouteParam routeParam = new RouteParam
            {
                NetworkParams = networkParams,
                ReturnNodePositions = true,
                ReturnEdgeIDsAndNodeIDs = true,
                ReturnCosts = true,
                ReturnPathInfo = new ReturnPathInfoParam()
                {
                    EdgeNameField = "SmEdgeID",
                    NodeNameField = "SmNodeID",
                    ReturnPathGuide = true,
                    ReturnPathTable = false,
                },
            };

            SuperMap.Web.ISDotNET6.FindPathByPointsParameters findPathParameters = new FindPathByPointsParameters
            {
                MapName = "changchun",
                Points = points,
                RouteParam = routeParam,
            };

            //最佳路径分析服务
            FindPathByPointsService service = new FindPathByPointsService("http://localhost/IS/AjaxDemo");
            service.ProcessAsync(findPathParameters);
            service.Failed += new EventHandler<ServiceFailedEventArgs>(service_Failed);
            service.ProcessCompleted += new EventHandler<RouteEventArgs>(service_ProcessCompleted);
        }
        private void FindClosestFacility_Click(object sender, RoutedEventArgs e)
        {
            //为最近设施分析设置参数
            NetworkSetting networkSetting = new NetworkSetting
            {
                NodeIDField = "SmNodeID",
                NetworkLayerName = "RoadNet@changchun",
                EdgeIDField = "SmEdgeID",
                FTWeightField = "SmLength",
                TFWeightField = "SmLength"
            };

            NetworkParams networkParams = new NetworkParams
            {
                Tolerance = 1000,
                NetworkSetting = networkSetting
            };
            ProximityParam proximityParam = new ProximityParam
            {
                FacilityCount = 2,
                MaxRadius = 100000,
                FacilityLayer = "School@changchun",
                IsFromEvent = true,
                NetworkParams = networkParams,
            };

            ClosestFacilityParameters closestFacilityParamters = new ClosestFacilityParameters
            {
                MapName = "changchun",
                Point = eventp,
                ProximityParam = proximityParam
            };

            //最近设施分析
            ClosestFacilityService service = new ClosestFacilityService("http://localhost/IS/AjaxDemo");
            service.ProcessAsync(closestFacilityParamters);
            service.ProcessCompleted += new EventHandler<ProximityEventArgs>(service_ProcessCompleted);
            service.Failed += new EventHandler<ServiceFailedEventArgs>(service_Failed);
        }
        internal static string ToJson(NetworkSetting networkSetting)
        {
            if (networkSetting == null)
            {
                return null;
            }

            string json = "{";

            List<string> list = new List<string>();

            if (!string.IsNullOrEmpty(networkSetting.NetworkLayerName))
            {
                list.Add(string.Format("\"networkLayerName\":\"{0}\"", networkSetting.NetworkLayerName));
            }
            else
            {
                list.Add("\"networkLayerName\":\"\"");
            }

            if (!string.IsNullOrEmpty(networkSetting.NodeIDField))
            {
                list.Add(string.Format("\"nodeIDField\":\"{0}\"", networkSetting.NodeIDField));
            }
            else
            {
                list.Add("\"nodeIDField\":\"\"");
            }

            if (!string.IsNullOrEmpty(networkSetting.EdgeIDField))
            {
                list.Add(string.Format("\"edgeIDField\":\"{0}\"", networkSetting.EdgeIDField));
            }
            else
            {
                list.Add("\"edgeIDField\":\"\"");
            }

            if (!string.IsNullOrEmpty(networkSetting.EdgeFilter))
            {
                list.Add(string.Format("\"edgeFilter\":\"{0}\"", networkSetting.EdgeFilter));
            }
            else
            {
                list.Add("\"edgeFilter\":\"\"");
            }

            if (!string.IsNullOrEmpty(networkSetting.FTWeightField))
            {
                list.Add(string.Format("\"FTWeightField\":\"{0}\"", networkSetting.FTWeightField));
            }
            else
            {
                list.Add("\"FTWeightField\":\"\"");
            }

            if (!string.IsNullOrEmpty(networkSetting.TFWeightField))
            {
                list.Add(string.Format("\"TFWeightField\":\"{0}\"", networkSetting.TFWeightField));
            }
            else
            {
                list.Add("\"TFWeightField\":\"\"");
            }

            if (networkSetting.BarrierEdges != null && networkSetting.BarrierEdges.Count > 0)
            {
                List<string> barrieredges = new List<string>();
                foreach (int i in networkSetting.BarrierEdges)
                {
                    barrieredges.Add(i.ToString());
                }
                list.Add(string.Format("\"barrierEdges\":[{0}]", string.Join(",", barrieredges.ToArray())));
            }
            else
            {
                list.Add("\"barrierEdges\":null");
            }

            if (networkSetting.BarrierNodes != null && networkSetting.BarrierNodes.Count > 0)
            {
                List<string> barriernodes = new List<string>();
                foreach (int ii in networkSetting.BarrierNodes)
                {
                    barriernodes.Add(ii.ToString());
                }
                list.Add(string.Format("\"barrierNodes\":[{0}]", string.Join(",", barriernodes.ToArray())));
            }
            else
            {
                list.Add("\"barrierNodes\":null");
            }

            if (!string.IsNullOrEmpty(networkSetting.FromNodeIDField))
            {
                list.Add(string.Format("\"fromNodeIDField\":\"{0}\"", networkSetting.FromNodeIDField));
            }
            else
            {
                list.Add("\"fromNodeIDField\":\"\"");
            }

            if (!string.IsNullOrEmpty(networkSetting.ToNodeIDField))
            {
                list.Add(string.Format("\"toNodeIDField\":\"{0}\"", networkSetting.ToNodeIDField));
            }
            else
            {
                list.Add("\"toNodeIDField\":\"\"");
            }

            if (!string.IsNullOrEmpty(networkSetting.RoadRuleField))
            {
                list.Add(string.Format("\"roadRuleField\":\"{0}\"", networkSetting.RoadRuleField));
            }
            else
            {
                list.Add("\"roadRuleField\":\"\"");
            }

            list.Add(string.Format("\"fromToOneWayValue\":{0}", networkSetting.FromToOneWayValue));
            list.Add(string.Format("\"toFromOneWayValue\":{0}", networkSetting.ToFromOneWayValue));
            list.Add(string.Format("\"twoWayValue\":{0}", networkSetting.TwoWayValue));
            list.Add(string.Format("\"prohibitValue\":{0}", networkSetting.ProhibitValue));

            json += string.Join(",", list.ToArray());
            json += "}";

            return json;
        }
 /// <summary>${IS6_NetworkParam_constructor_None_D}</summary>
 public NetworkParams()
 {
     NetworkSetting = new NetworkSetting();
 }