当前位置: 首页>>代码示例>>C#>>正文


C# Point.Equals方法代码示例

本文整理汇总了C#中System.Windows.Point.Equals方法的典型用法代码示例。如果您正苦于以下问题:C# Point.Equals方法的具体用法?C# Point.Equals怎么用?C# Point.Equals使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Windows.Point的用法示例。


在下文中一共展示了Point.Equals方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Equals

		public void Equals ()
		{
			Point p = new Point (4, 5);
			Assert.IsTrue (p.Equals (new Point (4, 5)));
			Assert.IsFalse (p.Equals (new Point (5, 4)));
			Assert.IsFalse (p.Equals (new object()));
		}
开发者ID:nobled,项目名称:mono,代码行数:7,代码来源:PointTest.cs

示例2: Compare

		private void Compare (Point p)
		{
			Point p2 = p;
			Assert.IsFalse (p.Equals (null), "Equals(null)");
			Assert.IsTrue (p.Equals ((object) p), "Equals(object)");
			Assert.IsTrue (p.Equals (p), "Equals(Point)");
			Assert.IsTrue (p == p2, "==");
			Assert.IsFalse (p != p2, "!=");
		}
开发者ID:dfr0,项目名称:moon,代码行数:9,代码来源:PointTest.cs

示例3: NaN

		public void NaN ()
		{
			Point p = new Point (Double.NaN, Double.NaN);
			Assert.IsTrue (Double.IsNaN (p.X), "X");
			Assert.IsTrue (Double.IsNaN (p.Y), "Y");
			Assert.AreEqual ("NaN,NaN", p.ToString (), "ToString");

			// special reserved case
			Point p2 = p;
			Assert.IsFalse (p.Equals ((object) p2), "Equals(object)");
			Assert.IsFalse (p.Equals (p2), "Equals(Point)");
			Assert.IsFalse (p == p2, "==");
			Assert.IsTrue (p != p2, "!=");
		}
开发者ID:dfr0,项目名称:moon,代码行数:14,代码来源:PointTest.cs

示例4: Equals

		public static bool Equals (Point point1, Point point2)
		{
			return point1.Equals (point2);
		}
开发者ID:ItsVeryWindy,项目名称:mono,代码行数:4,代码来源:Point.cs

示例5: AnimateMarkers4Spline

        private static void AnimateMarkers4Spline(List<DataPoint> pointCollection, Storyboard storyBoard)
        {   
            // Animate Marker
            foreach (DataPoint dataPoint in pointCollection)
            {
                dataPoint._parsedToolTipText = dataPoint.TextParser(dataPoint.ToolTipText);

                if ((Boolean)dataPoint.MarkerEnabled)
                {
                    #region Attach Animation with Marker

                    FrameworkElement marker = dataPoint.Marker.Visual;

                    if (marker != null)
                    {
                        Point newMarkerPosition = dataPoint.Marker.CalculateActualPosition(dataPoint._visualPosition.X, dataPoint._visualPosition.Y, new Point(0.5, 0.5));
                        Point oldMarkerPosition = new Point((Double)marker.GetValue(Canvas.LeftProperty), (Double)marker.GetValue(Canvas.TopProperty));

                        dataPoint.Marker.Visual.Visibility = Visibility.Visible;

                        if (!oldMarkerPosition.Equals(newMarkerPosition))
                        {
                            // Animation for (Canvas.Top) property
                            DoubleAnimation da = new DoubleAnimation()
                            {
                                From = oldMarkerPosition.X,
                                To = newMarkerPosition.X,
                                Duration = new Duration(new TimeSpan(0, 0, 1)),
                                SpeedRatio = 2
                            };

                            Storyboard.SetTarget(da, marker);
                            Storyboard.SetTargetProperty(da, new PropertyPath("(Canvas.Left)"));
                            Storyboard.SetTargetName(da, (String)marker.GetValue(FrameworkElement.NameProperty));

                            storyBoard.Children.Add(da);

                            // Animation for (Canvas.Top) property
                            da = new DoubleAnimation()
                            {
                                From = oldMarkerPosition.Y,
                                To = newMarkerPosition.Y,
                                Duration = new Duration(new TimeSpan(0, 0, 1)),
                                SpeedRatio = 2
                            };

                            Storyboard.SetTarget(da, marker);
                            Storyboard.SetTargetProperty(da, new PropertyPath("(Canvas.Top)"));
                            Storyboard.SetTargetName(da, (String)marker.GetValue(FrameworkElement.NameProperty));

                            storyBoard.Children.Add(da);
                        }
                    }

                    #endregion

                }

            }
        }
开发者ID:zhangzy0193,项目名称:visifire,代码行数:60,代码来源:LineChart.cs

示例6: AnimateLabel4Spline

        private static void AnimateLabel4Spline(List<DataPoint> pointCollection, Storyboard storyBoard)
        {
             // Animate Marker
            foreach (DataPoint dataPoint in pointCollection)
            {
                if ((Boolean)dataPoint.LabelEnabled)
                {
                    FrameworkElement labelVisual = dataPoint.LabelVisual;

                    if (labelVisual != null)
                    {
                        (((labelVisual as Border).Child as Canvas).Children[0] as TextBlock).Text = dataPoint.TextParser(dataPoint.LabelText);
                       
                        Point oldLabelPosition = new Point((Double)labelVisual.GetValue(Canvas.LeftProperty), (Double)labelVisual.GetValue(Canvas.TopProperty));

                        Double newMarkerXPos = 0, newMarkerYPos = 0;
                        Point newLabelPosition = SetLabelPosition4LineDataPoint(dataPoint, ref newMarkerXPos, ref newMarkerYPos);

                        //// Set the labels to its old position
                        //labelVisual.SetValue(Canvas.LeftProperty, oldLabelPosition.X);
                        //labelVisual.SetValue(Canvas.TopProperty, oldLabelPosition.Y);

                        labelVisual.Visibility = Visibility.Visible;

                        if (!oldLabelPosition.Equals(newLabelPosition))
                        {   
                            // Animation for (Canvas.Top) property
                            DoubleAnimation da = new DoubleAnimation()
                            {
                                From = oldLabelPosition.X,
                                To = newLabelPosition.X,
                                Duration = new Duration(new TimeSpan(0, 0, 1)),
                                SpeedRatio = 2
                            };

                            Storyboard.SetTarget(da, labelVisual);
                            Storyboard.SetTargetProperty(da, new PropertyPath("(Canvas.Left)"));
                            Storyboard.SetTargetName(da, (String)labelVisual.GetValue(FrameworkElement.NameProperty));

                            storyBoard.Children.Add(da);

                            // Animation for (Canvas.Top) property
                            da = new DoubleAnimation()
                            {
                                From = oldLabelPosition.Y,
                                To = newLabelPosition.Y,
                                Duration = new Duration(new TimeSpan(0, 0, 1)),
                                SpeedRatio = 2
                            };

                            Storyboard.SetTarget(da, labelVisual);
                            Storyboard.SetTargetProperty(da, new PropertyPath("(Canvas.Top)"));
                            Storyboard.SetTargetName(da, (String)labelVisual.GetValue(FrameworkElement.NameProperty));

                            storyBoard.Children.Add(da);
                        }
                    }
                }
            }
        }
开发者ID:zhangzy0193,项目名称:visifire,代码行数:60,代码来源:LineChart.cs

示例7: FindExtensionPoint

        /// <summary>
        /// Finds the extension point.
        /// </summary>
        public void FindExtensionPoint()
        {
            if (controlledCases.Count >= 25)
            {
                ExtensionPoint = null;
                return;
            }

            // Etendre à la case ayant le plus de minerai (i.e une case de desert)
            Point HG = new Point (position.X, position.Y);
            Point BD = new Point (position.X, position.Y);

            int portee = 0;
            // premier carré (3x3)
            if (controlledCases.Count < 9)
            {
                portee = 1;
            }
            // deuxième carré (4x4)
            else if (controlledCases.Count < 16)
            {
                portee = 2;
            }
            // troisième carré (5x5)
            else if (controlledCases.Count < 25)
            {
                portee = 3;
            }

            if (position.X - portee > 0)
                HG.X -= portee;
            if (position.Y - portee > 0)
                HG.Y -= portee;
            if (position.X + portee < map.Size.X)
                BD.X += portee;
            if (position.Y + portee < map.Size.Y)
                BD.Y += portee;

            // Trouver le point idéal
            List<Point> listCases = new List<Point>();

            for (int i = (int)HG.X; i <= BD.X; i++)
            {
                for (int j = (int)HG.Y; j <= BD.Y; j++)
                {
                    listCases.Add(new Point(i, j));
                }
            }

            Point toBeAdded = new Point();
            if (listCases.Exists(point => map.SquareMatrix[(int)point.X, (int)point.Y] is World.Square.FruitSquareDecorator && !controlledCases.Contains(point)))
            {
                toBeAdded = listCases.Find(point => map.SquareMatrix[(int)point.X, (int)point.Y] is World.Square.FruitSquareDecorator && !controlledCases.Contains(point));
            }
            else if (listCases.Exists(point => map.SquareMatrix[(int)point.X, (int)point.Y] is World.Square.IronSquareDecorator && !controlledCases.Contains(point)))
            {
                toBeAdded = listCases.Find(point => map.SquareMatrix[(int)point.X, (int)point.Y] is World.Square.IronSquareDecorator && !controlledCases.Contains(point));
            }
            else if (listCases.Exists(point => map.SquareMatrix[(int)point.X, (int)point.Y] is World.Square.Field && !controlledCases.Contains(point)))
            {
                toBeAdded = listCases.Find(point => map.SquareMatrix[(int)point.X, (int)point.Y] is World.Square.Field && !controlledCases.Contains(point));
            }
            else if (listCases.Exists(point => map.SquareMatrix[(int)point.X, (int)point.Y] is World.Square.Desert && !controlledCases.Contains(point)))
            {
                toBeAdded = listCases.Find(point => map.SquareMatrix[(int)point.X, (int)point.Y] is World.Square.Desert && !controlledCases.Contains(point));
            }
            else if (listCases.Exists(point => map.SquareMatrix[(int)point.X, (int)point.Y] is World.Square.Mountain && !controlledCases.Contains(point)))
            {
                toBeAdded = listCases.Find(point => map.SquareMatrix[(int)point.X, (int)point.Y] is World.Square.Mountain && !controlledCases.Contains(point));
            }
            else if (listCases.Exists(point => map.SquareMatrix[(int)point.X, (int)point.Y] is World.Square.Water && !controlledCases.Contains(point)))
            {
                toBeAdded = listCases.Find(point => map.SquareMatrix[(int)point.X, (int)point.Y] is World.Square.Water && !controlledCases.Contains(point));
            }

            if (toBeAdded.Equals(new Point(0, 0)))
            {
                ExtensionPoint = null;
            }
            else
            {
                ExtensionPoint = toBeAdded;
                player.CitiesToBeExtended.Enqueue(this);
            }
        }
开发者ID:Jiwan,项目名称:Civilisation,代码行数:88,代码来源:BasicCity.cs

示例8: PerformOperation


//.........这里部分代码省略.........
                        // Displaying Results
                        resultType = "Point";
                        syntaxString = "pointResult = Point.Multiply(point1, matrix1);";
                        operationString = "Multiplying a Point by a Matrix";
                        ShowResults(pointResult.ToString(), syntaxString, resultType, operationString);
                        break;
                    }

                case "rb10":
                    {
                        // Checks if two Points are equal using the overloaded equality operator.
                        Point point1 = new Point(10, 5);
                        Point point2 = new Point(15, 40);
                        Boolean areEqual;

                        areEqual = (point1 == point2);
                        // areEqual is False

                        // Displaying Results
                        syntaxString = "areEqual = (point1 == point2);";
                        resultType = "Boolean";
                        operationString = "Checking if two points are equal";
                        ShowResults(areEqual.ToString(), syntaxString, resultType, operationString);
                        break;
                    }

                case "rb11":
                    {
                        // Checks if two Points are equal using the static Equals method.
                        Point point1 = new Point(10, 5);
                        Point point2 = new Point(15, 40);
                        Boolean areEqual;

                        areEqual = Point.Equals(point1, point2);
                        // areEqual is False

                        // Displaying Results
                        syntaxString = "areEqual = Point.Equals(point1, point2);";
                        resultType = "Boolean";
                        operationString = "Checking if two points are equal";
                        ShowResults(areEqual.ToString(), syntaxString, resultType, operationString);
                        break;
                    }
                case "rb12":
                    {
                        // Compares an Object and a Point for equality using the non-static Equals method.
                        Point point1 = new Point(10, 5);
                        Point point2 = new Point(15, 40);
                        Boolean areEqual;

                        areEqual = point1.Equals(point2);
                        // areEqual is False

                        // Displaying Results
                        syntaxString = "areEqual = point1.Equals(point2);";
                        resultType = "Boolean";
                        operationString = "Checking if two points are equal";
                        ShowResults(areEqual.ToString(), syntaxString, resultType, operationString);
                        break;
                    }

                case "rb13":
                    {
                        // Compares an Object and a Vector for equality using the non-static Equals method.
                        Vector vector1 = new Vector(20, 30);
                        Vector vector2 = new Vector(45, 70);
开发者ID:samgonzalezr,项目名称:WPFSamples,代码行数:67,代码来源:MainWindow.xaml.cs

示例9: UpdateScrollOffsets

 /// <summary>
 /// Update the scroll offset of the HTML container and invalidate visual to re-render.
 /// </summary>
 private void UpdateScrollOffsets()
 {
     var newScrollOffset = new Point(-_horizontalScrollBar.Value, -_verticalScrollBar.Value);
     if (!newScrollOffset.Equals(_htmlContainer.ScrollOffset))
     {
         var oldValue = _htmlContainer.ScrollOffset;
         _htmlContainer.ScrollOffset = newScrollOffset;
         InvalidateVisual();
     }
 }
开发者ID:verdesgrobert,项目名称:HTML-Renderer,代码行数:13,代码来源:HtmlPanel.cs

示例10: OnSelectedPointChangedSecond

 // Selection and temp point should follow ones on CamersImage
 // and change corresponding camera3dpoint in real time
 // Undoing from this level
 private void OnSelectedPointChangedSecond(object sender, Point point)
 {
     if (point.X < 0)
     {
         _camImageFirst.SelectedPoint = point;
         _butRemovePoint.IsEnabled = false;
         _butAcceptPoint.IsEnabled = true;
         _isPointsSelected = false;
         return;
     }
     foreach (var point3d in Points3D)
     {
         if (point.Equals(point3d.Cam2Point))
         {
             _camImageFirst.SelectedPoint = point3d.Cam1Point;
             _butRemovePoint.IsEnabled = true;
             _curCamPoint = point3d;
             _isPointsSelected = true;
             return;
         }
     }
     CheckIfValidPointsChoosen();
 }
开发者ID:KFlaga,项目名称:Cam3D,代码行数:26,代码来源:Image3DConstructionMode.xaml.cs

示例11: WriteAttribute

 /// <summary>
 /// Writes the attribute.
 /// </summary>
 /// <param name="name">The name.</param>
 /// <param name="value">The value.</param>
 /// <param name="defaultValue">The default value.</param>
 protected void WriteAttribute(string name, Point value, Point defaultValue)
 {
     if (this.settings.WriteDefaultValues || !value.Equals(defaultValue)) {
         this.writer.WriteAttributeString(name, value.Format());
     }
 }
开发者ID:modulexcite,项目名称:SilverlightWpfContrib,代码行数:12,代码来源:XamlWriter.cs

示例12: ChunksToMesh


//.........这里部分代码省略.........
                for (int i = 2; i < vstrip.Length; ++i) {
                    int vidx1 = vstart + (vstrip[i - 2] & 0xFF);
                    int vidx2 = vstart + (vstrip[i - 1] & 0xFF);
                    int vidx3 = vstart + (vstrip[i] & 0xFF);

                    int uv1 = i - 2;
                    int uv2 = i - 1;
                    int uv3 = i;

                    // Flip the faces (indices 1 and 2) to keep the winding rule consistent.
                    if ((triIdx & 1) == 1) {
                        int temp = uv1;
                        uv1 = uv2;
                        uv2 = temp;

                        temp = vidx1;
                        vidx1 = vidx2;
                        vidx2 = temp;
                    }

                    if ((vstrip[i] & 0x8000) == 0) {
                        // WPF really has S,T coords rather than u,v
                        double udiv = texturePixelWidth * 16.0;
                        double vdiv = texturePixelHeight * 16.0;

                        var p1 = new Point(chunk.uvs[uv1].u / udiv, chunk.uvs[uv1].v / vdiv);
                        var p2 = new Point(chunk.uvs[uv2].u / udiv, chunk.uvs[uv2].v / vdiv);
                        var p3 = new Point(chunk.uvs[uv3].u / udiv, chunk.uvs[uv3].v / vdiv);

                        p1 = TileST(p1);
                        p2 = TileST(p2);
                        p3 = TileST(p3);

                        if (!uninitPoint.Equals(uvCoords[vidx1]) && !p1.Equals(uvCoords[vidx1]))
                        {
                            // There is more than 1 uv assigment to this vertex, so we need to duplicate it.
                            int originalVIdx = vidx1;
                            vidx1 = vstart + numVertsInChunk;
                            numVertsInChunk++;
                            mesh.Positions.Add(mesh.Positions.ElementAt(originalVIdx));
                            mesh.Normals.Add(mesh.Normals.ElementAt(originalVIdx));
                            Array.Resize(ref uvCoords, uvCoords.Length+1);
                            uvCoords[uvCoords.Length - 1] = uninitPoint;
                            var weight = FindVertexWeight(chunk.vertexWeights, originalVIdx - vstart);
                            if (weight.boneWeight1 > 0)
                            {
                                var vw = weight;
                                vw.startVertex = vidx1;
                                vw.endVertex = vidx1;
                                mesh.vertexWeights.Add(vw);
                            }
                        }
                        if (!uninitPoint.Equals(uvCoords[vidx2]) && !p2.Equals(uvCoords[vidx2]))
                        {
                            // There is more than 1 uv assigment to this vertex, so we need to duplicate it.
                            int originalVIdx = vidx2;
                            vidx2 = vstart + numVertsInChunk;
                            numVertsInChunk++;
                            mesh.Positions.Add(mesh.Positions.ElementAt(originalVIdx));
                            mesh.Normals.Add(mesh.Normals.ElementAt(originalVIdx));
                            Array.Resize(ref uvCoords, uvCoords.Length + 1);
                            uvCoords[uvCoords.Length - 1] = uninitPoint;
                            var weight = FindVertexWeight(chunk.vertexWeights, originalVIdx - vstart);
                            if (weight.boneWeight1 > 0)
                            {
                                var vw = weight;
开发者ID:Stranho,项目名称:bgda-explorer,代码行数:67,代码来源:VifDecoder.cs

示例13: TimerTick

        public void TimerTick(object sender, EventArgs e)
        {
            if (m_kinect.currentPlayer == 0) return;
            Line line = new Line();
            if (!m_calibarting)
            {
                line.Stroke = System.Windows.Media.Brushes.Red;
                m_prevPoint = m_point;
                line.X1 = m_prevPoint.X;
                line.Y1 = m_prevPoint.Y;
            }

            m_point = new Point(m_kinect.currentX, m_kinect.currentY);
            m_point = mapping(m_point);

            if (!m_calibarting)
            {
                line.X2 = m_point.X;
                line.Y2 = m_point.Y;
                line.HorizontalAlignment = HorizontalAlignment.Left;
                line.VerticalAlignment = VerticalAlignment.Top;
                line.StrokeThickness = 3;
            }
            UpdateDebug();

            if (!m_point.Equals(m_prevPoint))
            {
                m_grid.Children.Add(line);
            }

            this.sendMessage();
        }
开发者ID:ruofeidu,项目名称:AtmoSPHERE,代码行数:32,代码来源:MainWindow.xaml.cs


注:本文中的System.Windows.Point.Equals方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。