/// <summary>
        /// This method takes a pre-populated FeatureDataTable and removes rows that do not truly intersect testGeometry
        /// </summary>
        /// <param name="featureDataTable">The FeatureDataTable instance to filter</param>
        /// <param name="testGeometry">the geometry to compare against</param>
        public void PostFilterExistingFeatureDataTable(FeatureDataTable featureDataTable, Geometry testGeometry)
        {
            //first we create a new GeometryFactory.
            GeometryFactory geometryFactory = new GeometryFactory();


            //then we convert the testGeometry into the equivalent NTS geometry
            GeoAPI.Geometries.IGeometry testGeometryAsNtsGeom = GeometryConverter.ToNTSGeometry(testGeometry, geometryFactory);


            //now we loop backwards through the FeatureDataTable 
            for (int i = featureDataTable.Rows.Count - 1; i > -1; i--)
            {
                //we get each row
                FeatureDataRow featureDataRow = featureDataTable.Rows[i] as FeatureDataRow;
                //and get the rows' geometry
                Geometry compareGeometry = featureDataRow.Geometry;
                //convert the rows' geometry into the equivalent NTS geometry
                GeoAPI.Geometries.IGeometry compareGeometryAsNts = GeometryConverter.ToNTSGeometry(compareGeometry, geometryFactory);
                //now test for intesection (note other operations such as Contains, Within, Disjoint etc can all be done the same way)
                bool intersects = testGeometryAsNtsGeom.Intersects(compareGeometryAsNts);

                //if it doesn't intersect remove the row.
                if (!intersects)
                    featureDataTable.Rows.RemoveAt(i);
            }
        }
示例#2
0
        public static SqlGeometry ToSqlGeometry(SMGeometry smGeometry)
        {
            SqlGeometryBuilder builder = new SqlGeometryBuilder();
#if !DotSpatialProjections
            if (smGeometry.SpatialReference != null)
                builder.SetSrid((int) smGeometry.SpatialReference.AuthorityCode);
#else
            if (smGeometry.SpatialReference != null)
                builder.SetSrid((int) smGeometry.SpatialReference.EpsgCode);
#endif
            else
                builder.SetSrid(0);

            SharpMapGeometryToSqlGeometry(builder, smGeometry);

            SqlGeometry g = builder.ConstructedGeometry;
            if (!g.STIsValid())
            {
                try
                {
                    g.Reduce(ReduceTolerance);
                    g.MakeValid();
                }
                catch (Exception ex)
                {
                    throw new SqlGeometryConverterException(ex, smGeometry);
                }
            }

            if (!g.STIsValid())
                throw new SqlGeometryConverterException(smGeometry);

            return g;
        }
 private static void SharpMapGeometryToSqlGeometry(SqlGeometryBuilder geomBuilder, SMGeometry smGeometry)
 {
     
     switch (smGeometry.GeometryType)
     {
         case SMGeometryType.Point:
             SharpMapPointToSqlGeometry(geomBuilder, smGeometry as SMPoint);
             break;
         case SMGeometryType.LineString:
             SharpMapLineStringToSqlGeometry(geomBuilder, smGeometry as SMLineString);
             break;
         case SMGeometryType.Polygon:
             SharpMapPolygonToSqlGeometry(geomBuilder, smGeometry as SMPolygon);
             break;
         case SMGeometryType.MultiPoint:
             SharpMapMultiPointToSqlGeometry(geomBuilder, smGeometry as SMMultiPoint);
             break;
         case SMGeometryType.MultiLineString:
             SharpMapMultiLineStringToSqlGeometry(geomBuilder, smGeometry as SMMultiLineString);
             break;
         case SMGeometryType.MultiPolygon:
             SharpMapMultiPolygonToSqlGeometry(geomBuilder, smGeometry as SMMultiPolygon);
             break;
         case SMGeometryType.GeometryCollection:
             SharpMapGeometryCollectionToSqlGeometry(geomBuilder, smGeometry as SMGeometryCollection);
             break;
         default:
             throw new ArgumentException(
                 String.Format("Cannot convert '{0}' geometry type", smGeometry.GeometryType), "smGeometry");
     }
 }
        /// <summary>
        /// This method returns a FeatureDataTable containing all the rows from the shapefile that intersect the testGeometry.
        /// The ShapeFile.ExecuteIntersectionQuery method only tests bounding boxes so we use the FilterDelegate property to add a true 
        /// intersection test using NetTopologySuite
        /// </summary>
        /// <param name="pathToShapefile">The path to the shapefile</param>
        /// <param name="testGeometry">The geometry that we want to test against</param>
        /// <returns></returns>
        public FeatureDataTable GetIntersectingFeaturesUsingFilterDelegate(string pathToShapefile, Geometry testGeometry)
        {
            //create a new shapefile provider 
            using (ShapeFile shapefile = new ShapeFile(pathToShapefile))
            {
                //create an nts GeometryFactory
                GeometryFactory geometryFactory = new GeometryFactory();

                //convert the testGeometry into the equivalent NTS geometry
                GeoAPI.Geometries.IGeometry testGeometryAsNtsGeom = GeometryConverter.ToNTSGeometry(testGeometry, geometryFactory);

                Geometry check = GeometryConverter.ToSharpMapGeometry(testGeometryAsNtsGeom);
                if (!check.Equals(testGeometry))
                    throw new ApplicationException("conversion error");

                //set the shapefile providers' FilterDelegate property to a new anonymous method
                //this delegate method will be called for each potential row
                shapefile.FilterDelegate = delegate(FeatureDataRow featureDataRow)
                                               {
                                                   //get the geometry from the featureDataRow
                                                   Geometry rowGeometry = featureDataRow.Geometry;
                                                   //convert it to the equivalent NTS geometry
                                                   GeoAPI.Geometries.IGeometry compareGeometryAsNtsGeometry =
                                                           GeometryConverter.ToNTSGeometry(rowGeometry, geometryFactory);
                                                   //do the test. Note that the testGeometryAsNtsGeometry is available here because it is 
                                                   //declared in the same scope as the anonymous method.
                                                   bool intersects =
                                                       testGeometryAsNtsGeom.Intersects(compareGeometryAsNtsGeometry);
                                                   //return the result
                                                   return intersects;
                                               };


                //create a new FeatureDataSet
                FeatureDataSet featureDataSet = new FeatureDataSet();
                //open the shapefile
                shapefile.Open();
                //call ExecuteIntersectionQuery. The FilterDelegate will be used to limit the result set
                shapefile.ExecuteIntersectionQuery(testGeometry, featureDataSet);
                //close the shapefile
                shapefile.Close();
                //return the populated FeatureDataTable
                return featureDataSet.Tables[0];
            }
        }
示例#5
0
        public static SqlGeometry ToSqlGeometry(SMGeometry smGeometry)
        {
            SqlGeometryBuilder builder = new SqlGeometryBuilder();

#if !DotSpatialProjections
            if (smGeometry.SpatialReference != null)
            {
                builder.SetSrid((int)smGeometry.SpatialReference.AuthorityCode);
            }
#else
            if (smGeometry.SpatialReference != null)
            {
                builder.SetSrid((int)smGeometry.SpatialReference.EpsgCode);
            }
#endif
            else
            {
                builder.SetSrid(0);
            }

            SharpMapGeometryToSqlGeometry(builder, smGeometry);

            SqlGeometry g = builder.ConstructedGeometry;
            if (!g.STIsValid())
            {
                g.Reduce(ReduceTolerance);
                g.MakeValid();
            }

            if (!g.STIsValid())
            {
                throw new SqlGeometryConverterException(smGeometry);
            }

            return(g);
        }
示例#6
0
        /// <summary>
        /// Returns the data associated with all the geometries that are intersected by 'geom'.
        /// </summary>
        /// <param name="geom">The geometry.</param>
        /// <param name="ds">The <see cref="FeatureDataSet"/> to fill data into.</param>
        public override void ExecuteIntersectionQuery(Geometry geom, FeatureDataSet ds)
        {
            //Use the spatial index to get a list of features whose boundingbox intersects bbox
            var objectlist = GetObjectIDsInView(geom.GetBoundingBox());
			if (objectlist.Count == 0)
                return;

            var dt = DbaseFile.NewTable;
            var preparedGeometry = new NetTopologySuite.Geometries.Prepared.PreparedGeometryFactory()
                .Create(Converters.NTS.GeometryConverter.ToNTSGeometry(geom, _factory));
			for (int i = 0; i < objectlist.Count; i++)
			{
			    var testGeom = GetGeometryByID(objectlist[i]);
			    var testNtsGeom = Converters.NTS.GeometryConverter.ToNTSGeometry(testGeom, _factory);
                if (preparedGeometry.Intersects(testNtsGeom))
                {
                    var fdr = GetFeature(objectlist[i], dt);
                    if (fdr != null) dt.AddRow(fdr);
                }
			}

            if (dt.Rows.Count > 0)
                ds.Tables.Add(dt);
        }
示例#7
0
        /// <summary>
        /// Returns geometries within the specified bounding box
        /// </summary>
        /// <param name="bbox"></param>
        /// <returns></returns>
        public Collection <Geometries.Geometry> GetGeometriesInView(SharpMap.Geometries.BoundingBox bbox)
        {
            Collection <Geometries.Geometry> features = new Collection <SharpMap.Geometries.Geometry>();

            using (SqlConnection conn = new SqlConnection(_ConnectionString))
            {
                string strSQL = "SELECT ST.AsBinary(" + this.BuildGeometryExpression() + ") ";
                strSQL += "FROM ST.FilterQuery" + this.BuildSpatialQuerySuffix() + "(" + this.BuildEnvelope(bbox) + ")";

                if (!String.IsNullOrEmpty(_definitionQuery))
                {
                    strSQL += " WHERE " + this.DefinitionQuery;
                }

                using (SqlCommand command = new SqlCommand(strSQL, conn))
                {
                    conn.Open();
                    using (SqlDataReader dr = command.ExecuteReader())
                    {
                        while (dr.Read())
                        {
                            if (dr[0] != DBNull.Value)
                            {
                                SharpMap.Geometries.Geometry geom = SharpMap.Converters.WellKnownBinary.GeometryFromWKB.Parse((byte[])dr[0]);
                                if (geom != null)
                                {
                                    features.Add(geom);
                                }
                            }
                        }
                    }
                    conn.Close();
                }
            }
            return(features);
        }
示例#8
0
 /// <summary>
 /// Returns the geometry corresponding to the Object ID
 /// </summary>
 /// <param name="oid">Object ID</param>
 /// <returns>geometry</returns>
 public SharpMap.Geometries.Geometry GetGeometryByID(uint oid)
 {
     SharpMap.Geometries.Geometry geom = null;
     using (SqlConnection conn = new SqlConnection(_ConnectionString))
     {
         string strSQL = "SELECT ST.AsBinary(" + this.BuildGeometryExpression() + ") AS Geom FROM " + this.Table + " WHERE " + this.ObjectIdColumn + "='" + oid.ToString() + "'";
         conn.Open();
         using (SqlCommand command = new SqlCommand(strSQL, conn))
         {
             using (SqlDataReader dr = command.ExecuteReader())
             {
                 while (dr.Read())
                 {
                     if (dr[0] != DBNull.Value)
                     {
                         geom = SharpMap.Converters.WellKnownBinary.GeometryFromWKB.Parse((byte[])dr[0]);
                     }
                 }
             }
         }
         conn.Close();
     }
     return(geom);
 }
示例#9
0
 public SqlGeometryConverterException(Exception inner, SMGeometry geometry)
     : this("Failed to convert SharpMapGeometry", inner, geometry)
 {
 }
示例#10
0
 public SqlGeometryConverterException(string message, Exception inner, SMGeometry geometry)
     : base(message, inner)
 {
     Geometry = geometry;
 }
示例#11
0
        /// <summary>
        /// Returns the features that intersects with 'geom'
        /// </summary>
        /// <param name="geom"></param>
        /// <param name="ds">FeatureDataSet to fill data into</param>
        public void ExecuteIntersectionQuery(SharpMap.Geometries.Geometry geom, FeatureDataSet ds)
        {
            List <Geometries.Geometry> features = new List <SharpMap.Geometries.Geometry>();

            using (SqlConnection conn = new SqlConnection(this.ConnectionString))
            {
                string strGeom;
                if (this.TargetSRID > 0 && this.SRID > 0 && this.SRID != this.TargetSRID)
                {
                    strGeom = "ST.Transform(ST.GeomFromText('" + geom.AsText() + "'," + this.TargetSRID.ToString() + ")," + this.SRID.ToString() + ")";
                }
                else
                {
                    strGeom = "ST.GeomFromText('" + geom.AsText() + "', " + this.SRID.ToString() + ")";
                }

                string strSQL = "SELECT " + this.FeatureColumns + ", ST.AsBinary(" + this.BuildGeometryExpression() + ") As sharpmap_tempgeometry ";
                strSQL += "FROM ST.RelateQuery" + this.BuildSpatialQuerySuffix() + "(" + strGeom + ", 'intersects')";

                if (!String.IsNullOrEmpty(this.DefinitionQuery))
                {
                    strSQL += " WHERE " + this.DefinitionQuery;
                }

                if (!String.IsNullOrEmpty(this.OrderQuery))
                {
                    strSQL += " ORDER BY " + this.OrderQuery;
                }

                using (SqlDataAdapter adapter = new SqlDataAdapter(strSQL, conn))
                {
                    conn.Open();
                    adapter.Fill(ds);
                    conn.Close();
                    if (ds.Tables.Count > 0)
                    {
                        FeatureDataTable fdt = new FeatureDataTable(ds.Tables[0]);
                        foreach (System.Data.DataColumn col in ds.Tables[0].Columns)
                        {
                            if (col.ColumnName != this.GeometryColumn && !col.ColumnName.StartsWith(this.GeometryColumn + "_Envelope_") && col.ColumnName != "sharpmap_tempgeometry")
                            {
                                fdt.Columns.Add(col.ColumnName, col.DataType, col.Expression);
                            }
                        }
                        foreach (System.Data.DataRow dr in ds.Tables[0].Rows)
                        {
                            SharpMap.Data.FeatureDataRow fdr = fdt.NewRow();
                            foreach (System.Data.DataColumn col in ds.Tables[0].Columns)
                            {
                                if (col.ColumnName != this.GeometryColumn && !col.ColumnName.StartsWith(this.GeometryColumn + "_Envelope_") && col.ColumnName != "sharpmap_tempgeometry")
                                {
                                    fdr[col.ColumnName] = dr[col];
                                }
                            }
                            if (dr["sharpmap_tempgeometry"] != DBNull.Value)
                            {
                                fdr.Geometry = SharpMap.Converters.WellKnownBinary.GeometryFromWKB.Parse((byte[])dr["sharpmap_tempgeometry"]);
                            }
                            fdt.AddRow(fdr);
                        }
                        ds.Tables.Add(fdt);
                    }
                }
            }
        }
示例#12
0
 public SqlGeometryConverterException(SMGeometry geometry)
     : this("Failed to convert SharpMapGeometry", geometry)
 {
     Geometry = geometry;
 }
示例#13
0
 public SharpMap.Data.FeatureDataTable QueryFeatures(SharpMap.Geometries.Geometry geom, double distance)
 {
     throw new NotImplementedException("QueryFeatures is obsolete. Use ExecuteIntersectionQuery.");
 }
示例#14
0
 public SqlGeometryConverterException(string message, Exception inner, SMGeometry geometry)
     : base(message, inner)
 {
     Geometry = geometry;
 }
示例#15
0
        /// <summary>
        /// Returns the features that intersects with 'geom'
        /// </summary>
        /// <param name="geom"></param>
        /// <param name="ds">FeatureDataSet to fill data into</param>
        public void ExecuteIntersectionQuery(SharpMap.Geometries.Geometry geom, FeatureDataSet ds)
        {
            List <Geometries.Geometry> features = new List <SharpMap.Geometries.Geometry>();

            using (SqlConnection conn = new SqlConnection(_ConnectionString))
            {
                //TODO: Convert to SQL Server
                string strGeom = "geography::STGeomFromText('" + geom.AsText() + "', #SRID#)";

                if (this.SRID > 0)
                {
                    strGeom = strGeom.Replace("#SRID#", this.SRID.ToString());
                }
                else
                {
                    strGeom = strGeom.Replace("#SRID#", "0");
                }
                strGeom = this.GeometryColumn + ".STIntersects(" + strGeom + ") = 1";

                string strSQL = "SELECT g.* , g." + this.GeometryColumn + ").STAsBinary() As sharpmap_tempgeometry FROM " + this.Table + " g WHERE ";

                if (!String.IsNullOrEmpty(_defintionQuery))
                {
                    strSQL += this.DefinitionQuery + " AND ";
                }

                strSQL += strGeom;

                using (SqlDataAdapter adapter = new SqlDataAdapter(strSQL, conn))
                {
                    conn.Open();
                    adapter.Fill(ds);
                    conn.Close();
                    if (ds.Tables.Count > 0)
                    {
                        FeatureDataTable fdt = new FeatureDataTable(ds.Tables[0]);
                        foreach (System.Data.DataColumn col in ds.Tables[0].Columns)
                        {
                            if (col.ColumnName != this.GeometryColumn && col.ColumnName != "sharpmap_tempgeometry")
                            {
                                fdt.Columns.Add(col.ColumnName, col.DataType, col.Expression);
                            }
                        }
                        foreach (System.Data.DataRow dr in ds.Tables[0].Rows)
                        {
                            SharpMap.Data.FeatureDataRow fdr = fdt.NewRow();
                            foreach (System.Data.DataColumn col in ds.Tables[0].Columns)
                            {
                                if (col.ColumnName != this.GeometryColumn && col.ColumnName != "sharpmap_tempgeometry")
                                {
                                    fdr[col.ColumnName] = dr[col];
                                }
                            }
                            fdr.Geometry = SharpMap.Converters.WellKnownBinary.GeometryFromWKB.Parse((byte[])dr["sharpmap_tempgeometry"]);
                            fdt.AddRow(fdr);
                        }
                        ds.Tables.Add(fdt);
                    }
                }
            }
        }
示例#16
0
 /// <summary>
 /// Converts any <see cref=GisSharpBlog.NetTopologySuite.Geometries.Geometry"/> array to the correspondant 
 /// <see cref="SharpMap.Geometries.Geometry"/> array.
 /// </summary>
 /// <param name="geometries"></param>
 /// <returns></returns>
 public static SharpMap.Geometries.Geometry[] ToSharpMapGeometry(GisSharpBlog.NetTopologySuite.Geometries.Geometry[] geometries)
 {
     SharpMap.Geometries.Geometry[] converted = new SharpMap.Geometries.Geometry[geometries.Length];
     int index = 0;
     foreach (GisSharpBlog.NetTopologySuite.Geometries.Geometry geometry in geometries)
         converted[index++] = GeometryConverter.ToSharpMapGeometry(geometry);
     if ((geometries.Length != converted.Length))
         throw new ApplicationException("Conversion error");
     return converted;
        
 }
示例#17
0
        private string GetMapJson(DataTable data)
        {
            var    connectionCredentials = new bv.common.Configuration.ConnectionCredentials();
            string connection            = connectionCredentials.ConnectionString;

            var column = new DataColumn {
                DataType = typeof(SqlGeometry), ColumnName = "geom"
            };

            data.Columns.Add(column);

            var    sqlConnection = new SqlConnection(connection); sqlConnection.Open();
            string lTableName    = CoordinatesUtils.GetWKBTableName(data, connection);

            const int srid  = 4326;
            string    ratio = "0"; // Settlement

            if (lTableName == "gisWKBRegion")
            {
                ratio = "50";
            }
            if ((lTableName == "gisWKBRayon") || (lTableName == "gisWKBDistrict"))
            {
                ratio = "100";
            }

            string strIds = string.Empty;

            if (data.Rows.Count > 0)
            {
                strIds = String.Join(",", data.AsEnumerable().Select(x => x.Field <long>("id").ToString()).ToArray());
                strIds = string.Format("idfsGeoObject in ({0}) and ", strIds);
                if ((data.PrimaryKey == null) || (data.PrimaryKey.Length == 0))
                {
                    var key = new DataColumn[1];
                    key[0]          = data.Columns["id"];
                    data.PrimaryKey = key;
                }

                try // Try get it from precached table geomShape_4326
                {
                    string strBatchSql = "SELECT g.idfsGeoObject as id, g.geomShape_4326 as geom FROM " + lTableName + "Ready g WHERE " + strIds + " Ratio = " + ratio;
                    var    cmdBatch    = new SqlCommand(strBatchSql, sqlConnection);
                    using (SqlDataReader dr = cmdBatch.ExecuteReader())
                    {
                        var resBatch = new DataTable();

                        resBatch.Load(dr);
                        if ((resBatch != null) && resBatch.Rows.Count > 0)
                        {
                            if ((resBatch.PrimaryKey == null) || (resBatch.PrimaryKey.Length == 0))
                            {
                                var resBatchKey = new DataColumn[1];
                                resBatchKey[0]      = resBatch.Columns["id"];
                                resBatch.PrimaryKey = resBatchKey;
                            }

                            data.Merge(resBatch, false, MissingSchemaAction.Ignore);
                        }
                    }
                }
                catch (Exception /*ex*/) { /*var strErr = ex.Message;*/ }

                foreach (var rEmptyGeom in data.Select("geom is null"))
                {
                    SharpMap.Geometries.Geometry feature = null;

                    long id = 0;
                    if (rEmptyGeom["id"].ToString() != "")
                    {
                        id = Int64.Parse(rEmptyGeom["id"].ToString());
                    }

                    // Try get it as usual
                    feature = Extents.GetGeomById(sqlConnection, lTableName, id);
                    if (feature != null)
                    {
                        feature = GeometryTransform.TransformGeometry(feature, GIS_V4.Common.CoordinateSystems.SphericalMercatorCS, GIS_V4.Common.CoordinateSystems.WGS84);
                        var wktGeometry = new System.Data.SqlTypes.SqlChars(feature.AsText());
                        rEmptyGeom["geom"] = SqlGeometry.STGeomFromText(wktGeometry, srid);
                    }

                    if (feature != null)
                    {
                        SharpMap.Geometries.Point point = feature.GetBoundingBox().GetCentroid();
                        rEmptyGeom["x"] = point.X;
                        rEmptyGeom["y"] = point.Y;
                    }
                    else
                    {
                        double x, y;
                        if (CoordinatesUtils.GetAdminUnitCoordinates(connection, id, out x, out y))
                        {
                            rEmptyGeom["x"] = x;
                            rEmptyGeom["y"] = y;
                        }
                    }
                }
            }

            sqlConnection.Close();

            var ds = new DataSet();

            ds.Tables.Add(data.Copy());

            string json = GeoJSON.DataSetToJSON(ds);

            json = json.Replace("\\r\\n", " ");

            return(json);
        }
示例#18
0
        public ActionResult Index(long layoutId)
        {
            var    connectionCredentials = new bv.common.Configuration.ConnectionCredentials();
            string connection            = connectionCredentials.ConnectionString;

            AvrServiceAccessability access = AvrServiceAccessability.Check();

            if (!access.IsOk)
            {
                return(View("AvrServiceError", (object)access.ErrorMessage));
            }

            return(ObjectStorage.Using <AvrPivotViewModel, ActionResult>(viewModel =>
            {
                ViewBag.Title = string.Format(Translator.GetMessageString("webMapTitle"), viewModel.ViewHeader.LayoutName);

                // have we anything selected in combo admin unit?
                if (!string.IsNullOrEmpty(viewModel.ViewHeader.MapAdminUnitViewColumn))
                {
                    DataSet dataSet;
                    string error = ChartMapHelper.TryToPrepareMapData(viewModel, out dataSet);
                    if (error.Length > 0)
                    {
                        return View("AvrServiceError", (object)error);
                    }

                    //TEST
                    for (int j = 0; j < dataSet.Tables[1].Rows.Count; j++)
                    {
                        string c_name = dataSet.Tables[1].Rows[j]["ColumnName"].ToString();
                        string c_new_name = dataSet.Tables[1].Rows[j]["ColumnDescription"].ToString();
                        c_new_name = c_new_name.TrimStart(); // Spaces in column name, comes outside
                        dataSet.Tables[0].Columns[c_name].ColumnName = c_new_name;
                    }

                    SharpMap.Rendering.Thematics.ITheme gradLayerTheme;
                    SharpMap.Rendering.Thematics.ITheme chartLayerTheme;
                    string gradLayerName, chartLayerName;
                    gis.GisInterface.GetAvrStyles(layoutId, out gradLayerName, out gradLayerTheme, out chartLayerName, out chartLayerTheme);

                    if (chartLayerTheme is GIS_V4.Rendering.BarChartTheme)
                    {
                        var chart_theme = (GIS_V4.Rendering.BarChartTheme)chartLayerTheme;
                        string chart_style = "{\"BarCharts\" : [";
                        for (int j = 0; j < chart_theme.BarChartItems.Count; j++)
                        {
                            var c_column = chart_theme.BarChartItems[j].ColumnName;
                            var c_color = HexConverter(chart_theme.BarChartItems[j].Color);
                            chart_style += '{' + string.Format("\"title\":\"{0}\", \"color\":\"{1}\"", c_column, c_color) + '}' + ", ";
                        }
                        chart_style += "]}";
                        chart_style = chart_style.Replace(", ]", "]");
                        ViewBag.chart_style = new HtmlString(chart_style);
                    }

                    if (gradLayerTheme is GIS_V4.Rendering.GradientTheme)
                    {
                        GIS_V4.Rendering.GradientTheme grad_theme = (GIS_V4.Rendering.GradientTheme)gradLayerTheme;
                        string min_value = grad_theme.Min.ToString();
                        string max_value = grad_theme.Max.ToString();

                        System.Drawing.SolidBrush min_brush = (System.Drawing.SolidBrush)((SharpMap.Styles.VectorStyle)grad_theme.MinStyle).Fill;
                        string min_r = min_brush.Color.R.ToString();
                        string min_g = min_brush.Color.G.ToString();
                        string min_b = min_brush.Color.B.ToString();

                        System.Drawing.SolidBrush max_brush = (System.Drawing.SolidBrush)((SharpMap.Styles.VectorStyle)grad_theme.MaxStyle).Fill;
                        string max_r = max_brush.Color.R.ToString();
                        string max_g = max_brush.Color.G.ToString();
                        string max_b = max_brush.Color.B.ToString();

                        ViewBag.grad_style = new HtmlString("{" + string.Format("\"type\":\"gradient\", \"min_value\":{0}, \"max_value\":{1}, \"min_color\":[{2}, {3}, {4}], \"max_color\":[{5}, {6}, {7}]", min_value, max_value, min_r, min_g, min_b, max_r, max_g, max_b) + "}");
                    }

                    if (gradLayerTheme is GIS_V4.Rendering.GraduatedTheme)
                    {
                        dataSet.Tables[0].Columns.Add("color");
                        dataSet.Tables[0].Columns.Add("symbol");


                        string grad_style = "{\"type\":\"graduated\", \"legend\" : [";
                        GIS_V4.Rendering.GraduatedTheme grad_theme = (GIS_V4.Rendering.GraduatedTheme)gradLayerTheme;
                        for (int i = 0; i < grad_theme.Rules.Count; i++)
                        {
                            string value_title = ((GIS_V4.Rendering.GraduatedTheme)gradLayerTheme).Rules[i].Title;
                            System.Drawing.SolidBrush value_brush = (System.Drawing.SolidBrush)((SharpMap.Styles.VectorStyle)grad_theme.Rules[i].Style).Fill;
                            var val_color = HexConverter(value_brush.Color);
                            var val_symbol = ((SharpMap.Styles.VectorStyle)grad_theme.Rules[i].Style).SymbolId;

                            grad_style += '{' + string.Format("\"title\":\"{0}\", \"color\":\"{1}\", \"symbol\":\"{2}\"", value_title, val_color, val_symbol) + '}' + ", ";

                            var dataView = dataSet.DefaultViewManager.CreateDataView(dataSet.Tables[0]);
                            dataView.RowFilter = grad_theme.Rules[i].Condition;
                            for (int j = 0; j < dataView.Count; j++)
                            {
                                dataView[j].Row["color"] = val_color;
                                dataView[j].Row["symbol"] = val_symbol;
                            }
                        }
                        grad_style += "]}";
                        grad_style = grad_style.Replace(", ]", "]");
                        ViewBag.grad_style = new HtmlString(grad_style);
                    }


                    // Space in column fix
                    for (int j = 0; j < dataSet.Tables[1].Rows.Count; j++)
                    {
                        string c_new_name = dataSet.Tables[1].Rows[j]["ColumnDescription"].ToString();
                        c_new_name = c_new_name.TrimStart(); // Spaces in column name, comes outside
                        dataSet.Tables[0].Columns[c_new_name].ColumnName = c_new_name.TrimStart();
                        dataSet.Tables[1].Rows[j]["ColumnDescription"] = c_new_name.TrimStart();
                    }

                    using (var sqlConnection = new SqlConnection(connection))
                    {
                        try
                        {
                            sqlConnection.Open();
                            var CountryID = EidssSiteContext.Instance.CountryID;
                            SharpMap.Geometries.Geometry feature = Extents.GetGeomById(sqlConnection, "gisWKBCountry", CountryID);
                            if (feature != null)
                            {
                                feature = GeometryTransform.TransformGeometry(feature, GIS_V4.Common.CoordinateSystems.SphericalMercatorCS, GIS_V4.Common.CoordinateSystems.WGS84);
                            }
                            SharpMap.Geometries.Point center_point = feature.GetBoundingBox().GetCentroid();
                            ViewBag.county_lon = center_point.X;
                            ViewBag.county_lat = center_point.Y;
                        }
                        catch (Exception)
                        {
                            ViewBag.county_lon = 0;
                            ViewBag.county_lat = 0;
                        }
                    }
                    //TEST

                    if (error.Length == 0)
                    {
                        var ds = new DataSet();
                        ds.Tables.Add(dataSet.Tables[1].Copy());
                        string json = GeoJSON.DataSetToJSON(ds);
                        string avr_json = GeoJSON.DataSetToJSON(ds);
                        ViewBag.avr_json = new HtmlString(avr_json);

                        string map_json = GetMapJson(dataSet.Tables[0]);
                        ViewBag.map_json = new HtmlString(map_json);
                        ViewBag.ColumnName = new HtmlString(dataSet.Tables[1].Rows[0].ItemArray[1].ToString());
                        ViewBag.ColumnDescription = new HtmlString(dataSet.Tables[1].Rows[0].ItemArray[1].ToString());
                        ViewBag.blnIsGradient = new HtmlString(dataSet.Tables[1].Rows[0].ItemArray[2].ToString());
                        ViewBag.gradLayerName = new HtmlString(gradLayerName);
                        ViewBag.chartLayerName = new HtmlString(chartLayerName);
                        ViewBag.blnIsChart = new HtmlString(dataSet.Tables[1].Rows[0].ItemArray[3].ToString());
                        ViewBag.map_localurl = Config.GetSetting("MapLocalUrl");
                        if (CultureInfo.CurrentUICulture.TextInfo.IsRightToLeft)
                        {
                            ViewBag.left2right = 1;
                        }
                        else
                        {
                            ViewBag.left2right = 0;
                        }

                        return View("Index", dataSet);
                    }
                    return View("AvrServiceError", (object)error);
                }
                return View();
            }, Session.SessionID, layoutId, ViewLayoutController.StoragePrefix));
        }
示例#19
0
 public SqlGeometryConverterException(SMGeometry geometry)
     :this("Failed to convert SharpMapGeometry", geometry)
 {
     Geometry = geometry;
 }
示例#20
0
        /// <summary>
        /// Returns the features that intersects with 'geom'
        /// </summary>
        /// <param name="geom"></param>
        /// <param name="ds">FeatureDataSet to fill data into</param>
        public void ExecuteIntersectionQuery(SharpMap.Geometries.Geometry geom, FeatureDataSet ds)
        {
            List <Geometries.Geometry> features = new List <SharpMap.Geometries.Geometry>();

            using (OracleConnection conn = new OracleConnection(_ConnectionString))
            {
                string strGeom = "MDSYS.SDO_GEOMETRY('" + geom.AsText() + "', #SRID#)";

                if (this.SRID > 0)
                {
                    strGeom = strGeom.Replace("#SRID#", this.SRID.ToString(Map.numberFormat_EnUS));
                }
                else
                {
                    strGeom = strGeom.Replace("#SRID#", "NULL");
                }

                strGeom = "SDO_RELATE(g." + this.GeometryColumn + ", " + strGeom + ", 'mask=ANYINTERACT querytype=WINDOW') = 'TRUE'";

                string strSQL = "SELECT g.* , g." + this.GeometryColumn + ").Get_WKB() As sharpmap_tempgeometry FROM " + this.Table + " g WHERE ";

                if (!String.IsNullOrEmpty(_defintionQuery))
                {
                    strSQL += this.DefinitionQuery + " AND ";
                }

                strSQL += strGeom;

                using (OracleDataAdapter adapter = new OracleDataAdapter(strSQL, conn))
                {
                    conn.Open();
                    adapter.Fill(ds);
                    conn.Close();
                    if (ds.Tables.Count > 0)
                    {
                        FeatureDataTable fdt = new FeatureDataTable(ds.Tables[0]);
                        foreach (System.Data.DataColumn col in ds.Tables[0].Columns)
                        {
                            if (col.ColumnName != this.GeometryColumn && col.ColumnName != "sharpmap_tempgeometry")
                            {
                                fdt.Columns.Add(col.ColumnName, col.DataType, col.Expression);
                            }
                        }
                        foreach (System.Data.DataRow dr in ds.Tables[0].Rows)
                        {
                            SharpMap.Data.FeatureDataRow fdr = fdt.NewRow();
                            foreach (System.Data.DataColumn col in ds.Tables[0].Columns)
                            {
                                if (col.ColumnName != this.GeometryColumn && col.ColumnName != "sharpmap_tempgeometry")
                                {
                                    fdr[col.ColumnName] = dr[col];
                                }
                            }
                            fdr.Geometry = SharpMap.Converters.WellKnownBinary.GeometryFromWKB.Parse((byte[])dr["sharpmap_tempgeometry"]);
                            fdt.AddRow(fdr);
                        }
                        ds.Tables.Add(fdt);
                    }
                }
            }
        }
示例#21
0
 public FeatureDataTable QueryFeatures(SharpMap.Geometries.Geometry geom, double distance)
 {
     throw new NotImplementedException();
 }
示例#22
0
 public static SqlGeometry ToSqlServerGeometry(SMGeometry smGeometry)
 {
     SqlGeometryBuilder builder = new SqlGeometryBuilder();
     SharpMapGeometryToSqlGeometry(builder, smGeometry);
     return builder.ConstructedGeometry;
 }
示例#23
0
 public SqlGeometryConverterException(Exception inner, SMGeometry geometry)
     : this("Failed to convert SharpMapGeometry", inner, geometry)
 {
 }
        /// <summary>
        /// This method returns a FeatureDataTable containing all the rows from the shapefile that intersect the testGeometry.
        /// The ShapeFile.ExecuteIntersectionQuery method only tests bounding boxes so we use the FilterDelegate property to add a true
        /// intersection test using NetTopologySuite
        /// </summary>
        /// <param name="pathToShapefile">The path to the shapefile</param>
        /// <param name="testGeometry">The geometry that we want to test against</param>
        /// <returns></returns>
        public FeatureDataTable GetIntersectingFeaturesUsingFilterDelegate(string pathToShapefile, SMGeometry testGeometry)
        {
            //create a new shapefile provider
            using (ShapeFile shapefile = new ShapeFile(pathToShapefile))
            {
                //create an nts GeometryFactory
                GeometryFactory geometryFactory = new GeometryFactory();

                //convert the testGeometry into the equivalent NTS geometry
                GeoAPI.Geometries.IGeometry testGeometryAsNtsGeom = GeometryConverter.ToNTSGeometry(testGeometry, geometryFactory);

                SMGeometry check = GeometryConverter.ToSharpMapGeometry(testGeometryAsNtsGeom);
                if (!check.Equals(testGeometry))
                {
                    throw new ApplicationException("conversion error");
                }

                //set the shapefile providers' FilterDelegate property to a new anonymous method
                //this delegate method will be called for each potential row
                shapefile.FilterDelegate = delegate(FeatureDataRow featureDataRow)
                {
                    //get the geometry from the featureDataRow
                    SMGeometry rowGeometry = featureDataRow.Geometry;
                    //convert it to the equivalent NTS geometry
                    GeoAPI.Geometries.IGeometry compareGeometryAsNtsGeometry =
                        GeometryConverter.ToNTSGeometry(rowGeometry, geometryFactory);
                    //do the test. Note that the testGeometryAsNtsGeometry is available here because it is
                    //declared in the same scope as the anonymous method.
                    bool intersects =
                        testGeometryAsNtsGeom.Intersects(compareGeometryAsNtsGeometry);
                    //return the result
                    return(intersects);
                };


                //create a new FeatureDataSet
                FeatureDataSet featureDataSet = new FeatureDataSet();
                //open the shapefile
                shapefile.Open();
                //call ExecuteIntersectionQuery. The FilterDelegate will be used to limit the result set
                shapefile.ExecuteIntersectionQuery(testGeometry, featureDataSet);
                //close the shapefile
                shapefile.Close();
                //return the populated FeatureDataTable
                return(featureDataSet.Tables[0]);
            }
        }
        /// <summary>
        /// This method takes a pre-populated FeatureDataTable and removes rows that do not truly intersect testGeometry
        /// </summary>
        /// <param name="featureDataTable">The FeatureDataTable instance to filter</param>
        /// <param name="testGeometry">the geometry to compare against</param>
        public void PostFilterExistingFeatureDataTable(FeatureDataTable featureDataTable, SMGeometry testGeometry)
        {
            //first we create a new GeometryFactory.
            var geometryFactory = new GeometryFactory();


            //then we convert the testGeometry into the equivalent NTS geometry
            GeoAPI.Geometries.IGeometry testGeometryAsNtsGeom = GeometryConverter.ToNTSGeometry(testGeometry, geometryFactory);


            //now we loop backwards through the FeatureDataTable
            for (int i = featureDataTable.Rows.Count - 1; i > -1; i--)
            {
                //we get each row
                FeatureDataRow featureDataRow = featureDataTable.Rows[i] as FeatureDataRow;
                //and get the rows' geometry
                SMGeometry compareGeometry = featureDataRow.Geometry;
                //convert the rows' geometry into the equivalent NTS geometry
                GeoAPI.Geometries.IGeometry compareGeometryAsNts = GeometryConverter.ToNTSGeometry(compareGeometry, geometryFactory);
                //now test for intesection (note other operations such as Contains, Within, Disjoint etc can all be done the same way)
                bool intersects = testGeometryAsNtsGeom.Intersects(compareGeometryAsNts);

                //if it doesn't intersect remove the row.
                if (!intersects)
                {
                    featureDataTable.Rows.RemoveAt(i);
                }
            }
        }
示例#26
0
 /// <summary>
 /// Sets the geometry column to null
 /// </summary>
 public void SetFeatureGeometryNull()
 {
     this.Geometry = null;
 }
示例#27
0
        public override void Render(System.Drawing.Graphics g, Map map)
        {
            if (this.Style.Enabled && this.Style.MaxVisible >= map.Zoom && this.Style.MinVisible < map.Zoom)
            {
                if (this.DataSource == null)
                {
                    throw (new ApplicationException("DataSource property not set on layer '" + this.LayerName + "'"));
                }
                g.TextRenderingHint = this.TextRenderingHint;
                g.SmoothingMode     = this.SmoothingMode;

                SharpMap.Geometries.BoundingBox envelope = map.Envelope; //View to render
                if (this.CoordinateTransformation != null)
                {
                    envelope = SharpMap.CoordinateSystems.Transformations.GeometryTransform.TransformBox(envelope, this.CoordinateTransformation.MathTransform.Inverse());
                }

                SharpMap.Data.FeatureDataSet ds = new SharpMap.Data.FeatureDataSet();
                this.DataSource.Open();
                this.DataSource.ExecuteIntersectionQuery(envelope, ds);
                this.DataSource.Close();
                if (ds.Tables.Count == 0)
                {
                    base.Render(g, map);
                    return;
                }
                SharpMap.Data.FeatureDataTable features = (SharpMap.Data.FeatureDataTable)ds.Tables[0];

                //Initialize label collection
                List <Rendering.Label> labels = new List <SharpMap.Rendering.Label>();

                //List<System.Drawing.Rectangle> LabelBoxes; //Used for collision detection
                //Render labels
                for (int i = 0; i < features.Count; i++)
                {
                    SharpMap.Data.FeatureDataRow feature = features[i];
                    if (this.CoordinateTransformation != null)
                    {
                        features[i].Geometry = SharpMap.CoordinateSystems.Transformations.GeometryTransform.TransformGeometry(features[i].Geometry, this.CoordinateTransformation.MathTransform);
                    }

                    SharpMap.Styles.LabelStyle style = null;
                    if (this.Theme != null) //If thematics is enabled, lets override the style
                    {
                        style = this.Theme.GetStyle(feature) as SharpMap.Styles.LabelStyle;
                    }
                    else
                    {
                        style = this.Style;
                    }

                    float rotation = 0;
                    if (!String.IsNullOrEmpty(this.RotationColumn))
                    {
                        float.TryParse(feature[this.RotationColumn].ToString(), System.Globalization.NumberStyles.Any, SharpMap.Map.numberFormat_EnUS, out rotation);
                    }

                    string text;
                    if (_getLabelMethod != null)
                    {
                        text = _getLabelMethod(feature);
                    }
                    else
                    {
                        text = feature[this.LabelColumn].ToString();
                    }

                    if (text != null && text != String.Empty)
                    {
                        if (feature.Geometry is SharpMap.Geometries.GeometryCollection)
                        {
                            if (this.MultipartGeometryBehaviour == MultipartGeometryBehaviourEnum.All)
                            {
                                foreach (SharpMap.Geometries.Geometry geom in (feature.Geometry as Geometries.GeometryCollection))
                                {
                                    SharpMap.Rendering.Label lbl = CreateLabel(geom, text, rotation, style, map, g);
                                    if (lbl != null)
                                    {
                                        labels.Add(lbl);
                                    }
                                }
                            }
                            else if (this.MultipartGeometryBehaviour == MultipartGeometryBehaviourEnum.CommonCenter)
                            {
                                SharpMap.Rendering.Label lbl = CreateLabel(feature.Geometry, text, rotation, style, map, g);
                                if (lbl != null)
                                {
                                    labels.Add(lbl);
                                }
                            }
                            else if (this.MultipartGeometryBehaviour == MultipartGeometryBehaviourEnum.First)
                            {
                                if ((feature.Geometry as Geometries.GeometryCollection).Collection.Count > 0)
                                {
                                    SharpMap.Rendering.Label lbl = CreateLabel((feature.Geometry as Geometries.GeometryCollection).Collection[0], text, rotation, style, map, g);
                                    if (lbl != null)
                                    {
                                        labels.Add(lbl);
                                    }
                                }
                            }
                            else if (this.MultipartGeometryBehaviour == MultipartGeometryBehaviourEnum.Largest)
                            {
                                Geometries.GeometryCollection coll = (feature.Geometry as Geometries.GeometryCollection);
                                if (coll.NumGeometries > 0)
                                {
                                    double largestVal   = 0;
                                    int    idxOfLargest = 0;
                                    for (int j = 0; j < coll.NumGeometries; j++)
                                    {
                                        SharpMap.Geometries.Geometry geom = coll.Geometry(j);
                                        if (geom is Geometries.LineString && ((Geometries.LineString)geom).Length > largestVal)
                                        {
                                            largestVal   = ((Geometries.LineString)geom).Length;
                                            idxOfLargest = j;
                                        }
                                        if (geom is Geometries.MultiLineString && ((Geometries.MultiLineString)geom).Length > largestVal)
                                        {
                                            largestVal   = ((Geometries.LineString)geom).Length;
                                            idxOfLargest = j;
                                        }
                                        if (geom is Geometries.Polygon && ((Geometries.Polygon)geom).Area > largestVal)
                                        {
                                            largestVal   = ((Geometries.Polygon)geom).Area;
                                            idxOfLargest = j;
                                        }
                                        if (geom is Geometries.MultiPolygon && ((Geometries.MultiPolygon)geom).Area > largestVal)
                                        {
                                            largestVal   = ((Geometries.MultiPolygon)geom).Area;
                                            idxOfLargest = j;
                                        }
                                    }

                                    SharpMap.Rendering.Label lbl = CreateLabel(coll.Geometry(idxOfLargest), text, rotation, style, map, g);
                                    if (lbl != null)
                                    {
                                        labels.Add(lbl);
                                    }
                                }
                            }
                        }
                        else
                        {
                            SharpMap.Rendering.Label lbl = CreateLabel(feature.Geometry, text, rotation, style, map, g);
                            if (lbl != null)
                            {
                                labels.Add(lbl);
                            }
                        }
                    }
                }
                if (labels.Count > 0) //We have labels to render...
                {
                    if (this.Style.CollisionDetection && this._LabelFilter != null)
                    {
                        this._LabelFilter(labels);
                    }
                    for (int i = 0; i < labels.Count; i++)
                    {
                        SharpMap.Rendering.VectorRenderer.DrawLabel(g, labels[i].LabelPoint, labels[i].Style.Offset, labels[i].Style.Font, labels[i].Style.ForeColor, labels[i].Style.BackColor, Style.Halo, labels[i].Rotation, labels[i].Text, map);
                    }
                }
                labels = null;
            }
            base.Render(g, map);
        }
示例#28
0
        /// <summary>
        /// Converts any <see cref=GisSharpBlog.NetTopologySuite.Geometries.Geometry"/> to the correspondant
        /// <see cref="SharpMap.Geometries.Geometry"/>.
        /// </summary>
        /// <param name="geometry"></param>
        /// <returns></returns>
        public static GisSharpBlog.NetTopologySuite.Geometries.Geometry ToNTSGeometry(SharpMap.Geometries.Geometry geometry,
                                                                                      GisSharpBlog.NetTopologySuite.Geometries.GeometryFactory factory)
        {
            if (geometry == null)
            {
                throw new NullReferenceException("geometry");
            }

            if (geometry.GetType() == typeof(SharpMap.Geometries.Point))
            {
                return(ToNTSPoint(geometry as SharpMap.Geometries.Point, factory));
            }

            else if (geometry.GetType() == typeof(SharpMap.Geometries.LineString))
            {
                return(ToNTSLineString(geometry as SharpMap.Geometries.LineString, factory));
            }

            else if (geometry.GetType() == typeof(SharpMap.Geometries.Polygon))
            {
                return(ToNTSPolygon(geometry as SharpMap.Geometries.Polygon, factory));
            }

            else if (geometry.GetType() == typeof(SharpMap.Geometries.MultiPoint))
            {
                return(ToNTSMultiPoint(geometry as SharpMap.Geometries.MultiPoint, factory));
            }

            else if (geometry.GetType() == typeof(SharpMap.Geometries.MultiLineString))
            {
                return(ToNTSMultiLineString(geometry as SharpMap.Geometries.MultiLineString, factory));
            }

            else if (geometry.GetType() == typeof(SharpMap.Geometries.MultiPolygon))
            {
                return(ToNTSMultiPolygon(geometry as SharpMap.Geometries.MultiPolygon, factory));
            }

            else if (geometry.GetType() == typeof(SharpMap.Geometries.GeometryCollection))
            {
                return(ToNTSGeometryCollection(geometry as SharpMap.Geometries.GeometryCollection, factory));
            }

            else
            {
                throw new NotSupportedException("Type " + geometry.GetType().FullName + " not supported");
            }
        }
示例#29
0
        private static void SharpMapGeometryToSqlGeometry(SqlGeometryBuilder geomBuilder, SMGeometry smGeometry)
        {
            switch (smGeometry.GeometryType)
            {
            case SMGeometryType.Point:
                SharpMapPointToSqlGeometry(geomBuilder, smGeometry as SMPoint);
                break;

            case SMGeometryType.LineString:
                SharpMapLineStringToSqlGeometry(geomBuilder, smGeometry as SMLineString);
                break;

            case SMGeometryType.Polygon:
                SharpMapPolygonToSqlGeometry(geomBuilder, smGeometry as SMPolygon);
                break;

            case SMGeometryType.MultiPoint:
                SharpMapMultiPointToSqlGeometry(geomBuilder, smGeometry as SMMultiPoint);
                break;

            case SMGeometryType.MultiLineString:
                SharpMapMultiLineStringToSqlGeometry(geomBuilder, smGeometry as SMMultiLineString);
                break;

            case SMGeometryType.MultiPolygon:
                SharpMapMultiPolygonToSqlGeometry(geomBuilder, smGeometry as SMMultiPolygon);
                break;

            case SMGeometryType.GeometryCollection:
                SharpMapGeometryCollectionToSqlGeometry(geomBuilder, smGeometry as SMGeometryCollection);
                break;

            default:
                throw new ArgumentException(
                          String.Format("Cannot convert '{0}' geometry type", smGeometry.GeometryType), "smGeometry");
            }
        }
示例#30
0
 /// <summary>
 /// Returns the data associated with all the geometries that are intersected by 'geom'
 /// </summary>
 /// <param name="geom">Geometry to intersect with</param>
 /// <param name="ds">FeatureDataSet to fill data into</param>
 public void ExecuteIntersectionQuery(SharpMap.Geometries.Geometry geom, FeatureDataSet ds)
 {
     throw new NotImplementedException();
 }
示例#31
0
 public void ExecuteIntersectionQuery(SharpMap.Geometries.Geometry geom, SharpMap.Data.FeatureDataSet ds)
 {
     ExecuteIntersectionQuery(geom.GetBoundingBox(), ds);
 }