Пример #1
0
		public NodeInfo (NodeInfo parent, MemberInfo mi, object instance)
			: this (parent, NodeTypes.Other, mi, instance, null)
		{
			// set type
			switch (mi.MemberType) {
			case MemberTypes.NestedType:
			case MemberTypes.TypeInfo:
				this.type = NodeTypes.Type;
				break;
			case MemberTypes.Constructor:
				this.type = NodeTypes.Constructor;
				break;
			case MemberTypes.Event:
				this.type = NodeTypes.Event;
				break;
			case MemberTypes.Field:
				this.type = NodeTypes.Field;
				break;
			case MemberTypes.Method:
				this.type = NodeTypes.Method;
				break;
			case MemberTypes.Property:
				this.type = NodeTypes.Property;
				break;
			default:
				this.type = NodeTypes.Other;
				break;
			}
		}
Пример #2
0
 // Vertex Constructor
 protected Node(NodeTypes type, List<Road> roads, Point position, bool green)
 {
     Type = type;
     Roads = roads;
     Position = position;
     Green = green;
 }
Пример #3
0
 //Constructor
 public ExpressionModel(ExpressionModel parent)
 {
     _parent = parent;
     if (parent != null)
     {
         _types = parent.Types;
     }
 }
Пример #4
0
		public NodeInfo (NodeInfo parent, NodeTypes type, object reflectionObject, 
				object reflectionInstance, object description)
		{
			this.parent = parent;
			this.type = type;
			this.reflectionObject = reflectionObject;
			this.reflectionInstance = reflectionInstance;
			this.description = description;
		}
Пример #5
0
		static int CountType (NodeInfo root, NodeTypes type)
		{
			int count = 0;
			while (root != null) {
				if (root.NodeType == type)
					++count;
				root = root.Parent;
			}
			return count;
		}
Пример #6
0
        private Node(string n, List<Vector1D> levels)
        {
            this.center = GetTwo(n, "pos", UnitsOfMeasure.Points);
            this.size = new Vector2D(GetOne(n, "width", UnitsOfMeasure.Inches), GetOne(n, "height", UnitsOfMeasure.Inches));
            this.name = GetName(n);
            this.label = GetValue(n, "label") ?? name;

            var index = levels.IndexOf(center.Y);
            center.Y += index * levelspacer;

            var shape = GetValue(n, "shape");
            this.nodeType = shape == "AND" ? NodeTypes.AND : shape == "OR" ? NodeTypes.OR : NodeTypes.Unknown;
        }
Пример #7
0
		public NodeInfo (NodeInfo parent, NodeTypes type, object reflectionObject, 
				object reflectionInstance)
			: this (parent, type, reflectionObject, reflectionInstance, null)
		{
		}
Пример #8
0
 public TagStoreObj(NodeTypes _type, PARAMETER _param)
 {
     m_Type = _type;
     m_Param = _param;
     isFailed = isEval = false;
 }
Пример #9
0
 public GeneratorAttribute(NodeTypes NodeType)
 {
     this.NodeType = NodeType;
 }
Пример #10
0
        protected override void Update(GameTime gameTime)
        {
            MouseState mouse = Mouse.GetState();

            Vector3 point = getMapPoint(cam.Unproject(mouse.X, mouse.Y));
            cam.Position = new Vector3(player.Postion.X, player.Postion.Y, cam.Position.Z);
            Node node = map.GetNode((int)point.X, (int) point.Y );
            cam.Target = player.Postion;

            if (node != null)
            {
                if (mouse.LeftButton == ButtonState.Pressed && mouse.LeftButton == oldstate.LeftButton)
                {
                    var type = NodeFactory.Get(newNodeType);
                    node.SetType(type);

                }
                else if (mouse.RightButton == ButtonState.Pressed && mouse.RightButton == mouse.RightButton)
                {
                    newNodeType = node.Type.Type;

                }

                if (mouse.MiddleButton == ButtonState.Pressed && mouse.MiddleButton != oldstate.MiddleButton)
                {
                    point = new Vector3((int)point.X, (int)point.Y, 0);
                    var torch = EntityFactory.GetTorch();
                    torch.SetPosition(point);

                    map.SpawnLight(torch);
                    render.AddLight(torch);
                    gameWorld.AddEntity(torch);
                    itemgroup.Instances.Add(torch);
                }

                if (Keyboard.GetState().IsKeyDown(Keys.L))
                {
                    var ent = EntityFactory.GetWorm();

                    ent.Postion = point;

                    gameWorld.AddEntity(ent);
                    entitygroup.Instances.Add(ent);
                }

            }

            oldstate = mouse;
            map.Update(cam);
            base.Update(gameTime);
        }
Пример #11
0
 private void ShowContexMenu(NodeTypes _nodeType, Point location)
 {
     ContextMenu cm = new ContextMenu();
     MenuItem item = null;
     switch (_nodeType) {
         case NodeTypes.Nope:
             break;
         case NodeTypes.FunctionLevel:
             item = new MenuItem("Get Args", GetArgs);
             cm.MenuItems.Add(item);
             break;
         case NodeTypes.ComplexValue:
             item = new MenuItem("Get Members", GetMembers);
             cm.MenuItems.Add(item);
             break;
         case NodeTypes.Primitive:
             item = new MenuItem("Show Value", GetValue);
             cm.MenuItems.Add(item);
             break;
     }
     if (item != null) {
         cm.Show(paramTree, location);
     }
 }
Пример #12
0
 public Block()
 {
     type = NodeTypes.none;
     obj = null;
     blocked = false;
 }
Пример #13
0
        /*/// <summary>
        /// Gets the default edge type (direction) to be used in the
        /// event that the 'directed' attribute of an edge is not included
        /// </summary>
        /// <param name="defaultEdgeType">The value of the edgedefault attribute</param>
        private static GraphType GetDefaultEdgeType(string defaultEdgeType)
        {
            GraphType determinedEdgeType = GraphType.Undirected;

            if (defaultEdgeType != null && defaultEdgeType.ToLower().Equals("directed"))
            {
                determinedEdgeType = GraphType.Directed;
            }

            return determinedEdgeType;
        }*/
        /// <summary>
        /// Reads an XML node from the specified XmlReader
        /// </summary>
        /// <param name="reader">Reader from which to read the node from</param>
        private NodeMapData ReadNode(XmlReader reader, NodeTypes defaultNodeType)
        {
            NodeMapData objNode;

            string nodeId = reader.GetAttribute("id");
            if (defaultNodeType == NodeTypes.Icon)
            {
                objNode = new IconNodeMapData(nodeId);
            }
            else
            {
                objNode = new TextNodeMapData(nodeId);
            }

            if (reader.ReadToDescendant("data"))
            {
                Attributes.Attribute newAttribute = null;
                AttributeValue newAttributeValue = null;

                // Loop over all data elements.  These are the attributes
                do
                {
                    // Record the attributes
                    string dataKey = reader.GetAttribute("key");
                    string dataValue = reader.ReadElementContentAsString();

                    // Determine if we are dealing with a node property
                    if (dataKey.StartsWith(NODE_PROPERTY_PREFIX))
                    {
                        string propName = dataKey.Substring(NODE_PROPERTY_PREFIX.Length);
                        switch (propName)
                        {
                            case "Description":
                                objNode.Description = dataValue;
                                break;

                            case "DisplayValue":
                                objNode.Label = dataValue;
                                break;

                            case "SelectionColor":
                                SolidColorBrush selectionColor = Conversion.HexColorToBrush(dataValue);
                                objNode.SelectionColor = selectionColor.Color;
                                break;

                            case "ImageSource":
                                ((IconNodeMapData)objNode).ImageSource = new Uri(dataValue, UriKind.RelativeOrAbsolute);
                                break;

                            case "Height":
                                double height = double.Parse(dataValue);
                                objNode.Dimension = new Size(objNode.Dimension.Width, height);
                                break;

                            case "Width":
                                double width = double.Parse(dataValue);
                                objNode.Dimension = new Size(width, objNode.Dimension.Height);
                                break;

                            case "Position":
                                string[] splitPosition = dataValue.Split(',');
                                objNode.Position = new Point(double.Parse(splitPosition[0]), double.Parse(splitPosition[1]));
                                break;

                            case "IsHidden":
                                objNode.IsHidden = bool.Parse(dataValue);
                                break;

                            case "BackgroundColor":
                                SolidColorBrush backgroundColor = Conversion.HexColorToBrush(dataValue);
                                objNode.BackgroundColor = backgroundColor.Color;
                                break;

                            default:
                                // TODO prop is for a different version of SnagL
                                break;
                        }

                        // TODO do we only want to do whats above when what is commented out below fails?
                        /*// Attempt to set the node propety
                        if ((SetExportablePropertyValue(dataKey, objNode, dataValue)))
                            _logger.WriteLogEntry(LogLevel.INFO, string.Format("The Node property [{0}] was set to '{1}'", dataKey, dataValue), null, null);
                        else
                        {
                            // The property might be for the view model so try
                            // and set the view model
                            if ((SetExportablePropertyValue(dataKey, objNode, dataValue)))
                                _logger.WriteLogEntry(LogLevel.INFO, string.Format("The NodeVM property [{0}] was set to '{1}'", dataKey, dataValue), null, null);
                            else
                                _logger.WriteLogEntry(LogLevel.ERROR, string.Format("Unable to set the property [{0}] to the specified value [{1}]", dataKey, dataValue), null, null);
                        }*/
                    }
                    else // Determine if we are dealing with an attribute
                    {
                        if (dataKey.StartsWith(NODE_ATTRIBUTE_PREFIX))
                        {
                            // Determine if we are dealing with a descriptor or a value
                            if (dataKey.EndsWith(ATTRIBUTE_DESCRIPTOR_SUFFIX))
                                newAttribute = CreateAttribute(dataValue);
                            else if (dataKey.EndsWith(ATTRIBUTE_VALUE_SUFFIX))
                            {
                                newAttributeValue = new AttributeValue(dataValue);
                            }
                        }
                        else // If we are here, we are not dealing with SnagL formatted GraphML
                        {
                            // We are dealing with an unknown data element so we
                            // are going to treat it like a new attribute
                            // Determine if we are dealing with a descriptor or a value
                            newAttribute = new Attributes.Attribute(dataKey);
                            newAttributeValue = new AttributeValue(dataValue);
                        }

                        // Check if we have a valid Attribute and AttributeValue class
                        if (newAttribute != null && newAttributeValue != null)
                        {
                            AttributeMapData objAttribute = new AttributeMapData(newAttribute.Name, newAttributeValue.Value);
                            objNode.Attributes.Add(objAttribute.Name, objAttribute);

                            objAttribute.SemanticType = newAttribute.SemanticType;
                            objAttribute.SimilarityMeasure = newAttribute.PreferredSimilarityMeasure;
                            objAttribute.IsHidden = !newAttribute.Visible;

                            newAttribute = null;
                            newAttributeValue = null;
                        }
                    }
                } while (reader.LocalName == "data" || (string.IsNullOrEmpty(reader.LocalName) && reader.ReadToNextSibling("data")));
            }

            return objNode;
        }
Пример #14
0
        private void SetNodeType(NodeTypes type)
        {
            object obj = Viewport.GetObjByGridPos();
            if (obj is Node)
            {
                if (type == NodeTypes.Light && ((Node)obj).Type == NodeTypes.Light)
                    ((Node)obj).Green = !((Node)obj).Green;
                else
                    ((Node)obj).Type = type;

                Viewport.Nodes.Refresh();
            }
        }
Пример #15
0
        public static NodeType Get(NodeTypes type)
        {
            NodeType o = null;

            switch (type)
            {
                case NodeTypes.Earth:
                    o = new NodeType
                    {
                        Color = new Vector3(.6f, .5f, 0.4f),
                        Texture = new Vector3(0, 0, 0),
                        ResolveCollision = HardCollision,
                        Opacity = 1.0f,
                        Textures = {
                            {"0000", new Vector3(0, 0, 0)},
                            {"1000", new Vector3(0, 1, 0)},
                            {"0100", new Vector3(0, 2, 0)},
                            {"1100", new Vector3(0, 3, 0)},
                            {"0010", new Vector3(0, 4, 0)},
                            {"1010", new Vector3(0, 5, 0)},
                            {"0110", new Vector3(0, 6, 0)},
                            {"1110", new Vector3(0, 7, 0)},
                            {"0001", new Vector3(0, 8, 0)},
                            {"1001", new Vector3(0, 9, 0)},
                            {"0101", new Vector3(0, 10, 0)},
                            {"1101", new Vector3(0, 11, 0)},
                            {"0011", new Vector3(0, 12, 0)},
                            {"1011", new Vector3(0, 13, 0)},
                            {"0111", new Vector3(0, 14, 0)},
                            {"1111", new Vector3(0, 15, 0)},
                        }
                    };
                    break;
                case NodeTypes.Soil:
                    o = new NodeType
                    {
                        Color = new Vector3(.6f, .55f, 0.55f),
                        Texture = new Vector3(13, 0, 0),
                        ResolveCollision = HardCollision,
                        Opacity = 1.0f,
                        Textures = {
                            {"0000", new Vector3(2, 5, 0)},
                            {"1000", new Vector3(2, 5, 0)},
                            {"0100", new Vector3(2, 5, 0)},
                            {"1100", new Vector3(1, 6, 0)},
                            {"0010", new Vector3(2, 5, 0)},
                            {"1010", new Vector3(2, 5, 0)},
                            {"0110", new Vector3(2, 5, 0)},
                            {"1110", new Vector3(2, 5, 0)},
                            {"0001", new Vector3(2, 5, 0)},
                            {"1001", new Vector3(1, 5, 0)},
                            {"0101", new Vector3(2, 5, 0)},
                            {"1101", new Vector3(2, 5, 0)},
                            {"0011", new Vector3(3, 5, 0)},
                            {"1011", new Vector3(2, 5, 0)},
                            {"0111", new Vector3(2, 5, 0)},
                            {"1111", new Vector3(2, 5, 0)},
                        }

                    };
                    break;
                case NodeTypes.Air:
                    o = new NodeType
                    {
                        Color = Vector3.One,
                        Texture = new Vector3(14, 0, 0),
                        CanCollide = false,
                        CanRender = false,
                        //Emission = new Vector3(.1f, .125f, 0.25f),
                    };
                    break;
                case NodeTypes.EarthBack:
                    o = new NodeType
                    {
                        Color = Vector3.One,
                        Texture = new Vector3(14, 0, 0),
                        CanCollide = false,
                        CanRender = true,
                    };
                    break;

                case NodeTypes.Water:
                    o = new AnimatedNode
                    {
                        Animation = new PassiveAnimationSet
                        {
                            Frames = waterAnims.Frames,
                            ActiveAnimation = "0"
                        },
                        CanCollide = true,
                        CanRender = true,
                        //ReflectionAngle = 0.1f,
                        Color = new Vector3(0.5f, 0.5f, 1),
                        Opacity = 0.1f,
                        ResolveCollision = Slowdown,
                    };
                    break;
                case NodeTypes.Lava:
                    o = new AnimatedNode
                    {
                        Animation = new PassiveAnimationSet
                        {
                            Frames = lavaAnims.Frames,
                            ActiveAnimation = "0"
                        },

                        Color = new Vector3(1.0f, 0.3f, 0.0f),
                        ResolveCollision = HardCollision,
                        Opacity = 0.9f,
                        Emission = new Vector3(1f, 0.3f, 0.0f),
                    };
                    break;

                case NodeTypes.Cloud:
                    o = new NodeType
                    {
                        Color = Vector3.One,
                        Texture = new Vector3(15, 15, 0),
                        Opacity = 0.2f,
                        CanCollide = false,
                    };
                    break;
                case NodeTypes.Brick:
                    o = new NodeType
                    {
                        Color = new Vector3(0.9f, 0.9f, 0.9f),
                        Texture = new Vector3(1f, 7f, 0),
                        ResolveCollision = HardCollision,
                        Opacity = 1.0f,
                    };
                    break;
                case NodeTypes.BrickBack:
                    o = new NodeType
                    {
                        CanCollide = false,
                        Texture = new Vector3(2f, 7f, 0),
                        Color = new Vector3(0.6f, 0.6f, 0.5f),
                    };
                    break;
                default:
                    o = new NodeType();

                    o.Color = Vector3.One;
                    o.CanCollide = true;
                    o.ResolveCollision = NodeFactory.HardCollision;
                    o.Opacity = 1;
                    o.Texture = new Vector3(15, 15, 0);
                    break;
            }
            o.Type = type;
            return o;
        }
Пример #16
0
 public Node(NodeTypes nodeType, Vector3 target)
 {
     NodeType = nodeType;
     Target = target;
 }
Пример #17
0
 public static NodeType Get(NodeTypes type, bool renderable)
 {
     var o = NodeFactory.Get(type);
     o.CanRender = renderable;
     return o;
 }
Пример #18
0
 /// <summary>
 /// This factory method creates and returns a new Berico.LinkAnalysis.ViewModel.
 /// NodeViewModelBase instance based on the provided NodeType
 /// </summary>
 /// <param name="type">The type of node that should be created</param>
 /// <param name="node">The underlying data for the node</param>
 /// <returns>a new Berico.LinkAnalysis.ViewModel.NodeViewlModelBase instance</returns>
 public static NodeViewModelBase GetNodeViewModel(NodeTypes type, Node node, string scope)
 {
     // Create the appropriate viewmodel for the node based on
     // the provided type value
     switch (type)
     {
         case NodeTypes.Icon:
             return new IconNodeViewModel(node, scope);
         case NodeTypes.Simple:
             return null;
         case NodeTypes.Text:
             return new TextNodeViewModel(node, scope);
         default:
             return new TextNodeViewModel(node, scope);
     }
 }
Пример #19
0
 /// <summary>
 /// Initializes a new instance of the <see cref="DomNode"/> class.
 /// </summary>
 /// <param name="obj">
 /// The object.
 /// </param>
 /// <param name="type">
 /// The type.
 /// </param>
 /// <param name="name">
 /// The name.
 /// </param>
 public DomNode(object obj, NodeTypes type, string name = "")
 {
     this.DomObject = obj;
     this.Type = type;
     this.Name = string.IsNullOrEmpty(name) ? obj.ToString() : name;
 }
Пример #20
0
 public static NodeType Get(NodeTypes type, Vector3 texture)
 {
     var o = NodeFactory.Get(type);
     o.CanRender = true;
     o.Texture = texture;
     return o;
 }
Пример #21
0
 public Node(NodeTypes nodeType, Vector3 target, float duration)
 {
     NodeType = nodeType;
     Target = target;
     Duration = duration;
 }
Пример #22
0
		public NodeInfo (NodeInfo parent, NodeTypes type)
			: this (parent, type, null, null, null)
		{
		}