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