root / branches / v2_0_0_prep / extensions / extExpressionField / src / com / iver / cit / gvsig / project / documents / table / operators / Geometry.java @ 27752
History | View | Annotate | Download (1.83 KB)
1 |
package com.iver.cit.gvsig.project.documents.table.operators; |
---|---|
2 |
|
3 |
import org.apache.bsf.BSFException; |
4 |
import org.apache.bsf.BSFManager; |
5 |
import org.gvsig.fmap.dal.feature.Feature; |
6 |
|
7 |
import com.iver.andami.PluginServices; |
8 |
import com.iver.cit.gvsig.ExpressionFieldExtension; |
9 |
import com.iver.cit.gvsig.project.documents.table.GraphicOperator; |
10 |
import com.iver.cit.gvsig.project.documents.table.gui.FeatureContainer; |
11 |
/**
|
12 |
* @author Vicente Caballero Navarro
|
13 |
*/
|
14 |
public class Geometry extends GraphicOperator{ |
15 |
|
16 |
public String addText(String s) { |
17 |
return s.concat(toString()+"()"); |
18 |
} |
19 |
public double process(Feature feature) { |
20 |
return 0; |
21 |
} |
22 |
public org.gvsig.fmap.geom.Geometry getGeometry(FeatureContainer featureContainer) {
|
23 |
// ReadableVectorial adapter = getLayer().getSource();
|
24 |
org.gvsig.fmap.geom.Geometry geom=featureContainer.getFeature().getDefaultGeometry();//adapter.getShape(index.get());
|
25 |
return geom;
|
26 |
} |
27 |
public void eval(BSFManager interpreter) throws BSFException { |
28 |
interpreter.declareBean("jgeometry",this,Geometry.class); |
29 |
// interpreter.eval(ExpressionFieldExtension.BEANSHELL,null,-1,-1,"java.lang.Object geometry(){return geometry.getGeometry(indexRow);};");
|
30 |
interpreter.exec(ExpressionFieldExtension.JYTHON,null,-1,-1,"def geometry():\n" + |
31 |
" return jgeometry.getGeometry(featureContainer)");
|
32 |
} |
33 |
public String toString() { |
34 |
return "geometry"; |
35 |
} |
36 |
public boolean isEnable() { |
37 |
return false; |
38 |
} |
39 |
public String getTooltip(){ |
40 |
return PluginServices.getText(this,"operator")+": "+addText("")+"\n"+getDescription(); |
41 |
} |
42 |
public String getDescription() { |
43 |
return PluginServices.getText(this, "returns") + ": " + |
44 |
PluginServices.getText(this, "numeric_value") + "\n" + |
45 |
PluginServices.getText(this, "description") + ": " + |
46 |
"Returns the geometry of this row.";
|
47 |
} |
48 |
} |