當前位置: 首頁>>代碼示例>>C#>>正文


C# Piccolo.PNode類代碼示例

本文整理匯總了C#中UMD.HCIL.Piccolo.PNode的典型用法代碼示例。如果您正苦於以下問題:C# PNode類的具體用法?C# PNode怎麽用?C# PNode使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


PNode類屬於UMD.HCIL.Piccolo命名空間,在下文中一共展示了PNode類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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: 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

示例5: 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

示例6: 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

示例7: 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

示例8: 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

示例9: 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

示例10: 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

示例11: 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

示例12: 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

示例13: 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

示例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


注:本文中的UMD.HCIL.Piccolo.PNode類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。