Package com.vividsolutions.jts.geom

Examples of com.vividsolutions.jts.geom.CoordinateSequence


                return null;
            }

            final List<Long> ids = Lists.transform(nodes, NODELIST_TO_ID_LIST);

            CoordinateSequence coordinates = pointCache.get(ids);
            return GEOMF.createLineString(coordinates);
        }
View Full Code Here


            }

            final List<Long> ids = Lists.transform(nodes, NODELIST_TO_ID_LIST);

            try {
                CoordinateSequence coordinates = pointCache.get(ids);
                return GEOMF.createLineString(coordinates);
            } catch (IllegalArgumentException e) {
                unableToProcessCount++;
                return null;
            }
View Full Code Here

        Geometry geom;
        if ((typeAndMasks & POINT) == POINT) {
            geom = GEOMFAC.createPoint(EncodingSequenceFilter.readCoordinate(in));
        } else if ((typeAndMasks & LINESTRING) == LINESTRING) {
            CoordinateSequence cs = EncodingSequenceFilter.read(in);
            geom = GEOMFAC.createLineString(cs);
        } else {
            throw new UnsupportedOperationException();
        }
        return geom;
View Full Code Here

        }

        public static CoordinateSequence read(DataInput in) throws IOException {
            final int len = readUnsignedVarInt(in);

            CoordinateSequence cs = GEOMFAC.getCoordinateSequenceFactory().create(len, 2);
            for (int i = 0; i < len; i++) {
                cs.setOrdinate(i, 0, toDoublePrecision(readSignedVarInt(in)));
                cs.setOrdinate(i, 1, toDoublePrecision(readSignedVarInt(in)));
            }
            return cs;
        }
View Full Code Here

            }
            return cs;
        }

        public static CoordinateSequence readCoordinate(DataInput in) throws IOException {
            CoordinateSequence cs = GEOMFAC.getCoordinateSequenceFactory().create(1, 2);

            cs.setOrdinate(0, 0, toDoublePrecision(readSignedVarInt(in)));
            cs.setOrdinate(0, 1, toDoublePrecision(readSignedVarInt(in)));

            return cs;
        }
View Full Code Here

        cache.get(null);
    }

    @Test
    public void testGetEmpty() {
        CoordinateSequence coords = cache.get(ImmutableList.<Long> of());
        assertNotNull(coords);
        assertEquals(0, coords.size());
    }
View Full Code Here

    public void testGet() {
        cache.put(3L, coord(3, 3));
        cache.put(2L, coord(2, 2));
        cache.put(1L, coord(1, 1));
        List<Long> ids = ImmutableList.<Long> of(1L, 2L, 3L);
        CoordinateSequence sequence = cache.get(ids);
        assertNotNull(sequence);
        assertEquals(3, sequence.size());
        assertEquals(1D, sequence.getOrdinate(0, 0), 1E-9);
        assertEquals(1D, sequence.getOrdinate(0, 1), 1E-9);
        assertEquals(2D, sequence.getOrdinate(1, 0), 1E-9);
        assertEquals(2D, sequence.getOrdinate(1, 1), 1E-9);
        assertEquals(3D, sequence.getOrdinate(2, 0), 1E-9);
        assertEquals(3D, sequence.getOrdinate(2, 1), 1E-9);
    }
View Full Code Here

        System.err.printf("%,d nodes added in %s\n", numNodes, sw.stop());

        Collections.shuffle(nodeIds);

        sw.reset().start();
        CoordinateSequence sequence = cache.get(nodeIds);
        System.err.printf("requested %,d coordinates in %s\n", nodeIds.size(), sw.stop());
        assertNotNull(sequence);
        assertEquals(nodeIds.size(), sequence.size());
        long approxDbSize = caclDbSize();
        System.err.printf("Approx db size: %,f MB\n\n", ((double) approxDbSize / 1024D / 1024D));
    }
View Full Code Here

    @Override
    public boolean equals(Object other) {
        if (!(other instanceof ReversibleLineStringWrapper))
            return false;
        ReversibleLineStringWrapper that = (ReversibleLineStringWrapper) other;
        CoordinateSequence cs0 = this.ls.getCoordinateSequence();
        CoordinateSequence cs1 = that.ls.getCoordinateSequence();
        if (cs0.equals(cs1))
            return true;
        return matchesBackward(cs0, cs1);
    }
View Full Code Here

        return true;
    }

    @Override
    public int hashCode() {
        CoordinateSequence cs = ls.getCoordinateSequence();
        int maxIdx = cs.size() - 1;
        int x = (int) (cs.getX(0) * 1000000) + (int) (cs.getX(maxIdx) * 1000000);
        int y = (int) (cs.getY(0) * 1000000) + (int) (cs.getY(maxIdx) * 1000000);
        return x + y * 101149 + maxIdx * 7883;
    }
View Full Code Here

TOP

Related Classes of com.vividsolutions.jts.geom.CoordinateSequence

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.