/** * Hand coded groups. */ public void generateGroups(Visualization vis,VisualGraph vg){ AggregateTable at = vis.addAggregates("aggregates"); at.addColumn(VisualItem.POLYGON, float[].class); at.addColumn("id", int.class); // add nodes to aggregates // create an aggregate for each 3-clique of nodes Iterator<?> nodes = vg.nodes(); for ( int i=0; i<3; ++i ) { AggregateItem aitem = (AggregateItem)at.addItem(); aitem.setInt("id", i); for ( int j=0; j<3; ++j ) { aitem.addItem((VisualItem)nodes.next()); } if (i==0) aitem.addItem((VisualItem)vg.getNode(3)); } }
for ( Iterator aggrs = aggr.tuples(); aggrs.hasNext(); ) maxsz = Math.max(maxsz, 4*2* ((AggregateItem)aggrs.next()).getAggregateSize()); if ( m_pts == null || maxsz > m_pts.length ) { m_pts = new double[maxsz]; if ( aitem.getAggregateSize() == 0 ) continue; VisualItem item = null; Iterator iter = aitem.items(); while ( iter.hasNext() ) { item = (VisualItem)iter.next(); float[] fhull = (float[])aitem.get(VisualItem.POLYGON); if ( fhull == null || fhull.length < nhull.length ) fhull = new float[nhull.length]; aitem.set(VisualItem.POLYGON, fhull); aitem.setValidated(false); // force invalidation
protected static void setFixed(VisualItem item, boolean fixed) { if ( item instanceof AggregateItem ) { Iterator items = ((AggregateItem)item).items(); while ( items.hasNext() ) { setFixed((VisualItem)items.next(), fixed); } } else { item.setFixed(fixed); } }
/** * Finds the schema File Node in the AggregateItem * The AggregateItem contains the schema file node and * the SchemaComponent nodes for the file * */ private NodeItem findFileNode(final int aggregateItemFileGroup, final VisualItem item) { NodeItem fileNode = null; AggregateItem agIt = AggregateItem.class.cast(item); Iterator agItems = agIt.items(); while(agItems.hasNext()){ VisualItem agItem = (VisualItem)agItems.next(); int fileGroup = -1; if (agItem.canGetInt(AnalysisConstants.FILE_NODE_FILE_GROUP)) { fileGroup = agItem.getInt(AnalysisConstants.FILE_NODE_FILE_GROUP); if (fileGroup == aggregateItemFileGroup && agItem.canGetBoolean(AnalysisConstants.IS_EXPANDED)){ fileNode = NodeItem.class.cast(agItem); break; } } } return fileNode; }
/** * Finds the schema File Node in the AggregateItem * The AggregateItem contains the schema file node and * the SchemaComponent nodes for the file * */ private NodeItem findFileNode(final int aggregateItemFileGroup, final VisualItem item ) { NodeItem fileNode = null; AggregateItem agIt = AggregateItem.class.cast(item); Iterator agItems = agIt.items(); while(agItems.hasNext()){ VisualItem agItem = (VisualItem)agItems.next(); int fileGroup = -1; if (agItem.canGetInt(AnalysisConstants.FILE_NODE_FILE_GROUP)) { fileGroup = agItem.getInt(AnalysisConstants.FILE_NODE_FILE_GROUP); if (fileGroup == aggregateItemFileGroup && agItem.canGetBoolean(AnalysisConstants.IS_EXPANDED)){ fileNode = NodeItem.class.cast(agItem); break; } } } return fileNode; }
protected static void move(VisualItem item, double dx, double dy) { if ( item instanceof AggregateItem ) { Iterator items = ((AggregateItem)item).items(); while ( items.hasNext() ) { move((VisualItem)items.next(), dx, dy); } } else { double x = item.getX(); double y = item.getY(); item.setStartX(x); item.setStartY(y); item.setX(x+dx); item.setY(y+dy); item.setEndX(x+dx); item.setEndY(y+dy); } }