⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 test_combinations.rb

📁 在Linux下做的QuadTree的程序
💻 RB
字号:
#!/usr/bin/env rubyrequire 'test/unit'require 'geos'require 'test_helper'class TestGeosCombinations < Test::Unit::TestCase  def setup    @test_helper = GeosTestHelper.new()  end    def run_combination(message, &block)    STDOUT << "\n" << "-------- #{message} COMBINATION  ------" << "\n"    STDOUT.flush()    geoms = @test_helper.create_geoms()    new_geoms = Array.new()        geoms.each do |geom1|      geoms.each do |geom2|        begin          # Get the actual result from the provided block          result = yield(geom1, geom2)          new_geoms.push(result)     #     puts result        # Geometry Collection is not a valid argument        rescue RuntimeError => error          # This is ok        end      end    end  end  def test_union()    run_combination("UNION") do |geom1, geom2|      geom1.union(geom2)    end  end  def test_intersection()    run_combination("INTERSECTION") do |geom1, geom2|      geom1.intersection(geom2)    end  end    def test_difference()    run_combination("DIFFERENCE") do |geom1, geom2|      geom1.difference(geom2)    end  end    def test_symdifference()    run_combination("SYMDIFFERENCE") do |geom1, geom2|      geom1.sym_difference(geom2)    end  endend

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -