Search in sources :

Example 1 with GXGeospatial

use of com.genexus.GXGeospatial in project JavaClasses by genexuslabs.

the class GXMaps method geocodeAddress.

public static GXSimpleCollection<GXGeospatial> geocodeAddress(String address) {
    GXSimpleCollection<GXGeospatial> loclist = new GXSimpleCollection<GXGeospatial>();
    java.util.Vector listPoints = GXGeolocation.getLocation(address);
    for (Object var : listPoints) {
        GXGeospatial gPoint = new GXGeospatial((String) var);
        loclist.add(gPoint);
    }
    return loclist;
}
Also used : java.util(java.util) GXSimpleCollection(com.genexus.GXSimpleCollection) JSONObject(org.json.JSONObject) GXGeospatial(com.genexus.GXGeospatial)

Example 2 with GXGeospatial

use of com.genexus.GXGeospatial in project JavaClasses by genexuslabs.

the class GXMaps method calculateDirections.

public static GXXMLSerializable calculateDirections(GXGeospatial a, GXGeospatial b, String transportType, boolean requestAlternateRoutes) {
    try {
        Class<?> DirectionsParametersSDTClass = Class.forName(DIRECTIONS_PARAMETERS_SDT_CLASS_NAME);
        Object directionsParametersSDT = DirectionsParametersSDTClass.getDeclaredConstructor().newInstance();
        DirectionsParametersSDTClass.getMethod("setgxTv_SdtDirectionsRequestParameters_Sourcelocation", GXGeospatial.class).invoke(directionsParametersSDT, a);
        DirectionsParametersSDTClass.getMethod("setgxTv_SdtDirectionsRequestParameters_Destinationlocation", GXGeospatial.class).invoke(directionsParametersSDT, b);
        DirectionsParametersSDTClass.getMethod("setgxTv_SdtDirectionsRequestParameters_Transporttype", String.class).invoke(directionsParametersSDT, transportType);
        DirectionsParametersSDTClass.getMethod("setgxTv_SdtDirectionsRequestParameters_Requestalternateroutes", Boolean.TYPE).invoke(directionsParametersSDT, requestAlternateRoutes);
        return calculateDirections(directionsParametersSDT);
    } catch (ClassNotFoundException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    } catch (InstantiationException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    } catch (IllegalAccessException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    } catch (IllegalArgumentException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    } catch (InvocationTargetException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    } catch (NoSuchMethodException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    } catch (SecurityException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
    return null;
}
Also used : JSONObject(org.json.JSONObject) InvocationTargetException(java.lang.reflect.InvocationTargetException) GXGeospatial(com.genexus.GXGeospatial)

Example 3 with GXGeospatial

use of com.genexus.GXGeospatial in project JavaClasses by genexuslabs.

the class LocationInfo method FromJSONObject.

public void FromJSONObject(IJsonFormattable obj) {
    JSONObject jObj = (JSONObject) obj;
    this.setDescription(jObj.optString("description"));
    this.setHeading(jObj.optDouble("heading"));
    this.setSpeed(jObj.optDouble("speed"));
    this.setPrecision(jObj.optDouble("precision"));
    // /this.setTime( );
    this.setLocation(new GXGeospatial(jObj.optString("location")));
}
Also used : GXGeospatial(com.genexus.GXGeospatial)

Aggregations

GXGeospatial (com.genexus.GXGeospatial)3 JSONObject (org.json.JSONObject)2 GXSimpleCollection (com.genexus.GXSimpleCollection)1 InvocationTargetException (java.lang.reflect.InvocationTargetException)1 java.util (java.util)1