1 package FS::sector_coverage;
2 use base qw( FS::Record );
5 use FS::Record qw( qsearch qsearchs );
10 FS::sector_coverage - Object methods for sector_coverage records
14 use FS::sector_coverage;
16 $record = new FS::sector_coverage \%hash;
17 $record = new FS::sector_coverage { 'column' => 'value' };
19 $error = $record->insert;
21 $error = $new_record->replace($old_record);
23 $error = $record->delete;
25 $error = $record->check;
29 An FS::sector_coverage object represents a coverage map for a sector at
30 a specific signal strength level. FS::sector_coverage inherits from
31 FS::Record. The following fields are currently supported:
41 L<FS::tower_sector> foreign key
45 The maximum path loss shown on this map, in dB.
49 A GeoJSON Geometry object for the area covered at this level.
59 Creates a new map. To add the example to the database, see L<"insert">.
61 Note that this stores the hash reference, not a distinct copy of the hash it
62 points to. You can ask the object for a copy with the I<hash> method.
66 # the new method can be inherited from FS::Record, if a table method is defined
68 sub table { 'sector_coverage'; }
72 Adds this record to the database. If there is an error, returns the error,
73 otherwise returns false.
77 Delete this record from the database.
79 =item replace OLD_RECORD
81 Replaces the OLD_RECORD with this one in the database. If there is an error,
82 returns the error, otherwise returns false.
86 # the replace method can be inherited from FS::Record
90 Checks all fields to make sure this is a valid example. If there is
91 an error, returns the error, otherwise returns false. Called by the insert
96 # the check method should currently be supplied - FS::Record contains some
97 # data checking routines
103 $self->ut_numbern('coveragenum')
104 || $self->ut_number('sectornum')
105 || $self->ut_number('db_loss')
107 return $error if $error;
109 if ( length($self->geometry) ) {
110 # make sure it parses at least
112 my $data = eval { decode_json($self->geometry) };
114 # limit the length, in case it decides to return a large chunk of data
115 return "Error parsing coverage geometry: ".substr($@, 0, 100);