Example #1
0
 public MarkerBase(MarkerBase prototype) : base(prototype)
 {
     _width          = prototype.Width;
     _height         = prototype.Height;
     _backColor      = prototype.BackColor;
     _drawBackground = prototype.DrawBackground;
     _centered       = prototype.Centered;
 }
 public MarkerBase(MarkerBase prototype) : base(prototype)
 {
     mWidth          = prototype.Width;
     mHeight         = prototype.Height;
     mBackColor      = prototype.BackColor;
     mDrawBackground = prototype.DrawBackground;
     mCentered       = prototype.Centered;
 }
		public MarkerBase(MarkerBase prototype): base(prototype)
		{
			mWidth = prototype.Width;
			mHeight = prototype.Height;
			mBackColor = prototype.BackColor;
			mDrawBackground = prototype.DrawBackground;
			mCentered = prototype.Centered;
		}
Example #4
0
        //Renders a graphics marker
        protected virtual void RenderMarkerAction(MarkerBase marker, PointF markerPoint, PointF referencePoint, Graphics graphics, IRender render, IRenderDesign renderDesign)
        {
            if (marker == null)
            {
                return;
            }

            //Save the graphics state
            Matrix gstate = graphics.Transform;

            //Apply the marker transform and render the marker
            graphics.Transform = GetMarkerTransform(marker, markerPoint, referencePoint, graphics.Transform);
            marker.RenderAction(graphics, render, renderDesign);

            //Restore the graphics state
            graphics.Transform = gstate;
        }
Example #5
0
        //Determines if a marker contains the supplied point
        private bool MarkerContains(MarkerBase marker, PointF markerPoint, PointF referencePoint, PointF location)
        {
            if (marker == null)
            {
                return(false);
            }

            //Create a new matrix at the line location
            Matrix matrix = new Matrix();

            matrix.Translate(Bounds.X, Bounds.Y);

            GraphicsPath path = marker.GetPath();

            path.Transform(GetMarkerTransform(marker, markerPoint, referencePoint, matrix));

            return(path.IsVisible(location));
        }
Example #6
0
        //Returns a marker matrix from a diagram matrix
        public static Matrix GetMarkerTransform(MarkerBase marker, PointF markerPoint, PointF referencePoint, Matrix initialMatrix)
        {
            //Get the angle between the start and end points of the line
            Double rotation = Geometry.DegreesFromRadians(Geometry.GetAngle(markerPoint.X, markerPoint.Y, referencePoint.X, referencePoint.Y));

            //Save the graphics state and translate and transform to the marker origin.
            initialMatrix.Translate(markerPoint.X - marker.Bounds.X, markerPoint.Y - marker.Bounds.Y);
            initialMatrix.Rotate(Convert.ToSingle(rotation - 90));
            if (marker.Centered)
            {
                initialMatrix.Translate(marker.Bounds.Width / 2 * -1, marker.Bounds.Height / 2 * -1);
            }
            else
            {
                initialMatrix.Translate(marker.Bounds.Width / 2 * -1, 1);
            }

            return(initialMatrix);
        }
Example #7
0
		//Determines if a marker contains the supplied point
		private bool MarkerContains(MarkerBase marker, PointF markerPoint,PointF referencePoint,PointF location)
		{
			if (marker == null) return false;

			//Create a new matrix at the line location
			Matrix matrix = new Matrix();
			matrix.Translate(Rectangle.X,Rectangle.Y);

			GraphicsPath path = marker.GetPath();
			path.Transform(GetMarkerTransform(marker,markerPoint,referencePoint,matrix));
			
			return path.IsVisible(location);
		}
Example #8
0
		//Returns a marker matrix from a diagram matrix
		protected virtual Matrix GetMarkerTransform(MarkerBase marker,PointF markerPoint,PointF referencePoint,Matrix initialMatrix)
		{
			//Get the angle between the start and end points of the line
			Double rotation = Geometry.DegreesFromRadians(Geometry.GetAngle(markerPoint.X,markerPoint.Y,referencePoint.X,referencePoint.Y));
			
			//Save the graphics state and translate and transform to the marker origin.
			initialMatrix.Translate(markerPoint.X-Rectangle.X,markerPoint.Y-Rectangle.Y);
			initialMatrix.Rotate(Convert.ToSingle(rotation-90));
			if (marker.Centered) 
			{
				initialMatrix.Translate(marker.Rectangle.Width / 2 * -1,marker.Rectangle.Height / 2 * -1);
			}
			else
			{
				initialMatrix.Translate(marker.Rectangle.Width / 2 * -1,1);
			}
			
			return initialMatrix;
		}
Example #9
0
		//Renders a graphics marker
		protected virtual void RenderMarkerAction(MarkerBase marker,PointF markerPoint,PointF referencePoint,Graphics graphics,IRender render,IRenderDesign renderDesign)
		{
			if (marker == null) return;
			
			//Save the graphics state
			Matrix gstate = graphics.Transform;

			//Apply the marker transform and render the marker
			graphics.Transform = GetMarkerTransform(marker,markerPoint,referencePoint,graphics.Transform);
			marker.RenderAction(graphics,render,renderDesign);

			//Restore the graphics state
			graphics.Transform = gstate;
		}