Newer
Older
mountainnavigation / app / src / main / java / de / apps4ics / mountainnavigation / Poi.java
package de.apps4ics.mountainnavigation;

/**
 * Created by Vinz on 06.10.2015.
 */
public class Poi {
    protected long _id;
    protected int _type;
    protected DbGeoPoint gp;
    protected long gpId;

    public Poi() {
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        Poi poi = (Poi) o;

        if (_id != poi._id) return false;
        if (_type != poi._type) return false;
        return true;
    }

    @Override
    public int hashCode() {
        int result = (int) _id;
        result = 31 * result + _type;
        return result;
    }

    public long getGpId(){
        return gpId;
    }

    public DbGeoPoint getGp(){
        return gp;
    }

    public void setGpId(long gpId){
        this.gpId = gpId;
    }

    public void setGp(DbGeoPoint gp){
        this.gp = gp;
        this.gpId = gp.getId();
    }

    public Poi(int _type){
        this._type = _type;
    }

    public Poi(long _id, int _type){
        this._id = _id;
        this._type = _type;
    }

    public Poi(long _id, int _type, DbGeoPoint _gp){
        this(_id, _type);
        if(_gp != null){
            this.gp = _gp;
            this.gpId = _gp.getId();
        }
    }

    public long getId(){
        return _id;
    }

    @Override
    public String toString() {
        return "Poi {" +
                "_id=" + _id +
                ", _type=" + _type +
                '}';
    }

    public int getType(){
        return _type;
    }

}

class Fountain extends Poi {
    int size;
    public Fountain(long _id){
        super(_id, Types.FOUNTAIN);
    }
    public Fountain(){
        super(Types.FOUNTAIN);
    }
    public Fountain(long _id, int size, DbGeoPoint gp){
        super(_id, Types.FOUNTAIN, gp);
        this.size = size;
    }

    public int getSize(){
        return size;
    }
}

//TODO constructors for other classes, see fountain

class Path extends Poi {
    long gp_e_id;
    long length;
    int exposed;
    int diffWet;
    int giddiness;
    int climbing;
    DbGeoPoint end;

    public Path(long _id) {
        super(_id, Types.PATH);
    }
    public Path() {
        super(Types.PATH);
    }
    public Path(long _id, long _length, int exposed, int diff_wet, int giddiness, int climbing, DbGeoPoint start, DbGeoPoint end){
        super(_id, Types.PATH, start);
        this.length = _length;
        this.exposed = exposed;
        this.diffWet = diff_wet;
        this.giddiness = giddiness;
        this.climbing = climbing;
        this.end = end;
        this.gp_e_id = end.getId();
    }

    public long getStartGpId() {
        return gpId;
    }

    public DbGeoPoint getStartGp(){
        return gp;
    }

    public long getEndGpId() {
        return gp_e_id;
    }


    public DbGeoPoint getEndGp(){
        return end;
    }

    public long getLength() {
        return length;
    }

    public int getExposed() {
        return exposed;
    }

    public int getDiffWet() {
        return diffWet;
    }

    public int getGiddiness() {
        return giddiness;
    }

    public int getClimbing() {
        return climbing;
    }
}

class Hut extends Poi {
    int huttype;
    int winterroom;
    String name;

    public Hut(long _id) {
        super(_id, Types.HUT);
    }
    public Hut(){
        super(Types.HUT);
    }
    public Hut(long _id, int hut_type, int winterroom, String name, DbGeoPoint gp){
        super(_id, Types.HUT, gp);
        this.huttype = hut_type;
        this.winterroom = winterroom;
        this.name = name;
    }

    public int getHutType() {
        return huttype;
    }

    public int getWinterRoom() {
        return winterroom;
    }

    public String getName() {
        return name;
    }
}

class Peak extends Poi {
    String name;

    public Peak(long _id) {
        super(_id, Types.PEAK);
    }
    public Peak(){
        super(Types.PEAK);
    }
    public Peak(long _id, String name, DbGeoPoint gp){
        super(_id, Types.PEAK, gp);
        this.name = name;
    }

    public String getName() {
        return name;
    }
}

class BreakPoint extends Poi {
    int stone;
    int bench;
    int table;
    int roofed;

    public BreakPoint(long _id) {
        super(_id, Types.BREAK_POINT);
    }
    public BreakPoint(){
        super(Types.BREAK_POINT);
    }
    public BreakPoint(long _id, int stone, int bench, int table, int roofed, DbGeoPoint gp){
        super(_id, Types.BREAK_POINT, gp);
        this.stone = stone;
        this.bench = bench;
        this.table = table;
        this.roofed = roofed;
    }

    public int getStone() {
        return stone;
    }

    public int getBench() {
        return bench;
    }

    public int getTable() {
        return table;
    }

    public int getRoofed() {
        return roofed;
    }
}

class TrashBin extends Poi {
    public TrashBin(long _id) {
        super(_id, Types.TRASH_BIN);
    }
    public TrashBin(){
        super(Types.TRASH_BIN);
    }
    public TrashBin(long id, DbGeoPoint gp){
        super(id, Types.TRASH_BIN, gp);
    }
}

class Image extends Poi {
    String typeId;
    byte[] image;

    public Image(long _id) {
        super(_id, Types.PIC);
    }
    public Image(){
        super(Types.PIC);
    }
    public Image(long _id, String typeId, byte[] image, DbGeoPoint gp){
        super(_id, Types.PIC, gp);
        this.typeId = typeId;
        this.image = image;
    }

    public String getTypeId(){
        return typeId;
    }

    public byte[] getImage(){
        return image;
    }
}

class CellReception extends Poi {
    int strength;
    String opName;
    String opCountry;
    int roaming;
    String nwType;

    public CellReception(long _id) {
        super(_id, Types.CELL_RECEPTION);
    }
    public CellReception(){
        super(Types.CELL_RECEPTION);
    }
    public CellReception(long _id, int strength, String opName, String opCountry, int roaming, String nwType, DbGeoPoint gp){
        super(_id, Types.CELL_RECEPTION, gp);
        this.strength = strength;
        this.opName = opName;
        this.opCountry = opCountry;
        this.roaming = roaming;
        this.nwType = nwType;
    }

    public int getStrength() {
        return strength;
    }

    public String getOpName() {
        return opName;
    }

    public String getOpCountry() {
        return opCountry;
    }

    public int getRoaming() {
        return roaming;
    }

    public String getNwType() {
        return nwType;
    }
}

class Wifi extends Poi {
    String ssid;
    int levels;

    public Wifi(long _id) {
        super(_id, Types.WIFI);
    }
    public Wifi(){
        super(Types.WIFI);
    }
    public Wifi(long _id, String ssid, int levels, DbGeoPoint gp){
        super(_id, Types.WIFI, gp);
        this.ssid = ssid;
        this.levels = levels;
    }

    public String getSsid() {
        return ssid;
    }

    public int getLevels() {
        return levels;
    }
}

class Lift extends Poi {
    DbGeoPoint end;
    long endGpId;
    String name;

    public Lift(long _id) {
        super(_id, Types.LIFT);
    }
    public Lift(){
        super(Types.LIFT);
    }
    public Lift(long _id, String name, DbGeoPoint start, DbGeoPoint end){
        super(_id, Types.LIFT, start);
        this.name = name;
        this.end = end;
        this.endGpId = end.getId();
    }

    public long getStartGpId() {
        return gpId;
    }

    public DbGeoPoint getStartGp(){
        return gp;
    }

    public long getEndGpId() {
        return endGpId;
    }

    public DbGeoPoint getEndGp(){
        return end;
    }

    public String getName() {
        return name;
    }
}

class DbGeoPoint extends Poi {
    private double lat;
    private double lon;
    private double alt;
    private long _time;
    private String _type_id; //<poi-type>_<poi-id-in-table> => hut_2

    public DbGeoPoint(long _id) {
        super(_id, Types.GP);
    }
    public DbGeoPoint(){
        super(Types.GP);
    }

    public DbGeoPoint(double aLatitude, double aLongitude, double aAltitude) {
        this(aLatitude, aLongitude, aAltitude, System.currentTimeMillis());
    }

    public DbGeoPoint(double aLatitude, double aLongitude, double aAltitude, long _time) {
        this(0, aLatitude, aLongitude, aAltitude, _time, "");
    }

    public DbGeoPoint(long id, double lat, double lon, double alt, long time, String type_id){
        super(id, Types.GP);
        this.lat = lat;
        this.lon = lon;
        this.alt = alt;
        this._time = time;
        this._type_id = type_id;
    }

    public double getLat(){
        return lat;
    }

    public double getLon(){
        return lon;
    }

    public double getAlt(){
        return alt;
    }

    public long getTime(){
        return _time;
    }

    public String getTypeId(){
        return _type_id;
    }

    public void setTypeId(String typeId){
        _type_id = typeId;
    }

    public void setId(long id){
        _id = id;
    }
}