| 1 | package CXC::Gnuplot::V1::AxisLabel; | ||
| 2 | |||
| 3 | 1 | ▶ | use v5.38; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | 1 | ▶ | use experimental 'builtin'; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 5 | 1 | ▶ | use Object::Pad 0.821; |
|
Subroutine
BEGIN: called CC=1 SCAR=2.6
| |||
| 6 | |||
| 7 | our $VERSION = 'v0.29.3'; | ||
| 8 | |||
| 9 | class CXC::Gnuplot::V1::AxisLabel : isa(CXC::Gnuplot::V1::Base) | ||
| 10 | does( CXC::Gnuplot::V1::Role::Clone ); | ||
| 11 | |||
| 12 | use builtin 'is_bool', 'false'; | ||
| 13 | |||
| 14 | no namespace::clean; | ||
| 15 | |||
| 16 | use Ref::Util 'is_ref'; | ||
| 17 | |||
| 18 | use namespace::clean; | ||
| 19 | |||
| 20 | use CXC::Gnuplot::V1::Types -lexical, 'is_Num', 'is_NonEmptyStr'; | ||
| 21 | use CXC::Gnuplot::V1::Util -lexical, 'maybe_quote', 'pvalidate', 'to_hash_r', 'render_opts'; | ||
| 22 | |||
| 23 | my sub croak { | ||
| 24 | require Carp; | ||
| 25 | goto \&Carp::croak; | ||
| 26 | } | ||
| 27 | |||
| 28 | |||
| 29 | #<<< notidy | ||
| 30 | field $text :param :reader = undef; | ||
| 31 | field $offset :param :reader = undef; | ||
| 32 | field $font :param :reader = undef; | ||
| 33 | field $textcolor :param :reader = undef; | ||
| 34 | field $enhanced :param :reader = undef; | ||
| 35 | field $rotate :param :reader = undef; | ||
| 36 | #>>> | ||
| 37 | |||
| 38 | |||
| 39 | |||
| 40 | |||
| 41 | |||
| 42 | |||
| 43 | |||
| 44 | |||
| 45 | |||
| 46 | |||
| 47 | |||
| 48 | |||
| 49 | |||
| 50 | |||
| 51 | |||
| 52 | |||
| 53 | |||
| 54 | |||
| 55 | |||
| 56 | |||
| 57 | |||
| 58 | ADJUST { | ||
| 59 | |||
| 60 | pvalidate( offset => CoordOffset3D => \$offset ); | ||
| 61 | pvalidate( font => Font => \$font ); | ||
| 62 | |||
| 63 | pvalidate( textcolor => ColorSpec => \$textcolor ); | ||
| 64 | |||
| 65 | defined $enhanced | ||
| 66 | and $enhanced = !!$enhanced; | ||
| 67 | |||
| 68 | defined $rotate | ||
| 69 | and $rotate ne 'norotate' | ||
| 70 | and $rotate ne 'parallel' | ||
| 71 | and !( is_bool( $rotate ) && !$rotate ) | ||
| 72 | and !is_Num( $rotate ) | ||
| 73 | and | ||
| 74 | croak( '"rotate" must be a float or one of "parallel", "norotate", or the false boolean value' ); | ||
| 75 | |||
| 76 | } | ||
| 77 | |||
| 78 | |||
| 79 | |||
| 80 | |||
| 81 | |||
| 82 | |||
| 83 | |||
| 84 | |||
| 85 | |||
| 86 | |||
| 87 | |||
| 88 | |||
| 89 | |||
| 90 | |||
| 91 | |||
| 92 | method BUILDARGS : common (@args ) { | ||
| 93 | return ( text => $args[0] ) if @args == 1 && !is_ref( $args[0] ); | ||
| 94 | return $class->SUPER::BUILDARGS( @args ); | ||
| 95 | } | ||
| 96 | |||
| 97 | |||
| 98 | |||
| 99 | |||
| 100 | |||
| 101 | |||
| 102 | |||
| 103 | |||
| 104 | method to_hash { | ||
| 105 | to_hash_r( { | ||
| 106 | ( defined $text ? ( text => $text ) : () ), | ||
| 107 | ( defined $offset ? ( offset => $offset ) : () ), | ||
| 108 | ( defined $font ? ( font => $font ) : () ), | ||
| 109 | ( defined $textcolor ? ( textcolor => $textcolor ) : () ), | ||
| 110 | ( defined $enhanced ? ( enhanced => $enhanced ) : () ), | ||
| 111 | ( defined $rotate ? ( rotate => $rotate ) : () ), | ||
| 112 | } ); | ||
| 113 | } | ||
| 114 | |||
| 115 | |||
| 116 | |||
| 117 | |||
| 118 | |||
| 119 | method opts { | ||
| 120 | my @opts; | ||
| 121 | |||
| 122 | defined $text | ||
| 123 | and push @opts, maybe_quote( $text ); | ||
| 124 | |||
| 125 | push @opts, render_opts( offset => $offset ); | ||
| 126 | push @opts, render_opts( font => $font ); | ||
| 127 | |||
| 128 | push @opts, render_opts( textcolor => $textcolor ); | ||
| 129 | |||
| 130 | defined $enhanced | ||
| 131 | and push @opts, ( $enhanced ? 'enhanced' : 'noenhanced' ); | ||
| 132 | |||
| 133 | defined $rotate | ||
| 134 | and push @opts, | ||
| 135 | is_Num( $rotate ) ? [ 'rotate by' => $rotate ] | ||
| 136 | : $rotate eq 'parallel' ? [ rotate => 'parallel' ] | ||
| 137 | : 'norotate'; | ||
| 138 | |||
| 139 | return @opts; | ||
| 140 | } | ||
| 141 | |||
| 142 | |||
| 143 | 1; | ||
| 144 | |||
| 145 | # | ||
| 146 | # This file is part of CXC-Gnuplot | ||
| 147 | # | ||
| 148 | # This software is Copyright (c) 2024 by Smithsonian Astrophysical Observatory. | ||
| 149 | # | ||
| 150 | # This is free software, licensed under: | ||
| 151 | # | ||
| 152 | # The GNU General Public License, Version 3, June 2007 | ||
| 153 | # | ||
| 154 | |||
| 155 | __END__ | ||