Package net.wigis.graph.dnv.utilities

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


          {
            Map<Integer, DNVNode> nodes = node.getNodesAtDistance( distance );
            if( nodes != null && nodes.size() > 0 )
            {
              anyNodes = true;
              Vector3D color = new Vector3D( LIGHT_GREEN );
              Vector3D difference = new Vector3D( LIGHT_RED );
              difference.subtract( color );
              difference.dotProduct( (float)( distance - 1 ) / (float)maxDistance );
              color.add( difference );
              Vector3D outlineColor = new Vector3D( color );
              outlineColor.setX( (float)Math.max( 0, outlineColor.getX() - 0.3 ) );
              outlineColor.setY( (float)Math.max( 0, outlineColor.getY() - 0.3 ) );
              outlineColor.setZ( (float)Math.max( 0, outlineColor.getZ() - 0.3 ) );
              int drawn = drawBoxAround( distance, subgraph.getNodes(), nodes, g2d, width, height, minXPercent, minYPercent,
                  maxXPercent, maxYPercent, minX, maxX, minY, maxY, nodeWidth, color, outlineColor, pb, overview, node, drawnHeadings,
                  drawNumberOfNodesInBox, drawNeighborHighlightAsBoxes, drawAllNeighborsHighlight, alignBoxInfoRelativeToBox,
                  headerAlignment );
View Full Code Here


    Vector2D bottomRightScreen = ImageRenderer.transformPosition( pb, bottomRight );
    Vector2D topLeftScreen = ImageRenderer.transformPosition( pb, topLeft );

    g2d.setColor( Color.black );
    g2d.setStroke( new BasicStroke( 1 ) );
    Vector3D color = new Vector3D( 0, 0, 0 );
    Vector3D outlineColor = new Vector3D( 1, 1, 1 );

    // X-axis
    g2d.drawLine( (int)bottomLeftScreen.getX(), (int)bottomLeftScreen.getY(), (int)bottomRightScreen.getX() + 20, (int)bottomRightScreen.getY() );
    Vector2D tempPos = new Vector2D( bottomLeft );
    Vector2D tempPosScreen = new Vector2D( bottomLeftScreen );
View Full Code Here

      }
      else
      {
        for( DNVNode node : nodes.values() )
        {
          Vector3D color;
          if( !node.hasProperty( "originalColor" ) )
          {
            node.setProperty( "originalColor", node.getColor().toString() );
            color = fillColor;
          }
          else
          {
            color = new Vector3D( node.getColor() );
            color.add( fillColor );
            color.dotProduct( 0.5f );
          }
          node.setColor( color );
        }
      }

      Vector2D position = new Vector2D();
      Vector2D selectedNodeScreenPos = transformPosition( minX, maxX, minY, maxY, minXPercent, maxXPercent, minYPercent, maxYPercent, width,
          height, selectedNode.getPosition() );
      float xDiff = Math.abs( selectedNodeScreenPos.getX() - ( minPosScreen.getX() + ( maxPosScreen.getX() - minPosScreen.getX() ) / 2.0f ) );
      float yDiff = Math.abs( selectedNodeScreenPos.getY() - ( minPosScreen.getY() + ( maxPosScreen.getY() - minPosScreen.getY() ) / 2.0f ) );

      String key;
      if( alignBoxInfoRelativeToBox )
      {
        if( headerAlignment.containsKey( "X-align" + selectedNode.getId() )
            || ( !headerAlignment.containsKey( "Y-align" + selectedNode.getId() ) && xDiff >= yDiff ) )
        {
          headerAlignment.put( "X-align" + selectedNode.getId(), true );
          position = new Vector2D( minPosScreen.getX() + ( maxPosScreen.getX() - minPosScreen.getX() ) / 2.0f, 14 );
          key = "X" + hops;
          if( !drawnHeadings.containsKey( key ) )
          {
            Text t = new Text( "Dist " + hops, position, new Vector3D( 1, 1, 1 ), fillColor, 12, true, true, true, false, false, false,
                true );
            t.draw( g2d, pb, minXPercent, maxXPercent, minYPercent, maxYPercent, minX, maxX, minY, maxY, nodeWidth, height, overview );
            drawnHeadings.put( key, 1 );
          }
          else
          {
            drawnHeadings.put( key, drawnHeadings.get( key ) + 1 );
          }
        }
        else
        {
          headerAlignment.put( "Y-align" + selectedNode.getId(), true );
          position = new Vector2D( 35, minPosScreen.getY() + ( maxPosScreen.getY() - minPosScreen.getY() ) / 2.0f );
          key = "Y" + hops;
          if( !drawnHeadings.containsKey( key ) )
          {
            Text t = new Text( "Dist " + hops, position, new Vector3D( 1, 1, 1 ), fillColor, 12, true, true, true, false, false, false,
                true );
            t.draw( g2d, pb, minXPercent, maxXPercent, minYPercent, maxYPercent, minX, maxX, minY, maxY, nodeWidth, height, overview );
            drawnHeadings.put( key, 1 );
          }
          else
          {
            drawnHeadings.put( key, drawnHeadings.get( key ) + 1 );
          }
        }
      }
      else
      {
        position = new Vector2D( 70 * hops, 14 );
        key = "Align" + hops;
        if( !drawnHeadings.containsKey( key ) )
        {
          Text t = new Text( "Dist " + hops, position, new Vector3D( 1, 1, 1 ), fillColor, 12, true, true, true, false, false, false, true );
          t.draw( g2d, pb, minXPercent, maxXPercent, minYPercent, maxYPercent, minX, maxX, minY, maxY, nodeWidth, height, overview );
          drawnHeadings.put( key, 1 );
        }
        else
        {
          drawnHeadings.put( key, drawnHeadings.get( key ) + 1 );
        }
      }

      position.setY( position.getY() + ( drawnHeadings.get( key ) * 20 ) );
      if( drawNumberOfNodesInBox )
      {
        Text t = new Text( nodes.size() + " nodes", position, new Vector3D( 1, 1, 1 ), fillColor, 12, true, true, true, false, false, false,
            true );
        t.draw( g2d, pb, minXPercent, maxXPercent, minYPercent, maxYPercent, minX, maxX, minY, maxY, nodeWidth, height, overview );
      }

      return 1;
View Full Code Here

      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 )
View Full Code Here

   * @param alpha
   *            the alpha
   */
  private static void drawCurvedBoundingRectangle( Graphics2D g2d, DNVNode node, Rectangle boundingRectangle, float alpha, boolean highlighted )
  {
    Vector3D color = node.getColor();
    // if( color == null )
    // {
    // color = node.getColor();
    // }
    int left = (int)Math.round( boundingRectangle.left() );
    int right = (int)Math.round( boundingRectangle.right() );
    int top = (int)Math.round( boundingRectangle.top() );
    // int bottom = (int)Math.round( boundingRectangle.bottom );
    int width = right - left;
    int height = (int)Math.round( boundingRectangle.bottom() - boundingRectangle.top() );

    float r = Math.min( 1, color.getX() + 0.2f );
    float g = Math.min( 1, color.getY() + 0.2f );
    float b = Math.min( 1, color.getZ() + 0.2f );
    if( ( node.isSelected() || highlighted || node.isHighlighted() ) && alpha == 1 )
    {
      int shadowOffset = 7;

      // Draw a drop shadow of selected node labels
      g2d.setColor( new Color( 0, 0, 0, 0.4f ) );
      g2d.fillRoundRect( left + shadowOffset - ( height / 2 ), top + shadowOffset, width + height, height, height, height );
    }

    g2d.setColor( new Color( r, g, b, alpha ) );
    g2d.fillRoundRect( left - ( height / 2 ), top, width + height, height, height, height );
    int strokeWidth = 2;
    if( node.isSelected() || ( node.isHighlighted() && node.getHighlightColor() == null ) )
    {
      // Draw red outline of selected nodes
      color = new Vector3D( SELECTED_HIGHLIGHT_COLOR );
      strokeWidth = 3;
    }
    else if( node.isHighlighted() && node.getHighlightColor() != null )
    {
      color = new Vector3D( node.getHighlightColor() );
      strokeWidth = 3;
    }
    r = Math.max( 0, color.getX() - 0.2f );
    g = Math.max( 0, color.getY() - 0.2f );
    b = Math.max( 0, color.getZ() - 0.2f );
    g2d.setColor( new Color( r, g, b, alpha ) );
    g2d.setStroke( new BasicStroke( strokeWidth ) );
    g2d.drawRoundRect( left - ( height / 2 ), top, width + height, height, height, height );
  }
View Full Code Here

    // (Vector2D)tempEdge.getTo().getAttribute( "screenPositionOffset" );
    // tempPos2.setX( tempPos2.getX() + screenPositionOffset.getX() );
    // tempPos2.setY( tempPos2.getY() + screenPositionOffset.getY() );
    // }

    Vector3D edgeColor = tempEdge.getColor();
    if( tempEdge.isSelected() || ( tempEdge.isHighlighted() && tempEdge.getHighlightColor() == null ) || edgeColor == null
        || edgeColor.equals( DNVEntity.NO_COLOR ) )
    {
      g2d.setColor( color );
    }
    else if( tempEdge.isHighlighted() && tempEdge.getHighlightColor() != null )
    {
      g2d.setColor( new Color( tempEdge.getHighlightColor().getX(), tempEdge.getHighlightColor().getY(), tempEdge.getHighlightColor().getZ() ) );
    }
    else
    {
      g2d.setColor( new Color( edgeColor.getX(), edgeColor.getY(), edgeColor.getZ(), tempEdge.getAlpha() ) );
    }

    int pivotX = getPivot( width, (int)tempPos.getX(), (int)tempPos2.getX() );
    int pivotY = getPivot( height, (int)tempPos.getY(), (int)tempPos2.getY() );
    int temp = getPivot( width, pivotX, pivotY );
View Full Code Here

 
     
     
      if( allTimes.size() > 0 )
      {
        timeText = new Text( getMinTimeValue() + " - " + getMaxTimeValue(), new Vector2D( width / 2, 12 ), new Vector3D(1,1,1), new Vector3D(0,0,0), 18, true, true, false, false, false, false, true );
      }
      else
      {
        timeText = null;
      }
View Full Code Here

 
     
     
      if( allDKTimes.size() > 0 )
      {
        timeText = new Text( getMinDKTimeValue() + " - " + getMaxDKTimeValue(), new Vector2D( width / 2, 12 ), new Vector3D(1,1,1), new Vector3D(0,0,0), 18, true, true, false, false, false, false, true );
      }
      else
      {
        timeText = null;
      }
View Full Code Here

 
     
     
      if( allTimes.size() > 0 )
      {
        timeText = new Text( getMinTimeValue() + " - " + getMaxTimeValue(), new Vector2D( width / 2, 12 ), new Vector3D(1,1,1), new Vector3D(0,0,0), 18, true, true, false, false, false, false, true );
      }
      else
      {
        timeText = null;
      }
View Full Code Here

 
     
     
      if( allDKTimes.size() > 0 )
      {
        timeText = new Text( getMinDKTimeValue() + " - " + getMaxDKTimeValue(), new Vector2D( width / 2, 12 ), new Vector3D(1,1,1), new Vector3D(0,0,0), 18, true, true, false, false, false, false, true );
      }
      else
      {
        timeText = null;
      }
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.