當前位置: 首頁>>代碼示例>>Java>>正文


Java PassthroughMapping類代碼示例

本文整理匯總了Java中org.cytoscape.view.vizmap.mappings.PassthroughMapping的典型用法代碼示例。如果您正苦於以下問題:Java PassthroughMapping類的具體用法?Java PassthroughMapping怎麽用?Java PassthroughMapping使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


PassthroughMapping類屬於org.cytoscape.view.vizmap.mappings包,在下文中一共展示了PassthroughMapping類的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: createVisualStyleSingle

import org.cytoscape.view.vizmap.mappings.PassthroughMapping; //導入依賴的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.mappings.PassthroughMapping; //導入依賴的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

示例3: getNodeLabelMapping

import org.cytoscape.view.vizmap.mappings.PassthroughMapping; //導入依賴的package包/類
@SuppressWarnings("rawtypes")
private PassthroughMapping getNodeLabelMapping() {
	PassthroughMapping mapping = (PassthroughMapping) plugin.getVisualMappingFunctionFactoryPassthrough().createVisualMappingFunction("name", String.class, BasicVisualLexicon.NODE_LABEL);
	return mapping;
}
 
開發者ID:CyTargetLinker,項目名稱:cytargetlinker,代碼行數:6,代碼來源:VisualStyleCreator.java


注:本文中的org.cytoscape.view.vizmap.mappings.PassthroughMapping類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。