SvgHelper.cs 38 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556
  1. using DevExpress.Drawing.Internal.Fonts.Interop;
  2. using DevExpress.Utils;
  3. using DevExpress.Utils.Svg;
  4. using System;
  5. using System.Collections.Generic;
  6. using System.Data.SqlTypes;
  7. using System.Drawing;
  8. using System.IO;
  9. using System.IO.Ports;
  10. using System.Linq;
  11. using System.Text;
  12. using System.Threading.Tasks;
  13. using System.Xml;
  14. namespace DxHelper
  15. {
  16. public static class SvgHelper
  17. {
  18. static readonly Dictionary<string, SvgImage> cache = new Dictionary<string, SvgImage>();
  19. /// <summary>
  20. /// 判断color是否为HtmlColor(HtmlColor格式如#A1B2C3)
  21. /// </summary>
  22. /// <param name="color"></param>
  23. /// <returns></returns>
  24. public static bool IsHtmlColor(string color)
  25. {
  26. if (!color.StartsWith("#")) return false;
  27. if (color.Length != 7) return false;
  28. string r = color.Substring(1, 2);
  29. string g = color.Substring(3, 2);
  30. string b = color.Substring(5, 2);
  31. bool r1 = byte.TryParse(r, System.Globalization.NumberStyles.HexNumber, null, out _);
  32. bool r2 = byte.TryParse(g, System.Globalization.NumberStyles.HexNumber, null, out _);
  33. bool r3 = byte.TryParse(b, System.Globalization.NumberStyles.HexNumber, null, out _);
  34. return r1 & r2 & r3;
  35. }
  36. /// <summary>
  37. /// 将SvgImage转换为Image对象
  38. /// </summary>
  39. /// <param name="svg"></param>
  40. /// <param name="width"></param>
  41. /// <param name="height"></param>
  42. /// <returns></returns>
  43. public static Image SvgToImage(SvgImage svg, int width, int height)
  44. {
  45. var img = svg.Render(new Size(width, height), null, DefaultBoolean.False, DefaultBoolean.False);
  46. return img;
  47. }
  48. /// <summary>
  49. /// 将文件转换为SvgImage对象
  50. /// </summary>
  51. /// <param name="svgFile"></param>
  52. /// <returns></returns>
  53. public static SvgImage LoadFromFile(string svgFile)
  54. {
  55. return SvgLoader.LoadFromFile(svgFile);
  56. }
  57. /// <summary>
  58. /// 新增图片(➕号)
  59. /// </summary>
  60. /// <param name="color"></param>
  61. /// <param name="width"></param>
  62. /// <param name="height"></param>
  63. /// <returns></returns>
  64. public static SvgImage CreateAdd(string color = "#039C23", int width = 24, int height = 24)
  65. {
  66. string xml = $"<svg xmlns='http://www.w3.org/2000/svg\' width='{width}px' height='{height}px' viewBox='0 0 32 32'>"
  67. + $"<path fill='{color}' d='M27,14h-9V5c0-0.5-0.5-1-1-1h-2c-0.5,0-1,0.5-1,1v9H5c-0.5,0-1,0.5-1,1v2c0,0.5,0.5,1,1,1h9v9c0,0.5,0.5,1,1,1h2c0.5,0,1-0.5,1-1v-9h9c0.5,0,1-0.5,1-1v-2C28,14.5,27.5,14,27,14z'/>"
  68. + "</svg>";
  69. MemoryStream ms = new MemoryStream(Encoding.UTF8.GetBytes(xml));
  70. var svg = SvgLoader.LoadFromStream(ms);
  71. ms.Dispose();
  72. return svg;
  73. }
  74. /// <summary>
  75. /// 编辑图片
  76. /// </summary>
  77. /// <param name="color"></param>
  78. /// <param name="width"></param>
  79. /// <param name="height"></param>
  80. /// <returns></returns>
  81. public static SvgImage CreateEdit(string color = "#1177D7", int width = 24, int height = 24)
  82. {
  83. string xml = $"<svg xmlns='http://www.w3.org/2000/svg\' width='{width}px' height='{height}px' viewBox='0 0 32 32'>"
  84. + $"<path fill='{color}' d='M27.6,8.2l-3.8-3.8c-0.5-0.5-1.4-0.5-1.9,0l-2.5,2.5l5.8,5.8l2.5-2.5C28.1,9.6,28.1,8.8,27.6,8.2z'/>"
  85. + $"<polygon fill='{color}' points='4,28 9.8,28 4,22.2'/>"
  86. + $"<rect fill='{color}' x='5.8' y='13.4' transform='matrix(0.707 -0.7072 0.7072 0.707 -8.0721 15.4048)' width='17.6' height='8.2'/>"
  87. + "</svg>";
  88. MemoryStream ms = new MemoryStream(Encoding.UTF8.GetBytes(xml));
  89. var svg = SvgLoader.LoadFromStream(ms);
  90. ms.Dispose();
  91. return svg;
  92. }
  93. /// <summary>
  94. /// 移除图片(➖号)
  95. /// </summary>
  96. /// <param name="color"></param>
  97. /// <param name="width"></param>
  98. /// <param name="height"></param>
  99. /// <returns></returns>
  100. public static SvgImage CreateRemove(string color = "#1177D7", int width = 24, int height = 24)
  101. {
  102. string xml = $"<svg xmlns='http://www.w3.org/2000/svg\' width='{width}px' height='{height}px' viewBox='0 0 32 32'>"
  103. + $"<path fill='{color}' d='M27,18H5c-0.6,0-1-0.5-1-1v-2c0-0.6,0.4-1,1-1h22c0.5,0,1,0.4,1,1v2C28,17.5,27.5,18,27,18z'/>"
  104. + "</svg>";
  105. MemoryStream ms = new MemoryStream(Encoding.UTF8.GetBytes(xml));
  106. var svg = SvgLoader.LoadFromStream(ms);
  107. ms.Dispose();
  108. return svg;
  109. }
  110. /// <summary>
  111. /// 创建一个Svg圆.该圆的圆心在ViewBox的中心
  112. /// </summary>
  113. /// <param name="colorKey">用于生成颜色的一个key,相同的key具有相同的颜色,当colorKey为html颜色时则使用此颜色(如#A1B2FF)</param>
  114. /// <param name="opacity">透明度,默认不透明</param>
  115. /// <param name="viewBoxWidth">视口宽度,默认32px</param>
  116. /// <param name="viewBoxHeight">视口高度,默认32px</param>
  117. /// <param name="radius">半径,默认16px</param>
  118. /// <param name="offsetX">圆心的X轴偏移量,负向左偏移,正向右偏移,默认为0处于视口中心</param>
  119. /// <returns></returns>
  120. public static SvgImage CreateCycle(string colorKey, double opacity = 1, int viewBoxWidth = 32, int viewBoxHeight = 32, int radius = 16, double offsetX = 0)
  121. {
  122. if (colorKey == null) colorKey = "";
  123. if (cache.ContainsKey(colorKey))
  124. return cache[colorKey];
  125. SvgImage svg = new SvgImage();
  126. SvgRoot root = SvgRoot.Create(new SvgElementProperties(), viewBox: new SvgViewBox(0, 0, viewBoxWidth, viewBoxHeight));
  127. svg.Elements.Add(root);
  128. string colorStr;
  129. if (IsHtmlColor(colorKey))
  130. colorStr = colorKey;
  131. else
  132. colorStr = ColorHelper.GetHtmlColor(colorKey);
  133. SvgElementProperties props = new SvgElementProperties
  134. {
  135. Fill = colorStr,
  136. Opacity = opacity//透明度
  137. };
  138. SvgCircle circle = SvgCircle.Create(props, viewBoxWidth / 2 + offsetX, viewBoxHeight / 2, radius);
  139. root.Elements.Add(circle);
  140. //SvgImage未公开Width和Height属性的公共写入,需要通过以下方式可对width和Size赋值
  141. MemoryStream ms = new MemoryStream();
  142. svg.Save(ms);
  143. svg = ms.ToArray();
  144. cache.Add(colorKey, svg);
  145. ms.Dispose();
  146. return svg;
  147. }
  148. /// <summary>
  149. /// 删除或关闭图片(一个叉叉)
  150. /// </summary>
  151. /// <param name="colorStr"></param>
  152. /// <param name="opacity"></param>
  153. /// <returns></returns>
  154. public static SvgImage CreateClose(string colorStr = "#D11C1C", double opacity = 1)
  155. {
  156. if (string.IsNullOrWhiteSpace(colorStr))
  157. colorStr = $"#D11C1C";
  158. string xml = $"<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox='0 0 32 32'>\r\n<g>\r\n<path opacity=\"{opacity}\" fill=\"{colorStr}\" d=\"M18.8,16l6.9-6.9c0.4-0.4,0.4-1,0-1.4l-1.4-1.4c-0.4-0.4-1-0.4-1.4,0L16,13.2L9.1,6.3c-0.4-0.4-1-0.4-1.4,0\r\nL6.3,7.7c-0.4,0.4-0.4,1,0,1.4l6.9,6.9l-6.9,6.9c-0.4,0.4-0.4,1,0,1.4l1.4,1.4c0.4,0.4,1,0.4,1.4,0l6.9-6.9l6.9,6.9\r\nc0.4,0.4,1,0.4,1.4,0l1.4-1.4c0.4-0.4,0.4-1,0-1.4L18.8,16z\"/>\r\n</g>\r\n</svg>";
  159. MemoryStream ms = new MemoryStream(Encoding.UTF8.GetBytes(xml));
  160. var svg = SvgLoader.LoadFromStream(ms);
  161. ms.Dispose();
  162. return svg;
  163. }
  164. /// <summary>
  165. /// 清除图片(一个橡皮擦)
  166. /// </summary>
  167. /// <returns></returns>
  168. public static SvgImage CreateClear()
  169. {
  170. string xml = $"<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox='0 0 32 32'>\r\n<path class=\"Blue\" d=\"M16.1,23.1l-4.4,4.4c-0.7,0.7-1.9,0.7-2.6,0l-6.6-6.6c-0.7-0.7-0.7-1.9,0-2.6L6.9,14L16.1,23.1z\"/><path class=\"Red\" d=\"M27.5,11.8l-10,10l-9.2-9.2l10-10c0.7-0.7,1.9-0.7,2.6,0l6.6,6.6C28.2,9.9,28.2,11,27.5,11.8z\"/></svg>";
  171. MemoryStream ms = new MemoryStream(Encoding.UTF8.GetBytes(xml));
  172. var svg = SvgLoader.LoadFromStream(ms);
  173. ms.Dispose();
  174. return svg;
  175. }
  176. /// <summary>
  177. /// 测距图片
  178. /// </summary>
  179. /// <returns></returns>
  180. public static SvgImage CreateDistanceLine()
  181. {
  182. string xml = $"<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox='0 0 32 32'>"
  183. + "<path class=\"Blue\" d=\"M27,8c-1.7,0-3,1.3-3,3c0,0.5,0.1,0.9,0.3,1.3l-6,6C17.9,18.1,17.5,18,17,18s-0.9,0.1-1.3,0.3l-2-2\r\n\t\tc0.2-0.4,0.3-0.8,0.3-1.3c0-1.7-1.3-3-3-3s-3,1.3-3,3c0,0.5,0.1,0.9,0.3,1.3l-2,2C5.9,18.1,5.5,18,5,18c-1.7,0-3,1.3-3,3s1.3,3,3,3\r\n\t\ts3-1.3,3-3c0-0.5-0.1-0.9-0.3-1.3l2-2c0.4,0.2,0.8,0.3,1.3,0.3s0.9-0.1,1.3-0.3l2,2C14.1,20.1,14,20.5,14,21c0,1.7,1.3,3,3,3\r\n\t\ts3-1.3,3-3c0-0.5-0.1-0.9-0.3-1.3l6-6c0.4,0.2,0.8,0.3,1.3,0.3c1.7,0,3-1.3,3-3S28.7,8,27,8z M5,22c-0.6,0-1-0.4-1-1s0.4-1,1-1\r\n\t\ts1,0.4,1,1S5.6,22,5,22z M11,16c-0.6,0-1-0.4-1-1s0.4-1,1-1s1,0.4,1,1S11.6,16,11,16z M17,22c-0.6,0-1-0.4-1-1s0.4-1,1-1s1,0.4,1,1\r\n\t\tS17.6,22,17,22z M27,12c-0.6,0-1-0.4-1-1s0.4-1,1-1s1,0.4,1,1S27.6,12,27,12z\"/>"
  184. + "</svg>";
  185. MemoryStream ms = new MemoryStream(Encoding.UTF8.GetBytes(xml));
  186. var svg = SvgLoader.LoadFromStream(ms);
  187. ms.Dispose();
  188. return svg;
  189. }
  190. /// <summary>
  191. /// 标点图片(一个五角星)
  192. /// </summary>
  193. /// <param name="color"></param>
  194. /// <param name="width"></param>
  195. /// <param name="height"></param>
  196. /// <returns></returns>
  197. public static SvgImage CreateMarkDot(string color = "#F12233", int width = 24, int height = 24)
  198. {
  199. string xml = $"<svg xmlns=\"http://www.w3.org/2000/svg\" width='{width}px' height='{height}px' viewBox='0 0 32 32'>"
  200. + $"<path fill='{color}' d=\"M6,8c0,1.1-0.9,2-2,2c-1.1,0-2-0.9-2-2s0.9-2,2-2C5.1,6,6,6.9,6,8z M10,22c-1.1,0-2,0.9-2,2s0.9,2,2,2c1.1,0,2-0.9,2-2S11.1,22,10,22z M18,16c-1.1,0-2,0.9-2,2s0.9,2,2,2c1.1,0,2-0.9,2-2S19.1,16,18,16z M22,8c-1.1,0-2,0.9-2,2c0,1.1,0.9,2,2,2c1.1,0,2-0.9,2-2C24,8.9,23.1,8,22,8z M28,4c-1.1,0-2,0.9-2,2s0.9,2,2,2c1.1,0,2-0.9,2-2S29.1,4,28,4z\"/><path class=\"Yellow\" d=\"M8,18c0,1.1-0.9,2-2,2c-1.1,0-2-0.9-2-2s0.9-2,2-2C7.1,16,8,16.9,8,18z M12,10c-1.1,0-2,0.9-2,2s0.9,2,2,2c1.1,0,2-0.9,2-2S13.1,10,12,10z M4,26c-1.1,0-2,0.9-2,2s0.9,2,2,2c1.1,0,2-0.9,2-2S5.1,26,4,26z M20,2c-1.1,0-2,0.9-2,2s0.9,2,2,2\r\n\tc1.1,0,2-0.9,2-2S21.1,2,20,2z M28,12c-1.1,0-2,0.9-2,2s0.9,2,2,2c1.1,0,2-0.9,2-2S29.1,12,28,12z\"/>"
  201. + "</svg>";
  202. MemoryStream ms = new MemoryStream(Encoding.UTF8.GetBytes(xml));
  203. var svg = SvgLoader.LoadFromStream(ms);
  204. ms.Dispose();
  205. return svg;
  206. }
  207. /// <summary>
  208. /// 接收天线
  209. /// </summary>
  210. /// <param name="color"></param>
  211. /// <param name="width"></param>
  212. /// <param name="height"></param>
  213. /// <returns></returns>
  214. public static SvgImage CreateAnt(string color = "#1177D7", int width = 24, int height = 24)
  215. {
  216. string xml = $"<svg xmlns=\"http://www.w3.org/2000/svg\" width='{width}px' height='{height}px' viewBox='0 0 329.871 329.871'>" + $"<path fill='{color}' d='M104.839,60c-8.284,0-15,6.716-15,15c0,8.284,6.716,15,15,15c74.439,0,135,60.561,135,135c0,8.284,6.716,15,15,15c8.284,0,15-6.716,15-15C269.839,134.018,195.82,60,104.839,60z'/> <path fill='{color}' d='M159.141,191.91l18.878-18.877c5.858-5.857,5.858-15.355,0.001-21.213c-5.858-5.858-15.355-5.858-21.214,0l-18.878,18.877l-76.34-76.34c-5.857-5.857-15.355-5.857-21.213,0c-53.791,53.791-53.791,141.314,0,195.105c26.057,26.059,60.701,40.408,97.553,40.408c36.852,0,71.496-14.35,97.553-40.408c5.857-5.857,5.857-15.355,0-21.213L159.141,191.91z'/>"
  217. + "</svg>";
  218. MemoryStream ms = new MemoryStream(Encoding.UTF8.GetBytes(xml));
  219. var svg = SvgLoader.LoadFromStream(ms);
  220. ms.Dispose();
  221. return svg;
  222. }
  223. /// <summary>
  224. /// 圆点
  225. /// </summary>
  226. /// <param name="color"></param>
  227. /// <param name="width"></param>
  228. /// <param name="height"></param>
  229. /// <returns></returns>
  230. public static SvgImage CreateGeoDot(string color = "#D11C1C", int width = 24, int height = 24)
  231. {
  232. string xml = $"<svg xmlns=\"http://www.w3.org/2000/svg\" width='{width}px' height='{height}px' viewBox='0 0 32 32'>" + $"<path fill='{color}' d='M16,2C10.5,2,6,6.5,6,12s10,18,10,18s10-12.5,10-18S21.5,2,16,2z M16,16c-2.2,0-4-1.8-4-4s1.8-4,4-4s4,1.8,4,4S18.2,16,16,16z'/>"
  233. + "</svg>";
  234. MemoryStream ms = new MemoryStream(Encoding.UTF8.GetBytes(xml));
  235. var svg = SvgLoader.LoadFromStream(ms);
  236. ms.Dispose();
  237. return svg;
  238. }
  239. /// <summary>
  240. /// 五角星图片
  241. /// </summary>
  242. /// <param name="color"></param>
  243. /// <param name="width"></param>
  244. /// <param name="height"></param>
  245. /// <returns></returns>
  246. public static SvgImage CreatePentagram(string color = "#1177D7", int width = 24, int height = 24)
  247. {
  248. string xml = $"<svg xmlns='http://www.w3.org/2000/svg\' width='{width}px' height='{height}px' viewBox='0 0 32 32'>" + $"<polygon fill='{color}' points='16,4 19.9,11.9 28.6,13.2 22.3,19.3 23.8,28 16,23.9 8.2,28 9.7,19.3 3.4,13.2 12.1,11.9'/>"
  249. + "</svg>";
  250. MemoryStream ms = new MemoryStream(Encoding.UTF8.GetBytes(xml));
  251. var svg = SvgLoader.LoadFromStream(ms);
  252. ms.Dispose();
  253. return svg;
  254. }
  255. /// <summary>
  256. /// 卫星图片
  257. /// </summary>
  258. /// <param name="color"></param>
  259. /// <param name="width"></param>
  260. /// <param name="height"></param>
  261. /// <returns></returns>
  262. public static SvgImage CreateSat(string color = "#1177D7", int width = 24, int height = 24)
  263. {
  264. string xml = $"<svg xmlns=\"http://www.w3.org/2000/svg\" width='{width}px' height='{height}px' viewBox='0 0 297.131 297.131'>"
  265. + $"<path fill='{color}' d='M196.826,68.171c17.691,0.002,32.084,14.405,32.084,32.108c0,5.54,4.492,10.033,10.033,10.033 c5.54,0,10.033-4.493,10.033-10.033c0-28.768-23.394-52.173-52.148-52.175h-0.001c-5.54,0-10.033,4.491-10.033,10.032 C186.794,63.679,191.286,68.171,196.826,68.171z'/>"
  266. + $"<path fill='{color}' d='M196.827,34.094c36.476,0.002,66.15,29.692,66.15,66.186c0,5.54,4.492,10.033,10.033,10.033 c5.541,0,10.033-4.493,10.033-10.033c0-47.558-38.677-86.25-86.217-86.252c-5.54,0-10.033,4.491-10.033,10.033 C186.794,29.601,191.286,34.094,196.827,34.094z'/>"
  267. + $"<path fill='{color}' d='M187.387,160.099c13.264-13.271,13.264-34.984,0-48.254l-2.119-2.12c-6.631-6.635-15.374-9.952-24.115-9.952 c-8.743,0-17.484,3.316-24.116,9.953l-27.294,27.307c-13.264,13.271-13.264,34.984,0,48.254l2.12,2.12 c6.631,6.635,15.374,9.952,24.114,9.952c8.744,0,17.485-3.316,24.117-9.953L187.387,160.099z'/> "
  268. + $"<path fill='{color}' d='M98.388,125.684l27.295-27.307c7.865-7.869,17.917-12.782,28.811-14.212l-8.862-26.783 c-0.492-1.485-1.323-2.834-2.43-3.94L92.722,2.94C90.841,1.058,88.287,0,85.626,0c-2.662,0-5.215,1.059-7.097,2.94L3.001,78.505 c-3.915,3.918-3.915,10.269,0.002,14.186l50.48,50.501c1.106,1.107,2.456,1.938,3.941,2.432l26.752,8.861 C85.579,143.943,90.31,133.767,98.388,125.684z'/>"
  269. + $"<path fill='{color}' d='M294.128,204.439l-50.481-50.499c-1.107-1.106-2.456-1.938-3.941-2.43l-26.753-8.864 c-1.403,10.541-6.134,20.718-14.212,28.8l-27.294,27.308c-7.865,7.869-17.916,12.782-28.809,14.212l8.862,26.781 c0.492,1.484,1.323,2.834,2.429,3.941l50.478,50.503c1.882,1.882,4.435,2.94,7.097,2.94s5.215-1.058,7.096-2.94l75.529-75.564 C298.045,214.708,298.045,208.357,294.128,204.439z'/>"
  270. + "</svg>";
  271. MemoryStream ms = new MemoryStream(Encoding.UTF8.GetBytes(xml));
  272. var svg = SvgLoader.LoadFromStream(ms);
  273. ms.Dispose();
  274. return svg;
  275. }
  276. public static SvgImage CreateRect(string color = "#1177D7", int width = 24, int height = 24)
  277. {
  278. string xml = $"<svg xmlns='http://www.w3.org/2000/svg\' width='{width}px' height='{height}px' viewBox='0 0 512 512'>"
  279. + $"<path fill='{color}' d='M0,0v512h512V0H0z M465.5,465.5H46.5V46.5h418.9V465.5z'/>"
  280. + "</svg>";
  281. MemoryStream ms = new MemoryStream(Encoding.UTF8.GetBytes(xml));
  282. var svg = SvgLoader.LoadFromStream(ms);
  283. ms.Dispose();
  284. return svg;
  285. }
  286. /// <summary>
  287. /// 时隙参估图片
  288. /// </summary>
  289. /// <param name="color"></param>
  290. /// <param name="width"></param>
  291. /// <param name="height"></param>
  292. /// <returns></returns>
  293. public static SvgImage CreateSlotCg(string color = "#1177D7", int width = 24, int height = 24)
  294. {
  295. string xml = $"<svg xmlns='http://www.w3.org/2000/svg\' width='{width}px' height='{height}px' viewBox='0 0 32 32'>"
  296. + $"<path fill='{color}' d='M6,30H2V2h4V30z M12,2H8v28h4V2z M18,2h-4v28h4V2z M24,2h-4v28h4V2z M30,2h-4v28h4V2z'/>"
  297. + "</svg>";
  298. MemoryStream ms = new MemoryStream(Encoding.UTF8.GetBytes(xml));
  299. var svg = SvgLoader.LoadFromStream(ms);
  300. ms.Dispose();
  301. return svg;
  302. }
  303. /// <summary>
  304. /// 导出图像图片
  305. /// </summary>
  306. /// <returns></returns>
  307. public static SvgImage CreateExportImg()
  308. {
  309. string xml = $"<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox='0 0 32 32'>" + "<style type=\"text/css\">\r\n\t.Black{fill:#727272;}\r\n\t.Blue{fill:#1177D7;}\r\n\t.Red{fill:#D11C1C;}\r\n\t.st0{opacity:0.2;}\r\n</style>\r\n<path class=\"Black\" d=\"M8,4h18v6h2V3c0-0.5-0.5-1-1-1H7C6.5,2,6,2.5,6,3v7h2V4z\"/>\r\n<path class=\"Black\" d=\"M26,28H8V16H6v13c0,0.5,0.5,1,1,1h20c0.5,0,1-0.5,1-1V16h-2V28z\"/>\r\n<path class=\"Red\" d=\"M29,8H5C4.4,8,4,8.4,4,9v10c0,0.6,0.4,1,1,1h24c0.6,0,1-0.4,1-1V9C30,8.4,29.6,8,29,8z M9.5,17.9H8v-7.7h1.5\r\n\tV17.9z M18.9,17.9h-1.5v-4.6c0-0.5,0-1,0.1-1.6l0,0c-0.1,0.5-0.2,0.8-0.2,1l-1.6,5.2h-1.3l-1.6-5.2c0-0.1-0.1-0.5-0.2-1.1l0,0\r\n\tc0,0.8,0.1,1.4,0.1,2v4.3h-1.4v-7.7h2.2l1.4,4.6c0.1,0.4,0.2,0.7,0.2,1.1l0,0c0.1-0.4,0.2-0.8,0.3-1.1l1.4-4.6H19v7.7H18.9z\r\n\t M26,17.3c-0.7,0.4-1.5,0.7-2.5,0.7c-1.1,0-2-0.3-2.6-1S20,15.4,20,14.2s0.3-2.2,1-3s1.6-1.1,2.8-1.1c0.7,0,1.4,0.1,1.9,0.3V12\r\n\tc-0.5-0.3-1.2-0.5-1.9-0.5c-0.6,0-1.2,0.2-1.6,0.7s-0.6,1.1-0.6,1.9c0,0.8,0.2,1.4,0.5,1.8c0.4,0.4,0.8,0.6,1.5,0.6\r\n\tc0.4,0,0.7-0.1,0.9-0.2v-1.5h-1.4v-1.4H26V17.3z\"/>\r\n<g class=\"st0\">\r\n\t<path class=\"Blue\" d=\"M29,8H5C4.4,8,4,8.4,4,9v10c0,0.6,0.4,1,1,1h24c0.6,0,1-0.4,1-1V9C30,8.4,29.6,8,29,8z M9.5,17.9H8v-7.7h1.5\r\n\t\tV17.9z M18.9,17.9h-1.5v-4.6c0-0.5,0-1,0.1-1.6l0,0c-0.1,0.5-0.2,0.8-0.2,1l-1.6,5.2h-1.3l-1.6-5.2c0-0.1-0.1-0.5-0.2-1.1l0,0\r\n\t\tc0,0.8,0.1,1.4,0.1,2v4.3h-1.4v-7.7h2.2l1.4,4.6c0.1,0.4,0.2,0.7,0.2,1.1l0,0c0.1-0.4,0.2-0.8,0.3-1.1l1.4-4.6H19v7.7H18.9z M26,17.3c-0.7,0.4-1.5,0.7-2.5,0.7c-1.1,0-2-0.3-2.6-1S20,15.4,20,14.2s0.3-2.2,1-3s1.6-1.1,2.8-1.1c0.7,0,1.4,0.1,1.9,0.3V12\r\n\t\tc-0.5-0.3-1.2-0.5-1.9-0.5c-0.6,0-1.2,0.2-1.6,0.7s-0.6,1.1-0.6,1.9c0,0.8,0.2,1.4,0.5,1.8c0.4,0.4,0.8,0.6,1.5,0.6\r\n\t\tc0.4,0,0.7-0.1,0.9-0.2v-1.5h-1.4v-1.4H26V17.3z\"/>\r\n</g>"
  310. + "</svg>";
  311. MemoryStream ms = new MemoryStream(Encoding.UTF8.GetBytes(xml));
  312. var svg = SvgLoader.LoadFromStream(ms);
  313. ms.Dispose();
  314. return svg;
  315. }
  316. /// <summary>
  317. /// 导出Excel图片
  318. /// </summary>
  319. /// <returns></returns>
  320. public static SvgImage CreateExportXlsx()
  321. {
  322. string xml = $"<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox='0 0 32 32'>" + "<style type=\"text/css\">\r\n\t.Green{fill:#039C23;}\r\n\t.Black{fill:#727272;}\r\n\t.Blue{fill:#1177D7;}\r\n\t.st0{opacity:0.3;}\r\n</style>\r\n<path class=\"Black\" d=\"M8,4h18v6h2V3c0-0.5-0.5-1-1-1H7C6.5,2,6,2.5,6,3v7h2V4z\"/>\r\n<path class=\"Black\" d=\"M26,28H8V18H6v11c0,0.5,0.5,1,1,1h20c0.5,0,1-0.5,1-1V18h-2V28z\"/>\r\n<path class=\"Green\" d=\"M31,8H3C2.4,8,2,8.4,2,9v10c0,0.6,0.4,1,1,1h28c0.6,0,1-0.4,1-1V9C32,8.4,31.6,8,31,8z M9.1,18l-1.3-2.5\r\n\tc-0.1-0.1-0.1-0.3-0.2-0.5l0,0c0,0.1-0.1,0.3-0.2,0.5L6.1,18H4l2.5-3.9l-2.2-3.9h2.1l1.1,2.3c0.1,0.2,0.2,0.4,0.2,0.7l0,0\r\n\tc0-0.2,0.1-0.4,0.2-0.7l1.2-2.3H11L8.7,14l2.4,3.9L9.1,18L9.1,18z M16.7,18h-4.6v-7.7h1.7v6.3h2.9V18z M22.4,16.9\r\n\tc-0.2,0.3-0.4,0.5-0.7,0.7s-0.6,0.3-1,0.4s-0.8,0.1-1.2,0.1c-0.4,0-0.8,0-1.2-0.1c-0.4-0.1-0.7-0.2-1-0.3V16c0.3,0.3,0.6,0.5,1,0.6\r\n\ts0.7,0.2,1.1,0.2c0.2,0,0.4,0,0.6-0.1s0.3-0.1,0.4-0.2s0.2-0.2,0.2-0.2c0.1-0.1,0.1-0.2,0.1-0.3c0-0.2,0-0.3-0.1-0.4\r\n\tc-0.1-0.1-0.2-0.2-0.4-0.3S20,15.1,19.8,15s-0.4-0.2-0.7-0.3c-0.6-0.3-1.1-0.6-1.3-0.9c-0.3-0.4-0.4-0.8-0.4-1.3\r\n\tc0-0.4,0.1-0.7,0.2-1c0.2-0.3,0.4-0.5,0.7-0.7c0.3-0.2,0.6-0.3,1-0.4s0.8-0.1,1.2-0.1c0.4,0,0.8,0,1.1,0.1c0.3,0,0.6,0.1,0.9,0.2\r\n\tv1.6c-0.1-0.1-0.3-0.2-0.4-0.2s-0.3-0.1-0.5-0.2c-0.2,0-0.3-0.1-0.5-0.1s-0.3,0-0.5,0s-0.4,0-0.5,0.1c-0.2,0-0.3,0.1-0.4,0.2\r\n\tc-0.1,0.1-0.2,0.1-0.3,0.2c-0.1,0.1-0.1,0.2-0.1,0.3s0,0.2,0.1,0.3s0.2,0.2,0.3,0.3c0.1,0.1,0.3,0.2,0.5,0.3s0.4,0.2,0.6,0.3\r\n\tc0.3,0.1,0.6,0.3,0.8,0.4c0.2,0.1,0.5,0.3,0.6,0.5c0.2,0.2,0.3,0.4,0.4,0.6s0.1,0.5,0.1,0.8C22.6,16.3,22.5,16.6,22.4,16.9z\r\n\t M28.1,18l-1.3-2.5c-0.1-0.1-0.1-0.3-0.2-0.5l0,0c0,0.1-0.1,0.3-0.2,0.5L25.1,18H23l2.5-3.9l-2.2-3.9h2.1l1.1,2.3\r\n\tc0.1,0.2,0.2,0.4,0.2,0.7l0,0c0-0.2,0.1-0.4,0.2-0.7l1.2-2.3H30L27.7,14l2.4,3.9L28.1,18L28.1,18z\"/>\r\n<g class=\"st0\">\r\n\t<path class=\"Blue\" d=\"M31,8H3C2.4,8,2,8.4,2,9v10c0,0.6,0.4,1,1,1h28c0.6,0,1-0.4,1-1V9C32,8.4,31.6,8,31,8z M9.1,18l-1.3-2.5\r\n\t\tc-0.1-0.1-0.1-0.3-0.2-0.5l0,0c0,0.1-0.1,0.3-0.2,0.5L6.1,18H4l2.5-3.9l-2.2-3.9h2.1l1.1,2.3c0.1,0.2,0.2,0.4,0.2,0.7l0,0\r\n\t\tc0-0.2,0.1-0.4,0.2-0.7l1.2-2.3H11L8.7,14l2.4,3.9L9.1,18L9.1,18z M16.7,18h-4.6v-7.7h1.7v6.3h2.9V18z M22.4,16.9\r\n\t\tc-0.2,0.3-0.4,0.5-0.7,0.7s-0.6,0.3-1,0.4s-0.8,0.1-1.2,0.1c-0.4,0-0.8,0-1.2-0.1c-0.4-0.1-0.7-0.2-1-0.3V16c0.3,0.3,0.6,0.5,1,0.6\r\n\t\ts0.7,0.2,1.1,0.2c0.2,0,0.4,0,0.6-0.1s0.3-0.1,0.4-0.2s0.2-0.2,0.2-0.2c0.1-0.1,0.1-0.2,0.1-0.3c0-0.2,0-0.3-0.1-0.4\r\n\t\tc-0.1-0.1-0.2-0.2-0.4-0.3S20,15.1,19.8,15s-0.4-0.2-0.7-0.3c-0.6-0.3-1.1-0.6-1.3-0.9c-0.3-0.4-0.4-0.8-0.4-1.3\r\n\t\tc0-0.4,0.1-0.7,0.2-1c0.2-0.3,0.4-0.5,0.7-0.7c0.3-0.2,0.6-0.3,1-0.4s0.8-0.1,1.2-0.1c0.4,0,0.8,0,1.1,0.1c0.3,0,0.6,0.1,0.9,0.2\r\n\t\tv1.6c-0.1-0.1-0.3-0.2-0.4-0.2s-0.3-0.1-0.5-0.2c-0.2,0-0.3-0.1-0.5-0.1s-0.3,0-0.5,0s-0.4,0-0.5,0.1c-0.2,0-0.3,0.1-0.4,0.2\r\n\t\tc-0.1,0.1-0.2,0.1-0.3,0.2c-0.1,0.1-0.1,0.2-0.1,0.3s0,0.2,0.1,0.3s0.2,0.2,0.3,0.3c0.1,0.1,0.3,0.2,0.5,0.3s0.4,0.2,0.6,0.3\r\n\t\tc0.3,0.1,0.6,0.3,0.8,0.4c0.2,0.1,0.5,0.3,0.6,0.5c0.2,0.2,0.3,0.4,0.4,0.6s0.1,0.5,0.1,0.8C22.6,16.3,22.5,16.6,22.4,16.9z M28.1,18l-1.3-2.5c-0.1-0.1-0.1-0.3-0.2-0.5l0,0c0,0.1-0.1,0.3-0.2,0.5L25.1,18H23l2.5-3.9l-2.2-3.9h2.1l1.1,2.3\r\n\t\tc0.1,0.2,0.2,0.4,0.2,0.7l0,0c0-0.2,0.1-0.4,0.2-0.7l1.2-2.3H30L27.7,14l2.4,3.9L28.1,18L28.1,18z\"/>\r\n</g>"
  323. + "</svg>";
  324. MemoryStream ms = new MemoryStream(Encoding.UTF8.GetBytes(xml));
  325. var svg = SvgLoader.LoadFromStream(ms);
  326. ms.Dispose();
  327. return svg;
  328. }
  329. /// <summary>
  330. /// 导出Csv图片
  331. /// </summary>
  332. /// <returns></returns>
  333. public static SvgImage CreateExportCsv()
  334. {
  335. string xml = $"<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox='0 0 32 32'>" + "<style type=\"text/css\">.Black{fill:#727272;}.Blue{fill:#1177D7;}</style><path class=\"Black\" d=\"M8,4h18v6h2V3c0-0.5-0.5-1-1-1H7C6.5,2,6,2.5,6,3v7h2V4z\"/>\r\n<path class=\"Black\" d=\"M26,28H8V18H6v11c0,0.5,0.5,1,1,1h20c0.5,0,1-0.5,1-1V18h-2V28z\"/>\r\n<path class=\"Blue\" d=\"M29,8h-1h-2H8H6H5C4.4,8,4,8.4,4,9v10c0,0.6,0.4,1,1,1h1h2h18h2h1c0.6,0,1-0.4,1-1V9C30,8.4,29.6,8,29,8z\r\n\t M12.9,12c-0.5-0.3-1-0.5-1.6-0.5c-0.7,0-1.2,0.2-1.6,0.7C9.2,12.6,9,13.3,9,14c0,0.7,0.2,1.3,0.6,1.8s0.9,0.7,1.6,0.7\r\n\tc0.6,0,1.2-0.2,1.7-0.5v1.6c-0.5,0.3-1.2,0.4-2,0.4c-1.1,0-2-0.3-2.6-1c-0.1-0.1-0.2-0.2-0.2-0.3c-0.5-0.6-0.7-1.5-0.7-2.4\r\n\tc0-1,0.2-1.8,0.7-2.5c0.1-0.2,0.2-0.3,0.4-0.5C9.1,10.4,10,10,11.1,10c0.7,0,1.3,0.1,1.8,0.3V12z M19.2,16.8\r\n\tc-0.2,0.3-0.4,0.5-0.6,0.7c-0.3,0.2-0.6,0.3-0.9,0.4C17.4,17.9,17,18,16.6,18c-0.4,0-0.8,0-1.1-0.1c-0.4-0.1-0.7-0.2-0.9-0.3v-1.7\r\n\tc0.3,0.3,0.6,0.5,0.9,0.6c0.3,0.1,0.7,0.2,1,0.2c0.2,0,0.4,0,0.5-0.1c0.2,0,0.3-0.1,0.4-0.2c0.1-0.1,0.2-0.2,0.2-0.2\r\n\tc0.1-0.1,0.1-0.2,0.1-0.3c0-0.2,0-0.3-0.1-0.4s-0.2-0.2-0.3-0.3s-0.3-0.2-0.5-0.3s-0.4-0.2-0.6-0.3c-0.6-0.3-1-0.6-1.2-0.9\r\n\ts-0.4-0.8-0.4-1.3c0-0.4,0.1-0.7,0.2-1c0.1-0.3,0.4-0.5,0.6-0.7s0.6-0.3,0.9-0.4c0.3-0.1,0.7-0.1,1.1-0.1c0.4,0,0.7,0,1,0.1\r\n\tc0.3,0,0.6,0.1,0.8,0.2v1.6c-0.1-0.1-0.3-0.2-0.4-0.2c-0.1-0.1-0.3-0.1-0.4-0.2c-0.1,0-0.3-0.1-0.4-0.1c-0.1,0-0.3,0-0.4,0\r\n\tc-0.2,0-0.3,0-0.5,0.1c-0.1,0-0.3,0.1-0.4,0.2c-0.1,0.1-0.2,0.1-0.2,0.2c-0.1,0.1-0.1,0.2-0.1,0.3c0,0.1,0,0.2,0.1,0.3\r\n\tc0.1,0.1,0.2,0.2,0.3,0.3c0.1,0.1,0.3,0.2,0.4,0.3c0.2,0.1,0.4,0.2,0.6,0.3c0.3,0.1,0.5,0.3,0.8,0.4c0.2,0.1,0.4,0.3,0.6,0.5\r\n\tc0.2,0.2,0.3,0.4,0.4,0.6c0.1,0.2,0.1,0.5,0.1,0.8C19.5,16.1,19.4,16.5,19.2,16.8z M26,13.2l-1.5,4.7h-1.8L20.3,10H22l1.5,5.5\r\n\tc0.1,0.3,0.1,0.5,0.1,0.8h0c0-0.2,0.1-0.5,0.2-0.8l1.5-5.5H26h1L26,13.2z\"/>"
  336. + "</svg>";
  337. MemoryStream ms = new MemoryStream(Encoding.UTF8.GetBytes(xml));
  338. var svg = SvgLoader.LoadFromStream(ms);
  339. ms.Dispose();
  340. return svg;
  341. }
  342. /// <summary>
  343. /// 时差线图片
  344. /// </summary>
  345. /// <returns></returns>
  346. public static SvgImage CreateDtoLine(string color = "#039C23", int width = 24, int height = 24)
  347. {
  348. string xml = $"<svg xmlns='http://www.w3.org/2000/svg\' width='{width}px' height='{height}px' viewBox='0 0 32 32'>"
  349. + $"<path fill='{color}' d='M32,16c0,4.4-3.6,8-8,8c-0.2,0-0.3,0-0.5,0c1.6-2.3,2.5-5.1,2.5-8s-0.9-5.6-2.5-8c0.2,0,0.3,0,0.5,0C28.4,8,32,11.6,32,16z M14,16c0-3.9,2.3-7.5,5.8-9.1C17.7,5.1,15,4,12,4C5.4,4,0,9.4,0,16c0,6.6,5.4,12,12,12c3,0,5.7-1.1,7.8-2.9C16.3,23.5,14,19.9,14,16z M21.3,8.5C18.2,9.6,16,12.5,16,16s2.2,6.4,5.3,7.5C23,21.5,24,18.9,24,16S23,10.5,21.3,8.5z'/>"
  350. + "</svg>";
  351. MemoryStream ms = new MemoryStream(Encoding.UTF8.GetBytes(xml));
  352. var svg = SvgLoader.LoadFromStream(ms);
  353. ms.Dispose();
  354. return svg;
  355. }
  356. /// <summary>
  357. /// 频差线图片
  358. /// </summary>
  359. /// <returns></returns>
  360. public static SvgImage CreateDfoLine(string color = "#039C23", int width = 24, int height = 24)
  361. {
  362. string xml = $"<svg xmlns='http://www.w3.org/2000/svg\' width='{width}px' height='{height}px' viewBox='0 0 32 32'>"
  363. + $"<path opacity='0.75' fill='{color}' d='M20.6,8.6C17.8,10.8,16,14.2,16,18c0,0.6-0.1,1.1-0.4,1.6C15,21,13.6,22,12,22c-2.2,0-4-1.8-4-4c0-3.3-2.7-6-6-6v2v2c1.1,0,2,0.9,2,2c0,4.4,3.6,8,8,8c0.7,0,1.4-0.1,2-0.3c0,0,0.1,0,0.1,0c0.2-0.1,0.5-0.1,0.7-0.2c0.1,0,0.1,0,0.2-0.1c0.3-0.1,0.5-0.2,0.8-0.4c0.1-0.1,0.3-0.2,0.4-0.2c0.1-0.1,0.2-0.1,0.3-0.2c0.2-0.1,0.3-0.2,0.4-0.3c0.1-0.1,0.2-0.2,0.3-0.2c1.7-1.5,2.7-3.6,2.7-6c0-2.7,1.4-5.1,3.4-6.6c1.3-0.9,2.9-1.4,4.6-1.4V8.3V6C25.2,6,22.6,7,20.6,8.6z'/>"
  364. + $"<path fill='{color}' d='M14,20c0.6,0,1.1-0.1,1.6-0.4C15,21,13.6,22,12,22c-2.2,0-4-1.8-4-4c0-3.3-2.7-6-6-6l2-2c3.3,0,6,2.7,6,6C10,18.2,11.8,20,14,20z M20,18c0,2.4-1.1,4.5-2.7,6c0.1-0.1,0.3-0.2,0.4-0.3l2-2c1.4-1.4,2.3-3.4,2.3-5.7c0-1.7,0.5-3.3,1.4-4.6C21.4,12.9,20,15.3,20,18z M28,6v2.3V10l2-2V4L28,6z'/>"
  365. + $"<path opacity='0.5' fill='{color}' d='M20.6,8.6C22.6,7,25.2,6,28,6l2-2C26.2,4,22.8,5.8,20.6,8.6z'/>"
  366. + "</svg>";
  367. MemoryStream ms = new MemoryStream(Encoding.UTF8.GetBytes(xml));
  368. var svg = SvgLoader.LoadFromStream(ms);
  369. ms.Dispose();
  370. return svg;
  371. }
  372. /// <summary>
  373. /// 测向线图片
  374. /// </summary>
  375. /// <returns></returns>
  376. public static SvgImage CreateCxLine(string color1 = "#FFB115", string color2 = "#039C23", int width = 24, int height = 24)
  377. {
  378. string xml = $"<svg xmlns='http://www.w3.org/2000/svg\' width='{width}px' height='{height}px' viewBox='0 0 32 32'>"
  379. + $"<rect x='8.9' y='15' fill='{color1}' transform='matrix(0.7071 -0.7071 0.7071 0.7071 -6.6274 16)' width='14.1' height='2'/>"
  380. + $"<path fill='{color2}' d='M10,26H4v-4h6V26z M28,6h-6v4h6V6z'/>"
  381. + "</svg>";
  382. MemoryStream ms = new MemoryStream(Encoding.UTF8.GetBytes(xml));
  383. var svg = SvgLoader.LoadFromStream(ms);
  384. ms.Dispose();
  385. return svg;
  386. }
  387. /// <summary>
  388. /// GDOP
  389. /// </summary>
  390. /// <returns></returns>
  391. public static SvgImage CreateGDOP(string color = "#1177D7", int width = 24, int height = 24)
  392. {
  393. string xml = $"<svg xmlns='http://www.w3.org/2000/svg\' width='{width}px' height='{height}px' viewBox='0 0 32 32'>"
  394. + $"<path opacity='0.35' fill='#727272' d='M16,0C7.2,0,0,7.2,0,16s7.2,16,16,16s16-7.2,16-16S24.8,0,16,0z M16,30C8.3,30,2,23.7,2,16S8.3,2,16,2\ts14,6.3,14,14S23.7,30,16,30z M16,6C10.5,6,6,10.5,6,16c0,5.5,4.5,10,10,10s10-4.5,10-10C26,10.5,21.5,6,16,6z M16,24c-4.4,0-8-3.6-8-8s3.6-8,8-8s8,3.6,8,8S20.4,24,16,24z M16,12c-2.2,0-4,1.8-4,4c0,2.2,1.8,4,4,4s4-1.8,4-4C20,13.8,18.2,12,16,12zM16,18c-1.1,0-2-0.9-2-2c0-1.1,0.9-2,2-2s2,0.9,2,2C18,17.1,17.1,18,16,18z'/>"
  395. + $"<path fill='{color}' d='M15,4c-0.6,0-1,0.4-1,1c0,0.6,0.4,1,1,1c6.1,0,11,4.9,11,11c0,4.4-3.6,8-8,8s-8-3.6-8-8c0-2.8,2.2-5,5-5s5,2.2,5,5c0,1.7-1.3,3-3,3s-3-1.3-3-3c0-0.6,0.4-1,1-1s1,0.4,1,1c0,0.6,0.4,1,1,1s1-0.4,1-1c0-1.7-1.3-3-3-3s-3,1.3-3,3c0,2.8,2.2,5,5,5s5-2.2,5-5c0-3.9-3.1-7-7-7s-7,3.1-7,7c0,5.5,4.5,10,10,10s10-4.5,10-10C28,9.8,22.2,4,15,4z'/>"
  396. + "</svg>";
  397. MemoryStream ms = new MemoryStream(Encoding.UTF8.GetBytes(xml));
  398. var svg = SvgLoader.LoadFromStream(ms);
  399. ms.Dispose();
  400. return svg;
  401. }
  402. /// <summary>
  403. /// 查看参估结果
  404. /// </summary>
  405. /// <returns></returns>
  406. public static SvgImage CreateShowCafRes(string color = "#387CB7", int width = 24, int height = 24)
  407. {
  408. string xml = $"<svg xmlns='http://www.w3.org/2000/svg\' width='{width}px' height='{height}px' viewBox='0 0 32 32'>"
  409. + $"<path fill='{color}' d='M27,2H1C0.5,2,0,2.5,0,3v7h28V3C28,2.5,27.5,2,27,2z'/>"
  410. + $"<path opacity='0.5' fill='#737374' d='M26,16.2V10h2v6.9C27.4,16.6,26.7,16.4,26,16.2z M14.1,24.7L13.9,24H2V10H0v15c0,0.5,0.5,1,1,1h13.8C14.4,25.3,14.2,24.8,14.1,24.7z'/>"
  411. + $"<path fill='#737374' d='M24,18c-5.7,0-8,6-8,6s2.3,6,8,6s8-6,8-6S29.7,18,24,18z M24,28c-2.2,0-4-1.8-4-4c0-2.2,1.8-4,4-4c2.2,0,4,1.8,4,4C28,26.2,26.2,28,24,28z M26,24c0,1.1-0.9,2-2,2s-2-0.9-2-2s0.9-2,2-2S26,22.9,26,24z'/>"
  412. + "</svg>";
  413. MemoryStream ms = new MemoryStream(Encoding.UTF8.GetBytes(xml));
  414. var svg = SvgLoader.LoadFromStream(ms);
  415. ms.Dispose();
  416. return svg;
  417. }
  418. /// <summary>
  419. /// 查看测向结果
  420. /// </summary>
  421. /// <returns></returns>
  422. public static SvgImage CreateShowCxRes(string color = "#1177D7", int width = 24, int height = 24)
  423. {
  424. string xml = $"<svg xmlns='http://www.w3.org/2000/svg\' width='{width}px' height='{height}px' viewBox='0 0 32 32'>"
  425. + $"<polygon fill='{color}' points='25.4,9.4 30,14 30,2 18,2 22.6,6.6 16,13.2 9.4,6.6 14,2 2,2 2,14 6.6,9.4 13.2,16 6.6,22.6 2,18 2,30 14,30 9.4,25.4 16,18.8 22.6,25.4 18,30 30,30 30,18 25.4,22.6 18.8,16'/>"
  426. + "</svg>";
  427. MemoryStream ms = new MemoryStream(Encoding.UTF8.GetBytes(xml));
  428. var svg = SvgLoader.LoadFromStream(ms);
  429. ms.Dispose();
  430. return svg;
  431. }
  432. /// <summary>
  433. /// 查看检测结果
  434. /// </summary>
  435. /// <returns></returns>
  436. public static SvgImage CreateShowCheckRes(string color = "#1177D7", int width = 24, int height = 24)
  437. {
  438. string xml = $"<svg xmlns='http://www.w3.org/2000/svg\' width='{width}px' height='{height}px' viewBox='0 0 32 32'>"
  439. + $"<path opacity='0.5' fill='#727272' d='M14,24H2v-8h12V24z M28,16H16v8h12V16z'/>"
  440. + $"<polygon fill='{color}' points='30,8 28,8 28,4 26,4 26,8 16,8 16,4 14,4 14,8 4,8 4,4 2,4 2,8 0,8 0,10 2,10 2,14 4,14 4,10 14,10 14,14 16,14 16,10 26,10 26,14 28,14 28,10 30,10'/>"
  441. + "</svg>";
  442. MemoryStream ms = new MemoryStream(Encoding.UTF8.GetBytes(xml));
  443. var svg = SvgLoader.LoadFromStream(ms);
  444. ms.Dispose();
  445. return svg;
  446. }
  447. /// <summary>
  448. /// 手动定位
  449. /// </summary>
  450. /// <returns></returns>
  451. public static SvgImage CreatePosManual(string color = "#1177D7", int width = 24, int height = 24)
  452. {
  453. string xml = $"<svg xmlns='http://www.w3.org/2000/svg\' width='{width}px' height='{height}px' viewBox='0 0 32 32'>"
  454. + $"<path fill='{color}' d='M29,14h-3.1c-0.2-2.3-1.1-4.4-2.5-6l2.2-2.2c0.4-0.4,0.4-1,0-1.4s-1-0.4-1.4,0L22,6.5c-1.7-1.4-3.8-2.3-6-2.5\r\nV1c0-0.5-0.4-1-1-1s-1,0.5-1,1v3.1c-2.3,0.2-4.4,1.1-6,2.5L5.8,4.4C5.4,4,4.8,4,4.4,4.4s-0.4,1,0,1.4L6.5,8c-1.4,1.7-2.3,3.8-2.5,6\r\nH1c-0.6,0-1,0.5-1,1s0.4,1,1,1h3.1c0.2,2.3,1.1,4.4,2.5,6l-2.2,2.2c-0.4,0.4-0.4,1,0,1.4s1,0.4,1.4,0L8,23.5c1.7,1.4,3.8,2.3,6,2.5\r\nV29c0,0.5,0.4,1,1,1s1-0.5,1-1v-3.1c2.3-0.2,4.4-1.1,6-2.5l2.2,2.2c0.4,0.4,1,0.4,1.4,0s0.4-1,0-1.4L23.5,22c1.4-1.7,2.3-3.8,2.5-6\r\nH29c0.6,0,1-0.5,1-1S29.6,14,29,14z M16,6.1c1.7,0.2,3.3,0.9,4.6,1.9l-2.9,2.9c-0.5-0.3-1.1-0.6-1.8-0.7V6.1z M14,6.1v4\r\nc-0.6,0.1-1.2,0.4-1.8,0.7L9.4,8C10.7,6.9,12.3,6.3,14,6.1z M8,9.4l2.9,2.9c-0.3,0.5-0.6,1.1-0.7,1.8h-4C6.3,12.3,6.9,10.7,8,9.4z\r\nM6.1,16h4c0.1,0.6,0.4,1.2,0.7,1.8L8,20.6C6.9,19.3,6.3,17.7,6.1,16z M14,23.9c-1.7-0.2-3.3-0.9-4.6-1.9l2.9-2.9\r\nc0.5,0.3,1.1,0.6,1.8,0.7V23.9z M15,18c-1.7,0-3-1.3-3-3s1.3-3,3-3s3,1.3,3,3S16.7,18,15,18z M16,23.9v-4c0.6-0.1,1.2-0.4,1.8-0.7\r\nl2.9,2.9C19.3,23.1,17.7,23.7,16,23.9z M22,20.6l-2.9-2.9c0.3-0.5,0.6-1.1,0.7-1.8h4C23.7,17.7,23.1,19.3,22,20.6z M19.9,14\r\nc-0.1-0.6-0.4-1.2-0.7-1.8L22,9.4c1,1.3,1.7,2.9,1.9,4.6H19.9z'/>"
  455. + "</svg>";
  456. MemoryStream ms = new MemoryStream(Encoding.UTF8.GetBytes(xml));
  457. var svg = SvgLoader.LoadFromStream(ms);
  458. ms.Dispose();
  459. return svg;
  460. }
  461. /// <summary>
  462. /// 重新定位
  463. /// </summary>
  464. /// <returns></returns>
  465. public static SvgImage CreateRepos(string color = "#1177D7", int width = 24, int height = 24)
  466. {
  467. string xml = $"<svg xmlns='http://www.w3.org/2000/svg\' width='{width}px' height='{height}px' viewBox='0 0 32 32'>"
  468. + $"<path fill='{color}' d='M16,30L16,30L16,30C14.5,28.3,6,13.5,6,11C6,5.5,10.5,0,16,0s10,5.5,10,11C26,13.5,17.5,28.3,16,30z'/>"
  469. + $"<path fill='#FFFFFF' d='M16,4c3.3,0,6,2.7,6,6s-2.7,6-6,6s-6-2.7-6-6S12.7,4,16,4z'/>"
  470. + "</svg>";
  471. MemoryStream ms = new MemoryStream(Encoding.UTF8.GetBytes(xml));
  472. var svg = SvgLoader.LoadFromStream(ms);
  473. ms.Dispose();
  474. return svg;
  475. }
  476. /// <summary>
  477. /// 使用镜像点
  478. /// </summary>
  479. /// <returns></returns>
  480. public static SvgImage CreateUseMirr(string color = "#1177D7", int width = 24, int height = 24)
  481. {
  482. string xml = $"<svg xmlns='http://www.w3.org/2000/svg\' width='{width}px' height='{height}px' viewBox='0 0 32 32'>"
  483. + $"<polygon fill='#727272' points='4,28 4,2 2,2 2,30 30,30 30,28'/>"
  484. + $"<path fill='{color}' d='M26,18c0-6.6-5.4-12-12-12V2V0L6,8l8,8v-6c4.4,0,8,3.6,8,8h-6l8,8l8-8H26z'/>"
  485. + "</svg>";
  486. MemoryStream ms = new MemoryStream(Encoding.UTF8.GetBytes(xml));
  487. var svg = SvgLoader.LoadFromStream(ms);
  488. ms.Dispose();
  489. return svg;
  490. }
  491. /// <summary>
  492. /// 跳转|转到
  493. /// </summary>
  494. /// <returns></returns>
  495. public static SvgImage CreateGoto(string color = "#1177D7", int width = 24, int height = 24)
  496. {
  497. string xml = $"<svg xmlns='http://www.w3.org/2000/svg\' width='{width}px' height='{height}px' viewBox='0 0 32 32'>"
  498. + $"<path fill='{color}' d='M18,8l10,10L18,28v-8H5c-0.5,0-1-0.5-1-1V4h4v12h10V8z'/>"
  499. + "</svg>";
  500. MemoryStream ms = new MemoryStream(Encoding.UTF8.GetBytes(xml));
  501. var svg = SvgLoader.LoadFromStream(ms);
  502. ms.Dispose();
  503. return svg;
  504. }
  505. /// <summary>
  506. /// 信号识别
  507. /// </summary>
  508. /// <returns></returns>
  509. public static SvgImage CreateSigProc(int width = 24, int height = 24)
  510. {
  511. string xml = $"<svg xmlns='http://www.w3.org/2000/svg\' width='{width}px' height='{height}px' viewBox='0 0 32 32'>"
  512. + $"<circle fill='#039C23' cx='9' cy='9' r='7'/>"
  513. +$"<path fill='#FFB115' d='M24.5,2.4c0.3-0.6,0.8-0.6,1.1,0l6.3,12.5c0.3,0.6,0.1,1.1-0.5,1.1H18.7c-0.6,0-0.8-0.5-0.5-1.1L24.5,2.4z'/>"
  514. + $"<path fill='#D11C1C' d='M2.4,25.9c-0.5-0.5-0.5-1.3,0-1.8l5.7-5.7c0.5-0.5,1.3-0.5,1.8,0l5.7,5.7c0.5,0.5,0.5,1.3,0,1.8l-5.7,5.7 c-0.5,0.5-1.3,0.5-1.8,0L2.4,25.9z'/>"
  515. + "</svg>";
  516. MemoryStream ms = new MemoryStream(Encoding.UTF8.GetBytes(xml));
  517. var svg = SvgLoader.LoadFromStream(ms);
  518. ms.Dispose();
  519. return svg;
  520. }
  521. }
  522. }