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


C# BoundingRectangle.Join方法代码示例

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


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

示例1: FillFromCache

        /// <summary>
        /// Adds the features retrieved from cache to the receiver.
        /// </summary>
        /// <param name="processAttributes">A value indicating whether the attributes will be processed or not</param>
        /// <param name="cacheAccessor">Cache accessor instance</param>
        /// <param name="fr">An object that receives the retrieved features</param>
        /// <param name="bounds">Rectangle that defines a query region</param>
        /// <returns>Number of retrieved features</returns>
        public static int FillFromCache(IFeatureCollectionCacheAccessor cacheAccessor, IFeatureReceiver fr, BoundingRectangle bounds, bool processAttributes)
        {
            ISpatialIndex pointsIndex = cacheAccessor.RestoreFeaturesIndex(MapAround.Mapping.FeatureType.Point);
            ISpatialIndex polylinesIndex = cacheAccessor.RestoreFeaturesIndex(MapAround.Mapping.FeatureType.Polyline);
            ISpatialIndex polygonsIndex = cacheAccessor.RestoreFeaturesIndex(MapAround.Mapping.FeatureType.Polygon);

            BoundingRectangle b;
            if (!bounds.IsEmpty())
                b = bounds.GetBoundingRectangle();
            else
            {
                b = new BoundingRectangle();
                b.Join(pointsIndex.IndexedSpace);
                b.Join(polylinesIndex.IndexedSpace);
                b.Join(polygonsIndex.IndexedSpace);
            }

            List<Feature> points = new List<Feature>();
            pointsIndex.QueryObjectsInRectangle(bounds, points);

            List<Feature> polylines = new List<Feature>();
            polylinesIndex.QueryObjectsInRectangle(bounds, polylines);

            List<Feature> polygons = new List<Feature>();
            polygonsIndex.QueryObjectsInRectangle(bounds, polygons);

            points.ForEach(point => fr.AddFeature((Feature)point.Clone()));
            polylines.ForEach(polyline => fr.AddFeature((Feature)polyline.Clone()));
            polygons.ForEach(polygon => fr.AddFeature((Feature)polygon.Clone()));

            if (processAttributes)
            {
                fr.FeatureAttributeNames.Clear();
                IList<string> attributeNames = cacheAccessor.RestoreAttributeNames();
                foreach (string s in attributeNames)
                    fr.FeatureAttributeNames.Add(s);
            }

            return points.Count + polylines.Count + polygons.Count;
        }
开发者ID:gkrsu,项目名称:maparound.core,代码行数:48,代码来源:SpatialDataProviders.cs

示例2: BindRaster

        /// <summary>
        /// Performs a rubbersheeting transformation of raster.
        /// </summary>
        /// <param name="source">A System.Drawing.Bitmap instance containing the source image</param>
        /// <param name="sourceControlPoints">Control points of source</param>
        /// <param name="destinationControlPoints">Control points on the map</param>
        /// <param name="rectangle">A bounding rectangle defining a bouns of transformed raster</param>
        /// <param name="progress">Defines a method which is called to notify a subscriber about completion state.</param>
        /// <returns>A System.Drawing.Bitmap instance containing the transformed image</returns>
        public static Bitmap BindRaster(Bitmap source, Point[] sourceControlPoints, ICoordinate[] destinationControlPoints, out BoundingRectangle rectangle, RasterBindingProgress progress)
        {
#if DEMO
            throw new NotImplementedException("This method is not implemented in demo version.");
#else
            if (source == null)
                throw new ArgumentNullException("source");

            if (sourceControlPoints.Length != destinationControlPoints.Length)
                throw new ArgumentException("Number of control points of raster and map should be the same.");

            if (sourceControlPoints.Length < 3)
                throw new ArgumentException("Number of control points should not be less than 3");

            if (!checkControlPoints(source.Width, source.Height, sourceControlPoints))
                throw new ArgumentException("At least one source control point is outside raster", "sourceControlPoints");

            ICoordinate[,] warpTransformResult = new ICoordinate[source.Width, source.Height];
            PointF[,] affinneTransformResult = new PointF[source.Width, source.Height];

            // вычисляем результат аффинного преобразования примененного к координатам точек исходного растра
            calculateAffinneTransform(source.Width, source.Height, affinneTransformResult, sourceControlPoints, destinationControlPoints, progress);
            
            ICoordinate[] shifts = new ICoordinate[destinationControlPoints.Length];
            for (int i = 0; i < shifts.Length; i++)
            {
                PointF p = affinneTransformResult[sourceControlPoints[i].X, sourceControlPoints[i].Y];
                shifts[i] = PlanimetryEnvironment.NewCoordinate(destinationControlPoints[i].X - p.X, destinationControlPoints[i].Y - p.Y);
            }

            // вычисляем новые координаты точек исходного растра, полученные в результате "коробления"
            calculateRubberSheetTransform(source.Width, source.Height, affinneTransformResult, warpTransformResult, destinationControlPoints, shifts, progress);

            // вычисляем ограничивающий прямоугольник преобразованного растра
            rectangle = new BoundingRectangle();
            for (int i = 0; i < source.Width; i++)
                for (int j = 0; j < source.Height; j++)
                {
                    if (!double.IsNaN(warpTransformResult[i, j].X) && !double.IsNaN(warpTransformResult[i, j].Y))
                        rectangle.Join(warpTransformResult[i, j]);
                }

            return calcDestRaster(source, rectangle, warpTransformResult, progress);
#endif
        }
开发者ID:gkrsu,项目名称:maparound.core,代码行数:54,代码来源:RasterAlgorithms.cs

示例3: boundsChanged

 private void boundsChanged()
 {
     BoundingRectangle br = new BoundingRectangle();
     if (_segments.Count > 0)
     {
         br.Join(_segments[0].V1);
         br.Join(_segments[0].V2);
         br.Join(_segments[_segments.Count - 1].V1);
         br.Join(_segments[_segments.Count - 1].V2);
     }
     _boundingRectangle = br;
 }
开发者ID:gkrsu,项目名称:maparound.core,代码行数:12,代码来源:DataStructures.cs

示例4: init

        private void init()
        {
            _nodes.Clear();
            _edges.Clear();
            _sourceSegments.Clear();

            int pointCount = 0;

            _sourceBounds = new BoundingRectangle();
            if (_sourceGeometry1 != null)
            {
                _sourceBounds.Join(_sourceGeometry1.GetBoundingRectangle());
                pointCount += _sourceGeometry1.CoordinateCount;
            }

            if (_sourceGeometry2 != null)
            {
                _sourceBounds.Join(_sourceGeometry2.GetBoundingRectangle());
                pointCount += _sourceGeometry2.CoordinateCount;
            }

            if (pointCount > 800)
            {
                _sourceBounds.Grow(PlanimetryAlgorithms.Tolerance * 10);

                _splittedSegmentIndex = new KDTree(_sourceBounds);
                _splittedSegmentIndex.MaxDepth = 20;
                _splittedSegmentIndex.BoxSquareThreshold = _sourceBounds.Width * _sourceBounds.Height / 10000;
            }
        }
开发者ID:gkrsu,项目名称:maparound.core,代码行数:30,代码来源:Topology.cs

示例5: getCrossPointsIndex

        private KDTree getCrossPointsIndex(Polyline polyline)
        {
            List<MonotoneChain> chains = new List<MonotoneChain>();
            foreach (LinePath path in polyline.Paths)
                path.AppendMonotoneChains(chains);

            List<SDMinCrossPoint> crossPoints = new List<SDMinCrossPoint>();

            for (int i = 0; i < chains.Count - 1; i++)
                for (int j = i + 1; j < chains.Count; j++)
                    if (chains[i].BoundsIntersect(chains[j]))
                    {
                        List<ICoordinate> points = chains[i].GetCrossPoints(chains[j]);
                        foreach (ICoordinate p in points)
                        {
                            bool isChainIBoundsPoint = p.ExactEquals(chains[i].FirstPoint) ||
                                 p.ExactEquals(chains[i].LastPoint);

                            bool isChainJBoundsPoint = p.ExactEquals(chains[j].FirstPoint) ||
                                 p.ExactEquals(chains[j].LastPoint);

                            if (!(isChainIBoundsPoint && isChainJBoundsPoint))
                            {
                                SDMinCrossPoint cp = new SDMinCrossPoint();
                                cp.Point = p;
                                cp.BoundingRectangle = new PointD(p).GetBoundingRectangle();
                                cp.BoundingRectangle.Grow(PlanimetryAlgorithms.Tolerance);
                                crossPoints.Add(cp);
                            }
                        }
                    }

            BoundingRectangle br = new BoundingRectangle();
            foreach (SDMinCrossPoint p in crossPoints)
                br.Join(p.BoundingRectangle);

            KDTree result = new KDTree(br);
            result.MaxDepth = 10;
            result.MinObjectCount = 10;
            if (br.IsEmpty())
                br.Join(PlanimetryEnvironment.NewCoordinate(0, 0));
            result.BoxSquareThreshold = br.Width * br.Height / 10000;
            result.Build(crossPoints);
            return result;
        }
开发者ID:gkrsu,项目名称:maparound.core,代码行数:45,代码来源:Simplifier.cs

示例6: TransformBoundingRectangle

        /// <summary>
        /// Transforms coordinates of the bounding rectangle.
        /// </summary>
        /// <param name="box">Rectangle to transform</param>
        /// <param name="transform">The transformation to apply</param>
        /// <returns>The transformed rectangle</returns>
        public static BoundingRectangle TransformBoundingRectangle(BoundingRectangle box, IMathTransform transform)
        {
            if (box == null)
                return null;
            ICoordinate[] corners = new ICoordinate[4];
            corners[0] = PlanimetryEnvironment.NewCoordinate(transform.Transform(box.Min.Values()));
            corners[1] = PlanimetryEnvironment.NewCoordinate(transform.Transform(box.Max.Values()));
            corners[2] = PlanimetryEnvironment.NewCoordinate(transform.Transform(PlanimetryEnvironment.NewCoordinate(box.MinX, box.MaxY).Values()));
            corners[3] = PlanimetryEnvironment.NewCoordinate(transform.Transform(PlanimetryEnvironment.NewCoordinate(box.MaxX, box.MinY).Values())); 

            BoundingRectangle result = new BoundingRectangle();
            for (int i = 0; i < 4; i++)
                result.Join(corners[i]);
            return result;
        }
开发者ID:gkrsu,项目名称:maparound.core,代码行数:21,代码来源:Transformers.cs

示例7: addFeaturesToCache

        private void addFeaturesToCache(IFeatureReceiver fr, 
            List<Feature> points, 
            List<Feature> multiPoints,
            List<Feature> polylines,
            List<Feature> polygons)
        {
            _cacheAccessor.Key = fr.Alias;
            if (!_cacheAccessor.ExistsInCache)
            {
                BoundingRectangle b = new BoundingRectangle();
                List<Feature> pts = new List<Feature>();
                foreach (Feature feature in points)
                {
                    b.Join(feature.BoundingRectangle);
                    pts.Add(feature);
                }
                foreach (Feature feature in multiPoints)
                {
                    b.Join(feature.BoundingRectangle);
                    pts.Add(feature);
                }

                buildAndSaveIndex(MapAround.Mapping.FeatureType.Point, b, fr.DefaultPointsIndexSettings, pts);

                b = new BoundingRectangle();
                foreach (Feature feature in polylines)
                    b.Join(feature.BoundingRectangle);

                buildAndSaveIndex(MapAround.Mapping.FeatureType.Polyline, b, fr.DefaultPolylinesIndexSettings, polylines);

                b = new BoundingRectangle();
                foreach (Feature feature in polygons)
                    b.Join(feature.BoundingRectangle);

                buildAndSaveIndex(MapAround.Mapping.FeatureType.Polygon, b, fr.DefaultPolygonsIndexSettings, polygons);

                if (_processAttributes)
                    _cacheAccessor.SaveAttributeNames(fr.FeatureAttributeNames);
            }
        }
开发者ID:gkrsu,项目名称:maparound.core,代码行数:40,代码来源:ShapeFileDataProvider.cs


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