⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 previewstate.java

📁 fortran并行计算包
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
                        if ( jLevel-jDelta >= jHead ) {                            jLevel  -= jDelta;                            twgt.setPixelHeight( jDelta );                        }                        else {                            twgt.setPixelHeight( jLevel - jHead );                            jLevel = jHead;                        }                    }                    else                        twgt.setPixelHeight( 0 );                }                else                    twgt.setPixelHeight( 0 );            }        }        // Fill the color of the sub-rectangles from the bottom, ie. jHead+jTail        int num_sub_rects_drawn = 0;        if (    DisplayType == OVERLAP_INCLUSION_ID             || DisplayType == OVERLAP_EXCLUSION_ID ) {            // iBoxXXXX : variables that twgt isn't cut by image border            int iBoxHead, iBoxTail, iBoxWidth;            jCenter = jHead  + jHeight / 2; // i.e. jCenter % jHead & jTail            iCenter = iStart + iRange / 2;  // i.e. iCenter % iStart & iFinal            for ( idx = twgts_length-1; idx >= 0; idx-- ) {                twgt       = twgts[ idx ];                jDelta     = twgt.getPixelHeight();                iBoxWidth  = twgt.getPixelWidth();                if ( jDelta > 0 && iBoxWidth > 0 ) {                    iBoxHead = iCenter - iBoxWidth / 2;                    iBoxTail = iBoxHead + iBoxWidth;                    iLevel   = ( iBoxHead >= 0 ? iBoxHead : 0 );                    iDelta   = ( iBoxTail < iImageWidth ?                                 iBoxTail : iImageWidth ) - iLevel;                    g.setColor( twgt.getCategory().getColor() );                    g.fillRect( iLevel, jCenter-jDelta/2, iDelta, jDelta );                    num_sub_rects_drawn++;                }            }        }        else {            /*            if (    DisplayType == FIT_MOST_LEGENDS_ID )                 || DisplayType == CUMULATIVE_INCLUSION_ID                 || DisplayType == CUMULATIVE_EXCLUSION_ID                 || DisplayType == CUMULATIVE_EXCLUSION_BASE_ID )            */            jLevel = jHead + jHeight;  // jLevel = jTail + 1            if ( DisplayType == CUMULATIVE_EXCLUSION_ID )                jLevel -= ( jHeight - jDeltaTotal ) / 2;            for ( idx = twgts_length-1; idx >= 0; idx-- ) {                twgt     = twgts[ idx ];                jDelta   = twgt.getPixelHeight();                if ( jDelta > 0 ) {                    jLevel  -= jDelta;                    g.setColor( twgt.getCategory().getColor() );                    g.fillRect( iHead, jLevel, iWidth, jDelta );                    num_sub_rects_drawn++;                }            }        }        if ( num_sub_rects_drawn > 0 )            BorderStyle.paintStateBorder( g, color,                                          iHead, jHead, isStartVtxInImg,                                          iTail, jTail, isFinalVtxInImg );        return 1;    }    /*        Check if a point in pixel coordinate is in a Rectangle        specified between left-upper vertex (start_time, start_ypos)         and right-lower vertex (final_time, final_ypos)        Assume caller guarantees the order of timestamps and ypos, such that        start_time <= final_time  and  start_ypos <= final_ypos    */    private static Category isPixelIn( Shadow shade, Insets insets,                                       CoordPixelXform coord_xform, Point pt,                                       double start_time, float start_ypos,                                       double final_time, float final_ypos )    {        int      iStart, jStart, iFinal, jFinal;        int      pt_x, pt_y;        pt_y     = pt.y;        jStart   = coord_xform.convertRowToPixel( start_ypos );        if ( pt_y < jStart  )            return null;        jFinal   = coord_xform.convertRowToPixel( final_ypos );        if ( pt_y > jFinal )            return null;        pt_x     = pt.x;        iStart   = coord_xform.convertTimeToPixel( start_time );        if ( pt_x < iStart )            return null;        iFinal   = coord_xform.convertTimeToPixel( final_time );        if ( pt_x > iFinal )            return null;        //  If the code gets to here, it means the pixel is within the Shadow.        if ( insets != null ) {            iStart += insets.left;            iFinal -= insets.right;            jStart += insets.top;            jFinal -= insets.bottom;        }        int jHead, jTail, jHeight;        jHead    = jStart;        jTail    = jFinal;        jHeight  = jTail-jHead+1;        CategoryWeight[]  twgts;        CategoryWeight    twgt = null;        int               idx, twgts_length;        twgts        = shade.arrayOfCategoryWeights();        twgts_length = twgts.length;        // Locate the sub-rectangle from the bottom, ie. jHead+jTail        int iLevel, iDelta, iCenter;        int jLevel, jDelta, jCenter;        if (    DisplayType == OVERLAP_INCLUSION_ID             || DisplayType == OVERLAP_EXCLUSION_ID ) {            int iImageWidth, iRange;            // iBoxXXXX : variables that twgt isn't cut by image border            int iBoxHead, iBoxTail, iBoxWidth;            iImageWidth = coord_xform.getImageWidth();            iRange      = iFinal - iStart + 1; // width uncut by image border            jCenter     = jHead  + jHeight / 2;// i.e. jCenter % jHead & jTail            iCenter     = iStart + iRange / 2; // i.e. iCenter % iStart & iFinal            for ( idx = 0; idx < twgts_length; idx++ ) {                twgt      = twgts[ idx ];                jDelta    = twgt.getPixelHeight();                 iBoxWidth = twgt.getPixelWidth();                if ( jDelta > 0 && iBoxWidth > 0 ) {                    jLevel = jCenter - jDelta / 2;                    if ( pt_y >= jLevel && pt_y < jLevel+jDelta ) {                        iBoxHead = iCenter - iBoxWidth / 2;                        iBoxTail = iBoxHead + iBoxWidth;                        iLevel   = ( iBoxHead >= 0 ? iBoxHead : 0 );                        iDelta   = ( iBoxTail < iImageWidth ?                                     iBoxTail : iImageWidth ) - iLevel;                        if ( pt_x >= iLevel && pt_x < iLevel+iDelta )                            return twgt.getCategory();                    }                }            }        }        else {            /*            if (    DisplayType == FIT_MOST_LEGENDS_ID                  || DisplayType == CUMULATIVE_INCLUSION_ID                 || DisplayType == CUMULATIVE_EXCLUSION_ID                 || DisplayType == CUMULATIVE_EXCLUSION_BASE_ID )            */            jLevel = jHead + jHeight;  // jLevel = jTail + 1            if ( DisplayType == CUMULATIVE_EXCLUSION_ID )                jLevel -= ( jHeight - shade.getTotalPixelHeight() ) / 2;            for ( idx = twgts_length-1; idx >= 0; idx-- ) {                twgt     = twgts[ idx ];                jDelta   = twgt.getPixelHeight();                 if ( jDelta > 0 ) {                    jLevel  -= jDelta;                    if ( pt_y >= jLevel && pt_y < jLevel+jDelta )                        return twgt.getCategory();                }            }        }        return null; // mean failure, need something other than null    }    public static int  draw( Graphics2D g, Color color,                             Shadow shade, Insets insets,                             CoordPixelXform    coord_xform,                             DrawnBox           last_drawn_pos,                             double start_time, float start_ypos,                             double final_time, float final_ypos )    {         if ( start_time < final_time ) {             if ( start_ypos < final_ypos )                 return drawForward( g, color, shade, insets,                                     coord_xform, last_drawn_pos,                                     start_time, start_ypos,                                     final_time, final_ypos );             else                 return drawForward( g, color, shade, insets,                                     coord_xform, last_drawn_pos,                                     start_time, final_ypos,                                     final_time, start_ypos );         }         else {             if ( start_ypos < final_ypos )                 return drawForward( g, color, shade, insets,                                     coord_xform, last_drawn_pos,                                     final_time, start_ypos,                                     start_time, final_ypos );             else                 return drawForward( g, color, shade, insets,                                     coord_xform, last_drawn_pos,                                     final_time, final_ypos,                                     start_time, start_ypos );         }    }    public static Category containsPixel( Shadow shade, Insets insets,                                          CoordPixelXform coord_xform, Point pt,                                          double start_time, float start_ypos,                                          double final_time, float final_ypos )    {         if ( start_time < final_time ) {             if ( start_ypos < final_ypos )                 return isPixelIn( shade, insets, coord_xform, pt,                                   start_time, start_ypos,                                   final_time, final_ypos );             else                 return isPixelIn( shade, insets, coord_xform, pt,                                   start_time, final_ypos,                                   final_time, start_ypos );         }         else {             if ( start_ypos < final_ypos )                 return isPixelIn( shade, insets, coord_xform, pt,                                   final_time, start_ypos,                                   start_time, final_ypos );             else                 return isPixelIn( shade, insets, coord_xform, pt,                                   final_time, final_ypos,                                   start_time, start_ypos );         }    }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -