def dateChanged(self):
        try:
                modDate=self.dateTimeEdit.text()
                modDateValue = modDate.upper()
                system="RECS"
                connect =  ConnectionHandler()
                cur = connect.connect_Common()
                cur.execute("select taskid, createdby,status,beginlifespan,endlifespan,comments from v_l1_task where system like '%s' AND MODIFICATIONDATE like '%s'"%(system,modDateValue))
                rows = cur.fetchall()
                print rows
                xrows = len(rows)
                print xrows
                xcolumn = len(rows[0])
                i = 1
                j = 0
                model2 = QtGui.QStandardItemModel(xrows, xcolumn)
                model2.setHorizontalHeaderLabels(['TaskID','Created By','Status','Valid From Date','Valid To Date','Comment'])
                for i in range(xrows):
                    for j in range(xcolumn):
                        item = QtGui.QStandardItem(str(rows[i][j]))
                        model2.setItem(i, j, item)
                        item.setFlags(QtCore.Qt.ItemIsSelectable| QtCore.Qt.ItemIsEnabled)
                self.taskListTable.setModel(model2)

        except:
            QMessageBox.information(self, "Message", "No Result Found!")
Esempio n. 2
0
    def populate(self):
        try:

            system = "RECS"
            connect = ConnectionHandler()
            cur = connect.connect_Common()
            cur.execute(
                "select taskid, transactiontype,createdby,beginlifespan,endlifespan,status,comments from v_l1_task where system like '%s' and taskid like '%s' "
                % (system, taskId))
            rows = cur.fetchall()
            print rows
            xrows = len(rows)
            print xrows
            xcolumn = len(rows[0])

            model = QtGui.QStandardItemModel(xrows, xcolumn)
            model.setHorizontalHeaderLabels([
                'TaskID', 'Created By', 'Status', 'Valid From Date',
                'Valid To Date', 'Comment'
            ])
            for i in range(xrows):
                for j in range(xcolumn):
                    item = QtGui.QStandardItem(str(rows[i][j]))
                    model.setItem(i, j, item)
                    item.setFlags(QtCore.Qt.ItemIsSelectable
                                  | QtCore.Qt.ItemIsEnabled)
            self.taskInfoTable.setModel(model)

        except:
            QMessageBox.information(self, "Message", "No Result Found!")
    def populate(self):

            global model
            system='RECS'
            connect =  ConnectionHandler()
            cur = connect.connect_Common()
            cur.execute("select taskid, createdby,status,beginlifespan,endlifespan,MODIFICATIONDATE,comments from v_l1_task where system like '%s'"%(system))
            rows = cur.fetchall()
            xrows = len(rows)
            xcolumn = len(rows[0])
            i = 1
            j = 0
            model = QtGui.QStandardItemModel(xrows, xcolumn)
            model.setHorizontalHeaderLabels(['TaskID','Created By','Status','Valid From Date','Valid To Date','Date of Change','Comment'])
            for i in range(xrows):
                for j in range(xcolumn):
                    item = QtGui.QStandardItem(str(rows[i][j]))
                    model.setItem(i, j, item)
                    item.setFlags(QtCore.Qt.ItemIsSelectable| QtCore.Qt.ItemIsEnabled)
            self.taskListTable.setModel(model)
            filter_proxy_model = QtGui.QSortFilterProxyModel()
            filter_proxy_model.setSourceModel(model)
            filter_proxy_model.setFilterKeyColumn(1)
            filter_proxy_model2 = QtGui.QSortFilterProxyModel()
            filter_proxy_model2.setSourceModel(filter_proxy_model)
            filter_proxy_model2.setFilterKeyColumn(2)
            filter_proxy_model3 = QtGui.QSortFilterProxyModel()
            filter_proxy_model3.setSourceModel(filter_proxy_model2)
            filter_proxy_model3.setFilterKeyColumn(5)
            self.createdByText.textChanged.connect(filter_proxy_model.setFilterRegExp)
            self.taskListTable.setModel(filter_proxy_model)
            self.connect(self.comboBoxTaskStatus,SIGNAL("currentIndexChanged(QString)"),filter_proxy_model2.setFilterRegExp)
            self.taskListTable.setModel(filter_proxy_model2)
Esempio n. 4
0
    def createShape(self,taskID):
        load=LoadTask()
        load.loadXML(taskID)
        connect =  ConnectionHandler()
        cur = connect.connect_Common()
        cur.execute("SELECT dataxml FROM t_task WHERE Taskid = '%s'" % (taskID))
        dataXML = cur.fetchall()[0][0].read()
        dirname = "Z:\\GMLFile\\"
        pathDir = os.path.dirname(dirname)
        if not os.path.exists(pathDir):
            os.makedirs(pathDir)
        save_path = 'Z:\\GMLFile\\'
        name_of_file = str(taskID)
        completeName = os.path.join(save_path, name_of_file+".gml")
        openFile = open(completeName, "w")
        openFile.write(dataXML)
        openFile.close()
        parsedGML = GMLParser()
        parsedGML.createXML(taskID)
        #self.gmlWrite()

        iface.addVectorLayer("Z:\\GMLFile\\ogrGML.gml","gmlToShape","ogr")
        layers=iface.legendInterface().layers()
        for layer in layers:
           if layer.name() == 'gmlToShape':
             iface.setActiveLayer(layer)
        _vlayer = iface.activeLayer()
        QgsVectorFileWriter.writeAsVectorFormat(_vlayer,"Z:\\GMLFile\\%s.shp"%(taskID),"utf-8",None,"ESRI Shapefile")
        layers = iface.legendInterface().layers()
        for layer in layers:
            if layer.name() == 'gmlToShape':
                #print layer.name()
                QgsMapLayerRegistry.instance().removeMapLayer(layer.id())
Esempio n. 5
0
    def getInitXml(self,taskid):
        con = ConnectionHandler()
        cur = con.connect_Common()
        cur.execute("select INITXML from T_TASK where TASKID = '%s'" % (taskid))
        rows = cur.fetchall()
        xmlData = rows[0][0].read()
        print xmlData
        xmlDoc = ET.fromstring(xmlData)
        task = (xmlDoc[1][7])[1][0].text

        # print task
        self.getUpi(task)
Esempio n. 6
0
 def getOldOid(self,taskid):
     con = ConnectionHandler()
     cur = con.connect_Common()
     cur.execute("select INITXML from T_TASK where TASKID = '%s'" % (taskid))
     rows = cur.fetchall()
     xmlData = rows[0][0].read()
     print xmlData
     xmlDoc = ET.fromstring(xmlData)
     print xmlDoc
     oid = (xmlDoc[1][7])[1][0].text
     bls = (xmlDoc[1][7])[1][1].text
     els = (xmlDoc[1][7])[1][2].text
     return [oid,bls,els]
    def loadTaskClicked(self,taskID):
        print taskID
        layers = iface.legendInterface().layers()
        for layer in layers:
           if layer.name() == 'TaskLayer':
               QgsMapLayerRegistry.instance().removeMapLayer(layer.id())
        load=LoadTask()
        load.loadXML(taskID)
        connect =  ConnectionHandler()
        cur = connect.connect_Common()
        cur.execute("SELECT dataxml FROM t_task WHERE Taskid = '%s'" % (taskID))
        dataXML = cur.fetchall()[0][0].read()
        dirname = "Z:\\GMLFile\\"
        pathDir = os.path.dirname(dirname)
        if not os.path.exists(pathDir):
            os.makedirs(pathDir)
        save_path = 'Z:\\GMLFile\\'
        name_of_file = str(taskID)
        completeName = os.path.join(save_path, name_of_file+".gml")
        openFile = open(completeName, "w")
        openFile.write(dataXML)
        openFile.close()
        parsedGML = GMLParser()
        parsedGML.createXML(taskID)
        #self.gmlWrite()

        iface.addVectorLayer("Z:\\GMLFile\\ogrGML.gml","gmlToShape","ogr")
        for layer in layers:
           if layer.name() == 'gmlToShape':
             iface.setActiveLayer(layer)
        _vlayer = iface.activeLayer()	
        QgsVectorFileWriter.writeAsVectorFormat(_vlayer,"Z:\\GMLFile\\%s.shp"%(taskID),"utf-8",None,"ESRI Shapefile")
        layers = iface.legendInterface().layers()
        for layer in layers:
            if layer.name() == 'gmlToShape':
                print layer.name()
                QgsMapLayerRegistry.instance().removeMapLayer(layer.id())
		
        #QgsMapLayerRegistry.instance().removeAllMapLayers()
        iface.addVectorLayer("Z:\\GMLFile\\%s.shp"%(taskID),"TaskLayer","ogr")
        vLayer=iface.activeLayer()
        canvas = iface.mapCanvas()
        extent = vLayer.extent()
        canvas.setExtent(extent)
        symbols=vLayer.rendererV2().symbols()
        symbol=symbols[0]
        symbol.setColor(QtGui.QColor.fromRgb(255,248,220))
        vLayer.setLayerTransparency(50)
Esempio n. 8
0
 def taskOid(self,taskid):
     con = ConnectionHandler()
     cur = con.connect_Common()
     cur.execute("select INITXML from T_TASK where TASKID = '%s'" % (taskid))
     rows = cur.fetchall()
     xmlData = rows[0][0].read()
     # y="""<?xml version="1.0" encoding="utf-8"?><InitTask xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://hansaluftbild.de/InitTaskTPF.xsd"><Metadata><SystemName>RECS</SystemName><TPFProxyId>Bole</TPFProxyId></Metadata><Task><TASKID>Bole-1003</TASKID><CREATEDBY>yarecs</CREATEDBY><MODIFIEDBY>yarecs</MODIFIEDBY><CREATIONDATE>2016-06-30T17:05:20.3064695+03:00</CREATIONDATE><MODIFICATIONDATE>2016-06-30T17:05:20.3064695+03:00</MODIFICATIONDATE><BEGINLIFESPAN>2016-06-30</BEGINLIFESPAN><TRANSACTIONTYPEIDFK>14</TRANSACTIONTYPEIDFK><TaskObject><Type>Parcel</Type><ExistingObjectIdentifier><OID>ETH0001000000-00000157677</OID><BEGINLIFESPAN>2012-03-30</BEGINLIFESPAN><ENDLIFESPAN>3000-12-31</ENDLIFESPAN></ExistingObjectIdentifier><ExistingObjectIdentifier><OID>ETH0001000000-00000157674</OID><BEGINLIFESPAN>2012-03-30</BEGINLIFESPAN><ENDLIFESPAN>3000-12-31</ENDLIFESPAN></ExistingObjectIdentifier></TaskObject><COMMENTS /><SubCityCode>06</SubCityCode></Task></InitTask>"""
     #xmlDoc = ET.fromstring(y)
     import xml.dom.minidom
     doc = xml.dom.minidom.parseString(xmlData);
     parcels = doc.getElementsByTagName("ExistingObjectIdentifier")
     lst_oid=[]
     for parcel in parcels:
         OID = parcel.getElementsByTagName('OID')[0]
         OIDValue = OID.childNodes[0].data
         lst_oid.append(OIDValue)
     #print len(lst_oid)
     return lst_oid
    def rowClicked(self):
        global rows
        global taskID
        model = self.taskListTable.model()
        print model.rowCount()
        #x=model.data(1,1)
        #print str(x)
        indexes = self.taskListTable.selectionModel().selectedRows()

        for index in sorted(indexes):
            rowIndex=index.row()
            index = model.index(rowIndex, 0)
            itm=str(model.data(index))
        taskID = itm
        self.currentTaskLabel.setText("Current Task: "+str(taskID))

        try:
            connect =  ConnectionHandler()
            cur = connect.connect_Common()
            cur.execute(
                "select taskid, createdby,status,beginlifespan,endlifespan,comments from v_l1_task WHERE taskid = '%s'" % (
                    taskID))
            rows = cur.fetchall()
            xrows = len(rows)
            xcolumn = len(rows[0])

            self.propertiesTable.setColumnCount(xrows)
            self.propertiesTable.setRowCount(xcolumn)
            self.propertiesTable.setVerticalHeaderLabels(
                ['TaskID', 'Created By','Status', 'Modified By', 'Creation Date', 'Modification Date', 'Begin Life Span',
                 'End Life Span', 'Task Status', 'Comment'])
            for column in range(xcolumn):
                for row in range(xrows):
                    item = QtGui.QTableWidgetItem(str(rows[row][column]))
                    self.propertiesTable.setItem(row, column, item)
                    item.setFlags(QtCore.Qt.ItemIsEnabled)

        except:
            QMessageBox.information(self, "Connection Error", "Unable to Connect!")
Esempio n. 10
0
    def createShape(self, taskID):
        load = LoadTask()
        load.loadXML(taskID)
        connect = ConnectionHandler()
        cur = connect.connect_Common()
        cur.execute("SELECT dataxml FROM t_task WHERE Taskid = '%s'" %
                    (taskID))
        dataXML = cur.fetchall()[0][0].read()
        dirname = "Z:\\GMLFile\\"
        pathDir = os.path.dirname(dirname)
        if not os.path.exists(pathDir):
            os.makedirs(pathDir)
        save_path = 'Z:\\GMLFile\\'
        name_of_file = str(taskID)
        completeName = os.path.join(save_path, name_of_file + ".gml")
        openFile = open(completeName, "w")
        openFile.write(dataXML)
        openFile.close()
        parsedGML = GMLParser()
        parsedGML.createXML(taskID)
        #self.gmlWrite()

        iface.addVectorLayer("Z:\\GMLFile\\ogrGML.gml", "gmlToShape", "ogr")
        layers = iface.legendInterface().layers()
        for layer in layers:
            if layer.name() == 'gmlToShape':
                iface.setActiveLayer(layer)
        _vlayer = iface.activeLayer()
        QgsVectorFileWriter.writeAsVectorFormat(
            _vlayer, "Z:\\GMLFile\\%s.shp" % (taskID), "utf-8", None,
            "ESRI Shapefile")
        layers = iface.legendInterface().layers()
        for layer in layers:
            if layer.name() == 'gmlToShape':
                #print layer.name()
                QgsMapLayerRegistry.instance().removeMapLayer(layer.id())
Esempio n. 11
0
    def populate(self):
        try:

                system="RECS"
                connect =  ConnectionHandler()
                cur = connect.connect_Common()
                cur.execute("select taskid, transactiontype,createdby,beginlifespan,endlifespan,status,comments from v_l1_task where system like '%s' and taskid like '%s' "%(system,taskId))
                rows = cur.fetchall()
                print rows
                xrows = len(rows)
                print xrows
                xcolumn = len(rows[0])

                model = QtGui.QStandardItemModel(xrows, xcolumn)
                model.setHorizontalHeaderLabels(['TaskID','Created By','Status','Valid From Date','Valid To Date','Comment'])
                for i in range(xrows):
                    for j in range(xcolumn):
                        item = QtGui.QStandardItem(str(rows[i][j]))
                        model.setItem(i, j, item)
                        item.setFlags(QtCore.Qt.ItemIsSelectable| QtCore.Qt.ItemIsEnabled)
                self.taskInfoTable.setModel(model)

        except:
            QMessageBox.information(self, "Message", "No Result Found!")
Esempio n. 12
0
 def getAdminData(self,taskId):
     connect = ConnectionHandler()
     cur = connect.connect_Common()
     cur.execute(u"select createdby,modifiedby, creationdate,modificationdate  from t_task where taskid = '%s'" % (taskId) )
     retval = cur.fetchall()
     return retval[0]
Esempio n. 13
0
 def getNewOid(self):
     con = ConnectionHandler()
     cur = con.connect_Common()
     cur.execute("select OID_SEQ.nextval from DUAL")
     retval = cur.fetchall()
     return 'ETH0001006000-'+ '{:011d}'.format(retval[0][0])