GetClassBreaksRenderer() public method

public GetClassBreaksRenderer ( IFeatureLayer featureLayer ) : IClassBreaksRenderer
featureLayer IFeatureLayer
return IClassBreaksRenderer
Ejemplo n.º 1
0
        private void button1_Click(object sender, System.EventArgs e)
        {
            //Get the layer selected in the combo box
            IGeoFeatureLayer geofeaturelayer = null;
            IMap             map             = axPageLayoutControl1.ActiveView.FocusMap;

            for (int i = 0; i <= map.LayerCount - 1; i++)
            {
                if (map.get_Layer(i).Name == comboBox1.SelectedItem.ToString())
                {
                    geofeaturelayer = (IGeoFeatureLayer)map.get_Layer(i);
                    break;
                }
            }
            if (geofeaturelayer == null)
            {
                return;
            }

            //Create ClassBreaks form
            Form2 classBreaksForm = new  Form2();

            //Get a ClassBreakRenderer that uses the selected ColorRamp
            IClassBreaksRenderer classBreaksRenderer = classBreaksForm.GetClassBreaksRenderer(geofeaturelayer);

            if (classBreaksRenderer == null)
            {
                return;
            }

            //Set the new renderer
            geofeaturelayer.Renderer = (IFeatureRenderer)classBreaksRenderer;

            //Trigger contents changed event for TOCControl
            axPageLayoutControl1.ActiveView.ContentsChanged();
            //Refresh the display
            axPageLayoutControl1.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGeography, geofeaturelayer, null);

            //Dispose of the form
            classBreaksForm.Dispose();
        }
		private void button1_Click(object sender, System.EventArgs e)
		{
			//Get the layer selected in the combo box
			IGeoFeatureLayer geofeaturelayer = null;
			IMap map = axPageLayoutControl1.ActiveView.FocusMap;
			for (int i=0; i<= map.LayerCount-1; i++)
			{
				if (map.get_Layer(i).Name == comboBox1.SelectedItem.ToString())
				{
					geofeaturelayer = (IGeoFeatureLayer) map.get_Layer(i);
					break;
				}
			}
			if (geofeaturelayer == null) return;

			//Create ClassBreaks form 
			Form2 classBreaksForm = new  Form2();

			//Get a ClassBreakRenderer that uses the selected ColorRamp
			IClassBreaksRenderer classBreaksRenderer = classBreaksForm.GetClassBreaksRenderer(geofeaturelayer);
			if (classBreaksRenderer == null) return;

			//Set the new renderer 
			geofeaturelayer.Renderer = (IFeatureRenderer) classBreaksRenderer;

			//Trigger contents changed event for TOCControl
			axPageLayoutControl1.ActiveView.ContentsChanged();
			//Refresh the display 
			axPageLayoutControl1.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGeography, geofeaturelayer, null);

			//Dispose of the form
			classBreaksForm.Dispose();
		}