• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Piccolo.PNode类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中UMD.HCIL.Piccolo.PNode的典型用法代码示例。如果您正苦于以下问题:C# PNode类的具体用法?C# PNode怎么用?C# PNode使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



PNode类属于UMD.HCIL.Piccolo命名空间,在下文中一共展示了PNode类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: Initialize

		public override void Initialize() {
			PRoot root = Canvas.Root;
			PCamera camera = Canvas.Camera;
			//PLayer gridLayer = new GridLayer();

			// replace standard layer with grid layer.
			root.RemoveChild(camera.GetLayer(0));
			camera.RemoveLayer(0);
			root.AddChild(gridLayer);
			camera.AddLayer(gridLayer);

			// add constraints so that grid layers bounds always match cameras view bounds. This makes 
			// it look like an infinite grid.
			camera.BoundsChanged += new PPropertyEventHandler(camera_BoundsChanged);
			camera.ViewTransformChanged += new PPropertyEventHandler(camera_ViewTransformChanged);

			gridLayer.Bounds = camera.ViewBounds;

			PNode n = new PNode();
			n.Brush = Brushes.Blue;
			n.SetBounds(0, 0, 100, 80);
		
			Canvas.Layer.AddChild(n);
			Canvas.RemoveInputEventListener(Canvas.PanEventHandler);

			Canvas.AddInputEventListener(new GridDragHandler(Canvas));
		}
开发者ID:malacandrian,项目名称:Piccolo.NET,代码行数:27,代码来源:GridExample.cs


示例2: DetectOcclusions

		/// <summary>
		/// Traverse from the bottom right of the scene graph (top visible node)
		/// up the tree determining which parent nodes are occluded by their children
		/// nodes.
		/// </summary>
		/// <param name="n">The node to find occlusions for.</param>
		/// <param name="pickPath">
		/// A pick path representing the bounds of <c>n</c> in parent coordinates.
		/// </param>
		/// <remarks>
		/// Note that this is only detecting a subset of occlusions (parent, child),
		/// others such as overlapping siblings or cousins are not detected.
		/// </remarks>
		public void DetectOcclusions(PNode n, PPickPath pickPath) {
			if (n.FullIntersects(pickPath.PickBounds)) {
				pickPath.PushMatrix(n.MatrixReference);
		
				int count = n.ChildrenCount;
				for (int i = count - 1; i >= 0; i--) {
					PNode each = n[i];
					if (n.Occluded) {
						// if n has been occluded by a previous decendent then
						// this child must also be occluded
						each.Occluded = true;
					} else {
						// see if child each occludes n
						DetectOcclusions(each, pickPath);
					}
				}

				// see if n occludes it's parents		
				if (!n.Occluded) {
					if (n.Intersects(pickPath.PickBounds)) {
						if (n.IsOpaque(pickPath.PickBounds)) {
							PNode p = n.Parent;
							while (p != null && !p.Occluded) {
								p.Occluded = true;
							}
						}
					}
				}
	
				pickPath.PopMatrix(n.MatrixReference);
			}				
		}
开发者ID:CreeperLava,项目名称:ME3Explorer,代码行数:45,代码来源:POcclusionDetection.cs


示例3: Timeline

        public Timeline(int width, int height)
        {
            InitializeComponent();
            DefaultRenderQuality = RenderQuality.LowQuality;
            this.Size = new Size(width, height);

            TimeLineView = this.Layer;
            Camera.AddLayer(TimeLineView);
            TimeLineView.MoveToBack();
            TimeLineView.Pickable = false;
            TimeLineView.Brush = new SolidBrush(Color.FromArgb(92, 92, 92));
            //BackColor = Color.FromArgb(60, 60, 60);

            GroupList = new InterpData();
            GroupList.Bounds = new RectangleF(0, 0, ListWidth, Camera.Bounds.Bottom - InfoHeight);
            GroupList.Brush = new SolidBrush(Color.FromArgb(60, 60, 60));
            Root.AddChild(GroupList);
            this.Camera.AddChild(GroupList);

            TimeLineInfo = new PNode();
            TimeLineInfo.Bounds = new RectangleF(0, Camera.Bounds.Bottom - InfoHeight, ListWidth, InfoHeight);
            TimeLineInfo.Brush = Brushes.Black;
            Root.AddChild(TimeLineInfo);
            this.Camera.AddChild(TimeLineInfo);

            RemoveInputEventListener(PanEventHandler);
            RemoveInputEventListener(ZoomEventHandler);
            setupDone = true;
        }
开发者ID:CreeperLava,项目名称:ME3Explorer,代码行数:29,代码来源:Timeline.cs


示例4: AddBoundsHandlesTo

		/// <summary>
		/// Adds bounds handles to the given node.
		/// </summary>
		/// <param name="aNode">The node to isLocal bounds handles to.</param>
		public static void AddBoundsHandlesTo(PNode aNode) {
			aNode.AddChild(new PBoundsHandle(PBoundsLocator.CreateEastLocator(aNode))); 
			aNode.AddChild(new PBoundsHandle(PBoundsLocator.CreateWestLocator(aNode))); 
			aNode.AddChild(new PBoundsHandle(PBoundsLocator.CreateNorthLocator(aNode))); 
			aNode.AddChild(new PBoundsHandle(PBoundsLocator.CreateSouthLocator(aNode)));
			aNode.AddChild(new PBoundsHandle(PBoundsLocator.CreateNorthEastLocator(aNode))); 
			aNode.AddChild(new PBoundsHandle(PBoundsLocator.CreateNorthWestLocator(aNode))); 
			aNode.AddChild(new PBoundsHandle(PBoundsLocator.CreateSouthEastLocator(aNode))); 
			aNode.AddChild(new PBoundsHandle(PBoundsLocator.CreateSouthWestLocator(aNode))); 	
		}
开发者ID:malacandrian,项目名称:Piccolo.NET,代码行数:14,代码来源:PBoundsHandle.cs


示例5: Initialize

		public override void Initialize() {
			PLayer layer = Canvas.Layer;
			PNode aNode = new PNode();

			aNode.MouseDown += new PInputEventHandler(aNode_MouseDown);
			aNode.MouseDrag += new PInputEventHandler(aNode_MouseDrag);
			aNode.MouseUp += new PInputEventHandler(aNode_MouseUp);

			aNode.SetBounds(0, 0, 200, 200);
			aNode.Brush = new SolidBrush(Color.Green);

			// add another node to the canvas that does not handle events as a reference
			// point, so that we can make sure that our green node is getting dragged.				
			layer.AddChild(PPath.CreateRectangle(0, 0, 100, 80));
			layer.AddChild(aNode);		
		}
开发者ID:ArsenShnurkov,项目名称:piccolo2d.net,代码行数:16,代码来源:NodeEventExample.cs


示例6: InterpData

 public InterpData()
     : base()
 {
     InterpGroups = new List<InterpGroup>();
     TimelineView = new PNode();
     AddChild(TimelineView);
     TimelineView.MoveToBack();
     TimelineView.Pickable = false;
     //TimelineView.Brush = new SolidBrush(Color.FromArgb(60, 60, 60));
     TimelineView.SetBounds(0, 0, 3600, Height);
     TimelineView.TranslateBy(Timeline.ListWidth, 0);
     TimeScale = PPath.CreateRectangle(0, 0, 3600, Timeline.InfoHeight);
     TimeScale.TranslateBy(Timeline.ListWidth, 0);
     TimeScale.Pickable = false;
     TimeScale.Brush = new SolidBrush(Color.FromArgb(80, 80, 80));
     AddChild(TimeScale);
     TimeScale.MoveToFront();
     //seperationLine = PPath.CreateLine(Timeline.ListWidth, 0, Timeline.ListWidth, 10);
     //seperationLine.Pickable = false;
     //AddChild(seperationLine);
 }
开发者ID:Dybuk,项目名称:ME3Explorer,代码行数:21,代码来源:Timeline.cs


示例7: DirectCameraViewToFocus

		public virtual PActivity DirectCameraViewToFocus(PCamera aCamera, PNode aFocusNode, PPickPath path, int duration) {
			PMatrix originalViewMatrix = aCamera.ViewMatrix;

			// Scale the canvas to include
			SizeF s = new SizeF(1, 0);
			s = aFocusNode.GlobalToLocal(s);
		
			float scaleFactor = s.Width / aCamera.ViewScale;
			PointF scalePoint = PUtil.CenterOfRectangle(aFocusNode.GlobalFullBounds);
			if (scaleFactor != 1) {
				aCamera.ScaleViewBy(scaleFactor, scalePoint.X, scalePoint.Y);
			}
		
			// Pan the canvas to include the view bounds with minimal canvas
			// movement.
			aCamera.AnimateViewToPanToBounds(aFocusNode.GlobalFullBounds, 0);

			// Get rid of any white space. The canvas may be panned and
			// zoomed in to do this. But make sure not stay constrained by max
			// magnification.
			//FillViewWhiteSpace(aCamera);

			PMatrix resultingMatrix = aCamera.ViewMatrix;
			aCamera.ViewMatrix = originalViewMatrix;

			// Animate the canvas so that it ends up with the given
			// view transform.
			PActivity animateCameraViewActivity = AnimateCameraViewMatrixTo(aCamera, resultingMatrix, duration);

			PControl controlNode = (PControl)aFocusNode;
			aCamera.Root.WaitForActivities();

			controlNode.CurrentCanvas = path.TopCamera.Canvas;
			PointF pf = path.GetPathTransformTo(controlNode).Transform(new PointF(controlNode.X, controlNode.Y));
			controlNode.ControlLocation = new Point((int)pf.X, (int)pf.Y);

			controlNode.Editing = true;

			return animateCameraViewActivity;
		}
开发者ID:ArsenShnurkov,项目名称:piccolo2d.net,代码行数:40,代码来源:PControlEventHandler2.cs


示例8: Initialize

		public override void Initialize() {
			long currentTime = PUtil.CurrentTimeMillis;

			// Create a new node that we will apply different activities to, and
			// place that node at location 200, 200.
			aNode = PPath.CreateRectangle(0, 0, 100, 80);
			PLayer layer = Canvas.Layer;
			layer.AddChild(aNode);
			aNode.SetOffset(200, 200);
		
			// Create a new custom "flash" activity. This activity will start running in
			// five seconds, and while it runs it will flash aNode's brush color between
			// red and green every half second.  The same effect could be achieved by
			// extending PActivity and override OnActivityStep.
			PActivity flash = new PActivity(-1, 500, currentTime + 5000);
			flash.ActivityStepped = new ActivitySteppedDelegate(ActivityStepped);

			Canvas.Root.AddActivity(flash);

			// Use the PNode animate methods to create three activities that animate
			// the node's position. Since our node already descends from the root node the
			// animate methods will automatically schedule these activities for us.
			PActivity a1 = aNode.AnimateToPositionScaleRotation(0f, 0f, 0.5f, 0f, 5000);
			PActivity a2 = aNode.AnimateToPositionScaleRotation(100f, 0f, 1.5f, 110f, 5000);
			PActivity a3 = aNode.AnimateToPositionScaleRotation(200f, 100f, 1f, 0f, 5000);

			// the animate activities will start immediately (in the next call to PRoot.processInputs)
			// by default. Here we set their start times (in PRoot global time) so that they start 
			// when the previous one has finished.
			a1.StartTime = currentTime;
		
			a2.StartAfter(a1);
			a3.StartAfter(a2);
		
			// or the previous three lines could be replaced with these lines for the same effect.
			//a2.setStartTime(currentTime + 5000);
			//a3.setStartTime(currentTime + 10000);
		}
开发者ID:malacandrian,项目名称:Piccolo.NET,代码行数:38,代码来源:ActivityExample.cs


示例9: CommandInterface

        /// <summary>
        /// Create a new CommandInterface attached to a specific camera
        /// </summary>
        /// <param Name="camera"></param>
        public CommandInterface(PCamera camera)
            : base(new PImage(Properties.Resources.Gear))
        {
            Camera = camera;

            //Add the Auxillary box
            AuxillaryBox = new PNode();
            AddChild(AuxillaryBox);

            //Add the _Commands
            _Commands.Add(new ToggleStyleCommand("bold", FontStyle.Bold));
            _Commands.Add(new ToggleStyleCommand("italic", FontStyle.Italic));
            _Commands.Add(new ToggleStyleCommand("underline", FontStyle.Underline));
            _Commands.Add(new ToggleStyleCommand("strike", FontStyle.Strikeout));
            _Commands.Add(new StyleCommand());
            _Commands.Add(new SizeCommand());
            _Commands.Add(new ColorCommand());
            _Commands.Add(new CalculateCommand(Camera));
            _Commands.Add(new TranslateCommand("En", Camera));

            _RecentCommands = _Commands.OrderBy(x => x.Name).Take(4).Reverse().ToList();

            Entry.KeyUp += EntryKeyUp;
        }
开发者ID:malacandrian,项目名称:fyp,代码行数:28,代码来源:CommandInterface.cs


示例10: InternalUnselect

		/// <summary>
		/// Unselects the given node, if it is currently selected.
		/// </summary>
		/// <param name="node">The node to unselect.</param>
		/// <returns>True if the node was unselected; otherwise, false.</returns>
		/// <remarks>
		/// The handles will be removed from the node if it is unselected.
		/// </remarks>
		protected virtual bool InternalUnselect(PNode node) {
			if (!IsSelected(node)) {
				return false;
			}
		
			UndecorateSelectedNode(node);
			selection.Remove(node);
			return true;
		}
开发者ID:malacandrian,项目名称:Piccolo.NET,代码行数:17,代码来源:PSelectionEventHandler.cs


示例11: DecorateSelectedNode

		/// <summary> 
		/// Adds bounds handles to the given node.
		/// </summary>
		/// <param name="node">The node to decorate.</param>
		public virtual void DecorateSelectedNode(PNode node) {
			PBoundsHandle.AddBoundsHandlesTo(node);
		}
开发者ID:malacandrian,项目名称:Piccolo.NET,代码行数:7,代码来源:PSelectionEventHandler.cs


示例12: InternalSelect

		/// <summary>
		/// Selects the given node, if it is not already selected.
		/// </summary>
		/// <param name="node">The node to select.</param>
		/// <returns>True if the node was selected; otherwise, false.</returns>
		/// <remarks>
		/// The node will be decorated with handles if it is selected.
		/// </remarks>
		protected virtual bool InternalSelect(PNode node) {
			if (IsSelected(node)) {
				return false;
			}

			selection.Add(node, true);
			DecorateSelectedNode(node);
			return true;
		}
开发者ID:malacandrian,项目名称:Piccolo.NET,代码行数:17,代码来源:PSelectionEventHandler.cs


示例13: PSelectionEventHandler

		/// <summary>
		/// Constructs a new PSelectionEventHandler that will handle selection for the
		/// children of the given list of selectable parent nodes.
		/// </summary>
		/// <param name="marqueeParent">
		/// The node to which the event handler dynamically adds a marquee (temporarily)
		/// to represent the area being selected.
		/// </param>
		/// <param name="selectableParents">
		/// A list of nodes whose children will be selected by this event handler.
		/// </param>
		public PSelectionEventHandler(PNode marqueeParent, PNodeList selectableParents) {
			this.marqueeParent = marqueeParent;
			this.selectableParents = selectableParents;
			Init();
		}
开发者ID:malacandrian,项目名称:Piccolo.NET,代码行数:16,代码来源:PSelectionEventHandler.cs


示例14: AddSelectableParent

		//****************************************************************
		// Selectable Parents - Methods for modifying the set of
		// selectable parents
		//****************************************************************

		/// <summary>
		/// Adds the specified node to the list of selectable parents.
		/// </summary>
		/// <param name="node">The node to isLocal.</param>
		/// <remarks>
		/// Only nodes whose parents are added to the selectable parents list will
		/// be selectable.
		/// </remarks>
		public virtual void AddSelectableParent(PNode node) {
			selectableParents.Add(node);
		}
开发者ID:malacandrian,项目名称:Piccolo.NET,代码行数:16,代码来源:PSelectionEventHandler.cs


示例15: IsSelected

		/// <summary>
		/// Returns true if the specified node is currently selected and false
		/// otherwise.
		/// </summary>
		/// <param name="node">The node to test.</param>
		/// <returns>True if the node is selected; otherwise, false.</returns>
		public virtual bool IsSelected(PNode node) {
			if ((node != null) && (selection.ContainsKey(node))) {
				return true;
			} else {
				return false;
			}
		}
开发者ID:malacandrian,项目名称:Piccolo.NET,代码行数:13,代码来源:PSelectionEventHandler.cs


示例16: Unselect

		/// <summary>
		/// Unselects the given node, if it is currently selected, and posts a
		/// SELECTION_CHANGED_NOTIFICATION if the current selection has changed.
		/// </summary>
		/// <param name="node">The node to unselect.</param>
		/// <remarks>
		/// The handles will be removed from the node if it is unselected.
		/// </remarks>
		public virtual void Unselect(PNode node) {
			if (InternalUnselect(node)) {
				PostSelectionChanged();
			}
		}
开发者ID:malacandrian,项目名称:Piccolo.NET,代码行数:13,代码来源:PSelectionEventHandler.cs


示例17: UndecorateSelectedNode

		/// <summary> 
		/// Removes bounds handles from the given node.
		/// </summary>
		/// <param name="node">The node to undecorate.</param>
		public virtual void UndecorateSelectedNode(PNode node) {
			PBoundsHandle.RemoveBoundsHandlesFrom(node);
		}
开发者ID:malacandrian,项目名称:Piccolo.NET,代码行数:7,代码来源:PSelectionEventHandler.cs


示例18: PNodeTransformTarget

			/// <summary>
			/// Constructs a new PNodeTransformTarget.
			/// </summary>
			/// <param name="target">The target node.</param>
			public PNodeTransformTarget(PNode target) { 
				this.target = target;
			}
开发者ID:CreeperLava,项目名称:ME3Explorer,代码行数:7,代码来源:PNode.cs


示例19: IsSelectable

		/// <summary>
		/// Determines if the specified node is selectable (i.e., if it is a child
		/// of a node in the list of selectable parents).
		/// </summary>
		/// <param name="node">The node to test.</param>
		/// <returns>True if the node is selectable; otherwise, false.</returns>
		protected virtual bool IsSelectable(PNode node) {
			bool selectable = false;

			foreach (PNode parent in selectableParents) {
				if (parent.ChildrenReference.Contains(node)) {
					selectable = true;
					break;
				}
				else if (parent is PCamera) {
					PCamera cameraParent = (PCamera)parent;
					for(int i=0; i<cameraParent.LayerCount; i++) {
						PLayer layer = cameraParent.GetLayer(i);	
						if (layer.ChildrenReference.Contains(node)) {
							selectable = true;
							break;	
						}
					}
				}
			}
		
			return selectable;
		}
开发者ID:malacandrian,项目名称:Piccolo.NET,代码行数:28,代码来源:PSelectionEventHandler.cs


示例20: PNodeColorTarget

			/// <summary>
			/// Constructs a new PNodeColorTarget
			/// </summary>
			/// <param name="target">The target node.</param>
			public PNodeColorTarget(PNode target) {
				this.target = target;
			}
开发者ID:CreeperLava,项目名称:ME3Explorer,代码行数:7,代码来源:PNode.cs



注:本文中的UMD.HCIL.Piccolo.PNode类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Event.PInputEventArgs类代码示例发布时间:2022-05-26
下一篇:
C# UIKit.UIImage类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap