Beispiel #1
0
        private INALayer CreateRouteAnalysisLayer(string sName, INetworkDataset pNetworkDataset)
        {
            INARouteSolver    solver   = new NARouteSolverClass();
            INASolverSettings settings = solver as INASolverSettings;
            INASolver         solver2  = solver as INASolver;

            solver.FindBestSequence  = true;
            solver.PreserveFirstStop = true;
            solver.PreserveLastStop  = false;
            solver.UseTimeWindows    = false;
            solver.OutputLines       = esriNAOutputLineType.esriNAOutputLineTrueShapeWithMeasure;
            IStringArray restrictionAttributeNames = settings.RestrictionAttributeNames;

            restrictionAttributeNames.Add("Oneway");
            settings.RestrictionAttributeNames = restrictionAttributeNames;
            IDatasetComponent component   = pNetworkDataset as IDatasetComponent;
            IDENetworkDataset dataElement = component.DataElement as IDENetworkDataset;
            INAContext        context     = solver2.CreateContext(dataElement, sName);

            (context as INAContextEdit).Bind(pNetworkDataset, new GPMessagesClass());
            INALayer layer = solver2.CreateLayer(context);

            (layer as ILayer).Name = sName;
            return(layer);
        }
        /// <summary>
        /// Set solver settings
        /// </summary>
        public void SetSolverSettings()
        {
            // Set OD solver specific settings
            INASolver solver = m_NAContext.Solver;

            INAODCostMatrixSolver odSolver = solver as INAODCostMatrixSolver;

            if (textCutoff.Text.Length > 0 && IsNumeric(textCutoff.Text.Trim()))
            {
                odSolver.DefaultCutoff = textCutoff.Text;
            }
            else
            {
                odSolver.DefaultCutoff = null;
            }

            if (textTargetFacility.Text.Length > 0 && IsNumeric(textTargetFacility.Text.Trim()))
            {
                odSolver.DefaultTargetDestinationCount = textTargetFacility.Text;
            }
            else
            {
                odSolver.DefaultTargetDestinationCount = null;
            }

            odSolver.OutputLines = esriNAOutputLineType.esriNAOutputLineStraight;

            // Set generic solver settings
            // Set the impedance attribute
            INASolverSettings solverSettings = solver as INASolverSettings;

            solverSettings.ImpedanceAttributeName = comboCostAttribute.Text;

            // Set the OneWay restriction if necessary
            IStringArray restrictions = solverSettings.RestrictionAttributeNames;

            restrictions.RemoveAll();
            if (checkUseRestriction.Checked)
            {
                restrictions.Add("oneway");
            }
            solverSettings.RestrictionAttributeNames = restrictions;

            // Restrict UTurns
            solverSettings.RestrictUTurns         = esriNetworkForwardStarBacktrack.esriNFSBNoBacktrack;
            solverSettings.IgnoreInvalidLocations = true;

            // Set the hierarchy attribute
            solverSettings.UseHierarchy = checkUseHierarchy.Checked;
            if (solverSettings.UseHierarchy)
            {
                solverSettings.HierarchyAttributeName = "HierarchyMultiNet";
            }

            // Do not forget to update the context after you set your impedance
            solver.UpdateContext(m_NAContext, GetDENetworkDataset(m_NAContext.NetworkDataset), new GPMessagesClass());
        }
Beispiel #3
0
        public void SetSolverSettings()
        {
            INASolver solver = this.m_pNAContext.Solver;
            INAClosestFacilitySolver solver2 = solver as INAClosestFacilitySolver;

            if ((this.txtCutOff.Text.Length > 0) && this.IsNumeric(this.txtCutOff.Text.Trim()))
            {
                solver2.DefaultCutoff = this.txtCutOff.Text;
            }
            else
            {
                solver2.DefaultCutoff = null;
            }
            if ((this.txtTargetFacility.Text.Length > 0) && this.IsNumeric(this.txtTargetFacility.Text))
            {
                solver2.DefaultTargetFacilityCount = int.Parse(this.txtTargetFacility.Text);
            }
            else
            {
                solver2.DefaultTargetFacilityCount = 1;
            }
            solver2.OutputLines     = esriNAOutputLineType.esriNAOutputLineTrueShapeWithMeasure;
            solver2.TravelDirection = esriNATravelDirection.esriNATravelDirectionToFacility;
            INASolverSettings settings = solver as INASolverSettings;

            settings.ImpedanceAttributeName = this.cboCostAttribute.Text;
            IStringArray restrictionAttributeNames = settings.RestrictionAttributeNames;

            restrictionAttributeNames.RemoveAll();
            if (this.chkUseRestriction.Checked)
            {
                restrictionAttributeNames.Add("oneway");
            }
            settings.RestrictionAttributeNames = restrictionAttributeNames;
            settings.RestrictUTurns            = esriNetworkForwardStarBacktrack.esriNFSBNoBacktrack;
            settings.IgnoreInvalidLocations    = true;
            settings.UseHierarchy = this.chkUseHierarchy.Checked;
            if (settings.UseHierarchy)
            {
                settings.HierarchyAttributeName = "hierarchy";
                settings.HierarchyLevelCount    = 3;
                settings.set_MaxValueForHierarchy(1, 1);
                settings.set_NumTransitionToHierarchy(1, 9);
                settings.set_MaxValueForHierarchy(2, 2);
                settings.set_NumTransitionToHierarchy(2, 9);
            }
            solver.UpdateContext(this.m_pNAContext, this.GetDENetworkDataset(this.m_pNAContext.NetworkDataset),
                                 new GPMessagesClass());
        }
        /// <summary>
        /// Update settings that apply to all solvers
        /// </summary>
        private void ConfigureGenericSolverSettings()
        {
            INASolverSettings naSolverSettings = m_NAContext.Solver as INASolverSettings;

            naSolverSettings.ImpedanceAttributeName = cbCostAttribute.Text;

            // set the oneway restriction, if necessary
            IStringArray restrictions = naSolverSettings.RestrictionAttributeNames;

            restrictions.RemoveAll();
            if (ckbUseRestriction.Checked)
            {
                restrictions.Add("Oneway");
            }
            naSolverSettings.RestrictionAttributeNames = restrictions;
            //naSolverSettings.RestrictUTurns = esriNetworkForwardStarBacktrack.esriNFSBNoBacktrack;
        }
Beispiel #5
0
        /// <summary>
        /// Create a new network analysis layer and set some solver settings
        /// </summary>
        private INALayer CreateRouteAnalysisLayer(String layerName, INetworkDataset networkDataset)
        {
            INARouteSolver    naRouteSolver    = new NARouteSolverClass();
            INASolverSettings naSolverSettings = naRouteSolver as INASolverSettings;
            INASolver         naSolver         = naRouteSolver as INASolver;

            //Get the NetworkDataset's Data Element
            IDatasetComponent datasetComponent = networkDataset as IDatasetComponent;
            IDENetworkDataset deNetworkDataset = datasetComponent.DataElement as IDENetworkDataset;

            //Create the NAContext and bind to it
            INAContext naContext;

            naContext = naSolver.CreateContext(deNetworkDataset, layerName);
            INAContextEdit naContextEdit = naContext as INAContextEdit;

            naContextEdit.Bind(networkDataset, new GPMessagesClass());

            //Create the NALayer
            INALayer naLayer;

            naLayer = naSolver.CreateLayer(naContext);
            (naLayer as ILayer).Name = layerName;

            //Set properties on the route solver interface
            naRouteSolver.FindBestSequence  = true;
            naRouteSolver.PreserveFirstStop = true;
            naRouteSolver.PreserveLastStop  = false;
            naRouteSolver.UseTimeWindows    = false;
            naRouteSolver.OutputLines       = esriNAOutputLineType.esriNAOutputLineTrueShapeWithMeasure;

            //Set some properties on the general INASolverSettings interface
            IStringArray restrictions = naSolverSettings.RestrictionAttributeNames;

            restrictions.Add("Oneway");
            naSolverSettings.RestrictionAttributeNames = restrictions;

            // Update the context based on the changes made to the solver settings
            naSolver.UpdateContext(naContext, deNetworkDataset, new GPMessagesClass());

            //Return the layer
            return(naLayer);
        }
Beispiel #6
0
        public static INALayer CreateClosestFacilityLayer(string layerName, INetworkDataset networkDataset,
                                                          INAClosestFacilitySolver naClosesFacilitySolver)
        {
            INASolverSettings settings    = naClosesFacilitySolver as INASolverSettings;
            INASolver         solver      = naClosesFacilitySolver as INASolver;
            IDatasetComponent component   = networkDataset as IDatasetComponent;
            IDENetworkDataset dataElement = component.DataElement as IDENetworkDataset;
            INAContext        context     = solver.CreateContext(dataElement, layerName);

            (context as INAContextEdit).Bind(networkDataset, new GPMessagesClass());
            INALayer layer = solver.CreateLayer(context);

            (layer as ILayer).Name = layerName;
            naClosesFacilitySolver.CreateTraversalResult = true;
            naClosesFacilitySolver.TravelDirection       = esriNATravelDirection.esriNATravelDirectionFromFacility;
            naClosesFacilitySolver.OutputLines           = esriNAOutputLineType.esriNAOutputLineTrueShapeWithMeasure;
            IStringArray restrictionAttributeNames = settings.RestrictionAttributeNames;

            restrictionAttributeNames.Add("Oneway");
            settings.RestrictionAttributeNames = restrictionAttributeNames;
            solver.UpdateContext(context, dataElement, new GPMessagesClass());
            return(layer);
        }
        //*********************************************************************************
        // Set Solver Settings for the Location-Allocation Solver
        //*********************************************************************************
        public void SetSolverSettings()
        {
            //Set Location-Allocation specific Settings
            INASolver naSolver = m_NAContext.Solver;

            INALocationAllocationSolver2 laSolver = naSolver as INALocationAllocationSolver2;

            // Set number of facilities to locate
            if (txtFacilitiesToLocate.Text.Length > 0 && IsNumeric(txtFacilitiesToLocate.Text))
            {
                laSolver.NumberFacilitiesToLocate = int.Parse(txtFacilitiesToLocate.Text);
            }
            else
            {
                laSolver.NumberFacilitiesToLocate = 1;
            }

            // Set impedance cutoff
            if (txtCutOff.Text.Length > 0 && IsNumeric(txtCutOff.Text.Trim()))
            {
                laSolver.DefaultCutoff = txtCutOff.Text;
            }
            else
            {
                laSolver.DefaultCutoff = null;
            }

            // Set up Location-Allocation problem type
            if (cboProblemType.Text.Equals("Maximize Attendance"))
            {
                laSolver.ProblemType = esriNALocationAllocationProblemType.esriNALAPTMaximizeAttendance;
            }
            else if (cboProblemType.Text.Equals("Maximize Coverage"))
            {
                laSolver.ProblemType = esriNALocationAllocationProblemType.esriNALAPTMaximizeCoverage;
            }
            else if (cboProblemType.Text.Equals("Maximize Capacitated Coverage"))
            {
                laSolver.ProblemType = esriNALocationAllocationProblemType.esriNALAPTMaximizeCapacitatedCoverage;
            }
            else if (cboProblemType.Text.Equals("Minimize Facilities"))
            {
                laSolver.ProblemType = esriNALocationAllocationProblemType.esriNALAPTMaximizeCoverageMinimizeFacilities;
            }
            else if (cboProblemType.Text.Equals("Maximize Market Share"))
            {
                laSolver.ProblemType = esriNALocationAllocationProblemType.esriNALAPTMaximizeMarketShare;
            }
            else if (cboProblemType.Text.Equals("Minimize Impedance"))
            {
                laSolver.ProblemType = esriNALocationAllocationProblemType.esriNALAPTMinimizeWeightedImpedance;
            }
            else if (cboProblemType.Text.Equals("Target Market Share"))
            {
                laSolver.ProblemType = esriNALocationAllocationProblemType.esriNALAPTTargetMarketShare;
            }
            else
            {
                laSolver.ProblemType = esriNALocationAllocationProblemType.esriNALAPTMinimizeWeightedImpedance;
            }

            // Set Impedance Transformation type
            if (cboImpTransformation.Text.Equals("Linear"))
            {
                laSolver.ImpedanceTransformation = esriNAImpedanceTransformationType.esriNAITTLinear;
            }
            else if (cboImpTransformation.Text.Equals("Power"))
            {
                laSolver.ImpedanceTransformation = esriNAImpedanceTransformationType.esriNAITTPower;
            }
            else if (cboImpTransformation.Text.Equals("Exponential"))
            {
                laSolver.ImpedanceTransformation = esriNAImpedanceTransformationType.esriNAITTExponential;
            }

            // Set Impedance Transformation Parameter (distance decay beta)
            if (txtImpParameter.Text.Length > 0 && IsNumeric(txtCutOff.Text.Trim()))
            {
                laSolver.TransformationParameter = double.Parse(txtImpParameter.Text);
            }
            else
            {
                laSolver.TransformationParameter = 1.0;
            }

            // Set target market share percentage (should be between 0.0 and 100.0)
            if (txtTargetMarketShare.Text.Length > 0 && IsNumeric(txtCutOff.Text.Trim()))
            {
                double targetPercentage;
                targetPercentage = double.Parse(txtTargetMarketShare.Text);

                if ((targetPercentage <= 0.0) || (targetPercentage > 100.0))
                {
                    targetPercentage = 10.0;
                    lstOutput.Items.Add("Target percentage out of range. Reset to 10%");
                }
                laSolver.TargetMarketSharePercentage = targetPercentage;
                txtTargetMarketShare.Text            = laSolver.TargetMarketSharePercentage.ToString();
            }
            else
            {
                laSolver.TargetMarketSharePercentage = 10.0;
            }

            // Set default capacity
            if (txtDefaultCapacity.Text.Length > 0 && IsNumeric(txtDefaultCapacity.Text.Trim()))
            {
                double defaultCapacity;
                defaultCapacity = double.Parse(txtDefaultCapacity.Text);

                if ((defaultCapacity <= 0.0))
                {
                    defaultCapacity = 1.0;
                    lstOutput.Items.Add("Default capacity must be greater than zero.");
                }
                laSolver.DefaultCapacity = defaultCapacity;
                txtDefaultCapacity.Text  = laSolver.DefaultCapacity.ToString();
            }
            else
            {
                laSolver.DefaultCapacity = 1.0;
            }


            // Set any other solver settings
            laSolver.OutputLines     = esriNAOutputLineType.esriNAOutputLineStraight;
            laSolver.TravelDirection = esriNATravelDirection.esriNATravelDirectionFromFacility;

            // Set the impedance attribute
            INASolverSettings naSolverSettings = naSolver as INASolverSettings;

            naSolverSettings.ImpedanceAttributeName = cboCostAttribute.Text;

            naSolverSettings.IgnoreInvalidLocations = true;

            // Do not forget to update the context after you set your impedance
            naSolver.UpdateContext(m_NAContext, GetDENetworkDataset(m_NAContext.NetworkDataset), new GPMessagesClass());
        }
Beispiel #8
0
        /// <summary>
        /// Set solver settings
        /// </summary>
        public void SetSolverSettings()
        {
            // Set VRP solver specific settings
            INASolver    solver    = m_NAContext.Solver;
            INAVRPSolver vrpSolver = solver as INAVRPSolver;

            // Both orders and routes have capacity count of 2 in the input shape files. User can modify the input data and update this value accordingly.
            vrpSolver.CapacityCount = 2;

            // Read the time and distance unit from comboBox
            vrpSolver.DistanceFieldUnits = (esriNetworkAttributeUnits)m_unitDistList[comboDistUnits.Items[comboDistUnits.SelectedIndex].ToString()];
            vrpSolver.TimeFieldUnits     = (esriNetworkAttributeUnits)m_unitTimeList[comboTimeUnits.Items[comboTimeUnits.SelectedIndex].ToString()];

            // The value of time window violation penalty factor can be adjusted in terms of the user's preference.
            string importance = comboTWImportance.Items[comboTWImportance.SelectedIndex].ToString();

            if (importance == "Low")
            {
                vrpSolver.TimeWindowViolationPenaltyFactor = 0;
            }
            else if (importance == "Medium")
            {
                vrpSolver.TimeWindowViolationPenaltyFactor = 1;
            }
            else if (importance == "High")
            {
                vrpSolver.TimeWindowViolationPenaltyFactor = 10;
            }

            // Set output line type
            vrpSolver.OutputLines = esriNAOutputLineType.esriNAOutputLineStraight;

            // Set generic solver settings
            // Set the impedance attribute
            INASolverSettings solverSettings = solver as INASolverSettings;

            solverSettings.ImpedanceAttributeName = comboTimeAttribute.Text;

            // Set the accumulated attribute
            IStringArray accumulatedAttributes = solverSettings.AccumulateAttributeNames;

            accumulatedAttributes.RemoveAll();
            accumulatedAttributes.Insert(0, comboDistanceAttribute.Text);
            solverSettings.AccumulateAttributeNames = accumulatedAttributes;

            // Set the oneway restriction if necessary
            IStringArray restrictions = solverSettings.RestrictionAttributeNames;

            restrictions.RemoveAll();
            if (checkUseRestriction.Checked)
            {
                restrictions.Add("oneway");
            }
            solverSettings.RestrictionAttributeNames = restrictions;

            // Restrict UTurns
            solverSettings.RestrictUTurns = esriNetworkForwardStarBacktrack.esriNFSBNoBacktrack;

            // Set the hierarchy attribute
            solverSettings.UseHierarchy = checkUseHierarchy.Checked;
            if (solverSettings.UseHierarchy)
            {
                solverSettings.HierarchyAttributeName = "HierarchyMultiNet";
            }

            // Do not forget to update the context after you set your impedance
            solver.UpdateContext(m_NAContext, GetDENetworkDataset(m_NAContext.NetworkDataset), new GPMessagesClass());
        }
Beispiel #9
0
		//the rest of the class if for the best route

		/*
		 * '*********************************************************************************
			  ' Set Route Solver Settings
		   '*********************************************************************************
		 * */

		public void SetSolverSettings(ref INAContext pContext , string sImpedanceName,bool bOneWay ,bool bUseHierarchy)
		{
			
			INASolver pSolver;
            
			pSolver = pContext.Solver;
             
			INARouteSolver pRteSolver=pSolver as INARouteSolver;

			pRteSolver.OutputLines =esriNAOutputLineType.esriNAOutputLineTrueShapeWithMeasure;
			pRteSolver.CreateTraversalResult = true;
			pRteSolver.UseTimeWindows = false;
			pRteSolver.FindBestSequence = false;
			pRteSolver.PreserveFirstStop = false;
			pRteSolver.PreserveLastStop = false;


			//Set generic Solver settings
			// set the impedance attribute
			INASolverSettings pSolverSettings=pSolver as INASolverSettings;
            
			pSolverSettings.ImpedanceAttributeName = sImpedanceName;

			// Set the OneWay Restriction if necessary

			IStringArray restrictions;
			restrictions = pSolverSettings.RestrictionAttributeNames;
			restrictions.RemoveAll();
			if(bOneWay==true)
				restrictions.Add("oneway");
			pSolverSettings.RestrictionAttributeNames=restrictions;

			/*
			 *  'Restrict UTurns
			 * */
			pSolverSettings.RestrictUTurns =esriNetworkForwardStarBacktrack.esriNFSBNoBacktrack;

			//IgnoreInvalidLocations allows the network analyst solvers to ignore locations that have not snapped to a network edge
			pSolverSettings.IgnoreInvalidLocations=true;


			if(bUseHierarchy==true)
			{
				
				pSolverSettings.UseHierarchy=true;
				pSolverSettings.HierarchyAttributeName = "hierarchy";
				pSolverSettings.HierarchyLevelCount = 3;
                
				pSolverSettings.set_MaxValueForHierarchy(1,1);
				pSolverSettings.set_NumTransitionToHierarchy(1,9);

				pSolverSettings.set_MaxValueForHierarchy(2,2);
				pSolverSettings.set_NumTransitionToHierarchy(2,9);


			
			} 
			else
				pSolverSettings.UseHierarchy=false;


			// Do not forget to update the context after you set your impedance
			pSolver.UpdateContext(pContext, GetDENetworkDataset(pContext.NetworkDataset),new GPMessagesClass());

    
				   
		}
Beispiel #10
0
        private void btnOK_Click(object sender, EventArgs e)
        {
            INASolver naSolver = pMainFrm.m_NAContext.Solver;
            //开始进行设置
            INAClosestFacilitySolver cfSolver = naSolver as INAClosestFacilitySolver;

            if (numericUpDownCutoff.Value == 0)
            {
                cfSolver.DefaultCutoff = null;
            }
            else
            {
                cfSolver.DefaultCutoff = numericUpDownCutoff.Value;
            }
            if (numericUpDownFCount.Value == 0)
            {
                cfSolver.DefaultTargetFacilityCount = 1;
            }
            else
            {
                cfSolver.DefaultTargetFacilityCount = int.Parse(numericUpDownFCount.Value.ToString());
            }
            //设置输出线的形状
            switch (cboOutShapeType.Text)
            {
            case "无":
                cfSolver.OutputLines = esriNAOutputLineType.esriNAOutputLineNone;
                break;

            case "直线":
                cfSolver.OutputLines = esriNAOutputLineType.esriNAOutputLineStraight;
                break;

            case "True Shape":
                cfSolver.OutputLines = esriNAOutputLineType.esriNAOutputLineTrueShape;
                break;

            case "True Shape(无测量)":
                cfSolver.OutputLines = esriNAOutputLineType.esriNAOutputLineTrueShapeWithMeasure;
                break;
            }
            //设置查找方向
            if (rbnItoF.Checked == true)
            {
                cfSolver.TravelDirection = esriNATravelDirection.esriNATravelDirectionToFacility;
            }
            else
            {
                cfSolver.TravelDirection = esriNATravelDirection.esriNATravelDirectionFromFacility;
            }

            //设置SOLVER的参数
            //设置Impedance的属性
            INASolverSettings naSolverSetting = naSolver as INASolverSettings;

            naSolverSetting.ImpedanceAttributeName = cboImpedance.Text;
            //设置OneWay限制
            IStringArray restriction = naSolverSetting.RestrictionAttributeNames;

            restriction.RemoveAll();
            int i = 0;

            for (i = 0; i <= listView1.SelectedItems.Count - 1; i++)
            {
                restriction.Add(listView1.SelectedItems.ToString());
            }
            naSolverSetting.RestrictionAttributeNames = restriction;
            //设置拐点
            switch (cboAllowedTurn.Text)
            {
            case "无":
                naSolverSetting.RestrictUTurns = esriNetworkForwardStarBacktrack.esriNFSBNoBacktrack;
                break;

            case "任何端点":
                naSolverSetting.RestrictUTurns = esriNetworkForwardStarBacktrack.esriNFSBAllowBacktrack;
                break;

            case "仅在末端":
                naSolverSetting.RestrictUTurns = esriNetworkForwardStarBacktrack.esriNFSBAtDeadEndsOnly;
                break;
            }
            naSolverSetting.IgnoreInvalidLocations = chkIgnoreInvalidValue.Checked;
            naSolver.UpdateContext(pMainFrm.m_NAContext, Utility.GetDENetworkDataset(pMainFrm.m_pNetDataset), new GPMessagesClass());
            ToolBarButton toolbarbutton1 = pMainFrm.returnToolbarButton();

            toolbarbutton1.Enabled = true;
            this.Dispose();
        }
Beispiel #11
0
        /// <summary>
        /// Set controls based on the current NALayer settings
        /// This function takes the current NALayer and determines what type of solver it's pointing to
        /// and populates the corresponding controls and hides the tabs for the other solvers.
        /// </summary>
        private void PopulateControls(INALayer naLayer)
        {
            ILayer                      layer            = naLayer as ILayer;
            INAContext                  naContext        = naLayer.Context;
            INetworkDataset             networkDataset   = naContext.NetworkDataset;
            INALocator2                 naLocator        = naContext.Locator as INALocator2;
            INASolver                   naSolver         = naContext.Solver;
            INASolverSettings           naSolverSettings = naSolver as INASolverSettings2;
            INARouteSolver2             routeSolver      = naSolver as INARouteSolver2;
            INAClosestFacilitySolver    cfSolver         = naSolver as INAClosestFacilitySolver;
            INAODCostMatrixSolver       odSolver         = naSolver as INAODCostMatrixSolver;
            INAServiceAreaSolver2       saSolver         = naSolver as INAServiceAreaSolver2;
            INAVRPSolver                vrpSolver        = naSolver as INAVRPSolver;
            INALocationAllocationSolver laSolver         = naSolver as INALocationAllocationSolver;

            // Populate general Layer controls
            txtLayerName.Text          = layer.Name;
            txtMaxSearchTolerance.Text = naLocator.MaxSnapTolerance.ToString();
            cboMaxSearchToleranceUnits.SelectedIndex = Convert.ToInt32(naLocator.SnapToleranceUnits);

            // Populate controls for the particular solver

            if (routeSolver != null)  // ROUTE LAYER
            {
                // Remove unnecessary tabs
                tabPropPages.TabPages.Remove(tabClosestFacility);
                tabPropPages.TabPages.Remove(tabODCostMatrix);
                tabPropPages.TabPages.Remove(tabServiceArea);
                tabPropPages.TabPages.Remove(tabVRP);
                tabPropPages.TabPages.Remove(tabLocationAllocation);

                // INARouteSolver2
                chkRouteFindBestSequence.Checked  = routeSolver.FindBestSequence;
                chkRoutePreserveFirstStop.Checked = routeSolver.PreserveFirstStop;
                chkRoutePreserveLastStop.Checked  = routeSolver.PreserveLastStop;
                chkRouteUseTimeWindows.Checked    = routeSolver.UseTimeWindows;
                chkRouteUseStartTime.Checked      = routeSolver.UseStartTime;
                txtRouteStartTime.Text            = routeSolver.StartTime.ToShortTimeString();
                cboRouteOutputLines.SelectedIndex = System.Convert.ToInt32(routeSolver.OutputLines);

                // INASolverSettings
                PopulateImpedanceNameControl(cboRouteImpedance, networkDataset, naSolverSettings.ImpedanceAttributeName);
                chkRouteUseHierarchy.Enabled           = (naSolverSettings.HierarchyAttributeName.Length > 0);
                chkRouteUseHierarchy.Checked           = (chkRouteUseHierarchy.Enabled && naSolverSettings.UseHierarchy);
                chkRouteIgnoreInvalidLocations.Checked = naSolverSettings.IgnoreInvalidLocations;
                cboRouteRestrictUTurns.SelectedIndex   = System.Convert.ToInt32(naSolverSettings.RestrictUTurns);
                PopulateAttributeControl(chklstRouteAccumulateAttributeNames, networkDataset, naSolverSettings.AccumulateAttributeNames, esriNetworkAttributeUsageType.esriNAUTCost);
                PopulateAttributeControl(chklstRouteRestrictionAttributeNames, networkDataset, naSolverSettings.RestrictionAttributeNames, esriNetworkAttributeUsageType.esriNAUTRestriction);
            }
            else if (cfSolver != null)  // CLOSEST FACILITY LAYER
            {
                // Remove unnecessary tabs
                tabPropPages.TabPages.Remove(tabRoute);
                tabPropPages.TabPages.Remove(tabODCostMatrix);
                tabPropPages.TabPages.Remove(tabServiceArea);
                tabPropPages.TabPages.Remove(tabVRP);
                tabPropPages.TabPages.Remove(tabLocationAllocation);

                // INAClosestFacilitySolver
                txtCFDefaultCutoff.Text = GetStringFromObject(cfSolver.DefaultCutoff);
                txtCFDefaultTargetFacilityCount.Text = cfSolver.DefaultTargetFacilityCount.ToString();
                cboCFTravelDirection.SelectedIndex   = Convert.ToInt32(cfSolver.TravelDirection);
                cboCFOutputLines.SelectedIndex       = Convert.ToInt32(cfSolver.OutputLines);

                // INASolverSettings
                PopulateImpedanceNameControl(cboCFImpedance, networkDataset, naSolverSettings.ImpedanceAttributeName);
                chkCFUseHierarchy.Enabled           = (naSolverSettings.HierarchyAttributeName.Length > 0);
                chkCFUseHierarchy.Checked           = (chkCFUseHierarchy.Enabled && naSolverSettings.UseHierarchy);
                chkCFIgnoreInvalidLocations.Checked = naSolverSettings.IgnoreInvalidLocations;
                cboCFRestrictUTurns.SelectedIndex   = System.Convert.ToInt32(naSolverSettings.RestrictUTurns);
                PopulateAttributeControl(chklstCFAccumulateAttributeNames, networkDataset, naSolverSettings.AccumulateAttributeNames, esriNetworkAttributeUsageType.esriNAUTCost);
                PopulateAttributeControl(chklstCFRestrictionAttributeNames, networkDataset, naSolverSettings.RestrictionAttributeNames, esriNetworkAttributeUsageType.esriNAUTRestriction);
            }
            else if (odSolver != null) // OD COST MATRIX LAYER
            {
                // Remove unnecessary tabs
                tabPropPages.TabPages.Remove(tabRoute);
                tabPropPages.TabPages.Remove(tabClosestFacility);
                tabPropPages.TabPages.Remove(tabServiceArea);
                tabPropPages.TabPages.Remove(tabVRP);

                // INAODCostMatrixSolver
                txtODDefaultCutoff.Text = GetStringFromObject(odSolver.DefaultCutoff);
                txtODDefaultTargetDestinationCount.Text = GetStringFromObject(odSolver.DefaultTargetDestinationCount);
                cboODOutputLines.SelectedIndex          = Convert.ToInt32(odSolver.OutputLines);

                // INASolverSettings
                PopulateImpedanceNameControl(cboODImpedance, networkDataset, naSolverSettings.ImpedanceAttributeName);
                chkODUseHierarchy.Enabled           = (naSolverSettings.HierarchyAttributeName.Length > 0);
                chkODUseHierarchy.Checked           = (chkODUseHierarchy.Enabled && naSolverSettings.UseHierarchy);
                chkODIgnoreInvalidLocations.Checked = naSolverSettings.IgnoreInvalidLocations;
                cboODRestrictUTurns.SelectedIndex   = System.Convert.ToInt32(naSolverSettings.RestrictUTurns);
                PopulateAttributeControl(chklstODAccumulateAttributeNames, networkDataset, naSolverSettings.AccumulateAttributeNames, esriNetworkAttributeUsageType.esriNAUTCost);
                PopulateAttributeControl(chklstODRestrictionAttributeNames, networkDataset, naSolverSettings.RestrictionAttributeNames, esriNetworkAttributeUsageType.esriNAUTRestriction);
            }
            else if (saSolver != null)  //SERVICE AREA SOLVER
            {
                // Remove unnecessary tabs
                tabPropPages.TabPages.Remove(tabRoute);
                tabPropPages.TabPages.Remove(tabClosestFacility);
                tabPropPages.TabPages.Remove(tabODCostMatrix);
                tabPropPages.TabPages.Remove(tabVRP);
                tabPropPages.TabPages.Remove(tabLocationAllocation);

                // INAServiceAreaSolver2
                txtSADefaultBreaks.Text = "";
                for (int iBreak = 0; iBreak < saSolver.DefaultBreaks.Count; iBreak++)
                {
                    txtSADefaultBreaks.Text = txtSADefaultBreaks.Text + " " + saSolver.DefaultBreaks.get_Element(iBreak).ToString();
                }
                cboSATravelDirection.SelectedIndex = Convert.ToInt32(saSolver.TravelDirection);

                cboSAOutputPolygons.SelectedIndex           = -1;
                cboSAOutputPolygons.SelectedIndex           = Convert.ToInt32(saSolver.OutputPolygons);
                chkSAOverlapPolygons.Checked                = saSolver.OverlapPolygons;
                chkSASplitPolygonsAtBreaks.Checked          = saSolver.SplitPolygonsAtBreaks;
                chkSAMergeSimilarPolygonRanges.Checked      = saSolver.MergeSimilarPolygonRanges;
                chkSATrimOuterPolygon.Checked               = saSolver.TrimOuterPolygon;
                txtSATrimPolygonDistance.Text               = saSolver.TrimPolygonDistance.ToString();
                cboSATrimPolygonDistanceUnits.SelectedIndex = Convert.ToInt32(saSolver.TrimPolygonDistanceUnits);

                cboSAOutputLines.SelectedIndex  = -1;
                cboSAOutputLines.SelectedIndex  = Convert.ToInt32(saSolver.OutputLines);
                chkSAOverlapLines.Checked       = saSolver.OverlapLines;
                chkSASplitLinesAtBreaks.Checked = saSolver.SplitLinesAtBreaks;
                chkSAIncludeSourceInformationOnLines.Checked = saSolver.IncludeSourceInformationOnLines;

                // INASolverSettings
                PopulateImpedanceNameControl(cboSAImpedance, networkDataset, naSolverSettings.ImpedanceAttributeName);
                chkSAIgnoreInvalidLocations.Checked = naSolverSettings.IgnoreInvalidLocations;
                cboSARestrictUTurns.SelectedIndex   = System.Convert.ToInt32(naSolverSettings.RestrictUTurns);
                PopulateAttributeControl(chklstSAAccumulateAttributeNames, networkDataset, naSolverSettings.AccumulateAttributeNames, esriNetworkAttributeUsageType.esriNAUTCost);
                PopulateAttributeControl(chklstSARestrictionAttributeNames, networkDataset, naSolverSettings.RestrictionAttributeNames, esriNetworkAttributeUsageType.esriNAUTRestriction);
            }
            else if (vrpSolver != null) // VRP Solver
            {
                // Remove unnecessary tabs
                tabPropPages.TabPages.Remove(tabRoute);
                tabPropPages.TabPages.Remove(tabClosestFacility);
                tabPropPages.TabPages.Remove(tabODCostMatrix);
                tabPropPages.TabPages.Remove(tabServiceArea);
                tabPropPages.TabPages.Remove(tabLocationAllocation);

                cboVRPOutputShapeType.SelectedIndex = Convert.ToInt32(vrpSolver.OutputLines);
                cboVRPAllowUTurns.SelectedIndex     = Convert.ToInt32(naSolverSettings.RestrictUTurns);
                // VRP cannot have unknown units, so the index is offset by 1 from the solver field units
                cboVRPDistanceFieldUnits.SelectedIndex = Convert.ToInt32(vrpSolver.DistanceFieldUnits) - 1;
                cboVRPTransitTime.SelectedIndex        = Convert.ToInt32(vrpSolver.ExcessTransitTimePenaltyFactor);
                cboVRPTimeWindow.SelectedIndex         = Convert.ToInt32(vrpSolver.TimeWindowViolationPenaltyFactor);
                cboVRPTimeFieldUnits.SelectedIndex     = Convert.ToInt32(vrpSolver.TimeFieldUnits - 20);

                txtVRPCapacityCount.Text = vrpSolver.CapacityCount.ToString();
                txtVRPDefaultDate.Text   = vrpSolver.DefaultDate.ToShortDateString();

                chkVRPUseHierarchy.Checked = naSolverSettings.UseHierarchy;

                PopulateAttributeControl(chklstVRPRestrictionAttributeNames, networkDataset, naSolverSettings.RestrictionAttributeNames, esriNetworkAttributeUsageType.esriNAUTRestriction);

                //populate the time attribute combo box
                cboVRPTimeAttribute.Items.Clear();

                for (int i = 0; i < networkDataset.AttributeCount; i++)
                {
                    INetworkAttribute networkAttribute = networkDataset.get_Attribute(i);

                    if (networkAttribute.UsageType == esriNetworkAttributeUsageType.esriNAUTCost &&
                        networkAttribute.Units >= esriNetworkAttributeUnits.esriNAUSeconds)
                    {
                        cboVRPTimeAttribute.Items.Add(networkAttribute.Name);
                    }
                }

                if (cboVRPTimeAttribute.Items.Count > 0)
                {
                    cboVRPTimeAttribute.Text = naSolverSettings.ImpedanceAttributeName;
                }


                // for VRP, the AccumulateAttributeNames hold the length, and it can only hold one length.
                //  Loop through the network dataset attributes
                cboVRPDistanceAttribute.Items.Clear();
                cboVRPDistanceAttribute.SelectedIndex = cboVRPDistanceAttribute.Items.Add("");

                for (int i = 0; i < networkDataset.AttributeCount; i++)
                {
                    INetworkAttribute networkAttribute = networkDataset.get_Attribute(i);
                    if (networkAttribute.UsageType == esriNetworkAttributeUsageType.esriNAUTCost &&
                        networkAttribute.Units < esriNetworkAttributeUnits.esriNAUSeconds)
                    {
                        string attributeName = networkAttribute.Name;

                        int cboindex = cboVRPDistanceAttribute.Items.Add(networkAttribute.Name);

                        // If the attribute is in the strArray, it should be the selected one
                        for (int j = 0; j < naSolverSettings.AccumulateAttributeNames.Count; j++)
                        {
                            if (naSolverSettings.AccumulateAttributeNames.get_Element(j) == attributeName)
                            {
                                cboVRPDistanceAttribute.SelectedIndex = cboindex;
                            }
                        }
                    }
                }
            }
            else if (laSolver != null)  // Location-Allocation LAYER
            {
                // Remove unnecessary tabs
                tabPropPages.TabPages.Remove(tabRoute);
                tabPropPages.TabPages.Remove(tabClosestFacility);
                tabPropPages.TabPages.Remove(tabODCostMatrix);
                tabPropPages.TabPages.Remove(tabServiceArea);
                tabPropPages.TabPages.Remove(tabVRP);

                // INALocationAllocationSolver
                txtLACutOff.Text             = GetStringFromObject(laSolver.DefaultCutoff);
                txtLAFacilitiesToLocate.Text = laSolver.NumberFacilitiesToLocate.ToString();
                txtLAImpParameter.Text       = laSolver.TransformationParameter.ToString();
                txtLATargetMarketShare.Text  = laSolver.TargetMarketSharePercentage.ToString();

                cboLAImpTransformation.SelectedIndex = Convert.ToInt32(laSolver.ImpedanceTransformation);
                cboLAProblemType.SelectedIndex       = Convert.ToInt32(laSolver.ProblemType);
                cboLAOutputLines.SelectedIndex       = Convert.ToInt32(laSolver.OutputLines);
                cboLATravelDirection.SelectedIndex   = Convert.ToInt32(laSolver.TravelDirection);

                //// INASolverSettings
                PopulateImpedanceNameControl(cboLAImpedance, networkDataset, naSolverSettings.ImpedanceAttributeName);
                PopulateAttributeControl(chklstLAAccumulateAttributeNames, networkDataset, naSolverSettings.AccumulateAttributeNames, esriNetworkAttributeUsageType.esriNAUTCost);
                PopulateAttributeControl(chklstLARestrictionAttributeNames, networkDataset, naSolverSettings.RestrictionAttributeNames, esriNetworkAttributeUsageType.esriNAUTRestriction);
                chkLAUseHierarchy.Enabled           = (naSolverSettings.HierarchyAttributeName.Length > 0);
                chkLAUseHierarchy.Checked           = (chkCFUseHierarchy.Enabled && naSolverSettings.UseHierarchy);
                chkLAIgnoreInvalidLocations.Checked = naSolverSettings.IgnoreInvalidLocations;
            }
            else  // Unknown type of layer
            {
                // Remove unnecessary tabs
                tabPropPages.TabPages.Remove(tabRoute);
                tabPropPages.TabPages.Remove(tabClosestFacility);
                tabPropPages.TabPages.Remove(tabODCostMatrix);
                tabPropPages.TabPages.Remove(tabServiceArea);
                tabPropPages.TabPages.Remove(tabVRP);
                tabPropPages.TabPages.Remove(tabLocationAllocation);
            }
        }
Beispiel #12
0
        /// <summary>
        /// Updates the NALayer based on the current controls.
        /// This will update the solver settings for the solver referenced by the NALayer.
        /// </summary>
        private void UpdateNALayer(INALayer naLayer)
        {
            ILayer                      layer            = naLayer as ILayer;
            INAContext                  naContext        = naLayer.Context;
            INetworkDataset             networkDataset   = naContext.NetworkDataset;
            INALocator2                 naLocator        = naContext.Locator as INALocator2;
            INASolver                   naSolver         = naContext.Solver;
            INASolverSettings           naSolverSettings = naSolver as INASolverSettings2;
            INARouteSolver2             routeSolver      = naSolver as INARouteSolver2;
            INAClosestFacilitySolver    cfSolver         = naSolver as INAClosestFacilitySolver;
            INAODCostMatrixSolver       odSolver         = naSolver as INAODCostMatrixSolver;
            INAServiceAreaSolver2       saSolver         = naSolver as INAServiceAreaSolver2;
            INAVRPSolver                vrpSolver        = naSolver as INAVRPSolver;
            INALocationAllocationSolver laSolver         = naSolver as INALocationAllocationSolver;

            // Set Layer properties
            layer.Name = txtLayerName.Text;
            naLocator.MaxSnapTolerance   = Convert.ToDouble(txtMaxSearchTolerance.Text);
            naLocator.SnapToleranceUnits = (esriUnits)cboMaxSearchToleranceUnits.SelectedIndex;

            // Set Solver properties
            if (routeSolver != null)  // ROUTE LAYER
            {
                // INARouteSolver
                routeSolver.FindBestSequence  = chkRouteFindBestSequence.Checked;
                routeSolver.PreserveFirstStop = chkRoutePreserveFirstStop.Checked;
                routeSolver.PreserveLastStop  = chkRoutePreserveLastStop.Checked;
                routeSolver.UseTimeWindows    = chkRouteUseTimeWindows.Checked;
                routeSolver.UseStartTime      = chkRouteUseStartTime.Checked;
                routeSolver.StartTime         = System.Convert.ToDateTime(txtRouteStartTime.Text);
                routeSolver.OutputLines       = (esriNAOutputLineType)cboRouteOutputLines.SelectedIndex;

                // INASolverSettings
                naSolverSettings.ImpedanceAttributeName    = cboRouteImpedance.Text;
                naSolverSettings.UseHierarchy              = chkRouteUseHierarchy.Checked;
                naSolverSettings.IgnoreInvalidLocations    = chkRouteIgnoreInvalidLocations.Checked;
                naSolverSettings.RestrictUTurns            = (esriNetworkForwardStarBacktrack)cboRouteRestrictUTurns.SelectedIndex;
                naSolverSettings.AccumulateAttributeNames  = GetCheckedAttributeNamesFromControl(chklstRouteAccumulateAttributeNames);
                naSolverSettings.RestrictionAttributeNames = GetCheckedAttributeNamesFromControl(chklstRouteRestrictionAttributeNames);
            }

            else if (cfSolver != null)  // CLOSEST FACILITY LAYER
            {
                if (txtCFDefaultCutoff.Text.Length == 0)
                {
                    cfSolver.DefaultCutoff = null;
                }
                else
                {
                    cfSolver.DefaultCutoff = Convert.ToDouble(txtCFDefaultCutoff.Text);
                }

                if (txtCFDefaultTargetFacilityCount.Text.Length == 0)
                {
                    cfSolver.DefaultTargetFacilityCount = 1;
                }
                else
                {
                    cfSolver.DefaultTargetFacilityCount = Convert.ToInt32(txtCFDefaultTargetFacilityCount.Text);
                }

                cfSolver.TravelDirection = (esriNATravelDirection)cboCFTravelDirection.SelectedIndex;
                cfSolver.OutputLines     = (esriNAOutputLineType)cboCFOutputLines.SelectedIndex;

                // INASolverSettings
                naSolverSettings.ImpedanceAttributeName    = cboCFImpedance.Text;
                naSolverSettings.UseHierarchy              = chkCFUseHierarchy.Checked;
                naSolverSettings.IgnoreInvalidLocations    = chkCFIgnoreInvalidLocations.Checked;
                naSolverSettings.RestrictUTurns            = (esriNetworkForwardStarBacktrack)cboCFRestrictUTurns.SelectedIndex;
                naSolverSettings.AccumulateAttributeNames  = GetCheckedAttributeNamesFromControl(chklstCFAccumulateAttributeNames);
                naSolverSettings.RestrictionAttributeNames = GetCheckedAttributeNamesFromControl(chklstCFRestrictionAttributeNames);
            }

            else if (odSolver != null)  // OD COST MATRIX LAYER
            {
                if (txtODDefaultCutoff.Text.Length == 0)
                {
                    odSolver.DefaultCutoff = null;
                }
                else
                {
                    odSolver.DefaultCutoff = Convert.ToDouble(txtODDefaultCutoff.Text);
                }

                if (txtODDefaultTargetDestinationCount.Text.Length == 0)
                {
                    odSolver.DefaultTargetDestinationCount = null;
                }
                else
                {
                    odSolver.DefaultTargetDestinationCount = Convert.ToInt32(txtODDefaultTargetDestinationCount.Text);
                }

                odSolver.OutputLines = (esriNAOutputLineType)cboODOutputLines.SelectedIndex;

                // INASolverSettings
                naSolverSettings.ImpedanceAttributeName    = cboODImpedance.Text;
                naSolverSettings.UseHierarchy              = chkODUseHierarchy.Checked;
                naSolverSettings.IgnoreInvalidLocations    = chkODIgnoreInvalidLocations.Checked;
                naSolverSettings.RestrictUTurns            = (esriNetworkForwardStarBacktrack)cboODRestrictUTurns.SelectedIndex;
                naSolverSettings.AccumulateAttributeNames  = GetCheckedAttributeNamesFromControl(chklstODAccumulateAttributeNames);
                naSolverSettings.RestrictionAttributeNames = GetCheckedAttributeNamesFromControl(chklstODRestrictionAttributeNames);
            }

            else if (saSolver != null)  // SERVICE AREA SOLVER
            {
                IDoubleArray defaultBreaks = saSolver.DefaultBreaks;
                defaultBreaks.RemoveAll();
                string breaks = txtSADefaultBreaks.Text.Trim();
                breaks.Replace("  ", " ");
                string[] values = breaks.Split(' ');
                for (int iBreak = values.GetLowerBound(0); iBreak <= values.GetUpperBound(0); iBreak++)
                {
                    defaultBreaks.Add(System.Convert.ToDouble(values.GetValue(iBreak)));
                }
                saSolver.DefaultBreaks   = defaultBreaks;
                saSolver.TravelDirection = (esriNATravelDirection)cboSATravelDirection.SelectedIndex;

                saSolver.OutputPolygons            = (esriNAOutputPolygonType)cboSAOutputPolygons.SelectedIndex;
                saSolver.OverlapPolygons           = chkSAOverlapPolygons.Checked;
                saSolver.SplitPolygonsAtBreaks     = chkSASplitPolygonsAtBreaks.Checked;
                saSolver.MergeSimilarPolygonRanges = chkSAMergeSimilarPolygonRanges.Checked;
                saSolver.TrimOuterPolygon          = chkSATrimOuterPolygon.Checked;
                saSolver.TrimPolygonDistance       = Convert.ToDouble(this.txtSATrimPolygonDistance.Text);
                saSolver.TrimPolygonDistanceUnits  = (esriUnits)cboSATrimPolygonDistanceUnits.SelectedIndex;

                if (cboSAOutputLines.SelectedIndex == 0)
                {
                    saSolver.OutputLines = (esriNAOutputLineType)cboSAOutputLines.SelectedIndex;
                }
                else // Does not support Straight lines, so not in combobox, up by one to account for this
                {
                    saSolver.OutputLines = (esriNAOutputLineType)(cboSAOutputLines.SelectedIndex + 1);
                }

                saSolver.OverlapLines       = chkSAOverlapLines.Checked;
                saSolver.SplitLinesAtBreaks = chkSASplitLinesAtBreaks.Checked;
                saSolver.IncludeSourceInformationOnLines = this.chkSAIncludeSourceInformationOnLines.Checked;

                // INASolverSettings
                naSolverSettings.ImpedanceAttributeName    = cboSAImpedance.Text;
                naSolverSettings.IgnoreInvalidLocations    = chkSAIgnoreInvalidLocations.Checked;
                naSolverSettings.RestrictUTurns            = (esriNetworkForwardStarBacktrack)cboSARestrictUTurns.SelectedIndex;
                naSolverSettings.AccumulateAttributeNames  = GetCheckedAttributeNamesFromControl(chklstSAAccumulateAttributeNames);
                naSolverSettings.RestrictionAttributeNames = GetCheckedAttributeNamesFromControl(chklstSARestrictionAttributeNames);
            }
            else if (vrpSolver != null)
            {
                naSolverSettings.ImpedanceAttributeName = cboVRPTimeAttribute.Text;
                naSolverSettings.AccumulateAttributeNames.RemoveAll();
                IStringArray strArray = naSolverSettings.AccumulateAttributeNames;
                strArray.RemoveAll();
                strArray.Add(cboVRPDistanceAttribute.Text);
                naSolverSettings.AccumulateAttributeNames = strArray;

                vrpSolver.CapacityCount  = Convert.ToInt32(txtVRPCapacityCount.Text);
                vrpSolver.DefaultDate    = Convert.ToDateTime(txtVRPDefaultDate.Text);
                vrpSolver.TimeFieldUnits = ((esriNetworkAttributeUnits)cboVRPTimeFieldUnits.SelectedIndex) + 20;

                // there cannot be unknown units for a VRP, so the index is offset by 1
                vrpSolver.DistanceFieldUnits               = (esriNetworkAttributeUnits)cboVRPDistanceFieldUnits.SelectedIndex + 1;
                naSolverSettings.RestrictUTurns            = (esriNetworkForwardStarBacktrack)cboVRPAllowUTurns.SelectedIndex;
                vrpSolver.OutputLines                      = (esriNAOutputLineType)cboVRPOutputShapeType.SelectedIndex;
                vrpSolver.TimeWindowViolationPenaltyFactor = cboVRPTimeWindow.SelectedIndex;
                vrpSolver.ExcessTransitTimePenaltyFactor   = cboVRPTransitTime.SelectedIndex;

                naSolverSettings.UseHierarchy = chkVRPUseHierarchy.Checked;

                naSolverSettings.RestrictionAttributeNames = GetCheckedAttributeNamesFromControl(chklstVRPRestrictionAttributeNames);
            }
            else if (laSolver != null)  // Location-Allocation LAYER
            {
                if (txtLACutOff.Text.Length == 0)
                {
                    laSolver.DefaultCutoff = null;
                }
                else if (Convert.ToDouble(txtLACutOff.Text) == 0.0)
                {
                    laSolver.DefaultCutoff = null;
                }
                else
                {
                    laSolver.DefaultCutoff = Convert.ToDouble(txtLACutOff.Text);
                }

                if (txtLAFacilitiesToLocate.Text.Length == 0)
                {
                    laSolver.NumberFacilitiesToLocate = 1;
                }
                else
                {
                    laSolver.NumberFacilitiesToLocate = Convert.ToInt32(txtLAFacilitiesToLocate.Text);
                }

                laSolver.ProblemType                 = (esriNALocationAllocationProblemType)cboLAProblemType.SelectedIndex;
                laSolver.ImpedanceTransformation     = (esriNAImpedanceTransformationType)cboLAImpTransformation.SelectedIndex;
                laSolver.TransformationParameter     = Convert.ToDouble(txtLAImpParameter.Text);
                laSolver.TargetMarketSharePercentage = Convert.ToDouble(txtLATargetMarketShare.Text);
                laSolver.TravelDirection             = (esriNATravelDirection)cboLATravelDirection.SelectedIndex;
                laSolver.OutputLines                 = (esriNAOutputLineType)cboLAOutputLines.SelectedIndex;

                //// INASolverSettings
                naSolverSettings.ImpedanceAttributeName    = cboLAImpedance.Text;
                naSolverSettings.UseHierarchy              = chkLAUseHierarchy.Checked;
                naSolverSettings.AccumulateAttributeNames  = GetCheckedAttributeNamesFromControl(chklstLAAccumulateAttributeNames);
                naSolverSettings.RestrictionAttributeNames = GetCheckedAttributeNamesFromControl(chklstLARestrictionAttributeNames);
                naSolverSettings.IgnoreInvalidLocations    = chkLAIgnoreInvalidLocations.Checked;
            }
        }