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.
1424 1425 1426 1427 1428 |
# File 'lib/rgeo/coord_sys/cs/entities.rb', line 1424 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.
1429 1430 1431 |
# File 'lib/rgeo/coord_sys/cs/entities.rb', line 1429 def source_cs @source_cs end |
#target_cs ⇒ Object
Returns the value of attribute target_cs.
1429 1430 1431 |
# File 'lib/rgeo/coord_sys/cs/entities.rb', line 1429 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.
1541 1542 1543 |
# File 'lib/rgeo/coord_sys/cs/entities.rb', line 1541 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.
1446 1447 1448 |
# File 'lib/rgeo/coord_sys/cs/entities.rb', line 1446 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.
1500 1501 1502 |
# File 'lib/rgeo/coord_sys/cs/entities.rb', line 1500 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
1460 1461 1462 |
# File 'lib/rgeo/coord_sys/cs/entities.rb', line 1460 def dim_source source_cs.dimension end |
#dim_target ⇒ Integer
Dimension of the target_cs
1467 1468 1469 |
# File 'lib/rgeo/coord_sys/cs/entities.rb', line 1467 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.
1486 1487 1488 |
# File 'lib/rgeo/coord_sys/cs/entities.rb', line 1486 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
1474 1475 1476 |
# File 'lib/rgeo/coord_sys/cs/entities.rb', line 1474 def identity? raise NotImplementedError, "#{__method__} is not implemented in the abstract CoordinateTransform class." end |
#inspect ⇒ Object
1439 1440 1441 |
# File 'lib/rgeo/coord_sys/cs/entities.rb', line 1439 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.
1526 1527 1528 |
# File 'lib/rgeo/coord_sys/cs/entities.rb', line 1526 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.
1510 1511 1512 |
# File 'lib/rgeo/coord_sys/cs/entities.rb', line 1510 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.
1518 1519 1520 |
# File 'lib/rgeo/coord_sys/cs/entities.rb', line 1518 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.
1453 1454 1455 |
# File 'lib/rgeo/coord_sys/cs/entities.rb', line 1453 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.
1435 1436 1437 |
# File 'lib/rgeo/coord_sys/cs/entities.rb', line 1435 def wkt_typename "CONVERSION" end |