当前位置: 首页>>代码示例>>Java>>正文


Java TupleSet.addColumns方法代码示例

本文整理汇总了Java中prefuse.data.tuple.TupleSet.addColumns方法的典型用法代码示例。如果您正苦于以下问题:Java TupleSet.addColumns方法的具体用法?Java TupleSet.addColumns怎么用?Java TupleSet.addColumns使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在prefuse.data.tuple.TupleSet的用法示例。


在下文中一共展示了TupleSet.addColumns方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: initSimulator

import prefuse.data.tuple.TupleSet; //导入方法依赖的package包/类
/**
 * Loads the simulator with all relevant force items and springs.
 * @param fsim the force simulator driving this layout
 */
protected void initSimulator(ForceSimulator fsim) {     
    // make sure we have force items to work with
    TupleSet ts = m_vis.getGroup(m_nodeGroup);
    if ( ts == null ) return;
    try {
        ts.addColumns(FORCEITEM_SCHEMA);
    } catch ( IllegalArgumentException iae ) { /* ignored */ }
    
    float startX = (referrer == null ? 0f : (float)referrer.getX());
    float startY = (referrer == null ? 0f : (float)referrer.getY());
    startX = Float.isNaN(startX) ? 0f : startX;
    startY = Float.isNaN(startY) ? 0f : startY;
   
    Iterator iter = m_vis.visibleItems(m_nodeGroup);
    while ( iter.hasNext() ) {
        VisualItem item = (VisualItem)iter.next();
        ForceItem fitem = (ForceItem)item.get(FORCEITEM);
        fitem.mass = getMassValue(item);
        double x = item.getEndX();
        double y = item.getEndY();
        fitem.location[0] = (Double.isNaN(x) ? startX : (float)x);
        fitem.location[1] = (Double.isNaN(y) ? startY : (float)y);
        fsim.addItem(fitem);
    }
    if ( m_edgeGroup != null ) {
        iter = m_vis.visibleItems(m_edgeGroup);
        while ( iter.hasNext() ) {
            EdgeItem  e  = (EdgeItem)iter.next();
            NodeItem  n1 = e.getSourceItem();
            ForceItem f1 = (ForceItem)n1.get(FORCEITEM);
            NodeItem  n2 = e.getTargetItem();
            ForceItem f2 = (ForceItem)n2.get(FORCEITEM);
            float coeff = getSpringCoefficient(e);
            float slen = getSpringLength(e);
            fsim.addSpring(f1, f2, (coeff>=0?coeff:-1.f), (slen>=0?slen:-1.f));
        }
    }
}
 
开发者ID:luox12,项目名称:onecmdb,代码行数:43,代码来源:ForceDirectedLayout.java

示例2: initSimulator

import prefuse.data.tuple.TupleSet; //导入方法依赖的package包/类
protected void initSimulator(ForceSimulator fsim) {	 
	// make sure we have force items to work with
	TupleSet ts = m_vis.getGroup(m_nodeGroup);
	if ( ts == null ) return;
	try {
		ts.addColumns(FORCEITEM_SCHEMA);
	} catch ( IllegalArgumentException iae ) { /* ignored */ }
	
	float startX = (referrer == null ? 0f : (float)referrer.getX());
	float startY = (referrer == null ? 0f : (float)referrer.getY());
	startX = Float.isNaN(startX) ? 0f : startX;
	startY = Float.isNaN(startY) ? 0f : startY;
	
	ArrayList<EdgeItem> edges = new ArrayList<EdgeItem>();
	
	Iterator<?> iter = m_vis.items(m_nodeGroup, m_filter);
	while ( iter.hasNext() ) {
		NodeItem item = (NodeItem)iter.next();
		ForceItem fitem = (ForceItem)item.get(FORCEITEM);
		fitem.mass = getMassValue(item);
		double x = item.getEndX();
		double y = item.getEndY();
		fitem.location[0] = (Double.isNaN(x) ? startX : (float)x);
		fitem.location[1] = (Double.isNaN(y) ? startY : (float)y);
		fsim.addItem(fitem);
		
		for (Iterator<?> it=item.outEdges(); it.hasNext();) {
			EdgeItem edge = (EdgeItem) it.next();
			NodeItem adjacent = edge.getAdjacentItem(item);
			
			if (adjacent.getBoolean("is_local"))
				edges.add(edge);
		}
	}

	iter = edges.iterator();
	while ( iter.hasNext() ) {
		EdgeItem  e  = (EdgeItem)iter.next();
		NodeItem  n1 = e.getSourceItem();
		ForceItem f1 = (ForceItem)n1.get(FORCEITEM);
		NodeItem  n2 = e.getTargetItem();
		ForceItem f2 = (ForceItem)n2.get(FORCEITEM);
		float coeff = getSpringCoefficient(e);
		float slen = getSpringLength(e);
		fsim.addSpring(f1, f2, (coeff>=0?coeff:-1.f), (slen>=0?slen:-1.f));
	}
}
 
开发者ID:codydunne,项目名称:netgrok,代码行数:48,代码来源:LocalHostLayout.java

示例3: initSimulator

import prefuse.data.tuple.TupleSet; //导入方法依赖的package包/类
protected void initSimulator(ForceSimulator fsim) {	 
	// make sure we have force items to work with
	TupleSet ts = m_vis.getGroup(m_nodeGroup);
	if ( ts == null ) return;
	try {
		ts.addColumns(FORCEITEM_SCHEMA);
	} catch ( IllegalArgumentException iae ) { /* ignored */ }
	
	float startX = (referrer == null ? 0f : (float)referrer.getX());
	float startY = (referrer == null ? 0f : (float)referrer.getY());
	startX = Float.isNaN(startX) ? 0f : startX;
	startY = Float.isNaN(startY) ? 0f : startY;

	Iterator<?> iter = ts.tuples(m_filter);
	while ( iter.hasNext() ) {
		VisualItem item = (VisualItem)iter.next();
		ForceItem fitem = (ForceItem)item.get(FORCEITEM);
		
		fitem.mass = getMassValue(item);
		double x = item.getEndX();
		double y = item.getEndY();
		fitem.location[0] = (Double.isNaN(x) ? startX : (float)x);
		fitem.location[1] = (Double.isNaN(y) ? startY : (float)y);
		fsim.addItem(fitem);
		
		// add a force between this node and its initial location
		ForceItem anchor = new ForceItem();
		
		if (location.containsKey(item)) {
			anchor.location = location.get(item);
		}
		
		else {
			byte[] ip = ((InetAddress)item.get(Data.ADDRESS)).getAddress();
			float[] loc = null;
			
			// if the new host is in a group, place it's anchor
			// at it's group's default location
			AggregateTable table = (AggregateTable) m_vis.getGroup(NetworkView.GROUPS);
			Iterator<?> groups = table.tuples();
			
			while (groups.hasNext()) {
				AggregateItem group = (AggregateItem) groups.next();
				
				if (group.containsItem(item)) {
					int size = group.getInt(NetworkView.GROUP_SIZE);
					loc = pointFromIP((byte[])group.get(Data.HOME_IP));
					
					// spiral nodes around the group
					if (size > 1) {
						loc[0] += 5 * Math.cos(size) + size; 
						loc[1] += 5 * Math.sin(size) + size;
					}

					break;
				}
			}	
			
			// they weren't in a group
			if (loc == null) {
				loc = pointFromIP(ip);
			}
			
			anchor.location = loc;
			location.put(item, loc);
		}
		//fitem.location = anchor.location;//NOMOVE HACK
		getForceSimulator().addSpring(fitem, anchor, .001f, .001f);
		//this.setEnabled(false);//NOMOVE HACK
	}
}
 
开发者ID:codydunne,项目名称:netgrok,代码行数:72,代码来源:ForeignHostLayout.java

示例4: initSchema

import prefuse.data.tuple.TupleSet; //导入方法依赖的package包/类
protected void initSchema(TupleSet ts) {
    ts.addColumns(PARAMS_SCHEMA);
}
 
开发者ID:dritanlatifi,项目名称:AndroidPrefuse,代码行数:4,代码来源:NodeLinkTreeLayout.java

示例5: initSchema

import prefuse.data.tuple.TupleSet; //导入方法依赖的package包/类
protected void initSchema(TupleSet ts) {
    try {
        ts.addColumns(PARAMS_SCHEMA);
    } catch ( IllegalArgumentException iae ) {};
}
 
开发者ID:dritanlatifi,项目名称:AndroidPrefuse,代码行数:6,代码来源:FruchtermanReingoldLayout.java

示例6: initSchema

import prefuse.data.tuple.TupleSet; //导入方法依赖的package包/类
private void initSchema(TupleSet ts) {
    try {
        ts.addColumns(PARAMS_SCHEMA);
    } catch ( IllegalArgumentException iae ) {}
}
 
开发者ID:dritanlatifi,项目名称:AndroidPrefuse,代码行数:6,代码来源:BalloonTreeLayout.java


注:本文中的prefuse.data.tuple.TupleSet.addColumns方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。