}
// compute and assign convex hull for each aggregate
Iterator aggrs = m_vis.visibleItems(m_group);
while ( aggrs.hasNext() ) {
AggregateItem aitem = (AggregateItem)aggrs.next();
int idx = 0;
if ( aitem.getAggregateSize() == 0 ) continue;
VisualItem item = null;
Iterator iter = aitem.items();
while ( iter.hasNext() ) {
item = (VisualItem)iter.next();
if ( item.isVisible() ) {
addPoint(m_pts, idx, item, m_margin);
idx += 2*4;
}
}
// if no aggregates are visible, do nothing
if ( idx == 0 ) continue;
// compute convex hull
double[] nhull = GraphicsLib.convexHull(m_pts, idx);
// prepare viz attribute array
float[] fhull = (float[])aitem.get(VisualItem.POLYGON);
if ( fhull == null || fhull.length < nhull.length )
fhull = new float[nhull.length];
else if ( fhull.length > nhull.length )
fhull[nhull.length] = Float.NaN;
// copy hull values
for ( int j=0; j<nhull.length; j++ )
fhull[j] = (float)nhull[j];
aitem.set(VisualItem.POLYGON, fhull);
aitem.setValidated(false); // force invalidation
}
}