Class: RGeo::Geographic::Projector

Inherits:
Object
  • Object
show all
Defined in:
lib/rgeo/geographic/projector.rb

Overview

:nodoc:

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(geography_factory, projection_factory) ⇒ Projector

Returns a new instance of Projector.



12
13
14
15
# File 'lib/rgeo/geographic/projector.rb', line 12

def initialize(geography_factory, projection_factory)
  @geography_factory = geography_factory
  @projection_factory = projection_factory
end

Instance Attribute Details

#projection_factoryObject (readonly)

Returns the value of attribute projection_factory.



30
31
32
# File 'lib/rgeo/geographic/projector.rb', line 30

def projection_factory
  @projection_factory
end

Class Method Details

.create_from_existing_factory(geography_factory, projection_factory) ⇒ Object



41
42
43
# File 'lib/rgeo/geographic/projector.rb', line 41

def create_from_existing_factory(geography_factory, projection_factory)
  new(geography_factory, projection_factory)
end

.create_from_opts(geography_factory, opts = {}) ⇒ Object



45
46
47
48
49
50
51
52
53
54
55
56
57
# File 'lib/rgeo/geographic/projector.rb', line 45

def create_from_opts(geography_factory, opts = {})
  projection_factory =
    Cartesian.preferred_factory(
      coord_sys: opts[:coord_sys], srid: opts[:srid],
      coord_sys_class: opts[:coord_sys_class],
      buffer_resolution: opts[:buffer_resolution],
      has_z_coordinate: opts[:has_z_coordinate],
      has_m_coordinate: opts[:has_m_coordinate],
      wkt_parser: opts[:wkt_parser], wkt_generator: opts[:wkt_generator],
      wkb_parser: opts[:wkb_parser], wkb_generator: opts[:wkb_generator]
    )
  new(geography_factory, projection_factory)
end

Instance Method Details

#limits_windowObject



36
37
38
# File 'lib/rgeo/geographic/projector.rb', line 36

def limits_window
  nil
end

#project(geometry) ⇒ Object



22
23
24
# File 'lib/rgeo/geographic/projector.rb', line 22

def project(geometry)
  Feature.cast(geometry, @projection_factory, :project)
end

#set_factories(geography_factory, projection_factory) ⇒ Object



17
18
19
20
# File 'lib/rgeo/geographic/projector.rb', line 17

def set_factories(geography_factory, projection_factory)
  @geography_factory = geography_factory
  @projection_factory = projection_factory
end

#unproject(geometry) ⇒ Object



26
27
28
# File 'lib/rgeo/geographic/projector.rb', line 26

def unproject(geometry)
  Feature.cast(geometry, @geography_factory, :project)
end

#wraps?Boolean

Returns:

  • (Boolean)


32
33
34
# File 'lib/rgeo/geographic/projector.rb', line 32

def wraps?
  false
end