double hh = r.h;
MapRects row = new MapRects();
int height = 0;
int width = 0;
double weight = 0;
<BUG>double sumweight = 1;
while(ni <= ne) {</BUG>
if(ww < hh) {
weight += ml.weight[ni];
height = (int) (weight / sumweight * hh);

double hh = r.h;
MapRects row = new MapRects();
int height = 0;
int width = 0;
double weight = 0;
double sumweight = 1;
double tmpratio;
double rowratio = Double.MAX_VALUE;
while(ni <= ne) {
if(ww < hh) {
weight += ml.weight[ni];
height = (int) (weight / sumweight * hh);
