コード例 #1
0
        //创建字体
        private void CreateTextSymbol()
        {
            if (pStyleGalleryItem == null)
            {
                MessageBox.Show("请选择指北针样式", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return;
            }

            pTextSymbol = pStyleGalleryItem.Item as ITextSymbol;

            //颜色
            if (FontColor.SelectedColor != null)
            {
                pTextSymbol.Color = ClsGDBDataCommon.ColorToIColor(FontColor.SelectedColor);;
            }

            //大小
            string pFontString = double.Parse(FontSize.Text).ToString();

            pFont.Size = decimal.Parse(pFontString);

            //字体、
            pFont.Name = this.cmbBoxFontName.Text;

            //风格
            if (toolBtnBold.Checked == true)
            {
                pFont.Bold = true;
            }
            else
            {
                pFont.Bold = false;
            }
            if (toolBtnIntend.Checked == true)
            {
                pFont.Italic = true;
            }
            else
            {
                pFont.Italic = false;
            }
            if (toolBtnUnderline.Checked == true)
            {
                pFont.Underline = true;
            }
            else
            {
                pFont.Underline = false;
            }
            if (toolBtnStrikethrough.Checked == true)
            {
                pFont.Strikethrough = true;
            }
            else
            {
                pFont.Strikethrough = false;
            }

            pTextSymbol.Font = pFont;
        }
コード例 #2
0
 //颜色
 private void colorNorthArrow_SelectedColorChanged(object sender, EventArgs e)
 {
     if (m_pNorthArrow != null)
     {
         m_pNorthArrow.Color = ClsGDBDataCommon.ColorToIColor(colorNorthArrow.SelectedColor);
         m_hookHelper.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGeography, null, null);
     }
 }
コード例 #3
0
ファイル: FrmEditLine.cs プロジェクト: eglrp/TESTPROJECT-1
        //创建点状线
        private IMarkerLineSymbol CreateMarkerLineSymbol()
        {
            IMarkerLineSymbol pMarkerLS = new MarkerLineSymbol();

            //样式
            if (pMarkerSymbol != null)
            {
                pMarkerLS.MarkerSymbol = pMarkerSymbol;
            }

            ICartographicLineSymbol pCartographicLS = pMarkerLS as ICartographicLineSymbol;

            //颜色
            if (colorCartographicLine.SelectedColor != Color.Empty)
            {
                pCartographicLS.Color = ClsGDBDataCommon.ColorToIColor(colorCartographicLine.SelectedColor);
            }
            else
            {
                pCartographicLS.Color = ClsGDBDataCommon.ColorToIColor(Color.Black);
                colorCartographicLine.SelectedColor = Color.Black;
            }
            //宽度
            pCartographicLS.Width = double.Parse(widthCartographicLine.Text);

            //端点样式
            if (rbCatButt.Checked == true)
            {
                pCartographicLS.Cap = esriLineCapStyle.esriLCSButt;
            }
            else if (rbCatRoundC.Checked == true)
            {
                pCartographicLS.Cap = esriLineCapStyle.esriLCSRound;
            }
            else if (rbCatSquare.Checked == true)
            {
                pCartographicLS.Cap = esriLineCapStyle.esriLCSSquare;
            }

            //节点样式
            if (rbCatMitre.Checked == true)
            {
                pCartographicLS.Join = esriLineJoinStyle.esriLJSMitre;
            }
            else if (rbCatRoundJ.Checked == true)
            {
                pCartographicLS.Join = esriLineJoinStyle.esriLJSRound;
            }
            else if (rbCatBevel.Checked == true)
            {
                pCartographicLS.Join = esriLineJoinStyle.esriLJSBevel;
            }

            //端点箭头样式
            ILineDecorationElement pLineDecorationElement = new SimpleLineDecorationElement();

            return(pMarkerLS);
        }
コード例 #4
0
 //设置颜色变化
 private void FontColor_SelectedColorChanged(object sender, EventArgs e)
 {
     if (pStyleGalleryItem == null)
     {
         MessageBox.Show("请选择字体样式", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
         return;
     }
     pTextSymbol       = pStyleGalleryItem.Item as ITextSymbol;
     pTextSymbol.Color = ClsGDBDataCommon.ColorToIColor(FontColor.SelectedColor);;
     PreviewImage();
 }
コード例 #5
0
        //填充颜色设置
        private void colorFill_SelectedColorChanged(object sender, EventArgs e)
        {
            if (pStyleGalleryItem != null)
            {
                SymbolBackground = pStyleGalleryItem.Item as ISymbolBackground;
                IFillSymbol pFS = SymbolBackground.FillSymbol;
                pFS.Color = ClsGDBDataCommon.ColorToIColor(colorFill.SelectedColor);

                SymbolBackground.FillSymbol = pFS;
                PreviewImage();
            }
        }
コード例 #6
0
ファイル: FrmFrameBorder.cs プロジェクト: eglrp/TESTPROJECT-1
        //边框颜色
        private void colorBorder_SelectedColorChanged(object sender, EventArgs e)
        {
            if (pStyleGalleryItem != null)
            {
                SymbolBorder = (ISymbolBorder)pStyleGalleryItem.Item;
                ILineSymbol pLS = SymbolBorder.LineSymbol;

                pLS.Color = ClsGDBDataCommon.ColorToIColor(colorBorder.SelectedColor);
                SymbolBorder.LineSymbol = pLS;
                PreviewImage();
            }
        }
コード例 #7
0
ファイル: FrmSymbolPoint.cs プロジェクト: eglrp/TESTPROJECT-1
        private IPictureMarkerSymbol creatpicpoint(double size, double xoffset, double yoffset, double angle, Color backcolor, string picfile)
        {
            IPictureMarkerSymbol pictureMarkerSymbol = new PictureMarkerSymbolClass();

            pictureMarkerSymbol.CreateMarkerSymbolFromFile(esriIPictureType.esriIPictureBitmap, picfile);
            pictureMarkerSymbol.Size            = size;
            pictureMarkerSymbol.Angle           = angle;
            pictureMarkerSymbol.XOffset         = xoffset;
            pictureMarkerSymbol.YOffset         = yoffset;
            pictureMarkerSymbol.BackgroundColor = ClsGDBDataCommon.ColorToIColor(backcolor);
            return(pictureMarkerSymbol);
        }
コード例 #8
0
ファイル: FrmNorthArrow.cs プロジェクト: eglrp/TESTPROJECT-1
        //颜色设置
        private void colorNorthArrow_SelectedColorChanged(object sender, EventArgs e)
        {
            if (m_pStyleGalleryItem == null)
            {
                MessageBox.Show("请选择指北针样式", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return;
            }

            INorthArrow pNorthArrow = m_pStyleGalleryItem.Item as INorthArrow;

            pNorthArrow.Color = ClsGDBDataCommon.ColorToIColor(colorNorthArrow.SelectedColor);
            PreviewImage();
        }
コード例 #9
0
        //面 设计
        private void colorPolygon_SelectedColorChanged(object sender, EventArgs e)
        {
            if (pStyleGalleryItem == null)
            {
                MessageBox.Show("请选择面样式", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return;
            }

            IFillSymbol pFillSymbol = pStyleGalleryItem.Item as IFillSymbol;

            pFillSymbol.Color = ClsGDBDataCommon.ColorToIColor(colorPolygon.SelectedColor);;
            PreviewImage();
        }
コード例 #10
0
ファイル: FrmAddText.cs プロジェクト: eglrp/TESTPROJECT-1
        private void updateFromUI()
        {
            ITextSymbol pTmpTextSymbol = new TextSymbolClass();

            //字体
            IFontDisp pFont = new StdFontClass() as IFontDisp;

            pFont.Name          = this.cmbBoxFontName.Text;
            pFont.Size          = decimal.Parse(this.FontSize.Text);
            pFont.Bold          = this.toolBtnBold.Checked;
            pFont.Italic        = this.toolBtnIntend.Checked;
            pFont.Underline     = this.toolBtnUnderline.Checked;
            pFont.Strikethrough = this.toolBtnStrikethrough.Checked;
            pTmpTextSymbol.Font = pFont;

            //颜色
            if (this.FontColor.SelectedColor != null)
            {
                pTmpTextSymbol.Color = ClsGDBDataCommon.ColorToIColor(FontColor.SelectedColor);
            }

            //角度
            pTmpTextSymbol.Angle = double.Parse(this.TextAngle.Text);

            //字体对齐方式
            if (this.toolBtnLeft.Checked == true)
            {
                pTmpTextSymbol.HorizontalAlignment = esriTextHorizontalAlignment.esriTHALeft;
            }
            else if (this.toolBtnCenter.Checked == true)
            {
                pTmpTextSymbol.HorizontalAlignment = esriTextHorizontalAlignment.esriTHACenter;
            }
            else if (this.toolBtnRight.Checked == true)
            {
                pTmpTextSymbol.HorizontalAlignment = esriTextHorizontalAlignment.esriTHARight;
            }
            else if (this.toolBtnBoth.Checked == true)
            {
                pTmpTextSymbol.HorizontalAlignment = esriTextHorizontalAlignment.esriTHAFull;
            }

            //字符间距、行间距
            IFormattedTextSymbol pFormattedTextSymbol = pTmpTextSymbol as IFormattedTextSymbol;

            pFormattedTextSymbol.CharacterSpacing = dbiCharSpacing.Value;
            pFormattedTextSymbol.Leading          = dbiLineLeading.Value;

            pTextElement.Symbol = pTmpTextSymbol;
            pTextElement.Text   = this.txtAddText.Text;
        }
コード例 #11
0
        //阴影边线颜色设计
        private void colorOutline_SelectedColorChanged(object sender, EventArgs e)
        {
            if (pStyleGalleryItem != null)
            {
                SymbolShadow = pStyleGalleryItem.Item as ISymbolShadow;
                IFillSymbol pFS = SymbolShadow.FillSymbol as IFillSymbol;
                ILineSymbol pLS = pFS.Outline as ILineSymbol;

                pLS.Color               = ClsGDBDataCommon.ColorToIColor(colorOutline.SelectedColor);
                pFS.Outline             = pLS;
                SymbolShadow.FillSymbol = pFS;
                PreviewImage();
            }
        }
コード例 #12
0
ファイル: FrmSymbolPoint.cs プロジェクト: eglrp/TESTPROJECT-1
        private IArrowMarkerSymbol creatarrowpoint(Color color, double length, double width, double angle, double xoffset, double yoffset)
        {
            IArrowMarkerSymbol arrowMarkerSymbol = new ArrowMarkerSymbolClass();

            arrowMarkerSymbol.Color   = ClsGDBDataCommon.ColorToIColor(color);
            arrowMarkerSymbol.Length  = length;
            arrowMarkerSymbol.Width   = width;
            arrowMarkerSymbol.Angle   = angle;
            arrowMarkerSymbol.XOffset = xoffset;
            arrowMarkerSymbol.YOffset = yoffset;


            return(arrowMarkerSymbol);
        }
コード例 #13
0
ファイル: FrmEditLine.cs プロジェクト: eglrp/TESTPROJECT-1
        //创建简单线
        private ISimpleLineSymbol CreateSimpleLineSymbol()
        {
            ISimpleLineSymbol pSimpleLS = new SimpleLineSymbolClass();

            //颜色
            if (colorSimpleLine.SelectedColor != Color.Empty)
            {
                pSimpleLS.Color = ClsGDBDataCommon.ColorToIColor(colorSimpleLine.SelectedColor);
            }
            else
            {
                pSimpleLS.Color = ClsGDBDataCommon.ColorToIColor(Color.Black);
                colorSimpleLine.SelectedColor = Color.Black;
            }

            //样式
            switch (cboBoxSimpleLineStyle.SelectedItem.ToString())
            {
            case "Solid":
                pSimpleLS.Style = esriSimpleLineStyle.esriSLSSolid;
                break;

            case "Dashed":
                pSimpleLS.Style = esriSimpleLineStyle.esriSLSDash;
                break;

            case "Dotted":
                pSimpleLS.Style = esriSimpleLineStyle.esriSLSDot;
                break;

            case "Dash-Dot":
                pSimpleLS.Style = esriSimpleLineStyle.esriSLSDashDot;
                break;

            case "Dash-Dot-Dot":
                pSimpleLS.Style = esriSimpleLineStyle.esriSLSDashDotDot;
                break;

            case "null":
                pSimpleLS.Style = esriSimpleLineStyle.esriSLSNull;
                break;
            }

            //宽度
            pSimpleLS.Width = double.Parse(widthsimpleLine.Text);

            return(pSimpleLS);
        }
コード例 #14
0
ファイル: FrmSymbol.cs プロジェクト: eglrp/TESTPROJECT-1
        //点 设计
        private void colorPoint_SelectedColorChanged(object sender, EventArgs e)
        {
            if (pStyleGalleryItem == null)
            {
                MessageBox.Show("请选择点样式", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return;
            }

            IMarkerSymbol pMarkerSymbol = pStyleGalleryItem.Item as IMarkerSymbol;

            if (!(pMarkerSymbol is IPictureMarkerSymbol))
            {
                pMarkerSymbol.Color = ClsGDBDataCommon.ColorToIColor(colorPoint.SelectedColor);
            }
            PreviewImage();
        }
コード例 #15
0
ファイル: FrmSymbol.cs プロジェクト: eglrp/TESTPROJECT-1
        private void colorOutLine_SelectedColorChanged(object sender, EventArgs e)
        {
            if (pStyleGalleryItem == null)
            {
                MessageBox.Show("请选择面样式", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return;
            }

            IFillSymbol pFillSymbol = pStyleGalleryItem.Item as IFillSymbol;

            if (!(pFillSymbol is IPictureFillSymbol))
            {
                ILineSymbol pLineSymbol = pFillSymbol.Outline;
                pLineSymbol.Color   = ClsGDBDataCommon.ColorToIColor(colorOutLine.SelectedColor);
                pFillSymbol.Outline = pLineSymbol;
            }
            PreviewImage();
        }
コード例 #16
0
/**
 * @fn  CreateCalibratedMapGridBorder
 * @date 2013.03.16
 * @author Ge Xizhi
 * @brief 创建整饰边框
 * @param 零个参数
 * @retval 无返回值
 */
        private void CreateCalibratedMapGridBorder()
        {
            CalibratedMapGridBorder = new CalibratedMapGridBorderClass();

            //Set ICalibratedMapGridBorder properties

            CalibratedMapGridBorder.BackgroundColor = ClsGDBDataCommon.ColorToIColor(BackgroundColor.SelectedColor);
            CalibratedMapGridBorder.ForegroundColor = ClsGDBDataCommon.ColorToIColor(ForegroundColor.SelectedColor);;

            CalibratedMapGridBorder.BorderWidth = double.Parse(BorderWith.Text);
            CalibratedMapGridBorder.Interval    = double.Parse(BorderInterval.Text);

            if (ckBoxAlternating.Checked == true)
            {
                CalibratedMapGridBorder.Alternating = true;
            }
            else
            {
                CalibratedMapGridBorder.Alternating = false;
            }
        }
コード例 #17
0
ファイル: FrmSymbolPoint.cs プロジェクト: eglrp/TESTPROJECT-1
        private ISimpleMarkerSymbol creatsimpoint(Color color, esriSimpleMarkerStyle style, double size, double angle, double xoffset, double yoffset, Color outcolor, double outsize)
        {
            ISimpleMarkerSymbol pSimSymbol = new SimpleMarkerSymbolClass();

            pSimSymbol.Color   = ClsGDBDataCommon.ColorToIColor(color);
            pSimSymbol.Style   = style;
            pSimSymbol.Size    = size;
            pSimSymbol.Angle   = angle;
            pSimSymbol.XOffset = xoffset;
            pSimSymbol.YOffset = yoffset;

            if (checkBoxX1.Checked == true)
            {
                pSimSymbol.Outline      = true;
                pSimSymbol.OutlineColor = ClsGDBDataCommon.ColorToIColor(outcolor);
                pSimSymbol.OutlineSize  = outsize;
            }
            else
            {
                pSimSymbol.Outline = false;
            }

            return(pSimSymbol);
        }
コード例 #18
0
        private void btnuse_Click(object sender, EventArgs e)
        {
            if (treeshow.SelectedIndex == 1)
            {
                IRasterRGBRenderer2 pRRGBRenderUse = new RasterRGBRendererClass();
                if ((bool)gridsymbol.Rows[0].Cells[0].Value == true)
                {
                    pRRGBRenderUse.UseRedBand = true;
                }
                else
                {
                    pRRGBRenderUse.UseRedBand = false;
                }

                if ((bool)gridsymbol.Rows[1].Cells[0].Value == true)
                {
                    pRRGBRenderUse.UseGreenBand = true;
                }
                else
                {
                    pRRGBRenderUse.UseGreenBand = false;
                }
                if ((bool)gridsymbol.Rows[2].Cells[0].Value == true)
                {
                    pRRGBRenderUse.UseBlueBand = true;
                }
                else
                {
                    pRRGBRenderUse.UseBlueBand = false;
                }
                if ((bool)gridsymbol.Rows[3].Cells[0].Value == true)
                {
                    pRRGBRenderUse.UseAlphaBand = true;
                }
                else
                {
                    pRRGBRenderUse.UseAlphaBand = false;
                }

                pRRGBRenderUse.RedBandIndex   = cmbred.SelectedIndex;
                pRRGBRenderUse.GreenBandIndex = cmbgreen.SelectedIndex;
                pRRGBRenderUse.BlueBandIndex  = cmbblue.SelectedIndex;
                pRRGBRenderUse.AlphaBandIndex = cmbalpha.SelectedIndex;

                pRLayer.Renderer = (IRasterRenderer)pRRGBRenderUse;
            }
            else
            {
                if (pRStretch.StretchType == esriRasterStretchTypesEnum.esriRasterStretch_MinimumMaximum)
                {
                    if (txtmin.Text == "" && txtmax.Text != "")
                    {
                        MessageBox.Show("请设置拉伸的最小值", "提示", MessageBoxButtons.OK);
                    }
                    else if (txtmax.Text == "" && txtmin.Text != "")
                    {
                        MessageBox.Show("请设置拉伸的最大值", "提示", MessageBoxButtons.OK);
                    }
                    else if (txtmax.Text == "" && txtmin.Text == "")
                    {
                        MessageBox.Show("请设置拉伸的最大值以及最小值", "提示", MessageBoxButtons.OK);
                    }
                    else
                    {
                        pRasterStretchMinMax = (IRasterStretchMinMax)pRStretch;
                        pRasterStretchMinMax.UseCustomStretchMinMax = true;
                        pRasterStretchMinMax.CustomStretchMin       = double.Parse(txtmin.Text);
                        pRasterStretchMinMax.CustomStretchMax       = double.Parse(txtmax.Text);
                        pRStretch             = (IRasterStretch)pRasterStretchMinMax;
                        pRStretch.StretchType = esriRasterStretchTypesEnum.esriRasterStretch_MinimumMaximum;
                    }
                }

                if (chkdisplay.Checked == true)
                {
                    pRStretch.Background      = true;
                    pRStretch.BackgroundColor = ClsGDBDataCommon.ColorToIColor(colbackg.SelectedColor);
                    pRStretch.set_BackgroundValues(Convert.ToDouble(backvalue.Text));
                }
                else
                {
                    pRStretch.Background = false;
                }

                IRasterStretchColorRampRenderer pStretchColorRasterRenderer = (IRasterStretchColorRampRenderer)pRStretch;;
                IRasterRenderer pRasterRenderer = pStretchColorRasterRenderer as IRasterRenderer;
                pRasterRenderer.Raster = pRLayer.Raster;
                pRasterRenderer.Update();

                pStretchColorRasterRenderer.BandIndex = cmbBand.SelectedIndex;
                pStretchColorRasterRenderer.ColorRamp = PColorramp as IColorRamp;
                pRasterRenderer.Update();
                pRLayer.Renderer = pStretchColorRasterRenderer as IRasterRenderer;
            }


            if (pTocContral.Buddy == pMapContral.Object)
            {
                pTocContral.SetBuddyControl(pMapContral);
                pMapContral.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGeography, null, null);
                pTocContral.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGeography, null, null);
            }
            else if (pTocContral.Buddy.Equals(pSceneControl.Object))
            {
                pTocContral.SetBuddyControl(pSceneControl);
                IActiveView pActiveView = pSceneControl.Scene as IActiveView;
                pActiveView.PartialRefresh(esriViewDrawPhase.esriViewGeography, pRLayer, null);
                pTocContral.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGeography, null, null);
            }
        }
コード例 #19
0
        //设计比例尺属性
        private void CreateScaleBar()
        {
            //格数设计
            string pOriDiv = double.Parse(DivisionNum.Text).ToString();

            ScaleBar.Divisions = short.Parse(pOriDiv);
            string pOriSubDiv = double.Parse(SubDivisionNum.Text).ToString();

            ScaleBar.Subdivisions = short.Parse(pOriSubDiv);

            //单位设计
            if (coboBoxUnits.SelectedItem != null)
            {
                if (coboBoxUnits.SelectedItem.ToString() == "Centimeters")
                {
                    ScaleBar.Units = esriUnits.esriCentimeters;
                }
                else if (coboBoxUnits.SelectedItem.ToString() == "DecimalDegrees")
                {
                    ScaleBar.Units = esriUnits.esriDecimalDegrees;
                }
                else if (coboBoxUnits.SelectedItem.ToString() == "Decimeters")
                {
                    ScaleBar.Units = esriUnits.esriDecimeters;
                }
                else if (coboBoxUnits.SelectedItem.ToString() == "Feet")
                {
                    ScaleBar.Units = esriUnits.esriFeet;
                }
                else if (coboBoxUnits.SelectedItem.ToString() == "Inches")
                {
                    ScaleBar.Units = esriUnits.esriInches;
                }
                else if (coboBoxUnits.SelectedItem.ToString() == "Kilometers")
                {
                    ScaleBar.Units = esriUnits.esriKilometers;
                }
                else if (coboBoxUnits.SelectedItem.ToString() == "Meters")
                {
                    ScaleBar.Units = esriUnits.esriMeters;
                }
                else if (coboBoxUnits.SelectedItem.ToString() == "Miles")
                {
                    ScaleBar.Units = esriUnits.esriMiles;
                }
                else if (coboBoxUnits.SelectedItem.ToString() == "Millimeters")
                {
                    ScaleBar.Units = esriUnits.esriMillimeters;
                }
                else if (coboBoxUnits.SelectedItem.ToString() == "NauticalMiles")
                {
                    ScaleBar.Units = esriUnits.esriNauticalMiles;
                }
                else if (coboBoxUnits.SelectedItem.ToString() == "Points")
                {
                    ScaleBar.Units = esriUnits.esriPoints;
                }
                else if (coboBoxUnits.SelectedItem.ToString() == "UnitsLast")
                {
                    ScaleBar.Units = esriUnits.esriUnitsLast;
                }
                else if (coboBoxUnits.SelectedItem.ToString() == "UnknownUnits")
                {
                    ScaleBar.Units = esriUnits.esriUnknownUnits;
                }
                else if (coboBoxUnits.SelectedItem.ToString() == "Yards")
                {
                    ScaleBar.Units = esriUnits.esriYards;
                }
            }
            else
            {
                ScaleBar.Units = esriUnits.esriUnknownUnits;
            }

            //比例尺单位标签
            ScaleBar.UnitLabel = txtUnitsLabel.Text;

            //单位标签样式
            if (UnitsLabelSymbols != null)
            {
                ScaleBar.UnitLabelSymbol = UnitsLabelSymbols;
            }
            //单位标签位置
            if (coboBoxPos.SelectedItem.ToString() == "After Bar")
            {
                ScaleBar.UnitLabelPosition = esriScaleBarPos.esriScaleBarAfterBar;
            }
            else if (coboBoxPos.SelectedItem.ToString() == "Above Bar")
            {
                ScaleBar.UnitLabelPosition = esriScaleBarPos.esriScaleBarAbove;
            }
            else if (coboBoxPos.SelectedItem.ToString() == "After Labels")
            {
                ScaleBar.UnitLabelPosition = esriScaleBarPos.esriScaleBarAfterLabels;
            }
            else if (coboBoxPos.SelectedItem.ToString() == "Before Bar")
            {
                ScaleBar.UnitLabelPosition = esriScaleBarPos.esriScaleBarBeforeBar;
            }
            else if (coboBoxPos.SelectedItem.ToString() == "Before Labels")
            {
                ScaleBar.UnitLabelPosition = esriScaleBarPos.esriScaleBarBeforeLabels;
            }
            else if (coboBoxPos.SelectedItem.ToString() == "Below Bar")
            {
                ScaleBar.UnitLabelPosition = esriScaleBarPos.esriScaleBarBelow;
            }
            //单位标签间隔
            ScaleBar.UnitLabelGap = double.Parse(UnitsGap.Text);

            //频率设置
            if (cbBoxFrequency.SelectedItem.ToString() == "Divisions And First Mid point")
            {
                ScaleBar.LabelFrequency = esriScaleBarFrequency.esriScaleBarDivisionsAndFirstMidpoint;
            }
            else if (cbBoxFrequency.SelectedItem.ToString() == "Divisions")
            {
                ScaleBar.LabelFrequency = esriScaleBarFrequency.esriScaleBarDivisions;
            }
            else if (cbBoxFrequency.SelectedItem.ToString() == "Divisions And First Subdivisions")
            {
                ScaleBar.LabelFrequency = esriScaleBarFrequency.esriScaleBarDivisionsAndFirstSubdivisions;
            }
            else if (cbBoxFrequency.SelectedItem.ToString() == "Divisions And Subdivisions")
            {
                ScaleBar.LabelFrequency = esriScaleBarFrequency.esriScaleBarDivisionsAndSubdivisions;
            }
            else if (cbBoxFrequency.SelectedItem.ToString() == "ends(and zero)")
            {
                ScaleBar.LabelFrequency = esriScaleBarFrequency.esriScaleBarMajorDivisions;
            }
            else if (cbBoxFrequency.SelectedItem.ToString() == "no labels")
            {
                ScaleBar.LabelFrequency = esriScaleBarFrequency.esriScaleBarNone;
            }
            else if (cbBoxFrequency.SelectedItem.ToString() == "single labels")
            {
                ScaleBar.LabelFrequency = esriScaleBarFrequency.esriScaleBarOne;
            }
            //位置设计
            if (cbBoxPostion.SelectedItem.ToString() == "Above Bar")
            {
                ScaleBar.LabelPosition = esriVertPosEnum.esriAbove;
            }
            else if (cbBoxPostion.SelectedItem.ToString() == "Below bar")
            {
                ScaleBar.LabelPosition = esriVertPosEnum.esriBelow;
            }
            else if (cbBoxPostion.SelectedItem.ToString() == "Align to bottom of bar")
            {
                ScaleBar.LabelPosition = esriVertPosEnum.esriBottom;
            }
            else if (cbBoxPostion.SelectedItem.ToString() == "Center on bar")
            {
                ScaleBar.LabelPosition = esriVertPosEnum.esriOn;
            }
            else if (cbBoxPostion.SelectedItem.ToString() == "Align to top of bar")
            {
                ScaleBar.LabelPosition = esriVertPosEnum.esriTop;
            }
            //间隔设计
            ScaleBar.LabelGap = double.Parse(FrequencyGap.Text);

            //标注样式
            if (FrequencyLabelSymbols != null)
            {
                ScaleBar.LabelSymbol = FrequencyLabelSymbols;
            }

            //比例尺Bar大小、颜色设计
            //大小
            ScaleBar.BarHeight = double.Parse(BarsSize.Text);
            //颜色
            if (colorBar.SelectedColor != null)
            {
                ScaleBar.BarColor = ClsGDBDataCommon.ColorToIColor(colorBar.SelectedColor);
            }
            else
            {
                return;
            }

            //设置边框、阴影、背景的距离和圆角
            if (SymbolBorder != null)
            {
                if (this.txtBorderGap.Text != null)
                {
                    SymbolBorder.Gap = double.Parse(this.txtBorderGap.Text);
                }
                if (txtBorderAngle.Text != null)
                {
                    SymbolBorder.CornerRounding = short.Parse(this.txtBorderAngle.Text);
                }
            }
            if (SymbolBackground != null)
            {
                if (txtBackgroundGap.Text != null)
                {
                    SymbolBackground.Gap = double.Parse(this.txtBackgroundGap.Text);
                }
                if (txtBackgroundAngle.Text != null)
                {
                    SymbolBackground.CornerRounding = short.Parse(this.txtBackgroundAngle.Text);
                }
            }
            if (SymbolShadow != null)
            {
                if (txtShadowX.Text != null)
                {
                    SymbolShadow.HorizontalSpacing = double.Parse(this.txtShadowX.Text);
                }
                if (txtShadowY.Text != null)
                {
                    SymbolShadow.VerticalSpacing = double.Parse(this.txtShadowY.Text);
                }
                if (txtShadowAngle.Text != null)
                {
                    SymbolShadow.CornerRounding = short.Parse(this.txtShadowAngle.Text);
                }
            }
            //添加边框、背景、阴影
            IFrameProperties pFrameProperties = pMapSurroundFrame as IFrameProperties;

            if (SymbolBorder != null)
            {
                pFrameProperties.Border = SymbolBorder;
            }
            if (SymbolBackground != null)
            {
                pFrameProperties.Background = SymbolBackground;
            }
            if (SymbolShadow != null)
            {
                pFrameProperties.Shadow = SymbolShadow;
            }
        }
コード例 #20
0
ファイル: FrmSymboloTin.cs プロジェクト: eglrp/TESTPROJECT-1
        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();
                        }
                    }
                }
            }
        }
コード例 #21
0
ファイル: FrmVertor.cs プロジェクト: eglrp/TESTPROJECT-1
        private void btn3D_Click(object sender, EventArgs e)
        {
            try
            {
                IGraphicsContainer3D graphicsContainer3D = pSceneControl.Scene.ActiveGraphicsLayer as IGraphicsContainer3D;
                graphicsContainer3D.DeleteAllElements();
                pSceneControl.Scene.SceneGraph.RefreshViewers();
                //屏幕大小
                double PageX    = pSceneControl.SceneGraph.Extent.Envelope.XMax;
                double PageY    = pSceneControl.SceneGraph.Extent.Envelope.YMax;
                double PageZ    = pSceneControl.SceneGraph.Extent.Envelope.ZMax;
                double PageXmin = pSceneControl.SceneGraph.Extent.Envelope.XMin;

                double pMarkerSize = (PageX - PageXmin) / 10;

                IMarkerElement pMarkerElement = new MarkerElementClass();
                //正北方向
                IMarker3DSymbol pMarker3DSymbolNorth = new Marker3DSymbolClass();
                string          NorthPath            = ClsGDBDataCommon.GetParentPathofExe() + @"Resource\BMP\NorthArrow.3DS";
                pMarker3DSymbolNorth.CreateFromFile(NorthPath);
                IMarker3DPlacement pMarker3DPlacement = pMarker3DSymbolNorth as IMarker3DPlacement;

                pMarker3DPlacement.Size = pMarkerSize;
                pMarker3DPlacement.SetRotationAngles(-90, 0, 0);

                //IRgbColor pRgbColorNorth = new RgbColorClass();
                //pRgbColorNorth.Red = Color.Black.R;
                //pRgbColorNorth.Green = Color.Black.G;
                //pRgbColorNorth.Blue = Color.Black.B;
                pMarker3DPlacement.Color = ClsGDBDataCommon.ColorToIColor(Color.Black);

                //太阳方向
                IMarker3DSymbol pMarker3DSymbolSun = new Marker3DSymbolClass();
                string          SunPath            = ClsGDBDataCommon.GetParentPathofExe() + @"Resource\BMP\SunArrow.3DS";
                pMarker3DSymbolSun.CreateFromFile(SunPath);
                IMarker3DPlacement pMarker3DPlacement1 = pMarker3DSymbolSun as IMarker3DPlacement;
                pMarker3DPlacement1.Size = pMarkerSize;
                double SunAngleX = SunIncli.Value - 90;
                double SunAngleY = 0;
                double SunAngleZ = 0 - SunAzimuth.Value;
                pMarker3DPlacement1.SetRotationAngles(SunAngleX, SunAngleY, SunAngleZ);

                //IRgbColor pRgbColorSun = new RgbColorClass();
                //pRgbColorSun.Red = Color.Red.R;
                //pRgbColorSun.Green = Color.Red.G;
                //pRgbColorSun.Blue = Color.Red.B;
                pMarker3DPlacement1.Color = ClsGDBDataCommon.ColorToIColor(Color.Red);

                //地球方向
                IMarker3DSymbol pMarker3DSymbolEarth = new Marker3DSymbolClass();
                string          EarthPath            = ClsGDBDataCommon.GetParentPathofExe() + @"Resource\BMP\EarthArrow.3DS";
                pMarker3DSymbolEarth.CreateFromFile(EarthPath);
                IMarker3DPlacement pMarker3DPlacement2 = pMarker3DSymbolEarth as IMarker3DPlacement;
                pMarker3DPlacement2.Size = pMarkerSize;

                double EarthAngleX = EarIncli.Value - 90;
                double EarthAngleY = 0;
                double EarthAngleZ = 0 - EarAzimuth.Value;
                pMarker3DPlacement2.SetRotationAngles(EarthAngleX, EarthAngleY, EarthAngleZ);

                //IRgbColor pRgbColorEarth = new RgbColorClass();
                //pRgbColorEarth.Red = Color.BlueViolet.R;
                //pRgbColorEarth.Green = Color.BlueViolet.G;
                //pRgbColorEarth.Blue = Color.BlueViolet.B;
                pMarker3DPlacement2.Color = ClsGDBDataCommon.ColorToIColor(Color.BlueViolet);

                //合并成一个整体
                IMultiLayerMarkerSymbol pMultiLayerMarkerSymbol = new MultiLayerMarkerSymbolClass();
                pMultiLayerMarkerSymbol.AddLayer(pMarker3DSymbolNorth as IMarkerSymbol);
                pMultiLayerMarkerSymbol.AddLayer(pMarker3DSymbolSun as IMarkerSymbol);
                pMultiLayerMarkerSymbol.AddLayer(pMarker3DSymbolEarth as IMarkerSymbol);

                pMarkerElement.Symbol = pMultiLayerMarkerSymbol;
                IElement pElement = pMarkerElement as IElement;

                //确定添加位置
                IPoint pPoint = new PointClass();
                pPoint.X = PageX;
                pPoint.Y = PageY;
                pPoint.Z = PageZ + PageZ / 10;

                IZAware zAware = pPoint as IZAware;
                zAware.ZAware = true;
                IGeometry pointGeometry = pPoint as IGeometry;
                pointGeometry.SpatialReference = pSceneControl.Scene.SpatialReference;
                pElement.Geometry = pointGeometry;

                graphicsContainer3D.AddElement(pElement);
                pSceneControl.Scene.SceneGraph.RefreshViewers();
            }
            catch
            {
                MessageBox.Show(e.ToString());
            }

            this.Close();
        }
コード例 #22
0
/**
 * @fn CreateTitleSymbol
 * @date 2013.03.04
 * @author Ge Xizhi
 * @brief 图例标题样式
 * @param 返回 ITextSymbol
 * @param
 * @version 1.1
 * @par 修改历史:
 * <作者>    <时间>   <版本编号>    <修改原因>\n
 */
        //图例标题字体设计
        private ITextSymbol CreateTitleSymbol()
        {
            ITextSymbol pTitleSymbol = new TextSymbolClass();
            IFontDisp   pFont        = new StdFontClass() as IFontDisp;

            pTitleSymbol.Color = ClsGDBDataCommon.ColorToIColor(btTitleColor.SelectedColor);

            //字体大小
            pFont.Size = decimal.Parse(this.cboBoxTitleFontSize.Text);

            //字体名
            pFont.Name = this.cboBoxTitleFontName.Text;

            //字体加粗
            if (this.toolBtnBold.Checked == true)
            {
                pFont.Bold = true;
            }
            //倾斜
            if (this.toolBtnIntend.Checked == true)
            {
                pFont.Italic = true;
            }
            else
            {
                pFont.Italic = false;
            }
            //下划线
            if (this.toolBtnUnderline.Checked == true)
            {
                pFont.Underline = true;
            }
            else
            {
                pFont.Underline = false;
            }
            //中间线
            if (this.toolBtnStrikethrough.Checked == true)
            {
                pFont.Strikethrough = true;
            }
            else
            {
                pFont.Strikethrough = false;
            }
            //将字体赋值给pTitleSymbol
            pTitleSymbol.Font = pFont;

            //字体在水平方向的位置
            if (this.toolBtnLeft.Checked == true)
            {
                pTitleSymbol.HorizontalAlignment = esriTextHorizontalAlignment.esriTHALeft;
            }
            else if (this.toolBtnCenter.Checked == true)
            {
                pTitleSymbol.HorizontalAlignment = esriTextHorizontalAlignment.esriTHACenter;
            }
            else if (this.toolBtnRight.Checked == true)
            {
                pTitleSymbol.HorizontalAlignment = esriTextHorizontalAlignment.esriTHARight;
            }
            else if (this.toolBtnBoth.Checked == true)
            {
                pTitleSymbol.HorizontalAlignment = esriTextHorizontalAlignment.esriTHAFull;
            }

            //返回样式
            return(pTitleSymbol);
        }
コード例 #23
0
        private void btnadd_Click(object sender, EventArgs e)
        {
            if (supergrid.PrimaryGrid.Rows.Count > 0)
            {
                supergrid.PrimaryGrid.Rows.RemoveAt(0);
                RePainPictureBox(Radio);
            }
            if (superTabControl1.SelectedTabIndex == 0)
            {
                if (pLineSymbol == null)
                {
                    MessageBox.Show("请选择填充线的类型", "提示", MessageBoxButtons.OK);
                }
                else if (pOutLineSymbol == null)
                {
                    MessageBox.Show("请选择外框线的类型", "提示", MessageBoxButtons.OK);
                }
                else
                {
                    ILineFillSymbol pLineFillsymbol = CreatLineFillSymbol(pLineSymbol, pOutLineSymbol, ClsGDBDataCommon.ColorToIColor(colorline.SelectedColor), angleline.Value, lineoffset.Value, separline.Value);
                    pSymbolOK = (ISymbol)pLineFillsymbol;
                    addListBoxItem((ISymbol)pLineFillsymbol);
                }
            }
            else if (superTabControl1.SelectedTabIndex == 1)
            {
                if (pMarkersymbol == null)
                {
                    MessageBox.Show("请选择填充点的类型", "提示", MessageBoxButtons.OK);
                }
                else if (pMarkOutLineSymbol == null)
                {
                    MessageBox.Show("请选择外框线的类型", "提示", MessageBoxButtons.OK);
                }
                else
                {
                    IMarkerFillSymbol pMarkerFillSymbol = CreatMarkerFillSymbol(pMarkersymbol, pMarkOutLineSymbol, ClsGDBDataCommon.ColorToIColor(colorpoint.SelectedColor), xoffsetpoint.Value, yoffsetpoint.Value, xsparpoint.Value, ysparpoint.Value);
                    pSymbolOK = (ISymbol)pMarkerFillSymbol;
                    addListBoxItem((ISymbol)pMarkerFillSymbol);
                }
            }

            RePainPictureBox(Radio);
        }
コード例 #24
0
ファイル: FrmLabelDesign.cs プロジェクト: eglrp/TESTPROJECT-1
        private void btnuse_Click(object sender, EventArgs e)
        {
            try
            {
                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;

                IGeoFeatureLayer pGeoLayer = (IGeoFeatureLayer)pLayer;
                pGeoLayer.AnnotationProperties.Clear();
                ILabelEngineLayerProperties pLabelEngine = new LabelEngineLayerPropertiesClass();
                pLabelEngine.Symbol = pTextSymbol;

                //pLabelEngine2.BasicOverposterLayerProperties = pBasicProperties as IBasicOverposterLayerProperties;

                if (cmbfields.Text.Contains("[") && cmbfields.Text.Contains("]"))
                {
                    pLabelEngine.Expression = cmbfields.Text;
                }
                else
                {
                    string Exptext = "[" + cmbfields.Text + "]";
                    pLabelEngine.Expression = Exptext;
                }

                IBasicOverposterLayerProperties4 pBasic = new BasicOverposterLayerPropertiesClass();
                //pBasic.PolygonPlacementMethod = esriOverposterPolygonPlacementMethod.esriAlwaysHorizontal;
                if (chkOverLap.Checked)
                {
                    pBasic.GenerateUnplacedLabels = true;
                }
                if (pLayer is IFeatureLayer)
                {
                    IFeatureLayer featureLayer = pLayer as FeatureLayer;
                    if (featureLayer.FeatureClass == null)
                    {
                        return;
                    }

                    if (featureLayer.FeatureClass.ShapeType == esriGeometryType.esriGeometryPoint)
                    {
                        IPointPlacementPriorities pPointPlace = new PointPlacementPrioritiesClass();
                        pBasic.PointPlacementMethod = esriOverposterPointPlacementMethod.esriAroundPoint;
                        pBasic.PointPlacementOnTop  = radioCenterTop.Checked;

                        SetPointPlacementPriorities(pPointPlace);
                        pBasic.PointPlacementPriorities = pPointPlace;
                    }
                    else if (featureLayer.FeatureClass.ShapeType == esriGeometryType.esriGeometryPolyline)
                    {
                        //更改角度
                        //= new LineLabelPositionClass();
                        IClone             pSrcClone          = pBasic.LineLabelPosition as IClone;
                        IClone             pDstClone          = pSrcClone.Clone();
                        ILineLabelPosition pLineLabelPosition = pDstClone as ILineLabelPosition;
                        if (pLineLabelPosition != null)
                        {
                            if (radioBtnHorizontal.Checked)
                            {
                                pLineLabelPosition.Horizontal    = true;
                                pLineLabelPosition.Parallel      = false;
                                pLineLabelPosition.Perpendicular = false;
                            }

                            if (radioBtnPerpendicular.Checked)
                            {
                                pLineLabelPosition.Horizontal    = false;
                                pLineLabelPosition.Parallel      = false;
                                pLineLabelPosition.Perpendicular = true;
                            }

                            if (radioBtnParallel.Checked)
                            {
                                pLineLabelPosition.Horizontal    = false;
                                pLineLabelPosition.Parallel      = true;
                                pLineLabelPosition.Perpendicular = false;
                            }
                        }

                        pBasic.LineLabelPosition = pLineLabelPosition;
                        //pBasic.PerpendicularToAngle = true;
                    }
                    else if (featureLayer.FeatureClass.ShapeType == esriGeometryType.esriGeometryPolygon)
                    {
                        pBasic.PolygonPlacementMethod = esriOverposterPolygonPlacementMethod.esriAlwaysHorizontal;
                    }
                }

                //赋给labelEngine
                pLabelEngine.BasicOverposterLayerProperties = pBasic as IBasicOverposterLayerProperties;


                IAnnotateLayerProperties pAnnoLayerP = (IAnnotateLayerProperties)pLabelEngine;
                pAnnoLayerP.DisplayAnnotation  = chklabel.Checked;
                pAnnoLayerP.FeatureLayer       = pGeoLayer;
                pAnnoLayerP.LabelWhichFeatures = esriLabelWhichFeatures.esriVisibleFeatures;
                pAnnoLayerP.WhereClause        = "";

                pGeoLayer.AnnotationProperties.Add(pAnnoLayerP);
                pGeoLayer.DisplayAnnotation = chklabel.Checked;


                pMapControl.ActiveView.Refresh();
                //if (pTocControl.Buddy == pMapControl.Object)
                //{
                //    pTocControl.SetBuddyControl(pMapControl);
                //    pMapControl.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGeography, null, null);
                //    pTocControl.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGeography, null, null);
                //}
                //else if (pTocControl.Buddy.Equals(pSceneControl.Object))
                //{
                //    pTocControl.SetBuddyControl(pSceneControl);
                //    IActiveView pActiveView = pSceneControl.Scene as IActiveView;
                //    pActiveView.PartialRefresh(esriViewDrawPhase.esriViewGeography, pLayer, null);
                //    pTocControl.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGeography, null, null);
                //}
            }
            catch (System.Exception ex)
            {
            }
        }
コード例 #25
0
ファイル: FrmLabelDesign.cs プロジェクト: eglrp/TESTPROJECT-1
        /// <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;
            }
        }
コード例 #26
0
        //创建文字比例尺
        private void CreateScaleText()
        {
            //文字比例尺样式:绝对类型和相对类型
            if (ckBoxAsolute.Checked)
            {
                ScaleText.Style     = esriScaleTextStyleEnum.esriScaleTextAbsolute;
                ScaleText.Separator = txtSeparator.Text;
            }
            else if (ckBoxRelative.Checked)
            {
                ScaleText.Style     = esriScaleTextStyleEnum.esriScaleTextRelative;
                ScaleText.Separator = txtSeparator.Text;
            }
            //布局单位
            if (cmbBoxPageUnits.SelectedItem.ToString() == "Centimeters")
            {
                ScaleText.PageUnits     = esriUnits.esriCentimeters;
                ScaleText.PageUnitLabel = txtPageLabel.Text;
            }
            else if (cmbBoxPageUnits.SelectedItem.ToString() == "Inches")
            {
                ScaleText.PageUnits     = esriUnits.esriInches;
                ScaleText.PageUnitLabel = txtPageLabel.Text;
            }
            else if (cmbBoxPageUnits.SelectedItem.ToString() == "Points")
            {
                ScaleText.PageUnits     = esriUnits.esriPoints;
                ScaleText.PageUnitLabel = txtPageLabel.Text;
            }
            //地图单位
            if (cmbBoxMapUnits.SelectedItem.ToString() == "Centimeters")
            {
                ScaleText.MapUnits     = esriUnits.esriCentimeters;
                ScaleText.MapUnitLabel = txtMapLabel.Text;
            }
            else if (cmbBoxMapUnits.SelectedItem.ToString() == "Decimal Degrees")
            {
                ScaleText.MapUnits     = esriUnits.esriDecimalDegrees;
                ScaleText.MapUnitLabel = txtMapLabel.Text;
            }
            else if (cmbBoxMapUnits.SelectedItem.ToString() == "Decimeters")
            {
                ScaleText.MapUnits     = esriUnits.esriDecimeters;
                ScaleText.MapUnitLabel = txtMapLabel.Text;
            }
            else if (cmbBoxMapUnits.SelectedItem.ToString() == "Feet")
            {
                ScaleText.MapUnits     = esriUnits.esriFeet;
                ScaleText.MapUnitLabel = txtMapLabel.Text;
            }
            else if (cmbBoxMapUnits.SelectedItem.ToString() == "Inches")
            {
                ScaleText.MapUnits     = esriUnits.esriInches;
                ScaleText.MapUnitLabel = txtMapLabel.Text;
            }
            else if (cmbBoxMapUnits.SelectedItem.ToString() == "Kilometers")
            {
                ScaleText.MapUnits     = esriUnits.esriKilometers;
                ScaleText.MapUnitLabel = txtMapLabel.Text;
            }
            else if (cmbBoxMapUnits.SelectedItem.ToString() == "Meters")
            {
                ScaleText.MapUnits     = esriUnits.esriMeters;
                ScaleText.MapUnitLabel = txtMapLabel.Text;
            }
            else if (cmbBoxMapUnits.SelectedItem.ToString() == "Miles")
            {
                ScaleText.MapUnits     = esriUnits.esriMiles;
                ScaleText.MapUnitLabel = txtMapLabel.Text;
            }
            else if (cmbBoxMapUnits.SelectedItem.ToString() == "Millimeters")
            {
                ScaleText.MapUnits     = esriUnits.esriMillimeters;
                ScaleText.MapUnitLabel = txtMapLabel.Text;
            }
            else if (cmbBoxMapUnits.SelectedItem.ToString() == "Nautical Miles")
            {
                ScaleText.MapUnits     = esriUnits.esriNauticalMiles;
                ScaleText.MapUnitLabel = txtMapLabel.Text;
            }
            else if (cmbBoxMapUnits.SelectedItem.ToString() == "Points")
            {
                ScaleText.MapUnits     = esriUnits.esriPoints;
                ScaleText.MapUnitLabel = txtMapLabel.Text;
            }
            else if (cmbBoxMapUnits.SelectedItem.ToString() == "Unknown Units")
            {
                ScaleText.MapUnits     = esriUnits.esriUnknownUnits;
                ScaleText.MapUnitLabel = txtMapLabel.Text;
            }
            else if (cmbBoxMapUnits.SelectedItem.ToString() == "Yards")
            {
                ScaleText.MapUnits     = esriUnits.esriYards;
                ScaleText.MapUnitLabel = txtMapLabel.Text;
            }

            if (TextSymbol == null)
            {
                //字体样式
                ITextSymbol pTextSymbol = new TextSymbolClass();
                IFontDisp   pFont       = new StdFontClass() as IFontDisp;

                pFont.Name = this.cboBoxFontName.Text;
                pFont.Size = decimal.Parse(this.cboBoxFontSize.Text);

                if (FontColor.SelectedColor != null)
                {
                    pTextSymbol.Color = ClsGDBDataCommon.ColorToIColor(FontColor.SelectedColor);
                }
                //风格
                if (toolBtnBold.Checked == true)
                {
                    pFont.Bold = true;
                }
                else
                {
                    pFont.Bold = false;
                }
                if (toolBtnIntend.Checked == true)
                {
                    pFont.Italic = true;
                }
                else
                {
                    pFont.Italic = false;
                }
                if (toolBtnUnderline.Checked == true)
                {
                    pFont.Underline = true;
                }
                else
                {
                    pFont.Underline = false;
                }
                if (toolBtnStrikethrough.Checked == true)
                {
                    pFont.Strikethrough = true;
                }
                else
                {
                    pFont.Strikethrough = false;
                }

                pTextSymbol.Font = pFont;
                ScaleText.Symbol = pTextSymbol;
            }
            else if (TextSymbol != null)
            {
                ScaleText.Symbol = TextSymbol;
            }

            //设置边框、阴影、背景的距离和圆角
            //边框、背景、阴影距离、角度
            if (SymbolBorder != null)
            {
                if (this.txtBorderGap.Text != null)
                {
                    SymbolBorder.Gap = double.Parse(this.txtBorderGap.Text);
                }
                if (txtBorderAngle.Text != null)
                {
                    SymbolBorder.CornerRounding = short.Parse(this.txtBorderAngle.Text);
                }
            }
            if (SymbolBackground != null)
            {
                if (txtBackgroundGap.Text != null)
                {
                    SymbolBackground.Gap = double.Parse(this.txtBackgroundGap.Text);
                }
                if (txtBackgroundAngle.Text != null)
                {
                    SymbolBackground.CornerRounding = short.Parse(this.txtBackgroundAngle.Text);
                }
            }
            if (SymbolShadow != null)
            {
                if (txtShadowX.Text != null)
                {
                    SymbolShadow.HorizontalSpacing = double.Parse(this.txtShadowX.Text);
                }
                if (txtShadowY.Text != null)
                {
                    SymbolShadow.VerticalSpacing = double.Parse(this.txtShadowY.Text);
                }
                if (txtShadowAngle.Text != null)
                {
                    SymbolShadow.CornerRounding = short.Parse(this.txtShadowAngle.Text);
                }
            }
            //添加边框、背景、阴影
            IFrameProperties pFrameProperties = pMapSurroundFrame as IFrameProperties;

            if (SymbolBorder != null)
            {
                pFrameProperties.Border = SymbolBorder;
            }
            if (SymbolBackground != null)
            {
                pFrameProperties.Background = SymbolBackground;
            }
            if (SymbolShadow != null)
            {
                pFrameProperties.Shadow = SymbolShadow;
            }
        }
コード例 #27
0
ファイル: FrmSymbol.cs プロジェクト: eglrp/TESTPROJECT-1
        //线 设计
        private void colorLine_SelectedColorChanged(object sender, EventArgs e)
        {
            if (pStyleGalleryItem == null)
            {
                MessageBox.Show("请选择线样式", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return;
            }

            ILineSymbol pLineSymbol = pStyleGalleryItem.Item as ILineSymbol;

            if (pLineSymbol == null)
            {
                return;
            }

            pLineSymbol.Color = ClsGDBDataCommon.ColorToIColor(colorLine.SelectedColor);
            //新添加,用于更改线修饰颜色
            if (pLineSymbol is IMultiLayerLineSymbol)
            {
                IMultiLayerLineSymbol pMultiLyerLine = pLineSymbol as IMultiLayerLineSymbol;
                int nLCount = pMultiLyerLine.LayerCount;
                for (int j = 0; j < nLCount; j++)
                {
                    ILineSymbol     Psymbol   = pMultiLyerLine.get_Layer(j);
                    ILineProperties pLineProp = Psymbol as ILineProperties;

                    List <ILineDecorationElement> Linedeclist = new List <ILineDecorationElement>();
                    if (pLineProp != null)
                    {
                        ILineDecoration pLineDec = pLineProp.LineDecoration;
                        if (pLineDec != null)
                        {
                            int ncount = pLineDec.ElementCount;
                            for (int i = 0; i < ncount; i++)
                            {
                                ILineDecorationElement pLineDecEle = pLineDec.get_Element(i);
                                Linedeclist.Add(pLineDecEle);
                            }
                            if (Linedeclist.Count > 0)
                            {
                                for (int i = 0; i < ncount; i++)
                                {
                                    ISimpleLineDecorationElement pSLDecEle = Linedeclist[i] as ISimpleLineDecorationElement;
                                    ISimpleLineDecorationElement pnewele   = new SimpleLineDecorationElementClass();
                                    if (pSLDecEle != null)
                                    {
                                        IMarkerSymbol pMSymbol = pSLDecEle.MarkerSymbol;

                                        pMSymbol.Color = ClsGDBDataCommon.ColorToIColor(colorLine.SelectedColor);
                                        pnewele.AddPosition(pSLDecEle.get_Position(i));
                                        pnewele.MarkerSymbol = pMSymbol;
                                        pLineDec.DeleteElement(i);
                                        pLineDec.AddElement(pnewele);
                                    }
                                }
                            }
                        }
                    }
                }
            }
            PreviewImage();
        }