コード例 #1
0
    def test35_OL3_poly_graduated(self):
        """OL3 polygon graduated (test_qgis2web_dialog.test_OL3_poly_graduated)"""
        layer_path = test_data_path('layer', 'polygon.shp')
        style_path = test_data_path('style', 'json_polygon_graduated.qml')
        control_path = test_data_path('control',
                                      'ol3_json_polygon_graduated.html')
        layer = load_layer(layer_path)
        layer.loadNamedStyle(style_path)

        registry = QgsMapLayerRegistry.instance()
        registry.addMapLayer(layer)

        control_file = open(control_path, 'r')
        control_output = control_file.read()

        self.dialog = MainDialog(IFACE)
        self.dialog.paramsTreeOL.itemWidget(
            self.dialog.paramsTreeOL.findItems(
                "Extent", (Qt.MatchExactly | Qt.MatchRecursive))[0],
            1).setCurrentIndex(1)
        self.dialog.ol3.click()

        test_file = open(self.dialog.preview.url().toString().replace(
            'file://', ''))
        test_output = test_file.read()

        test_style_file = open(self.dialog.preview.url().toString().replace(
            'file://', '').replace('index.html', 'styles/polygon_style.js'))
        test_style_output = test_style_file.read()
        test_output += test_style_output
        self.assertEqual(test_output, control_output)
コード例 #2
0
    def test26_Leaflet_wfs_poly_graduated(self):
        """Leaflet WFS polygon graduated (test_qgis2web_dialog.test_Leaflet_wfs_poly_graduated)"""
        layer_url = ('http://maps.nationalparks.gov.uk/geoserver/wfs?SERVICE'
                     '=WFS&VERSION=1.0.0&REQUEST=GetFeature&TYPENAME'
                     '=yorkshire_dales:ydnpa_conservationareas&SRSNAME=EPSG'
                     ':27700')
        layer_style = test_data_path('style', 'wfs_polygon_graduated.qml')
        control_path = test_data_path('control',
                                      'leaflet_wfs_polygon_graduated.html')
        layer = load_wfs_layer(layer_url, 'polygon')
        layer.loadNamedStyle(layer_style)

        registry = QgsMapLayerRegistry.instance()
        registry.addMapLayer(layer)

        control_file = open(control_path, 'r')
        control_output = control_file.read()

        self.dialog = MainDialog(IFACE)
        self.dialog.paramsTreeOL.itemWidget(
            self.dialog.paramsTreeOL.findItems(
                'Extent', (Qt.MatchExactly | Qt.MatchRecursive))[0],
            1).setCurrentIndex(1)
        self.dialog.leaflet.click()

        test_file = open(self.dialog.preview.url().toString().replace(
            "file://", ""))
        test_output = test_file.read()
        self.assertEqual(test_output, control_output)
コード例 #3
0
    def test25_Leaflet_json_poly_graduated(self):
        """Leaflet JSON polygon graduated (test_qgis2web_dialog.test_Leaflet_json_poly_graduated)"""
        layer_path = test_data_path('layer', 'polygon.shp')
        layer_style = test_data_path('style', 'json_polygon_graduated.qml')
        control_path = test_data_path('control',
                                      'leaflet_json_polygon_graduated.html')
        layer = load_layer(layer_path)
        layer.loadNamedStyle(layer_style)

        registry = QgsMapLayerRegistry.instance()
        registry.addMapLayer(layer)

        control_file = open(control_path, 'r')
        control_output = control_file.read()

        self.dialog = MainDialog(IFACE)
        self.dialog.paramsTreeOL.itemWidget(
            self.dialog.paramsTreeOL.findItems(
                'Extent', (Qt.MatchExactly | Qt.MatchRecursive))[0],
            1).setCurrentIndex(1)
        self.dialog.leaflet.click()

        test_file = open(self.dialog.preview.url().toString().replace(
            "file://", ""))
        test_output = test_file.read()
        self.assertEqual(test_output, control_output)
コード例 #4
0
 def tearDown(self):
     """Runs after each test"""
     registry = QgsMapLayerRegistry.instance()
     registry.removeAllMapLayers()
     self.dialog = MainDialog(IFACE)
     self.dialog.ol3.click()
     self.dialog = None
コード例 #5
0
    def test09_Leaflet_json_pnt_single(self):
        """Leaflet JSON point single (test_qgis2web_dialog.test_Leaflet_json_pnt_single)"""
        layer_path = test_data_path('layer', 'point.shp')
        style_path = test_data_path('style', 'point_single.qml')
        layer = load_layer(layer_path)
        layer.loadNamedStyle(style_path)

        registry = QgsMapLayerRegistry.instance()
        registry.addMapLayer(layer)

        control_file = open(
            test_data_path('control', 'leaflet_json_point_single.html'), 'r')
        control_output = control_file.read()

        # Export to web map
        self.dialog = MainDialog(IFACE)
        self.dialog.paramsTreeOL.itemWidget(
            self.dialog.paramsTreeOL.findItems(
                'Extent', (Qt.MatchExactly | Qt.MatchRecursive))[0],
            1).setCurrentIndex(1)
        self.dialog.leaflet.click()

        # Open the test file
        test_file = open(self.dialog.preview.url().toString().replace(
            'file://', ''))
        test_output = test_file.read()

        # Compare with control file
        self.assertEqual(test_output, control_output)
コード例 #6
0
ファイル: qgis2web.py プロジェクト: maellson/qgis2web
 def run(self):
     if not self.dlg or sip.isdeleted(self.dlg):
         self.dlg = MainDialog(self.iface)
     self.dlg.setAttribute(Qt.WA_DeleteOnClose)
     self.dlg.show()
     # bring to front
     self.dlg.raise_()
コード例 #7
0
    def test10_Leaflet_wfs_pnt_single(self):
        """Leaflet WFS point single (test_qgis2web_dialog.test_Leaflet_wfs_pnt_single)"""
        layer_url = ('http://maps.nationalparks.gov.uk/geoserver/wfs?SERVICE'
                     '=WFS&VERSION=1.0.0&REQUEST=GetFeature&TYPENAME=dartmoor'
                     ':dnpa-tpo-point&SRSNAME=EPSG:27700')
        layer_style = test_data_path('style', 'point_single.qml')
        layer = load_wfs_layer(layer_url, 'point')
        layer.loadNamedStyle(layer_style)

        registry = QgsMapLayerRegistry.instance()
        registry.addMapLayer(layer)

        control_file = open(
            test_data_path('control', 'leaflet_wfs_point_single.html'), 'r')
        control_output = control_file.read()

        self.dialog = MainDialog(IFACE)
        self.dialog.paramsTreeOL.itemWidget(
            self.dialog.paramsTreeOL.findItems(
                'Extent', (Qt.MatchExactly | Qt.MatchRecursive))[0],
            1).setCurrentIndex(1)
        self.dialog.leaflet.click()

        test_file = open(self.dialog.preview.url().toString().replace(
            'file://', ''))
        test_output = test_file.read()
        self.assertEqual(test_output, control_output)
コード例 #8
0
 def setUp(self):
     """Runs before each test"""
     self.dialog = MainDialog(IFACE)
     self.dialog.paramsTreeOL.itemWidget(
         self.dialog.paramsTreeOL.findItems(
             "Template", (Qt.MatchExactly | Qt.MatchRecursive))[0],
         1).setCurrentIndex(1)
コード例 #9
0
ファイル: aeag_mask.py プロジェクト: GRSEB9S/linconfig
    def run(self):
        dest_crs, poly = self.get_selected_polygons()
        is_new = False
        if not self.layer:
            if not poly:
                QMessageBox.critical(None, self.tr("Mask plugin error"),
                                     self.tr("No polygon selection !"))
                return
            self.layer = QgsVectorLayer(
                "MultiPolygon?crs=%s" % dest_crs.authid(), self.mask_name,
                "memory")
            style_tools.set_default_layer_symbology(self.layer)
            is_new = True
        self.parameters.layer = self.layer

        if self.must_reload_from_layer:
            self.layer = self.must_reload_from_layer
            self.parameters.load_from_layer(self.layer)
            self.must_reload_from_layer = None

        dlg = MainDialog(self.parameters, is_new)
        dlg.applied.connect(self.apply_mask_parameters)

        r = dlg.exec_()
        if r == 1:
            self.apply_mask_parameters()

        self.update_menus()
コード例 #10
0
 def test11_Leaflet_shp_poly_simple(self):
     """Leaflet shape polygon simple (test_qgis2web_dialog.test_Leaflet_shp_poly_simple)."""
     layer = QgsVectorLayer(
         "/home/travis/build/tomchadwin/qgis2web/test_data/polygon_feature.shp",
         "polygon feature", "ogr")
     if not layer:
         print "Layer failed to load!"
     registry = QgsMapLayerRegistry.instance()
     registry.addMapLayer(layer)
     self.dialog = MainDialog(IFACE)
     self.dialog.leaflet.click()
コード例 #11
0
 def test09_Leaflet_shp_pnt_simple(self):
     """Leaflet shape point simple (test_qgis2web_dialog.test_Leaflet_shp_pnt_simple)."""
     layer = QgsVectorLayer(
         "/home/travis/build/tomchadwin/qgis2web/test_data/places_few_1.shp",
         "point feature", "ogr")
     if not layer:
         print "Layer failed to load!"
     registry = QgsMapLayerRegistry.instance()
     registry.addMapLayer(layer)
     testFile = open(
         '/home/travis/build/tomchadwin/qgis2web/test_data/shp_point_simple.html',
         'r')
     goodOutput = testFile.read()
     self.dialog = MainDialog(IFACE)
     self.dialog.leaflet.click()
コード例 #12
0
 def run(self):
     appdef = None
     projFile = QgsProject.instance().fileName()
     if projFile:
         appdefFile = projFile + ".appdef"
         if os.path.exists(appdefFile):
             ret = QMessageBox.question(
                 self.iface.mainWindow(), "Web app builder",
                 "This project has been already published as a web app.\n"
                 "Do you want to reload app configuration?",
                 QMessageBox.Yes | QMessageBox.No, QMessageBox.Yes)
             if ret == QMessageBox.Yes:
                 appdef = loadAppdef(appdefFile)
     initialize()
     dlg = MainDialog(appdef)
     dlg.exec_()
コード例 #13
0
ファイル: qgis2web.py プロジェクト: nothing-butanol/qgis2web
 def run(self):
     dlg = MainDialog(self.iface)
     dlg.exec_()
コード例 #14
0
 def test08_export_OL3(self):
     """Export OL3 - no data (test_qgis2web_dialog.test_export_OL3)."""
     self.dialog = MainDialog(IFACE)
     self.dialog.ol3.click()
     self.dialog.buttonExport.click()
コード例 #15
0
 def test07_preview_OL3(self):
     """Preview OL3 - no data (test_qgis2web_dialog.test_preview_OL3)."""
     self.dialog = MainDialog(IFACE)
     self.dialog.ol3.click()
     self.dialog.buttonPreview.click()
コード例 #16
0
 def test06_toggle_OL3(self):
     """Toggle to OL3 (test_qgis2web_dialog.test_toggle_OL3)."""
     self.dialog = MainDialog(IFACE)
     self.dialog.ol3.click()
コード例 #17
0
 def test05_export_Leaflet(self):
     """Export Leaflet - no data (test_qgis2web_dialog.test_export_Leaflet)."""
     self.dialog = MainDialog(IFACE)
     self.dialog.leaflet.click()
     self.dialog.buttonExport.click()
コード例 #18
0
 def test04_preview_Leaflet(self):
     """Preview Leaflet - no data (test_qgis2web_dialog.test_preview_Leaflet)."""
     self.dialog = MainDialog(IFACE)
     self.dialog.leaflet.click()
     self.dialog.buttonPreview.click()
コード例 #19
0
 def test03_toggle_Leaflet(self):
     """Toggle to Leaflet (test_qgis2web_dialog.test_toggle_Leaflet)."""
     self.dialog = MainDialog(IFACE)
     self.dialog.leaflet.click()
コード例 #20
0
 def test02_save_default(self):
     """Save default - no data (OL3) (test_qgis2web_dialog.test_save_default)."""
     self.dialog = MainDialog(IFACE)
     self.dialog.buttonExport.click()
コード例 #21
0
 def test01_preview_default(self):
     """Preview default - no data (OL3) (test_qgis2web_dialog.test_preview_default)."""
     self.dialog = MainDialog(IFACE)
     self.dialog.buttonPreview.click()
コード例 #22
0
 def run(self):
     dlg = MainDialog()
     dlg.exec_()
コード例 #23
0
 def run(self):
     dlg = MainDialog(self.iface)
     dlg.show()