Esempio n. 1
0
        //样式选择
        private void axSymbologyControl_OnItemSelected(object sender, ISymbologyControlEvents_OnItemSelectedEvent e)
        {
            //选择样式
            pStyleGalleryItem = (IStyleGalleryItem)e.styleGalleryItem;
            //将选择的样式与设计的样式大小、颜色等属性结合
            if (axSymbologyControl.StyleClass == esriSymbologyStyleClass.esriStyleClassMarkerSymbols)
            {
                IMarkerSymbol pMarkerSymbol = pStyleGalleryItem.Item as IMarkerSymbol;
                double        pMarkerSize   = pMarkerSymbol.Size;
                PointSize.Text = pMarkerSize.ToString();
                double pMarkerAngle = pMarkerSymbol.Angle;
                PointAngle.Text          = pMarkerAngle.ToString();
                colorPoint.SelectedColor = ClsGDBDataCommon.IColorToColor(pMarkerSymbol.Color);
            }
            else if (axSymbologyControl.StyleClass == esriSymbologyStyleClass.esriStyleClassLineSymbols)
            {
                ILineSymbol pLineSymbol = pStyleGalleryItem.Item as ILineSymbol;
                double      pLineWidth  = pLineSymbol.Width;
                LineSize.Text = pLineWidth.ToString();

                colorLine.SelectedColor = ClsGDBDataCommon.IColorToColor(pLineSymbol.Color);
            }
            else if (axSymbologyControl.StyleClass == esriSymbologyStyleClass.esriStyleClassFillSymbols)
            {
                IFillSymbol pFillSymbol = pStyleGalleryItem.Item as IFillSymbol;

                PolygonSize.Text           = pFillSymbol.Outline.Width.ToString();
                colorPolygon.SelectedColor = ClsGDBDataCommon.IColorToColor(pFillSymbol.Color);
                colorOutLine.SelectedColor = ClsGDBDataCommon.IColorToColor(pFillSymbol.Outline.Color);
            }
            PreviewImage();
        }
Esempio n. 2
0
        private void FrmEditLine_Load(object sender, EventArgs e)
        {
            IMultiLayerLineSymbol pMultiLayerLineSymbol = pStyleGalleryItem.Item as IMultiLayerLineSymbol;

            colorSimpleLine.SelectedColor = ClsGDBDataCommon.IColorToColor(pMultiLayerLineSymbol.get_Layer(0).Color);
            PreviewImage();
            addListBoxItem();
        }
Esempio n. 3
0
        private void FrmSymboloTin_Load(object sender, EventArgs e)
        {
            string sInstall = ClsGDBDataCommon.GetParentPathofExe() + @"Resource\Style\ESRI.ServerStyle";

            axSymbologyControl1.LoadStyleFile(sInstall);
            axSymbologyControl1.StyleClass = esriSymbologyStyleClass.esriStyleClassColorRamps;
            pSymbolClass = axSymbologyControl1.GetStyleClass(esriSymbologyStyleClass.esriStyleClassColorRamps);



            /* *********************************
            * 生成色度带
            * *********************************/

            for (int i = 0; i < pSymbolClass.get_ItemCount(pSymbolClass.StyleCategory); i++)
            {
                stdole.IPictureDisp pPicture = pSymbolClass.PreviewItem(pSymbolClass.GetItem(i), cmbcolor.Width, cmbcolor.Height);
                Image image = Image.FromHbitmap(new System.IntPtr(pPicture.Handle));
                cmbcolor.Items.Add(image);
            }

            if (cmbcolor.Items.Count > 0)
            {
                cmbcolor.SelectedIndex = 0;
            }

            /* *********************************
            * 初始化gridview及颜色控件
            * *********************************/

            if (pTLayer.GetRenderer(0).GetType().Name == "TinFaceRendererClass" || pTLayer.GetRenderer(0).Name == "Faces")
            {
                treeshow.SelectedIndex = 1;
                ITinSingleSymbolRenderer pTinrenderer = pTLayer.GetRenderer(0) as ITinSingleSymbolRenderer;
                ISimpleFillSymbol        psymbol      = new SimpleFillSymbolClass();
                psymbol = pTinrenderer.Symbol as ISimpleFillSymbol;
                btncolor.SelectedColor = ClsGDBDataCommon.IColorToColor(psymbol.Color);
                istrue = true;
            }
            else if (pTLayer.GetRenderer(0).Name == "Elevation" || pTLayer.GetRenderer(0).Name == "Edge types")
            {
                treeshow.SelectedIndex = 0;
                btncolor.SelectedColor = System.Drawing.Color.Green;
                for (int j = 0; j < pTLayer.RendererCount; j++)
                {
                    if (pTLayer.GetRenderer(j).Name == "Elevation")
                    {
                        ptinColorRampRenderer = pTLayer.GetRenderer(j) as ITinColorRampRenderer;
                        break;
                    }
                }
                cmbclasses.SelectedIndex = ptinColorRampRenderer.BreakCount - 1;
                initialupdatagrid();
            }
        }
Esempio n. 4
0
        //初始化gridview控件
        private void initialupdatagrid()
        {
            for (int i = 0; i < ptinColorRampRenderer.BreakCount; i++)
            {
                DataRow row = dataTable2.NewRow();
                row[1] = ptinColorRampRenderer.get_Label(i);
                row[2] = row[1];
                dataTable2.Rows.Add(row);

                ISimpleFillSymbol pSymbol = ptinColorRampRenderer.get_Symbol(i) as ISimpleFillSymbol;
                datagridsymbol.Rows[i].Cells[0].Style.BackColor = ClsGDBDataCommon.IColorToColor(pSymbol.Color);
            }
            datagridsymbol.CurrentCell = null;
        }
Esempio n. 5
0
 private void cmbcolor_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (cmbclasses.SelectedItem != null)
     {
         ITinAdvanced      pTinAdv           = pTLayer.Dataset as ITinAdvanced;
         IColorRamp        pColorRamp        = null;
         int               symbol_index      = cmbcolor.SelectedIndex;//获取选择的序号
         IStyleGalleryItem mStyleGalleryItem = pSymbolClass.GetItem(symbol_index);
         // IColorRamp
         pColorRamp      = (IColorRamp)mStyleGalleryItem.Item;//获取选择的符号
         pColorRamp.Size = int.Parse(cmbclasses.SelectedItem.ToString());
         bool bOK = false;
         pColorRamp.CreateRamp(out bOK);
         for (int i = 0; i < pColorRamp.Size; i++)
         {
             (datagridsymbol.Rows[i].Cells[0]).Style.BackColor = ClsGDBDataCommon.IColorToColor(pColorRamp.get_Color(i));
         }
         datagridsymbol.CurrentCell = null;
     }
 }
Esempio n. 6
0
        //更新gridview控件
        private void updatadatagrid()
        {
            int          classcount = int.Parse(cmbclasses.SelectedItem.ToString());
            ITinAdvanced pTinAdv    = pTLayer.Dataset as ITinAdvanced;
            double       dZMin      = pTinAdv.Extent.ZMin; //tin的Z轴最高值
            double       dZMax      = pTinAdv.Extent.ZMax; //tin的Z轴最低值
            double       dInterval  = (dZMax - dZMin) / classcount;

            double dLowBreak  = dZMin;
            double dHighBreak = dLowBreak + dInterval;

            //创建颜色集合
            IColorRamp        pColorRamp        = null;
            int               symbol_index      = cmbcolor.SelectedIndex;//获取选择的序号
            IStyleGalleryItem mStyleGalleryItem = pSymbolClass.GetItem(symbol_index);

            // IColorRamp
            pColorRamp      = (IColorRamp)mStyleGalleryItem.Item;//获取选择的符号
            pColorRamp.Size = classcount;
            bool bOK = false;

            pColorRamp.CreateRamp(out bOK);

            lowbreak.Clear();
            highbreak.Clear();
            dataTable2.Rows.Clear();
            for (int i = 0; i < pColorRamp.Size; i++)
            {
                lowbreak.Add(dLowBreak);
                highbreak.Add(dHighBreak);
                DataRow row = dataTable2.NewRow();
                row[1] = dLowBreak.ToString("#.#") + " - " + dHighBreak.ToString("#.#");
                row[2] = row[1];
                dataTable2.Rows.Add(row);
                dLowBreak  = dHighBreak;
                dHighBreak = dHighBreak + dInterval;
                datagridsymbol.Rows[i].Cells[0].Style.BackColor = ClsGDBDataCommon.IColorToColor(pColorRamp.get_Color(i));
            }
            datagridsymbol.CurrentCell = null;
        }
Esempio n. 7
0
        private void btnok_Click(object sender, EventArgs e)
        {
            if (treeshow.SelectedIndex == 0)
            {
                if (treeadd.SelectedNode == null)
                {
                    MessageBox.Show("请选择要添加的值", "提示", MessageBoxButtons.OK);
                }
                else
                {
                    string strnode = "";
                    strnode = treeadd.SelectedNode.Text;
                    if (pFClass.ShapeType == esriGeometryType.esriGeometryPolygon)
                    {
                        IClone            pSourceClone    = pSimpleFillSymbol as IClone;
                        ISimpleFillSymbol pSimpleFillSymb = pSourceClone.Clone() as ISimpleFillSymbol;
                        pUniquerender.AddValue(strnode, "唯一值渲染", (ISymbol)pSimpleFillSymb);

                        ISimpleFillSymbol pNextSymbol = pUniquerender.get_Symbol(strnode) as ISimpleFillSymbol;
                        pNextSymbol.Color = coloru[treeadd.SelectedIndex];
                        pUniquerender.set_Symbol(strnode, (ISymbol)pNextSymbol);
                        DataRow rowu = dtable2.NewRow();
                        rowu[1] = strnode;
                        rowu[2] = strnode;
                        rowu[3] = cuntu[treeadd.SelectedIndex];
                        dtable2.Rows.Add(rowu);
                        gridviewu.Rows[gridviewu.Rows.Count - 2].Cells[0].Style.BackColor = ClsGDBDataCommon.IColorToColor(pNextSymbol.Color);
                    }
                    else if (pFClass.ShapeType == esriGeometryType.esriGeometryLine || pFClass.ShapeType == esriGeometryType.esriGeometryPolyline)
                    {
                        IClone            pSourceClone    = pLineSymbol as IClone;
                        ISimpleLineSymbol pSimpleFillSymb = pSourceClone.Clone() as ISimpleLineSymbol;
                        pUniquerender.AddValue(strnode, "唯一值渲染", (ISymbol)pSimpleFillSymb);

                        ISimpleLineSymbol pNextSymbol = pUniquerender.get_Symbol(strnode) as ISimpleLineSymbol;
                        pNextSymbol.Color = coloru[treeadd.SelectedIndex];
                        pUniquerender.set_Symbol(strnode, (ISymbol)pNextSymbol);
                        DataRow rowu = dtable2.NewRow();
                        rowu[1] = strnode;
                        rowu[2] = strnode;
                        rowu[3] = cuntu[treeadd.SelectedIndex];
                        dtable2.Rows.Add(rowu);
                        gridviewu.Rows[gridviewu.Rows.Count - 2].Cells[0].Style.BackColor = ClsGDBDataCommon.IColorToColor(pNextSymbol.Color);
                    }
                    else
                    {
                        IClone pSourceClone = pPointSymbol as IClone;
                        ISimpleMarkerSymbol pSimpleFillSymb = pSourceClone.Clone() as ISimpleMarkerSymbol;
                        pUniquerender.AddValue(strnode, "唯一值渲染", (ISymbol)pSimpleFillSymb);

                        ISimpleMarkerSymbol pNextSymbol = pUniquerender.get_Symbol(strnode) as ISimpleMarkerSymbol;
                        pNextSymbol.Color = coloru[treeadd.SelectedIndex];
                        pUniquerender.set_Symbol(strnode, (ISymbol)pNextSymbol);
                        DataRow rowu = dtable2.NewRow();
                        rowu[1] = strnode;
                        rowu[2] = strnode;
                        rowu[3] = cuntu[treeadd.SelectedIndex];
                        dtable2.Rows.Add(rowu);
                        gridviewu.Rows[gridviewu.Rows.Count - 2].Cells[0].Style.BackColor = ClsGDBDataCommon.IColorToColor(pNextSymbol.Color);
                    }
                    addvx.Remove(addvx[treeadd.SelectedIndex]);
                    coloru.Remove(coloru[treeadd.SelectedIndex]);
                    countu.Add(cuntu[treeadd.SelectedIndex]);
                    cuntu.Remove(cuntu[treeadd.SelectedIndex]);
                    treeadd.Nodes[treeadd.SelectedIndex].Remove();
                    treeadd.SelectedNode  = null;
                    gridviewu.CurrentCell = null;
                }
            }
            else
            {
                if (treeadd.SelectedNode == null)
                {
                    MessageBox.Show("请选择要添加的值", "提示", MessageBoxButtons.OK);
                }
                else
                {
                    string strnode = "";
                    strnode = treeadd.SelectedNode.Text;
                    if (pFClass.ShapeType == esriGeometryType.esriGeometryPolygon)
                    {
                        IClone            pSourceClone    = pSimpleFillSymbol as IClone;
                        ISimpleFillSymbol pSimpleFillSymb = pSourceClone.Clone() as ISimpleFillSymbol;
                        pUniquerendermu.AddValue(strnode, "唯一值渲染", (ISymbol)pSimpleFillSymb);

                        ISimpleFillSymbol pNextSymbol = pUniquerendermu.get_Symbol(strnode) as ISimpleFillSymbol;
                        pNextSymbol.Color = colorumu[treeadd.SelectedIndex];
                        pUniquerendermu.set_Symbol(strnode, (ISymbol)pNextSymbol);
                        DataRow rowu = dtable3.NewRow();
                        rowu[1] = strnode;
                        rowu[2] = strnode;
                        rowu[3] = cuntumu[treeadd.SelectedIndex];
                        dtable3.Rows.Add(rowu);
                        gridviewmu.Rows[gridviewmu.Rows.Count - 2].Cells[0].Style.BackColor = ClsGDBDataCommon.IColorToColor(pNextSymbol.Color);
                    }
                    else if (pFClass.ShapeType == esriGeometryType.esriGeometryLine || pFClass.ShapeType == esriGeometryType.esriGeometryPolyline)
                    {
                        IClone            pSourceClone    = pLineSymbol as IClone;
                        ISimpleLineSymbol pSimpleFillSymb = pSourceClone.Clone() as ISimpleLineSymbol;
                        pUniquerendermu.AddValue(strnode, "唯一值渲染", (ISymbol)pSimpleFillSymb);

                        ISimpleLineSymbol pNextSymbol = pUniquerendermu.get_Symbol(strnode) as ISimpleLineSymbol;
                        pNextSymbol.Color = colorumu[treeadd.SelectedIndex];
                        pUniquerendermu.set_Symbol(strnode, (ISymbol)pNextSymbol);
                        DataRow rowu = dtable3.NewRow();
                        rowu[1] = strnode;
                        rowu[2] = strnode;
                        rowu[3] = cuntumu[treeadd.SelectedIndex];
                        dtable3.Rows.Add(rowu);
                        gridviewmu.Rows[gridviewmu.Rows.Count - 2].Cells[0].Style.BackColor = ClsGDBDataCommon.IColorToColor(pNextSymbol.Color);
                    }
                    else
                    {
                        IClone pSourceClone = pPointSymbol as IClone;
                        ISimpleMarkerSymbol pSimpleFillSymb = pSourceClone.Clone() as ISimpleMarkerSymbol;
                        pUniquerendermu.AddValue(strnode, "唯一值渲染", (ISymbol)pSimpleFillSymb);

                        ISimpleMarkerSymbol pNextSymbol = pUniquerendermu.get_Symbol(strnode) as ISimpleMarkerSymbol;
                        pNextSymbol.Color = colorumu[treeadd.SelectedIndex];
                        pUniquerendermu.set_Symbol(strnode, (ISymbol)pNextSymbol);
                        DataRow rowu = dtable3.NewRow();
                        rowu[1] = strnode;
                        rowu[2] = strnode;
                        rowu[3] = cuntumu[treeadd.SelectedIndex];
                        dtable3.Rows.Add(rowu);
                        gridviewmu.Rows[gridviewmu.Rows.Count - 2].Cells[0].Style.BackColor = ClsGDBDataCommon.IColorToColor(pNextSymbol.Color);
                    }
                    addvxmu.Remove(addvxmu[treeadd.SelectedIndex]);
                    colorumu.Remove(colorumu[treeadd.SelectedIndex]);
                    countumu.Add(cuntumu[treeadd.SelectedIndex]);
                    cuntumu.Remove(cuntumu[treeadd.SelectedIndex]);
                    treeadd.Nodes[treeadd.SelectedIndex].Remove();
                    treeadd.SelectedNode   = null;
                    gridviewmu.CurrentCell = null;
                }
            }
        }
Esempio n. 8
0
        private void FrmLabelDesign_Load(object sender, EventArgs e)
        {
            IGeoFeatureLayer geoFeatureLayer              = (IGeoFeatureLayer)pLayer;
            IAnnotateLayerPropertiesCollection  pAnnColl  = geoFeatureLayer.AnnotationProperties;
            IAnnotateLayerPropertiesCollection2 pAnnColl2 = (IAnnotateLayerPropertiesCollection2)pAnnColl;
            IAnnotateLayerProperties            pAnnProp  = pAnnColl2.get_Properties(0);
            ILabelEngineLayerProperties         pLable    = (ILabelEngineLayerProperties)pAnnProp;
            IBasicOverposterLayerProperties4    pBasic    = (IBasicOverposterLayerProperties4)pLable.BasicOverposterLayerProperties;

            //IPointPlacementPriorities pPlace = pBasic.PointPlacementPriorities;

            chklabel.Checked = pAnnProp.DisplayAnnotation;
            ITable  pTable  = (ITable)pLayer;
            IFields pFields = pTable.Fields;

            for (int i = 0; i < pFields.FieldCount; i++)
            {
                if (pFields.Field[i].Name != "Shape")
                {
                    cmbfields.Items.Add(pFields.Field[i].Name);
                }
            }
            //if (chklabel.Checked)
            //{
            //    cmbfields.Text = pLable.Expression;
            //}
            //else
            //{
            //    cmbfields.SelectedIndex = 0;
            //}
            cmbfields.Text = pLable.Expression;

            InstalledFontCollection pFontCollection = new InstalledFontCollection();

            FontFamily[] pFontFamily = pFontCollection.Families;
            for (int i = 0; i < pFontFamily.Length; i++)
            {
                string pFontName = pFontFamily[i].Name;
                this.cmbfont.Items.Add(pFontName);
            }

            //标注方向
            ILineLabelPosition pLineLabelPosition = pBasic.LineLabelPosition;

            if (pLineLabelPosition != null)
            {
                if (pLineLabelPosition.Horizontal)  //水平
                {
                    radioBtnHorizontal.Checked    = true;
                    radioBtnParallel.Checked      = false;
                    radioBtnPerpendicular.Checked = false;
                }
                if (pLineLabelPosition.Perpendicular)//垂直
                {
                    radioBtnHorizontal.Checked    = false;
                    radioBtnParallel.Checked      = false;
                    radioBtnPerpendicular.Checked = true;
                }
                if (pLineLabelPosition.Parallel)//平行
                {
                    radioBtnHorizontal.Checked    = false;
                    radioBtnParallel.Checked      = true;
                    radioBtnPerpendicular.Checked = false;
                }
            }

            if (pLable.Symbol != null)
            {
                pTextSymbol = pLable.Symbol;
                stdole.IFontDisp pFont = pTextSymbol.Font;
                symbolcolor.SelectedColor = ClsGDBDataCommon.IColorToColor(pTextSymbol.Color);
                //cmbfont.Text = pTextSymbol.Font.Name;
                for (int i = 0; i < cmbfont.Items.Count; i++)
                {
                    if (cmbfont.Items[i].ToString() == pTextSymbol.Font.Name)
                    {
                        cmbfont.SelectedIndex = i;
                    }
                }
                cmbsize.Text = pTextSymbol.Size.ToString();
                if (pFont.Bold == true)
                {
                    toolBtnBold.Checked = true;
                }
                else
                {
                    toolBtnBold.Checked = false;
                }
                if (pFont.Italic == true)
                {
                    toolBtnIntend.Checked = true;
                }
                else
                {
                    toolBtnIntend.Checked = false;
                }
                if (pFont.Underline == true)
                {
                    toolBtnUnderline.Checked = true;
                }
                else
                {
                    toolBtnUnderline.Checked = false;
                }
                if (pFont.Strikethrough == true)
                {
                    toolBtnStrikethrough.Checked = true;
                }
                else
                {
                    toolBtnStrikethrough.Checked = false;
                }
            }
            else
            {
                symbolcolor.SelectedColor = Color.Black;
                cmbfont.SelectedIndex     = cmbfont.Items.Count - 9;
                cmbsize.Text                 = "8";
                toolBtnBold.Checked          = false;
                toolBtnIntend.Checked        = false;
                toolBtnUnderline.Checked     = false;
                toolBtnStrikethrough.Checked = false;
            }
        }
Esempio n. 9
0
        /// <summary>
        /// 标注符号
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnsymbol_Click(object sender, EventArgs e)
        {
            FrmTextSymbol frmtext = new FrmTextSymbol();

            frmtext.StartPosition = FormStartPosition.CenterScreen;
            frmtext.ShowInTaskbar = false;
            frmtext.ShowDialog();
            pTextSymbol = frmtext.GetTextSymbol();
            if (pTextSymbol != null)
            {
                stdole.IFontDisp pFont = pTextSymbol.Font;
                symbolcolor.SelectedColor = ClsGDBDataCommon.IColorToColor(pTextSymbol.Color);
                //cmbfont.Text = pTextSymbol.Font.Name;
                for (int i = 0; i < cmbfont.Items.Count; i++)
                {
                    if (cmbfont.Items[i].ToString() == pTextSymbol.Font.Name)
                    {
                        cmbfont.SelectedIndex = i;
                    }
                }
                cmbsize.Text = pTextSymbol.Size.ToString();
                if (pFont.Bold == true)
                {
                    toolBtnBold.Checked = true;
                }
                else
                {
                    toolBtnBold.Checked = false;
                }
                if (pFont.Italic == true)
                {
                    toolBtnIntend.Checked = true;
                }
                else
                {
                    toolBtnIntend.Checked = false;
                }
                if (pFont.Underline == true)
                {
                    toolBtnUnderline.Checked = true;
                }
                else
                {
                    toolBtnUnderline.Checked = false;
                }
                if (pFont.Strikethrough == true)
                {
                    toolBtnStrikethrough.Checked = true;
                }
                else
                {
                    toolBtnStrikethrough.Checked = false;
                }
            }
            else
            {
                IFontDisp pFont = new StdFontClass() as IFontDisp;
                pTextSymbol.Color   = ClsGDBDataCommon.ColorToIColor(symbolcolor.SelectedColor);
                pFont.Bold          = toolBtnBold.Checked;
                pFont.Italic        = toolBtnIntend.Checked;
                pFont.Strikethrough = toolBtnStrikethrough.Checked;
                pFont.Underline     = toolBtnUnderline.Checked;
                pFont.Name          = cmbfont.Text;
                pFont.Size          = decimal.Parse(cmbsize.Text);
                pTextSymbol.Font    = pFont;
            }
        }