/// <summary> /// Set server solver paramaters (ReturnMap, SnapTolerance, etc.) /// </summary> private void SetServerSolverParams(NAServerSolverParams solverParams) { solverParams.ReturnMap = chkReturnMap.Checked; solverParams.ImageDescription.ImageDisplay.ImageWidth = pictureBox.Width; solverParams.ImageDescription.ImageDisplay.ImageHeight = pictureBox.Height; NAServerRouteParams routeParams = solverParams as NAServerRouteParams; if (routeParams != null) { routeParams.ReturnDirections = chkReturnDirections.Checked; } }
/// <summary> /// This function shows how to populate stop locations using an array of PropertySets /// </summary> private void LoadLocations(NAServerSolverParams solverParams) { // Geocode Addresses PropertySet[] propSets = new PropertySet[2]; propSets[0] = GeocodeAddress(txtStartStreetAddress.Text, txtStartCity.Text, txtStartState.Text, txtStartZipCode.Text); propSets[1] = GeocodeAddress(txtEndStreetAddress.Text, txtEndCity.Text, txtEndState.Text, txtEndZipCode.Text); NAServerPropertySets StopsPropSets = new NAServerPropertySets(); StopsPropSets.PropertySets = propSets; NAServerRouteParams routeParams = solverParams as NAServerRouteParams; routeParams.Stops = StopsPropSets; }
/// <summary> /// Output Route Results according to the NAServerRouteParams /// </summary> private void OutputRouteResults(NAServerRouteParams solverParams, NAServerRouteResults solverResults) { // Return Directions if generated if (solverParams.ReturnDirections) { AddTabAndControl(this.tabReturnDirections, this.treeViewDirections); OutputDirections(solverResults.Directions); } else this.tabCtrlOutput.TabPages.Remove(this.tabReturnDirections); // Return Route Geometries is generated if (solverParams.ReturnRouteGeometries) { AddTabAndControl(this.tabReturnRouteGeometry, this.treeViewRouteGeometry); OutputPolylines(solverResults.RouteGeometries); } else this.tabCtrlOutput.TabPages.Remove(this.tabReturnRouteGeometry); // Return Route Features as RecordSet if (solverParams.ReturnRoutes) { AddTabAndControl(this.tabReturnRouteFeatures, this.dataGridRouteFeatures); OutputRecSetToDataGrid(solverResults.Routes, dataGridRouteFeatures); } else this.tabCtrlOutput.TabPages.Remove(this.tabReturnRouteFeatures); // Return Stop Features as RecordSet if (solverParams.ReturnStops) { AddTabAndControl(this.tabReturnStopsFeatures, this.dataGridStopFeatures); OutputRecSetToDataGrid(solverResults.Stops, dataGridStopFeatures); } else this.tabCtrlOutput.TabPages.Remove(this.tabReturnStopsFeatures); // Return Barrier Features as RecordSet if (solverParams.ReturnBarriers) { AddTabAndControl(this.tabReturnBarrierFeatures, this.dataGridBarrierFeatures); OutputRecSetToDataGrid(solverResults.Barriers, dataGridBarrierFeatures); } else this.tabCtrlOutput.TabPages.Remove(this.tabReturnBarrierFeatures); // Make TabControlOutput enable tabCtrlOutput.Enabled = true; }