Sign in or register
for additional privileges

Border Codes

Mark Marino, Author

You appear to be using an older verion of Internet Explorer. For the best experience please upgrade your IE version or switch to a another web browser.

The Code

DowsingCompass.java

Annotations

/*  WalkingtoolsGpx: XML, APIs, and Apps for Walking Artists
    Copyright (C) 2007-2012 Walkingtoools project/B.A.N.G Lab UCSD

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU Affero General Public License as
    published by the Free Software Foundation, either version 3 of the
    License, or (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU Affero General Public License for more details.

    You should have received a copy of the GNU Affero General Public License
    along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

package edu.ucsd.calit2.TransBorderTool;

import java.io.IOException;
import javax.microedition.location.Coordinates;
import javax.microedition.lcdui.Image;

/**
 * The TBCoordinates class extends javax.microedition.location.Coordinates
 * to include various MetaData
 * @author Brett Stalbaum and Jason Najarro
 * @version 0.5.5
 */
public class TBCoordinates extends Coordinates {

    public final int WATER = 0;
    public final int BEACON = 1;
    public final int CITY = 2;
    private String name = "";
    private String type = "";

    public TBCoordinates(double latitude, double longitude, float altitude, String name, String type) {
        super(latitude, longitude, altitude);
        this.name = name;
        this.type = type;
    }

    public TBCoordinates() {
        super(0, 0, 0);
        name = "";
        type = "";
    }

    // Convert Coordinates to TBCoordinates
    //
    /**
     * @param c
     * @return
     */
    public static TBCoordinates toMetaCoords(Coordinates c, String name, String type) {
        TBCoordinates mc = new TBCoordinates(c.getLatitude(), c.getLongitude(), c.getAltitude(), name, type);
        return mc;
    }

    // Convert Coordinates to TBCoordinates
    //
    /**
     * @param c
     * @return
     */
    public static TBCoordinates toMetaCoords(Coordinates c) {
        TBCoordinates mc = toMetaCoords(c, "", "");
        return mc;
    }

    public void setName(String n) {
        name = n;
    }

    /** Set TBCoordinates type
     * e.g water station, safety beacon, etc.
     */
    public void setType(String t) {
        type = t;
    }

    public String getName() {
        return name;
    }

    public String getType() {
        return type;
    }

    /** Returns image pertaining to MetaCoordinate type
     */
    public Image getIcon() {
        Image icon = null;
        try {
            //System.out.println(this.getType());
            if (this.getType().toLowerCase().endsWith("water")) { // matching "Water", "Drinking Water", "N Water...."
                icon = Image.createImage("/img/water_icon_sm.png");
            } else if (this.getType().equalsIgnoreCase("beacon")) {
                icon = Image.createImage("/img/beacon_icon_sm.png");
            } else if (this.getType().equalsIgnoreCase("city")) {
                icon = Image.createImage("/img/generic_icon_sm.png");
            } else {
                icon = Image.createImage("/img/generic_icon_sm.png");
            }
        } catch (IOException ioe) {
            System.err.println(ioe);
        }
        return icon;
    }
}

View Page Details



To read through computer source code is to cross a border.
Scroll down to see all annotations. 

Transborder Immigrant Tool Files
                  (from the Sourceforge)
TBMidlet.java



path
Poetry
politics
performance

Comment on this page
 

Discussion of "The Code"

Add your voice to this discussion.

Checking your signed in status ...

Previous page on path Crossing the Code, page 7 of 7 Path end, return home