You are on page 1of 6

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.

org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>gui.qgis_interface &mdash; InaSAFE 0.4.1-alpha documentation</title> <link rel="stylesheet" href="../../_static/cloud.css" type="text/css" /> <link rel="stylesheet" href="../../_static/pygments.css" type="text/css" /> <link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Noticia+ Text|Droid+Sans+Mono" type="text/css" /> <script type="text/javascript"> var DOCUMENTATION_OPTIONS = { URL_ROOT: '../../', VERSION: '0.4.1-alpha', COLLAPSE_INDEX: false, FILE_SUFFIX: '.html', HAS_SOURCE: true }; </script> <script type="text/javascript" src="../../_static/jquery.js"></script> <script type="text/javascript" src="../../_static/underscore.js"></script> <script type="text/javascript" src="../../_static/doctools.js"></script> <script type="text/javascript" src="../../_static/jquery.cookie.js"></script > <script type="text/javascript" src="../../_static/toggle_sections.js"></scri pt> <link rel="top" title="InaSAFE 0.4.1-alpha documentation" href="../../index. html" /> <link rel="up" title="Module code" href="../index.html" /> </head> <body> <div class="relbar-top"> <div class="related"> <h3>Navigation</h3> <ul> <li class="right" style="margin-right: 10px"> <a href="../../genindex.html" title="General Index" accesskey="I">index</a></li> <li class="right" > <a href="../../py-modindex.html" title="Python Module Index" >modules</a> &nbsp; &nbsp;</li> <li><a href="../../index.html">Home</a> &raquo;</li> <li><a href="../../contents.html">Contents</a> &raquo;</li> <li><a href="../index.html" accesskey="U">Module code</a> &raquo;</li> </ul> </div> </div>

<div class="document"> <div class="documentwrapper"> <div class="bodywrapper"> <div class="body"> <h1>Source code for gui.qgis_interface</h1><div class="highlight"><pre> <span class="sd">&quot;&quot;&quot;</span> <span class="sd">InaSAFE Disaster risk assessment tool developed by AusAid -</sp an> <span class="sd">**QGIS plugin implementation.**</span> <span class="sd">Contact : ole.moller.nielsen@gmail.com</span> <span class="sd">.. note:: This program is free software; you can redistribute i t and/or modify</span> <span class="sd"> it under the terms of the GNU General Public License as pu blished by</span> <span class="sd"> the Free Software Foundation; either version 2 of the Lice nse, or</span> <span class="sd"> (at your option) any later version.</span> <span class="sd">.. note:: This source code was copied from the &#39;postgis vie wer&#39; application</span> <span class="sd"> with original authors:</span> <span class="sd"> Copyright (c) 2010 by Ivan Mincik, ivan.mincik@gista.sk</s pan> <span class="sd"> Copyright (c) 2011 German Carrillo, geotux_tuxman@linuxmai l.org</span> <span class="sd">&quot;&quot;&quot;</span> <span class="n">__author__</span> <span class="o">=</span> <span class="s">&#39; tim@linfiniti.com&#39;</span> <span class="n">__version__</span> <span class="o">=</span> <span class="s">&#39 ;0.3.1&#39;</span> <span class="n">__date__</span> <span class="o">=</span> <span class="s">&#39;10 /01/2011&#39;</span> <span class="n">__copyright__</span> <span class="o">=</span> <span class="p">(< /span><span class="s">&#39;Copyright (c) 2010 by Ivan Mincik, ivan.mincik@gista. sk and &#39;</span> <span class="s">&#39;Copyright (c) 2011 German Carrillo, &#39;< /span> <span class="s">&#39;geotux_tuxman@linuxmail.org&#39;</span><sp an class="p">)</span> <span class="kn">from</span> <span class="nn">PyQt4.QtCore</span> <span class="k n">import</span> <span class="n">QObject</span> <span class="kn">from</span> <span class="nn">qgis.core</span> <span class="kn"> import</span> <span class="n">QgsMapLayerRegistry</span> <div class="viewcode-block" id="QgisInterface"><a class="viewcode-back" href=".. /../api-docs/gui/qgis_interface.html#gui.qgis_interface.QgisInterface">[docs]</a ><span class="k">class</span> <span class="nc">QgisInterface</span><span class=" p">(</span><span class="n">QObject</span><span class="p">):</span> <span class="sd">&quot;&quot;&quot;Class to expose qgis objects and function alities to plugins.</span> <span class="sd"> This class is here for enabling us to run unit tests only,<

/span> <span class="sd"> <span class="sd">

so most methods are simply stubs.</span> &quot;&quot;&quot;</span>

<span class="k">def</span> <span class="nf">__init__</span><span class="p">( </span><span class="bp">self</span><span class="p">,</span> <span class="n">canv as</span><span class="p">):</span> <span class="sd">&quot;&quot;&quot;Constructor&quot;&quot;&quot;</span> <span class="n">QObject</span><span class="o">.</span><span class="n">__ init__</span><span class="p">(</span><span class="bp">self</span><span class="p" >)</span> <span class="bp">self</span><span class="o">.</span><span class="n">canv as</span> <span class="o">=</span> <span class="n">canvas</span> <div class="viewcode-block" id="QgisInterface.zoomFull"><a class="viewcode-back" href="../../api-docs/gui/qgis_interface.html#gui.qgis_interface.QgisInterface.z oomFull">[docs]</a> <span class="k">def</span> <span class="nf">zoomFull</spa n><span class="p">(</span><span class="bp">self</span><span class="p">):</span> <span class="sd">&quot;&quot;&quot;Zoom to the map full extent&quot;&quo t;&quot;</span> <span class="k">pass</span> </div> <div class="viewcode-block" id="QgisInterface.zoomToPrevious"><a class="viewcode -back" href="../../api-docs/gui/qgis_interface.html#gui.qgis_interface.QgisInter face.zoomToPrevious">[docs]</a> <span class="k">def</span> <span class="nf">z oomToPrevious</span><span class="p">(</span><span class="bp">self</span><span cl ass="p">):</span> <span class="sd">&quot;&quot;&quot;Zoom to previous view extent&quot;&qu ot;&quot;</span> <span class="k">pass</span> </div> <div class="viewcode-block" id="QgisInterface.zoomToNext"><a class="viewcode-bac k" href="../../api-docs/gui/qgis_interface.html#gui.qgis_interface.QgisInterface .zoomToNext">[docs]</a> <span class="k">def</span> <span class="nf">zoomToNex t</span><span class="p">(</span><span class="bp">self</span><span class="p">):</ span> <span class="sd">&quot;&quot;&quot;Zoom to next view extent&quot;&quot;& quot;</span> <span class="k">pass</span> </div> <div class="viewcode-block" id="QgisInterface.zoomToActiveLayer"><a class="viewc ode-back" href="../../api-docs/gui/qgis_interface.html#gui.qgis_interface.QgisIn terface.zoomToActiveLayer">[docs]</a> <span class="k">def</span> <span class= "nf">zoomToActiveLayer</span><span class="p">(</span><span class="bp">self</span ><span class="p">):</span> <span class="sd">&quot;&quot;&quot;Zoom to extent of active layer&quot;& quot;&quot;</span> <span class="k">pass</span> </div> <div class="viewcode-block" id="QgisInterface.addVectorLayer"><a class="viewcode -back" href="../../api-docs/gui/qgis_interface.html#gui.qgis_interface.QgisInter face.addVectorLayer">[docs]</a> <span class="k">def</span> <span class="nf">a ddVectorLayer</span><span class="p">(</span><span class="bp">self</span><span cl ass="p">,</span> <span class="n">vectorLayerPath</span><span class="p">,</span> <span class="n">baseName</span><span class="p">,</span> <span class="n">provider Key</span><span class="p">):</span> <span class="sd">&quot;&quot;&quot;Add a vector layer&quot;&quot;&quot;< /span> <span class="k">pass</span> </div>

<div class="viewcode-block" id="QgisInterface.addRasterLayer"><a class="viewcode -back" href="../../api-docs/gui/qgis_interface.html#gui.qgis_interface.QgisInter face.addRasterLayer">[docs]</a> <span class="k">def</span> <span class="nf">a ddRasterLayer</span><span class="p">(</span><span class="bp">self</span><span cl ass="p">,</span> <span class="n">rasterLayerPath</span><span class="p">,</span> <span class="n">baseName</span><span class="p">):</span> <span class="sd">&quot;&quot;&quot;Add a raster layer given a raster lay er file name&quot;&quot;&quot;</span> <span class="k">pass</span> </div> <div class="viewcode-block" id="QgisInterface.activeLayer"><a class="viewcode-ba ck" href="../../api-docs/gui/qgis_interface.html#gui.qgis_interface.QgisInterfac e.activeLayer">[docs]</a> <span class="k">def</span> <span class="nf">activeL ayer</span><span class="p">(</span><span class="bp">self</span><span class="p">) :</span> <span class="sd">&quot;&quot;&quot;Get pointer to the active layer (laye r selected in the legend)&quot;&quot;&quot;</span> <span class="n">myLayers</span> <span class="o">=</span> <span class="n" >QgsMapLayerRegistry</span><span class="o">.</span><span class="n">instance</spa n><span class="p">()</span><span class="o">.</span><span class="n">mapLayers</sp an><span class="p">()</span> <span class="k">for</span> <span class="n">myItem</span> <span class="ow ">in</span> <span class="n">myLayers</span><span class="p">:</span> <span class="k">return</span> <span class="n">myLayers</span><span c lass="p">[</span><span class="n">myItem</span><span class="p">]</span> </div> <div class="viewcode-block" id="QgisInterface.addToolBarIcon"><a class="viewcode -back" href="../../api-docs/gui/qgis_interface.html#gui.qgis_interface.QgisInter face.addToolBarIcon">[docs]</a> <span class="k">def</span> <span class="nf">a ddToolBarIcon</span><span class="p">(</span><span class="bp">self</span><span cl ass="p">,</span> <span class="n">qAction</span><span class="p">):</span> <span class="sd">&quot;&quot;&quot;Add an icon to the plugins toolbar&qu ot;&quot;&quot;</span> <span class="k">pass</span> </div> <div class="viewcode-block" id="QgisInterface.removeToolBarIcon"><a class="viewc ode-back" href="../../api-docs/gui/qgis_interface.html#gui.qgis_interface.QgisIn terface.removeToolBarIcon">[docs]</a> <span class="k">def</span> <span class= "nf">removeToolBarIcon</span><span class="p">(</span><span class="bp">self</span ><span class="p">,</span> <span class="n">qAction</span><span class="p">):</span > <span class="sd">&quot;&quot;&quot;Remove an action (icon) from the plug in toolbar&quot;&quot;&quot;</span> <span class="k">pass</span> </div> <div class="viewcode-block" id="QgisInterface.addToolBar"><a class="viewcode-bac k" href="../../api-docs/gui/qgis_interface.html#gui.qgis_interface.QgisInterface .addToolBar">[docs]</a> <span class="k">def</span> <span class="nf">addToolBa r</span><span class="p">(</span><span class="bp">self</span><span class="p">,</s pan> <span class="n">name</span><span class="p">):</span> <span class="sd">&quot;&quot;&quot;Add toolbar with specified name&quot; &quot;&quot;</span> <span class="k">pass</span> </div> <div class="viewcode-block" id="QgisInterface.mapCanvas"><a class="viewcode-back " href="../../api-docs/gui/qgis_interface.html#gui.qgis_interface.QgisInterface. mapCanvas">[docs]</a> <span class="k">def</span> <span class="nf">mapCanvas</ span><span class="p">(</span><span class="bp">self</span><span class="p">):</spa n> <span class="sd">&quot;&quot;&quot;Return a pointer to the map canvas&qu

ot;&quot;&quot;</span> <span class="k">return</span> <span class="bp">self</span><span class="o ">.</span><span class="n">canvas</span> </div> <div class="viewcode-block" id="QgisInterface.mainWindow"><a class="viewcode-bac k" href="../../api-docs/gui/qgis_interface.html#gui.qgis_interface.QgisInterface .mainWindow">[docs]</a> <span class="k">def</span> <span class="nf">mainWindo w</span><span class="p">(</span><span class="bp">self</span><span class="p">):</ span> <span class="sd">&quot;&quot;&quot;Return a pointer to the main window</ span> <span class="sd"> In case of QGIS it returns an instance of QgisApp</span > <span class="sd"> &quot;&quot;&quot;</span> <span class="k">pass</span> </div> <div class="viewcode-block" id="QgisInterface.addDockWidget"><a class="viewcodeback" href="../../api-docs/gui/qgis_interface.html#gui.qgis_interface.QgisInterf ace.addDockWidget">[docs]</a> <span class="k">def</span> <span class="nf">add DockWidget</span><span class="p">(</span><span class="bp">self</span><span class ="p">,</span> <span class="n">area</span><span class="p">,</span> <span class="n ">dockwidget</span><span class="p">):</span> <span class="sd">&quot;&quot;&quot; Add a dock widget to the main window &quot;&quot;&quot;</span> <span class="k">pass</span></div></div> </pre></div> </div> </div> </div> <div class="sphinxsidebar"> <div class="sphinxsidebarwrapper"> <p class="logo"><a href="../../contents.html"> <img class="logo" src="../../_static/icon.png" alt="Logo"/> </a></p> <div id="searchbox" style="display: none"> <h3>Quick search</h3> <form class="search" action="../../search.html" method="get"> <input type="text" name="q" /> <input type="submit" value="Go" /> <input type="hidden" name="check_keywords" value="yes" /> <input type="hidden" name="area" value="default" /> </form> <p class="searchtip" style="font-size: 90%"> Enter search terms or a module, class or function name. </p> </div> <script type="text/javascript">$('#searchbox').show(0);</script> </div> </div> <div class="clearer"></div> </div> <div class="relbar-bottom"> <div class="related"> <h3>Navigation</h3> <ul> <li class="right" style="margin-right: 10px"> <a href="../../genindex.html" title="General Index"

>index</a></li> <li class="right" > <a href="../../py-modindex.html" title="Python Module Index" >modules</a> &nbsp; &nbsp;</li> <li><a href="../../index.html">Home</a> &raquo;</li> <li><a href="../../contents.html">Contents</a> &raquo;</li> <li><a href="../index.html" >Module code</a> &raquo;</li> </ul> </div> </div> <div class="footer"> &copy; Copyright 2012, BNPB/AIFDR/GFDRR. Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.1.2. </div> <!-- cloud_sptheme 1.3 --> </body> </html>

You might also like