Package com.impetus.kundera.gis.geometry

Examples of com.impetus.kundera.gis.geometry.Point


                        try
                        {
                            double x = Double.parseDouble(xObj.toString());
                            double y = Double.parseDouble(yObj.toString());

                            Point point = new Point(x, y);
                            PropertyAccessorHelper.set(entityObject, (Field) column.getJavaMember(), point);
                        }
                        catch (NumberFormatException e)
                        {
                            log.error(
View Full Code Here


                    }
                    dbObj.put(((AbstractAttribute) column).getJPAColumnName(), basicDBList);
                    break;
                case POINT:

                    Point p = (Point) valueObject;
                    double[] coordinate = new double[] { p.getX(), p.getY() };
                    dbObj.put(((AbstractAttribute) column).getJPAColumnName(), coordinate);
                    break;
                case ENUM:
                case PRIMITIVE:
                    dbObj.put(((AbstractAttribute) column).getJPAColumnName(),
View Full Code Here

        return persons;
    }

    public List<Person> findNear(double x, double y, double maxDistance, SurfaceType surfaceType)
    {
        Point point = new Point(x, y);
        point.setSurfaceType(surfaceType);

        Query q = em
                .createQuery("Select p from Person p where p.currentLocation > :point AND p.currentLocation < :maxDistance");
        q.setParameter("point", point);
        q.setParameter("maxDistance", maxDistance);
View Full Code Here

            double y = Math.floor(i / 10);

            Person person = new Person();
            person.setPersonId(i + 1);
            person.setName("Amresh_" + (i + 1));
            person.setCurrentLocation(new Point(x, y));

            Vehicle vehicle = new Vehicle();
            vehicle.setCurrentLocation(new Point(x + 1.0, y + 1.0));
            vehicle.setPreviousLocation(new Point(x + 2.0, y + 2.0));

            person.setVehicle(vehicle);

            dao.addPerson(person);
        }
View Full Code Here

        Assert.assertNotNull(person);
        Assert.assertEquals(4, person.getPersonId());
        Assert.assertEquals("Amresh_4", person.getName());

        Point currentLocation = person.getCurrentLocation();
        Assert.assertNotNull(currentLocation);
        Assert.assertEquals(3.0, currentLocation.getX());
        Assert.assertEquals(0.0, currentLocation.getY());

        Vehicle vehicleLocation = person.getVehicle();
        Assert.assertNotNull(vehicleLocation);
        Assert.assertNotNull(vehicleLocation.getCurrentLocation());
        Assert.assertEquals(4.0, vehicleLocation.getCurrentLocation().getX());
View Full Code Here

        Assert.assertNotNull(person);
        Assert.assertEquals(4, person.getPersonId());
        Assert.assertEquals("Amresh_4", person.getName());

        person.setCurrentLocation(new Point(9.3, 5.8));

        Vehicle vehicle = person.getVehicle();
        vehicle.setCurrentLocation(new Point(5.67, 11.59));
        vehicle.setPreviousLocation(new Point(15.67, 21.59));

        person.setVehicle(vehicle);

        dao.mergePerson(person);
        dao.closeEntityManager();
        dao.createEntityManager();

        person = dao.findPerson(4);

        Assert.assertNotNull(person);
        Assert.assertEquals(4, person.getPersonId());
        Assert.assertEquals("Amresh_4", person.getName());
        Point currentLocation = person.getCurrentLocation();
        Assert.assertNotNull(currentLocation);
        Assert.assertEquals(9.3, currentLocation.getX());
        Assert.assertEquals(5.8, currentLocation.getY());

        vehicle = person.getVehicle();
        Assert.assertNotNull(vehicle);
        Assert.assertNotNull(vehicle.getCurrentLocation());
        Assert.assertEquals(5.67, vehicle.getCurrentLocation().getX());
View Full Code Here

            q = new BasicDBObject();

        // Set point in query which is involved in near search
        if (shape != null && shape.getClass().isAssignableFrom(Point.class))
        {
            Point point = (Point) shape;
            BasicDBObject filter = (BasicDBObject) q.get(geolocationColumnName);

            if (filter == null)
                filter = new BasicDBObject();

            if (point.getSurfaceType().equals(SurfaceType.SPHERICAL))
            {
                filter.put("$nearSphere", new double[] { point.getX(), point.getY() });
            }
            else
            {
                filter.put("$near", new double[] { point.getX(), point.getY() });
            }

            q.put(geolocationColumnName, filter);
        }
View Full Code Here

   
    @Override
    public Point fromBytes(Class targetClass, byte[] b)
    {
        ObjectInputStream ois;
        Point o;
        try
        {
            ois = new ObjectInputStream(new ByteArrayInputStream(b));
            o = (Point) ois.readObject();
            ois.close();
View Full Code Here

            return null;

        WKTReader reader = new WKTReader();
        try
        {
            return new Point((com.vividsolutions.jts.geom.Point) reader.read(s));
        }
        catch (ParseException e)
        {
            log.error("Parse exception, Caused by {}.", e);
            throw new PropertyAccessException(e);
View Full Code Here

    public Point getCopy(Object object)
    {
        if (object == null)
            return null;

        Point p = (Point) object;
        return new Point(p.getX(), p.getY());
    }
View Full Code Here

TOP

Related Classes of com.impetus.kundera.gis.geometry.Point

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.