Git Product home page Git Product logo

bimsurfer's Introduction

Copyright 2016, bimsurfer.org
BIM Surfer will be licensed under the MIT License.

New version 2016

In 2016 a new version of BIM Surfer will be released. The code will be build from scratch into a component that can be re-used in other softwaretools. The license will change to MIT license to allow liberal re-use in commercial applications.

At this moment an API is being designed. This file will elaborate about this API and the intended implementation.

Design rationale

A BIM viewer module that can be used by 3d-novices without extensive knowledge on either web-frameworks or 3d frameworks. The example below serves to minimize boilerplate code, but is implemented on top of modular classes that can be instantiated manually as well. Legibility is prefered at all times. Hence, whenever sensible, methods take dictionaries rather than positional arguments

var viewer = new BimSurfer();

// Alternative 1: Load a model from an on-line BIMserver with existing bimserverapi/model:
var bimServerApi = ...// existing bimserverapi
var model = ...// existing bimserverapi model
var viewerModel = viewer.load({bimserverapi: bimserverapi, model: model, query: });

// Alternative 2: Let bimsurfer create a bimsererapi and model
// The load()'ing of a model happens asynchronously. Hence, it
// returns a Promise with a then() function that accepts a 
// method in case of success and (optionally) in case of error.
viewer.load({bimserver: , username: , password: ,
             poid: , roid: , query: }).then(
    function(model) {  },
    function(error) {  }
);

// Alternatively 3: load a model from file:
var model = viewer.load({url: "/path/to/file.glTF"}).then(function(model) {

// getTree() returns a javascript notation of the tree.
// `guid` and `nlevels` allow to only return a subset 
// of the tree for performance reasons.
var tree = model.getTree({guid: , nlevels: }).then(function(tree) {

// Creating a DOM tree is framework specific, but examples
// are provided for various frameworks [1]
// [1] https://github.com/opensourceBIM/bimvie.ws-viewer/
//             blob/master/index.html#L108
var domtree = ;

domtree.on("click", function(oid) {
    viewer.viewFit({ids: [oid]});
});

domtree.on("eye-click", function(oid) {
    viewer.hide([oid]);
});

// Event handlers on the viewer can be subscribed to using the 
// on() method.

function selectionChanged(currentlySelected, selectionChanged) {

}

viewer.on("selection-changed", selectionChanged);

// Event handler can be canceled using the off() method. Possibly
// by using a wildcard to cancel all handlers on a particular
// event.
viewer.off("selection-changed", selectionChanged);
viewer.off("selection-changed", "*");

Advanced usage

The example above favours ease of use over modularity and extensibility. In fact, the code above are merely shortcuts providing sensible defaults to functionally identical behaviour.

var viewer = BimSurfer.Viewer();
// Still not so sure what to do with this
var tree_view = BimSurfer.DojoTreeView();
var canvas = BimSurfer.XeoEngineViewer();
var loader = BimSurfer.BimServerLoader();
var query = BimSurfer.RubenQueryEngine();
var painter = BimSurfer.MaterialColorByEntity();

viewer.addTreeView(tree_view);
viewer.addViewer(canvas);
viewer.addLoader(loader);
viewer.setPainter(painter);

loader.load({bimserver: , username: , password: ,
             poid: , roid: , query: });

API reference

NB: This is the “simple” viewer API NB2: What do we prefer? select/deselect or setSelectionState

The type refers to

  • A numeric identifier (“oid” / objectID in BIMserver jargon)
  • A textual guid (“GUID” / Globally Unique IDentifier in IFC jargon) Users are free to mix and match these types of ids and the viewer will translate between them. Use of numeric identifiers is more efficient, hence numeric ids are returned by the viewer. The user can translate between them with toId() toGuid() respectively.

API concept Sorry that this is a picture. We wanted to get the API out asap, and the markdown syntax dialect for tables just took too long.

bimsurfer's People

Contributors

aothms avatar bastienmenis avatar berlotti avatar bigbim avatar bpimost avatar bryandenijs avatar camel1cz avatar cedeon avatar dlabz avatar rehno-lindeque avatar rubendel avatar stegh avatar tk120404 avatar xeolabs avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.