module OGR::GeometryTypes::Curve::Extensions
Public Instance Methods
closed?()
click to toggle source
# File lib/ogr/extensions/geometry_types/curve/extensions.rb, line 59 def closed? start_point == end_point end
each_point_geometry() { |point_as_geometry(point_num)| ... }
click to toggle source
@return [Enumerator] @yieldparam [OGR::Point]
# File lib/ogr/extensions/geometry_types/curve/extensions.rb, line 26 def each_point_geometry return enum_for(:each_point_geometry) unless block_given? point_count.times do |point_num| yield point_as_geometry(point_num) end end
end_point()
click to toggle source
# File lib/ogr/extensions/geometry_types/curve/extensions.rb, line 55 def end_point point(point_count - 1) end
pixels(geo_transform)
click to toggle source
@param geo_transform [GDAL::GeoTransform] @return [Array<Array>]
# File lib/ogr/extensions/geometry_types/curve/extensions.rb, line 42 def pixels(geo_transform) log "points count: #{point_count}" points.map do |x_and_y| result = geo_transform.world_to_pixel(*x_and_y) [result[:pixel].to_i.abs, result[:line].to_i.abs] end end
point_geometries()
click to toggle source
@return [Array<OGR::Point>] @see each_point_geometry
, point_geometry
# File lib/ogr/extensions/geometry_types/curve/extensions.rb, line 36 def point_geometries each_point_geometry.to_a end
point_geometry(number)
click to toggle source
It seems as if {{#point}} should return an OGR::Point
, but since OGR’s OGR_G_GetPoint only returns coordinates, this allows getting the point as an OGR::Point
.
@param number [Integer] Index of the point to get. @return [OGR::Point]
# File lib/ogr/extensions/geometry_types/curve/extensions.rb, line 16 def point_geometry(number) coords = point(number) point = OGR::Point.new point.set_point(0, *coords) point end
start_point()
click to toggle source
# File lib/ogr/extensions/geometry_types/curve/extensions.rb, line 51 def start_point point(0) end