<html>
  <head>
    <style type="text/css" media="all">
        a:hover {       color: red;     }
        a {
                text-decoration: none;
                color: #0088cc;
        }
        
        a.primaryactionlink:link, a.primaryactionlink:visited { background-color: #2585B2; color: #fff; }
        a.primaryactionlink:hover, a.primaryactionlink:active { background-color: #11729E !important; color: #fff !important; }

/*
        @media only screen and (max-device-width: 480px) { 
                 .post { min-width: 700px !important; }
        }
*/
        </style>
    <title>WordPress.com</title>
    <!--[if gte mso 12]>
        <style type="text/css" media="all">
        body {
        font-family: arial;
        font-size: 0.8em;
        }
        .post, .comment {
        background-color: white !important;
        line-height: 1.4em !important;
        }
        </style>  
        <![endif]-->
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    Salve.<br>
    una nuova funzione in QGIS, che consente di utilizzare nel labelling
    e nel calcolatore non solo le funzioni preconfezionate, ma anche
    quelle definite dall'utente. Non proprio utilissima per chi e' alle
    prime armi, ma per i power users e' una ganzata.<br>
    Se qualcuno ci inventa utilizzi interessanti, per piacere dia
    notizia in lista.<br>
    Saluti, e buon divertimento.<br>
    <br>
    -------- Messaggio originale --------<br>
    <br>
    <style type="text/css" media="all">
        a:hover {       color: red;     }
        a {
                text-decoration: none;
                color: #0088cc;
        }
        
        a.primaryactionlink:link, a.primaryactionlink:visited { background-color: #2585B2; color: #fff; }
        a.primaryactionlink:hover, a.primaryactionlink:active { background-color: #11729E !important; color: #fff !important; }

/*
        @media only screen and (max-device-width: 480px) { 
                 .post { min-width: 700px !important; }
        }
*/
        </style>
    <title>WordPress.com</title>
    [if gte mso 12]> <style type="text/css" media="all"> body {
    font-family: arial; font-size: 0.8em; } .post, .comment {
    background-color: white !important; line-height: 1.4em !important; }
    </style> <![endif]
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <table style="background: #DDDDDD; width: 100%;" bgcolor="#DDDDDD"
      border="0" cellpadding="0" cellspacing="0">
      <tbody>
        <tr>
          <td> <span style="display:none !important"> Nathan posted:
              "Ever since I added expression based labels, including the
              new expression builder UI, something that I always wanted
              to add is the ability to define custom user defined
              functions in Python (or C++) and use them in an
              expression. The expression engine is " </span>
            <table style="padding: 10px; width: 100%;"
              class="subscribe-body" align="center" border="0"
              cellpadding="0" cellspacing="0">
              <tbody>
                <tr>
                  <td>
                    <table class="header-small-text"
                      style="padding-bottom:10px; width: 100%;"
                      align="center" border="0" width="100%"
                      cellpadding="0" cellspacing="0">
                      <tbody>
                        <tr>
                          <td style="color: #555 !important; font-size:
                            10px;" align="center">Respond to this post
                            by replying above this line</td>
                        </tr>
                      </tbody>
                    </table>
                    <div style="max-width: 600px; margin: 0 auto;
                      overflow: hidden;">
                      <table style="background-color: #fff; text-align:
                        left; margin: 0 auto; max-width: 1024px;
                        min-width: 320px; width: 100%;"
                        class="subscribe-wrapper" bgcolor="#ffffff"
                        border="0" cellpadding="0" cellspacing="0">
                        <tbody>
                          <tr>
                            <td>
                              <table style="background-image: url(
                                'http:/s.wordpress.com/i/emails/stripes.gif');
                                background-repeat: repeat-x;
                                background-color: #43A4D0; height: 8px;
                                width: 100%;"
                                class="subscribe-header-wrap"
                                background="http:/s.wordpress.com/i/emails/stripes.gif"
                                border="0" height="8" cellpadding="0"
                                cellspacing="0">
                                <tbody>
                                  <tr>
                                    <td><br>
                                    </td>
                                  </tr>
                                </tbody>
                              </table>
                              <table style="color: #0088cc; margin: 0 0
                                5px 0; font-size: 1.6em; color: #0088cc;
                                margin: 0 0 0px 0; font-size: 1.6em;
                                background-color: #EFEFEF; padding: 0;
                                border-bottom: 1px solid #DDD; width:
                                100%;" class="subscribe-header"
                                border="0" cellpadding="0"
                                cellspacing="0">
                                <tbody>
                                  <tr>
                                    <td>
                                      <h2 style="padding: 0px; margin:
                                        5px 20px; font-size: 16px;
                                        line-height: 1; font-weight:
                                        normal; color: #464646;
                                        font-family: "Helvetica
                                        Neue", Helvetica, Arial,
                                        sans-serif;"
                                        class="subscribe-title"> New
                                        post on <strong>Nathans QGIS
                                          and GIS blog</strong> </h2>
                                    </td>
                                    <td style="text-align: right;"> <img
                                        moz-do-not-send="true"
                                        style="margin: 5px 20px 5px 0;
                                        vertical-align: middle;"
                                        class="head-avatar"
                                        src="http://s.wordpress.com/i/emails/blavatar-default.png"
                                        alt="" border="0"> </td>
                                  </tr>
                                </tbody>
                              </table>
                              <table style="width: 100%;"
                                bgcolor="#ffffff" border="0"
                                cellpadding="20" cellspacing="0">
                                <tbody>
                                  <tr>
                                    <td>
                                      <table style="width: 100%;"
                                        border="0" cellpadding="0"
                                        cellspacing="0">
                                        <tbody>
                                          <tr>
                                            <td class="the-post"
                                              valign="top">
                                              <table style="width:
                                                100%;" border="0"
                                                cellpadding="0"
                                                cellspacing="0">
                                                <tbody>
                                                  <tr>
                                                    <td style="width:
                                                      60px !important;
                                                      white-space:
                                                      nowrap;
                                                      vertical-align:
                                                      top;"> <a
                                                        moz-do-not-send="true"
href="http://woostuff.wordpress.com/author/madmanwoo/" style="display:
                                                        block;
                                                        margin-right:
                                                        10px;
                                                        text-decoration:
                                                        none; color:
                                                        #0088cc;
                                                        text-decoration:
                                                        underline;
                                                        color: #2585B2;"><img
moz-do-not-send="true" alt=""
src="http://0.gravatar.com/avatar/03ccba009c26488991d9ec669e3fccf6?s=50&d="
                                                          class="avatar
                                                          avatar-50"
                                                          border="0"
                                                          height="50"
                                                          width="50"></a>
                                                    </td>
                                                    <td>
                                                      <h2 style="margin:
                                                        0; font-size:
                                                        1.6em; color:
                                                        #555; margin: 0;
                                                        font-size:
                                                        1.6em; color:
                                                        #555; font-size:
                                                        20px;"
                                                        class="post-title"><a
moz-do-not-send="true" style="text-decoration: none !important;
                                                          text-decoration:
                                                          none; color:
                                                          #0088cc;
                                                          text-decoration:
                                                          underline;
                                                          color:
                                                          #2585B2;"
href="http://woostuff.wordpress.com/2012/11/10/user-defined-expression-functions-for-qgis/">User
                                                          defined
                                                          expression
                                                          functions
                                                          for QGIS</a></h2>
                                                      <span
                                                        style="color:
                                                        #888;">by <a
                                                          moz-do-not-send="true"
href="http://woostuff.wordpress.com/author/madmanwoo/" style="color:
                                                          #888
                                                          !important;
                                                          text-decoration:
                                                          none; color:
                                                          #0088cc;
                                                          text-decoration:
                                                          underline;
                                                          color:
                                                          #2585B2;">Nathan</a></span>
                                                    </td>
                                                  </tr>
                                                </tbody>
                                              </table>
                                              <div style="margin-top:
                                                1em; max-width: 560px;"
                                                class="post-content">
                                                <p style="font-size:
                                                  14px; line-height:
                                                  1.4em; color: #444444;
                                                  font-family:
                                                  "Helvetica
                                                  Neue", Helvetica,
                                                  Arial, sans-serif;
                                                  margin: 0 0 1em 0;">Ever
                                                  since I added <a
                                                    moz-do-not-send="true"
                                                    title="Expression
                                                    based labeling now
                                                    in QGIS."
href="http://woostuff.wordpress.com/2011/10/27/expression-based-labeling/"
                                                    style="text-decoration:
                                                    none; color:
                                                    #0088cc;
                                                    text-decoration:
                                                    underline; color:
                                                    #2585B2;">expression
                                                    based labels</a>,
                                                  including the new
                                                  expression builder UI,
                                                  something that I
                                                  always wanted to add
                                                  is the ability to
                                                  define custom user
                                                  defined functions in
                                                  Python (or C++) and
                                                  use them in an
                                                  expression. The
                                                  expression engine is
                                                  used for <a
                                                    moz-do-not-send="true"
                                                    title="Expression
                                                    based labeling now
                                                    in QGIS."
href="http://woostuff.wordpress.com/2011/10/27/expression-based-labeling/"
                                                    style="text-decoration:
                                                    none; color:
                                                    #0088cc;
                                                    text-decoration:
                                                    underline; color:
                                                    #2585B2;">labels</a>,
                                                  <a
                                                    moz-do-not-send="true"
                                                    title="Improvements
                                                    to the QGIS rule
                                                    based rendering"
href="http://woostuff.wordpress.com/2012/01/25/improvements-to-the-qgis-rule-based-rendering/"
                                                    style="text-decoration:
                                                    none; color:
                                                    #0088cc;
                                                    text-decoration:
                                                    underline; color:
                                                    #2585B2;">rule</a> <a
moz-do-not-send="true" title="One of my favorite features of QGIS – Rule
                                                    based styling."
href="http://woostuff.wordpress.com/2011/06/06/one-of-my-favorite-features-of-qgis/"
                                                    style="text-decoration:
                                                    none; color:
                                                    #0088cc;
                                                    text-decoration:
                                                    underline; color:
                                                    #2585B2;">based rendering</a>,
                                                  layer actions, and
                                                  atlas composer tags.
                                                   Thanks to the all the
                                                  awesome work on the
                                                  expression engine by
                                                  Martin all this cool
                                                  stuff is now possible.</p>
                                                <p style="font-size:
                                                  14px; line-height:
                                                  1.4em; color: #444444;
                                                  font-family:
                                                  "Helvetica
                                                  Neue", Helvetica,
                                                  Arial, sans-serif;
                                                  margin: 0 0 1em 0;">Today
                                                  I pushed a <a
                                                    moz-do-not-send="true"
href="https://github.com/qgis/Quantum-GIS/commit/a7699e2696efcb471ab84871aae7af406ca2a375"
                                                    style="text-decoration:
                                                    none; color:
                                                    #0088cc;
                                                    text-decoration:
                                                    underline; color:
                                                    #2585B2;">commit</a> into
                                                  master that adds the
                                                  ability to define a
                                                  function in Python (or
                                                  C++), register it in
                                                  the expression engine,
                                                  then use it anywhere
                                                  expressions are used.</p>
                                                <h2>The good stuff</h2>
                                                <p style="font-size:
                                                  14px; line-height:
                                                  1.4em; color: #444444;
                                                  font-family:
                                                  "Helvetica
                                                  Neue", Helvetica,
                                                  Arial, sans-serif;
                                                  margin: 0 0 1em 0;">Lets
                                                  take a use case from <a
moz-do-not-send="true"
href="http://qgistips.spatialthoughts.com/2012/11/tip-count-number-of-vertices-in-layer.html"
                                                    style="text-decoration:
                                                    none; color:
                                                    #0088cc;
                                                    text-decoration:
                                                    underline; color:
                                                    #2585B2;">Ujaval
                                                    Gandhi</a> and his
                                                  example of counting
                                                  vertices for each
                                                  feature.</p>
                                                <p style="font-size:
                                                  14px; line-height:
                                                  1.4em; color: #444444;
                                                  font-family:
                                                  "Helvetica
                                                  Neue", Helvetica,
                                                  Arial, sans-serif;
                                                  margin: 0 0 1em 0;">First
                                                  we need to import the
                                                  new <a
                                                    moz-do-not-send="true"
href="https://github.com/qgis/Quantum-GIS/blob/a7699e2696efcb471ab84871aae7af406ca2a375/python/utils.py#L375"
                                                    style="text-decoration:
                                                    none; color:
                                                    #0088cc;
                                                    text-decoration:
                                                    underline; color:
                                                    #2585B2;"><code>qgsfunction</code></a>
                                                  decorator function
                                                  from <code>qgis.utils</code>.
                                                  The <code>qgsfunction</code>
                                                  decorator will take a
                                                  normal Python
                                                  function, wrap it up
                                                  in the class used to
                                                  define a function, and
                                                  register it in the
                                                  engine.</p>
                                                <p style="font-size:
                                                  14px; line-height:
                                                  1.4em; color: #444444;
                                                  font-family:
                                                  "Helvetica
                                                  Neue", Helvetica,
                                                  Arial, sans-serif;
                                                  margin: 0 0 1em 0;">So
                                                  what does an empty
                                                  function look like:</p>
                                                <p style="font-size:
                                                  14px; line-height:
                                                  1.4em; color: #444444;
                                                  font-family:
                                                  "Helvetica
                                                  Neue", Helvetica,
                                                  Arial, sans-serif;
                                                  margin: 0 0 1em 0;">
                                                </p>
                                                <pre class="brush: python;">from qgis.utils import qgsfunction
from qgis.core import QGis

@qgsfunction(0, "Python")
def vertices(values, feature, parent):
        pass
</pre>
                                                <p style="font-size:
                                                  14px; line-height:
                                                  1.4em; color: #444444;
                                                  font-family:
                                                  "Helvetica
                                                  Neue", Helvetica,
                                                  Arial, sans-serif;
                                                  margin: 0 0 1em 0;"><code>@qgsfunction(0,
                                                    "Python")</code>
                                                  means we are defining
                                                  a new vertices
                                                  function that takes 0
                                                  args and lives in the
                                                  "python" group in the
                                                  expression builder UI.
                                                  Any custom function
                                                  must take <code>(values,
                                                    feature, parent)</code>
                                                  as python args. <strong><code>values</code></strong>
                                                  is a list of QVariants
                                                  passed into the
                                                  function, <strong><code>feature</code></strong>
                                                  is the current <code>QgsFeature</code>,
                                                  and <strong><code>parent</code></strong>
                                                  is expression engine
                                                  node (you use this to
                                                  raise errors).</p>
                                                <p style="font-size:
                                                  14px; line-height:
                                                  1.4em; color: #444444;
                                                  font-family:
                                                  "Helvetica
                                                  Neue", Helvetica,
                                                  Arial, sans-serif;
                                                  margin: 0 0 1em 0;">Lets
                                                  stick some more logic
                                                  in there:</p>
                                                <p style="font-size:
                                                  14px; line-height:
                                                  1.4em; color: #444444;
                                                  font-family:
                                                  "Helvetica
                                                  Neue", Helvetica,
                                                  Arial, sans-serif;
                                                  margin: 0 0 1em 0;">
                                                </p>
                                                <pre class="brush: python;">from qgis.utils import qgsfunction
from qgis.core import QGis

@qgsfunction(0, "Python")
def vertices(values, feature, parent):
        """
                Returns the number of vertices for a features geometry
        """
        count = None
        geom = feature.geometry()
        if geom is None: return None
        if geom.type() == QGis.Polygon:
                count = 0
                if geom.isMultipart():
                  polygons = geom.asMultiPolygon()
                else:
                  polygons = [ geom.asPolygon() ]
                for polygon in polygons:
                  for ring in polygon:
                    count += len(ring)
        return count
</pre>
                                                <p style="font-size:
                                                  14px; line-height:
                                                  1.4em; color: #444444;
                                                  font-family:
                                                  "Helvetica
                                                  Neue", Helvetica,
                                                  Arial, sans-serif;
                                                  margin: 0 0 1em 0;">Pretty
                                                  simple. Get the
                                                  geometry from the
                                                  feature, check if it's
                                                  a polygon, if it is
                                                  then count the number
                                                  of vertices and return
                                                  that number.</p>
                                                <p style="font-size:
                                                  14px; line-height:
                                                  1.4em; color: #444444;
                                                  font-family:
                                                  "Helvetica
                                                  Neue", Helvetica,
                                                  Arial, sans-serif;
                                                  margin: 0 0 1em 0;">Now
                                                  that we have that all
                                                  done we can save it
                                                  into a file in our <code>.qgis/python</code> folder,
                                                  lets call it <strong>userfunctions.py</strong>
                                                  (note you don't have
                                                  to save it here,
                                                  anywhere that QGIS can
                                                  find it will do.
                                                   Anywhere on PATH)</p>
                                                <p style="font-size:
                                                  14px; line-height:
                                                  1.4em; color: #444444;
                                                  font-family:
                                                  "Helvetica
                                                  Neue", Helvetica,
                                                  Arial, sans-serif;
                                                  margin: 0 0 1em 0;">Lets
                                                  open QGIS and run
                                                  import <strong>userfunctions.py:</strong></p>
                                                <p style="font-size:
                                                  14px; line-height:
                                                  1.4em; color: #444444;
                                                  font-family:
                                                  "Helvetica
                                                  Neue", Helvetica,
                                                  Arial, sans-serif;
                                                  margin: 0 0 1em 0;">
                                                </p>
                                                <div
                                                  id="attachment_1193"
                                                  class="" style="
                                                  clear:both;
                                                  text-align: center;
                                                  margin: 0 auto;
                                                  padding: 4px;
                                                  background-color:
                                                  white; border: 1px
                                                  solid #ccc"><a
                                                    moz-do-not-send="true"
href="http://woostuff.files.wordpress.com/2012/11/import.png"
                                                    style="text-decoration:
                                                    none; color:
                                                    #0088cc;
                                                    text-decoration:
                                                    underline; color:
                                                    #2585B2;"><img
                                                      moz-do-not-send="true"
                                                      style="max-width:
                                                      100%; height:
                                                      auto;
                                                      margin-bottom:
                                                      12px;"
                                                      class="size-full
                                                      wp-image-1193"
                                                      title="import
                                                      functions" alt=""
src="http://woostuff.files.wordpress.com/2012/11/import.png?w=630&h=266"
                                                      border="0"></a>
                                                  <p
                                                    class="wp-caption-text"
                                                    style="font-size:
                                                    14px; line-height:
                                                    1.4em; color:
                                                    #444444;
                                                    font-family:
                                                    "Helvetica
                                                    Neue",
                                                    Helvetica, Arial,
                                                    sans-serif; margin:
                                                    0 0 1em 0;">Importing
                                                    functions from
                                                    userfunctions.py</p>
                                                </div>
                                                <p style="font-size:
                                                  14px; line-height:
                                                  1.4em; color: #444444;
                                                  font-family:
                                                  "Helvetica
                                                  Neue", Helvetica,
                                                  Arial, sans-serif;
                                                  margin: 0 0 1em 0;">Now
                                                  open the label
                                                  properties for the
                                                  layer:</p>
                                                <p style="font-size:
                                                  14px; line-height:
                                                  1.4em; color: #444444;
                                                  font-family:
                                                  "Helvetica
                                                  Neue", Helvetica,
                                                  Arial, sans-serif;
                                                  margin: 0 0 1em 0;">
                                                </p>
                                                <div
                                                  id="attachment_1195"
                                                  class="" style="
                                                  clear:both;
                                                  text-align: center;
                                                  margin: 0 auto;
                                                  padding: 4px;
                                                  background-color:
                                                  white; border: 1px
                                                  solid #ccc"><a
                                                    moz-do-not-send="true"
href="http://woostuff.files.wordpress.com/2012/11/expression.png"
                                                    style="text-decoration:
                                                    none; color:
                                                    #0088cc;
                                                    text-decoration:
                                                    underline; color:
                                                    #2585B2;"><img
                                                      moz-do-not-send="true"
                                                      style="max-width:
                                                      100%; height:
                                                      auto;
                                                      margin-bottom:
                                                      12px;"
                                                      class="size-full
                                                      wp-image-1195"
                                                      title="New
                                                      function" alt=""
src="http://woostuff.files.wordpress.com/2012/11/expression.png?w=481&h=526"
                                                      border="0"></a>
                                                  <p
                                                    class="wp-caption-text"
                                                    style="font-size:
                                                    14px; line-height:
                                                    1.4em; color:
                                                    #444444;
                                                    font-family:
                                                    "Helvetica
                                                    Neue",
                                                    Helvetica, Arial,
                                                    sans-serif; margin:
                                                    0 0 1em 0;">The new
                                                    function shown in
                                                    the expression
                                                    builder</p>
                                                </div>
                                                <p style="font-size:
                                                  14px; line-height:
                                                  1.4em; color: #444444;
                                                  font-family:
                                                  "Helvetica
                                                  Neue", Helvetica,
                                                  Arial, sans-serif;
                                                  margin: 0 0 1em 0;">Nice!
                                                  Notice also that the
                                                  function doc string is
                                                  used as the function
                                                  help. How cool is
                                                  that.  You can also
                                                  see the $ sign in
                                                  front of the function,
                                                  this is because any
                                                  functions that take no
                                                  args are considered
                                                  special and use the $
                                                  sign as a convention,
                                                  this is all automatic
                                                  when the function is
                                                  registered.</p>
                                                <p style="font-size:
                                                  14px; line-height:
                                                  1.4em; color: #444444;
                                                  font-family:
                                                  "Helvetica
                                                  Neue", Helvetica,
                                                  Arial, sans-serif;
                                                  margin: 0 0 1em 0;">And
                                                  the result is:</p>
                                                <p style="font-size:
                                                  14px; line-height:
                                                  1.4em; color: #444444;
                                                  font-family:
                                                  "Helvetica
                                                  Neue", Helvetica,
                                                  Arial, sans-serif;
                                                  margin: 0 0 1em 0;">
                                                </p>
                                                <div
                                                  id="attachment_1196"
                                                  class="" style="
                                                  clear:both;
                                                  text-align: center;
                                                  margin: 0 auto;
                                                  padding: 4px;
                                                  background-color:
                                                  white; border: 1px
                                                  solid #ccc"><a
                                                    moz-do-not-send="true"
href="http://woostuff.files.wordpress.com/2012/11/result.png"
                                                    style="text-decoration:
                                                    none; color:
                                                    #0088cc;
                                                    text-decoration:
                                                    underline; color:
                                                    #2585B2;"><img
                                                      moz-do-not-send="true"
                                                      style="max-width:
                                                      100%; height:
                                                      auto;
                                                      margin-bottom:
                                                      12px;"
                                                      class="size-full
                                                      wp-image-1196"
                                                      title="Result of
                                                      new function"
                                                      alt=""
src="http://woostuff.files.wordpress.com/2012/11/result.png?w=630&h=479"
                                                      border="0"></a>
                                                  <p
                                                    class="wp-caption-text"
                                                    style="font-size:
                                                    14px; line-height:
                                                    1.4em; color:
                                                    #444444;
                                                    font-family:
                                                    "Helvetica
                                                    Neue",
                                                    Helvetica, Arial,
                                                    sans-serif; margin:
                                                    0 0 1em 0;">The
                                                    label using the new
                                                    function</p>
                                                </div>
                                                <p style="font-size:
                                                  14px; line-height:
                                                  1.4em; color: #444444;
                                                  font-family:
                                                  "Helvetica
                                                  Neue", Helvetica,
                                                  Arial, sans-serif;
                                                  margin: 0 0 1em 0;">You
                                                  can even use it in the
                                                  rule based rendering:</p>
                                                <p style="font-size:
                                                  14px; line-height:
                                                  1.4em; color: #444444;
                                                  font-family:
                                                  "Helvetica
                                                  Neue", Helvetica,
                                                  Arial, sans-serif;
                                                  margin: 0 0 1em 0;">
                                                </p>
                                                <div
                                                  id="attachment_1198"
                                                  class="" style="
                                                  clear:both;
                                                  text-align: center;
                                                  margin: 0 auto;
                                                  padding: 4px;
                                                  background-color:
                                                  white; border: 1px
                                                  solid #ccc"><a
                                                    moz-do-not-send="true"
href="http://woostuff.files.wordpress.com/2012/11/rules.png"
                                                    style="text-decoration:
                                                    none; color:
                                                    #0088cc;
                                                    text-decoration:
                                                    underline; color:
                                                    #2585B2;"><img
                                                      moz-do-not-send="true"
                                                      style="max-width:
                                                      100%; height:
                                                      auto;
                                                      margin-bottom:
                                                      12px;"
                                                      class="size-full
                                                      wp-image-1198"
                                                      title="Rules"
                                                      alt=""
src="http://woostuff.files.wordpress.com/2012/11/rules.png?w=630&h=423"
                                                      border="0"></a>
                                                  <p
                                                    class="wp-caption-text"
                                                    style="font-size:
                                                    14px; line-height:
                                                    1.4em; color:
                                                    #444444;
                                                    font-family:
                                                    "Helvetica
                                                    Neue",
                                                    Helvetica, Arial,
                                                    sans-serif; margin:
                                                    0 0 1em 0;">Rule
                                                    rendering using new
                                                    function</p>
                                                </div>
                                                <p style="font-size:
                                                  14px; line-height:
                                                  1.4em; color: #444444;
                                                  font-family:
                                                  "Helvetica
                                                  Neue", Helvetica,
                                                  Arial, sans-serif;
                                                  margin: 0 0 1em 0;">Enjoy!</p>
                                                <h2>Notes</h2>
                                                <ul style="margin: 0 0
                                                  1em 0; padding: 0;
                                                  margin-left: 1em;
                                                  margin: 0 0 1em 1em;
                                                  padding: 0; font-size:
                                                  14px; line-height:
                                                  1.4em; color: #444444;
                                                  font-family:
                                                  "Helvetica
                                                  Neue", Helvetica,
                                                  Arial, sans-serif;">
                                                  <li
                                                    style="line-height:
                                                    1.6; margin-left:
                                                    1em; line-height:
                                                    1.6; margin-left:
                                                    1em; font-size:
                                                    14px; line-height:
                                                    1.4em; color:
                                                    #444444;
                                                    font-family:
                                                    "Helvetica
                                                    Neue",
                                                    Helvetica, Arial,
                                                    sans-serif;">You
                                                    must unregister a
                                                    function once you
                                                    are finished with it
                                                    using
                                                    QgsExpression.unregisterFunction(name).
                                                    This mainly applies
                                                    to plugins where the
                                                    user might unload
                                                    your plugin and the
                                                    code is no
                                                    longer available. In
                                                    the above example we
                                                    could import
                                                    userfunctions and
                                                    never unregister
                                                    because we plan on
                                                    using it for the
                                                    whole session.</li>
                                                  <li
                                                    style="line-height:
                                                    1.6; margin-left:
                                                    1em; line-height:
                                                    1.6; margin-left:
                                                    1em; font-size:
                                                    14px; line-height:
                                                    1.4em; color:
                                                    #444444;
                                                    font-family:
                                                    "Helvetica
                                                    Neue",
                                                    Helvetica, Arial,
                                                    sans-serif;">You
                                                    can't override
                                                    the built-in methods.</li>
                                                </ul>
                                              </div>
                                              <div style="color: #999;
                                                font-size: 0.9em;
                                                margin-top: 4px; color:
                                                #999; font-size: 0.9em;
                                                margin-top: 4px;
                                                line-height: 160%;
                                                padding: 15px 0 15px;
                                                border-top: 1px solid
                                                #eee; border-bottom: 1px
                                                solid #eee; overflow:
                                                hidden" class="meta"> <strong><a
moz-do-not-send="true"
                                                    href="http://woostuff.wordpress.com/author/madmanwoo/"
                                                    style="text-decoration:
                                                    none; color:
                                                    #0088cc;
                                                    text-decoration:
                                                    underline; color:
                                                    #2585B2;">Nathan</a></strong>
                                                | November 10, 2012 at
                                                4:38 pm | Categories: <a
                                                  moz-do-not-send="true"
href="http://woostuff.wordpress.com/?cat=25" style="text-decoration:
                                                  none; color: #0088cc;
                                                  text-decoration:
                                                  underline; color:
                                                  #2585B2;">Open Source</a>
                                                | URL: <a
                                                  moz-do-not-send="true"
href="http://wp.me/pjIwZ-jc" style="text-decoration: none; color:
                                                  #0088cc;
                                                  text-decoration:
                                                  underline; color:
                                                  #2585B2;">http://wp.me/pjIwZ-jc</a>
                                              </div>
                                              <p style="font-size: 14px;
                                                padding: 0; color: #666;
                                                padding-top: 1em;
                                                padding-bottom: 0em;
                                                margin-bottom: 0;
                                                margin-left: 0;
                                                padding-left: 0;"
                                                class="subscribe-action-links">
                                                <table style="width:
                                                  100%;" border="0"
                                                  cellpadding="0"
                                                  cellspacing="0">
                                                  <tbody>
                                                    <tr>
                                                      <td style="width:
                                                        10px;"><a
                                                          moz-do-not-send="true"
                                                          style="-moz-border-radius:
                                                          10em;
                                                          -webkit-border-radius:
                                                          10em;
                                                          border-radius:
                                                          10em; border:
                                                          1px solid
                                                          #11729E;
                                                          text-decoration:
                                                          none; color:
                                                          #fff;
                                                          text-shadow: 0
                                                          1px 0 #11729E;
                                                          background-color:
                                                          #2585B2;
                                                          padding: 5px
                                                          15px;
                                                          font-size:
                                                          16px;
                                                          line-height:
                                                          1.4em;
                                                          font-family:
                                                          Helvetica
                                                          Neue,
                                                          Helvetica,
                                                          Arial,
                                                          sans-serif;
                                                          font-weight:
                                                          normal;
                                                          margin-left:
                                                          0;
                                                          white-space:
                                                          nowrap;"
href="http://woostuff.wordpress.com/2012/11/10/user-defined-expression-functions-for-qgis/#respond">Comment</a></td>
                                                      <td>   <a
                                                          moz-do-not-send="true"
                                                          style="font-size:
                                                          14px;
                                                          text-decoration:
                                                          underline;
                                                          text-decoration:
                                                          none; color:
                                                          #0088cc;
                                                          text-decoration:
                                                          underline;
                                                          color:
                                                          #2585B2;"
                                                          class="subscribe-action-link"
href="http://woostuff.wordpress.com/2012/11/10/user-defined-expression-functions-for-qgis/#comments">See
                                                          all comments</a></td>
                                                    </tr>
                                                  </tbody>
                                                </table>
                                              </p>
                                            </td>
                                          </tr>
                                        </tbody>
                                      </table>
                                    </td>
                                  </tr>
                                </tbody>
                              </table>
                              <table style="background-color: #efefef;
                                text-align: left; border-top: 1px solid
                                #dddddd; width: 100%;"
                                class="subscribe-wrapper-sub"
                                bgcolor="#efefef" border="0"
                                cellpadding="20" cellspacing="0">
                                <tbody>
                                  <tr>
                                    <td style="border-top: 1px solid
                                      #f3f3f3; color: #888; font-family:
                                      "Helvetica Neue",
                                      Helvetica, Arial, sans-serif;
                                      font-size: 14px; background:
                                      #efefef;"
                                      class="subscribe-content">
                                      <p style="font-size: 12px;
                                        line-height: 1.4em; margin: 0px
                                        0px 10px 0px;"> Unsubscribe or
                                        change your email settings at <a
                                          moz-do-not-send="true"
href="https://subscribe.wordpress.com/?key=5d8fffc771bced9f7eeeda3b07f875c6&email=cavallini%40faunalia.it"
                                          style="text-decoration: none;
                                          color: #0088cc;
                                          text-decoration: underline;
                                          color: #2585B2;">Manage
                                          Subscriptions</a>. </p>
                                      <p style="font-size: 12px;
                                        line-height: 1.4em; margin: 0px
                                        0px 0px 0px;"> <strong>Trouble
                                          clicking?</strong> Copy and
                                        paste this URL into your
                                        browser: <br>
                                        <a moz-do-not-send="true"
href="http://woostuff.wordpress.com/2012/11/10/user-defined-expression-functions-for-qgis/"
                                          style="text-decoration: none;
                                          color: #0088cc;
                                          text-decoration: underline;
                                          color: #2585B2;">http://woostuff.wordpress.com/2012/11/10/user-defined-expression-functions-for-qgis/</a>
                                      </p>
                                    </td>
                                  </tr>
                                </tbody>
                              </table>
                            </td>
                          </tr>
                        </tbody>
                      </table>
                      <table style="background-image: url(
                        'http://s.wordpress.com/i/emails/stripes.gif');
                        background-repeat: repeat-x; background-color:
                        #43A4D0; height: 3px; width: 100%;"
                        class="subscribe-footer-wrap"
                        background="http:/s.wordpress.com/i/emails/stripes.gif"
                        border="0" height="3" cellpadding="0"
                        cellspacing="0">
                        <tbody>
                          <tr>
                            <td><br>
                            </td>
                          </tr>
                        </tbody>
                      </table>
                    </div>
                  </td>
                </tr>
              </tbody>
            </table>
            <table style="padding-bottom: 2em; color: #555555;
              font-size: 12px; height: 18px; text-align: center;
              font-family: "Helvetica Neue", Helvetica, Arial,
              sans-serif; width: 100%;" class="subscribe-footer"
              align="center" border="0" width="100%" cellpadding="0"
              cellspacing="0">
              <tbody>
                <tr>
                  <td align="center"> <a moz-do-not-send="true"
                      style="font-size: 14px; color: #555555 !important;
                      text-decoration: none; font-family:
                      "Helvetica Neue", Helvetica, Arial,
                      sans-serif; color: #555 !important; font-size:
                      14px; text-decoration: none;"
                      class="subscribe-footer-link"
                      href="http://wordpress.com">Thanks for flying with
                      <img moz-do-not-send="true"
                        src="http://s.wordpress.com/i/emails/wp-footericon.png"
                        alt="" style="vertical-align: middle;" and=""
                        border="0" height="17" width="16"> WordPress.com</a>
                  </td>
                </tr>
              </tbody>
            </table>
            <br>
          </td>
        </tr>
      </tbody>
    </table>
    <img moz-do-not-send="true" alt=""
src="http://stats.wordpress.com/b.gif?host=woostuff.wordpress.com&blog=4699413&post=1190&subd=woostuff&ref=&email=1&email_o=wpcom"
      border="0" height="1" width="1">
  </body>
</html>