root / tags / v2_0_0_Build_2035 / extensions / extExpressionField / src / org / gvsig / expressionfield / project / documents / table / operators / ToRadians.java @ 36300
History | View | Annotate | Download (1.58 KB)
1 | 29628 | jpiera | package org.gvsig.expressionfield.project.documents.table.operators; |
---|---|---|---|
2 | 27752 | vcaballero | |
3 | import org.apache.bsf.BSFException; |
||
4 | import org.apache.bsf.BSFManager; |
||
5 | 29628 | jpiera | import org.gvsig.andami.PluginServices; |
6 | import org.gvsig.expressionfield.ExpressionFieldExtension; |
||
7 | import org.gvsig.expressionfield.project.documents.table.AbstractOperator; |
||
8 | import org.gvsig.expressionfield.project.documents.table.IOperator; |
||
9 | 27752 | vcaballero | |
10 | |||
11 | /**
|
||
12 | * @author Vicente Caballero Navarro
|
||
13 | */
|
||
14 | public class ToRadians extends AbstractOperator{ |
||
15 | |||
16 | public String addText(String s) { |
||
17 | return toString()+"("+s+")"; |
||
18 | } |
||
19 | public String toString() { |
||
20 | return "toRadians"; |
||
21 | } |
||
22 | public void eval(BSFManager interpreter) throws BSFException { |
||
23 | // interpreter.eval(ExpressionFieldExtension.BEANSHELL,null,-1,-1,"double toRadians(double value){return java.lang.Math.toRadians(value);};");
|
||
24 | interpreter.exec(ExpressionFieldExtension.JYTHON,null,-1,-1,"def toRadians(value):\n" + |
||
25 | " import java.lang.Math\n" +
|
||
26 | " return java.lang.Math.toRadians(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, "numeric_value") + "\n" + |
||
34 | PluginServices.getText(this, "returns") + ": " + |
||
35 | PluginServices.getText(this, "numeric_value") + "\n" + |
||
36 | PluginServices.getText(this, "description") + ": " + |
||
37 | "Converts an angle measured in degrees to an approximately equivalent angle measured in radians. The conversion from degrees to radians is generally inexact.";
|
||
38 | } |
||
39 | } |