示例#1
0
	def __init__(self):
		super(GIS_TMS_Dialog, self).__init__()

		#Get/set parameters for GIS		
		self.sitename = "GIS-Sitedata"
		self.tempFolderName = "GIStemp/"
		self.X = str(GIS2BIM_FreeCAD.ArchSiteCreateCheck(self.sitename).CRS_x)
		self.Y = str(GIS2BIM_FreeCAD.ArchSiteCreateCheck(self.sitename).CRS_y)
		self.lat = str(GIS2BIM_FreeCAD.ArchSiteCreateCheck(self.sitename).WGS84_Latitude)
		self.lon = str(GIS2BIM_FreeCAD.ArchSiteCreateCheck(self.sitename).WGS84_Longitude)
		self.CRS = str(GIS2BIM_FreeCAD.ArchSiteCreateCheck(self.sitename).CRS_EPSG_SRID)
		self.CRSDescription = str(GIS2BIM_FreeCAD.ArchSiteCreateCheck(self.sitename).CRS_EPSG_Description)
		self.bboxWidthStart = str(GIS2BIM_FreeCAD.ArchSiteCreateCheck(self.sitename).BoundingboxWidth)
		self.bboxHeightStart = str(GIS2BIM_FreeCAD.ArchSiteCreateCheck(self.sitename).BoundingboxHeight)
		self.width = float(self.bboxWidthStart)
		self.height = float(self.bboxHeightStart)
		self.tempFolder = GIS2BIM_FreeCAD.CreateTempFolder(self.tempFolderName)
		self.folderName = self.tempFolder
		self.tempFileName = self.tempFolder + "initialTMS.jpg" 

		self.zoomL = 17
		self.pixels = 256
		self.TMS_WMTS = 0

		#Set Style
		self.setStyleSheet("QWidget {background-color: rgb(68, 68, 68)} QPushButton { background-color: black } QGroupBox {border: 1px solid grey; }") #margin: 2px;

		#Download list of predefined TMS Requests
		category = "webserverRequests"
		service = "WMTS_TMS"
		data = GIS2BIM.GetWebServerDataService(category,service)
		
		TitleList  = []
		for i in data:
			TitleList.append(i["title"])
		
		ServerRequestPrefix  = []
		for i in data:
			ServerRequestPrefix.append(i["serverrequestprefix"])
		yx = sorted(zip(TitleList,ServerRequestPrefix))
		self.TitleList = [x[0] for x in yx]
		self.ServerRequestPrefix = [x[1] for x in yx]
		
		#Widget Right Bottom Combined
		gridRB = QtWidgets.QGridLayout()
		gridRB.addWidget(self.webserverGroup(), 0, 0, QtCore.Qt.AlignTop)
		gridRB.addWidget(self.freeCADGroup(), 1, 0, QtCore.Qt.AlignTop)
		
		#Overall Grid
		grid = QtWidgets.QGridLayout()
		grid.addWidget(self.imageGroup(), 0, 0, 1, 2)
		grid.addWidget(self.locationGroup(), 3, 0, QtCore.Qt.AlignTop)	
		grid.addLayout(gridRB, 3, 1)
		grid.addLayout(self.buttonGroup(),4,0,1,2)
		grid.setRowStretch(0,2)
		self.setLayout(grid)
		
		self.setWindowTitle("Load Raster Data with TMS(Tile Map Server)")
		self.resize(920, 910)
		self.onTest()
示例#2
0
    def __init__(self, parent=None):
        super(GISWFS_Dialog, self).__init__(parent)

        self.sitename = "GIS-Sitedata"

        dialog = QtWidgets.QMessageBox()
        dialog.setText(
            " Several limitations are 1) WFS 2.0.0 2) Server should support SRS 4326 3)For preview purposes server should support GeoJSON 4)Request for import works only with gml. Work in progress!"
        )
        dialog.setWindowTitle("Warning: This is a Proof of Concept.")
        dialog.exec_()

        #Get/set parameters for GIS
        self.tempFolderName = "GIStemp/"
        self.X = str(GIS2BIM_FreeCAD.ArchSiteCreateCheck(self.sitename).CRS_x)
        self.Y = str(GIS2BIM_FreeCAD.ArchSiteCreateCheck(self.sitename).CRS_y)
        self.lat = str(
            GIS2BIM_FreeCAD.ArchSiteCreateCheck(self.sitename).WGS84_Latitude)
        self.lon = str(
            GIS2BIM_FreeCAD.ArchSiteCreateCheck(self.sitename).WGS84_Longitude)
        self.bboxWidthStart = str(
            GIS2BIM_FreeCAD.ArchSiteCreateCheck(
                self.sitename).BoundingboxWidth)
        self.bboxHeightStart = str(
            GIS2BIM_FreeCAD.ArchSiteCreateCheck(
                self.sitename).BoundingboxHeight)
        self.CRS = str(
            GIS2BIM_FreeCAD.ArchSiteCreateCheck(self.sitename).CRS_EPSG_SRID)
        self.CRSDescription = str(
            GIS2BIM_FreeCAD.ArchSiteCreateCheck(
                self.sitename).CRS_EPSG_Description)
        self.bboxString = GIS2BIM.CreateBoundingBox(
            float(GIS2BIM_FreeCAD.ArchSiteCreateCheck(self.sitename).CRS_x),
            float(GIS2BIM_FreeCAD.ArchSiteCreateCheck(self.sitename).CRS_y),
            float(self.bboxWidthStart), float(self.bboxHeightStart), 0)

        #Set Style
        self.setStyleSheet(
            "QWidget {background-color: rgb(68, 68, 68)} QPushButton { background-color: black } QGroupBox {border: 1px solid grey; }"
        )  #margin: 2px;

        #Download files
        self.URLUpdate = GIS2BIM.GetWebServerData(
            "HTMLLocationDataJSmapbboxupdate", "Other",
            "URL")  #Javascript-URL for update boundingbox
        self.URLwfs = GIS2BIM.GetWebServerData(
            "HTMLwfsJSwfsUpdate", "Other",
            "URL")  #Javascript-URL for update wfs
        self.URLmap = GIS2BIM.GetWebServerData("HTMLwfs", "Other", "URL")
        self.filepathJSUpdate = GIS2BIM.DownloadURL(
            GIS2BIM_FreeCAD.CreateTempFolder(self.tempFolderName),
            self.URLUpdate,
            "map_bboxupdate.js")  #Javascript-file for update boundingbox
        self.filepathJSwfs = GIS2BIM.DownloadURL(
            GIS2BIM_FreeCAD.CreateTempFolder(self.tempFolderName), self.URLwfs,
            "map_wfsupdate.js")  #Javascript-file for update wfs
        self.filepathBaseMap = GIS2BIM.DownloadURL(
            GIS2BIM_FreeCAD.CreateTempFolder(self.tempFolderName), self.URLmap,
            "basemapWFS.html")  #Basemap from GIS2BIM Repository for preview
        self.filepathNewMap = GIS2BIM.DownloadURL(
            GIS2BIM_FreeCAD.CreateTempFolder(self.tempFolderName), self.URLmap,
            "mapWFS.html")  #Edited Basemap with location and bbox
        #self.filepathBaseMap = "C:/Users/mikev/OneDrive/Bureaublad/TEMP/GIStemp/basemapWFS.html"
        #self.filepathNewMap = "C:/Users/mikev/OneDrive/Bureaublad/TEMP/GIStemp/mapWFS.html"
        self.tempFolderPath = GIS2BIM_FreeCAD.CreateTempFolder(
            self.tempFolderName)

        os.remove(self.filepathNewMap)
        BaseMap = open(self.filepathBaseMap, "r")
        BaseMapstr = BaseMap.read()
        Newstr = BaseMapstr.replace("51LAT", str(self.lat))
        Newstr = Newstr.replace("4LONG", str(self.lon))
        Newstr = Newstr.replace("WBBOX", self.bboxWidthStart)
        Newstr = Newstr.replace("HBBOX", self.bboxHeightStart)
        open(self.filepathNewMap, "x")
        f1 = open(self.filepathNewMap, "w")
        f1.write(Newstr)
        f1.close()

        #Download list of predefined WFS Requests
        category = "webserverRequests"
        service = "WFS_curves"
        data = GIS2BIM.GetWebServerDataService(category, service)

        TitleList = []
        for i in data:
            TitleList.append(i["title"])

        ServerRequestPrefix = []
        for i in data:
            ServerRequestPrefix.append(i["serverrequestprefix"])
        yx = sorted(zip(TitleList, ServerRequestPrefix))
        self.TitleList = [x[0] for x in yx]
        self.ServerRequestPrefix = [x[1] for x in yx]

        #Widget Right Bottom Combined
        gridRB = QtWidgets.QGridLayout()
        gridRB.addWidget(self.webserverGroup(), 0, 0, QtCore.Qt.AlignTop)
        gridRB.addWidget(self.freeCADGroup(), 1, 0, QtCore.Qt.AlignTop)

        #Overall Grid
        grid = QtWidgets.QGridLayout()
        grid.addWidget(self.webViewGroup(), 0, 0, 1, 2)
        grid.addWidget(self.locationGroup(), 3, 0, QtCore.Qt.AlignTop)
        grid.addLayout(gridRB, 3, 1)
        grid.addLayout(self.buttonGroup(), 4, 0, 1, 2)
        grid.setRowStretch(0, 2)
        self.setLayout(grid)

        self.setWindowTitle("Load 2D Vector Data with WFS(Web Feature Server)")
        self.resize(920, 910)