Geo-Raster
view release on metacpan or search on metacpan
lib/Geo/Raster/Operations.pm view on Meta::CPAN
## @class Geo::Raster::Operations
# @brief Adds operations into Geo::Raster and overloads them to operators.
# @note Many methods may convert an integer raster into a floating
# point raster if the operation requires.
# @note All operations, which involve more than one raster, require
# that the rasters are overlayable.
package Geo::Raster;
use strict;
use overload (
'fallback' => undef,
# not having "" overloaded makes print "$raster" to print "1"
'""' => 'as_string',
'bool' => 'bool',
'=' => 'shallow_copy',
'neg' => 'neg',
'+' => 'plus',
'-' => 'minus',
'*' => 'times',
'/' => 'over',
'%' => 'modulo',
'**' => 'power',
'+=' => 'add',
'-=' => 'subtract',
'*=' => 'multiply_by',
'/=' => 'divide_by',
'%=' => 'modulus_with',
'**=' => 'to_power_of',
'<' => 'lt',
'>' => 'gt',
'<=' => 'le',
'>=' => 'ge',
'==' => 'eq',
'!=' => 'ne',
'<=>' => 'cmp',
'atan2' => 'atan2',
'cos' => 'cos',
'sin' => 'sin',
'exp' => 'exp',
'abs' => 'abs',
'log' => 'log',
'sqrt' => 'sqrt',
);
use Scalar::Util 'blessed';
## @ignore
sub as_string {
my $self = shift;
return $self;
}
## @ignore
sub bool {
return 1;
}
## @ignore
sub shallow_copy {
my $self = shift;
return $self;
}
## @method Geo::Raster neg()
#
# @brief Unary minus. Multiplies this raster with -1.
#
( run in 1.717 second using v1.01-cache-2.11-cpan-39bf76dae61 )