| 1 | package Geo::JSON::Types; | ||||||||||
| 2 | |||||||||||
| 3 | 6 | our $VERSION = '0.007'; | |||||||||
| 4 | |||||||||||
| 5 | 6 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | 6 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 7 | |||||||||||
| 8 | 6 | ▶ | BEGIN { | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 9 | 6 | ▶ | use Type::Library -base, -declare => qw/ | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 10 | CRS | ||||||||||
| 11 | Feature | ||||||||||
| 12 | Features | ||||||||||
| 13 | Geometry | ||||||||||
| 14 | LinearRing | ||||||||||
| 15 | LineString | ||||||||||
| 16 | LineStrings | ||||||||||
| 17 | Polygon | ||||||||||
| 18 | Polygons | ||||||||||
| 19 | Position | ||||||||||
| 20 | Positions | ||||||||||
| 21 | 6 | /; | |||||||||
| 22 | 6 | ▶ | use Type::Utils; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 23 | 6 | ▶ | use Types::Standard -types; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 24 | |||||||||||
| 25 | 6 | ▶ | use Geo::JSON::Utils qw/ compare_positions /; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 26 | |||||||||||
| 27 | declare Position, # | ||||||||||
| 28 | as ArrayRef [Num], # | ||||||||||
| 29 | 6 | ▶ | where { @{$_} >= 2 }; | ||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||
| 30 | |||||||||||
| 31 | declare Positions, # | ||||||||||
| 32 | as ArrayRef [Position], # | ||||||||||
| 33 | 6 | ▶ | where { @{$_} > 0 }; | ||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||
| 34 | |||||||||||
| 35 | declare LineString, # | ||||||||||
| 36 | as Positions, # | ||||||||||
| 37 | 6 | ▶ | where { @{$_} >= 2 }; | ||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||
| 38 | |||||||||||
| 39 | 6 | declare LineStrings, # | |||||||||
| 40 | as ArrayRef [LineString]; | ||||||||||
| 41 | |||||||||||
| 42 | declare LinearRing, # | ||||||||||
| 43 | as LineString, # | ||||||||||
| 44 | 6 | ▶ | where { @{$_} >= 4 && compare_positions( $_->[0], $_->[-1] ) }; | ||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=7.1
Branch: 1 branch
| |||||||||||
| 45 | |||||||||||
| 46 | 6 | declare Polygon, # | |||||||||
| 47 | as ArrayRef [LinearRing]; | ||||||||||
| 48 | |||||||||||
| 49 | 6 | declare Polygons, # | |||||||||
| 50 | as ArrayRef [Polygon]; | ||||||||||
| 51 | |||||||||||
| 52 | 6 | ▶ | declare Geometry, as Object, where { $_->does("Geo::JSON::Role::Geometry") }; | ||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||
| 53 | |||||||||||
| 54 | 6 | class_type CRS, { class => 'Geo::JSON::CRS' }; | |||||||||
| 55 | 6 | class_type Feature, { class => 'Geo::JSON::Feature' }; | |||||||||
| 56 | |||||||||||
| 57 | 6 | coerce CRS, from HashRef, q{ 'Geo::JSON::CRS'->new($_) }; | |||||||||
| 58 | |||||||||||
| 59 | 6 | coerce Feature, from HashRef, q{ 'Geo::JSON'->load( $_ ) }; | |||||||||
| 60 | |||||||||||
| 61 | 6 | coerce Geometry, from HashRef, q{ 'Geo::JSON'->load( $_ ) }; | |||||||||
| 62 | |||||||||||
| 63 | 6 | declare Features, as ArrayRef [Feature], coercion => 1; | |||||||||
| 64 | } | ||||||||||
| 65 | |||||||||||
| 66 | 6 | 1; | |||||||||
| 67 | |||||||||||
| 68 | __END__ | ||||||||||