tilecache 0.0.3 → 0.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/VERSION +1 -1
 - data/lib/tile_cache/caches/disk.rb +5 -0
 - data/lib/tile_cache/meta_layer.rb +7 -3
 - metadata +12 -5
 
    
        data/VERSION
    CHANGED
    
    | 
         @@ -1 +1 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            0.0. 
     | 
| 
      
 1 
     | 
    
         
            +
            0.0.4
         
     | 
| 
         @@ -2,12 +2,17 @@ module TileCache 
     | 
|
| 
       2 
2 
     | 
    
         
             
              module Caches
         
     | 
| 
       3 
3 
     | 
    
         
             
                class Disk
         
     | 
| 
       4 
4 
     | 
    
         
             
                  REQUIRED_ATTRIBUTES = %w{ root }
         
     | 
| 
      
 5 
     | 
    
         
            +
                  VALID_ATTRIBUTES = %w{ debug }
         
     | 
| 
       5 
6 
     | 
    
         | 
| 
       6 
7 
     | 
    
         
             
                  def initialize(settings)
         
     | 
| 
       7 
8 
     | 
    
         
             
                    @root = settings[:root]
         
     | 
| 
      
 9 
     | 
    
         
            +
                    @debug = settings[:debug]
         
     | 
| 
       8 
10 
     | 
    
         
             
                  end
         
     | 
| 
       9 
11 
     | 
    
         | 
| 
       10 
12 
     | 
    
         
             
                  def get(tile)
         
     | 
| 
      
 13 
     | 
    
         
            +
                    # If we are in debug mode, always simulate cache misses to force rewriting the cache every time
         
     | 
| 
      
 14 
     | 
    
         
            +
                    return false if @debug
         
     | 
| 
      
 15 
     | 
    
         
            +
                    
         
     | 
| 
       11 
16 
     | 
    
         
             
                    file = key_for_tile(tile)
         
     | 
| 
       12 
17 
     | 
    
         | 
| 
       13 
18 
     | 
    
         
             
                    if File.exist?(file)
         
     | 
| 
         @@ -1,4 +1,3 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            require 'rubygems'
         
     | 
| 
       2 
1 
     | 
    
         
             
            require 'RMagick'
         
     | 
| 
       3 
2 
     | 
    
         | 
| 
       4 
3 
     | 
    
         
             
            module TileCache
         
     | 
| 
         @@ -35,8 +34,13 @@ module TileCache 
     | 
|
| 
       35 
34 
     | 
    
         
             
                end
         
     | 
| 
       36 
35 
     | 
    
         | 
| 
       37 
36 
     | 
    
         
             
                def render_meta_tile(metatile, tile)
         
     | 
| 
       38 
     | 
    
         
            -
                  data  
     | 
| 
       39 
     | 
    
         
            -
                   
     | 
| 
      
 37 
     | 
    
         
            +
                  # TODO: Better debugging and logging support here.. data may not be an image but an XML error document!
         
     | 
| 
      
 38 
     | 
    
         
            +
                  begin
         
     | 
| 
      
 39 
     | 
    
         
            +
                    data = render_tile(metatile)
         
     | 
| 
      
 40 
     | 
    
         
            +
                    image = Image.from_blob(data).first
         
     | 
| 
      
 41 
     | 
    
         
            +
                  rescue => e
         
     | 
| 
      
 42 
     | 
    
         
            +
                    raise "#{e.message} (data: #{data.inspect})"
         
     | 
| 
      
 43 
     | 
    
         
            +
                  end
         
     | 
| 
       40 
44 
     | 
    
         | 
| 
       41 
45 
     | 
    
         
             
                  (meta_cols, meta_rows) = meta_limits(metatile.z)
         
     | 
| 
       42 
46 
     | 
    
         
             
                  meta_height = meta_rows * @size[1] + 2 * @metabuffer[1]
         
     | 
    
        metadata
    CHANGED
    
    | 
         @@ -1,7 +1,12 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification 
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: tilecache
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version 
         
     | 
| 
       4 
     | 
    
         
            -
               
     | 
| 
      
 4 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 5 
     | 
    
         
            +
              segments: 
         
     | 
| 
      
 6 
     | 
    
         
            +
              - 0
         
     | 
| 
      
 7 
     | 
    
         
            +
              - 0
         
     | 
| 
      
 8 
     | 
    
         
            +
              - 4
         
     | 
| 
      
 9 
     | 
    
         
            +
              version: 0.0.4
         
     | 
| 
       5 
10 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
11 
     | 
    
         
             
            authors: 
         
     | 
| 
       7 
12 
     | 
    
         
             
            - Pascal Ehlert
         
     | 
| 
         @@ -9,7 +14,7 @@ autorequire: 
     | 
|
| 
       9 
14 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       10 
15 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       11 
16 
     | 
    
         | 
| 
       12 
     | 
    
         
            -
            date:  
     | 
| 
      
 17 
     | 
    
         
            +
            date: 2010-04-19 00:00:00 +02:00
         
     | 
| 
       13 
18 
     | 
    
         
             
            default_executable: 
         
     | 
| 
       14 
19 
     | 
    
         
             
            dependencies: []
         
     | 
| 
       15 
20 
     | 
    
         | 
| 
         @@ -51,18 +56,20 @@ required_ruby_version: !ruby/object:Gem::Requirement 
     | 
|
| 
       51 
56 
     | 
    
         
             
              requirements: 
         
     | 
| 
       52 
57 
     | 
    
         
             
              - - ">="
         
     | 
| 
       53 
58 
     | 
    
         
             
                - !ruby/object:Gem::Version 
         
     | 
| 
      
 59 
     | 
    
         
            +
                  segments: 
         
     | 
| 
      
 60 
     | 
    
         
            +
                  - 0
         
     | 
| 
       54 
61 
     | 
    
         
             
                  version: "0"
         
     | 
| 
       55 
     | 
    
         
            -
              version: 
         
     | 
| 
       56 
62 
     | 
    
         
             
            required_rubygems_version: !ruby/object:Gem::Requirement 
         
     | 
| 
       57 
63 
     | 
    
         
             
              requirements: 
         
     | 
| 
       58 
64 
     | 
    
         
             
              - - ">="
         
     | 
| 
       59 
65 
     | 
    
         
             
                - !ruby/object:Gem::Version 
         
     | 
| 
      
 66 
     | 
    
         
            +
                  segments: 
         
     | 
| 
      
 67 
     | 
    
         
            +
                  - 0
         
     | 
| 
       60 
68 
     | 
    
         
             
                  version: "0"
         
     | 
| 
       61 
     | 
    
         
            -
              version: 
         
     | 
| 
       62 
69 
     | 
    
         
             
            requirements: []
         
     | 
| 
       63 
70 
     | 
    
         | 
| 
       64 
71 
     | 
    
         
             
            rubyforge_project: tilecache
         
     | 
| 
       65 
     | 
    
         
            -
            rubygems_version: 1.3. 
     | 
| 
      
 72 
     | 
    
         
            +
            rubygems_version: 1.3.6
         
     | 
| 
       66 
73 
     | 
    
         
             
            signing_key: 
         
     | 
| 
       67 
74 
     | 
    
         
             
            specification_version: 3
         
     | 
| 
       68 
75 
     | 
    
         
             
            summary: An implementation of TileCache from MetaCarta, written in pure Ruby
         
     |