Exemple #1
0
        /// <summary>
        /// 开始路径查询
        /// </summary>
        private void menuOKRoute_Click(object sender, EventArgs e)
        {
            try
            {
                pPathFinder.loadNANetworkLocations("Stops", pPathFinder.inputFClass, 80);
                IGPMessages gpMessages = new GPMessagesClass();
                bool        flag       = pPathFinder.m_NAContext.Solver.Solve(pPathFinder.m_NAContext, gpMessages, null);

                IFeatureClass routesFC      = pPathFinder.m_NAContext.NAClasses.get_ItemByName("Routes") as IFeatureClass;
                IFeatureLayer pRouteFeature = new FeatureLayerClass();
                pRouteFeature.FeatureClass = routesFC;
                pRouteFeature.Name         = routesFC.AliasName;
                axMapControl1.AddLayer(pRouteFeature, 0);

                axMapControl1.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGraphics, null, null);
            }
            catch
            {
                MessageBox.Show("无路径分析结果", "提示");
                return;
            }
        }