Exemple #1
0
        //开始加载
        private void FrmLegend_Load(object sender, EventArgs e)
        {
            //第一界面需要加载内容
            if (pMap.LayerCount > 0)
            {
                for (int i = 0; i < pMap.LayerCount; i++)
                {
                    //将所有数据名称加载到第一个ListView中
                    this.LViewMapLayer.Items.Add(pMap.get_Layer(i).Name);
                    //将所有显示的数据名称加载到第二个ListView中
                    if (pMap.get_Layer(i).Visible == true)
                    {
                        //第一界面中需要添加到图例的图层列表
                        this.LViewLegendLayer.Items.Add(pMap.get_Layer(i).Name);
                        pSelectedidx.Add(i);
                    }
                }
            }
            //第二界面需要加载内容

            //加载字体名称
            InstalledFontCollection pFontCollection = new InstalledFontCollection();

            FontFamily[] pFontFamily = pFontCollection.Families;
            for (int i = 0; i < pFontFamily.Length; i++)
            {
                string pFontName = pFontFamily[i].Name;
                this.cboBoxTitleFontName.Items.Add(pFontName);
            }
            this.cboBoxTitleFontName.Text = "宋体";
            //加载字体大小
            for (int i = 3; i <= 100; i++)
            {
                this.cboBoxTitleFontSize.Items.Add(i.ToString());
            }
            this.cboBoxTitleFontSize.Text = "10";
            //颜色
            btTitleColor.SelectedColor = Color.Black;
            //字体风格和位置
            this.toolTitlePostion.Visible = true;
            this.toolTitleStyle.Visible   = true;

            //第三界面需要加载内容
            ILegendFormat pLegendFormat = new LegendFormatClass();

            if (pLegendFormat.DefaultLinePatch != null)
            {
                FrmPatchLineAndArea frm = new FrmPatchLineAndArea(esriSymbologyStyleClass.esriStyleClassLinePatches);
                this.btLineShape.Image = frm.GetImageByGiveLineSymbolBeforeSelectItem(esriSymbologyStyleClass.esriStyleClassLinePatches, (ILinePatch)pLegendFormat.DefaultLinePatch, btLineShape.Width - 14, btLineShape.Height - 14);
            }
            if (pLegendFormat.DefaultAreaPatch != null)
            {
                FrmPatchLineAndArea frm = new FrmPatchLineAndArea(esriSymbologyStyleClass.esriStyleClassAreaPatches);
                this.btAreaShape.Image = frm.GetImageByGiveAreaSymbolBeforeSelectItem(esriSymbologyStyleClass.esriStyleClassAreaPatches, (IAreaPatch)pLegendFormat.DefaultAreaPatch, btAreaShape.Width - 14, btAreaShape.Height - 14);
            }
            //第四界面需要加载内容
            this.LegendDistanceImage.Image = global::LibCerMap.Properties.Resources._1;
        }
        private void btAreaShape_Click(object sender, EventArgs e)
        {
            FrmPatchLineAndArea frm = new FrmPatchLineAndArea(esriSymbologyStyleClass.esriStyleClassAreaPatches);

            frm.ShowDialog();
            if (frm.DialogResult == DialogResult.OK)
            {
                pAreaPatch = frm.GetAreaPatch();
                if (pAreaPatch != null)
                {
                    this.btAreaShape.Image = frm.GetImageByGiveSymbolAfterSelectItem(btAreaShape.Width, btAreaShape.Height);
                }
            }
        }
Exemple #3
0
        private void btAreaShape_Click(object sender, EventArgs e)
        {
            FrmPatchLineAndArea Frm = new FrmPatchLineAndArea(esriSymbologyStyleClass.esriStyleClassAreaPatches);

            Frm.ShowDialog();
            if (Frm.DialogResult == DialogResult.OK)
            {
                pAreaPatch = Frm.GetAreaPatch();
                if (pAreaPatch != null)
                {
                    //pLegendFormat.DefaultAreaPatch = pAreaPatch;
                    btAreaShape.Image = Frm.GetImageByGiveSymbolAfterSelectItem(btAreaShape.Width - 14, btAreaShape.Height - 14);
                }
            }
        }
        private void FrmLegendAttribute_Load(object sender, EventArgs e)
        {
            //图例界面要素信息加载

            ILegendFormat pLegendFormat = Legend.Format;

            //标题
            this.txtLegendTitle.Text = Legend.Title;
            if (pLegendFormat.ShowTitle == true)
            {
                this.cBoxShowTitle.Checked  = true;
                this.txtLegendTitle.Enabled = true;
            }
            else
            {
                this.cBoxShowTitle.Checked  = false;
                this.txtLegendTitle.Enabled = false;
            }
            pTitleSymbol = pLegendFormat.TitleSymbol;
            //图面
            this.txtPatchWith.Text   = pLegendFormat.DefaultPatchWidth.ToString();
            this.txtPatchHeight.Text = pLegendFormat.DefaultPatchHeight.ToString();

            if (pLegendFormat.DefaultLinePatch != null)
            {
                FrmPatchLineAndArea frmPatchLine = new FrmPatchLineAndArea(esriSymbologyStyleClass.esriStyleClassLinePatches);
                this.btLineShape.Image = frmPatchLine.GetImageByGiveLineSymbolBeforeSelectItem(esriSymbologyStyleClass.esriStyleClassLinePatches, (ILinePatch)pLegendFormat.DefaultLinePatch, btLineShape.Width, btLineShape.Height);
            }
            if (pLegendFormat.DefaultAreaPatch != null)
            {
                FrmPatchLineAndArea frmPatchArea = new FrmPatchLineAndArea(esriSymbologyStyleClass.esriStyleClassAreaPatches);
                this.btAreaShape.Image = frmPatchArea.GetImageByGiveAreaSymbolBeforeSelectItem(esriSymbologyStyleClass.esriStyleClassAreaPatches, (IAreaPatch)pLegendFormat.DefaultAreaPatch, btAreaShape.Width, btAreaShape.Height);
            }

            //间隔
            this.txtTitleAndLegend.Text       = pLegendFormat.TitleGap.ToString();
            this.txtLegendItems.Text          = pLegendFormat.VerticalItemGap.ToString();
            this.txtColumns.Text              = pLegendFormat.HorizontalItemGap.ToString();
            this.txtLabelsAndDescription.Text = pLegendFormat.TextGap.ToString();
            this.txtHeadings.Text             = pLegendFormat.HeadingGap.ToString();
            this.txtPatchesV.Text             = pLegendFormat.VerticalPatchGap.ToString();
            this.txtPatchAndLabels.Text       = pLegendFormat.HorizontalPatchGap.ToString();

            //图层加载
            if (pMap.LayerCount > 0)
            {
                for (int i = 0; i < pMap.LayerCount; i++)
                {
                    //将所有数据名称加载到ListView中
                    this.LViewMapLayer.Items.Add(pMap.get_Layer(i).Name);

                    for (int j = 0; j < Legend.ItemCount; j++)
                    {
                        ILegendItem pLegendItem = Legend.Item[j];
                        if (pMap.get_Layer(i).Name == pLegendItem.Layer.Name)
                        {
                            this.LViewLegendLayer.Items.Add(pLegendItem.Layer.Name);
                            pSelectedidx.Add(i);
                        }
                    }
                }
            }

            //各类文本样式
            ILegendItem pLegendItem0 = Legend.Item[0];

            pLayerNameSymbol = pLegendItem0.LayerNameSymbol;
            pHeadingSymbol   = pLegendItem0.HeadingSymbol;
            ILegendClassFormat pLegendClassFormat = pLegendItem0.LegendClassFormat;

            pLabelSymbol       = pLegendClassFormat.LabelSymbol;
            pDescriptionSymbol = pLegendClassFormat.DescriptionSymbol;

            ////图例列数
            //ILegendItem pLegendItemff = new HorizontalLegendItemClass();
            //this.LegendColumn.Text = pLegendItemff.Columns.ToString ();
            //文本样式下拉列表
            this.cboBoxTextSymbol.SelectedIndex = 0;

            cBoxAddVisibleLayer.Checked = Legend.AutoVisibility; //只显示显示的图层
            cBoxAddNewLayer.Checked     = Legend.AutoAdd;        //自动添加显示的图层
            cBoxNewOrder.Checked        = Legend.AutoReorder;    //按照图层顺序排列图例

            //地图框架
            IFrameProperties pFrameProperties = pMapSurroundFrame as IFrameProperties;

            if (pMapSurroundFrame.Border != null)
            {
                FrmFrameBorder frm = new FrmFrameBorder(SymbolStyle, (ISymbolBorder)pMapSurroundFrame.Border);

                if (btBorder.Image != null)
                {
                    btBorder.Image.Dispose();
                }
                this.btBorder.Image = frm.GetImageByGiveSymbolBeforeSelectItem(esriSymbologyStyleClass.esriStyleClassBorders, (ISymbolBorder)pMapSurroundFrame.Border, btBorder.Width, btBorder.Height);
                pSymbolBorder       = pFrameProperties.Border as ISymbolBorder;
                txtBorderGap.Text   = pFrameProperties.Border.Gap.ToString();
                txtBorderAngle.Text = pSymbolBorder.CornerRounding.ToString();
            }
            if (pMapSurroundFrame.Background != null)
            {
                FrmFrameBackground frm = new FrmFrameBackground(SymbolStyle, (ISymbolBackground)pMapSurroundFrame.Background);

                if (btBackground.Image != null)
                {
                    btBackground.Image.Dispose();
                }
                this.btBackground.Image = frm.GetImageByGiveSymbolBeforeSelectItem(esriSymbologyStyleClass.esriStyleClassBackgrounds, (ISymbolBackground)pMapSurroundFrame.Background, btBackground.Width, btBackground.Height);

                pSymbolBackground       = pFrameProperties.Background as ISymbolBackground;
                txtBackgroundGap.Text   = pSymbolBackground.Gap.ToString();
                txtBackgroundAngle.Text = pSymbolBackground.CornerRounding.ToString();
            }
            if (pFrameProperties.Shadow != null)
            {
                FrmFrameShadow frm = new FrmFrameShadow(SymbolStyle, (ISymbolShadow)pFrameProperties.Shadow);

                if (btShadow.Image != null)
                {
                    btShadow.Image.Dispose();
                }
                this.btShadow.Image = frm.GetImageByGiveSymbolBeforeSelectItem(esriSymbologyStyleClass.esriStyleClassShadows, (ISymbolShadow)pFrameProperties.Shadow, btShadow.Width, btShadow.Height);

                pSymbolShadow       = pFrameProperties.Shadow as ISymbolShadow;
                txtShadowX.Text     = pSymbolShadow.HorizontalSpacing.ToString();
                txtShadowY.Text     = pSymbolShadow.VerticalSpacing.ToString();
                txtShadowAngle.Text = pSymbolShadow.CornerRounding.ToString();
            }
        }