App-SourcePlot
view release on metacpan or search on metacpan
lib/App/SourcePlot.pm view on Meta::CPAN
foreach $name (@Epocs) {
$epocB->command(
-label => $name,
-command => sub {
$epocB->configure(-text => $name);
$epocEnt = $name;
},
);
}
$epocB->grid(-column => 1, -row => 3, -padx => 10, -pady => 5, -sticky => 'w');
my $buttonF = $Top->Frame->pack(-padx => 10, -pady => 10);
$buttonF->Button(
-text => 'Ok',
-command => sub {
$source->configure($nameEnt->get(), $raEnt->get(), $decEnt->get(), $epocEnt);
destroy $Top;
$RESPONSE = 1;
},
)->pack(-side => 'right');
$buttonF->Button(
-text => 'Cancel',
-command => sub {
destroy $Top;
$RESPONSE = -1;
},
)->pack(-side => 'right');
$Top->update;
$Top->grab;
}
=item B<editSource>
Edits the existing source list.
=cut
sub editSource {
my (@selected) = ();
my $udeb = 0; #debugger
$eBut->configure(-state => 'disabled');
my $Top = $MW->Toplevel();
$Top->geometry('+600+90');
$Top->title('Source Plot: Edit Window');
$Top->resizable(1, 1);
my $topFrame = $Top->Frame(
-relief => 'groove',
-borderwidth => 2,
-width => 50,
)->grid(-column => 0, -row => 0, -padx => 3, -pady => 3, -sticky => 'nsew');
# create the header
my $head = $topFrame->Text(
-wrap => 'none',
-relief => 'flat',
-foreground => 'midnightblue',
-width => 50,
-height => 1,
-font => '-*-Courier-Medium-R-Normal--*-120-*-*-*-*-*-*',
-takefocus => 0,
)->grid(-sticky => 'ew', -row => 0);
my $title = sprintf "%5s %-16s %-12s %-13s %-4s", 'Index', 'Name',
'Ra', 'Dec', 'Epoc';
$head->insert('end', $title);
$head->configure(-state => 'disabled');
# create the scollable text
my $T = $topFrame->Scrolled(
'Text',
-scrollbars => 'e',
-background => '#333333',
-wrap => 'none',
-width => 60,
-height => 15,
-font => '-*-Courier-Medium-R-Normal--*-120-*-*-*-*-*-*',
-setgrid => 1,
)->grid(-sticky => 'nsew', -row => 1);
$T->bindtags(qw/widget_demo/); # remove all bindings but dummy "widget_demo"
$topFrame->gridRowconfigure(1, -weight => 1);
$topFrame->gridColumnconfigure(0, -weight => 1);
# create the done button
my $buttonF = $Top->Frame->grid(-column => 0, -row => 1, -padx => 3, -pady => 3, -sticky => 'nsew');
my $doneBut = $buttonF->Button(
-text => 'Done',
-width => 4,
-command => sub {
destroy $Top;
},
)->pack(-side => 'right');
$balloon->attach($doneBut, -balloonmsg => "Press to close the Edit Window");
# Closing the window should reset $eBut.
$Top->bind('<Destroy>', sub {
my $widget = shift;
return unless $widget == $Top;
$eBut->configure(-state => 'normal');
$EDIT_OPEN = 0;
});
# create the On / Off button
my $OOBut = $buttonF->Button(
-text => 'ON/Off',
-width => 5,
-command => sub {
my $source;
foreach $source (@selected) {
if ($source->active()) {
tagOnOff($source->name(), 0);
$source->active(0);
$T->tag(
'configure',
'd' . $source->index(),
-foreground => 'black'
);
}
else {
tagOnOff($source->name(), 1, $source->color(), 'yellow');
$source->active(1);
$T->tag(
'configure',
'd' . $source->index(),
-foreground => $source->color()
);
}
}
@selected = ();
},
)->pack(-side => 'left');
$balloon->attach($OOBut, -balloonmsg => "Press to turn the selected\nsources On/Off");
# create the delete all button
my $manipF = $buttonF->Frame->pack(-side => 'left', -padx => 30);
my $DABut = $manipF->Button(
lib/App/SourcePlot.pm view on Meta::CPAN
$minY = $lst;
print "y-axis is time\n" if $debug;
}
elsif ($Y_AXIS =~ /air mass/i) {
$yworldRatio = -90 / ($yplot - $yborder * 2 - $YSpaceForTime);
$maxY = 90;
$minY = 0;
print "y-axis is ele\n" if $debug;
}
elsif ($Y_AXIS =~ /elevation/i) {
$yworldRatio = -90 / ($yplot - $yborder * 2 - $YSpaceForTime);
$maxY = 90;
$minY = 0;
print "y-axis is ele\n" if $debug;
}
elsif ($Y_AXIS =~ /azimuth/i) {
$yworldRatio = -360 / ($yplot - $yborder * 2 - $YSpaceForTime);
$minY = 0;
$maxY = 360;
print "y-axis is az\n" if $debug;
}
elsif ($Y_AXIS =~ /parallactic angle/i) {
$yworldRatio = -360 / ($yplot - $yborder * 2 - $YSpaceForTime);
$minY = -180;
$maxY = 180;
print "y-axis is pa\n" if $debug;
}
else {
print "ERROR: Y axis undefined!!\n\n";
$minY = 0;
$maxY = 0;
}
if ((($Y_AXIS =~ /azimuth/i) && ($X_AXIS =~ /elevation/i))
|| (($X_AXIS =~ /azimuth/i) && ($Y_AXIS =~ /elevation/i))
|| (($Y_AXIS =~ /azimuth/i) && ($X_AXIS =~ /air mass/i))
|| (($X_AXIS =~ /azimuth/i) && ($Y_AXIS =~ /air mass/i))) {
$yworldRatio = -180 / ($yplot - $yborder * 2);
$xworldRatio = 180 / ($xplot - $xborder * 2);
$minY = 0;
$maxY = 180;
$minX = 0;
$maxX = 180;
$plotter->usingWorld(0);
$plotter->worldCenter($xplot / 2, $yplot / 2);
$plotter->usingWorld(1);
if (($X_AXIS =~ /elevation/i) || ($Y_AXIS =~ /elevation/i)) {
$special = 1;
}
else {
# air mass case
$special = 2;
}
print "axes is special\n" if $debug;
}
print " Setting the world coordinate system\n" if $locateBug;
$plotter->worldToPixRatio($xworldRatio, $yworldRatio);
$plotter->worldAtZero($minX, $minY);
# draw the grid lines - x axis
$plotter->fontColor('White');
$plotter->drawColor('dark green');
if (($special == 1) || ($special == 2)) {
# draw the angle grid lines
for (my $z = 0; $z < 360; $z += 15) {
my $tz = (90 - $z) * pi / 180;
my $x = 92 * cos $tz;
my $y = 92 * sin $tz;
$plotter->drawLine(0, 0, $x, $y, 'grid');
}
#label the angle grid lines
for (my $z = 0; $z < 360; $z += 15) {
my $tz = (90 - $z) * pi / 180;
my $x = 95 * cos $tz;
my $y = 95 * sin $tz;
if ($z == 0) {
$plotter->drawText($x, $y, 'N', 'twhite');
}
elsif ($z == 90) {
$plotter->drawText($x, $y, 'E', 'twhite');
}
elsif ($z == 180) {
$plotter->drawText($x, $y, 'S', 'twhite');
}
elsif ($z == 270) {
$plotter->drawText($x, $y, 'W', 'twhite');
}
else {
$plotter->drawText($x, $y, $z, 'twhite');
}
}
# draw the outside circle
$plotter->drawColor('white');
$plotter->penWidth(2);
$plotter->drawOval(-90, -90, 90, 90, 'owhite');
$plotter->penWidth(1);
if ($special == 1) {
# elevation -azimuth case
# draw the elevation labels
$plotter->drawColor('dark green');
my $texty = $plotter->toWy(5) - $plotter->toWy(0);
for (my $i = 0; $i < 90; $i += 10) {
$plotter->drawOval(-$i, -$i, $i, $i, 'grid');
$plotter->drawText(0, $i - $texty, 90 - $i, 'twhite');
}
$plotter->usingWorld(0);
$plotter->worldCenter($xborder, $yplot - $yborder);
$plotter->usingWorld(1);
}
if ($special == 2) {
# azimuth - air mass case
# draw the elevation labels
$plotter->drawColor('dark green');
my $ytext = $plotter->toWx(5) - $plotter->toWx(0);
for (qw/1.0 1.25 1.5 1.75 2.0 3.0 4.0 5.0/) {
my $new_el = 90 - am_to_deg($_);
lib/App/SourcePlot.pm view on Meta::CPAN
$lm = '0' . $lm if $lm < 10;
my $lx = $plotter->toWx($xplot - $xborder * 3 / 2);
$plotter->drawText($lx, $hour, sprintf("%2s:%2s", $lh, $lm), 'twhite');
$ho += 4;
}
}
elsif ($Y_AXIS =~ /elevation/i) {
for (my $deg = $minY + 20; $deg < $maxY; $deg += 10) {
$plotter->drawLine($minX, $deg, $maxX, $deg, 'grid');
my $x = $plotter->toWx($xborder + 10);
$plotter->drawText($x, $deg, $deg, 'twhite');
}
}
elsif ($Y_AXIS =~ /air mass/i) {
my $dAt12 = 90 - (180 / pi * acos(1 / 1.25));
my $dAt15 = 90 - (180 / pi * acos(1 / 1.5));
my $dAt17 = 90 - (180 / pi * acos(1 / 1.75));
my $x = $plotter->toWx($xborder + 15);
for my $am (qw/1 2 3 4 5/) {
my $dAt = 90 - (180 / pi * acos(1 / $am));
$plotter->drawLine($minX, $dAt, $maxX, $dAt, 'grid');
$plotter->drawText($x, $dAt, $am, 'twhite');
}
$plotter->drawLine($minX, $dAt12, $maxX, $dAt12, 'grid');
$plotter->drawLine($minX, $dAt15, $maxX, $dAt15, 'grid');
$plotter->drawLine($minX, $dAt17, $maxX, $dAt17, 'grid');
$plotter->drawText($x, $dAt12, '1.25', 'twhite');
$plotter->drawText($x, $dAt15, '1.5', 'twhite');
$plotter->drawText($x, $dAt17, '1.75', 'twhite');
}
elsif ($Y_AXIS =~ /azimuth/i) {
for (my $deg = $minY + 40; $deg < $maxY; $deg += 40) {
$plotter->drawLine($minX, $deg, $maxX, $deg, 'grid');
my $x = $plotter->toWx($xborder + 10);
$plotter->drawText($x, $deg, $deg, 'twhite');
}
}
elsif ($Y_AXIS =~ /parallactic angle/i) {
for (my $deg = $minY + 40; $deg < $maxY; $deg += 40) {
$plotter->drawLine($minX, $deg, $maxX, $deg, 'grid');
my $x = $plotter->toWx($xborder + 10);
$plotter->drawText($x, $deg, $deg, 'twhite');
}
}
if (! $special) {
# erase any mess under the y axis or to the left of the x axis
my $bottom = $plotter->toWy($yplot + 10);
my $top = $plotter->toWy(-10);
my $west = $plotter->toWx(-10);
my $east = $plotter->toWx($xplot + 10);
$plotter->drawColor('black');
$plotter->drawBox($west, $maxY, $east, $top, 'foblack');
$plotter->drawBox($west, $minY, $east, $bottom, 'foblack');
$plotter->drawBox($west, $bottom, $minX, $top, 'foblack');
$plotter->drawBox($maxX, $bottom, $east, $top, 'foblack');
# plot the axes and graphs - last to make look neat
print " Plotting the grid border and labels\n" if $locateBug;
$plotter->drawColor('White');
$plotter->fontColor('White');
$plotter->drawLine($minX, $minY, $minX, $maxY, 'lwhite');
$plotter->drawLine($minX, $minY, $maxX, $minY, 'lwhite');
$plotter->drawLine($maxX, $minY, $maxX, $maxY, 'lwhite');
$plotter->drawLine($minX, $maxY, $maxX, $maxY, 'lwhite');
$plotter->raiseAbove('lwhite', 'foblack');
$plotter->raiseAbove('twhite', 'foblack');
}
# label the axes
$plotter->usingWorld(0);
if ($special) {
}
elsif ($X_AXIS =~ /time/i) {
$plotter->drawText($xplot / 2, $yplot - $yborder / 2, 'HST', 'twhite');
$plotter->drawText($xplot / 2, $yborder, 'UT', 'twhite');
$plotter->drawText($xplot / 2, $yborder * 2, 'LST', 'twhite');
$plotter->drawLine($xborder, $yborder, $xplot - $xborder, $yborder, 'lwhite');
$plotter->drawLine($xborder, $yborder, $xborder, $yborder + $YSpaceForTime, 'lwhite');
$plotter->drawLine($xplot - $xborder, $yborder, $xplot - $xborder, $yborder + $YSpaceForTime, 'lwhite');
}
elsif ($X_AXIS =~ /elevation/i) {
$plotter->usingWorld(1);
my $yoff = $maxY + $plotter->toWy(5) - $plotter->toWy(0);
my $toff = $plotter->toWy(10) - $plotter->toWy(0);
$plotter->drawLine(30, $maxY, 30, $yoff, 'lwhite');
my $dAt12 = 90 - (180 / pi * acos(1 / 1.25));
my $dAt15 = 90 - (180 / pi * acos(1 / 1.5));
my $dAt17 = 90 - (180 / pi * acos(1 / 1.75));
my $dAt3 = 90 - (180 / pi * acos(1 / 3));
my $dAt4 = 90 - (180 / pi * acos(1 / 4));
my $dAt5 = 90 - (180 / pi * acos(1 / 5));
$plotter->drawLine($dAt12, $maxY, $dAt12, $yoff, 'lwhite');
$plotter->drawLine($dAt15, $maxY, $dAt15, $yoff, 'lwhite');
$plotter->drawLine($dAt17, $maxY, $dAt17, $yoff, 'lwhite');
$plotter->drawLine($dAt3, $maxY, $dAt3, $yoff, 'lwhite');
$plotter->drawLine($dAt4, $maxY, $dAt4, $yoff, 'lwhite');
$plotter->drawLine($dAt5, $maxY, $dAt5, $yoff, 'lwhite');
$plotter->drawText(90, $maxY + $toff, '1', 'twhite');
$plotter->drawText(30, $maxY + $toff, '2', 'twhite');
$plotter->drawText($dAt12, $maxY + $toff, '1.25', 'twhite');
$plotter->drawText($dAt15, $maxY + $toff, '1.5', 'twhite');
$plotter->drawText($dAt17, $maxY + $toff, '1.75', 'twhite');
$plotter->drawText($dAt3, $maxY + $toff, '3', 'twhite');
$plotter->drawText($dAt4, $maxY + $toff, '4', 'twhite');
$plotter->drawText($dAt5, $maxY + $toff, '5', 'twhite');
$plotter->usingWorld(0);
$plotter->drawText($xplot / 2, $yborder / 2, 'Air Mass', 'twhite');
$plotter->drawText($xplot / 2, $yplot - $yborder / 2, 'Elevation', 'twhite');
}
elsif ($X_AXIS =~ /air mass/i) {
$plotter->usingWorld(1);
my $yoff = $maxY + $plotter->toWy(5) - $plotter->toWy(0);
my $toff = $plotter->toWy(10) - $plotter->toWy(0);
for (my $deg = $minX + 20; $deg < $maxX; $deg += 20) {
$plotter->drawLine($deg, $maxY, $deg, $yoff, 'lwhite');
$plotter->drawText($deg, $maxY + $toff, $deg, 'twhite');
}
$plotter->usingWorld(0);
$plotter->drawText($xplot / 2, $yborder / 2, 'Elevation', 'twhite');
$plotter->drawText($xplot / 2, $yplot - $yborder / 2, 'Air Mass', 'twhite');
lib/App/SourcePlot.pm view on Meta::CPAN
}
elsif (($Y_AXIS =~ /elevation/i) || ($Y_AXIS =~ /air mass/i)) {
@points = $source->ele_az_points();
}
elsif ($Y_AXIS =~ /parallactic angle/i) {
@points = $source->az_pa_points();
}
}
elsif ($X_AXIS =~ /parallactic angle/i) {
if ($Y_AXIS =~ /time/i) {
@points = $source->pa_time_points();
}
elsif (($Y_AXIS =~ /elevation/i) || ($Y_AXIS =~ /air mass/i)) {
@points = $source->pa_ele_points();
}
elsif ($Y_AXIS =~ /azimuth/i) {
@points = $source->pa_az_points();
}
}
$plotter->penWidth($source->lineWidth());
$plotter->penWidth($H_WIDTH) if ($H_LIGHT == $source);
$plotter->drawColor($source->color());
print "color plotted is " . $source->color() . "\n" if $debug;
my @times = $source->time_ele_points();
if (($special == 1) || ($special == 2)) {
my $i;
my $len = @points;
my @newpoints = ();
my $prevr;
my $prevt;
my $dotColor = "#55ffff";
for ($i = 0; $i < $len; $i += 2) {
my $r = $points[$i];
$r = 90 - $r;
my $theta = $points[$i + 1];
$theta = (90 - $theta) * pi / 180;
my $x = 90 + $r * cos $theta;
my $y = 90 + $r * sin $theta;
my $len2 = @newpoints;
if ($r < 90) {
if ($len2 == 0 && defined $prevr && $prevr > 90) {
my $dr = 90 - $r;
my $pdr = $prevr - 90;
my $nt = $dr / ($dr + $pdr) * ($prevt - $theta) + $theta;
my $x2 = 90 + 90 * cos $nt;
my $y2 = 90 + 90 * sin $nt;
push @newpoints, $x2;
push @newpoints, $y2;
}
if ($r > 60 && defined $prevr && $prevr < 60) {
my $time = $timeH - 12 + int($i / 2) * (24 / ($NUM_POINTS - 1));
$time += 24 if $time < 0;
$time -= 24 if $time > 24;
my ($h, $m) = split /\./, $time;
$m = ('.' . $m) * 60;
$m = '0' . $m if $m < 10;
$h = '0' . $h if $h < 10;
$time = sprintf "%2s:%2s", $h, $m;
$plotter->fontColor('#ffff00');
$plotter->drawText($x, $y + 3, "$time", 'time' . $source->name());
$plotter->drawFillOval($x - 1, $y - 1, $x + 1, $y + 1, 'fo' . $source->name());
}
elsif ($r < 60 && defined $prevr && $prevr > 60) {
my $time = $timeH - 12 + int($i / 2) * (24 / ($NUM_POINTS - 1));
my $di = 24 / ($NUM_POINTS - 1);
$time -= $di;
$time += 24 if $time < 0;
$time -= 24 if $time > 24;
my ($h, $m) = split /\./, $time;
$m = ('.' . $m) * 60;
$m = '0' . $m if $m < 10;
$h = '0' . $h if $h < 10;
$time = sprintf "%2s:%2s", $h, $m;
my $x2 = 90 + $prevr * cos $prevt;
my $y2 = 90 + $prevr * sin $prevt;
$plotter->fontColor('#ffff00');
$plotter->drawText($x2, $y2 + 3, "$time", 'time' . $source->name());
$plotter->drawFillOval($x2 - 1, $y2 - 1, $x2 + 1, $y2 + 1, 'fo' . $source->name());
}
$plotter->drawFillOval($x - .5, $y - .5, $x + .5, $y + .5, 'fo' . $source->name());
push @newpoints, $x;
push @newpoints, $y;
}
elsif ($len2 > 0 && defined $prevr && $prevr < 90) {
my $dr = $r - 90;
my $pdr = 90 - $prevr;
my $nt = $dr / ($dr + $pdr) * ($prevt - $theta) + $theta;
$x = 90 + 90 * cos $nt;
$y = 90 + 90 * sin $nt;
$plotter->fontColor($source->color());
$plotter->drawTextFromLeft($x + 5, $y, $source->name(), 't' . $source->name());
push @newpoints, $x;
push @newpoints, $y;
$plotter->drawSmoothLine(@newpoints, 'l' . $source->name());
@newpoints = ();
}
elsif (defined $len2 and $len2 >= 4) {
$plotter->drawSmoothLine(@newpoints, 'l' . $source->name());
@newpoints = ();
}
$prevr = $r;
$prevt = $theta;
}
@points = @newpoints;
}
else {
# give the points some labels
my $max = $points[1];
my $xm = $points[0];
my $len = @points;
my $xw = $plotter->toWx(1) - $plotter->toWx(0);
my $yw = $plotter->toWy(1) - $plotter->toWy(0);
for (my $i = 1; $i < $len; $i += 2) {
my $x = $points[$i - 1];
my $y = $points[$i];
$plotter->drawFillOval($x - $xw, $y - $yw, $x + $xw, $y + $yw, 'fo' . $source->name());
if ($points[$i] > $max) {
$max = $points[$i];
$xm = $points[$i - 1];
}
}
my $ya = $plotter->toWy(5) - $plotter->toWy(0);
$plotter->fontColor($source->color());
$plotter->drawTextFromLeft($xm, $max - $ya, $source->name(), 't' . $source->name());
my @second = ();
my $prevx = $points[0];
my $prevy = $points[1];
my $plotNow = 0;
for (my $i = 3; $i < $len; $i += 2) {
my $x = $points[$i - 1];
my $y = $points[$i];
my $plotx = $x;
my $ploty = $y;
my $plotxn = $x;
my $plotyn = $y;
push(@second, $prevx);
push(@second, $prevy);
if ($Y_AXIS =~ /parallactic angle/i) {
if ($prevy < -80 && $y > 80) {
my $len2 = @second;
if ($len2 > 0) {
$ploty = $y - 360;
$plotyn = $prevy + 360;
$plotNow = 1;
}
}
elsif ($y < -80 && $prevy > 80) {
my $len2 = @second;
if ($len2 > 0) {
$ploty = $y + 360;
$plotyn = $prevy - 360;
$plotNow = 1;
}
}
}
elsif ($X_AXIS =~ /parallactic angle/i) {
if ($prevx < -80 && $x > 80) {
my $len2 = @second;
if ($len2 > 0) {
$plotx = $x - 360;
$plotxn = $prevx + 360;
$plotNow = 1;
}
}
elsif ($x < -80 && $prevx > 80) {
my $len2 = @second;
if ($len2 > 0) {
$plotx = $x + 360;
$plotxn = $prevx - 360;
$plotNow = 1;
}
}
}
if ($Y_AXIS =~ /azimuth/i) {
if ($prevy < 100 && $y > 260) {
my $len2 = @second;
if ($len2 > 0) {
$ploty = $y - 360;
$plotyn = $prevy + 360;
$plotNow = 1;
}
lib/App/SourcePlot.pm view on Meta::CPAN
$eley = $plotter->toWy($eley) - $plotter->toWy(0);
$azx = $plotter->toWx($azx) - $plotter->toWx(0);
$azy = $plotter->toWy($azy) - $plotter->toWy(0);
# draw the time dot
if ($ele > 0) {
$source->AzElOffsets($elex, $eley, $azx, $azy);
plot_time_dot($source, $plotstyle, $radiusscale);
}
}
$TIMER = $MW->after($TimeLap, \&calcTime);
}
sub plot_time_dot {
my $source = shift;
my $plotstyle = shift;
my $radiusscale = shift;
my ($elex, $eley, $azx, $azy) = $source->AzElOffsets();
$plotter->drawColor($source->color());
if ((($Y_AXIS =~ /azimuth/i) && ($X_AXIS =~ /elevation/i))
|| (($X_AXIS =~ /azimuth/i) && ($Y_AXIS =~ /elevation/i))
|| (($Y_AXIS =~ /azimuth/i) && ($X_AXIS =~ /air mass/i))
|| (($Y_AXIS =~ /air mass/i) && ($X_AXIS =~ /azimuth/i))) {
my $sX = my $sY = 2 * $radiusscale;
my $r = 90 - $source->timeDotX();
if ($r < 90) {
my $theta = (90 - $source->timeDotY()) * pi / 180;
my $x2 = 90 + $r * cos $theta;
my $y2 = 90 + $r * sin $theta;
$plotter->$plotstyle($x2 - $sX, $y2 - $sY, $x2 + $sX, $y2 + $sY, 'timeDot' . $source->name());
$plotter->bindTag(
'timeDot' . $source->name(),
'<Any-Enter>' => sub {
},
);
$plotter->bindTag(
'ltimeDot' . $source->name(),
'<Any-Leave>' => sub {
},
);
}
}
else {
my ($sX, $sY) = $plotter->toW($dotSizeX, $dotSizeY);
$sX = ($sX - $plotter->toWx(0)) * $radiusscale;
$sY = ($sY - $plotter->toWy(0)) * $radiusscale;
my $x2 = $source->timeDotX();
my $y2 = $source->timeDotY();
if ($x2 ne '' && $y2 ne '') {
$plotter->$plotstyle($x2 - $sX, $y2 - $sY, $x2 + $sX, $y2 + $sY, 'timeDot' . $source->name());
$plotter->bindTag(
'timeDot' . $source->name(),
'<Any-Enter>' => sub {
$plotter->drawColor($source->color());
$plotter->drawFillOval($x2 - $sX, $y2 - $sY, $x2 + $sX, $y2 + $sY, 'ltimeDot' . $source->name());
# draw AZ-EL pointers
$plotter->drawColor('red');
$plotter->fontColor('red');
$plotter->penWidth(2);
$plotter->drawLine($x2 - $elex, $y2 - $eley, $x2, $y2, 'ltimeDot' . $source->name());
$plotter->drawLine($x2 - $azx, $y2 - $azy, $x2, $y2, 'ltimeDot' . $source->name());
$plotter->penWidth(1);
my ($xoff, $yoff) = $plotter->toW(7, 7);
$xoff -= $plotter->toWx(0);
$yoff -= $plotter->toWy(0);
$plotter->drawText($x2 - $elex - $xoff, $y2 - $eley - $yoff, 'El', 'ltimeDot' . $source->name());
# and RA-Dec box
my $bx = 1.5 * sqrt($azx * $azx + $elex * $elex);
my $by = 1.5 * sqrt($azy * $azy + $eley * $eley);
$plotter->drawLine($x2 - $bx, $y2 - $by, $x2 - $bx, $y2 + $by, 'ltimeDot' . $source->name());
$plotter->drawLine($x2 - $bx, $y2 + $by, $x2 + $bx, $y2 + $by, 'ltimeDot' . $source->name());
$plotter->drawLine($x2 + $bx, $y2 + $by, $x2 + $bx, $y2 - $by, 'ltimeDot' . $source->name());
$plotter->drawLine($x2 + $bx, $y2 - $by, $x2 - $bx, $y2 - $by, 'ltimeDot' . $source->name());
$plotter->drawText($x2, $y2 - 1.2 * $by, 'R.A.', 'ltimeDot' . $source->name());
$plotter->drawText($x2 - 1.12 * $bx, $y2 + 0.2 * $by, 'D', 'ltimeDot' . $source->name());
$plotter->drawText($x2 - 1.1 * $bx, $y2, 'e', 'ltimeDot' . $source->name());
$plotter->drawText($x2 - 1.1 * $bx, $y2 - 0.2 * $by, 'c', 'ltimeDot' . $source->name());
$plotter->fontColor($source->color());
},
);
$plotter->bindTag(
'ltimeDot' . $source->name(),
'<Any-Leave>' => sub {
$plotter->delete('ltimeDot' . $source->name());
},
);
}
}
}
=item B<tagOnOff>
Configures all object with the tag name off or on.
=cut
sub tagOnOff {
my $tag = shift;
my $turnOn = shift;
my $color = shift;
my $color2 = shift;
if (! $turnOn) {
$plotter->configureTag('l' . $tag, -fill => 'black');
$plotter->configureTag('fo' . $tag, -fill => 'black', outline => 'black');
$plotter->configureTag('o' . $tag, outline => 'black');
$plotter->configureTag('t' . $tag, -fill => 'black');
$plotter->configureTag('time' . $tag, -fill => 'black');
$plotter->configureTag('timeDot' . $tag, -fill => 'black', -outline => 'black');
if (! ($tag =~ /(white)/i)) {
$plotter->lowerBelow('l' . $tag, 'grid');
$plotter->lowerBelow('o' . $tag, 'grid');
$plotter->lowerBelow('fo' . $tag, 'grid');
$plotter->lowerBelow('t' . $tag, 'grid');
$plotter->lowerBelow('time' . $tag, 'grid');
$plotter->lowerBelow('timeDot' . $tag, 'grid');
}
}
else {
$plotter->configureTag('l' . $tag, -fill => $color);
$plotter->configureTag('fo' . $tag, -fill => $color, outline => $color);
$plotter->configureTag('o' . $tag, outline => $color);
$plotter->configureTag('timeDot' . $tag, -fill => $color, outline => $color);
$plotter->configureTag('t' . $tag, -fill => $color);
if (defined $color2) {
$plotter->configureTag('time' . $tag, -fill => $color2);
}
else {
$plotter->configureTag('time' . $tag, -fill => $color);
}
$plotter->raiseAbove('l' . $tag, 'grid');
$plotter->raiseAbove('o' . $tag, 'grid');
$plotter->raiseAbove('fo' . $tag, 'grid');
$plotter->raiseAbove('t' . $tag, 'grid');
$plotter->raiseAbove('time' . $tag, 'grid');
$plotter->raiseAbove('timeDot' . $tag, 'grid');
}
}
( run in 0.467 second using v1.01-cache-2.11-cpan-ceb78f64989 )