protected SuperSector(double minLat, double maxLat, double minLon, double maxLon, int latDivisions, int lonDivisions) : base(minLat, maxLat, minLon, maxLon) { LatDivisions = latDivisions; LonDivisions = lonDivisions; sectors = new AbstractSector <T> [LatDivisions, LonDivisions]; InitSectors(); }
protected void DivideSubSector(AbstractSector <T> sector, int latDivisions, int lonDivisions) { List <T> all = sector.GetAllItems(); int latIndex, lonIndex; int w = sectors.GetLength(0); int h = sectors.GetLength(1); int x = 0; int y = 0; for (; x < w; x++) { for (; y < h; y++) { if (sectors[x, y] == sector) { latIndex = y; lonIndex = x; break; } } } if (x == w) { throw new SectorNotFoundException(); } double latRange = MaxLat - MinLat; double lonRange = MaxLon - MinLon; double minLat = this.MinLat + latRange / this.LatDivisions * y; double maxLat = this.MinLat + latRange / this.LatDivisions * (y + 1); double minLon = this.MinLon + lonRange / this.LonDivisions * x; double maxLon = this.MinLon + lonRange / this.LonDivisions * (x + 1); sectors[x, y] = new SuperSector <T>(this, minLat, maxLat, minLon, maxLon, latDivisions, lonDivisions); }