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


C# Rectangle.GetMaxX方法代码示例

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


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

示例1: RectangleImpl

 public RectangleImpl(Rectangle r)
 {
     minX = r.GetMinX();
     maxX = r.GetMaxX();
     minY = r.GetMinY();
     maxY = r.GetMaxY();
 }
开发者ID:ccurrens,项目名称:Spatial4n,代码行数:7,代码来源:RectangleImpl.cs

示例2: Init

		protected void Init(SpatialContext ctx, Rectangle bounds, int maxLevels)
		{
			this.xmin = bounds.GetMinX();
			this.xmax = bounds.GetMaxX();
			this.ymin = bounds.GetMinY();
			this.ymax = bounds.GetMaxY();

			levelW = new double[maxLevels];
			levelH = new double[maxLevels];
			levelS = new int[maxLevels];
			levelN = new int[maxLevels];

			gridW = xmax - xmin;
			gridH = ymax - ymin;
			xmid = xmin + gridW / 2.0;
			ymid = ymin + gridH / 2.0;
			levelW[0] = gridW / 2.0;
			levelH[0] = gridH / 2.0;
			levelS[0] = 2;
			levelN[0] = 4;

			for (int i = 1; i < levelW.Length; i++)
			{
				levelW[i] = levelW[i - 1] / 2.0;
				levelH[i] = levelH[i - 1] / 2.0;
				levelS[i] = levelS[i - 1] * 2;
				levelN[i] = levelN[i - 1] * 4;
			}

		}
开发者ID:synhershko,项目名称:lucene.net,代码行数:30,代码来源:QuadPrefixTree.cs

示例3: QuadPrefixTree

 public QuadPrefixTree(SpatialContext ctx, Rectangle bounds, int maxLevels)
     : base(ctx, maxLevels)
 {
     //not really sure how big this should be
     // side
     // number
     xmin = bounds.GetMinX();
     xmax = bounds.GetMaxX();
     ymin = bounds.GetMinY();
     ymax = bounds.GetMaxY();
     levelW = new double[maxLevels];
     levelH = new double[maxLevels];
     levelS = new int[maxLevels];
     levelN = new int[maxLevels];
     gridW = xmax - xmin;
     gridH = ymax - ymin;
     xmid = xmin + gridW / 2.0;
     ymid = ymin + gridH / 2.0;
     levelW[0] = gridW / 2.0;
     levelH[0] = gridH / 2.0;
     levelS[0] = 2;
     levelN[0] = 4;
     for (int i = 1; i < levelW.Length; i++)
     {
         levelW[i] = levelW[i - 1] / 2.0;
         levelH[i] = levelH[i - 1] / 2.0;
         levelS[i] = levelS[i - 1] * 2;
         levelN[i] = levelN[i - 1] * 4;
     }
 }
开发者ID:Cefa68000,项目名称:lucenenet,代码行数:30,代码来源:QuadPrefixTree.cs

示例4: MakeEquals

        /*
         * Constructs a query to retrieve documents that equal the input envelope.
         *
         * @return the spatial query
         */
        public Query MakeEquals(Rectangle bbox)
        {
            // docMinX = queryExtent.GetMinX() AND docMinY = queryExtent.GetMinY() AND docMaxX = queryExtent.GetMaxX() AND docMaxY = queryExtent.GetMaxY()
            Query qMinX = NumericRangeQuery.NewDoubleRange(field_minX, precisionStep, bbox.GetMinX(), bbox.GetMinX(), true, true);
            Query qMinY = NumericRangeQuery.NewDoubleRange(field_minY, precisionStep, bbox.GetMinY(), bbox.GetMinY(), true, true);
            Query qMaxX = NumericRangeQuery.NewDoubleRange(field_maxX, precisionStep, bbox.GetMaxX(), bbox.GetMaxX(), true, true);
            Query qMaxY = NumericRangeQuery.NewDoubleRange(field_maxY, precisionStep, bbox.GetMaxY(), bbox.GetMaxY(), true, true);

            var bq = new BooleanQuery
                     	{
                     		{qMinX, Occur.MUST},
                     		{qMinY, Occur.MUST},
                     		{qMaxX, Occur.MUST},
                     		{qMaxY, Occur.MUST}
                     	};
            return bq;
        }
开发者ID:Cefa68000,项目名称:lucenenet,代码行数:22,代码来源:BBoxStrategy.cs

示例5: GetHashCode

        public static int GetHashCode(Rectangle thiz)
        {
            if (thiz == null)
                throw new ArgumentNullException("thiz");

            long temp = thiz.GetMinX() != +0.0d ? BitConverter.DoubleToInt64Bits(thiz.GetMinX()) : 0L;
            int result = (int)(temp ^ ((uint)temp >> 32));
            temp = thiz.GetMaxX() != +0.0d ? BitConverter.DoubleToInt64Bits(thiz.GetMaxX()) : 0L;
            result = 31 * result + (int)(temp ^ ((uint)temp >> 32));
            temp = thiz.GetMinY() != +0.0d ? BitConverter.DoubleToInt64Bits(thiz.GetMinY()) : 0L;
            result = 31 * result + (int)(temp ^ ((uint)temp >> 32));
            temp = thiz.GetMaxY() != +0.0d ? BitConverter.DoubleToInt64Bits(thiz.GetMaxY()) : 0L;
            result = 31*result + (int) (temp ^ ((uint)temp >> 32));
            return result;
        }
开发者ID:ccurrens,项目名称:Spatial4n,代码行数:15,代码来源:RectangleImpl.cs

示例6: Equals

        /// <summary>
        /// All {@link Rectangle} implementations should use this definition of {@link Object#equals(Object)}.
        /// </summary>
        /// <param name="thiz"></param>
        /// <param name="o"></param>
        /// <returns></returns>
        public static bool Equals(Rectangle thiz, Object o)
        {
            if (thiz == null)
                throw new ArgumentNullException("thiz");

            if (thiz == o) return true;

            var rectangle = o as Rectangle;
            if (rectangle == null) return false;

            return thiz.GetMaxX().Equals(rectangle.GetMaxX()) && thiz.GetMinX().Equals(rectangle.GetMinX()) &&
                   thiz.GetMaxY().Equals(rectangle.GetMaxY()) && thiz.GetMinY().Equals(rectangle.GetMinY());
        }
开发者ID:ccurrens,项目名称:Spatial4n,代码行数:19,代码来源:RectangleImpl.cs

示例7: Relate

        public SpatialRelation Relate(Rectangle rect, SpatialContext ctx)
        {
            SpatialRelation yIntersect = RelateYRange(rect.GetMinY(), rect.GetMaxY(), ctx);
            if (yIntersect == SpatialRelation.DISJOINT)
                return SpatialRelation.DISJOINT;

            SpatialRelation xIntersect = RelateXRange(rect.GetMinX(), rect.GetMaxX(), ctx);
            if (xIntersect == SpatialRelation.DISJOINT)
                return SpatialRelation.DISJOINT;

            if (xIntersect == yIntersect)//in agreement
                return xIntersect;

            //if one side is equal, return the other
            if (GetMinX() == rect.GetMinX() && GetMaxX() == rect.GetMaxX())
                return yIntersect;
            if (GetMinY() == rect.GetMinY() && GetMaxY() == rect.GetMaxY())
                return xIntersect;

            return SpatialRelation.INTERSECTS;
        }
开发者ID:ccurrens,项目名称:Spatial4n,代码行数:21,代码来源:RectangleImpl.cs

示例8: RelateRectanglePhase2

        protected virtual SpatialRelation RelateRectanglePhase2(Rectangle r, SpatialRelation bboxSect, SpatialContext ctx)
        {
            /*
             !! DOES NOT WORK WITH GEO CROSSING DATELINE OR WORLD-WRAP.
             TODO upgrade to handle crossing dateline, but not world-wrap; use some x-shifting code from RectangleImpl.
             */

            //At this point, the only thing we are certain of is that circle is *NOT* WITHIN r, since the bounding box of a
            // circle MUST be within r for the circle to be within r.

            //--Quickly determine if they are DISJOINT or not.
            //see http://stackoverflow.com/questions/401847/circle-rectangle-collision-detection-intersection/1879223#1879223
            double closestX;
            double ctr_x = GetXAxis();
            if (ctr_x < r.GetMinX())
                closestX = r.GetMinX();
            else if (ctr_x > r.GetMaxX())
                closestX = r.GetMaxX();
            else
                closestX = ctr_x;

            double closestY;
            double ctr_y = GetYAxis();
            if (ctr_y < r.GetMinY())
                closestY = r.GetMinY();
            else if (ctr_y > r.GetMaxY())
                closestY = r.GetMaxY();
            else
                closestY = ctr_y;

            //Check if there is an intersection from this circle to closestXY
            bool didContainOnClosestXY = false;
            if (ctr_x == closestX)
            {
                double deltaY = Math.Abs(ctr_y - closestY);
                double distYCirc = (ctr_y < closestY ? enclosingBox.GetMaxY() - ctr_y : ctr_y - enclosingBox.GetMinY());
                if (deltaY > distYCirc)
                    return SpatialRelation.DISJOINT;
            }
            else if (ctr_y == closestY)
            {
                double deltaX = Math.Abs(ctr_x - closestX);
                double distXCirc = (ctr_x < closestX ? enclosingBox.GetMaxX() - ctr_x : ctr_x - enclosingBox.GetMinX());
                if (deltaX > distXCirc)
                    return SpatialRelation.DISJOINT;
            }
            else
            {
                //fallback on more expensive calculation
                didContainOnClosestXY = true;
                if (!Contains(closestX, closestY))
                    return SpatialRelation.DISJOINT;
            }

            //At this point we know that it's *NOT* DISJOINT, so there is some level of intersection. It's *NOT* WITHIN either.
            // The only question left is whether circle CONTAINS r or simply intersects it.

            //If circle contains r, then its bbox MUST also CONTAIN r.
            if (bboxSect != SpatialRelation.CONTAINS)
                return SpatialRelation.INTERSECTS;

            //Find the farthest point of r away from the center of the circle. If that point is contained, then all of r is
            // contained.
            double farthestX = r.GetMaxX() - ctr_x > ctr_x - r.GetMinX() ? r.GetMaxX() : r.GetMinX();
            double farthestY = r.GetMaxY() - ctr_y > ctr_y - r.GetMinY() ? r.GetMaxY() : r.GetMinY();
            if (Contains(farthestX, farthestY))
                return SpatialRelation.CONTAINS;
            return SpatialRelation.INTERSECTS;
        }
开发者ID:ccurrens,项目名称:Spatial4n,代码行数:69,代码来源:CircleImpl.cs

示例9: MakeWithin

        /*
         * Constructs a query to retrieve documents are fully within the input envelope.
         *
         * @return the spatial query
         */
        Query MakeWithin(Rectangle bbox)
        {
            // general case
            // docMinX >= queryExtent.GetMinX() AND docMinY >= queryExtent.GetMinY() AND docMaxX <= queryExtent.GetMaxX() AND docMaxY <= queryExtent.GetMaxY()

            // Y conditions
            // docMinY >= queryExtent.GetMinY() AND docMaxY <= queryExtent.GetMaxY()
            Query qMinY = NumericRangeQuery.NewDoubleRange(field_minY, precisionStep, bbox.GetMinY(), null, true, false);
            Query qMaxY = NumericRangeQuery.NewDoubleRange(field_maxY, precisionStep, null, bbox.GetMaxY(), false, true);
            Query yConditions = this.MakeQuery(new Query[] { qMinY, qMaxY }, Occur.MUST);

            // X conditions
            Query xConditions = null;

            // X Conditions for documents that cross the date line,
            // the left portion of the document must be within the left portion of the query,
            // AND the right portion of the document must be within the right portion of the query
            // docMinXLeft >= queryExtent.GetMinX() AND docMaxXLeft <= 180.0
            // AND docMinXRight >= -180.0 AND docMaxXRight <= queryExtent.GetMaxX()
            Query qXDLLeft = NumericRangeQuery.NewDoubleRange(field_minX, precisionStep, bbox.GetMinX(), null, true, false);
            Query qXDLRight = NumericRangeQuery.NewDoubleRange(field_maxX, precisionStep, null, bbox.GetMaxX(), false, true);
            Query qXDLLeftRight = this.MakeQuery(new Query[] { qXDLLeft, qXDLRight }, Occur.MUST);
            Query qXDL = this.MakeXDL(true, qXDLLeftRight);

            // queries that do not cross the date line
            if (!bbox.GetCrossesDateLine())
            {

                // X Conditions for documents that do not cross the date line,
                // docMinX >= queryExtent.GetMinX() AND docMaxX <= queryExtent.GetMaxX()
                Query qMinX = NumericRangeQuery.NewDoubleRange(field_minX, precisionStep, bbox.GetMinX(), null, true, false);
                Query qMaxX = NumericRangeQuery.NewDoubleRange(field_maxX, precisionStep, null, bbox.GetMaxX(), false, true);
                Query qMinMax = this.MakeQuery(new Query[] { qMinX, qMaxX }, Occur.MUST);
                Query qNonXDL = this.MakeXDL(false, qMinMax);

                // apply the non-XDL or XDL X conditions
                if ((bbox.GetMinX() <= -180.0) && bbox.GetMaxX() >= 180.0)
                {
                    xConditions = this.MakeQuery(new Query[] { qNonXDL, qXDL }, Occur.SHOULD);
                }
                else
                {
                    xConditions = qNonXDL;
                }

                // queries that cross the date line
            }
            else
            {

                // X Conditions for documents that do not cross the date line

                // the document should be within the left portion of the query
                // docMinX >= queryExtent.GetMinX() AND docMaxX <= 180.0
                Query qMinXLeft = NumericRangeQuery.NewDoubleRange(field_minX, precisionStep, bbox.GetMinX(), null, true, false);
                Query qMaxXLeft = NumericRangeQuery.NewDoubleRange(field_maxX, precisionStep, null, 180.0, false, true);
                Query qLeft = this.MakeQuery(new Query[] { qMinXLeft, qMaxXLeft }, Occur.MUST);

                // the document should be within the right portion of the query
                // docMinX >= -180.0 AND docMaxX <= queryExtent.GetMaxX()
                Query qMinXRight = NumericRangeQuery.NewDoubleRange(field_minX, precisionStep, -180.0, null, true, false);
                Query qMaxXRight = NumericRangeQuery.NewDoubleRange(field_maxX, precisionStep, null, bbox.GetMaxX(), false, true);
                Query qRight = this.MakeQuery(new Query[] { qMinXRight, qMaxXRight }, Occur.MUST);

                // either left or right conditions should occur,
                // apply the left and right conditions to documents that do not cross the date line
                Query qLeftRight = this.MakeQuery(new Query[] { qLeft, qRight }, Occur.SHOULD);
                Query qNonXDL = this.MakeXDL(false, qLeftRight);

                // apply the non-XDL and XDL conditions
                xConditions = this.MakeQuery(new Query[] { qNonXDL, qXDL }, Occur.SHOULD);
            }

            // both X and Y conditions must occur
            return this.MakeQuery(new Query[] { xConditions, yConditions }, Occur.MUST);
        }
开发者ID:Cefa68000,项目名称:lucenenet,代码行数:81,代码来源:BBoxStrategy.cs

示例10: MakeDisjoint

		/// <summary>
		/// Constructs a query to retrieve documents that fully contain the input envelope.
		/// </summary>
		/// <param name="bbox"></param>
		/// <param name="fieldInfo"></param>
		/// <returns>The spatial query</returns>
		Query MakeDisjoint(Rectangle bbox)
		{
			Query qX = NumericRangeQuery.NewDoubleRange(
			  fieldNameX,
			  precisionStep,
			  bbox.GetMinX(),
			  bbox.GetMaxX(),
			  true,
			  true);
			Query qY = NumericRangeQuery.NewDoubleRange(
			  fieldNameY,
			  precisionStep,
			  bbox.GetMinY(),
			  bbox.GetMaxY(),
			  true,
			  true);

			var bq = new BooleanQuery {{qX, Occur.MUST_NOT}, {qY, Occur.MUST_NOT}};
			return bq;
		}
开发者ID:synhershko,项目名称:lucene.net,代码行数:26,代码来源:TwoDoublesStrategy.cs

示例11: MakeWithin

 /// <summary>
 /// Constructs a query to retrieve documents that fully contain the input envelope.
 /// </summary>
 /// <param name="bbox"></param>
 private Query MakeWithin(Rectangle bbox)
 {
     var bq = new BooleanQuery();
     const Occur MUST = Occur.MUST;
     if (bbox.GetCrossesDateLine())
     {
         //use null as performance trick since no data will be beyond the world bounds
         bq.Add(RangeQuery(fieldNameX, null /*-180*/, bbox.GetMaxX()), Occur.SHOULD);
         bq.Add(RangeQuery(fieldNameX, bbox.GetMinX(), null /*+180*/), Occur.SHOULD);
         bq.MinimumNumberShouldMatch = 1; //must match at least one of the SHOULD
     }
     else
     {
         bq.Add(RangeQuery(fieldNameX, bbox.GetMinX(), bbox.GetMaxX()), MUST);
     }
     bq.Add(RangeQuery(fieldNameY, bbox.GetMinY(), bbox.GetMaxY()), MUST);
     return bq;
 }
开发者ID:Cefa68000,项目名称:lucenenet,代码行数:22,代码来源:PointVectorStrategy.cs

示例12: MakeDisjoint

 /// <summary>
 /// Constructs a query to retrieve documents that fully contain the input envelope.
 /// </summary>
 /// <param name="bbox"></param>
 private Query MakeDisjoint(Rectangle bbox)
 {
     if (bbox.GetCrossesDateLine())
         throw new InvalidOperationException("MakeDisjoint doesn't handle dateline cross");
     Query qX = RangeQuery(fieldNameX, bbox.GetMinX(), bbox.GetMaxX());
     Query qY = RangeQuery(fieldNameY, bbox.GetMinY(), bbox.GetMaxY());
     var bq = new BooleanQuery { { qX, Occur.MUST_NOT }, { qY, Occur.MUST_NOT } };
     return bq;
 }
开发者ID:Cefa68000,项目名称:lucenenet,代码行数:13,代码来源:PointVectorStrategy.cs

示例13: CreateIndexableFields

 public AbstractField[] CreateIndexableFields(Rectangle bbox)
 {
     var fields = new AbstractField[5];
     fields[0] = DoubleField(field_minX, bbox.GetMinX());
     fields[1] = DoubleField(field_maxX, bbox.GetMaxX());
     fields[2] = DoubleField(field_minY, bbox.GetMinY());
     fields[3] = DoubleField(field_maxY, bbox.GetMaxY());
     fields[4] = new Field(field_xdl, bbox.GetCrossesDateLine() ? "T" : "F", Field.Store.NO,
                           Field.Index.NOT_ANALYZED_NO_NORMS) {OmitNorms = true, OmitTermFreqAndPositions = true};
     return fields;
 }
开发者ID:raol,项目名称:lucene.net,代码行数:11,代码来源:BBoxStrategy.cs

示例14: RectangleImpl

 public RectangleImpl(Rectangle r, SpatialContext ctx)
     : this(r.GetMinX(), r.GetMaxX(), r.GetMinY(), r.GetMaxY(), ctx)
 {
 }
开发者ID:h0st1le,项目名称:Spatial4n,代码行数:4,代码来源:RectangleImpl.cs

示例15: MakeContains

        //-------------------------------------------------------------------------------
        //
        //-------------------------------------------------------------------------------
        /// <summary>
        /// Constructs a query to retrieve documents that fully contain the input envelope.
        /// </summary>
        /// <param name="bbox"></param>
        /// <returns>The spatial query</returns>
        protected Query MakeContains(Rectangle bbox)
        {
            // general case
            // docMinX <= queryExtent.GetMinX() AND docMinY <= queryExtent.GetMinY() AND docMaxX >= queryExtent.GetMaxX() AND docMaxY >= queryExtent.GetMaxY()

            // Y conditions
            // docMinY <= queryExtent.GetMinY() AND docMaxY >= queryExtent.GetMaxY()
            Query qMinY = NumericRangeQuery.NewDoubleRange(field_minY, precisionStep, null, bbox.GetMinY(), false, true);
            Query qMaxY = NumericRangeQuery.NewDoubleRange(field_maxY, precisionStep, bbox.GetMaxY(), null, true, false);
            Query yConditions = this.MakeQuery(new Query[] { qMinY, qMaxY }, Occur.MUST);

            // X conditions
            Query xConditions = null;

            // queries that do not cross the date line
            if (!bbox.GetCrossesDateLine())
            {

                // X Conditions for documents that do not cross the date line,
                // documents that contain the min X and max X of the query envelope,
                // docMinX <= queryExtent.GetMinX() AND docMaxX >= queryExtent.GetMaxX()
                Query qMinX = NumericRangeQuery.NewDoubleRange(field_minX, precisionStep, null, bbox.GetMinX(), false, true);
                Query qMaxX = NumericRangeQuery.NewDoubleRange(field_maxX, precisionStep, bbox.GetMaxX(), null, true, false);
                Query qMinMax = this.MakeQuery(new Query[] { qMinX, qMaxX }, Occur.MUST);
                Query qNonXDL = this.MakeXDL(false, qMinMax);

                // X Conditions for documents that cross the date line,
                // the left portion of the document contains the min X of the query
                // OR the right portion of the document contains the max X of the query,
                // docMinXLeft <= queryExtent.GetMinX() OR docMaxXRight >= queryExtent.GetMaxX()
                Query qXDLLeft = NumericRangeQuery.NewDoubleRange(field_minX, precisionStep, null, bbox.GetMinX(), false, true);
                Query qXDLRight = NumericRangeQuery.NewDoubleRange(field_maxX, precisionStep, bbox.GetMaxX(), null, true, false);
                Query qXDLLeftRight = this.MakeQuery(new Query[] { qXDLLeft, qXDLRight }, Occur.SHOULD);
                Query qXDL = this.MakeXDL(true, qXDLLeftRight);

                // apply the non-XDL and XDL conditions
                xConditions = this.MakeQuery(new Query[] { qNonXDL, qXDL }, Occur.SHOULD);

                // queries that cross the date line
            }
            else
            {

                // No need to search for documents that do not cross the date line

                // X Conditions for documents that cross the date line,
                // the left portion of the document contains the min X of the query
                // AND the right portion of the document contains the max X of the query,
                // docMinXLeft <= queryExtent.GetMinX() AND docMaxXRight >= queryExtent.GetMaxX()
                Query qXDLLeft = NumericRangeQuery.NewDoubleRange(field_minX, precisionStep, null, bbox.GetMinX(), false, true);
                Query qXDLRight = NumericRangeQuery.NewDoubleRange(field_maxX, precisionStep, bbox.GetMaxX(), null, true, false);
                Query qXDLLeftRight = this.MakeQuery(new Query[] { qXDLLeft, qXDLRight }, Occur.MUST);

                xConditions = this.MakeXDL(true, qXDLLeftRight);
            }

            // both X and Y conditions must occur
            return this.MakeQuery(new Query[] { xConditions, yConditions }, Occur.MUST);
        }
开发者ID:Cefa68000,项目名称:lucenenet,代码行数:67,代码来源:BBoxStrategy.cs


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