public void TSPPathTest_PointParameterNull() { NetworkAnalyst networkAnalyst = new NetworkAnalyst("http://" + ip + ":8090/iserver/services/transportationanalyst-sample/rest"); Point2D[] points = new Point2D[4]; points[0] = new Point2D(119.6100397551, -122.6278394459); points[1] = new Point2D(171.9035599945, -113.2491141857); points[2] = new Point2D(181.9035599945, -123.2491141857); points[3] = new Point2D(161.9035599945, -123.2491141857); List<TSPPath> paths = networkAnalyst.FindTSPPath("RoadNet@Changchun", points, false, null); Assert.IsNotNull(paths); Assert.IsNotNull(paths[0]); Assert.IsNull(paths[0].EdgeFeatures); Assert.IsNotNull(paths[0].EdgeIDs[0]); Assert.IsNull(paths[0].NodeFeatures); Assert.IsNotNull(paths[0].NodeIDs[0]); Assert.IsNull(paths[0].PathGuideItems); 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, 40.7164345497407); Assert.IsNotNull(paths[0].Route.Type); Assert.AreEqual(paths[0].Route.MaxM, 66); Assert.AreEqual(paths[0].Route.MinM, 0.0); Assert.AreEqual(paths[0].StopIndexes[0], 0); Assert.AreEqual(paths[0].StopIndexes[1], 3); Assert.AreEqual(paths[0].Route.Type, GeometryType.LINEM); }
public void TSPPathTest_PointDatasetNull() { NetworkAnalyst networkAnalyst = new NetworkAnalyst("http://" + ip + ":8090/iserver/services/transportationanalyst-sample/rest"); Point2D[] points = new Point2D[4]; points[0] = new Point2D(119.6100397551, -122.6278394459); points[1] = new Point2D(171.9035599945, -113.2491141857); points[2] = new Point2D(181.9035599945, -123.2491141857); points[3] = new Point2D(161.9035599945, -123.2491141857); TransportationAnalystParameter parameter = new TransportationAnalystParameter(); parameter.WeightFieldName = "length"; parameter.TurnWeightField = "TurnCost"; try { List<TSPPath> paths = networkAnalyst.FindTSPPath(string.Empty, points, false, parameter); } catch (ArgumentNullException e) { Assert.AreEqual(e.Message, "参数不能为空。\r\n参数名: networkDatasetName"); } }
public void TSPPathTest_PointPointNull() { NetworkAnalyst networkAnalyst = new NetworkAnalyst("http://" + ip + ":8090/iserver/services/transportationanalyst-sample/rest"); Point2D[] points = new Point2D[1]; points[0] = new Point2D(119.6100397551, -122.6278394459); TransportationAnalystParameter parameter = new TransportationAnalystParameter(); parameter.WeightFieldName = "length"; parameter.TurnWeightField = "TurnCost"; try { List<TSPPath> paths = networkAnalyst.FindTSPPath("RoadNet@Changchun", points, false, parameter); } catch (ArgumentException e) { Assert.AreEqual(e.Message, "参数 pointsToVisit 不合法,必须至少包含两个二维点。"); } }
public void TSPPathTest_Point() { NetworkAnalyst networkAnalyst = new NetworkAnalyst("http://" + ip + ":8090/iserver/services/transportationanalyst-sample/rest"); Point2D[] points = new Point2D[4]; points[0] = new Point2D(119.6100397551, -122.6278394459); points[1] = new Point2D(171.9035599945, -113.2491141857); points[2] = new Point2D(181.9035599945, -123.2491141857); points[3] = new Point2D(161.9035599945, -123.2491141857); TransportationAnalystParameter parameter = new TransportationAnalystParameter(); parameter.WeightFieldName = "length"; parameter.TurnWeightField = "TurnCost"; parameter.ResultSetting = new TransportationAnalystResultSetting(); parameter.ResultSetting.ReturnEdgeFeatures = true; parameter.ResultSetting.ReturnEdgeGeometry = true; parameter.ResultSetting.ReturnEdgeIDs = true; parameter.ResultSetting.ReturnNodeFeatures = true; parameter.ResultSetting.ReturnNodeGeometry = true; parameter.ResultSetting.ReturnNodeIDs = true; parameter.ResultSetting.ReturnPathGuides = true; parameter.ResultSetting.ReturnRoutes = true; List<TSPPath> paths = networkAnalyst.FindTSPPath("RoadNet@Changchun", points, false, 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, 40.716434549740718); Assert.IsNotNull(paths[0].Route.Type); Assert.AreEqual(paths[0].Route.MaxM, 66); Assert.AreEqual(paths[0].Route.MinM, 0.0); Assert.AreEqual(paths[0].StopIndexes[0], 0); Assert.AreEqual(paths[0].StopIndexes[1], 3); Assert.AreEqual(paths[0].Route.Type, GeometryType.LINEM); }
public void TSPPathTest_ParameterNUll() { NetworkAnalyst networkAnalyst = new NetworkAnalyst("http://" + ip + ":8090/iserver/services/transportationanalyst-sample/rest"); int[] nodeIDs = new int[] { 2, 3 }; TransportationAnalystParameter parameter = new TransportationAnalystParameter(); parameter.WeightFieldName = "length"; parameter.TurnWeightField = "TurnCost"; List<TSPPath> paths = networkAnalyst.FindTSPPath("RoadNet@Changchun", nodeIDs, false, 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); Assert.AreEqual(paths[0].StopIndexes[0], 0); Assert.AreEqual(paths[0].StopIndexes[1], 1); }
public void TSPPathTest_DatasetNameNUll() { NetworkAnalyst networkAnalyst = new NetworkAnalyst("http://" + ip + ":8090/iserver/services/transportationanalyst-sample/rest"); int[] nodeIDs = new int[] { 2, 3 }; TransportationAnalystParameter parameter = new TransportationAnalystParameter(); parameter.WeightFieldName = "length"; parameter.TurnWeightField = "TurnCost"; try { List<TSPPath> path = networkAnalyst.FindTSPPath(string.Empty, nodeIDs, false, parameter); } catch (ArgumentNullException e) { Assert.AreEqual(e.Message, "参数不能为空。\r\n参数名: networkDatasetName"); } }
public void TSPPathTest_IDNUll() { NetworkAnalyst networkAnalyst = new NetworkAnalyst("http://" + ip + ":8090/iserver/services/transportationanalyst-sample/rest"); int[] nodeIDs = new int[] { }; TransportationAnalystParameter parameter = new TransportationAnalystParameter(); parameter.WeightFieldName = "length"; parameter.TurnWeightField = "TurnCost"; try { List<TSPPath> path = networkAnalyst.FindTSPPath("RoadNet@Changchun", nodeIDs, false, parameter); } catch (ArgumentException e) { Assert.AreEqual(e.Message, "参数 nodeIDsToVisit 不合法,必须至少包含两个二维点。"); } }
public void TSPPathTest_ID() { NetworkAnalyst networkAnalyst = new NetworkAnalyst("http://" + ip + ":8090/iserver/services/transportationanalyst-sample/rest"); int[] nodeIDs = new int[2] { 2, 3 }; TransportationAnalystParameter parameter = new TransportationAnalystParameter(); parameter.WeightFieldName = "length"; parameter.TurnWeightField = "TurnCost"; parameter.ResultSetting = new TransportationAnalystResultSetting(); parameter.ResultSetting.ReturnEdgeFeatures = true; parameter.ResultSetting.ReturnEdgeGeometry = true; parameter.ResultSetting.ReturnEdgeIDs = true; parameter.ResultSetting.ReturnNodeFeatures = true; parameter.ResultSetting.ReturnNodeGeometry = true; parameter.ResultSetting.ReturnNodeIDs = true; parameter.ResultSetting.ReturnPathGuides = true; parameter.ResultSetting.ReturnRoutes = true; List<TSPPath> paths = networkAnalyst.FindTSPPath("RoadNet@Changchun", nodeIDs, false, 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); Assert.AreEqual(paths[0].StopIndexes[0], 0); Assert.AreEqual(paths[0].StopIndexes[1], 1); }