📄 summarystate.java
字号:
} prev_time = starttime; interval = ( finaltime - starttime ) / vis_typeboxes_length; for ( idx = typeboxes.length-1; idx >= 0; idx-- ) { typebox = typeboxes[ idx ]; if ( typebox.isCategoryVisiblySearchable() ) { typebox.setEarliestTime( prev_time ); typebox.setLatestFromEarliest( interval ); prev_time = typebox.getLatestTime(); curr_timebox.affectTimeBounds( typebox ); } } } else { isInclusive = ! isDisplayTypeExclusiveRatio(); if ( isDisplayTypeCumulative() ) { // CumulativeXXclusionRatio prev_time = starttime; duration = finaltime - starttime; for ( idx = typeboxes.length-1; idx >= 0; idx-- ) { typebox = typeboxes[ idx ]; if ( typebox.isCategoryVisiblySearchable() ) { interval = duration * typebox.getCategoryRatio( isInclusive ); typebox.setEarliestTime( prev_time ); typebox.setLatestFromEarliest( interval ); prev_time = typebox.getLatestTime(); curr_timebox.affectTimeBounds( typebox ); } } } else { // OverlapInclusionRatio, OverlapExclusiveRatio duration = finaltime - starttime; for ( idx = typeboxes.length-1; idx >= 0; idx-- ) { typebox = typeboxes[ idx ]; if ( typebox.isCategoryVisiblySearchable() ) { interval = duration * typebox.getCategoryRatio( isInclusive ); typebox.setEarliestTime( starttime ); typebox.setLatestFromEarliest( interval ); curr_timebox.affectTimeBounds( typebox ); } } } } } public static int draw( Graphics2D g, TimeAveBox avebox, CoordPixelXform coord_xform, float start_ypos, float final_ypos, float avebox_height ) { CategoryTimeBox[] typeboxes; CategoryTimeBox typebox; TimeBoundingBox curr_timebox; Color color; double head_time, tail_time; float head_ypos, tail_ypos, gap_ypos; int count, idx; if ( start_ypos < final_ypos ) { head_ypos = start_ypos; tail_ypos = final_ypos; } else { head_ypos = final_ypos; tail_ypos = start_ypos; } // Draw CategoryTimeBox[] in descending ratio order count = 0; curr_timebox = avebox.getCurrentTimeBoundingBox(); typeboxes = avebox.arrayOfCategoryTimeBoxes(); if ( isDisplayTypeEqualWeighted() || isDisplayTypeCumulative() ) { if ( head_ypos + avebox_height < tail_ypos - avebox_height ) { head_time = curr_timebox.getEarliestTime(); tail_time = curr_timebox.getLatestTime(); count += drawForward( g, null, coord_xform, head_time, head_ypos, tail_time, tail_ypos ); head_ypos += avebox_height; tail_ypos -= avebox_height; } for ( idx = typeboxes.length-1; idx >= 0; idx-- ) { typebox = typeboxes[ idx ]; color = typebox.getCategoryColor(); head_time = typebox.getEarliestTime(); tail_time = typebox.getLatestTime(); count += drawForward( g, color, coord_xform, head_time, head_ypos, tail_time, tail_ypos ); } } else { // OverlapXXclusionRatio if ( head_ypos + avebox_height < tail_ypos - avebox_height ) { head_time = curr_timebox.getEarliestTime(); tail_time = curr_timebox.getLatestTime(); count += drawForward( g, null, coord_xform, head_time, head_ypos, tail_time, tail_ypos ); head_ypos += avebox_height; tail_ypos -= avebox_height; } gap_ypos = ( tail_ypos - head_ypos ) / ( typeboxes.length * 2 ); for ( idx = typeboxes.length-1; idx >= 0; idx-- ) { typebox = typeboxes[ idx ]; color = typebox.getCategoryColor(); head_time = typebox.getEarliestTime(); tail_time = typebox.getLatestTime(); count += drawForward( g, color, coord_xform, head_time, head_ypos, tail_time, tail_ypos ); head_ypos += gap_ypos; tail_ypos -= gap_ypos; } } return count; } public static Object containsPixel( TimeAveBox avebox, CoordPixelXform coord_xform, Point pt, float start_ypos, float final_ypos, float avebox_height ) { CategoryTimeBox[] typeboxes; CategoryTimeBox typebox; TimeBoundingBox curr_timebox; double head_time, tail_time; float head_ypos, tail_ypos, gap_ypos; boolean hasBoundary; int idx; if ( start_ypos < final_ypos ) { head_ypos = start_ypos; tail_ypos = final_ypos; } else { head_ypos = final_ypos; tail_ypos = start_ypos; } if ( pt.y < coord_xform.convertRowToPixel( head_ypos ) ) return null; if ( pt.y > coord_xform.convertRowToPixel( tail_ypos ) ) return null; // Search CategoryTimeBox[] in ascending ratio order curr_timebox = avebox.getCurrentTimeBoundingBox(); typeboxes = avebox.arrayOfCategoryTimeBoxes(); if ( isDisplayTypeEqualWeighted() || isDisplayTypeCumulative() ) { if ( head_ypos + avebox_height < tail_ypos - avebox_height ) { head_ypos += avebox_height; tail_ypos -= avebox_height; hasBoundary = true; } else hasBoundary = false; for ( idx = 0; idx < typeboxes.length; idx++ ) { typebox = typeboxes[ idx ]; head_time = typebox.getEarliestTime(); tail_time = typebox.getLatestTime(); if ( isPixelIn( coord_xform, pt, head_time, head_ypos, tail_time, tail_ypos ) ) return typebox; } if ( hasBoundary ) { head_ypos -= avebox_height; tail_ypos += avebox_height; head_time = curr_timebox.getEarliestTime(); tail_time = curr_timebox.getLatestTime(); if ( isPixelIn( coord_xform, pt, head_time, head_ypos, tail_time, tail_ypos ) ) return avebox; } } else { // OverlapXXclusionRatio if ( head_ypos + avebox_height < tail_ypos - avebox_height ) { head_ypos += avebox_height; tail_ypos -= avebox_height; hasBoundary = true; } else hasBoundary = false; gap_ypos = ( tail_ypos - head_ypos ) / ( typeboxes.length * 2 ); head_ypos += gap_ypos * (typeboxes.length-1); tail_ypos -= gap_ypos * (typeboxes.length-1); for ( idx = 0; idx < typeboxes.length; idx++ ) { typebox = typeboxes[ idx ]; head_time = typebox.getEarliestTime(); tail_time = typebox.getLatestTime(); if ( isPixelIn( coord_xform, pt, head_time, head_ypos, tail_time, tail_ypos ) ) return typebox; head_ypos -= gap_ypos; tail_ypos += gap_ypos; } if ( hasBoundary ) { head_ypos += gap_ypos; tail_ypos -= gap_ypos; head_ypos -= avebox_height; tail_ypos += avebox_height; head_time = curr_timebox.getEarliestTime(); tail_time = curr_timebox.getLatestTime(); if ( isPixelIn( coord_xform, pt, head_time, head_ypos, tail_time, tail_ypos ) ) return avebox; } } return null; }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -