com.partnersoft.v3x.apps.Staker.domain
Class Job

java.lang.Object
  extended by com.partnersoft.v3x.apps.Staker.domain.Job
All Implemented Interfaces:
java.io.Serializable

public class Job
extends java.lang.Object
implements java.io.Serializable

A staking job.

See Also:
Serialized Form

Constructor Summary
Job()
          Create a new, blank job.
 
Method Summary
 void addJobListener(JobListener listener)
           
 void applyPostprocessingCorrections(CorrectedJob corrections, Projection projection)
           
 Location convertToLocation(IntermediatePoint station)
           
 java.util.List<PostprocessingPoint> copyPostprocessingPoints()
           Copies all the job's postprocessing points into a new list.
 void createAlternative(java.lang.String name)
          Adds a new alternative.
 void createAlternative(java.lang.String name, java.lang.String alternativeToCopy)
          Adds a new alternative as a copy of an existing alternative.
 Location createLocation(StakingNode parent, double x, double y)
          Creates a new location with the given parent, x, and y.
 Location createLocation(StakingNode parent, XyPoint point)
          Creates a new location with the given parent, x, and y.
 RedlineSticker createRedlinePoint(java.lang.String iconName, double x, double y)
          Creates a new RedlineSticker with the given icon name.
 IntermediatePoint createStation(StakingNode parent, double x, double y)
          Creates a new station with the given parent, x, and y.
 java.lang.Object deepCopy()
          clones the job.
static java.util.Set deepCopyNodes(java.util.Set original)
           
 void deleteAlternative(java.lang.String name)
           
 void detachNodes()
          This removes the parent-child pointer relationships from the nodes and places them in the detachedNodes list, storing the relationships in the detachedNodeParents() Naming.
 void fireJobChanged()
          Notifies all listeners that this job has changed.
 void fixDanglingStations()
          Converts any dangling stations to locations.
 java.util.Set getAlternative(java.lang.String name)
           
 java.util.Map getAlternatives()
           
 XyBounds getBounds()
          Returns the geometric extents of the locations and annotations in this job.
 java.lang.String getCurrentAlternative()
           
 java.util.Map<java.lang.String,java.lang.String> getDetachedNodeParents()
           
 java.util.List<MapPoint> getDetachedNodes()
           
 JobHeader getHeader()
          Get job header info.
 java.util.Iterator<Location> getLocations()
           
 int getNextGpsID()
          Get next location ID.
 int getNextLocationID()
          Get next location ID.
 int getNextNodeID()
          Get next node ID.
 java.util.Set getNodes()
          Get set of staking nodes.
 ReportOptions getReportOptions()
           
 java.util.Map getSummaryInfo()
          Get summary info.
 Location getTakeoffLocation()
          Get takeoff point (lowest ID#).
 java.util.ArrayList getTakeoffLocations()
          Gets all root (takeoff) locations - those without parents.
 java.util.Set getUnitSummary()
           
 Location importJob(Job notherJob, boolean clearGuids)
          Imports another job or template.
 void insertAlternative(java.lang.String name)
          Inserts the named alternative into the current one.
 Location insertJob(Job notherJob, StakingNode parent, XyPoint insertionPoint, boolean clearGuids)
          Insert another job or template at the given take-off location.
 java.util.List<Location> listLocations()
          Lists just the Location objects in this job.
 Location locationNearest(XyPoint point)
          Returns the location nearest the given XyPoint.
 Location locationNearest(XyPoint point, double radius)
          Returns the location nearest the given XyPoint, within the given radius.
 java.util.Iterator locations()
           
 void mergerTwoLocations(Staker staker, Location location)
           
 void mergeTemplateWithLocation(Job template, Location selectedLocation)
          This basically merges a template with an actual location.
 void move(double offsetX, double offsetY)
           
 MapPoint nodeForGPSID(java.lang.String gpsID)
           Returns the MapPoint (location, redline node, whatever) with the given GPS ID in this job.
 MapPoint nodeForGuid(java.lang.String guid)
          Returns the MapPoint (location, redline node, whatever) with the given GUID in this job.
 void promote()
          Promotes a job to the next JobStatus.
 void reattachNodes()
          This restores the parent-child pointer relationships from the nodes and places them in the detachedNodes list, storing the relationships in the detachedNodeParents() Naming.
 void refresh()
           
 void removeJobListener(JobListener listener)
           
 void removePoint(MapPoint point)
          Removes the given node.
 void renameAlternative(java.lang.String original, java.lang.String newName)
           
 void renumberLocations()
          Renumbers numbered locations.
 void reproject(Projection originalProjection, Projection newProjection)
          Assumes units are in feet!
 Location reverseFlow(StakingNode node)
           
 void selectCurrentAlternative(java.lang.String name)
           
 void setAlternatives(java.util.Map newAlternatives)
           
 void setCurrentAlternative(java.lang.String newName)
           
 void setDetachedNodeParents(java.util.Map<java.lang.String,java.lang.String> newParents)
           
 void setDetachedNodes(java.util.List<MapPoint> newNodes)
           
 void setHeader(JobHeader newHeader)
          Set header info.
 void setNextGpsID(int newNext)
          Set next location ID.
 void setNextLocationID(int newNext)
          Set next location ID.
 void setNextNodeID(int newNext)
          Set next node ID.
 void setNodes(java.util.Set newNodes)
          Set staking node set.
 void setReportOptions(ReportOptions newOptions)
           
 java.lang.String toString()
           
 void updateCentroidAndBounds()
          Updates the centroid and takeoff coord in the job header.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Job

public Job()
Create a new, blank job.

Method Detail

createLocation

public Location createLocation(StakingNode parent,
                               XyPoint point)
Creates a new location with the given parent, x, and y. Adds it to the job and returns the result.


createLocation

public Location createLocation(StakingNode parent,
                               double x,
                               double y)
Creates a new location with the given parent, x, and y. Adds it to the job and returns the result.


createStation

public IntermediatePoint createStation(StakingNode parent,
                                       double x,
                                       double y)
Creates a new station with the given parent, x, and y. Adds it to the job and returns the result. This is not technically valid (stations without children) but it can be useful in map editing.


createRedlinePoint

public RedlineSticker createRedlinePoint(java.lang.String iconName,
                                         double x,
                                         double y)
Creates a new RedlineSticker with the given icon name.


removePoint

public void removePoint(MapPoint point)
Removes the given node.


reverseFlow

public Location reverseFlow(StakingNode node)

mergerTwoLocations

public void mergerTwoLocations(Staker staker,
                               Location location)

mergeTemplateWithLocation

public void mergeTemplateWithLocation(Job template,
                                      Location selectedLocation)
This basically merges a template with an actual location. This is to solve a situation where we already have locations from either GPS, Mobile Staker, staking buddy, or some other gps sources. This function will allow adding template at these locations without losing the gps coordinates. This is more like merge a template with a already created location.


importJob

public Location importJob(Job notherJob,
                          boolean clearGuids)
Imports another job or template. Returns the takeoff location, if any. If clearGuids is true the original guids from the imported job are discarded.


insertJob

public Location insertJob(Job notherJob,
                          StakingNode parent,
                          XyPoint insertionPoint,
                          boolean clearGuids)
Insert another job or template at the given take-off location. Returns the takeoff location, if any. If clearGuids is true the original guids from the imported job are discarded.


promote

public void promote()
Promotes a job to the next JobStatus.


toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

locations

public java.util.Iterator locations()

getLocations

public java.util.Iterator<Location> getLocations()

move

public void move(double offsetX,
                 double offsetY)

reproject

public void reproject(Projection originalProjection,
                      Projection newProjection)
Assumes units are in feet!


selectCurrentAlternative

public void selectCurrentAlternative(java.lang.String name)

createAlternative

public void createAlternative(java.lang.String name)
Adds a new alternative.


createAlternative

public void createAlternative(java.lang.String name,
                              java.lang.String alternativeToCopy)
Adds a new alternative as a copy of an existing alternative.


insertAlternative

public void insertAlternative(java.lang.String name)
Inserts the named alternative into the current one.


getAlternative

public java.util.Set getAlternative(java.lang.String name)

renameAlternative

public void renameAlternative(java.lang.String original,
                              java.lang.String newName)

deleteAlternative

public void deleteAlternative(java.lang.String name)

detachNodes

public void detachNodes()
This removes the parent-child pointer relationships from the nodes and places them in the detachedNodes list, storing the relationships in the detachedNodeParents() Naming. This simplifies the job for storage in TOF and similar formats, and should be done just prior to saving. reattachNodes() reverses this process.


reattachNodes

public void reattachNodes()
This restores the parent-child pointer relationships from the nodes and places them in the detachedNodes list, storing the relationships in the detachedNodeParents() Naming. This simplifies the job for storage in TOF and similar formats, and should be done just prior to saving. reattachNodes() reverses this process.


renumberLocations

public void renumberLocations()
Renumbers numbered locations.


updateCentroidAndBounds

public void updateCentroidAndBounds()
Updates the centroid and takeoff coord in the job header.


refresh

public void refresh()

fixDanglingStations

public void fixDanglingStations()
Converts any dangling stations to locations.


convertToLocation

public Location convertToLocation(IntermediatePoint station)

nodeForGuid

public MapPoint nodeForGuid(java.lang.String guid)
Returns the MapPoint (location, redline node, whatever) with the given GUID in this job.


nodeForGPSID

public MapPoint nodeForGPSID(java.lang.String gpsID)

Returns the MapPoint (location, redline node, whatever) with the given GPS ID in this job.


locationNearest

public Location locationNearest(XyPoint point)
Returns the location nearest the given XyPoint. Returns null if there are no locations.


locationNearest

public Location locationNearest(XyPoint point,
                                double radius)
Returns the location nearest the given XyPoint, within the given radius. Returns null if there are no locations within the radius.


getTakeoffLocations

public java.util.ArrayList getTakeoffLocations()
Gets all root (takeoff) locations - those without parents.


getTakeoffLocation

public Location getTakeoffLocation()
Get takeoff point (lowest ID#). Null if none found.


getSummaryInfo

public java.util.Map getSummaryInfo()
Get summary info.


getUnitSummary

public java.util.Set getUnitSummary()

getHeader

public JobHeader getHeader()
Get job header info.


setHeader

public void setHeader(JobHeader newHeader)
Set header info.


getNodes

public java.util.Set getNodes()
Get set of staking nodes.


setNodes

public void setNodes(java.util.Set newNodes)
Set staking node set.


getDetachedNodeParents

public java.util.Map<java.lang.String,java.lang.String> getDetachedNodeParents()

setDetachedNodeParents

public void setDetachedNodeParents(java.util.Map<java.lang.String,java.lang.String> newParents)

getDetachedNodes

public java.util.List<MapPoint> getDetachedNodes()

setDetachedNodes

public void setDetachedNodes(java.util.List<MapPoint> newNodes)

copyPostprocessingPoints

public java.util.List<PostprocessingPoint> copyPostprocessingPoints()

Copies all the job's postprocessing points into a new list. Skips points w/ no postprocessing data.

Returns:

getNextGpsID

public int getNextGpsID()
Get next location ID.


setNextGpsID

public void setNextGpsID(int newNext)
Set next location ID.


getNextLocationID

public int getNextLocationID()
Get next location ID.


setNextLocationID

public void setNextLocationID(int newNext)
Set next location ID.


getNextNodeID

public int getNextNodeID()
Get next node ID.


setNextNodeID

public void setNextNodeID(int newNext)
Set next node ID.


getReportOptions

public ReportOptions getReportOptions()

setReportOptions

public void setReportOptions(ReportOptions newOptions)

getBounds

public XyBounds getBounds()
Returns the geometric extents of the locations and annotations in this job.

Returns:
bounds of job

getAlternatives

public java.util.Map getAlternatives()

setAlternatives

public void setAlternatives(java.util.Map newAlternatives)

getCurrentAlternative

public java.lang.String getCurrentAlternative()

setCurrentAlternative

public void setCurrentAlternative(java.lang.String newName)

deepCopyNodes

public static java.util.Set deepCopyNodes(java.util.Set original)

listLocations

public java.util.List<Location> listLocations()
Lists just the Location objects in this job.


deepCopy

public java.lang.Object deepCopy()
clones the job.


fireJobChanged

public void fireJobChanged()
Notifies all listeners that this job has changed.


addJobListener

public void addJobListener(JobListener listener)

removeJobListener

public void removeJobListener(JobListener listener)

applyPostprocessingCorrections

public void applyPostprocessingCorrections(CorrectedJob corrections,
                                           Projection projection)