コード例 #1
0
 public void FindLocation_CountSet()
 {
     NetworkAnalyst networkAnalyst = new NetworkAnalyst("http://" + ip + ":8090/iserver/services/transportationanalyst-sample/rest");
     LocationAnalystParameter parameter = new LocationAnalystParameter();
     parameter.WeightName = "length";
     parameter.TurnWeightField = "TurnCost";
     parameter.ReturnEdgeFeatures = true;
     parameter.ReturnEdgeGeometry = true;
     parameter.ReturnNodeFeatures = true;
     parameter.IsFromCenter = true;
     parameter.SupplyCenters = new List<SupplyCenter>();
     parameter.SupplyCenters.Add(new SupplyCenter() { NodeID = -11, MaxWeight = 100, Type = SupplyCenterType.FIXEDCENTER });
     parameter.SupplyCenters.Add(new SupplyCenter() { NodeID = 12, MaxWeight = 100, Type = SupplyCenterType.OPTIONALCENTER });
     parameter.ExpectedSupplyCenterCount = 1;
     LocationAnalystResult result = networkAnalyst.FindLocation("RoadNet@Changchun", parameter);
     Assert.IsNotNull(result);
     Assert.IsTrue(result.DemandResults != null);
     Assert.IsTrue(result.DemandResults.Count == 0);
     Assert.IsTrue(result.SupplyResults.Count == 1);
     Assert.IsTrue(result.SupplyResults != null);
     Assert.IsTrue(result.SupplyResults[0].AverageWeight == -1.0);
 }
コード例 #2
0
 public void FindLocation_NetworkDatasetNameNotFound()
 {
     NetworkAnalyst networkAnalyst = new NetworkAnalyst("http://" + ip + ":8090/iserver/services/transportationanalyst-sample/rest");
     LocationAnalystParameter parameter = new LocationAnalystParameter();
     parameter.WeightName = "length";
     parameter.TurnWeightField = "TurnCost";
     parameter.ReturnEdgeFeatures = true;
     parameter.ReturnEdgeGeometry = true;
     parameter.ReturnNodeFeatures = true;
     parameter.IsFromCenter = true;
     parameter.SupplyCenters = new List<SupplyCenter>();
     parameter.SupplyCenters.Add(new SupplyCenter() { NodeID = 11, MaxWeight = 100, Type = SupplyCenterType.FIXEDCENTER });
     parameter.SupplyCenters.Add(new SupplyCenter() { NodeID = 12, MaxWeight = 100, Type = SupplyCenterType.OPTIONALCENTER });
     parameter.ExpectedSupplyCenterCount = 2;
     try
     {
         LocationAnalystResult result = networkAnalyst.FindLocation("RoadNet1@Changchun", parameter);
     }
     catch (ServiceException exception)
     {
         Assert.IsTrue("不存在RoadNet1@Changchun对应的网络数据集。" == exception.Message);
         Assert.IsTrue(exception.Code == 400);
     }
 }