本文整理汇总了Java中prefuse.render.ShapeRenderer类的典型用法代码示例。如果您正苦于以下问题:Java ShapeRenderer类的具体用法?Java ShapeRenderer怎么用?Java ShapeRenderer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ShapeRenderer类属于prefuse.render包,在下文中一共展示了ShapeRenderer类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: AggregateDemo
import prefuse.render.ShapeRenderer; //导入依赖的package包/类
public AggregateDemo() {
// initialize display and data
super(new Visualization());
initDataGroups();
// set up the renderers
// draw the nodes as basic shapes
Renderer nodeR = new ShapeRenderer(20);
// draw aggregates as polygons with curved edges
Renderer polyR = new PolygonRenderer(Constants.POLY_TYPE_CURVE);
((PolygonRenderer)polyR).setCurveSlack(0.15f);
DefaultRendererFactory drf = new DefaultRendererFactory();
drf.setDefaultRenderer(nodeR);
drf.add("ingroup('aggregates')", polyR);
m_vis.setRendererFactory(drf);
// set up the visual operators
// first set up all the color actions
ColorAction nStroke = new ColorAction(NODES, VisualItem.STROKECOLOR);
nStroke.setDefaultColor(ColorLib.gray(100));
nStroke.add("_hover", ColorLib.gray(50));
ColorAction nFill = new ColorAction(NODES, VisualItem.FILLCOLOR);
nFill.setDefaultColor(ColorLib.gray(255));
nFill.add("_hover", ColorLib.gray(200));
ColorAction nEdges = new ColorAction(EDGES, VisualItem.STROKECOLOR);
nEdges.setDefaultColor(ColorLib.gray(100));
ColorAction aStroke = new ColorAction(AGGR, VisualItem.STROKECOLOR);
aStroke.setDefaultColor(ColorLib.gray(200));
aStroke.add("_hover", ColorLib.rgb(255,100,100));
int[] palette = new int[] {
ColorLib.rgba(255,200,200,150),
ColorLib.rgba(200,255,200,150),
ColorLib.rgba(200,200,255,150)
};
ColorAction aFill = new DataColorAction(AGGR, "id",
Constants.NOMINAL, VisualItem.FILLCOLOR, palette);
// bundle the color actions
ActionList colors = new ActionList();
colors.add(nStroke);
colors.add(nFill);
colors.add(nEdges);
colors.add(aStroke);
colors.add(aFill);
// now create the main layout routine
ActionList layout = new ActionList(Activity.INFINITY);
layout.add(colors);
layout.add(new ForceDirectedLayout(GRAPH, true));
layout.add(new AggregateLayout(AGGR));
layout.add(new RepaintAction());
m_vis.putAction("layout", layout);
// set up the display
setSize(500,500);
pan(250, 250);
setHighQuality(true);
addControlListener(new AggregateDragControl());
addControlListener(new ZoomControl());
addControlListener(new PanControl());
// set things running
m_vis.run("layout");
}
开发者ID:codydunne,项目名称:netgrok,代码行数:70,代码来源:AggregateDemo.java
示例2: CodyTestWindow
import prefuse.render.ShapeRenderer; //导入依赖的package包/类
public CodyTestWindow() {
// initialize display and data
super(new Visualization());
initDataGroups();
// set up the renderers
// draw the nodes as basic shapes
Renderer nodeR = new ShapeRenderer(20);
// draw aggregates as polygons with curved edges
Renderer polyR = new PolygonRenderer(Constants.POLY_TYPE_CURVE);
((PolygonRenderer)polyR).setCurveSlack(0.15f);
DefaultRendererFactory drf = new DefaultRendererFactory();
drf.setDefaultRenderer(nodeR);
drf.add("ingroup('aggregates')", polyR);
m_vis.setRendererFactory(drf);
// set up the visual operators
// first set up all the color actions
ColorAction nStroke = new ColorAction(NODES, VisualItem.STROKECOLOR);
nStroke.setDefaultColor(ColorLib.gray(100));
nStroke.add("_hover", ColorLib.gray(50));
ColorAction nFill = new ColorAction(NODES, VisualItem.FILLCOLOR);
nFill.setDefaultColor(ColorLib.gray(255));
nFill.add("_hover", ColorLib.gray(200));
ColorAction nEdges = new ColorAction(EDGES, VisualItem.STROKECOLOR);
nEdges.setDefaultColor(ColorLib.gray(100));
ColorAction aStroke = new ColorAction(AGGR, VisualItem.STROKECOLOR);
aStroke.setDefaultColor(ColorLib.gray(200));
aStroke.add("_hover", ColorLib.rgb(255,100,100));
int[] palette = new int[] {
ColorLib.rgba(255,200,200,150),
ColorLib.rgba(200,255,200,150),
ColorLib.rgba(200,200,255,150)
};
ColorAction aFill = new DataColorAction(AGGR, "id",
Constants.NOMINAL, VisualItem.FILLCOLOR, palette);
// bundle the color actions
ActionList colors = new ActionList();
colors.add(nStroke);
colors.add(nFill);
colors.add(nEdges);
colors.add(aStroke);
colors.add(aFill);
// now create the main layout routine
ActionList layout = new ActionList(Activity.INFINITY);
layout.add(colors);
layout.add(new ForceDirectedLayout(GRAPH, true));
layout.add(new AggregateLayout(AGGR));
layout.add(new RepaintAction());
m_vis.putAction("layout", layout);
// set up the display
setSize(500,500);
pan(250, 250);
setHighQuality(true);
addControlListener(new AggregateDragControl());
addControlListener(new ZoomControl());
addControlListener(new PanControl());
// set things running
m_vis.run("layout");
}
开发者ID:codydunne,项目名称:netgrok,代码行数:70,代码来源:CodyTestWindow.java
示例3: AggregateDecoratorDemo
import prefuse.render.ShapeRenderer; //导入依赖的package包/类
public AggregateDecoratorDemo() {
// initialize display and data
super(new Visualization());
initDataGroups();
// set up the renderers
// draw the nodes as basic shapes
Renderer nodeR = new ShapeRenderer(20);
// draw aggregates as polygons with curved edges
Renderer polyR = new PolygonRenderer(Constants.POLY_TYPE_CURVE);
((PolygonRenderer)polyR).setCurveSlack(0.15f);
DefaultRendererFactory drf = new DefaultRendererFactory();
drf.setDefaultRenderer(nodeR);
drf.add("ingroup('aggregates')", polyR);
drf.add(new InGroupPredicate(EDGE_DECORATORS), new LabelRenderer(VisualItem.LABEL));
drf.add(new InGroupPredicate(NODE_DECORATORS), new LabelRenderer(VisualItem.LABEL));
drf.add(new InGroupPredicate(AGGR_DECORATORS), new LabelRenderer("id"));
m_vis.setRendererFactory(drf);
// adding decorators, one group for the nodes, one for the edges and one
// for the aggregates
DECORATOR_SCHEMA.setDefault(VisualItem.TEXTCOLOR, ColorLib.gray(0));
m_vis.addDecorators(EDGE_DECORATORS, EDGES, DECORATOR_SCHEMA);
DECORATOR_SCHEMA.setDefault(VisualItem.TEXTCOLOR, ColorLib.gray(128));
m_vis.addDecorators(NODE_DECORATORS, NODES, DECORATOR_SCHEMA);
// the HoverPredicate makes this group of decorators to appear only on mouseOver
DECORATOR_SCHEMA.setDefault(VisualItem.TEXTCOLOR, ColorLib.gray(255, 128));
DECORATOR_SCHEMA.setDefault(VisualItem.FONT, FontLib.getFont("Tahoma", Font.BOLD, 48));
m_vis.addDecorators(AGGR_DECORATORS, AGGR, new HoverPredicate(), DECORATOR_SCHEMA);
// set up the visual operators
// first set up all the color actions
ColorAction nStroke = new ColorAction(NODES, VisualItem.STROKECOLOR);
nStroke.setDefaultColor(ColorLib.gray(100));
nStroke.add("_hover", ColorLib.gray(50));
ColorAction nFill = new ColorAction(NODES, VisualItem.FILLCOLOR);
nFill.setDefaultColor(ColorLib.gray(255));
nFill.add("_hover", ColorLib.gray(200));
ColorAction nEdges = new ColorAction(EDGES, VisualItem.STROKECOLOR);
nEdges.setDefaultColor(ColorLib.gray(100));
ColorAction aStroke = new ColorAction(AGGR, VisualItem.STROKECOLOR);
aStroke.setDefaultColor(ColorLib.gray(200));
aStroke.add("_hover", ColorLib.rgb(255,100,100));
int[] palette = new int[] {
ColorLib.rgba(255,200,200,150),
ColorLib.rgba(200,255,200,150),
ColorLib.rgba(200,200,255,150)
};
ColorAction aFill = new DataColorAction(AGGR, "id",
Constants.NOMINAL, VisualItem.FILLCOLOR, palette);
// bundle the color actions
ActionList colors = new ActionList();
colors.add(nStroke);
colors.add(nFill);
colors.add(nEdges);
colors.add(aStroke);
colors.add(aFill);
// now create the main layout routine
ActionList layout = new ActionList(Activity.INFINITY);
layout.add(colors);
layout.add(new ForceDirectedLayout(GRAPH, true));
layout.add(new AggregateLayout2(AGGR));
layout.add(new LabelLayout2(EDGE_DECORATORS));
layout.add(new LabelLayout2(NODE_DECORATORS));
layout.add(new LabelLayout2(AGGR_DECORATORS));
layout.add(new RepaintAction());
m_vis.putAction("layout", layout);
// set up the display
setSize(500,500);
pan(250, 250);
setHighQuality(true);
addControlListener(new AggregateDragControl2());
addControlListener(new ZoomControl());
addControlListener(new PanControl());
// set things running
m_vis.run("layout");
}
开发者ID:codydunne,项目名称:netgrok,代码行数:75,代码来源:AggregateDecoratorDemo.java
示例4: createVisualizationV2
import prefuse.render.ShapeRenderer; //导入依赖的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;
}
开发者ID:dritanlatifi,项目名称:AndroidPrefuse,代码行数:66,代码来源:MainActivityOld.java
示例5: AggregateDecoratorDemo
import prefuse.render.ShapeRenderer; //导入依赖的package包/类
public AggregateDecoratorDemo() {
// initialize display and data
super(new Visualization());
initDataGroups();
// set up the renderers
// draw the nodes as basic shapes
Renderer nodeR = new ShapeRenderer(20);
// draw aggregates as polygons with curved edges
Renderer polyR = new PolygonRenderer(Constants.POLY_TYPE_CURVE);
((PolygonRenderer)polyR).setCurveSlack(0.15f);
DefaultRendererFactory drf = new DefaultRendererFactory();
drf.setDefaultRenderer(nodeR);
drf.add("ingroup('aggregates')", polyR);
drf.add(new InGroupPredicate(EDGE_DECORATORS), new LabelRenderer(VisualItem.LABEL));
drf.add(new InGroupPredicate(NODE_DECORATORS), new LabelRenderer(VisualItem.LABEL));
drf.add(new InGroupPredicate(AGGR_DECORATORS), new LabelRenderer("id"));
m_vis.setRendererFactory(drf);
// adding decorators, one group for the nodes, one for the edges and one
// for the aggregates
DECORATOR_SCHEMA.setDefault(VisualItem.TEXTCOLOR, ColorLib.gray(0));
m_vis.addDecorators(EDGE_DECORATORS, EDGES, DECORATOR_SCHEMA);
DECORATOR_SCHEMA.setDefault(VisualItem.TEXTCOLOR, ColorLib.gray(128));
m_vis.addDecorators(NODE_DECORATORS, NODES, DECORATOR_SCHEMA);
// the HoverPredicate makes this group of decorators to appear only on mouseOver
DECORATOR_SCHEMA.setDefault(VisualItem.TEXTCOLOR, ColorLib.gray(255, 128));
DECORATOR_SCHEMA.setDefault(VisualItem.FONT, FontLib.getFont("Tahoma", Font.BOLD, 48));
m_vis.addDecorators(AGGR_DECORATORS, AGGR, new HoverPredicate(), DECORATOR_SCHEMA);
// set up the visual operators
// first set up all the color actions
ColorAction nStroke = new ColorAction(NODES, VisualItem.STROKECOLOR);
nStroke.setDefaultColor(ColorLib.gray(100));
nStroke.add("_hover", ColorLib.gray(50));
ColorAction nFill = new ColorAction(NODES, VisualItem.FILLCOLOR);
nFill.setDefaultColor(ColorLib.gray(255));
nFill.add("_hover", ColorLib.gray(200));
ColorAction nEdges = new ColorAction(EDGES, VisualItem.STROKECOLOR);
nEdges.setDefaultColor(ColorLib.gray(100));
ColorAction aStroke = new ColorAction(AGGR, VisualItem.STROKECOLOR);
aStroke.setDefaultColor(ColorLib.gray(200));
aStroke.add("_hover", ColorLib.rgb(255,100,100));
int[] palette = new int[] {
ColorLib.rgba(255,200,200,150),
ColorLib.rgba(200,255,200,150),
ColorLib.rgba(200,200,255,150)
};
ColorAction aFill = new DataColorAction(AGGR, "id",
Constants.NOMINAL, VisualItem.FILLCOLOR, palette);
// bundle the color actions
ActionList colors = new ActionList();
colors.add(nStroke);
colors.add(nFill);
colors.add(nEdges);
colors.add(aStroke);
colors.add(aFill);
// now create the main layout routine
ActionList layout = new ActionList(Activity.INFINITY);
layout.add(colors);
layout.add(new ForceDirectedLayout(GRAPH, true));
layout.add(new AggregateLayout(AGGR));
layout.add(new LabelLayout2(EDGE_DECORATORS));
layout.add(new LabelLayout2(NODE_DECORATORS));
layout.add(new LabelLayout2(AGGR_DECORATORS));
layout.add(new RepaintAction());
m_vis.putAction("layout", layout);
// set up the display
setSize(500,500);
pan(250, 250);
setHighQuality(true);
addControlListener(new AggregateDragControl());
addControlListener(new ZoomControl());
addControlListener(new PanControl());
// set things running
m_vis.run("layout");
}
开发者ID:santiontanon,项目名称:fterm,代码行数:75,代码来源:AggregateDecoratorDemo.java
注:本文中的prefuse.render.ShapeRenderer类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论