/// <summary> /// Creates a new grid cell result. /// </summary> /// <param name="gridCell">The grid cell object returned from web service.</param> public static WfsStatisticsGridCellResult Create(IGridCellFeatureStatistics gridCell) { var model = new WfsStatisticsGridCellResult(); //model.WestSouthCoordinate = new double[] { gridCell.GridCellCentreCoordinate.X - gridCell.GridCellSize, gridCell.GridCellCentreCoordinate.Y - gridCell.GridCellSize }; //model.EastNorthCoordinate = new double[] { gridCell.GridCellCentreCoordinate.X + gridCell.GridCellSize, gridCell.GridCellCentreCoordinate.Y + gridCell.GridCellSize }; //model.WestSouthCoordinate = new double[] { gridCell.GridCellBoundingBox.LinearRings[0].Points[0].X, gridCell.GridCellBoundingBox.LinearRings[0].Points[0].Y }; //model.EastNorthCoordinate = new double[] { gridCell.GridCellBoundingBox.LinearRings[0].Points[2].X, gridCell.GridCellBoundingBox.LinearRings[0].Points[2].Y }; model.BoundingBox = new double[4][]; for (int i = 0; i < 4; i++) { IPoint point = gridCell.GridCellBoundingBox.LinearRings[0].Points[i]; model.BoundingBox[i] = new[] { point.X, point.Y }; } model.CentreCoordinateX = gridCell.GridCellCentreCoordinate.X; model.CentreCoordinateY = gridCell.GridCellCentreCoordinate.Y; model.OriginalCentreCoordinateX = gridCell.OrginalGridCellCentreCoordinate.X; model.OriginalCentreCoordinateY = gridCell.OrginalGridCellCentreCoordinate.Y; model.FeatureCount = gridCell.FeatureCount; model.FeatureArea = gridCell.FeatureArea; model.FeatureLength = gridCell.FeatureLength; return(model); }
/// <summary> /// Creates a Grid statistics result object. /// </summary> /// <param name="cells">Grid statistics cell list returned from web service.</param> /// <returns></returns> public static WfsStatisticsGridResult Create(List <IGridCellFeatureStatistics> cells) { var model = new WfsStatisticsGridResult(); model.Cells = new List <WfsStatisticsGridCellResult>(); model.GridCellCoordinateSystem = ""; if (cells == null || cells.Count == 0) { return(model); } model.GridCellSize = cells[0].GridCellSize; model.GridCellCoordinateSystemId = (int)cells[0].GridCoordinateSystem; model.GridCellCoordinateSystem = cells[0].GridCoordinateSystem.ToString(); foreach (IGridCellFeatureStatistics gridCell in cells) { model.Cells.Add(WfsStatisticsGridCellResult.Create(gridCell)); } return(model); }