I have created a FeatureSource.GetFeaturesInsideBoundingBoxCore override using the ExtendingMapSuiteFeatureSource sample solution. I can create features from PointShapes and from RectangleShapes, but the features I create from PolygonShapes do not display.
For the sake of argument, I use the same records from the database to create the PointShape, RectangleShape and PolygonShape features. The data looks like so:
service_area
service_area_id
area_name
minim_long_nbr
minim_lat_nbr
maxim_long_nbr
maxim_lat_nbr
428
West Palm Beach
-80.17157
26.78963
-79.95124
26.93378
My code appears below. The same record is used to create the polygon, rectangle and point. I can comment out the code blocks one at a time, to demonstrate that features display in the map only for the point and rectangle, and not the polygon. I am sure the problem lies with the way I declare the vertices and construct the polygon from them, but can not be sure. Your advice is appreciated.
{
protected override Collection<Feature> GetFeaturesInsideBoundingBoxCore(RectangleShape boundingBox,
IEnumerable<string> returningColumnNames)Collection<Feature> returnFeatures = new Collection<Feature>();
try
{
boundingBox.UpperLeftPoint.Y, boundingBox.LowerRightPoint.Y);
DataTable dt = Data.Regions.GetRegions(boundingBox.LowerRightPoint.X, boundingBox.UpperLeftPoint.X,
{
pointShapes.Add(
pointShapes.Add(
pointShapes.Add(
pointShapes.Add(
pointShapes.Add(
polygonShape.Id = service_area_id +
{
{
feature.ColumnValues.Add(dc.ColumnName,
}
}
returnFeatures.Add(feature);
rectangleShape.Id = polygonShape.Id +
feature = rectangleShape.GetFeature();
{
{
feature.ColumnValues.Add(dc.ColumnName,
}
}
returnFeatures.Add(feature);
pointShape.Id = service_area_id +
feature = pointShape.GetFeature();
{
{
feature.ColumnValues.Add(dc.ColumnName,
}
}
returnFeatures.Add(feature);
}
}
{
}
boundingBox.ToString()));
}
foreach(DataRow dr in dt.Rows)double minim_long_nbr = Convert.ToDouble(dr["minim_long_nbr"]);double maxim_long_nbr = Convert.ToDouble(dr["maxim_long_nbr"]);double minim_lat_nbr = Convert.ToDouble(dr["minim_lat_nbr"]);double maxim_lat_nbr = Convert.ToDouble(dr["maxim_lat_nbr"]);string service_area_id = Convert.ToString(dr["service_area_id"]);string area_name = Convert.ToString(dr["area_name"]);EllipseShape es = new EllipseShape(new PointShape(minim_long_nbr, minim_lat_nbr), 400, GeographyUnit.DecimalDegree, DistanceUnit.Feet);RectangleShape rectangleShape = es.GetBoundingBox();List<Vertex> pointShapes = new List<Vertex>();new Vertex(rectangleShape.UpperLeftPoint));new Vertex(rectangleShape.UpperRightPoint));new Vertex(rectangleShape.LowerLeftPoint));new Vertex(rectangleShape.LowerRightPoint));new Vertex(es.Center));RingShape ringShape = new RingShape(pointShapes);PolygonShape polygonShape = new PolygonShape(ringShape);"x";Feature feature = polygonShape.GetFeature();foreach(DataColumn dc in dt.Columns)if (!dr.IsNull(dc))Convert.ToString(dr[dc]));"y";foreach(DataColumn dc in dt.Columns)if (!dr.IsNull(dc))Convert.ToString(dr[dc]));PointShape pointShape = new PointShape(minim_long_nbr, minim_lat_nbr);"z";foreach (DataColumn dc in dt.Columns)if (!dr.IsNull(dc))Convert.ToString(dr[dc]));catch(Exception ex)Debug.WriteLine(ex.ToString());Debug.WriteLine(String.Format("Found {0} items in {1} bounding box", returnFeatures.Count, return returnFeatures;