Exemple #1
0
        protected static bool EhHitDoubleClick(IHitTestObject o)
        {
            object hitted = o.HittedObject;

            Current.Gui.ShowDialog(ref hitted, "Shape properties", true);
            return(true);
        }
Exemple #2
0
        /// <summary>
        /// Handles the mouse doubleclick event.
        /// </summary>
        /// <param name="e">EventArgs as provided by the view.</param>
        /// <returns>The next mouse state handler that should handle mouse events.</returns>
        public override void OnDoubleClick(System.EventArgs e)
        {
            base.OnDoubleClick(e);

            // if there is exactly one object selected, try to open the corresponding configuration dialog
            if (_selectedObjects.Count == 1)
            {
                IEnumerator graphEnum = _selectedObjects.GetEnumerator(); // get the enumerator
                graphEnum.MoveNext();                                     // set the enumerator to the first item
                IHitTestObject graphObject = (IHitTestObject)graphEnum.Current;

                // Set the currently active layer to the layer the clicked object is belonging to.
                if (graphObject.ParentLayer != null && !object.ReferenceEquals(_grac.ActiveLayer, graphObject.ParentLayer))
                {
                    _grac.SetActiveLayerFromInternal(graphObject.ParentLayer.Number); // Sets the current active layer
                }
                if (graphObject.DoubleClick != null)
                {
                    //EndMovingObjects(); // this will resume the suspended graph so that pressing the "Apply" button in a dialog will result in a visible change
                    ClearSelections(); // this will resume the suspended graph so that pressing the "Apply" button in a dialog will result in a visible change
                    graphObject.OnDoubleClick();

                    //ClearSelections();
                }
            }
        }
Exemple #3
0
        private static bool EhTitleRemove(IHitTestObject o)
        {
            object hitted  = o.HittedObject;
            var    axStyle = ((TextGraphic)hitted).ParentObject as AxisStyle;

            axStyle.Title = null;
            return(true);
        }
			/// <summary>
			/// Initializes a new instance of the <see cref="ResizeGripHandle"/> class.
			/// </summary>
			/// <param name="parent">The data for the object that is about to be resized.</param>
			/// <param name="relPos">The relative position of the handle. A value of 0 designates left (x) or top (y). A value of 1 designates right (x) or bottom (y).</param>
			/// <param name="spanningHalfYRhombus">The spanning half y rhombus.</param>
			public ResizeGripHandle(IHitTestObject parent, PointD2D relPos, MatrixD2D spanningHalfYRhombus)
			{
				_parent = parent;
				_drawrPosition = relPos;
				_fixrPosition = new PointD2D(relPos.X == 0 ? 1 : 0, relPos.Y == 0 ? 1 : 0);
				_fixaPosition = GraphObject.RelativeLocalToAbsoluteParentCoordinates(_fixrPosition);
				_spanningHalfYRhombus = spanningHalfYRhombus;
			}
Exemple #5
0
        private static bool EhHitDoubleClick(IHitTestObject o)
        {
            object hitted = o.HittedObject;

            Current.Gui.ShowDialog(ref hitted, "Graphics properties", true);
            ((CurlyBraceShape)hitted).EhSelfChanged(EventArgs.Empty);
            return(true);
        }
Exemple #6
0
        protected static bool EhHitDoubleClick(IHitTestObject o)
        {
            object hitted = o.HittedObject;

            Current.Gui.ShowDialog(ref hitted, "Shape group properties", true);
            ((ShapeGroup)hitted).EhSelfChanged(EventArgs.Empty);
            return(true);
        }
Exemple #7
0
        private static bool EhHitDoubleClick(IHitTestObject o)
        {
            object hitted = o.HittedObject;

            Current.Gui.ShowDialog(ref hitted, "Floating scale properties", true);
            ((FloatingScale)hitted).EhSelfChanged(EventArgs.Empty);
            return(true);
        }
 public RotationGripHandle(IHitTestObject parent, PointD2D relPos, MatrixD2D spanningHalfYRhombus)
 {
     _parent               = parent;
     _drawrPosition        = relPos;
     _fixrPosition         = new PointD2D(0.5, 0.5);
     _fixaPosition         = GraphObject.RelativeLocalToAbsoluteParentCoordinates(_fixrPosition);
     _spanningHalfYRhombus = spanningHalfYRhombus;
 }
Exemple #9
0
 public ShearGripHandle(IHitTestObject parent, PointD2D relPos, MatrixD2D spanningHalfYRhombus)
 {
     _parent               = parent;
     _drawrPosition        = relPos;
     _fixrPosition         = new PointD2D(relPos.X == 0 ? 1 : 0, relPos.Y == 0 ? 1 : 0);
     _fixaPosition         = GraphObject.RelativeToAbsolutePosition(_fixrPosition, true);
     _spanningHalfYRhombus = spanningHalfYRhombus;
 }
Exemple #10
0
        private static new bool EhHitDoubleClick(IHitTestObject o)
        {
            object hitted = o.HittedObject;

            Current.Gui.ShowDialog(ref hitted, "Line properties", true);
            ((ClosedCardinalSpline)hitted).EhSelfChanged(EventArgs.Empty);
            return(true);
        }
Exemple #11
0
        private static bool EhHitDoubleClick(IHitTestObject o)
        {
            object hitted = o.HittedObject;

            Current.Gui.ShowDialog(ref hitted, "Shape properties", true);
            ((OpenPathShapeBase)hitted).EhSelfChanged(EventArgs.Empty);
            return(true);
        }
			public ShearGripHandle(IHitTestObject parent, PointD2D relPos, MatrixD2D spanningHalfYRhombus)
			{
				_parent = parent;
				_drawrPosition = relPos;
				_fixrPosition = new PointD2D(relPos.X == 0 ? 1 : 0, relPos.Y == 0 ? 1 : 0);
				_fixaPosition = GraphObject.RelativeToAbsolutePosition(_fixrPosition, true);
				_spanningHalfYRhombus = spanningHalfYRhombus;
			}
Exemple #13
0
        static bool EhHitDoubleClick(IHitTestObject o)
        {
            object hitted = o.HittedObject;

            Current.Gui.ShowDialog(ref hitted, "Shape properties", true);
            ((ShapeGraphic)hitted).OnChanged();
            return(true);
        }
Exemple #14
0
            public PathNodeGripHandle(IHitTestObject parent, PointD2D relPos, PointD2D gripCenter, double gripRadius)
            {
                _parent        = parent;
                _drawrPosition = relPos;
                _fixrPosition  = new PointD2D(relPos.X == 0 ? 1 : 0, relPos.Y == 0 ? 1 : 0);
                _fixaPosition  = GraphObject.RelativeToAbsolutePosition(_fixrPosition, true);

                _gripCenter = gripCenter;
                _gripRadius = gripRadius;
            }
			public PathNodeGripHandle(IHitTestObject parent, PointD2D relPos, PointD2D gripCenter, double gripRadius)
			{
				_parent = parent;
				_drawrPosition = relPos;
				_fixrPosition = new PointD2D(relPos.X == 0 ? 1 : 0, relPos.Y == 0 ? 1 : 0);
				_fixaPosition = GraphObject.RelativeToAbsolutePosition(_fixrPosition, true);

				_gripCenter = gripCenter;
				_gripRadius = gripRadius;
			}
Exemple #16
0
        public override IHitTestObject HitTest(PointF pt)
        {
            IHitTestObject result = base.HitTest(pt);

            if (result != null)
            {
                result.DoubleClick = EhHitDoubleClick;
            }
            return(result);
        }
Exemple #17
0
        public override IHitTestObject HitTest(HitTestRectangularData rect)
        {
            IHitTestObject result = base.HitTest(rect);

            if (result != null)
            {
                result.DoubleClick = EhHitDoubleClick;
            }
            return(result);
        }
Exemple #18
0
        public override IHitTestObject HitTest(HitTestPointData htd)
        {
            IHitTestObject result = base.HitTest(htd);

            if (result != null)
            {
                result.DoubleClick = EhHitDoubleClick;
            }
            return(result);
        }
			public RescaleGripHandle(IHitTestObject parent, PointD2D relPos, MatrixD2D spanningHalfYRhombus)
			{
				_parent = parent;
				_drawrPosition = relPos;
				_drawaPosition = GraphObject.RelativeToAbsolutePosition(_drawrPosition, true);

				_fixrPosition = new PointD2D(1 - relPos.X, 1 - relPos.Y);
				_fixaPosition = GraphObject.RelativeLocalToAbsoluteParentCoordinates(_fixrPosition);

				_spanningHalfYRhombus = spanningHalfYRhombus;
			}
			/// <summary>
			/// Initializes a new instance of the <see cref="PathNodeGripHandle"/> class.
			/// </summary>
			/// <param name="parent">The object that was hit.</param>
			/// <param name="movePointRelativePosition">The relative position of the node that should be moved. For instance, (0,0,0) is at the origin of the object, (1,1,1) on the other side of the object, (0.5, 0.5, 0.5) at the center of the object.</param>
			/// <param name="gripCenter">The grip center in local (layer) coordinates.</param>
			/// <param name="gripRadius">The grip radius.</param>
			public PathNodeGripHandle(IHitTestObject parent, VectorD3D movePointRelativePosition, PointD3D gripCenter, double gripRadius)
			{
				_parent = parent;
				_initialObjectSize = GraphObject.Size;
				_movePointRelativePosition = movePointRelativePosition;
				_fixPointRelativePosition = new VectorD3D(movePointRelativePosition.X == 0 ? 1 : 0, movePointRelativePosition.Y == 0 ? 1 : 0, movePointRelativePosition.Z == 0 ? 1 : 0);
				_fixPointAbsolutePosition = GraphObject.RelativeLocalToAbsoluteParentCoordinates(_fixPointRelativePosition);

				_gripCenter = gripCenter;
				_gripRadius = gripRadius;
			}
            /// <summary>
            /// Initializes a new instance of the <see cref="PathNodeGripHandle"/> class.
            /// </summary>
            /// <param name="parent">The object that was hit.</param>
            /// <param name="movePointRelativePosition">The relative position of the node that should be moved. For instance, (0,0,0) is at the origin of the object, (1,1,1) on the other side of the object, (0.5, 0.5, 0.5) at the center of the object.</param>
            /// <param name="gripCenter">The grip center in local (layer) coordinates.</param>
            /// <param name="gripRadius">The grip radius.</param>
            public PathNodeGripHandle(IHitTestObject parent, VectorD3D movePointRelativePosition, PointD3D gripCenter, double gripRadius)
            {
                _parent                    = parent;
                _initialObjectSize         = GraphObject.Size;
                _movePointRelativePosition = movePointRelativePosition;
                _fixPointRelativePosition  = new VectorD3D(movePointRelativePosition.X == 0 ? 1 : 0, movePointRelativePosition.Y == 0 ? 1 : 0, movePointRelativePosition.Z == 0 ? 1 : 0);
                _fixPointAbsolutePosition  = GraphObject.RelativeLocalToAbsoluteParentCoordinates(_fixPointRelativePosition);

                _gripCenter = gripCenter;
                _gripRadius = gripRadius;
            }
			/// <summary>
			/// Initializes a new instance of the <see cref="MovementGripHandle"/> class.
			/// </summary>
			/// <param name="parent">The parent hit test object.</param>
			/// <param name="gripPath">The grip path, i.e. the outline that is used to test whether this grip is hitted with the mouse.</param>
			/// <param name="displayPath">The display path, i.e. the outline that is displayed on the plot.</param>
			public MovementGripHandle(IHitTestObject parent, IObjectOutline gripPath, IObjectOutline displayPath)
			{
				if (null == parent)
					throw new ArgumentNullException(nameof(parent));
				if (null == gripPath)
					throw new ArgumentNullException(nameof(gripPath));

				_parent = parent;
				_gripPath = gripPath;
				_displayedPath = displayPath ?? gripPath;
			}
            public RescaleGripHandle(IHitTestObject parent, PointD2D relPos, MatrixD2D spanningHalfYRhombus)
            {
                _parent        = parent;
                _drawrPosition = relPos;
                _drawaPosition = GraphObject.RelativeToAbsolutePosition(_drawrPosition, true);

                _fixrPosition = new PointD2D(1 - relPos.X, 1 - relPos.Y);
                _fixaPosition = GraphObject.RelativeLocalToAbsoluteParentCoordinates(_fixrPosition);

                _spanningHalfYRhombus = spanningHalfYRhombus;
            }
Exemple #24
0
 private bool EhAxisTitleRemove(IHitTestObject o)
 {
     foreach (var axstyle in _axisStyles)
     {
         if (object.ReferenceEquals(o.HittedObject, axstyle.Title))
         {
             axstyle.Title = null;
             return(true);
         }
     }
     return(false);
 }
Exemple #25
0
        public static bool EhAxisLabelMinorStyleEdit(IHitTestObject hit)
        {
            AxisLabelStyle style = hit.HittedObject as AxisLabelStyle;

            if (style == null || hit.ParentLayer == null)
            {
                return(false);
            }

            ShowDialog(hit.ParentLayer, "MinorLabels", style.AxisStyleID);

            return(false);
        }
Exemple #26
0
        /// <summary>
        /// Handles the double click event onto a plot item.
        /// </summary>
        /// <param name="hit">Object containing information about the double clicked object.</param>
        /// <returns>True if the object should be deleted, false otherwise.</returns>
        protected static bool EhEditPlotItem(IHitTestObject hit)
        {
            XYPlotLayer actLayer = hit.ParentLayer;
            IGPlotItem  pa       = (IGPlotItem)hit.HittedObject;


            // get plot group
            PlotGroupStyleCollection plotGroup = pa.ParentCollection.GroupStyles;

            Current.Gui.ShowDialog(new object[] { pa }, string.Format("#{0}: {1}", pa.Name, pa.ToString()), true);

            return(false);
        }
Exemple #27
0
        public static bool EhLayerPositionEdit(IHitTestObject hit)
        {
            XYPlotLayer layer = hit.HittedObject as XYPlotLayer;

            if (layer == null)
            {
                return(false);
            }

            ShowDialog(layer, "Position");

            return(false);
        }
        public static bool EhLayerPositionEdit(IHitTestObject hit)
        {
            var layer = hit.HittedObject as DensityImageLegend;

            if (layer == null)
            {
                return(false);
            }

            ShowDialog(layer, "Position");

            return(false);
        }
Exemple #29
0
        public static bool EhAxisStyleEdit(IHitTestObject hit)
        {
            AxisLineStyle style = hit.HittedObject as AxisLineStyle;

            if (style == null || hit.ParentLayer == null)
            {
                return(false);
            }

            ShowDialog(hit.ParentLayer, "TitleAndFormat", style.AxisStyleID);

            return(false);
        }
            /// <summary>
            /// Initializes a new instance of the <see cref="MovementGripHandle"/> class.
            /// </summary>
            /// <param name="parent">The parent hit test object.</param>
            /// <param name="gripPath">The grip path, i.e. the outline that is used to test whether this grip is hitted with the mouse.</param>
            /// <param name="displayPath">The display path, i.e. the outline that is displayed on the plot.</param>
            public MovementGripHandle(IHitTestObject parent, IObjectOutline gripPath, IObjectOutline displayPath)
            {
                if (null == parent)
                {
                    throw new ArgumentNullException(nameof(parent));
                }
                if (null == gripPath)
                {
                    throw new ArgumentNullException(nameof(gripPath));
                }

                _parent        = parent;
                _gripPath      = gripPath;
                _displayedPath = displayPath ?? gripPath;
            }
Exemple #31
0
        /// <summary>
        /// Determines whether or not the pixel position in <paramref name="pixelPos"/> is on a already selected object
        /// </summary>
        /// <param name="pixelPos">The pixel position to test (on the graph panel)</param>
        /// <param name="foundObject">Returns the object the position <paramref name="pixelPos"/> is pointing to, else null</param>
        /// <returns>True when the pixel position is upon a selected object, else false</returns>
        public bool IsPixelPositionOnAlreadySelectedObject(PointF pixelPos, out IHitTestObject foundObject)
        {
            PointF graphXY = _grac.PixelToPrintableAreaCoordinates(pixelPos); // Graph area coordinates

            // have we clicked on one of the already selected objects
            foreach (IHitTestObject graphObject in m_SelectedObjects)
            {
                if (graphObject.SelectionPath.IsVisible(graphXY))
                {
                    foundObject = graphObject;
                    return(true);
                }
            }
            foundObject = null;
            return(false);
        }
Exemple #32
0
        public override IHitTestObject HitTest(HitTestPointData parentHitData)
        {
            IHitTestObject result       = null;
            var            localHitData = parentHitData.NewFromAdditionalTransformation(_transformation);

            if (localHitData.IsHit(new LineD3D(Bounds.Location, Bounds.LocationPlusSize), _linePen.Thickness1, _linePen.Thickness2))
            {
                result = GetNewHitTestObject(parentHitData.WorldTransformation);
            }

            if (result != null)
            {
                result.DoubleClick = EhHitDoubleClick;
            }

            return(result);
        }
        public static bool EhAxisStyleEdit(IHitTestObject hit)
        {
            var style = hit.HittedObject as AxisLineStyle;

            if (style == null || hit.ParentLayer == null)
            {
                return(false);
            }

            var xylayer = hit.ParentLayer as XYZPlotLayer;

            if (null != xylayer)
            {
                ShowDialog(xylayer, "TitleAndFormat", style.AxisStyleID);
            }

            return(false);
        }
        public static bool EhAxisLabelMinorStyleEdit(IHitTestObject hit)
        {
            var style = hit.HittedObject as AxisLabelStyle;

            if (style == null || hit.ParentLayer == null)
            {
                return(false);
            }

            var xylayer = hit.ParentLayer as XYPlotLayer;

            if (null != xylayer)
            {
                ShowDialog(xylayer, "MinorLabels", style.AxisStyleID);
            }

            return(false);
        }
        public IHitTestObject HitTest(IPlotArea layer, System.Drawing.PointF hitpoint)
        {
            IHitTestObject result = null;

            foreach (IGPlotItem pi in _plotItems)
            {
                result = pi.HitTest(layer, hitpoint);
                if (null != result)
                {
                    if (result.Remove == null)
                    {
                        result.Remove = new DoubleClickHandler(this.EhHitTestObject_Remove);
                    }

                    return(result);
                }
            }
            return(null);
        }
Exemple #36
0
        /// <summary>
        /// Arranges the objects so they share a common boundary.
        /// </summary>
        /// <param name="arrange">Routine that determines how to arrange the element with respect to the master element.</param>
        public void Arrange(ArrangeElement arrange)
        {
            if (m_SelectedObjects.Count < 2)
            {
                return;
            }


            RectangleF masterbound = m_SelectedObjects[m_SelectedObjects.Count - 1].ObjectPath.GetBounds();

            // now move each object to the new position, which is the difference in the position of the bounds.X
            for (int i = m_SelectedObjects.Count - 2; i >= 0; i--)
            {
                IHitTestObject o      = m_SelectedObjects[i];
                RectangleF     bounds = o.ObjectPath.GetBounds();

                arrange(o, bounds, masterbound);
            }

            _grac.RefreshGraph(); // force a refresh
        }
    /// <summary>
    /// Looks for a graph object at pixel position <paramref name="pixelPos"/> and returns true if one is found.
    /// </summary>
    /// <param name="pixelPos">The pixel coordinates (graph panel coordinates)</param>
    /// <param name="plotItemsOnly">If true, only the plot items where hit tested.</param>
    /// <param name="foundObject">Found object if there is one found, else null</param>
    /// <param name="foundInLayerNumber">The layer the found object belongs to, otherwise 0</param>
    /// <returns>True if a object was found at the pixel coordinates <paramref name="pixelPos"/>, else false.</returns>
    public bool FindGraphObjectAtPixelPosition(PointF pixelPos, bool plotItemsOnly, out IHitTestObject foundObject, out int foundInLayerNumber)
    {
      // search for a object first
      PointF mousePT = PixelToPrintableAreaCoordinates(pixelPos);

      for(int nLayer=0;nLayer<Layers.Count;nLayer++)
      {
        XYPlotLayer layer = Layers[nLayer];
        foundObject = layer.HitTest(mousePT, plotItemsOnly);
        if(null!=foundObject)
        {
          foundInLayerNumber = nLayer;
          return true;
        }
      }
      foundObject=null;
      foundInLayerNumber=0;
      return false;
    }
    /// <summary>
    /// Handles the double click event onto a plot item.
    /// </summary>
    /// <param name="hit">Object containing information about the double clicked object.</param>
    /// <returns>True if the object should be deleted, false otherwise.</returns>
    protected static bool EhEditTextGraphics(IHitTestObject hit)
    {
      XYPlotLayer layer = hit.ParentLayer;
      TextGraphic tg = (TextGraphic)hit.HittedObject;

      bool shouldDeleted = false;

      object tgoo = tg;
      if (Current.Gui.ShowDialog(ref tgoo, "Edit text", true))
      {
        tg = (TextGraphic)tgoo;
        if (tg == null || tg.Empty)
        {
          if (null != hit.Remove)
            shouldDeleted = hit.Remove(hit);
          else
            shouldDeleted = false;
        }
        else
        {
          if (layer.ParentLayerList != null)
            layer.ParentLayerList.EhChildChanged(layer, EventArgs.Empty);
        }
      }
      /*
      TextControlDialog dlg = new TextControlDialog(layer,tg);
      if(DialogResult.OK==dlg.ShowDialog(Current.MainWindow))
      {
        if(!dlg.SimpleTextGraphics.Empty)
        {
          tg.CopyFrom(dlg.SimpleTextGraphics);
        }
        else // item is empty, so must be deleted in the layer and in the selectedObjects
        {
          if(null!=hit.Remove)
            shouldDeleted = hit.Remove(hit);
          else
            shouldDeleted = false;
        }
        // note the chante in the text graphics object
        if(layer.ParentLayerList!=null)
          layer.ParentLayerList.EhChildChanged(layer,EventArgs.Empty);
      }
      */


      return shouldDeleted;
    }
		private void AddSelectedObject(HitTestPointData hitPoint, IHitTestObject clickedObject)
		{
			_selectedObjects.Add(clickedObject);

			DisplayedGripLevel = 1;
			DisplayedGrips = GetGripsFromSelectedObjects();

			if (_selectedObjects.Count == 1) // single object selected
			{
				ActiveGrip = GripHitTest(hitPoint);
				if (ActiveGrip != null)
					ActiveGrip.Activate(hitPoint, true);
			}
			else // multiple objects selected
			{
				ActiveGrip = DisplayedGrips[0]; // this is our SuperGrip
				DisplayedGrips[0].Activate(hitPoint, true);
			}

			_grac.RenderOverlay();
		}
			public bool GetHittedElement(PointD2D point, out IGripManipulationHandle gripHandle, out IHitTestObject hitObject)
			{
				for (int i = GripList.Count - 1; i >= 0; i--)
				{
					if (GripList[i].IsGripHitted(point))
					{
						gripHandle = GripList[i];
						hitObject = HittedList[i];
						return true;
					}
				}

				gripHandle = null;
				hitObject = null;
				return false;
			}
			public MovementGripHandle(IHitTestObject parent, GraphicsPath gripPath, GraphicsPath objectPath)
			{
				_parent = parent;
				_gripPath = gripPath;
				_displayedPath = objectPath;
			}
 /// <summary>
 /// Draws immediately a selection rectangle around the object <paramref name="graphObject"/>.
 /// </summary>
 /// <param name="graphObject">The graph object for which a selection rectangle has to be drawn.</param>
 /// <param name="nLayer">The layer number the <paramref name="graphObject"/> belongs to.</param>
 public void DrawSelectionRectangleImmediately(IHitTestObject graphObject, int nLayer)
 {
   using(Graphics g = m_View.CreateGraphGraphics())
   {
     // now translate the graphics to graph units and paint all selection path
     this.TranslateGraphicsToGraphUnits(g);
     //        g.DrawPath(Pens.Blue,Layers[nLayer].LayerToGraphCoordinates(graphObject.SelectionPath)); // draw the selection path
     g.DrawPath(Pens.Blue,graphObject.SelectionPath); // draw the selection path
   }   
 }
 static bool EhGraphicsObject_Remove(IHitTestObject o)
 {
   GraphicBase go = (GraphicBase)o.HittedObject;
   o.ParentLayer.GraphObjects.Remove(go);
   return true;
 }
			/// <summary>
			/// Initializes a new instance of the <see cref="PathNodeGripHandle"/> class.
			/// </summary>
			/// <param name="parent">The object that was hit.</param>
			/// <param name="relPos">The relative position of the node that should be moved. For instance, (0,0,0) is at the origin of the object, (1,1,1) on the other side of the object, (0.5, 0.5, 0.5) at the center of the object.</param>
			/// <param name="gripCenter">The grip center in local (layer) coordinates.</param>
			/// <param name="gripRadius">The grip radius.</param>
			/// <param name="moveAction">Action to carry out when moving the handle.</param>
			public PathNodeGripHandle(IHitTestObject parent, VectorD3D relPos, PointD3D gripCenter, double gripRadius, Action<HitTestPointData> moveAction)
				: this(parent, relPos, gripCenter, gripRadius)
			{
				_moveAction = moveAction;
			}
Exemple #45
0
			public ClosedCardinalSplinePathNodeGripHandle(IHitTestObject parent, int pointNr, PointD2D gripCenter, double gripRadius)
				: base(parent, new PointD2D(0, 0), gripCenter, gripRadius)
			{
				_pointNumber = pointNr;
				_offset = ((ClosedCardinalSpline)GraphObject).Location.AbsoluteVectorPivotToLeftUpper;
			}
Exemple #46
0
		private static bool EhHitDoubleClick(IHitTestObject o)
		{
			object hitted = o.HittedObject;
			Current.Gui.ShowDialog(ref hitted, "Shape properties", true);
			return true;
		}
			public void Add(IGripManipulationHandle gripHandle, IHitTestObject hitTestObject)
			{
				GripList.Add(gripHandle);
				HittedList.Add(hitTestObject);
			}
			} // end of function

    private void AddSelectedObject(PointF graphXY, IHitTestObject clickedObject)
    {
      _selectedObjects.Add(clickedObject);

			DisplayedGripLevel = 1;
      DisplayedGrips = GetGripsFromSelectedObjects();

      if (_selectedObjects.Count == 1) // single object selected
      {
        ActiveGrip = GripHitTest(graphXY);
        if (ActiveGrip != null)
          ActiveGrip.Activate(graphXY, true);
      }
      else // multiple objects selected
      {
        ActiveGrip = DisplayedGrips[0]; // this is our SuperGrip
        DisplayedGrips[0].Activate(graphXY, true);
      }

      _grac.WinFormsController.RepaintGraphArea();
    }
 private IHitTestObject ForwardTransform(IHitTestObject o)
 {
   o.Transform(_cachedForwardMatrix);
   o.ParentLayer = this;
   return o;
 }
    public static bool EhAxisStyleEdit(IHitTestObject hit)
    {
      AxisLineStyle style = hit.HittedObject as AxisLineStyle;
      if (style == null || hit.ParentLayer == null)
        return false;

      ShowDialog(hit.ParentLayer, "TitleAndFormat", style.AxisStyleID);

      return false;
    }
 bool EhAxisLabelMinorStyleRemove(IHitTestObject o)
 {
   AxisLabelStyle als = o.HittedObject as AxisLabelStyle;
   AxisStyle axisStyle = als == null ? null : als.ParentObject as AxisStyle;
   if (axisStyle != null)
   {
     axisStyle.ShowMinorLabels = false;
     return true;
   }
   return false;
 }
    /// <summary>
    /// Handles the double click event onto a plot item.
    /// </summary>
    /// <param name="hit">Object containing information about the double clicked object.</param>
    /// <returns>True if the object should be deleted, false otherwise.</returns>
    protected static bool EhEditPlotItem(IHitTestObject hit)
    {
      XYPlotLayer actLayer = hit.ParentLayer;
      IGPlotItem pa = (IGPlotItem)hit.HittedObject;


      // get plot group
      PlotGroupStyleCollection plotGroup = pa.ParentCollection.GroupStyles;

      Current.Gui.ShowDialog(new object[] { pa }, string.Format("#{0}: {1}", pa.Name, pa.ToString()),true);

      return false;
    }
    static bool EhTitlesOrLegend_Remove(IHitTestObject o)
    {
      GraphicBase go = (GraphicBase)o.HittedObject;
      XYPlotLayer layer = o.ParentLayer;

      if (object.ReferenceEquals(go, layer.Legend))
      {
        layer.Legend = null;
        return true;
      }
      foreach (AxisStyle style in layer._axisStyles)
      {
        if (object.ReferenceEquals(go, style.Title))
        {
          style.Title = null;
          return true;
        }
      }

      return false;
    }
    public static bool EhLayerPositionEdit(IHitTestObject hit)
    {
      XYPlotLayer layer = hit.HittedObject as XYPlotLayer;
      if (layer == null)
        return false;

      ShowDialog( layer, "Position");

      return false;
    }
Exemple #55
0
		protected static bool EhHitDoubleClick(IHitTestObject o)
		{
			object hitted = o.HittedObject;
			Current.Gui.ShowDialog(ref hitted, "Shape group properties", true);
			((ShapeGroup)hitted).EhSelfChanged(EventArgs.Empty);
			return true;
		}
Exemple #56
0
		private static bool EhHitDoubleClick(IHitTestObject o)
		{
			object hitted = o.HittedObject;
			Current.Gui.ShowDialog(ref hitted, "Line properties", true);
			((LineShape)hitted).EhSelfChanged(EventArgs.Empty);
			return true;
		}
    public static bool EhAxisLabelMinorStyleEdit(IHitTestObject hit)
    {
      AxisLabelStyle style = hit.HittedObject as AxisLabelStyle;
      if (style == null || hit.ParentLayer == null)
        return false;

      ShowDialog(hit.ParentLayer, "MinorLabels", style.AxisStyleID);

      return false;
    }
Exemple #58
0
		protected override IGripManipulationHandle[] GetGrips(IHitTestObject hitTest, GripKind gripKind)
		{
			var list = new List<IGripManipulationHandle>();

			/*

const double gripNominalSize = 10; // 10 Points nominal size on the screen
			if ((GripKind.Resize & gripKind) != 0)
			{
				double gripSize = gripNominalSize / pageScale; // 10 Points, but we have to consider the current pageScale
				for (int i = 1; i < _gripRelPositions.Length; i++)
				{
					PointD2D outVec, pos;
					if (1 == i % 2)
						GetCornerOutVector(_gripRelPositions[i], hitTest, out outVec, out pos);
					else
						GetMiddleRayOutVector(_gripRelPositions[i], hitTest, out outVec, out pos);

					outVec *= (gripSize / outVec.VectorLength);
					PointD2D altVec = outVec.Get90DegreeRotated();
					PointD2D ptStart = pos;
					list.Add(new ResizeGripHandle(hitTest, _gripRelPositions[i], new MatrixD2D(outVec.X, outVec.Y, altVec.X, altVec.Y, ptStart.X, ptStart.Y)));
				}
			}
			*/

			/*
			if ((GripKind.Rotate & gripKind) != 0)
			{
				double gripSize = 10 / pageScale;
				// Rotation grips
				for (int i = 1; i < _gripRelPositions.Length; i += 2)
				{
					PointD2D outVec, pos;
					GetCornerOutVector(_gripRelPositions[i], hitTest, out outVec, out pos);

					outVec *= (gripSize / outVec.VectorLength);
					PointD2D altVec = outVec.Get90DegreeRotated();
					PointD2D ptStart = pos;
					list.Add(new RotationGripHandle(hitTest, _gripRelPositions[i], new MatrixD2D(outVec.X, outVec.Y, altVec.X, altVec.Y, ptStart.X, ptStart.Y)));
				}
			}
			*/

			/*
			if ((GripKind.Rescale & gripKind) != 0)
			{
				double gripSize = 10 / pageScale; // 10 Points, but we have to consider the current pageScale
				for (int i = 1; i < _gripRelPositions.Length; i++)
				{
					PointD2D outVec, pos;
					if (1 == i % 2)
						GetCornerOutVector(_gripRelPositions[i], hitTest, out outVec, out pos);
					else
						GetMiddleRayOutVector(_gripRelPositions[i], hitTest, out outVec, out pos);

					outVec *= (gripSize / outVec.VectorLength);
					PointD2D altVec = outVec.Get90DegreeRotated();
					PointD2D ptStart = pos;
					list.Add(new RescaleGripHandle(hitTest, _gripRelPositions[i], new MatrixD2D(outVec.X, outVec.Y, altVec.X, altVec.Y, ptStart.X, ptStart.Y)));
				}
			}
			*/

			/*
			if ((GripKind.Shear & gripKind) != 0)
			{
				double gripSize = 10 / pageScale; // 10 Points, but we have to consider the current pageScale
				for (int i = 2; i < _gripRelPositions.Length; i += 2)
				{
					PointD2D outVec, pos;
					GetEdgeOutVector(_gripRelPositions[i], hitTest, out outVec, out pos);

					outVec *= (gripSize / outVec.VectorLength);
					PointD2D altVec = outVec.Get90DegreeRotated();
					PointD2D ptStart = pos;
					list.Add(new ShearGripHandle(hitTest, _gripRelPositions[i], new MatrixD2D(outVec.X, outVec.Y, altVec.X, altVec.Y, ptStart.X, ptStart.Y)));
				}
			}
			*/

			if ((GripKind.Move & gripKind) != 0)
			{
				var bounds = this.Bounds;
				var wn = PolylineMath3D.GetWestNorthVectors(bounds.Size);
				var transformation = Matrix4x3.NewFromBasisVectorsAndLocation(wn.Item1, wn.Item2, bounds.Size.Normalized, PointD3D.Empty);

				transformation.AppendTransform(_transformation);
				transformation.AppendTransform(hitTest.Transformation);

				double t1 = 0.55 * _linePen.Thickness1;
				double t2 = 0.55 * _linePen.Thickness2;
				var rect = new RectangleD3D(-t1, -t2, 0, 2 * t1, 2 * t2, bounds.Size.Length);
				var objectOutline = new RectangularObjectOutline(rect, transformation);
				list.Add(new MovementGripHandle(hitTest, objectOutline, null));
			}

			return list.ToArray();
		}
Exemple #59
0
 static bool EhHitDoubleClick(IHitTestObject o)
 {
   object hitted = o.HittedObject;
   Current.Gui.ShowDialog(ref hitted, "Line properties", true);
   ((LineShape)hitted).OnChanged();
   return true;
 }
    /// <summary>
    /// Determines whether or not the pixel position in <paramref name="pixelPos"/> is on a already selected object
    /// </summary>
    /// <param name="pixelPos">The pixel position to test (on the graph panel)</param>
    /// <param name="foundObject">Returns the object the position <paramref name="pixelPos"/> is pointing to, else null</param>
    /// <returns>True when the pixel position is upon a selected object, else false</returns>
    public bool IsPixelPositionOnAlreadySelectedObject(PointF pixelPos, out IHitTestObject foundObject)
    {
      PointF graphXY = _grac.PixelToPrintableAreaCoordinates(pixelPos); // Graph area coordinates

      // have we clicked on one of the already selected objects
      foreach(IHitTestObject graphObject in m_SelectedObjects)
      {
       
        
        if(graphObject.SelectionPath.IsVisible(graphXY))
        {
          foundObject = graphObject;
          return true;
        }
      }
      foundObject = null;
      return false;
    }