Esempio n. 1
0
	def export2leaf(self):
		dictionary = layerlist()
		for i in range(len(dictionary)):
			#print dictionary[i]
			for key in dictionary[i]:
				if key == 'META':
					continue
				else:
					if self.ui.comboBox.currentText() == key:
						self.basemapMeta = dictionary[i]['META']
						self.basemapName = self.ui.comboBox.currentText()
						self.basemapAddress = dictionary[i][self.ui.comboBox.currentText()]
		self.outFileName=self.ui.lineEdit_2.text()		
		self.width = self.ui.width_box.text()
		self.height = self.ui.height_box.text()
		self.webpage_name = self.ui.webpage_name.text()
		self.webmap_head = self.ui.webmap_head.text()
		self.webmap_subhead = self.ui.webmap_subhead.text()
		self.extent = self.ui.comboBox_2.currentText()
		self.visible = self.ui.comboBox_3.currentText()
		self.layer_list = self.ui.listWidget.selectedItems()
		self.opacity = self.ui.checkBox.isChecked()
		self.encode2JSON = self.ui.encode2JSON.isChecked()
		self.createcluster = self.ui.createcluster.isChecked()
		self.legend = self.ui.createlegend.isChecked()
		self.locate = self.ui.locate.isChecked()
		self.address = self.ui.address.isChecked()
		#print self.opacity
		for i in range(len(self.layer_list)): 
			self.layer_list[i] = re.sub('[\W_]+', '', self.layer_list[i].text())
		qgis2leaf_exec(self.outFileName, self.basemapName, self.basemapMeta, self.basemapAddress, self.width, self.height, self.extent, self.full_screen, self.layer_list, self.visible, self.opacity, self.encode2JSON,self.createcluster, self.webpage_name, self.webmap_head,self.webmap_subhead, self.legend,self.locate,self.address)
		self.close()
Esempio n. 2
0
	def export2leaf(self):
		self.basemapName = []
		self.basemapMeta = []
		self.basemapAddress = []
		dictionary = layerlist()
		for i in range(len(dictionary)):
			#print dictionary[i]
			for key in dictionary[i]:
				if key == 'META':
					continue
				else:
					for baseitem in self.ui.comboBox.selectedItems():
						if baseitem.text() == key:
							self.basemapMeta.append(dictionary[i]['META'])
							print baseitem.text()
							self.basemapName.append(baseitem.text())
							self.basemapAddress.append(dictionary[i][baseitem.text()])
		
		self.outFileName=self.ui.lineEdit_2.text()		
		self.width = self.ui.width_box.text()
		self.height = self.ui.height_box.text()
		self.webpage_name = self.ui.webpage_name.text()
		self.webmap_head = self.ui.webmap_head.text()
		self.webmap_subhead = self.ui.webmap_subhead.text()
		self.extent = self.ui.comboBox_2.currentText()
		self.visible = self.ui.comboBox_3.currentText()
		self.layer_list = self.ui.listWidget.selectedItems()
		self.opacity = self.ui.checkBox.isChecked()
		self.encode2JSON = self.ui.encode2JSON.isChecked()
		self.createcluster = self.ui.createcluster.isChecked()
		self.legend = self.ui.createlegend.isChecked()
		self.locate = self.ui.locate.isChecked()
		self.address = self.ui.address.isChecked()
		self.precision = self.ui.spinBox.value()
		self.labels = self.ui.extract_labels.isChecked()
		self.labelshover = self.ui.labelsonhover.isChecked()
		self.matchCRS = self.ui.matchCRS.isChecked()
		self.selected = self.ui.exp_selected.isChecked()
		print self.precision
		if self.matchCRS == True:
			self.createcluster = False

		for i in range(len(self.layer_list)): 
			self.layer_list[i] = re.sub('[\W_]+', '', self.layer_list[i].text())
		qgis2leaf_exec(self.outFileName, self.basemapName, self.basemapMeta, self.basemapAddress, self.width, self.height, self.extent, self.full_screen, self.layer_list, self.visible, self.opacity, self.encode2JSON,self.createcluster, self.webpage_name, self.webmap_head,self.webmap_subhead, self.legend,self.locate,self.address, self.precision, self.labels, self.labelshover, self.matchCRS, self.selected)
		self.close()
Esempio n. 3
0
 def export2leaf(self):
     dictionary = layerlist()
     for i in range(len(dictionary)):
         #print dictionary[i]
         for key in dictionary[i]:
             if key == 'META':
                 continue
             else:
                 if self.ui.comboBox.currentText() == key:
                     self.basemapMeta = dictionary[i]['META']
                     self.basemapName = self.ui.comboBox.currentText()
                     self.basemapAddress = dictionary[i][
                         self.ui.comboBox.currentText()]
     self.outFileName = self.ui.lineEdit_2.text()
     self.width = self.ui.width_box.text()
     self.height = self.ui.height_box.text()
     self.webpage_name = self.ui.webpage_name.text()
     self.webmap_head = self.ui.webmap_head.text()
     self.webmap_subhead = self.ui.webmap_subhead.text()
     self.extent = self.ui.comboBox_2.currentText()
     self.visible = self.ui.comboBox_3.currentText()
     self.layer_list = self.ui.listWidget.selectedItems()
     self.opacity = self.ui.checkBox.isChecked()
     self.encode2JSON = self.ui.encode2JSON.isChecked()
     self.createcluster = self.ui.createcluster.isChecked()
     self.legend = self.ui.createlegend.isChecked()
     self.locate = self.ui.locate.isChecked()
     self.address = self.ui.address.isChecked()
     #print self.opacity
     for i in range(len(self.layer_list)):
         self.layer_list[i] = re.sub('[\W_]+', '',
                                     self.layer_list[i].text())
     qgis2leaf_exec(self.outFileName, self.basemapName, self.basemapMeta,
                    self.basemapAddress, self.width, self.height,
                    self.extent, self.full_screen, self.layer_list,
                    self.visible, self.opacity, self.encode2JSON,
                    self.createcluster, self.webpage_name, self.webmap_head,
                    self.webmap_subhead, self.legend, self.locate,
                    self.address)
     self.close()
Esempio n. 4
0
	def __init__(self):
		QtGui.QDialog.__init__(self)
        # Set up the user interface from Designer.
		self.ui = Ui_qgis2leaf()
		self.ui.setupUi(self)

		self.setWindowTitle("QGIS 2 Leaflet")
		
		# Additional code
		self.outFileName = None
		self.ui.listWidget.setSelectionMode(QtGui.QAbstractItemView.ExtendedSelection)
		self.ui.comboBox.setSelectionMode(QtGui.QAbstractItemView.ExtendedSelection)
		
		# For now disable some features
		self.ui.lineEdit_2.setReadOnly(False)
		self.ui.okButton.setDisabled(False)
		self.ui.listWidget.clear()
		
		# Connect signals
		self.ui.cancelButton.clicked.connect(self.close)
		dictionary = layerlist()
		attrFields = []
		for i in range(len(dictionary)):
			#print dictionary[i]
			for key in dictionary[i]:
				if key == 'META':
					continue
				else:
					attrFields.append(key)
		self.ui.comboBox.addItems(attrFields)
		extFields = ['canvas extent', 'layer extent']
		self.ui.comboBox_2.addItems(extFields)
		visFields = ['show all', 'show none']
		self.ui.lineEdit_2.setText(tempfile.gettempdir())
		self.outFileName = self.ui.lineEdit_2.text()
		self.ui.comboBox_3.addItems(visFields)
		self.ui.pushButton_2.clicked.connect(self.showSaveDialog)
		#settings dialog:
		self.ui.lineEdit_3.setText(str(tempfile.gettempdir()) + os.sep +'settings.csv')
		self.SettingsFileName = self.ui.lineEdit_3.text()
		self.ui.lineEdit_4.setText(str(tempfile.gettempdir()) + os.sep +'settings.csv')
		self.SettingsFileNameLoad = self.ui.lineEdit_4.text()
		self.ui.pushButton_3.clicked.connect(self.showSaveDialogSettings)
		self.ui.pushButton_4.clicked.connect(self.showLoadDialogSettings)

		self.ui.okButton.clicked.connect(self.export2leaf)		
		self.ui.okButton_2.clicked.connect(self.SaveDialogSettings)
		self.ui.okButton_3.clicked.connect(self.LoadDialogSettings)
		self.ui.getSizeButton.clicked.connect(self.getSize)
		self.ui.getButton.clicked.connect(self.layerGet)
		# set default width and height for the leaflet output
		self.ui.radioButton.setChecked(False)
		self.full_screen = 0
		self.width = self.ui.width_box.setText('800')
		self.height = self.ui.height_box.setText('600')
		self.ui.radioButton.toggled.connect(self.width_)
		if QgsProject.instance().title() != "":
			self.webpage_name = self.ui.webpage_name.setText(unicode(QgsProject.instance().title()))
			self.webmap_head = self.ui.webmap_head.setText(unicode(QgsProject.instance().title()))
			self.webmap_subhead = self.ui.webmap_subhead.setText(unicode(QgsProject.instance().title()))
		else:
			self.webpage_name = self.ui.webpage_name.setText("QGIS2leaf webmap")
			self.webmap_head = self.ui.webmap_head.setText("This is the title")
			self.webmap_subhead = self.ui.webmap_subhead.setText("This is the subtitle")