Sweet Home 3D 3.4

com.eteks.sweethome3d.model
Class Compass

java.lang.Object
  extended by com.eteks.sweethome3d.model.Compass
All Implemented Interfaces:
Selectable, java.io.Serializable, java.lang.Cloneable

public class Compass
extends java.lang.Object
implements java.io.Serializable, Selectable

A compass used to locate where a home is located and how it's oriented towards North.

Since:
3.0
Author:
Emmanuel Puybaret, Frédéric Mantegazza (Sun location algorithm)
See Also:
Serialized Form

Nested Class Summary
static class Compass.Property
          The properties of a compass that may change.
 
Constructor Summary
Compass(float x, float y, float diameter)
          Creates a compass drawn at the given point.
 
Method Summary
 void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
          Adds the property change listener in parameter to this compass.
 Compass clone()
          Returns a clone of this compass.
 boolean containsPoint(float x, float y, float margin)
          Returns true if the disc of this compass contains the point at (x, y) with a given margin.
 float getDiameter()
          Returns the diameter of this compass.
 float getLatitude()
          Returns the latitudeInDegrees of this compass in radians.
 float getLongitude()
          Returns the longitudeInDegrees of this compass in radians.
 float getNorthDirection()
          Returns the North direction angle of this compass in radians.
 float[][] getPoints()
          Returns the corner points of the square that contains compass disc.
 float getSunAzimuth(long date)
          Returns the azimuth angle of the Sun in the sky in radians at a given date in milliseconds since the Epoch.
 float getSunElevation(long date)
          Returns the elevation angle of the Sun in the sky in radians at a given date in milliseconds since the Epoch.
 java.lang.String getTimeZone()
          Returns the time zone identifier of this compass.
 float getX()
          Returns the abscissa of the center of this compass.
 float getY()
          Returns the ordinate of the center of this compass.
 boolean intersectsRectangle(float x0, float y0, float x1, float y1)
          Returns true if the disc of this compass intersects with the horizontal rectangle which opposite corners are at points (x0, y0) and (x1, y1).
 boolean isVisible()
          Returns true if this compass is visible.
 void move(float dx, float dy)
          Moves this compass of (dx, dy) units.
 void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
          Removes the property change listener in parameter from this compass.
 void setDiameter(float diameter)
          Sets the diameter of this compass.
 void setLatitude(float latitude)
          Sets the latitudeInDegrees of this compass.
 void setLongitude(float longitude)
          Sets the longitudeInDegrees of the center of this compass.
 void setNorthDirection(float northDirection)
          Sets the North direction angle of this compass.
 void setTimeZone(java.lang.String timeZone)
          Sets the time zone identifier of this compass.
 void setVisible(boolean visible)
          Sets whether this compass is visible or not.
 void setX(float x)
          Sets the abscissa of the center of this compass.
 void setY(float y)
          Sets the ordinate of the center of this compass.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Compass

public Compass(float x,
               float y,
               float diameter)
Creates a compass drawn at the given point. North direction is set to zero, time zone to default and the latitudeInDegrees and the longitudeInDegrees of this new compass is equal to the geographic point matching the default time zone.

Method Detail

addPropertyChangeListener

public void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
Adds the property change listener in parameter to this compass.


removePropertyChangeListener

public void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
Removes the property change listener in parameter from this compass.


getX

public float getX()
Returns the abscissa of the center of this compass.


setX

public void setX(float x)
Sets the abscissa of the center of this compass. Once this compass is updated, listeners added to this compass will receive a change notification.


getY

public float getY()
Returns the ordinate of the center of this compass.


setY

public void setY(float y)
Sets the ordinate of the center of this compass. Once this compass is updated, listeners added to this compass will receive a change notification.


getDiameter

public float getDiameter()
Returns the diameter of this compass.


setDiameter

public void setDiameter(float diameter)
Sets the diameter of this compass. Once this compass is updated, listeners added to this compass will receive a change notification.


isVisible

public boolean isVisible()
Returns true if this compass is visible.


setVisible

public void setVisible(boolean visible)
Sets whether this compass is visible or not. Once this compass is updated, listeners added to this piece will receive a change notification.


getNorthDirection

public float getNorthDirection()
Returns the North direction angle of this compass in radians.


setNorthDirection

public void setNorthDirection(float northDirection)
Sets the North direction angle of this compass. Once this compass is updated, listeners added to this compass will receive a change notification.


getLatitude

public final float getLatitude()
Returns the latitudeInDegrees of this compass in radians.


setLatitude

public void setLatitude(float latitude)
Sets the latitudeInDegrees of this compass. Once this compass is updated, listeners added to this compass will receive a change notification.


getLongitude

public final float getLongitude()
Returns the longitudeInDegrees of this compass in radians.


setLongitude

public void setLongitude(float longitude)
Sets the longitudeInDegrees of the center of this compass. Once this compass is updated, listeners added to this compass will receive a change notification.


getTimeZone

public java.lang.String getTimeZone()
Returns the time zone identifier of this compass.

See Also:
TimeZone

setTimeZone

public void setTimeZone(java.lang.String timeZone)
Sets the time zone identifier of this compass. Once this compass is updated, listeners added to this compass will receive a change notification.

Throws:
java.lang.IllegalArgumentException - if timeZone is null or contains an unknown identifier.
See Also:
TimeZone

getPoints

public float[][] getPoints()
Returns the corner points of the square that contains compass disc.

Specified by:
getPoints in interface Selectable
Returns:
an array of the (x,y) coordinates of the rectangle.

intersectsRectangle

public boolean intersectsRectangle(float x0,
                                   float y0,
                                   float x1,
                                   float y1)
Returns true if the disc of this compass intersects with the horizontal rectangle which opposite corners are at points (x0, y0) and (x1, y1).

Specified by:
intersectsRectangle in interface Selectable

containsPoint

public boolean containsPoint(float x,
                             float y,
                             float margin)
Returns true if the disc of this compass contains the point at (x, y) with a given margin.

Specified by:
containsPoint in interface Selectable

move

public void move(float dx,
                 float dy)
Moves this compass of (dx, dy) units.

Specified by:
move in interface Selectable

clone

public Compass clone()
Returns a clone of this compass.

Specified by:
clone in interface Selectable
Overrides:
clone in class java.lang.Object

getSunElevation

public float getSunElevation(long date)
Returns the elevation angle of the Sun in the sky in radians at a given date in milliseconds since the Epoch. See Sun azimuth and elevation angles for more information.


getSunAzimuth

public float getSunAzimuth(long date)
Returns the azimuth angle of the Sun in the sky in radians at a given date in milliseconds since the Epoch. See Sun azimuth and elevation angles for more information.


Sweet Home 3D 3.4

? Copyrights 2006-2011 eTeks - All rights reserved
Distributed under GNU General Public License