Package org.geotools.xml

Examples of org.geotools.xml.Node


        //round up children that are geometries, since this type is often
        // extended by multi geometries, dont reference members by element name
        List geoms = new ArrayList();

        for (Iterator itr = node.getChildren().iterator(); itr.hasNext();) {
            Node cnode = (Node) itr.next();

            if (cnode.getValue() instanceof Geometry) {
                geoms.add(cnode.getValue());
            }
        }

        GeometryCollection gc = null;
       
View Full Code Here


        container.registerComponentImplementation(GeometryFactory.class);
        container.registerComponentImplementation(GMLPointTypeBinding.class);
    }

    public void testParseCoordinate() throws Exception {
        Node node = createNode(point, new ElementInstance[] { coord },
                new Object[] { new Coordinate(12.34, 56.78) }, null, null);

        GMLPointTypeBinding strategy = (GMLPointTypeBinding) container.getComponentInstanceOfType(GMLPointTypeBinding.class);

        Point p = (Point) strategy.parse(point, node, null);
View Full Code Here

        assertEquals(p.getX(), 12.34, 0d);
        assertEquals(p.getY(), 56.78, 0d);
    }

    public void testParseCoordinates() throws Exception {
        Node node = createNode(point, new ElementInstance[] { coords },
                new Object[] { createCoordinateSequence(new Coordinate(12.34, 56.78)) }, null, null);

        GMLPointTypeBinding strategy = (GMLPointTypeBinding) container.getComponentInstanceOfType(GMLPointTypeBinding.class);

        Point p = (Point) strategy.parse(point, node, null);
View Full Code Here

        assertEquals(p.getX(), 12.34, 0d);
        assertEquals(p.getY(), 56.78, 0d);
    }

    public void testParseMultiCoordinates() throws Exception {
        Node node = createNode(point, new ElementInstance[] { coords },
                new Object[] {
                    createCoordinateSequence(
                        new Coordinate[] { new Coordinate(12.34, 56.78), new Coordinate(9.10, 11.12) })
                }, null, null);
View Full Code Here

        List innerRings = node.getChildren("innerBoundaryIs");
        LinearRing[] holes = new LinearRing[innerRings.size()];

        for (int i = 0; i < innerRings.size(); i++) {
            Node inode = (Node) innerRings.get(i);
            holes[i] = (LinearRing) inode.getValue();
        }

        return gFactory.createPolygon(shell, holes);
    }
View Full Code Here

     * Test method for 'org.geotools.gml2.strategies.GMLCoordinatesTypeBinding.parse(Element, Node[], Node[], Object)'
     */
    public void testParseDefaults() throws Exception {
        coordinates.setText("12.34,56.78 9.10,11.12 13.14,15.16");

        Node node = createNode(coordinates, null, null, null, null);
        GMLCoordinatesTypeBinding strategy = (GMLCoordinatesTypeBinding) container
            .getComponentInstanceOfType(GMLCoordinatesTypeBinding.class);

        CoordinateSequence c = (CoordinateSequence) strategy.parse(coordinates, node, null);
        assertNotNull(c);
View Full Code Here

    }

    public void testParseNonDefaults() throws Exception {
        coordinates.setText("12.34:56.78;9.10:11.12;13.14:15.16");

        Node node = createNode(coordinates, null, null, new AttributeInstance[] { cs, ts },
                new String[] { ":", ";" });

        GMLCoordinatesTypeBinding strategy = (GMLCoordinatesTypeBinding) container
            .getComponentInstanceOfType(GMLCoordinatesTypeBinding.class);
View Full Code Here

     * Data coming with multiple blanks or newlines shouldn't happen, but it does
     */
    public void testParseMultipleBlankCharacters() throws Exception {
        coordinates.setText("\n12.34,56.78\n 9.10,11.12\t\t\n 13.14,15.16\t\n  ");

        Node node = createNode(coordinates, null, null, null, null);
        GMLCoordinatesTypeBinding strategy = (GMLCoordinatesTypeBinding) container
            .getComponentInstanceOfType(GMLCoordinatesTypeBinding.class);

        CoordinateSequence c = (CoordinateSequence) strategy.parse(coordinates, node, null);
        assertNotNull(c);
View Full Code Here

                null);
        geometry = createElement(GML.NAMESPACE, "myPolygon", GML.POLYGONTYPE, null);
    }

    public void testWithGeometry() throws Exception {
        Node node = createNode(association, new ElementInstance[] { geometry },
                new Object[] {
                    new GeometryFactory().createPolygon(new GeometryFactory().createLinearRing(
                            new Coordinate[] {
                                new Coordinate(0, 0), new Coordinate(1, 1), new Coordinate(2, 2),
                                new Coordinate(0, 0),
View Full Code Here

        container.registerComponentImplementation(GeometryFactory.class);
        container.registerComponentImplementation(GMLLineStringTypeBinding.class);
    }

    public void testCoordTwo() throws Exception {
        Node node = createNode(line, new ElementInstance[] { coord1, coord2 },
                new Object[] {
                    createCoordinateSequence(new Coordinate(1, 2)),
                    createCoordinateSequence(new Coordinate(3, 4))
                }, null, null);
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.