Esempio n. 1
0
        protected override void CreateChildElements()
        {
            this.linePrimitive = new LinePrimitive();
            this.linePrimitive.AutoSizeMode   = RadAutoSizeMode.FitToAvailableSize;
            this.linePrimitive.BackColor      = Color.Black;
            this.linePrimitive.BackColor2     = Color.White;
            this.linePrimitive.BackColor3     = Color.White;
            this.linePrimitive.NumberOfColors = 3;
            this.linePrimitive.GradientStyle  = GradientStyles.Linear;

            this.linePrimitive.BindProperty(LinePrimitive.BackColorProperty, this,
                                            RadLineItem.LineColorProperty, PropertyBindingOptions.OneWay);
            this.linePrimitive.BindProperty(LinePrimitive.BackColor2Property, this,
                                            RadLineItem.LineColor2Property, PropertyBindingOptions.OneWay);
            this.linePrimitive.BindProperty(LinePrimitive.BackColor3Property, this,
                                            RadLineItem.LineColor2Property, PropertyBindingOptions.OneWay);

            this.linePrimitive.BindProperty(LinePrimitive.LineWidthProperty, this,
                                            RadLineItem.LineWidthProperty, PropertyBindingOptions.OneWay);
            this.linePrimitive.BindProperty(LinePrimitive.SweepAngleProperty, this,
                                            RadLineItem.SweepAngleProperty, PropertyBindingOptions.OneWay);
            this.linePrimitive.BindProperty(LinePrimitive.OrientationProperty, this,
                                            RadLineItem.OrientationProperty, PropertyBindingOptions.OneWay);

            this.Children.Add(this.linePrimitive);
        }
Esempio n. 2
0
        internal static bool CheckLineToPolygonCollision(LinePrimitive line, ConvexPolygonPrimitive polygon)
        {
            #region Argument Check

            if (line == null)
            {
                throw new ArgumentNullException("line");
            }

            if (polygon == null)
            {
                throw new ArgumentNullException("polygon");
            }

            #endregion

            if (IsPointInPolygon(line.Start, polygon) || IsPointInPolygon(line.End, polygon))
            {
                return(true);
            }

            // ReSharper disable once LoopCanBeConvertedToQuery
            // ReSharper disable once ForCanBeConvertedToForeach
            for (var index = 0; index < polygon.Edges.Count; index++)
            {
                var edge = polygon.Edges[index];
                if (CheckLineToLineCollision(line, edge))
                {
                    return(true);
                }
            }

            return(false);
        }
Esempio n. 3
0
        public ReferenceLineGraphic()
        {
            base.Graphics.Add(_text = new InvariantTextPrimitive());
            base.Graphics.Add(_line = new LinePrimitive());

            _text.BoundingBoxChanged += OnTextBoundingBoxChanged;
        }
Esempio n. 4
0
        internal static bool CheckLineToCircleCollision(LinePrimitive line, CirclePrimitive circle)
        {
            #region Argument Check

            if (line == null)
            {
                throw new ArgumentNullException("line");
            }

            if (circle == null)
            {
                throw new ArgumentNullException("circle");
            }

            #endregion

            // It's enough to check only one of the line's points
            if (IsPointInCircle(line.Start, circle))
            {
                return(true);
            }

            var circleDirection = line.Start - circle.Center;

            var a = line.Direction * line.Direction;
            var b = 2 * (circleDirection * line.Direction);
            var c = (circleDirection * circleDirection) - circle.RadiusSquared;

            var d = b.Sqr() - 4 * a * c;
            return(d.IsPositiveOrZero());
        }
        private void OnCloneComplete()
        {
            _shaft     = CollectionUtils.SelectFirst(base.Graphics, delegate(IGraphic graphic) { return(graphic is LinePrimitive); }) as LinePrimitive;
            _crosshair = CollectionUtils.SelectFirst(base.Graphics, delegate(IGraphic graphic) { return(graphic is InvariantCrosshairGraphic); }) as InvariantCrosshairGraphic;

            Initialize();
        }
Esempio n. 6
0
        public Text(SystemManagers managers, string text = "Hello")
        {
            Visible        = true;
            RenderBoundary = RenderBoundaryDefault;

            mManagers = managers;
            mChildren = new List <IRenderableIpso>();

            mRawText = text;
            mNeedsBitmapFontRefresh = true;
            mBounds       = new LinePrimitive(this.Renderer.SinglePixelTexture);
            mBounds.Color = Color.LightGreen;

            mBounds.Add(0, 0);
            mBounds.Add(0, 0);
            mBounds.Add(0, 0);
            mBounds.Add(0, 0);
            mBounds.Add(0, 0);
            HorizontalAlignment = Graphics.HorizontalAlignment.Left;
            VerticalAlignment   = Graphics.VerticalAlignment.Top;

#if !TEST
            if (LoaderManager.Self.DefaultBitmapFont != null)
            {
                this.BitmapFont = LoaderManager.Self.DefaultBitmapFont;
            }
#endif
            UpdateLinePrimitive();
        }
Esempio n. 7
0
 /// <summary>
 /// Constructs a <see cref="ScaleGraphic"/>.
 /// </summary>
 public ScaleGraphic()
 {
     Graphics.Add(_baseLine = new LinePrimitive {
         Name = _baseLineName
     });
     _isDirty = false;
 }
Esempio n. 8
0
    public GeometricObject()
    {
        rendering   = false;
        initialized = false;

        pointAppearance = new Stack <Appearance> ();
        pointAppearance.Push(new Appearance(Color.red, Color.red, 60f, 1f, 1f));

        lineAppearance = new Stack <Appearance> ();
        lineAppearance.Push(new Appearance(Color.blue, Color.blue, 60f, 1f, 1f));

        surfaceAppearance = new Stack <Appearance> ();
        surfaceAppearance.Push(new Appearance(Color.green, Color.grey, 60f, 1f, 1f));

        primitives = new List <PrimitiveBase> ();

        ptp = new PointPrimitive();
        primitives.Add(ptp);

        lp = new LinePrimitive();
        primitives.Add(lp);

        pp = new PolygonPrimitive();
        primitives.Add(pp);

        sp = new SpherePrimitive();
        primitives.Add(sp);

        mp = new MeshPrimitive();
        primitives.Add(mp);
    }
Esempio n. 9
0
 protected override void CreateChildElements()
 {
     base.CreateChildElements();
     this.linePrimitive           = new LinePrimitive();
     this.linePrimitive.Alignment = ContentAlignment.MiddleCenter;
     this.linePrimitive.BackColor = Color.Black;
     this.Children.Add((RadElement)this.linePrimitive);
 }
Esempio n. 10
0
        protected override void CreateChildElements()
        {
            base.CreateChildElements();
            this.Class                                        = nameof(DescriptionTextListVisualItem);
            this.DrawText                                     = true;
            this.Text                                         = string.Empty;
            this.ClipDrawing                                  = true;
            this.horizontalStackLayout                        = new StackLayoutElement();
            this.horizontalStackLayout.Orientation            = Orientation.Horizontal;
            this.horizontalStackLayout.StretchHorizontally    = true;
            this.horizontalStackLayout.StretchVertically      = true;
            this.horizontalStackLayout.ShouldHandleMouseInput = false;
            this.Children.Add((RadElement)this.horizontalStackLayout);
            this.imageContent                     = new LightVisualElement();
            this.imageContent.DrawText            = false;
            this.imageContent.StretchVertically   = true;
            this.imageContent.StretchHorizontally = false;
            this.imageContent.ImageLayout         = ImageLayout.None;
            this.imageContent.ImageAlignment      = ContentAlignment.MiddleCenter;
            int num1 = (int)this.imageContent.BindProperty(LightVisualElement.ImageAlignmentProperty, (RadObject)this, LightVisualElement.ImageAlignmentProperty, PropertyBindingOptions.OneWay);

            this.imageContent.Class = "ImageContent";
            this.imageContent.ShouldHandleMouseInput = false;
            this.horizontalStackLayout.Children.Add((RadElement)this.imageContent);
            this.verticalStackLayout                        = new StackLayoutElement();
            this.verticalStackLayout.Orientation            = Orientation.Vertical;
            this.verticalStackLayout.StretchHorizontally    = true;
            this.verticalStackLayout.StretchVertically      = false;
            this.verticalStackLayout.ShouldHandleMouseInput = false;
            this.horizontalStackLayout.Children.Add((RadElement)this.verticalStackLayout);
            this.mainContent = new LightVisualElement();
            this.mainContent.StretchVertically        = false;
            this.mainContent.TextAlignment            = ContentAlignment.MiddleLeft;
            this.mainContent.NotifyParentOnMouseInput = true;
            this.mainContent.TextWrap = true;
            this.mainContent.Class    = "MainContent";
            this.mainContent.ShouldHandleMouseInput = false;
            this.verticalStackLayout.Children.Add((RadElement)this.mainContent);
            this.separator = new LinePrimitive();
            this.separator.NotifyParentOnMouseInput = true;
            this.separator.StretchHorizontally      = true;
            this.separator.StretchVertically        = false;
            this.separator.ShouldHandleMouseInput   = false;
            this.verticalStackLayout.Children.Add((RadElement)this.separator);
            this.descriptionContent = new DescriptionContentListVisualItem();
            this.descriptionContent.TextAlignment            = ContentAlignment.MiddleLeft;
            this.descriptionContent.ForeColor                = Color.FromArgb((int)byte.MaxValue, 128, 128, 128);
            this.descriptionContent.NotifyParentOnMouseInput = true;
            this.descriptionContent.ShouldHandleMouseInput   = false;
            this.descriptionContent.TextWrap = true;
            this.descriptionContent.Class    = "DescriptionContent";
            int num2 = (int)this.descriptionContent.BindProperty(DescriptionContentListVisualItem.ActiveProperty, (RadObject)this, RadListVisualItem.ActiveProperty, PropertyBindingOptions.OneWay);
            int num3 = (int)this.descriptionContent.BindProperty(DescriptionContentListVisualItem.SelectedProperty, (RadObject)this, RadListVisualItem.SelectedProperty, PropertyBindingOptions.OneWay);
            int num4 = (int)this.descriptionContent.BindProperty(RadElement.ContainsMouseProperty, (RadObject)this, RadElement.ContainsMouseProperty, PropertyBindingOptions.OneWay);

            this.verticalStackLayout.Children.Add((RadElement)this.descriptionContent);
            RadListVisualItem.SynchronizationProperties.Add(DescriptionTextListVisualItem.DescriptionFontProperty);
        }
Esempio n. 11
0
        public CrosshairGraphic()
        {
            base.Graphics.Add(_line1 = new LinePrimitive());
            base.Graphics.Add(_line2 = new LinePrimitive());
            base.Graphics.Add(_line3 = new LinePrimitive());
            base.Graphics.Add(_line4 = new LinePrimitive());

            this.Color = Color.LimeGreen;
        }
Esempio n. 12
0
        public LinePrimitive CreateLinesForMinimap(Vector2 offset, Vector2 ratio, Color LineColor)
        {
            LinePrimitive lp = new LinePrimitive(Engine.Instance.Graphics.GraphicsDevice, LineColor);

            foreach (WayPoint wp in NextWaypoints)
            {
                lp.AddVector(offset + Location * ratio);
                lp.AddVector(offset + wp.Location * ratio);
            }
            return(lp);
        }
 protected override void CreateChildElements()
 {
     this.headerButton = this.CreateButtonElement();
     this.headerButton.StretchHorizontally = false;
     this.Children.Add((RadElement)this.headerButton);
     this.headerText = this.CreateTextElement();
     this.headerText.StretchHorizontally = false;
     this.Children.Add((RadElement)this.headerText);
     this.headerLine = this.CreateLineElement();
     this.Children.Add((RadElement)this.headerLine);
 }
Esempio n. 14
0
        protected override void CreateChildElements()
        {
            this.internalLayoutPanel       = (ImageAndTextLayoutPanel) new MenuImageAndTextLayout();
            this.internalLayoutPanel.Class = "RadMenuItemInternalLayoutPanel";
            this.Children.Add((RadElement)this.internalLayoutPanel);
            this.checkmark = new RadMenuCheckmark();
            int num1 = (int)this.checkmark.SetValue(ImageAndTextLayoutPanel.IsImagePrimitiveProperty, (object)true);

            this.checkmark.Alignment = ContentAlignment.MiddleCenter;
            this.checkmark.CheckElement.Alignment = ContentAlignment.MiddleCenter;
            this.checkmark.CheckElement.Class     = "RadMenuItemCheckPrimitive";
            this.internalLayoutPanel.Children.Add((RadElement)this.checkmark);
            this.imagePrimitive = new ImagePrimitive();
            int num2 = (int)this.imagePrimitive.SetValue(RadCheckmark.IsImageProperty, (object)true);

            this.imagePrimitive.Class     = "RadMenuItemImagePrimitive";
            this.imagePrimitive.Alignment = ContentAlignment.MiddleCenter;
            this.imagePrimitive.ZIndex    = this.checkmark.ZIndex + 1;
            this.checkmark.Children.Add((RadElement)this.imagePrimitive);
            this.textPanel = new StackLayoutPanel();
            this.textPanel.StretchHorizontally = false;
            this.textPanel.StretchVertically   = false;
            this.textPanel.Class              = "RadMenuItemTextPanel";
            this.textPanel.Orientation        = Orientation.Vertical;
            this.textPanel.EqualChildrenWidth = true;
            int num3 = (int)this.textPanel.SetValue(ImageAndTextLayoutPanel.IsTextPrimitiveProperty, (object)true);

            this.internalLayoutPanel.Children.Add((RadElement)this.textPanel);
            this.textPrimitive = new TextPrimitive();
            int num4 = (int)this.textPrimitive.SetValue(ImageAndTextLayoutPanel.IsTextPrimitiveProperty, (object)true);

            this.textPrimitive.Class = "RadMenuItemTextPrimitive";
            this.textPanel.Children.Add((RadElement)this.textPrimitive);
            this.textSeparator            = new LinePrimitive();
            this.textSeparator.Class      = "RadMenuItemTextSeparator";
            this.textSeparator.Visibility = ElementVisibility.Collapsed;
            this.textPanel.Children.Add((RadElement)this.textSeparator);
            this.descriptionTextPrimitive       = new TextPrimitive();
            this.descriptionTextPrimitive.Class = "RadMenuItemDescriptionText";
            this.textPanel.Children.Add((RadElement)this.descriptionTextPrimitive);
            this.shortcutTextPrimitive            = new TextPrimitive();
            this.shortcutTextPrimitive.Class      = "RadMenuItemShortcutPrimitive";
            this.shortcutTextPrimitive.Visibility = ElementVisibility.Collapsed;
            this.Children.Add((RadElement)this.shortcutTextPrimitive);
            this.arrowPrimitive               = new ArrowPrimitive();
            this.arrowPrimitive.Visibility    = ElementVisibility.Hidden;
            this.arrowPrimitive.Direction     = this.RightToLeft ? Telerik.WinControls.ArrowDirection.Left : Telerik.WinControls.ArrowDirection.Right;
            this.arrowPrimitive.Alignment     = ContentAlignment.MiddleLeft;
            this.arrowPrimitive.Class         = "RadMenuItemArrowPrimitive";
            this.arrowPrimitive.SmoothingMode = SmoothingMode.Default;
            this.arrowPrimitive.MinSize       = Size.Empty;
            this.arrowPrimitive.MaxSize       = Size.Empty;
            this.Children.Add((RadElement)this.arrowPrimitive);
        }
Esempio n. 15
0
        protected override void CreateChildElements()
        {
            this.linePrimitive       = new LinePrimitive();
            this.linePrimitive.Class = "LineFill";
            this.linePrimitive.SetDefaultValueOverride(RadElement.MarginProperty, new Padding(0, 2, 0, 2));
            this.linePrimitive.BindProperty(LinePrimitive.SweepAngleProperty, this, SweepAngleProperty, PropertyBindingOptions.TwoWay);
            this.linePrimitive.BindProperty(LinePrimitive.LineWidthProperty, this, LineWidthProperty, PropertyBindingOptions.TwoWay);
            this.linePrimitive.BindProperty(LinePrimitive.OrientationProperty, this, OrientationProperty, PropertyBindingOptions.TwoWay);
            this.Children.Add(this.linePrimitive);

            cachedLineOffset = (float)GetValue(LineOffsetProperty);
        }
Esempio n. 16
0
        /// <summary>
        /// Formats the scale's minor ticks.
        /// </summary>
        /// <param name="tickLine">A reference to the <see cref="LinePrimitive"/> that is the tick.</param>
        /// <param name="point">The point along the base line segment where the tick begins.</param>
        /// <param name="unitNormal">A unit normal vector that is perpendicular to the base line segment.</param>
        protected virtual void FormatMinorTick(LinePrimitive tickLine, PointF point, SizeF unitNormal)
        {
            float length = this.MinorTickLength;

            if (this.IsMirrored)
            {
                length = -length;
            }
            tickLine.Point1 = point;
            tickLine.Point2 = new PointF(point.X + length * unitNormal.Width, point.Y + length * unitNormal.Height);
            tickLine.Color  = Color.White;
        }
Esempio n. 17
0
        public static LineSide GetLineSide(LinePrimitive line, Point2D point)
        {
            #region Argument Check

            if (line == null)
            {
                throw new ArgumentNullException("line");
            }

            #endregion

            return(GetLineSide(line.Start, line.End, point));
        }
        private void Initialize()
        {
            if (_shaft == null)
            {
                base.Graphics.Add(_shaft = new LinePrimitive());
            }

            if (_crosshair == null)
            {
                base.Graphics.Add(_crosshair = new InvariantCrosshairGraphic());
                _crosshair.Visible           = _showCrosshair;
            }

            _shaft.Point1Changed += OnShaftPoint1Changed;
            _shaft.Point2Changed += OnShaftPoint2Changed;
        }
Esempio n. 19
0
 protected override void CreateChildElements()
 {
     this.line1               = new LinePrimitive();
     this.line1.Class         = "Line1";
     this.line1.BackColor     = Color.Black;
     this.line1.GradientStyle = GradientStyles.Solid;
     this.line1.LineWidth     = 1;
     this.line1.SmoothingMode = SmoothingMode.None;
     this.Children.Add((RadElement)this.line1);
     this.line2               = new LinePrimitive();
     this.line2.Class         = "Line2";
     this.line2.BackColor     = Color.LightGray;
     this.line2.GradientStyle = GradientStyles.Solid;
     this.line2.LineWidth     = 1;
     this.line2.SmoothingMode = SmoothingMode.None;
     this.Children.Add((RadElement)this.line2);
 }
Esempio n. 20
0
        private void OnCloneComplete()
        {
            foreach (var graphic in Graphics)
            {
                if (_baseLine == null && graphic is LinePrimitive && graphic.Name == _baseLineName)
                {
                    _baseLine = (LinePrimitive)graphic;
                }

                if (graphic is LinePrimitive && graphic.Name == _tickLineName)
                {
                    _ticklines.Add((LinePrimitive)graphic);
                }
            }

            _isDirty = true;
        }
Esempio n. 21
0
            protected override void CreateChildElements()
            {
                base.CreateChildElements();
                container = new StackLayoutElement();
                container.StretchVertically   = true;
                container.StretchHorizontally = true;
                container.Orientation         = Orientation.Vertical;
                infoElement = new LightVisualElement();
                infoElement.StretchVertically = false;
                infoElement.MaxSize           = new System.Drawing.Size(0, 30);
                container.Children.Add(infoElement);
                linePrimitive = new LinePrimitive();
                container.Children.Add(linePrimitive);
                unitElement = new LightVisualElement();
                container.Children.Add(unitElement);

                this.Children.Add(container);
            }
Esempio n. 22
0
        protected override void CreateChildElements()
        {
            line1               = new LinePrimitive();
            line1.Class         = "Line1";
            line1.BackColor     = Color.Black;
            line1.GradientStyle = GradientStyles.Solid;
            line1.LineWidth     = 1;
            line1.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.None;
            this.Children.Add(line1);

            line2               = new LinePrimitive();
            line2.Class         = "Line2";
            line2.BackColor     = Color.LightGray;
            line2.GradientStyle = GradientStyles.Solid;
            line2.LineWidth     = 1;
            line2.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.None;
            this.Children.Add(line2);
        }
Esempio n. 23
0
        public void Add(Vector3 point1, Vector3 point2, Color color, float hideAt = 0)
        {
            var primitive = freePrimitives.First;

            if (primitive == null)
            {
                primitive = new LinePrimitive( );
            }
            else
            {
                primitive.Remove( );
            }
            primitive.Value.point1 = point1;
            primitive.Value.point2 = point2;
            primitive.Value.color  = color;
            primitive.Value.hideAt = hideAt;
            usedPrimitives.AddFirst(primitive);
        }
Esempio n. 24
0
            protected override void CreateChildElements()
            {
                base.CreateChildElements();
                container                   = new StackLayoutElement();
                container.Orientation       = Orientation.Vertical;
                container.StretchVertically = true;

                descriptionElement = new LightVisualElement();
                descriptionElement.StretchVertically = false;
                container.Children.Add(descriptionElement);
                linePrimitive = new LinePrimitive();
                container.Children.Add(linePrimitive);
                selectButton = new RadButtonElement();
                container.Children.Add(selectButton);

                this.Children.Add(container);
                selectButton.Text   = "Select all child nodes";
                selectButton.Click += selectButton_Click;
            }
Esempio n. 25
0
        private static CompositeGraphic CreateTestSceneGraph()
        {
            CompositeGraphic      sceneGraph     = new CompositeGraphic();
            ImageSpatialTransform imageTransform = CreateTransform();

            sceneGraph.Graphics.Add(imageTransform.OwnerGraphic);

            CompositeGraphic composite = new CompositeGraphic();
            Graphic          leaf      = new LinePrimitive();

            composite.Graphics.Add(leaf);
            ((CompositeImageGraphic)imageTransform.OwnerGraphic).Graphics.Add(composite);

            RoiGraphic roiGraphic = new RoiGraphic(new EllipsePrimitive());

            ((CompositeImageGraphic)imageTransform.OwnerGraphic).Graphics.Add(roiGraphic);

            return(sceneGraph);
        }
Esempio n. 26
0
        public void DebugDraw()
        {
            Color drawColor = Color.Red;

            if (IsStart)
            {
                drawColor = Color.Yellow;
            }
            else if (IsFinish)
            {
                drawColor = Color.Purple;
            }
            Engine.Instance.SpriteBatch.Draw(Common.White1px50Trans, new Rectangle(Location.Xi() - 2, Location.Yi() - 2, 5, 5), drawColor);
            foreach (WayPoint wp in NextWaypoints)
            {
                LinePrimitive lp = new LinePrimitive(Engine.Instance.Graphics.GraphicsDevice, Color.Blue);
                lp.AddVector(Location);
                lp.AddVector(wp.Location);
                lp.Render(Engine.Instance.SpriteBatch);
            }
        }
Esempio n. 27
0
        /// <summary>
        /// Allocates sufficient tick <see cref="LinePrimitive"/>s, adding new objects and disposing extra objects as necessary.
        /// </summary>
        /// <param name="tickCount">The number of tick <see cref="LinePrimitive"/>s to allocate.</param>
        /// <returns></returns>
        protected IList <LinePrimitive> AllocateTicks(int tickCount)
        {
            LinePrimitive tick;

            while (_ticklines.Count < tickCount)
            {
                tick = new LinePrimitive {
                    Name = _tickLineName
                };
                _ticklines.Add(tick);
                base.Graphics.Add(tick);
            }
            while (_ticklines.Count > tickCount)
            {
                tick = _ticklines[0];
                _ticklines.RemoveAt(0);
                base.Graphics.Remove(tick);
                tick.Dispose();
            }
            return(_ticklines.AsReadOnly());
        }
Esempio n. 28
0
        internal static bool CheckLineToLineCollision(LinePrimitive line1, LinePrimitive line2)
        {
            #region Argument Check

            if (line1 == null)
            {
                throw new ArgumentNullException("line1");
            }

            if (line2 == null)
            {
                throw new ArgumentNullException("line2");
            }

            #endregion

            var dir1 = line1.Direction;
            var dir2 = line2.Direction;

            var denominator = dir2.Y * dir1.X - dir2.X * dir1.Y;
            var numeratorA  = dir2.X * (line1.Start.Y - line2.Start.Y) - dir2.Y * (line1.Start.X - line2.Start.X);
            var numeratorB  = dir1.X * (line1.Start.Y - line2.Start.Y) - dir1.Y * (line1.Start.X - line2.Start.X);

            if (denominator.IsZero())
            {
                if (numeratorA.IsZero() || numeratorB.IsZero())
                {
                    // Both lines are same line (with respect to zero tolerance)
                    return(true);
                }

                // Lines are parallel
                return(false);
            }

            var a = numeratorA / denominator;
            var b = numeratorB / denominator;

            return(a.IsInRange(LineCollisionRange) && b.IsInRange(LineCollisionRange));
        }
Esempio n. 29
0
    public GeometricObject()
    {
        rendering   = false;
        initialized = false;

        primitives = new List <PrimitiveBase> ();

        ptp = new PointPrimitive();
        primitives.Add(ptp);

        lp = new LinePrimitive();
        primitives.Add(lp);

        pp = new PolygonPrimitive();
        primitives.Add(pp);

        sp = new SpherePrimitive();
        primitives.Add(sp);

        mp = new MeshPrimitive();
        primitives.Add(mp);
    }
Esempio n. 30
0
        protected override void CreateChildElements()
        {
            this.linePrimitive       = new LinePrimitive();
            this.linePrimitive.Class = "LineFill";
            int num1 = (int)this.linePrimitive.SetDefaultValueOverride(RadElement.MarginProperty, (object)new Padding(0, 2, 0, 2));
            int num2 = (int)this.linePrimitive.BindProperty(LinePrimitive.SweepAngleProperty, (RadObject)this, RadMenuSeparatorItem.SweepAngleProperty, PropertyBindingOptions.TwoWay);
            int num3 = (int)this.linePrimitive.BindProperty(LinePrimitive.LineWidthProperty, (RadObject)this, RadMenuSeparatorItem.LineWidthProperty, PropertyBindingOptions.TwoWay);
            int num4 = (int)this.linePrimitive.BindProperty(LinePrimitive.OrientationProperty, (RadObject)this, RadMenuSeparatorItem.OrientationProperty, PropertyBindingOptions.TwoWay);

            this.Children.Add((RadElement)this.linePrimitive);
            this.text       = new LightVisualElement();
            this.text.Class = "TextElement";
            int num5 = (int)this.text.BindProperty(RadItem.TextProperty, (RadObject)this, RadItem.TextProperty, PropertyBindingOptions.TwoWay);
            int num6 = (int)this.text.BindProperty(RadElement.VisibilityProperty, (RadObject)this, RadMenuSeparatorItem.TextVisibilityProperty, PropertyBindingOptions.TwoWay);
            int num7 = (int)this.text.BindProperty(RadElement.AlignmentProperty, (RadObject)this, RadButtonItem.TextAlignmentProperty, PropertyBindingOptions.TwoWay);

            this.text.Alignment           = ContentAlignment.MiddleLeft;
            this.text.DrawFill            = true;
            this.text.StretchHorizontally = false;
            this.text.StretchVertically   = false;
            this.Children.Add((RadElement)this.text);
            this.cachedLineOffset = (float)this.GetValue(RadMenuSeparatorItem.LineOffsetProperty);
        }