コード例 #1
0
ファイル: PdfRectangle.cs プロジェクト: torbjornlandin/PdfPig
 /// <summary>
 /// Creates a new <see cref="PdfRectangle"/> which is the current rectangle moved in the x and y directions relative to its current position by a value.
 /// </summary>
 /// <param name="dx">The distance to move the rectangle in the x direction relative to its current location.</param>
 /// <param name="dy">The distance to move the rectangle in the y direction relative to its current location.</param>
 /// <returns>A new rectangle shifted on the y axis by the given delta value.</returns>
 public PdfRectangle Translate(double dx, double dy)
 {
     return(new PdfRectangle(TopLeft.Translate(dx, dy), TopRight.Translate(dx, dy),
                             BottomLeft.Translate(dx, dy), BottomRight.Translate(dx, dy)));
 }
コード例 #2
0
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="Other">The other rect.</param>
 public C2DRect(C2DRect Other)
 {
     TopLeft.Set(Other.TopLeft);
     BottomRight.Set(Other.BottomRight);
 }
コード例 #3
0
 public override string ToString()
 {
     return("MyImage " + TopLeft.ToString() + " " + File);
 }
コード例 #4
0
 bool Equals(CornerRadius other)
 {
     return(TopLeft.Equals(other.TopLeft) && TopRight.Equals(other.TopRight) && BottomRight.Equals(other.BottomRight) && BottomLeft.Equals(other.BottomLeft));
 }
コード例 #5
0
 public override bool ContainsPoint(int gridSize, Point p)
 {
     //check all 4 lines.
     return(DrawFacts.PointOnRectangle(TopLeft.ToPoint(gridSize), BottomRight.ToPoint(gridSize), p, Width) ||
            DrawFacts.PointInsideRectangle(TopLeft.ToPoint(gridSize), BottomRight.ToPoint(gridSize), p));
 }
コード例 #6
0
 public override Shape DeepClone()
 {
     return(new FilledRectangle(TopLeft.Clone(), BottomRight.Clone(), Width, Color));
 }
コード例 #7
0
 public override Shape clone()
 {
     return(new Rectangle((Point)TopLeft.clone(), (Point)TopRight.clone(), (Point)DownLeft.clone(), (Point)DownRight.clone()));
 }
コード例 #8
0
ファイル: Rect2D.cs プロジェクト: tuita520/PoESkillTree
 private bool Equals(Rect2D other)
 => TopLeft.Equals(other.TopLeft) && BottomRight.Equals(other.BottomRight);
コード例 #9
0
 /// <summary>
 /// Snaps this to the conceptual grid.
 /// </summary>
 /// <param name="grid">Grid to snap to.</param>
 public override void SnapToGrid(CGrid grid)
 {
     TopLeft.SnapToGrid(grid);
     BottomRight.SnapToGrid(grid);
 }
コード例 #10
0
 /// <summary>
 /// Assignment.
 /// </summary>
 /// <param name="ptTopLeft">The top left point.</param>
 /// <param name="ptBottomRight">The bottom right point.</param>
 public void Set(C2DPoint ptTopLeft, C2DPoint ptBottomRight)
 {
     TopLeft.Set(ptTopLeft);
     BottomRight.Set(ptBottomRight);
 }
コード例 #11
0
 /// <summary>
 /// Constructor sets both the top left and bottom right to equal the rect.
 /// </summary>
 /// <param name="pt">Point.</param>
 public C2DRect(C2DPoint pt)
 {
     TopLeft.Set(pt);
     BottomRight.Set(pt);
 }
コード例 #12
0
 /// <summary>
 /// Moves this point by the vector given.
 /// </summary>
 /// <param name="Vector">The vector.</param>
 public override void Move(C2DVector Vector)
 {
     TopLeft.Move(Vector);
     BottomRight.Move(Vector);
 }
コード例 #13
0
 /// <summary>
 /// Grows it from the given point.
 /// </summary>
 /// <param name="dFactor">Factor to grow by.</param>
 /// <param name="Origin">The origin.</param>
 public override void Grow(double dFactor, C2DPoint Origin)
 {
     BottomRight.Grow(dFactor, Origin);
     TopLeft.Grow(dFactor, Origin);
 }
コード例 #14
0
    protected override void WndProc(ref Message message)
    {
        base.WndProc(ref message);

        if (message.Msg == 0x84 && Form2.simstart == false) // WM_NCHITTEST
        {
            var cursor = this.PointToClient(Cursor.Position);

            if (TopLeft.Contains(cursor))
            {
                message.Result = (IntPtr)HTTOPLEFT;
            }
            else if (TopRight.Contains(cursor))
            {
                message.Result = (IntPtr)HTTOPRIGHT;
            }
            else if (BottomLeft.Contains(cursor))
            {
                message.Result = (IntPtr)HTBOTTOMLEFT;
            }
            else if (BottomRight.Contains(cursor))
            {
                message.Result = (IntPtr)HTBOTTOMRIGHT;
            }

            else if (Top.Contains(cursor))
            {
                message.Result = (IntPtr)HTTOP;
            }
            else if (Left.Contains(cursor))
            {
                message.Result = (IntPtr)HTLEFT;
            }
            else if (Right.Contains(cursor))
            {
                message.Result = (IntPtr)HTRIGHT;
            }
            else if (Bottom.Contains(cursor))
            {
                message.Result = (IntPtr)HTBOTTOM;
            }
        }


        {
            if (Form2.simstart == false)
            {
                var cursor = this.PointToClient(Cursor.Position);

                if (TopLeft.Contains(cursor))
                {
                    message.Result = (IntPtr)HTTOPLEFT;
                }
                else if (TopRight.Contains(cursor))
                {
                    message.Result = (IntPtr)HTTOPRIGHT;
                }
                else if (BottomLeft.Contains(cursor))
                {
                    message.Result = (IntPtr)HTBOTTOMLEFT;
                }
                else if (BottomRight.Contains(cursor))
                {
                    message.Result = (IntPtr)HTBOTTOMRIGHT;
                }

                else if (Top.Contains(cursor))
                {
                    message.Result = (IntPtr)HTTOP;
                }
                else if (Left.Contains(cursor))
                {
                    message.Result = (IntPtr)HTLEFT;
                }
                else if (Right.Contains(cursor))
                {
                    message.Result = (IntPtr)HTRIGHT;
                }
                else if (Bottom.Contains(cursor))
                {
                    message.Result = (IntPtr)HTBOTTOM;
                }
            }
        }
    }
コード例 #15
0
        protected override void WndProc(ref Message message)
        {
            try
            {
                if (message.Msg == WM_SYSCOMMAND && (message.WParam.ToInt32() & 0xfff0) == SC_SIZE)
                {
                    int isDragFullWindow;
                    GetSystemParametersInfo(SPI_GETDRAGFULLWINDOWS, 0, out isDragFullWindow, 0);

                    if (isDragFullWindow != 0)
                    {
                        SetSystemParametersInfo(SPI_SETDRAGFULLWINDOWS, 0, 0, 0);
                    }

                    base.WndProc(ref message);

                    if (isDragFullWindow != 0)
                    {
                        SetSystemParametersInfo(SPI_SETDRAGFULLWINDOWS, 1, 0, 0);
                    }
                }
                else
                {
                    base.WndProc(ref message);

                    if (message.Msg == 0x84) // WM_NCHITTEST
                    {
                        var cursor = PointToClient(Cursor.Position);

                        if (TopLeft.Contains(cursor))
                        {
                            message.Result = (IntPtr)HTTOPLEFT;
                        }
                        else if (TopRight.Contains(cursor))
                        {
                            message.Result = (IntPtr)HTTOPRIGHT;
                        }
                        else if (BottomLeft.Contains(cursor))
                        {
                            message.Result = (IntPtr)HTBOTTOMLEFT;
                        }
                        else if (BottomRight.Contains(cursor))
                        {
                            message.Result = (IntPtr)HTBOTTOMRIGHT;
                        }

                        else if (Top.Contains(cursor))
                        {
                            message.Result = (IntPtr)HTTOP;
                        }
                        else if (Left.Contains(cursor))
                        {
                            message.Result = (IntPtr)HTLEFT;
                        }
                        else if (Right.Contains(cursor))
                        {
                            message.Result = (IntPtr)HTRIGHT;
                        }
                        else if (Bottom.Contains(cursor))
                        {
                            message.Result = (IntPtr)HTBOTTOM;
                        }
                    }
                }
            }
            catch (Exception e)
            {
                MessageBox.Show(
                    "Google Geolocation encountered a fatal error and must be restarted. Please contact support with this message: " +
                    e.Message, "Fatal Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
コード例 #16
0
ファイル: Rect2D.cs プロジェクト: tuita520/PoESkillTree
 public override int GetHashCode()
 => TopLeft.GetHashCode() ^ BottomRight.GetHashCode();
コード例 #17
0
ファイル: Rectangle.cs プロジェクト: perl-easj/OOProg
 public void Move(double dx, double dy)
 {
     TopLeft.Move(dx, dy);
     BotRight.Move(dx, dy);
 }
コード例 #18
0
 public override void Draw(int gridSize, Graphics g)
 {
     g.FillRectangle(new SolidBrush(Color), new System.Drawing.Rectangle(TopLeft.ToPoint(gridSize),
                                                                         new Size(Math.Abs((TopLeft.X - BottomRight.X) * gridSize), Math.Abs((TopLeft.Y - BottomRight.Y) * gridSize))));
 }
コード例 #19
0
ファイル: Rectangle.cs プロジェクト: perl-easj/OOProg
 public override string ToString()
 {
     return($"A Rectangle from {TopLeft.ToCoord()} to {BotRight.ToCoord()}");
 }
コード例 #20
0
 public override void Translate(int x, int y)
 {
     TopLeft.Adjust(x, y);
     BottomRight.Adjust(x, y);
 }
コード例 #21
0
 private void Start()
 {
     State          = new TopLeft();
     mySprite       = GetComponentInChildren <SpriteRenderer>().sprite;
     levelGenerator = GetComponentInParent <LevelGenerator>().gameObject;
 }
コード例 #22
0
ファイル: NEW_FRM.cs プロジェクト: devmuaz/BrainOne-IDE
        protected override void WndProc(ref Message message)
        {
            switch (message.Msg)
            {
            // box shadow
            case WM_NCPAINT:
                if (m_aeroEnabled)
                {
                    var v = 2;
                    DwmSetWindowAttribute(this.Handle, 2, ref v, 4);
                    MARGINS margins = new MARGINS()
                    {
                        bottomHeight = 1,
                        leftWidth    = 1,
                        rightWidth   = 1,
                        topHeight    = 1
                    };
                    DwmExtendFrameIntoClientArea(this.Handle, ref margins);
                }
                break;

            default:
                break;
            }

            base.WndProc(ref message);

            if (message.Msg == 0x84) // WM_NCHITTEST
            {
                var cursor = this.PointToClient(Cursor.Position);

                if (TopLeft.Contains(cursor))
                {
                    message.Result = (IntPtr)HTTOPLEFT;
                }
                else if (TopRight.Contains(cursor))
                {
                    message.Result = (IntPtr)HTTOPRIGHT;
                }
                else if (BottomLeft.Contains(cursor))
                {
                    message.Result = (IntPtr)HTBOTTOMLEFT;
                }
                else if (BottomRight.Contains(cursor))
                {
                    message.Result = (IntPtr)HTBOTTOMRIGHT;
                }

                else if (Top.Contains(cursor))
                {
                    message.Result = (IntPtr)HTTOP;
                }
                else if (Left.Contains(cursor))
                {
                    message.Result = (IntPtr)HTLEFT;
                }
                else if (Right.Contains(cursor))
                {
                    message.Result = (IntPtr)HTRIGHT;
                }
                else if (Bottom.Contains(cursor))
                {
                    message.Result = (IntPtr)HTBOTTOM;
                }
            }
        }
コード例 #23
0
 public bool Equals(Rectangle other)
 {
     return(TopLeft.Equals(other.TopLeft) && Size.Equals(other.Size));
 }
コード例 #24
0
        public override double GetSurfacePointAltitude(double lat, double lng, bool meters)
        {
            if (Level < lastDeepestLevel)
            {
                //interate children
                for (int ii = 0; ii < 4; ii++)
                {
                    Tile child = children[ii];
                    if (child != null)
                    {
                        if (child.IsPointInTile(lat, lng))
                        {
                            double retVal = child.GetSurfacePointAltitude(lat, lng, meters);
                            if (retVal != 0)
                            {
                                return(retVal);
                            }
                            else
                            {
                                break;
                            }
                        }
                    }
                }
            }

            TileTargetLevel = Level;
            TileTargetX     = tileX;
            TileTargetY     = tileY;



            Vector3d testPoint = Coordinates.GeoTo3dDouble(-lat, lng);

            testPoint = Vector3d.SubtractVectors(new Vector3d(), testPoint);
            Vector2d uv = DistanceCalc.GetUVFromInnerPoint(TopLeft.Copy(), TopRight.Copy(), BottomLeft.Copy(), BottomRight.Copy(), testPoint.Copy());


            //Document.Title = "u:" + uv.X + ", v:" + uv.Y;
            //uv.X = 1 - uv.X;
            //uv.Y = 1 - uv.Y;
            // Get 4 samples and interpolate
            double uud = Math.Max(0, Math.Min(16, (uv.X * 16)));
            double vvd = Math.Max(0, Math.Min(16, (uv.Y * 16)));



            int uu = Math.Max(0, Math.Min(15, (int)(uv.X * 16)));
            int vv = Math.Max(0, Math.Min(15, (int)(uv.Y * 16)));

            double ha = uud - uu;
            double va = vvd - vv;

            if (demArray != null)
            {
                // 4 nearest neighbors
                double ul = demArray[uu + 17 * vv];
                double ur = demArray[(uu + 1) + 17 * vv];
                double ll = demArray[uu + 17 * (vv + 1)];
                double lr = demArray[(uu + 1) + 17 * (vv + 1)];

                double top    = ul * (1 - ha) + ha * ur;
                double bottom = ll * (1 - ha) + ha * lr;
                double val    = top * (1 - va) + va * bottom;

                return(val / DemScaleFactor);
            }

            return(demAverage / DemScaleFactor);
        }
コード例 #25
0
 public string GetLuaValue()
 {
     return("{" + TopLeft.GetLuaValue() + ", " + BottomRight.GetLuaValue() + "}");
 }
コード例 #26
0
 public override int GetHashCode()
 {
     return(TopLeft.GetHashCode() ^ BottomRight.GetHashCode());
 }
コード例 #27
0
 public string GetAttributeValue()
 {
     return($"{TopLeft.GetAttributeValue()},{BottomRight.GetAttributeValue()}");
 }
コード例 #28
0
 public override string ToString()
 {
     return(string.Format(CultureInfo.InvariantCulture, "[{0}][{1}]", TopLeft.ToString(), BottomRight.ToString()));
 }
コード例 #29
0
 public IntRect Translate(IntPoint pt)
 {
     return(new IntRect(TopLeft.Translate(pt), Size));
 }