예제 #1
0
 public ProcessRegion(uint fileLine, uint line, int process, ProcessStyle style, ProcessStyle oldStyle)
 {
     this.mLine 				= line;
     this.mProcess 			= process;
     this.mInitialHeight 	= 0;
     this.mItemPen 			= new Pen(Color.Black, 1);
     this.mFileLine 			= fileLine;
     this.mStyle 			= style;
     this.mOldStyle 			= oldStyle;
 }
 public static void RepertoryImage(Graphics drawDestination, ProcessStyle style, MscStyle style2)
 {
     float[] pattern = new float[2]{5f,5f};
     Pen pen = new Pen(Color.Black);
     drawDestination.DrawLine(Pens.DarkGray,40,10,40,20);
     drawDestination.DrawLine(Pens.DarkGray,40,60,40,70);
     drawDestination.DrawLine(Pens.Black,35,20,45,20);
     drawDestination.DrawLine(Pens.Black,35,60,45,60);
     switch(style){
         case ProcessStyle.Activation:
             drawDestination.FillRectangle(Brushes.DarkGray,35, 20, 10, 40);
             drawDestination.DrawLine(Pens.Black,35,20, 35,60);
             drawDestination.DrawLine(Pens.Black,45,20, 45,60);
             break;
         case ProcessStyle.Suspension:
             pen.DashStyle = System.Drawing.Drawing2D.DashStyle.Custom;
             pen.DashPattern = pattern;
             drawDestination.DrawLine(pen,35,20, 35,60);
             drawDestination.DrawLine(pen,45,20, 45,60);
             pen.DashStyle = System.Drawing.Drawing2D.DashStyle.Solid;
             break;
         case ProcessStyle.Coregion:
             pen.DashStyle = System.Drawing.Drawing2D.DashStyle.Custom;
             pen.DashPattern = pattern;
             drawDestination.DrawLine(pen,40,20, 40,60);
             if (style2 == MscStyle.UML2){
                 drawDestination.DrawLine(Pens.Black,35,20, 35,25);
                 drawDestination.DrawLine(Pens.Black,45,20, 45,25);
                 drawDestination.DrawLine(Pens.Black,35,60, 35,55);
                 drawDestination.DrawLine(Pens.Black,45,60, 45,55);
             }
             pen.DashStyle = System.Drawing.Drawing2D.DashStyle.Solid;
             break;
     }
     drawDestination.DrawLine(Pens.Black,35,20,45,20);
     drawDestination.DrawLine(Pens.Black,35,60,45,60);
     pen.Dispose();
 }
예제 #3
0
        public InterpretResult addProcessRegion(uint fileLine, string processName, uint line, ProcessStyle style)
        {
            IEnumerator enumeratorL = lines.GetEnumerator();
            IEnumerator enumeratorP = processes.GetEnumerator();
            bool lineFound = false;
            bool instanceFound = false;
            for(int j=0;j<processes.Count;j++){
                enumeratorP.MoveNext();
                if(((Process) enumeratorP.Current).ProcessName == processName){
                    instanceFound = true;
                    for(uint i=0;i<lines.Count;i++){
                        enumeratorL.MoveNext();
                        if ( enumeratorL.Current is ProcessLine){
                            if((((ProcessLine) enumeratorL.Current).LineEnd==0)&&(((ProcessLine) enumeratorL.Current).ProcessIndex == j)) {
                                string tmpName = ((ProcessLine) enumeratorL.Current).Name;
                                string tmpDescription = ((ProcessLine) enumeratorL.Current).Description;
                                this.addProcessLineEnd(fileLine, line,j);
                                items.Add(new ProcessRegion(fileLine, line, j, style, ((ProcessLine) enumeratorL.Current).ProcessStyle));
                                this.addProcessLineBeginn(fileLine, tmpName,tmpDescription,line,j,style,((ProcessLine) enumeratorL.Current).CreatingProcess, ((ProcessLine) enumeratorL.Current));
                                lineFound = true;
                                break;
                            }
                        }

                    }
                    break;
                }
            }
            if (instanceFound == false){
                return InterpretResult.InstanceNotFound;
            }
            if (lineFound == false){
                return InterpretResult.LineNotExists;
            }
            mLines = Math.Max(mLines, line);
            return InterpretResult.Ok;
        }
예제 #4
0
 public InterpretResult addProcessLineBeginn(uint fileLine, string name, string description, uint line, int process, ProcessStyle style, ProcessCreate p,ProcessLine oldLine)
 {
     if (process >= processes.Count)
         return InterpretResult.InstanceNotFound;
     IEnumerator enumerator = lines.GetEnumerator();
     for(uint i=0;i<lines.Count;i++){
         enumerator.MoveNext();
         if ( enumerator.Current is ProcessLine)
             if((((ProcessLine) enumerator.Current).LineEnd==0)&&(((ProcessLine) enumerator.Current).ProcessIndex == process)&&(((ProcessLine) enumerator.Current).ProcessType != ProcessType.Dummy)) return InterpretResult.LineAllreadyExists;
     }
     lines.Add(new ProcessLine(fileLine, name, description, line, process, style, p,0,0,oldLine));
     mLines = Math.Max(mLines, line);
     return InterpretResult.Ok;
 }
예제 #5
0
 public ProcessLine(uint fileLine, uint line, int process, ProcessType type, ProcessCreate p, uint left, uint right, ProcessLine oldLine)
 {
     this.mName 				= "";
     this.mLineBeginn 		= line;
     this.mProcess 			= process;
     this.mLineEnd 			= 0;
     this.mItemPen 			= new Pen(Color.Black, 1);
     this.mDescription		= "";
     this.mStyle 			= ProcessStyle.Normal;
     this.mType 				= type;
     if(type==ProcessType.Actor)
         mInitialHeight 		= 50;
     if(type==ProcessType.Dummy)
         this.mStyle			= ProcessStyle.NotUsed;
     this.mFileLine 			= fileLine;
     this.mCreatingProcess 	= p;
     this.mLeft 				= left;
     this.mRight 			= right;
     this.mOldLine			= oldLine;
 }
예제 #6
0
 public ProcessLine(uint fileLine, string name, string description, uint line, int process, ProcessStyle style, ProcessCreate p, uint left, uint right, ProcessLine oldLine)
 {
     this.mName 				= name;
     this.mLineBeginn 		= line;
     this.mProcess 			= process;
     this.mLineEnd 			= 0;
     this.mItemPen 			= new Pen(Color.Black, 1);
     this.mDescription 		= description;
     this.mStyle 			= style;
     this.mType 				= ProcessType.Normal;
     this.mFileLine 			= fileLine;
     this.mCreatingProcess 	= p;
     this.mLeft 				= left;
     this.mRight 			= right;
     this.mOldLine			= oldLine;
 }
예제 #7
0
        public void DrawItem(Graphics drawDestination, float xPosSource, float xPosDestination, float yPos, float lineHeight,float xLeftPos,float xRightPos, ProcessStyle sourceStyle, ProcessStyle destinationStyle)
        {
            float[] pattern = {6f,6f};

            if (xPosSource == Generator.ENV_LEFT)
                xPosSource = xLeftPos;
            if (xPosSource == Generator.ENV_RIGHT)
                xPosSource = xRightPos;
            if (xPosDestination == Generator.ENV_LEFT)
                xPosDestination = xLeftPos;
            if (xPosDestination == Generator.ENV_RIGHT)
                xPosDestination = xRightPos;

            if (xPosDestination<xPosSource){
                xPosSource=xPosDestination+((Generator.LOOP_OFFSET+Generator.LOOP_OFFSET/2)+MSCItem.ItemLayoutSize.Width/2);
                if ((destinationStyle == ProcessStyle.Activation)||(destinationStyle == ProcessStyle.Suspension))
                    xPosDestination +=5;
            }
            if (xPosDestination>xPosSource){
                xPosSource=xPosDestination-((Generator.LOOP_OFFSET+Generator.LOOP_OFFSET/2)+MSCItem.ItemLayoutSize.Width/2);
                if ((destinationStyle == ProcessStyle.Activation)||(destinationStyle == ProcessStyle.Suspension))
                    xPosDestination -=5;
            }
            if (xPosDestination==xPosSource){
                xPosSource=xPosDestination-((Generator.LOOP_OFFSET+Generator.LOOP_OFFSET/2)+MSCItem.ItemLayoutSize.Width/2);
                if ((destinationStyle == ProcessStyle.Activation)||(destinationStyle == ProcessStyle.Suspension))
                    xPosDestination -=5;
            }
            if 	(this.mStyle==MessageStyle.Dashed){
                mItemPen.DashStyle = System.Drawing.Drawing2D.DashStyle.Custom;
                mItemPen.DashPattern = pattern;
            }
            if (mMscStyle == MscStyle.SDL){
                if (xPosDestination>=xPosSource){
                    drawDestination.DrawLine(mItemPen,xPosSource, yPos+lineHeight, xPosDestination, yPos+lineHeight);
                    PointF[] messagePolygon = new PointF[3];
                    messagePolygon[0] = new PointF(xPosDestination, yPos+lineHeight);
                    messagePolygon[1] = new PointF(xPosDestination-8, yPos+lineHeight-4);
                    messagePolygon[2] = new PointF(xPosDestination-8, yPos+lineHeight+4);
                    drawDestination.FillPolygon(Brushes.Black,messagePolygon);

                }
                if (xPosDestination<xPosSource){
                    drawDestination.DrawLine(mItemPen,xPosSource, yPos+lineHeight, xPosDestination, yPos+lineHeight);
                    PointF[] messagePolygon = new PointF[3];
                    messagePolygon[0] = new PointF(xPosDestination, yPos+lineHeight);
                    messagePolygon[1] = new PointF(xPosDestination+8, yPos+lineHeight-4);
                    messagePolygon[2] = new PointF(xPosDestination+8, yPos+lineHeight+4);
                    drawDestination.FillPolygon(Brushes.Black,messagePolygon);
                }
                this.mBounds.X = Math.Min(xPosSource,xPosDestination);
                this.mBounds.Width = Math.Max(xPosSource, xPosDestination)-this.mBounds.X;
                this.mBounds.Y = yPos+lineHeight-4;
                this.mBounds.Height = 8;
            }
            else if(mMscStyle == MscStyle.UML2){
                if (xPosDestination>=xPosSource){
                    drawDestination.DrawLine(mItemPen,xPosSource, yPos+lineHeight, xPosDestination, yPos+lineHeight);
                    mItemPen.DashStyle = System.Drawing.Drawing2D.DashStyle.Solid;
                    if ((mStyle == MessageStyle.Normal)||(mStyle == MessageStyle.Dashed)){
                        drawDestination.DrawLine(mItemPen,xPosDestination, yPos+lineHeight, xPosDestination-8, yPos+lineHeight-4);
                        drawDestination.DrawLine(mItemPen,xPosDestination, yPos+lineHeight, xPosDestination-8, yPos+lineHeight+4);
                    }
                    else if (mStyle == MessageStyle.Synchron){
                        PointF[] messagePolygon = new PointF[3];
                        messagePolygon[0] = new PointF(xPosDestination, yPos+lineHeight);
                        messagePolygon[1] = new PointF(xPosDestination-8, yPos+lineHeight-4);
                        messagePolygon[2] = new PointF(xPosDestination-8, yPos+lineHeight+4);
                        drawDestination.FillPolygon(Brushes.Black,messagePolygon);
                    }
                }
                if (xPosDestination<xPosSource){
                    drawDestination.DrawLine(mItemPen,xPosSource, yPos+lineHeight, xPosDestination, yPos+lineHeight);
                    mItemPen.DashStyle = System.Drawing.Drawing2D.DashStyle.Solid;
                    if ((mStyle == MessageStyle.Normal)||(mStyle == MessageStyle.Dashed)){
                        drawDestination.DrawLine(mItemPen,xPosDestination, yPos+lineHeight, xPosDestination+8, yPos+lineHeight-4);
                        drawDestination.DrawLine(mItemPen,xPosDestination, yPos+lineHeight, xPosDestination+8, yPos+lineHeight+4);
                    }
                    else if (mStyle == MessageStyle.Synchron){
                        PointF[] messagePolygon = new PointF[3];
                        messagePolygon[0] = new PointF(xPosDestination, yPos+lineHeight);
                        messagePolygon[1] = new PointF(xPosDestination+8, yPos+lineHeight-4);
                        messagePolygon[2] = new PointF(xPosDestination+8, yPos+lineHeight+4);
                        drawDestination.FillPolygon(Brushes.Black,messagePolygon);
                    }
                }
                this.mBounds.X = Math.Min(xPosSource,xPosDestination);
                this.mBounds.Width = Math.Max(xPosSource, xPosDestination)-this.mBounds.X;
                this.mBounds.Y = yPos+lineHeight-4;
                this.mBounds.Height = 8;
            }
            mItemPen.DashStyle = System.Drawing.Drawing2D.DashStyle.Solid;
        }
예제 #8
0
        public void DrawItem(Graphics drawDestination, float xPosSource, float xPosDestination, float yPos, float lineHeight,float xLeftPos,float xRightPos, ProcessStyle sourceStyle, ProcessStyle destinationStyle)
        {
            float[] pattern = {6f,6f};
            RectangleF itemBox = new RectangleF();
            SizeF itemNameSize, itemTextSize;
            StringFormat itemStringFormat = new StringFormat();

            if (xPosSource == Generator.ENV_LEFT)
                xPosSource = xLeftPos;
            if (xPosSource == Generator.ENV_RIGHT)
                xPosSource = xRightPos;
            if (xPosDestination == Generator.ENV_LEFT)
                xPosDestination = xLeftPos;
            if (xPosDestination == Generator.ENV_RIGHT)
                xPosDestination = xRightPos;

            if (xPosDestination<xPosSource){
                if ((sourceStyle == ProcessStyle.Activation)||(sourceStyle == ProcessStyle.Suspension))
                    xPosSource -=5;
                if ((destinationStyle == ProcessStyle.Activation)||(destinationStyle == ProcessStyle.Suspension))
                    xPosDestination +=5;
            }
            if (xPosDestination>xPosSource){
                if ((sourceStyle == ProcessStyle.Activation)||(sourceStyle == ProcessStyle.Suspension))
                    xPosSource +=5;
                if ((destinationStyle == ProcessStyle.Activation)||(destinationStyle == ProcessStyle.Suspension))
                    xPosDestination -=5;
            }
            if (xPosDestination==xPosSource){
                if ((sourceStyle == ProcessStyle.Activation)||(sourceStyle == ProcessStyle.Suspension))
                    xPosSource -=5;
                if ((destinationStyle == ProcessStyle.Activation)||(destinationStyle == ProcessStyle.Suspension))
                    xPosDestination -=5;
            }

            if (mMscStyle == MscStyle.SDL){
                if (xPosSource!=xPosDestination){
                    itemTextSize=new SizeF(Math.Abs(xPosDestination-xPosSource)-2, MSCItem.ItemLayoutSize.Height);
                    if 	(this.mStyle==MessageStyle.Dashed){
                        mItemPen.DashStyle = System.Drawing.Drawing2D.DashStyle.Custom;
                        mItemPen.DashPattern = pattern;
                    }
                    itemNameSize = drawDestination.MeasureString(mName, mItemFont, itemTextSize, itemStringFormat);
                    itemStringFormat.Alignment = StringAlignment.Center;
                    if (xPosDestination>xPosSource){
                        drawDestination.FillRectangle(mBackBrush, xPosSource + ((xPosDestination-xPosSource)/2)- itemNameSize.Width / 2, yPos+lineHeight-itemNameSize.Height , itemNameSize.Width, itemNameSize.Height);
                        itemBox = new RectangleF(xPosSource+1, yPos+lineHeight-itemNameSize.Height, itemTextSize.Width, itemNameSize.Height);
                        drawDestination.DrawString(mName,mItemFont,mItemStringBrush,itemBox,itemStringFormat);
                        drawDestination.DrawLine(mItemPen,xPosSource, yPos+lineHeight, xPosDestination, yPos+lineHeight);
                        PointF[] messagePolygon = new PointF[3];
                        messagePolygon[0] = new PointF(xPosDestination, yPos+lineHeight);
                        messagePolygon[1] = new PointF(xPosDestination-8, yPos+lineHeight-4);
                        messagePolygon[2] = new PointF(xPosDestination-8, yPos+lineHeight+4);
                        drawDestination.FillPolygon(Brushes.Black,messagePolygon);
                    }
                    if (xPosDestination<xPosSource){
                        drawDestination.FillRectangle(mBackBrush, xPosDestination + ((xPosSource-xPosDestination)/2)- itemNameSize.Width / 2, yPos+lineHeight-itemNameSize.Height,itemNameSize.Width, itemNameSize.Height);
                        itemBox = new RectangleF(xPosDestination+1, yPos+lineHeight-itemNameSize.Height, itemTextSize.Width, itemNameSize.Height);
                        drawDestination.DrawString(mName,mItemFont,mItemStringBrush,itemBox,itemStringFormat);

                        drawDestination.DrawLine(mItemPen,xPosSource, yPos+lineHeight, xPosDestination, yPos+lineHeight);
                        PointF[] messagePolygon = new PointF[3];
                        messagePolygon[0] = new PointF(xPosDestination, yPos+lineHeight);
                        messagePolygon[1] = new PointF(xPosDestination+8, yPos+lineHeight-4);
                        messagePolygon[2] = new PointF(xPosDestination+8, yPos+lineHeight+4);
                        drawDestination.FillPolygon(Brushes.Black,messagePolygon);
                    }
                    this.mBounds.X = Math.Min(xPosSource,xPosDestination);
                    this.mBounds.Width = Math.Max(xPosSource, xPosDestination)-this.mBounds.X;
                    if (itemBox.Height == 0){
                        this.mBounds.Y = itemBox.Y-4;
                        this.mBounds.Height = 8;
                    }
                    else{
                        this.mBounds.Y = itemBox.Y;
                        this.mBounds.Height = (yPos+lineHeight+4) - this.mBounds.Y;
                    }
                    mItemPen.DashStyle = System.Drawing.Drawing2D.DashStyle.Solid;
                }
                else{
                    itemTextSize=new SizeF(MSCItem.ItemLayoutSize.Width/2+Generator.LOOP_OFFSET, MSCItem.ItemLayoutSize.Height-mInitialHeight);
                    itemNameSize = drawDestination.MeasureString(mName, mItemFont, itemTextSize, itemStringFormat);
                    yPos += Math.Max(0,(lineHeight-(itemNameSize.Height+mInitialHeight)));
                    itemStringFormat.Alignment = StringAlignment.Near;
                    itemBox = new RectangleF(xPosSource-MSCItem.ItemLayoutSize.Width/2-Generator.LOOP_OFFSET, yPos, itemNameSize.Width, itemNameSize.Height);
                    drawDestination.FillRectangle(mBackBrush,itemBox);
                    drawDestination.DrawString(mName,mItemFont,mItemStringBrush,itemBox,itemStringFormat);
                    drawDestination.DrawLine(mItemPen,xPosSource,yPos+itemNameSize.Height, xPosSource-MSCItem.ItemLayoutSize.Width/2,yPos+itemNameSize.Height);
                    drawDestination.DrawLine(mItemPen,xPosSource-MSCItem.ItemLayoutSize.Width/2,yPos+itemNameSize.Height, xPosSource-MSCItem.ItemLayoutSize.Width/2,yPos+itemNameSize.Height+mInitialHeight);
                    drawDestination.DrawLine(mItemPen,xPosSource-MSCItem.ItemLayoutSize.Width/2,yPos+itemNameSize.Height+mInitialHeight, xPosSource,yPos+itemNameSize.Height+mInitialHeight);
                    PointF[] messagePolygon = new PointF[3];
                    messagePolygon[0] = new PointF(xPosDestination, yPos+itemNameSize.Height+mInitialHeight);
                    messagePolygon[1] = new PointF(xPosDestination-8, yPos+itemNameSize.Height+mInitialHeight-4);
                    messagePolygon[2] = new PointF(xPosDestination-8, yPos+itemNameSize.Height+mInitialHeight+4);
                    drawDestination.FillPolygon(Brushes.Black,messagePolygon);
                    this.mBounds.X = itemBox.X;
                    this.mBounds.Width = MSCItem.ItemLayoutSize.Width/2+Generator.LOOP_OFFSET;
                    this.mBounds.Y = itemBox.Y;
                    this.mBounds.Height = (yPos+itemNameSize.Height+mInitialHeight+4) - this.mBounds.Y;

                }
            }
            else if (mMscStyle == MscStyle.UML2){
                if (xPosSource!=xPosDestination){
                    itemTextSize=new SizeF(Math.Abs(xPosDestination-xPosSource)-2, MSCItem.ItemLayoutSize.Height);
                    if 	(this.mStyle==MessageStyle.Dashed){
                        mItemPen.DashStyle = System.Drawing.Drawing2D.DashStyle.Custom;
                        mItemPen.DashPattern = pattern;
                    }
                    itemNameSize = drawDestination.MeasureString(mName, mItemFont, itemTextSize, itemStringFormat);
                    itemStringFormat.Alignment = StringAlignment.Center;
                    if (xPosDestination>xPosSource){
                        drawDestination.FillRectangle(mBackBrush, xPosSource + ((xPosDestination-xPosSource)/2)- itemNameSize.Width / 2, yPos+lineHeight-itemNameSize.Height , itemNameSize.Width, itemNameSize.Height);
                        itemBox = new RectangleF(xPosSource+1, yPos+lineHeight-itemNameSize.Height, itemTextSize.Width, itemNameSize.Height);
                        drawDestination.DrawString(mName,mItemFont,mItemStringBrush,itemBox,itemStringFormat);
                        drawDestination.DrawLine(mItemPen,xPosSource, yPos+lineHeight, xPosDestination, yPos+lineHeight);
                        if (this.mStyle==MessageStyle.Synchron){
                            PointF[] messagePolygon = new PointF[3];
                            messagePolygon[0] = new PointF(xPosDestination, yPos+lineHeight);
                            messagePolygon[1] = new PointF(xPosDestination-8, yPos+lineHeight-4);
                            messagePolygon[2] = new PointF(xPosDestination-8, yPos+lineHeight+4);
                            drawDestination.FillPolygon(Brushes.Black,messagePolygon);
                        }
                        else{
                            drawDestination.DrawLine(mItemPen, xPosDestination, yPos+lineHeight, xPosDestination-8, yPos+lineHeight-4);
                            drawDestination.DrawLine(mItemPen, xPosDestination, yPos+lineHeight, xPosDestination-8, yPos+lineHeight+4);
                        }
                    }
                    if (xPosDestination<xPosSource){
                        drawDestination.FillRectangle(mBackBrush, xPosDestination + ((xPosSource-xPosDestination)/2)- itemNameSize.Width / 2, yPos+lineHeight-itemNameSize.Height,itemNameSize.Width, itemNameSize.Height);
                        itemBox = new RectangleF(xPosDestination+1, yPos+lineHeight-itemNameSize.Height, itemTextSize.Width, itemNameSize.Height);
                        drawDestination.DrawString(mName,mItemFont,mItemStringBrush,itemBox,itemStringFormat);

                        drawDestination.DrawLine(mItemPen,xPosSource, yPos+lineHeight, xPosDestination, yPos+lineHeight);
                        if (this.mStyle==MessageStyle.Synchron){
                            PointF[] messagePolygon = new PointF[3];
                            messagePolygon[0] = new PointF(xPosDestination, yPos+lineHeight);
                            messagePolygon[1] = new PointF(xPosDestination+8, yPos+lineHeight-4);
                            messagePolygon[2] = new PointF(xPosDestination+8, yPos+lineHeight+4);
                            drawDestination.FillPolygon(Brushes.Black,messagePolygon);
                        }
                        else{
                            mItemPen.DashStyle = System.Drawing.Drawing2D.DashStyle.Solid;
                            drawDestination.DrawLine(mItemPen, xPosDestination, yPos+lineHeight, xPosDestination+8, yPos+lineHeight-4);
                            drawDestination.DrawLine(mItemPen, xPosDestination, yPos+lineHeight, xPosDestination+8, yPos+lineHeight+4);
                        }
                    }
                    this.mBounds.X = Math.Min(xPosSource,xPosDestination);
                    this.mBounds.Width = Math.Max(xPosSource, xPosDestination)-this.mBounds.X;
                    if (itemBox.Height == 0){
                        this.mBounds.Y = itemBox.Y-4;
                        this.mBounds.Height = 8;
                    }
                    else{
                        this.mBounds.Y = itemBox.Y;
                        this.mBounds.Height = (yPos+lineHeight+4) - this.mBounds.Y;
                    }
                    mItemPen.DashStyle = System.Drawing.Drawing2D.DashStyle.Solid;
                }
                else{
                    itemTextSize=new SizeF(MSCItem.ItemLayoutSize.Width/2+Generator.LOOP_OFFSET, MSCItem.ItemLayoutSize.Height-mInitialHeight);
                    itemNameSize = drawDestination.MeasureString(mName, mItemFont, itemTextSize, itemStringFormat);
                    yPos += Math.Max(0,(lineHeight-(itemNameSize.Height+mInitialHeight)));
                    itemStringFormat.Alignment = StringAlignment.Near;
                    itemBox = new RectangleF(xPosSource-MSCItem.ItemLayoutSize.Width/2-Generator.LOOP_OFFSET, yPos, itemNameSize.Width, itemNameSize.Height);
                    drawDestination.FillRectangle(mBackBrush,itemBox);
                    drawDestination.DrawString(mName,mItemFont,mItemStringBrush,itemBox,itemStringFormat);
                    drawDestination.DrawLine(mItemPen,xPosSource,yPos+itemNameSize.Height, xPosSource-MSCItem.ItemLayoutSize.Width/2,yPos+itemNameSize.Height);
                    drawDestination.DrawLine(mItemPen,xPosSource-MSCItem.ItemLayoutSize.Width/2,yPos+itemNameSize.Height, xPosSource-MSCItem.ItemLayoutSize.Width/2,yPos+itemNameSize.Height+mInitialHeight);
                    drawDestination.DrawLine(mItemPen,xPosSource-MSCItem.ItemLayoutSize.Width/2,yPos+itemNameSize.Height+mInitialHeight, xPosSource,yPos+itemNameSize.Height+mInitialHeight);
                    if (this.mStyle==MessageStyle.Synchron){
                        PointF[] messagePolygon = new PointF[3];
                        messagePolygon[0] = new PointF(xPosDestination, yPos+itemNameSize.Height+mInitialHeight);
                        messagePolygon[1] = new PointF(xPosDestination-8, yPos+itemNameSize.Height+mInitialHeight-4);
                        messagePolygon[2] = new PointF(xPosDestination-8, yPos+itemNameSize.Height+mInitialHeight+4);
                        drawDestination.FillPolygon(Brushes.Black,messagePolygon);
                    }
                    else{
                        mItemPen.DashStyle = System.Drawing.Drawing2D.DashStyle.Solid;
                        drawDestination.DrawLine(mItemPen, xPosDestination, yPos+lineHeight, xPosDestination-8, yPos+lineHeight-4);
                        drawDestination.DrawLine(mItemPen, xPosDestination, yPos+lineHeight, xPosDestination-8, yPos+lineHeight+4);
                    }
                    this.mBounds.X = itemBox.X;
                    this.mBounds.Width = MSCItem.ItemLayoutSize.Width/2+Generator.LOOP_OFFSET;
                    this.mBounds.Y = itemBox.Y;
                    this.mBounds.Height = (yPos+itemNameSize.Height+mInitialHeight+4) - this.mBounds.Y;
                }
            }
            itemStringFormat.Dispose();
        }
예제 #9
0
        public void DrawItem(Graphics drawDestination, float xPosSource, float xPosDestination, float yPos, float lineHeight,float xLeftPos,float xRightPos, ProcessStyle sourceStyle, ProcessStyle destinationStyle)
        {
            float[] pattern = {6f,6f};
            RectangleF itemBox = new RectangleF();
            SizeF itemNameSize, itemTextSize;
            StringFormat itemStringFormat = new StringFormat();
            bool xisy = false;

            if (xPosSource == Generator.ENV_LEFT)
                xPosSource = xLeftPos;
            if (xPosSource == Generator.ENV_RIGHT)
                xPosSource = xRightPos;
            if (xPosDestination == Generator.ENV_LEFT)
                xPosDestination = xLeftPos;
            if (xPosDestination == Generator.ENV_RIGHT)
                xPosDestination = xRightPos;

            if (xPosDestination<xPosSource){
                xPosDestination+=((Generator.LOOP_OFFSET+Generator.LOOP_OFFSET/2)+MSCItem.ItemLayoutSize.Width/2);
                if ((sourceStyle == ProcessStyle.Activation)||(sourceStyle == ProcessStyle.Suspension))
                    xPosSource -=5;
            }
            if (xPosDestination>xPosSource){
                xPosDestination-=((Generator.LOOP_OFFSET+Generator.LOOP_OFFSET/2)+MSCItem.ItemLayoutSize.Width/2);
                if ((sourceStyle == ProcessStyle.Activation)||(sourceStyle == ProcessStyle.Suspension))
                    xPosSource +=5;
            }
            if (xPosDestination==xPosSource){
                xisy = true;
                if ((sourceStyle == ProcessStyle.Activation)||(sourceStyle == ProcessStyle.Suspension)){
                    xPosSource -=5;
                }
            }
            if (!xisy){
                itemTextSize=new SizeF(Math.Abs(xPosDestination-xPosSource), MSCItem.ItemLayoutSize.Height);
                if 	(this.mStyle==MessageStyle.Dashed){
                    mItemPen.DashStyle = System.Drawing.Drawing2D.DashStyle.Custom;
                    mItemPen.DashPattern = pattern;
                }
                itemNameSize = drawDestination.MeasureString(mName, mItemFont, itemTextSize, itemStringFormat);
                itemStringFormat.Alignment = StringAlignment.Center;
                if (xPosDestination>xPosSource){
                    drawDestination.FillRectangle(mBackBrush, (xPosDestination+xPosSource)/2-itemNameSize.Width/2, yPos+lineHeight-itemNameSize.Height, itemNameSize.Width, itemNameSize.Height);
                    itemBox = new RectangleF((xPosDestination+xPosSource)/2-itemNameSize.Width/2, yPos+lineHeight-itemNameSize.Height, itemNameSize.Width, itemNameSize.Height);
                    drawDestination.DrawString(mName,mItemFont,mItemStringBrush,itemBox,itemStringFormat);
                    drawDestination.DrawLine(mItemPen,xPosSource, yPos+lineHeight, xPosDestination, yPos+lineHeight);
                }
                if (xPosDestination<xPosSource){
                    drawDestination.FillRectangle(mBackBrush, (xPosDestination+xPosSource)/2-itemNameSize.Width/2, yPos+lineHeight-itemNameSize.Height,itemNameSize.Width, itemNameSize.Height);
                    itemBox = new RectangleF((xPosDestination+xPosSource)/2-itemNameSize.Width/2, yPos+lineHeight-itemNameSize.Height, itemNameSize.Width, itemNameSize.Height);
                    drawDestination.DrawString(mName,mItemFont,mItemStringBrush,itemBox,itemStringFormat);
                    drawDestination.DrawLine(mItemPen,xPosSource, yPos+lineHeight, xPosDestination, yPos+lineHeight);
                }
                this.mBounds.X = Math.Min(xPosSource,xPosDestination);
                this.mBounds.Width = Math.Max(xPosSource, xPosDestination)-this.mBounds.X;
                this.mBounds.Y = itemBox.Y;
                this.mBounds.Height = (yPos+lineHeight) - this.mBounds.Y;
            }
            else if(xisy){
                if 	(this.mStyle==MessageStyle.Dashed){
                    mItemPen.DashStyle = System.Drawing.Drawing2D.DashStyle.Custom;
                    mItemPen.DashPattern = pattern;
                }
                itemTextSize=new SizeF(MSCItem.ItemLayoutSize.Width/2+Generator.LOOP_OFFSET, MSCItem.ItemLayoutSize.Height-mInitialHeight);
                itemNameSize = drawDestination.MeasureString(mName, mItemFont, itemTextSize, itemStringFormat);
                itemStringFormat.Alignment = StringAlignment.Near;
                itemBox = new RectangleF(xPosDestination-MSCItem.ItemLayoutSize.Width/2-Generator.LOOP_OFFSET, yPos+lineHeight-itemNameSize.Height, itemTextSize.Width, itemNameSize.Height);
                drawDestination.DrawString(mName,mItemFont,mItemStringBrush,itemBox,itemStringFormat);
                drawDestination.DrawLine(mItemPen,xPosSource,yPos+lineHeight, xPosDestination-MSCItem.ItemLayoutSize.Width/2-(Generator.LOOP_OFFSET+Generator.LOOP_OFFSET/2),yPos+lineHeight);
                this.mBounds.X = xPosSource-MSCItem.ItemLayoutSize.Width/2-(Generator.LOOP_OFFSET+Generator.LOOP_OFFSET/2);
                this.mBounds.Width = MSCItem.ItemLayoutSize.Width/2-(Generator.LOOP_OFFSET+Generator.LOOP_OFFSET/2);
                this.mBounds.Y = itemBox.Y;
                this.mBounds.Height = (yPos+lineHeight) - this.mBounds.Y;
            }
            mItemPen.DashStyle = System.Drawing.Drawing2D.DashStyle.Solid;
            itemStringFormat.Dispose();
        }