com.reades.mapthing
Class Node

java.lang.Object
  extended by com.reades.mapthing.Node
All Implemented Interfaces:
Serializable

public class Node
extends Object
implements Serializable

A simple node class that holds references to a position and an identifier. You would usually want to extend this class to do something more clever, but this is also used internally to hold the transformed coordinates within a Polygons/Lines/Points object.

The idea here is that we take our complex geographic coordinates from the data source and turn them into simple objects that are easy to draw in Processing as this will be faster and it will also be simpler to move them around and do things like zoom and pan.

Author:
jereades
See Also:
Link, Serialized Form

Field Summary
 boolean DEBUG
           
 
Constructor Summary
Node(int id, double nx, double ny)
          Create a Node object
Node(int id, double nx, double ny, double nz, double val)
          Create a Node object
Node(int id, double nx, double ny, double nz, double val, String nm)
          Create a Node object
Node(int id, double nx, double ny, double nz, String nm)
          Create a Node object
Node(int id, double nx, double ny, String nm)
          Create a Node object
 
Method Summary
 int getId()
          Get the (preferably) unique identifier
 String getName()
          Get the (preferably) unique name
 double getValue()
          A better way to get a value that is distinct from some z-value such as an altitude.
 float getX()
          The x-position of the node
 float getY()
          The y-position of the node
 float getZ()
          The z-position of the node -- you can overload this as the value of the node if you like since it doesn't have to be a geographical z-axis.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEBUG

public boolean DEBUG
Constructor Detail

Node

public Node(int id,
            double nx,
            double ny)
Create a Node object

Parameters:
id - a (preferably) unique identifier for the node
nx - the x-position of the node (usually in pixels)
ny - the y-position of the node (usually in pixels)

Node

public Node(int id,
            double nx,
            double ny,
            String nm)
Create a Node object

Parameters:
id - a (preferably) unique identifier for the node
nx - the x-position of the node (usually in pixels)
ny - the y-position of the node (usually in pixels)
nm - the name of the node (useful for having labels)

Node

public Node(int id,
            double nx,
            double ny,
            double nz,
            String nm)
Create a Node object

Parameters:
id - a (preferably) unique identifier for the node
nx - the x-position of the node (usually in pixels)
ny - the y-position of the node (usually in pixels)
nz - the z-position of the node (usually in pixels)
nm - the name of the node (useful for having labels)

Node

public Node(int id,
            double nx,
            double ny,
            double nz,
            double val)
Create a Node object

Parameters:
id - a (preferably) unique identifier for the node
nx - the x-position of the node (usually in pixels)
ny - the y-position of the node (usually in pixels)
nz - the z-position of the node (usually in pixels)
val - the value of the node (usually some kind of double)

Node

public Node(int id,
            double nx,
            double ny,
            double nz,
            double val,
            String nm)
Create a Node object

Parameters:
id - a (preferably) unique identifier for the node
nx - the x-position of the node (usually in pixels)
ny - the y-position of the node (usually in pixels)
nz - the z-position of the node (usually in pixels)
val - the value of the node (usually some kind of double)
nm - the name of the node (useful for having labels)
Method Detail

getId

public int getId()
Get the (preferably) unique identifier

Returns:
A (preferably) unique identifying integer

getName

public String getName()
Get the (preferably) unique name

Returns:
A (preferably) unique identifying name

getX

public float getX()
The x-position of the node

Returns:
A float representing the node's x-position

getY

public float getY()
The y-position of the node

Returns:
A float representing the node's y-position

getZ

public float getZ()
The z-position of the node -- you can overload this as the value of the node if you like since it doesn't have to be a geographical z-axis.

Returns:
A float representing the node's z-position or value

getValue

public double getValue()
A better way to get a value that is distinct from some z-value such as an altitude.

Returns:
A double representing the node's 'value' on an arbitrary scale


Processing library MapThing by Jon Reades. (C) 2013