Package com.evelopers.unimod.glayout.graph.containers

Examples of com.evelopers.unimod.glayout.graph.containers.Chain


    /*
     * unoriented method
     */
    private static Chain getTowardsPathUnOri(Face f, SimpleEdge e, SimpleVertex source,
                                             SimpleVertex target) {
        Chain res = new Chain(f.getGraph());
        res.addEdge(e);

        SimpleEdge curre = e;
        res.addVertex(source);

        SimpleVertex curr = e.getAnother(source);
        res.addVertex(curr);

        while (curr != target) {
            SimpleEdge tmp;

            if (curr.getEdgesRelative(f)
                        .get(0) == curre) {
                tmp = (SimpleEdge) curr.getEdgesRelative(f)
                                       .get(1);
            } else {
                tmp = (SimpleEdge) curr.getEdgesRelative(f)
                                       .get(0);
            }

            res.addEdge(tmp);
            curr = tmp.getAnother(curr);
            res.addVertex(curr);
            curre = tmp;
        }

        return res;
    }
View Full Code Here


    private void countProperties() {
        /* chain is better then face anyway
         * 'cause it is in the proper order
         * must be ccw
         */
        Chain c =
            GraphHelper.getInstance()
                       .dfsChainSearchUnOri(f,
                                            new Chain(f),
                                            (SimpleVertex) f.getVertices().get(0),
                                            (SimpleVertex) f.getVertices().get(0));
        f.removePropertyAsc(GraphHelper.getInstance());

        // the uppermost edge
        SimpleEdge upperedge = GeometricHelper.getUpperEdge(c);

        // index of the next for upper
        int nexti;

        if (c.getEdges()
                 .indexOf(upperedge) == (c.getEdges()
                                              .size() - 1)) {
            nexti = 0;
        } else {
            nexti = c.getEdges()
                     .indexOf(upperedge) + 1;
        }

        // whether order is ccw or cw
        SimpleEdge nextupper = (SimpleEdge) c.getEdges()
                                             .get(nexti);

        if (!CompactionHelper.getIntersection(upperedge, nextupper)
                                 .equals(GeometricHelper.getRightVetrtex(upperedge))) {
            Collections.reverse(c.getEdges());
        }

        SimpleEdge[] edges = (SimpleEdge[]) c.getEdges()
                                             .toArray(new SimpleEdge[0]);
        SimpleEdge prev = edges[edges.length - 1];

        for (int i = 0; i < edges.length; i++) {
            SimpleEdge curr     = edges[i];
View Full Code Here

        SimpleGraph temp = new SimpleGraph();
        GraphHelper.instanceCopy(getGraph(),
                                 temp);

        while (true) {
            Chain ac = new Chain(temp);
            ac = GraphHelper.getInstance()
                            .dfsChainSearchUnOri(temp,
                                                 ac,
                                                 gd.getSource(),
                                                 gd.getTarget());
            getGraph()
                .removePropertyAsc(GraphHelper.getInstance());

            if (ac == null) {
                break;
            }

            orientOnSTChain(ac);
            temp.removeEdges(ac.getEdges());
        }
    }
View Full Code Here

        dontgo.setProperty(GraphHelper.getInstance(),
                           GraphHelper.getInstance());

        // chain for face
        Face tface = new Face(sg);
        Chain ac   = new Chain(tface);
        GraphHelper.instanceCopy(gd.getOuterLeft(),
                                 tface);
        GraphHelper.instanceCopy(gd.getOuterRight(),
                                 tface);
        ac = GraphHelper.getInstance()
                        .dfsChainSearchUnOri(tface, ac, v1, v2);
        sg.removePropertyAsc(GraphHelper.getInstance());

        Face f = new Face(sg);

        GraphsContainer vgc = new GraphsContainer(sg, f);
        f.addEdges(ac.getEdges());
        f.addVertices(ac.getVertices());
        f.setProperty(FICTIVE_KEY, FICTIVE_VALUE);
        gd.getFaces()
          .add(f);

        return vgc;
View Full Code Here

    /**
     * Get outer face two set
     * @return result
     */
    protected GContainer getOuter() {
        Chain temp = new Chain(tempg);
        temp =
            GraphHelper.getInstance()
                       .dfsChainSearchUnOri(tempg, temp,
                                            (SimpleVertex) tempg.getVertices().get(0),
                                            (SimpleVertex) tempg.getVertices().get(0));
View Full Code Here

     * @param s
     */
    private void addAlphaChain(Segment s) {
        ListIterator li = gd.getFaces()
                            .listIterator();
        Chain ac            = null;
        SimpleVertex source = null;
        SimpleVertex target = null;
        Face cface          = null;

        while (li.hasNext()) {
            cface = (Face) li.next();

            if (cface.isAdmissible(s)) {
                List contactvertices = s.getCV();

                if (contactvertices.size() > 0) {
                    source = (SimpleVertex) contactvertices.get(0);

                    if (contactvertices.size() == 1) {
                        target = source;
                    } else {
                        target = (SimpleVertex) contactvertices.get(1);
                    }

                    ac = s.getAChain(tempg, source, target);

                    break;
                }
            }
        }

        Face f = cface.split(ac, source, target);
        gd.getFaces()
          .add(f);
        GraphHelper.instanceCopy(ac, planarg);
        tempg.removeEdges(ac.getEdges());
        tempg.removeVertices(ac.getVertices());
    }
View Full Code Here

     * preverify that face is cyclic
     * @param f face to check
     * @return result
     */
    public boolean isCycle(Face f) {
        Chain ac        = new Chain(f.getGraph());
        SimpleVertex sv = (SimpleVertex) f.getVertices()
                                          .get(0);
        ac              = GraphHelper.getInstance()
                                     .dfsChainSearchOri(f, ac, sv, sv);

View Full Code Here

                    return ac;
                }

                if (svc.getProperty(this) == null) {
                    Chain acc = (Chain) ac.instanceCopy();
                    acc.addEdge(element);
                    acc.addVertex(svc);

                    Chain res = dfsChainSearch(sg, acc, svc, target, ori);

                    if (res != null) {
                        return res;
                    }
                }
View Full Code Here

TOP

Related Classes of com.evelopers.unimod.glayout.graph.containers.Chain

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.