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


Java Node.getNodeData方法代码示例

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


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

示例1: apply

import org.gephi.graph.api.Node; //导入方法依赖的package包/类
@Override
public void apply(Node n1, Node n2) {
    NodeData n1Data = n1.getNodeData();
    ForceAtlas2LayoutData n1Layout = n1Data.getLayoutData();
    NodeData n2Data = n2.getNodeData();
    ForceAtlas2LayoutData n2Layout = n2Data.getLayoutData();

    // Get the distance
    double xDist = n1Data.x() - n2Data.x();
    double yDist = n1Data.y() - n2Data.y();
    double distance = (float) Math.sqrt(xDist * xDist + yDist * yDist);

    if (distance > 0) {
        // NB: factor = force / distance
        double factor = coefficient * n1Layout.mass * n2Layout.mass / distance / distance;

        n1Layout.dx += xDist * factor;
        n1Layout.dy += yDist * factor;

        n2Layout.dx -= xDist * factor;
        n2Layout.dy -= yDist * factor;
    }
}
 
开发者ID:nolanlab,项目名称:vortex,代码行数:24,代码来源:ForceFactory.java

示例2: apply

import org.gephi.graph.api.Node; //导入方法依赖的package包/类
@Override
public void apply(Node n1, Node n2, double e) {
    NodeData n1Data = n1.getNodeData();
    ForceAtlas2LayoutData n1Layout = n1Data.getLayoutData();
    NodeData n2Data = n2.getNodeData();
    ForceAtlas2LayoutData n2Layout = n2Data.getLayoutData();

    // Get the distance
    double xDist = n1Data.x() - n2Data.x();
    double yDist = n1Data.y() - n2Data.y();
    double distance = Math.sqrt(xDist * xDist + yDist * yDist) - n1Data.getSize() - n2Data.getSize();

    if (distance > 0) {

        // NB: factor = force / distance
        double factor = -coefficient * e * Math.log(1 + distance) / distance / n1Layout.mass;

        n1Layout.dx += xDist * factor;
        n1Layout.dy += yDist * factor;

        n2Layout.dx -= xDist * factor;
        n2Layout.dy -= yDist * factor;
    }
}
 
开发者ID:nolanlab,项目名称:vortex,代码行数:25,代码来源:ForceFactory.java

示例3: applyForce

import org.gephi.graph.api.Node; //导入方法依赖的package包/类
public void applyForce(Node n, RepulsionForce Force, double theta) {
    NodeData nData = n.getNodeData();
    if (nodes.size() < 2) {
        Node regionNode = nodes.get(0);
        Force.apply(n, regionNode);
    } else {
        double distance = Math.sqrt((nData.x() - massCenterX) * (nData.x() - massCenterX) + (nData.y() - massCenterY) * (nData.y() - massCenterY));
        if (distance * theta > size) {
            Force.apply(n, this);
        } else {
            for (Region subregion : subregions) {
                subregion.applyForce(n, Force, theta);
            }
        }
    }
}
 
开发者ID:nolanlab,项目名称:vortex,代码行数:17,代码来源:Region.java

示例4: getLayoutData

import org.gephi.graph.api.Node; //导入方法依赖的package包/类
private DagLayoutData getLayoutData(Node node) {
    if (node == null) {
        return null;
    }
    NodeData nodeData = node.getNodeData();
    if (nodeData == null) {
        return null;
    }

    return (DagLayoutData) nodeData.getLayoutData();
}
 
开发者ID:nolanlab,项目名称:vortex,代码行数:12,代码来源:TreeLayout.java


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