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

Java BasicVisualLexicon类代码示例

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

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



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

示例1: createDomainBrowserStyle

import org.cytoscape.view.presentation.property.BasicVisualLexicon; //导入依赖的package包/类
public VisualStyle createDomainBrowserStyle() {

        Color noDomain = new Color(51, 51, 51);

        VisualStyle style = visualStyleFactory.createVisualStyle(DOMAIN_BROWSER_STYLE);

        style.setDefaultValue(BasicVisualLexicon.NETWORK_BACKGROUND_PAINT, Color.BLACK);

        style.setDefaultValue(BasicVisualLexicon.NODE_SIZE, 80D);
        style.setDefaultValue(BasicVisualLexicon.NODE_SHAPE, NodeShapeVisualProperty.ELLIPSE);
        style.setDefaultValue(BasicVisualLexicon.NODE_FILL_COLOR, noDomain);

        style.setDefaultValue(BasicVisualLexicon.EDGE_VISIBLE, false);

        VisualMappingFunction<String, Paint> fillFunction = passthroughMappingFactory.createVisualMappingFunction(COLOR_COLUMN,
                                                                                                                  String.class,
                                                                                                                  BasicVisualLexicon.NODE_FILL_COLOR);
        style.addVisualMappingFunction(fillFunction);

        VisualMappingFunction<Double, Double> zLocationFunction = passthroughMappingFactory.createVisualMappingFunction(StyleFactory.BRIGHTNESSS_COLUMN,
                                                                                                                        Double.class,
                                                                                                                        BasicVisualLexicon.NODE_Z_LOCATION);
        style.addVisualMappingFunction(zLocationFunction);

        return style;
    }
 
开发者ID:baryshnikova-lab,项目名称:safe-java,代码行数:27,代码来源:StyleFactory.java


示例2: forNodes

import org.cytoscape.view.presentation.property.BasicVisualLexicon; //导入依赖的package包/类
public static CoordinateData forNodes(CyNetworkView networkView, Collection<CyNode> nodes) {
	double xmin = 100000000;
	double xmax = -100000000;
	double ymin = 100000000;
	double ymax = -100000000;
	
	Map<CyNode,double[]> coordinates = new HashMap<>();
	Map<CyNode,Double> radii = new HashMap<>();
	
	for(CyNode node : nodes) {
		View<CyNode> nodeView = networkView.getNodeView(node);
		if(nodeView != null) {
			double x = nodeView.getVisualProperty(BasicVisualLexicon.NODE_X_LOCATION);
			double y = nodeView.getVisualProperty(BasicVisualLexicon.NODE_Y_LOCATION);
			double radius = nodeView.getVisualProperty(BasicVisualLexicon.NODE_WIDTH);
			
			coordinates.put(node, new double[]{x,y});
			radii.put(node, radius);
			
			xmin = Double.min(xmin, x);
			xmax = Double.max(xmax, x);
			ymin = Double.min(ymin, y);
			ymax = Double.max(ymax, y);
		}
	}
	
	return new CoordinateData(xmin, xmax, ymin, ymax, coordinates, radii);
}
 
开发者ID:BaderLab,项目名称:AutoAnnotateApp,代码行数:29,代码来源:CoordinateData.java


示例3: applyVisualStyle

import org.cytoscape.view.presentation.property.BasicVisualLexicon; //导入依赖的package包/类
private void applyVisualStyle(CyNetworkView originNetworkView, CyNetworkView summaryNetworkView, SummaryNetwork summaryNetwork) {
	VisualStyle vs = visualMappingManager.getVisualStyle(originNetworkView);
	
	for(View<CyNode> nodeView : summaryNetworkView.getNodeViews()) {
		// Label
		String name = summaryNetworkView.getModel().getRow(nodeView.getModel()).get("name", String.class);
		nodeView.setLockedValue(BasicVisualLexicon.NODE_LABEL, name);
		
		// Node size
		CyNode node = nodeView.getModel();
		SummaryCluster cluster = summaryNetwork.getClusterFor(node);
		int numNodes = cluster.getNodes().size();
		nodeView.setLockedValue(BasicVisualLexicon.NODE_SIZE, (double)numNodes);
	}
	
	visualMappingManager.setVisualStyle(vs, summaryNetworkView);
}
 
开发者ID:BaderLab,项目名称:AutoAnnotateApp,代码行数:18,代码来源:SummaryNetworkTask.java


示例4: makeMap

import org.cytoscape.view.presentation.property.BasicVisualLexicon; //导入依赖的package包/类
public void makeMap (CyApplicationManager manager){

		netMap=new HashMap<String,List<Double>>();
		networkView = manager.getCurrentNetworkView();
		network = manager.getCurrentNetwork();
		nameNetwork = network.getRow(network).get("name", String.class);
		//System.out.println("curr net 2 one" + network);
		List<CyNode> nodes = network.getNodeList();
		//networkView.setVisualProperty(BasicVisualLexicon.NETWORK_CENTER_X_LOCATION, 0.0);
		//networkView.setVisualProperty(BasicVisualLexicon.NETWORK_CENTER_Y_LOCATION, 0.0);


		for (CyNode node: nodes ){
			String name = network.getRow(node).get("name", String.class);
			nodeView= networkView.getNodeView(node) ;
			List<Double> XY = new ArrayList<Double>();
			Double xref = nodeView.getVisualProperty(BasicVisualLexicon.NODE_X_LOCATION);
			Double yref = nodeView.getVisualProperty(BasicVisualLexicon.NODE_Y_LOCATION);

			XY.add(xref);
			XY.add(yref);
			netMap.put(name, XY);
		}
	}
 
开发者ID:sysbio-curie,项目名称:DeDaL,代码行数:25,代码来源:DedalMethods.java


示例5: UpdateNodeNames

import org.cytoscape.view.presentation.property.BasicVisualLexicon; //导入依赖的package包/类
public static void UpdateNodeNames(CyNetworkView myNetView) {
if (done == 1) {
    return;
}

CyNetwork myNetwork = myNetView.getModel();
DataConnectionRest dataConnection = new DataConnectionRest();

for (View<CyNode> myNode : myNetView.getNodeViews()) {
    int nodeID = Integer.parseInt(myNetwork.getRow(myNode.getModel()).get(CyNetwork.NAME, String.class).replaceAll("\"", ""));
    String userName = dataConnection.getUserNameFromID(nodeID);
    myNode.setVisualProperty(BasicVisualLexicon.NODE_LABEL, userName);
    myNode.setVisualProperty(BasicVisualLexicon.NODE_WIDTH, userName.length() * 7.5);
}
myNetView.updateView();
done = 1;
   }
 
开发者ID:AutonlabCMU,项目名称:ActiveSearch,代码行数:18,代码来源:UpdateNodeNameViewTask.java


示例6: mapVariationCountToNodeSize

import org.cytoscape.view.presentation.property.BasicVisualLexicon; //导入依赖的package包/类
/**
 * Map variation_count to node size continuously.
 */
private void mapVariationCountToNodeSize()
{
    VisualStyle visualStyle = visualMappingManager.getCurrentVisualStyle();

    // remove existing node size mapping
    visualStyle.removeVisualMappingFunction(BasicVisualLexicon.NODE_SIZE);

    // create new continuous node size mapping
    ContinuousMapping<Integer, Double> nodeSizeMapping = (ContinuousMapping<Integer, Double>) continuousMappingFactory.createVisualMappingFunction("variation_count", Integer.class, BasicVisualLexicon.NODE_SIZE);

    Double smallest = Double.valueOf(30.0d);
    Double largest = Double.valueOf(90.0d);
    int maxVariationCount = maxCount(model.getNetwork(), "variation_count");
    nodeSizeMapping.addPoint(0, new BoundaryRangeValues(smallest, smallest, smallest));
    nodeSizeMapping.addPoint(maxVariationCount, new BoundaryRangeValues(largest, largest, largest));

    // install new mapping
    visualStyle.addVisualMappingFunction(nodeSizeMapping);
}
 
开发者ID:heuermh,项目名称:variation-cytoscape3-app,代码行数:23,代码来源:VisualMappingView.java


示例7: mapVariationCountToNodeColor

import org.cytoscape.view.presentation.property.BasicVisualLexicon; //导入依赖的package包/类
/**
 * Map variation_count to node color continuously.
 */
private void mapVariationCountToNodeColor()
{
    VisualStyle visualStyle = visualMappingManager.getCurrentVisualStyle();

    // remove existing node color mapping
    visualStyle.removeVisualMappingFunction(BasicVisualLexicon.NODE_FILL_COLOR);

    // create new continuous node color mapping
    ContinuousMapping<Integer, Paint> nodeColorMapping = (ContinuousMapping<Integer, Paint>) continuousMappingFactory.createVisualMappingFunction("variation_count", Integer.class, BasicVisualLexicon.NODE_FILL_COLOR);

    // blues-4
    Paint p0 = new Color(239, 243, 255);
    Paint p1 = new Color(189, 215, 231);
    Paint p2 = new Color(107, 174, 214);
    Paint p3 = new Color(33, 113, 181);
    int maxVariationCount = maxCount(model.getNetwork(), "variation_count");
    nodeColorMapping.addPoint(0, new BoundaryRangeValues(p0, p0, p0));
    nodeColorMapping.addPoint(maxVariationCount / 3, new BoundaryRangeValues(p1, p1, p1));
    nodeColorMapping.addPoint(2 * maxVariationCount / 3, new BoundaryRangeValues(p2, p2, p2));
    nodeColorMapping.addPoint(maxVariationCount, new BoundaryRangeValues(p3, p3, p3));

    // install new mapping
    visualStyle.addVisualMappingFunction(nodeColorMapping);
}
 
开发者ID:heuermh,项目名称:variation-cytoscape3-app,代码行数:28,代码来源:VisualMappingView.java


示例8: processCallResponse

import org.cytoscape.view.presentation.property.BasicVisualLexicon; //导入依赖的package包/类
@Override
public void processCallResponse(ExtensionCall call, Object callRetValue) {

	List<Double> values = (List<Double>)callRetValue;

	CyTable defNodeTab = currNet.getDefaultNodeTable();
	CyNetworkView networkView = getPlugin().getCyNetViewMgr().getNetworkViews(currNet).iterator().next();

	for(int i = 0; i < (values.size() / 3); ++i){
		Long neoid = values.get(i*3).longValue();
		Double x = values.get(i*3+1);
		Double y = values.get(i*3+2);

		Set<CyNode> nodeSet = CyUtils.getNodesWithValue(currNet, defNodeTab, "neoid", neoid);
		CyNode n = nodeSet.iterator().next();

		View<CyNode> nodeView = networkView.getNodeView(n);
		nodeView.setVisualProperty(BasicVisualLexicon.NODE_X_LOCATION, x);
		nodeView.setVisualProperty(BasicVisualLexicon.NODE_Y_LOCATION, y);

		CyUtils.updateVisualStyle(getPlugin().getVisualMappingManager(), networkView, currNet);
	}
}
 
开发者ID:gsummer,项目名称:cyNeo4j,代码行数:24,代码来源:ForceAtlas2LayoutExtExec.java


示例9: getArrowShape

import org.cytoscape.view.presentation.property.BasicVisualLexicon; //导入依赖的package包/类
@SuppressWarnings({ "unchecked", "rawtypes" })
private DiscreteMapping<String, ArrowShape> getArrowShape() {
	Class<String> dataType = String.class;
	DiscreteMapping<String, ArrowShape> arrowShapeMapper = (DiscreteMapping) plugin.getVisualMappingFunctionFactoryDiscrete().createVisualMappingFunction("datasource", dataType, BasicVisualLexicon.EDGE_TARGET_ARROW_SHAPE);
	
	ExtensionManager mgr = plugin.getExtensionManager(network);
	for(DataSource ds : mgr.getDatasources()) {
		arrowShapeMapper.putMapValue(ds.getName(), ArrowShapeVisualProperty.ARROW);
	}
	
       arrowShapeMapper.putMapValue("pp", ArrowShapeVisualProperty.CIRCLE);
       arrowShapeMapper.putMapValue("interaction", ArrowShapeVisualProperty.ARROW);
       arrowShapeMapper.putMapValue("Line, Arrow", ArrowShapeVisualProperty.ARROW);
       arrowShapeMapper.putMapValue("Line, TBar", ArrowShapeVisualProperty.T);
       arrowShapeMapper.putMapValue("group-connection", ArrowShapeVisualProperty.NONE);
       
       return arrowShapeMapper;
}
 
开发者ID:CyTargetLinker,项目名称:cytargetlinker,代码行数:19,代码来源:VisualStyleCreator.java


示例10: getNodeColor

import org.cytoscape.view.presentation.property.BasicVisualLexicon; //导入依赖的package包/类
@SuppressWarnings({ "unchecked", "rawtypes" })
private DiscreteMapping<String, Color> getNodeColor() {
	String ctrAttr = "biologicalType";
	Class<String> dataType = String.class; 
	
	DiscreteMapping<String, Color> dMapping = (DiscreteMapping) plugin.getVisualMappingFunctionFactoryDiscrete().createVisualMappingFunction(ctrAttr, dataType, BasicVisualLexicon.NODE_FILL_COLOR);
	
	String tf  = "transcriptionFactor";
	dMapping.putMapValue(tf, new Color(204, 255, 204));
	String gene  = "gene";
	dMapping.putMapValue(gene, new Color(255,204,204));
	String target  = "target";
	dMapping.putMapValue(target, new Color(255,204,204));
	String miRNA  = "microRNA";
	dMapping.putMapValue(miRNA, new Color(255, 255, 204));
	String drug  = "drug";
	dMapping.putMapValue(drug, new Color(204, 204, 255));
	
	return dMapping;
}
 
开发者ID:CyTargetLinker,项目名称:cytargetlinker,代码行数:21,代码来源:VisualStyleCreator.java


示例11: getNodeShapeStyle

import org.cytoscape.view.presentation.property.BasicVisualLexicon; //导入依赖的package包/类
@SuppressWarnings({ "unchecked", "rawtypes" })
private DiscreteMapping<String, NodeShape> getNodeShapeStyle() {
	String ctrAttr = "ctl.nodeType";
	Class<String> dataType = String.class; 
	
	DiscreteMapping<String, NodeShape> dMapping = (DiscreteMapping) plugin.getVisualMappingFunctionFactoryDiscrete().createVisualMappingFunction(ctrAttr, dataType, BasicVisualLexicon.NODE_SHAPE);

	String reg  = NodeType.REGULATOR.toString();
	dMapping.putMapValue(reg, NodeShapeVisualProperty.ROUND_RECTANGLE);
	String tar  = NodeType.TARGET.toString();
	dMapping.putMapValue(tar, NodeShapeVisualProperty.HEXAGON);
	String both  = NodeType.BOTH.toString();
	dMapping.putMapValue(both, NodeShapeVisualProperty.DIAMOND);
	String init  = NodeType.INITIAL.toString();
	dMapping.putMapValue(init, NodeShapeVisualProperty.ELLIPSE);
	
	return dMapping;
}
 
开发者ID:CyTargetLinker,项目名称:cytargetlinker,代码行数:19,代码来源:VisualStyleCreator.java


示例12: createAttributeBrowserStyle

import org.cytoscape.view.presentation.property.BasicVisualLexicon; //导入依赖的package包/类
public VisualStyle createAttributeBrowserStyle() {

        VisualStyle style = visualStyleFactory.createVisualStyle(ATTRIBUTE_BROWSER_STYLE);

        style.setDefaultValue(BasicVisualLexicon.NETWORK_BACKGROUND_PAINT, Color.BLACK);

        style.setDefaultValue(BasicVisualLexicon.NODE_SIZE, 80D);
        style.setDefaultValue(BasicVisualLexicon.NODE_SHAPE, NodeShapeVisualProperty.ELLIPSE);
        style.setDefaultValue(BasicVisualLexicon.NODE_FILL_COLOR, ZERO);

        style.setDefaultValue(BasicVisualLexicon.EDGE_VISIBLE, false);

        ContinuousMapping<Double, Paint> fillFunction = (ContinuousMapping<Double, Paint>) continuousMappingFactory.createVisualMappingFunction(HIGHLIGHT_COLUMN,
                                                                                                                                                Double.class,
                                                                                                                                                BasicVisualLexicon.NODE_FILL_COLOR);

        fillFunction.addPoint(-1D, new BoundaryRangeValues<>(NEGATIVE, NEGATIVE, NEGATIVE));
        fillFunction.addPoint(0D, new BoundaryRangeValues<>(ZERO, ZERO, ZERO));
        fillFunction.addPoint(1D, new BoundaryRangeValues<>(POSITIVE, POSITIVE, POSITIVE));
        style.addVisualMappingFunction(fillFunction);

        VisualMappingFunction<Double, Double> zLocationFunction = passthroughMappingFactory.createVisualMappingFunction(StyleFactory.BRIGHTNESSS_COLUMN,
                                                                                                                        Double.class,
                                                                                                                        BasicVisualLexicon.NODE_Z_LOCATION);
        style.addVisualMappingFunction(zLocationFunction);

        return style;
    }
 
开发者ID:baryshnikova-lab,项目名称:safe-java,代码行数:29,代码来源:StyleFactory.java


示例13: computeShapeArgs

import org.cytoscape.view.presentation.property.BasicVisualLexicon; //导入依赖的package包/类
private static ShapeArgs computeShapeArgs(AnnotationRenderer annotationRenderer, Cluster cluster) {
	AnnotationSet annotationSet = cluster.getParent();
	CyNetworkView view = annotationSet.getParent().getNetworkView();
	DisplayOptions displayOptions = annotationSet.getDisplayOptions();
	boolean isSelected = annotationRenderer.isSelected(cluster);
	
	ShapeType shapeType = displayOptions.getShapeType();
	int borderWidth = displayOptions.getBorderWidth() * (isSelected ? 3 : 1);
	int opacity = displayOptions.getOpacity();
	Color borderColor = isSelected ? SELECTED_COLOR : displayOptions.getBorderColor();
	Color fillColor = displayOptions.getFillColor();
	
	
	double zoom = view.getVisualProperty(BasicVisualLexicon.NETWORK_SCALE_FACTOR);

	CoordinateData coordinateData = cluster.getCoordinateData();
	double centreX = coordinateData.getCenterX();
	double centreY = coordinateData.getCenterY();
	double width  = Double.max(coordinateData.getWidth(),  minSize);
	double height = Double.max(coordinateData.getHeight(), minSize);
	
	if (shapeType == ShapeType.ELLIPSE) {
		while (nodesOutOfCluster(coordinateData, width, height, centreX, centreY, borderWidth)) {
			width *= 1.1;
			height *= 1.1;
		}
		width += 40;
		height += 40;
	} else {
		width += 50;
		height += 50;
	}
	
	// Set the position of the top-left corner of the ellipse
	Integer xPos = (int) Math.round(centreX - width/2);
	Integer yPos = (int) Math.round(centreY - height/2);
	
	return new ShapeArgs(xPos, yPos, width, height, zoom, shapeType, borderWidth, opacity, fillColor, borderColor);
}
 
开发者ID:BaderLab,项目名称:AutoAnnotateApp,代码行数:40,代码来源:DrawClusterTask.java


示例14: createNetworkView

import org.cytoscape.view.presentation.property.BasicVisualLexicon; //导入依赖的package包/类
private CyNetworkView createNetworkView(SummaryNetwork summaryNetwork) {
	CyNetworkView networkView = networkViewFactory.createNetworkView(summaryNetwork.network);
	for(View<CyNode> nodeView : networkView.getNodeViews()) {
		SummaryCluster cluster = summaryNetwork.getClusterFor(nodeView.getModel());
		Point2D.Double center = cluster.getCoordinateData().getCenter();
		nodeView.setVisualProperty(BasicVisualLexicon.NODE_X_LOCATION, center.x);
		nodeView.setVisualProperty(BasicVisualLexicon.NODE_Y_LOCATION, center.y);
	}
	return networkView;
}
 
开发者ID:BaderLab,项目名称:AutoAnnotateApp,代码行数:11,代码来源:SummaryNetworkTask.java


示例15: addNodes

import org.cytoscape.view.presentation.property.BasicVisualLexicon; //导入依赖的package包/类
/**
 * @desc - Adds nodes to the protein network from the information returned by the Slim* run.
 * @param uniprotIDs - list of all Uniprot IDs input to the returned run.
 * @param nodeIds - map linking all selected Uniprot IDs to their CyNodes, for easy access to the network.
 * @param newNetwork - CyNetwork of the network being altered.
 * @param networkViewManager - NetworkViewManager for the network being altered. Initialised in CyActivator.
 * @param manager - CyApplicationManager for the network being altered. Initialised in CyActivator.
 */
public void addNodes (List<String> uniprotIDs, Map<String, CyNode> nodeIds, CyNetwork newNetwork,
                      CyNetworkViewManager networkViewManager, CyApplicationManager manager) {

    // Add network view
    final Collection<CyNetworkView> views = networkViewManager.getNetworkViews(newNetwork);
    CyNetworkView myView = null;
    if(views.size() != 0) {
        myView = views.iterator().next();
    }

    if (myView == null) {
        // create a new view for my network
        myView = networkViewFactory.createNetworkView(newNetwork);
        networkViewManager.addNetworkView(myView);
    } else {
        System.out.println("networkView already existed.");
    }

    CyNetworkView networkView =  manager.getCurrentNetworkView();
    for (Object o : nodeIds.entrySet()) {
        Map.Entry pairs = (Map.Entry) o;
        CyNode node = (CyNode) pairs.getValue();
        View<CyNode> nodeView = networkView.getNodeView(node);
        nodeView.setLockedValue(BasicVisualLexicon.NODE_SHAPE, NodeShapeVisualProperty.ELLIPSE);
        nodeView.setLockedValue(BasicVisualLexicon.NODE_BORDER_PAINT, Color.BLACK);
        nodeView.setLockedValue(BasicVisualLexicon.NODE_SIZE, 60.0);
    }
}
 
开发者ID:passeridae,项目名称:SLiMscape,代码行数:37,代码来源:AlterGraph.java


示例16: getEdgeColor

import org.cytoscape.view.presentation.property.BasicVisualLexicon; //导入依赖的package包/类
@SuppressWarnings({ "unchecked", "rawtypes" })
private DiscreteMapping<String, Color> getEdgeColor() {
	Class<String> dataType = String.class;
	DiscreteMapping<String, Color> edgeColorMapper = (DiscreteMapping) plugin.getVisualMappingFunctionFactoryDiscrete().createVisualMappingFunction("datasource", dataType, BasicVisualLexicon.EDGE_STROKE_UNSELECTED_PAINT);		
	ExtensionManager mgr = plugin.getExtensionManager(network);
	for(DataSource ds : mgr.getDatasources()) {
		edgeColorMapper.putMapValue(ds.getName(), ds.getColor());
	}
        
    return edgeColorMapper;
}
 
开发者ID:CyTargetLinker,项目名称:cytargetlinker,代码行数:12,代码来源:VisualStyleCreator.java


示例17: draw

import org.cytoscape.view.presentation.property.BasicVisualLexicon; //导入依赖的package包/类
@Override
public void draw() {
    color(Color.BLACK);
    translate(topLeft);
    
    // Get label bounds, but also sets label font.
    PVector bounds = Layout.labelDimensions(element, true);
    Shape shape = shape(bounds);
    translate(-0.5 * bounds.x, -0.5 * bounds.y);
    
    // Background rectangle.
    color(highlight() ? containmentColor :
                        (Color) styleValue(BasicVisualLexicon.NODE_FILL_COLOR));
    fill(shape);
    //fillRect(0, 0, bounds.x, bounds.y, bounds.y);
    
    // Foreground outline with color coding.
    color((Color) styleValue(BasicVisualLexicon.NODE_BORDER_PAINT));
    strokeWeight(styleValue(BasicVisualLexicon.NODE_BORDER_WIDTH));
    StaticGraphics.draw(shape);
    //drawRect(0, 0, bounds.x, bounds.y, bounds.y);
    
    picking();
    color(highlight() ? textContainedColor :
                        (Color) styleValue(BasicVisualLexicon.NODE_LABEL_COLOR));
    text(element.toString(), 0.5 * (bounds.y + NODE_OUTLINE) - 3,
                             bounds.y - NODE_OUTLINE - 3);
}
 
开发者ID:ls-cwi,项目名称:eXamine,代码行数:29,代码来源:NodeRepresentation.java


示例18: computeLabelArgs

import org.cytoscape.view.presentation.property.BasicVisualLexicon; //导入依赖的package包/类
public static LabelArgs computeLabelArgs(AnnotationRenderer annotationRenderer, Cluster cluster) {
	AnnotationSet annotationSet = cluster.getParent();
	CyNetworkView view = annotationSet.getParent().getNetworkView();
	DisplayOptions displayOptions = annotationSet.getDisplayOptions();
	boolean isSelected = annotationRenderer.isSelected(cluster);
	
	double zoom = view.getVisualProperty(BasicVisualLexicon.NETWORK_SCALE_FACTOR);
	String labelText = cluster.getLabel();
	
	double xPos=0.0, yPos=0.0, width=0.0, height=0.0;
	
	if(annotationRenderer.getShapeAnnotation(cluster) != null) {
		Map<String,String> shapeArgs = annotationRenderer.getShapeAnnotation(cluster).getArgMap();
		xPos = Double.parseDouble(shapeArgs.get("x"));
		yPos = Double.parseDouble(shapeArgs.get("y"));
		width = Double.parseDouble(shapeArgs.get("width"));
		height = Double.parseDouble(shapeArgs.get("height"));
	}
	
	double labelFontSize;
	if(displayOptions.isUseConstantFontSize()) {
		labelFontSize = displayOptions.getFontSize();
	}
	else {
		int baseFontSize = 2 * (int) Math.round(5 * Math.pow(cluster.getNodeCount(), 0.4));
		labelFontSize = (int) Math.round(((double)displayOptions.getFontScale()/DisplayOptions.FONT_SCALE_MAX) * baseFontSize);
	}
	
	double labelWidth = 2.3;
	double labelHeight = 4.8;
	if(labelText != null) {
		labelWidth= 2.3*labelFontSize*labelText.length();
		labelHeight = 4.8*labelFontSize;
	}
	
	// MKTODO Default to above-centered for now
	double xOffset = 0.5;
	double yOffset = 0.0;
	// Set the position of the label relative to the ellipse
	if (yOffset == 0.5 && xOffset != 0.5) {
		// If vertically centered, label should go outside of cluster (to the right or left)
		xPos = (int) Math.round(xPos + width/zoom*xOffset + labelWidth*(xOffset-1));
	} else {
		xPos = (int) Math.round(xPos + width/zoom*xOffset - labelWidth*xOffset);
	}
	yPos = (int) Math.round(yPos + height/zoom*yOffset - labelHeight*(1.0-yOffset) - 10 + yOffset*20.0);
	
	double fontSize = 5*zoom*labelFontSize;
	
	Color fontColor = isSelected ? SELECTED_COLOR : displayOptions.getFontColor();
	
	return new LabelArgs(xPos, yPos, width, height, zoom, labelText, fontSize, fontColor);
}
 
开发者ID:BaderLab,项目名称:AutoAnnotateApp,代码行数:54,代码来源:DrawClusterTask.java


示例19: isHidden

import org.cytoscape.view.presentation.property.BasicVisualLexicon; //导入依赖的package包/类
private static boolean isHidden(View<CyNode> nodeView) {
	if(nodeView == null)
		return false;
	return nodeView.getVisualProperty(BasicVisualLexicon.NODE_VISIBLE) == Boolean.FALSE;
}
 
开发者ID:BaderLab,项目名称:AutoAnnotateApp,代码行数:6,代码来源:CreateAnnotationSetTask.java


示例20: doSimpleGridLayout

import org.cytoscape.view.presentation.property.BasicVisualLexicon; //导入依赖的package包/类
private void doSimpleGridLayout(Set<CyNode> nodesAdded) 
{		
	double x = 0;
	double y = 0;
	
	int rowSize = (int)Math.ceil(Math.sqrt (nodesAdded.size()));
	int count = 0;
	
	final double INTERDISTANCE = 50;
	
	int missingCount = 0;
	
	for (CyNode node : nodesAdded)
	{
		View<CyNode> nodeView = myView.getNodeView(node);

		if (nodeView != null)
		{
			nodeView.setVisualProperty(BasicVisualLexicon.NODE_X_LOCATION, x);
			nodeView.setVisualProperty(BasicVisualLexicon.NODE_Y_LOCATION, y);
		}
		else
		{
			missingCount++;
		}
		
		if ((++count) % rowSize == 0)
		{
			x = 0;
			y += INTERDISTANCE;
		}
		else
		{
			x += INTERDISTANCE;
		}
	}

	// TODO what strange magic is this? - even though we always call flushPayloadEvents, some
	// node views seem not to be created yet at this time.
	if (missingCount > 0) System.out.println (missingCount + " node views were not yet created...");
}
 
开发者ID:generalbioinformatics,项目名称:general-sparql-cy3,代码行数:42,代码来源:CytoscapeV3Mapper.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Java IEnergyAcceptor类代码示例发布时间:2022-05-22
下一篇:
Java Bytecode类代码示例发布时间: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