|
1 <?php |
|
2 /** |
|
3 * Zend Framework |
|
4 * |
|
5 * LICENSE |
|
6 * |
|
7 * This source file is subject to the new BSD license that is bundled |
|
8 * with this package in the file LICENSE.txt. |
|
9 * It is also available through the world-wide-web at this URL: |
|
10 * http://framework.zend.com/license/new-bsd |
|
11 * If you did not receive a copy of the license and are unable to |
|
12 * obtain it through the world-wide-web, please send an email |
|
13 * to license@zend.com so we can send you a copy immediately. |
|
14 * |
|
15 * @category Zend |
|
16 * @package Zend_Measure |
|
17 * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) |
|
18 * @license http://framework.zend.com/license/new-bsd New BSD License |
|
19 * @version $Id: Angle.php 20096 2010-01-06 02:05:09Z bkarwin $ |
|
20 */ |
|
21 |
|
22 /** |
|
23 * Implement needed classes |
|
24 */ |
|
25 require_once 'Zend/Measure/Abstract.php'; |
|
26 require_once 'Zend/Locale.php'; |
|
27 |
|
28 /** |
|
29 * Class for handling angle conversions |
|
30 * |
|
31 * @category Zend |
|
32 * @package Zend_Measure |
|
33 * @subpackage Zend_Measure_Angle |
|
34 * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) |
|
35 * @license http://framework.zend.com/license/new-bsd New BSD License |
|
36 */ |
|
37 class Zend_Measure_Angle extends Zend_Measure_Abstract |
|
38 { |
|
39 const STANDARD = 'RADIAN'; |
|
40 |
|
41 const RADIAN = 'RADIAN'; |
|
42 const MIL = 'MIL'; |
|
43 const GRAD = 'GRAD'; |
|
44 const DEGREE = 'DEGREE'; |
|
45 const MINUTE = 'MINUTE'; |
|
46 const SECOND = 'SECOND'; |
|
47 const POINT = 'POINT'; |
|
48 const CIRCLE_16 = 'CIRCLE_16'; |
|
49 const CIRCLE_10 = 'CIRCLE_10'; |
|
50 const CIRCLE_8 = 'CIRCLE_8'; |
|
51 const CIRCLE_6 = 'CIRCLE_6'; |
|
52 const CIRCLE_4 = 'CIRCLE_4'; |
|
53 const CIRCLE_2 = 'CIRCLE_2'; |
|
54 const FULL_CIRCLE = 'FULL_CIRCLE'; |
|
55 |
|
56 /** |
|
57 * Calculations for all angle units |
|
58 * |
|
59 * @var array |
|
60 */ |
|
61 protected $_units = array( |
|
62 'RADIAN' => array('1','rad'), |
|
63 'MIL' => array(array('' => M_PI,'/' => '3200'), 'mil'), |
|
64 'GRAD' => array(array('' => M_PI,'/' => '200'), 'gr'), |
|
65 'DEGREE' => array(array('' => M_PI,'/' => '180'), '°'), |
|
66 'MINUTE' => array(array('' => M_PI,'/' => '10800'), "'"), |
|
67 'SECOND' => array(array('' => M_PI,'/' => '648000'), '"'), |
|
68 'POINT' => array(array('' => M_PI,'/' => '16'), 'pt'), |
|
69 'CIRCLE_16' => array(array('' => M_PI,'/' => '8'), 'per 16 circle'), |
|
70 'CIRCLE_10' => array(array('' => M_PI,'/' => '5'), 'per 10 circle'), |
|
71 'CIRCLE_8' => array(array('' => M_PI,'/' => '4'), 'per 8 circle'), |
|
72 'CIRCLE_6' => array(array('' => M_PI,'/' => '3'), 'per 6 circle'), |
|
73 'CIRCLE_4' => array(array('' => M_PI,'/' => '2'), 'per 4 circle'), |
|
74 'CIRCLE_2' => array(M_PI, 'per 2 circle'), |
|
75 'FULL_CIRCLE' => array(array('' => M_PI,'*' => '2'), 'cir'), |
|
76 'STANDARD' => 'RADIAN' |
|
77 ); |
|
78 } |