def test01_export_empty(self): """test exporting with empty export settings""" # map settings canvasSize = QSize(600, 600) width = 1000. height = width * canvasSize.height() / canvasSize.width() crs = QgsCoordinateReferenceSystem(3099, QgsCoordinateReferenceSystem.EpsgCrsId) # JGD2000 / UTM zone 53N mapSettings = QgsMapSettings() mapSettings.setOutputSize(canvasSize) mapSettings.setExtent(QgsRectangle(0, 0, width, height)) mapSettings.setDestinationCrs(crs) exporter = Exporter() exporter.setMapSettings(mapSettings) err = exporter.export(outputPath(os.path.join("empty", "empty.html"))) assert err == Exporter.NO_ERROR, err
def test02_export_project1(self): """test exporting from a test project""" projectPath = dataPath("testproject1.qgs") mapSettings = loadProject(projectPath) # output size width = 800 height = width * mapSettings.extent().height() / mapSettings.extent().width() mapSettings.setOutputSize(QSize(width, height)) exporter = Exporter(None, dataPath("testproject1.qto3settings")) exporter.setMapSettings(mapSettings) err = exporter.export(outputPath(os.path.join("testproject1", "testproject1.html"))) assert err == Exporter.NO_ERROR, err # test export with flat plane and vector objects exporter.settings.data[ObjectTreeItem.ITEM_DEM]["comboBox_DEMLayer"] = 0 err = exporter.export(outputPath(os.path.join("testproject1", "flatplane.html"))) assert err == Exporter.NO_ERROR, err
# Size of extent, and rotation #width = 10000. #height = width * canvasSize.height() / canvasSize.width() # charge les settings pour exporter la couche courrante newdata = settingsdata.replace("FFFFFF",filename) newdata = newdata.replace("XXXXXX", layerID) expleSettings = open("/home/chap/dev/simplu3D-openmole/scriptQGIS_genThree.js/settingsExampleModified.qto3settings",'w') expleSettings.write(newdata) expleSettings.close() newSettingPath = "/home/chap/dev/simplu3D-openmole/scriptQGIS_genThree.js/settingsExampleModified.qto3settings" # Create an exporter exporter = Exporter(iface, newSettingPath) exporter.setMapSettings(mapSettings) #print "exporter instance" # Coordinate transform center = canvas.center() # Set extent and rotation rotation = 0 #exporter.setExtent(center, canvas.width(), canvas.height(), rotation) exporter.setExtent(center, 700, 500, rotation) # Output HTML file path filepath = path_tmpl.format(filename) # Export err = exporter.export(filepath, openBrowser=False) #if err == Exporter.NO_ERROR:
"checkBox_Surroundings": False, "checkBox_TransparentBackground": False, "comboBox_ClipLayer": None, "comboBox_DEMLayer": dem.id(), "comboBox_TextureSize": 100, "horizontalSlider_DEMSize": 2, "lineEdit_Color": "", "lineEdit_ImageFile": "", "lineEdit_centerX": "", "lineEdit_centerY": "", "lineEdit_rectHeight": "", "lineEdit_rectWidth": "", "radioButton_MapCanvas": True, "radioButton_Simple": True, "spinBox_Height": 4, "spinBox_Roughening": 4, "spinBox_Size": 5, "spinBox_demtransp": 0, "visible": True }, "OutputFilename": outputPath, "PluginVersion": "1.4.2", "Template": "3DViewer(dat-gui).html" } e = Exporter(iface) e.settings.loadSettings(props) canvas = iface.mapCanvas() e.setMapSettings(canvas.mapSettings()) e.export(outputPath, openBrowser=True)