spit.pro commit

git-svn-id: http://svn.osgeo.org/qgis/trunk@340 c8812cc2-4d05-0410-92ff-de0c093fc19c
This commit is contained in:
rawbytes 2003-12-23 05:44:06 +00:00
parent 09a3e4888b
commit 6cc084be01
8 changed files with 128 additions and 81 deletions

View File

@ -1,6 +1,6 @@
#############################################################################
# Makefile for building: spit
# Generated by qmake (1.04a) (Qt 3.1.1) on: Sun Dec 21 19:17:08 2003
# Generated by qmake (1.04a) (Qt 3.1.1) on: Tue Dec 23 00:24:04 2003
# Project: spit.pro
# Template: app
# Command: $(QMAKE) -o Makefile spit.pro
@ -16,10 +16,10 @@ CFLAGS = -pipe -Wall -W -O2 -march=i386 -mcpu=i686 -g -DGLX_GLXEXT_LEGACY -fno
CXXFLAGS = -pipe -Wall -W -O2 -march=i386 -mcpu=i686 -g -DGLX_GLXEXT_LEGACY -fno-use-cxa-atexit -fno-exceptions -DPOSTGRESQL -DHAVE_NAMESPACE_STD -DHAVE_CXX_STRING_HEADER -DDLLIMPORT="" -DQT_NO_DEBUG
LEXFLAGS =
YACCFLAGS= -d
INCPATH = -I$(QTDIR)/mkspecs/default -I. -I$(QTDIR)/include
INCPATH = -I$(QTDIR)/mkspecs/default -I. -I-I/usr/local/include -I$(PGSQL)/include -I$(QTDIR)/include
LINK = g++
LFLAGS =
LIBS = $(SUBLIBS) -L$(QTDIR)/lib -L/usr/X11R6/lib -L$(PGSQL)/lib -lpq++ -lqt-mt -lXext -lX11 -lm
LIBS = $(SUBLIBS) -L$(QTDIR)/lib -L/usr/X11R6/lib -L$(PGSQL)/lib -lpq++ -L/usr/local/lib -lgdal.1.1 -lqt-mt -lXext -lX11 -lm
AR = ar cqs
RANLIB =
MOC = $(QTDIR)/bin/moc
@ -140,6 +140,7 @@ main.o: main.cpp qgsspit.h \
qgsspit.o: qgsspit.cpp qgsspit.h \
qgsconnectiondialog.h \
qgsshapefile.h \
qgsspitbase.h \
qgsconnectiondialogbase.h

View File

@ -17,16 +17,53 @@
#include <ogrsf_frmts.h>
#include <ogr_geometry.h>
#include <sstream>
#include <string>
#include "cpl_error.h"
#include "qgsshapefile.h"
QgsShapeFile::QgsShapeFile(QString filename){
/*
ogrDataSource = OGRSFDriverRegistrar::Open((const char *) filename);
if (ogrDataSource != NULL) qWarning("Valid!");
else qWarning("Invalid!");
*/
}
QgsShapeFile::~QgsShapeFile(){
valid = false;
OGRRegisterAll();
ogrDataSource = OGRSFDriverRegistrar::Open((const char *) filename);
if (ogrDataSource != NULL){
valid = true;
ogrLayer = ogrDataSource->GetLayer(0);
}
else
qWarning(filename + " Invalid!" + CPLGetLastErrorMsg());
}
QgsShapeFile::~QgsShapeFile(){
delete ogrLayer;
delete ogrDataSource;
}
const char * QgsShapeFile::getFeatureCount(){
std::ostringstream res;
res << ogrLayer->GetFeatureCount();
return res.str().c_str();
}
const char * QgsShapeFile::getFeatureClass(){
const char * res;
OGRFeature *feat = ogrLayer->GetNextFeature();
if(feat){
OGRGeometry *geom = feat->GetGeometryRef();
if(geom){
res = geom->getGeometryName();
}else{
valid = false;
delete geom;
}
}else{
valid = false;
delete feat;
}
ogrLayer->ResetReading();
return valid?res:NULL;
}

View File

@ -15,19 +15,31 @@
* *
***************************************************************************/
#ifndef QGSSHAPEFILE_H
#define QGSSHAPEFILE_H
#include<qstring.h>
//#include "qva OGRDataSource *ogrDataSource;luevector.h"
#include <ogrsf_frmts.h>
class OGRLayer;
class OGRDataSource;
class QgsShapeFile
{
public:
public:
QgsShapeFile(QString filename);
~QgsShapeFile();
const char * getFeatureCount();
const char * QgsShapeFile::getFeatureClass();
private:
//OGRDataSource *ogrDataSource;
OGRDataSource *ogrDataSource;
OGRLayer * ogrLayer;
bool valid;
//const char *featureType = {"null", "Point", "Line", "Polygon", "MultiPoint", "MultiLine", "MultiPolygon"};
};
#endif

View File

@ -1,6 +1,5 @@
#include<qmessagebox.h>
#include <libpq++.h>
#include <iostream>
#include <qsettings.h>
@ -90,9 +89,10 @@ void QgsSpit::addFile()
break;
}
if(!exist){
QgsShapeFile * file = new QgsShapeFile(*it);
QListViewItem *lvi = new QListViewItem(lstShapefiles, *it);
lvi->setText(1, "Polygon");
lvi->setText(2, "lots");
lvi->setText(1, file->getFeatureClass());
lvi->setText(2, file->getFeatureCount());
}
}
}

View File

@ -1,6 +1,8 @@
#include <qlistview.h>
#include <vector>
#include "qgsspitbase.h"
#include "qgsshapefile.h"
class QgsSpit :public QgsSpitBase{
public:
@ -21,4 +23,5 @@ class QgsSpit :public QgsSpitBase{
private:
int default_value;
std::vector <QgsShapeFile> fileList;
};

View File

@ -324,46 +324,10 @@
</widget>
<connections>
<connection>
<sender>btnNew</sender>
<sender>chkUseDefault</sender>
<signal>clicked()</signal>
<receiver>QgsSpitBase</receiver>
<slot>newConnection()</slot>
</connection>
<connection>
<sender>btnImport</sender>
<signal>clicked()</signal>
<receiver>QgsSpitBase</receiver>
<slot>import()</slot>
</connection>
<connection>
<sender>btnCancel</sender>
<signal>clicked()</signal>
<receiver>QgsSpitBase</receiver>
<slot>close()</slot>
</connection>
<connection>
<sender>btnEdit</sender>
<signal>clicked()</signal>
<receiver>QgsSpitBase</receiver>
<slot>editConnection()</slot>
</connection>
<connection>
<sender>btnRemoveFile</sender>
<signal>clicked()</signal>
<receiver>QgsSpitBase</receiver>
<slot>removeFile()</slot>
</connection>
<connection>
<sender>btnAddFile</sender>
<signal>clicked()</signal>
<receiver>QgsSpitBase</receiver>
<slot>addFile()</slot>
</connection>
<connection>
<sender>btnRemove</sender>
<signal>clicked()</signal>
<receiver>QgsSpitBase</receiver>
<slot>removeConnection()</slot>
<slot>useDefault()</slot>
</connection>
<connection>
<sender>btnRemoveAll</sender>
@ -372,22 +336,58 @@
<slot>removeAllFiles()</slot>
</connection>
<connection>
<sender>chkUseDefault</sender>
<sender>btnRemove</sender>
<signal>clicked()</signal>
<receiver>QgsSpitBase</receiver>
<slot>useDefault()</slot>
<slot>removeConnection()</slot>
</connection>
<connection>
<sender>btnHelp</sender>
<sender>btnAddFile</sender>
<signal>clicked()</signal>
<receiver>QgsSpitBase</receiver>
<slot>help()</slot>
<slot>addFile()</slot>
</connection>
<connection>
<sender>btnRemoveFile</sender>
<signal>clicked()</signal>
<receiver>QgsSpitBase</receiver>
<slot>removeFile()</slot>
</connection>
<connection>
<sender>btnEdit</sender>
<signal>clicked()</signal>
<receiver>QgsSpitBase</receiver>
<slot>editConnection()</slot>
</connection>
<connection>
<sender>btnCancel</sender>
<signal>clicked()</signal>
<receiver>QgsSpitBase</receiver>
<slot>close()</slot>
</connection>
<connection>
<sender>btnImport</sender>
<signal>clicked()</signal>
<receiver>QgsSpitBase</receiver>
<slot>import()</slot>
</connection>
<connection>
<sender>btnNew</sender>
<signal>clicked()</signal>
<receiver>QgsSpitBase</receiver>
<slot>newConnection()</slot>
</connection>
<connection>
<sender>btnAbout</sender>
<signal>clicked()</signal>
<receiver>QgsSpitBase</receiver>
<slot>about()</slot>
<slot>aboutInfo()</slot>
</connection>
<connection>
<sender>btnHelp</sender>
<signal>clicked()</signal>
<receiver>QgsSpitBase</receiver>
<slot>helpInfo()</slot>
</connection>
</connections>
<slots>
@ -399,8 +399,8 @@
<slot>removeFile()</slot>
<slot>removeAllFiles()</slot>
<slot>useDefault()</slot>
<slot>help()</slot>
<slot>about()</slot>
<slot>helpInfo()</slot>
<slot>aboutInfo()</slot>
</slots>
<layoutdefaults spacing="6" margin="11"/>
</UI>

View File

@ -3,27 +3,21 @@
<KDevPrjSession>
<LastCompileConfig>(Default)</LastCompileConfig>
<Mainframe MaximizeMode="1" />
<DocsAndViews NumberOfDocuments="7" >
<Doc0 CursorPosLine="40" Type="KWriteDoc" NumberOfViews="1" CursorPosCol="82" FileName="/sav/downloads/qgis/tools/spit/qgsspit.cpp" >
<View0 Top="0" Width="904" Attach="1" Height="508" Left="0" Focus="0" Type="KWriteView" MinMaxMode="0" />
<DocsAndViews NumberOfDocuments="5" >
<Doc0 CursorPosLine="18" Type="KWriteDoc" NumberOfViews="1" CursorPosCol="24" FileName="/sav/downloads/qgis/tools/spit/qgsspit.cpp" >
<View0 Top="0" Width="1165" Attach="1" Height="526" Left="0" Focus="0" Type="KWriteView" MinMaxMode="0" />
</Doc0>
<Doc1 CursorPosLine="19" Type="KWriteDoc" NumberOfViews="1" CursorPosCol="30" FileName="/sav/downloads/qgis/tools/spit/qgsspit.h" >
<View0 Top="0" Width="904" Attach="1" Height="508" Left="0" Focus="0" Type="KWriteView" MinMaxMode="0" />
<View0 Top="0" Width="98" Attach="1" Height="28" Left="0" Focus="0" Type="KWriteView" MinMaxMode="0" />
</Doc1>
<Doc2 CursorPosLine="0" Type="KWriteDoc" NumberOfViews="1" CursorPosCol="0" FileName="/sav/downloads/qgis/tools/spit/qgsspitbase.h" >
<View0 Top="0" Width="904" Attach="1" Height="508" Left="0" Focus="0" Type="KWriteView" MinMaxMode="0" />
<Doc2 CursorPosLine="41" Type="KWriteDoc" NumberOfViews="1" CursorPosCol="12" FileName="/sav/downloads/qgis/tools/spit/qgsconnectiondialog.cpp" >
<View0 Top="0" Width="1165" Attach="1" Height="526" Left="0" Focus="0" Type="KWriteView" MinMaxMode="0" />
</Doc2>
<Doc3 CursorPosLine="111" Type="KWriteDoc" NumberOfViews="1" CursorPosCol="0" FileName="/usr/lib/qt-3.1/include/qlistview.h" >
<View0 Top="0" Width="904" Attach="1" Height="508" Left="0" Focus="0" Type="KWriteView" MinMaxMode="0" />
<Doc3 CursorPosLine="26" Type="KWriteDoc" NumberOfViews="1" CursorPosCol="19" FileName="/sav/downloads/qgis/tools/spit/qgsshapefile.cpp" >
<View0 Top="0" Width="1165" Attach="1" Height="526" Left="0" Focus="1" Type="KWriteView" MinMaxMode="0" />
</Doc3>
<Doc4 CursorPosLine="25" Type="KWriteDoc" NumberOfViews="1" CursorPosCol="61" FileName="/sav/downloads/qgis/tools/spit/qgsconnectiondialog.cpp" >
<View0 Top="0" Width="904" Attach="1" Height="508" Left="0" Focus="1" Type="KWriteView" MinMaxMode="0" />
<Doc4 CursorPosLine="26" Type="KWriteDoc" NumberOfViews="1" CursorPosCol="8" FileName="/sav/downloads/qgis/tools/spit/qgsshapefile.h" >
<View0 Top="0" Width="1165" Attach="1" Height="526" Left="0" Focus="0" Type="KWriteView" MinMaxMode="0" />
</Doc4>
<Doc5 CursorPosLine="28" Type="KWriteDoc" NumberOfViews="1" CursorPosCol="29" FileName="/sav/downloads/qgis/tools/spit/qgsshapefile.cpp" >
<View0 Top="0" Width="904" Attach="1" Height="508" Left="0" Focus="0" Type="KWriteView" MinMaxMode="0" />
</Doc5>
<Doc6 CursorPosLine="29" Type="KWriteDoc" NumberOfViews="1" CursorPosCol="0" FileName="/sav/downloads/qgis/tools/spit/qgsshapefile.h" >
<View0 Top="0" Width="904" Attach="1" Height="508" Left="0" Focus="0" Type="KWriteView" MinMaxMode="0" />
</Doc6>
</DocsAndViews>
</KDevPrjSession>

View File

@ -16,6 +16,6 @@ FORMS = qgsconnectiondialogbase.ui \
TEMPLATE =app
CONFIG += qt warn_on release
DEFINES += POSTGRESQL HAVE_NAMESPACE_STD HAVE_CXX_STRING_HEADER DLLIMPORT=""
INCLUDEPATH += $(PGSQL)/include
LIBS += -L$(PGSQL)/lib -lpq++
LIBS += -L$(PGSQL)/lib -lpq++ -L/usr/local/lib -lgdal.1.1
LANGUAGE = C++
INCLUDEPATH += -I/usr/local/include $(PGSQL)/include