public void FindServiceArea_CenterPoints() { NetworkAnalyst networkAnalyst = new NetworkAnalyst("http://" + ip + ":8090/iserver/services/transportationanalyst-sample/rest"); Point2D[] centerPoints = new Point2D[1]; centerPoints[0] = new Point2D() { X = 4978.55537676716, Y = -2574.77869765731 }; double[] weights = new double[] { 300 }; TransportationAnalystParameter parameter = new TransportationAnalystParameter(); parameter.WeightFieldName = "length"; parameter.TurnWeightField = "TurnCost"; List<ServiceAreaResult> result = networkAnalyst.FindServiceArea("RoadNet@Changchun", centerPoints, weights, true, false, parameter); Assert.IsNotNull(result); Assert.IsTrue(result.Count == 1); Assert.IsNotNull(result[0]); Assert.IsTrue(result[0].NodeIDs.Count == 19); Assert.IsTrue(result[0].EdgeIDs.Count == 38); Assert.IsTrue(result[0].Routes.Count == 40); }
public void FindServiceArea_IsFromCenterFalse() { NetworkAnalyst networkAnalyst = new NetworkAnalyst("http://" + ip + ":8090/iserver/services/transportationanalyst-sample/rest"); Point2D[] centerPoints = new Point2D[1]; centerPoints[0] = new Point2D() { X = 4978.55537676716, Y = -2574.77869765731 }; double[] weights = new double[] { 300 }; TransportationAnalystParameter parameter = new TransportationAnalystParameter(); parameter.ResultSetting = new TransportationAnalystResultSetting(); parameter.WeightFieldName = "length"; parameter.TurnWeightField = "TurnCost"; try { List<ServiceAreaResult> result = networkAnalyst.FindServiceArea("RoadNet@Changchun", centerPoints, weights, false, false, parameter); Assert.IsNotNull(result); Assert.IsTrue(result.Count == 1); Assert.IsTrue(result[0] != null); Assert.IsTrue(result[0].NodeIDs.Count == 19); } catch (ServiceException e) { Assert.IsTrue(e.Code == 400); } }
public void FindServiceArea_NodeIDs() { NetworkAnalyst networkAnalyst = new NetworkAnalyst("http://" + ip + ":8090/iserver/services/transportationanalyst-sample/rest"); int[] centerIDs = new int[] { 2, 4, 6 }; double[] weights = new double[] { 500, 1000, 500 }; TransportationAnalystParameter parameter = new TransportationAnalystParameter(); parameter.WeightFieldName = "length"; parameter.TurnWeightField = "TurnCost"; List<ServiceAreaResult> result = networkAnalyst.FindServiceArea("RoadNet@Changchun", centerIDs, weights, true, false, parameter); Assert.IsNotNull(result); Assert.IsTrue(result.Count == 3); Assert.IsNotNull(result[0]); Assert.IsTrue(result[0].NodeIDs.Count == 16); Assert.IsTrue(result[0].EdgeIDs.Count == 19); Assert.IsTrue(result[0].Routes.Count == 19); }