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


C# IPoint类代码示例

本文整理汇总了C#中IPoint的典型用法代码示例。如果您正苦于以下问题:C# IPoint类的具体用法?C# IPoint怎么用?C# IPoint使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: Create

        public void Create()
        {
            var points = new IPoint[,]
                             {
                                 {new Point(0.0, 1.0), new Point(0.0, 0.0)}, 
                                 {new Point(0.5, 1.5), new Point(1.0, 0.0)}, 
                                 {new Point(1.0, 2.0), new Point(2.0, 2.0)}
                             };


            var coverage = new DiscreteGridPointCoverage(3, 2, points.Cast<IPoint>());

            var values = new[,]
                             {
                                 {1.0, 2.0},
                                 {3.0, 4.0},
                                 {5.0, 6.0}
                             };

            coverage.SetValues(values);

/*
            var coverageLayer = new DiscreteGridPointCoverageLayer { Coverage = coverage, ShowFaces = true };
            var map = new Map { Layers = { coverageLayer } };
            MapTestHelper.Show(map);
*/

            var value = coverage.Evaluate(points[1, 1].Coordinate);

            const double expectedValue = 4.0;
            Assert.AreEqual(expectedValue, value);
            
            Assert.IsTrue(coverage.Components[0].Values.Cast<double>().SequenceEqual(new [] { 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 }));
            Assert.AreEqual("new grid point coverage", coverage.Name);
        }
开发者ID:lishxi,项目名称:_SharpMap,代码行数:35,代码来源:DiscreteGridPointCoverageTest.cs

示例2: CalcDistanceBetweenTwoPointsIn2D

    public static double CalcDistanceBetweenTwoPointsIn2D(IPoint firstPoint, IPoint secondPoint)
    {
        double distance = Math.Sqrt((secondPoint.X - firstPoint.X) * (secondPoint.X - firstPoint.X) + 
                                    (secondPoint.Y - firstPoint.Y) * (secondPoint.Y - firstPoint.Y));

        return distance;
    }
开发者ID:IskraNikolova,项目名称:High-Quality-Code,代码行数:7,代码来源:CoordinateSystem.cs

示例3: SqlGeometryToGeometryMultiPoint

 private static IGeometry SqlGeometryToGeometryMultiPoint(SqlGeometry geometry, GeometryFactory factory)
 {
     IPoint[] points = new IPoint[geometry.STNumGeometries().Value];
     for (int i = 1; i <= points.Length; i++)
         points[i - 1] = SqlGeometryToGeometryPoint(geometry.STGeometryN(i), factory);
     return factory.CreateMultiPoint(points);
 }
开发者ID:interworks,项目名称:FastShapefile,代码行数:7,代码来源:ConvertToGeometry.cs

示例4: GetPositionImprovement

		public static float GetPositionImprovement(IPoint source, IPoint target, int turns)
		{
			float dSource = (float)Goal.Other.GetDistance(source);
			float dTarget = (float)Goal.Other.GetDistance(target);
			var gain = dSource- dTarget;
			return gain / (float)turns;
		}
开发者ID:Corniel,项目名称:CloudBall.LostKeysUnited,代码行数:7,代码来源:Evaluator.cs

示例5: addSplitPt

 public void addSplitPt(IPoint startPt, IPoint endPt)
 {
     LineEndPt lineEnd = new LineEndPt();
     lineEnd.startPt = startPt;
     lineEnd.endPt = endPt;
     splitLineEndPtArray.Add(lineEnd);
 }
开发者ID:Leooonard,项目名称:CGXM,代码行数:7,代码来源:Area.cs

示例6: HouseManager

        public HouseManager(IPoint llPt, House h, CommonHouse ch)
        {
            //四个角的点是外面圈的四个顶点, 因为在进行计算时, 一直以外圈为准.
            lowerLeftPt = new PointClass();
            lowerLeftPt.X = llPt.X;
            lowerLeftPt.Y = llPt.Y;
            house = h;
            commonHouse = ch;

            lowerRightPt = new PointClass();
            lowerRightPt.X = lowerLeftPt.X + house.leftGap + house.width + house.rightGap;
            lowerRightPt.Y = lowerLeftPt.Y;

            upperLeftPt = new PointClass();
            upperLeftPt.X = lowerLeftPt.X;
            upperLeftPt.Y = lowerLeftPt.Y + commonHouse.frontGap + commonHouse.height + commonHouse.backGap;

            upperRightPt = new PointClass();
            upperRightPt.X = lowerRightPt.X;
            upperRightPt.Y = upperLeftPt.Y;

            southDirctionPt = new PointClass();
            southDirctionPt.X = (lowerLeftPt.X + lowerRightPt.X) / 2;
            southDirctionPt.Y = lowerLeftPt.Y;

            rotateAngle = 0;
        }
开发者ID:Leooonard,项目名称:CGXM,代码行数:27,代码来源:HouseManager.cs

示例7: Create

        public void Create()
        {
            var points = new IPoint[,]
                             {
                                 {new Point(0, 0), new Point(1, 0)},
                                 {new Point(2, 1), new Point(3, 1.5)},
                                 {new Point(1, 2), new Point(3, 3)}
                             };


            var coverage = new DiscreteGridPointCoverage(3, 2, points.Cast<IPoint>());

            var values = new[,]
                             {
                                 {1.0, 2.0},
                                 {3.0, 4.0},
                                 {5.0, 6.0}
                             };

            coverage.SetValues(values);

            var value = coverage.Evaluate(points[1, 1].Coordinate);

            const double expectedValue = 4.0;
            Assert.AreEqual(expectedValue, value);
            
            Assert.IsTrue(coverage.Components[0].Values.Cast<double>().SequenceEqual(new [] { 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 }));
            Assert.AreEqual("new grid point coverage", coverage.Name);
        }
开发者ID:lishxi,项目名称:_SharpMap,代码行数:29,代码来源:DiscreteGridPointCoverageTest.cs

示例8: IsOnField

		public bool IsOnField(IPoint point) { 
			return
				!IsLeft(point) &&
				!IsRight(point) &&
				!IsAbove(point) &&
				!IsUnder(point);
		}
开发者ID:Corniel,项目名称:CloudBall.LostKeysUnited,代码行数:7,代码来源:FieldInfo.cs

示例9: Read

        /// <summary>
        /// Reads a stream and converts the shapefile record to an equilivant geometry object.
        /// </summary>
        /// <param name="file">The stream to read.</param>
        /// <param name="geometryFactory">The geometry factory to use when making the object.</param>
        /// <returns>The Geometry object that represents the shape file record.</returns>
        public override IGeometry Read(BigEndianBinaryReader file, IGeometryFactory geometryFactory)
        {
            int shapeTypeNum = file.ReadInt32();

            type = (ShapeGeometryType) Enum.Parse(typeof(ShapeGeometryType), shapeTypeNum.ToString());
            if (type == ShapeGeometryType.NullShape)
                return geometryFactory.CreateMultiPoint(new IPoint[] { });
            
            if (!(type == ShapeGeometryType.MultiPoint  || type == ShapeGeometryType.MultiPointM ||
                  type == ShapeGeometryType.MultiPointZ || type == ShapeGeometryType.MultiPointZM))	
                throw new ShapefileException("Attempting to load a non-multipoint as multipoint.");

            // Read and for now ignore bounds.
            int bblength = GetBoundingBoxLength();
            bbox = new double[bblength];
            for (; bbindex < 4; bbindex++)
            {
                double d = file.ReadDouble();
                bbox[bbindex] = d;
            }

            // Read points
            int numPoints = file.ReadInt32();
            IPoint[] points = new IPoint[numPoints];
            for (int i = 0; i < numPoints; i++)
            {
                double x = file.ReadDouble();
                double y = file.ReadDouble();
                IPoint point = geometryFactory.CreatePoint(new Coordinate(x, y));                
                points[i] = point;
            }
            geom = geometryFactory.CreateMultiPoint(points);
            GrabZMValues(file);
            return geom;
        }        
开发者ID:ExRam,项目名称:DotSpatial-PCL,代码行数:41,代码来源:MultiPointHandler.cs

示例10: Contains

        public bool Contains(IPoint point)
        {
            var crossProduct = (point.YCoordinate - StartingPoint.YCoordinate)*
                               (EndingPoint.XCoordinate - StartingPoint.XCoordinate) -
                               (point.XCoordinate - StartingPoint.XCoordinate)*
                               (EndingPoint.YCoordinate - StartingPoint.YCoordinate);

            if (Math.Abs(crossProduct) > Double.Epsilon)
                return false;

            var dotProduct = (point.XCoordinate - StartingPoint.XCoordinate)*
                             (EndingPoint.XCoordinate - StartingPoint.XCoordinate) +
                             (point.YCoordinate - StartingPoint.YCoordinate)*
                             (EndingPoint.YCoordinate - StartingPoint.YCoordinate);
            if (dotProduct < 0)
                return false;

            var squaredLength = (EndingPoint.XCoordinate - StartingPoint.XCoordinate)*
                                  (EndingPoint.XCoordinate - StartingPoint.XCoordinate) +
                                  (EndingPoint.YCoordinate - StartingPoint.YCoordinate)*
                                  (EndingPoint.YCoordinate - StartingPoint.YCoordinate);
            if (dotProduct > squaredLength)
                return false;

            return true;
        }
开发者ID:JasonvanBrackel,项目名称:Rectangles,代码行数:26,代码来源:Line.cs

示例11: CreatePartial

 public static IPartialEvaluator CreatePartial(IPoint point)
 {
     // It's important for efficiency that the same objects are reused whenever possible. Thus no compact memory
     // implementation of IPartialEvaluator (like InnerCompactEvaluator; but in that case only primitive types
     // are returned, i.e. doubles).
     return new InnerPartialEvaluator(point);
 }
开发者ID:mortenbakkedal,项目名称:SharpMath,代码行数:7,代码来源:Evaluator.cs

示例12: Rotate

 public static IPoint Rotate( this IPoint point, double degrees, IPoint pivot )
 {
     var translate = new Point( pivot.X * -1, pivot.Y * -1 );
       var translatedPoint = point.Translate( translate );
       var rotatedPoint = translatedPoint.Rotate( degrees );
       return rotatedPoint.Translate( pivot );
 }
开发者ID:nrkn,项目名称:NrknLib,代码行数:7,代码来源:PointExtensions.cs

示例13: DragOperation

 public DragOperation(ICanvasItem child, IPoint startingPoint, ISnappingEngine snappingEngine)
 {
     SnappingEngine = snappingEngine;
     Child = child;                                   
     StartingPoint = startingPoint;            
     ChildStartingPoint = child.GetPosition();
 }
开发者ID:modulexcite,项目名称:VisualDesigner,代码行数:7,代码来源:DragOperation.cs

示例14: IpoptOptimizerResult

 public IpoptOptimizerResult(bool status, bool hasConverged, IPoint optimalPoint, double optimalValue, IpoptReturnCode returnCode, int iterations)
     : base(status, optimalPoint, optimalValue)
 {
     HasConverged = hasConverged;
     ReturnCode = returnCode;
     Iterations = iterations;
 }
开发者ID:mortenbakkedal,项目名称:SharpMath,代码行数:7,代码来源:IpoptOptimizerResult.cs

示例15: UpdateHandlePosition

        public void UpdateHandlePosition(IPoint newPoint)
        {
            var rect = Child.Rect();

            if (InsideLimitsX(newPoint.X) && CanChangeHorizontalPosition)
            {
                var left = Math.Min(newPoint.X, Opposite.X);
                var right = Math.Max(newPoint.X, Opposite.X);
                rect.X = left;
                rect.SetRightKeepingLeft(right);
            }

            if (InsideLimitsY(newPoint.Y) && CanChangeVerticalPosition)
            {
                var top = Math.Min(newPoint.Y, Opposite.Y);
                var bottom = Math.Max(newPoint.Y, Opposite.Y);
                rect.Y = top;
                rect.SetBottomKeepingTop(bottom);
            }

            if (rect.Width > 0 && rect.Height > 0)
            {
                SnappingEngine.SetSourceRectForResize(rect);                               
            }
            
        }
开发者ID:modulexcite,项目名称:VisualDesigner,代码行数:26,代码来源:ResizeOperation.cs


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