コード例 #1
0
ファイル: Port.cs プロジェクト: michaelrut/arcgis-diagrammer
        protected internal override void Render(Graphics graphics, IRender render)
        {
            if (GetPathInternal() == null)
            {
                return;
            }

            //Translate by offset
            graphics.TranslateTransform(mOffset.X, mOffset.Y);

            //Fill and draw the port
            RenderPort(graphics, render);

            //Render image
            if (Image != null)
            {
                Image.Render(graphics, render);
            }

            //Render label
            if (Label != null)
            {
                Label.Render(graphics, render);
            }

            graphics.TranslateTransform(-mOffset.X, -mOffset.Y);
        }
コード例 #2
0
        protected internal override void Render(Graphics graphics, IRender render)
        {
            base.Render(graphics, render);

            //Render Image
            if (Image != null || Label != null)
            {
                //Determine central point
                //If even number of points, then position half way on segment
                PointF center;
                if (Points.Count % 2 == 0)
                {
                    int    index = (Points.Count / 2) - 1;
                    PointF start = (PointF)Points[index];
                    PointF end   = (PointF)Points[index + 1];
                    center = new PointF(start.X + ((end.X - start.X) / 2), start.Y + ((end.Y - start.Y) / 2));
                }
                else                 //Else calculate from middle segment direction
                {
                    int index = Convert.ToInt32(Math.Floor((Double)(Points.Count / 2)));
                    center = (PointF)Points[index];
                }

                //Offset to line co-ordinates
                center = new PointF(center.X - Rectangle.X, center.Y - Rectangle.Y);

                graphics.TranslateTransform(center.X, center.Y);
                if (Image != null)
                {
                    Image.Render(graphics, render);
                }
                if (Label != null)
                {
                    Label.Render(graphics, render);
                }
                graphics.TranslateTransform(-center.X, -center.Y);
            }

            //Draw test squares for points
//			if (Selected)
//			{
//				graphics.TranslateTransform(-Rectangle.X,-Rectangle.Y);
//				Pen newPen = new Pen(Color.Red,1);
//
//				Font font = new Font("Arial",8);
//				SolidBrush brush = new SolidBrush(Color.Blue);
//				int offset = 0;
//
//				foreach (PointF point in Points)
//				{
//					offset+=20;
//					graphics.DrawRectangle(newPen,point.X-2,point.Y-2,4,4);
//					graphics.DrawString(point.ToString(),font,brush,10,offset);
//
//				}
//				graphics.TranslateTransform(Rectangle.X,Rectangle.Y);
//			}
        }
コード例 #3
0
        protected internal override void Render(Graphics graphics, IRender render)
        {
            if (GetPathInternal() == null)
            {
                return;
            }

            //Fill the solid
            RenderSolid(graphics, render);

            //Set clipping for this shape
            Region current = null;

            //Add local clipping
            if (Clip)
            {
                Region region = new Region(GetPathInternal());
                current = graphics.Clip;
                graphics.SetClip(region, CombineMode.Intersect);
            }

            //Render image
            if (Image != null)
            {
                Image.Render(graphics, render);
            }

            //Render label
            if (Label != null)
            {
                Label.Render(graphics, InternalRectangle, render);
            }

            //Restore clipping
            if (Clip)
            {
                graphics.Clip = current;
            }


            //Call the base implementation of render to draw border
            if (DrawBorder)
            {
                base.Render(graphics, render);
            }
        }
コード例 #4
0
        protected internal override void Render(Graphics graphics, IRender render)
        {
            base.Render(graphics, render);

            //Render Image and Label
            if (Image != null || Label != null)
            {
                PointF center = GetLabelLocation();

                graphics.TranslateTransform(center.X, center.Y);
                if (Image != null)
                {
                    Image.Render(graphics, render);
                }
                if (Label != null)
                {
                    Label.Render(graphics, render);
                }
                graphics.TranslateTransform(-center.X, -center.Y);
            }
        }