本文整理汇总了Java中prefuse.util.ColorLib.rgb方法的典型用法代码示例。如果您正苦于以下问题:Java ColorLib.rgb方法的具体用法?Java ColorLib.rgb怎么用?Java ColorLib.rgb使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类prefuse.util.ColorLib
的用法示例。
在下文中一共展示了ColorLib.rgb方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getColor
import prefuse.util.ColorLib; //导入方法依赖的package包/类
@Override
public int getColor( VisualItem item )
{
if( m_vis.isInGroup( item, Visualization.SEARCH_ITEMS ) )
{
return ColorLib.rgb( 255, 190, 190 );
}
else if( m_vis.isInGroup( item, Visualization.FOCUS_ITEMS ) )
{
return ColorLib.rgb( 198, 229, 229 );
}
else if( item.getDOI() > -1 )
{
return ColorLib.rgb( 164, 193, 193 );
}
else
{
return ColorLib.rgba( 255, 255, 255, 0 );
}
}
示例2: getColor
import prefuse.util.ColorLib; //导入方法依赖的package包/类
public int getColor(VisualItem item) {
if ( m_vis.isInGroup(item, Visualization.SEARCH_ITEMS) )
return ColorLib.rgb(255,190,190);
else if ( m_vis.isInGroup(item, Visualization.FOCUS_ITEMS) )
return ColorLib.rgb(198,229,229);
else if ( item.getDOI() > -1 )
return ColorLib.rgb(164,193,193);
else
return ColorLib.rgba(100,100,100,0);
}
示例3: getColor
import prefuse.util.ColorLib; //导入方法依赖的package包/类
public int getColor(VisualItem item) {
if ( m_vis.isInGroup(item, Visualization.SEARCH_ITEMS) )
return ColorLib.rgb(255,190,190);
else if ( m_vis.isInGroup(item, Visualization.FOCUS_ITEMS) )
return ColorLib.rgb(198,229,229);
else if ( item.getDOI() > -1 )
return ColorLib.rgb(164,193,193);
else
return ColorLib.rgba(255,255,255,0);
}
示例4: EdgeColorAction
import prefuse.util.ColorLib; //导入方法依赖的package包/类
public EdgeColorAction(String group) {
super(group, VisualItem.STROKECOLOR, ColorLib.rgb(100, 200, 200));
add(VisualItem.HOVER, ColorLib.rgb(255, 200, 125));
add(VisualItem.HIGHLIGHT, ColorLib.rgb(255, 200, 125));
add("CaColor", ColorLib.rgb(0, 255, 0));
add("CeColor", ColorLib.rgb(137, 0, 255));
add("mutualColor", ColorLib.rgb(140, 140, 140));
}
示例5: getColor
import prefuse.util.ColorLib; //导入方法依赖的package包/类
public int getColor(VisualItem item) {
if (m_vis.isInGroup(item, Visualization.SEARCH_ITEMS))
return ColorLib.rgb(255, 190, 190);
else if (m_vis.isInGroup(item, Visualization.FOCUS_ITEMS))
return ColorLib.rgb(198, 229, 229);
else if (item.getDOI() > -1)
return ColorLib.rgb(164, 193, 193);
else
return ColorLib.rgba(255, 255, 255, 0);
}
示例6: RenderPrefuseGraph
import prefuse.util.ColorLib; //导入方法依赖的package包/类
/**
* @param prefuseDisplay
* @param graph
* @param id
*/
public RenderPrefuseGraph(Display prefuseDisplay, Graph graph, String id) {
/* default color for nodes and edges
* both is overwritten later (NodeRenderer and TextLayoutDecorator) */
ColorAction fill = new ColorAction("GraphDataModifier.nodes", VisualItem.FILLCOLOR, ColorLib.rgb(0, 200, 0));
ColorAction edges = new ColorAction("GraphDataModifier.edges", VisualItem.STROKECOLOR, ColorLib.rgb(0, 0, 0));
ColorAction arrow = new ColorAction("GraphDataModifier.edges", VisualItem.FILLCOLOR, ColorLib.rgb(0, 0, 0));
fill.add(VisualItem.FIXED, ColorLib.rgb(0, 250, 0));
fill.add(VisualItem.HIGHLIGHT, ColorLib.rgb(0, 250, 0));
ActionList layout = new ActionList(Activity.INFINITY);
layout.add(fill); // add default node color
layout.add(edges); // add default edge color
layout.add(arrow); // add default edge color
// set layout as force directed layout without (all objects must be displayed)
ForceDirectedLayoutExtended fdle = new ForceDirectedLayoutExtended("GraphDataModifier", false);
PrefuseForceAbstractLayoutStorage.addForceDirectedLayout(fdle, id);
layout.add(fdle);
layout.add(new TextLayoutDecorator("nodedec"));
layout.add(new TextLayoutDecorator("NodeExtraData"));
layout.add(new TextLayoutDecorator("EdgeExtraData"));
layout.add(new RepaintAction());
layout.add(new TextLayoutDecorator("edgeDeco"));
final Visualization vis = new Visualization();
vis.add("GraphDataModifier", graph);
vis.putAction("layout", layout);
NodeRenderer nodeRender = new NodeRenderer();
EdgeRender edgeRender = new EdgeRender(prefuse.Constants.EDGE_TYPE_LINE, prefuse.Constants.EDGE_ARROW_FORWARD);
edgeRender.setArrowHeadSize(10, 10);
DefaultRendererFactory drf = new DefaultRendererFactory();
drf.setDefaultRenderer(nodeRender);
drf.setDefaultEdgeRenderer(edgeRender);
drf.add(new InGroupPredicate("edgeDeco"), new LabelRenderer(ColumnNames.NAME));
drf.add(new InGroupPredicate("nodedec"), new LabelRenderer(ColumnNames.NAME));
final Schema DECATOR_SCHEMA = PrefuseLib.getVisualItemSchema();
DECATOR_SCHEMA.setDefault(VisualItem.INTERACTIVE, false);
DECATOR_SCHEMA.setDefault(VisualItem.TEXTCOLOR, ColorLib.rgb(255, 255, 255));
final Schema DECATOR_SCHEMA_EDGES = PrefuseLib.getVisualItemSchema();
DECATOR_SCHEMA_EDGES.setDefault(VisualItem.INTERACTIVE, true);
DECATOR_SCHEMA_EDGES.setDefault(VisualItem.TEXTCOLOR, ColorLib.rgb(255, 255, 255));
DECATOR_SCHEMA.setDefault(VisualItem.FONT, FontUsed.getFont());
DECATOR_SCHEMA.setDefault(VisualItem.TEXTCOLOR, ColorLib.gray(0));
// add extra name field (should be done before the normal name field [for edges], otherwise normal field is covered with extra name background)
final Schema DECATOR_SCHEMA_NAME_EXTRA = PrefuseLib.getVisualItemSchema();
DECATOR_SCHEMA_NAME_EXTRA.setDefault(VisualItem.SIZE, NameExtraDataSize);
DECATOR_SCHEMA_NAME_EXTRA.setDefault(VisualItem.INTERACTIVE, false);
drf.add(new InGroupPredicate("NodeExtraData"), new LabelRenderer(ColumnNames.NAME_DATA));
vis.addDecorators("NodeExtraData", "GraphDataModifier.nodes", DECATOR_SCHEMA_NAME_EXTRA);
drf.add(new InGroupPredicate("EdgeExtraData"), new LabelRenderer(ColumnNames.NAME_DATA));
// disabled because unhappy with the optical result
// vis.addDecorators("EdgeExtraData", "GraphDataModifier.edges", DECATOR_SCHEMA_NAME_EXTRA);
// add short name decorators
vis.addDecorators("edgeDeco", "GraphDataModifier.edges", DECATOR_SCHEMA_EDGES);
vis.addDecorators("nodedec", "GraphDataModifier.nodes", DECATOR_SCHEMA);
vis.setRendererFactory(drf);
prefuseDisplay.setVisualization(vis);
vis.run("layout");
}
示例7: StackedGraphDisplay
import prefuse.util.ColorLib; //导入方法依赖的package包/类
StackedGraphDisplay()
{
super( new Visualization() );
setBackground( ColorLib.getColor( 0, 51, 88 ) );
LabelRenderer labelRenderer = new LabelRenderer( NAME_LABEL );
labelRenderer.setVerticalAlignment( Constants.BOTTOM );
labelRenderer.setHorizontalAlignment( Constants.LEFT );
EdgeRenderer usesRenderer = new EdgeRenderer( Constants.EDGE_TYPE_CURVE, Constants.EDGE_ARROW_FORWARD );
usesRenderer.setHorizontalAlignment1( Constants.CENTER );
usesRenderer.setHorizontalAlignment2( Constants.CENTER );
usesRenderer.setVerticalAlignment1( Constants.BOTTOM );
usesRenderer.setVerticalAlignment2( Constants.TOP );
Predicate usesPredicate = (Predicate) ExpressionParser.parse( "ingroup('graph.edges') AND [" + USES_EDGES + "]==true", true );
// set up the renderers - one for nodes and one for LABELS
DefaultRendererFactory rf = new DefaultRendererFactory();
rf.add( new InGroupPredicate( GRAPH_NODES ), new NodeRenderer() );
rf.add( new InGroupPredicate( LABELS ), labelRenderer );
rf.add( usesPredicate, usesRenderer );
m_vis.setRendererFactory( rf );
// border colors
ColorAction borderColor = new BorderColorAction( GRAPH_NODES );
ColorAction fillColor = new FillColorAction( GRAPH_NODES );
// uses edge colors
ItemAction usesColor = new ColorAction( GRAPH_EDGES, usesPredicate, VisualItem.STROKECOLOR, ColorLib.rgb( 50, 50, 50 ) );
ItemAction usesArrow = new ColorAction( GRAPH_EDGES, usesPredicate, VisualItem.FILLCOLOR, ColorLib.rgb( 50, 50, 50 ) );
// color settings
ActionList colors = new ActionList();
colors.add( fillColor );
colors.add( borderColor );
colors.add( usesColor );
colors.add( usesArrow );
m_vis.putAction( COLORS_ACTION, colors );
ActionList autoPan = new ActionList();
autoPan.add( colors );
autoPan.add( new AutoPanAction() );
autoPan.add( new RepaintAction() );
m_vis.putAction( AUTO_PAN_ACTION, autoPan );
// create the layout action list
stackedLayout = new StackedLayout( GRAPH );
ActionList layout = new ActionList();
layout.add( stackedLayout );
layout.add( new LabelLayout( LABELS ) );
layout.add( autoPan );
m_vis.putAction( LAYOUT_ACTION, layout );
// initialize our display
Dimension size = new Dimension( 400, 400 );
setSize( size );
setPreferredSize( size );
setItemSorter( new ExtendedTreeDepthItemSorter( true ) );
addControlListener( new HoverControl() );
addControlListener( new FocusControl( 1, COLORS_ACTION ) );
addControlListener( new WheelMouseControl() );
addControlListener( new PanControl( true ) );
addControlListener( new ItemSelectionControl() );
setDamageRedraw( true );
}
示例8: initVisualization
import prefuse.util.ColorLib; //导入方法依赖的package包/类
private void initVisualization() {
/*try
{
graph = new GraphMLReader().readGraph("/socialnet.xml");
} catch ( DataIOException e ) {
e.printStackTrace();
System.err.println("Error loading graph. Exiting...");
System.exit(1);
}*/
Graph graph = data.getIPGraph();
vis = new Visualization();
vis.add(GRAPH, graph);
LabelRenderer r = new LabelRenderer(data.ADDRESS);
r.setRoundedCorner(8,8);
r.setRenderType(LabelRenderer.RENDER_TYPE_DRAW_AND_FILL);
vis.setRendererFactory(new DefaultRendererFactory(r));
/*int [] palette = new int[] {
ColorLib.rgb(255,180,180), ColorLib.rgb(190,190,255)
};
DataColorAction fill = new DataColorAction("graph.nodes","gender",
Constants.NOMINAL,VisualItem.FILLCOLOR,palette);*/
ColorAction draw = new ColorAction(NODES,VisualItem.STROKECOLOR,ColorLib.gray(0));
ColorAction fill = new ColorAction(NODES,VisualItem.FILLCOLOR,ColorLib.rgb(210, 210, 255));
ColorAction text = new ColorAction(NODES,VisualItem.TEXTCOLOR,ColorLib.gray(0));
ColorAction edges = new ColorAction(EDGES,VisualItem.STROKECOLOR,ColorLib.gray(200));
ActionList color = new ActionList(Activity.INFINITY,1000);
color.add(data.getLockAction());
color.add(draw);
color.add(fill);
color.add(text);
color.add(edges);
color.add(data.getUnlockAction());
//ActionList layout = new ActionList(Activity.INFINITY,100);
ActionList layout = new ActionList(Activity.INFINITY,1000);
layout.add(data.getLockAction());
layout.add(new GridMinusCircle(150,10,NODES));
layout.add(data.getUnlockAction());
layout.add(new RepaintAction());
vis.putAction(COLOR, color);
vis.putAction(LAYOUT,layout);
display = new Display(vis);
display.setSize(720,500);
display.addControlListener(new ZoomControl());
display.addControlListener(new DragControl());
display.addControlListener(new PanControl());
TupleTableModel ttm = new TupleTableModel(graph.getEdgeTable());
node_table = new JTable(ttm);
node_table.getTableHeader().addMouseListener(ttm);
//ttm.addTableModelListener(node_table);
//node_table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
node_table.addMouseListener(new JTableMouseListener());
}
示例9: createVisualizationV2
import prefuse.util.ColorLib; //导入方法依赖的package包/类
/**
* Phase 2 from the example http://www.ifs.tuwien.ac.at/~rind/w/doku.php/java/prefuse-scatterplot without tooltip control
*
* @param data
* @return
*/
private View createVisualizationV2(Table data)
{
final Visualization vis = new Visualization();
PDisplay display = new PDisplay(this, vis);
// STEP 1: setup the visualized data
vis.add("data", data);
/* STEP 2: set up renderers for the visual data */
vis.setRendererFactory(new DefaultRendererFactory(new ShapeRenderer(12)));
// STEP 3: create actions to process the visual data
AxisLayout x_axis = new AxisLayout("data", "NBZ", Constants.X_AXIS, VisiblePredicate.TRUE);
AxisLayout y_axis = new AxisLayout("data", "BMI", Constants.Y_AXIS, VisiblePredicate.TRUE);
ColorAction color = new ColorAction("data", VisualItem.STROKECOLOR, ColorLib.rgb(100, 100, 255));
int[] palette =
{ Constants.SHAPE_STAR, Constants.SHAPE_ELLIPSE };
DataShapeAction shape = new DataShapeAction("data", "Insult", palette);
ActionList draw = new ActionList();
draw.add(x_axis);
draw.add(y_axis);
draw.add(color);
draw.add(shape);
draw.add(new RepaintAction());
vis.putAction("draw", draw);
// --------------------------------------------------------------------
// STEP 4: set up a display and controls
display.setHighQuality(true);
display.setSize(700, 450);
// display.setBorder(BorderFactory.createEmptyBorder(15, 30, 15, 30));
// // TODO for Dritan: setBorder method was in JComponent. See if there
// is a similar method in Android.View
display.setBorders(15, 30, 15, 30);
// STEP 5: launching the visualization. The visualization must run after
// the Display is ready (Android View)
// TODO for Dritan: using dispay.post seems to be not a good solution.
// Fix this before releasing the final solution
display.post(new Runnable()
{
@Override
public void run()
{
vis.run("draw");
}
});
return display;
}
示例10: createVisualizationV1
import prefuse.util.ColorLib; //导入方法依赖的package包/类
/**
* Phase 1 from the example http://www.ifs.tuwien.ac.at/~rind/w/doku.php/java/prefuse-scatterplot
*
* @param data
* @return
*/
private View createVisualizationV1(Table data)
{
final Visualization vis = new Visualization();
PDisplay display = new PDisplay(this, vis);
// --------------------------------------------------------------------
// STEP 1: setup the visualized data
vis.add("data", data);
// --------------------------------------------------------------------
// STEP 2: set up renderers for the visual data
// --------------------------------------------------------------------
// STEP 3: create actions to process the visual data
AxisLayout x_axis = new AxisLayout("data", "NBZ", Constants.X_AXIS, VisiblePredicate.TRUE);
AxisLayout y_axis = new AxisLayout("data", "BMI", Constants.Y_AXIS, VisiblePredicate.TRUE);
ColorAction color = new ColorAction("data", VisualItem.STROKECOLOR, ColorLib.rgb(100, 100, 255));
ActionList draw = new ActionList();
draw.add(x_axis);
draw.add(y_axis);
draw.add(color);
vis.putAction("draw", draw);
// --------------------------------------------------------------------
// STEP 4: set up a display and controls
// --------------------------------------------------------------------
// STEP 5: launching the visualization. The visualization must run after
// the Display is ready (Android View)
// TODO for Dritan: using dispay.post seems to be not a good solution.
// Fix this before releasing the final solution
display.post(new Runnable()
{
@Override
public void run()
{
vis.run("draw");
}
});
return display;
}
示例11: getInt
import prefuse.util.ColorLib; //导入方法依赖的package包/类
public int getInt(Tuple t) {
int r = param(0).getInt(t);
int g = param(1).getInt(t);
int b = param(2).getInt(t);
return ColorLib.rgb(r,g,b);
}
示例12: initialiseTreeView
import prefuse.util.ColorLib; //导入方法依赖的package包/类
@Override
public void initialiseTreeView(Tree t, Dimension size, String label, int orientation) {
this.m_orientation = orientation;
m_vis.add(tree, t);
m_nodeRenderer = new LabelRenderer(null, "image");
m_edgeRenderer = new EdgeRenderer(Constants.EDGE_TYPE_CURVE);
m_edgeRenderer.setDefaultLineWidth(4);
DefaultRendererFactory rf = new DefaultRendererFactory(m_nodeRenderer);
rf.add(new InGroupPredicate(treeEdges), m_edgeRenderer);
m_vis.setRendererFactory(rf);
int[] colorPalette = new int[]{ColorLib.rgb(51, 51, 51), ColorLib.rgb(51, 51, 51), ColorLib.rgb(51, 51, 51)};
DataColorAction dataColorAction = new DataColorAction("tree.nodes", "type", Constants.NOMINAL, VisualItem.TEXTCOLOR, colorPalette);
// colors
ItemAction nodeColor = new WorkflowNodeColorAction(treeNodes);
m_vis.putAction("textColor", dataColorAction);
ItemAction edgeColor = new ColorAction(treeEdges,
VisualItem.STROKECOLOR, ColorLib.rgba(51, 51, 51, 100));
// quick repaint
ActionList repaint = new ActionList();
repaint.add(nodeColor);
repaint.add(new RepaintAction());
m_vis.putAction("repaint", repaint);
// full paint
ActionList fullPaint = new ActionList();
fullPaint.add(nodeColor);
m_vis.putAction("fullPaint", fullPaint);
// create the tree layout action
NodeLinkTreeLayout treeLayout = new NodeLinkTreeLayout(tree,
m_orientation, 80, 70, 8);
treeLayout.setLayoutAnchor(new Point2D.Double(size.width / 2, 15));
m_vis.putAction("treeLayout", treeLayout);
CollapsedSubtreeLayout subLayout = new CollapsedSubtreeLayout(tree,
m_orientation);
m_vis.putAction("subLayout", subLayout);
createAndAddFilter(dataColorAction, nodeColor, edgeColor, treeLayout, subLayout);
// animated transition
createAnimation();
// ensure size is reasonable!
finaliseVisualizationSteps(size);
}
示例13: initialiseGraphView
import prefuse.util.ColorLib; //导入方法依赖的package包/类
private void initialiseGraphView(Graph g, String label, int orientation, Dimension size) {
setSize(size);
m_vis = new Visualization();
m_vis.addFocusGroup("selected");
m_vis.addFocusGroup("highlighted");
MultiScaleLabelRenderer tr = new MultiScaleLabelRenderer("value", label.contains("image") ? label : null);
tr.setImagePosition(Constants.TOP);
m_vis.setRendererFactory(new DefaultRendererFactory(tr));
// adds graph to visualization and sets renderer label field
setGraph(g);
int hops = Integer.MAX_VALUE;
final GraphDistanceFilter filter = new GraphDistanceFilter(graph, hops);
FontAction font = new FontAction(nodes, UIHelper.VER_8_PLAIN);
ColorAction fill = new ColorAction(nodes, VisualItem.FILLCOLOR, ColorLib.rgb(255, 255, 255));
fill.add("ingroup('highlighted')", ColorLib.rgb(241, 242, 242));
fill.add("ingroup('selected')", ColorLib.rgb(241, 242, 242));
ColorAction stroke = new ColorAction(nodes, VisualItem.STROKECOLOR, backgroundColor);
StrokeAction strokeWeight = new StrokeAction(nodes, StrokeLib.getStroke(3f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND));
stroke.add("ingroup('highlighted')", ColorLib.rgb(224, 228, 204));
stroke.add("ingroup('selected')", ColorLib.rgb(202, 106, 33));
ActionList draw = new ActionList(500);
draw.add(font);
draw.add(filter);
draw.add(fill);
draw.add(stroke);
draw.add(strokeWeight);
draw.add(new ColorAction(nodes, VisualItem.TEXTCOLOR, ColorLib.rgb(109, 110, 113)));
draw.add(new ColorAction(edges, VisualItem.FILLCOLOR, ColorLib.gray(200)));
draw.add(new ColorAction(edges, VisualItem.STROKECOLOR, ColorLib.gray(200)));
draw.add(new RepaintAction());
ActionList animate = new ActionList();
NodeLinkTreeLayout layout = new NodeLinkTreeLayout(graph);
layout.setDepthSpacing(80);
layout.setBreadthSpacing(70);
layout.setOrientation(orientation);
animate.add(new QualityControlAnimator());
animate.add(new LocationAnimator(nodes));
animate.add(layout);
m_vis.putAction("draw", draw);
m_vis.putAction("layout", animate);
// set up a display to show the visualization
display = new Display(m_vis);
display.setSize(size);
// main display controls
display.addControlListener(new PanControl());
display.addControlListener(new ZoomControl());
display.addControlListener(new WheelZoomControl());
display.addControlListener(new ZoomToFitControl());
// now we run our action list
m_vis.run("draw");
m_vis.run("layout");
add(display);
}