Пример #1
0
        /// <summary>
        /// Remove the layer at the given index from the list of layers managed by this
        /// camera.
        /// </summary>
        /// <param name="index">The index of the layer to remove.</param>
        /// <returns>The removed layer.</returns>
        public virtual PLayer RemoveLayer(int index)
        {
            PLayer layer = layers[index];

            layers.RemoveAt(index);
            layer.RemoveCamera(this);
            InvalidatePaint();
            return(layer);
        }
Пример #2
0
        /// <summary>
        /// Pick all the layers that the camera is looking at.
        /// </summary>
        /// <param name="pickPath">The pick path to use for the pick operation.</param>
        /// <returns>
        /// True if an object viewed by the camera was picked; else false.
        /// </returns>
        /// <remarks>
        /// This method is only called when the camera's view matrix and clip are
        /// applied to the pickPath.
        /// </remarks>
        protected virtual bool PickCameraView(PPickPath pickPath)
        {
            int count = LayerCount;

            for (int i = count - 1; i >= 0; i--)
            {
                PLayer each = layers[i];
                if (each.FullPick(pickPath))
                {
                    return(true);
                }
            }
            return(false);
        }
Пример #3
0
        public override void Initialize()
        {
            PLayer l = new PLayer();
            PEllipse n = new PEllipse();
            n.SetBounds(0, 0, 100, 80);
            n.Brush = new SolidBrush(Color.Red);
            PBoundsHandle.AddBoundsHandlesTo(n);
            l.AddChild(n);
            n.TranslateBy(100, 100);

            PCamera c = new PCamera();
            c.SetBounds(0, 0, 100, 80);
            c.ScaleViewBy(0.1f);
            c.AddLayer(l);
            PBoundsHandle.AddBoundsHandlesTo(c);
            c.Brush = new SolidBrush(Color.Yellow);

            Canvas.Layer.AddChild(l);
            Canvas.Layer.AddChild(c);

            base.Initialize ();
        }
Пример #4
0
 /// <summary>
 /// Return the index where the given layer is stored.
 /// </summary>
 /// <param name="layer">The layer whose index is desired.</param>
 /// <returns>The index where the given layer is stored.</returns>
 public virtual int IndexOfLayer(PLayer layer)
 {
     return layers.IndexOf(layer);
 }
Пример #5
0
 /// <summary>
 /// Add the layer at the given index in this camera's list of layers.  Layers
 /// may be viewed by multiple cameras at once.
 /// </summary>
 /// <param name="index">The index at which to add the layer.</param>
 /// <param name="layer">The layer to add to this camera.</param>
 public virtual void AddLayer(int index, PLayer layer)
 {
     layers.Insert(index, layer);
     layer.AddCamera(this);
     InvalidatePaint();
 }
Пример #6
0
 /// <summary>
 /// Add the layer to the end of this camera's list of layers.  Layers may be
 /// viewed by multiple cameras at once.
 /// </summary>
 /// <param name="layer">The layer to add to this camera.</param>
 public virtual void AddLayer(PLayer layer)
 {
     AddLayer(LayerCount, layer);
 }
Пример #7
0
 /// <summary>
 /// Determines whether the list contains a specific layer.
 /// </summary>
 /// <param name="layer">The layer to locate in the list.</param>
 /// <returns>
 /// True if the layer is found in the list; otherwise, false.
 /// </returns>
 public bool Contains(PLayer layer)
 {
     return List.Contains(layer);
 }
Пример #8
0
 /// <summary>
 /// Add the layer to the end of this camera's list of layers.  Layers may be
 /// viewed by multiple cameras at once.
 /// </summary>
 /// <param name="layer">The layer to add to this camera.</param>
 public virtual void AddLayer(PLayer layer)
 {
     AddLayer(LayerCount, layer);
 }
Пример #9
0
 /// <summary>
 /// Add the layer at the given index in this camera's list of layers.  Layers
 /// may be viewed by multiple cameras at once.
 /// </summary>
 /// <param name="index">The index at which to add the layer.</param>
 /// <param name="layer">The layer to add to this camera.</param>
 public virtual void AddLayer(int index, PLayer layer)
 {
     layers.Insert(index, layer);
     layer.AddCamera(this);
     InvalidatePaint();
 }
Пример #10
0
 /// <summary>
 /// Adds a layer to the list.
 /// </summary>
 /// <param name="layer">The layer to add.</param>
 /// <returns>The position into which the new layer was inserted.</returns>
 public int Add(PLayer layer)
 {
     return List.Add(layer);
 }
Пример #11
0
 /// <summary>
 /// Return the index where the given layer is stored.
 /// </summary>
 /// <param name="layer">The layer whose index is desired.</param>
 /// <returns>The index where the given layer is stored.</returns>
 public virtual int IndexOfLayer(PLayer layer)
 {
     return(layers.IndexOf(layer));
 }
Пример #12
0
 /// <summary>
 /// Removes the first occurrence of a specific layer from the list.
 /// </summary>
 /// <param name="layer">The layer to remove from the list.</param>
 public void Remove(PLayer layer)
 {
     List.Remove(layer);
 }
Пример #13
0
 /// <summary>
 /// Inserts a layer to the list at the specified position.
 /// </summary>
 /// <param name="index">
 /// The zero-based index at which the layer should be inserted.
 /// </param>
 /// <param name="layer">The layer to insert into the list.</param>
 public void Insert(int index, PLayer layer)
 {
     List.Insert(index, layer);
 }
Пример #14
0
 /// <summary>
 /// Determines the index of a specific layer in the list.
 /// </summary>
 /// <param name="layer">The layer to locate in the list.</param>
 /// <returns>
 /// The index of the layer if found in the list; otherwise, -1.
 /// </returns>
 public int IndexOf(PLayer layer)
 {
     return List.IndexOf(layer);
 }
Пример #15
0
 /// <summary>
 /// Remove the given layer from the list of layers managed by this camera.
 /// </summary>
 /// <param name="layer">The layer to remove.</param>
 /// <returns>The removed layer.</returns>
 public virtual PLayer RemoveLayer(PLayer layer)
 {
     return RemoveLayer(layers.IndexOf(layer));
 }
Пример #16
0
 /// <summary>
 /// Remove the given layer from the list of layers managed by this camera.
 /// </summary>
 /// <param name="layer">The layer to remove.</param>
 /// <returns>The removed layer.</returns>
 public virtual PLayer RemoveLayer(PLayer layer)
 {
     return(RemoveLayer(layers.IndexOf(layer)));
 }
Пример #17
0
 public SquiggleHandler(PLayer layer)
 {
     this.layer = layer;
 }
Пример #18
0
        /// <summary>
        /// Creates a basic scene graph.
        /// </summary>
        /// <returns>The main camera node in the new scene graph.</returns>
        /// <remarks>
        /// The scene graph will consist of  root node with two children, a layer and a
        /// camera.  Additionally, The camera will be set to view the layer.  Typically,
        /// you will want to add new nodes to the layer.
        /// </remarks>
        public static PCamera CreateBasicScenegraph()
        {
            PRoot r = new PRoot();
            PLayer l = new PLayer();
            PCamera c = new PCamera();

            r.AddChild(c);
            r.AddChild(l);
            c.AddLayer(l);

            return c;
        }