package de.i3mainz.chronontlogy.json;

import org.json.simple.JSONObject;

/**
 * JSONObject to store gazetter search results
 *
 * @author Florian Thiery
 */
public class GGeoJSONObject extends JSONObject {

    public GGeoJSONObject() {
        super();
        super.put("type", "Feature");
        super.put("geometry", new JSONObject());
        super.put("properties", new JSONObject());
    }

    /**
     * set GeoJSON type
     * @param type 
     */
    public void setType(String type) {
        super.remove("type");
        super.put("type", type);
    }
    
    /**
     * get type
     * @return type string
     */
    public String getType() {
        return (String) super.get("type");
    }

    /**
     * set GeoJSON geometry
     * @param geometry 
     */
    public void setGeometry(JSONObject geometry) {
        super.remove("geometry");
        super.put("geometry", geometry);
    }
    
    /**
     * get geometry
     * @return geometry json object
     */
    public JSONObject getGeometry() {
        return (JSONObject) super.get("geometry");
    }

    /**
     * set GeoJSON properties
     * @param url
     * @param gazetteerid
     * @param type
     * @param names 
     */
    public void setProperties(String url, String gazetteerid, String type, NamesJSONObject names) {
        JSONObject properties = new JSONObject();
        super.remove("properties");
        properties.put("@id", url);
        properties.put("gazetteerid", gazetteerid);
        properties.put("type", type);
        properties.put("names", names);
        super.put("properties", properties);
    }
    
    /**
     * get properties
     * @return properties json object
     */
    public JSONObject getProperties() {
        return (JSONObject) super.get("properties");
    }

}

@@ -398,320 +398,8 @@
  %7D%0A%0A
-    /**%0A     * set GeoJSON type%0A     * @param type %0A     */%0A    public void setType(String type) %7B%0A        super.remove(%22type%22);%0A        super.put(%22type%22, type);%0A    %7D%0A    %0A    /**%0A     * get type%0A     * @return type string%0A     */%0A    public String getType() %7B%0A        return (String) super.get(%22type%22);%0A    %7D%0A%0A
     

remove set type from GGeoJSONObject