本文整理汇总了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;未经允许,请勿转载。 |
请发表评论