Esempio n. 1
0
 def run(self):
     HOST = str(parseOutputconf()['host']) # 'localhost'
     PORT = 9000
     s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
     s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
     s.bind((HOST, PORT))
     s.listen(1)
     conn, addr = s.accept()
     print 'Connected by', addr
     while self.alive:
         while self.running:
             data = conn.recv(1048)
             #print data
             #print type(data)
             #time.sleep(0.5)
             try :
                 parsed = parseSignal(data)
                 self.LonUpdated.emit(str(parsed['lon']))
                 self.LatUpdated.emit(str(parsed['lat']))
                 self.RollUpdated.emit(float(parsed['roll']))
                 self.PitchUpdated.emit(float(parsed['pitch']))
                 self.GainUpdated.emit(float(parsed['gain']))
                 self.AltUpdated2.emit(str(parsed['msl']))
                 self.AltUpdated.emit(float(parsed['msl']))
                 self.LookAtLonUpdated.emit(str(parsed['lookat_lon']))
                 self.LookAtLatUpdated.emit(str(parsed['lookat_lat']))
                 self.LookAtAltitudeUpdated.emit(str(parsed['lookat_alt']))
                 self.LookAtRangeUpdated.emit(float(parsed['lookat_range']))
             
             #print parsed
             #navlogger('localhost', 9000)
             #self.msleep(500)
             except :
                 print 'parsing error'
Esempio n. 2
0
    def run(self):
        HOST = str(parseOutputconf()['host'])  # 'localhost'
        PORT = 9000
        s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
        s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
        s.bind((HOST, PORT))
        s.listen(1)
        conn, addr = s.accept()
        print 'Connected by', addr
        while self.alive:
            while self.running:
                data = conn.recv(1048)
                #print data
                #print type(data)
                #time.sleep(0.5)
                try:
                    parsed = parseSignal(data)
                    self.LonUpdated.emit(str(parsed['lon']))
                    self.LatUpdated.emit(str(parsed['lat']))
                    self.RollUpdated.emit(float(parsed['roll']))
                    self.PitchUpdated.emit(float(parsed['pitch']))
                    self.GainUpdated.emit(float(parsed['gain']))
                    self.AltUpdated2.emit(str(parsed['msl']))
                    self.AltUpdated.emit(float(parsed['msl']))
                    self.LookAtLonUpdated.emit(str(parsed['lookat_lon']))
                    self.LookAtLatUpdated.emit(str(parsed['lookat_lat']))
                    self.LookAtAltitudeUpdated.emit(str(parsed['lookat_alt']))
                    self.LookAtRangeUpdated.emit(float(parsed['lookat_range']))

                #print parsed
                #navlogger('localhost', 9000)
                #self.msleep(500)
                except:
                    print 'parsing error'
Esempio n. 3
0
 def paramConnection(self, t):
     
     try :
         if t not in ('H','P','D'):
             print "Unknown type:" + t + " Use H/P/D for host/password/data"
         if t == 'H':
             host = str(parseOutputconf()['host'])
             return host
         elif t == 'P':    
             port = parseOutputconf()['pport']
             return int(port)
         elif t == 'D':
             data = parseOutputconf()['dport']
             return data
             
     except :
         print 'Use preference Panel to set preference'
         self.worningmessage('Use the preference setting to set TCP preference')        
Esempio n. 4
0
    def run(self):
        HOST = str(parseOutputconf()['host']) # 'localhost'
        print HOST
        PORT = 8000 #str(parseOutputconf()['port'])
        print PORT
        s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
        s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
        s.bind((HOST, PORT))
        s.listen(1)
        conn, addr = s.accept()
        print 'Connected to Planet - ' + HOST + '@'  + str(PORT)

       
        #print self.alive
        #print self.running
        while self.alive:
            while self.running:
                data = conn.recv(1048)
                #print data
                #print 'hhhmm'
                #print type(data)
                #time.sleep(1)
                try :
                    #time.sleep(5)
                    parsed = Utils.readPlanetMessage(data)
                    self.LonUpdated.emit(str(parsed['lontitude']))
                    self.LatUpdated.emit(str(parsed['latitude']))
                    self.RollUpdated.emit(float(parsed['roll']))
                    self.PitchUpdated.emit(float(parsed['pitch']))
                    self.GainUpdated.emit(float(parsed['gain']))
                    self.AltUpdated2.emit(str(parsed['msl']))
                    self.AltUpdated.emit(float(parsed['msl']))
                    self.LookAtLonUpdated.emit(str(parsed['lk_lon']))
                    self.LookAtLatUpdated.emit(str(parsed['lk_lat']))
                    self.LookAtAltitudeUpdated.emit(str(parsed['lk_alt']))
                    self.LookAtRangeUpdated.emit(float(parsed['lk_rng']))
                    
                #navlogger('localhost', 9000)
                    #self.msleep(500)
                except:
                    print 'parsing error'
Esempio n. 5
0
 def filemanager(self):
     filemanager = parseOutputconf()['filemanager']
     kmldir = parseOutputconf()['kmldir']
     output = subprocess.Popen([filemanager ,str(kmldir)], stdout=subprocess.PIPE).communicate()[0]
Esempio n. 6
0
    def makekml(self):
        # vedi di aggiungere zoom,range e view type ... magari link a immagini ???
        # aggiungi un "salva in sqlite" il db deve essere inizializzato nelle preferenze
        LabelAlpha = self.LabelAlpha.value()
        LineAlpha = self.LineAlpha.value()
        PolygonAlpha = self.PolygonAlpha.value()
        labalpha = hex(int(LabelAlpha))
        linalpha = hex(int(LineAlpha))
        polalpha = hex(int(PolygonAlpha))
        labalpha = labalpha.split('x')
        linalpha = linalpha.split('x')
        polalpha = polalpha.split('x')
        labalpha = labalpha[-1]
        linalpha = linalpha[-1]
        polalpha = polalpha[-1]
        if len(labalpha) == 1:
            labalpha = str('0')+labalpha
        if len(linalpha) == 1:
            linalpha = str('0')+linalpha
        if len(polalpha) == 1:
            polalpha = str('0')+polalpha
        colorlabel = VectorLabelColorName
        colorline = VectorLineColorName
        colorpolygon = VectorPolygonColorName
        colorlabel = colorlabel[1:]
        colorlabelR = colorlabel[0:2]
        colorlabelG = colorlabel[2:4]
        colorlabelB = colorlabel[4:6]
        colorlabel = colorlabelB+colorlabelG+colorlabelR
        colorlabel = str(labalpha)+colorlabel
        colorline = colorline[1:]
        colorlineR = colorline[0:2]
        colorlineG = colorline[2:4]
        colorlineB = colorline[4:6]
        colorline = colorlineB+colorlineG+colorlineR
        colorline = str(linalpha)+colorline
        colorpolygon = colorpolygon[1:]
        colorpolygonR = colorpolygon[0:2]
        colorpolygonG = colorpolygon[2:4]
        colorpolygonB = colorpolygon[4:6]
        colorpolygon = colorpolygonB+colorpolygonG+colorpolygonR
        colorpolygon = str(polalpha)+colorpolygon
        tessellate = 0
        extrude = 0
        kmldirectory = parseOutputconf()['kmldir']
        if self.Tessellate.isChecked():
            tessellate = 1
        if self.Extrude.isChecked():
            extrude = 1
         
        kmldescr = self.kmllabel.text()
        kmlname = self.kmlname.text()
        self.kmlstr = 	"""<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://www.opengis.net/kml/2.2">
<Document>
<name>%s</name>
<open>0</open>
<description>%s</description><Style id="Mystyle">
<LabelStyle>
<color>%s</color>
<colorMode>normal</colorMode>
<scale>1</scale>
</LabelStyle>
<IconStyle>
<Icon>
<href>%s</href>
</Icon>
</IconStyle>
<LineStyle>
<color>%s</color>
<colorMode>normal</colorMode>
<tessellate>%s</tessellate>
<width>%s</width>
</LineStyle>
<PolyStyle>
<color>%s</color>
<colorMode>normal</colorMode>
</PolyStyle>
</Style>""" % (kmlname, kmldescr, colorlabel, self.iconpath, colorline, tessellate, self.LineWidth.value(), colorpolygon)
        
        print self.kmlstr
        """
Esempio n. 7
0
 def filemanagerdir(self,dir):
     filemanager = parseOutputconf()['filemanager']
     output = subprocess.Popen([filemanager ,str(dir)], stdout=subprocess.PIPE).communicate()[0]
Esempio n. 8
0
    def savekml(self):
        # vedi di aggiungere zoom,range e view type ... magari link a immagini ???
        # aggiungi un "salva in sqlite" il db deve essere inizializzato nelle preferenze
        LabelAlpha = self.LabelAlpha.value()
        LineAlpha = self.LineAlpha.value()
        PolygonAlpha = self.PolygonAlpha.value()
        labalpha = hex(int(LabelAlpha))
        linalpha = hex(int(LineAlpha))
        polalpha = hex(int(PolygonAlpha))
        labalpha = labalpha.split('x')
        linalpha = linalpha.split('x')
        polalpha = polalpha.split('x')
        labalpha = labalpha[-1]
        linalpha = linalpha[-1]
        polalpha = polalpha[-1]
        if len(labalpha) == 1:
            labalpha = str('0')+labalpha
        if len(linalpha) == 1:
            linalpha = str('0')+linalpha
        if len(polalpha) == 1:
            polalpha = str('0')+polalpha
        colorlabel = VectorLabelColorName
        colorline = VectorLineColorName
        colorpolygon = VectorPolygonColorName
        colorlabel = colorlabel[1:]
        colorlabelR = colorlabel[0:2]
        colorlabelG = colorlabel[2:4]
        colorlabelB = colorlabel[4:6]
        colorlabel = colorlabelB+colorlabelG+colorlabelR
        colorlabel = str(labalpha)+colorlabel
        colorline = colorline[1:]
        colorlineR = colorline[0:2]
        colorlineG = colorline[2:4]
        colorlineB = colorline[4:6]
        colorline = colorlineB+colorlineG+colorlineR
        colorline = str(linalpha)+colorline
        colorpolygon = colorpolygon[1:]
        colorpolygonR = colorpolygon[0:2]
        colorpolygonG = colorpolygon[2:4]
        colorpolygonB = colorpolygon[4:6]
        colorpolygon = colorpolygonB+colorpolygonG+colorpolygonR
        colorpolygon = str(polalpha)+colorpolygon
        tessellate = 0
        extrude = 0
        kmldirectory = parseOutputconf()['kmldir']
        if self.Tessellate.isChecked():
            tessellate = 1
        if self.Extrude.isChecked():
            extrude = 1
        kml = 	"""<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://www.opengis.net/kml/2.2">
<Document>
<name>%s</name>
<open>0</open>
<description>some desription here</description><Style id="Mystyle">
<LabelStyle>
<color>%s</color>
<colorMode>normal</colorMode>
<scale>1</scale>
</LabelStyle>
<IconStyle>
<Icon>
<href>%s</href>
</Icon>
</IconStyle>
<LineStyle>
<color>%s</color>
<colorMode>normal</colorMode>
<tessellate>%s</tessellate>
<width>%s</width>
</LineStyle>
<PolyStyle>
<color>%s</color>
<colorMode>normal</colorMode>
</PolyStyle>
</Style><Placemark>
<name>%s</name>
<description><![CDATA[<div name="" id="id_main" align="center" dir="ltr" width="680"><table width="680" height="375"><tr>%s<td></td>]]></description>
<visibility>0</visibility>
<styleUrl>#Mystyle</styleUrl><LookAt> 
<longitude>%s</longitude> 
<latitude>%s</latitude> 
<altitude>%s</altitude> 
<range>%s</range> 
<tilt>%s</tilt> 
<heading>%s</heading> 
<altitudeMode>relativeToGround</altitudeMode> 
</LookAt><Point>
<extrude>%s</extrude>
<altitudeMode>relativeToGround</altitudeMode>
<coordinates>%s,%s,%s</coordinates>
</Point></Placemark></Document></kml>""" % (self.kmlname.text(), colorlabel, self.iconpath, colorline, tessellate, self.LineWidth.value(), colorpolygon, self.kmllabel.text(), self.description.toHtml(), self.lon, self.lat, self.Zoomchange, self.Rangechange, self.Pitchchange, self.Headchange, extrude, self.lon, self.lat, self.Offset.value())
        kmldir = str(kmldirectory)+'/'
        kmltosave = kmldir+self.kmlname.text()+'.kml'
        f=codecs.open(kmltosave, 'w', 'UTF8' )
        f.write(kml)
        f.close()
        kmz = self.compress_kml(str(kmltosave),str(self.iconpath))
Esempio n. 9
0
    def savekml(self):
        # vedi di aggiungere zoom,range e view type ... magari link a immagini ???
        # aggiungi un "salva in sqlite" il db deve essere inizializzato nelle preferenze
        LabelAlpha = self.LabelAlpha.value()
        LineAlpha = self.LineAlpha.value()
        PolygonAlpha = self.PolygonAlpha.value()
        labalpha = hex(int(LabelAlpha))
        linalpha = hex(int(LineAlpha))
        polalpha = hex(int(PolygonAlpha))
        labalpha = labalpha.split('x')
        linalpha = linalpha.split('x')
        polalpha = polalpha.split('x')
        labalpha = labalpha[-1]
        linalpha = linalpha[-1]
        polalpha = polalpha[-1]
        if len(labalpha) == 1:
            labalpha = str('0') + labalpha
        if len(linalpha) == 1:
            linalpha = str('0') + linalpha
        if len(polalpha) == 1:
            polalpha = str('0') + polalpha
        colorlabel = VectorLabelColorName
        colorline = VectorLineColorName
        colorpolygon = VectorPolygonColorName
        colorlabel = colorlabel[1:]
        colorlabelR = colorlabel[0:2]
        colorlabelG = colorlabel[2:4]
        colorlabelB = colorlabel[4:6]
        colorlabel = colorlabelB + colorlabelG + colorlabelR
        colorlabel = str(labalpha) + colorlabel
        colorline = colorline[1:]
        colorlineR = colorline[0:2]
        colorlineG = colorline[2:4]
        colorlineB = colorline[4:6]
        colorline = colorlineB + colorlineG + colorlineR
        colorline = str(linalpha) + colorline
        colorpolygon = colorpolygon[1:]
        colorpolygonR = colorpolygon[0:2]
        colorpolygonG = colorpolygon[2:4]
        colorpolygonB = colorpolygon[4:6]
        colorpolygon = colorpolygonB + colorpolygonG + colorpolygonR
        colorpolygon = str(polalpha) + colorpolygon
        tessellate = 0
        extrude = 0
        kmldirectory = parseOutputconf()['kmldir']
        if self.Tessellate.isChecked():
            tessellate = 1
        if self.Extrude.isChecked():
            extrude = 1
        kml = """<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://www.opengis.net/kml/2.2">
<Document>
<name>%s</name>
<open>0</open>
<description>some desription here</description><Style id="Mystyle">
<LabelStyle>
<color>%s</color>
<colorMode>normal</colorMode>
<scale>1</scale>
</LabelStyle>
<IconStyle>
<Icon>
<href>%s</href>
</Icon>
</IconStyle>
<LineStyle>
<color>%s</color>
<colorMode>normal</colorMode>
<tessellate>%s</tessellate>
<width>%s</width>
</LineStyle>
<PolyStyle>
<color>%s</color>
<colorMode>normal</colorMode>
</PolyStyle>
</Style><Placemark>
<name>%s</name>
<description><![CDATA[<div name="" id="id_main" align="center" dir="ltr" width="680"><table width="680" height="375"><tr>%s<td></td>]]></description>
<visibility>0</visibility>
<styleUrl>#Mystyle</styleUrl><LookAt> 
<longitude>%s</longitude> 
<latitude>%s</latitude> 
<altitude>%s</altitude> 
<range>%s</range> 
<tilt>%s</tilt> 
<heading>%s</heading> 
<altitudeMode>relativeToGround</altitudeMode> 
</LookAt><Point>
<extrude>%s</extrude>
<altitudeMode>relativeToGround</altitudeMode>
<coordinates>%s,%s,%s</coordinates>
</Point></Placemark></Document></kml>""" % (
            self.kmlname.text(), colorlabel, self.iconpath, colorline,
            tessellate, self.LineWidth.value(), colorpolygon,
            self.kmllabel.text(), self.description.toHtml(), self.lon,
            self.lat, self.Zoomchange, self.Rangechange, self.Pitchchange,
            self.Headchange, extrude, self.lon, self.lat, self.Offset.value())
        kmldir = str(kmldirectory) + '/'
        kmltosave = kmldir + self.kmlname.text() + '.kml'
        f = codecs.open(kmltosave, 'w', 'UTF8')
        f.write(kml)
        f.close()
        kmz = self.compress_kml(str(kmltosave), str(self.iconpath))