示例#1
0
    def exportTxt(self):
        delimiter = self.__getDelimiter()
        decimalDelimiter = self.__getDecimalDelimiter()
        if delimiter == decimalDelimiter:
            msg = QApplication.translate(
                'code', 'Gleiches Dezimal- und Spaltentrennzeichen gewählt!',
                None, QApplication.UnicodeUTF8)
            QMessageBox.warning(self.iface.mainWindow(), 'VoGIS-Profiltool',
                                msg)
            return

        u = Util(self.iface)
        caption = QApplication.translate('code', 'Textdatei exportieren', None,
                                         QApplication.UnicodeUTF8)
        fileName, file_ext = u.getFileName(caption, [["txt", "txt"]],
                                           self.filePath)
        if fileName == '':
            return
        fInfo = QFileInfo(fileName)
        self.filePath = fInfo.path()
        QSettings().setValue("vogisprofiltoolmain/savepath", self.filePath)
        hekto = (self.ui.IDC_chkHekto.checkState() == Qt.Checked)
        attribs = (self.ui.IDC_chkLineAttributes.checkState() == Qt.Checked)
        txt = open(fileName, 'w')

        txt.write(self.profiles[0].writeHeader(
            self.settings.mapData.rasters.selectedRasters(), hekto, attribs,
            delimiter))
        for p in self.profiles:
            #txt.write('=====Profil {0}======{1}'.format(p.id, os.linesep))
            #txt.write('Segments:{0}{1}'.format(len(p.segments), os.linesep))
            #for s in p.segments:
            #    txt.write('Vertices:{0}{1}'.format(len(s.vertices), os.linesep))
            txt.write(p.toString(hekto, attribs, delimiter, decimalDelimiter))
        txt.close()
示例#2
0
    def __exportShp(self, asPnt):

        u = Util(self.iface)
        if asPnt is True:
            caption = QApplication.translate('code',
                                             'Punkt Shapefile exportieren',
                                             None, QApplication.UnicodeUTF8)
        else:
            caption = QApplication.translate('code',
                                             'Linien Shapefile exportieren',
                                             None, QApplication.UnicodeUTF8)
        fileName, file_ext = u.getFileName(caption, [["shp", "shp"]],
                                           self.filePath)
        if fileName == '':
            return
        fInfo = QFileInfo(fileName)
        self.filePath = fInfo.path()
        QSettings().setValue("vogisprofiltoolmain/savepath", self.filePath)
        expShp = ExportShape(
            self.iface, (self.ui.IDC_chkHekto.checkState() == Qt.Checked),
            (self.ui.IDC_chkLineAttributes.checkState() == Qt.Checked),
            self.__getDelimiter(), self.__getDecimalDelimiter(), fileName,
            self.settings, self.profiles)
        if asPnt is False:
            expShp.exportLine()
        else:
            expShp.exportPoint()
示例#3
0
    def exportCsvXls(self):
        u = Util(self.iface)
        caption = QApplication.translate('code', 'CSV-datei exportieren', None, QApplication.UnicodeUTF8)
        fileName = u.getFileName(caption, [["csv", "csv"]], self.filePath)
        if fileName == '':
            return
        fInfo = QFileInfo(fileName)
        self.filePath = fInfo.path()
        QSettings().setValue("vogisprofiltoolmain/savepath", self.filePath)
        hekto = (self.ui.IDC_chkHekto.checkState() == Qt.Checked)
        attribs = (self.ui.IDC_chkLineAttributes.checkState() == Qt.Checked)
        delimiter = ';'
        decimalDelimiter = self.__getDecimalDelimiter()

        txt = open(fileName, 'w')

        txt.write(self.profiles[0].writeHeader(self.settings.mapData.rasters.selectedRasters(), hekto, attribs, delimiter))
        for p in self.profiles:
            #txt.write('=====Profil {0}======{1}'.format(p.id, os.linesep))
            #txt.write('Segments:{0}{1}'.format(len(p.segments), os.linesep))
            #for s in p.segments:
            #    txt.write('Vertices:{0}{1}'.format(len(s.vertices), os.linesep))
            txt.write(p.toString(hekto,
                                 attribs,
                                 delimiter,
                                 decimalDelimiter
                                 ))
示例#4
0
    def exportTxt(self):
        delimiter = self.__getDelimiter()
        decimalDelimiter = self.__getDecimalDelimiter()
        if delimiter == decimalDelimiter:
            msg = QApplication.translate('code', 'Gleiches Dezimal- und Spaltentrennzeichen gewählt!', None, QApplication.UnicodeUTF8)
            QMessageBox.warning(self.iface.mainWindow(), 'VoGIS-Profiltool', msg)
            return

        u = Util(self.iface)
        caption = QApplication.translate('code', 'Textdatei exportieren', None, QApplication.UnicodeUTF8)
        fileName = u.getFileName(caption, [["txt", "txt"]], self.filePath)
        if fileName == '':
            return
        fInfo = QFileInfo(fileName)
        self.filePath = fInfo.path()
        QSettings().setValue("vogisprofiltoolmain/savepath", self.filePath)
        hekto = (self.ui.IDC_chkHekto.checkState() == Qt.Checked)
        attribs = (self.ui.IDC_chkLineAttributes.checkState() == Qt.Checked)
        txt = open(fileName, 'w')

        txt.write(self.profiles[0].writeHeader(self.settings.mapData.rasters.selectedRasters(), hekto, attribs, delimiter))
        for p in self.profiles:
            #txt.write('=====Profil {0}======{1}'.format(p.id, os.linesep))
            #txt.write('Segments:{0}{1}'.format(len(p.segments), os.linesep))
            #for s in p.segments:
            #    txt.write('Vertices:{0}{1}'.format(len(s.vertices), os.linesep))
            txt.write(p.toString(hekto,
                                 attribs,
                                 delimiter,
                                 decimalDelimiter
                                 ))

        txt.close()
示例#5
0
    def __exportShp(self, asPnt):

        u = Util(self.iface)
        if asPnt is True:
            caption = QApplication.translate('code', 'Punkt Shapefile exportieren', None, QApplication.UnicodeUTF8)
        else:
            caption = QApplication.translate('code', 'Linien Shapefile exportieren', None, QApplication.UnicodeUTF8)
        fileName = u.getFileName(caption, [["shp", "shp"]], self.filePath)
        if fileName == '':
            return
        fInfo = QFileInfo(fileName)
        self.filePath = fInfo.path()
        QSettings().setValue("vogisprofiltoolmain/savepath", self.filePath)
        expShp = ExportShape(self.iface,
                             (self.ui.IDC_chkHekto.checkState() == Qt.Checked),
                             (self.ui.IDC_chkLineAttributes.checkState() == Qt.Checked),
                             self.__getDelimiter(),
                             self.__getDecimalDelimiter(),
                             fileName,
                             self.settings,
                             self.profiles
                             )
        if asPnt is False:
            expShp.exportLine()
        else:
            expShp.exportPoint()
示例#6
0
    def exportCsvXls(self):
        u = Util(self.iface)
        caption = QApplication.translate('code', 'CSV-datei exportieren', None,
                                         QApplication.UnicodeUTF8)
        fileName = u.getFileName(caption, [["csv", "csv"]], self.filePath)
        if fileName == '':
            return
        fInfo = QFileInfo(fileName)
        self.filePath = fInfo.path()
        QSettings().setValue("vogisprofiltoolmain/savepath", self.filePath)
        hekto = (self.ui.IDC_chkHekto.checkState() == Qt.Checked)
        attribs = (self.ui.IDC_chkLineAttributes.checkState() == Qt.Checked)
        delimiter = ';'
        decimalDelimiter = self.__getDecimalDelimiter()

        txt = open(fileName, 'w')

        txt.write(self.profiles[0].writeHeader(
            self.settings.mapData.rasters.selectedRasters(), hekto, attribs,
            delimiter))
        for p in self.profiles:
            #txt.write('=====Profil {0}======{1}'.format(p.id, os.linesep))
            #txt.write('Segments:{0}{1}'.format(len(p.segments), os.linesep))
            #for s in p.segments:
            #    txt.write('Vertices:{0}{1}'.format(len(s.vertices), os.linesep))
            txt.write(p.toString(hekto, attribs, delimiter, decimalDelimiter))
    def exportCsvXls(self):
        u = Util(self.iface)
        caption = QApplication.translate("code", "Excel- oder CSV-Datei exportieren", None, QApplication.UnicodeUTF8)
        file_format = []
        file_format.append(["Microsoft Excel 2007/2010 XML", "xlsx"])
        file_format.append(["Comma-Separated Values CSV", "csv"])

        fileName, fileExt = u.getFileName(caption, file_format, self.filePath)
        QgsMessageLog.logMessage(u"fileName: {0} fileExt:{1}".format(fileName, fileExt), "VoGis")

        if fileName == "":
            return
        fInfo = QFileInfo(fileName)
        self.filePath = fInfo.path()
        QSettings().setValue("vogisprofiltoolmain/savepath", self.filePath)
        hekto = self.ui.IDC_chkHekto.checkState() == Qt.Checked
        attribs = self.ui.IDC_chkLineAttributes.checkState() == Qt.Checked
        delimiter = ";"
        decimalDelimiter = self.__getDecimalDelimiter()

        if fileExt == "csv":
            txt = open(fileName, "w")
            txt.write(
                self.profiles[0].writeHeader(self.settings.mapData.rasters.selectedRasters(), hekto, attribs, delimiter)
            )
            for p in self.profiles:
                # txt.write('=====Profil {0}======{1}'.format(p.id, os.linesep))
                # txt.write('Segments:{0}{1}'.format(len(p.segments), os.linesep))
                # for s in p.segments:
                #    txt.write('Vertices:{0}{1}'.format(len(s.vertices), os.linesep))
                txt.write(p.toString(hekto, attribs, delimiter, decimalDelimiter))
        else:
            # BEGIN XLSX-Export
            exXls = ExportXls(self.iface, fileName, self.settings, self.profiles, hekto, attribs, decimalDelimiter)
            exXls.create()
示例#8
0
 def exportAutoCadTxt(self):
     u = Util(self.iface)
     caption = QApplication.translate('code', 'AutoCad Textdatei exportieren', None, QApplication.UnicodeUTF8)
     fileName = u.getFileName(caption, [["txt", "txt"]], self.filePath)
     if fileName == '':
         return
     fInfo = QFileInfo(fileName)
     self.filePath = fInfo.path()
     QSettings().setValue("vogisprofiltoolmain/savepath", self.filePath)
     txt = open(fileName, 'w')
     for p in self.profiles:
         txt.write(p.toACadTxt(' ', '.'))
     txt.close()
示例#9
0
 def __exportDxf(self, asPnt):
     u = Util(self.iface)
     caption = QApplication.translate('code', 'DXF exportieren', None, QApplication.UnicodeUTF8)
     fileName = u.getFileName(caption, [["dxf", "dxf"]], self.filePath)
     if fileName == '':
         return
     fInfo = QFileInfo(fileName)
     self.filePath = fInfo.path()
     QSettings().setValue("vogisprofiltoolmain/savepath", self.filePath)
     exDxf = ExportDxf(self.iface, fileName, self.settings, self.profiles)
     if asPnt is True:
         exDxf.exportPoint()
     else:
         exDxf.exportLine()
示例#10
0
 def __exportDxf(self, asPnt):
     u = Util(self.iface)
     caption = QApplication.translate('code', 'DXF exportieren', None,
                                      QApplication.UnicodeUTF8)
     fileName = u.getFileName(caption, [["dxf", "dxf"]], self.filePath)
     if fileName == '':
         return
     fInfo = QFileInfo(fileName)
     self.filePath = fInfo.path()
     QSettings().setValue("vogisprofiltoolmain/savepath", self.filePath)
     exDxf = ExportDxf(self.iface, fileName, self.settings, self.profiles)
     if asPnt is True:
         exDxf.exportPoint()
     else:
         exDxf.exportLine()
示例#11
0
 def exportAutoCadTxt(self):
     u = Util(self.iface)
     caption = QApplication.translate('code',
                                      'AutoCad Textdatei exportieren', None,
                                      QApplication.UnicodeUTF8)
     fileName = u.getFileName(caption, [["txt", "txt"]], self.filePath)
     if fileName == '':
         return
     fInfo = QFileInfo(fileName)
     self.filePath = fInfo.path()
     QSettings().setValue("vogisprofiltoolmain/savepath", self.filePath)
     txt = open(fileName, 'w')
     for p in self.profiles:
         txt.write(p.toACadTxt(' ', '.'))
     txt.close()
示例#12
0
    def exportCsvXls(self):
        u = Util(self.iface)
        caption = QApplication.translate('code',
                                         'Excel- oder CSV-Datei exportieren',
                                         None, QApplication.UnicodeUTF8)
        file_format = []
        file_format.append(["Microsoft Excel 2007/2010 XML", "xlsx"])
        file_format.append(["Comma-Separated Values CSV", "csv"])

        fileName, fileExt = u.getFileName(caption, file_format, self.filePath)
        QgsMessageLog.logMessage(
            u'fileName: {0} fileExt:{1}'.format(fileName, fileExt), 'VoGis')

        if fileName == '':
            return
        fInfo = QFileInfo(fileName)
        self.filePath = fInfo.path()
        QSettings().setValue("vogisprofiltoolmain/savepath", self.filePath)
        hekto = (self.ui.IDC_chkHekto.checkState() == Qt.Checked)
        attribs = (self.ui.IDC_chkLineAttributes.checkState() == Qt.Checked)
        delimiter = ';'
        decimalDelimiter = self.__getDecimalDelimiter()

        if fileExt == 'csv':
            txt = open(fileName, 'w')
            txt.write(self.profiles[0].writeHeader(
                self.settings.mapData.rasters.selectedRasters(), hekto,
                attribs, delimiter))
            for p in self.profiles:
                #txt.write('=====Profil {0}======{1}'.format(p.id, os.linesep))
                #txt.write('Segments:{0}{1}'.format(len(p.segments), os.linesep))
                #for s in p.segments:
                #    txt.write('Vertices:{0}{1}'.format(len(s.vertices), os.linesep))
                txt.write(
                    p.toString(hekto, attribs, delimiter, decimalDelimiter))
        else:
            # BEGIN XLSX-Export
            exXls = ExportXls(self.iface, fileName, self.settings,
                              self.profiles, hekto, attribs, decimalDelimiter)
            exXls.create()