Search in sources :

Example 1 with Edge

use of y.base.Edge in project binnavi by google.

the class CBendEnterState method mouseMoved.

@Override
public IMouseStateChange mouseMoved(final MouseEvent event, final AbstractZyGraph<?, ?> graph) {
    final double x = m_graph.getEditMode().translateX(event.getX());
    final double y = m_graph.getEditMode().translateY(event.getY());
    final HitInfo hitInfo = m_graph.getGraph().getHitInfo(x, y);
    if (hitInfo.hasHitNodes()) {
        m_factory.createBendExitState(m_bend, event);
        return CHitNodesTransformer.enterNode(m_factory, event, hitInfo);
    } else if (hitInfo.hasHitNodeLabels()) {
        throw new IllegalStateException();
    } else if (hitInfo.hasHitEdges()) {
        final Edge e = hitInfo.getHitEdge();
        m_factory.createBendExitState(m_bend, event);
        return new CStateChange(m_factory.createEdgeEnterState(e, event), true);
    } else if (hitInfo.hasHitEdgeLabels()) {
        final EdgeLabel l = hitInfo.getHitEdgeLabel();
        m_factory.createBendExitState(m_bend, event);
        return new CStateChange(m_factory.createEdgeLabelEnterState(l, event), true);
    } else if (hitInfo.hasHitBends()) {
        return CHitBendsTransformer.changeBend(m_factory, event, hitInfo, m_bend);
    } else if (hitInfo.hasHitPorts()) {
        return new CStateChange(this, true);
    } else {
        return new CStateChange(m_factory.createBendExitState(m_bend, event), true);
    }
}
Also used : HitInfo(y.view.HitInfo) EdgeLabel(y.view.EdgeLabel) ZyGraphEdge(com.google.security.zynamics.zylib.yfileswrap.gui.zygraph.edges.ZyGraphEdge) Edge(y.base.Edge) CStateChange(com.google.security.zynamics.zylib.gui.zygraph.editmode.CStateChange)

Example 2 with Edge

use of y.base.Edge in project binnavi by google.

the class ProximityNodeCreator method insertProximityEdge.

/**
 * Inserts a proximity edge between two nodes. One of the two input nodes must be a proximity
 * browsing node or an exception is thrown.
 *
 * @param graph The graph where the node is inserted.
 * @param sourceNode The source node of the edge.
 * @param targetNode The target node of the edge.
 *
 * @return The inserted edge.
 */
public static ZyInfoEdge insertProximityEdge(final Graph2D graph, final ZyGraphNode<?> sourceNode, final ZyGraphNode<?> targetNode) {
    Preconditions.checkNotNull(graph, "Graph argument can not be null");
    Preconditions.checkNotNull(sourceNode, "Source node argument can not be null");
    Preconditions.checkNotNull(targetNode, "Target node argument can not be null");
    Preconditions.checkArgument((sourceNode instanceof ZyProximityNode<?>) || (targetNode instanceof ZyProximityNode<?>), "One of the two arguments must be a proximity browsing node");
    final ZyEdgeRealizer<ZyInfoEdge> r = new ZyEdgeRealizer<ZyInfoEdge>(new ZyLabelContent(null), null);
    r.setLineType(LineType.LINE_2);
    final Edge edge = graph.createEdge(sourceNode.getNode(), targetNode.getNode(), r);
    final ZyInfoEdge infoEdge = new ZyInfoEdge(sourceNode, targetNode, edge, r);
    final ZyEdgeData<ZyInfoEdge> data = new ZyEdgeData<ZyInfoEdge>(infoEdge);
    r.setUserData(data);
    return infoEdge;
}
Also used : ZyEdgeRealizer(com.google.security.zynamics.zylib.yfileswrap.gui.zygraph.realizers.ZyEdgeRealizer) ZyInfoEdge(com.google.security.zynamics.zylib.yfileswrap.gui.zygraph.edges.ZyInfoEdge) ZyLabelContent(com.google.security.zynamics.zylib.gui.zygraph.realizers.ZyLabelContent) ZyEdgeData(com.google.security.zynamics.zylib.gui.zygraph.edges.ZyEdgeData) ZyInfoEdge(com.google.security.zynamics.zylib.yfileswrap.gui.zygraph.edges.ZyInfoEdge) Edge(y.base.Edge)

Example 3 with Edge

use of y.base.Edge in project binnavi by google.

the class CBendClickedLeftState method mouseMoved.

@Override
public IMouseStateChange mouseMoved(final MouseEvent event, final AbstractZyGraph<?, ?> g) {
    final double x = g.getEditMode().translateX(event.getX());
    final double y = g.getEditMode().translateY(event.getY());
    final HitInfo hitInfo = g.getGraph().getHitInfo(x, y);
    if (hitInfo.hasHitNodes()) {
        m_factory.createBendExitState(m_bend, event);
        return CHitNodesTransformer.enterNode(m_factory, event, hitInfo);
    } else if (hitInfo.hasHitNodeLabels()) {
        throw new IllegalStateException();
    } else if (hitInfo.hasHitEdges()) {
        m_factory.createBendExitState(m_bend, event);
        final Edge e = hitInfo.getHitEdge();
        return new CStateChange(m_factory.createEdgeEnterState(e, event), true);
    } else if (hitInfo.hasHitEdgeLabels()) {
        m_factory.createBendExitState(m_bend, event);
        final EdgeLabel l = hitInfo.getHitEdgeLabel();
        return new CStateChange(m_factory.createEdgeLabelEnterState(l, event), true);
    } else if (hitInfo.hasHitBends()) {
        return CHitBendsTransformer.changeBend(m_factory, event, hitInfo, m_bend);
    } else if (hitInfo.hasHitPorts()) {
        return new CStateChange(this, true);
    } else {
        m_factory.createBendExitState(m_bend, event);
        return new CStateChange(this, true);
    }
}
Also used : HitInfo(y.view.HitInfo) EdgeLabel(y.view.EdgeLabel) ZyGraphEdge(com.google.security.zynamics.zylib.yfileswrap.gui.zygraph.edges.ZyGraphEdge) Edge(y.base.Edge) CStateChange(com.google.security.zynamics.zylib.gui.zygraph.editmode.CStateChange)

Example 4 with Edge

use of y.base.Edge in project binnavi by google.

the class ZyNodeRealizer method scalePortCoordinates.

protected void scalePortCoordinates(final Node node, final double wOld, final double wNew, final double hOld, final double hNew) {
    final Graph2D graph = (Graph2D) node.getGraph();
    final double wScaling = wOld > 0 ? wNew / wOld : 1.0d;
    final double hScaling = hOld > 0 ? hNew / hOld : 1.0d;
    for (Edge e = node.firstOutEdge(); e != null; e = e.nextOutEdge()) {
        final EdgeRealizer er = graph.getRealizer(e);
        final Port port = er.getSourcePort();
        final double px = port.getOffsetX() * wScaling;
        final double py = port.getOffsetY() * hScaling;
        port.setOffsets(px, py);
        graph.setSourcePointRel(e, new YPoint(px, py));
    }
    for (Edge e = node.firstInEdge(); e != null; e = e.nextInEdge()) {
        final EdgeRealizer er = graph.getRealizer(e);
        final Port port = er.getTargetPort();
        final double px = port.getOffsetX() * wScaling;
        final double py = port.getOffsetY() * hScaling;
        port.setOffsets(px, py);
        graph.setTargetPointRel(e, new YPoint(px, py));
    }
}
Also used : Port(y.view.Port) EdgeRealizer(y.view.EdgeRealizer) Edge(y.base.Edge) YPoint(y.geom.YPoint) Graph2D(y.view.Graph2D)

Example 5 with Edge

use of y.base.Edge in project binnavi by google.

the class TypeDependenceGraph method deleteMember.

// Deletes all member relations from the graph.
private ImmutableSet<BaseType> deleteMember(final BaseType containingType, final BaseType memberType) {
    final Node containingTypeNode = containedRelationMap.get(containingType);
    final Node memberTypeNode = containedRelationMap.get(memberType);
    final Edge memberEdge = memberTypeNode.getEdgeTo(containingTypeNode);
    containedRelation.removeEdge(memberEdge);
    return determineDependentTypes(containingType);
}
Also used : Node(y.base.Node) Edge(y.base.Edge)

Aggregations

Edge (y.base.Edge)18 Node (y.base.Node)7 EdgeCursor (y.base.EdgeCursor)6 NaviEdge (com.google.security.zynamics.binnavi.yfileswrap.zygraph.NaviEdge)5 INaviEdge (com.google.security.zynamics.binnavi.disassembly.INaviEdge)4 NaviNode (com.google.security.zynamics.binnavi.yfileswrap.zygraph.NaviNode)4 ZyLabelContent (com.google.security.zynamics.zylib.gui.zygraph.realizers.ZyLabelContent)4 ZyEdgeRealizer (com.google.security.zynamics.zylib.yfileswrap.gui.zygraph.realizers.ZyEdgeRealizer)4 ZyGraph (com.google.security.zynamics.binnavi.yfileswrap.zygraph.ZyGraph)3 CAddress (com.google.security.zynamics.zylib.disassembly.CAddress)3 CStateChange (com.google.security.zynamics.zylib.gui.zygraph.editmode.CStateChange)3 ZyGraph2DView (com.google.security.zynamics.zylib.yfileswrap.gui.zygraph.ZyGraph2DView)3 ArrayList (java.util.ArrayList)3 HitInfo (y.view.HitInfo)3 MockDatabase (com.google.security.zynamics.binnavi.Database.MockClasses.MockDatabase)2 MockSqlProvider (com.google.security.zynamics.binnavi.Database.MockClasses.MockSqlProvider)2 ZyGraphViewSettings (com.google.security.zynamics.binnavi.ZyGraph.ZyGraphViewSettings)2 CallGraphSettingsConfigItem (com.google.security.zynamics.binnavi.config.CallGraphSettingsConfigItem)2 CModule (com.google.security.zynamics.binnavi.disassembly.Modules.CModule)2 ReilEdge (com.google.security.zynamics.reil.ReilEdge)2