com.mapquest
Class BestFit

java.lang.Object
  extended bycom.mapquest.MQObject
      extended bycom.mapquest.MapCommand
          extended bycom.mapquest.BestFit
All Implemented Interfaces:
java.lang.Cloneable

public class BestFit
extends MapCommand

Calculates the best scale and center point of a map for the given set of features in the Session. For example, if you place 20 points in a FeatureCollection object in your Session, adding a BestFit object to the Session adjusts the MapState object so that the map optimally displays all 20 points.

See Also:
DTCollection

Field Summary
static int CLASS_ID
           
static java.lang.String CLASS_NAME
           
 
Fields inherited from class com.mapquest.MQObject
DEFAULT_ID, DEFAULT_NAME, DEFAULT_VERSION, FORMAT_NUMERIC_ID, FORMAT_TEXT_NAME, INVALID_ID, INVALID_NAME, INVALID_VERSION
 
Constructor Summary
BestFit()
          Default Constructor.
 
Method Summary
 boolean equals(java.lang.Object otherObject)
          Compares this object to the specified object.
 int getClassId()
          Returns the numeric id of this class.
 java.lang.String getClassName()
          Returns the text name of this class.
 DTCollection getDTs()
          Gets the DTCollection for this object
 boolean getIncludePrimitives()
          Gets the IncludePrimitives member value.
 boolean getKeepCenter()
          Returns the KeepCenter property.
 double getScaleAdjustmentFactor()
          Gets the Scale adjustment factor member.
 boolean getSnapToZoomLevel()
          Get the SnapToZoomLevel property.
 int hashCode()
          Returns a hash code for this BestFit.
 void init()
          Initializes object.
 void setDTs(DTCollection dts)
          Sets the DTCollection for this object to the value of the collection passed in as a parameter.
 void setIncludePrimitives(boolean bIncludePrimitives)
          Sets the IncludePrimitives member value.
 void setKeepCenter(boolean keepCenter)
          Set the KeepCenter property.
 void setScaleAdjustmentFactor(double dScaleAdjFactor)
          Sets the Scale adjustment factor, used to increase the bounding rect enclosing the points to ensure their optimal visibility.
 void setSnapToZoomLevel(boolean bSnapToZoomLevel)
          Set the SnapToZoomLevel property.
 
Methods inherited from class com.mapquest.MQObject
clone, getFormat, getIdWithVersion, getNameWithVersion, getObjectVersion, getTypeId, getTypeName, getVerboseConsoleOutput, setFormat, setObjectVersion, setVerboseConsoleOutput, toString
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

CLASS_ID

public static final int CLASS_ID
See Also:
Constant Field Values

CLASS_NAME

public static final java.lang.String CLASS_NAME
See Also:
Constant Field Values
Constructor Detail

BestFit

public BestFit()
Default Constructor.

Method Detail

init

public void init()
Initializes object.

Overrides:
init in class MapCommand

getClassId

public int getClassId()
Returns the numeric id of this class.

Overrides:
getClassId in class MQObject
Returns:
the numeric id of this class.

getClassName

public java.lang.String getClassName()
Returns the text name of this class.

Overrides:
getClassName in class MQObject
Returns:
the text name of this class.

setDTs

public void setDTs(DTCollection dts)
Sets the DTCollection for this object to the value of the collection passed in as a parameter.

Parameters:
dts - The DTCollection to which this DTCollection is to be set.

getDTs

public DTCollection getDTs()
Gets the DTCollection for this object

Returns:
The dt collection member.

setScaleAdjustmentFactor

public void setScaleAdjustmentFactor(double dScaleAdjFactor)
Sets the Scale adjustment factor, used to increase the bounding rect enclosing the points to ensure their optimal visibility.

Parameters:
dScaleAdjFactor - The display type collection to which this display type collection is to be set.

getScaleAdjustmentFactor

public double getScaleAdjustmentFactor()
Gets the Scale adjustment factor member.

Returns:
The Scale adjustment factor member.

setIncludePrimitives

public void setIncludePrimitives(boolean bIncludePrimitives)
Sets the IncludePrimitives member value. Specifies if best fit should include the primitives in the session.

Parameters:
bIncludePrimitives - true or false.

getIncludePrimitives

public boolean getIncludePrimitives()
Gets the IncludePrimitives member value. Specifies if best fit should include the primitives in the session.

Returns:
IncludePrimitives member variable.

getKeepCenter

public boolean getKeepCenter()
Returns the KeepCenter property. Use to adjust the scale and center of the map. If KeepCenter is true BestFit will use the map center pt. specified by the mapstate object and only adjust the scale. If KeepCenter is false(default) the BestFit will adjust the map center point as well as the scale.

Returns:
the KeepCenter property.

setKeepCenter

public void setKeepCenter(boolean keepCenter)
Set the KeepCenter property. If KeepCenter is true BestFit will use the map center pt. specified by the mapstate object and only adjust the scale. If KeepCenter is false(default) the BestFit will adjust the map center point as well as the scale.

Parameters:
keepCenter - the value to determine whether or not to keep the center point.

getSnapToZoomLevel

public boolean getSnapToZoomLevel()
Get the SnapToZoomLevel property. If SnapToZoomLevel is true BestFit will use a scale from the ZoomLevels property in the AutoMapCovSwitch object. If AutoMapCovSwitch is not in use this property has no affect. If SnapToZoomLevel is false(default) the BestFit will adjust scale to the best scale that encompasses the area/features selected.

Returns:
the SnapToZoomLevel flag

setSnapToZoomLevel

public void setSnapToZoomLevel(boolean bSnapToZoomLevel)
Set the SnapToZoomLevel property. If SnapToZoomLevel is true BestFit will use a scale from the ZoomLevels property in the AutoMapCovSwitch object. If AutoMapCovSwitch is not in use this property has no affect. If SnapToZoomLevel is false(default) the BestFit will adjust scale to the best scale that encompasses the area/features selected.

Parameters:
bSnapToZoomLevel - The SnapToZoomLevel flag

equals

public boolean equals(java.lang.Object otherObject)
Compares this object to the specified object. The result is true if and only if the argument is not null and is a BestFit object that has same attributes as this object.

Overrides:
equals in class MQObject
Parameters:
otherObject - the object to compare this BestFit against.
Returns:
true if the BestFit objects are equal; false otherwise.

hashCode

public int hashCode()
Returns a hash code for this BestFit.

Overrides:
hashCode in class MQObject
Returns:
a hash code value for this BestFit.