Пример #1
0
        private void method_0(IClassify iclassify_0, ITinColorRampRenderer itinColorRampRenderer_0, int int_0,
                              ITin itin_1)
        {
            bool             flag;
            IRandomColorRamp ramp = new RandomColorRampClass
            {
                StartHue      = 40,
                EndHue        = 120,
                MinValue      = 65,
                MaxValue      = 90,
                MinSaturation = 25,
                MaxSaturation = 45,
                Size          = 5,
                Seed          = 23
            };
            IColorRamp ramp2 = ramp;

            if (iclassify_0 is IClassifyMinMax2)
            {
                ITinAdvanced advanced = itin_1 as ITinAdvanced;
                double       zMin     = advanced.Extent.ZMin;
                double       zMax     = advanced.Extent.ZMax;
                (iclassify_0 as IClassifyMinMax2).ClassifyMinMax(zMin, zMax, ref int_0);
            }
            else if (!(iclassify_0 is IDeviationInterval))
            {
            }
            itinColorRampRenderer_0.BreakCount = int_0;
            double[] classBreaks = (double[])iclassify_0.ClassBreaks;
            if (classBreaks.Length == 0)
            {
                ramp2.Size = 5;
            }
            else
            {
                ramp2.Size = classBreaks.Length;
            }
            ramp2.CreateRamp(out flag);
            IEnumColors colors = ramp2.Colors;
            ISymbol     sym    = null;

            for (int i = 0; i < (classBreaks.Length - 1); i++)
            {
                IColor color = colors.Next();
                if ((itinColorRampRenderer_0 as ITinRenderer).Name == "Elevation")
                {
                    ISimpleFillSymbol symbol2 = new SimpleFillSymbolClass
                    {
                        Color = color,
                        Style = esriSimpleFillStyle.esriSFSSolid
                    };
                    sym = symbol2 as ISymbol;
                }
                else if ((itinColorRampRenderer_0 as ITinRenderer).Name == "Node elevation")
                {
                    IMarkerSymbol symbol3 = new SimpleMarkerSymbolClass
                    {
                        Color = color
                    };
                    sym = symbol3 as ISymbol;
                }
                itinColorRampRenderer_0.set_Symbol(i, sym);
                (itinColorRampRenderer_0 as IClassBreaksUIProperties).set_LowBreak(i, classBreaks[i]);
                itinColorRampRenderer_0.set_Break(i, classBreaks[i + 1]);
                string label = classBreaks[i].ToString() + " - " + classBreaks[i + 1].ToString();
                itinColorRampRenderer_0.set_Label(i, label);
            }
        }
Пример #2
0
        private void btnok_Click(object sender, EventArgs e)
        {
            if (treeshow.SelectedIndex == 1)
            {
                ITinRenderer             pRenderNew  = new TinFaceRenderer() as ITinRenderer;
                ITinSingleSymbolRenderer pUVRenderer = pRenderNew as ITinSingleSymbolRenderer;
                ISimpleFillSymbol        pSymbol     = new SimpleFillSymbolClass();
                pSymbol.Color      = ClsGDBDataCommon.ColorToIColor(btncolor.SelectedColor);
                pUVRenderer.Symbol = pSymbol as ISymbol;
                pTLayer.ClearRenderers();
                pTLayer.InsertRenderer(pRenderNew, 0);
                pTocContral.SetBuddyControl(pMapContral);
                pTocContral.Refresh();
                pMapContral.Refresh();
                if (bar3.SelectedDockTab == 2)
                {
                    IActiveView pActiveView = pSceneControl.Scene as IActiveView;
                    pActiveView.PartialRefresh(esriViewDrawPhase.esriViewGeography, pTLayer, null);
                }
                this.Close();
            }
            else
            {
                ITinRenderer pTinRenderer = new TinElevationRenderer() as ITinRenderer;

                //设置样式
                if (pTinRenderer is ITinColorRampRenderer)
                {
                    if (pTinRenderer.Name == "Elevation")
                    {
                        if (lowbreak.Count > 0)
                        {
                            int ClassCount = int.Parse(cmbclasses.SelectedItem.ToString());

                            ITinAdvanced             pTinAdv = pTLayer.Dataset as ITinAdvanced;
                            ITinColorRampRenderer    pTinColorRampRenderer    = pTinRenderer as ITinColorRampRenderer;
                            IClassBreaksUIProperties pClassBreaksUIProperties = pTinRenderer as IClassBreaksUIProperties;
                            INumberFormat            pNumberFormat            = pClassBreaksUIProperties.NumberFormat;
                            pTinColorRampRenderer.MinimumBreak = lowbreak[0];

                            pTinColorRampRenderer.BreakCount = int.Parse(cmbclasses.SelectedItem.ToString());
                            ISimpleFillSymbol pSymbol = null;
                            for (int j = 0; j < pTinColorRampRenderer.BreakCount; j++)
                            {
                                pClassBreaksUIProperties.set_LowBreak(j, lowbreak[j]);
                                pTinColorRampRenderer.set_Break(j, highbreak[j]);

                                //用于图层控制中分级标示显示
                                pTinColorRampRenderer.set_Label(ClassCount - j - 1, datagridsymbol.Rows[j].Cells[2].Value.ToString());
                                pSymbol       = new SimpleFillSymbolClass();
                                pSymbol.Color = ClsGDBDataCommon.ColorToIColor(datagridsymbol.Rows[j].Cells[0].Style.BackColor);
                                pTinColorRampRenderer.set_Symbol(ClassCount - j - 1, pSymbol as ISymbol);
                            }
                            pTLayer.ClearRenderers();
                            (pTinColorRampRenderer as ITinRenderer).Visible = true;
                            pTLayer.InsertRenderer(pTinColorRampRenderer as ITinRenderer, 0);//插入一个渲染模型
                            pTocContral.SetBuddyControl(pMapContral);
                            pTocContral.Refresh();
                            pMapContral.Refresh();
                            if (bar3.SelectedDockTab == 2)
                            {
                                IActiveView pActiveView = pSceneControl.Scene as IActiveView;
                                pActiveView.PartialRefresh(esriViewDrawPhase.esriViewGeography, pTLayer, null);
                            }
                            this.Close();
                        }
                    }
                }
            }
        }
Пример #3
0
        private void method_3(IColorRamp icolorRamp_1, ITinColorRampRenderer itinColorRampRenderer_1, int int_0,
                              ITin itin_0)
        {
            IClassify classify =
                this.method_2((itinColorRampRenderer_1 as IClassBreaksUIProperties).Method) as IClassify;

            if (classify != null)
            {
                bool flag;
                if (classify is IClassifyMinMax2)
                {
                    ITinAdvanced dataset = this.itinLayer_0.Dataset as ITinAdvanced;
                    double       zMin    = dataset.Extent.ZMin;
                    double       zMax    = dataset.Extent.ZMax;
                    (classify as IClassifyMinMax2).ClassifyMinMax(zMin, zMax, ref int_0);
                }
                else if (!(classify is IDeviationInterval))
                {
                }
                itinColorRampRenderer_1.BreakCount = int_0;
                this.bool_0 = false;
                this.cboClassifyNum.SelectedIndex = int_0 - 1;
                this.bool_0 = true;
                double[] classBreaks = (double[])classify.ClassBreaks;
                if (classBreaks.Length == 0)
                {
                    icolorRamp_1.Size = 5;
                }
                else
                {
                    icolorRamp_1.Size = classBreaks.Length;
                }
                icolorRamp_1.CreateRamp(out flag);
                IEnumColors colors = icolorRamp_1.Colors;
                ISymbol     sym    = null;
                for (int i = 0; i < (classBreaks.Length - 1); i++)
                {
                    IColor color = colors.Next();
                    if ((itinColorRampRenderer_1 as ITinRenderer).Name == "Elevation")
                    {
                        ISimpleFillSymbol symbol2 = new SimpleFillSymbolClass
                        {
                            Color = color,
                            Style = esriSimpleFillStyle.esriSFSSolid
                        };
                        sym = symbol2 as ISymbol;
                    }
                    else if ((itinColorRampRenderer_1 as ITinRenderer).Name == "Node elevation")
                    {
                        IMarkerSymbol symbol3 = new SimpleMarkerSymbolClass
                        {
                            Color = color
                        };
                        sym = symbol3 as ISymbol;
                    }
                    itinColorRampRenderer_1.set_Symbol(i, sym);
                    (itinColorRampRenderer_1 as IClassBreaksUIProperties).set_LowBreak(i, classBreaks[i]);
                    itinColorRampRenderer_1.set_Break(i, classBreaks[i + 1]);
                    string label = classBreaks[i].ToString() + " - " + classBreaks[i + 1].ToString();
                    itinColorRampRenderer_1.set_Label(i, label);
                }
            }
        }