Esempio n. 1
0
        private Collection <Feature> GetGeneratedPolygons(RectangleShape boundingRectangle)
        {
            //Here i just created about 20,000 rectangles around the bounding box area and generated random number from 1-4 for their data

            Random random = new Random();

            boundingRectangle.ScaleTo(10);

            Collection <Feature> features = new Collection <Feature>();

            for (int x = 1; x < 150; x++)
            {
                for (int y = 1; y < 150; y++)
                {
                    double upperLeftX = boundingRectangle.UpperLeftPoint.X + x * boundingRectangle.Width / 150;
                    double upperLeftY = boundingRectangle.UpperLeftPoint.Y - y * boundingRectangle.Height / 150;

                    double lowerRightX = upperLeftX + boundingRectangle.Width / 150;
                    double lowerRightY = upperLeftY - boundingRectangle.Height / 150;

                    Feature feature = new Feature(new RectangleShape(new PointShape(upperLeftX, upperLeftY), new PointShape(lowerRightX, lowerRightY)));
                    feature.ColumnValues.Add("DataPoint1", random.Next(1, 5).ToString());

                    features.Add(feature);
                }
            }

            return(features);
        }