Package org.geotools.xml

Examples of org.geotools.xml.Node


        assertEquals(((Point) gc.getGeometryN(1)).getX(), 1d, 0d);
        assertEquals(((Point) gc.getGeometryN(1)).getY(), 1d, 0d);
    }

    public void testHeterogeneous() throws Exception {
        Node node = createNode(gcol, new ElementInstance[] { point1, point2, line1, ring1, poly1 },
                new Object[] {
                    gf.createPoint(new Coordinate(0, 0)), gf.createPoint(new Coordinate(1, 1)),
                    gf.createLineString(
                        new Coordinate[] { new Coordinate(0, 0), new Coordinate(1, 1) }),
                    gf.createLinearRing(
View Full Code Here


        super.setUp();
        nul = createElement(GML.NAMESPACE, "myNull", GML.NULLTYPE, null);
    }

    public void testAllowable() throws Exception {
        Node node = createNode(nul, null, null, null, null);

        GMLNullTypeBinding s = (GMLNullTypeBinding) getBinding(GML.NULLTYPE);

        assertEquals("inapplicable", s.parse(nul, "inapplicable"));
        assertEquals("unknown", s.parse(nul, "unknown"));
View Full Code Here

        association = createElement(GML.NAMESPACE, "myAssociation", GML.LINESTRINGMEMBERTYPE, null);
        geometry = createElement(GML.NAMESPACE, "myGeometry", GML.LINESTRINGTYPE, null);
    }

    public void testWithGeometry() throws Exception {
        Node node = createNode(association, new ElementInstance[] { geometry },
                new Object[] {
                    new GeometryFactory().createLineString(
                        new Coordinate[] { new Coordinate(0, 0), new Coordinate(1, 1) })
                }, null, null);
        GMLGeometryAssociationTypeBinding s1 = (GMLGeometryAssociationTypeBinding) getBinding(GML.GEOMETRYASSOCIATIONTYPE);
View Full Code Here

                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);
        GMLGeometryPropertyTypeBinding s1 = (GMLGeometryPropertyTypeBinding) getBinding(GML.GEOMETRYPROPERTYTYPE);
        Geometry p = (Geometry) s1.parse(association, node, s.parse(association, node, null));
        assertNotNull(p);
View Full Code Here

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

    public void test() throws Exception {
        Node node = createNode(mp, new ElementInstance[] { point1, point2 },
                new Object[] {
                    new GeometryFactory().createPoint(new Coordinate(0, 0)),
                    new GeometryFactory().createPoint(new Coordinate(1, 1))
                }, null, null);
View Full Code Here

        association = createElement(GML.NAMESPACE, "myAssociation", GML.POLYGONMEMBERTYPE, null);
        geometry = createElement(GML.NAMESPACE, "myGeometry", 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

    //    Feature f1 = (Feature) s.parse(featureAssociation,node,null);
    //    assertNotNull(f1);
    //    assertEquals(f1,f);
    //  }
    public void testWithoutFeature() throws Exception {
        Node node = createNode(featureAssociation, null, null, null, null);

        GMLFeatureAssociationTypeBinding s = (GMLFeatureAssociationTypeBinding) getBinding(GML.FEATUREASSOCIATIONTYPE);

        try {
            assertNull(s.parse(featureAssociation, node, null));
View Full Code Here

    public Object parse(ElementInstance instance, Node node, Object value)
        throws Exception {
        List coordinates = node.getChildren("coord");

        if (!coordinates.isEmpty() && (coordinates.size() == 2)) {
            Node n1 = (Node) coordinates.get(0);
            Node n2 = (Node) coordinates.get(1);
            Coordinate c1 = (Coordinate) n1.getValue();
            Coordinate c2 = (Coordinate) n2.getValue();

            return new Envelope(c1.x, c2.x, c1.y, c2.y);
        }

        if (!coordinates.isEmpty()) {
View Full Code Here

        coord3 = createElement(GML.NAMESPACE, "coord", GML.COORDTYPE, null);
        coords = createElement(GML.NAMESPACE, "coordinates", GML.COORDINATESTYPE, null);
    }

    public void testTwoCoord() throws Exception {
        Node node = createNode(box, new ElementInstance[] { coord1, coord2 },
                new Object[] { new Coordinate(1, 2), new Coordinate(3, 4) }, null, null);

        GMLBoxTypeBinding s = (GMLBoxTypeBinding) getBinding(GML.BOXTYPE);
        Envelope e = (Envelope) s.parse(box, node, null);
        assertNotNull(e);
View Full Code Here

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

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

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

        try {
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.