本文整理汇总了Java中org.cytoscape.view.vizmap.VisualStyle类的典型用法代码示例。如果您正苦于以下问题:Java VisualStyle类的具体用法?Java VisualStyle怎么用?Java VisualStyle使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
VisualStyle类属于org.cytoscape.view.vizmap包,在下文中一共展示了VisualStyle类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setAttributeBrowserStyle
import org.cytoscape.view.vizmap.VisualStyle; //导入依赖的package包/类
void setAttributeBrowserStyle(CyNetworkView view) {
if (!SwingUtilities.isEventDispatchThread()) {
SwingUtilities.invokeLater(() -> setAttributeBrowserStyle(view));
return;
}
VisualStyle style = visualMappingManager.getAllVisualStyles()
.stream()
.filter(s -> s.getTitle()
.equals(StyleFactory.ATTRIBUTE_BROWSER_STYLE))
.findFirst()
.orElse(null);
if (style == null) {
style = styleFactory.createAttributeBrowserStyle();
visualMappingManager.addVisualStyle(style);
}
VisualStyle viewStyle = visualMappingManager.getVisualStyle(view);
if (viewStyle != style) {
visualMappingManager.setVisualStyle(style, view);
}
}
示例2: setDomainBrowserStyle
import org.cytoscape.view.vizmap.VisualStyle; //导入依赖的package包/类
void setDomainBrowserStyle(CyNetworkView view) {
if (!SwingUtilities.isEventDispatchThread()) {
SwingUtilities.invokeLater(() -> setDomainBrowserStyle(view));
return;
}
VisualStyle style = visualMappingManager.getAllVisualStyles()
.stream()
.filter(s -> s.getTitle()
.equals(StyleFactory.DOMAIN_BROWSER_STYLE))
.findFirst()
.orElse(null);
if (style == null) {
style = styleFactory.createDomainBrowserStyle();
visualMappingManager.addVisualStyle(style);
}
VisualStyle viewStyle = visualMappingManager.getVisualStyle(view);
if (viewStyle != style) {
visualMappingManager.setVisualStyle(style, view);
}
}
示例3: createDomainBrowserStyle
import org.cytoscape.view.vizmap.VisualStyle; //导入依赖的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;
}
示例4: applyVisualStyle
import org.cytoscape.view.vizmap.VisualStyle; //导入依赖的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);
}
示例5: run
import org.cytoscape.view.vizmap.VisualStyle; //导入依赖的package包/类
@Override
public void run(final TaskMonitor taskMonitor) throws Exception {
for (VisualStyle style : visualMappingManager.getAllVisualStyles()) {
if (style.getTitle().equals(GFDNET_VIZMAP_FILE)) {
return;
}
}
URL url = this.getClass().getClassLoader().getResource(GFDNET_VIZMAP_FILE);
VizmapReader reader = vizmapReaderManager.getReader(url.toURI(), url.getPath());
if (reader == null) {
throw new NullPointerException("Failed to find Default Vizmap loader.");
}
insertTasksAfterCurrentTask(reader, new AddVisualStylesTask(reader));
}
示例6: mapVariationCountToNodeSize
import org.cytoscape.view.vizmap.VisualStyle; //导入依赖的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);
}
示例7: mapVariationCountToNodeColor
import org.cytoscape.view.vizmap.VisualStyle; //导入依赖的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);
}
示例8: createAttributeBrowserStyle
import org.cytoscape.view.vizmap.VisualStyle; //导入依赖的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;
}
示例9: handleEvent
import org.cytoscape.view.vizmap.VisualStyle; //导入依赖的package包/类
@Override
public void handleEvent(NetworkViewAddedEvent e) {
// always apply the style and layout to new BioPAX views,
// except when they come from a session that is being loaded
if(loadingSession)
return;
final CyNetworkView view = e.getNetworkView();
final CyNetwork cyNetwork = view.getModel();
if(isBioPaxNetwork(cyNetwork)) {
VisualStyle style = null;
String kind = cyNetwork.getRow(cyNetwork).get(BioPaxMapper.BIOPAX_NETWORK, String.class);
if ("DEFAULT".equals(kind))
style = visualStyleUtil.getBioPaxVisualStyle();
else if ("SIF".equals(kind))
style = visualStyleUtil.getBinarySifVisualStyle();
//apply style and layout
if(style != null) {
final VisualStyle vs = style;
//apply style and layout
SwingUtilities.invokeLater(new Runnable() {
public void run() {
layout(view);
cyServices.mappingManager.setVisualStyle(vs, view);
vs.apply(view);
view.updateView();
}
});
}
}
}
示例10: findBiopaxVisualStyle
import org.cytoscape.view.vizmap.VisualStyle; //导入依赖的package包/类
private VisualStyle findBiopaxVisualStyle(String biopaxVisualStyleTitle) {
for(VisualStyle vs : mappingManager.getAllVisualStyles()) {
if(biopaxVisualStyleTitle.equals(vs.getTitle())) {
return vs;
}
}
return null;
}
示例11: flushView
import org.cytoscape.view.vizmap.VisualStyle; //导入依赖的package包/类
private void flushView()
{
CyEventHelper eventHelper = adapter.getCyEventHelper();
eventHelper.flushPayloadEvents(); // will cause node views to be created...
if (myView != null) // myView could be null if the first query returned zero results, so nodes were created. This is not a bug.
{
VisualStyle vs = createOrGetVisualStyle();
vs.apply(myView);
myView.updateView();
}
}
示例12: applyVisualStyle
import org.cytoscape.view.vizmap.VisualStyle; //导入依赖的package包/类
private void applyVisualStyle() {
for (VisualStyle style : visualMappingManager.getAllVisualStyles()) {
if (style.getTitle().equals("GFD-Net Style")) {
style.apply(networkView);
break;
}
}
}
示例13: findVisualStyleByTitle
import org.cytoscape.view.vizmap.VisualStyle; //导入依赖的package包/类
/**
* Return the {@link VisualStyle}, identified by {@code title}, or {@code null}
* if it does not exist in {@link VisualMappingManager}.
*
* @param title {@link String} title; cannot be {@code null}
* @param mgr {@link VisualMappingManager} Cytoscape service; cannot be {@code null}
* @return the {@link VisualStyle} or {@code null} if it does not exist
*/
public static VisualStyle findVisualStyleByTitle(String title, VisualMappingManager mgr) {
if (mgr == null) throw new NullPointerException("mgr cannot be null");
if (title == null) throw new NullPointerException("title cannot be null");
for (VisualStyle vs : mgr.getAllVisualStyles()) {
if (vs.getTitle().equals(title))
return vs;
}
return null;
}
示例14: buildCyNetworkView
import org.cytoscape.view.vizmap.VisualStyle; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public CyNetworkView buildCyNetworkView(CyNetwork network) {
final CyNetworkView view = cyNetworkViewFactory.createNetworkView(network);
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
// find the style we would like to apply...
VisualStyle style = StyleUtility.findVisualStyleByTitle(APPLIED_VISUAL_STYLE, visMgr);
// ...return if view or style do not exist
if (view == null || style == null) return;
// ...wait for view to be active before setting visual style
try { Thread.sleep(500); } catch (InterruptedException e) {}
Set<CyNetworkView> views = networkViewMgr.getNetworkViewSet();
if (views.contains(view)) {
// ...then set visual style and fit network content in window
eventHelper.flushPayloadEvents();
visMgr.setVisualStyle(style, view);
style.apply(view);
view.fitContent();
view.updateView();
}
}
});
return view;
}
示例15: getVSstyle
import org.cytoscape.view.vizmap.VisualStyle; //导入依赖的package包/类
private VisualStyle getVSstyle(VisualMappingManager vmm,
String name) {
Set<VisualStyle> vss = vmm.getAllVisualStyles();
for(final VisualStyle v : vss) {
if(v.getTitle() == name)
return v;
}
return null;
}