示例#1
0
        private void SetFieldByLegendType(LegendType aLT)
        {
            if (_mapLayer.LayerType == LayerTypes.VectorLayer)
            {
                VectorLayer aLayer = (VectorLayer)_mapLayer;
                switch (aLT)
                {
                case LegendType.SingleSymbol:
                    CB_Field.Enabled = false;
                    CB_Field.Text    = "<None>";
                    CreateLegendScheme(aLT, "");
                    break;

                case LegendType.UniqueValue:
                    CB_Field.Enabled = true;
                    CB_Field.Items.Clear();
                    foreach (string fn in aLayer.GetFieldNameList())
                    {
                        CB_Field.Items.Add(fn);
                    }
                    CB_Field.Text = "<None>";
                    break;

                case LegendType.GraduatedColor:
                    CB_Field.Enabled = true;
                    CB_Field.Items.Clear();
                    for (int i = 0; i < aLayer.NumFields; i++)
                    {
                        if (MIMath.IsNumeric(aLayer.GetField(i)))
                        {
                            CB_Field.Items.Add(aLayer.GetFieldName(i));
                        }
                    }
                    CB_Field.Text = "<None>";
                    break;
                }
            }
        }
示例#2
0
        private void Initialize()
        {
            PG_General.SelectedObject = _mapLayer.GetPropertyObject();
            TabControl_Prop.TabPages.Clear();
            TabControl_Prop.TabPages.Add(TabPage_General);
            switch (_mapLayer.LayerType)
            {
            case LayerTypes.VectorLayer:
            case LayerTypes.RasterLayer:
                TabControl_Prop.TabPages.Add(TabPage_Legend);
                _legendScheme = (LegendScheme)_mapLayer.LegendScheme.Clone();
                legendSchemeControl1.Update(_mapLayer, _mapLayer.LegendScheme);
                break;

            case LayerTypes.ImageLayer:

                break;
            }

            if (_mapLayer.LayerType == LayerTypes.VectorLayer)
            {
                switch (_mapLayer.ShapeType)
                {
                case ShapeTypes.Point:
                case ShapeTypes.PointZ:
                case ShapeTypes.Polygon:
                    TabControl_Prop.TabPages.Add(TabPage_Chart);
                    VectorLayer aLayer = (VectorLayer)_mapLayer;
                    if (_mapLayer.ShapeType == ShapeTypes.Polygon)
                    {
                        CB_ChartType.Items.Clear();
                        CB_ChartType.Items.Add(ChartTypes.BarChart.ToString());
                        CB_ChartType.Items.Add(ChartTypes.PieChart.ToString());
                    }
                    else
                    {
                        CB_ChartType.Items.Clear();
                        CB_ChartType.Items.Add(ChartTypes.BarChart.ToString());
                        CB_ChartType.Items.Add(ChartTypes.PieChart.ToString());
                        //CB_ChartType.Items.Add(ChartTypes.WindVector.ToString());
                        //CB_ChartType.Items.Add(ChartTypes.WindBarb.ToString());
                        //CB_ChartType.Items.Add(ChartTypes.StationModel.ToString());
                    }
                    CB_ChartType.Text = aLayer.ChartSet.ChartType.ToString();

                    //Add fields
                    CLB_Fields.Items.Clear();
                    for (int i = 0; i < aLayer.NumFields; i++)
                    {
                        if (MIMath.IsNumeric(aLayer.GetField(i)))
                        {
                            string fn = aLayer.GetFieldName(i);
                            CLB_Fields.Items.Add(fn);
                            if (aLayer.ChartSet.FieldNames.Contains(fn))
                            {
                                CLB_Fields.SetItemChecked(CLB_Fields.Items.Count - 1, true);
                            }
                        }
                    }

                    TB_BarWidth.Text      = aLayer.ChartSet.BarWidth.ToString();
                    TB_MaxSize.Text       = aLayer.ChartSet.MaxSize.ToString();
                    TB_MinSize.Text       = aLayer.ChartSet.MinSize.ToString();
                    TB_XShift.Text        = aLayer.ChartSet.XShift.ToString();
                    TB_YShift.Text        = aLayer.ChartSet.YShift.ToString();
                    CHB_Collision.Checked = aLayer.ChartSet.AvoidCollision;
                    //Set align type
                    CB_Align.Items.Clear();
                    foreach (string align in Enum.GetNames(typeof(AlignType)))
                    {
                        CB_Align.Items.Add(align);
                    }
                    CB_Align.Text      = aLayer.ChartSet.AlignType.ToString();
                    CHB_View3D.Checked = aLayer.ChartSet.View3D;
                    TB_Thickness.Text  = aLayer.ChartSet.Thickness.ToString();

                    legendView_Chart.LegendScheme = aLayer.ChartSet.LegendScheme;
                    break;
                }
            }
        }