private static readonly Color SelectionColor = Color.White;         //ncrunch: no coverage

        internal void UpdateOutlines(List <Entity2D> selectedControlList)
        {
            ClearLines();
            foreach (Entity2D selectedControl in selectedControlList)
            {
                var newOutlineColor = new Line2D[4];
                CreateOutlinesAndGizmos(newOutlineColor);
                if (selectedControl == null)
                {
                    return;                     //ncrunch: no coverage
                }
                var rectangleCorners = GetRotatedRectangelCorners(selectedControl.DrawArea,
                                                                  selectedControl.Rotation);
                newOutlineColor[0].StartPoint = rectangleCorners[0];
                newOutlineColor[0].EndPoint   = rectangleCorners[1];
                newOutlineColor[1].StartPoint = rectangleCorners[0];
                newOutlineColor[1].EndPoint   = rectangleCorners[2];
                newOutlineColor[2].StartPoint = rectangleCorners[2];
                newOutlineColor[2].EndPoint   = rectangleCorners[3];
                newOutlineColor[3].StartPoint = rectangleCorners[3];
                newOutlineColor[3].EndPoint   = rectangleCorners[1];
                Outlines.Add(newOutlineColor);
            }
            CreateGeneralOutline(selectedControlList);
        }
Beispiel #2
0
        /// <summary>
        /// Updates the texture of the hitbox.
        /// </summary>
        public void Update()
        {
            if (!Visible || Object == null || _textureCreator == null)
            {
                return;
            }

            if (Outlines == null)
            {
                Outlines = new Dictionary <Point, Texture2D>();
            }

            //Size is +2 to surround (but not cover) object
            Point     currentSize = new Point(Object.Width.Round() + 2, Object.Height.Round() + 2);
            Texture2D image;

            if (!Outlines.TryGetValue(currentSize, out image) || image == null)
            {
                //Calculate image
                image = _textureCreator.CreateHollowRectangle(currentSize.X, currentSize.Y, OutlineColor);
                //Add image to cache
                Outlines[currentSize] = image;
            }
            //Set the temporary variable
            Texture = image;
        }
Beispiel #3
0
        private void UpdateLayers(ICollection <RhitLocation> locations)
        {
            LabeledLocations.Clear();
            Outlines.Clear();
            PolygonLayer.Children.Clear();
            TextLayer.Children.Clear();

            foreach (RhitLocation location in locations)
            {
                MapPolygon polygon = location.OutLine;
                if (polygon.Locations == null || polygon.Locations.Count <= 0)
                {
                    continue;
                }
                PolygonLayer.Children.Add(polygon);
                if (!AreOutlinesVisible)
                {
                    RhitLocation.HideOutline(polygon);
                }
                polygon.MouseLeftButtonUp += new MouseButtonEventHandler(Outline_Tap);
                Outlines[polygon]          = location;
                LabeledLocations[location] = location.GetLabel();
                if (ShouldShowLabel(location))
                {
                    TextLayer.Children.Add(LabeledLocations[location]);
                }
            }
        }
Beispiel #4
0
    void ModifyOutlines(Outlines.Mode mode, Color color, float width)
    {
        Outlines outline = gameObject.GetComponent <Outlines>();

        outline.OutlineMode  = mode;
        outline.OutlineColor = color;
        outline.OutlineWidth = width;
    }
Beispiel #5
0
        //--------------------------------------------------------------------------------------------------

        public override bool Write(PdfWriter writer)
        {
            base.Write(writer);

            Outlines.Write(writer);
            Pages.Write(writer);

            return(true);
        }
        protected internal override void Initialize()
        {
            SetValue <PDFViewerPreferences>("ViewerPreferences", Document.CreateObject <PDFViewerPreferences>());

            Outlines.Clear();
            Pages.Clear();

            ViewerPreferences.Duplex = PDFViewerPreferences.PDFDuplex.Simplex;
            ViewerPreferences.NonFullScreenPageMode = PDFViewerPreferences.PDFNonFullScreenPageMode.UseOutlines;
        }
        private void Remove(OutlineState rur)
        {
            if (rur.button != null)
            {
                Controls.Remove(rur.button);
                rur.button.Dispose();
            }

            Outlines.Remove(rur);
        }
 // Add an set of outline areas, areas must be unique but can overlap
 public void Add(IEnumerable <Outline> outlinelist)
 {
     foreach (var e in outlinelist)
     {
         OutlineState rup = new OutlineState();
         rup.r = e;
         Outlines.Add(rup);
     }
     RollUpListChanged();
     UpdateOutlines();
 }
Beispiel #9
0
        public Tile(int x, int y, Tiles tile, Outlines outline)
        {
            markedAsDead = false;
            target       = null;

            this.x       = x;
            this.y       = y;
            coordinates  = new Vector2(x * Board.columnWidth, (y + 1) * Board.rowHeight);
            this.tile    = tile;
            this.outline = outline;
        }
Beispiel #10
0
 /// <summary>
 /// Constructors
 /// </summary>
 /// <param name="Element">Element containing outline information</param>
 public Outline(XmlElement Element)
 {
     if (Element == null)
     {
         throw new ArgumentNullException("Element");
     }
     if (Element.Name.Equals("outline", StringComparison.CurrentCultureIgnoreCase))
     {
         if (Element.Attributes["text"] != null)
         {
             Text = Element.Attributes["text"].Value;
         }
         else if (Element.Attributes["description"] != null)
         {
             Description = Element.Attributes["description"].Value;
         }
         else if (Element.Attributes["htmlUrl"] != null)
         {
             HTMLUrl = Element.Attributes["htmlUrl"].Value;
         }
         else if (Element.Attributes["type"] != null)
         {
             Type = Element.Attributes["type"].Value;
         }
         else if (Element.Attributes["language"] != null)
         {
             Language = Element.Attributes["language"].Value;
         }
         else if (Element.Attributes["title"] != null)
         {
             Title = Element.Attributes["title"].Value;
         }
         else if (Element.Attributes["version"] != null)
         {
             Version = Element.Attributes["version"].Value;
         }
         else if (Element.Attributes["xmlUrl"] != null)
         {
             XMLUrl = Element.Attributes["xmlUrl"].Value;
         }
         foreach (XmlNode Child in Element.ChildNodes)
         {
             try
             {
                 if (Child.Name.Equals("outline", StringComparison.CurrentCultureIgnoreCase))
                 {
                     Outlines.Add(new Outline((XmlElement)Child));
                 }
             }
             catch { }
         }
     }
 }
        private void RollUpListChanged()        // changed list of rollups, resort, work out level of each, reset the outlining size
        {
            Outlines.Sort(delegate(OutlineState first, OutlineState last)
            {
                int c = first.r.start.CompareTo(last.r.start);           // start order, then in largest range (biggest end)
                return(c != 0 ? c : -first.r.end.CompareTo(last.r.end)); // so smaller ones are placed after larger ranges
            });

            SuspendLayout();

            foreach (var r in Outlines)
            {
                if (r.button == null)       // check we have a button, if not, add..
                {
                    r.button = new ExtButtonDrawn()
                    {
                        Visible = false, ImageSelected = ExtButtonDrawn.ImageType.Collapse, Padding = new Padding(0), Size = new Size(butsize, butsize), ForeColor = this.ForeColor
                    };
                    r.button.Tag    = r;
                    r.button.Click += Button_Click;
                    Controls.Add(r.button);
                }
                r.level = 0;
            }

            int maxlevel = 0;

            for (int i = 0; i < Outlines.Count; i++)
            {
                Outlines[i].parent = -1;
            }

            for (int i = 0; i < Outlines.Count; i++)
            {
                for (int j = i + 1; j < Outlines.Count; j++)
                {
                    if (Outlines[j].Overlapped(Outlines[i]))
                    {
                        Outlines[j].level  = Outlines[i].level + 1;
                        Outlines[j].parent = i;
                        maxlevel           = Math.Max(Outlines[j].level, maxlevel);
                    }
                }
            }

            ResumeLayout();
            int width = Math.Max((butsize + butpadding) * (maxlevel + 1) + butleft, MinWidth);          // resize control appropriately

            if (width != this.Width)
            {
                this.Width = width;
            }
        }
Beispiel #12
0
        public virtual object Clone()
        {
            var result = MemberwiseClone() as Category;

            result.SeoInfos   = SeoInfos?.Select(x => x.Clone()).OfType <SeoInfo>().ToList();
            result.Children   = Children?.Select(x => x.Clone()).OfType <Category>().ToList();
            result.Outlines   = Outlines?.Select(x => x.Clone()).OfType <Outline>().ToList();
            result.Parents    = Parents?.Select(x => x.Clone()).OfType <Category>().ToArray();
            result.Properties = Properties?.Select(x => x.Clone()).OfType <Property>().ToList();
            result.Links      = Links?.Select(x => x.Clone()).OfType <CategoryLink>().ToList();
            // result.Images = Images?.Select(x => x.Clone()).OfType<Image>().ToList(); // Intentionally temporary disabled due to memory overhead

            return(result);
        }
 private void ClearLines()
 {
     foreach (Line2D line2D in Outlines.SelectMany(lines => lines))
     {
         line2D.IsActive = false;
     }
     foreach (Line2D line2D in GeneralOutline.Where(line2D => line2D != null))
     {
         line2D.IsActive = false;
     }
     foreach (Sprite gizmo in GizmoList.Where(gizmo => gizmo != null))
     {
         gizmo.IsActive = false;
     }
 }
        public void Clear()
        {
            SuspendLayout();
            foreach (var rur in Outlines)
            {
                if (rur.button != null)
                {
                    Controls.Remove(rur.button);
                    rur.button.Dispose();
                }
            }

            Outlines.Clear();
            this.Width = MinWidth;

            ResumeLayout();
            Invalidate();
        }
Beispiel #15
0
        /// <summary>
        /// Constructors
        /// </summary>
        /// <param name="Element">Element containing outline information</param>
        public Outline(XElement Element)
        {
            Contract.Requires <ArgumentNullException>(Element != null, "Element");
            if (Element.Attribute("text") != null)
            {
                Text = Element.Attribute("text").Value;
            }
            if (Element.Attribute("description") != null)
            {
                Description = Element.Attribute("description").Value;
            }
            if (Element.Attribute("htmlUrl") != null)
            {
                HTMLUrl = Element.Attribute("htmlUrl").Value;
            }
            if (Element.Attribute("type") != null)
            {
                Type = Element.Attribute("type").Value;
            }
            if (Element.Attribute("language") != null)
            {
                Language = Element.Attribute("language").Value;
            }
            if (Element.Attribute("title") != null)
            {
                Title = Element.Attribute("title").Value;
            }
            if (Element.Attribute("version") != null)
            {
                Version = Element.Attribute("version").Value;
            }
            if (Element.Attribute("xmlUrl") != null)
            {
                XMLUrl = Element.Attribute("xmlUrl").Value;
            }

            foreach (XElement Child in Element.Elements("outline"))
            {
                Outlines.Add(new Outline(Child));
            }
        }
        // Add/remove does not affect DGV - you need to do that yourself
        // areas must be unique
        // no update means you must call UpdateAfterAdd.
        public bool Add(int rowstart, int rowend, bool expandedout = true, bool noupdate = false)
        {
            if (FindEntry(rowstart, rowend) == null)
            {
                OutlineState rup = new OutlineState();
                rup.r = new Outline()
                {
                    start = rowstart, end = rowend, expanded = expandedout
                };
                Outlines.Add(rup);

                if (!noupdate)
                {
                    RollUpListChanged();
                    UpdateOutlines();
                }
                return(true);
            }
            else
            {
                return(false);
            }
        }
        private void Button_Click(object sender, EventArgs e)
        {
            ExtButtonDrawn but = sender as ExtButtonDrawn;
            OutlineState   rur = but.Tag as OutlineState;

            if (Parent is ExtPanelDataGridViewScroll)   // this implements an efficient visibility change system
            {
                rur.r.expanded = !rur.r.expanded;

                if (rur.r.expanded == false)       // off is easy - hide everything
                {
                    (Parent as ExtPanelDataGridViewScroll).ChangeVisibility(rur.r.start, rur.r.end - KeepLastEntriesVisibleOnRollUp, rur.r.expanded);
                }
                else
                {
                    BaseUtils.IntRangeList irl = new BaseUtils.IntRangeList();
                    irl.Add(rur.r.start, rur.r.end);
                    Vis(Outlines.IndexOf(rur), irl);         // remove visibility of any children marked hidden
                    irl.Sort();
                    (Parent as ExtPanelDataGridViewScroll).ChangeVisibility(rur.r.start, rur.r.end, irl);
                }
            }
        }
        public void RowRemoved(int row, int count)
        {
            List <OutlineState> removelist = new List <OutlineState>();

            foreach (var rur in Outlines)     // double check they are not removing a start or end row..
            {
                if ((rur.r.start >= row && rur.r.start < row + count) || (rur.r.end >= row && rur.r.end < row + count))
                {
                    removelist.Add(rur);
                }
            }

            foreach (var r in removelist)       // if so, remove the roll up
            {
                Outlines.Remove(r);
            }

            if (removelist.Count > 0)       // if changed, rework states
            {
                RollUpListChanged();
            }

            UpdateOutlines();
        }
        public bool Remove(int rowstart, int rowend)        // remove it
        {
            OutlineState r = FindEntry(rowstart, rowend);

            if (r != null)
            {
                if (r.button != null)
                {
                    Controls.Remove(r.button);
                    r.button.Dispose();
                }

                Outlines.Remove(r);

                RollUpListChanged();
                UpdateOutlines();
                Invalidate();   // ensure in case we have gone to zero rollups
                return(true);
            }
            else
            {
                return(false);
            }
        }
Beispiel #20
0
    void SetOutlinesEnabled(bool enabled)
    {
        Outlines outline = gameObject.GetComponent <Outlines>();

        outline.enabled = enabled;
    }
Beispiel #21
0
 void OnEnable()
 {
     Outlines.HighlightRenderers(myRenderers, BasicColor.Black, false, "AO");
 }