.. _api-zoo-geometry:

ZOO.Geometry
============

A Geometry is a description of a geographic object.

Properties	
----------

.. list-table::
   :widths: 12 50
   :header-rows: 1

   * - NAME
     - DESCRIPTION
   * - :ref:`id <id>`
     - {String} A unique identifier for this geometry.
   * - :ref:`parent <parent>`
     - {ZOO.Geometry}This is set when a Geometry is added as component of another geometry
   * - :ref:`bounds <bounds>`
     - {ZOO.Bounds} The bounds of this geometry

Functions	
---------

.. list-table::
   :widths: 15 50
   :header-rows: 1

   * - NAME
     - DESCRIPTION
   * - :ref:`ZOO.Geometry <ZOO.Geometry>`
     - Creates a geometry object.
   * - :ref:`destroy <destroy>`
     - nullify references to prevent circular references and memory leaks
   * - :ref:`clone <clone>`
     - Create a clone of this vector feature.
   * - :ref:`extendBounds <extendBounds>`
     - Moves the feature and redraws it at its new location
   * - :ref:`clearBounds <clearBounds>`
     - Nullify this components bounds and that of its parent as well.
   * - :ref:`getBounds <getBounds>`
     - Get the bounds for this Geometry.
   * - :ref:`calculateBounds <calculateBounds>`
     - Recalculate the bounds for the geometry.
   * - :ref:`toString <toString>`
     - Returns the Well-Known Text representation of a geometry
   * - :ref:`ZOO.Geometry.fromWKT <ZOO.Geometry.fromWKT>`
     - Generate a geometry given a Well-Known Text string.   
   
     
**Properties**
       
.. _id: 

id	
  ``{String}`` A unique identifier for this geometry.
  
.. _parent:  
  
parent	
  :ref:`{ZOO.Geometry} <api-zoo-geometry>` This is set when a Geometry is added as component of another geometry
  
.. _bounds:    
  
bounds	
  :ref:`{ZOO.Bounds} <api-zoo-bounds>` The bounds of this geometry

**Functions**
       
.. _ZOO.Geometry: 

ZOO.Geometry	
  Creates a geometry object.
  
.. _destroy:   
  
destroy	
  ::
  
    destroy: function()

  Destroy this geometry.
  
.. _clone:     
  
clone	
  ::
  
    clone: function()

  Create a clone of this geometry.  Does not set any non-standard properties of the cloned geometry.
  
  *Returns*

  :ref:`{ZOO.Geometry} <api-zoo-geometry>` An exact clone of this geometry.  
  
.. _extendBounds:       
  
extendBounds	
  ::
  
    extendBounds: function(newBounds)

  Extend the existing bounds to include the new bounds.  If geometry's bounds is not yet set, 
  then set a new Bounds.
  
  *Parameters*
  
  ``newBounds``	:ref:`{ZOO.Bounds} <api-zoo-bounds>`
  
.. _clearBounds:         
  
clearBounds	
  ::
  
    clearBounds: function()

  Nullify this components bounds and that of its parent as well. 
  
.. _getBounds:           
  
getBounds	
  ::
  
    getBounds: function()

  Get the bounds for this Geometry.  If bounds is not set, it is calculated again, this 
  makes queries faster.
  
  *Returns*

  ``newBounds``	:ref:`{ZOO.Bounds} <api-zoo-bounds>`
  
.. _calculateBounds:             
  
calculateBounds	
  ::
  
    calculateBounds: function()

  Recalculate the bounds for the geometry. 
  
.. _toString:               
  
toString	
  ::
  
    toString: function()

  Returns the Well-Known Text representation of a geometry
  
  *Returns*

  ``{String}`` Well-Known Text  
  
.. _ZOO.Geometry.fromWKT:                 
  
ZOO.Geometry.fromWKT	
  ::
  
    ZOO.Geometry.fromWKT = function(wkt)

  Generate a geometry given a Well-Known Text string.
  
  *Parameters*
  
  ``wkt	{String}`` A string representing the geometry in Well-Known Text.

  *Returns*

  :ref:`{ZOO.Geometry} <api-zoo-geometry>` A geometry of the appropriate class.