backend.spheremodel
Class SphereWorldModel

java.lang.Object
  extended by java.util.Observable
      extended by backend.spheremodel.SphereWorldModel

public class SphereWorldModel
extends java.util.Observable

SphereWorldModel is a model of the sphere as well as objects that would placed on the sphere points, lines, etc...


Constructor Summary
SphereWorldModel(float sphereRad)
          SphereWorldModel constructor takes a radius to ouse for he radius of the sphere to model
 
Method Summary
 boolean addCircle(SphereCircleModel addMe)
          addCircle will add the given SphereCircleModel into the model
 void addGreatCircle(SpherePointModel firstPoint, SpherePointModel secondPoint)
          addGreatCircle adds a great circle to the model based on the given points
 boolean addIntersection(SphereMultiPointBase firstLine, SphereMultiPointBase secondLine)
          addIntersection will add an intersection to the SphereWorldModel
 void addLongLine(SpherePointModel firstPoint, SpherePointModel secondPoint)
          addLongLine will add a long line to the sphere given the two points
 boolean addParaTrans(SphereParaTransModel newTrans)
          addParaTrans will allow a parallel transport model to be added to the backend while allowing the frontend to now have to change :)
 boolean addPoint(float x, float y, float z)
          addPoint needs to be given an x y and z coordinate in world coordinates and it will be added to the sphere If either x or y or z is NaN it will not plot a point.
 boolean addPoint(javax.vecmath.Point3f addMe)
          addPoint will add a Point3f as a point after checking if it's a duplicate
 boolean addPoint(SpherePointModel addMe)
          addPoint will add a point to the model
 boolean addPotentialDuplicatePoint(SpherePointModel addMe)
          addPotentialDuplicatePoint will add a point that might be a duplicate.
 void addShortLine(SpherePointModel firstPoint, SpherePointModel secondPoint)
          addShortLine will add a short line to the sphere given two points
 SphereBasicObject getLastAdded()
          getLastAdded returns the last SphereBasicObject added to the world
 SphereBasicObject getLastObjectRemoved()
          getLastObjectRemoved returns the last SphereBasicObject removed from the SphereWorldModel
 SphereModel getSphereModel()
          getLastRemoved returns the SphereModel we are using to model our sphere
 void readDataFromFile(SphereFileReader myFileReader)
          readDataFromFile will take the data out of a SphereFileReader and set the sphere up correctly with it
 void removeObject(SphereBasicObject removeMe)
          removeObject will remove a given SphereBasicObject from the model if it exists otherwise it won't do anything all children of the object will also be removed.
 void reset()
          reset will reset the SphereWorldModel and sent out a RESET_NOT notification
 void writeSphereToFile(SphereFileWriter writeToMe)
          writeSphereToFile will take the contents of this sphere and write it out to a file
 
Methods inherited from class java.util.Observable
addObserver, countObservers, deleteObserver, deleteObservers, hasChanged, notifyObservers, notifyObservers
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SphereWorldModel

public SphereWorldModel(float sphereRad)
SphereWorldModel constructor takes a radius to ouse for he radius of the sphere to model

Parameters:
sphereRad -
Method Detail

addCircle

public boolean addCircle(SphereCircleModel addMe)
addCircle will add the given SphereCircleModel into the model

Parameters:
addMe - the SphereCircleModel to add
Returns:
true if the circle was added and false if it was a duplicate

addPotentialDuplicatePoint

public boolean addPotentialDuplicatePoint(SpherePointModel addMe)
addPotentialDuplicatePoint will add a point that might be a duplicate. This function should be used sparingly because it is much easier to create errors (of the mathematical and user interface type) by letting a duplicate point be added!

Parameters:
addMe -
Returns:
true if there was a duplicate and false if there wasn't. Either way the point is added

addParaTrans

public boolean addParaTrans(SphereParaTransModel newTrans)
addParaTrans will allow a parallel transport model to be added to the backend while allowing the frontend to now have to change :)

Parameters:
newTrans - is the new SphereParaTransModel to add
Returns:
true if it was added and false if it was not

addPoint

public boolean addPoint(float x,
                        float y,
                        float z)
addPoint needs to be given an x y and z coordinate in world coordinates and it will be added to the sphere If either x or y or z is NaN it will not plot a point. So you don't necessarily have to make sure those values are valid just make sure you understand the outcome you might face

Parameters:
x - - x value in world coordinates
y - - y value in world coordinates
z - - z value in world coordinates
Returns:
true if the point is placed in the model, false if it is not

addPoint

public boolean addPoint(SpherePointModel addMe)
addPoint will add a point to the model

Parameters:
addMe -
Returns:
true if the point was added and false if it was not. The only reason it wouldn't be added is if there is already an indentical point in the model

addPoint

public boolean addPoint(javax.vecmath.Point3f addMe)
addPoint will add a Point3f as a point after checking if it's a duplicate

Parameters:
addMe - the Point3f to add

addGreatCircle

public void addGreatCircle(SpherePointModel firstPoint,
                           SpherePointModel secondPoint)
addGreatCircle adds a great circle to the model based on the given points

Parameters:
firstPoint - is the first point to be added to the model
secondPoint - is the second point to be added to the model

addLongLine

public void addLongLine(SpherePointModel firstPoint,
                        SpherePointModel secondPoint)
addLongLine will add a long line to the sphere given the two points

Parameters:
firstPoint - is the first point defining the line
secondPoint - is the second point defining the line

addShortLine

public void addShortLine(SpherePointModel firstPoint,
                         SpherePointModel secondPoint)
addShortLine will add a short line to the sphere given two points

Parameters:
firstPoint - is the first point defining the line
secondPoint - is the second point defining the line

addIntersection

public boolean addIntersection(SphereMultiPointBase firstLine,
                               SphereMultiPointBase secondLine)
addIntersection will add an intersection to the SphereWorldModel

Parameters:
firstLine - is the first line of the intersection to add
secondLine - is the second line of the intersection to add
Returns:
will return true if the intersection was added and false if it wasn't currently the only reason it wouldn't be added is if one was already there

removeObject

public void removeObject(SphereBasicObject removeMe)
removeObject will remove a given SphereBasicObject from the model if it exists otherwise it won't do anything all children of the object will also be removed. Upon each remove there will be a notification sent out that a point or a line was removed and getLastObjectRemoved will be updated appropriately. On the off chance the element does not exists getLastObjectRemoved returns null and there will be no notification

Parameters:
removeMe - the object to remove

getLastObjectRemoved

public SphereBasicObject getLastObjectRemoved()
getLastObjectRemoved returns the last SphereBasicObject removed from the SphereWorldModel

Returns:
the last SphereBasicObject removed

getLastAdded

public SphereBasicObject getLastAdded()
getLastAdded returns the last SphereBasicObject added to the world

Returns:
the last SphereBasicObject removed

getSphereModel

public SphereModel getSphereModel()
getLastRemoved returns the SphereModel we are using to model our sphere

Returns:
the SphereModel of the SphereWorldModel

writeSphereToFile

public void writeSphereToFile(SphereFileWriter writeToMe)
writeSphereToFile will take the contents of this sphere and write it out to a file

Parameters:
writeToMe - is the SphereFileWriter to write data to

readDataFromFile

public void readDataFromFile(SphereFileReader myFileReader)
readDataFromFile will take the data out of a SphereFileReader and set the sphere up correctly with it

Parameters:
myFileReader - is the file reader to get the data from

reset

public void reset()
reset will reset the SphereWorldModel and sent out a RESET_NOT notification