コード例 #1
0
ファイル: utils.cpp プロジェクト: aaronpdennis/node-osmium
    v8::Handle<v8::Value> create_js_box(const osmium::Box& box) {
        v8::HandleScope scope;

        if (!box.valid()) {
            return scope.Close(v8::Undefined());
        }

        auto cf = module->Get(symbol_Coordinates);
        assert(cf->IsFunction());
        auto bf = module->Get(symbol_Box);
        assert(bf->IsFunction());

        v8::Local<v8::Value> argv_bl[2] = { v8::Number::New(box.bottom_left().lon()), v8::Number::New(box.bottom_left().lat()) };
        auto bottom_left = v8::Local<v8::Function>::Cast(cf)->NewInstance(2, argv_bl);

        v8::Local<v8::Value> argv_tr[2] = { v8::Number::New(box.top_right().lon()), v8::Number::New(box.top_right().lat()) };
        auto top_right = v8::Local<v8::Function>::Cast(cf)->NewInstance(2, argv_tr);

        v8::Local<v8::Value> argv_box[2] = { bottom_left, top_right };
        return scope.Close(v8::Local<v8::Function>::Cast(bf)->NewInstance(2, argv_box));
    }
コード例 #2
0
ファイル: crc.hpp プロジェクト: knowname/libosmium
 void update(const osmium::Box& box) {
     update(box.bottom_left());
     update(box.top_right());
 }
コード例 #3
0
 /**
  * Check whether one geometry overlaps another.
  */
 inline bool overlaps(const osmium::Box& lhs, const osmium::Box& rhs) noexcept {
     return ((lhs.bottom_left().x() <= rhs.top_right().x()) &&
             (lhs.bottom_left().y() <= rhs.top_right().y()) &&
             (rhs.bottom_left().x() <= lhs.top_right().x()) &&
             (rhs.bottom_left().y() <= lhs.top_right().y()));
 }