Parcel


cpc.sau.lulctools
Class Parcel

java.lang.Object
  extended by cpc.sau.lulctools.Parcel

public class Parcel
extends java.lang.Object

The Parcel class is a container that holds LulcCell object with the same LULC type. It is designed to allow a Household agent to identify homogeneous patches of LULC and manipulate the LulcCell objects (i.e. cells) in the parcel, including the splitting of the parcel into two or more smaller parcels. The class has methods for calculating the perimeter and area of the parcel, and also has some basic patch-based pattern metrics.

cellList : arraylist containing all LulcCell objects(i.e cells) in the parcel
numCells :the number of Lulc objects in the parcel
landuse : type of LULC in the parcel
parcelArea : area of the parcel (sum of the area of all cells)
perimeter : the perimeter of the parcel
neighbors : list of neighboring parcels. It is based on the 4-neighbor relationship.
nbrLanduse : list of LULC in the neighboring parcels
yield: the annual yield of the parcel
pid: the ID of the parcel


Constructor Summary
Parcel()
          Constructs a new parcel object with default values.
 
Method Summary
 void addCellToParcel(LulcCell obj)
          Adds a new land LulcCell object to the parcel
 void clearNeighbors()
          Removes all LulcCell objects in the neighbors.
 void deleteNeighbors(Parcel parcel)
          Removes a parcel from the neighbor list.
 double distToFeature(int x, int y, int xFeat, int yFeat)
          Calculate the distance to some user-specified feature
 double frac()
          Calculate the Fractal Dimension Index.
 java.util.ArrayList<LulcCell> getCellList()
          Returns a list containing all LulcCell objects in the parcel
 java.lang.String getLanduse()
          Returns the parcel's land use
 java.util.ArrayList<Parcel> getNeighbors()
          Returns a neighborhood arraylist for this parcel agent
 java.util.ArrayList getNeighborsLanduse()
          Returns the land use of neighboring parcels.
 double getNumCells()
          Returns the number of LulcCell objects in this parcel
 double getParcelArea()
          Returns the parcel's area.
 double getPerimeter()
          Calculates the perimeter of the parcel.
 java.lang.String getPid()
          Returns the ID of this parcel
 double getYield()
          Returns the parcel's yield
 double perimToArea()
          [pattern metric]Calculates the Perimeter-to-Area Ratio.
 void setLanduse()
          Sets the land use of this parcel based on the land use in its cells.
 void setLanduse(java.lang.String landuse)
          Changes the land use of this parcel and updates the land use of all cells in the parcel.
 void setNeighbors(java.util.ArrayList<LulcCell> coverList, java.util.ArrayList<Parcel> pList)
          Defines the neighboring parcels.
 void setNumCells()
          Sets the number of LulcCell objects in the parcel.
 void setPid(java.lang.String s)
          Sets the ID of the parcel.
 void setYield(double yld)
          Sets the parcel's yield
 double shapeIndex(java.util.ArrayList<Parcel> pList)
          [pattern metric]Calculates the Shape Index.
 Parcel splitParcel(int X, int coverValue)
          Subdivides a parcel given a maximum size and land use type for the new parcel.
 void updateParcel()
          Synchronizes the LulcCell IDs with the Parcel ID.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Parcel

public Parcel()
Constructs a new parcel object with default values. Its attributes can be changed by the set methods.

Method Detail

setNeighbors

public void setNeighbors(java.util.ArrayList<LulcCell> coverList,
                         java.util.ArrayList<Parcel> pList)
Defines the neighboring parcels. It checks the IsEdgeCell attribute of each cell in this parcel to identify the neighbors. The neighbors list stores all neighborhood parcels without duplicates.

The method requires two input parameters which information are about the landscape. One parameter is an arraylist containing all LulcCell objects in the entire landscape. It is used to set the IsEdgeCell attributes in the cells. The other parameter is an arraylist of all Parcel objects in the landscape.

Parameters:
coverList - an arraylist containing all LulcCell objects in the landscape.
pList - arraylist containing all Parcel objects in the landscape

deleteNeighbors

public void deleteNeighbors(Parcel parcel)
Removes a parcel from the neighbor list.

Parameters:
parcel - the parcel to be removed from its neighbor list

clearNeighbors

public void clearNeighbors()
Removes all LulcCell objects in the neighbors.


getNeighbors

public java.util.ArrayList<Parcel> getNeighbors()
Returns a neighborhood arraylist for this parcel agent

Returns:
an arraylist containing all neighboring parcels.

setLanduse

public void setLanduse(java.lang.String landuse)
Changes the land use of this parcel and updates the land use of all cells in the parcel.

Parameters:
landuse - the type of new land use

setLanduse

public void setLanduse()
Sets the land use of this parcel based on the land use in its cells.


getLanduse

public java.lang.String getLanduse()
Returns the parcel's land use

Returns:
a string representing the land use of this parcel

getParcelArea

public double getParcelArea()
Returns the parcel's area.

Returns:
the area of the parcel.

setPid

public void setPid(java.lang.String s)
Sets the ID of the parcel.

Parameters:
s - parcel ID

getPid

public java.lang.String getPid()
Returns the ID of this parcel

Returns:
a string, the ID of this parcel

setYield

public void setYield(double yld)
Sets the parcel's yield

Parameters:
yld - the yield of the parcel

getYield

public double getYield()
Returns the parcel's yield

Returns:
yield of the parcel

getPerimeter

public double getPerimeter()
Calculates the perimeter of the parcel. It cycles through all cells in the parcel, identifies the edge cells, and calculates the perimeter based on the number of shared edges.

Returns:
the perimeter of the parcel

setNumCells

public void setNumCells()
Sets the number of LulcCell objects in the parcel. It is the same size as the cellList arraylist.


getNumCells

public double getNumCells()
Returns the number of LulcCell objects in this parcel

Returns:
the number of cells in this parcel

getNeighborsLanduse

public java.util.ArrayList getNeighborsLanduse()
Returns the land use of neighboring parcels. The order is the same as the neighbor arraylist.

Returns:
an arraylist containing the land use of the neighboring parcels

addCellToParcel

public void addCellToParcel(LulcCell obj)
Adds a new land LulcCell object to the parcel

Parameters:
obj - a new LulcCell object

getCellList

public java.util.ArrayList<LulcCell> getCellList()
Returns a list containing all LulcCell objects in the parcel

Returns:
an arraylist of LulcCell objects

perimToArea

public double perimToArea()
[pattern metric]Calculates the Perimeter-to-Area Ratio. It is equal to P/a, where P is the perimeter and a is area.

Returns:
a value greater than 0

shapeIndex

public double shapeIndex(java.util.ArrayList<Parcel> pList)
[pattern metric]Calculates the Shape Index. It is equal to P/min(p), where P is perimeter and min(p) is the minimum perimeter possible for a maximally compact parcel with the same area.

Parameters:
pList - the parcel list containing all parcels
Returns:
a value greater than or equal to 1, where 1 is a maximally compact parcel

frac

public double frac()
Calculate the Fractal Dimension Index. It is equal to (2*ln(0.25P))/ln(a), where P is perimeter and a is area.

Returns:
a value between 1 and 2. frac approaches 1 for simple shapes such as squares, and frac approaches 2 for highly convoluted shapes.

distToFeature

public double distToFeature(int x,
                            int y,
                            int xFeat,
                            int yFeat)
Calculate the distance to some user-specified feature

Parameters:
x - Parcel's X coordinate
y - Parcel's Y coordinate
xFeat - Feature's X coordinate
yFeat - Feature's Y coordinate
Returns:
the distance between the parcel and the feature

splitParcel

public Parcel splitParcel(int X,
                          int coverValue)
Subdivides a parcel given a maximum size and land use type for the new parcel. The subdivision is based on the suitability score in each cell. It calls the splitByScore method, which returns a new parcel with a maximum size X. After the creation of the new parcel, it sets each Lulcobject in the new parcel to the new land use type. The new parcel ID is set automatically by this method. The original parcel keeps its same ID, but is reduced in size by the amount of the new parcel.

Parameters:
X - the maximum size for the new parcel
coverValue - the LULC type for the new parcel
Returns:
a new parcel subdivided from the original Parcel object

updateParcel

public void updateParcel()
Synchronizes the LulcCell IDs with the Parcel ID. If the parcel ID is changed, the IDs of the LulcCells in this parcel will also be changed.



Wink Plone Theme by Quintagroup © 2013.

Personal tools
This is themeComment for Wink theme