Пример #1
0
 public Scene1(IScene prevScene) : base(prevScene)
 {
     sceneTitle         = new TextOverlay(TITLE);
     backMessage        = new TextOverlay(BACK_MSG, 0, BACK_MSG_Y);
     sceneSwitchMessage = new TextOverlay(SWITCH_MSG, 0, SWITCH_MSG_Y);
     ball = new Ball();
 }
Пример #2
0
        public async Task <string> ProcessRecipe()
        {
            string jsonObject = await Request.Content.ReadAsStringAsync();

            //byte[] image = await Request.Content.ReadAsByteArrayAsync();

            //if (image == null)
            //	image = File.ReadAllBytes(@"C:\test\new\IMG_0030.jpg");
            //OCR.Space.OCRSpaceMain ocrSpace = new OCR.Space.OCRSpaceMain();
            //string jsonObject = ocrSpace.ProcessPicture(image, "TestImageName.jpg");

            JavaScriptSerializer serializer = new JavaScriptSerializer();
            Recipe recipe = serializer.Deserialize <Recipe>(jsonObject);

            if (recipe.OCRExitCode != 1)
            {
                return(null);
            }

            TextOverlay overlay = recipe.ParsedResults[0].TextOverlay;

            overlay.ComputeExtraFields();

            string htmlOutput = RecipeHTMLConverter.ConvertRecipeToHTML(recipe);

            string jsonOutput = ProcessRecipe(Encoding.ASCII.GetBytes(htmlOutput));

            return(jsonOutput);
        }
Пример #3
0
        public frmFavorites()
        {
            InitializeComponent();

            // Create text overlays with colors to match our theme.
            TextOverlay queueOverlay = lvFavorites.EmptyListMsgOverlay as TextOverlay;

            queueOverlay.BorderWidth = 0f;
            queueOverlay.Font        = new Font(Font.FontFamily, 12);
            queueOverlay.TextColor   = Color.DimGray;
            queueOverlay.BackColor   = Color.FromArgb(255, 255, 255);
            queueOverlay.BorderColor = Color.FromArgb(40, 146, 255);

            // Create our HotTracking decoration.
            RowBorderDecoration rbd = new RowBorderDecoration();

            rbd.BorderPen                       = new Pen(Color.FromArgb(64, Color.White), 0);
            rbd.FillBrush                       = new SolidBrush(Color.FromArgb(64, SystemColors.Highlight));
            rbd.BoundsPadding                   = new Size(0, 0);
            rbd.CornerRounding                  = 0.0f;
            lvFavorites.HotItemStyle            = new HotItemStyle();
            lvFavorites.HotItemStyle.Decoration = rbd;

            // Setup aspect getters programatically in case we decide to encrypt our executable.
            colName.AspectGetter += delegate(object x) { return(((FavoriteObject)x).Name); };
        }
Пример #4
0
        public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destinationType)
        {
            if (destinationType == typeof(string))
            {
                ImageOverlay imageOverlay = value as ImageOverlay;
                if (imageOverlay != null)
                {
                    if (imageOverlay.Image == null)
                    {
                        return("(none)");
                    }
                    else
                    {
                        return("(set)");
                    }
                }
                TextOverlay textOverlay = value as TextOverlay;
                if (textOverlay != null)
                {
                    if (String.IsNullOrEmpty(textOverlay.Text))
                    {
                        return("(none)");
                    }
                    else
                    {
                        return("(set)");
                    }
                }
            }

            return(base.ConvertTo(context, culture, value, destinationType));
        }
Пример #5
0
        /// <summary>
        /// 绑定数据
        /// </summary>
        /// <param name="view">表格对象</param>
        /// <param name="data">数据</param>
        public static void BindData(ObjectListView view, dynamic data)
        {
            int count = 0;

            if (data != null)
            {
                count = data.Count;
            }
            view.SetObjects(data);
            if (OverlayDic.ContainsKey(view.Name))
            {
                view.RemoveOverlay(OverlayDic[view.Name]);
            }
            TextOverlay nagOverlay = new TextOverlay();

            nagOverlay.Alignment     = ContentAlignment.BottomRight;
            nagOverlay.Text          = "共{0}条".FS(count);
            nagOverlay.BackColor     = Color.White;
            nagOverlay.BorderWidth   = 2.0f;
            nagOverlay.BorderColor   = Color.Green;
            nagOverlay.TextColor     = Color.Red;
            nagOverlay.Font          = new Font("微软雅黑", 18);
            view.OverlayTransparency = 255;
            view.AddOverlay(nagOverlay);
            OverlayDic.AddOrUpdate(view.Name, nagOverlay);
        }
Пример #6
0
        public void ProcessUploadedFile(HttpPostedFile file)
        {
            fileName = String.Format(@"C:\test\{0}_{1}", file.FileName, DateTime.Now.ToString("MM-dd-hh-mm-ss"));

            byte[] fileData = null;
            using (var binaryReader = new BinaryReader(file.InputStream))
            {
                fileData = binaryReader.ReadBytes(file.ContentLength);
            }

            string jsonObject = ocrSpace.ProcessPicture(fileData, file.FileName);

            JavaScriptSerializer serializer = new JavaScriptSerializer();
            Recipe recipe = serializer.Deserialize <Recipe>(jsonObject);

            if (recipe.OCRExitCode != 1)
            {
                return;
            }

            TextOverlay overlay = recipe.ParsedResults[0].TextOverlay;

            overlay.ComputeExtraFields();

            //string[] lines = recipe.ParsedResults[0].ParsedText.Split(new string[] { "\r\n" }, StringSplitOptions.None);

            string htmlOutput = RecipeHTMLConverter.ConvertRecipeToHTML(recipe);

            File.WriteAllText(fileName + ".html", htmlOutput, swedishEncoding);

            GenerateAreasPicture(recipe.ParsedResults[0].TextOverlay);
        }
Пример #7
0
 public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType)
 {
     if (destinationType == typeof(string))
     {
         ImageOverlay overlay = value as ImageOverlay;
         if (overlay != null)
         {
             if (overlay.Image == null)
             {
                 return("(none)");
             }
             return("(set)");
         }
         TextOverlay overlay2 = value as TextOverlay;
         if (overlay2 != null)
         {
             if (string.IsNullOrEmpty(overlay2.Text))
             {
                 return("(none)");
             }
             return("(set)");
         }
     }
     return(base.ConvertTo(context, culture, value, destinationType));
 }
Пример #8
0
        //Crea mensaje cuando el objectlistview esta vacio
        private void InitializeEmptyListMsgOverlay()
        {
            TextOverlay textOverlay = this.listadoEnlaces.EmptyListMsgOverlay as TextOverlay;

            textOverlay.TextColor   = Color.FromArgb(231, 120, 0);
            textOverlay.BackColor   = Color.FromArgb(32, 32, 32);
            textOverlay.BorderWidth = 0.0f;
            textOverlay.Font        = new Font("Segoe UI Semilight", 22);
        }
        protected virtual void InitializeEmptyListMsgOverlay()
        {
            TextOverlay textOverlay = this.objectListView1.EmptyListMsgOverlay as TextOverlay;

            textOverlay.TextColor   = Color.FromArgb(231, 120, 0);
            textOverlay.BackColor   = Color.FromArgb(32, 32, 32);
            textOverlay.BorderWidth = 0.0f;
            textOverlay.Font        = new Font("Segoe UI Semilight", 22);
        }
Пример #10
0
        public Sniffer(string target, string mac, string gatewaymac, string gatewayip, Loading loading)
        {
            InitializeComponent();

            var materialSkinManager = MaterialSkinManager.Instance;

            materialSkinManager.AddFormToManage(this);
            gatewayIP  = gatewayip;
            gatewayMAC = gatewaymac;
            GatewayMAC = PhysicalAddress.Parse(gatewaymac.Replace(":", ""));
            TargetMAC  = PhysicalAddress.Parse(mac.Replace(":", ""));
            TargetIP   = IPAddress.Parse(target);

            olvColumn7.AspectGetter = delegate(object rowObject)
            {
                try
                {
                    AcceptedPacket packet = rowObject as AcceptedPacket;
                    if ((packet != null && (string.IsNullOrEmpty(packet.Host) && packet.Source.ToString() == Target) || packet.Host == "Not found"))//null reference on sniffer close
                    {
                        return("Resolve");
                    }

                    return(null);
                }
                catch (Exception)
                {
                }
                return(null);
            };


            textOverlay            = this.materialListView1.EmptyListMsgOverlay as TextOverlay;
            menu                   = new ContextMenu(new MenuItem[] { new MenuItem("Show Packet", ShowPacket), });
            Target                 = target;
            targetmac              = mac;
            olvColumn1.ImageGetter = delegate(object rowObject)
            {
                var Packet = rowObject as AcceptedPacket;
                try
                {
                    if (Packet.Source.ToString() == Target)
                    {
                        return("request");
                    }
                    else
                    {
                        return("response");
                    }
                }
                catch (Exception)
                {
                    return("");
                }
            };
        }
Пример #11
0
        public Main()
        {
            InitializeComponent();

            _controller = new Controller(this);
            var materialSkinManager = MaterialSkinManager.Instance;

            materialSkinManager.AddFormToManage(this);
            notifyIcon1.ContextMenu = new ContextMenu(new MenuItem[] { new MenuItem("Show", (sender, args) =>
                {
                    Show();
                    WindowState         = FormWindowState.Normal;
                    notifyIcon1.Visible = false;
                }), new MenuItem("Exit", (sender, args) => { Application.Exit(); }), });

            this.olvColumn1.ImageGetter = delegate(object rowObject)  //Set the images from the image list (with setting small image list in properties)
            {
                Device s = (Device)rowObject;
                if (s.IsGateway)
                {
                    return("router"); //Image name in the image list
                }
                else
                {
                    return("pc"); //Image name in the image list
                }
            };
            this.olvColumn1.GroupKeyGetter = delegate(object rowObject)  //Give every model object a key so items with the same key are grouped together
            {
                var Device = rowObject as Device;

                if (Device.IsGateway)
                {
                    return("Gateway");
                }
                else if (Device.IsLocalDevice)
                {
                    return("Own Device");
                }
                else
                {
                    return("Devices");
                }
            };
            this.olvColumn1.GroupKeyToTitleConverter = delegate(object key) { return(key.ToString()); }; //Convert the key to a title for the groups
            fastObjectListView1.ShowGroups           = true;

            textOverlay          = this.fastObjectListView1.EmptyListMsgOverlay as TextOverlay;
            textOverlay.Font     = new Font("Roboto", 25);
            ValuesTimer          = new Timer();
            ValuesTimer.Interval = 1000;
            ValuesTimer.Tick    += ValuesTimerOnTick;
            AliveTimer           = new Timer();
            AliveTimer.Interval  = 5000;
            AliveTimer.Tick     += AliveTimerOnTick;
        }
Пример #12
0
        public void Run(RemoteInterface remoteInterface)
        {
            // Draw 2D text overlay on screen.
            // The X and Y values are coordinates on the screen space, mapped to a 1000x1000 area.
            TextOverlay hello  = new TextOverlay("Hello World", 10, 5, 5).Show();
            TextOverlay colors = new TextOverlay("This text is red and transparent".Red(), 10, 5, 30, 180).Show();

            // Use RemoteInterface.Log() to display text in the mod loader console.
            remoteInterface.Log("Hello World");
        }
        public Overlay(IScreenInformation screenInformation, IProgressDisplayGuiMode progressDisplay) : base(screenInformation)
        {
            _textOverlay = new TextOverlay();
            _resizeOverlay = new TargetAreaResizeOverlay(screenInformation);
            _progressDisplay = progressDisplay;

            _progressDisplay.OnWantsToRender += (sender, args) =>
            {
                ShowOverlay();
            };
        }
Пример #14
0
        TextOverlay GenerateOverlay()
        {
            TextOverlay ov = new TextOverlay();

            ov.Alignment   = ContentAlignment.MiddleCenter;
            ov.TextColor   = Color.White;
            ov.BackColor   = Color.GreenYellow;
            ov.BorderColor = Color.Black;
            ov.BorderWidth = 4.0f;
            ov.Font        = new Font("Segoe UI", 36);
            ov.Text        = "Loading...";
            return(ov);
        }
Пример #15
0
 // This example will move the text object to the right
 // and hide it once it's no longer visible on screen.
 private void MoveTextOffscreen(TextOverlay overlay)
 {
     overlay.X += 3;
     Interface.Log($"Text overlay visible at X:{overlay.X}");
     if (overlay.X > 1000)
     {
         // Note: While the text overlay is hidden, both UpdateText and UpdateProperties
         // are _not_ evaluated - notice the "Text overlay visible" messages
         // are no longer sent after calling Hide().
         overlay.Hide();
         Interface.Log($"Text overlay hidden");
     }
 }
Пример #16
0
        private void SetupObjectListView()
        {
            this.Title.Renderer = CreateDescribedTaskRenderer();

            this.Title.AspectName = "Title";

            this.ObjectListView.CellPadding = new Rectangle(4, 1, 4, 0);


            TextOverlay textOverlay = this.ObjectListView.EmptyListMsgOverlay as TextOverlay;

            textOverlay.BackColor   = Color.White;
            textOverlay.BorderWidth = 0f;
        }
        private void btTextLogoAdd_Click(object sender, EventArgs e)
        {
            var dlg = new TextLogoSettingsDialog();

            var name   = $"textlogo{lbTextLogos.Items.Count + 1}";
            var effect = new TextOverlay(name, "TEST", 20, 20);

            this._player.Video_Overlays_Add(effect);
            lbTextLogos.Items.Add(effect.Name);
            dlg.Fill(effect);

            dlg.ShowDialog(this);
            dlg.Dispose();
        }
Пример #18
0
    public void CreateWord(string word)
    {
        GameObject  instance = Instantiate(wordPrefab.gameObject, transform) as GameObject;
        TextOverlay overlay  = instance.GetComponent <TextOverlay>();

        if (wordOverlays.Count >= maxWords)
        {
            TextOverlay wordToRemove = wordOverlays.Dequeue();
            Destroy(wordToRemove.gameObject);
        }
        wordOverlays.Enqueue(overlay);
        overlay.InitializeText(word.ToUpper(), wordFontSize);
        CreateDefinition(GameManager.words.GetDefinition(word));
    }
        private void OnClientListError(String err)
        {
            clientCommandSupported = false;

            TextOverlay to = new TextOverlay();

            to.Text      = String.Format("{0}\n{1}", locale.GetString("RBF_ClientFetchFail"), err);
            to.TextColor = Color.DarkRed;
            to.Alignment = ContentAlignment.MiddleCenter;

            olvClients.OverlayText = to;
            olvClients.ContextMenu = null;
            olvClients.ShowOverlays();
        }
Пример #20
0
        private Recipe GetRecipeFromNuanceXML(string xmlPath)
        {
            XmlDocument xmlDoc = new XmlDocument();

            xmlDoc.Load(xmlPath);

            Recipe      recipe      = SetupRecipe();
            TextOverlay textOverlay = recipe.ParsedResults[0].TextOverlay;

            XmlNode pageInfoNode = xmlDoc.SelectSingleNode("/document/page[1]/description/theoreticalPage");

            textOverlay.Width  = Int32.Parse(pageInfoNode.Attributes["width"].Value);
            textOverlay.Height = Int32.Parse(pageInfoNode.Attributes["height"].Value);
            XmlNodeList nodeList = xmlDoc.SelectNodes("/document/page[1]/body//para/ln");

            foreach (XmlNode lnNode in nodeList)
            {
                TextLine line = new TextLine();
                line.Words     = new List <TextWord>();
                line.MinTop    = Int32.Parse(lnNode.Attributes["t"].Value);
                line.MaxHeight = Int32.Parse(lnNode.Attributes["b"].Value) - line.MinTop;
                foreach (XmlNode nodeInsideLn in lnNode.ChildNodes)
                {
                    if (nodeInsideLn.Name == "wd")
                    {
                        line.Words.Add(CreateWordFromWordNode(nodeInsideLn));
                    }
                    else if (nodeInsideLn.Name == "run")
                    {
                        foreach (XmlNode nodeInsideRun in nodeInsideLn.ChildNodes)
                        {
                            if (nodeInsideLn.Name == "wd")
                            {
                                TextWord word = CreateWordFromWordNode(nodeInsideRun);
                                // May be checking actual bold attribute is better than cheching
                                // deviance from the normal text, depends on the recipe
                                // use the code below in case you just want to find Bold text
                                // word.Bold = Boolean.Parse(nodeInsideLn.Attributes["bold"].Value);
                                word.Bold = true;
                                line.Words.Add(word);
                            }
                        }
                    }
                }
                textOverlay.Lines.Add(line);
            }
            return(recipe);
        }
Пример #21
0
        public void GenerateAreasPicture(TextOverlay overlay)
        {
            Bitmap   flag         = new Bitmap(overlay.Width, overlay.Height);
            Graphics flagGraphics = Graphics.FromImage(flag);

            foreach (TextLine line in overlay.Lines)
            {
                flagGraphics.FillRectangle(Brushes.Black, line.Bounds.Left, line.Bounds.Top, line.Bounds.Width, line.Bounds.Height);
                flagGraphics.DrawString("Line " + overlay.Lines.IndexOf(line),
                                        new Font(FontFamily.GenericSerif, 16),
                                        Brushes.OrangeRed,
                                        new PointF(line.Bounds.Left, line.Bounds.Top));
            }

            flag.Save(fileName + ".png");
        }
Пример #22
0
        public Sniffer(Device device)
        {
            InitializeComponent();

            var materialSkinManager = MaterialSkinManager.Instance;

            materialSkinManager.AddFormToManage(this);

            this.Device = device;

            #region List Configuration

            //Set empty list overlay
            ListOverlay = this.materialListView1.EmptyListMsgOverlay as TextOverlay;

            //A context menu to be added to list items on every right click and removed on empty clicks
            PacketMenu = new ContextMenu(new MenuItem[] { new MenuItem("Show Packet", ShowPacket), });

            //This delegate decides if the list item has a resolve button
            olvColumn7.AspectGetter = delegate(object rowObject)
            {
                try
                {
                    AcceptedPacket packet = rowObject as AcceptedPacket;

                    if (packet == null)
                    {
                        return(null);
                    }

                    if (string.IsNullOrEmpty(packet.Host) && packet.Source.Equals(device.IP) || packet.Host == "Not found")
                    {
                        return("Resolve");
                    }
                }
                catch { }

                return(null);
            };

            //Select row icon based on the packet type (Request or Response)
            olvColumn1.ImageGetter = delegate(object rowObject)
            {
                AcceptedPacket Packet = rowObject as AcceptedPacket;
                if (Packet == null)
                {
                    return(default);
Пример #23
0
        public void ConfigureList()
        {
            // cretate datatable for column
            DataTable newDt = new DataTable();

            newDt.Columns.Add(ResStrings.BoxModeConfig_UpdateDataList_Box, typeof(string));
            for (int i = 0; i < _columnInfo.Count; i++)
            {
                newDt.Columns.Add(_columnInfo[i].ToString(), typeof(string));
            }
            dataListView.DataSource      = null;
            dataListView.DataSource      = newDt;
            dataListView.Columns[0].Name = ResStrings.BoxModeConfig_UpdateDataList_Box;
            dataListView.Columns[0].Text = ResStrings.BoxModeConfig_UpdateDataList_Box;

            for (int i = 0; i < _columnInfo.Count; i++)
            {
                dataListView.Columns[i + 1].Name = _columnInfo[i].ToString();
                dataListView.Columns[i + 1].Text = _columnInfo[i].ToString();
            }


            //empty List

            dataListView.EmptyListMsg = "";
            TextOverlay textOverlay = dataListView.EmptyListMsgOverlay as TextOverlay;

            textOverlay.TextColor   = Color.Firebrick;
            textOverlay.BackColor   = Color.AntiqueWhite;
            textOverlay.BorderColor = Color.DarkRed;
            textOverlay.BorderWidth = 4.0f;
            textOverlay.Font        = new Font("Chiller", 36);
            textOverlay.Rotation    = -5;


            for (int i = 0; i < dataListView.Columns.Count; i++)
            {
                OLVColumn ol = dataListView.GetColumn(i);
                //ol.FillsFreeSpace = true;
                ol.HeaderFont               = new Font("Arial", 12F, FontStyle.Bold, GraphicsUnit.Point, 0);
                ol.HeaderForeColor          = Color.AliceBlue;
                ol.IsTileViewColumn         = true;
                ol.UseInitialLetterForGroup = false;
                ol.MinimumWidth             = 20 + ol.Text.Length * 10;
            }
        }
Пример #24
0
    IEnumerator AddTextEffect(string text, Vector2 position, Color color, float fadeT, int fontSize)
    {
        // Create the text effect
        TextOverlay t = new TextOverlay(0, 0);

        t.gui = Instantiate(effectTextPrefab, Vector3.zero, Quaternion.identity) as Text;
        t.gui.transform.SetParent(transform, false);

        t.text  = text;
        t.color = color;

        t.gui.transform.eulerAngles = new Vector3(0, 0, Random.Range(-maxRotation, maxRotation));
        t.gui.fontSize = fontSize;

        //Solid time
        float start = Time.time;

        while (Time.time < start + solidTime)
        {
            t.position = viewCamera.WorldToScreenPoint(position);
            yield return(0);

            //
            if (GameManager.instance.roundState == GameManager.RoundState.END_SCREEN)
            {
                break;
            }
        }
        //Fade time
        float alpha = 1.0f, lastTime = Time.time;

        while (alpha >= 0)
        {
            alpha      = 1.0f - ((Time.time - lastTime) / fadeT);
            t.alpha    = alpha;
            t.position = viewCamera.WorldToScreenPoint(position);
            yield return(0);

            //
            if (GameManager.instance.roundState == GameManager.RoundState.END_SCREEN)
            {
                break;
            }
        }
        Destroy(t.gui.gameObject);
    }
Пример #25
0
    public void CreateDefinition(string def)
    {
        GameObject  instance = Instantiate(wordPrefab.gameObject, transform) as GameObject;
        TextOverlay overlay  = instance.GetComponent <TextOverlay>();

        overlay.GetComponent <RectTransform>().sizeDelta = new Vector2(
            overlay.GetComponent <RectTransform>().sizeDelta.x,
            overlay.GetComponent <RectTransform>().sizeDelta.y *(definitionFontSize / wordFontSize)
            );
        if (defOverlays.Count >= maxWords)
        {
            TextOverlay defToRemove = defOverlays.Dequeue();
            Destroy(defToRemove.gameObject);
        }
        defOverlays.Enqueue(overlay);
        overlay.InitializeText(def, definitionFontSize);
    }
Пример #26
0
 private void materialCheckBox8_CheckedChanged(object sender, EventArgs e)
 {
     this.fastObjectListView1.RemoveOverlay(this.nagOverlay);
     if (materialCheckBox8.Checked)
     {
         this.nagOverlay             = new TextOverlay();
         this.nagOverlay.Alignment   = ContentAlignment.MiddleCenter;
         this.nagOverlay.Text        = "  俺がザクだ.  ";
         this.nagOverlay.TextColor   = Color.Red;
         this.nagOverlay.BorderWidth = 4.0f;
         this.nagOverlay.BorderColor = Color.Red;
         this.nagOverlay.Rotation    = -30;
         this.nagOverlay.Font        = new Font("Stencil", 36);
         this.fastObjectListView1.OverlayTransparency = 192;
         this.fastObjectListView1.AddOverlay(this.nagOverlay);
     }
 }
Пример #27
0
        private Font GetOverlayFont(TextOverlay textOverlay)
        {
            string fontKey =
                $"{textOverlay.Font.Name}{textOverlay.Font.Size}{textOverlay.Font.Style}{textOverlay.AntiAliased}";

            if (!_fontCache.TryGetValue(fontKey, out Font overlayFont))
            {
                overlayFont = ToDispose(new Font(_device, new FontDescription()
                {
                    FaceName = textOverlay.Font.Name,
                    Italic = (textOverlay.Font.Style & System.Drawing.FontStyle.Italic) == System.Drawing.FontStyle.Italic,
                    Quality = (textOverlay.AntiAliased ? FontQuality.Antialiased : FontQuality.Default),
                    Weight = ((textOverlay.Font.Style & System.Drawing.FontStyle.Bold) == System.Drawing.FontStyle.Bold) ? FontWeight.Bold : FontWeight.Normal,
                    Height = (int)textOverlay.Font.SizeInPoints
                }));
                _fontCache[fontKey] = overlayFont;
            }
            return overlayFont;
        }
Пример #28
0
        public static string ConvertRecipeToHTML(Recipe recipe)
        {
            TextOverlay overlay = recipe.ParsedResults[0].TextOverlay;

            overlay.ComputeExtraFields();
            overlay.Normalize();
            StringBuilder output = new StringBuilder(String.Empty);

            output.AppendLine("<html>");
            output.AppendLine(String.Format("<body data-ml=\"{0} {1} {2} {3} block\">", 0, 0, overlay.Width, overlay.Height));
            foreach (TextLine line in overlay.Lines)
            {
                output.AppendLine(String.Format("<p data-ml=\"{0} {1} {2} {3} {4}block\">{5}</p>",
                                                line.Bounds.Left, line.Bounds.Top, line.Bounds.Width, line.Bounds.Height, line.Bold? "bold ": String.Empty, line.Text));
            }
            output.AppendLine("</body>");
            output.AppendLine("</html>");
            return(output.ToString());
        }
Пример #29
0
        public void Run(RemoteInterface remoteInterface)
        {
            Interface = remoteInterface;

            // Regular, static text.
            // The X and Y values are coordinates on the screen space, mapped to a 1000x1000 area.
            TextOverlay plain = new TextOverlay("Regular text", 10, 5, 5).Show();

            // Dynamically updating text.
            // The delegate TextOverlay.UpdateText is evaluated on every frame (if assigned).
            // It can be assigned instead of text in the constructor, or later at any point.
            int         frames  = 0;
            TextOverlay counter = new TextOverlay((previousText) =>
            {
                string newText = $"Frame counter={frames}";
                frames++;
                return(newText);
            }, 10, 5, 35).Show();

            // Previous text is passed to the UpdateText method as a parameter.
            // This example appends 1 dot to the text every 10 frames, up to a total of 20.
            // It also uses the frame counter from the previous example.
            int         dots   = 0;
            TextOverlay append = new TextOverlay("Some dots", 10, 5, 65).Show();

            append.UpdateText = (text) =>
            {
                if (frames % 10 == 0 && dots < 20)
                {
                    text += '.';
                    dots++;
                }
                return(text);
            };

            // The delegate TextOverlay.UpdateProperties can be used for advanced text manipulation.
            // It is evaluated on every frame, after UpdateText.
            // The TextOverlay object itself is passed as a parameter.
            // This lets you reuse functions and delegates for multiple text objects.
            plain.UpdateProperties = MoveTextOffscreen;
        }
Пример #30
0
        static GridHelper()
        {
            var emptyListMsgOverlay = new TextOverlay
            {
                Alignment       = ContentAlignment.TopLeft,
                ReferenceCorner = ContentAlignment.TopLeft,
                AdornmentCorner = ContentAlignment.TopLeft,
                BorderWidth     = 0,
                BorderColor     = Color.Transparent,
                TextColor       = Color.FromArgb(244, 133, 24),
                BackColor       = Color.Transparent,
                Text            = @"No data was found",
                CornerRounding  = 0,
                Transparency    = 0,
                Font            = new Font("Segoe UI", 10f),
                InsetX          = 0,
                InsetY          = 0
            };

            EMPTY_LIST_MSG_OVERLAY = emptyListMsgOverlay;
        }
 /**
  * 添加点、线、多边形、圆、文字
  */
 public void AddCustomElementsDemo()
 {
     GraphicsOverlay graphicsOverlay = new GraphicsOverlay(mMapView);
     mMapView.Overlays.Add(graphicsOverlay);
     //添加点
     graphicsOverlay.SetData(DrawPoint());
     //添加折线
     graphicsOverlay.SetData(DrawLine());
     //添加弧线
     graphicsOverlay.SetData(DrawArc());
     //添加多边形
     graphicsOverlay.SetData(DrawPolygon());
     //添加圆
     graphicsOverlay.SetData(DrawCircle());
     //绘制文字
     TextOverlay textOverlay = new TextOverlay(mMapView);
     mMapView.Overlays.Add(textOverlay);
     textOverlay.AddText(DrawText());
     //执行地图刷新使生效
     mMapView.Refresh();
 }