Package org.geotools.xml

Examples of org.geotools.xml.Node


        assertEquals(lineString.getPointN(1).getX(), 3d, 0);
        assertEquals(lineString.getPointN(1).getY(), 4d, 0);
    }

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

        GMLLineStringTypeBinding s = (GMLLineStringTypeBinding) container.getComponentInstanceOfType(GMLLineStringTypeBinding.class);

        try {
View Full Code Here


            //ok
        }
    }

    public void testCoordMulti() throws Exception {
        Node node = createNode(line, 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

        assertEquals(lineString.getPointN(2).getX(), 5d, 0);
        assertEquals(lineString.getPointN(2).getY(), 6d, 0);
    }

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

        assertEquals(lineString.getPointN(1).getX(), 3d, 0);
        assertEquals(lineString.getPointN(1).getY(), 4d, 0);
    }

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

        GMLLineStringTypeBinding s = (GMLLineStringTypeBinding) container.getComponentInstanceOfType(GMLLineStringTypeBinding.class);
View Full Code Here

            //ok
        }
    }

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

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

    public void testNoInnerRing() throws Exception {
        Node node = createNode(poly, new ElementInstance[] { oring },
                new Object[] {
                    new GeometryFactory().createLinearRing(
                        new Coordinate[] {
                            new Coordinate(1, 2), new Coordinate(3, 4), new Coordinate(5, 6),
                            new Coordinate(1, 2)
View Full Code Here

        assertEquals(p.getExteriorRing().getPointN(3).getX(), 1d, 0d);
        assertEquals(p.getExteriorRing().getPointN(3).getY(), 2d, 0d);
    }

    public void testInnerRing() throws Exception {
        Node node = createNode(poly, new ElementInstance[] { oring, iring },
                new Object[] {
                    new GeometryFactory().createLinearRing(
                        new Coordinate[] {
                            new Coordinate(0, 0), new Coordinate(10, 0), new Coordinate(10, 10),
                            new Coordinate(0, 10), new Coordinate(0, 0)
View Full Code Here

        association = createElement(GML.NAMESPACE, "myPointProperty", GML.POINTPROPERTYTYPE, null);
        geometry = createElement(GML.NAMESPACE, "myPoint", GML.POINTTYPE, null);
    }

    public void testWithGeometry() throws Exception {
        Node node = createNode(association, new ElementInstance[] { geometry },
                new Object[] { new GeometryFactory().createPoint(new Coordinate(0, 0)) }, null, null);
        GMLGeometryAssociationTypeBinding s = (GMLGeometryAssociationTypeBinding) getBinding(GML.GEOMETRYASSOCIATIONTYPE);
        GMLPointPropertyTypeBinding s1 = (GMLPointPropertyTypeBinding) getBinding(GML.POINTPROPERTYTYPE);
        Point p = (Point) s1.parse(association, node, s.parse(association, node, null));
        assertNotNull(p);
View Full Code Here

        if (coordinates.size() == 1) {
            throw new RuntimeException("Linestring must have at least 2 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.createLineString(lineSeq);
        }

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

            return gFactory.createLineString(lineSeq);
        }

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

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

    public void testHomogeneous() throws Exception {
        Node node = createNode(gcol, new ElementInstance[] { point1, point2 },
                new Object[] {
                    gf.createPoint(new Coordinate(0, 0)), gf.createPoint(new Coordinate(1, 1))
                }, null, null);

        GMLGeometryCollectionTypeBinding s = (GMLGeometryCollectionTypeBinding) container
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.