50
50
import java .util .List ;
51
51
import java .util .concurrent .CopyOnWriteArrayList ;
52
52
import org .apache .commons .math3 .util .FastMath ;
53
+ import org .slf4j .Logger ;
54
+ import org .slf4j .LoggerFactory ;
53
55
54
56
import javax .swing .JPanel ;
55
57
56
58
public class OverlayPanel extends JPanel implements Listener <ChannelEvent >, ISourceEventProcessor , SettingChangeListener
57
59
{
58
60
private static final long serialVersionUID = 1L ;
59
-
60
- // private final static Logger mLog = LoggerFactory.getLogger(OverlayPanel.class);
61
+ private final static Logger mLog = LoggerFactory .getLogger (OverlayPanel .class );
61
62
private final DecimalFormat PPM_FORMATTER = new DecimalFormat ( "#.0" );
62
63
63
64
private final static RenderingHints RENDERING_HINTS = new RenderingHints (RenderingHints .KEY_ANTIALIASING ,
@@ -533,39 +534,36 @@ private void drawChannels(Graphics2D graphics)
533
534
{
534
535
for (Channel channel : mVisibleChannels )
535
536
{
536
- if (mChannelDisplay == ChannelDisplay .ALL ||
537
- (mChannelDisplay == ChannelDisplay .ENABLED && channel .isProcessing ()))
537
+ if (mChannelDisplay == ChannelDisplay .ALL || (mChannelDisplay == ChannelDisplay .ENABLED && channel .isProcessing ()))
538
538
{
539
- //Choose the correct background color to use
540
- if (channel .isSelected ())
541
- {
542
- graphics .setColor (mColorChannelConfigSelected );
543
- }
544
- else if (channel .isProcessing ())
545
- {
546
- graphics .setColor (mColorChannelConfigProcessing );
547
- }
548
- else
549
- {
550
- graphics .setColor (mColorChannelConfig );
551
- }
552
-
553
539
List <TunerChannel > tunerChannels = channel .getTunerChannels ();
554
540
555
541
for (TunerChannel tunerChannel : tunerChannels )
556
542
{
557
543
if (tunerChannel .overlaps (getMinDisplayFrequency (), getMaxDisplayFrequency ()))
558
544
{
559
- double xAxis = getAxisFromFrequency (tunerChannel .getFrequency ());
545
+ //Choose the correct background color to use
546
+ if (channel .isSelected ())
547
+ {
548
+ graphics .setColor (mColorChannelConfigSelected );
549
+ }
550
+ else if (channel .isProcessing ())
551
+ {
552
+ graphics .setColor (mColorChannelConfigProcessing );
553
+ }
554
+ else
555
+ {
556
+ graphics .setColor (mColorChannelConfig );
557
+ }
560
558
559
+ double xAxis = getAxisFromFrequency (tunerChannel .getFrequency ());
561
560
double width = (double )(tunerChannel .getBandwidth ()) / (double )getDisplayBandwidth () * getSize ().getWidth ();
562
561
563
- Rectangle2D .Double box =
564
- new Rectangle2D . Double ( xAxis - ( width / 2.0d ), 0.0d , width , getSize ().getHeight () - mSpectrumInset );
562
+ Rectangle2D .Double box = new Rectangle2D . Double ( xAxis - ( width / 2.0d ), 0.0d , width ,
563
+ getSize ().getHeight () - mSpectrumInset );
565
564
566
565
//Fill the box with the correct color
567
566
graphics .fill (box );
568
-
569
567
graphics .draw (box );
570
568
571
569
//Change to the line color to render the channel name, etc.
@@ -590,11 +588,8 @@ else if(channel.isProcessing())
590
588
//Draw the decoder label
591
589
drawLabel (graphics , channel .getDecodeConfiguration ().getDecoderType ().getShortDisplayString (),
592
590
this .getFont (), xAxis , yAxis , width );
593
-
594
591
long frequency = tunerChannel .getFrequency ();
595
-
596
592
double frequencyAxis = getAxisFromFrequency (frequency );
597
-
598
593
drawChannelCenterLine (graphics , frequencyAxis );
599
594
600
595
/* Draw Automatic Frequency Control line */
@@ -603,7 +598,6 @@ else if(channel.isProcessing())
603
598
if (correction != 0 )
604
599
{
605
600
long error = frequency + correction ;
606
-
607
601
drawAFC (graphics , frequencyAxis , getAxisFromFrequency (error ), width , correction ,
608
602
tunerChannel .getFrequency ());
609
603
}
0 commit comments