• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java LayeredIcon类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中edu.uci.ics.jung.visualization.LayeredIcon的典型用法代码示例。如果您正苦于以下问题:Java LayeredIcon类的具体用法?Java LayeredIcon怎么用?Java LayeredIcon使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



LayeredIcon类属于edu.uci.ics.jung.visualization包,在下文中一共展示了LayeredIcon类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: itemStateChanged

import edu.uci.ics.jung.visualization.LayeredIcon; //导入依赖的package包/类
public void itemStateChanged(ItemEvent e) {
    Icon icon = imager.transform((Number)e.getItem());
    if(icon != null && icon instanceof LayeredIcon) {
        if(e.getStateChange() == ItemEvent.SELECTED) {
            ((LayeredIcon)icon).add(checked);
        } else {
            ((LayeredIcon)icon).remove(checked);
        }
    }
}
 
开发者ID:marcvanzee,项目名称:mdp-plan-revision,代码行数:11,代码来源:LensVertexImageShaperDemo.java


示例2: itemStateChanged

import edu.uci.ics.jung.visualization.LayeredIcon; //导入依赖的package包/类
public void itemStateChanged(ItemEvent e) {
    Icon icon = imager.transform((V)e.getItem());
    if(icon != null && icon instanceof LayeredIcon) {
        if(e.getStateChange() == ItemEvent.SELECTED) {
            ((LayeredIcon)icon).add(checked);
        } else {
            ((LayeredIcon)icon).remove(checked);
        }
    }
}
 
开发者ID:marcvanzee,项目名称:mdp-plan-revision,代码行数:11,代码来源:VertexImageShaperDemo.java


示例3: InitiateGraph

import edu.uci.ics.jung.visualization.LayeredIcon; //导入依赖的package包/类
public void InitiateGraph(Character[] cs, Template[] templates, Color[] colors, String[] picture_keys,
                          String[] extra_keys) {

    Map<CharacterNode, Icon> iconMap = new HashMap<CharacterNode, Icon>();

    characters = new CharacterNode[cs.length];
    for (int x = 0; x < cs.length; x++) {

        characters[x] = new CharacterNode(cs[x]);

        for (int y = 0; y < templates.length; y++) {

            if (cs[x].templateIdentifier.equals(templates[y].GetTemplateID())) {

                characters[x].color = colors[y];
                characters[x].extra_key = extra_keys[y];

                ImageIcon img = XEED.RescaleImageIcon((ImageIcon) cs[x].imgData.get(picture_keys[y]), ImageMaxSize,
                        ImageMaxSize);

                if (img != null) {
                    iconMap.put(characters[x], new LayeredIcon(img.getImage()));
                }

            }

        }
    }

    // creates the graph
    graph = new DelegateForest<CharacterNode, Integer>();

    //Loads the tree data
    createTree();

    //Sets up the transformer that paints the node.
    Transformer<CharacterNode, Paint> vertexPaint = new Transformer<CharacterNode, Paint>() {

        @Override
        public Paint transform(CharacterNode cn) {
            ;
            return cn.color;
        }
    };

    final DefaultVertexIconTransformer<CharacterNode> vertexIconFunction = new DefaultVertexIconTransformer<CharacterNode>();
    vertexIconFunction.setIconMap(iconMap);

    final VertexIconShapeTransformer<CharacterNode> vertexImageShapeFunction = new VertexIconShapeTransformer<CharacterNode>(
            new EllipseVertexShapeTransformer<CharacterNode>());
    vertexImageShapeFunction.setIconMap(iconMap);

    treeLayout = new TreeLayout<CharacterNode, Integer>(graph, TreeLayout.DEFAULT_DISTX * 3);

    //Skriva en anpassad metod för att bestämma platser.
    //använd treeLayout.setLocation();

    vv = new VisualizationViewer<CharacterNode, Integer>(treeLayout);
    vv.getRenderContext().setEdgeShapeTransformer(new EdgeShape.Line());
    vv.getRenderContext().setVertexLabelTransformer(new ToStringLabeller());
    vv.getRenderContext().setVertexShapeTransformer(vertexImageShapeFunction);
    vv.getRenderContext().setVertexIconTransformer(vertexIconFunction);
    // add a listener for ToolTips
    vv.setVertexToolTipTransformer(new ToStringLabeller());
    vv.getRenderContext().setArrowFillPaintTransformer(new ConstantTransformer(Color.lightGray));
    vv.getRenderContext().setVertexFillPaintTransformer(vertexPaint);
    vv.getRenderer().getVertexLabelRenderer().setPosition(Position.AUTO);

    Container content = this;
    final GraphZoomScrollPane panel = new GraphZoomScrollPane(vv);
    content.add(panel);
    panel.setVisible(true);
    content.validate();

    final DefaultModalGraphMouse graphMouse = new DefaultModalGraphMouse();
    vv.setGraphMouse(graphMouse);

    graphMouse.setMode(ModalGraphMouse.Mode.TRANSFORMING);

}
 
开发者ID:ErikGartner,项目名称:xeed,代码行数:81,代码来源:GenealogyGraphPanel.java


示例4: updateIcon

import edu.uci.ics.jung.visualization.LayeredIcon; //导入依赖的package包/类
private void updateIcon() {
    int plottedIconWidth = 40;
    int plottedIconHeight = 100;
    
    // We reduce the icon size of named persons
    if(isHidden && persName != null && !persName.isEmpty())
    {
        plottedIconWidth /= 10;
        plottedIconHeight /= 10;
    }
    
    BufferedImage tempIcon = new BufferedImage(plottedIconWidth, plottedIconHeight, BufferedImage.TYPE_INT_RGB);
    
    Graphics2D graphics = (Graphics2D)tempIcon.createGraphics();
    
    // Plot the icon
    graphics.drawImage(bufferIcon, 0, 0, plottedIconWidth, plottedIconHeight, null);

    // Plot the border
    if(plotNameColor || isSelected || nbNeighborSelected > 0)
    {
        graphics.setStroke(new BasicStroke(8.f));
        
        if(isSelected)
        {
            graphics.setColor(new Color(255, 0, 0));
        }
        else if (nbNeighborSelected > 0)
        {
            graphics.setColor(new Color(0, 200, 0));
        }
        else if(plotNameColor)
        {
            // Default color value
            int valueR = 125;
            int valueG = 125;
            int valueB = 125;
            
            if(persName != null && !persName.isEmpty())
            {
                Random r = new Random(persName.hashCode());
                valueR = r.nextInt(256);
                valueG = r.nextInt(256);
                valueB = r.nextInt(256);
            }

            Color colorBorder = new Color(valueR,
                                          valueG,
                                          valueB);
            graphics.setColor(colorBorder);
        }
        
        graphics.drawRect(0, 0, tempIcon.getWidth(), tempIcon.getHeight());
    }
    
    graphics.dispose();
    
    plottedIcon = new LayeredIcon(new ImageIcon(tempIcon).getImage());
}
 
开发者ID:Conchylicultor,项目名称:NetworkVisualizer,代码行数:60,代码来源:Vertex.java


示例5: updateIconsMap

import edu.uci.ics.jung.visualization.LayeredIcon; //导入依赖的package包/类
private void updateIconsMap(final Map<String, GraphMLMetadata<String>> vertexMetadata, final Collection<String> graphVertices) {
//        final Collection<String> graphVertices = graph.getVertices();
        String[] vertices = graphVertices.toArray(new String[graphVertices.size()]);
        List<IconType> iconTypeList = viewerConfig.getIcon();
        List<IconType.Data> datas;
        for (String vertice : vertices) {
            //System.out.println(vertice);
            for (IconType iconType : iconTypeList) {
                boolean match = true;
                datas = iconType.getData();
                boolean isDefaultIcon = datas.isEmpty();

                for (IconType.Data data : datas) {

                    final GraphMLMetadata<String> stringGraphMLMetadata = vertexMetadata.get(data.getKey());
                    if (stringGraphMLMetadata == null){
                        logger.error(String.format("Can not find vertex metadata key '%s'.",data.getKey()));
                        match = false;
                        break;
                    }
                    final String value = stringGraphMLMetadata.transformer.transform(vertice);
                    String matcher = data.getMatcher();
                    if (matcher == null) {
                        matcher = "default";
                    }
                    if (value == null){
                        match = false;
                        break;

                    }
                    DataMatcher matcherInstance = matcherMap.get(matcher);
                    boolean matchResult = matcherInstance.compareData(value, data.getValue());
                    if (value == null || !matchResult) {
                        match = false;
                        break;
                    }
                }
                boolean iconExists = iconMap.containsKey(vertice);
                if ((!isDefaultIcon && match) || (isDefaultIcon && !iconExists)) {
                    final String name = iconType.getName();
                    String[] iconNames = name.split(",");
                    logger.debug("Load icon: "+iconNames[0].trim() + " for node "+vertice);
                    final URL resource = TopologyManagerFrame.class.getResource(iconNames[0].trim());
                    if (resource == null) {
                        logger.error("Can not load icon: "+iconNames[0].trim());
                        continue;
                    }
                    final ImageIcon imageIcon = new ImageIcon(resource);
                    LayeredIcon iconImg = new LayeredIcon(imageIcon.getImage());
                    for (int i=1;i<iconNames.length;i++) {
                        final URL resource1 = TopologyManagerFrame.class.getResource(iconNames[i].trim());
                        logger.debug("Load icon: "+iconNames[0].trim() + " for node "+vertice);
                        iconImg.add(new ImageIcon(resource1));
                    }
                    iconMap.put(vertice, iconImg);
                    break;
                }
            }
        }
    }
 
开发者ID:iTransformers,项目名称:netTransformer,代码行数:61,代码来源:IconMapLoader.java



注:本文中的edu.uci.ics.jung.visualization.LayeredIcon类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java Sampler类代码示例发布时间:2022-05-22
下一篇:
Java AutoProxyRegistrar类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap