Class: RGeo::CoordSys::CS::CoordinateTransform
- Defined in:
- lib/rgeo/coord_sys/cs/entities.rb
Overview
CoordinateTransform object. Note it is a combo of CoordinateTransform and MathTransform as specified in the OGC standard. This is just to simplify the model and keep all functionality in this class.
Instance Attribute Summary collapse
-
#source_cs ⇒ Object
Returns the value of attribute source_cs.
-
#target_cs ⇒ Object
Returns the value of attribute target_cs.
Attributes inherited from Info
#abbreviation, #alias, #authority, #authority_code, #name, #remarks
Class Method Summary collapse
-
.create(source_cs, target_cs, *optional) ⇒ CoordinateTransform
Initialize a new CoordinateTransform.
Instance Method Summary collapse
-
#area_of_use ⇒ String
Human readable description of domain in source coordinate system.
-
#codomain_convex_hull(points) ⇒ Array<<Array<Integer>>]
Gets transformed convex hull.
-
#dim_source ⇒ Integer
Dimension of the source_cs.
-
#dim_target ⇒ Integer
Dimension of the target_cs.
-
#domain_flags(points) ⇒ Array<Integer>
Gets flags classifying domain points within a convex hull.
-
#identity? ⇒ Boolean
Tests whether this transform does not move any points.
-
#initialize(source_cs, target_cs, *optional) ⇒ CoordinateTransform
constructor
Initialize a new CoordinateTransform.
- #inspect ⇒ Object
-
#inverse ⇒ CoordinateTransform
Creates the inverse transform of this object.
-
#transform_coords(x, y, z = nil) ⇒ Array<Integer>
Transforms a coordinate point.
-
#transform_list(points) ⇒ Array<Array<Integer>>
Transforms a coordinate point.
-
#transform_type ⇒ String
Semantic type of transform.
-
#wkt_typename ⇒ Object
TODO: This changes depending on what type of conversion is done and we can’t know unless we implement the conversion ourselves.
Methods inherited from Info
Methods inherited from Base
#encode_with, #eql?, #hash, #init_with, #marshal_dump, #marshal_load, #to_s, #to_wkt
Constructor Details
#initialize(source_cs, target_cs, *optional) ⇒ CoordinateTransform
Initialize a new CoordinateTransform
Note this class should not be used directly since it does not implement any transformation logic. It merely defines what methods actual implementations must use.
1428 1429 1430 1431 1432 |
# File 'lib/rgeo/coord_sys/cs/entities.rb', line 1428 def initialize(source_cs, target_cs, *optional) super(optional) @source_cs = source_cs @target_cs = target_cs end |
Instance Attribute Details
#source_cs ⇒ Object
Returns the value of attribute source_cs.
1433 1434 1435 |
# File 'lib/rgeo/coord_sys/cs/entities.rb', line 1433 def source_cs @source_cs end |
#target_cs ⇒ Object
Returns the value of attribute target_cs.
1433 1434 1435 |
# File 'lib/rgeo/coord_sys/cs/entities.rb', line 1433 def target_cs @target_cs end |
Class Method Details
.create(source_cs, target_cs, *optional) ⇒ CoordinateTransform
Initialize a new CoordinateTransform
Note this class should not be used directly since it does not implement any transformation logic. It merely defines what methods actual implementations must use.
1545 1546 1547 |
# File 'lib/rgeo/coord_sys/cs/entities.rb', line 1545 def create(source_cs, target_cs, *optional) new(source_cs, target_cs, optional) end |
Instance Method Details
#area_of_use ⇒ String
Human readable description of domain in source coordinate system.
1450 1451 1452 |
# File 'lib/rgeo/coord_sys/cs/entities.rb', line 1450 def area_of_use raise NotImplementedError, "#{__method__} is not implemented in the abstract CoordinateTransform class." end |
#codomain_convex_hull(points) ⇒ Array<<Array<Integer>>]
Gets transformed convex hull. The supplied ordinates are interpreted as a sequence of points, which generates a convex hull in the source space. The returned sequence of ordinates represents a convex hull in the output space. The number of output points will often be different from the number of input points. Each of the input points should be inside the valid domain (this can be checked by testing the points’ domain flags individually). However, the convex hull of the input points may go outside the valid domain. The returned convex hull should contain the transformed image of the intersection of the source convex hull and the source domain.
1504 1505 1506 |
# File 'lib/rgeo/coord_sys/cs/entities.rb', line 1504 def codomain_convex_hull(points) raise NotImplementedError, "#{__method__} is not implemented in the abstract CoordinateTransform class." end |
#dim_source ⇒ Integer
Dimension of the source_cs
1464 1465 1466 |
# File 'lib/rgeo/coord_sys/cs/entities.rb', line 1464 def dim_source source_cs.dimension end |
#dim_target ⇒ Integer
Dimension of the target_cs
1471 1472 1473 |
# File 'lib/rgeo/coord_sys/cs/entities.rb', line 1471 def dim_target target_cs.dimension end |
#domain_flags(points) ⇒ Array<Integer>
Gets flags classifying domain points within a convex hull. The supplied ordinates are interpreted as a sequence of points, which generates a convex hull in the source space. Conceptually, each of the (usually infinite) points inside the convex hull is then tested against the source domain. The flags of all these tests are then combined. In practice, implementations of different transforms will use different short-cuts to avoid doing an infinite number of tests.
1490 1491 1492 |
# File 'lib/rgeo/coord_sys/cs/entities.rb', line 1490 def domain_flags(points) raise NotImplementedError, "#{__method__} is not implemented in the abstract CoordinateTransform class." end |
#identity? ⇒ Boolean
Tests whether this transform does not move any points
1478 1479 1480 |
# File 'lib/rgeo/coord_sys/cs/entities.rb', line 1478 def identity? raise NotImplementedError, "#{__method__} is not implemented in the abstract CoordinateTransform class." end |
#inspect ⇒ Object
1443 1444 1445 |
# File 'lib/rgeo/coord_sys/cs/entities.rb', line 1443 def inspect "#<#{self.class}:0x#{object_id.to_s(16)} @source_cs=#{source_cs.to_wkt} @target_cs=#{target_cs.to_wkt}>" end |
#inverse ⇒ CoordinateTransform
Creates the inverse transform of this object. This method may fail if the transform is not one to one. However, all cartographic projections should succeed.
1530 1531 1532 |
# File 'lib/rgeo/coord_sys/cs/entities.rb', line 1530 def inverse self.class.create(target_cs, source_cs) end |
#transform_coords(x, y, z = nil) ⇒ Array<Integer>
Transforms a coordinate point. The passed parameter point should not be modified.
1514 1515 1516 |
# File 'lib/rgeo/coord_sys/cs/entities.rb', line 1514 def transform_coords(x, y, z = nil) raise NotImplementedError, "#{__method__} is not implemented in the abstract CoordinateTransform class." end |
#transform_list(points) ⇒ Array<Array<Integer>>
Transforms a coordinate point. The passed parameter point should not be modified.
1522 1523 1524 |
# File 'lib/rgeo/coord_sys/cs/entities.rb', line 1522 def transform_list(points) points.map { |x, y, z| transform_coords(x, y, z) } end |
#transform_type ⇒ String
Semantic type of transform. For example, a datum transformation or a coordinate conversion.
1457 1458 1459 |
# File 'lib/rgeo/coord_sys/cs/entities.rb', line 1457 def transform_type raise NotImplementedError, "#{__method__} is not implemented in the abstract CoordinateTransform class." end |
#wkt_typename ⇒ Object
TODO: This changes depending on what type of conversion is done and we can’t know unless we implement the conversion ourselves. We should delegate all of the wkt generation to the library if possible.
1439 1440 1441 |
# File 'lib/rgeo/coord_sys/cs/entities.rb', line 1439 def wkt_typename "CONVERSION" end |