svn-gvsig-desktop / branches / v2_0_0_prep / extensions / extExpressionField / src / com / iver / cit / gvsig / project / documents / table / operators / ToDegrees.java @ 27752
History | View | Annotate | Download (1.6 KB)
1 | 27752 | vcaballero | package com.iver.cit.gvsig.project.documents.table.operators; |
---|---|---|---|
2 | |||
3 | import org.apache.bsf.BSFException; |
||
4 | import org.apache.bsf.BSFManager; |
||
5 | |||
6 | import com.iver.andami.PluginServices; |
||
7 | import com.iver.cit.gvsig.ExpressionFieldExtension; |
||
8 | import com.iver.cit.gvsig.project.documents.table.AbstractOperator; |
||
9 | import com.iver.cit.gvsig.project.documents.table.IOperator; |
||
10 | |||
11 | /**
|
||
12 | * @author Vicente Caballero Navarro
|
||
13 | */
|
||
14 | public class ToDegrees extends AbstractOperator{ |
||
15 | |||
16 | public String addText(String s) { |
||
17 | return toString()+"("+s+")"; |
||
18 | } |
||
19 | public String toString() { |
||
20 | return "toDegrees"; |
||
21 | } |
||
22 | public void eval(BSFManager interpreter) throws BSFException { |
||
23 | // interpreter.eval(ExpressionFieldExtension.BEANSHELL,null,-1,-1,"double toDegrees(double value){return java.lang.Math.toDegrees(value);};");
|
||
24 | interpreter.exec(ExpressionFieldExtension.JYTHON,null,-1,-1,"def toDegrees(value):\n" + |
||
25 | " import java.lang.Math\n" +
|
||
26 | " return java.lang.Math.toDegrees(value)");
|
||
27 | } |
||
28 | public boolean isEnable() { |
||
29 | return (getType()==IOperator.NUMBER);
|
||
30 | } |
||
31 | public String getDescription() { |
||
32 | return PluginServices.getText(this, "parameter") + ": " + |
||
33 | PluginServices.getText(this, "double_value") + "\n" + |
||
34 | PluginServices.getText(this, "returns") + ": " + |
||
35 | PluginServices.getText(this, "double_value") + "\n" + |
||
36 | PluginServices.getText(this, "description") + ": " + |
||
37 | "Converts an angle measured in radians to an approximately equivalent angle measured in degrees.\n" +
|
||
38 | "The conversion from radians to degrees is generally inexact; users should not expect cos(toRadians(90.0)) to exactly equal 0.0.";
|
||
39 | } |
||
40 | } |