Package org.geotools.xml

Examples of org.geotools.xml.Node


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

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


            //ok
        }
    }

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

    public Object parse(ElementInstance instance, Node node, Object value)
            throws Exception {
        List children = node.getChildren("curveMember");
        List<LineString> components = new ArrayList<>();
        for (Iterator it = children.iterator(); it.hasNext();) {
            Node child = (Node) it.next();
            if (child.getValue() instanceof LineString) {
                LineString ls = (LineString) child.getValue();
                components.add(ls);
            }
        }

        if (components.isEmpty()) {
View Full Code Here

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

    public void test() throws Exception {
        Node node = createNode(ml, new ElementInstance[] { line1, line2 },
                new Object[] {
                    new GeometryFactory().createLineString(
                        new Coordinate[] { new Coordinate(0, 0), new Coordinate(1, 1) }),
                    new GeometryFactory().createLineString(
                        new Coordinate[] { new Coordinate(2, 2), new Coordinate(3, 3) })
View Full Code Here

                GML.LINESTRINGPROPERTYTYPE, null);
        geometry = createElement(GML.NAMESPACE, "myLineString", GML.LINESTRINGTYPE, null);
    }

    public void testWithGeometry() throws Exception {
        Node node = createNode(association, new ElementInstance[] { geometry },
                new Object[] {
                    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

                null);
        geometry = createElement(GML.NAMESPACE, "myGeometry", GML.ABSTRACTGEOMETRYTYPE, 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);
        Geometry g = (Geometry) s.parse(association, node, null);
        assertNotNull(g);
        assertTrue(g instanceof Point);
View Full Code Here

        assertNotNull(g);
        assertTrue(g instanceof Point);
    }

    public void testWithoutGeometry() throws Exception {
        Node node = createNode(association, null, null, null, null);
        GMLGeometryAssociationTypeBinding s = (GMLGeometryAssociationTypeBinding) getBinding(GML.GEOMETRYASSOCIATIONTYPE);

        try {
            s.parse(association, node, null);
        } catch (Exception e) {
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().createMultiPoint(new Point[] { p1, p2 }) },
                null, null);

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

        container.registerComponentInstance(CoordinateArraySequenceFactory.instance());
        container.registerComponentImplementation(GMLCoordTypeBinding.class);
    }

    public void testParse1D() throws Exception {
        Node node = createNode(coordinate, new ElementInstance[] { x },
                new Object[] { new BigDecimal(12.34) }, null, null);

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

        Coordinate c = (Coordinate) strategy.parse(coordinate, node, null);
View Full Code Here

        assertNotNull(c);
        assertEquals(c.x, 12.34, 0d);
    }

    public void testParse2D() throws Exception {
        Node node = createNode(coordinate, new ElementInstance[] { x, y },
                new Object[] { new BigDecimal(12.34), new BigDecimal(56.78) }, null, null);

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

        Coordinate c = (Coordinate) strategy.parse(coordinate, node, 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.