Package com.evelopers.unimod.glayout.graph

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


        // adding cutpoints
        ListIterator licp = cutpoints.listIterator();

        while (licp.hasNext()) {
            SimpleVertex element = (SimpleVertex) licp.next();
            SimpleVertex toadd   = new SimpleVertex();
            blk.addVertex(toadd);
            toadd.setProperty(CORRESP_KEY, element);
            element.setProperty(CORRESP_KEY, toadd);
        }

        // searching for biconn subgraph count
        int esub_count   = 0;
        ListIterator lie = sg.getEdges()
                             .listIterator();

        while (lie.hasNext()) {
            SimpleEdge element = (SimpleEdge) lie.next();
            int esub_n         = element.getIntProperty(ESUBGRAPH_KEY);

            if (esub_n > esub_count) {
                esub_count = esub_n;
            }
        }

        // creating vertices
        SimpleVertex[] white = new SimpleVertex[esub_count];

        for (int i = 0; i < white.length; i++) {
            white[i] = new SimpleVertex();
            blk.addVertex(white[i]);
        }

        // setting vertex corresp
        lie = sg.getEdges()
                .listIterator();

        while (lie.hasNext()) {
            SimpleEdge element  = (SimpleEdge) lie.next();
            SimpleVertex svcomp = white[element.getIntProperty(ESUBGRAPH_KEY) - 1];
            SimpleVertex v1     = element.getSource();
            SimpleVertex v2     = element.getTarget();

            //setting corresp vertex not from cutpoints
            if ((svcomp.getVertexProperty(CORRESP_KEY) == null)
                    || (!cutpoints.contains(v1))) {
                svcomp.setProperty(CORRESP_KEY, v1);
            }

            if ((svcomp.getVertexProperty(CORRESP_KEY) == null)
                    || (!cutpoints.contains(v2))) {
                svcomp.setProperty(CORRESP_KEY, v2);
            }
        }

        // adding edges
        licp = cutpoints.listIterator();

        while (licp.hasNext()) {
            SimpleVertex element = (SimpleVertex) licp.next();
            SimpleVertex svcutp  = element.getVertexProperty(CORRESP_KEY);
            ListIterator liedges = element.getEdgesRelative(sg)
                                          .listIterator();

            List v2c = new ArrayList();

            // but no duplicate edges
            while (liedges.hasNext()) {
                SimpleEdge edge     = (SimpleEdge) liedges.next();
                SimpleVertex svcomp = white[edge.getIntProperty(ESUBGRAPH_KEY) - 1];

                if (!v2c.contains(svcomp)) {
                    v2c.add(svcomp);
                }
            }

            ListIterator liv2c = v2c.listIterator();

            while (liv2c.hasNext()) {
                SimpleVertex vertex = (SimpleVertex) liv2c.next();

                SimpleEdge toadd = new SimpleEdge(svcutp, vertex);
                blk.addEdge(toadd);
            }
        }
View Full Code Here


//        SimpleVertex startV     = (SimpleVertex) sg.getVertices()
//                                                   .get(0);

        // maybe without startV
        List connectedVertices = sg.getVertices();
        SimpleVertex tempV;
        SimpleVertex otherV;
        SimpleEdge tempE;
        int i                  = 0;
        List edges;
        boolean flag;
        boolean hasUnusedEdges;
        boolean alreadyVisited = false;
        int subGraphNumber     = 1;
        LinkedList nodeStack   = new LinkedList();
        LinkedList edgeStack   = new LinkedList();

        ListIterator li = connectedVertices.listIterator();

        while (li.hasNext()) {
            SimpleVertex v = (SimpleVertex) li.next();
            v.setProperty(DFSNUM_KEY,
                          new Integer(0));
            v.setProperty(ISOLD_KEY, Boolean.FALSE);
            v.setProperty(LOWNUM_KEY,
                          new Integer(0));
            v.setProperty(SUBGRAPH_KEY,
                          new Integer(0));
        }

        edges     = sg.getEdges();
        li        = edges.listIterator();
View Full Code Here

        ListIterator li = getGraph()
                              .getVertices()
                              .listIterator();

        while (li.hasNext()) {
            SimpleVertex element = (SimpleVertex) li.next();
            element.setOrig(element);
            element.setDest(element);
        }
    }
View Full Code Here

        double maxy     = Double.MIN_VALUE;
        ListIterator li = sg.getVertices()
                            .listIterator();

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

            if ((element.getVertexext()
                            .getLeftTop()
                            .getY() + element.getVertexext()
                                                 .getHeight()) > maxy) {
                maxy =
                    element.getVertexext()
                           .getLeftTop()
                           .getY() + element.getVertexext()
                                            .getHeight();
            }

            if ((element.getVertexext()
                            .getLeftTop()
                            .getX() + element.getVertexext()
                                                 .getWidth()) > maxx) {
                maxx =
                    element.getVertexext()
                           .getLeftTop()
                           .getX() + element.getVertexext()
                                            .getWidth();
            }
        }

        maxx += 2;
View Full Code Here

        ListIterator li = getGraph()
                              .getVertices()
                              .listIterator();

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

            if ((element == gd.getSource()) || (element == gd.getTarget())) {
                element.setLeft(gd.getOuterLeft());
                element.setRight(gd.getOuterRight());
            } else {
                Face[] vfaces     = getNonSTFacesForVertex(element);
                boolean islefted  = false;
                ListIterator outg =
                    element.getEdgesRelativeOutgoing(getGraph())
                           .listIterator();

                while (outg.hasNext()) {
                    SimpleEdge outg_e = (SimpleEdge) outg.next();

                    if (outg_e.getLeft() == vfaces[0]) {
                        islefted = true;

                        break;
                    }
                }

                if (islefted) {
                    element.setLeft(vfaces[0]);
                    element.setRight(vfaces[1]);
                } else {
                    element.setLeft(vfaces[1]);
                    element.setRight(vfaces[0]);
                }
            }
        }
    }
View Full Code Here

//        List res         = new ArrayList();
        ListIterator li0 = sg.getVertices()
                             .listIterator();

        while (li0.hasNext()) {
            SimpleVertex el = (SimpleVertex) li0.next();
            SimpleGraph sgr = (SimpleGraph) el.getProperty(Constant.LAYER_KEY);

            if (sgr != null) {
                iPaint(sgr, bg);
            }
        }

        // vertices
        ListIterator li = sg.getVertices()
                            .listIterator();

        while (li.hasNext()) {
            SimpleVertex v = (SimpleVertex) li.next();
            int vx         = xconvert(v.getVertexext().getLeftTop().getX());
            int vy         = yconvert(v.getVertexext().getLeftTop().getY());
            int ww         = xmult(v.getVertexext().getWidth());
            int hh         = ymult(v.getVertexext().getHeight());
            bg.setColor(Color.BLACK);

            if ((v.getProperty(AltMultiLayerBuilder.FICTIVEML_KEY) != null)
                    || (v.getProperty(AltMultiLayerBuilder.FICTIVEMLE_KEY) != null)) {
                bg.setColor(Color.GREEN);
            }

            bg.drawRect(vx, vy, ww, hh);
            bg.setColor(Color.RED);
            bg.drawString("v" + v.getId(), vx + (Consts.VR / 2), vy - (Consts.VR / 2));
        }

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

        while (li.hasNext()) {
            SimpleEdge e = (SimpleEdge) li.next();
            bg.setColor(Consts.EDGE_C);

            if ((e.getProperty(Connectivity.FICTIVEEDGEBICONN_KEY) != null)
                    || (e.getProperty(Connectivity.FICTIVEEDGECONN_KEY) != null)
                    || (e.getProperty(AltMultiLayerBuilder.FICTIVEML_KEY) != null)
                    || (e.getProperty(AltMultiLayerBuilder.FICTIVEMLE_KEY) != null)) {
                bg.setColor(Color.GREEN);
            }

            int[] xpoints     = new int[3];
            int[] ypoints     = new int[3];
            SimpleVertex src  = e.getSource();
            SimpleVertex dest = e.getTarget();
            Anchor srca       = e.getEdgeext()
                                 .getSrcAnchor();
            Anchor targeta = e.getEdgeext()
                              .getTargetAnchor();

            Point2D spoint = src.getVertexext()
                                .getAnchorPoint(srca);

            xpoints[0]     = xconvert(spoint.getX());
            ypoints[0]     = yconvert(spoint.getY());

            Point2D fpoint = dest.getVertexext()
                                 .getAnchorPoint(targeta);

            xpoints[2]     = xconvert(fpoint.getX());
            ypoints[2]     = yconvert(fpoint.getY());
View Full Code Here

        ListIterator lif = gd.getFaces()
                             .listIterator();

        while (lif.hasNext()) {
            Face element    = (Face) lif.next();
            SimpleVertex sv = new SimpleVertex();
            associated.addVertex(sv);
            element.setProperty(this, sv);
        }

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

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

            if (!((element.getSource() == gd.getSource())
                    && (element.getTarget() == gd.getTarget()))) {
                SimpleVertex src = element.getLeft()
                                          .getVertexProperty(this);
                SimpleVertex dst = element.getRight()
                                          .getVertexProperty(this);
                SimpleEdge se = new SimpleEdge(src, dst);
                associated.addEdge(se);
            }
        }
View Full Code Here

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

        for (int i = 0; i < vertices.length; i++) {
            SimpleVertex v = vertices[i];
            BigVertex bv   = BigVertex.getBigIfNeeded(sg, gd, v);

            if (bv != null) {
                bigvertices.add(bv);
            }
View Full Code Here

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

        while (li.hasNext()) {
            SimpleEdge edge1 = (SimpleEdge) li.next();
            SimpleVertex src = null;
            SimpleVertex dst = null;
            boolean todo     = false;

            if (hor) {
                if (edge1.isHorizontal()) {
                    src      = GeometricHelper.getMinHorizontal(edge1);
                    dst      = edge1.getAnother(src);
                    todo     = true;
                }
            } else {
                if (edge1.isVertical()) {
                    src      = GeometricHelper.getMinVertical(edge1);
                    dst      = edge1.getAnother(src);
                    todo     = true;
                }
            }

            if (todo) {
                SimpleVertex mainsrc = src.getVertexProperty(NGRAPH_KEY);
                SimpleVertex maindst = dst.getVertexProperty(NGRAPH_KEY);
                SimpleEdge newedge   = new SimpleEdge(mainsrc, maindst);
                ngraph.addEdge(newedge);
            }
        }
    }
View Full Code Here

        }

        SimpleVertex[] vertices = new SimpleVertex[compcount];

        for (int i = 0; i < vertices.length; i++) {
            vertices[i] = new SimpleVertex();
            ngraph.addVertex(vertices[i]);
        }

        ListIterator li = sg.getVertices()
                            .listIterator();

        while (li.hasNext()) {
            SimpleVertex vertex = (SimpleVertex) li.next();
            int compnum         = vertex.getIntProperty(this);
            vertex.setProperty(NGRAPH_KEY, vertices[compnum]);
        }

        sg.removePropertyAsc(this);
    }
View Full Code Here

TOP

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

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.