The view model for the data catalog.

@param {Terria} terria The Terria instance.

@alias Catalog
@constructor
9229
function(terria) {
  if (!defined(terria)) {
    throw new DeveloperError("terria is required");
  }

  this._terria = terria;
  this._shareKeyIndex = {};

  this._group = new CatalogGroup(terria);
  this._group.name = "Root Group";
  this._group.preserveOrder = true;

  /**
   * Gets or sets a flag indicating whether the catalog is currently loading.
   * @type {Boolean}
   */
  this.isLoading = false;

  this._chartableItems = [];

  knockout.track(this, ["isLoading", "_chartableItems"]);

  knockout.defineProperty(this, "userAddedDataGroup", {
    get: this.upsertCatalogGroup.bind(
      this,
      CatalogGroup,
      USER_ADDED_CATEGORY_NAME,
      "The group for data that was added by the user via the Add Data panel."
    )
  });

  /**
   * Array of the items that should be shown as a chart.
   */
  knockout.defineProperty(this, "chartableItems", {
    get: function() {
      return this._chartableItems;
    }
  });
}
723663
function ERDRelationshipView() {
        type.EdgeView.apply(this, arguments);
        this.lineStyle = PreferenceManager.get("erd.relationship.lineStyle", Core.LS_ROUNDRECT) || PreferenceManager.get("view.lineStyle", Core.LS_OBLIQUE);

        this.headEndStyle = Core.ES_CROWFOOT_ONE;
        this.tailEndStyle = Core.ES_CROWFOOT_ONE;

        /** @member {EdgeLabelView} */
        this.nameLabel = new type.EdgeLabelView();
        this.nameLabel.hostEdge = this;
        this.nameLabel.edgePosition = Core.EP_MIDDLE;
        this.nameLabel.distance = 15;
        this.nameLabel.alpha = Math.PI / 2;
        this.addSubView(this.nameLabel);

        /** @member {EdgeLabelView} */
        this.tailNameLabel = new type.EdgeLabelView();
        this.tailNameLabel.hostEdge = this;
        this.tailNameLabel.edgePosition = Core.EP_TAIL;
        this.tailNameLabel.alpha = Math.PI / 6;
        this.tailNameLabel.distance = 30;
        this.addSubView(this.tailNameLabel);

        /** @member {EdgeLabelView} */
        this.headNameLabel = new type.EdgeLabelView();
        this.headNameLabel.hostEdge = this;
        this.headNameLabel.edgePosition = Core.EP_HEAD;
        this.headNameLabel.alpha = -Math.PI / 6;
        this.headNameLabel.distance = 30;
        this.addSubView(this.headNameLabel);
    }
256617
def create(*catalog_roots)
      fs = [@db_filepath, @db_log_filepath, @config_filepath]
      fs.each do |f|
        FileUtils.rm(f) if File.exist?(f)
      end

      if File.exist? @config_filepath
        raise SimpleCatalogerError, "cannot create already existent catalog '#{@name}'"
      end
      @config = {
          :roots   => catalog_roots,
          :ignore  => %w{sub subtitles images},
          :version => DirCat::VERSION
      }
      write_config

      #
      # migrate db
      #
      # TODO: drop tables!
      ActiveRecord::Base.establish_connection(@active_record_config)
      ActiveRecord::Migration.verbose = ENV["VERBOSE"] ? ENV["VERBOSE"] == "true" : false
      migration_dir = File.join(File.dirname(__FILE__), %w{migration})
      unless Dir.exist? migration_dir
        raise "migration dir '#{migration_dir}' not exists"
      end
      ActiveRecord::Migrator.migrate(migration_dir, ENV["VERSION"] ? ENV["VERSION"].to_i : nil)
      require_models
    end
660578
function addLocationMarker(terria, initSources) {
  if (defined(terria.locationMarker)) {
    const position = terria.locationMarker.entities.values[0].position.getValue();
    const positionDegrees = Ellipsoid.WGS84.cartesianToCartographic(position);

    initSources.push({
      locationMarker: {
        name: terria.locationMarker.entities.values[0].name,
        latitude: CesiumMath.toDegrees(positionDegrees.latitude),
        longitude: CesiumMath.toDegrees(positionDegrees.longitude)
      }
    });
  }
}
452196
function Views(options) {
  Collection.call(this, options);
  this.options.collection = this.options.collection || this;
  this.define('View', this.options.View || require('./view'));
  this.define('Item', this.View);
}
128717
function(terria, map) {
  GlobeOrMap.call(this, terria);

  /**
   * Gets or sets the Leaflet {@link Map} instance.
   * @type {Map}
   */
  this.map = map;

  this.scene = new LeafletScene(map);

  /**
   * Gets or sets whether this viewer _can_ show a splitter.
   * @type {Boolean}
   */
  this.canShowSplitter = true;

  /**
   * Gets the {@link LeafletDataSourceDisplay} used to render a {@link DataSource}.
   * @type {LeafletDataSourceDisplay}
   */
  this.dataSourceDisplay = undefined;

  this._tweens = new TweenCollection();
  this._tweensAreRunning = false;
  this._selectionIndicatorTween = undefined;
  this._selectionIndicatorIsAppearing = undefined;

  this._pickedFeatures = undefined;
  this._selectionIndicator = L.marker([0, 0], {
    icon: L.divIcon({
      className: "",
      html:
        '<img src="' +
        selectionIndicatorUrl +
        '" width="50" height="50" alt="" />',
      iconSize: L.point(50, 50)
    }),
    zIndexOffset: 1, // We increment the z index so that the selection marker appears above the item.
    interactive: false,
    keyboard: false
  });
  this._selectionIndicator.addTo(this.map);
  this._selectionIndicatorDomElement = this._selectionIndicator._icon.children[0];

  this._dragboxcompleted = false;
  this._pauseMapInteractionCount = 0;

  this.scene.featureClicked.addEventListener(
    featurePicked.bind(undefined, this)
  );

  var that = this;

  // if we receive dragboxend (see LeafletDragBox) and we are currently
  // accepting a rectangle, then return the box as the picked feature
  map.on("dragboxend", function(e) {
    var mapInteractionModeStack = that.terria.mapInteractionModeStack;
    if (
      defined(mapInteractionModeStack) &&
      mapInteractionModeStack.length > 0
    ) {
      if (
        mapInteractionModeStack[mapInteractionModeStack.length - 1]
          .drawRectangle &&
        defined(e.dragBoxBounds)
      ) {
        var b = e.dragBoxBounds;
        mapInteractionModeStack[
          mapInteractionModeStack.length - 1
        ].pickedFeatures = Rectangle.fromDegrees(
          b.getWest(),
          b.getSouth(),
          b.getEast(),
          b.getNorth()
        );
      }
    }
    that._dragboxcompleted = true;
  });

  map.on("click", function(e) {
    if (!that._dragboxcompleted && that.map.dragging.enabled()) {
      pickFeatures(that, e.latlng);
    }
    that._dragboxcompleted = false;
  });

  this._selectedFeatureSubscription = knockout
    .getObservable(this.terria, "selectedFeature")
    .subscribe(function() {
      selectFeature(this);
    }, this);

  this._splitterPositionSubscription = knockout
    .getObservable(this.terria, "splitPosition")
    .subscribe(function() {
      this.updateAllItemsForSplitter();
    }, this);

  this._showSplitterSubscription = knockout
    .getObservable(terria, "showSplitter")
    .subscribe(function() {
      this.updateAllItemsForSplitter();
    }, this);

  map.on("layeradd", function(e) {
    that.updateAllItemsForSplitter();
  });

  map.on("move", function(e) {
    that.updateAllItemsForSplitter();
  });

  this._initProgressEvent();

  selectFeature(this);
}
406409
function UMLCustomFrameView() {
        NodeView.apply(this, arguments);

        /** @member {LabelView} */
        this.nameLabel = new LabelView();
        this.nameLabel.parentStyle = true;
        this.addSubView(this.nameLabel);

        /** @member {LabelView} */
        this.frameTypeLabel = new LabelView();
        this.frameTypeLabel.parentStyle = true;
        this.addSubView(this.frameTypeLabel);
    }
826254
function addUserAddedCatalog(terria, initSources) {
  const localDataFilterRemembering = rememberRejections(
    CatalogMember.itemFilters.noLocalData
  );

  const userAddedCatalog = terria.catalog.serializeToJson({
    itemFilter: combineFilters([
      localDataFilterRemembering.filter,
      CatalogMember.itemFilters.userSuppliedOnly,
      function(item) {
        // If the parent has a URL then this item will just load from that, so don't bother serializing it.
        // Properties that change when an item is enabled like opacity will be included in the shared members
        // anyway.
        return !item.parent || !item.parent.url;
      }
    ])
  });

  // Add an init source with user-added catalog members.
  if (userAddedCatalog.length > 0) {
    initSources.push({
      catalog: userAddedCatalog
    });
  }

  return localDataFilterRemembering.rejections;
}
705394
function(terria, url) {
  CatalogItem.call(this, terria);

  this._geoJsonItem = undefined;

  this.url = url;

  /**
   * Gets or sets the Gpx data, represented as a binary Blob, DOM Document, or a Promise for one of those things.
   * If this property is set, {@link CatalogItem#url} is ignored.
   * This property is observable.
   * @type {Blob|Document|Promise}
   */
  this.data = undefined;

  /**
   * Gets or sets the URL from which the {@link GpxCatalogItem#data} was obtained.  This may be used
   * to resolve any resources linked in the Gpx file, if any.
   * @type {String}
   */
  this.dataSourceUrl = undefined;

  knockout.track(this, ["data", "dataSourceUrl"]);
}
1339595
function convertJSONViews(jsonViews, configuration) {
  if (!jsonViews) {
    return jsonViews;
  }

  const viewCatalog = configuration.views || {};

  jsonViews = Array.isArray(jsonViews) ? jsonViews : [jsonViews];
  return jsonViews
    .map(jsonView => {
      // Try to find a view definition
      const View = viewCatalog[jsonView.type] || DEFAULT_VIEW_CATALOG[jsonView.type];
      // Instantiate it
      if (View) {
        const viewProps = Object.assign({}, jsonView);
        delete viewProps.type;
        return new View(viewProps);
      }
      return null;
    })
    .filter(Boolean);
}
279464
function() {
      var newItemViews = [];
      _.each(this.modelsToRender(), function(model, indexOfModel) {
        var itemView = this.getItemViewFromModel(model);
        if (!itemView) {
          newItemViews.push({
            view: this.__createItemView(model, true),
            indexOfModel: indexOfModel
          });
        }
      }, this);
      this.__updateOrderedModelIdList();
      return newItemViews;
    }
1020547
function(el) {
			var mythis = this;

			this.source.colSortIdx = el.data('col-idx');
			this.source.columns[el.data('col-idx')].dir = this.source.columns[el.data('col-idx')].dir == 'asc' ? 'desc' : 'asc';

			this.source.update(function() {
				mythis.render();
			});
		}
1161873
function(terria) {
  ImageryLayerCatalogItem.call(this, terria);

  /**
   * Gets or sets the file extension used to retrieve Open Street Map data
   * This property is observable.
   * @type {String}
   */
  this.fileExtension = "png";

  /**
   * Gets or sets the maximum tile level to retrieve from Open Street Map data
   * This property is observable.
   * @type {String}
   */
  this.maximumLevel = 25;

  /**
   * Gets or sets the attribution to display with the data
   * This property is observable.
   * @type {String}
   */
  this.attribution = undefined;

  /**
   * Gets or sets the array of subdomains, one of which will be prepended to each tile URL.
   * This property is observable.
   * @type {Array}
   */
  this.subdomains = undefined;

  knockout.track(this, ["fileExtension", "maximumLevel", "attribution"]);
}
230777
function createViewmodel(name,component,params,pre,post)
      {
        /* creates blank observable data set */
        var obsv = _mixed({},name);

        /* Attach Pre properties, or pre designed attachments for every Data set */
        for(var x=0,keys=Object.keys(pre),len=keys.length;x<len;x++)
        {
          if(_ignoreList.indexOf(keys[x]) !== -1)
          {
            Object.defineProperty(obsv,keys[x],setDescriptor(pre[keys[x]],(keys[x] !== 'filters')));
          }
          else
          {
            if(pre.pointers)
            {
              if(pre.pointers[keys[x]] === undefined) obsv.set(keys[x],pre[keys[x]]);
            }
            else
            {
              obsv.set(keys[x],pre[keys[x]]);
            }
          }
        }
        
        if(pre.pointers)
        {
          if(!obsv.pointers) Object.defineProperty(obsv,'pointers',setDescriptor({},false,true));
          for(var x=0,keys=Object.keys(pre.pointers),len=keys.length;x<len;x++)
          {
            obsv.pointers[keys[x]] = pre.pointers[keys[x]];
            obsv.addPointer(obsv.pointers[keys[x]].point,obsv.pointers[keys[x]].key,keys[x]);
          }
        }
        
        /* if there are any prototypes on this component they are added to the Data sets prototype */
        for(var x=0,keys=Object.keys(component.prototype),len=keys.length;x<len;x++)
        {
          Object.defineProperty(obsv,[keys[x]],setDescriptor(component.prototype[keys[x]],true));
        }
        
        /* we then apply the component constructor to the data set in order to add the 'this' properties from it and pass in the params */
        component.apply(obsv,params);
        
        /* Post attachments, overwritables, for data or pointers */
        for(var x=0,keys=Object.keys(post),len=keys.length;x<len;x++)
        {
          if(_ignoreList.indexOf(keys[x]) !== -1)
          {
            Object.defineProperty(obsv,keys[x],setDescriptor(post[keys[x]],(keys[x] !== 'filters')));
          }
          else
          {
            if(post.pointers)
            {
              if(post.pointers[keys[x]] === undefined) obsv.set(keys[x],post[keys[x]]);
            }
            else
            {
              obsv.set(keys[x],post[keys[x]]);
            }
          }
        }
        
        /* post pointers */
        if(post.pointers)
        {
          if(!obsv.pointers) Object.defineProperty(obsv,'pointers',setDescriptor({},false,true));
          for(var x=0,keys=Object.keys(post.pointers),len=keys.length;x<len;x++)
          {
            obsv.pointers[keys[x]] = post.pointers[keys[x]];
            obsv.addPointer(obsv.pointers[keys[x]].point,obsv.pointers[keys[x]].key,keys[x]);
          }
        }
        
        /* map filters as binded to vm */
        for(var x=0,keys=Object.keys(obsv.filters),len=keys.length;x<len;x++)
        {
          obsv.filters[keys[x]] = obsv.filters[keys[x]].bind(obsv);
        }

        /* Apply session storage if set, this allows for storing this vm in session storage, only those values that are enumerable */
        if(obsv.sessionStorage)
        {
            var storage = sessionStorage.getItem((obsv.id || name));
            
            /* load storage into the data set if it is set */
            if(storage)
            {
                storage = JSON.parse(storage);
                for(var x=0,keys=Object.keys(storage),len=keys.length;x<len;x++)
                {
                    obsv.set(keys[x],storage[keys[x]]);
                }
            }
          
            /* set the storage object with the defaults */
            else
            {
                sessionStorage.setItem((obsv.id || name),obsv.stringify());
            }
          
            /* if any data updates then the storage will be updated along with it */
            obsv.addChildDataUpdateListener('*',function(){
                sessionStorage.setItem((obsv.id || name),obsv.stringify());
            });
        }

        /* Apply local storage if set, similiar to session Storage except this persists even after browser is closed */
        if(obsv.localStorage)
        {
            var storage = localStorage.getItem((obsv.id || name));
          
            /* load storage into the data set if it is set */
            if(storage)
            {
                storage = JSON.parse(storage);
                for(var x=0,keys=Object.keys(storage),len=keys.length;x<len;x++)
                {
                    obsv.set(keys[x],storage[keys[x]]);
                }
            }
          
            /* set the storage object with the defaults */
            else
            {
                localStorage.setItem((obsv.id || name),obsv.stringify());
            }
          
            /* if any data updates then the storage will be updated along with it */
            obsv.addChildDataUpdateListener('*',function(){
                localStorage.setItem((obsv.id || name),obsv.stringify());
            });
        }
        
        if(obsv.store)
        {
            /* adds a pointer in model to this viewmodel, look into using id as an id from component: <test id="storeid"></test> */
            _model.set((obsv.id || name),obsv);
        }

        return obsv;
      }
1137983
function UMLEnumerationView() {
        UMLClassifierView.apply(this, arguments);

        /** @member {boolean} */
        this.suppressLiterals = false;

        /** @member {UMLEnumerationLiteralCompartmentView} */
        this.enumerationLiteralCompartment = new UMLEnumerationLiteralCompartmentView();
        this.enumerationLiteralCompartment.parentStyle = true;
        this.addSubView(this.enumerationLiteralCompartment);

        this.fillColor  = PreferenceManager.get("uml.enumeration.fillColor", "#ffffff") || PreferenceManager.get("view.fillColor", "#ffffff");
        this.stereotypeDisplay  = PreferenceManager.get("uml.enumeration.stereotypeDisplay", UML.SD_LABEL);
        this.suppressAttributes = PreferenceManager.get("uml.enumeration.suppressAttributes", true);
        this.suppressOperations = PreferenceManager.get("uml.enumeration.suppressOperations", true);
        this.suppressLiterals   = PreferenceManager.get("uml.enumeration.suppressLiterals", false);
    }
505434
function initViews () {
    // list of views - may be empty
    this.modelViews = []
    // if view is false no model views will be applied overriding any defaults
    if (this.args.view === false) {
        return
    }
    // get view from args or default
    var viewArg = defined(this.args.view) ? this.args.view : this.model.views.default
    // skip unless view arg is set from args or default
    if (!defined(viewArg)) {
        return
    }
    // list of views to apply to model
    var views
    // if view is string then convert to array
    if (typeof viewArg === 'string') {
        views = [viewArg]
    }
    // if view is array use it
    else if (Array.isArray(viewArg)) {
        views = viewArg
    }
    // invalid argument
    else {
        throw this.error('invalid view argument')
    }
    // iterate over views getting model view objects
    _.each(views, view => {
        var modelView = requireValidModelView(view, this.model.views, true)
        // if result is array then add all
        if (Array.isArray(modelView)) {
            _.each(modelView, modelView => this.modelViews.push(modelView))
        }
        // otherwise add object
        else {
            this.modelViews.push(modelView)
        }
    })
    // instantiate model view engine if there are views
    if (this.modelViews.length > 0) {
        this.modelViewEngine = new ImmutableCoreModelViewEngine({query: this})
    }
}
1292744
function(terria, scene, handler, keyboardModifier) {
  this._terria = terria;
  this._scene = scene;
  this._ellipsoid = scene.globe.ellipsoid;
  this._finishHandler = handler;
  this._mouseHandler = new ScreenSpaceEventHandler(scene.canvas, false);
  this._stopHandler = undefined;
  this._interHandler = undefined;
  this._dataSource = undefined;
  this._click1 = undefined;
  this._click2 = undefined;
  this.active = false;
  this.keyboardModifier = defaultValue(
    keyboardModifier,
    KeyboardEventModifier.SHIFT
  );
}