Graphics-HotMap
view release on metacpan or search on metacpan
lib/Graphics/HotMap.pm view on Meta::CPAN
},
);
# ..., and import/add it
$hotMap->addConfs(\%other);
# Run the interpolation and generate and image
$hotMap->genImage;
# Save the image a a PNG file
$hotMap->genImagePng('MyTest.png');
# print the text representation of the map
print $hotMap->toString('floor') if $hotMap->scale < 3;
=head1 DESCRIPTION
Generate thermographic images from a few know points. Others values are interpolated. Graphics::HotMap use PDL to work on matrix.
PDL can compute very very large matrix in a few seconds.
See L<http://kumy.org/HotMap/HotMap.png>
lib/Graphics/HotMap.pm view on Meta::CPAN
=item new(<HASH>)
=for ref
Construct and return a new HotMap Object;
=for usage
Graphics::HotMap->new(
outfileGif => <File path>, # file to write GIF
outfilePng => <File path>, # file to write PNG
legend => [0|1], # activate lengend
legendNbGrad => <number>, # Number a graduation
cross => <bool>, # activate crossing of known values
crossValues => <bool>, # activate values printing whith cross
minValue => <number>, # minimum value
maxValue => <number>, # maximum value
font => <path to font file>,
fontSize => <number>, # font size
scale => <number>, # scale values and coordonates
sizeX => <number>, # X size
lib/Graphics/HotMap.pm view on Meta::CPAN
maxvalue => 50,
);
=cut
sub new {
my ($class, %params) = (@_);
my $self={};
$self->{_outfileGif} = $params{outfileGif} || undef;
$self->{_outfilePng} = $params{outfilePng} || undef;
$self->{_legend} = $params{legend} || 0;
$self->{_legendNbGrad} = $params{legendNbGrad} || 7;
$self->{_crossMark} = $params{cross} || 0;
$self->{_crossMarkTemp}= $params{crossTemp} || 0;
#$self->{_minValue} = $params{minValue} || 0;
#$self->{_maxValue} = $params{maxValue} || 70;
$self->{_font} = $params{font} || '/usr/share/fonts/truetype/freefont/FreeSans.ttf';
$self->{_fontSize} = $params{fontSize} || 15;
$self->{_text} = ();
$self->{_horodatage} = $params{horodatage} || [0, 0, 0];
lib/Graphics/HotMap.pm view on Meta::CPAN
=cut
sub _saveImg {
my $self = shift;
my ($outfile, $im) = @_;
print $im->Write(filename=>$outfile); #, compression=>'JPEG', type => 'Palette');
}
=item genImagePng()
=for ref
Write a PNG image from the interpolated table.
=for exemple
$hotMap->genImagePng('<path_to_png'>);
=cut
sub genImagePng {
my $self = shift;
my $fileName = shift || $self->{_outfilePng} || die "No output PNG specified";
$self->_saveImg($fileName,$self->{_im});
return {
width => $self->{_im}->Get('width'),
height => $self->{_im}->Get('height'),
filesize => $self->{_im}->Get('filesize'),
mime => $self->{_im}->Get('mime'),
image => $self->{_im},
};
}
( run in 0.593 second using v1.01-cache-2.11-cpan-0a6323c29d9 )