123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556 |
- using DevExpress.Drawing.Internal.Fonts.Interop;
- using DevExpress.Utils;
- using DevExpress.Utils.Svg;
- using System;
- using System.Collections.Generic;
- using System.Data.SqlTypes;
- using System.Drawing;
- using System.IO;
- using System.IO.Ports;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Xml;
- namespace DxHelper
- {
- public static class SvgHelper
- {
- static readonly Dictionary<string, SvgImage> cache = new Dictionary<string, SvgImage>();
- /// <summary>
- /// 判断color是否为HtmlColor(HtmlColor格式如#A1B2C3)
- /// </summary>
- /// <param name="color"></param>
- /// <returns></returns>
- public static bool IsHtmlColor(string color)
- {
- if (!color.StartsWith("#")) return false;
- if (color.Length != 7) return false;
- string r = color.Substring(1, 2);
- string g = color.Substring(3, 2);
- string b = color.Substring(5, 2);
- bool r1 = byte.TryParse(r, System.Globalization.NumberStyles.HexNumber, null, out _);
- bool r2 = byte.TryParse(g, System.Globalization.NumberStyles.HexNumber, null, out _);
- bool r3 = byte.TryParse(b, System.Globalization.NumberStyles.HexNumber, null, out _);
- return r1 & r2 & r3;
- }
- /// <summary>
- /// 将SvgImage转换为Image对象
- /// </summary>
- /// <param name="svg"></param>
- /// <param name="width"></param>
- /// <param name="height"></param>
- /// <returns></returns>
- public static Image SvgToImage(SvgImage svg, int width, int height)
- {
- var img = svg.Render(new Size(width, height), null, DefaultBoolean.False, DefaultBoolean.False);
- return img;
- }
- /// <summary>
- /// 将文件转换为SvgImage对象
- /// </summary>
- /// <param name="svgFile"></param>
- /// <returns></returns>
- public static SvgImage LoadFromFile(string svgFile)
- {
- return SvgLoader.LoadFromFile(svgFile);
- }
- /// <summary>
- /// 新增图片(➕号)
- /// </summary>
- /// <param name="color"></param>
- /// <param name="width"></param>
- /// <param name="height"></param>
- /// <returns></returns>
- public static SvgImage CreateAdd(string color = "#039C23", int width = 24, int height = 24)
- {
- 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='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'/>"
- + "</svg>";
- MemoryStream ms = new MemoryStream(Encoding.UTF8.GetBytes(xml));
- var svg = SvgLoader.LoadFromStream(ms);
- ms.Dispose();
- return svg;
- }
- /// <summary>
- /// 编辑图片
- /// </summary>
- /// <param name="color"></param>
- /// <param name="width"></param>
- /// <param name="height"></param>
- /// <returns></returns>
- public static SvgImage CreateEdit(string color = "#1177D7", int width = 24, int height = 24)
- {
- 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='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'/>"
- + $"<polygon fill='{color}' points='4,28 9.8,28 4,22.2'/>"
- + $"<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'/>"
- + "</svg>";
- MemoryStream ms = new MemoryStream(Encoding.UTF8.GetBytes(xml));
- var svg = SvgLoader.LoadFromStream(ms);
- ms.Dispose();
- return svg;
- }
- /// <summary>
- /// 移除图片(➖号)
- /// </summary>
- /// <param name="color"></param>
- /// <param name="width"></param>
- /// <param name="height"></param>
- /// <returns></returns>
- public static SvgImage CreateRemove(string color = "#1177D7", int width = 24, int height = 24)
- {
- 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='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'/>"
- + "</svg>";
- MemoryStream ms = new MemoryStream(Encoding.UTF8.GetBytes(xml));
- var svg = SvgLoader.LoadFromStream(ms);
- ms.Dispose();
- return svg;
- }
- /// <summary>
- /// 创建一个Svg圆.该圆的圆心在ViewBox的中心
- /// </summary>
- /// <param name="colorKey">用于生成颜色的一个key,相同的key具有相同的颜色,当colorKey为html颜色时则使用此颜色(如#A1B2FF)</param>
- /// <param name="opacity">透明度,默认不透明</param>
- /// <param name="viewBoxWidth">视口宽度,默认32px</param>
- /// <param name="viewBoxHeight">视口高度,默认32px</param>
- /// <param name="radius">半径,默认16px</param>
- /// <param name="offsetX">圆心的X轴偏移量,负向左偏移,正向右偏移,默认为0处于视口中心</param>
- /// <returns></returns>
- public static SvgImage CreateCycle(string colorKey, double opacity = 1, int viewBoxWidth = 32, int viewBoxHeight = 32, int radius = 16, double offsetX = 0)
- {
- if (colorKey == null) colorKey = "";
- if (cache.ContainsKey(colorKey))
- return cache[colorKey];
- SvgImage svg = new SvgImage();
- SvgRoot root = SvgRoot.Create(new SvgElementProperties(), viewBox: new SvgViewBox(0, 0, viewBoxWidth, viewBoxHeight));
- svg.Elements.Add(root);
- string colorStr;
- if (IsHtmlColor(colorKey))
- colorStr = colorKey;
- else
- colorStr = ColorHelper.GetHtmlColor(colorKey);
- SvgElementProperties props = new SvgElementProperties
- {
- Fill = colorStr,
- Opacity = opacity//透明度
- };
- SvgCircle circle = SvgCircle.Create(props, viewBoxWidth / 2 + offsetX, viewBoxHeight / 2, radius);
- root.Elements.Add(circle);
- //SvgImage未公开Width和Height属性的公共写入,需要通过以下方式可对width和Size赋值
- MemoryStream ms = new MemoryStream();
- svg.Save(ms);
- svg = ms.ToArray();
- cache.Add(colorKey, svg);
- ms.Dispose();
- return svg;
- }
- /// <summary>
- /// 删除或关闭图片(一个叉叉)
- /// </summary>
- /// <param name="colorStr"></param>
- /// <param name="opacity"></param>
- /// <returns></returns>
- public static SvgImage CreateClose(string colorStr = "#D11C1C", double opacity = 1)
- {
- if (string.IsNullOrWhiteSpace(colorStr))
- colorStr = $"#D11C1C";
- 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>";
- MemoryStream ms = new MemoryStream(Encoding.UTF8.GetBytes(xml));
- var svg = SvgLoader.LoadFromStream(ms);
- ms.Dispose();
- return svg;
- }
- /// <summary>
- /// 清除图片(一个橡皮擦)
- /// </summary>
- /// <returns></returns>
- public static SvgImage CreateClear()
- {
- 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>";
- MemoryStream ms = new MemoryStream(Encoding.UTF8.GetBytes(xml));
- var svg = SvgLoader.LoadFromStream(ms);
- ms.Dispose();
- return svg;
- }
- /// <summary>
- /// 测距图片
- /// </summary>
- /// <returns></returns>
- public static SvgImage CreateDistanceLine()
- {
- string xml = $"<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox='0 0 32 32'>"
- + "<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\"/>"
- + "</svg>";
- MemoryStream ms = new MemoryStream(Encoding.UTF8.GetBytes(xml));
- var svg = SvgLoader.LoadFromStream(ms);
- ms.Dispose();
- return svg;
- }
- /// <summary>
- /// 标点图片(一个五角星)
- /// </summary>
- /// <param name="color"></param>
- /// <param name="width"></param>
- /// <param name="height"></param>
- /// <returns></returns>
- public static SvgImage CreateMarkDot(string color = "#F12233", int width = 24, int height = 24)
- {
- 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=\"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\"/>"
- + "</svg>";
- MemoryStream ms = new MemoryStream(Encoding.UTF8.GetBytes(xml));
- var svg = SvgLoader.LoadFromStream(ms);
- ms.Dispose();
- return svg;
- }
- /// <summary>
- /// 接收天线
- /// </summary>
- /// <param name="color"></param>
- /// <param name="width"></param>
- /// <param name="height"></param>
- /// <returns></returns>
- public static SvgImage CreateAnt(string color = "#1177D7", int width = 24, int height = 24)
- {
- 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'/>"
- + "</svg>";
- MemoryStream ms = new MemoryStream(Encoding.UTF8.GetBytes(xml));
- var svg = SvgLoader.LoadFromStream(ms);
- ms.Dispose();
- return svg;
- }
- /// <summary>
- /// 圆点
- /// </summary>
- /// <param name="color"></param>
- /// <param name="width"></param>
- /// <param name="height"></param>
- /// <returns></returns>
- public static SvgImage CreateGeoDot(string color = "#D11C1C", int width = 24, int height = 24)
- {
- 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'/>"
- + "</svg>";
- MemoryStream ms = new MemoryStream(Encoding.UTF8.GetBytes(xml));
- var svg = SvgLoader.LoadFromStream(ms);
- ms.Dispose();
- return svg;
- }
- /// <summary>
- /// 五角星图片
- /// </summary>
- /// <param name="color"></param>
- /// <param name="width"></param>
- /// <param name="height"></param>
- /// <returns></returns>
- public static SvgImage CreatePentagram(string color = "#1177D7", int width = 24, int height = 24)
- {
- 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'/>"
- + "</svg>";
- MemoryStream ms = new MemoryStream(Encoding.UTF8.GetBytes(xml));
- var svg = SvgLoader.LoadFromStream(ms);
- ms.Dispose();
- return svg;
- }
- /// <summary>
- /// 卫星图片
- /// </summary>
- /// <param name="color"></param>
- /// <param name="width"></param>
- /// <param name="height"></param>
- /// <returns></returns>
- public static SvgImage CreateSat(string color = "#1177D7", int width = 24, int height = 24)
- {
- string xml = $"<svg xmlns=\"http://www.w3.org/2000/svg\" width='{width}px' height='{height}px' viewBox='0 0 297.131 297.131'>"
- + $"<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'/>"
- + $"<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'/>"
- + $"<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'/> "
- + $"<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'/>"
- + $"<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'/>"
- + "</svg>";
- MemoryStream ms = new MemoryStream(Encoding.UTF8.GetBytes(xml));
- var svg = SvgLoader.LoadFromStream(ms);
- ms.Dispose();
- return svg;
- }
- public static SvgImage CreateRect(string color = "#1177D7", int width = 24, int height = 24)
- {
- string xml = $"<svg xmlns='http://www.w3.org/2000/svg\' width='{width}px' height='{height}px' viewBox='0 0 512 512'>"
- + $"<path fill='{color}' d='M0,0v512h512V0H0z M465.5,465.5H46.5V46.5h418.9V465.5z'/>"
- + "</svg>";
- MemoryStream ms = new MemoryStream(Encoding.UTF8.GetBytes(xml));
- var svg = SvgLoader.LoadFromStream(ms);
- ms.Dispose();
- return svg;
- }
- /// <summary>
- /// 时隙参估图片
- /// </summary>
- /// <param name="color"></param>
- /// <param name="width"></param>
- /// <param name="height"></param>
- /// <returns></returns>
- public static SvgImage CreateSlotCg(string color = "#1177D7", int width = 24, int height = 24)
- {
- 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='M6,30H2V2h4V30z M12,2H8v28h4V2z M18,2h-4v28h4V2z M24,2h-4v28h4V2z M30,2h-4v28h4V2z'/>"
- + "</svg>";
- MemoryStream ms = new MemoryStream(Encoding.UTF8.GetBytes(xml));
- var svg = SvgLoader.LoadFromStream(ms);
- ms.Dispose();
- return svg;
- }
- /// <summary>
- /// 导出图像图片
- /// </summary>
- /// <returns></returns>
- public static SvgImage CreateExportImg()
- {
- 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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5h-1.4v-1.4H26V17.3z\"/>\r\n</g>"
- + "</svg>";
- MemoryStream ms = new MemoryStream(Encoding.UTF8.GetBytes(xml));
- var svg = SvgLoader.LoadFromStream(ms);
- ms.Dispose();
- return svg;
- }
- /// <summary>
- /// 导出Excel图片
- /// </summary>
- /// <returns></returns>
- public static SvgImage CreateExportXlsx()
- {
- 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-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.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>"
- + "</svg>";
- MemoryStream ms = new MemoryStream(Encoding.UTF8.GetBytes(xml));
- var svg = SvgLoader.LoadFromStream(ms);
- ms.Dispose();
- return svg;
- }
- /// <summary>
- /// 导出Csv图片
- /// </summary>
- /// <returns></returns>
- public static SvgImage CreateExportCsv()
- {
- 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,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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\"/>"
- + "</svg>";
- MemoryStream ms = new MemoryStream(Encoding.UTF8.GetBytes(xml));
- var svg = SvgLoader.LoadFromStream(ms);
- ms.Dispose();
- return svg;
- }
- /// <summary>
- /// 时差线图片
- /// </summary>
- /// <returns></returns>
- public static SvgImage CreateDtoLine(string color = "#039C23", int width = 24, int height = 24)
- {
- 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='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'/>"
- + "</svg>";
- MemoryStream ms = new MemoryStream(Encoding.UTF8.GetBytes(xml));
- var svg = SvgLoader.LoadFromStream(ms);
- ms.Dispose();
- return svg;
- }
- /// <summary>
- /// 频差线图片
- /// </summary>
- /// <returns></returns>
- public static SvgImage CreateDfoLine(string color = "#039C23", int width = 24, int height = 24)
- {
- string xml = $"<svg xmlns='http://www.w3.org/2000/svg\' width='{width}px' height='{height}px' viewBox='0 0 32 32'>"
- + $"<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'/>"
- + $"<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'/>"
- + $"<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'/>"
- + "</svg>";
- MemoryStream ms = new MemoryStream(Encoding.UTF8.GetBytes(xml));
- var svg = SvgLoader.LoadFromStream(ms);
- ms.Dispose();
- return svg;
- }
- /// <summary>
- /// 测向线图片
- /// </summary>
- /// <returns></returns>
- public static SvgImage CreateCxLine(string color1 = "#FFB115", string color2 = "#039C23", int width = 24, int height = 24)
- {
- string xml = $"<svg xmlns='http://www.w3.org/2000/svg\' width='{width}px' height='{height}px' viewBox='0 0 32 32'>"
- + $"<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'/>"
- + $"<path fill='{color2}' d='M10,26H4v-4h6V26z M28,6h-6v4h6V6z'/>"
- + "</svg>";
- MemoryStream ms = new MemoryStream(Encoding.UTF8.GetBytes(xml));
- var svg = SvgLoader.LoadFromStream(ms);
- ms.Dispose();
- return svg;
- }
- /// <summary>
- /// GDOP
- /// </summary>
- /// <returns></returns>
- public static SvgImage CreateGDOP(string color = "#1177D7", int width = 24, int height = 24)
- {
- string xml = $"<svg xmlns='http://www.w3.org/2000/svg\' width='{width}px' height='{height}px' viewBox='0 0 32 32'>"
- + $"<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'/>"
- + $"<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'/>"
- + "</svg>";
- MemoryStream ms = new MemoryStream(Encoding.UTF8.GetBytes(xml));
- var svg = SvgLoader.LoadFromStream(ms);
- ms.Dispose();
- return svg;
- }
- /// <summary>
- /// 查看参估结果
- /// </summary>
- /// <returns></returns>
- public static SvgImage CreateShowCafRes(string color = "#387CB7", int width = 24, int height = 24)
- {
- 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='M27,2H1C0.5,2,0,2.5,0,3v7h28V3C28,2.5,27.5,2,27,2z'/>"
- + $"<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'/>"
- + $"<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'/>"
- + "</svg>";
- MemoryStream ms = new MemoryStream(Encoding.UTF8.GetBytes(xml));
- var svg = SvgLoader.LoadFromStream(ms);
- ms.Dispose();
- return svg;
- }
- /// <summary>
- /// 查看测向结果
- /// </summary>
- /// <returns></returns>
- public static SvgImage CreateShowCxRes(string color = "#1177D7", int width = 24, int height = 24)
- {
- 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='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'/>"
- + "</svg>";
- MemoryStream ms = new MemoryStream(Encoding.UTF8.GetBytes(xml));
- var svg = SvgLoader.LoadFromStream(ms);
- ms.Dispose();
- return svg;
- }
- /// <summary>
- /// 查看检测结果
- /// </summary>
- /// <returns></returns>
- public static SvgImage CreateShowCheckRes(string color = "#1177D7", int width = 24, int height = 24)
- {
- string xml = $"<svg xmlns='http://www.w3.org/2000/svg\' width='{width}px' height='{height}px' viewBox='0 0 32 32'>"
- + $"<path opacity='0.5' fill='#727272' d='M14,24H2v-8h12V24z M28,16H16v8h12V16z'/>"
- + $"<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'/>"
- + "</svg>";
- MemoryStream ms = new MemoryStream(Encoding.UTF8.GetBytes(xml));
- var svg = SvgLoader.LoadFromStream(ms);
- ms.Dispose();
- return svg;
- }
- /// <summary>
- /// 手动定位
- /// </summary>
- /// <returns></returns>
- public static SvgImage CreatePosManual(string color = "#1177D7", int width = 24, int height = 24)
- {
- 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='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'/>"
- + "</svg>";
- MemoryStream ms = new MemoryStream(Encoding.UTF8.GetBytes(xml));
- var svg = SvgLoader.LoadFromStream(ms);
- ms.Dispose();
- return svg;
- }
- /// <summary>
- /// 重新定位
- /// </summary>
- /// <returns></returns>
- public static SvgImage CreateRepos(string color = "#1177D7", int width = 24, int height = 24)
- {
- 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,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'/>"
- + $"<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'/>"
- + "</svg>";
- MemoryStream ms = new MemoryStream(Encoding.UTF8.GetBytes(xml));
- var svg = SvgLoader.LoadFromStream(ms);
- ms.Dispose();
- return svg;
- }
- /// <summary>
- /// 使用镜像点
- /// </summary>
- /// <returns></returns>
- public static SvgImage CreateUseMirr(string color = "#1177D7", int width = 24, int height = 24)
- {
- string xml = $"<svg xmlns='http://www.w3.org/2000/svg\' width='{width}px' height='{height}px' viewBox='0 0 32 32'>"
- + $"<polygon fill='#727272' points='4,28 4,2 2,2 2,30 30,30 30,28'/>"
- + $"<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'/>"
- + "</svg>";
- MemoryStream ms = new MemoryStream(Encoding.UTF8.GetBytes(xml));
- var svg = SvgLoader.LoadFromStream(ms);
- ms.Dispose();
- return svg;
- }
- /// <summary>
- /// 跳转|转到
- /// </summary>
- /// <returns></returns>
- public static SvgImage CreateGoto(string color = "#1177D7", int width = 24, int height = 24)
- {
- 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='M18,8l10,10L18,28v-8H5c-0.5,0-1-0.5-1-1V4h4v12h10V8z'/>"
- + "</svg>";
- MemoryStream ms = new MemoryStream(Encoding.UTF8.GetBytes(xml));
- var svg = SvgLoader.LoadFromStream(ms);
- ms.Dispose();
- return svg;
- }
- /// <summary>
- /// 信号识别
- /// </summary>
- /// <returns></returns>
- public static SvgImage CreateSigProc(int width = 24, int height = 24)
- {
- string xml = $"<svg xmlns='http://www.w3.org/2000/svg\' width='{width}px' height='{height}px' viewBox='0 0 32 32'>"
- + $"<circle fill='#039C23' cx='9' cy='9' r='7'/>"
- +$"<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'/>"
- + $"<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'/>"
- + "</svg>";
- MemoryStream ms = new MemoryStream(Encoding.UTF8.GetBytes(xml));
- var svg = SvgLoader.LoadFromStream(ms);
- ms.Dispose();
- return svg;
- }
- }
- }
|