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


Java VisualStyleFactory.createVisualStyle方法代码示例

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


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

示例1: createVisualStyleSingle

import org.cytoscape.view.vizmap.VisualStyleFactory; //导入方法依赖的package包/类
/**
 * Create visual style for single condition
 * @param vmmServiceRef
 * @param vsfServiceRef
 * @param vmfFactoryC
 * @param vmfFactoryD
 * @param vmfFactoryP
 * @return
 */
private VisualStyle createVisualStyleSingle(
		VisualMappingManager vmmServiceRef,
		VisualStyleFactory vsfServiceRef,
		VisualMappingFunctionFactory vmfFactoryC,
		VisualMappingFunctionFactory vmfFactoryD,
		VisualMappingFunctionFactory vmfFactoryP) {
	
	// retrieve visual style if already exist
	if(styleExist(vmmServiceRef, "KDDN visual style - single condition"))
		return getVSstyle(vmmServiceRef, "KDDN visual style - single condition");
	
	// node color setting
	Color NODE_COLOR = new Color(230, 191, 85);
	Color NODE_BORDER_COLOR = Color.WHITE;
	Color NODE_LABEL_COLOR = new Color(50, 50, 50);
	
	// To create a new VisualStyle object and set the mapping function
	VisualStyle vs= vsfServiceRef.createVisualStyle("KDDN visual style - single condition");

	// unlock node size
	Set<VisualPropertyDependency<?>> deps = vs.getAllVisualPropertyDependencies();
	for(VisualPropertyDependency<?> dep: deps) {
		dep.setDependency(false);
	}
	
	// set node related default
	vs.setDefaultValue(BasicVisualLexicon.NODE_SHAPE, NodeShapeVisualProperty.ELLIPSE);
	vs.setDefaultValue(BasicVisualLexicon.NODE_FILL_COLOR, NODE_COLOR);
	vs.setDefaultValue(BasicVisualLexicon.NODE_LABEL_COLOR, NODE_LABEL_COLOR);
	vs.setDefaultValue(BasicVisualLexicon.NODE_BORDER_PAINT, NODE_BORDER_COLOR);
	vs.setDefaultValue(BasicVisualLexicon.NODE_TRANSPARENCY, 220);
	vs.setDefaultValue(BasicVisualLexicon.NODE_LABEL_FONT_SIZE, 20);
	
	// map node names
	String nodeName = "name";
	PassthroughMapping nodeNameMapping = (PassthroughMapping) 
			vmfFactoryP.createVisualMappingFunction(nodeName, String.class, 
					BasicVisualLexicon.NODE_LABEL);
	vs.addVisualMappingFunction(nodeNameMapping);
			
	// map edge color
	String edgeType = "interaction";
	DiscreteMapping<String, Paint> edgeTypeMapping = (DiscreteMapping<String, Paint>) 
			vmfFactoryD.createVisualMappingFunction(edgeType, String.class, 
					BasicVisualLexicon.EDGE_STROKE_UNSELECTED_PAINT);
	edgeTypeMapping.putMapValue("static edge", Color.DARK_GRAY);
	vs.addVisualMappingFunction(edgeTypeMapping);
	
	// add visual style if not added
	if(!styleExist(vmmServiceRef, "KDDN visual style - single condition"))
		vmmServiceRef.addVisualStyle(vs);
	
	return vs;
}
 
开发者ID:tianye03,项目名称:kddn-cytoscape,代码行数:64,代码来源:KddnExperiment.java

示例2: createVisualStyleTwoCondition

import org.cytoscape.view.vizmap.VisualStyleFactory; //导入方法依赖的package包/类
/**
 * Create visual style for two conditions
 * @param vmmServiceRef
 * @param vsfServiceRef
 * @param vmfFactoryC
 * @param vmfFactoryD
 * @param vmfFactoryP
 * @return
 */
private VisualStyle createVisualStyleTwoCondition(VisualMappingManager vmmServiceRef,
		VisualStyleFactory vsfServiceRef,
		VisualMappingFunctionFactory vmfFactoryC,
		VisualMappingFunctionFactory vmfFactoryD,
		VisualMappingFunctionFactory vmfFactoryP) {
	
	// retrieve visual style if already exist
	if(styleExist(vmmServiceRef, "KDDN visual style - two conditions"))
		return getVSstyle(vmmServiceRef, "KDDN visual style - two conditions");
			
	// node related color
	Color NODE_COLOR = new Color(230, 191, 85);
	Color NODE_BORDER_COLOR = Color.WHITE;
	Color NODE_LABEL_COLOR = new Color(50, 50, 50);
	
	// To create a new VisualStyle object and set the mapping function
	VisualStyle vs= vsfServiceRef.createVisualStyle("KDDN visual style - two conditions");

	// unlock node size
	Set<VisualPropertyDependency<?>> deps = vs.getAllVisualPropertyDependencies();
	for(VisualPropertyDependency<?> dep: deps) {
		dep.setDependency(false);
	}
	
	// default node appearance
	vs.setDefaultValue(BasicVisualLexicon.NODE_SHAPE, NodeShapeVisualProperty.ELLIPSE);
	vs.setDefaultValue(BasicVisualLexicon.NODE_FILL_COLOR, NODE_COLOR);
	vs.setDefaultValue(BasicVisualLexicon.NODE_LABEL_COLOR, NODE_LABEL_COLOR);
	vs.setDefaultValue(BasicVisualLexicon.NODE_BORDER_PAINT, NODE_BORDER_COLOR);
	vs.setDefaultValue(BasicVisualLexicon.NODE_TRANSPARENCY, 220);
	vs.setDefaultValue(BasicVisualLexicon.NODE_LABEL_FONT_SIZE, 20);
	
	// map node names
	String nodeName = "name";
	PassthroughMapping nodeNameMapping = (PassthroughMapping) 
			vmfFactoryP.createVisualMappingFunction(nodeName, String.class, 
					BasicVisualLexicon.NODE_LABEL);
	vs.addVisualMappingFunction(nodeNameMapping);
			
	// map edge color
	String edgeType = "interaction";
	DiscreteMapping<String, Paint> edgeTypeMapping = (DiscreteMapping<String, Paint>) 
			vmfFactoryD.createVisualMappingFunction(edgeType, String.class, 
					BasicVisualLexicon.EDGE_STROKE_UNSELECTED_PAINT);
	edgeTypeMapping.putMapValue("condition 1", Color.RED);
	edgeTypeMapping.putMapValue("condition 2", new Color(0,196,26));
	vs.addVisualMappingFunction(edgeTypeMapping);
	
	// add visual style is not added
	if(!styleExist(vmmServiceRef, "KDDN visual style - two conditions"))
		vmmServiceRef.addVisualStyle(vs);
	
	return vs;
}
 
开发者ID:tianye03,项目名称:kddn-cytoscape,代码行数:64,代码来源:KddnExperiment.java


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