Package org.cytoscape.view.model

Examples of org.cytoscape.view.model.View


            // Calculate all node distances.  Keep track of the furthest.
           
            for (Iterator iterator = graphView.getNodeViews().iterator(); iterator.hasNext();)
      {
              View node_view = (View)iterator.next();
        PartialDerivatives partials = new PartialDerivatives(node_view);
        calculatePartials(partials, null, potential_energy, false);
        partials_list.add(partials);
        if (furthest_node_partials == null || partials.euclideanDistance > furthest_node_partials.euclideanDistance)
          furthest_node_partials = partials;
View Full Code Here


                                                   boolean reversed) {

        partials.reset();

       /* NodeView node_view = partials.getNodeView();*/
        View node_view = partials.getNodeView();
       
        int node_view_index = ((Integer)nodeIndexToMatrixIndexMap.get(((CyNode)node_view.getModel()).getSUID())).intValue();
    double node_view_radius = ((Double)node_view.getVisualProperty(BasicVisualLexicon.NODE_WIDTH)).doubleValue();
    double node_view_x = ((Double)node_view.getVisualProperty(BasicVisualLexicon.NODE_X_LOCATION)).doubleValue();
    double node_view_y = ((Double)node_view.getVisualProperty(BasicVisualLexicon.NODE_Y_LOCATION)).doubleValue();
   
       
/*        int node_view_index = ((Integer) nodeIndexToMatrixIndexMap.get(
                new Integer(node_view.getRootGraphIndex()))).intValue();
        double node_view_radius = node_view.getWidth();
        double node_view_x = node_view.getXPosition();
        double node_view_y = node_view.getYPosition();*/

        PartialDerivatives other_node_partials = null;
        View other_node_view;
        int other_node_view_index;
        double other_node_view_radius;

        PartialDerivatives furthest_partials = null;

        Iterator iterator;
        if (partials_list == null) {
          iterator = graphView.getNodeViews().iterator();
            //iterator = graphView.getNodeViewsIterator();
           
        } else {
            iterator = partials_list.iterator();
        }
        double delta_x;
        double delta_y;
        double euclidean_distance;
        double euclidean_distance_cubed;
        double distance_from_rest;
        double distance_from_touching;
        double incremental_change;
        while (iterator.hasNext()) {
            if (partials_list == null) {
                other_node_view = (View) iterator.next();
            } else {
                other_node_partials = (PartialDerivatives) iterator.next();
                other_node_view = other_node_partials.getNodeView();
            }
            if (((CyNode)node_view.getModel()).getSUID() == ((CyNode)other_node_view.getModel()).getSUID()){
           // if (node_view.getRootGraphIndex() == other_node_view.getRootGraphIndex()) {                //System.out.println( "Nodes are the same. " );
                continue;
            }

           
            other_node_view_index = ((Integer)nodeIndexToMatrixIndexMap.get(((CyNode)other_node_view.getModel()).getSUID())).intValue();
      other_node_view_radius = Math.max(((Double)other_node_view.getVisualProperty(BasicVisualLexicon.NODE_WIDTH)).doubleValue(), ((Double)other_node_view.getVisualProperty(BasicVisualLexicon.NODE_HEIGHT)).doubleValue());
      delta_x = node_view_x - ((Double)other_node_view.getVisualProperty(BasicVisualLexicon.NODE_X_LOCATION)).doubleValue();
      delta_y = node_view_y - ((Double)other_node_view.getVisualProperty(BasicVisualLexicon.NODE_Y_LOCATION)).doubleValue();
   
     
      /*
            other_node_view_index = ((Integer) nodeIndexToMatrixIndexMap.get(
                    new Integer(other_node_view.getRootGraphIndex()))).intValue();
View Full Code Here

     * @return the PartialDerivatives of the farthest node after the move.
     */
    protected PartialDerivatives moveNode(PartialDerivatives partials,
                                          List partials_list,
                                          PotentialEnergy potential_energy) {
        View node_view = partials.getNodeView();

        PartialDerivatives starting_partials = new PartialDerivatives(partials);
        calculatePartials(partials,
                partials_list,
                potential_energy,
View Full Code Here

        //);

        Point2D p = node_view.getOffset();
        node_view.setOffset(p.getX() + delta_x, p.getY() + delta_y);
        */
        View node_view = partials.getNodeView();
    double denomenator = partials.xx * partials.yy - partials.xy * partials.xy;
    double delta_x = (-partials.x * partials.yy - -partials.y * partials.xy) / denomenator;
    double delta_y = (-partials.y * partials.xx - -partials.x * partials.xy) / denomenator;
    double x = ((Double)node_view.getVisualProperty(BasicVisualLexicon.NODE_X_LOCATION)).doubleValue();
    double y = ((Double)node_view.getVisualProperty(BasicVisualLexicon.NODE_Y_LOCATION)).doubleValue();
    node_view.setVisualProperty(BasicVisualLexicon.NODE_X_LOCATION, Double.valueOf(x + delta_x));
    node_view.setVisualProperty(BasicVisualLexicon.NODE_Y_LOCATION, Double.valueOf(y + delta_y));

    } // simpleMoveNode( PartialDerivatives )
View Full Code Here

          boolean layoutNecessary = false;
          CyNetworkView clusterView = cluster.getView();

          for (View nv : newNetworkView.getNodeViews()) {
            CyNode node = (CyNode)nv.getModel();
            View cnv = clusterView != null ? clusterView.getNodeView(node) : null;

            if (cnv != null)
            {
              double x = ((Double)cnv.getVisualProperty(BasicVisualLexicon.NODE_X_LOCATION)).doubleValue();
              double y = ((Double)cnv.getVisualProperty(BasicVisualLexicon.NODE_Y_LOCATION)).doubleValue();
              nv.setVisualProperty(BasicVisualLexicon.NODE_X_LOCATION, Double.valueOf(x));
              nv.setVisualProperty(BasicVisualLexicon.NODE_Y_LOCATION, Double.valueOf(y));
            }
            else
            {
View Full Code Here

                // Calculate all node distances.  Keep track of the furthest.
               
                for (Iterator iterator = graphView.getNodeViews().iterator(); iterator.hasNext();)
          {
            View node_view = (View)iterator.next();
            PartialDerivatives partials = new PartialDerivatives(node_view);
            calculatePartials(partials, null, potential_energy, false);
            partials_list.add(partials);
            if (furthest_node_partials == null || partials.euclideanDistance > furthest_node_partials.euclideanDistance)
              furthest_node_partials = partials;
View Full Code Here

      setupForLayoutPass();
      potential_energy.reset();
      partials_list.clear();
      for (Iterator iterator = graphView.getNodeViews().iterator(); iterator.hasNext();)
      {
        View node_view = (View)iterator.next();
        PartialDerivatives partials = new PartialDerivatives(node_view);
        calculatePartials(partials, null, potential_energy, false);
        partials_list.add(partials);
        if (furthest_node_partials == null || partials.euclideanDistance > furthest_node_partials.euclideanDistance)
          furthest_node_partials = partials;
View Full Code Here

                                                   PotentialEnergy potential_energy,
                                                   boolean reversed) {

        partials.reset();

        View node_view = partials.getNodeView();
       
       
        int node_view_index = ((Integer)nodeIndexToMatrixIndexMap.get(((CyNode)node_view.getModel()).getSUID())).intValue();
    double node_view_radius = ((Double)node_view.getVisualProperty(BasicVisualLexicon.NODE_WIDTH)).doubleValue();
    double node_view_x = ((Double)node_view.getVisualProperty(BasicVisualLexicon.NODE_X_LOCATION)).doubleValue();
    double node_view_y = ((Double)node_view.getVisualProperty(BasicVisualLexicon.NODE_Y_LOCATION)).doubleValue();
   
        /*int node_view_index = ((Integer) nodeIndexToMatrixIndexMap.get(
                new Integer(node_view.getRootGraphIndex()))).intValue();
        double node_view_radius = node_view.getWidth();
        double node_view_x = node_view.getXPosition();
        double node_view_y = node_view.getYPosition();
*/
        //System.out.println( "index: "+node_view_index+" x: "+node_view_x+" y:" +node_view_y );

        PartialDerivatives other_node_partials = null;
        View other_node_view;
        int other_node_view_index;
        double other_node_view_radius;

        PartialDerivatives furthest_partials = null;

        Iterator iterator;
        if (partials_list == null) {
          iterator = graphView.getNodeViews().iterator();
            //iterator = graphView.getNodeViewsIterator();
        } else {
            iterator = partials_list.iterator();
        }
        double delta_x;
        double delta_y;
        double euclidean_distance;
        double euclidean_distance_cubed;
        double distance_from_rest;
        double distance_from_touching;
        double incremental_change;
        while (iterator.hasNext()) {
            if (partials_list == null) {
                other_node_view = (View) iterator.next();
            } else {
                other_node_partials = (PartialDerivatives) iterator.next();
                other_node_view = other_node_partials.getNodeView();
            }

            if (((CyNode)node_view.getModel()).getSUID() == ((CyNode)other_node_view.getModel()).getSUID()){
            //if (node_view.getRootGraphIndex() == other_node_view.getRootGraphIndex()) {
                //System.out.println( "Nodes are the same. " );
                continue;
            }

       
          other_node_view_index = ((Integer)nodeIndexToMatrixIndexMap.get(((CyNode)other_node_view.getModel()).getSUID())).intValue();
      other_node_view_radius = Math.max(((Double)other_node_view.getVisualProperty(BasicVisualLexicon.NODE_WIDTH)).doubleValue(), ((Double)other_node_view.getVisualProperty(BasicVisualLexicon.NODE_HEIGHT)).doubleValue());
      delta_x = node_view_x - ((Double)other_node_view.getVisualProperty(BasicVisualLexicon.NODE_X_LOCATION)).doubleValue();
      delta_y = node_view_y - ((Double)other_node_view.getVisualProperty(BasicVisualLexicon.NODE_Y_LOCATION)).doubleValue();
   
           /* other_node_view_index = ((Integer) nodeIndexToMatrixIndexMap.get( new Integer(other_node_view.getRootGraphIndex()))).intValue();
            other_node_view_radius = other_node_view.getWidth();

            delta_x = (node_view_x - other_node_view.getXPosition());
View Full Code Here

     * @return the PartialDerivatives of the furthest node after the move.
     */
    protected PartialDerivatives moveNode(PartialDerivatives partials,
                                          List partials_list,
                                          PotentialEnergy potential_energy) {
        View node_view = partials.getNodeView();

        PartialDerivatives starting_partials = new PartialDerivatives(partials);
        calculatePartials(partials,
                partials_list,
                potential_energy,
View Full Code Here

        //);

        Point2D p = node_view.getOffset();
        node_view.setOffset(p.getX() + delta_x, p.getY() + delta_y);*/
     
      View node_view = partials.getNodeView();
    double denomenator = partials.xx * partials.yy - partials.xy * partials.xy;
    double delta_x = (-partials.x * partials.yy - -partials.y * partials.xy) / denomenator;
    double delta_y = (-partials.y * partials.xx - -partials.x * partials.xy) / denomenator;
    double x = ((Double)node_view.getVisualProperty(BasicVisualLexicon.NODE_X_LOCATION)).doubleValue();
    double y = ((Double)node_view.getVisualProperty(BasicVisualLexicon.NODE_Y_LOCATION)).doubleValue();
    node_view.setVisualProperty(BasicVisualLexicon.NODE_X_LOCATION, Double.valueOf(x + delta_x));
    node_view.setVisualProperty(BasicVisualLexicon.NODE_Y_LOCATION, Double.valueOf(y + delta_y));

    } // simpleMoveNode( PartialDerivatives )
View Full Code Here

TOP

Related Classes of org.cytoscape.view.model.View

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.