Beispiel #1
0
function ContextDefCluster(struct, contextCollection, options) {
    struct = struct || {};
    this.G = this.G || options.G || require('app/Global')();

    // Setup and render the cluster
    var defaultClusterOptions = {
        hideRoot: false,
        layoutChange: false,
        hideLabels: false,
        labelIDsOnly: false,
        noCompress: true,

        radiusScaleFactor: 0.4,
        scaleFactor: !this.G.isTablet && this.G.isMobile ? 0.6 : 0.6,
        spaceFactor: 0.7,
        focusAngleArc: 360,
        focusStartAngle: 30,
        childAngleArc: 210,
        maxDepth: null,
        numDetailLevels: 6
    };
    struct.Options = _.extend({}, defaultClusterOptions, struct.Options || {});

    // Call the base constructor
    BaseClusterController.call(this, struct, contextCollection);

    var cluster = this.cluster;

    this.contextCollection.each(function(model) {
        var viewID = model.id;
        if (model.get('Type') == 'ContextDefRoot') {
            // Enable drop only on the root (better to disable on all leaves)
            cluster.setViewState(viewID, {
                dropDisabled: false
            });
        }
    }, this);

    cluster.setFocus(this.rootContextID);
    cluster.setFilterLevel(0, {noRender: true});
    cluster.setRadius(this.getClusterSize());
    this.setPosition();
}
Beispiel #2
0
function AttributeCluster(struct, contextCollection, options) {
    options = options || {};
    this.G = this.G || options.G || require('app/Global')();
    struct = struct || {};

    // Setup and render the cluster
    var defaultClusterOptions = {
        hideRoot: false,
        layoutChange: true,
        hideLabels: false,
        labelIDsOnly: false,
        noCompress: true,

        radiusScaleFactor: 0.4,
        scaleFactor: !this.G.isTablet && this.G.isMobile ? 0.6 : 0.6,
        spaceFactor: 0.7,
        focusAngleArc: 360,
        focusStartAngle: 30,
        childAngleArc: 210,
        maxDepth: null,
        numDetailLevels: 6
    };
    struct.Options = _.extend({}, defaultClusterOptions, struct.Options || {});

    // Call the base constructor
    BaseClusterController.call(this, struct, contextCollection);

    var cluster = this.cluster;
    cluster.setFocus(this.rootContextID);
    cluster.setFilterLevel(0, {noRender: true});
    cluster.setRadius(this.getClusterSize());
    this.setPosition();

    if (this.clusterConfig.clusterSize == 'Expanded') {
        this.setClusterExpanded({render: false});
    }
    else {
        this.setClusterCompact({render: false});
    }
}