Package com.evelopers.unimod.glayout.graph

Examples of com.evelopers.unimod.glayout.graph.SimpleEdge


    private SimpleEdge getAnotherEdge(SimpleVertex sv, SimpleEdge se) {
        ListIterator li = sv.getEdgesRelative(f)
                            .listIterator();

        while (li.hasNext()) {
            SimpleEdge e = (SimpleEdge) li.next();

            if (!e.equals(se)) {
                return e;
            }
        }

        return null;
View Full Code Here


    protected void orientOnChain(GContainer ac, SimpleVertex source, SimpleVertex target,
                                 Object tocheck, Object key) {
        SimpleVertex curr = source;

        // another edge
        SimpleEdge curre = null;

        while (curr != target) {
            // curr is changing
            List edges      = curr.getEdgesRelative(ac);
            ListIterator li = edges.listIterator();

            while (li.hasNext()) {
                SimpleEdge element = (SimpleEdge) li.next();

                if (element != curre) {
                    if ((tocheck == null) || (element.getProperty(tocheck) == null)) {
                        if (element.getTarget() == curr) {
                            element.reverse();
                        }
                    }

                    if (tocheck != null) {
                        element.setProperty(tocheck, key);
                    }

                    curr      = element.getAnother(curr);
                    curre     = element;

                    break;
                }
            }
View Full Code Here

        ListIterator li2 = sg.getEdges()
                             .listIterator();

        while (li2.hasNext()) {
            SimpleEdge element = (SimpleEdge) li2.next();
            element.setVisX(asd.getCorrespondingVertex(element.getLeft()).getTopnum());
            element.setVisYB(element.getOrig().getTopnum());
            element.setVisYT(element.getDest().getTopnum());
        }
    }
View Full Code Here

    private void convertBendpoints() {
        SimpleEdge[] edges = (SimpleEdge[]) sg.getEdges()
                                              .toArray(new SimpleEdge[0]);

        for (int i = 0; i < edges.length; i++) {
            SimpleEdge edge = edges[i];

            // will update faces
            GraphsContainer vgc =
                new GraphsContainer(sg,
                                    edge.getLeft(),
                                    edge.getRight());
            BendPoint[] bps =
                (BendPoint[]) edge.getBendPoints()
                                  .toArray(new BendPoint[0]);
            SimpleVertex currsource = edge.getSource();

            for (int j = 0; j < bps.length; j++) {
                SimpleVertex v = new SimpleVertex();
                v.setProperty(FICTIVE_KEY, edge);

                // to set the bendpoints order
                v.setProperty(FICTIVENUMBER_KEY,
                              new Integer(j));
                v.setOrthX(bps[j].getOrthX());
                v.setOrthY(bps[j].getOrthY());
                vgc.addVertex(v);

                SimpleEdge e = new SimpleEdge(currsource, v);
                e.setProperty(FICTIVE_KEY, FICTIVE_VALUE);

                /* thre is really no need to set left and right properties
                 * 'cause the HashMap link is to edge, and
                 * we are going to work only with it.
                 */
                vgc.addEdge(e);
                currsource = v;
            }

            if (bps.length > 0) {
                SimpleEdge e = new SimpleEdge(currsource,
                                              edge.getTarget());
                e.setProperty(FICTIVE_KEY, FICTIVE_VALUE);
                vgc.addEdge(e);
                vgc.removeEdge(edge);
            }
        }
    }
View Full Code Here

        IOrthItem corner = GeometricHelper.getAbstractCorner(sg, c);
        List edges       =
            CompactionHelper.getInstance()
                            .getEdgesSorted(sg, vertical, corner);
        ListIterator li = edges.listIterator();
        SimpleEdge prev = (SimpleEdge) li.next();

        while (li.hasNext()) {
            SimpleEdge next = (SimpleEdge) li.next();
            boolean add     = false;
            SimpleVertex v1 = null;
            SimpleVertex v2 = null;

            if (vertical) {
                if (GeometricHelper.getBottomVetrtex(prev)
                                       .getOrthY() < GeometricHelper.getTopVetrtex(next)
                                                                        .getOrthY()) {
                    v1      = GeometricHelper.getBottomVetrtex(prev);
                    v2      = GeometricHelper.getTopVetrtex(next);
                    add     = true;
                }
            } else {
                if (GeometricHelper.getRightVetrtex(prev)
                                       .getOrthX() < GeometricHelper.getLeftVetrtex(next)
                                                                        .getOrthX()) {
                    v1      = GeometricHelper.getRightVetrtex(prev);
                    v2      = GeometricHelper.getLeftVetrtex(next);
                    add     = true;
                }
            }

            if (add) {
                SimpleEdge e = new SimpleEdge(v1, v2);
                e.setProperty(FICTIVE_KEY, FICTIVE_VALUE);

                GraphsContainer vgc = proceedBridge(prev.getAnother(v1),
                                                    v1,
                                                    v2);
                vgc.addEdge(e);
View Full Code Here

            SimpleVertex v        = new SimpleVertex();
            v.setProperty(CORNER_KEY, FICTIVE_VALUE);
            v.setOrthX(acorner.getOrthX());
            v.setOrthY(acorner.getOrthY());

            SimpleEdge e1 = new SimpleEdge(rcorner1, v);
            e1.setProperty(FICTIVE_KEY, FICTIVE_VALUE);

            SimpleEdge e2 = new SimpleEdge(v, rcorner2);
            e2.setProperty(FICTIVE_KEY, FICTIVE_VALUE);

            SimpleVertex tvertex =
                CompactionHelper.getFirstVerticalEdge(rcorner1, sg)
                                .getAnother(rcorner1);
View Full Code Here

            (SimpleVertex[]) sg.getVertices()
                               .toArray(new SimpleVertex[0]);

        for (int i = 0; i < vertices.length; i++) {
            if (vertices[i].getProperty(FICTIVE_KEY) != null) {
                SimpleEdge edge     = vertices[i].getEdgeProperty(FICTIVE_KEY);
                GraphsContainer vgc =
                    new GraphsContainer(sg,
                                        edge.getLeft(),
                                        edge.getRight());
                int number   = vertices[i].getIntProperty(FICTIVENUMBER_KEY);
                BendPoint bp = (BendPoint) edge.getBendPoints()
                                               .get(number);
                vgc.removeVertex(vertices[i]);

                // duplicating is controlled inside
                vgc.addEdge(edge);
View Full Code Here

            (SimpleVertex[]) sg.getVertices()
                               .toArray(new SimpleVertex[0]);

        for (int i = 0; i < vertices.length; i++) {
            if (vertices[i].getProperty(FaceRectangulator.FICTIVEFACE_KEY) != null) {
                SimpleEdge e =
                    vertices[i].getEdgeProperty(FaceRectangulator.FICTIVEFACE_KEY);

                // sg controls repeating itself
                sg.addEdge(e);
                sg.removeVertex(vertices[i]);
View Full Code Here

        li = tempg.getEdges()
                  .listIterator();

        // adding other vertices, which lay in G'
        while (li.hasNext()) {
            SimpleEdge element = (SimpleEdge) li.next();

            if (((element.getSource()
                             .getProperty(this) != null)
                    && (element.getTarget()
                                   .getProperty(this) == null))
                    || ((element.getTarget()
                                    .getProperty(this) != null)
                    && (element.getSource()
                                   .getProperty(this) == null))
                    || ((element.getSource()
                                    .getProperty(this) == element.getTarget()
                                                                     .getProperty(this))
                    && (element.getSource()
                                   .getProperty(this) != null))) {
                Integer ii =
                    (Integer) ((element.getSource()
                                       .getProperty(this) == null)
                               ? element.getTarget()
                                        .getProperty(this)
                               : element.getSource()
                                        .getProperty(this));

                if (element.getSource()
                               .getProperty(this) == null) {
                    ((Segment) currSegments.get(ii.intValue())).addVertex(element
                                                                          .getSource());
                }

                if (element.getTarget()
                               .getProperty(this) == null) {
                    ((Segment) currSegments.get(ii.intValue())).addVertex(element
                                                                          .getTarget());
                }

                ((Segment) currSegments.get(ii.intValue())).addEdge(element);
            }
        }

        sg.removePropertyAsc(this);

        // one edge property
        li = tempg.getEdges()
                  .listIterator();

        while (li.hasNext()) {
            SimpleEdge element = (SimpleEdge) li.next();

            if ((planarg.getVertices()
                            .indexOf(element.getSource()) != -1)
                    && (planarg.getVertices()
                                   .indexOf(element.getTarget()) != -1)
                    && (planarg.getEdges()
                                   .indexOf(element) == -1)) {
                Segment s = new Segment(planarg);
                s.addEdge(element);
                s.addVertex(element.getSource());
                s.addVertex(element.getTarget());
                currSegments.add(s);
            }
        }
    }
View Full Code Here

                               .listIterator();

        List todel = new ArrayList();

        while (li.hasNext()) {
            SimpleEdge element = (SimpleEdge) li.next();

            if (!gv.contains(element.getTarget()) && gv.contains(element.getSource())) {
                makeDE(todel, element);
            } else if (gv.contains(element.getTarget())
                           && !gv.contains(element.getSource())) {
                makeDE(todel, element);
            } else if (!gv.contains(element.getTarget())
                           && !gv.contains(element.getSource())) {
                makeDE(todel, element);
            } else {
                continue;
            }
        }
View Full Code Here

TOP

Related Classes of com.evelopers.unimod.glayout.graph.SimpleEdge

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.