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


Java EdgeItem.isDirected方法代码示例

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


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

示例1: getRawShape

import prefuse.visual.EdgeItem; //导入方法依赖的package包/类
@Override
protected Shape getRawShape(VisualItem item) {
      EdgeItem   edge = (EdgeItem)item;
        VisualItem item1 = edge.getSourceItem();
        VisualItem item2 = edge.getTargetItem();
        
        int type = m_edgeType;
        
        getAlignedPoint(m_tmpPoints[0], item1.getBounds(),
                        m_xAlign1, m_yAlign1);
        getAlignedPoint(m_tmpPoints[1], item2.getBounds(),
                        m_xAlign2, m_yAlign2);
        m_curWidth = (float)(m_width * getLineWidth(item));
        
        // create the arrow head, if needed
        EdgeItem e = (EdgeItem)item;
        if ( e.isDirected() && m_edgeArrow != Constants.EDGE_ARROW_NONE ) {
            // get starting and ending edge endpoints
            boolean forward = (m_edgeArrow == Constants.EDGE_ARROW_FORWARD);
            Point2D start = null, end = null;
            start = m_tmpPoints[forward?0:1];
            end   = m_tmpPoints[forward?1:0];
            
            // compute the intersection with the target bounding box
            VisualItem dest = forward ? e.getTargetItem() : e.getSourceItem();
            int i = GraphicsLib.intersectLineRectangle(start, end,
                    dest.getBounds(), m_isctPoints);
            if ( i > 0 ) end = m_isctPoints[0];
            
            // create the arrow head shape
            AffineTransform at = getArrowTrans(start, end, m_curWidth);
            m_curArrow = at.createTransformedShape(m_arrowHead);
            
            // update the endpoints for the edge shape
            // need to bias this by arrow head size
            Point2D lineEnd = m_tmpPoints[forward?1:0]; 
            lineEnd.setLocation(0, -m_arrowHeight);
            at.transform(lineEnd, lineEnd);
        } else {
            m_curArrow = null;
        }
        
        // create the edge shape
        Shape shape = null;
        double n1x = m_tmpPoints[0].getX();
        double n1y = m_tmpPoints[0].getY();
        double n2x = m_tmpPoints[1].getX();
        double n2y = m_tmpPoints[1].getY();
        switch ( type ) {
            case Constants.EDGE_TYPE_LINE:          
                m_line.setLine(n1x, n1y, n2x, n2y);
                shape = m_line;
                break;
            case Constants.EDGE_TYPE_CURVE:
                getCurveControlPoints(edge, m_ctrlPoints,n1x,n1y,n2x,n2y);
                m_cubic.setCurve(n1x, n1y,
                                m_ctrlPoints[0].getX(), m_ctrlPoints[0].getY(),
                                m_ctrlPoints[1].getX(), m_ctrlPoints[1].getY(),
                                n2x, n2y);
                shape = m_cubic;
                break;
            default:
                throw new IllegalStateException("Unknown edge type");
        }
        
        // return the edge shape
        return shape;

}
 
开发者ID:luox12,项目名称:onecmdb,代码行数:70,代码来源:MyEdgeRenderer.java

示例2: getRawShape

import prefuse.visual.EdgeItem; //导入方法依赖的package包/类
/**
 * @see prefuse.render.AbstractShapeRenderer#getRawShape(prefuse.visual.VisualItem)
 */
protected Shape getRawShape(VisualItem item) {
    EdgeItem   edge = (EdgeItem)item;
    VisualItem item1 = edge.getSourceItem();
    VisualItem item2 = edge.getTargetItem();
    
    int type = m_edgeType;
    
    getAlignedPoint(m_tmpPoints[0], item1.getBounds(),
                    m_xAlign1, m_yAlign1);
    getAlignedPoint(m_tmpPoints[1], item2.getBounds(),
                    m_xAlign2, m_yAlign2);
    m_curWidth = (float)(m_width * getLineWidth(item));
    
    // create the arrow head, if needed
    EdgeItem e = (EdgeItem)item;
    if ( e.isDirected() && m_edgeArrow != Constants.EDGE_ARROW_NONE ) {
        // get starting and ending edge endpoints
        boolean forward = (m_edgeArrow == Constants.EDGE_ARROW_FORWARD);
        Point2D start = null, end = null;
        start = m_tmpPoints[forward?0:1];
        end   = m_tmpPoints[forward?1:0];
        
        // compute the intersection with the target bounding box
        VisualItem dest = forward ? e.getTargetItem() : e.getSourceItem();
        int i = GraphicsLib.intersectLineRectangle(start, end,
                dest.getBounds(), m_isctPoints);
        if ( i > 0 ) end = m_isctPoints[0];
        
        // create the arrow head shape
        AffineTransform at = getArrowTrans(start, end, m_curWidth);
        m_curArrow = at.createTransformedShape(m_arrowHead);
        
        // update the endpoints for the edge shape
        // need to bias this by arrow head size
        Point2D lineEnd = m_tmpPoints[forward?1:0]; 
        lineEnd.setLocation(0, -m_arrowHeight);
        at.transform(lineEnd, lineEnd);
    } else {
        m_curArrow = null;
    }
    
    // create the edge shape
    Shape shape = null;
    double n1x = m_tmpPoints[0].getX();
    double n1y = m_tmpPoints[0].getY();
    double n2x = m_tmpPoints[1].getX();
    double n2y = m_tmpPoints[1].getY();
    switch ( type ) {
        case Constants.EDGE_TYPE_LINE:          
            m_line.setLine(n1x, n1y, n2x, n2y);
            shape = m_line;
            break;
        case Constants.EDGE_TYPE_CURVE:
            getCurveControlPoints(edge, m_ctrlPoints,n1x,n1y,n2x,n2y);
            m_cubic.setCurve(n1x, n1y,
                            m_ctrlPoints[0].getX(), m_ctrlPoints[0].getY(),
                            m_ctrlPoints[1].getX(), m_ctrlPoints[1].getY(),
                            n2x, n2y);
            shape = m_cubic;
            break;
        default:
            throw new IllegalStateException("Unknown edge type");
    }
    
    // return the edge shape
    return shape;
}
 
开发者ID:dritanlatifi,项目名称:AndroidPrefuse,代码行数:71,代码来源:EdgeRenderer.java


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