Package ru.spbu.math.ontologycomparison.zhukova.visualisation.ui.graphpane

Examples of ru.spbu.math.ontologycomparison.zhukova.visualisation.ui.graphpane.IGraphPane


    public void mouseReleased(MouseEvent e) {
        Composite c = new Composite();
        Point mouseLocation = e.getPoint();
        int dx = mouseLocation.x - MovingTool.veryFrom.x;
        int dy = mouseLocation.y - MovingTool.veryFrom.y;
        IGraphPane graphPane = Tool.getGraphPane();
        Set<IVertex> vertices = graphPane.getSelectedVertices();
        for (IVertex v : vertices) {
            c.addCommand(new MoveVertexCommand(graphPane.getGraphModel(), v, dx, dy));
        }
        graphPane.setTool(SelectingTool.getInstance());
    }
View Full Code Here


        SelectingTool.isOnlySuperVerticesSelection = b;
    }

    public void mousePressed(MouseEvent e) {
        if (e.getButton() == MouseEvent.BUTTON1) {
            IGraphPane graphPane = Tool.getGraphPane();
            Point mouseLocation = e.getPoint();
            Set<IVertex> vertices = graphPane.getSelectedVertices();
            for (IVertex v : vertices) {
                if (v.hitTest(mouseLocation)) {
                    moveOn(mouseLocation);
                    return;
                }
            }
            graphPane.deselectVertices();
            Set<SimpleVertex> simpleVertices = graphPane.getGraphModel().getSimpleVertices();
            for (SimpleVertex v : simpleVertices) {
                if (v.hitTest(mouseLocation)) {
                    if (!SelectingTool.isOnlySuperVerticesSelection() ||
                            v.getSuperVertex() == null || v.getSuperVertex().isHidden()) {
                        graphPane.selectVertex(v);
                        moveOn(mouseLocation);
                        return;
                    }
                }
            }
            Set<SuperVertex> superVertices = graphPane.getGraphModel().getSuperVertices();
            for (SuperVertex v : superVertices) {
                /*boolean leftX = v.leftBorderTest(mouseLocation);
                boolean rightX = v.rightBorderTest(mouseLocation);
                boolean topY = v.topBorderTest(mouseLocation);
                boolean bottomY = v.bottomBorderTest(mouseLocation);
                if (leftX || rightX || topY || bottomY) {
                    resizeOn(mouseLocation, v, leftX, rightX, topY, bottomY);
                } else*/
                if (v.hitTest(mouseLocation)) {
                    graphPane.selectVertex(v);
                    moveOn(mouseLocation);
                    return;
                }
            }
            SelectingTool.left = mouseLocation;
        } else if (e.getButton() == MouseEvent.BUTTON3) {
            IGraphPane graphPane = Tool.getGraphPane();
            Point mouseLocation = e.getPoint();
            Set<IVertex> vertices = graphPane.getSelectedVertices();
            boolean show = false;
            Set<SuperVertex> forPopUp = new HashSet<SuperVertex>();
            for (IVertex vertex : vertices) {
                if (vertex instanceof SuperVertex) {
                    forPopUp.add((SuperVertex) vertex);
                } else if (vertex instanceof SimpleVertex) {
                    SimpleVertex simple = (SimpleVertex) vertex;
                    if (simple.getSuperVertex() != null) {
                        forPopUp.add(simple.getSuperVertex());
                    }
                }
                if (vertex.hitTest(mouseLocation)) {
                    show = true;
                }
            }
            if (show) {
                showPopUp(mouseLocation, forPopUp.toArray(new SuperVertex[forPopUp.size()]));
                return;
            }
            /*
            if (!SelectingTool.isOnlySuperVerticesSelection()) {
                Set<SimpleVertex> simpleVertices = graphPane.getGraphModel().getSimpleVertices();
                for (SimpleVertex v : simpleVertices) {
                    if (v.hitTest(mouseLocation) && v.getSuperVertex() != null) {
                        showPopUp(mouseLocation, v.getSuperVertex());
                        return;
                    }
                }
            }*/
            Set<SuperVertex> superVertices = graphPane.getGraphModel().getSuperVertices();
            for (SuperVertex v : superVertices) {
                if (v.hitTest(mouseLocation)) {
                    showPopUp(mouseLocation, v);
                    return;
                }
View Full Code Here

TOP

Related Classes of ru.spbu.math.ontologycomparison.zhukova.visualisation.ui.graphpane.IGraphPane

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.