Package org.gephi.graph.api

Examples of org.gephi.graph.api.TextData


        try {
            writer.writeStartElement(ELEMENT_TEXTDATA);
            GraphModel graphModel = workspace.getLookup().lookup(GraphModel.class);
            HierarchicalGraph hierarchicalGraph = graphModel.getHierarchicalGraph();
            for (Node node : hierarchicalGraph.getNodesTree()) {
                TextData nodeTextData = node.getNodeData().getTextData();
                if (nodeTextData != null) {
                    writer.writeStartElement(ELEMENT_NODEDATA_TEXTDATA);
                    writer.writeAttribute("for", String.valueOf(node.getId()));
                    if (nodeTextData.getR() > 0) {
                        writer.writeStartElement(ELEMENT_TEXTDATA_COLOR);
                        writer.writeAttribute("r", String.valueOf(nodeTextData.getR()));
                        writer.writeAttribute("g", String.valueOf(nodeTextData.getG()));
                        writer.writeAttribute("b", String.valueOf(nodeTextData.getB()));
                        writer.writeAttribute("a", String.valueOf(nodeTextData.getAlpha()));
                        writer.writeEndElement();
                    }
                    writer.writeStartElement(ELEMENT_TEXTDATA_SIZE);
                    writer.writeAttribute("value", String.valueOf(nodeTextData.getSize()));
                    writer.writeEndElement();
                    writer.writeStartElement(ELEMENT_TEXTDATA_VISIBLE);
                    writer.writeAttribute("value", String.valueOf(nodeTextData.isVisible()));
                    writer.writeEndElement();
                    writer.writeEndElement();
                }
            }
            for (Node node : hierarchicalGraph.getNodesTree()) {
                for (Edge edge : hierarchicalGraph.getEdges(node)) {
                    TextData edgeTextData = edge.getEdgeData().getTextData();
                    if (edgeTextData != null) {
                        writer.writeStartElement(ELEMENT_EDGEDATA_TEXTDATA);
                        writer.writeAttribute("for", String.valueOf(edge.getId()));
                        if (edgeTextData.getR() > 0) {
                            writer.writeStartElement(ELEMENT_TEXTDATA_COLOR);
                            writer.writeAttribute("r", String.valueOf(edgeTextData.getR()));
                            writer.writeAttribute("g", String.valueOf(edgeTextData.getG()));
                            writer.writeAttribute("b", String.valueOf(edgeTextData.getB()));
                            writer.writeAttribute("a", String.valueOf(edgeTextData.getAlpha()));
                            writer.writeEndElement();
                        }
                        writer.writeStartElement(ELEMENT_TEXTDATA_SIZE);
                        writer.writeAttribute("value", String.valueOf(edgeTextData.getSize()));
                        writer.writeEndElement();
                        writer.writeStartElement(ELEMENT_TEXTDATA_VISIBLE);
                        writer.writeAttribute("value", String.valueOf(edgeTextData.isVisible()));
                        writer.writeEndElement();
                        writer.writeEndElement();
                    }
                }
            }
View Full Code Here

TOP

Related Classes of org.gephi.graph.api.TextData

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.