svn-gvsig-desktop / trunk / org.gvsig.desktop / org.gvsig.desktop.library / org.gvsig.expressionevaluator / org.gvsig.expressionevaluator.lib / org.gvsig.expressionevaluator.lib.impl / src / main / java / org / gvsig / expressionevaluator / impl / function / spatial / STGeometryNFunction.java @ 44006
History | View | Annotate | Download (825 Bytes)
1 | 43512 | jjdelcerro | package org.gvsig.expressionevaluator.impl.function.spatial; |
---|---|---|---|
2 | |||
3 | import org.apache.commons.lang3.Range; |
||
4 | 43521 | jjdelcerro | import org.gvsig.expressionevaluator.Interpreter; |
5 | 43512 | jjdelcerro | import org.gvsig.expressionevaluator.spi.AbstractFunction; |
6 | 43518 | jjdelcerro | import org.gvsig.fmap.geom.Geometry; |
7 | import org.gvsig.fmap.geom.aggregate.Aggregate; |
||
8 | import org.gvsig.fmap.geom.primitive.Primitive; |
||
9 | 43512 | jjdelcerro | |
10 | 43518 | jjdelcerro | public class STGeometryNFunction extends AbstractFunction { |
11 | 43512 | jjdelcerro | |
12 | 43518 | jjdelcerro | public STGeometryNFunction() {
|
13 | super("OGC", "ST_GeometryN", Range.is(2)); |
||
14 | 43512 | jjdelcerro | } |
15 | |||
16 | @Override
|
||
17 | 43521 | jjdelcerro | public Object call(Interpreter interpreter, Object[] args) throws Exception { |
18 | 43518 | jjdelcerro | Geometry geom = getGeom(args, 0);
|
19 | if( geom instanceof Aggregate ) { |
||
20 | Primitive r = ((Aggregate) geom).getPrimitiveAt(getInt(args, 1));
|
||
21 | return r;
|
||
22 | } |
||
23 | return null; |
||
24 | 43512 | jjdelcerro | } |
25 | |||
26 | } |