Package net.wigis.graph.dnv.utilities

Examples of net.wigis.graph.dnv.utilities.Vector3D


    int nodeCnt = 0;
   
   
    //map each nodeId to appropriate level
    for(int index : gaps){     
      Vector3D color = new Vector3D( (float)Math.max( 0.3, Math.random() ), (float)Math.max( 0.3, Math.random() ), (float)Math.max( 0.3, Math
          .random() ) );
      ArrayList<DNVNode> levelNodes = new ArrayList<DNVNode>();
      for(int i = lastVistedIndex; i < index; i++){
        Integer degree = (Integer) degreeOrderedListDK1.get(i);
        for(DNVNode node : degreeNodeTableDK1.get(degree)){
          nodeIdToLevel.put(node.getId(), currentLevel);
          levelNodes.add(node);
          node.setColor(color);
        }
      }
      levelToNodeList.put(currentLevel, levelNodes);
      System.out.println("gap" + index + "current level " + currentLevel + " number of nodes " + levelNodes.size());
      nodeCnt += levelNodes.size();
      currentLevel--;
      lastVistedIndex = index;
    }
    Vector3D color = new Vector3D( (float)Math.max( 0.3, Math.random() ), (float)Math.max( 0.3, Math.random() ), (float)Math.max( 0.3, Math
        .random() ) );
    ArrayList<DNVNode> levelNodes = new ArrayList<DNVNode>();
    for(int i = lastVistedIndex; i < degreeOrderedListDK1.size(); i++){
      Integer degree = (Integer) degreeOrderedListDK1.get(i);
      for(DNVNode node : degreeNodeTableDK1.get(degree)){
View Full Code Here


    newNode.setLevel( newLevel.intValue() );
    newNode.setFirstChild( tempNode );
    graph.addNode( newLevel, newNode );
    if( multicolor && newLevel == 1 )
    {
      Vector3D color = new Vector3D( (float)Math.max( 0.3, Math.random() ), (float)Math.max( 0.3, Math.random() ), (float)Math.max( 0.3, Math
          .random() ) );
      newNode.setColor( color );
    }
    else
    {
      Vector3D color = new Vector3D( tempNode.getColor() );
      newNode.setColor( color );
    }

    nodeDistance.put( tempNode.getId(), Integer.valueOf( 0 ) );
    nodeToParent.put( tempNode.getId(), newNode );
View Full Code Here

    {
      tempLine = line.substring( line.indexOf( checkString ) + checkString.length() );
      tempLine = tempLine.substring( 0, tempLine.indexOf( "\"" ) );
      if( !tempLine.equals( "null" ) )
      {
        labelColor = new Vector3D( tempLine );
        if( labelColor.getX() > 1 )
          labelColor.setX( 1 );
        if( labelColor.getY() > 1 )
          labelColor.setY( 1 );
        if( labelColor.getZ() > 1 )
          labelColor.setZ( 1 );
        if( labelColor.getX() < 0 )
          labelColor.setX( 0 );
        if( labelColor.getY() < 0 )
          labelColor.setY( 0 );
        if( labelColor.getZ() < 0 )
          labelColor.setZ( 0 );
      }
    }
    checkString = " LabelOutlineColor=\"";
    if( line.contains( checkString ) )
    {
      tempLine = line.substring( line.indexOf( checkString ) + checkString.length() );
      tempLine = tempLine.substring( 0, tempLine.indexOf( "\"" ) );
      if( !tempLine.equals( "null" ) )
      {
        labelOutlineColor = new Vector3D( tempLine );
        if( labelOutlineColor.getX() > 1 )
          labelOutlineColor.setX( 1 );
        if( labelOutlineColor.getY() > 1 )
          labelOutlineColor.setY( 1 );
        if( labelOutlineColor.getZ() > 1 )
          labelOutlineColor.setZ( 1 );
        if( labelOutlineColor.getX() < 0 )
          labelOutlineColor.setX( 0 );
        if( labelOutlineColor.getY() < 0 )
          labelOutlineColor.setY( 0 );
        if( labelOutlineColor.getZ() < 0 )
          labelOutlineColor.setZ( 0 );
      }
    }
    checkString = " OutlineColor=\"";
    if( line.contains( checkString ) )
    {
      tempLine = line.substring( line.indexOf( checkString ) + checkString.length() );
      tempLine = tempLine.substring( 0, tempLine.indexOf( "\"" ) );
      if( !tempLine.equals( "null" ) )
      {
        outlineColor = new Vector3D( tempLine );
        if( outlineColor.getX() > 1 )
          outlineColor.setX( 1 );
        if( outlineColor.getY() > 1 )
          outlineColor.setY( 1 );
        if( outlineColor.getZ() > 1 )
View Full Code Here

    node = nodes.get( 0 );
    int maxNumDocuments = Integer.parseInt( node.getProperty( "numDocuments" ) );
    System.out.println( "Max number of docs " + maxNumDocuments );
    for( DNVNode tempNode : nodes )
    {
      Vector3D color = new Vector3D( LIGHT_GREEN );
      if( tempNode.hasProperty( "numDocuments" ) )
      {
        Vector3D difference = new Vector3D( LIGHT_RED );
        difference.subtract( color );
        difference.dotProduct( (float)(Integer.parseInt( tempNode.getProperty( "numDocuments" ) ) )/(float)maxNumDocuments );
        color.add( difference );
        color.setX( (float)Math.max( 0, color.getX() ) );
        color.setY( (float)Math.max( 0, color.getY() ) );
        color.setZ( (float)Math.max( 0, color.getZ() ) );
        color.setX( (float)Math.min( 1, color.getX() ) );
View Full Code Here

    newNode.setLevel( newLevel.intValue() );
    newNode.setFirstChild( tempNode );
    graph.addNode( newLevel, newNode );
    if( multicolor && newLevel == 1 )
    {
      Vector3D color = new Vector3D( (float)Math.max( 0.3, Math.random() ), (float)Math.max( 0.3, Math.random() ), (float)Math.max( 0.3, Math
          .random() ) );
      newNode.setColor( color );
    }
    else
    {
      Vector3D color = new Vector3D( tempNode.getColor() );
      newNode.setColor( color );
    }

    nodeDistance.put( tempNode.getId(), Integer.valueOf( 0 ) );
    nodeToParent.put( tempNode.getId(), newNode );
View Full Code Here

    Map<Integer, DNVNode> nodeToParent = new HashMap<Integer, DNVNode>();
    Map<Integer, List<DNVNode>> parentToNode = new HashMap<Integer, List<DNVNode>>();
    DNVNode newNode;
    Vector2D position;
    Vector3D color;
    for( String neighborListId : nodesByNeighborlist.keySet() )
    {
      tempList = nodesByNeighborlist.get( neighborListId );
      position = new Vector2D( 0, 0 );
      color = new Vector3D( 0, 0, 0 );
      if( tempList != null && tempList.size() > 0 )
      {
        newNode = new DNVNode( graph );
        newNode.setFirstChild( tempList.get( 0 ) );
        newNode.setSubNodes( tempList );
        graph.addNode( currentLevel + 1, newNode );
        parentToNode.put( newNode.getId(), tempList );
        for( DNVNode childNode : tempList )
        {
          nodeToParent.put( childNode.getId(), newNode );
          position.add( childNode.getPosition() );
          color.add( childNode.getColor() );
          childNode.setParentNode( newNode );
        }
        position.dotProduct( 1.0f / (float)tempList.size() );
        color.dotProduct( 1.0f / (float)tempList.size() );
        if( tempList.size() == 1 )
        {
          newNode.setLabel( tempList.get( 0 ).getLabel() );
          newNode.setIcon( tempList.get( 0 ).getIcon() );
          newNode.setLabelColor( tempList.get( 0 ).getLabelColor() );
View Full Code Here

        {
          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

      List<DNVNode> nodes = getNodes(0);
      if(propertyValues == null){
        return;
      }
      String[] valuesArr = propertyValues.split("\t");
      Vector3D color = new Vector3D( (float)Math.max( 0.3, Math.random() ), (float)Math.max( 0.3, Math.random() ), (float)Math.max( 0.3, Math.random() ) );
      HashMap<String, DNVNode> propertyToNode = new HashMap<String, DNVNode>();
      for(int i = 0; i < valuesArr.length; i++){
        DNVNode newNode = new DNVNode(this);
        newNode.setColor( color );
        propertyToNode.put(valuesArr[i], newNode);
View Full Code Here

    ArrayList<Vector3D> chunkColors = new ArrayList<Vector3D>();
    ArrayList<Double> chunkSizes = new ArrayList<Double>();
    ArrayList<String> currentChunk = null;
    ArrayList<Integer> offsets = new ArrayList<Integer>();
    int currentOffset = 0;
    Vector3D currentColor;
    double currentSize;
    final int OFFSET_DIFFERENCE = 100000;
    String line = "";
    try
    {
View Full Code Here

    {
      String workString = line.substring( line.indexOf( "@COLOR" ) );
      workString = workString.substring( workString.indexOf( "[" ) );
      workString = workString.substring( 0, workString.indexOf( "]" ) + 1 );
      workString = workString.trim();
      return new Vector3D( workString );
    }

    return DEFAULT_COLOR;
  }
View Full Code Here

TOP

Related Classes of net.wigis.graph.dnv.utilities.Vector3D

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.