本文整理汇总了Java中prefuse.visual.EdgeItem类的典型用法代码示例。如果您正苦于以下问题:Java EdgeItem类的具体用法?Java EdgeItem怎么用?Java EdgeItem使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
EdgeItem类属于prefuse.visual包,在下文中一共展示了EdgeItem类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: getCurveControlPoints
import prefuse.visual.EdgeItem; //导入依赖的package包/类
@Override
protected void getCurveControlPoints(EdgeItem eitem, Point2D[] cp,
double x1, double y1, double x2, double y2) {
// check if the same object...
if (eitem.getSourceItem().equals(eitem.getTargetItem())) {
cp[0].setLocation(x1-80, y1+80);
cp[1].setLocation(x1+80, y1+80);
/*
cp[0].setLocation(x1+2*dx/3,y1);
cp[1].setLocation(x2-dx/8,y2-dy/8);
*/
return;
}
// TODO Auto-generated method stub
super.getCurveControlPoints(eitem, cp, x1, y1, x2, y2);
}
开发者ID:luox12,项目名称:onecmdb,代码行数:18,代码来源:MyEdgeRenderer.java
示例2: calcAttraction
import prefuse.visual.EdgeItem; //导入依赖的package包/类
public void calcAttraction(EdgeItem e) {
NodeItem n1 = e.getSourceItem();
Params n1p = getParams(n1);
NodeItem n2 = e.getTargetItem();
Params n2p = getParams(n2);
double xDelta = n1p.loc[0] - n2p.loc[0];
double yDelta = n1p.loc[1] - n2p.loc[1];
double deltaLength = Math.max(EPSILON,
Math.sqrt(xDelta*xDelta + yDelta*yDelta));
double force = (deltaLength*deltaLength) / forceConstant;
if (Double.isNaN(force)) {
System.err.println("Mathematical error...");
}
double xDisp = (xDelta/deltaLength) * force;
double yDisp = (yDelta/deltaLength) * force;
n1p.disp[0] -= xDisp; n1p.disp[1] -= yDisp;
n2p.disp[0] += xDisp; n2p.disp[1] += yDisp;
}
开发者ID:dritanlatifi,项目名称:AndroidPrefuse,代码行数:24,代码来源:FruchtermanReingoldLayout.java
示例3: score
import prefuse.visual.EdgeItem; //导入依赖的package包/类
public int score(VisualItem item) {
int result = super.score(item);
double x = 0;
double x2 = 0;
if(item instanceof NodeItem) {
x = item.getX();
x2 = item.getDouble(VisualItem.X2);
} else if (item instanceof EdgeItem) {
EdgeItem edge = ((EdgeItem)item);
x = edge.getTargetItem().getX();
x2 = edge.getSourceItem().getDouble(VisualItem.X2);
}
result += 4096-(int)Math.round(Math.abs(x2-x));
return result;
}
开发者ID:ieg-vienna,项目名称:TimeBench,代码行数:20,代码来源:SizeItemSorter.java
示例4: setBounds
import prefuse.visual.EdgeItem; //导入依赖的package包/类
/**
* Sets the bounds of the item to the bounds of the rectangle.
* @see prefuse.render.Renderer#setBounds(prefuse.visual.VisualItem)
*/
public void setBounds(VisualItem item) {
if(item instanceof EdgeItem) {
NodeItem childNode = ((EdgeItem)item).getSourceItem();
NodeItem parentNode = ((EdgeItem)item).getTargetItem();
if (childNode instanceof VisualItem && parentNode instanceof VisualItem) {
VisualItem child = (VisualItem)childNode;
VisualItem parent = (VisualItem)parentNode;
double outerRadius = (child.getDouble(VisualItem.X2)-parent.getX())/2.0;
int ydirect = parent.getInt(ParentChildNode.DEPTH) % 2 == 1 ? 0 : 1;
item.setBounds(parent.getX(),parent.getY()-ydirect*outerRadius,outerRadius*2,outerRadius);
}
}
}
开发者ID:ieg-vienna,项目名称:TimeBench,代码行数:20,代码来源:ArcRenderer.java
示例5: itemEntered
import prefuse.visual.EdgeItem; //导入依赖的package包/类
/**
* mouse-over event on a visual item (node item or edge item)
*/
@Override
public void itemEntered(VisualItem item, MouseEvent e) {
// if ctrl is pressed, user zooms -> ignore itemEntered
if (e.getModifiers() == InputEvent.CTRL_MASK) {
ctrlZoom(e);
return;
}
// only mark items as highlighted if the layout process is active
RunLayoutControl rlc = new RunLayoutControl(viewManagerID);
if (rlc.isLayouting()) {
if (item instanceof NodeItem) {
/* set highlight attribute to true, NodeRenderer will change the color */
item.set(ColumnNames.IS_HIGHLIGHTED, true);
}
if (item instanceof EdgeItem) {
/* set highlight attribute to true, EdgeRenderer will change the color */
item.set(ColumnNames.IS_HIGHLIGHTED, true);
}
if (item instanceof TableDecoratorItem) {
/* set highlight attribute to true, EdgeRenderer will change the color */
item.set(ColumnNames.IS_HIGHLIGHTED, true);
}
}
}
开发者ID:VisualDataWeb,项目名称:ProtegeVOWL,代码行数:34,代码来源:ControlListener.java
示例6: itemExited
import prefuse.visual.EdgeItem; //导入依赖的package包/类
/**
* mouse moves away from a visual item (node item or edge item)
*/
@Override
public void itemExited(VisualItem item, java.awt.event.MouseEvent e) {
// if ctrl is pressed, user zooms -> ignore itemExited
// disable highlight possible but it should be same as zoom by mouse wheel or zoom by prefuse's right click zoom
if (e.getModifiers() == InputEvent.CTRL_MASK) {
ctrlZoom(e);
return;
}
if (item instanceof NodeItem) {
/* set highlight attribute to false, NodeRenderer will change the color */
item.set(ColumnNames.IS_HIGHLIGHTED, false);
}
if (item instanceof EdgeItem) {
/* set highlight attribute to false, EdgeRenderer will change the color */
item.set(ColumnNames.IS_HIGHLIGHTED, false);
}
if (item instanceof TableDecoratorItem) {
/* set highlight attribute to false, EdgeRenderer will change the color */
item.set(ColumnNames.IS_HIGHLIGHTED, false);
}
}
开发者ID:VisualDataWeb,项目名称:ProtegeVOWL,代码行数:30,代码来源:ControlListener.java
示例7: getSpringLength
import prefuse.visual.EdgeItem; //导入依赖的package包/类
/**
* returns the length of an edge
* 'overrides' the prefuse way of calculating the force abstraction layout length
*
* @param e - EdgeItem
*/
@Override
protected float getSpringLength(EdgeItem e) {
int edgeLengthColumn = e.getColumnIndex(ColumnNames.EDGE_LENGTH);
try {
int edgeLength = (Integer) e.get(edgeLengthColumn);
return edgeLength;
} catch (NullPointerException npe) {
return -1.f;
}
}
开发者ID:VisualDataWeb,项目名称:ProtegeVOWL,代码行数:17,代码来源:ForceDirectedLayoutExtended.java
示例8: initSimulator
import prefuse.visual.EdgeItem; //导入依赖的package包/类
/**
* Loads the simulator with all relevant force items and springs.
* @param fsim the force simulator driving this layout
*/
protected void initSimulator(ForceSimulator fsim) {
// make sure we have force items to work with
TupleSet ts = m_vis.getGroup(m_nodeGroup);
if ( ts == null ) return;
try {
ts.addColumns(FORCEITEM_SCHEMA);
} catch ( IllegalArgumentException iae ) { /* ignored */ }
float startX = (referrer == null ? 0f : (float)referrer.getX());
float startY = (referrer == null ? 0f : (float)referrer.getY());
startX = Float.isNaN(startX) ? 0f : startX;
startY = Float.isNaN(startY) ? 0f : startY;
Iterator iter = m_vis.visibleItems(m_nodeGroup);
while ( iter.hasNext() ) {
VisualItem item = (VisualItem)iter.next();
ForceItem fitem = (ForceItem)item.get(FORCEITEM);
fitem.mass = getMassValue(item);
double x = item.getEndX();
double y = item.getEndY();
fitem.location[0] = (Double.isNaN(x) ? startX : (float)x);
fitem.location[1] = (Double.isNaN(y) ? startY : (float)y);
fsim.addItem(fitem);
}
if ( m_edgeGroup != null ) {
iter = m_vis.visibleItems(m_edgeGroup);
while ( iter.hasNext() ) {
EdgeItem e = (EdgeItem)iter.next();
NodeItem n1 = e.getSourceItem();
ForceItem f1 = (ForceItem)n1.get(FORCEITEM);
NodeItem n2 = e.getTargetItem();
ForceItem f2 = (ForceItem)n2.get(FORCEITEM);
float coeff = getSpringCoefficient(e);
float slen = getSpringLength(e);
fsim.addSpring(f1, f2, (coeff>=0?coeff:-1.f), (slen>=0?slen:-1.f));
}
}
}
开发者ID:luox12,项目名称:onecmdb,代码行数:43,代码来源:ForceDirectedLayout.java
示例9: getSpringCoefficient
import prefuse.visual.EdgeItem; //导入依赖的package包/类
@Override
protected float getSpringCoefficient(EdgeItem e) {
if (e.canGetFloat("springCoefficient")) {
float f = e.getFloat("springCoefficient");
if (f > 0) {
return(f);
}
}
return super.getSpringCoefficient(e);
}
开发者ID:luox12,项目名称:onecmdb,代码行数:11,代码来源:MyForcedDirectedLayout.java
示例10: getSpringLength
import prefuse.visual.EdgeItem; //导入依赖的package包/类
@Override
protected float getSpringLength(EdgeItem e) {
if (e.canGetFloat("springLength")) {
float f = e.getFloat("springLength");
if (f > 0) {
return(f);
}
}
return super.getSpringLength(e);
}
开发者ID:luox12,项目名称:onecmdb,代码行数:11,代码来源:MyForcedDirectedLayout.java
示例11: collapseAggregate
import prefuse.visual.EdgeItem; //导入依赖的package包/类
public static void collapseAggregate(Visualization vis, String nodeType, boolean enable) {
Iterator iter = vis.items(new FieldMatchGroupPredicate("aggregates", "type", nodeType));
while(iter.hasNext()) {
AggregateItem aitem = (AggregateItem)iter.next();
double x = aitem.getBounds().getCenterX();
double y = aitem.getBounds().getCenterY();
// Make all items invisable...
Iterator aiter = aitem.items();
while(aiter.hasNext()) {
NodeItem item = (NodeItem)aiter.next();
item.setVisible(enable);
if (!enable) {
item.setFixed(true);
PrefuseLib.setX(item, null, x);
PrefuseLib.setY(item, null, y);
}
Iterator edges = item.edges();
while(edges.hasNext()) {
EdgeItem e = (EdgeItem)edges.next();
VisualItem target = e.getTargetItem();
VisualItem source = e.getSourceItem();
if (aitem.containsItem(target) && aitem.containsItem(source)) {
e.setVisible(enable);
}
}
}
}
}
开发者ID:luox12,项目名称:onecmdb,代码行数:35,代码来源:AggregateControl.java
示例12: addAggregate
import prefuse.visual.EdgeItem; //导入依赖的package包/类
private static void addAggregate(int id, NodeItem node, AggregateItem aitem, boolean enable) {
System.out.println("\t" + node.toString());
aitem.set("id", id);
aitem.set("type", node.getString("type"));
Iterator edges = node.edges();
if (enable) {
aitem.addItem(node);
} else {
aitem.removeItem(node);
}
while(edges.hasNext()) {
EdgeItem e = (EdgeItem)edges.next();
VisualItem target = e.getTargetItem();
VisualItem source = e.getSourceItem();
System.out.println("\t\t-->" + target.toString());
System.out.println("\t\t-->" + source.toString());
aitem.setInt("id", 1);
if (!target.equals(node)) {
if (enable) {
aitem.addItem(target);
} else {
aitem.removeItem(target);
}
}
if (!source.equals(node)) {
if (enable) {
aitem.addItem(source);
} else {
aitem.removeItem(source);
}
}
}
}
开发者ID:luox12,项目名称:onecmdb,代码行数:39,代码来源:AggregateControl.java
示例13: getRenderer
import prefuse.visual.EdgeItem; //导入依赖的package包/类
/**
* Return a Renderer instance for the input VisualItem. The VisualItem
* is matched against the registered Predicates, and if a match is found
* the corresponding Renderer is returned. Predicate matches are evaluated
* in the order in which Predicate/Renderer mappings were added to this
* RendererFactory. If no matches are found, either the default renderer
* (for all VisualItems except EdgeItems) or the default edge renderer (for
* EdgeItems) is returned.
*/
public Renderer getRenderer(VisualItem item) {
Renderer r = (Renderer)m_chain.get(item);
if ( r != null )
return r;
else if ( item instanceof EdgeItem )
return m_edgeRenderer;
else
return m_itemRenderer;
}
开发者ID:dritanlatifi,项目名称:AndroidPrefuse,代码行数:19,代码来源:DefaultRendererFactory.java
示例14: setNeighborHighlight
import prefuse.visual.EdgeItem; //导入依赖的package包/类
/**
* Set the highlighted state of the neighbors of a node.
* @param n the node under consideration
* @param state the highlighting state to apply to neighbors
*/
protected void setNeighborHighlight(NodeItem n, boolean state) {
Iterator iter = n.edges();
while ( iter.hasNext() ) {
EdgeItem eitem = (EdgeItem)iter.next();
NodeItem nitem = eitem.getAdjacentItem(n);
if (eitem.isVisible() || highlightWithInvisibleEdge) {
eitem.setHighlighted(state);
nitem.setHighlighted(state);
}
}
if ( activity != null )
n.getVisualization().run(activity);
}
开发者ID:dritanlatifi,项目名称:AndroidPrefuse,代码行数:19,代码来源:NeighborHighlightControl.java
示例15: visit
import prefuse.visual.EdgeItem; //导入依赖的package包/类
/**
* Visit a specific node and update its degree-of-interest.
*/
private void visit(NodeItem n, NodeItem c, int doi, int ldist) {
PrefuseLib.updateVisible(n, true);
double localDOI = -ldist / Math.min(1000.0, m_divisor);
n.setDOI(doi+localDOI);
if ( c != null ) {
EdgeItem e = (EdgeItem)c.getParentEdge();
e.setDOI(c.getDOI());
PrefuseLib.updateVisible(e, true);
}
}
开发者ID:dritanlatifi,项目名称:AndroidPrefuse,代码行数:15,代码来源:FisheyeTreeFilter.java
示例16: getSpringCoefficient
import prefuse.visual.EdgeItem; //导入依赖的package包/类
@Override
protected float getSpringCoefficient(EdgeItem e) {
if(e.get(VisualItem.LABEL).equals("LBUB")) {
return 0.001f;
}
return super.getSpringCoefficient(e)*0.000000001f; //10.0f;
}
开发者ID:FedericoPecora,项目名称:meta-csp-framework,代码行数:9,代码来源:PlotSTPTemporalModule.java
示例17: getSpringLength
import prefuse.visual.EdgeItem; //导入依赖的package包/类
@Override
protected float getSpringLength(EdgeItem e) {
if(e.get(VisualItem.LABEL).equals("LBUB")) {
return 0.1f;
}
return 200.0f;
//return super.getSpringLength(e);
}
开发者ID:FedericoPecora,项目名称:meta-csp-framework,代码行数:9,代码来源:PlotSTPTemporalModule.java
示例18: hideSelf
import prefuse.visual.EdgeItem; //导入依赖的package包/类
private void hideSelf(NodeItem item) {
// 收集需要隐藏的显示对象
HashSet<VisualItem> currentHideItems = new HashSet<VisualItem>();
currentHideItems.add(item);
Iterator iter = item.edges();
while (iter.hasNext()) {
EdgeItem eitem = (EdgeItem) iter.next();
currentHideItems.add(eitem);
}
this.hide(currentHideItems);
}
开发者ID:jdepend,项目名称:cooper,代码行数:13,代码来源:JDependNodeControl.java
示例19: itemClicked
import prefuse.visual.EdgeItem; //导入依赖的package包/类
@Override
public void itemClicked(VisualItem item, MouseEvent e) {
if (e.getButton() == 3 && item instanceof EdgeItem) {
JPopupMenu popupMenu = this.popupMenu((EdgeItem) item);
popupMenu.show((Component) e.getSource(), e.getX(), e.getY());
} else {
super.itemClicked(item, e);
}
}
开发者ID:jdepend,项目名称:cooper,代码行数:10,代码来源:JDependEdgeControl.java
示例20: setNeighborHighlight
import prefuse.visual.EdgeItem; //导入依赖的package包/类
@Override
protected void setNeighborHighlight(NodeItem n, boolean state) {
Iterator iter = n.edges();
while (iter.hasNext()) {
EdgeItem eitem = (EdgeItem) iter.next();
NodeItem nitem = eitem.getAdjacentItem(n);
if (eitem.isVisible() || this.isHighlightWithInvisibleEdge()) {
// 相互依赖
String attentionType = eitem.getTable().getString(eitem.getRow(), "attentionType");
if (attentionType.equals(Relation.MutualDependAttentionType)) {
eitem.getTable().setBoolean(eitem.getRow(), "mutualColor", state);
if (nitem.isVisible()) {
nitem.getTable().setBoolean(nitem.getRow(), "mutualColor", state);
}
// 传出依赖
} else if (eitem.getSourceItem().equals(n)) {
eitem.getTable().setBoolean(eitem.getRow(), "CeColor", state);
if (nitem.isVisible()) {
nitem.getTable().setBoolean(nitem.getRow(), "CeColor", state);
}
// 传入依赖
} else {
eitem.getTable().setBoolean(eitem.getRow(), "CaColor", state);
if (nitem.isVisible()) {
nitem.getTable().setBoolean(nitem.getRow(), "CaColor", state);
}
}
}
}
}
开发者ID:jdepend,项目名称:cooper,代码行数:31,代码来源:JDependHighlightControl.java
注:本文中的prefuse.visual.EdgeItem类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论