public XmlNode ToNode(XmlDocument doc)
        {
            var node = doc.CreateElement(RootElementName);

            var idAtr = doc.CreateAttribute("id");
            idAtr.Value = Id;
            node.Attributes.Append(idAtr);

            if (!string.IsNullOrEmpty(Title))
            {
                var atr = doc.CreateAttribute("title");
                atr.Value = Title;
                node.Attributes.Append(atr);
            }

            if (!string.IsNullOrEmpty(Image))
            {
                var atr = doc.CreateAttribute("image");
                atr.Value = Image.Contains("Template") ? Image : $"base64:{Image}";

                node.Attributes.Append(atr);
            }

            if (ChildElements.Any())
                node.AppendChild(CreateIdentifiedChildNode(doc, ChildElements, ChildElementName, "PopoverChild"));

            if (PressAndHoldChildElements.Any())
                node.AppendChild(CreateIdentifiedChildNode(doc, PressAndHoldChildElements, PressAndHoldChildElementName, "PressAndHoldChild"));

            return node;
        }
        public Joint() : base("joint", false)
        {
            Origin = new Origin("Joint", false);
            Parent = new ParentLink();
            Child  = new ChildLink();
            Axis   = new Axis();

            Limit       = new Limit();
            Calibration = new Calibration();
            Dynamics    = new Dynamics();
            Safety      = new SafetyController();
            Mimic       = new Mimic();

            NameAttribute = new URDFAttribute("name", true, "");
            TypeAttribute = new URDFAttribute("type", true, "");

            Attributes.Add(NameAttribute);
            Attributes.Add(TypeAttribute);

            ChildElements.Add(Origin);
            ChildElements.Add(Parent);
            ChildElements.Add(Child);
            ChildElements.Add(Axis);

            ChildElements.Add(Limit);
            ChildElements.Add(Calibration);
            ChildElements.Add(Dynamics);
            ChildElements.Add(Safety);
            ChildElements.Add(Mimic);
        }
Example #3
0
 void RemoveVariable(int index)
 {
     ChildElements.Remove(parameterContainers[index].numberDisplay);
     ChildElements.Remove(parameterContainers[index].variableDisplay);
     parameterContainers.RemoveAt(index);
     ParameterValues.RemoveAt(index);
 }
        /// <summary>
        /// Used to add the Childs the element to current instance.
        /// </summary>
        /// <typeparam name="T">Model</typeparam>
        /// <returns></returns>
        public T ChildElement <T>() where T : HtmlTag, new()
        {
            var child = new T();

            ChildElements.Add(child);
            return(child);
        }
        /// <summary>
        /// Renders the specified writer.
        /// </summary>
        /// <param name="writer">The writer.</param>
        public void Render(TextWriter writer)
        {
            if (RenderMode != TagRenderMode.SelfClosing)
            {
                writer.Write(tagBuilder.ToString(TagRenderMode.StartTag));

                if (Template != null)
                {
                    Template(writer);
                }
                if (ChildElements.Any())
                {
                    ChildElements.ForEach(child => child.Render(writer));
                }
                else
                {
                    writer.Write(tagBuilder.InnerHtml);
                }

                writer.Write(tagBuilder.ToString(TagRenderMode.EndTag));
            }
            else
            {
                writer.Write(tagBuilder.ToString(TagRenderMode.SelfClosing));
            }
        }
Example #6
0
 protected internal override void RenderNode(WordTemplateParameters p)
 {
     if (this.NodeProvider.IsParagraph(this.Parent) &&
         !this.Parent !.ChildElements.Any(a => BlockContainerNode.IsImportant(a, NodeProvider) && a != this))
     {
         this.Parent.Remove();
     }
Example #7
0
        public Collision() : base("collision", false)
        {
            Origin   = new Origin(false);
            Geometry = new Geometry();

            ChildElements.Add(Origin);
            ChildElements.Add(Geometry);
        }
Example #8
0
 public void AddChild(ListElement element)
 {
     if (ChildElements.Contains(element) == false)
     {
         element.ParentElement = this;
         ChildElements.Add(element);
     }
 }
Example #9
0
        public Robot() : base("robot", true)
        {
            BaseLink      = new Link(null);
            NameAttribute = new URDFAttribute("name", true, "");

            ChildElements.Add(BaseLink);
            Attributes.Add(NameAttribute);
        }
Example #10
0
 public bool Equals(Test other)
 {
     return(String == other.String &&
            Int == other.Int &&
            DateTime == other.DateTime &&
            (SingleChildObject == null && other.SingleChildObject == null || SingleChildObject.Equals(other.SingleChildObject)) &&
            ChildElements.SequenceEqual(other.ChildElements) &&
            Children.SequenceEqual(other.Children));
 }
        public bool IsLast(CollectionElementViewModel element)
        {
            if (!ChildElements.Any())
            {
                return(false);
            }

            return(ChildElements.Last().ElementId == element.ElementId);
        }
        public Material() : base("material", false)
        {
            Color         = new Color();
            Texture       = new Texture();
            NameAttribute = new URDFAttribute("name", true, "");

            Attributes.Add(NameAttribute);
            ChildElements.Add(Color);
            ChildElements.Add(Texture);
        }
        public Inertial() : base("inertial", false)
        {
            Origin  = new Origin("Inertia", false);
            Mass    = new Mass();
            Inertia = new Inertia();

            ChildElements.Add(Origin);
            ChildElements.Add(Mass);
            ChildElements.Add(Inertia);
        }
        public Visual() : base("visual", false)
        {
            Origin   = new Origin(false);
            Geometry = new Geometry();
            Material = new Material();

            ChildElements.Add(Origin);
            ChildElements.Add(Geometry);
            ChildElements.Add(Material);
        }
Example #15
0
        public virtual void Dispose()
        {
            foreach (var element in ChildElements)
            {
                element.Dispose();
            }

            ChildElements.Clear();
            Location = default(FloatPoint);
            Size     = default(Point);
            Rotation = null;
        }
 public GraphComponent(RectangleF Rect, Color color, int Spacing = 1, bool Dots = false) : base(Rect)
 {
     this.Dots    = Dots;
     this.spacing = Spacing;
     Color        = color;
     this.Rect    = Rect;
     Array        = new double[(int)Rect.Width / spacing];
     StartIndex   = Array.Length;
     TextRect     = new Rectangle((int)Rect.Width, 0, TextDisplayWidth, (int)Rect.Height);
     TextDisplay  = new TextDisplay(TextRect);
     ChildElements.Add(TextDisplay);
 }
Example #17
0
        public virtual void MouseMove(Point mousePosition)
        {
            if (!IsVisible)
            {
                return;
            }

            ChildElements?.ForEach((e) =>
            {
                e.MouseMove(mousePosition);
            });
        }
        public ColorEditor(RectangleF Rect) : base(Rect)
        {
            float Padding = 10;
            float X       = Padding;

            ColorScaleSlider       = new Slider(new RectangleF(X, Padding, 30, Rect.Height - Padding * 2));
            ColorScaleSlider.Value = 0.5;
            ChildElements.Add(ColorScaleSlider);
            X += ColorScaleSlider.Rect.Width + Padding;
            MainCircleOuterRadius = Rect.Height / 2 - Padding;
            MainCirclePosition    = new Vector2(X + MainCircleOuterRadius, Padding + MainCircleOuterRadius);
            X += MainCircleOuterRadius * 2 + Padding;
            InnerCircleRadius     = MainCircleOuterRadius * 0.3f;
            MainCircleInnerRadius = MainCircleOuterRadius * 0.6f;

            ColorPalette[0]     = Color4.Orange;
            ColorPalette[1]     = Color4.DarkBlue;
            ColorPalette[2]     = Color4.Cyan;
            PalettePositions[0] = 0.0f;
            PalettePositions[1] = 0.33f;
            PalettePositions[2] = 0.66f;
            CurrentPaletteSize  = 3;
            InteriorColor       = Color.Black;
            DragEvent          += MainDrag;
            MouseDownEvent     += MouseDown;
            HoverEvent         += MouseHover;
            MouseUpEvent       += MouseUp;
            float SliderHeight = (Rect.Height - Padding * 4) / 3;

            Color[] Colors = new Color[] { Color.Red, Color.Lime, Color.Blue };
            for (int i = 0; i < 3; i++)
            {
                ColorSliders[i] = new Slider(new RectangleF(X, Padding + (SliderHeight + Padding) * i, 140, SliderHeight));
                ColorSliders[i].BackgroundColor = Colors[i];
                ChildElements.Add(ColorSliders[i]);
            }
            X += 140 + Padding;
            DotStrengthSlider       = new Slider(new RectangleF(X, Padding, 30, Rect.Height - Padding * 2));
            DotStrengthSlider.Value = 1;
            X += 30 + Padding;
            ChildElements.Add(DotStrengthSlider);
            ColorScaleSlider.SliderEvent += ScaleSliderChanged;
            DistanceColoringButton        = new FractalWindow(new RectangleF(X, Padding, 50, 50));
            DistanceColoringButton.Controller.CameraPos = new Complex(-0.037896351914748, 0.682660083979483);
            DistanceColoringButton.Controller.Zoom      = 0.005;
            DistanceColoringButton.EnableInteraction    = false;
            DistanceColoringButton.MouseDownEvent      += DistanceColorButtonClicked;
            DistanceColoringButton.Controller.DistanceEstimateEnabled = true;
            DistanceColoringButton.Controller.ColorScale = 5;
            ChildElements.Add(DistanceColoringButton);
        }
Example #19
0
        public override void Draw(SpriteBatch spriteBatch, Rectangle rectangle)
        {
            int xoffset = Margin + rectangle.X;

            ChildElements?.ForEach((e) =>
            {
                var rect             = e.Rectangle;
                Rectangle targetRect = new Rectangle(xoffset, rectangle.Y, rect.Width, rectangle.Height);
                xoffset    += (Margin + targetRect.Width);
                e.Rectangle = targetRect;
            });
            Rectangle = new Rectangle(Rectangle.Location, new Point(xoffset - rectangle.X, Rectangle.Height));
            base.Draw(spriteBatch, Rectangle);
        }
Example #20
0
        public override void Draw(SpriteBatch spriteBatch, Rectangle rectangle)
        {
            int yoffset = Margin + rectangle.Y;

            ChildElements?.Where(e => e.IsVisible).ToList().ForEach((e) =>
            {
                var rect             = e.Rectangle;
                Rectangle targetRect = new Rectangle(rectangle.X + Margin, yoffset, rectangle.Width - 2 * Margin, rect.Height);
                yoffset    += (Margin + targetRect.Height);
                e.Rectangle = targetRect;
            });
            Rectangle = new Rectangle(Rectangle.Location, new Point(Rectangle.Width, yoffset - rectangle.Y));
            base.Draw(spriteBatch, Rectangle);
        }
Example #21
0
        protected string GetChildString(string name)
        {
            var child = ChildElements.Where(elem => elem.Name.ToString() == name).FirstOrDefault();

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

            var charData = child.Children.FirstOrDefault() as ICharacterData;

            return(charData != null ?
                   charData.Content
                : null);
        }
Example #22
0
        public virtual void Draw(SpriteBatch spriteBatch, Rectangle rectangle)
        {
            if (!IsVisible)
            {
                return;
            }
            if (Background != null)
            {
                spriteBatch.Draw(Background, rectangle, MaskColor);
            }

            ChildElements?.ForEach((e) =>
            {
                e.Draw(spriteBatch);
            });
        }
Example #23
0
        internal object ToDump() => new
        {
            Name,

            Attributes =
                from an in AttributeNames
                select new { Name = an, Value = GetAttributeValue(an) },

            ChildElementCount =
                HasChildElements ? ChildElements.Count() : 0,

            OuterHtml =
                OuterHtml.Length <= 300
                ? (object)OuterHtml
                : new Lazy <string>(() => OuterHtml)
        };
        public override List <IError> Validate(List <IError> errors)
        {
            RequireRange(this, x => x.VersionMajor, 0, 4, errors);
            RequireRange(this, x => x.VersionMinor, 0, 99, errors);
            ValidateString(this, x => x.ManagementSoftwareManufacturer, 32, errors);
            ValidateString(this, x => x.ManagementSoftwareVersion, 32, errors);
            ValidateString(this, x => x.TaskControllerManufacturer, 32, errors);
            ValidateString(this, x => x.TaskControllerVersion, 32, errors);
            ValidateEnumerationValue(typeof(ISOTaskDataTransferOrigin), DataTransferOriginInt, errors);
            ChildElements.ForEach(i => i.Validate(errors));
            if (LinkList != null)
            {
                LinkList.Validate(errors);
            }

            return(errors);
        }
Example #25
0
        public TriodionRule FindTriodionRule(int daysFromEaster)
        {
            TriodionRule result = (TriodionRule)ChildElements.AsQueryable().
                                  FirstOrDefault(c => ((c is TriodionRule) && ((c as TriodionRule).Day.DaysFromEaster == daysFromEaster)));

            if (result == null)
            {
                foreach (TypiconFolder folder in Folders)
                {
                    result = folder.FindTriodionRule(daysFromEaster);
                    if (result != null)
                    {
                        return(result);
                    }
                }
            }

            return(result);
        }
Example #26
0
        public ConfigurationElementCollection GetCollection(string collectionName)
        {
            var child = ChildElements[collectionName];

            if (child != null)
            {
                return(child.GetCollection());
            }

            var schema = Schema.ChildElementSchemas[collectionName];

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

            var result = new ConfigurationElementCollection(collectionName, schema, this, this.InnerEntity, null);

            ChildElements.Add(result);
            return(result.GetCollection());
        }
Example #27
0
        public Link() : base("link", true)
        {
            Parent          = null;
            Children        = new List <Link>();
            SWComponents    = new List <Component2>();
            SWComponentPIDs = new List <byte[]>();
            NameAttribute   = new URDFAttribute("name", true, "");

            Inertial  = new Inertial();
            Visual    = new Visual();
            Collision = new Collision();
            Joint     = new Joint();

            isFixedFrame = false;

            Attributes.Add(NameAttribute);
            ChildElements.Add(Inertial);
            ChildElements.Add(Visual);
            ChildElements.Add(Collision);
            ChildElements.Add(Joint);
        }
Example #28
0
        public virtual bool Click(Point mousePosition)
        {
            if (!IsVisible)
            {
                return(false);
            }
            var copyElements = ChildElements.ToArray();

            if (copyElements.Any(e => e.Click(mousePosition)))
            {
                return(true);
            }

            if (Rectangle.Contains(mousePosition))
            {
                OnClick(this, EventArgs.Empty);
                return(StopPropagation);
            }

            return(false);
        }
Example #29
0
        public MenologyRule FindMenologyRule(DateTime date)
        {
            //MenologyRule result = (MenologyRule)Rules.AsQueryable().FirstOrDefault(c => ((c is MenologyRule) &&
            //                                    (((MenologyRule)c).Day.GetCurrentDate(date.Year)) == date));

            MenologyRule result = (MenologyRule)ChildElements.FirstOrDefault(c => ((c is MenologyRule) &&
                                                                                   (((MenologyRule)c).Day.GetCurrentDate(date.Year)) == date));

            if (result == null)
            {
                foreach (TypiconFolder folder in Folders)
                {
                    result = folder.FindMenologyRule(date);
                    if (result != null)
                    {
                        return(result);
                    }
                }
            }

            return(result);
        }
Example #30
0
        void AddVariable(char v)
        {
            Complex pv = 0;

            ParameterValues.Add(pv);
            var container = new ParameterContainer();

            container.variable        = v;
            container.variableDisplay = new TextDisplay(new RectangleF(10, 0, VariableDisplaySize, VariableDisplaySize));
            container.variableDisplay.PrepareWrite();
            container.variableDisplay.DrawCenteredText(v.ToString(), Brushes.Black, 10);
            container.variableDisplay.PrepareDraw();
            ChildElements.Add(container.variableDisplay);

            container.numberDisplay = new TextDisplay(new RectangleF(20 + VariableDisplaySize, 0, Rect.Width - VariableDisplaySize * 2 - 30, VariableDisplaySize));
            container.numberDisplay.PrepareWrite();
            container.numberDisplay.DrawCenteredText(pv.ToString(), Brushes.Black, 8);
            container.numberDisplay.PrepareDraw();
            container.numberDisplay.DrawFrame = false;
            ChildElements.Add(container.numberDisplay);

            parameterContainers.Add(container);
        }