コード例 #1
0
ファイル: Legends.cs プロジェクト: SDRC-India/sdrcdevinfo
 public void AddRange(Legend[] p_Legends)
 {
     foreach (Legend _Legend in p_Legends)
     {
         List.Add(_Legend);
     }
 }
コード例 #2
0
ファイル: Theme.cs プロジェクト: SDRC-India/sdrcdevinfo
        private void GenerateEqualSize(DataView _DV)
        {
            //IFormatProvider culture = new CultureInfo("fr-Fr", true);

            m_Legends.Clear();

            Legend legend = null;
            DataTable RangeTable = DICommon.GenerateEqualSize(_DV, this.m_BreakCount, this.m_Minimum, this.m_Maximum, this.m_Decimals);
            int TotalShapeCount = 0;
            int i = 1;
            // Loop each row and add Legends by filling RangeTo, RangeFrom, shapeCount in each legend
            foreach (DataRow dr in RangeTable.Rows)
            {
                // Table structure is :- Range_From | Range_To | Count
                legend = new Legend();
                legend.Title = Convert.ToString(dr[0], System.Globalization.CultureInfo.CurrentCulture) + " - " + Convert.ToString(dr[1], System.Globalization.CultureInfo.CurrentCulture);
                //--default Caption : Label 1, Label 2, label 3.... Label N
                legend.Caption = "Label " + i.ToString();
                legend.RangeFrom = Convert.ToDecimal(dr[0]);
                legend.RangeTo = Convert.ToDecimal(dr[1]);

                legend.ShapeCount = (int)dr[2];

                // Increment Total shape count
                TotalShapeCount += (int)dr[2];
                switch (this.m_ThemeType)
                {
                    case ThemeType.Color:
                        legend.FillStyle = FillStyle.Solid;
                        break;
                    case ThemeType.Hatch:
                        legend.FillStyle = (FillStyle)i - 1;
                        break;
                }
                this.m_Legends.Add(legend);
                i += 1;
            }

            Legend _Legend = new Legend();
            {
                _Legend.Caption = "Missing Data";
                _Legend.Color = m_MissingColor;
                _Legend.ShapeCount = m_ShapeCount - TotalShapeCount;
                //*** BugFix 20 Mar 2006 Negative Value for missing data. If no map is associated with map then Dv.Count > m_shape count
                if (_Legend.ShapeCount < 0)
                    _Legend.ShapeCount = 0;
                switch (m_ThemeType)
                {
                    case ThemeType.Color:
                        _Legend.FillStyle = FillStyle.Solid;
                        break;
                    case ThemeType.Hatch:
                        _Legend.FillStyle = (FillStyle)i;
                        break;
                }
            }
            this.m_Legends.Add(_Legend);
        }
コード例 #3
0
ファイル: Map.cs プロジェクト: SDRC-India/sdrcdevinfo
        public string GetLabel(Layer _Layer, ref Shape _Shape, ref Theme _Theme, CustomLabel _CustomLabel, ref Legend _Legend)
        {
            int i;
            int j;
            string Label = "";
            //*** BugFix 06 Feb 2006 No label field selected
            string Delimiter = " ";
            int IndentSpace = 3;
            char[] Fields;
            bool Indented;

            if ((_Theme == null))
            {
                //*** Custom and Feature Layers
                if (_CustomLabel == null)
                {
                    if (_Layer.LabelMultirow == true)
                        Delimiter = "\r\n";  //initially it was: ControlChars.CrLf (line feed)
                    Fields = _Layer.LabelField.Replace(",", "").ToCharArray();
                }
                else
                {
                    if (_CustomLabel.MultiRow == true)
                        Delimiter = "\r\n";  //initially it was: ControlChars.CrLf (line feed)
                    Fields = _CustomLabel.LabelField.Replace(",", "").ToCharArray();
                }

                if (Array.IndexOf(Fields, "0"[0]) > -1)
                    Label = _Shape.AreaId + Delimiter;
                if (Array.IndexOf(Fields, char.Parse("1")) > -1)
                {
                    if (_Layer.LabelMultirow == true)
                    {
                        if (Label == "")
                        {
                            Label += _Shape.AreaName;
                        }
                        else
                        {
                            if (_Layer.LabelIndented == true)
                                Label += new string(' ', IndentSpace);
                            Label += _Shape.AreaName;
                        }
                    }
                    else
                    {
                        Label += _Shape.AreaName;
                    }
                }
            }
            else
            {
                //*** Base Layers
                if (_CustomLabel == null)
                {
                    if (_Legend == null)
                    {
                        if (_Layer.LabelMultirow == true)
                            Delimiter = "\r\n";  //initially it was: ControlChars.CrLf (line feed)
                        Fields = _Layer.LabelField.Replace(",", "").ToCharArray();
                        Indented = _Layer.LabelIndented;
                    }
                    else
                    {
                        if (_Legend.LabelMultiRow == true)
                            Delimiter = "\r\n";  //initially it was: ControlChars.CrLf (line feed)
                        Fields = _Legend.LabelField.Replace(",", "").ToCharArray();
                        Indented = _Legend.LabelIndented;
                    }
                }
                else
                {
                    if (_CustomLabel.MultiRow == true)
                        Delimiter = "\r\n";  //initially it was: ControlChars.CrLf (line feed)
                    Fields = _CustomLabel.LabelField.Replace(",", "").ToCharArray();
                    Indented = _CustomLabel.Indent;
                }
                if (_Theme.AreaIndexes.ContainsKey(_Shape.AreaId))
                {
                    j = 0;
                    for (i = 0; i <= Fields.Length - 1; i++)
                    {
                        switch (Fields[i])
                        {
                            case '0':
                                Label += _Shape.AreaId + Delimiter;
                                j = j + 1;
                                break;
                            case '1':
                                if (Indented == true)
                                    Label += new string(' ', j * IndentSpace);

                                Label += ((AreaInfo)_Theme.AreaIndexes[_Shape.AreaId]).AreaName + Delimiter;
                                j = j + 1;
                                break;
                            case '2':
                                if (Indented == true)
                                    Label += new string(' ', j * IndentSpace);

                                //Label += ((AreaInfo)_Theme.AreaIndexes[_Shape.AreaId]).DataValue + Delimiter;
                                //Textual dataValue is also displayed on Map Label, so property AreaInfo.DisplayInfo is used.
                                Label += ((AreaInfo)_Theme.AreaIndexes[_Shape.AreaId]).DisplayInfo + Delimiter;
                                j = j + 1;
                                break;
                            case '3':
                                if (Indented == true)
                                    Label += new string(' ', j * IndentSpace);

                                Label += _Theme.UnitName + Delimiter;
                                j = j + 1;
                                break;
                            case '4':
                                if (Indented == true)
                                    Label += new string(' ', j * IndentSpace);

                                //Label += _Theme.SubgroupName(0) & Delimiter
                                //*** BugFix 21 Sep 2006 Subgroup label error
                                Label += ((AreaInfo)_Theme.AreaIndexes[_Shape.AreaId]).Subgroup + Delimiter;
                                j = j + 1;
                                break;
                            case '5':
                                if (Indented == true)
                                    Label += new string(' ', j * IndentSpace);

                                Label += ((AreaInfo)_Theme.AreaIndexes[_Shape.AreaId]).Time + Delimiter;
                                break;
                        }
                    }
                    Label = Label.Trim(Delimiter.ToCharArray());
                }
                else
                {
                    if (this._ShowLabelWhereDataExists)
                    {
                        //- If label is not required for Areas NOT having Data,
                        // then set blank label.
                        Label = string.Empty;
                    }
                    else
                    {
                        Hashtable AreaNames = _Layer.AreaNames;
                        string AreaName;
                        if (Array.IndexOf(Fields, "0"[0]) > -1)
                            Label = _Shape.AreaId + Delimiter;
                        if (Array.IndexOf(Fields, char.Parse("1")) > -1)
                        {
                            if (AreaNames.ContainsKey(_Shape.AreaId))
                            {
                                //Get language specific AreaName from Database if it exists
                                AreaName = (string)AreaNames[_Shape.AreaId];
                            }
                            else
                            {
                                //Get Shapefile Area Name
                                AreaName = _Shape.AreaName;
                            }
                            if (_Layer.LabelMultirow == true)
                            {
                                if (Label == "")
                                {
                                    Label += AreaName;
                                }
                                else
                                {
                                    if (_Layer.LabelIndented == true)
                                        Label += new string(' ', IndentSpace);
                                    Label += AreaName;
                                }
                            }
                            else
                            {
                                Label += AreaName;
                            }
                        }
                    }
                }
            }
            return Label;
        }
コード例 #4
0
ファイル: Legends.cs プロジェクト: SDRC-India/sdrcdevinfo
 public void Add(Legend p_Legend)
 {
     List.Add(p_Legend);
 }