dotter 0.1.1

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/.document ADDED
@@ -0,0 +1,5 @@
1
+ README.rdoc
2
+ lib/**/*.rb
3
+ bin/*
4
+ features/**/*.feature
5
+ LICENSE
data/.gitignore ADDED
@@ -0,0 +1,5 @@
1
+ *.sw?
2
+ .DS_Store
3
+ coverage
4
+ rdoc
5
+ pkg
data/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2009 Peter Sarnacki
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.rdoc ADDED
@@ -0,0 +1,31 @@
1
+ = Dotter
2
+
3
+ Simple library for drawing dots (for google maps).
4
+
5
+ == Usage
6
+ First you must create a tile (which will represent google maps tile). Tile takes tile start (latlng coordinates of upper left corner) and zoom. More on google maps tiles: http://code.google.com/apis/maps/documentation/overlays.html#Google_Maps_Coordinates
7
+
8
+ tile_start = Dotter::LatLng.new(tile_start_latitude, tile_start_longitude)
9
+ tile = Dotter::Tile.new(tile_start, zoom)
10
+
11
+ tile.places = places_array # places should respond_to latitude and longitude
12
+
13
+ dotter = Dotter::Dotter.new(:dots => tile.convert_places)
14
+ dotter.generate_image # Magick::Image instance containing transparent image with dots
15
+
16
+ This will generate image of a tile with dots representing given places.
17
+
18
+ Dots are black by default. If you want to color them, objects passed as a dots should respond_to :dot_color method. dot_color should return string representing color, for list of available color names visit: http://www.imagemagick.org/RMagick/doc/imusage.html#color_names
19
+
20
+
21
+ TODO: write short note about implementing it in google maps
22
+ == Note on Patches/Pull Requests
23
+
24
+ * Fork the project.
25
+ * Make your feature addition or bug fix.
26
+ * Add tests for it. This is important so I don't break it in a
27
+ future version unintentionally.
28
+ * Commit, do not mess with rakefile, version, or history.
29
+ (if you want to have your own version, that is fine but
30
+ bump version in a commit by itself I can ignore when I pull)
31
+ * Send me a pull request. Bonus points for topic branches.
data/Rakefile ADDED
@@ -0,0 +1,48 @@
1
+ require 'rubygems'
2
+ require 'rake'
3
+
4
+ begin
5
+ require 'jeweler'
6
+ Jeweler::Tasks.new do |gem|
7
+ gem.name = "dotter"
8
+ gem.summary = %Q{Simple lib drawing dots on transparent image}
9
+ gem.description = %Q{Simple lib drawing dots on transparent image}
10
+ gem.email = "drogus@gmail.com"
11
+ gem.homepage = "http://github.com/drogus/dotter"
12
+ gem.authors = ["Piotr Sarnacki"]
13
+ gem.add_development_dependency "rspec"
14
+ end
15
+ Jeweler::GemcutterTasks.new
16
+ rescue LoadError
17
+ puts "Jeweler (or a dependency) not available. Install it with: sudo gem install jeweler"
18
+ end
19
+
20
+ require 'spec/rake/spectask'
21
+ Spec::Rake::SpecTask.new(:spec) do |spec|
22
+ spec.libs << 'lib' << 'spec'
23
+ spec.spec_files = FileList['spec/**/*_spec.rb']
24
+ end
25
+
26
+ Spec::Rake::SpecTask.new(:rcov) do |spec|
27
+ spec.libs << 'lib' << 'spec'
28
+ spec.pattern = 'spec/**/*_spec.rb'
29
+ spec.rcov = true
30
+ end
31
+
32
+ task :spec => :check_dependencies
33
+
34
+ task :default => :spec
35
+
36
+ require 'rake/rdoctask'
37
+ Rake::RDocTask.new do |rdoc|
38
+ if File.exist?('VERSION')
39
+ version = File.read('VERSION')
40
+ else
41
+ version = "0.1"
42
+ end
43
+
44
+ rdoc.rdoc_dir = 'rdoc'
45
+ rdoc.title = "dotter #{version}"
46
+ rdoc.rdoc_files.include('README*')
47
+ rdoc.rdoc_files.include('lib/**/*.rb')
48
+ end
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.1.1
data/dotter.gemspec ADDED
@@ -0,0 +1,69 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run `rake gemspec`
4
+ # -*- encoding: utf-8 -*-
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = %q{dotter}
8
+ s.version = "0.1.1"
9
+
10
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
+ s.authors = ["Piotr Sarnacki"]
12
+ s.date = %q{2009-10-20}
13
+ s.description = %q{Simple lib drawing dots on transparent image}
14
+ s.email = %q{drogus@gmail.com}
15
+ s.extra_rdoc_files = [
16
+ "LICENSE",
17
+ "README.rdoc"
18
+ ]
19
+ s.files = [
20
+ ".document",
21
+ ".gitignore",
22
+ "LICENSE",
23
+ "README.rdoc",
24
+ "Rakefile",
25
+ "VERSION",
26
+ "dotter.gemspec",
27
+ "init.rb",
28
+ "lib/dotter.rb",
29
+ "lib/dotter/dot.rb",
30
+ "lib/dotter/gmap.rb",
31
+ "lib/dotter/lat_lng.rb",
32
+ "lib/dotter/point.rb",
33
+ "lib/dotter/tile.rb",
34
+ "spec/dotter/dot_spec.rb",
35
+ "spec/dotter/gmap_spec.rb",
36
+ "spec/dotter/lat_lng_spec.rb",
37
+ "spec/dotter/point_spec.rb",
38
+ "spec/dotter/tile_spec.rb",
39
+ "spec/dotter_spec.rb",
40
+ "spec/spec_helper.rb"
41
+ ]
42
+ s.homepage = %q{http://github.com/drogus/dotter}
43
+ s.rdoc_options = ["--charset=UTF-8"]
44
+ s.require_paths = ["lib"]
45
+ s.rubygems_version = %q{1.3.5}
46
+ s.summary = %q{Simple lib drawing dots on transparent image}
47
+ s.test_files = [
48
+ "spec/spec_helper.rb",
49
+ "spec/dotter/gmap_spec.rb",
50
+ "spec/dotter/point_spec.rb",
51
+ "spec/dotter/tile_spec.rb",
52
+ "spec/dotter/dot_spec.rb",
53
+ "spec/dotter/lat_lng_spec.rb",
54
+ "spec/dotter_spec.rb"
55
+ ]
56
+
57
+ if s.respond_to? :specification_version then
58
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
59
+ s.specification_version = 3
60
+
61
+ if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
62
+ s.add_development_dependency(%q<rspec>, [">= 0"])
63
+ else
64
+ s.add_dependency(%q<rspec>, [">= 0"])
65
+ end
66
+ else
67
+ s.add_dependency(%q<rspec>, [">= 0"])
68
+ end
69
+ end
data/init.rb ADDED
@@ -0,0 +1 @@
1
+ require 'dotter'
data/lib/dotter/dot.rb ADDED
@@ -0,0 +1,16 @@
1
+ class Dotter::Dot
2
+ attr_accessor :x, :y, :radius, :dot_color
3
+
4
+ def initialize(x, y, opts = {})
5
+ @x, @y = x, y
6
+
7
+ @dot_color = opts.delete(:dot_color)
8
+ end
9
+
10
+ def -(other)
11
+ dot = self.dup
12
+ dot.x -= other.x
13
+ dot.y -= other.y
14
+ dot
15
+ end
16
+ end
@@ -0,0 +1,26 @@
1
+ class Dotter::GMap
2
+
3
+ # translate given coordinates to pixels on google map
4
+ # with given zoom. implementation is based on: http://www.usnaviguide.com/google-tiles.htm
5
+ #
6
+ # returns point relative to map (not tile!) beginning (0, 0)
7
+ def self.latlng_to_pixel(latlng, zoom)
8
+ c = 256
9
+ bc = 2 * Math::PI
10
+ wa = Math::PI / 180
11
+ cp = 2 ** (zoom + 8)
12
+ pixLngDeg = cp / 360.0
13
+ pixLngRad = cp / bc
14
+ bmO = cp / 2
15
+
16
+ point = Dotter::Point.new(0, 0)
17
+
18
+ e = Math.sin(latlng.lat * wa)
19
+ e = 0.9999 if e > 0.9999
20
+ e = -0.9999 if e < -0.9999
21
+
22
+ point.x = (bmO + latlng.lng * pixLngDeg).floor
23
+ point.y = (bmO + 0.5 * Math.log((1 + e) / (1 - e)) * -1 * pixLngRad).floor
24
+ point
25
+ end
26
+ end
@@ -0,0 +1,9 @@
1
+ class Dotter::LatLng
2
+ attr_accessor :lat, :lng
3
+ alias latitude lat
4
+ alias longitude lng
5
+
6
+ def initialize(lat, lng)
7
+ @lat, @lng = lat.to_f, lng.to_f
8
+ end
9
+ end
@@ -0,0 +1,25 @@
1
+ class Dotter::Point
2
+ attr_accessor :x, :y
3
+
4
+ def initialize(x, y)
5
+ @x, @y = x, y
6
+ end
7
+
8
+ def ==(other)
9
+ x == other.x && y == other.y
10
+ end
11
+
12
+ def -(other)
13
+ point = self.dup
14
+ point.x -= other.x
15
+ point.y -= other.y
16
+ point
17
+ end
18
+
19
+ def +(other)
20
+ point = self.dup
21
+ point.x += other.x
22
+ point.y += other.y
23
+ point
24
+ end
25
+ end
@@ -0,0 +1,67 @@
1
+ # Dotter::Tile is abstracting google maps' tiles (squares, usually 256x256, that are loaded as parts of the map).
2
+ #
3
+ # More on tiles and how google maps works can be found here: http://code.google.com/apis/maps/documentation/overlays.html#Google_Maps_Coordinates
4
+ #
5
+ # ==== Usage
6
+ #
7
+ # To generate a tile you must give upper left corner of a tile and zoom.
8
+ #
9
+ # tile_start = Dotter::LatLng.new(tile_start_latitude, tile_start_longitude)
10
+ # tile = Dotter::Tile.new(tile_start, zoom)
11
+ #
12
+ # tile.places = places_array # places should respond_to latitude and longitude
13
+ #
14
+ # tile.image # generates RMagick::Magick image with "png" format set
15
+ #
16
+ # You can also use tile in Dotter::Dotter explicitly (tile.image is a simple helper, but if you want to set some specific options you will have to do that this way):
17
+ # dots = tile.convert_places
18
+ # dotter = Dotter::Dotter.new(:dots => dots)
19
+ # dotter.generate_image
20
+ #
21
+ # It passes places changed into points relative to current tile's start.
22
+ #
23
+ class Dotter::Tile
24
+ attr_accessor :zoom, :start, :places, :dots
25
+ def initialize(latlng, zoom)
26
+ @zoom = zoom.to_i
27
+ @start = Dotter::GMap.latlng_to_pixel(latlng, @zoom)
28
+ end
29
+
30
+ # Method that takes places passed to Tile and converts them into points with x an y relative to tile start
31
+ #
32
+ # ==== Returns
33
+ # Array[~x, ~y]:: points array
34
+ def places_as_points(options = {})
35
+ points = []
36
+ places.each do |place|
37
+ latlng = Dotter::LatLng.new(place.latitude, place.longitude)
38
+ point = Dotter::GMap.latlng_to_pixel(latlng, zoom)
39
+ point = point - start # place is relative to big map, let's make it relative to start of tile
40
+ if block_given?
41
+ yield(point, place)
42
+ else
43
+ points << point
44
+ end
45
+ end
46
+ points
47
+ end
48
+
49
+ # Method converts places to points if places responds to x= and y=
50
+ #
51
+ def convert_places
52
+ places_as_points do |point, place|
53
+ place.x = point.x
54
+ place.y = point.y
55
+ end
56
+ @dots = places
57
+ places
58
+ end
59
+
60
+ # Generate tile image with Dotter
61
+ def image
62
+ dotter = Dotter::Dotter.new(:dots => @dots || places_as_points)
63
+ img = dotter.generate_image
64
+ img.format = "png"
65
+ img
66
+ end
67
+ end
data/lib/dotter.rb ADDED
@@ -0,0 +1,86 @@
1
+ require "RMagick"
2
+
3
+ module Dotter
4
+ end
5
+
6
+ # Dotter::Dotter allows to generate transparent image with dots representing points on map. This image can be used as a google maps tile.
7
+ #
8
+ # Usage:
9
+ #
10
+ # dotter = Dotter::Dotter.new(:dots => dots_array)
11
+ #
12
+ # image = dotter.generate_image
13
+ # image # Magick::Image instance containing transparent image with dots
14
+ #
15
+ # A Dot can be any object that responds to :x and :y methods. If :colorize in options is set to true and dot responds to :dot_color method, dot will be drawn with this color (color can be anything that is acceptable as a color in RMagick, usually RGB value, ie: "#ff0000". Dots are black by default)
16
+ #
17
+ # x and y coordinates represents the actual place, where the dot will be placed on image. If you have latitude and longitude coordinates you must convert it first. It's fairly easy with Dotter::Tile, which abstracts google maps tiles.
18
+ class Dotter::Dotter
19
+ attr_accessor :dots, :colorize
20
+
21
+ # ==== Parameters
22
+ # options<Hash>::
23
+ #
24
+ # ==== Options
25
+ # :dots<Enumerable>:: array of dots that should be displayed on the image
26
+ # :width<Fixnum>:: tile width (default: 256)
27
+ # :height<Fixnum>:: tile height (default: 256)
28
+ # :radius<Fixnym>:: dot radius (default: 5)
29
+ # :colorize<Boolean>:: if colorize is set to true and dot responds_to dot_color, dot is colored using that color. Otherwise it's black (default: true)
30
+ def initialize(opts = {})
31
+ @dots = opts.delete(:dots) || []
32
+ @width = opts.delete(:width) || 256
33
+ @height = opts.delete(:height) || 256
34
+ @radius = opts.delete(:radius) || 5
35
+ colorize = opts.delete(:colorize)
36
+ @colorize = colorize.nil? ? true : colorize
37
+ end
38
+
39
+ # Tells if dots can be colored. If yes, dotter colors dot with anything that is returned by dot_color method.
40
+ def colorize?
41
+ @colorize
42
+ end
43
+
44
+ # Generate transparent image with dots
45
+ def generate_image
46
+ image = Magick::Image.new(@width, @height) do
47
+ self.background_color = "transparent"
48
+ end
49
+
50
+ draw_dots(image)
51
+
52
+ image
53
+ end
54
+
55
+ private
56
+ def draw_dots(image) #:nodoc
57
+ return if dots.nil? || dots.length == 0
58
+ gc = Magick::Draw.new
59
+
60
+ dots.each do |dot|
61
+ draw_dot(gc, dot)
62
+ end
63
+
64
+ gc.draw(image)
65
+ end
66
+
67
+ def draw_dot(gc, dot)
68
+ gc.fill("white")
69
+ gc.circle(dot.x, dot.y, dot.x - @radius, dot.y)
70
+ color = if colorize? and dot.respond_to?(:dot_color) && !dot.dot_color.nil?
71
+ dot.dot_color
72
+ else
73
+ "black"
74
+ end
75
+ gc.fill(color)
76
+ gc.circle(dot.x, dot.y, dot.x - @radius + 1, dot.y)
77
+ end
78
+ end
79
+
80
+ directory = File.expand_path(File.dirname(__FILE__))
81
+ require File.join(directory, 'dotter', 'dot')
82
+ require File.join(directory, 'dotter', 'lat_lng')
83
+ require File.join(directory, 'dotter', 'gmap')
84
+ require File.join(directory, 'dotter', 'tile')
85
+ require File.join(directory, 'dotter', 'point')
86
+
@@ -0,0 +1,29 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
2
+
3
+ describe "Dotter::Dot" do
4
+ it "should allow to pass coordinates" do
5
+ dot = Dotter::Dot.new(1, 2)
6
+ dot.x.should == 1
7
+ dot.y.should == 2
8
+ end
9
+
10
+ it "should allow to subtract one dot from another" do
11
+ dot = Dotter::Dot.new(10, 5)
12
+ dot2 = Dotter::Dot.new(5, 2)
13
+ result = dot - dot2
14
+
15
+ result.x.should == 5
16
+ result.y.should == 3
17
+ end
18
+
19
+ it "should allow to set color of a dot" do
20
+ dot = Dotter::Dot.new(1, 2)
21
+ dot.dot_color = "#ff0000"
22
+ dot.dot_color.should == "#ff0000"
23
+ end
24
+
25
+ it "should allow to pass a color in options" do
26
+ dot = Dotter::Dot.new(1, 2, :dot_color => "#ff0000")
27
+ dot.dot_color.should == "#ff0000"
28
+ end
29
+ end
@@ -0,0 +1,7 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
2
+
3
+ describe "Dotter::GMap" do
4
+ it "should allow to convert coordinates to point on map" do
5
+ Dotter::GMap.latlng_to_pixel(Dotter::LatLng.new(0, 0), 0).should == Dotter::Point.new(128, 128)
6
+ end
7
+ end
@@ -0,0 +1,9 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
2
+
3
+ describe "Dotter::LatLng" do
4
+ it "should allow to pass latitude and longitude in initialize" do
5
+ latlng = Dotter::LatLng.new(10.0, 20.0)
6
+ latlng.lat.should == 10.0
7
+ latlng.lng.should == 20.0
8
+ end
9
+ end
@@ -0,0 +1,34 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
2
+
3
+ describe "Dotter::Point" do
4
+ it "should allow to pass coordinates" do
5
+ point = Dotter::Point.new(1, 2)
6
+ point.x.should == 1
7
+ point.y.should == 2
8
+ end
9
+
10
+ it "should allow to subtract one point from another" do
11
+ point = Dotter::Point.new(10, 5)
12
+ point2 = Dotter::Point.new(5, 2)
13
+ result = point - point2
14
+
15
+ result.x.should == 5
16
+ result.y.should == 3
17
+ end
18
+
19
+ it "should allow to add one point to another" do
20
+ point = Dotter::Point.new(10, 5)
21
+ point2 = Dotter::Point.new(5, 2)
22
+ result = point + point2
23
+
24
+ result.x.should == 15
25
+ result.y.should == 7
26
+ end
27
+
28
+ it "should allow to compare points" do
29
+ point = Dotter::Point.new(1, 1)
30
+ point2 = Dotter::Point.new(1, 1)
31
+
32
+ point.should == point2
33
+ end
34
+ end
@@ -0,0 +1,44 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
2
+
3
+ def stub_point(point, x, y)
4
+ stub(point).x=
5
+ stub(point).x { x }
6
+ stub(point).y=
7
+ stub(point).y { y }
8
+ end
9
+
10
+ describe "Dotter::Tile" do
11
+ it "should generate tile image" do
12
+ # i know that this isn't good spec, it's just to run code and see it if not fails
13
+ # need to add more specs fot Tile
14
+ tile = Dotter::Tile.new(Dotter::LatLng.new(0, 0), 0)
15
+ tile.places = [Dotter::LatLng.new(0, 0)]
16
+ tile.image.class.should == Magick::Image
17
+ lambda { tile.image.to_blob }.should_not raise_error
18
+ end
19
+
20
+ describe "Converting" do
21
+ before(:each) do
22
+ @tile = Dotter::Tile.new(Dotter::LatLng.new(0, 0), 1)
23
+ @places = [Dotter::LatLng.new(0, 0), Dotter::LatLng.new(-85.1, 180)]
24
+ @tile.places = @places
25
+ end
26
+
27
+ it "should convert places to points" do
28
+ points = @tile.places_as_points
29
+ points.should have(2).items
30
+ points.first.x.should == 0
31
+ points.first.y.should == 0
32
+ points[1].x.should == 256
33
+ points[1].y.should == 256
34
+ end
35
+
36
+ it "should set x and y in current points if points responds_to x= and x=" do
37
+ stub_point(@tile.places[0], 0, 0)
38
+ stub_point(@tile.places[1], 111, 111)
39
+
40
+ @tile.convert_places
41
+ end
42
+ end
43
+
44
+ end
@@ -0,0 +1,56 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
2
+
3
+ describe "Dotter::Dotter" do
4
+ it "should allow to pass dots in initializer" do
5
+ dots = [Dotter::Dot.new(1, 2), Dotter::Dot.new(3, 4)]
6
+ dotter = Dotter::Dotter.new(:dots => dots)
7
+ dotter.dots.length.should == 2
8
+ end
9
+
10
+ it "should generate blank image without error if there is no dots" do
11
+ dotter = Dotter::Dotter.new
12
+ lambda { dotter.generate_image }.should_not raise_error
13
+ end
14
+
15
+ describe "colorize" do
16
+ before(:each) do
17
+ @dotter = Dotter::Dotter.new(:colorize => true)
18
+ end
19
+
20
+ it "should enable colorizing by default" do
21
+ dotter = Dotter::Dotter.new
22
+ dotter.colorize?.should be_true
23
+ end
24
+
25
+ it "should allow to set if dots should be colorized" do
26
+ @dotter.colorize?.should be_true
27
+ @dotter.colorize = false
28
+ @dotter.colorize?.should be_false
29
+ end
30
+
31
+ it "should make colored dots" do
32
+ @dotter.dots = [Dotter::Dot.new(10, 10, :dot_color => "#ff0000")]
33
+ image = @dotter.generate_image
34
+ image.pixel_color(10, 10).should have_color("#ff0000")
35
+ end
36
+ end
37
+
38
+ describe "generated image" do
39
+ before(:each) do
40
+ @dotter = Dotter::Dotter.new(:dots => [Dotter::Dot.new(10, 10), Dotter::Dot.new(20, 20)])
41
+ @image = @dotter.generate_image
42
+ end
43
+
44
+ it "should have image class" do
45
+ @image.class.should == Magick::Image
46
+ end
47
+
48
+ it "there should be transparent pixel" do
49
+ @image.pixel_color(0, 0).should be_transparent
50
+ end
51
+
52
+ it "dot should not be transparent" do
53
+ @image.pixel_color(10, 10).should_not be_transparent
54
+ end
55
+ end
56
+ end
@@ -0,0 +1,21 @@
1
+ $LOAD_PATH.unshift(File.dirname(__FILE__))
2
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
3
+ require 'dotter'
4
+ require 'spec'
5
+ require 'spec/autorun'
6
+
7
+ Spec::Runner.configure do |config|
8
+ config.mock_with :rr
9
+ end
10
+
11
+ def be_transparent
12
+ simple_matcher("be transparent") { |actual|
13
+ actual.opacity == Magick::TransparentOpacity
14
+ }
15
+ end
16
+
17
+ def have_color(color)
18
+ simple_matcher("have color #{color}") { |actual|
19
+ actual.fcmp(Magick::Pixel.from_color(color))
20
+ }
21
+ end
metadata ADDED
@@ -0,0 +1,91 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: dotter
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.1
5
+ platform: ruby
6
+ authors:
7
+ - Piotr Sarnacki
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2009-10-20 00:00:00 +02:00
13
+ default_executable:
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: rspec
17
+ type: :development
18
+ version_requirement:
19
+ version_requirements: !ruby/object:Gem::Requirement
20
+ requirements:
21
+ - - ">="
22
+ - !ruby/object:Gem::Version
23
+ version: "0"
24
+ version:
25
+ description: Simple lib drawing dots on transparent image
26
+ email: drogus@gmail.com
27
+ executables: []
28
+
29
+ extensions: []
30
+
31
+ extra_rdoc_files:
32
+ - LICENSE
33
+ - README.rdoc
34
+ files:
35
+ - .document
36
+ - .gitignore
37
+ - LICENSE
38
+ - README.rdoc
39
+ - Rakefile
40
+ - VERSION
41
+ - dotter.gemspec
42
+ - init.rb
43
+ - lib/dotter.rb
44
+ - lib/dotter/dot.rb
45
+ - lib/dotter/gmap.rb
46
+ - lib/dotter/lat_lng.rb
47
+ - lib/dotter/point.rb
48
+ - lib/dotter/tile.rb
49
+ - spec/dotter/dot_spec.rb
50
+ - spec/dotter/gmap_spec.rb
51
+ - spec/dotter/lat_lng_spec.rb
52
+ - spec/dotter/point_spec.rb
53
+ - spec/dotter/tile_spec.rb
54
+ - spec/dotter_spec.rb
55
+ - spec/spec_helper.rb
56
+ has_rdoc: true
57
+ homepage: http://github.com/drogus/dotter
58
+ licenses: []
59
+
60
+ post_install_message:
61
+ rdoc_options:
62
+ - --charset=UTF-8
63
+ require_paths:
64
+ - lib
65
+ required_ruby_version: !ruby/object:Gem::Requirement
66
+ requirements:
67
+ - - ">="
68
+ - !ruby/object:Gem::Version
69
+ version: "0"
70
+ version:
71
+ required_rubygems_version: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: "0"
76
+ version:
77
+ requirements: []
78
+
79
+ rubyforge_project:
80
+ rubygems_version: 1.3.5
81
+ signing_key:
82
+ specification_version: 3
83
+ summary: Simple lib drawing dots on transparent image
84
+ test_files:
85
+ - spec/spec_helper.rb
86
+ - spec/dotter/gmap_spec.rb
87
+ - spec/dotter/point_spec.rb
88
+ - spec/dotter/tile_spec.rb
89
+ - spec/dotter/dot_spec.rb
90
+ - spec/dotter/lat_lng_spec.rb
91
+ - spec/dotter_spec.rb