Class: Proj::OperationFactoryContext
- Inherits:
-
Object
- Object
- Proj::OperationFactoryContext
- Defined in:
- lib/proj/operation_factory_context.rb
Overview
A context for building coordinate operations between two CRS.
Instance Attribute Summary collapse
-
#context ⇒ Object
readonly
Returns the value of attribute context.
Class Method Summary collapse
Instance Method Summary collapse
-
#allow_use_intermediate_crs=(value) ⇒ Object
Set whether an intermediate pivot CRS can be used for researching coordinate operations between a source and target CRS.
-
#allowed_intermediate_crs=(values) ⇒ Object
Restrict the potential pivot CRSs that can be used when trying to build a coordinate operation between two CRS that have no direct operation.
-
#area_of_interest_name=(value) ⇒ Object
Set the name of the desired area of interest for the resulting coordinate transformations.
-
#ballpark_transformations=(value) ⇒ Object
Specifies whether ballpark transformations are allowed.
-
#create_operations(source, target) ⇒ Array
Find a list of CoordinateOperation from source_crs to target_crs.
-
#crs_extent_use=(value) ⇒ Object
Set how source and target CRS extent should be used when considering if a transformation can be used (only takes effect if no area of interest is explicitly defined).
-
#desired_accuracy=(value) ⇒ Object
Set the desired accuracy of the resulting coordinate transformations.
-
#discard_superseded=(value) ⇒ Object
Set whether transformations that are superseded (but not deprecated) should be discarded.
-
#grid_availability=(value) ⇒ Object
Set how grid availability is used.
-
#initialize(context, authority: nil) ⇒ OperationFactoryContext
constructor
Create a new OperationFactoryContext.
-
#set_area_of_interest(west, south, east, north) ⇒ Object
Set the desired area of interest for the resulting coordinate transformations.
-
#spatial_criterion=(value) ⇒ Object
Set the spatial criterion to use when comparing the area of validity of coordinate operations with the area of interest / area of validity of source and target CRS.
- #to_ptr ⇒ Object
-
#use_proj_alternative_grid_names=(value) ⇒ Object
Set whether PROJ alternative grid names should be substituted to the official authority names.
Constructor Details
#initialize(context, authority: nil) ⇒ OperationFactoryContext
Create a new OperationFactoryContext
22 23 24 25 |
# File 'lib/proj/operation_factory_context.rb', line 22 def initialize(context, authority: nil) @pointer = Api.proj_create_operation_factory_context(context, ) ObjectSpace.define_finalizer(self, self.class.finalize(@pointer)) end |
Instance Attribute Details
#context ⇒ Object (readonly)
Returns the value of attribute context.
4 5 6 |
# File 'lib/proj/operation_factory_context.rb', line 4 def context @context end |
Class Method Details
.finalize(pointer) ⇒ Object
6 7 8 9 10 |
# File 'lib/proj/operation_factory_context.rb', line 6 def self.finalize(pointer) proc do Api.proj_operation_factory_context_destroy(pointer) end end |
Instance Method Details
#allow_use_intermediate_crs=(value) ⇒ Object
Set whether an intermediate pivot CRS can be used for researching coordinate operations between a source and target CRS.
104 105 106 |
# File 'lib/proj/operation_factory_context.rb', line 104 def allow_use_intermediate_crs=(value) Api.proj_operation_factory_context_set_allow_use_intermediate_crs(self.context, self, value) end |
#allowed_intermediate_crs=(values) ⇒ Object
Restrict the potential pivot CRSs that can be used when trying to build a coordinate operation between two CRS that have no direct operation.
112 113 114 115 116 117 118 119 120 121 122 123 |
# File 'lib/proj/operation_factory_context.rb', line 112 def allowed_intermediate_crs=(values) # Convert strings to C chars values_ptr = values.map do |value| FFI::MemoryPointer.from_string(value) end # Add extra item at end for null pointer pointer = FFI::MemoryPointer.new(:pointer, values.size + 1) pointer.write_array_of_pointer(values_ptr) Api.proj_operation_factory_context_set_allowed_intermediate_crs(self.context, self, pointer) end |
#area_of_interest_name=(value) ⇒ Object
Set the name of the desired area of interest for the resulting coordinate transformations.
66 67 68 |
# File 'lib/proj/operation_factory_context.rb', line 66 def area_of_interest_name=(value) Api.proj_operation_factory_context_set_area_of_interest_name(self.context, self, value) end |
#ballpark_transformations=(value) ⇒ Object
Specifies whether ballpark transformations are allowed.
41 42 43 |
# File 'lib/proj/operation_factory_context.rb', line 41 def ballpark_transformations=(value) Api.proj_operation_factory_context_set_allow_ballpark_transformations(self.context, self, value ? 1 : 0) end |
#create_operations(source, target) ⇒ Array
Find a list of CoordinateOperation from source_crs to target_crs
33 34 35 36 |
# File 'lib/proj/operation_factory_context.rb', line 33 def create_operations(source, target) ptr = Api.proj_create_operations(self.context, source, target, self) PjObjects.new(ptr, self.context) end |
#crs_extent_use=(value) ⇒ Object
Set how source and target CRS extent should be used when considering if a transformation can be used (only takes effect if no area of interest is explicitly defined).
74 75 76 |
# File 'lib/proj/operation_factory_context.rb', line 74 def crs_extent_use=(value) Api.proj_operation_factory_context_set_crs_extent_use(self.context, self, value) end |
#desired_accuracy=(value) ⇒ Object
Set the desired accuracy of the resulting coordinate transformations.
48 49 50 |
# File 'lib/proj/operation_factory_context.rb', line 48 def desired_accuracy=(value) Api.proj_operation_factory_context_set_desired_accuracy(self.context, self, value) end |
#discard_superseded=(value) ⇒ Object
Set whether transformations that are superseded (but not deprecated) should be discarded.
128 129 130 |
# File 'lib/proj/operation_factory_context.rb', line 128 def discard_superseded=(value) Api.proj_operation_factory_context_set_discard_superseded(self.context, self, value ? 1 : 0) end |
#grid_availability=(value) ⇒ Object
Set how grid availability is used.
@param [PROJ_GRID_AVAILABILITY_USE] - Use how grid availability is used.
89 90 91 |
# File 'lib/proj/operation_factory_context.rb', line 89 def grid_availability=(value) Api.proj_operation_factory_context_set_grid_availability_use(self.context, self, value) end |
#set_area_of_interest(west, south, east, north) ⇒ Object
Set the desired area of interest for the resulting coordinate transformations. For an area of interest crossing the anti-meridian, west_lon_degree will be greater than east_lon_degree.
59 60 61 |
# File 'lib/proj/operation_factory_context.rb', line 59 def set_area_of_interest(west, south, east, north) Api.proj_operation_factory_context_set_area_of_interest(self.context, self, west, south, east, north) end |
#spatial_criterion=(value) ⇒ Object
Set the spatial criterion to use when comparing the area of validity of coordinate operations with the area of interest / area of validity of source and target CRS.
@param value [PROJ_SPATIAL_CRITERION] spatial criterion to use
82 83 84 |
# File 'lib/proj/operation_factory_context.rb', line 82 def spatial_criterion=(value) Api.proj_operation_factory_context_set_spatial_criterion(self.context, self, value) end |
#to_ptr ⇒ Object
132 133 134 |
# File 'lib/proj/operation_factory_context.rb', line 132 def to_ptr @pointer end |
#use_proj_alternative_grid_names=(value) ⇒ Object
Set whether PROJ alternative grid names should be substituted to the official authority names.
96 97 98 |
# File 'lib/proj/operation_factory_context.rb', line 96 def use_proj_alternative_grid_names=(value) Api.proj_operation_factory_context_set_use_proj_alternative_grid_names(self.context, self, value ? 1 : 0) end |