예제 #1
0
파일: Grid.cs 프로젝트: ntj/GravurGIS
        public Grid(int width, int height,
                    int shape_width, int shape_height, bool cellMeassureDefined)
        {
            this.shape_height = shape_height;
            this.shape_width  = shape_width;
            int i;

            if (cellMeassureDefined)
            {
                this.cell_width  = width;
                this.cell_height = height;
                this.v_size      = shape_height / height;
                this.h_size      = shape_width / width;
                for (i = 0; shape_width >= ((i + h_size) * cell_width); i++)
                {
                }
                h_size += i;
                for (i = 0; shape_height >= ((i + v_size) * cell_height); i++)
                {
                }
                v_size += i;
            }
            else
            {
                this.h_size      = width;
                this.v_size      = height;
                this.cell_width  = shape_width / h_size;
                this.cell_height = shape_height / v_size;
                for (i = 0; shape_width >= (h_size * (i + cell_width)); i++)
                {
                }
                cell_width += i;
                for (i = 0; shape_height >= (v_size * (i + cell_height)); i++)
                {
                }
                cell_height += i;
            }
            itemCount = h_size * v_size;
            items     = new GridElementItem[itemCount];

            // Initialize array
            for (i = 0; i < itemCount; i++)
            {
                items[i] = new GridElementItem((i * cell_width) % h_size,
                                               (i * cell_height) % v_size);
            }
        }
예제 #2
0
파일: Grid.cs 프로젝트: ntj/GravurGIS
        public Grid(int width, int height,
            int shape_width, int shape_height, bool cellMeassureDefined)
        {
            this.shape_height = shape_height;
            this.shape_width  = shape_width;
            int i;
            if (cellMeassureDefined)
            {
                this.cell_width = width;
                this.cell_height = height;
                this.v_size = shape_height / height;
                this.h_size = shape_width / width;
                for (i = 0; shape_width >= ((i + h_size) * cell_width); i++) { }
                h_size += i;
                for (i = 0; shape_height >= ((i + v_size) * cell_height); i++) { }
                v_size += i;
            }
            else
            {
                this.h_size = width;
                this.v_size = height;
                this.cell_width = shape_width / h_size;
                this.cell_height = shape_height / v_size;
                for (i = 0; shape_width >= (h_size * (i + cell_width)); i++) { }
                cell_width += i;
                for (i = 0; shape_height >= (v_size * (i + cell_height)); i++) { }
                cell_height += i;
            }
            itemCount = h_size * v_size;
            items = new GridElementItem[itemCount];

            // Initialize array
            for (i = 0; i < itemCount; i++)
                items[i] = new GridElementItem((i * cell_width) % h_size,
                    (i * cell_height) % v_size);
        }