summaryrefslogtreecommitdiff
path: root/examples/Simulator/DOVEBrowser/MultiDoubleVisComp.java
diff options
context:
space:
mode:
Diffstat (limited to 'examples/Simulator/DOVEBrowser/MultiDoubleVisComp.java')
-rw-r--r--examples/Simulator/DOVEBrowser/MultiDoubleVisComp.java48
1 files changed, 24 insertions, 24 deletions
diff --git a/examples/Simulator/DOVEBrowser/MultiDoubleVisComp.java b/examples/Simulator/DOVEBrowser/MultiDoubleVisComp.java
index 1685f25c69a..4961e2aa437 100644
--- a/examples/Simulator/DOVEBrowser/MultiDoubleVisComp.java
+++ b/examples/Simulator/DOVEBrowser/MultiDoubleVisComp.java
@@ -1,5 +1,5 @@
// $Id$
-//
+//
// = FILENAME
// MultiDoubleVisComp.java
//
@@ -25,7 +25,7 @@ public class MultiDoubleVisComp extends Canvas implements VisComp
private static final int MIN_SPACING = 2;
private static final int POINT_HISTORY = 200;
private static final Font FONT = new Font ("Dialog", Font.PLAIN, 10);
-
+
private Queue plots_ [];
private int plot_count_ = 0;
private String title_;
@@ -62,19 +62,19 @@ public class MultiDoubleVisComp extends Canvas implements VisComp
title_ = "";
max_value_ = 1;
old_max_value_ = max_value_;
-
+
java.util.Random rand = new java.util.Random (System.currentTimeMillis ());
float hue_ = rand.nextFloat ();
float brightness = rand.nextFloat ();
hue_ += .075;
-
+
if (hue_ > 1.0)
hue_ -= 1.0;
-
+
if (brightness > 0.75)
brightness -= 0.25;
-
+
Color new_color = Color.getHSBColor (hue_, 1, brightness);
this.setBackground (new_color);
@@ -129,7 +129,7 @@ public class MultiDoubleVisComp extends Canvas implements VisComp
public void setName (String title) {
title_ = title;
}
-
+
public int getProperty () {
return Properties.MULTIDOUBLE;
}
@@ -141,7 +141,7 @@ public class MultiDoubleVisComp extends Canvas implements VisComp
public Dimension getPreferredSize () {
return new Dimension (175, 175);
}
-
+
public String getName () {
return title_;
}
@@ -154,14 +154,14 @@ public class MultiDoubleVisComp extends Canvas implements VisComp
{
Double double_array[];
try {
- double_array = (Double[]) obj;
+ double_array = (Double[]) obj;
}
catch (Exception excp) {
double_array = new Double [plot_count_];
for (int j = 0; j < plot_count_; ++j)
{
double_array [j] = new Double (0.0);
- }
+ }
System.out.println (excp);
System.out.println ("Multi Double Visualization Component received wrong data type!");
}
@@ -171,13 +171,13 @@ public class MultiDoubleVisComp extends Canvas implements VisComp
float new_point = double_array [i].floatValue ();
Float temp = (Float) plots_ [i].dequeue_tail ();
plots_ [i].enqueue_head (new Float (new_point));
-
+
if (new_point > local_max_ [i])
{
local_max_ [i] = new_point;
local_max_values_ [local_max_value_index_ [i]] = local_max_ [i];
}
-
+
if (monotonic_scale_)
{
float global_max = 0;
@@ -185,7 +185,7 @@ public class MultiDoubleVisComp extends Canvas implements VisComp
while (global_max > max_value_)
max_value_ *= 2;
-
+
while ((global_max < max_value_/2) && (max_value_ > old_max_value_))
max_value_ /= 2;
}
@@ -193,7 +193,7 @@ public class MultiDoubleVisComp extends Canvas implements VisComp
{
while (local_max_ [i] > max_value_)
max_value_ *= 2;
-
+
while ((local_max_ [i] < max_value_/2) && (max_value_ > old_max_value_))
max_value_ /= 2;
}
@@ -211,7 +211,7 @@ public class MultiDoubleVisComp extends Canvas implements VisComp
FontMetrics fm = g.getFontMetrics ();
int fheight = fm.getHeight ();
String value = "Scale: " + max_value_ ;
-
+
if ((offscreen_ == null) ||
(offscreensize_.width != d.width - 8) ||
(offscreensize_.height != d.height - 8))
@@ -226,10 +226,10 @@ public class MultiDoubleVisComp extends Canvas implements VisComp
g.draw3DRect (0, 0, d.width - 1, d.height - 1, true);
g.draw3DRect (1, 1, d.width - 3, d.height - 3, true);
g.draw3DRect (2, 2, d.width - 5, d.height - 5, true);
-
+
offgraphics_.setColor (getBackground ());
offgraphics_.fillRect (0, 0, offscreensize_.width, offscreensize_.height);
- offgraphics_.setColor (getForeground ());
+ offgraphics_.setColor (getForeground ());
offgraphics_.drawString (title_, 5, fheight);
offgraphics_.drawString (value, 5, offscreensize_.height - 5);
@@ -242,13 +242,13 @@ public class MultiDoubleVisComp extends Canvas implements VisComp
while (queue_iter.hasMoreElements ())
{
value_2 = ((Float) queue_iter.nextElement ()).floatValue ();
-
+
if (value_1 > local_max_ [i])
local_max_ [i] = value_1;
-
+
y1 = normalize (offscreensize_.height - fheight, value_1, i);
y2 = normalize (offscreensize_.height - fheight, value_2, i);
-
+
tmp = value_2;
value_2 = value_1;
value_1 = tmp;
@@ -265,7 +265,7 @@ public class MultiDoubleVisComp extends Canvas implements VisComp
g.drawImage (offscreen_, 3, 3, null);
}
-
+
public void paint (Graphics g)
{
Dimension d = getSize ();
@@ -274,7 +274,7 @@ public class MultiDoubleVisComp extends Canvas implements VisComp
{
int plot_length = plots_ [i].length ();
int num_points = d.width / spacing_;
-
+
if (plots_[i].length () < num_points)
{
for (int j = 0; j < num_points - plot_length; j++)
@@ -309,7 +309,7 @@ public class MultiDoubleVisComp extends Canvas implements VisComp
if (new_count > plot_count_)
{
// New larger static global array of all local maxima values
- float local_max_values_temp [] =
+ float local_max_values_temp [] =
new float [local_max_value_count_ + new_count - plot_count_];
// Copy the previously stored maxima (if any) into the new array.
@@ -365,7 +365,7 @@ public class MultiDoubleVisComp extends Canvas implements VisComp
// Then, subtract the pixel location
float location = (float) height - pixels;
-
+
return Math.round (location);
}
}