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 / STPointNFunction.java @ 43521
History | View | Annotate | Download (835 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.primitive.OrientablePrimitive; |
||
8 | import org.gvsig.fmap.geom.primitive.Point; |
||
9 | 43512 | jjdelcerro | |
10 | 43518 | jjdelcerro | public class STPointNFunction extends AbstractFunction { |
11 | 43512 | jjdelcerro | |
12 | 43518 | jjdelcerro | public STPointNFunction() {
|
13 | super("OGC", "ST_PointN", 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 OrientablePrimitive ) { |
||
20 | Point n = ((OrientablePrimitive) geom).getVertex(getInt(args, 1)); |
||
21 | return n;
|
||
22 | } |
||
23 | return null; |
||
24 | 43512 | jjdelcerro | } |
25 | |||
26 | } |