mapserver export

git-svn-id: http://svn.osgeo.org/qgis/trunk@293 c8812cc2-4d05-0410-92ff-de0c093fc19c
This commit is contained in:
gsherman 2003-11-09 06:15:31 +00:00
parent cb8dfafa57
commit 854eec3874
12 changed files with 348 additions and 52 deletions

View File

@ -46,6 +46,7 @@ qgis_SOURCES = qgisapp.cpp \
qgsrenderitem.cpp \
qgsshapefilelayer.cpp \
qgssymbol.cpp\
qgsmapserverexport.cpp \
$(qgis_UI)\
$(qgis_MOC)
qgis_MOC = qgisappbase.moc.cpp \

View File

@ -1,7 +1,7 @@
# Makefile.in generated by automake 1.7.7 from Makefile.am.
# Makefile.in generated by automake 1.7.2 from Makefile.am.
# @configure_input@
# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002
# Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@ -43,7 +43,6 @@ ACLOCAL = @ACLOCAL@
AMDEP_FALSE = @AMDEP_FALSE@
AMDEP_TRUE = @AMDEP_TRUE@
AMTAR = @AMTAR@
AR = @AR@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
@ -54,7 +53,6 @@ CFLAGS = @CFLAGS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CXX = @CXX@
CXXCPP = @CXXCPP@
CXXDEPMODE = @CXXDEPMODE@
CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
@ -66,8 +64,6 @@ ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
F77 = @F77@
FFLAGS = @FFLAGS@
GDAL_CFLAGS = @GDAL_CFLAGS@
GDAL_LIB = @GDAL_LIB@
GRASS_INC = @GRASS_INC@
@ -113,10 +109,8 @@ SHELL = @SHELL@
STRIP = @STRIP@
UIC = @UIC@
VERSION = @VERSION@
ac_ct_AR = @ac_ct_AR@
ac_ct_CC = @ac_ct_CC@
ac_ct_CXX = @ac_ct_CXX@
ac_ct_F77 = @ac_ct_F77@
ac_ct_RANLIB = @ac_ct_RANLIB@
ac_ct_STRIP = @ac_ct_STRIP@
am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
@ -124,7 +118,6 @@ am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
bindir = @bindir@
build = @build@
@ -194,6 +187,7 @@ qgis_SOURCES = qgisapp.cpp \
qgsrenderitem.cpp \
qgsshapefilelayer.cpp \
qgssymbol.cpp\
qgsmapserverexport.cpp \
$(qgis_UI)\
$(qgis_MOC)\
$(am__append_1)
@ -259,7 +253,6 @@ qgis_LDADD := $(LDADD) $(QT_LDADD) $(GDAL_LIB) $(PG_LIB)
AM_CXXFLAGS := $(PGDB) $(CXXFLAGS) $(EXTRA_CXXFLAGS) -I../include $(QT_CXXFLAGS) -I$(PG_INC)
CLEANFILES = $(BUILT_SOURCES)
subdir = src
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_CLEAN_FILES =
bin_PROGRAMS = qgis$(EXEEXT)
@ -275,13 +268,14 @@ am__qgis_SOURCES_DIST = qgisapp.cpp main.cpp qgisiface.cpp \
qgspluginmanager.cpp qgspoint.cpp qgspolygonsymbol.cpp \
qgsprojectio.cpp qgsrasterlayer.cpp qgsrect.cpp qgsrenderer.cpp \
qgsrenderitem.cpp qgsshapefilelayer.cpp qgssymbol.cpp \
qgisappbase.h qgisappbase.cpp qgslegenditembase.h \
qgslegenditembase.cpp qgsabout.h qgsabout.cpp \
qgslayerpropertiesbase.h qgslayerpropertiesbase.cpp \
qgsidentifyresultsbase.h qgsidentifyresultsbase.cpp \
qgsattributetablebase.h qgsattributetablebase.cpp \
qgspluginmanagerbase.h qgspluginmanagerbase.cpp \
qgsmessageviewer.h qgsmessageviewer.cpp qgsdbsourceselectbase.h \
qgsmapserverexport.cpp qgisappbase.h qgisappbase.cpp \
qgslegenditembase.h qgslegenditembase.cpp qgsabout.h \
qgsabout.cpp qgslayerpropertiesbase.h \
qgslayerpropertiesbase.cpp qgsidentifyresultsbase.h \
qgsidentifyresultsbase.cpp qgsattributetablebase.h \
qgsattributetablebase.cpp qgspluginmanagerbase.h \
qgspluginmanagerbase.cpp qgsmessageviewer.h \
qgsmessageviewer.cpp qgsdbsourceselectbase.h \
qgsdbsourceselectbase.cpp qgsnewconnectionbase.h \
qgsnewconnectionbase.cpp qgisappbase.moc.cpp qgisapp.moc.cpp \
qgisinterface.moc.cpp qgsabout.moc.cpp \
@ -338,7 +332,8 @@ am_qgis_OBJECTS = qgisapp.$(OBJEXT) main.$(OBJEXT) qgisiface.$(OBJEXT) \
qgsprojectio.$(OBJEXT) qgsrasterlayer.$(OBJEXT) \
qgsrect.$(OBJEXT) qgsrenderer.$(OBJEXT) qgsrenderitem.$(OBJEXT) \
qgsshapefilelayer.$(OBJEXT) qgssymbol.$(OBJEXT) \
$(am__objects_3) $(am__objects_6) $(am__objects_8)
qgsmapserverexport.$(OBJEXT) $(am__objects_3) $(am__objects_6) \
$(am__objects_8)
qgis_OBJECTS = $(am_qgis_OBJECTS)
qgis_DEPENDENCIES =
qgis_LDFLAGS =
@ -388,6 +383,7 @@ am__depfiles_maybe = depfiles
@AMDEP_TRUE@ ./$(DEPDIR)/qgsmaplayer.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/qgsmaplayer.moc.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/qgsmaplayerinterface.moc.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/qgsmapserverexport.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/qgsmarkersymbol.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/qgsmessageviewer.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/qgsmessageviewer.moc.Po \
@ -425,7 +421,7 @@ CCLD = $(CC)
LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
$(AM_LDFLAGS) $(LDFLAGS) -o $@
DIST_SOURCES = $(am__qgis_SOURCES_DIST)
DIST_COMMON = $(srcdir)/Makefile.in Makefile.am
DIST_COMMON = Makefile.am Makefile.in
SOURCES = $(qgis_SOURCES)
all: $(BUILT_SOURCES)
@ -521,6 +517,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/qgsmaplayer.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/qgsmaplayer.moc.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/qgsmaplayerinterface.moc.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/qgsmapserverexport.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/qgsmarkersymbol.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/qgsmessageviewer.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/qgsmessageviewer.moc.Po@am__quote@
@ -544,10 +541,13 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/qgsshapefilelayer.moc.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/qgssymbol.Po@am__quote@
distclean-depend:
-rm -rf ./$(DEPDIR)
.cpp.o:
@am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \
@am__fastdepCXX_TRUE@ -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<; \
@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \
@am__fastdepCXX_TRUE@ then mv "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \
@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \
@am__fastdepCXX_TRUE@ fi
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@ -558,7 +558,7 @@ distclean-compile:
.cpp.obj:
@am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \
@am__fastdepCXX_TRUE@ -c -o $@ `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi`; \
@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \
@am__fastdepCXX_TRUE@ then mv "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \
@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \
@am__fastdepCXX_TRUE@ fi
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@ -569,7 +569,7 @@ distclean-compile:
.cpp.lo:
@am__fastdepCXX_TRUE@ if $(LTCXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \
@am__fastdepCXX_TRUE@ -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<; \
@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; \
@am__fastdepCXX_TRUE@ then mv "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; \
@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \
@am__fastdepCXX_TRUE@ fi
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
@ -679,8 +679,8 @@ all-am: Makefile $(PROGRAMS)
installdirs:
$(mkinstalldirs) $(DESTDIR)$(bindir)
install: $(BUILT_SOURCES)
$(MAKE) $(AM_MAKEFLAGS) install-am
install: install-am
install-exec: install-exec-am
install-data: install-data-am
uninstall: uninstall-am
@ -700,7 +700,7 @@ clean-generic:
-test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
distclean-generic:
-rm -f $(CONFIG_CLEAN_FILES)
-rm -f Makefile $(CONFIG_CLEAN_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@ -711,11 +711,9 @@ clean: clean-am
clean-am: clean-binPROGRAMS clean-generic clean-libtool mostlyclean-am
distclean: distclean-am
-rm -rf ./$(DEPDIR)
-rm -f Makefile
distclean-am: clean-am distclean-compile distclean-generic \
distclean-libtool distclean-tags
distclean-am: clean-am distclean-compile distclean-depend \
distclean-generic distclean-libtool distclean-tags
dvi: dvi-am
@ -736,8 +734,6 @@ install-man:
installcheck-am:
maintainer-clean: maintainer-clean-am
-rm -rf ./$(DEPDIR)
-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic
@ -758,15 +754,15 @@ uninstall-am: uninstall-binPROGRAMS uninstall-info-am
.PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \
clean-generic clean-libtool ctags distclean distclean-compile \
distclean-generic distclean-libtool distclean-tags distdir dvi \
dvi-am info info-am install install-am install-binPROGRAMS \
install-data install-data-am install-exec install-exec-am \
install-info install-info-am install-man install-strip \
installcheck installcheck-am installdirs maintainer-clean \
maintainer-clean-generic mostlyclean mostlyclean-compile \
mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
tags uninstall uninstall-am uninstall-binPROGRAMS \
uninstall-info-am
distclean-depend distclean-generic distclean-libtool \
distclean-tags distdir dvi dvi-am info info-am install \
install-am install-binPROGRAMS install-data install-data-am \
install-exec install-exec-am install-info install-info-am \
install-man install-strip installcheck installcheck-am \
installdirs maintainer-clean maintainer-clean-generic \
mostlyclean mostlyclean-compile mostlyclean-generic \
mostlyclean-libtool pdf pdf-am ps ps-am tags uninstall \
uninstall-am uninstall-binPROGRAMS uninstall-info-am
%.moc.cpp: %.h
$(MOC) -o $@ $<

View File

@ -61,6 +61,7 @@
#include "qgslegend.h"
#include "qgslegendview.h"
#include "qgsprojectio.h"
#include "qgsmapserverexport.h"
#ifdef POSTGRESQL
#include <libpq++.h>
#include "qgsdbsourceselect.h"
@ -396,6 +397,11 @@ void QgisApp::fileSaveAs(){
delete pio;
}
void QgisApp::exportMapServer(){
QgsMapServerExport *mse = new QgsMapServerExport(mapCanvas, QgsProjectIo::SAVEAS);
mse->write();
delete mse;
}
void QgisApp::zoomIn()
{
/* QWMatrix m = mapCanvas->worldMatrix();

View File

@ -122,6 +122,8 @@ class QgisApp:public QgisAppBase
void fileOpen();
//! Create a new project
void fileNew();
//! Export current view as a mapserver map file
void exportMapServer();
//! Check qgis version against the qgis version server
void checkQgisVersion();
void socketConnected();

View File

@ -9,7 +9,7 @@
<x>0</x>
<y>0</y>
<width>610</width>
<height>459</height>
<height>465</height>
</rect>
</property>
<property name="font">
@ -67,6 +67,7 @@
<separator/>
<action name="actionFileSave"/>
<action name="actionFileSaveAs"/>
<action name="actionExportMapServer"/>
<separator/>
<action name="actionFileExit"/>
</item>
@ -445,6 +446,25 @@
<string>Check QGIS Version</string>
</property>
</action>
<action>
<property name="name">
<cstring>actionExportMapServer</cstring>
</property>
<property name="iconSet">
<iconset>image17</iconset>
</property>
<property name="text">
<string>Export current view as a Mapserver file</string>
</property>
</action>
<action>
<property name="name">
<cstring>fileExport_to_MapServerAction</cstring>
</property>
<property name="text">
<string>Export to MapServer</string>
</property>
</action>
</actions>
<images>
<image name="image0">
@ -498,6 +518,9 @@
<image name="image16">
<data format="XPM.GZ" length="4670">789cadd7596fe3361007f0f77c8a60e76d51cc5ab2254b28fa90c4b94fe74e8a3e0c25ca576cc7b17316fdeea5397f6a9b34bd8082ebddfd811c7178cafef675f5fae470f5ebb795f942168362b5e8cbc3ead7f2713c7efdf9979f7e5df912b756977fa26835fef2c3ca97ee62b5583d9a4eec1272ea40cdbcd96a464bf3a476beb4113843fd636d5f2ff1d2ad28ce1a0ddf7ea60eedcda0b6b63f860bb8e12dad063c87d1bf6c04b7b4ffc3dab234a57086fa23b8d07ae92d9dc4a19e3a70a136f7b57d7b3e50278dc44f169d79d7cfe3549d34d0ff104e50ff10acf1fc0ae789d66fc025ece7238d931cf13618f177700957b5b5fd96b7d4f5a53a8d505f2cdd6ea679aaf5fbea76d46e7a1b6fd38eb45e92a5b36692447e3da50be78dccfbd2db240d5d6f16753b4fb5bf6b7516b58d6f7fb174deaae35fe052e3a5a54ea3587d059758ff7d7586fc9882357f29e01c3e83cbbce5db8fd579a2963def224d90cf365cc2e7ea7689f5bd5167984f5306239f2738ac97e65f84fee816ce91cfa276e1ebfd7c482bcd311f060ef96ca9db113c0a8ed4119c683c9dc388a7437516e17c24eabc44ffcfde857bbef6bf535b9f7f02e3f9f2aaaee38fd4e28e88afdf5cda7cefff499d45ba9fe815c6fc1aab96489f274d18f3c723b589c5d7b35f5f534a588f312ce83f85ad9a06ea102f7efe8b24c37e2482c37eec046bbefca6ce4bbdcf488275bdcd9ddaa4fa7c6ac06234ff5dd89ad27bae2ee222f1eddbde651ece5bbfb6cf8f233857d363b09e17da84912f2d82b5de4cd51265fe7c183c5f92cc9f4f43b0e07cdcc2566d266a373e9dcf0d18e3936b7511ebf8e8184e757c3c84a5d0f123dfc2aac5cf8fbbcc305e1906e33e38529b18fb631d463e52c161fd1f6aeb7a24b0d57ce954edf2d5f115708af569c1a2f99b116cd572575bdb0fd4655aea78336f2b383fbc0387fb4682637fbff10d2c58efd3601d3fb761abedc9a80b8bf3f0ac2e631dbf190623bf4b38e4d7835df1f6f79f4dc5e23c6c05633f8dd526c678bac1d87ff770aaf7355dc082f3320dc6fdb3168cf76ba62e62b51ca843bec6c0a2f952045b8c67565bc7d309b6a9775f6d63781d4ed5e4f7b7b526c5fc8e60c17cdc05e33e3881ad8e971bea22c67dc630f6a7e9d5d6fd388345df979207e33c0d608bfac360ecd74a5de2fe90368cf346252c388f4530da87fa305f4db58de17338b5ea1758e07bd8aac5efbfcaad9faeb73cc1d80f7203237fbe5597b1de47b40da7787f67c19abfac0523ff191cc6636beb785b70b85fee8375bfc854edc6abf3d5afadfb6b1d4ee19360dd2f3281b11f651c8cfd847c6cd87f7bea2aaeb4dedf975555c67a1e846aebf78d2b38c57960389c97bcb6b6df0bd6ef2334872dccb5753f3d06eb7cd381dac678de7e30e22f6b6b7d3318f3d785c37cedc282f57da8addf07df82d13e0ec67c617c36bcbfd78231bf6fb5357e475de1fd4ebd60d45770aaf3cfe8af12f8a276e53d852b7577f1dfcaff13c3e48ab8625c295c295db15cfd434c8ffbf567c0431ef11d8f79f23731e25a4eff50ee79c60f3ce7053ffe65cc133fbf8b99f20bbfbacfd0454dfe22e68dd778fd43d40677dcdf9b2e6aebd3986ddee15dde7b17b3cf077cc8476e5cc77f8ee113eef2299ff1f9bb980bf78c4bbee26bb69fc4dcf02d373872d95fbc8b8ab9c92d4e38fd18c36dce38770b442464a8a092ac4650453dead380861a4323baa3314d684af734a3079abbff2de8919ee8995ec8cd998b78a3355aa70dea847e6893b6689b765cfb5d1731a73ddaa703f784173aa4233aa6131fd1a5533afb9e1b9d73461774e923ae5cb976fdbcd00ddd5283228a5d44935a94d087f1509b321795bbcd46ee3bb49182133a96d24774dd0f692b95f4dec7485f06e8e35a8632e22bb99331bdc984ba32957b99c983cc3fc42ce451c88d7e214ff22c2ff2eafae8c99b2b53d7cb4cd6645d363ec474b8219bb225dbb223bbb227fb72b0cc6a1941858b38942379b70fa4e3da9f48574ee54ccee5422ee54aae5d4ecb3ed67cc48ddc4ae35dcca64412bb7fe76edfcfa429eeb7877b39b75d445b321791bb4348463edda3a931cb353785fb85614d15fa303d57fa66f0590c0dcdb28c5ccc9d199b893cb8cf91dcba3efa662aa79ff7c32975ccbdf45c69c886fb34e4588eddb7f0991beba731ffe2def9edc795df013ad18bd4</data>
</image>
<image name="image17">
<data format="XPM.GZ" length="1904">789c5dd4c772db301006e0bb9e8223dc3c99357b994c0e72efdd96ec4c0e204855cbb68a8b9cc9bb07fb2fa889c3df3e7ce4120217203737bcdec5a9b7b1d95a2cf572643c33d4736fa37a9d4e573f7ffdf8dd6a07a967ff72df0bdbdf5a6d1a78c6533e1f39dc6b1cf8f0bc7114c0c3c6b1864338e7c02f8d13b9be60077ed08cf70ce71c38638741d0dc9fc0459067257c26e6c0113b0a38f0122ec2c0d577c41cf89d1d876191c8f3aec41cf8949d588532debed89e91f9a78dddfd1fb0e6c00fec34e2c07b709984ee792e1a17315ba17f5994681ffd5053761e5ba35ef5c5ebf146620eae97b0492357af1abbf9c46cb44be6bb03c759e99eef53cc81efe18c03dfc038e073b8e4c0016c38f0015c73e02db6f639f02b1c71e0198c0662fe8f709625ae5f4f620e8cfe681cb0d41b0ebc0b5745ecd6f3d2d9b8fd3081fb1c78cc2e030e7c08471cb880933c76fdda86530efc06e71c18eb55e2806bb8e2c015dce7c0866d420e8cf5343107fdc07a9b3437f27ea8a7c66eff9f8875e2dea75bb18df45fc31907c6fec072e1fe4bbc2f0607c6c77c4d5d18d7bf2bb1ae32f44361fe555a18b73e47625d391f8bcbc4bdcfd7620eeec7f356b576ebabc68d65fe0aeb5367ba72cfe38b39700ef7cbe67eedecea15894dedd6fb4eccc1757cdffa9949ddf85d3147fa418a349564a8a29afa34a0218d684c137aa4293d490fffab18d033bd34153493beff533147cdc2fe2fa5825e65add7156ff44e1fb4a24fead8df43056dc9fe58576cdb9a1ddaa53ddab723a2820e644fad2b0e6dcd111dd3099dd2991dcd56d0b9ecc375c58c2ee892aee8da9e5b4805ddc8de7515633bfe2dddd9746d3ad4e30aba97fdee2a86f4e0ae77c9a78042fb74f7f429ef082a4614b9eb4d3af6f7e624df9943f434b1555f6b528c349277133dcdece85f6b3e6c4dcfd54cecd519e554d8a76de6d35564bb14daff997c1329571a29ed1c9a51ae9451953d57cb77765d33b0bd918a400ddd392de3a8911aab09ce3cdad55ad9751fa8a9fdf55c3d51d0fef3bdf5178af1abfa</data>
</image>
</images>
<connections>
<connection>
@ -638,6 +661,18 @@
<receiver>QgisAppBase</receiver>
<slot>select()</slot>
</connection>
<connection>
<sender>actionExportMapServer</sender>
<signal>activated()</signal>
<receiver>QgisAppBase</receiver>
<slot>exportMapServer()</slot>
</connection>
<connection>
<sender>actionAddLayer</sender>
<signal>activated()</signal>
<receiver>QgisAppBase</receiver>
<slot>addDatabaseLayer()</slot>
</connection>
</connections>
<slots>
<slot>fileExit()</slot>
@ -665,6 +700,7 @@
<slot>actionPluginManager_activated()</slot>
<slot>checkQgisVersion()</slot>
<slot>select()</slot>
<slot>exportMapServer()</slot>
</slots>
<layoutdefaults spacing="6" margin="11"/>
</UI>

View File

@ -150,3 +150,9 @@ void QgisAppBase::select()
{
}
void QgisAppBase::exportMapServer()
{
}

View File

@ -65,6 +65,9 @@ void QgsMapCanvas::setLegend(QgsLegend * legend)
{
mapLegend = legend;
}
QgsLegend * QgsMapCanvas::getLegend(){
return mapLegend;
}
void QgsMapCanvas::setDirty(bool _dirty){
dirty = _dirty;
}

View File

@ -14,6 +14,7 @@
* (at your option) any later version. *
* *
***************************************************************************/
/* $Id */
#ifndef QGSMAPCANVAS_H
#define QGSMAPCANVAS_H
@ -48,6 +49,8 @@ public:
~QgsMapCanvas();
//! Set the legend control to be used with this canvas
void setLegend(QgsLegend *legend);
//! Get a pointer to the legend control used with this canvas
QgsLegend * getLegend();
/*! Adds a layer to the map canvas.
* @param lyr Pointer to a layer derived from QgsMapLayer
*/

181
src/qgsmapserverexport.cpp Normal file
View File

@ -0,0 +1,181 @@
/***************************************************************************
qgsmapserverexport.cpp - Export QGIS MapCanvas to MapServer
--------------------------------------
Date : 8-Nov-2003
Copyright : (C) 2003 by Gary E.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. *
* *
***************************************************************************/
/* $Id$ */
#include <iostream>
#include <fstream>
#include <qfiledialog.h>
#include <qfileinfo.h>
#include <qmessagebox.h>
#include <qcolor.h>
#include <qregexp.h>
#include "qgsmaplayer.h"
#ifdef POSTGRESQL
#include "qgsdatabaselayer.h"
#endif
#include "qgsshapefilelayer.h"
#include "qgsmapcanvas.h"
#include "qgsrect.h"
#include "qgsmapserverexport.h"
#include "qgis.h"
QgsMapServerExport::QgsMapServerExport(QgsMapCanvas *_map, int _action) : map(_map), action(_action)
{
}
QgsMapServerExport::~QgsMapServerExport()
{
}
QString QgsMapServerExport::baseName(){
QFileInfo fi(fullPath);
return fi.baseName(true);
}
bool QgsMapServerExport::write(){
if(fullPath.isEmpty()){
selectFileName();
}
//QMessageBox::information(0,"Full Path",fullPath);
int okToSave = 0;
if(QFile::exists(fullPath) && (action == SAVEAS)){
okToSave = QMessageBox::warning(0,"Overwrite File?",fullPath + " exists. \nDo you want to overwrite it?", "Yes", "No");
}
if(okToSave == 0){
// write the project information to the selected file
writeMapFile();
return true;
}else{
return false;
}
}
//Read map server file to create a QGIS view
//TODO - implement this function!
bool QgsMapServerExport::read(){
return true;
}
QString QgsMapServerExport::selectFileName(){
if(action == SAVE && fullPath.isEmpty()){
action = SAVEAS;
}
switch(action){
case OPEN:
fullPath = QFileDialog::getOpenFileName("./", "MapServer files (*.map)", 0, 0, "Choose a file to open" );
break;
case SAVEAS:
fullPath = QFileDialog::getSaveFileName("./", "MapServer files (*.map)", 0, 0, "Choose a filename to save" );
break;
}
return fullPath;
}
void QgsMapServerExport::setFileName(QString fn){
fullPath = fn;
}
QString QgsMapServerExport::fullPathName(){
return fullPath;
}
void QgsMapServerExport::writeMapFile(){
// write the map file, making massive assumptions about default values
std::ofstream mapFile(fullPath);
if(!mapFile.fail()){
// header
mapFile << "#\n# Map file generated by QGIS" << std::endl;
mapFile << "NAME QGISMap" << std::endl; //TODO - use the project name is set
mapFile << "STATUS ON" << std::endl;
mapFile << "SIZE 600 600" << std::endl;
// extent
mapFile << "EXTENT ";
QgsRect extent = map->extent();
mapFile << extent.xMin() << " " << extent.yMin() << " ";
mapFile << extent.xMax() << " " << extent.yMax() << std::endl;
// units
mapFile << "UNITS METERS" << std::endl;
// image info
mapFile << "IMAGECOLOR 255 255 255" << std::endl;
mapFile << "IMAGETYPE PNG" << std::endl;
// projection information TODO: support projections :)
mapFile << "# Projection definition" << std::endl;
// TODO - write WEB section
// layer definitions
for(int i = 0; i < map->layerCount(); i++){
bool isPolygon =false;
QgsMapLayer *lyr = map->getZpos(i);
mapFile << "LAYER" << std::endl;
QString name = lyr->name().lower();
// MapServer NAME must be < 20 char and unique
name.replace(QRegExp(" "),"_");
mapFile << " NAME " << name << std::endl;
// feature type
mapFile << " TYPE ";
switch (lyr->featureType()) {
case QGis::WKBPoint:
case QGis::WKBMultiPoint:
mapFile << "POINT";
break;
case QGis::WKBLineString:
case QGis::WKBMultiLineString:
mapFile << "LINE";
break;
case QGis::WKBPolygon:
case QGis::WKBMultiPolygon:
mapFile << "POLYGON";
isPolygon = true;
break;
}
mapFile << std::endl;
// set visibility (STATUS)
mapFile << " STATUS ";
if(lyr->visible()){
mapFile << "ON";
}else{
mapFile << "OFF";
}
mapFile << std::endl;
// data source (DATA)
// Data source spec depends on layer type
mapFile << " DATA " << lyr->source() << std::endl;
// create a simple class entry based on layer color
QgsSymbol *sym = lyr->symbol();
mapFile << " CLASS" << std::endl;
QgsLegend *lgd = map->getLegend();
//QListViewItem *li = lgd->currentItem();
// return li->text(0);
mapFile << " NAME \"" << lyr->name() << "\"" << std::endl;
mapFile << " # TEMPLATE" << std::endl;
QColor fillColor = sym->fillColor();
mapFile << " COLOR " << fillColor.red() << " " <<
fillColor.green() << " " << fillColor.blue() << std::endl;
if(isPolygon){
QColor outlineColor = sym->color();
mapFile << " OUTLINECOLOR " << outlineColor.red() << " "
<< outlineColor.green() << " " << outlineColor.blue()
<< std::endl;
}
mapFile << " END" << std::endl;
mapFile << "END" << std::endl;
}
mapFile << "END # Map File";
mapFile.close();
}else{
}
}

58
src/qgsmapserverexport.h Normal file
View File

@ -0,0 +1,58 @@
/***************************************************************************
qgsmapserverexport.h - Export QGIS MapCanvas to MapServer
--------------------------------------
Date : 08-Nov-2003
Copyright : (C) 2003 by Gary E.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. *
* *
***************************************************************************/
/* $Id$ */
#ifndef QGSMAPSERVEREXPORT_H
#define QGSMAPSERVEREXPORT_H
class QgsMapCanvas;
/*! \class QgsMapServerExport
* \brief Class to handle reading and writing a Qgis project file
*/
class QgsMapServerExport
{
public:
QgsMapServerExport(QgsMapCanvas *map=0, int action=SAVE);
~QgsMapServerExport();
//! Read the file and create the map
bool read();
//! Write the contents of the map to a file
bool write();
void setMapCanvas(QgsMapCanvas *map);
//! Open a file dialog, the type determined by action (SAVE AS or OPEN)
QString selectFileName();
//! get the basename of the file (no path, just the file name)
QString baseName();
//! get the full path name of the map file
QString fullPathName();
//! Set the full path to the file
void setFileName(QString filename);
enum ACTION {
SAVE,
SAVEAS,
OPEN
};
private:
void writeMapFile(void);
QString fileName;
QString fullPath;
bool neverSaved;
QgsMapCanvas *map;
int action;
};
#endif //QGSMAPSERVEREXPORT_H

View File

@ -1,9 +1,10 @@
/**
*
* Gary Sherman
**/
/***************************************************************************
/***************************************************************************
qgsprojectio.cpp - Save/Restore QGIS project
--------------------------------------
Date : 19-Oct-2003
Copyright : (C) 2003 by Gary E.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 *
@ -11,6 +12,7 @@
* (at your option) any later version. *
* *
***************************************************************************/
/* qgsprojectio.cpp,v 1.8 2003/11/09 06:15:31 gsherman Exp */
#include <iostream>
#include <fstream>
#include <qfiledialog.h>

View File

@ -1,8 +1,9 @@
/**
*
* Gary Sherman
**/
/***************************************************************************
qgsprojectio.h - Save/Restore QGIS Project files
--------------------------------------
Date : 08-Nov-2003
Copyright : (C) 2003 by Gary E.Sherman
email : sherman at mrcc.com
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
@ -11,6 +12,7 @@
* (at your option) any later version. *
* *
***************************************************************************/
/* qgsprojectio.h,v 1.3 2003/11/09 06:15:31 gsherman Exp */
#ifndef _QGSPROJECTIO_H_
#define _QGSPROJECTIO_H_