Inheritance: System.Windows.Forms.Form
示例#1
0
        public override void OnClick()
        {
            // Get the NALayer and corresponding NAContext of the layer that
            // was right-clicked on in the table of contents
            // m_MapControl.CustomProperty was set in frmMain.axTOCControl1_OnMouseDown
            INALayer naLayer = (INALayer)m_mapControl.CustomProperty;

            // Set the Active Analysis layer to be the layer right-clicked on
            m_naEnv.NAWindow.ActiveAnalysis = naLayer;

            if (!Enabled)
            {
                return;
            }

            // Show the Property Page form for Network Analyst
            frmLoadLocations loadLocations = new frmLoadLocations();

            if (loadLocations.ShowModal(m_mapControl, m_naEnv))
            {
                // If loaded locations, refresh the NAWindow and the Screen
                m_mapControl.Refresh(esriViewDrawPhase.esriViewGeography, naLayer, m_mapControl.Extent);
                m_naEnv.NAWindow.UpdateContent(m_naEnv.NAWindow.ActiveCategory);
            }
        }
示例#2
0
        private void miLoadLocations_Click(object sender, System.EventArgs e)
        {
            var mapControl = axMapControl1.Object as IMapControl3;

            // Show the Property Page form for ArcGIS Network Analyst extension
            var loadLocations = new frmLoadLocations();

            if (loadLocations.ShowModal(mapControl, m_naEnv))
            {
                // notify that the context has changed because we have added locations to a NAClass within it
                var contextEdit = m_naEnv.NAWindow.ActiveAnalysis.Context as INAContextEdit;
                contextEdit.ContextChanged();

                // If loaded locations, refresh the NAWindow and the Screen
                INALayer naLayer = m_naWindow.ActiveAnalysis;
                mapControl.Refresh(esriViewDrawPhase.esriViewGeography, naLayer, mapControl.Extent);
                m_naWindow.UpdateContent(m_naWindow.ActiveCategory);
            }
        }
        private void miLoadLocations_Click(object sender, System.EventArgs e)
        {
            IMapControl3 mapControl = (IMapControl3)axMapControl1.Object;

            // 显示网络分析的属性页窗体
            frmLoadLocations loadLocations = new frmLoadLocations();

            if (loadLocations.ShowModal(mapControl, m_naEnv))
            {
                // 上下文已更改,已将位置添加到其中的一个naclass
                INAContextEdit contextEdit = m_naEnv.NAWindow.ActiveAnalysis.Context as INAContextEdit;
                contextEdit.ContextChanged();

                // 如果加载,刷新NAWindow屏幕
                INALayer naLayer = m_naWindow.ActiveAnalysis;
                mapControl.Refresh(esriViewDrawPhase.esriViewGeography, naLayer, mapControl.Extent);
                m_naWindow.UpdateContent(m_naWindow.ActiveCategory);
            }
        }
        public override void OnClick()
        {
            if (m_mapControl == null)
            {
                MessageBox.Show("Error: Map control is null for this command");
                return;
            }

            // Get the NALayer and corresponding NAContext of the layer that
            // was right-clicked on in the table of contents
            // m_MapControl.CustomProperty was set in frmMain.axTOCControl1_OnMouseDown
            var naLayer = m_mapControl.CustomProperty as INALayer;

            if (naLayer == null)
            {
                MessageBox.Show("Error: NALayer was not set as the CustomProperty of the map control");
                return;
            }

            var naEnv = CommonFunctions.GetTheEngineNetworkAnalystEnvironment();

            if (naEnv == null || naEnv.NAWindow == null)
            {
                MessageBox.Show("Error: EngineNetworkAnalystEnvironment is not properly configured");
                return;
            }

            ESRI.ArcGIS.Controls.IEngineNAWindowCategory naWindowCategory = naEnv.NAWindow.ActiveCategory;
            if (naWindowCategory == null)
            {
                MessageBox.Show("Error: There is no active category for the NAWindow");
                return;
            }

            INAClass naClass = naWindowCategory.NAClass;

            if (naClass == null)
            {
                MessageBox.Show("Error: There is no NAClass for the active category");
                return;
            }

            INAClassDefinition naClassDefinition = naClass.ClassDefinition;

            if (naClassDefinition == null)
            {
                MessageBox.Show("Error: NAClassDefinition is null for the active NAClass");
                return;
            }

            if (!naClassDefinition.IsInput)
            {
                MessageBox.Show("Error: Locations can only be loaded into an input NAClass");
                return;
            }

            // Set the Active Analysis layer to be the layer right-clicked on
            naEnv.NAWindow.ActiveAnalysis = naLayer;

            // Show the Property Page form for ArcGIS Network Analyst extension
            var loadLocations = new frmLoadLocations();

            if (loadLocations.ShowModal(m_mapControl, naEnv))
            {
                // Notify that the context has changed, because we have added locations to a NAClass within it
                var contextEdit = naEnv.NAWindow.ActiveAnalysis.Context as INAContextEdit;
                contextEdit.ContextChanged();

                // Refresh the NAWindow and the map
                m_mapControl.Refresh(esriViewDrawPhase.esriViewGeography, naLayer, m_mapControl.Extent);
                naEnv.NAWindow.UpdateContent(naEnv.NAWindow.ActiveCategory);
            }
        }
示例#5
0
        public override void OnClick()
        {
            // Get the NALayer and corresponding NAContext of the layer that
            // was right-clicked on in the table of contents
            // m_MapControl.CustomProperty was set in frmMain.axTOCControl1_OnMouseDown
            INALayer naLayer =  (INALayer) m_mapControl.CustomProperty;

            // Set the Active Analysis layer to be the layer right-clicked on
            m_naEnv.NAWindow.ActiveAnalysis = naLayer;

            if (!Enabled)
                return;

            // Show the Property Page form for Network Analyst
            frmLoadLocations loadLocations = new frmLoadLocations();
            if (loadLocations.ShowModal(m_mapControl, m_naEnv))
            {
                // If loaded locations, refresh the NAWindow and the Screen
                m_mapControl.Refresh(esriViewDrawPhase.esriViewGeography, naLayer, m_mapControl.Extent);
                m_naEnv.NAWindow.UpdateContent(m_naEnv.NAWindow.ActiveCategory);
            }
        }
		public override void OnClick()
		{
			if (m_mapControl == null)
			{
				MessageBox.Show("Error: Map control is null for this command");
				return;
			}

			// Get the NALayer and corresponding NAContext of the layer that
			// was right-clicked on in the table of contents
			// m_MapControl.CustomProperty was set in frmMain.axTOCControl1_OnMouseDown
			var naLayer = m_mapControl.CustomProperty as INALayer;
			if (naLayer == null)
			{
				MessageBox.Show("Error: NALayer was not set as the CustomProperty of the map control");
				return;
			}

			var naEnv = CommonFunctions.GetTheEngineNetworkAnalystEnvironment();
			if (naEnv == null || naEnv.NAWindow == null )
			{
				MessageBox.Show("Error: EngineNetworkAnalystEnvironment is not properly configured");
				return;
			}

			ESRI.ArcGIS.Controls.IEngineNAWindowCategory naWindowCategory = naEnv.NAWindow.ActiveCategory;
			if (naWindowCategory == null )
			{
				MessageBox.Show("Error: There is no active category for the NAWindow");
				return;
			}

			INAClass naClass = naWindowCategory.NAClass;
			if (naClass == null)
			{
				MessageBox.Show("Error: There is no NAClass for the active category");
				return;
			}

			INAClassDefinition naClassDefinition = naClass.ClassDefinition;
			if (naClassDefinition == null)
			{
				MessageBox.Show("Error: NAClassDefinition is null for the active NAClass");
				return;
			}

			if (!naClassDefinition.IsInput)
			{
				MessageBox.Show("Error: Locations can only be loaded into an input NAClass");
				return;
			}

			// Set the Active Analysis layer to be the layer right-clicked on
			naEnv.NAWindow.ActiveAnalysis = naLayer;

			// Show the Property Page form for ArcGIS Network Analyst extension
			var loadLocations = new frmLoadLocations();
			if (loadLocations.ShowModal(m_mapControl, naEnv))
			{
				// Notify that the context has changed, because we have added locations to a NAClass within it
				var contextEdit = naEnv.NAWindow.ActiveAnalysis.Context as INAContextEdit;
				contextEdit.ContextChanged();

				// Refresh the NAWindow and the map
				m_mapControl.Refresh(esriViewDrawPhase.esriViewGeography, naLayer, m_mapControl.Extent);
				naEnv.NAWindow.UpdateContent(naEnv.NAWindow.ActiveCategory);
			}
		}
		private void miLoadLocations_Click(object sender, System.EventArgs e)
		{
			var mapControl = axMapControl1.Object as IMapControl3;

			// Show the Property Page form for ArcGIS Network Analyst extension
			var loadLocations = new frmLoadLocations();
			if (loadLocations.ShowModal(mapControl, m_naEnv))
			{
				// notify that the context has changed because we have added locations to a NAClass within it
				var contextEdit = m_naEnv.NAWindow.ActiveAnalysis.Context as INAContextEdit;
				contextEdit.ContextChanged();

				// If loaded locations, refresh the NAWindow and the Screen
				INALayer naLayer = m_naWindow.ActiveAnalysis;
				mapControl.Refresh(esriViewDrawPhase.esriViewGeography, naLayer, mapControl.Extent);
				m_naWindow.UpdateContent(m_naWindow.ActiveCategory);
			}
		}