Delimited text plugin moved to core
| 
		 Before Width: | Height: | Size: 111 KiB  | 
| 
		 Before Width: | Height: | Size: 292 B  | 
| 
		 Before Width: | Height: | Size: 112 KiB  | 
| 
		 Before Width: | Height: | Size: 110 KiB  | 
| 
		 Before Width: | Height: | Size: 111 KiB  | 
| 
		 Before Width: | Height: | Size: 115 KiB  | 
@ -1,70 +0,0 @@
 | 
			
		||||
<html>
 | 
			
		||||
  <body>
 | 
			
		||||
    <h1>Delmited Text Plugin</h1>
 | 
			
		||||
    The Delimited Text plugin allows you to load a delimited text file
 | 
			
		||||
    as a layer in QGIS. 
 | 
			
		||||
    <h2>Requirements</h2>
 | 
			
		||||
    To view a delimited text file as layer, the text file must contain:
 | 
			
		||||
    <ol>
 | 
			
		||||
      <li>A delimited header row of field names. This must be the
 | 
			
		||||
      first line in the text file</li>
 | 
			
		||||
      <li>The header row must contain an X and Y field. These fields
 | 
			
		||||
      can have any name.</li>
 | 
			
		||||
      <li>The x and y coordinates must be specified as a number. The
 | 
			
		||||
      coordinate system is not important</li>
 | 
			
		||||
      <h3>Example of a valid text file</h3>
 | 
			
		||||
      <pre>
 | 
			
		||||
        name|latdec|longdec|cell|
 | 
			
		||||
        196 mile creek|61.89806|-150.0775|tyonek d-1 ne|
 | 
			
		||||
        197 1/2 mile creek|61.89472|-150.09972|tyonek d-1 ne|
 | 
			
		||||
        a b mountain|59.52889|-135.28333|skagway c-1 sw|
 | 
			
		||||
        apw dam number 2|60.53|-145.75167|cordova c-5 sw|
 | 
			
		||||
        apw reservoir|60.53167|-145.75333|cordova c-5 sw|
 | 
			
		||||
        apw reservoir|60.53|-145.75167|cordova c-5 sw|
 | 
			
		||||
        aaron creek|56.37861|-131.96556|bradfield canal b-6|
 | 
			
		||||
        aaron island|58.43778|-134.81944|juneau b-3 ne|
 | 
			
		||||
        aats bay|55.905|-134.24639|craig d-7|
 | 
			
		||||
      </pre>
 | 
			
		||||
      Some items of note about the text file are:
 | 
			
		||||
      <ol>
 | 
			
		||||
        <li> The example text file uses | as delimter. Any character can be used to
 | 
			
		||||
        delimit the fields.</li>
 | 
			
		||||
        <li>The first row is the header row. It contains the fields name, latdec, longdec, and cell</li>
 | 
			
		||||
        <li>No quotes (") are used to delimit text fields</li>
 | 
			
		||||
        <li>The x coordinates are contained in the <i>longdec</i> field</li>
 | 
			
		||||
        <li>The y coordinates are contained in the <i>latdec</i> field</li>
 | 
			
		||||
 | 
			
		||||
      </ol>
 | 
			
		||||
      <h2>Using the Plugin</h2>
 | 
			
		||||
      To use the plugin you must have QGIS running and use the Plugin Manager to load the plugin:
 | 
			
		||||
      <ol>
 | 
			
		||||
        <li>Start QGIS</li>
 | 
			
		||||
        <li>Open the Plugin Manager by choosing the <i>Tools|Plugin Manager</i> menu. The
 | 
			
		||||
        Plugin Manager displays a list of available plugins. Plugins that are already loaded have
 | 
			
		||||
        a checkmark to the left of their name. Click on the checkbox to the left of the <i>Add Delimited Text
 | 
			
		||||
          Layer</i> plugin and click Ok to load it.<br><br>
 | 
			
		||||
        <img src="plugin_manager.png" alt="Plugin Manager"> 
 | 
			
		||||
        </li>
 | 
			
		||||
        <li>A new toolbar icon is now present: 
 | 
			
		||||
        <img src="toolbar_icon.png" align="absmiddle" alt="Delimited Text toolbar icon"></li>
 | 
			
		||||
        <li>Click on the icon to open the Delimited Text dialog:
 | 
			
		||||
        <br><br>
 | 
			
		||||
        <img src="dialog.png" alt="Add delimited text layer dialog"><br><br>
 | 
			
		||||
 | 
			
		||||
        </li>
 | 
			
		||||
        <li>First select the file to import by clicking on the ellipsis button: <img src="ellipsis.png" align="absmiddle"><br></li>
 | 
			
		||||
        <li>Select the desired text file from the file dialog</li>
 | 
			
		||||
        <li>Once the file is selected, the plugin attempts to parse the file using the last used delimiter, in this case |<br><br>
 | 
			
		||||
        <img src="file_selected.png"><br><br></li>
 | 
			
		||||
        <li>In this case the delimiter | is not correct for the file. The file is actually tab delimited. Note that the X and Y field drop down boxes do not contain valid field names.</li>
 | 
			
		||||
        <li>To properly parse the file, change the delimiter to tab using \t (this is a regular expression for the tab character). After changing the delimiter, click <i>Parse</i></li>
 | 
			
		||||
        <li>The drop down boxes now contain the fields properly parsed:<br><br>
 | 
			
		||||
        <img src="file_selected2.png"><br><br></li>
 | 
			
		||||
        <li>Choose the X and Y fields from the drop down boxes and enter a Layer name<br><br>
 | 
			
		||||
        <img src="file_selected3.png"><br><br></li>
 | 
			
		||||
        <li>Click <i>Add Layer</i></li>
 | 
			
		||||
        <li>The layer is added to the map:<br><br> <img src="layer_added.png"></li>
 | 
			
		||||
        
 | 
			
		||||
        </ol>
 | 
			
		||||
    </body>
 | 
			
		||||
  </html>
 | 
			
		||||
| 
		 Before Width: | Height: | Size: 33 KiB  | 
| 
		 Before Width: | Height: | Size: 21 KiB  | 
| 
		 Before Width: | Height: | Size: 549 B  | 
@ -140,6 +140,7 @@
 | 
			
		||||
        <file>themes/default/mActionAddWcsLayer.png</file>
 | 
			
		||||
        <file>themes/default/mActionAddWfsLayer.png</file>
 | 
			
		||||
        <file>themes/default/mActionAddWmsLayer.png</file>
 | 
			
		||||
        <file>themes/default/mActionAddDelimitedTextLayer.png</file>
 | 
			
		||||
        <file>themes/default/mActionAlignBottom.png</file>
 | 
			
		||||
        <file>themes/default/mActionAlignHCenter.png</file>
 | 
			
		||||
        <file>themes/default/mActionAlignLeft.png</file>
 | 
			
		||||
@ -360,7 +361,6 @@
 | 
			
		||||
        <file>themes/default/plugin.png</file>
 | 
			
		||||
        <file>themes/default/plugins/coordinate_capture/coordinate_capture.png</file>
 | 
			
		||||
        <file>themes/default/plugins/copyright_label.png</file>
 | 
			
		||||
        <file>themes/default/plugins/delimited_text.png</file>
 | 
			
		||||
        <file>themes/default/plugins/dxf2shp_converter.png</file>
 | 
			
		||||
        <file>themes/default/plugins/gps_importer.png</file>
 | 
			
		||||
        <file>themes/default/plugins/gps_importer/create_gpx.png</file>
 | 
			
		||||
 | 
			
		||||
| 
		 Before Width: | Height: | Size: 659 B After Width: | Height: | Size: 659 B  | 
@ -980,6 +980,7 @@ void QgisApp::createActions()
 | 
			
		||||
  connect( mActionAddWmsLayer, SIGNAL( triggered() ), this, SLOT( addWmsLayer() ) );
 | 
			
		||||
  connect( mActionAddWcsLayer, SIGNAL( triggered() ), this, SLOT( addWcsLayer() ) );
 | 
			
		||||
  connect( mActionAddWfsLayer, SIGNAL( triggered() ), this, SLOT( addWfsLayer() ) );
 | 
			
		||||
  connect( mActionAddDelimitedText, SIGNAL( triggered()), this, SLOT(addDelimitedTextLayer()));
 | 
			
		||||
  connect( mActionOpenTable, SIGNAL( triggered() ), this, SLOT( attributeTable() ) );
 | 
			
		||||
  connect( mActionToggleEditing, SIGNAL( triggered() ), this, SLOT( toggleEditing() ) );
 | 
			
		||||
  connect( mActionSaveLayerEdits, SIGNAL( triggered() ), this, SLOT( saveActiveLayerEdits() ) );
 | 
			
		||||
@ -2970,6 +2971,31 @@ void QgisApp::addSpatiaLiteLayer()
 | 
			
		||||
  delete dbs;
 | 
			
		||||
} // QgisApp::addSpatiaLiteLayer()
 | 
			
		||||
 | 
			
		||||
void QgisApp::addDelimitedTextLayer()
 | 
			
		||||
{
 | 
			
		||||
  if ( mMapCanvas && mMapCanvas->isDrawing() )
 | 
			
		||||
  {
 | 
			
		||||
    return;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  // show the Delimited text dialog
 | 
			
		||||
  QDialog *dts = dynamic_cast<QDialog*>( QgsProviderRegistry::instance()->selectWidget( "delimitedtext", this ) );
 | 
			
		||||
  if ( !dts )
 | 
			
		||||
  {
 | 
			
		||||
    QMessageBox::warning( this, tr( "DelimitedText" ), tr( "Cannot get Delimited Text select dialog from provider." ) );
 | 
			
		||||
    return;
 | 
			
		||||
  }
 | 
			
		||||
  connect( dts, SIGNAL( addVectorLayer( QString, QString, QString ) ),
 | 
			
		||||
           this, SLOT( addSelectedVectorLayer( QString, QString, QString ) ) );
 | 
			
		||||
  dts->exec();
 | 
			
		||||
  delete dts;
 | 
			
		||||
} // QgisApp::addDelimitedTextLayer()
 | 
			
		||||
 | 
			
		||||
void QgisApp::addSelectedVectorLayer( QString uri, QString layerName, QString provider )
 | 
			
		||||
{
 | 
			
		||||
  addVectorLayer( uri, layerName, provider );
 | 
			
		||||
} // QgisApp:addSelectedVectorLayer
 | 
			
		||||
 | 
			
		||||
void QgisApp::addMssqlLayer()
 | 
			
		||||
{
 | 
			
		||||
#ifdef HAVE_MSSQL
 | 
			
		||||
 | 
			
		||||
@ -115,7 +115,7 @@ class QgisApp : public QMainWindow, private Ui::MainWindow
 | 
			
		||||
     */
 | 
			
		||||
    QgsVectorLayer* addVectorLayer( QString vectorLayerPath, QString baseName, QString providerKey );
 | 
			
		||||
 | 
			
		||||
    /** \brief overloaded vesion of the privat addLayer method that takes a list of
 | 
			
		||||
    /** \brief overloaded version of the private addLayer method that takes a list of
 | 
			
		||||
     * file names instead of prompting user with a dialog.
 | 
			
		||||
     @param enc encoding type for the layer
 | 
			
		||||
    @param dataSourceType type of ogr datasource
 | 
			
		||||
@ -623,6 +623,10 @@ class QgisApp : public QMainWindow, private Ui::MainWindow
 | 
			
		||||
    void addDatabaseLayers( QStringList const & layerPathList, QString const & providerKey );
 | 
			
		||||
    //! Add a SpatiaLite layer to the map
 | 
			
		||||
    void addSpatiaLiteLayer();
 | 
			
		||||
    //! Add a Delimited Text layer to the map
 | 
			
		||||
    void addDelimitedTextLayer();
 | 
			
		||||
    //! Add a vector layer defined by uri, layer name, data source uri
 | 
			
		||||
    void addSelectedVectorLayer(QString uri, QString layerName, QString provider );
 | 
			
		||||
    //#ifdef HAVE_MSSQL
 | 
			
		||||
    //! Add a MSSQL layer to the map
 | 
			
		||||
    void addMssqlLayer();
 | 
			
		||||
 | 
			
		||||
@ -2,7 +2,6 @@
 | 
			
		||||
SET (CMAKE_RUNTIME_OUTPUT_DIRECTORY ${QGIS_OUTPUT_DIRECTORY}/${QGIS_PLUGIN_SUBDIR})
 | 
			
		||||
SET (CMAKE_LIBRARY_OUTPUT_DIRECTORY ${QGIS_OUTPUT_DIRECTORY}/${QGIS_PLUGIN_SUBDIR})
 | 
			
		||||
 | 
			
		||||
ADD_SUBDIRECTORY(delimited_text)
 | 
			
		||||
ADD_SUBDIRECTORY(diagram_overlay)
 | 
			
		||||
ADD_SUBDIRECTORY(interpolation)
 | 
			
		||||
ADD_SUBDIRECTORY(oracle_raster)
 | 
			
		||||
 | 
			
		||||
@ -1,39 +0,0 @@
 | 
			
		||||
 | 
			
		||||
########################################################
 | 
			
		||||
# Files
 | 
			
		||||
 | 
			
		||||
SET (DLTEXT_SRCS qgsdelimitedtextplugin.cpp)
 | 
			
		||||
 | 
			
		||||
SET (DLTEXT_MOC_HDRS qgsdelimitedtextplugin.h)
 | 
			
		||||
 | 
			
		||||
SET (DLTEXT_RCCS  delimited_text.qrc)
 | 
			
		||||
 | 
			
		||||
########################################################
 | 
			
		||||
# Build
 | 
			
		||||
 | 
			
		||||
QT4_WRAP_CPP (DLTEXT_MOC_SRCS  ${DLTEXT_MOC_HDRS})
 | 
			
		||||
 | 
			
		||||
QT4_ADD_RESOURCES(DLTEXT_RCC_SRCS ${DLTEXT_RCCS})
 | 
			
		||||
 | 
			
		||||
ADD_LIBRARY (delimitedtextplugin MODULE ${DLTEXT_SRCS} ${DLTEXT_MOC_SRCS} ${DLTEXT_RCC_SRCS})
 | 
			
		||||
 | 
			
		||||
INCLUDE_DIRECTORIES(
 | 
			
		||||
     ${CMAKE_CURRENT_BINARY_DIR}
 | 
			
		||||
     ../../core ../../core/raster
 | 
			
		||||
     ../../gui
 | 
			
		||||
     ..
 | 
			
		||||
     ../../providers/delimitedtext/delimitedtext
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
TARGET_LINK_LIBRARIES(delimitedtextplugin
 | 
			
		||||
  qgis_core
 | 
			
		||||
  qgis_gui
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
########################################################
 | 
			
		||||
# Install
 | 
			
		||||
 | 
			
		||||
INSTALL(TARGETS delimitedtextplugin
 | 
			
		||||
  RUNTIME DESTINATION ${QGIS_PLUGIN_DIR}
 | 
			
		||||
  LIBRARY DESTINATION ${QGIS_PLUGIN_DIR})
 | 
			
		||||
@ -1,125 +0,0 @@
 | 
			
		||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
 | 
			
		||||
<!-- Created with Inkscape (http://www.inkscape.org/) -->
 | 
			
		||||
<svg
 | 
			
		||||
   xmlns:dc="http://purl.org/dc/elements/1.1/"
 | 
			
		||||
   xmlns:cc="http://creativecommons.org/ns#"
 | 
			
		||||
   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
 | 
			
		||||
   xmlns:svg="http://www.w3.org/2000/svg"
 | 
			
		||||
   xmlns="http://www.w3.org/2000/svg"
 | 
			
		||||
   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
 | 
			
		||||
   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
 | 
			
		||||
   width="32"
 | 
			
		||||
   height="32"
 | 
			
		||||
   id="svg2"
 | 
			
		||||
   sodipodi:version="0.32"
 | 
			
		||||
   inkscape:version="0.46"
 | 
			
		||||
   version="1.0"
 | 
			
		||||
   sodipodi:docname="delimitedText.svg"
 | 
			
		||||
   inkscape:output_extension="org.inkscape.output.svg.inkscape"
 | 
			
		||||
   inkscape:export-filename="/home/timlinux/dev/cpp/qgis/src/plugins/delimited_text/delimited_text.png"
 | 
			
		||||
   inkscape:export-xdpi="91"
 | 
			
		||||
   inkscape:export-ydpi="91">
 | 
			
		||||
  <defs
 | 
			
		||||
     id="defs4">
 | 
			
		||||
    <marker
 | 
			
		||||
       inkscape:stockid="Arrow2Mend"
 | 
			
		||||
       orient="auto"
 | 
			
		||||
       refY="0.0"
 | 
			
		||||
       refX="0.0"
 | 
			
		||||
       id="Arrow2Mend"
 | 
			
		||||
       style="overflow:visible;">
 | 
			
		||||
      <path
 | 
			
		||||
         id="path3704"
 | 
			
		||||
         style="font-size:12.0;fill-rule:evenodd;stroke-width:0.62500000;stroke-linejoin:round;"
 | 
			
		||||
         d="M 8.7185878,4.0337352 L -2.2072895,0.016013256 L 8.7185884,-4.0017078 C 6.9730900,-1.6296469 6.9831476,1.6157441 8.7185878,4.0337352 z "
 | 
			
		||||
         transform="scale(0.6) rotate(180) translate(0,0)" />
 | 
			
		||||
    </marker>
 | 
			
		||||
    <marker
 | 
			
		||||
       inkscape:stockid="Arrow2Lend"
 | 
			
		||||
       orient="auto"
 | 
			
		||||
       refY="0.0"
 | 
			
		||||
       refX="0.0"
 | 
			
		||||
       id="Arrow2Lend"
 | 
			
		||||
       style="overflow:visible;">
 | 
			
		||||
      <path
 | 
			
		||||
         id="path3698"
 | 
			
		||||
         style="font-size:12.0;fill-rule:evenodd;stroke-width:0.62500000;stroke-linejoin:round;"
 | 
			
		||||
         d="M 8.7185878,4.0337352 L -2.2072895,0.016013256 L 8.7185884,-4.0017078 C 6.9730900,-1.6296469 6.9831476,1.6157441 8.7185878,4.0337352 z "
 | 
			
		||||
         transform="scale(1.1) rotate(180) translate(1,0)" />
 | 
			
		||||
    </marker>
 | 
			
		||||
    <marker
 | 
			
		||||
       inkscape:stockid="Arrow1Lend"
 | 
			
		||||
       orient="auto"
 | 
			
		||||
       refY="0.0"
 | 
			
		||||
       refX="0.0"
 | 
			
		||||
       id="Arrow1Lend"
 | 
			
		||||
       style="overflow:visible;">
 | 
			
		||||
      <path
 | 
			
		||||
         id="path3680"
 | 
			
		||||
         d="M 0.0,0.0 L 5.0,-5.0 L -12.5,0.0 L 5.0,5.0 L 0.0,0.0 z "
 | 
			
		||||
         style="fill-rule:evenodd;stroke:#000000;stroke-width:1.0pt;marker-start:none;"
 | 
			
		||||
         transform="scale(0.8) rotate(180) translate(12.5,0)" />
 | 
			
		||||
    </marker>
 | 
			
		||||
    <inkscape:perspective
 | 
			
		||||
       sodipodi:type="inkscape:persp3d"
 | 
			
		||||
       inkscape:vp_x="0 : 526.18109 : 1"
 | 
			
		||||
       inkscape:vp_y="0 : 1000 : 0"
 | 
			
		||||
       inkscape:vp_z="744.09448 : 526.18109 : 1"
 | 
			
		||||
       inkscape:persp3d-origin="372.04724 : 350.78739 : 1"
 | 
			
		||||
       id="perspective10" />
 | 
			
		||||
  </defs>
 | 
			
		||||
  <sodipodi:namedview
 | 
			
		||||
     id="base"
 | 
			
		||||
     pagecolor="#ffffff"
 | 
			
		||||
     bordercolor="#666666"
 | 
			
		||||
     borderopacity="1.0"
 | 
			
		||||
     inkscape:pageopacity="0.0"
 | 
			
		||||
     inkscape:pageshadow="2"
 | 
			
		||||
     inkscape:zoom="24.1875"
 | 
			
		||||
     inkscape:cx="15.958656"
 | 
			
		||||
     inkscape:cy="16"
 | 
			
		||||
     inkscape:document-units="px"
 | 
			
		||||
     inkscape:current-layer="layer1"
 | 
			
		||||
     showgrid="false"
 | 
			
		||||
     inkscape:window-width="1680"
 | 
			
		||||
     inkscape:window-height="975"
 | 
			
		||||
     inkscape:window-x="0"
 | 
			
		||||
     inkscape:window-y="49" />
 | 
			
		||||
  <metadata
 | 
			
		||||
     id="metadata7">
 | 
			
		||||
    <rdf:RDF>
 | 
			
		||||
      <cc:Work
 | 
			
		||||
         rdf:about="">
 | 
			
		||||
        <dc:format>image/svg+xml</dc:format>
 | 
			
		||||
        <dc:type
 | 
			
		||||
           rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
 | 
			
		||||
      </cc:Work>
 | 
			
		||||
    </rdf:RDF>
 | 
			
		||||
  </metadata>
 | 
			
		||||
  <g
 | 
			
		||||
     inkscape:label="Camada 1"
 | 
			
		||||
     inkscape:groupmode="layer"
 | 
			
		||||
     id="layer1">
 | 
			
		||||
    <path
 | 
			
		||||
       style="opacity:0.90747334;fill:#54d0ff;fill-opacity:1;fill-rule:nonzero;stroke:#171717;stroke-width:2.28699994;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dashoffset:0;stroke-opacity:1"
 | 
			
		||||
       d="M 2.46875,30.4375 C 11.645833,30.4375 20.822917,30.4375 30,30.4375 C 30.064138,24.378635 30.11603,15.883025 30.118277,9.6236971 C 30.118983,7.6558782 30.335133,7.5645206 25.279877,3.5419089 C 23.096951,1.6385074 23.172235,1.7049399 22.845544,1.6952675 C 18.708486,1.5727809 6.911066,1.6005551 2.46875,1.5625 C 2.46875,11.1875 2.46875,20.8125 2.46875,30.4375 z"
 | 
			
		||||
       id="rect14833"
 | 
			
		||||
       sodipodi:nodetypes="ccscscc" />
 | 
			
		||||
    <text
 | 
			
		||||
       xml:space="preserve"
 | 
			
		||||
       style="font-size:29.98666382000000041px;font-style:normal;font-weight:normal;fill:#171717;fill-opacity:0.90980393;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
 | 
			
		||||
       x="3.9695039"
 | 
			
		||||
       y="21.511156"
 | 
			
		||||
       id="text14838"
 | 
			
		||||
       transform="scale(0.9040853,1.1060903)"><tspan
 | 
			
		||||
         sodipodi:role="line"
 | 
			
		||||
         id="tspan14840"
 | 
			
		||||
         x="3.9695039"
 | 
			
		||||
         y="21.511156">,,,</tspan></text>
 | 
			
		||||
    <path
 | 
			
		||||
       style="fill:none;fill-rule:evenodd;stroke:#171717;stroke-width:2.46289229000000010;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:0.90980393;fill-opacity:0.90980393000000004"
 | 
			
		||||
       d="M 22.008966,3.8177511 L 22.008966,8.8747553 L 27.934187,8.8364447"
 | 
			
		||||
       id="path3769"
 | 
			
		||||
       sodipodi:nodetypes="ccc" />
 | 
			
		||||
  </g>
 | 
			
		||||
</svg>
 | 
			
		||||
| 
		 Before Width: | Height: | Size: 4.9 KiB  | 
| 
		 Before Width: | Height: | Size: 1.1 KiB  | 
@ -1,5 +0,0 @@
 | 
			
		||||
<RCC>
 | 
			
		||||
    <qresource prefix="/" >
 | 
			
		||||
        <file>delimited_text.png</file>
 | 
			
		||||
    </qresource>
 | 
			
		||||
</RCC>
 | 
			
		||||
@ -1,229 +0,0 @@
 | 
			
		||||
/***************************************************************************
 | 
			
		||||
  qgsdelimitedtextplugin.cpp
 | 
			
		||||
  Import tool for various worldmap analysis output files
 | 
			
		||||
Functions:
 | 
			
		||||
 | 
			
		||||
-------------------
 | 
			
		||||
  begin                : Feb 21, 2004
 | 
			
		||||
  copyright            : (C) 2004 by Gary Sherman
 | 
			
		||||
  email                : sherman at mrcc.com
 | 
			
		||||
 | 
			
		||||
 ***************************************************************************/
 | 
			
		||||
 | 
			
		||||
/***************************************************************************
 | 
			
		||||
 *                                                                         *
 | 
			
		||||
 *   This program is free software; you can redistribute it and/or modify  *
 | 
			
		||||
 *   it under the terms of the GNU General Public License as published by  *
 | 
			
		||||
 *   the Free Software Foundation; either version 2 of the License, or     *
 | 
			
		||||
 *   (at your option) any later version.                                   *
 | 
			
		||||
 *                                                                         *
 | 
			
		||||
 ***************************************************************************/
 | 
			
		||||
 | 
			
		||||
// includes
 | 
			
		||||
 | 
			
		||||
#include "qgisinterface.h"
 | 
			
		||||
#include "qgisgui.h"
 | 
			
		||||
#include "qgsapplication.h"
 | 
			
		||||
#include "qgsmaplayer.h"
 | 
			
		||||
#include "qgsproviderregistry.h"
 | 
			
		||||
#include "qgsdelimitedtextplugin.h"
 | 
			
		||||
 | 
			
		||||
#include <QMenu>
 | 
			
		||||
#include <QAction>
 | 
			
		||||
#include <QFile>
 | 
			
		||||
#include <QToolBar>
 | 
			
		||||
#include <QMessageBox>
 | 
			
		||||
 | 
			
		||||
static const QString pluginVersion = QObject::tr( "Version 0.2" );
 | 
			
		||||
static const QString description_ = QObject::tr( "Loads and displays delimited text files containing x,y coordinates" );
 | 
			
		||||
static const QString category_ = QObject::tr( "Layers" );
 | 
			
		||||
static const QString icon_ = ":/delimited_text.png";
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Constructor for the plugin. The plugin is passed a pointer to the main app
 | 
			
		||||
 * and an interface object that provides access to exposed functions in QGIS.
 | 
			
		||||
 * @param qgis Pointer to the QGIS main window
 | 
			
		||||
 * @param _qI Pointer to the QGIS interface object
 | 
			
		||||
 */
 | 
			
		||||
QgsDelimitedTextPlugin::QgsDelimitedTextPlugin( QgisInterface * theQgisInterFace )
 | 
			
		||||
    : qGisInterface( theQgisInterFace )
 | 
			
		||||
{
 | 
			
		||||
  /** Initialize the plugin and set the required attributes */
 | 
			
		||||
  pluginNameQString = tr( "DelimitedTextLayer" );
 | 
			
		||||
  pluginVersionQString = pluginVersion;
 | 
			
		||||
  pluginDescriptionQString = description_;
 | 
			
		||||
  pluginCategoryQString = category_;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
QgsDelimitedTextPlugin::~QgsDelimitedTextPlugin()
 | 
			
		||||
{
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* Following functions return name, description, version, and type for the plugin */
 | 
			
		||||
QString QgsDelimitedTextPlugin::name()
 | 
			
		||||
{
 | 
			
		||||
  return pluginNameQString;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
QString QgsDelimitedTextPlugin::version()
 | 
			
		||||
{
 | 
			
		||||
  return pluginVersionQString;
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
QString QgsDelimitedTextPlugin::description()
 | 
			
		||||
{
 | 
			
		||||
  return pluginDescriptionQString;
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
QString QgsDelimitedTextPlugin::category()
 | 
			
		||||
{
 | 
			
		||||
  return pluginCategoryQString;
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
int QgsDelimitedTextPlugin::type()
 | 
			
		||||
{
 | 
			
		||||
  return QgisPlugin::UI;
 | 
			
		||||
}
 | 
			
		||||
//method defined in interface
 | 
			
		||||
void QgsDelimitedTextPlugin::help()
 | 
			
		||||
{
 | 
			
		||||
  //implement me!
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * Initialize the GUI interface for the plugin
 | 
			
		||||
 */
 | 
			
		||||
void QgsDelimitedTextPlugin::initGui()
 | 
			
		||||
{
 | 
			
		||||
  // Create the action for tool
 | 
			
		||||
  myQActionPointer = new QAction( QIcon(), tr( "&Add Delimited Text Layer" ), this );
 | 
			
		||||
  setCurrentTheme( "" );
 | 
			
		||||
  myQActionPointer->setWhatsThis( tr( "Add a delimited text file as a map layer. "
 | 
			
		||||
                                      "The file must have a header row containing the field names. "
 | 
			
		||||
                                      "The file must either contain X and Y fields with coordinates in decimal units or a WKT field." ) );
 | 
			
		||||
  // Connect the action to the run
 | 
			
		||||
  connect( myQActionPointer, SIGNAL( triggered() ), this, SLOT( run() ) );
 | 
			
		||||
  // Add the icon to the toolbar
 | 
			
		||||
  qGisInterface->layerToolBar()->addAction( myQActionPointer );
 | 
			
		||||
  qGisInterface->insertAddLayerAction( myQActionPointer );
 | 
			
		||||
  // this is called when the icon theme is changed
 | 
			
		||||
  connect( qGisInterface, SIGNAL( currentThemeChanged( QString ) ), this, SLOT( setCurrentTheme( QString ) ) );
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Slot called when the buffer menu item is activated
 | 
			
		||||
void QgsDelimitedTextPlugin::run()
 | 
			
		||||
{
 | 
			
		||||
  // show the DelimitedText dialog
 | 
			
		||||
  QDialog *dlg = dynamic_cast<QDialog*>( QgsProviderRegistry::instance()->selectWidget( QString( "delimitedtext" ), qGisInterface->mainWindow() ) );
 | 
			
		||||
  if ( !dlg )
 | 
			
		||||
  {
 | 
			
		||||
    QMessageBox::warning( qGisInterface->mainWindow(), tr( "Delimited Text" ), tr( "Cannot get Delimited Text select dialog from provider." ) );
 | 
			
		||||
    return;
 | 
			
		||||
  }
 | 
			
		||||
  //listen for when the layer has been made so we can draw it
 | 
			
		||||
  connect( dlg, SIGNAL( addVectorLayer( QString, QString, QString ) ),
 | 
			
		||||
           this, SLOT( addVectorLayer( QString, QString, QString ) ) );
 | 
			
		||||
 | 
			
		||||
  dlg->exec();
 | 
			
		||||
  delete dlg;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
//!add a vector layer - intended to respond to signal
 | 
			
		||||
//sent by dialog when it as finished
 | 
			
		||||
void QgsDelimitedTextPlugin::addVectorLayer( QString thePathNameQString,
 | 
			
		||||
    QString theBaseNameQString, QString theProviderQString )
 | 
			
		||||
{
 | 
			
		||||
  qGisInterface->addVectorLayer( thePathNameQString,
 | 
			
		||||
                                 theBaseNameQString, theProviderQString );
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Unload the plugin by cleaning up the GUI
 | 
			
		||||
void QgsDelimitedTextPlugin::unload()
 | 
			
		||||
{
 | 
			
		||||
  // remove the GUI
 | 
			
		||||
  qGisInterface->layerToolBar()->removeAction( myQActionPointer );
 | 
			
		||||
  qGisInterface->removeAddLayerAction( myQActionPointer );
 | 
			
		||||
  delete myQActionPointer;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
//! Set icons to the current theme
 | 
			
		||||
void QgsDelimitedTextPlugin::setCurrentTheme( QString theThemeName )
 | 
			
		||||
{
 | 
			
		||||
  Q_UNUSED( theThemeName );
 | 
			
		||||
  QString myCurThemePath = QgsApplication::activeThemePath() + "/plugins/delimited_text.png";
 | 
			
		||||
  QString myDefThemePath = QgsApplication::defaultThemePath() + "/plugins/delimited_text.png";
 | 
			
		||||
  QString myQrcPath = ":/delimited_text.png";
 | 
			
		||||
  if ( QFile::exists( myCurThemePath ) )
 | 
			
		||||
  {
 | 
			
		||||
    myQActionPointer->setIcon( QIcon( myCurThemePath ) );
 | 
			
		||||
  }
 | 
			
		||||
  else if ( QFile::exists( myDefThemePath ) )
 | 
			
		||||
  {
 | 
			
		||||
    myQActionPointer->setIcon( QIcon( myDefThemePath ) );
 | 
			
		||||
  }
 | 
			
		||||
  else if ( QFile::exists( myQrcPath ) )
 | 
			
		||||
  {
 | 
			
		||||
    myQActionPointer->setIcon( QIcon( myQrcPath ) );
 | 
			
		||||
  }
 | 
			
		||||
  else
 | 
			
		||||
  {
 | 
			
		||||
    myQActionPointer->setIcon( QIcon() );
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Required extern functions needed  for every plugin
 | 
			
		||||
 * These functions can be called prior to creating an instance
 | 
			
		||||
 * of the plugin class
 | 
			
		||||
 */
 | 
			
		||||
// Class factory to return a new instance of the plugin class
 | 
			
		||||
QGISEXTERN QgisPlugin * classFactory( QgisInterface * theQgisInterfacePointer )
 | 
			
		||||
{
 | 
			
		||||
  return new QgsDelimitedTextPlugin( theQgisInterfacePointer );
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Return the name of the plugin - note that we do not user class members as
 | 
			
		||||
// the class may not yet be insantiated when this method is called.
 | 
			
		||||
QGISEXTERN QString name()
 | 
			
		||||
{
 | 
			
		||||
  return QString( QObject::tr( "Add Delimited Text Layer" ) );
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Return the description
 | 
			
		||||
QGISEXTERN QString description()
 | 
			
		||||
{
 | 
			
		||||
  return description_;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Return the category
 | 
			
		||||
QGISEXTERN QString category()
 | 
			
		||||
{
 | 
			
		||||
  return category_;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Return the type (either UI or MapLayer plugin)
 | 
			
		||||
QGISEXTERN int type()
 | 
			
		||||
{
 | 
			
		||||
  return QgisPlugin::UI;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Return the version number for the plugin
 | 
			
		||||
QGISEXTERN QString version()
 | 
			
		||||
{
 | 
			
		||||
  return pluginVersion;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
QGISEXTERN QString icon()
 | 
			
		||||
{
 | 
			
		||||
  return icon_;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Delete ourself
 | 
			
		||||
QGISEXTERN void unload( QgisPlugin * theQgsDelimitedTextPluginPointer )
 | 
			
		||||
{
 | 
			
		||||
  delete theQgsDelimitedTextPluginPointer;
 | 
			
		||||
}
 | 
			
		||||
@ -1,97 +0,0 @@
 | 
			
		||||
/***************************************************************************
 | 
			
		||||
                          qgsdelimitedtextplugin.h
 | 
			
		||||
 Functions:
 | 
			
		||||
                             -------------------
 | 
			
		||||
    begin                : Jan 21, 2004
 | 
			
		||||
    copyright            : (C) 2004 by Tim Sutton
 | 
			
		||||
    email                : tim@linfiniti.com
 | 
			
		||||
 | 
			
		||||
 ***************************************************************************/
 | 
			
		||||
 | 
			
		||||
/***************************************************************************
 | 
			
		||||
 *                                                                         *
 | 
			
		||||
 *   This program is free software; you can redistribute it and/or modify  *
 | 
			
		||||
 *   it under the terms of the GNU General Public License as published by  *
 | 
			
		||||
 *   the Free Software Foundation; either version 2 of the License, or     *
 | 
			
		||||
 *   (at your option) any later version.                                   *
 | 
			
		||||
 *                                                                         *
 | 
			
		||||
 ***************************************************************************/
 | 
			
		||||
#ifndef PLUGIN
 | 
			
		||||
#define PLUGIN
 | 
			
		||||
#include <QObject>
 | 
			
		||||
 | 
			
		||||
#include "../qgisplugin.h"
 | 
			
		||||
 | 
			
		||||
class QgisInterface;
 | 
			
		||||
class QAction;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
* \class QgsDelimitedTextPlugin
 | 
			
		||||
* \brief Delimited text plugin for QGIS
 | 
			
		||||
*
 | 
			
		||||
*/
 | 
			
		||||
class QgsDelimitedTextPlugin: public QObject, public QgisPlugin
 | 
			
		||||
{
 | 
			
		||||
  Q_OBJECT public:
 | 
			
		||||
    /**
 | 
			
		||||
     * Constructor for a plugin. The QgisInterface pointer is passed by
 | 
			
		||||
     * QGIS when it attempts to instantiate the plugin.
 | 
			
		||||
     * @param qI Pointer to the QgisInterface object
 | 
			
		||||
     */
 | 
			
		||||
    QgsDelimitedTextPlugin( QgisInterface * );
 | 
			
		||||
    /**
 | 
			
		||||
     * Virtual function to return the name of the plugin. The name will be used when presenting a list
 | 
			
		||||
     * of installable plugins to the user
 | 
			
		||||
     */
 | 
			
		||||
    virtual QString name();
 | 
			
		||||
    /**
 | 
			
		||||
     * Virtual function to return the version of the plugin.
 | 
			
		||||
     */
 | 
			
		||||
    virtual QString version();
 | 
			
		||||
    /**
 | 
			
		||||
     * Virtual function to return a description of the plugins functions
 | 
			
		||||
     */
 | 
			
		||||
    virtual QString description();
 | 
			
		||||
    /**
 | 
			
		||||
     * Virtual function to return a plugin category
 | 
			
		||||
     */
 | 
			
		||||
    virtual QString category();
 | 
			
		||||
    /**
 | 
			
		||||
     * Return the plugin type
 | 
			
		||||
     */
 | 
			
		||||
    virtual int type();
 | 
			
		||||
    //! Destructor
 | 
			
		||||
    virtual ~ QgsDelimitedTextPlugin();
 | 
			
		||||
  public slots:
 | 
			
		||||
    //! init the gui
 | 
			
		||||
    virtual void initGui();
 | 
			
		||||
    //! Show the dialog box
 | 
			
		||||
    void run();
 | 
			
		||||
    //! Add a vector layer given vectorLayerPath, baseName, providerKey (i.e. delimitedtext)
 | 
			
		||||
    void addVectorLayer( QString, QString, QString );
 | 
			
		||||
    //! unload the plugin
 | 
			
		||||
    void unload();
 | 
			
		||||
    //! show the help document
 | 
			
		||||
    void help();
 | 
			
		||||
    //! update the plugins theme when the app tells us its theme is changed
 | 
			
		||||
    void setCurrentTheme( QString theThemeName );
 | 
			
		||||
  private:
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    //! Name of the plugin
 | 
			
		||||
    QString pluginNameQString;
 | 
			
		||||
    //! Version
 | 
			
		||||
    QString pluginVersionQString;
 | 
			
		||||
    //! Descrption of the plugin
 | 
			
		||||
    QString pluginDescriptionQString;
 | 
			
		||||
    //! Category of the plugin
 | 
			
		||||
    QString pluginCategoryQString;
 | 
			
		||||
    //! Plugin type as defined in Plugin::PLUGINTYPE
 | 
			
		||||
    int pluginType;
 | 
			
		||||
    //! Pointer to the QGIS interface object
 | 
			
		||||
    QgisInterface *qGisInterface;
 | 
			
		||||
    //! Pointer to the QAction object used in the menu and toolbar
 | 
			
		||||
    QAction *myQActionPointer;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
#endif
 | 
			
		||||
@ -17,7 +17,7 @@
 | 
			
		||||
     <x>0</x>
 | 
			
		||||
     <y>0</y>
 | 
			
		||||
     <width>1050</width>
 | 
			
		||||
     <height>21</height>
 | 
			
		||||
     <height>23</height>
 | 
			
		||||
    </rect>
 | 
			
		||||
   </property>
 | 
			
		||||
   <widget class="QMenu" name="mEditMenu">
 | 
			
		||||
@ -160,6 +160,7 @@
 | 
			
		||||
    <addaction name="mActionAddLayerSeparator"/>
 | 
			
		||||
    <addaction name="mActionAddWcsLayer"/>
 | 
			
		||||
    <addaction name="mActionAddWfsLayer"/>
 | 
			
		||||
    <addaction name="mActionAddDelimitedText"/>
 | 
			
		||||
    <addaction name="separator"/>
 | 
			
		||||
    <addaction name="mActionCopyStyle"/>
 | 
			
		||||
    <addaction name="mActionPasteStyle"/>
 | 
			
		||||
@ -287,6 +288,7 @@
 | 
			
		||||
   <addaction name="mActionAddWmsLayer"/>
 | 
			
		||||
   <addaction name="mActionAddWcsLayer"/>
 | 
			
		||||
   <addaction name="mActionAddWfsLayer"/>
 | 
			
		||||
   <addaction name="mActionAddDelimitedText"/>
 | 
			
		||||
   <addaction name="mActionNewVectorLayer"/>
 | 
			
		||||
   <addaction name="mActionRemoveLayer"/>
 | 
			
		||||
  </widget>
 | 
			
		||||
@ -2074,6 +2076,18 @@ Acts on currently active editable layer</string>
 | 
			
		||||
    <string>Need Support?</string>
 | 
			
		||||
   </property>
 | 
			
		||||
  </action>
 | 
			
		||||
  <action name="mActionAddDelimitedText">
 | 
			
		||||
   <property name="icon">
 | 
			
		||||
    <iconset resource="../../images/images.qrc">
 | 
			
		||||
     <normaloff>:/images/themes/default/mActionAddDelimitedTextLayer.png</normaloff>:/images/themes/default/mActionAddDelimitedTextLayer.png</iconset>
 | 
			
		||||
   </property>
 | 
			
		||||
   <property name="text">
 | 
			
		||||
    <string>Add Delimited Text Layer...</string>
 | 
			
		||||
   </property>
 | 
			
		||||
   <property name="toolTip">
 | 
			
		||||
    <string>Add Delimited Text Layer</string>
 | 
			
		||||
   </property>
 | 
			
		||||
  </action>
 | 
			
		||||
 </widget>
 | 
			
		||||
 <resources>
 | 
			
		||||
  <include location="../../images/images.qrc"/>
 | 
			
		||||
 | 
			
		||||