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


C# SharpMap.GetBoundingBox方法代码示例

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


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

示例1: CreateLabel

    protected override SharpMap.Rendering.Label CreateLabel(SharpMap.Geometries.Geometry feature, string text, float rotation, SharpMap.Styles.LabelStyle style, Map map, System.Drawing.Graphics g)
    {
      //System.Drawing.SizeF size = g.MeasureString(text, style.Font);

      System.Drawing.PointF position = map.WorldToImage(feature.GetBoundingBox().GetCentroid());
      //position.X = position.X - size.Width * (short)style.HorizontalAlignment * 0.5f;
      //position.Y = position.Y - size.Height * (short)style.VerticalAlignment * 0.5f;
      if (position.X /*- size.Width*/ > map.Size.Width || position.X /*+ size.Width */< 0 ||
        position.Y /*- size.Height*/ > map.Size.Height || position.Y /*+ size.Height*/ < 0)
        return null;
      else
      {
        SharpMap.Rendering.Label lbl;

        if (!style.CollisionDetection)
          lbl = new SharpMap.Rendering.Label(text, position, rotation, this.Priority, null, style);
        else
        {
          //Collision detection is enabled so we need to measure the size of the string
          lbl = new SharpMap.Rendering.Label(text, position, rotation, this.Priority,
            new SharpMap.Rendering.LabelBox(position.X /*- size.Width * 0.5f*/ - style.CollisionBuffer.Width, position.Y + /*size.Height * 0.5f*/ + style.CollisionBuffer.Height,
            /*size.Width +*/ 2f * style.CollisionBuffer.Width, /*size.Height +*/ style.CollisionBuffer.Height * 2f), style);
        }
        if (feature.GetType() == typeof(SharpMap.Geometries.LineString))
        {
          SharpMap.Geometries.LineString line = feature as SharpMap.Geometries.LineString;
          if (line.Length / map.PixelSize > 40/*size.Width*/) //Only label feature if it is long enough
            CalculateLabelOnLinestring(line, ref lbl, map);
          else
            return null;
        }

        return lbl;
      }
    }
开发者ID:diegowald,项目名称:intellitrack,代码行数:35,代码来源:HtmlLabel.cs

示例2: ExecuteIntersectionQuery

 public void ExecuteIntersectionQuery(SharpMap.Geometries.Geometry geom, SharpMap.Data.FeatureDataSet ds)
 {
     ExecuteIntersectionQuery(geom.GetBoundingBox(), ds);
 }
开发者ID:jumpinjackie,项目名称:fdotoolbox,代码行数:4,代码来源:FdoInMemoryProvider.cs

示例3: ExecuteIntersectionQuery

        /// <summary>
        /// Returns the data associated with all the geometries that are intersected by 'geom'.
        /// Please note that the ShapeFile provider currently doesn't fully support geometryintersection
        /// and thus only BoundingBox/BoundingBox querying are performed. The results are NOT
        /// guaranteed to lie withing 'geom'.
        /// </summary>
        /// <param name="geom"></param>
        /// <param name="ds">FeatureDataSet to fill data into</param>
        public void ExecuteIntersectionQuery(SharpMap.Geometries.Geometry geom, FeatureDataSet ds)
        {
            SharpMap.Data.FeatureDataTable dt = (SharpMap.Data.FeatureDataTable)dbaseFile.NewTable;
            SharpMap.Geometries.BoundingBox bbox = geom.GetBoundingBox();
            //Get candidates by intersecting the spatial index tree
            List<uint> objectlist = tree.Search(bbox);

            if (objectlist.Count == 0)
                return;

            for (int j = 0; j < objectlist.Count; j++)
            {
                for (uint i = (uint)dt.Rows.Count - 1; i >= 0; i--)
                {
                    FeatureDataRow fdr = GetFeature(objectlist[j],dt);
                    if (fdr.Geometry != null)
                        if (fdr.Geometry.GetBoundingBox().Intersects(bbox))
                        //replace above line with this:  if(fdr.Geometry.Intersects(bbox))  when relation model is complete
                            if (FilterDelegate == null || FilterDelegate(fdr))
                                dt.AddRow(fdr);
                }
            }
            ds.Tables.Add(dt);
        }
开发者ID:jumpinjackie,项目名称:fdotoolbox,代码行数:32,代码来源:ShapeFile.cs

示例4: FindGeoNearPoint

        public SharpMap.Data.FeatureDataRow FindGeoNearPoint(SharpMap.Geometries.Point pos, double amountGrow, ref double DistanceToSelected)
        {
            SharpMap.Geometries.BoundingBox bbox = pos.GetBoundingBox().Grow(amountGrow);
            SharpMap.Data.FeatureDataSet ds = new SharpMap.Data.FeatureDataSet();
            DataSource.ExecuteIntersectionQuery(bbox, ds);
            System.Data.DataTable tbl = ds.Tables[0] as SharpMap.Data.FeatureDataTable;
            GisSharpBlog.NetTopologySuite.IO.WKTReader reader = new GisSharpBlog.NetTopologySuite.IO.WKTReader();
            GeoAPI.Geometries.IGeometry point = reader.Read(pos.ToString());
            if (tbl.Rows.Count == 0)
                return null;

            double distance = point.Distance(reader.Read((tbl.Rows[0] as SharpMap.Data.FeatureDataRow).Geometry.ToString()));
            SharpMap.Data.FeatureDataRow selectedFeature = tbl.Rows[0] as SharpMap.Data.FeatureDataRow;

            if (tbl.Rows.Count > 1)
                for (int i = 1; i < tbl.Rows.Count; i++)
                {
                    GeoAPI.Geometries.IGeometry line = reader.Read((tbl.Rows[i] as SharpMap.Data.FeatureDataRow).Geometry.ToString());
                    if (point.Distance(line) < distance)
                    {
                        distance = point.Distance(line);
                        selectedFeature = tbl.Rows[i] as SharpMap.Data.FeatureDataRow;
                    }
                }
            DistanceToSelected = distance;
            return selectedFeature;
        }
开发者ID:diegowald,项目名称:intellitrack,代码行数:27,代码来源:VectorLayer.cs

示例5: SelectElements

 public SharpMap.Data.FeatureDataSet SelectElements(SharpMap.Geometries.Point point, string layername)
 {
   return SelectElements(point.GetBoundingBox(), layername);
 }
开发者ID:diegowald,项目名称:intellitrack,代码行数:4,代码来源:ComplexMap.cs

示例6: ZoomToElement

    public void ZoomToElement(SharpMap.Geometries.Geometry Element)
    {
      if (Element == null)
        return;

      SharpMap.Geometries.Point point = Element.GetBoundingBox().GetCentroid().AsPoint();
      if ((point.X == 0.0) && (point.Y == 0.0))
        return;
      _BaseMap.Center = Element.GetBoundingBox().GetCentroid();
      _RealTimeMap.ZoomToBox(_BaseMap.Envelope);
      _MapArea = _BaseMap.Envelope;
      BaseMapRedrawn = false;
      OverviewMapRedrawn = false;
      RealTimeMapRedrawn = false;
      RefreshViews();
    }
开发者ID:diegowald,项目名称:intellitrack,代码行数:16,代码来源:ComplexMap.cs


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