public void FindPathTest() { int[] nodeIDs = new int[] { 2, 3 }; string networkDatasetName = "RoadNet@Changchun"; TransportationAnalystParameter parameter = new TransportationAnalystParameter(); parameter.ResultSetting = new TransportationAnalystResultSetting(); parameter.ResultSetting.ReturnEdgeIDs = true; parameter.ResultSetting.ReturnNodeIDs = true; parameter.ResultSetting.ReturnPathGuides = true; parameter.ResultSetting.ReturnRoutes = true; parameter.ResultSetting.ReturnEdgeFeatures = true; parameter.ResultSetting.ReturnEdgeGeometry = true; parameter.ResultSetting.ReturnNodeFeatures = true; parameter.ResultSetting.ReturnNodeGeometry = true; parameter.WeightFieldName = "length"; parameter.TurnWeightField = "TurnCost"; NetworkAnalyst networkAnalyst = new NetworkAnalyst("http://" + ip + ":8090/iserver/services/transportationanalyst-sample/rest"); List<Path> paths = networkAnalyst.FindPath(networkDatasetName, nodeIDs, true, parameter); Assert.IsNotNull(paths); Assert.IsNotNull(paths[0]); Assert.IsNotNull(paths[0].EdgeFeatures[0]); Assert.IsNotNull(paths[0].EdgeIDs[0]); Assert.IsNotNull(paths[0].NodeFeatures[0]); Assert.IsNotNull(paths[0].NodeIDs[0]); Assert.IsNotNull(paths[0].PathGuideItems[0]); Assert.IsNotNull(paths[0].Route); Assert.IsNotNull(paths[0].Route.Length); Assert.IsNotNull(paths[0].Route.Points[0]); Assert.AreEqual(paths[0].Route.Points[1].Measure, 42.273803871316005); Assert.IsNotNull(paths[0].Route.Type); Assert.AreEqual(paths[0].Route.MaxM, 53); Assert.AreEqual(paths[0].Route.MinM, 0.0); Assert.AreEqual(paths[0].Route.Type, GeometryType.LINEM); }
public void FindPathTest_PointssNull1() { Point2D[] points = new Point2D[1]; string networkDatasetName = "RoadNet@Changchun"; TransportationAnalystParameter parameter = new TransportationAnalystParameter(); parameter.ResultSetting = new TransportationAnalystResultSetting(); parameter.WeightFieldName = "length"; parameter.TurnWeightField = "TurnCost"; NetworkAnalyst networkAnalyst = new NetworkAnalyst("http://" + ip + ":8090/iserver/services/transportationanalyst-sample/rest"); try { List<Path> paths = networkAnalyst.FindPath(networkDatasetName, points, true, parameter); } catch (ArgumentException e) { Assert.AreEqual(e.Message, "参数 points 不合法,必须至少包含两个二维点。"); } }
public void FindPathTest_Points_networkDatasetNameNull() { Point2D[] points = new Point2D[2]; points[0] = new Point2D(119.6100397551, -122.6278394459); points[1] = new Point2D(171.9035599945, -113.2491141857); //string networkDatasetName = "RoadNet@Changchun"; TransportationAnalystParameter parameter = new TransportationAnalystParameter(); parameter.ResultSetting = new TransportationAnalystResultSetting(); parameter.WeightFieldName = "length"; parameter.TurnWeightField = "TurnCost"; NetworkAnalyst networkAnalyst = new NetworkAnalyst("http://" + ip + ":8090/iserver/services/transportationanalyst-sample/rest"); try { List<Path> paths = networkAnalyst.FindPath(string.Empty, points, true, parameter); } catch (ArgumentException e) { Assert.AreEqual(e.Message, "参数不能为空。\r\n参数名: networkDatasetName"); } }
public void FindPathTest_Points_RouteType() { Point2D[] points = new Point2D[2]; points[0] = new Point2D(119.6100397551, -122.6278394459); points[1] = new Point2D(171.9035599945, -113.2491141857); string networkDatasetName = "RoadNet@Changchun"; NetworkAnalyst networkAnalyst = new NetworkAnalyst("http://" + ip + ":8090/iserver/services/transportationanalyst-sample/rest"); List<Path> paths = networkAnalyst.FindPath(networkDatasetName, points, true, null); Assert.IsNotNull(paths); Assert.IsNotNull(paths[0]); Assert.AreEqual(paths[0].Route.Type, GeometryType.LINEM); }
public void FindPathTest_Points_Parameter() { Point2D[] points = new Point2D[2]; points[0] = new Point2D(119.6100397551, -122.6278394459); points[1] = new Point2D(171.9035599945, -113.2491141857); string networkDatasetName = "RoadNet@Changchun"; TransportationAnalystParameter parameter = new TransportationAnalystParameter(); parameter.ResultSetting = new TransportationAnalystResultSetting(); parameter.WeightFieldName = "length"; parameter.TurnWeightField = "TurnCost"; NetworkAnalyst networkAnalyst = new NetworkAnalyst("http://" + ip + ":8090/iserver/services/transportationanalyst-sample/rest"); List<Path> paths = networkAnalyst.FindPath(networkDatasetName, points, true, parameter); Assert.IsNotNull(paths); Assert.IsNotNull(paths[0]); Assert.IsNull(paths[0].EdgeFeatures); Assert.AreEqual(paths[0].EdgeIDs.Count(), 1); Assert.IsNull(paths[0].NodeFeatures); Assert.AreEqual(paths[0].NodeIDs.Count(), 2); Assert.IsNull(paths[0].PathGuideItems); Assert.IsNotNull(paths[0].Route); Assert.AreEqual(paths[0].Weight, 53); Assert.AreEqual(paths[0].StopWeights[0], 53); }
public void FindPathTest_Points_ParameterNUll() { Point2D[] points = new Point2D[2]; points[0] = new Point2D(119.6100397551, -122.6278394459); points[1] = new Point2D(171.9035599945, -113.2491141857); string networkDatasetName = "RoadNet@Changchun"; NetworkAnalyst networkAnalyst = new NetworkAnalyst("http://" + ip + ":8090/iserver/services/transportationanalyst-sample/rest"); List<Path> paths = networkAnalyst.FindPath(networkDatasetName, points, true, null); Assert.IsNotNull(paths); Assert.IsNotNull(paths[0]); Assert.IsNotNull(paths[0].EdgeIDs[0]); Assert.IsNotNull(paths[0].NodeIDs[0]); Assert.IsNotNull(paths[0].Route); Assert.IsNotNull(paths[0].Route.Length); Assert.IsNotNull(paths[0].Route.Points[0]); Assert.AreEqual(paths[0].Route.Points[1].Measure, 42.273803871316005); Assert.IsNotNull(paths[0].Route.Type); Assert.AreEqual(paths[0].Route.MaxM, 53); Assert.AreEqual(paths[0].Route.MinM, 0.0); Assert.AreEqual(paths[0].StopWeights[0], 53); Assert.AreEqual(paths[0].Weight, 53); }
public void FindPathTest_networkDatasetName() { int[] nodeIDs = new int[] { 2, 3 }; //string networkDatasetName = "RoadNet@Changchun"; TransportationAnalystParameter parameter = new TransportationAnalystParameter(); parameter.ResultSetting = new TransportationAnalystResultSetting(); parameter.WeightFieldName = "length"; parameter.TurnWeightField = "TurnCost"; NetworkAnalyst networkAnalyst = new NetworkAnalyst("http://" + ip + ":8090/iserver/services/transportationanalyst-sample/rest"); try { List<Path> paths = networkAnalyst.FindPath(string.Empty, nodeIDs, true, parameter); } catch (ArgumentException e) { Assert.AreEqual(e.Message, "参数不能为空。\r\n参数名: networkDatasetName"); } }
public void FindPathTest_Parameter() { int[] nodeIDs = new int[] { 2, 3 }; string networkDatasetName = "RoadNet@Changchun"; TransportationAnalystParameter parameter = new TransportationAnalystParameter(); parameter.ResultSetting = new TransportationAnalystResultSetting(); parameter.WeightFieldName = "length"; parameter.TurnWeightField = "TurnCost"; NetworkAnalyst networkAnalyst = new NetworkAnalyst("http://" + ip + ":8090/iserver/services/transportationanalyst-sample/rest"); List<Path> paths = networkAnalyst.FindPath(networkDatasetName, nodeIDs, true, parameter); Assert.IsNotNull(paths); Assert.IsNotNull(paths[0]); Assert.IsNull(paths[0].EdgeFeatures); Assert.AreEqual(paths[0].EdgeIDs.Count(), 1); Assert.IsNull(paths[0].NodeFeatures); Assert.AreEqual(paths[0].NodeIDs.Count(), 2); Assert.IsNull(paths[0].PathGuideItems); Assert.IsNotNull(paths[0].Route); Assert.AreEqual(paths[0].Weight, 53); Assert.AreEqual(paths[0].StopWeights[0], 53); }
public void FindPathTest_RouteType() { int[] nodeIDs = new int[] { 2, 3 }; string networkDatasetName = "RoadNet@Changchun"; NetworkAnalyst networkAnalyst = new NetworkAnalyst("http://" + ip + ":8090/iserver/services/transportationanalyst-sample/rest"); List<Path> paths = networkAnalyst.FindPath(networkDatasetName, nodeIDs, true, null); Assert.IsNotNull(paths); Assert.IsNotNull(paths[0]); Assert.AreEqual(paths[0].Route.Type, GeometryType.LINEM); }
public void FindPathTest_ParameterNUll() { int[] nodeIDs = new int[] { 2, 3 }; string networkDatasetName = "RoadNet@Changchun"; NetworkAnalyst networkAnalyst = new NetworkAnalyst("http://" + ip + ":8090/iserver/services/transportationanalyst-sample/rest"); List<Path> paths = networkAnalyst.FindPath(networkDatasetName, nodeIDs, true, null); Assert.IsNotNull(paths); Assert.IsNotNull(paths[0]); Assert.IsNotNull(paths[0].EdgeIDs[0]); Assert.IsNotNull(paths[0].NodeIDs[0]); Assert.IsNotNull(paths[0].Route); Assert.IsNotNull(paths[0].Route.Length); Assert.IsNotNull(paths[0].Route.Points[0]); Assert.AreEqual(paths[0].Route.Points[1].Measure, 42.273803871316005); Assert.IsNotNull(paths[0].Route.Type); Assert.AreEqual(paths[0].Route.MaxM, 53); Assert.AreEqual(paths[0].Route.MinM, 0.0); Assert.AreEqual(paths[0].StopWeights[0], 53); Assert.AreEqual(paths[0].Weight, 53); }