Search in sources :

Example 1 with GXSimpleCollection

use of com.genexus.GXSimpleCollection 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 GXSimpleCollection

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

the class GXMaps method reverseGeocode.

public static GXSimpleCollection<String> reverseGeocode(GXGeospatial coordinate) {
    GXSimpleCollection<String> addresses = new GXSimpleCollection<String>();
    String location = coordinate.getLatitude().toString() + "," + coordinate.getLongitude().toString();
    java.util.Vector listaddr = GXGeolocation.getAddress(location);
    for (Object var : listaddr) {
        addresses.add((String) var);
    }
    return addresses;
}
Also used : java.util(java.util) GXSimpleCollection(com.genexus.GXSimpleCollection) JSONObject(org.json.JSONObject)

Example 3 with GXSimpleCollection

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

the class EnterpriseConnect method getValue.

/*        ---   Get Return Values  ---           */
public void getValue(String parameterName, GXSimpleCollection[] value) {
    if (value.length != 0) {
        GXSimpleCollection col = value[0];
        col.clear();
        JCoTable tbl = function.getTableParameterList().getTable(parameterName);
        JSONArray jCol = new JSONArray();
        try {
            for (int i = 0; i < tbl.getNumRows(); i++) {
                JSONObject jRow = new JSONObject();
                tbl.setRow(i);
                for (JCoField field : tbl) {
                    if (field.getType() == JCoMetaData.TYPE_INT || (field.getType() == JCoMetaData.TYPE_NUM && field.getDecimals() == 0)) {
                        jRow.put(field.getName(), field.getLong());
                    } else if (field.getType() == JCoMetaData.TYPE_INT2 || field.getType() == JCoMetaData.TYPE_INT1 || field.getType() == JCoMetaData.TYPE_BYTE) {
                        jRow.put(field.getName(), field.getInt());
                    } else if (field.getType() == JCoMetaData.TYPE_NUM || field.getType() == JCoMetaData.TYPE_FLOAT || field.getType() == JCoMetaData.TYPE_BCD) {
                        jRow.put(field.getName(), field.getDouble());
                    } else {
                        jRow.put(field.getName(), field.getString());
                    }
                }
                jCol.put(jRow);
            }
            col.FromJSONObject(jCol);
        } catch (JSONException ex) {
            throw new RuntimeException(ex.toString());
        }
    }
}
Also used : JSONObject(json.org.json.JSONObject) JCoTable(com.sap.conn.jco.JCoTable) GXSimpleCollection(com.genexus.GXSimpleCollection) JSONArray(json.org.json.JSONArray) JSONException(json.org.json.JSONException) JCoField(com.sap.conn.jco.JCoField)

Aggregations

GXSimpleCollection (com.genexus.GXSimpleCollection)3 java.util (java.util)2 JSONObject (org.json.JSONObject)2 GXGeospatial (com.genexus.GXGeospatial)1 JCoField (com.sap.conn.jco.JCoField)1 JCoTable (com.sap.conn.jco.JCoTable)1 JSONArray (json.org.json.JSONArray)1 JSONException (json.org.json.JSONException)1 JSONObject (json.org.json.JSONObject)1