Example #1
0
        Dictionary <string, ColorStr> GetSizeofLabels(HClusterNode hNode)
        {
            Dictionary <string, ColorStr> dic = new Dictionary <string, ColorStr>();

            foreach (var item in hNode.setStruct)
            {
                /* if (labels == null)
                 * {
                 *
                 *   string[] aux = item.Split(labelBreak);
                 *   if (!dic.ContainsKey(aux[0]))
                 *   {
                 *       ColorStr str = new ColorStr(1);
                 *       dic.Add(aux[0], str);
                 *   }
                 *   else
                 *   {
                 *       ColorStr copyStr = dic[aux[0]];
                 *       copyStr.IncrementSize();
                 *       dic[aux[0]]=copyStr;
                 *   }
                 *
                 * }
                 * else
                 * {*/
                if (labels.ContainsKey(item))
                {
                    string colorToString = labels[item];
                    if (!dic.ContainsKey(colorToString))
                    {
                        ColorStr str = new ColorStr(1);
                        dic.Add(colorToString, str);
                    }

                    else
                    {
                        ColorStr copyStr = dic[colorToString];
                        copyStr.IncrementSize();
                        dic[colorToString] = copyStr;
                    }
                }
                //}
            }
            if (dic.Keys.Count > colorMap.Count)
            {
                throw new Exception("Too many labels");
            }

            foreach (var item in dic)
            {
                item.Value.SetColor(colorMap[labelColor[item.Key]]);
            }
            return(dic);
        }
Example #2
0
        Dictionary<string,ColorStr> GetSizeofLabels(HClusterNode hNode)
        {
            Dictionary<string, ColorStr> dic = new Dictionary<string, ColorStr>();
            foreach (var item in hNode.setStruct)
            {
               /* if (labels == null)
                {
                    
                    string[] aux = item.Split(labelBreak);
                    if (!dic.ContainsKey(aux[0]))
                    {
                        ColorStr str = new ColorStr(1);
                        dic.Add(aux[0], str);
                    }
                    else
                    {
                        ColorStr copyStr = dic[aux[0]];
                        copyStr.IncrementSize();
                        dic[aux[0]]=copyStr;
                    }

                }
                else
                {*/
                    if (labels.ContainsKey(item))
                    {
                        string colorToString = labels[item];
                        if (!dic.ContainsKey(colorToString))
                        {
                            ColorStr str = new ColorStr(1);
                            dic.Add(colorToString, str);
                        }

                        else
                        {
                            ColorStr copyStr = dic[colorToString];
                            copyStr.IncrementSize();
                            dic[colorToString]=copyStr;
                        }
                    }
                //}
            }
            if (dic.Keys.Count > colorMap.Count)
                throw new Exception("Too many labels");
            
            foreach (var item in dic)
                item.Value.SetColor(colorMap[labelColor[item.Key]]);
            return dic;
        }