Package org.geotools.xml

Examples of org.geotools.xml.Node


            //ok
        }
    }

    public void testMultiCoord() throws Exception {
        Node node = createNode(box, new ElementInstance[] { coord1, coord2, coord3 },
                new Object[] {
                    createCoordinateSequence(new Coordinate(1, 2)),
                    createCoordinateSequence(new Coordinate(3, 4)),
                    createCoordinateSequence(new Coordinate(5, 6))
                }, null, null);
View Full Code Here


            //ok
        }
    }

    public void testTwoCoordinates() throws Exception {
        Node node = createNode(box, new ElementInstance[] { coords },
                new Object[] {
                    createCoordinateSequence(
                        new Coordinate[] { new Coordinate(1, 2), new Coordinate(3, 4) })
                }, null, null);
View Full Code Here

        assertEquals(e.getMaxX(), 3d, 0d);
        assertEquals(e.getMaxY(), 4d, 0d);
    }

    public void testSingleCoordinates() throws Exception {
        Node node = createNode(box, new ElementInstance[] { coords },
                new Object[] { createCoordinateSequence(new Coordinate(1, 2)) }, null, null);

        GMLBoxTypeBinding s = (GMLBoxTypeBinding) getBinding(GML.BOXTYPE);

        try {
View Full Code Here

            //ok
        }
    }

    public void testMultiCoordinates() throws Exception {
        Node node = createNode(box, new ElementInstance[] { coords },
                new Object[] {
                    createCoordinateSequence(
                        new Coordinate[] {
                            new Coordinate(1, 2), new Coordinate(3, 4), new Coordinate(5, 6)
                        })
View Full Code Here

    public void testWithGeometry() throws Exception {
        Point p1 = new GeometryFactory().createPoint(new Coordinate(0, 0));
        Point p2 = new GeometryFactory().createPoint(new Coordinate(1, 1));

        Node node = createNode(association, new ElementInstance[] { geometry },
                new Object[] {
                    new GeometryFactory().createGeometryCollection(new Geometry[] { p1, p2 })
                }, null, null);

        GMLGeometryAssociationTypeBinding s = (GMLGeometryAssociationTypeBinding) getBinding(GML.GEOMETRYASSOCIATIONTYPE);
View Full Code Here

        if (!coordinates.isEmpty() && (coordinates.size() < 4)) {
            throw new RuntimeException("LinearRing must have at least 4 coordinates");
        }

        if (!coordinates.isEmpty()) {
            Node cnode = (Node) coordinates.get(0);
            CoordinateSequence seq = (CoordinateSequence) cnode.getValue();
            int dimension = GMLUtil.getDimension(seq);

            CoordinateSequence lineSeq = csFactory.create(coordinates.size(), dimension);

            for (int i = 0; i < coordinates.size(); i++) {
                cnode = (Node) coordinates.get(i);
                seq = (CoordinateSequence) cnode.getValue();

                for (int j = 0; j < dimension; j++) {
                    lineSeq.setOrdinate(i, j, seq.getOrdinate(0, j));
                }
            }

            return gFactory.createLinearRing(lineSeq);
        }

        if (node.getChild("coordinates") != null) {
            Node cnode = (Node) node.getChild("coordinates");
            CoordinateSequence lineSeq = (CoordinateSequence) cnode.getValue();

            return gFactory.createLinearRing(lineSeq);
        }

        throw new RuntimeException("Could not find coordinates to build linestring");
View Full Code Here

            // TODO: come up with something a bit more concrete
            if ( name == null ) {
                name = "";
            }
           
          Node srsNode = node.getChild(Envelope.class).getAttribute("srsName");
            String srs = (srsNode != null) ? srsNode.getValue().toString() : null;

            if ((srs == null) && (crs != null)) {
                srs = GML2EncodingUtils.crs(crs);
            }         
           
View Full Code Here

    public Object parse(ElementInstance instance, Node node, Object value)
        throws Exception {
        Expression[] args = new Expression[node.getChildren().size()];

        for (int i = 0; i < node.getChildren().size(); i++) {
            Node child = (Node) node.getChildren().get(i);
            args[i] = (Expression) child.getValue();
        }

        String name = (String) node.getAttribute("name").getValue();

        return factory.function(name, args);
View Full Code Here

        return String.class;
    }

    @Override
    public Object parse(ElementInstance instance, Node node, Object value) throws Exception {
        Node parent = node.getParent();
        if (parent != null) {
            String parentElementName = parent.getComponent().getName();
            if (FOLDER.equals(parentElementName)) {
                Folder folder = folderStack.peek();
                if (folder != null) {
                    folder.setName(value.toString());
                }
View Full Code Here

     *
     * @param node
     * @return
     */
    public static int dimensions(Node node) {
        Node current = node;
        while (current != null) {
            Node dimensions = current.getAttribute("srsDimension");
            if (dimensions != null) {
                return ((Number) dimensions.getValue()).intValue();
            }
            current = current.getParent();
        }

        return 2;
View Full Code Here

TOP

Related Classes of org.geotools.xml.Node

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.