Package com.evelopers.unimod.glayout.graph

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


    private void buildEdges() {
        ListIterator li = sg.getEdges()
                            .listIterator();

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

            if (element.getSource()
                           .equals(gd.getSource())) {
                if (element.getTarget()
                               .equals(gd.getTarget())) {
                    preBuildSTEdge(element, 2);
                } else {
                    preBuildSTEdge(element, -1);
                }
            } else if (element.getTarget()
                                  .equals(gd.getTarget())) {
                if (!element.getSource()
                                .equals(gd.getSource())) {
                    preBuildSTEdge(element, 1);
                } else {
                    preBuildSTEdge(element, 2);
                }
View Full Code Here


            if ((!vertex.equals(gd.getSource())) && (!vertex.equals(gd.getTarget()))) {
                vertex.setOrthY(vertex.getVisY());

                Path path       = (Path) vertex.getProperty(VisibilityFactory.PATH_KEY);
                SimpleEdge edge = (SimpleEdge) path.getEdges()
                                                   .get(0);
                vertex.setOrthX(edge.getVisX());
            }
        }

        sg.removePropertyAsc(VisibilityFactory.PATH_KEY);
    }
View Full Code Here

    /*
     * x -> min
     */
    private SimpleEdge getRightmostEdgeOrth(SimpleVertex v, List edges, int issource) {
        ListIterator li = edges.listIterator();
        SimpleEdge curr = (SimpleEdge) edges.get(0);

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

            if (element.getAnother(v)
                           .getOrthX() > curr.getAnother(v)
                                                 .getOrthX()) {
                curr = element;
            }

            /* this may be not needed
             * cause now we are using another orientation method
             */
            if ((element.getSource() == gd.getSource())
                    && (element.getTarget() == gd.getTarget())) {
                return element;
            }
        }

        return curr;
View Full Code Here

     * x -> min
     * using visibility
     */
    private SimpleEdge getLeftmostEdgeVis(SimpleVertex v, List edges) {
        ListIterator li = edges.listIterator();
        SimpleEdge curr = (SimpleEdge) edges.get(0);

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

            // to edges of equal VisX is an impossible case
            // but left there for better compatibility
            if ((element.getVisX() < curr.getVisX())
                    || ((element.getVisX() == curr.getVisX())
                    && (element.getAnother(v)
                                   .getVisY() > curr.getAnother(v)
                                                        .getVisY()))) {
                curr = element;
            }
        }
View Full Code Here

        ListIterator li = sg.getEdges()
                            .listIterator();
        HashMap hm = new HashMap();

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

            if (closure(hm,
                            element.getSource(),
                            element.getTarget())
                    || closure(hm,
                                   element.getTarget(),
                                   element.getSource())) {
                dupes.add(element);
            }
        }

        sg.removeEdges(dupes);
View Full Code Here

        // st-oriented
        LinkedList stn;

        if (sg.getVertices()
                  .size() > 1) {
            SimpleEdge ste = (SimpleEdge) sg.getEdges()
                                            .get(0);
            stn = STNumbering.getInstance(sg)
                             .buildSTNumbering(ste.getSource(),
                                               ste.getTarget(),
                                               ste);
        } else {
            stn = new LinkedList();
            stn.add(sg.getVertices().get(0));
        }

        sg.setProperty(STN_KEY, stn);

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

        while (lie.hasNext()) {
            SimpleEdge edge = (SimpleEdge) lie.next();
            GraphHelper.checkAndReverse(edge, stn);
        }

        ListIterator listn = stn.listIterator();
View Full Code Here

                         new EdgeDistComparator(element));

        ListIterator li = l.listIterator();

        while (li.hasNext()) {
            SimpleEdge edge = (SimpleEdge) li.next();
            SimpleVertex v1 = edge.getAnother(element);

            SimpleGraph inner = (SimpleGraph) element.getProperty(Constant.LAYER_KEY);
            boolean inside    = false;

            if (inner != null) {
                List innerv = (List) inner.getProperty(AltMultiLayerBuilder.LOWERV_KEY);
                List innerc = inner.getVertices();

                if (innerv != null) {
                    if (innerv.contains(v1)) {
                        inside = true;
                    }
                }

                if (innerc.contains(v1)) {
                    inside = true;
                }
            }

            double dist =
                v1.getVertexext()
                  .getLeftTop()
                  .getX() - element.getVertexext()
                                   .getLeftTop()
                                   .getX();
            EdgeExt ee    = new EdgeExt();
            Anchor src    = null;
            Anchor target = null;

            if (dist < 0) {
                // v1 is src, v1.x < target.x
                src = v1.getVertexext()
                        .getTopRightmost();

                if (!inside) {
                    target = element.getVertexext()
                                    .getLeftUpmost();
                } else {
                    target = element.getVertexext()
                                    .getLeftLowmost();
                }
            } else {
                src = v1.getVertexext()
                        .getTopLeftmost();

                if (!inside) {
                    target = element.getVertexext()
                                    .getRightUpmost();
                } else {
                    target = element.getVertexext()
                                    .getRightLowmost();
                }
            }

            ee.setSrcAnchor(src);
            ee.setTargetAnchor(target);
            edge.setEdgeext(ee);
        }
    }
View Full Code Here

     */
    private void orientSpeciale(SimpleVertex element) {
        ListIterator li = speciale.listIterator();

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

            if (element.getEdges()
                           .contains(edge)) {
                if (edge.getProperty(FCOLOR_KEY) == null) {
                    edge.setProperty(FCOLOR_KEY, FRED);

                    if (element.equals(edge.getTarget())) {
                        edge.reverse();
                    }
                } else if (edge.getIntProperty(FCOLOR_KEY) == FRED.intValue()) {
                    edge.setProperty(FCOLOR_KEY, FBLACK);
                } else if (edge.getIntProperty(FCOLOR_KEY) == FBLACK.intValue()) {
                    throw new IllegalArgumentException("cannot meet black vertex");
                }
            }
        }
    }
View Full Code Here

        List l = element.getEdgesRelativeIncoming(sg);
        Collections.sort(l,
                         new EdgeXComparator(element));

        int index         = l.size() / 2;
        SimpleEdge median = (SimpleEdge) l.get(index);
        VertexExt ve      = median.getAnother(element)
                                  .getVertexext();
        int x = ((int) ve.getLeftTop()
                         .getX() + ve.getWidth());

        return x;
View Full Code Here

            super();
            this.v = v;
        }

        public int compare(Object o1, Object o2) {
            SimpleEdge e1   = (SimpleEdge) o1;
            SimpleEdge e2   = (SimpleEdge) o2;
            SimpleVertex v1 = e1.getAnother(v);
            SimpleVertex v2 = e2.getAnother(v);
            double x1       = v1.getVertexext()
                                .getLeftTop()
                                .getX();
            double x2 = v2.getVertexext()
                          .getLeftTop()
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.