Changeset bc02e89
- Timestamp:
- 05/23/11 21:14:49 (2 years ago)
- Branches:
- master
- Children:
- f8d618c
- Parents:
- 123c06c
- git-author:
- xkolman2 <xkolman2@…> (05/23/11 21:14:49)
- git-committer:
- xkolman2 <xkolman2@…> (05/23/11 21:14:49)
- Location:
- modules
- Files:
-
- 2 edited
-
mod_mapTiles.py (modified) (7 diffs)
-
mod_options.py (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
modules/mod_mapTiles.py
r123c06c rbc02e89 223 223 print "exception in tile download manager thread:\n%s" % e 224 224 225 def startTileLoadingThread(self):226 """start the loading-request consumer thread"""227 t = Thread(target=self.tileLoader, name='tile loading thread')228 t.setDaemon(True) # we need that the worker dies with the program229 t.start()225 # def startTileLoadingThread(self): 226 # """start the loading-request consumer thread""" 227 # t = Thread(target=self.tileLoader, name='tile loading thread') 228 # t.setDaemon(True) # we need that the worker dies with the program 229 # t.start() 230 230 231 231 # def tileLoader(self): … … 642 642 # Return the cairo projection to what it was 643 643 cr.restore() 644 644 645 def _fakePrint(self, text): 646 """print that does nothing""" 647 pass 648 649 def _realPrint(self,text): 650 print(text) 651 645 652 def loadImage(self,name , x, y, z, layer): 646 653 """Check that an image is loaded, and try to load it if not""" … … 648 655 """at this point, there is only a placeholder image in the memmory cache""" 649 656 657 # check if tile loading debugging is on 658 debug = self.get('tileLoadingDebug', False) 659 if debug: 660 sprint = self._realPrint 661 else: 662 sprint = self._fakePrint 663 664 sprint("###") 665 sprint("loading tile %s" % name) 666 650 667 # first, is it already in the process of being downloaded? 651 668 with self.threadlListCondition: 652 669 if name in self.threads.keys(): 670 sprint("tile is being downloaded") 653 671 if(not self.threads[name].finished): 654 672 with self.imagesLock: # substitute the "loading" tile with a "downloading" tile … … 663 681 layerInfo = maplayers.get(layer, None) 664 682 if(layerInfo == None): # is the layer info valid 683 sprint("invalid layer") 665 684 return('NOK') 666 685 … … 670 689 storeTiles = self.m.get('storeTiles', None) # get the tile storage module 671 690 if storeTiles: 691 start1 = time.clock() 672 692 pixbuf = storeTiles.getTile(layerPrefix, z, x, y, layerType) 673 693 """None from getTiles means the tile was not found 674 694 False means loading the tile from file to pixbuf failed""" 675 695 if pixbuf: 696 start2 = time.clock() 676 697 self.storeInMemmory(self.pixbufToCairoImageSurface(pixbuf), name) 698 if debug: 699 storageType = self.get('tileStorageType', 'files') 700 sprint("tile loaded from local storage (%s) in %1.2f ms" % (storageType,(1000 * (time.clock() - start1)))) 701 sprint("tile cached in memmory in %1.2f ms" % (1000 * (time.clock() - start2))) 677 702 return('OK') 678 703 704 705 # Image not found anywhere locally - resort to downloading it 679 706 filename = self.getTileFolderPath() + (self.getImagePath(x,y,z,layerPrefix, layerType)) 680 681 # Image not found anywhere locally - resort to downloading it 707 sprint("image not found locally - trying to download") 682 708 683 709 # Are we allowed to download it ? (network=='full') 684 710 if(self.get('network','full')=='full'): 711 sprint("automatic tile download enabled - starting download") 685 712 # use threads 686 713 """the thread list condition is used to signalize to the download manager, … … 700 727 701 728 self.threadlListCondition.notifyAll() # wake up the download manager 729 else: 730 sprint("automatic tile download disabled - not starting download") 702 731 703 732 def loadImageFromFile(self,path,name, type="normal", expireTimestamp=None, dictIndex=0): … … 746 775 if len(self.images[0]) > self.maxImagesInMemmory: 747 776 self.trimCache() 777 # new tile available, make redraw request TODO: what overhead does this create ? 778 if self.get('tileLoadedRedraw', True): 779 self.set('needRedraw', True) 748 780 749 781 def trimCache(self): -
modules/mod_options.py
r6837014 rbc02e89 524 524 group = addGroup("Tiles", "tiles", catDebug, "generic") 525 525 addBoolOpt("Print tile cache status to terminal", "reportTileCachStatus", group, False) 526 addBoolOpt("Tile loading status to terminal", "tileLoadingDebug", group, False) 527 addBoolOpt("Redraw screen once a new tile is loaded", "tileLoadedRedraw", group, True) 526 528 addBoolOpt("Remove dups berofe batch dl", "checkTiles", group, False) 527 529 # ** tracklog drawing
Note: See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/trac/gps_navigace/chrome/site/nlp-logo.png)