Пример #1
0
        private static WordTargetLayout createTextLayout(List <string> words, int circle, int startingAngle)
        {
            List <string> allWords = new List <string>();

            if (circle != 5)
            {
                allWords.Add("FIRST");
            }
            allWords.AddRange(words);
            allWords.Add("LAST");
            WordTargetLayout layout = new WordTargetLayout(allWords);

            if (circle != 5)
            {
                layout.SetStartingAngle(circle, startingAngle);
            }
            foreach (string word in words)
            {
                if (circle == 5 && word == words[0])
                {
                    continue;
                }
                layout.AssignWord(word, circle);
            }
            layout.CalculateAnglesInCircle();
            return(layout);
        }
Пример #2
0
        public static string RenderWordTarget(WordTargetLayout layout)
        {
            layout.CalculateAnglesInCircle();
            StringBuilder str = new StringBuilder();

            str.Append(@"<svg width=""500"" height=""500"" viewBox=""-700 -700 1400 1400"" xmlns=""http://www.w3.org/2000/svg"">
  <style>
    .text1 { fill: black; font: 50px sans-serif; }
    .text2 { fill: white; font: 50px sans-serif; }
    .line2 { stroke: white; stroke-width:5; }
    .text3 { fill: black; font: 50px sans-serif; }
    .line3 { stroke: black; stroke-width:5; }
    .text4 { fill: white; font: 50px sans-serif; }
    .line4 { stroke: white; stroke-width:5; }
    .text5 { fill: black; font: 50px sans-serif; }
    .line5 { stroke: black; stroke-width:5; }
  </style>

  <circle cx=""0"" cy=""0"" r=""505"" fill=""black"" />
  <circle cx=""0"" cy=""0"" r=""500"" fill=""white"" />
  <circle cx=""0"" cy=""0"" r=""400"" fill=""black"" />
  <circle cx=""0"" cy=""0"" r=""300"" fill=""white"" />
  <circle cx=""0"" cy=""0"" r=""200"" fill=""black"" />
  <circle cx=""0"" cy=""0"" r=""100"" fill=""white"" />
  <line x1=""-415"" y1=""-415"" x2=""-390"" y2=""-390"" stroke=""black"" stroke-width=""20""/>
  <polygon points=""-375 -415, -415 -375, -360 -360"" />

  <path id=""circle2"" fill=""transparent""
      d=""
      M 0 0
      m -130, 0
      a 130,130 0 1,1 260,0
      a 130,130 0 1,1 -260,0
      ""
  />
  <path id=""circle3"" fill=""transparent""
      d=""
      M 0 0
      m -230, 0
      a 230,230 0 1,1 460,0
      a 230,230 0 1,1 -460,0
      ""
  />
  <path id=""circle4"" fill=""transparent""
      d=""
      M 0 0
      m -330, 0
      a 330,330 0 1,1 660,0
      a 330,330 0 1,1 -660,0
      ""
  />
  <path id=""circle5"" fill=""transparent""
      d=""
      M 0 0
      m -430, 0
      a 430,430 0 1,1 860,0
      a 430,430 0 1,1 -860,0
      ""
  />

  <!-- First circle -->
");
            str.Append(LayoutWordCenter(layout.WordInCenter));
            str.Append(@"
  <!-- Second circle -->
");
            str.Append(LayoutWord(layout, 2));
            str.Append(@"
  <!-- Third circle -->
");
            str.Append(LayoutWord(layout, 3));
            str.Append(@"
  <!-- Fourth circle -->
");
            str.Append(LayoutWord(layout, 4));
            str.Append(@"
  <!-- Fifth circle -->
");
            str.Append(LayoutWord(layout, 5));
            str.Append(@"
</svg>
");

            return(str.ToString());
        }