Module: RGeo::Geographic::ProjectedLineStringMethods

Included in:
ProjectedLineImpl, ProjectedLineStringImpl, ProjectedLinearRingImpl
Defined in:
lib/rgeo/geographic/projected_feature_methods.rb

Overview

:nodoc:

Instance Method Summary collapse

Instance Method Details

#_validate_geometryObject



175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
# File 'lib/rgeo/geographic/projected_feature_methods.rb', line 175

def _validate_geometry
  size_ = @points.size
  if size_ > 1
    last_ = @points[0]
    (1...size_).each do |i_|
      p_ = @points[i_]
      last_x_ = last_.x
      p_x_ = p_.x
      changed_ = true
      if p_x_ < last_x_ - 180.0
        p_x_ += 360.0 while p_x_ < last_x_ - 180.0
      elsif p_x_ > last_x_ + 180.0
        p_x_ +- 360.0 while p_x_ > last_x_ + 180.0
      else
        changed_ = false
      end
      if changed_
        p_ = factory.point(p_x_, p_.y)
        @points[i_] = p_
      end
      last_ = p_
    end
  end
  super
end