コード例 #1
0
define(function(require) {

	var Node = require('nodes/Node');
	var $ = require('jquery');

	return Node.Model.extend({
		properties : {},
		_metaType : "ConnectionNode",
		entityInstancePath : null,
		type : null,

		/**
		 * Initializes this node with passed attributes
		 * 
		 * @param {Object} options - Object with options attributes to initialize
		 *                           node
		 */
		initialize : function(options) {
			this.id = options.id;
			this.entityInstancePath = options.entityInstancePath;
			this.type = options.type;
			this.instancePath = options.instancePath;
		},

		/**
		 * Get type of connection
		 * 
		 * @command ConnectionNode.getType()
		 * @returns {String} Entity ID for this connection 
		 */
		getEntityId : function() {
			return this.entityInstancePath;
		},
		
		/**
		 * Get type of connection
		 * 
		 * @command ConnectionNode.getType()
		 * @returns {String} Type of connection
		 */
		getType : function() {
			return this.type;
		},

		/**
		 * Print out formatted node
		 */
		print : function() {
			return "Id : " + this.id + "\n" 
					+ "    EntityInstancePath : " + this.entityInstancePath + "\n"
					+ "    Type : " + this.type + "\n";
		}
	});
});
コード例 #2
0
define(function(require) {

	var Node = require('nodes/Node');

	return Node.Model.extend({
		value : "",

		/**
		 * Initializes this node with passed attributes
		 * 
		 * @param {Object} options - Object with options attributes to initialize
		 *                           node
		 */
		initialize : function(options) {
			this.name = options.name;
			this.id = options.id;
			this.instancePath = options.instancePath;
			this.text = options.text;
			this.value = options.value;
			this._metaType = options._metaType;
			this.domainType = options.domainType;
		},

		/**
		 * Get value of quantity
		 * 
		 * @command ParameterSpecificationNode.getValue()
		 * @returns {String} Value of quantity
		 */
		getValue : function() {
			return this.value;
		},
		
		/**
		 * Print out formatted node
		 */
		print : function() {
			return "ID : " + this.name + "\n" 
					+ "    Name : " + this.name + "\n"
					+ "    value : " + this.text + "\n";
		}
	});
});
コード例 #3
0
define(function(require) {

	var Node = require('nodes/Node');

	return Node.Model.extend({
		properties : {},

		/**
		 * Initializes this node with passed attributes
		 * 
		 * @param {Object} options - Object with options attributes to initialize
		 *                           node
		 */
		initialize : function(options) {
			this.properties = options.properties;
			this.name = options.name;
			this.id = options.id;
			this.instancePath = options.instancePath;
			this.domainType = options.domainType;
			this._metaType = options._metaType;
		},

		/**
		 * Get properties for this node
		 * 
		 * @command ParameterNode.getProperties()
		 * @returns {String} Unit for quantity
		 */
		getProperties : function() {
			return this.properties;
		},

		/**
		 * Print out formatted node
		 */
		print : function() {
			return "Name : " + this.name + "\n" + "    Id: " + this.id + "\n"
					+ "    InstancePath : " + this.instancePath + "\n"
					+ "    Properties : " + this.properties + "\n";
		}
	});
});
コード例 #4
0
define(function(require) {

	var Node = require('nodes/Node');

	return Node.Model.extend({
		parameter : "",
		color : "",

		/**
		 * Initializes this node with passed attributes
		 * 
		 * @param {Object} options - Object with options attributes to initialize
		 *                           node
		 */
		initialize : function(options) {
			this.parameter = options.parameter;
			this.color = options.color;
			this.name = options.name;
			this.id = options.id;
			this.instancePath = options.instancePath;
			this.domainType = options.domainType;
			this._metaType = options._metaType;
		},

		/**
		 * Get value of quantity
		 * 
		 * @command VisualGroupElementNode.getValue()
		 * @returns {String} Value of quantity
		 */
		getValue : function() {
			if(this.parameter == "" || this.parameter==undefined){
				return null;
			}
			return this.parameter.value;
		},
		
		/**
		 * Get unit of quantity
		 * 
		 * @command VisualGroupElementNode.getUnit()
		 * @returns {String} Unit of quantity
		 */
		getUnit : function() {
			if(this.parameter == "" || this.parameter==undefined){
				return null;
			}
			return this.parameter.unit;
		},

		/**
		 * Get scaling factor
		 * 
		 * @command VisualGroupElementNode.getScalingFactor()
		 * @returns {String} Scaling Factor for value and unit
		 */
		getScalingFactor : function() {
			if(this.parameter == "" || this.parameter==undefined){
				return null;
			}
			return this.parameter.scalingFactor;
		},
		
		/**
		 * Get color of element
		 * 
		 * @command VisualGroupElementNode.getValue()
		 * @returns {String} Color of VisualGroupElementNode
		 */
		getColor : function() {
			return this.color;
		},
		
		show : function(mode){
			var visualizationTree = this.getParent().getParent();
			
			var findVisTree = false;
			while(!findVisTree){
				if(visualizationTree._metaType!= GEPPETTO.Resources.ASPECT_SUBTREE_NODE){
					visualizationTree = visualizationTree.getParent();
				}
				else{
					findVisTree = true;
				}
			}
			
			if(mode){
				GEPPETTO.SceneController.split(visualizationTree.getParent().getInstancePath());
			}
			else{
				GEPPETTO.SceneController.merge(visualizationTree.getParent().getInstancePath());
			}
			
			var group = {};
			group[this.getId()] = {};
			group[this.getId()].color = this.getColor();
			
			GEPPETTO.SceneController.showVisualGroups(visualizationTree, group,mode);			
		},

		/**
		 * Print out formatted node
		 */
		print : function() {
			return "Name : " + this.name + "\n" + "    Id: " + this.id + "\n"
					+ "    InstancePath : " + this.instancePath + "\n"
					+ "    Properties : " + this.properties + "\n";
		}
	});
});
コード例 #5
0
define(function(require) {

	var Node = require('nodes/Node');
	var $ = require('jquery');

	return Node.Model.extend({
		unit : "",
		value : "",
		scalingFactor : "",
		_metaType : "ParameterSpecificationNode",

		/**
		 * Initializes this node with passed attributes
		 * 
		 * @param {Object} options - Object with options attributes to initialize
		 *                           node
		 */
		initialize : function(options) {
			this.name = options.name;
			this.id = options.id;
			this.unit = options.unit;
			this.instancePath = options.instancePath;
			this.value = options.value;
			this.scalingFactor = options.scalingFactor;
		},

		/**
		 * Get the type of tree this is
		 * 
		 * @command ParameterSpecificationNode.getUnit()
		 * @returns {String} Unit for quantity
		 */
		getUnit : function() {
			return this.unit;
		},

		/**
		 * Get value of quantity
		 * 
		 * @command ParameterSpecificationNode.getValue()
		 * @returns {String} Value of quantity
		 */
		getValue : function() {
			return this.value;
		},

		/**
		 * Get scaling factor
		 * 
		 * @command ParameterSpecificationNode.getScalingFactor()
		 * @returns {String} Scaling Factor for value and unit
		 */
		getScalingFactor : function() {
			return this.scalingFactor;
		},

		/**
		 * Print out formatted node
		 */
		print : function() {
			return "Name : " + this.name + "\n" + "    Id: " + this.id + "\n"
					+ "    InstancePath : " + this.instancePath + "\n"
					+ "    Value : " + this.value + "\n" + "    Unit : "
					+ this.unit + "\n" + "    ScalingFactor : "
					+ this.scalingFactor + "\n";
		}
	});
});
コード例 #6
0
define(function(require) {

	var Node = require('nodes/Node');
	var VisualObjectReferenceNode = require('nodes/VisualObjectReferenceNode');

	return Node.Model.extend({
		relations : [ {
			type : Backbone.Many,
			key : 'customNodes',
			relatedModel : Node,
		}, {
			type : Backbone.Many,
			key : 'visualObjectReferenceNodes',
			relatedModel : VisualObjectReferenceNode
		}],

		defaults : {
			customNodes : [],
			visualObjectReferenceNodes : [],
		},

		entityInstancePath : null,
		type : null,
		highlighted : null,

		/**
		 * Initializes this node with passed attributes
		 * 
		 * @param {Object} options - Object with options attributes to initialize
		 *                           node
		 */
		initialize : function(options) {
			this.id = options.id;
			this.entityInstancePath = options.entityInstancePath;
			this.type = options.type;
			this.name = options.name;
			this.instancePath = options.instancePath;
			this._metaType = options._metaType;
			this.domainType = options.domainType;
		},

		/**
		 * Get Instance path of entity this connection is connected to
		 * 
		 * @command ConnectionNode.getEntityInstancePath()
		 * @returns {String} Entity instance patch for entity this connection 
		 *                   is connected to
		 */
		getEntityInstancePath : function() {
			return this.entityInstancePath;
		},
		
		/**
		 * Get type of connection
		 * 
		 * @command ConnectionNode.getType()
		 * @returns {String} Type of connection
		 */
		getType : function() {
			return this.type;
		},

		/**
		 * Returns array of custom nodes for this connection
		 * 
		 * @command ConnectionNode.getCustomNodes()
		 * @returns {Array} Array of nodes for custom properties of connection node.
		 */
		getCustomNodes : function(){
			return this.get("customNodes").models;
		},
		
		/**
		 * Returns array of visual object reference nodes for this connection
		 * @command ConnectionNode.getVisualObjectReferenceNodes()
		 * @returns {Array} Array of nodes for visual object references
		 */
		getVisualObjectReferenceNodes : function(){
			return this.get("visualObjectReferenceNodes").models;
		},
		
		/**
		 * Highlight the visual references of this connection
		 * @command ConnectionNode.highlight()
		 * @param {boolean} - Highlight or unhighlight reference nodes
		 */
		highlight : function(mode){
			
			if(mode == null || mode == undefined){
				return GEPPETTO.Resources.MISSING_PARAMETER;
			}
			
			var references = this.getVisualObjectReferenceNodes();
			var message = GEPPETTO.Resources.HIGHLIGHTING + this.id;
			
			if(references.length > 0){
				//highlight all reference nodes
				for(var ref in references){
					references[ref].highlight(mode);
				}
			}else{
				message = GEPPETTO.Resources.NO_REFERENCES_TO_HIGHLIGHT;
			}
			
			this.highlighted = mode;
			Simulation.highlightedConnections[this.getInstancePath()] = this;
						
			return message;
		},
		
		/**
		 * Show lines for connections of this entity
		 * @command ConnectionNode.showConnectionsLine()
		 */
		showConnectionsLine : function(mode){
			var from;
			var to;
			GEPPETTO.SceneController.drawLine(from,to);
		},
		
		/**
		 * Get this entity's children entities
		 * 
		 * @command ConnectionNode.getChildren()
		 * @returns {List<Aspect>} All children e.g. aspects and
		 *          entities
		 * 
		 */
		getChildren : function() {
			 var children = new Backbone.Collection();
			 children.add(this.get("customNodes").models);
			 children.add(this.get("visualObjectReferenceNodes").models);
			 return children;
		},
		
		/**
		 * Print out formatted node
		 * @command EntityNode.print()
		 */
		print : function() {
			return "Id : " + this.id + "\n" 
					+ "    Name : " + this.name + "\n"
					+ "    EntityInstancePath : " + this.entityInstancePath + "\n"
					+ "    Type : " + this.type + "\n";
		}
	});
});