Package net.wigis.graph.dnv

Examples of net.wigis.graph.dnv.DNVNode


   * @param list
   * @return
   */
  private static DNVNode addNode( DNVGraph graph, String nodeColor, String type, List<DNVNode> list )
  {
    DNVNode node = new DNVNode( graph );
    node.setColor( nodeColor );
    node.setPosition( (float)Math.random(), (float)Math.random() );
    node.setType( type );
    graph.addNode( 0, node );
    list.add( node );
    return node;
  }
View Full Code Here


      int level, boolean highlightNeighbors, int maxLabelLength, int curvedLabelAngle, boolean scaleLabels, boolean hideConflictingLabels,
      boolean drawLabelBox, Graphics2D g2d, int nodeWidth, List<DNVNode> nodes, List<DNVNode> selectedNodes, SortByLabelSize sortByLabelSize,
      boolean boldLabels, float fadeFactor, int maxNumberOfSelectedLabels, Vector3D neighborHighlightColor ) throws MalformedURLException,
      IOException
  {
    DNVNode tempNode;
    drawMustDrawLabels( subgraph, width, height, minXPercent, minYPercent, maxXPercent, maxYPercent, ratio, curvedLabels, outlinedLabels,
        labelSize, interpolationLabels, minX, maxX, minY, maxY, overview, level, highlightNeighbors, maxLabelLength, curvedLabelAngle,
        scaleLabels, hideConflictingLabels, drawLabelBox, g2d, nodeWidth, sortByLabelSize, boldLabels, fadeFactor, neighborHighlightColor );

    if( drawLabels )
    {
      if( hideConflictingLabels )
      {
        nodes = getNodesWithoutOverlappingLabels( nodes, g2d, nodeWidth, interpolationLabels, curvedLabels, labelSize, minX, maxX, minY,
            maxY, minXPercent, maxXPercent, minYPercent, maxYPercent, width, height, ratio, scaleLabels, maxLabelLength,
            curvedLabelAngle, boldLabels, fadeFactor, subgraph.getSuperGraph() );
      }
      for( int i = 0; i < nodes.size(); i++ )
      {
        tempNode = nodes.get( i );
        // if( tempNode.isVisible() )
        // {
        boolean highlighted = highlightNode( highlightNeighbors, tempNode );
        drawLabel( width, height, minXPercent, minYPercent, maxXPercent, maxYPercent, ratio, drawLabels, curvedLabels, outlinedLabels,
            labelSize, interpolationLabels, minX, maxX, minY, maxY, highlightNeighbors, maxLabelLength, curvedLabelAngle, scaleLabels,
            drawLabelBox, tempNode, g2d, nodeWidth, boldLabels, highlighted, neighborHighlightColor );
        // }
      }
    }
    else if( showSearchSelectedLabels && !overview
        && ( subgraph.getSuperGraph().getSelectedNodes( level ).size() > 0 || subgraph.getSuperGraph().getSelectedEdges( level ).size() > 0 ) )
    {
      // int maxNumberLabelsShown = 200;
      // int numberLabelsShown = 0;
      Map<Integer, DNVNode> neighborSelectedNodes = new HashMap<Integer, DNVNode>();
      for( DNVNode selectedNode : selectedNodes )
      {
        neighborSelectedNodes.put( selectedNode.getId(), selectedNode );
        for( DNVNode neighbor : selectedNode.getNeighborMap( true ).values() )
        {
          neighborSelectedNodes.put( neighbor.getId(), neighbor );
        }
      }
      nodes = new ArrayList<DNVNode>( neighborSelectedNodes.values() );

      if( hideConflictingLabels )
      {
        nodes = getNodesWithoutOverlappingLabels( nodes, g2d, nodeWidth, interpolationLabels, curvedLabels, labelSize, minX, maxX, minY,
            maxY, minXPercent, maxXPercent, minYPercent, maxYPercent, width, height, ratio, scaleLabels, maxLabelLength,
            curvedLabelAngle, boldLabels, fadeFactor, subgraph.getSuperGraph() );
      }
      for( int i = 0; i < nodes.size(); i++ )
      {
        tempNode = nodes.get( i );
        if( tempNode.getLabel() != null && !tempNode.getLabel().trim().equals( "" )/*
                                               * &&
                                               * tempNode
                                               * .
                                               * isVisible
                                               * (
                                               * )
                                               */)
        {
          if( tempNode.isNeighborSelected() || tempNode.isEdgeSelected() || tempNode.isSelected() )
          {
            boolean selected = highlightNode( highlightNeighbors, tempNode );
            boolean temp = tempNode.isSelected();
            tempNode.setSelected( selected );
            drawLabel( width, height, minXPercent, minYPercent, maxXPercent, maxYPercent, ratio, selected, curvedLabels, outlinedLabels,
                labelSize, interpolationLabels, minX, maxX, minY, maxY, highlightNeighbors, maxLabelLength, curvedLabelAngle,
                scaleLabels, drawLabelBox, tempNode, g2d, nodeWidth, boldLabels, highlightNode( highlightNeighbors, tempNode ),
                neighborHighlightColor );
            tempNode.setSelected( temp );
          }
        }
      }

    }
View Full Code Here

      List<DNVNode> mustDrawNodes = subgraph.getSortedMustDrawLabelNodes();
      if( mustDrawNodes == null )
      {
        List<DNVEntity> entities = new ArrayList<DNVEntity>( subgraph.getSuperGraph().getMustDrawLabels( level ).values() );
        mustDrawNodes = new ArrayList<DNVNode>();
        DNVNode node;
        for( DNVEntity entity : entities )
        {
          if( entity instanceof DNVNode )
          {
            node = (DNVNode)entity;
            if( !( node.isSelected() || ( highlightNeighbors && ( node.isEdgeSelected() || node.isNeighborSelected() ) ) ) )
            {
              mustDrawNodes.add( node );
            }
          }
        }
View Full Code Here

  private static List<DNVNode> drawNodes( SubGraph subgraph, Graphics2D g, int width, int height, double minXPercent, double minYPercent,
      double maxXPercent, double maxYPercent, boolean showIcons, double minX, double maxX, double minY, double maxY,
      boolean highlightNeighbors, int type, int nodeWidth, List<DNVNode> selectedNodes, Timer transformTimer, Timer drawNodeTimer,
      SortByLabelSize sortByLabelSize, boolean sortNodes, int maxDistanceToHighlight ) throws MalformedURLException, IOException
  {
    DNVNode tempNode;
    Vector2D tempPos;
    List<DNVNode> nodes;
    Vector3D color;
    nodes = subgraph.getSortedNodes();
    if( nodes == null )
    {
      nodes = subgraph.getNodesList();
      if( sortNodes )
      {
        Collections.sort( nodes, sortByLabelSize );
        subgraph.setSortedNodes( nodes );
      }
    }
    for( int i = 0; i < nodes.size(); i++ )
    {
      tempNode = nodes.get( i );
      color = tempNode.getColor();
      transformTimer.setStart();
      tempPos = transformPosition( minX, maxX, minY, maxY, minXPercent, maxXPercent, minYPercent, maxYPercent, width, height,
          tempNode.getPosition( true ) );
      transformTimer.setEnd();
      drawNodeTimer.setStart();
      try
      {
        drawNode( g, showIcons, tempNode, tempNode.getIcon(), tempPos, color, nodeWidth, type, maxDistanceToHighlight );
      }
      catch( IOException ioe )
      {
        ioe.printStackTrace();
      }
View Full Code Here

      double minYPercent, double maxYPercent, int width, int height, double ratio, boolean scaleLabels, int maxLabelLength,
      int curvedLabelAngle, boolean boldLabels, float fadeFactor, DNVGraph graph )
  {
    List<DNVNode> goodNodes = new ArrayList<DNVNode>();
    // DNVNode node;
    DNVNode node2;
    Rectangle boundingRectangle;
    Rectangle boundingRectangle2;
    float overlap = 1;
    Map<Integer, Rectangle> boundingRectangles = new HashMap<Integer, Rectangle>();
    Map<Integer, List<DNVNode>> nodesByYPos = new HashMap<Integer, List<DNVNode>>();
    Map<Integer, Map<Integer, Integer>> nodeAndKeyToIndex = new HashMap<Integer, Map<Integer, Integer>>();
    getNodesByYPos( nodes, g, nodeWidth, interpolationLabels, curvedLabels, labelSize, minX, maxX, minY, maxY, minXPercent, maxXPercent,
        minYPercent, maxYPercent, width, height, ratio, scaleLabels, maxLabelLength, curvedLabelAngle, boldLabels, graph, boundingRectangles,
        nodesByYPos, nodeAndKeyToIndex, false, DEFAULT_LABEL_HEIGHT );

    for( DNVNode node : nodes )
    {
      // node = nodes.get( i );
      if( node.getLabel() != null && !node.getLabel().equals( "" )/*
                                     * &&
                                     * node.
                                     * isVisible
                                     * ()
                                     */)
      {
        overlap = 1;
        boundingRectangle = boundingRectangles.get( node.getId() );
        Integer key = getKey( boundingRectangle.positionY, DEFAULT_LABEL_HEIGHT );
        List<DNVNode> nodes2 = nodesByYPos.get( key );
        try
        {
          int end = nodeAndKeyToIndex.get( key ).get( node.getId() );
          for( int j = nodes2.size() - 1; j > end; j-- )
          {
            node2 = nodes2.get( j );
            if( !node2.getLabel().equals( "" )/* && node2.isVisible() *//*
                                         * &&
                                         * !
                                         * node2
                                         * .
                                         * hasProperty
                                         * (
                                         * "faded"
                                         * )
                                         */)
            {
              boundingRectangle2 = boundingRectangles.get( node2.getId() );

              if( overlap( boundingRectangle, boundingRectangle2 ) )
              {
                overlap /= fadeFactor;
                if( overlap < 0.01f )
View Full Code Here

  {
    Vector2D tempPos;
    Rectangle boundingRectangle;
    for( int i = 0; i < nodes.size(); i++ )
    {
      DNVNode tempNode = nodes.get( i );
      tempPos = transformPosition( minX, maxX, minY, maxY, minXPercent, maxXPercent, minYPercent, maxYPercent, width, height,
          tempNode.getPosition( true ) );
      boundingRectangle = getRectangleBoundingTheLabel( tempNode, tempPos, g, nodeWidth, tempNode.getLabel( interpolationLabels ),
          curvedLabels, labelSize, minXPercent, maxXPercent, ratio, scaleLabels, maxLabelLength, curvedLabelAngle, boldLabels,
          nodes.size() > 1000, includeNodeBounds );
      boundingRectangles.put( tempNode.getId(), boundingRectangle );
      Integer key = getKey( boundingRectangle.positionY, areaHeight );
      addByKey( nodesByYPos, nodeAndKeyToIndex, tempNode, key );
      addByKey( nodesByYPos, nodeAndKeyToIndex, tempNode, key - 1 );
      addByKey( nodesByYPos, nodeAndKeyToIndex, tempNode, key + 1 );
    }
View Full Code Here

      int level = 0;
      double globalMaxY;
      double globalMinY;
      double globalMaxX;
      double globalMinX;
      DNVNode movedNode;
      int graphSize;
      int tempIndex;
      String tempFileName;
      Timer[] selectionTimers = new Timer[fileNames.length];
      Timer[] movementTimers = new Timer[fileNames.length];
View Full Code Here

      Node n;
      String fromid = "";
      String toid = "";
      int edgeID = EDGE_ID_OFFSET;
      String uuid = "";
      DNVNode dnvnode = null;
      for( int i = 0; i < nl.getLength(); i++ )
      {
        n = nl.item( i );

        if( n.getNodeName().equals( "uuid" ) )
        {
          dnvnode = new DNVNode( g );
          uuid = clean( n.getTextContent() );
          g.addNode( 0, dnvnode );
          nodeIdMap.put( uuid, dnvnode );
        }
        // transformation case
        else if( n.getNodeName().equals( "name" ) )
        {
          System.out.println( n.getNodeName() + " " );
          dnvnode.setLabel( "TRANS: " + clean( n.getTextContent() ) );
          dnvnode.setRadius( 2 );
          dnvnode.setPosition( (float)Math.random(), (float)Math.random() );
          dnvnode.setColor( new Vector3D( 0.1f, 0.5f, 0.9f ) );
          System.out.println( n.getTextContent() + " " );
        }
        // file case
        else if( n.getNodeName().equals( "localId" ) )
        {
          System.out.println( n.getNodeName() + " " );
          dnvnode.setLabel( "FILE: " + clean( n.getTextContent() ) );
          dnvnode.setRadius( 3 );
          dnvnode.setPosition( (float)Math.random(), (float)Math.random() );
          dnvnode.setColor( new Vector3D( 0.0f, 0.9f, 0.1f ) );
          System.out.println( n.getTextContent() + " " );
        }

        else if( n.getNodeName().equals( "from" ) )
        {
View Full Code Here

    String currentLine;
    String currentChunkType;
    DNVGraph dnvGraph = new DNVGraph();
    int fromId;
    int toId;
    DNVNode fromNode;
    DNVNode toNode;
    for( int i = 0; i < allChunks.size(); i++ )
    {
      currentChunk = allChunks.get( i );
      currentChunkType = chunkTypes.get( i );
      currentOffset = offsets.get( i );
      currentColor = chunkColors.get( i );
      currentSize = chunkSizes.get( i );

      for( int j = 0; j < currentChunk.size(); j++ )
      {
        currentLine = currentChunk.get( j );
        currentLineArray = parseLine( currentLine, delim );
        if( currentChunkType.equals( "@NODES" ) )
        {
          DNVNode dnvNode = new DNVNode( new Vector2D( (float)Math.random(), (float)Math.random() ), dnvGraph );
          dnvNode.setLevel( 0 );
          dnvNode.setId( Integer.parseInt( currentLineArray.get( 0 ) ) );
          dnvNode.setLabel( currentLineArray.get( 1 ) );
          dnvNode.setColor( currentColor );
          dnvNode.setRadius( (float)currentSize );
          dnvGraph.addNode( 0, dnvNode );
        }
        else if( currentChunkType.equals( "@EDGES" ) )
        {
          fromId = Integer.parseInt( currentLineArray.get( 0 ) );
View Full Code Here

          maxIndex = Math.max(maxIndex, Math.max(ind1, ind2));
          tupos.add(new Pair<Integer, Integer>(ind1, ind2));
          line = br.readLine();
        }
        for(int i = minIndex; i <= maxIndex; i++){
          DNVNode node = new DNVNode(graph);
          graph.addNode(0, node);
        }
        for(Pair<Integer, Integer> eIndex : tupos){
          DNVEdge edge = new DNVEdge(graph);
          edge.setFrom(graph.getNode(0, eIndex.getFirst() - minIndex));
View Full Code Here

TOP

Related Classes of net.wigis.graph.dnv.DNVNode

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.