Пример #1
0
 protected virtual void InitDrawDestination()
 {
     drawDestination = this.picOutput.CreateGraphics();
     ipHDC = drawDestination.GetHdc();
     tmpWorksheet = new Worksheet();
     imageMetaFile.Dispose();
     imageMetaFile = new Metafile(ipHDC,new Rectangle(0,0,worksheet.GetWorksheetWidth(),worksheet.GetWorksheetHeight()),System.Drawing.Imaging.MetafileFrameUnit.Pixel);//System.Drawing.Imaging.EmfType.EmfPlusDual); 										// open created empty emf file
     drawDestination = Graphics.FromImage(imageMetaFile);
     tmpWorksheet.EnableFootLine = true;
     tmpWorksheet.Width = worksheet.GetWorksheetWidth();
     tmpWorksheet.Height = worksheet.GetWorksheetHeight();
     tmpWorksheet.SetMargins(0,0,0,0);
     tmpWorksheet.EnableFootLine = false;
     drawDestination.Clear(Color.White);
     drawDestination.SmoothingMode = imageSmoothingMode;		// set image quality
     drawDestination.TextRenderingHint = System.Drawing.Text.TextRenderingHint.AntiAliasGridFit;
 }
Пример #2
0
        protected virtual void LoadFile(string filename, bool showInProgram)
        {
            string s = String.Empty;
            string[] temp;
            temp = filename.Split('\\');								// get filename
            lastOpenedFile = filename;
            sourceFileWatch.Path = System.IO.Directory.GetParent(lastOpenedFile).FullName;
            Worksheet.InitFootLine();
            Worksheet tmpWorksheet = new Worksheet();								// create temporary worksheet without margins for screen otput
            tmpWorksheet.Width = worksheet.GetWorksheetWidth();
            tmpWorksheet.Height = worksheet.GetWorksheetHeight();
            tmpWorksheet.EnableFootLine = false;
            tmpWorksheet.SetMargins(0,0,0,0);
            if (showInProgram == true){
                this.stbpFile.Text = temp[temp.Length-1];
                Worksheet.FileName = temp[temp.Length - 1];
                this.rtbMscEditor.MarkedRow = 0;
                this.rtbMscEditor.LoadFile(lastOpenedFile,RichTextBoxStreamType.PlainText);
                this.tlbbSaveText.Enabled = false;
                this.umnuSave.Enabled = false;
            }
            InterpretFile(filename, showInProgram);

            this.RtbTextInitUndo();
            this.rtbMscEditor.Edited = false;
            this.rtbMscEditor.Modified = false;
            this.Text = appName + " - " + lastOpenedFile;
            if (showInProgram == true){
                this.ZoomToPage();
                this.CenterPage();
            }
        }
Пример #3
0
        private void OwenInitializeComponent()
        {
            drawDestination = this.CreateGraphics();
            worksheet = new Worksheet();	// new worksheet object
            ipHDC = drawDestination.GetHdc();
            imageMetaFile = new Metafile(ipHDC,System.Drawing.Imaging.EmfType.EmfOnly); 										// open created empty emf file
            imageBitmap = new Bitmap(this.worksheet.GetWorksheetWidth(), this.worksheet.GetWorksheetHeight()); 		// working bitmap, draw destination of generated imageBitmap
            this.printDocument = new PrintDocument();
            this.printDocument.PrintPage += new System.Drawing.Printing.PrintPageEventHandler(this.PrintDocumentPrintPage);
            this.printDocument.BeginPrint += new System.Drawing.Printing.PrintEventHandler(this.PrintDocumentBeginPrint);
            this.rtbMscEditor.MouseDown += new System.Windows.Forms.MouseEventHandler(this.RtbEditorMouseDown);
            //searchDialog = new Search();

            this.picOutput.MouseClick += new System.Windows.Forms.MouseEventHandler(this.ImageClick);
            //			this.picOutput.MouseDown += new System.Windows.Forms.MouseEventHandler(this.ImageClick);
            this.picOutput.MouseWheel += new System.Windows.Forms.MouseEventHandler(this.ImageWheel);
            this.picOutput.MouseEnter += new System.EventHandler(this.OnMouseEnter);
            this.picOutput.Paint += new System.Windows.Forms.PaintEventHandler(this.PicOutputRedraw);
            this.tabWork.SelectedIndexChanged += new EventHandler(TabChanged);
            this.picOutput.MouseDown += new System.Windows.Forms.MouseEventHandler(this.PicOutput_MouseDown);
            this.picOutput.MouseUp += new System.Windows.Forms.MouseEventHandler(this.PicOutput_MouseUp);
            this.picOutput.MouseMove += new System.Windows.Forms.MouseEventHandler(PicOutput_MouseMove);
            this.picOutput.KeyDown += new KeyEventHandler(PicOutput_KeyDown);
            this.picOutput.KeyUp += new KeyEventHandler(PicOutput_KeyUp);
            this.cmnuSearch.Click += new System.EventHandler(CmnuSearchClick);
            this.pnlOutput.DoubleClick += new EventHandler(PnlOutput_DoubleClick);
            this.Activated += new EventHandler(GUI_GotFocus);
            //			this.cmnuSearchAgain.Click += new System.EventHandler(cmnuSearchAgainClick);
            //			this.cmnuReplace.Click += new System.EventHandler(cmnuReplaceClick);
            //			this.cmnuComment.Click += new System.EventHandler(cmnuCommentClick);
            //			this.cmnuDo.Click += new System.EventHandler(cmnuDoClick);
            //			this.cmnuUndo.Click += new System.EventHandler(cmnuUndoClick);

            this.picOutput.DoubleClick += new System.EventHandler(this.ImageDoubleClick);

            try{
                this.printDocument.DefaultPageSettings.Landscape = true;
            }
            catch{};

            OptionsDialog.OptionsWorksheet = worksheet;
            OptionsDialog.TargetBounds = this.Bounds;
            //			this.rtbMscEditor.Paint += new System.Windows.Forms.PaintEventHandler(this.EditorRedraw);

            this.lstPreview.MeasureItem += new System.Windows.Forms.MeasureItemEventHandler(this.DrawPreviewResize);
            this.lstPreview.DrawItem += new System.Windows.Forms.DrawItemEventHandler(this.DrawPreview);
            this.lstPreview.SelectedIndexChanged += new System.EventHandler(this.SelectedPageChanged);
            this.rtbMscEditor.TextChanged += new System.EventHandler(this.EditorTextChanged);
            this.Closing += new System.ComponentModel.CancelEventHandler(this.GUIClose);
            this.rtbMscEditor.TextChanged += new System.EventHandler(this.RtbTextOnTextChanged);
            this.rtbMscEditor.LineChanged += new NumberingEditor.LineChangedEventHandler(RtbMscEditor_LineChanged);
            this.rtbMscEditor.KeyDown += new KeyEventHandler(RtbMscEditor_KeyDown);
            this.rtbMscEditor.KeyPress += new KeyPressEventHandler(RtbMscEditor_KeyPress);
            this.rtbMscEditor.SelectionChanged += new EventHandler(RtbMscEditor_SelectionChanged);

            ShowGraphicMenu();

            //Drag&Drop:
            this.DragEnter += new DragEventHandler(GUI_DragEnter);
            this.DragDrop += new DragEventHandler(GUI_DragDrop);
            this.AllowDrop = true;
            this.rtbMscEditor.DragEnter += new DragEventHandler(GUI_DragEnter);
            this.rtbMscEditor.DragDrop += new DragEventHandler(GUI_DragDrop);
            this.rtbMscEditor.AllowDrop = true;
        }
Пример #4
0
 protected virtual void ExportImage(string filename, string format)
 {
     try
     {
     uint pages;
     Image exportImage = new Bitmap(this.worksheet.Width, this.worksheet.Height);		// create export draw area
     Graphics drawDestination = Graphics.FromImage(exportImage);
     Graphics grph;
     IntPtr ipHDC;																	//necessary for wmf and emf export
     Metafile mf;
     //EMetafile ef;
     pages = GetPages();		// calculate imageBitmap page count
     if (pages > 0)																	// something to do?
     {
         if (filename.LastIndexOf('.') >= (filename.Length-4)){
             filename = filename.Substring(0,filename.LastIndexOf('.'));
         }
         for (uint i=1; i<=pages; i++){
             switch (format.ToUpper()){				// identify selected format
                 case "BMP":
                     drawDestination.Clear(Color.White);
                     DrawPage(drawDestination,i);
                     exportImage.Save(filename + "_" + i + ".bmp");
                     break;
                 case "GIF":
                     drawDestination.Clear(Color.White);
                     DrawPage(drawDestination,i);
                     exportImage.Save(filename + "_" + i + ".gif",System.Drawing.Imaging.ImageFormat.Gif);
                     break;
                 case "JPG":
                     drawDestination.Clear(Color.White);
                     DrawPage(drawDestination,i);
                     exportImage.Save(filename + "_" + i + ".jpg",System.Drawing.Imaging.ImageFormat.Jpeg);
                     break;
                 case "PNG":
                     drawDestination.Clear(Color.White);
                     DrawPage(drawDestination,i);
                     exportImage.Save(filename + "_" + i + ".png",System.Drawing.Imaging.ImageFormat.Png);
                     break;
                 case "WMF":
                     drawDestination.Clear(Color.White);
                     exportImage.Save(filename + "_" + i + ".wmf",System.Drawing.Imaging.ImageFormat.Wmf);		// for save as wmf first empty wmf file shall be created
                     grph = this.CreateGraphics();
                     ipHDC = grph.GetHdc();
                     mf = new Metafile(filename + "_" + i + ".wmf", ipHDC); 										// open created empty wmf file
                     grph = Graphics.FromImage(mf);
                     grph.Clear(Color.White);
                     grph.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.None;					// set image quality
                     grph.TextRenderingHint = System.Drawing.Text.TextRenderingHint.ClearTypeGridFit;
                     DrawPage(grph,i);														// draw imageBitmap direct to wmf file
                     grph.Dispose();
                     mf.Dispose();
                     break;
                 case "EMF":
                     drawDestination.Clear(Color.White);
                     exportImage.Save(filename + "_" + i + ".emf",System.Drawing.Imaging.ImageFormat.Emf);  		// for save as emf first empty wmf file shall be created
                     grph = this.CreateGraphics();
                     ipHDC = grph.GetHdc();
                     mf = new Metafile(filename + "_" + i + ".emf", ipHDC); 										// open created empty emf file
                     grph = Graphics.FromImage(mf);
                     grph.Clear(Color.White);
                     grph.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.None;					// set image quality
                     grph.TextRenderingHint = System.Drawing.Text.TextRenderingHint.ClearTypeGridFit;
                     DrawPage(grph,i);														// draw imageBitmap direct to emf file
                     grph.Dispose();
                     mf.Dispose();
                     break;
             }
         }
     }
     Worksheet tmpWorksheet = new Worksheet();						// recalculate back line hights for screen output
     tmpWorksheet.Width = worksheet.GetWorksheetWidth();
     tmpWorksheet.Height = worksheet.GetWorksheetHeight();
     tmpWorksheet.SetMargins(0,0,0,0);
     drawDestination.Dispose();
     exportImage.Dispose();
     }
     catch(Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
Пример #5
0
        protected override void ExportImage(string filename, string format)
        {
            uint pages;
            Image exportImage = new Bitmap(this.worksheet.Width, this.worksheet.Height);		// create export draw area
            Graphics drawDestination = Graphics.FromImage(exportImage);
            //MessageBox.Show(drawDestination.PageScale.ToString());
            Graphics grph;
            IntPtr ipHDC;																	//necessary for wmf and emf export
            Metafile mf;
            Trace.WriteLine(DateTime.Now.TimeOfDay + " height: " + worksheet.Height.ToString());
            Worksheet w = new Worksheet();
            w.WorksheetValues = worksheet.WorksheetValues;
            pages = GetPages();		// calculate imageBitmap page count
            if (pages > 0) {																	// something to do?
                if (Output.AutosizeExport == true) {
                    int x = 0;
                    for (int k = 0; k < generator.PageHeights.Length; k++)
                        x +=	(int)generator.PageHeights[k] - (int)generator.YProcessOffset - (int)Generator.BOTTOM_MARGIN_MSC - (int)generator.YItemOffset;
                    x += (int)generator.YProcessOffset + (int)Generator.BOTTOM_MARGIN_MSC + (int)generator.YItemOffset;
                    worksheet.SetWorksheetHeight(x);
                    if (Output.AutosizeOutputWidth) {
                        worksheet.SetWorksheetWidth((int)generator.AutoWidth);
                    }
                    exportImage = new Bitmap(this.worksheet.Width, this.worksheet.Height);
                    Trace.WriteLine(DateTime.Now.TimeOfDay + " height: ");
                    drawDestination = Graphics.FromImage(exportImage);
                    switch (format.ToUpper()) {				// identify selected format
                        case "BMP":
                            drawDestination.Clear(Color.White);
                            DrawPage(drawDestination, 0);
                            exportImage.Save(filename + ".bmp");
                            break;
                        case "GIF":
                            drawDestination.Clear(Color.White);
                            DrawPage(drawDestination, 0);
                            exportImage.Save(filename + ".gif", System.Drawing.Imaging.ImageFormat.Gif);
                            break;
                        case "JPG":
                            drawDestination.Clear(Color.White);
                            DrawPage(drawDestination, 0);
                            exportImage.Save(filename + ".jpg", System.Drawing.Imaging.ImageFormat.Jpeg);
                            break;
                        case "PNG":
                            drawDestination.Clear(Color.White);
                            DrawPage(drawDestination, 0);
                            exportImage.Save(filename + ".png", System.Drawing.Imaging.ImageFormat.Png);
                            break;
                        case "WMF":
                            drawDestination.Clear(Color.White);
                            exportImage.Save(filename + ".wmf", System.Drawing.Imaging.ImageFormat.Wmf);		// for save as wmf first empty wmf file shall be created
                            grph = this.CreateGraphics();
                            ipHDC = grph.GetHdc();
                            mf = new Metafile(filename + ".wmf", ipHDC); 										// open created empty wmf file
                            grph = Graphics.FromImage(mf);
                            grph.Clear(Color.White);
                            grph.FillRectangle(Brushes.White, 0, 0, exportImage.Width, exportImage.Height);
                            grph.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.None;					// set image quality
                            grph.TextRenderingHint = System.Drawing.Text.TextRenderingHint.ClearTypeGridFit;
                            DrawPage(grph, 0);														// draw imageBitmap direct to wmf file
                            grph.Dispose();
                            mf.Dispose();
                            break;
                        case "EMF":
                            System.IO.FileStream st = new FileStream(filename + ".emf", FileMode.Create);
                            drawDestination.Clear(Color.White);
                            grph = this.CreateGraphics();
                            ipHDC = grph.GetHdc();
                            mf = new Metafile(st, ipHDC);
                            grph = Graphics.FromImage(mf);
                            grph.Clear(Color.White);
                            grph.FillRectangle(Brushes.White, 0, 0, exportImage.Width, exportImage.Height);
                            grph.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.None;					// set image quality
                            grph.TextRenderingHint = System.Drawing.Text.TextRenderingHint.ClearTypeGridFit;
                            DrawPage(grph, 0);														// draw imageBitmap direct to emf file
                            grph.Dispose();
                            st.Dispose();
                            mf.Dispose();
                            break;

                    }
                } else {
                    if (filename.LastIndexOf('.') >= (filename.Length - 4)) {
                        filename = filename.Substring(0, filename.LastIndexOf('.'));
                    }
                    for (uint i = 1; i <= pages; i++) {
                        if (Output.AutosizeOutputHeight) {
                            worksheet.SetWorksheetHeight((int)generator.PageHeights[i - 1]); // correct height for export

                        }
                        if (Output.AutosizeOutputWidth) {
                            worksheet.SetWorksheetWidth((int)generator.AutoWidth);
                        }
                        exportImage = new Bitmap(this.worksheet.Width, this.worksheet.Height);
                        Trace.WriteLine(DateTime.Now.TimeOfDay + " height: ");
                        drawDestination = Graphics.FromImage(exportImage);
                        switch (format.ToUpper()) {				// identify selected format
                            case "BMP":
                                drawDestination.Clear(Color.White);
                                DrawPage(drawDestination, i);
                                exportImage.Save(filename + "_" + i + ".bmp");
                                break;
                            case "GIF":
                                drawDestination.Clear(Color.White);
                                DrawPage(drawDestination, i);
                                exportImage.Save(filename + "_" + i + ".gif", System.Drawing.Imaging.ImageFormat.Gif);
                                break;
                            case "JPG":
                                drawDestination.Clear(Color.White);
                                DrawPage(drawDestination, i);
                                exportImage.Save(filename + "_" + i + ".jpg", System.Drawing.Imaging.ImageFormat.Jpeg);
                                break;
                            case "PNG":
                                drawDestination.Clear(Color.White);
                                DrawPage(drawDestination, i);
                                exportImage.Save(filename + "_" + i + ".png", System.Drawing.Imaging.ImageFormat.Png);
                                break;
                            case "WMF":
                                drawDestination.Clear(Color.White);
                                exportImage.Save(filename + "_" + i + ".wmf", System.Drawing.Imaging.ImageFormat.Wmf);		// for save as wmf first empty wmf file shall be created
                                grph = this.CreateGraphics();
                                ipHDC = grph.GetHdc();
                                mf = new Metafile(filename + "_" + i + ".wmf", ipHDC); 										// open created empty wmf file
                                grph = Graphics.FromImage(mf);
                                grph.Clear(Color.White);
                                grph.FillRectangle(Brushes.White, 0, 0, exportImage.Width, exportImage.Height);
                                grph.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.None;					// set image quality
                                grph.TextRenderingHint = System.Drawing.Text.TextRenderingHint.ClearTypeGridFit;
                                DrawPage(grph, i);														// draw imageBitmap direct to wmf file
                                grph.Dispose();
                                mf.Dispose();
                                break;
                            case "EMF":
                                System.IO.FileStream st = new FileStream(filename + "_" + i + ".emf", FileMode.Create);
                                drawDestination.Clear(Color.White);
                                grph = this.CreateGraphics();
                                ipHDC = grph.GetHdc();
                                mf = new Metafile(st, ipHDC);
                                grph = Graphics.FromImage(mf);
                                grph.Clear(Color.White);
                                grph.FillRectangle(Brushes.White, 0, 0, exportImage.Width, exportImage.Height);
                                grph.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.None;					// set image quality
                                grph.TextRenderingHint = System.Drawing.Text.TextRenderingHint.ClearTypeGridFit;
                                DrawPage(grph, i);														// draw imageBitmap direct to emf file
                                grph.Dispose();
                                st.Dispose();
                                mf.Dispose();
                                break;
                        }
                    }
                }
            }
            worksheet.WorksheetValues = w.WorksheetValues;
            tmpWorksheet.Width = worksheet.GetWorksheetWidth();
            tmpWorksheet.Height = worksheet.GetWorksheetHeight();
            tmpWorksheet.SetMargins(0, 0, 0, 0);
            generator.CalcOffsets(drawDestination, tmpWorksheet);
            drawDestination.Dispose();
            exportImage.Dispose();
            GC.Collect();
        }
Пример #6
0
        protected override void PrintDocumentPrintPage(object sender, PrintPageEventArgs e)
        {
            uint pages = generator.DiagramPages;
            Worksheet w = new Worksheet();
            w.WorksheetValues = worksheet.WorksheetValues;						// store old worksheet
            Image exportImage = new Bitmap(this.worksheet.Width, this.worksheet.Height);		// create export draw area
            e.Graphics.PageScale = 100.0f / (float)exportImage.HorizontalResolution;
            if (maxPage == 0)
                maxPage = pages;												// if not max page selected, print to last page

            if (Output.AutosizeOutputHeight) {				// if auto height activated
                worksheet.SetWorksheetHeight((int)generator.PageHeights[printPage - 1]);		// set the hight of the diagram to print
            }
            if (Output.AutosizeOutputWidth) {
                worksheet.SetWorksheetWidth((int)generator.AutoWidth);
            }
            if (worksheet.Width > worksheet.Height)
                e.Graphics.TextRenderingHint = System.Drawing.Text.TextRenderingHint.ClearTypeGridFit;
            DrawPage(e.Graphics, printPage);						// draw page to printer output
            if (printPage < Math.Min(maxPage, pages)) {										// another site to print ?
                e.HasMorePages = true;
                printPage++;
            }
            worksheet.WorksheetValues = w.WorksheetValues;					// restore old worksheet
            tmpWorksheet.Width = worksheet.GetWorksheetWidth();
            tmpWorksheet.Height = worksheet.GetWorksheetHeight();
            tmpWorksheet.SetMargins(0, 0, 0, 0);
            Graphics drawDestination = Graphics.FromImage(exportImage);
            generator.CalcOffsets(drawDestination, tmpWorksheet);
            drawDestination.Dispose();
            System.GC.Collect();
        }
Пример #7
0
 /// <summary>
 /// draws margins
 /// </summary>
 /// <param name="drawDestination">drawing area</param>
 /// <param name="worksheet">worksheet of the drawing area</param>
 public void DrawMargins(Graphics drawDestination, Worksheet worksheet)
 {
     //if ((worksheet.TopMargin>0) && (worksheet.BottomMargin>0) && (worksheet.LeftMargin>0) && (worksheet.RightMargin>0)){
         drawDestination.DrawRectangle(Pens.Black, worksheet.LeftMargin, worksheet.TopMargin, ((worksheet.Width-worksheet.LeftMargin)-worksheet.RightMargin), worksheet.GetWorksheetHeight());
     //}
     //else /*if((worksheet.TopMargin==0) && (worksheet.BottomMargin==0) && (worksheet.LeftMargin==0) && (worksheet.RightMargin==0)){
     //
     //}
     //else*/{
     //				/*if (worksheet.TopMargin>0)*/ drawDestination.DrawLine(Pens.Black, worksheet.LeftMargin , worksheet.TopMargin, worksheet.Width-worksheet.RightMargin, worksheet.TopMargin);
     //				if (worksheet.BottomMargin>0) drawDestination.DrawLine(Pens.Black, worksheet.LeftMargin , worksheet.Height-worksheet.BottomMargin-worksheet.FootMargin, worksheet.Width-worksheet.RightMargin, worksheet.Height-worksheet.BottomMargin-worksheet.FootMargin);
     //				/*if (worksheet.BottomMargin>0)*/ drawDestination.DrawLine(Pens.Black, worksheet.LeftMargin , worksheet.TopMargin + worksheet.GetWorksheetHeight() , worksheet.Width-worksheet.RightMargin, worksheet.TopMargin + worksheet.GetWorksheetHeight());
     //				/*if (worksheet.LeftMargin>0)*/ drawDestination.DrawLine(Pens.Black, worksheet.LeftMargin , worksheet.TopMargin, worksheet.LeftMargin, worksheet.TopMargin + worksheet.GetWorksheetHeight());
     //				/*if (worksheet.RightMargin>0)*/ drawDestination.DrawLine(Pens.Black, worksheet.Width-worksheet.RightMargin , worksheet.TopMargin, worksheet.Width-worksheet.RightMargin, worksheet.TopMargin + worksheet.GetWorksheetHeight());
     //				if (worksheet.LeftMargin>0) drawDestination.DrawLine(Pens.Black, worksheet.LeftMargin , worksheet.TopMargin, worksheet.LeftMargin, worksheet.Height-worksheet.BottomMargin);
     //				if (worksheet.RightMargin>0) drawDestination.DrawLine(Pens.Black, worksheet.Width-worksheet.RightMargin , worksheet.TopMargin, worksheet.Width-worksheet.RightMargin, worksheet.Height-worksheet.BottomMargin);
     //			}
 }
Пример #8
0
        /// <description>redraw whole image list pictures</description>
        protected override void AddPreview()
        {
            uint pages;
            Image mscPreview = null;
            Graphics previewDestination = null, drawDestinationBmp = null;
            Worksheet w = new Worksheet();
            w.WorksheetValues = worksheet.WorksheetValues;
            float wHeight = worksheet.GetWorksheetHeight();
            float wWidth = worksheet.GetWorksheetWidth();
            //			pages = this.GetPages();
            pages = generator.DiagramPages;
            generator.ChangeAllItemPens(new Pen(Color.Silver, 10));						// change all item pens and brushes for image list pictures
            generator.ChangeAllProcessPens(new Pen(Color.Silver, 10));

            this.lstPreview.Items.Clear();												// clear old image list
            previewImages.Clear();														// clear list of old image list pictures
            for (uint i = 1; i <= pages; i++) {												// for all pages a image list picture shall be generated
                if (Output.AutosizeOutputWidth) {
                    if (generator.EmptyDiagram == true) {
                        wWidth = worksheet.Width = 800;
                    } else {
                        worksheet.SetWorksheetWidth((int)generator.AutoWidth);
                        wWidth = (int)generator.AutoWidth;
                    }
                }
                if (Output.AutosizeOutputHeight) {
                    if (generator.EmptyDiagram == true) {
                        wHeight = worksheet.Height = 600;
                    } else {
                        worksheet.SetWorksheetHeight((int)generator.PageHeights[i - 1]); // correct height for export
                        wHeight = (int)generator.PageHeights[i - 1];
                    }
                }
                imageBitmap = new Bitmap((int)wWidth, (int)wHeight); 		// working bitmap, draw destination of generated msc
                drawDestinationBmp = Graphics.FromImage(imageBitmap);
                mscPreview = new Bitmap(90, Math.Min((int)(wHeight / (wWidth / 90)), 200));
                previewDestination = Graphics.FromImage(mscPreview);

                StringFormat previewStringFormat = new StringFormat();
                previewStringFormat.Alignment = StringAlignment.Center;
                previewStringFormat.LineAlignment = StringAlignment.Center;
                previewDestination.Clear(Color.White);
                drawDestinationBmp.Clear(Color.White);
                generator.DrawPage(drawDestinationBmp, worksheet, i);					// draw imageBitmap for image list picture
                previewDestination.DrawImage(imageBitmap, new RectangleF(0, 0, 90, mscPreview.Height));		// scale to width = 90
                previewDestination.DrawString(strings.GetString("Page ") + i.ToString(), new Font("Arial", 14, FontStyle.Regular, GraphicsUnit.Point), Brushes.DarkBlue, new RectangleF(0, 0, 90, mscPreview.Height), previewStringFormat);
                previewStringFormat.Dispose();
                previewImages.Add(new PreviewImage(mscPreview));	// add image list picture to array list
                this.lstPreview.Items.Add("");	// add image list picture to image list
                //System.GC.Collect();
            }
            generator.ChangeAllItemPens(new Pen(Color.Black, 1));			// change back all item pens and brushes
            generator.ChangeAllProcessPens(new Pen(Color.Black, 1));
            if (this.lstPreview.Items.Count > 0)							// select first picture of image list
                this.lstPreview.SelectedIndex = 0;
            if (mscPreview != null)
                mscPreview.Dispose();
            if (previewDestination != null)
                previewDestination.Dispose();
        }
Пример #9
0
 ///<summary>
 /// draws measurement, timing and instance lines and carry lines
 /// </summary>
 /// <param name="drawDestination">drawing area</param>
 /// <param name="pageBeginnLine">first line of page</param>
 /// <param name="pageEndLine">last line of page</param>
 /// <param name="yPos">max top position to draw inline</param>
 /// <param name="ySize">height of the drawing area</param>
 /// <param name="worksheet">worksheet of the drawing area</param>
 public void DrawLines(Graphics drawDestination, uint pageBeginnLine, uint pageEndLine, float yPos, float ySize, Worksheet worksheet, uint page)
 {
     IEnumerator enumerator = lines.GetEnumerator();
     float 	yPosStart, 				// y start position of the inline to draw
             yPosEnd,				// y end position of the inline to draw
             TopMargin 		= worksheet.TopMargin,	//top margin height of the worksheet
             yHelpTop		= this.YItemOffset;  // helps draw a top carry line
     uint 	lineBeginnLine, 		// first line of the inline to draw
             lineEndLine;			// last line of the inline to draw
     for(uint i=0;i<lines.Count;i++){
         enumerator.MoveNext();
         yHelpTop = this.YItemOffset;
         if (enumerator.Current is ItemVerticalLine){
             if((((ItemVerticalLine) enumerator.Current).LineBeginn<=pageEndLine)&&(((ItemVerticalLine) enumerator.Current).LineEnd>=pageBeginnLine)){	// shall loopline be drawed on the page
                 // calculate the vertical start and end position for the loopline
                 yPosStart=this.YProcessOffset;
                 yPosEnd=this.YProcessOffset;
                 lineBeginnLine = Math.Max(pageBeginnLine, ((ItemVerticalLine) enumerator.Current).LineBeginn);
                 lineEndLine = Math.Min(pageEndLine, ((ItemVerticalLine) enumerator.Current).LineEnd);
                 if (pageBeginnLine <= lineBeginnLine) yPosStart += 10;
                 for (uint j=pageBeginnLine; j<lineBeginnLine; j++){
                     if (mDiagramLines[j].Height != MSCItem.NEW_PAGE) yPosStart += mDiagramLines[j].Height+this.YItemOffset;
                 }
                 for (uint j=pageBeginnLine; j<=lineEndLine; j++){
                     if (mDiagramLines[j].Height != MSCItem.NEW_PAGE) yPosEnd += mDiagramLines[j].Height+this.YItemOffset;
                 }
                 // shall top carry line be drawed
                 if (((ItemVerticalLine) enumerator.Current).LineBeginn<=pageBeginnLine){
                     ((ItemVerticalLine) enumerator.Current).DrawItemCarry(drawDestination,GetInstanceXPos(((ItemVerticalLine) enumerator.Current).Process) ,yPosStart-20, yPosStart);
                     yHelpTop = 0;
                 }
                 // shall bottom carry line be drawed
                 if (((ItemVerticalLine) enumerator.Current).LineEnd>=pageEndLine){
                     yPosEnd-=10;
                     ((ItemVerticalLine) enumerator.Current).DrawItem(drawDestination,GetInstanceXPos(((ItemVerticalLine) enumerator.Current).Process) , yPosEnd, ySize-10);
                     ((ItemVerticalLine) enumerator.Current).DrawItemCarry(drawDestination,GetInstanceXPos(((ItemVerticalLine) enumerator.Current).Process) ,ySize-10, ySize);
                 }
                 // draw loopline
                 ((ItemVerticalLine) enumerator.Current).DrawItem(drawDestination,GetInstanceXPos(((ItemVerticalLine) enumerator.Current).Process) ,yPosStart-yHelpTop, yPosEnd);
             }
             // shall top carry line be drawed
             if(((ItemVerticalLine) enumerator.Current).LineBeginn==(pageEndLine+1)){
                 yPosStart=this.YProcessOffset;
                 yPosEnd=this.YProcessOffset;
                 lineBeginnLine = Math.Max(pageBeginnLine, ((ItemVerticalLine) enumerator.Current).LineBeginn);
                 if (pageBeginnLine <= lineBeginnLine) yPosStart += 10;
                 for (uint j=pageBeginnLine; j<=pageEndLine; j++){
                     if (mDiagramLines[j].Height != MSCItem.NEW_PAGE) yPosStart += mDiagramLines[j].Height+this.YItemOffset;
                 }
                 ((ItemVerticalLine) enumerator.Current).DrawItem(drawDestination,GetInstanceXPos(((ItemVerticalLine) enumerator.Current).Process) , yPosStart-this.YItemOffset, ySize-10);
                 ((ItemVerticalLine) enumerator.Current).DrawItemCarry(drawDestination,GetInstanceXPos(((ItemVerticalLine) enumerator.Current).Process) ,ySize-10, ySize);
             }
             // shall bottom carry line be drawed
             if(((ItemVerticalLine) enumerator.Current).LineEnd==(pageBeginnLine-1)){
                 ((ItemVerticalLine) enumerator.Current).DrawItemCarry(drawDestination,GetInstanceXPos(((ItemVerticalLine) enumerator.Current).Process) ,this.YProcessOffset, TopMargin+HeadHeight + TOP_MARGIN_MSC);
             }
         }
         if (enumerator.Current is MeasureLine){
             if((((MeasureLine) enumerator.Current).LineBegin<=pageEndLine)&&(((MeasureLine) enumerator.Current).LineEnd>=pageBeginnLine)){
                 // calculate the vertical start and end position for the measure line
                 yPosStart=this.YProcessOffset;
                 yPosEnd=this.YProcessOffset;
                 lineBeginnLine = Math.Max(pageBeginnLine, ((MeasureLine) enumerator.Current).LineBegin);
                 lineEndLine = Math.Min(pageEndLine, ((MeasureLine) enumerator.Current).LineEnd);
                 for (uint j=pageBeginnLine; j<lineBeginnLine; j++){
                     if (mDiagramLines[j].Height != MSCItem.NEW_PAGE) yPosStart += mDiagramLines[j].Height+this.YItemOffset;
                 }
                 for (uint j=pageBeginnLine; j<=lineEndLine; j++){
                     if (mDiagramLines[j].Height != MSCItem.NEW_PAGE) yPosEnd += mDiagramLines[j].Height+this.YItemOffset;
                 }
                 // shall top carry line be drawed
                 if (((MeasureLine) enumerator.Current).LineBegin<=pageBeginnLine){
                     ((MeasureLine) enumerator.Current).DrawItemCarry(drawDestination,GetInstanceXPos(((MeasureLine) enumerator.Current).Process) ,yPosStart-20, yPosStart);
                     yHelpTop = 0;
                 }
                 else if(((MeasureLine) enumerator.Current).MeasureCapStyle==CapStyle.Inner){
                     yHelpTop -=10;
                 }
                 // shall bottom carry line be drawed
                 if (((MeasureLine) enumerator.Current).LineEnd>=pageEndLine){
                     yPosEnd-=10;
                     ((MeasureLine) enumerator.Current).DrawItem(drawDestination,GetInstanceXPos(((MeasureLine) enumerator.Current).Process) , yPosEnd, ySize-10);
                     ((MeasureLine) enumerator.Current).DrawItemCarry(drawDestination,GetInstanceXPos(((MeasureLine) enumerator.Current).Process) ,ySize-10, ySize);
                 }
                 // draw measure line
                 ((MeasureLine) enumerator.Current).DrawItem(drawDestination,GetInstanceXPos(((MeasureLine) enumerator.Current).Process) ,yPosStart - yHelpTop, yPosEnd);
             }
             // shall top carry line be drawed
             if(((MeasureLine) enumerator.Current).LineBegin==(pageEndLine+1)){
                 yPosStart=this.YProcessOffset;
                 yPosEnd=this.YProcessOffset;
                 for (uint j=pageBeginnLine; j<=pageEndLine; j++){
                     if (mDiagramLines[j].Height != MSCItem.NEW_PAGE) yPosStart += mDiagramLines[j].Height+this.YItemOffset;
                 }
                 ((MeasureLine) enumerator.Current).DrawItem(drawDestination,GetInstanceXPos(((MeasureLine) enumerator.Current).Process) , yPosStart-this.YItemOffset+10, ySize-10);
                 ((MeasureLine) enumerator.Current).DrawItemCarry(drawDestination,GetInstanceXPos(((MeasureLine) enumerator.Current).Process) ,ySize-10, ySize);
             }
             // shall bottom carry line be drawed
             if(((MeasureLine) enumerator.Current).LineEnd==(pageBeginnLine-1)){
                 ((MeasureLine) enumerator.Current).DrawItemCarry(drawDestination,GetInstanceXPos(((MeasureLine) enumerator.Current).Process) ,this.YProcessOffset, TopMargin+HeadHeight + TOP_MARGIN_MSC);
             }
         }
         if (enumerator.Current is MessageLine){
             if((((MessageLine) enumerator.Current).LineBeginn<=pageEndLine)&&(((MessageLine) enumerator.Current).LineEnd>=pageBeginnLine)){
                 // calculate the vertical start and end position for the message line
                 yPosStart=this.YProcessOffset;
                 yPosEnd=this.YProcessOffset;
                 lineBeginnLine = Math.Max(pageBeginnLine, ((MessageLine) enumerator.Current).LineBeginn);
                 lineEndLine = Math.Min(pageEndLine, ((MessageLine) enumerator.Current).LineEnd);
                 for (uint j=pageBeginnLine; j<lineBeginnLine; j++){
                     if (mDiagramLines[j].Height != MSCItem.NEW_PAGE) yPosStart += mDiagramLines[j].Height+this.YItemOffset;
                 }
                 for (uint j=pageBeginnLine; j<=lineEndLine; j++){
                     if (mDiagramLines[j].Height != MSCItem.NEW_PAGE) yPosEnd += mDiagramLines[j].Height+this.YItemOffset;
                 }
                 // shall top carry line be drawed
                 if (((MessageLine) enumerator.Current).LineBeginn<pageBeginnLine){
                     ((MessageLine) enumerator.Current).DrawItemCarry(drawDestination,GetInstanceXPos(((MessageLine) enumerator.Current).MessageSource),GetInstanceXPos(((MessageLine) enumerator.Current).MessageDestination) ,yPosStart-20, yPosStart,worksheet.LeftMargin,worksheet.Width-worksheet.RightMargin);
                     yHelpTop = 0;
                 }
                 // shall bottom carry line be drawed
                 if (((MessageLine) enumerator.Current).LineEnd>pageEndLine){
                     yPosEnd-=10;
                     ((MessageLine) enumerator.Current).DrawItem(drawDestination,GetInstanceXPos(((MessageLine) enumerator.Current).MessageSource),GetInstanceXPos(((MessageLine) enumerator.Current).MessageDestination) , yPosEnd-this.YItemOffset, ySize-10,worksheet.LeftMargin,worksheet.Width-worksheet.RightMargin);
                     ((MessageLine) enumerator.Current).DrawItemCarry(drawDestination,GetInstanceXPos(((MessageLine) enumerator.Current).MessageSource),GetInstanceXPos(((MessageLine) enumerator.Current).MessageDestination) ,ySize-10, ySize,worksheet.LeftMargin,worksheet.Width-worksheet.RightMargin);
                 }
                 // draw message line
                 ((MessageLine) enumerator.Current).DrawItem(drawDestination,GetInstanceXPos(((MessageLine) enumerator.Current).MessageSource),GetInstanceXPos(((MessageLine) enumerator.Current).MessageDestination) ,yPosStart-yHelpTop, yPosEnd-this.YItemOffset,worksheet.LeftMargin,worksheet.Width-worksheet.RightMargin);
             }
         }
         if (enumerator.Current is ProcessLine){
             if((((ProcessLine) enumerator.Current).LineBeginn<=pageEndLine)&&((((ProcessLine) enumerator.Current).LineEnd>=pageBeginnLine)||(((ProcessLine) enumerator.Current).LineEnd==0))){
                 // calculate the vertical start and end position for the instance line
                 yPosStart=this.YProcessOffset;
                 yPosEnd=this.YProcessOffset;
                 lineBeginnLine = Math.Max(pageBeginnLine, ((ProcessLine) enumerator.Current).LineBeginn);
                 lineEndLine = Math.Min(pageEndLine, ((ProcessLine) enumerator.Current).LineEnd);
                 for (uint j=pageBeginnLine; j<=lineBeginnLine; j++){
                     if (mDiagramLines[j].Height != MSCItem.NEW_PAGE) yPosStart += mDiagramLines[j].Height+this.YItemOffset;
                 }
                 if ((((ProcessLine) enumerator.Current).LineEnd>pageEndLine) ||(((ProcessLine) enumerator.Current).LineEnd==0))
                     yPosEnd = ySize;
                 else{
                     for (uint j=pageBeginnLine; j<=lineEndLine; j++){
                         if (mDiagramLines[j].Height != MSCItem.NEW_PAGE) yPosEnd += mDiagramLines[j].Height+this.YItemOffset;
                     }
                     yPosEnd -=this.YItemOffset;
                 }
                 // shall the instance head be drawed on top of the page
                 if (((ProcessLine) enumerator.Current).LineBeginn<pageBeginnLine){
                     ((ProcessLine) enumerator.Current).DrawProcessHead(drawDestination, GetInstanceXPos(((ProcessLine) enumerator.Current).ProcessIndex) ,this.mYProcessName,this.mProcessNameHeight,this.mInstanceNameHeight,yPosEnd, page);
                 }
                 // shall the instance line be drawed to end of page
                 else if ((((ProcessLine) enumerator.Current).LineEnd>=pageEndLine)||(((ProcessLine) enumerator.Current).LineEnd==0)){
                     ((ProcessLine) enumerator.Current).DrawItem(drawDestination,GetInstanceXPos(((ProcessLine) enumerator.Current).ProcessIndex) , yPosStart-this.YItemOffset, yPosEnd);
                 }
                 // shall the instance line be drawed only inside the actual page
                 else if ((((ProcessLine) enumerator.Current).LineEnd<=pageEndLine)&&(((ProcessLine) enumerator.Current).LineBeginn>=pageBeginnLine)){
                     ((ProcessLine) enumerator.Current).DrawItem(drawDestination,GetInstanceXPos(((ProcessLine) enumerator.Current).ProcessIndex) , yPosStart-this.YItemOffset, yPosEnd);
                 }
             }
         }
     }
 }
Пример #10
0
        /// <summary>
        /// calculates all offsets for the msc
        /// </summary>
        /// <param name="drawDestination">actual drawing area</param>
        /// <param name="worksheet">worksheet sizes of the drawing area</param>
        public void CalcOffsets(Graphics drawDestination, Worksheet worksheet)
        {
            IEnumerator enumerator;
            float 	instanceSpace, 		// horizontal space for every instance
                    instanceOffset,		// x position of the first instance
                 	sumMargin=0,		// margin summation to affact each instance space
                 	xSize, 				// width of the drawing area without margins
                    ySize;				// height of the drawing area without margins

            CalcProcessMargins();
            enumerator = processes.GetEnumerator();
            for(uint i=0;i<processes.Count;i++){		//calculate summation of all margins
                enumerator.MoveNext();
                sumMargin +=((Process)enumerator.Current).LeftMargin+((Process)enumerator.Current).RightMargin;
            }
            this.mAutoWidth = (sumMargin + processes.Count * 150);
            if (Output.AutosizeOutputWidth == true){
                worksheet.SetWorksheetWidth((int)this.mAutoWidth);
            }
            xSize = (worksheet.Width - worksheet.LeftMargin) - worksheet.RightMargin;	// calculate width of drawing area
            ySize = worksheet.GetWorksheetHeight();	// calculate height of drawing area
            Trace.WriteLine(DateTime.Now.TimeOfDay + " ySize: " + ySize.ToString());

            instanceSpace = (xSize-(INLINE_OFFSET*2)-sumMargin)/processes.Count;		// calculate the available space for each instance
            instanceOffset = INLINE_OFFSET+instanceSpace/2 + worksheet.LeftMargin;		// calculate the x positon of first instance
            HeadHeight = headLine.GetHeight(drawDestination, xSize);
            enumerator.Reset();
            sumMargin = 0;
            for(uint i=0;i<processes.Count;i++){										// calculate the x position of each instance
                enumerator.MoveNext();
                sumMargin +=((Process)enumerator.Current).LeftMargin;
                ((Process)enumerator.Current).XPos = sumMargin + instanceOffset + i * instanceSpace;
                sumMargin +=((Process)enumerator.Current).RightMargin;
            }
            MSCItem.ItemLayoutSize = new SizeF(instanceSpace,(ySize-this.YProcessOffset)-20);			// set the max size of msc items
            mProcessNameHeight=0;
            mInstanceNameHeight=0;
            this.CalcProcessesNameHeight(drawDestination);
            this.mYProcessName = worksheet.TopMargin + this.GetProcessesDescriptionHeight(drawDestination) + this.HeadHeight;	// set the verical position of instance name
            this.YProcessOffset = this.mYProcessName + mInstanceNameHeight+20; 			// set the vertical offset for first msc item
            if (instanceSpace < GEM_MIN_INSTANCE_SPACE)									// check min horizontal space for instances
                this.generatorResult = GeneratorResult.InstanceSpaceToSmall;			// diagram can not be drawn
            else
                this.generatorResult = GeneratorResult.OK;								// insantce horizontal space ok
        }
Пример #11
0
        /// <summary>
        /// calculates all offsets and line heights for the msc
        /// </summary>
        /// <param name="drawDestination">actual drawing area</param>
        /// <param name="worksheet">worksheet sizes of the drawing area</param>
        /// <param name="font">font used in the msc</param>
        public void CalcLineHights(Graphics drawDestination, Worksheet worksheet, Font font)
        {
            IEnumerator enumerator;
            uint 	line=0;				// msc line counter
            float 	instanceSpace, 		// horizontal space for every instance
                    instanceOffset,		// x position of the first instance
                 	sumMargin=0,		// margin summation to affact each instance space
                 	xSize, 				// width of the drawing area without margins
                    ySize;				// height of the drawing area without margins

            CalcProcessMargins();
            enumerator = processes.GetEnumerator();
            for(uint i=0;i<processes.Count;i++){		//calculate summation of all margins
                enumerator.MoveNext();
                sumMargin +=((Process)enumerator.Current).LeftMargin+((Process)enumerator.Current).RightMargin;
            }
            this.mAutoWidth = (sumMargin + processes.Count * 150);
            if (Output.AutosizeOutputWidth == true){
                worksheet.SetWorksheetWidth((int)this.mAutoWidth);
            }
            xSize = (worksheet.Width - worksheet.LeftMargin) - worksheet.RightMargin;	// calculate width of drawing area
            ySize = worksheet.GetWorksheetHeight();	// calculate height of drawing area

            instanceSpace = (xSize-(INLINE_OFFSET*2)-sumMargin)/processes.Count;		// calculate the available space for each instance
            if (instanceSpace < GEM_MIN_INSTANCE_SPACE){
                generatorResult = GeneratorResult.InstanceSpaceToSmall;
            }
            else{
                generatorResult = GeneratorResult.OK;
            }
            instanceOffset = INLINE_OFFSET+instanceSpace/2 + worksheet.LeftMargin;		// calculate the x positon of first instance
            HeadHeight = headLine.GetHeight(drawDestination, xSize);
            enumerator.Reset();
            sumMargin = 0;
            for(uint i=0;i<processes.Count;i++){										// calculate the x position of each instance
                enumerator.MoveNext();
                sumMargin +=((Process)enumerator.Current).LeftMargin;
                ((Process)enumerator.Current).XPos = sumMargin + instanceOffset + i * instanceSpace;
                sumMargin +=((Process)enumerator.Current).RightMargin;
            }
            MSCItem.ItemFont = font;
            MSCItem.ItemLayoutSize = new SizeF(instanceSpace,(ySize-this.YProcessOffset)-20);			// set the max size of msc items
            mProcessNameHeight=0;
            mInstanceNameHeight=0;
            this.CalcProcessesNameHeight(drawDestination);
            this.mYProcessName = worksheet.TopMargin + this.GetProcessesDescriptionHeight(drawDestination) + this.HeadHeight;	// set the verical position of instance name
            this.YProcessOffset = this.mYProcessName + mInstanceNameHeight+20; 			// set the vertical offset for first msc item
            if (mLines>0){
                mDiagramLines = new DiagramLine[mLines+2];
                enumerator = items.GetEnumerator();
                for(uint i=0;i<items.Count;i++){										// store the maximum line height of each msc line
                    enumerator.MoveNext();
                    if (enumerator.Current is State)
                    {
                        float xPosMin = GetInstanceXPos(processes.Count-1);
                        float xPosMax = 0;

                        for(int j=0; j<processes.Count; j++){
                            if(((State)enumerator.Current).IsUsedProcess(j)){
                                xPosMin = Math.Min(xPosMin,GetInstanceXPos(j));
                                xPosMax = Math.Max(xPosMax,GetInstanceXPos(j));
                            }
                        }
                        mDiagramLines[((State)enumerator.Current).Line].Height = Math.Max(mDiagramLines[((State)enumerator.Current).Line].Height,((State)enumerator.Current).GetHeight(drawDestination,xPosMin,xPosMax));
                        line = ((State)enumerator.Current).Line;
                    }
                    if (enumerator.Current is MSCEnd)
                    {
                        mDiagramLines[((MSCEnd)enumerator.Current).Line].Height = Math.Max(mDiagramLines[((MSCEnd)enumerator.Current).Line].Height,((MSCEnd)enumerator.Current).GetHeight(drawDestination));
                        line = ((MSCEnd)enumerator.Current).Line;
                    }
                    if (enumerator.Current is MeasureStart)
                    {
                        mDiagramLines[((MeasureStart)enumerator.Current).Line].Height = Math.Max(mDiagramLines[((MeasureStart)enumerator.Current).Line].Height,((MeasureStart)enumerator.Current).GetHeight(drawDestination));
                        line = ((MeasureStart)enumerator.Current).Line;
                    }
                    if (enumerator.Current is MeasureStop)
                    {
                        mDiagramLines[((MeasureStop)enumerator.Current).Line].Height = Math.Max(mDiagramLines[((MeasureStop)enumerator.Current).Line].Height,((MeasureStop)enumerator.Current).GetHeight(drawDestination));
                        line = ((MeasureStop)enumerator.Current).Line;
                    }
                    if (enumerator.Current is MeasureBeginn)
                    {
                        mDiagramLines[((MeasureBeginn)enumerator.Current).Line].Height = Math.Max(mDiagramLines[((MeasureBeginn)enumerator.Current).Line].Height,((MeasureBeginn)enumerator.Current).GetHeight(drawDestination));
                        line = ((MeasureBeginn)enumerator.Current).Line;
                    }
                    if (enumerator.Current is MeasureEnd)
                    {
                        mDiagramLines[((MeasureEnd)enumerator.Current).Line].Height = Math.Max(mDiagramLines[((MeasureEnd)enumerator.Current).Line].Height,((MeasureEnd)enumerator.Current).GetHeight(drawDestination));
                        line = ((MeasureEnd)enumerator.Current).Line;
                    }
                    if (enumerator.Current is TimerBegin)
                    {
                        mDiagramLines[((TimerBegin)enumerator.Current).Line].Height = Math.Max(mDiagramLines[((TimerBegin)enumerator.Current).Line].Height,((TimerBegin)enumerator.Current).GetHeight(drawDestination));
                        line = ((TimerBegin)enumerator.Current).Line;
                    }
                    if (enumerator.Current is TimerEnd)
                    {
                        mDiagramLines[((TimerEnd)enumerator.Current).Line].Height = Math.Max(mDiagramLines[((TimerEnd)enumerator.Current).Line].Height,((TimerEnd)enumerator.Current).GetHeight(drawDestination));
                        line = ((TimerEnd)enumerator.Current).Line;
                    }
                    if (enumerator.Current is TimeoutBegin)
                    {
                        mDiagramLines[((TimeoutBegin)enumerator.Current).Line].Height = Math.Max(mDiagramLines[((TimeoutBegin)enumerator.Current).Line].Height,((TimeoutBegin)enumerator.Current).GetHeight(drawDestination));
                        line = ((TimeoutBegin)enumerator.Current).Line;
                    }
                    if (enumerator.Current is TimeoutEnd)
                    {
                        mDiagramLines[((TimeoutEnd)enumerator.Current).Line].Height = Math.Max(mDiagramLines[((TimeoutEnd)enumerator.Current).Line].Height,((TimeoutEnd)enumerator.Current).GetHeight(drawDestination));
                        line = ((TimeoutEnd)enumerator.Current).Line;
                    }
                    if (enumerator.Current is TimeoutStop)
                    {
                        mDiagramLines[((TimeoutStop)enumerator.Current).Line].Height = Math.Max(mDiagramLines[((TimeoutStop)enumerator.Current).Line].Height,((TimeoutStop)enumerator.Current).GetHeight(drawDestination));
                        line = ((TimeoutStop)enumerator.Current).Line;
                    }
                    if (enumerator.Current is TimeOut)
                    {
                        mDiagramLines[((TimeOut)enumerator.Current).Line].Height = Math.Max(mDiagramLines[((TimeOut)enumerator.Current).Line].Height,((TimeOut)enumerator.Current).GetHeight(drawDestination));
                        line = ((TimeOut)enumerator.Current).Line;
                    }
                    if (enumerator.Current is StopTimer)
                    {
                        mDiagramLines[((StopTimer)enumerator.Current).Line].Height = Math.Max(mDiagramLines[((StopTimer)enumerator.Current).Line].Height,((StopTimer)enumerator.Current).GetHeight(drawDestination));
                        line = ((StopTimer)enumerator.Current).Line;
                    }
                    if (enumerator.Current is SetTimer)
                    {
                        mDiagramLines[((SetTimer)enumerator.Current).Line].Height = Math.Max(mDiagramLines[((SetTimer)enumerator.Current).Line].Height,((SetTimer)enumerator.Current).GetHeight(drawDestination));
                        line = ((SetTimer)enumerator.Current).Line;
                    }
                    if (enumerator.Current is Comment)
                    {
                        if (((Comment)enumerator.Current).Position == CommentPos.OverAll){
                            mDiagramLines[((Comment)enumerator.Current).Line].Height = Math.Max(mDiagramLines[((Comment)enumerator.Current).Line].Height,((Comment)enumerator.Current).GetHeight(drawDestination,GetInstanceXPos(((Comment) enumerator.Current).Process), GetInstanceXPos(0),GetInstanceXPos(processes.Count-1), MSC.LeftMargin + ((Process)processes[0]).LeftRand, MSC.RightMargin + ((Process)processes[processes.Count-1]).RightRand));
                        }
                        else{
                            mDiagramLines[((Comment)enumerator.Current).Line].Height = Math.Max(mDiagramLines[((Comment)enumerator.Current).Line].Height,((Comment)enumerator.Current).GetHeight(drawDestination,GetInstanceXPos(((Comment) enumerator.Current).Process), worksheet.LeftMargin,worksheet.Width-worksheet.RightMargin, MSC.LeftMargin + ((Process)processes[0]).LeftRand, MSC.RightMargin + ((Process)processes[processes.Count-1]).RightRand));
                        }
                        line = ((Comment)enumerator.Current).Line;
                    }
                    if (enumerator.Current is LineComment)
                    {
                        mDiagramLines[((LineComment)enumerator.Current).Line].Height = Math.Max(mDiagramLines[((LineComment)enumerator.Current).Line].Height,((LineComment)enumerator.Current).GetHeight(drawDestination));
                        line = ((LineComment)enumerator.Current).Line;
                    }
                    if (enumerator.Current is Task)
                    {
                        mDiagramLines[((Task)enumerator.Current).Line].Height = Math.Max(mDiagramLines[((Task)enumerator.Current).Line].Height,((Task)enumerator.Current).GetHeight(drawDestination));
                        line = ((Task)enumerator.Current).Line;
                    }
                    if (enumerator.Current is mscElements.Message)
                    {
                        mDiagramLines[((mscElements.Message)enumerator.Current).Line].Height = Math.Max(mDiagramLines[((mscElements.Message)enumerator.Current).Line].Height,((mscElements.Message)enumerator.Current).GetHeight(drawDestination, GetInstanceXPos(((mscElements.Message)enumerator.Current).MessageSource), GetInstanceXPos(((mscElements.Message)enumerator.Current).MessageDestination)));
                        line = ((mscElements.Message)enumerator.Current).Line;
                    }
                    if (enumerator.Current is Mark)
                    {
                        mDiagramLines[((Mark)enumerator.Current).Line].Height = Math.Max(mDiagramLines[((Mark)enumerator.Current).Line].Height,((Mark)enumerator.Current).GetHeight(drawDestination));
                        line = ((Mark)enumerator.Current).Line;
                    }
                    if (enumerator.Current is FoundMessage)
                    {
                        mDiagramLines[((FoundMessage)enumerator.Current).Line].Height = Math.Max(mDiagramLines[((FoundMessage)enumerator.Current).Line].Height,((FoundMessage)enumerator.Current).GetHeight(drawDestination));
                        line = ((FoundMessage)enumerator.Current).Line;
                    }
                    if (enumerator.Current is LostMessage)
                    {
                        mDiagramLines[((LostMessage)enumerator.Current).Line].Height = Math.Max(mDiagramLines[((LostMessage)enumerator.Current).Line].Height,((LostMessage)enumerator.Current).GetHeight(drawDestination));
                        line = ((LostMessage)enumerator.Current).Line;
                    }
                    if (enumerator.Current is ProcessStop)
                    {
                        mDiagramLines[((ProcessStop)enumerator.Current).Line].Height = Math.Max(mDiagramLines[((ProcessStop)enumerator.Current).Line].Height,((ProcessStop)enumerator.Current).GetHeight(drawDestination));
                        line = ((ProcessStop)enumerator.Current).Line;
                    }
                    if (enumerator.Current is ProcessCreate)
                    {
                        mDiagramLines[((ProcessCreate)enumerator.Current).Line].Height = Math.Max(mDiagramLines[((ProcessCreate)enumerator.Current).Line].Height,((ProcessCreate)enumerator.Current).GetHeight(drawDestination, GetInstanceXPos(((ProcessCreate)enumerator.Current).Source), GetInstanceXPos(((ProcessCreate)enumerator.Current).Destination)));
                        line = ((ProcessCreate)enumerator.Current).Line;
                    }
                    if (enumerator.Current is ProcessRegion)
                    {
                        mDiagramLines[((ProcessRegion)enumerator.Current).Line].Height = Math.Max(mDiagramLines[((ProcessRegion)enumerator.Current).Line].Height,((ProcessRegion)enumerator.Current).GetHeight(drawDestination));
                        line = ((ProcessRegion)enumerator.Current).Line;
                    }
                    if (enumerator.Current is Reference)
                    {
                        mDiagramLines[((Reference)enumerator.Current).Line].Height = Math.Max(mDiagramLines[((Reference)enumerator.Current).Line].Height,((Reference)enumerator.Current).GetHeight(drawDestination, GetInstanceXPos(((Reference)enumerator.Current).ProcessBeginn), GetInstanceXPos(((Reference)enumerator.Current).ProcessEnd)));
                        line = ((Reference)enumerator.Current).Line;
                    }
                    if (enumerator.Current is InLineBeginn)
                    {
                        mDiagramLines[((InLineBeginn)enumerator.Current).Line].Height = Math.Max(mDiagramLines[((InLineBeginn)enumerator.Current).Line].Height,((InLineBeginn)enumerator.Current).GetHeight(drawDestination));
                        line = ((InLineBeginn)enumerator.Current).Line;
                    }
                    if (enumerator.Current is InLineEnd)
                    {
                        mDiagramLines[((InLineEnd)enumerator.Current).Line].Height = Math.Max(mDiagramLines[((InLineEnd)enumerator.Current).Line].Height,((InLineEnd)enumerator.Current).GetHeight(drawDestination));
                        line = ((InLineEnd)enumerator.Current).Line;
                    }
                    if (enumerator.Current is InLineSeparator)
                    {
                        mDiagramLines[((InLineSeparator)enumerator.Current).Line].Height = Math.Max(mDiagramLines[((InLineSeparator)enumerator.Current).Line].Height,((InLineSeparator)enumerator.Current).GetHeight(drawDestination));
                        line = ((InLineSeparator)enumerator.Current).Line;
                    }
                    if (enumerator.Current is InLineText)
                    {
                        mDiagramLines[((InLineText)enumerator.Current).Line].Height = Math.Max(mDiagramLines[((InLineText)enumerator.Current).Line].Height,((InLineText)enumerator.Current).GetHeight(drawDestination, ((Process)processes[((InLineText)enumerator.Current).ProcessBeginn]).LeftRand));
                        line = ((InLineText)enumerator.Current).Line;
                    }
                    if (enumerator.Current is MessageBegin)
                    {
                        mDiagramLines[((MessageBegin)enumerator.Current).Line].Height = Math.Max(mDiagramLines[((MessageBegin)enumerator.Current).Line].Height,((MessageBegin)enumerator.Current).GetHeight(drawDestination, GetInstanceXPos(((MessageBegin)enumerator.Current).MessageSource), GetInstanceXPos(((MessageBegin)enumerator.Current).MessageDestination)));
                        line = ((MessageBegin)enumerator.Current).Line;
                    }
                    if (enumerator.Current is MessageEnd)
                    {
                        mDiagramLines[((MessageEnd)enumerator.Current).Line].Height = Math.Max(mDiagramLines[((MessageEnd)enumerator.Current).Line].Height,((MessageEnd)enumerator.Current).GetHeight(drawDestination));
                        line = ((MessageEnd)enumerator.Current).Line;
                    }
                    if (enumerator.Current is NewPage)
                    {
                        mDiagramLines[((NewPage)enumerator.Current).Line].Height = ((NewPage)enumerator.Current).GetHeight();
                        line = ((NewPage)enumerator.Current).Line;
                    }
                }
            }
            if (instanceSpace < GEM_MIN_INSTANCE_SPACE)
                this.generatorResult = GeneratorResult.InstanceSpaceToSmall;
            else
                this.generatorResult = GeneratorResult.OK;
        }
Пример #12
0
        ///<summary>
        /// draws msc items
        /// </summary>
        /// <param name="drawDestination">actual drawing area</param>
        /// <param name="worksheet">worksheet sizes of the drawing area</param>
        /// <param name="line">actual msc line</param>
        /// <param name="yPos">y start drawing position</param>
        /// <param name="ySize">height of the drawing area</param>
        /// <param name="page">current page</param>
        private void DrawItem(Graphics drawDestination, Worksheet worksheet, uint line, float yPos, float ySize, uint page)
        {
            IEnumerator enumerator = items.GetEnumerator();
            for(uint i=0;i<items.Count;i++){
                enumerator.MoveNext();
                //drawDestination.DrawRectangle(Pens.Red,((MSCItem)enumerator.Current).bounds.X,((MSCItem)enumerator.Current).bounds.Y,((MSCItem)enumerator.Current).bounds.Width,((MSCItem)enumerator.Current).bounds.Height);
                if (((MSCItem)enumerator.Current).Line == line)
                    ((MSCItem)enumerator.Current).ItemPage = page;
                if (enumerator.Current is State)
                {
                    if (((State)enumerator.Current).Line == line){
                        float xPosMin = GetInstanceXPos(processes.Count-1);
                        float xPosMax = 0;

                        for(int j=0; j<processes.Count; j++){					// get the start and end x position of the state item
                            if(((State)enumerator.Current).IsUsedProcess(j)){
                                xPosMin = Math.Min(xPosMin,GetInstanceXPos(j));
                                xPosMax = Math.Max(xPosMax,GetInstanceXPos(j));
                            }
                        }
                        ((State)enumerator.Current).DrawItem(drawDestination,xPosMin, xPosMax,yPos, mDiagramLines[line].Height);
                        for(int j=0; j<processes.Count; j++){					// for overlayed instance lines, that are not integrated in the state
                                float xPos=0;									// instance lines have to be redrawed
                            if(!((State)enumerator.Current).IsUsedProcess(j)){
                                if (GetProcessStyle(j,line)!=ProcessStyle.NotUsed){
                                    xPos=GetInstanceXPos(j);
                                    if((xPos>xPosMin)&&(xPos<xPosMax))
                                        ((State)enumerator.Current).DrawForegroundProcessLine(drawDestination,GetInstanceXPos(j),yPos,xPosMin, xPosMax, mDiagramLines[line].Height);
                                }
                            }
                        }
                    }
                }
                if (enumerator.Current is MSCEnd)
                {
                    if (((MSCEnd)enumerator.Current).Line == line){
                        for(int j=0; j<processes.Count; j++)
                            if(GetProcessStyle(j,line)!=ProcessStyle.NotUsed)
                                ((MSCEnd)enumerator.Current).DrawItem(drawDestination,GetInstanceXPos(j),ySize);
                    }
                }
                if (enumerator.Current is MeasureStart)
                {
                    if (((MeasureStart)enumerator.Current).Line == line)
                        ((MeasureStart)enumerator.Current).DrawItem(drawDestination,GetInstanceXPos(((MeasureStart)enumerator.Current).Process),yPos,mDiagramLines[line].Height);
                }
                if (enumerator.Current is MeasureStop)
                {
                    if (((MeasureStop)enumerator.Current).Line == line)
                        ((MeasureStop)enumerator.Current).DrawItem(drawDestination,GetInstanceXPos(((MeasureStop)enumerator.Current).Process),yPos,mDiagramLines[line].Height);
                }
                if (enumerator.Current is MeasureBeginn)
                {
                    if (((MeasureBeginn)enumerator.Current).Line == line)
                        ((MeasureBeginn)enumerator.Current).DrawItem(drawDestination,GetInstanceXPos(((MeasureBeginn)enumerator.Current).Process),yPos,mDiagramLines[line].Height);
                }
                if (enumerator.Current is MeasureEnd)
                {
                    if (((MeasureEnd) enumerator.Current).Line == line)
                        ((MeasureEnd) enumerator.Current).DrawItem(drawDestination,GetInstanceXPos(((MeasureEnd) enumerator.Current).Process),yPos,mDiagramLines[line].Height);
                }
                if (enumerator.Current is TimeOut)
                {
                    if (((TimeOut)enumerator.Current).Line == line)
                        ((TimeOut)enumerator.Current).DrawItem(drawDestination,GetInstanceXPos(((TimeOut)enumerator.Current).Process),yPos,mDiagramLines[line].Height);
                }
                if (enumerator.Current is StopTimer)
                {
                    if (((StopTimer)enumerator.Current).Line == line)
                        ((StopTimer)enumerator.Current).DrawItem(drawDestination,GetInstanceXPos(((StopTimer)enumerator.Current).Process),yPos,mDiagramLines[line].Height);
                }
                if (enumerator.Current is SetTimer)
                {
                    if (((SetTimer)enumerator.Current).Line == line)
                        ((SetTimer)enumerator.Current).DrawItem(drawDestination,GetInstanceXPos(((SetTimer)enumerator.Current).Process),yPos,mDiagramLines[line].Height);
                }
                if (enumerator.Current is TimerBegin)
                {
                    if (((TimerBegin)enumerator.Current).Line == line)
                        ((TimerBegin)enumerator.Current).DrawItem(drawDestination,GetInstanceXPos(((TimerBegin)enumerator.Current).Process),yPos,mDiagramLines[line].Height);
                }
                if (enumerator.Current is TimerEnd)
                {
                    if (((TimerEnd) enumerator.Current).Line == line)
                        ((TimerEnd) enumerator.Current).DrawItem(drawDestination,GetInstanceXPos(((TimerEnd) enumerator.Current).Process),yPos,mDiagramLines[line].Height);
                }
                if (enumerator.Current is TimeoutBegin)
                {
                    if (((TimeoutBegin)enumerator.Current).Line == line)
                        ((TimeoutBegin)enumerator.Current).DrawItem(drawDestination,GetInstanceXPos(((TimeoutBegin)enumerator.Current).Process),yPos,mDiagramLines[line].Height);
                }
                if (enumerator.Current is TimeoutEnd)
                {
                    if (((TimeoutEnd) enumerator.Current).Line == line)
                        ((TimeoutEnd) enumerator.Current).DrawItem(drawDestination,GetInstanceXPos(((TimeoutEnd) enumerator.Current).Process),yPos,mDiagramLines[line].Height);
                }
                if (enumerator.Current is TimeoutStop)
                {
                    if (((TimeoutStop) enumerator.Current).Line == line)
                        ((TimeoutStop) enumerator.Current).DrawItem(drawDestination,GetInstanceXPos(((TimeoutStop) enumerator.Current).Process),yPos,mDiagramLines[line].Height);
                }
                if (enumerator.Current is Comment)
                {
                    if (((Comment) enumerator.Current).Line == line){
                        if (((Comment)enumerator.Current).Position == CommentPos.OverAll){
                            ((Comment) enumerator.Current).DrawItem(drawDestination,GetInstanceXPos(((Comment) enumerator.Current).Process), GetInstanceXPos(0),GetInstanceXPos(processes.Count-1),yPos, MSC.LeftMargin + ((Process)processes[0]).LeftRand, MSC.RightMargin + ((Process)processes[processes.Count-1]).RightRand);
                        }
                        else{
                            ((Comment) enumerator.Current).DrawItem(drawDestination,GetInstanceXPos(((Comment) enumerator.Current).Process), worksheet.LeftMargin,worksheet.Width-worksheet.RightMargin,yPos, MSC.LeftMargin + ((Process)processes[0]).LeftRand, MSC.RightMargin + ((Process)processes[processes.Count-1]).RightRand);
                        }
                    }
                }
                if (enumerator.Current is LineComment)
                {
                    if (((LineComment) enumerator.Current).Line == line){
                        ((LineComment) enumerator.Current).DrawItem(drawDestination,GetInstanceXPos(((LineComment) enumerator.Current).Process),yPos,mDiagramLines[line].Height);
                    }
                }
                if (enumerator.Current is Task)
                {
                    if (((Task) enumerator.Current).Line == line)
                        ((Task) enumerator.Current).DrawItem(drawDestination,GetInstanceXPos(((Task) enumerator.Current).Process),yPos, mDiagramLines[line].Height);
                }
                if (enumerator.Current is mscElements.Message)
                {
                    if (((mscElements.Message) enumerator.Current).Line == line)
                        ((mscElements.Message) enumerator.Current).DrawItem(drawDestination,GetInstanceXPos(((mscElements.Message) enumerator.Current).MessageSource),GetInstanceXPos(((mscElements.Message) enumerator.Current).MessageDestination),yPos,mDiagramLines[line].Height,worksheet.LeftMargin,worksheet.Width-worksheet.RightMargin, GetLifeLineStyle(((mscElements.Message) enumerator.Current).MessageSource, line), GetLifeLineStyle(((mscElements.Message) enumerator.Current).MessageDestination, line));
                }
                if (enumerator.Current is Mark)
                {
                    if (((Mark) enumerator.Current).Line == line)
                        ((Mark) enumerator.Current).DrawItem(drawDestination,GetInstanceXPos(((Mark) enumerator.Current).Process),worksheet.LeftMargin,worksheet.Width-worksheet.RightMargin,yPos,mDiagramLines[line].Height, this.YItemOffset);
                }
                if (enumerator.Current is FoundMessage)
                {
                    if (((FoundMessage) enumerator.Current).Line == line)
                        ((FoundMessage) enumerator.Current).DrawItem(drawDestination,GetInstanceXPos(((FoundMessage) enumerator.Current).Process),yPos,mDiagramLines[line].Height);
                }
                if (enumerator.Current is LostMessage)
                {
                    if (((LostMessage) enumerator.Current).Line == line)
                        ((LostMessage) enumerator.Current).DrawItem(drawDestination,GetInstanceXPos(((LostMessage) enumerator.Current).Process),yPos,mDiagramLines[line].Height);
                }
                if (enumerator.Current is ProcessStop)
                {
                    if (((ProcessStop) enumerator.Current).Line == line)
                        ((ProcessStop) enumerator.Current).DrawItem(drawDestination,GetInstanceXPos(((ProcessStop) enumerator.Current).Process),yPos,mDiagramLines[line].Height);
                }
                if (enumerator.Current is ProcessCreate)
                {
                    if (((ProcessCreate) enumerator.Current).Line == line)
                        ((ProcessCreate) enumerator.Current).DrawItem(drawDestination,GetInstanceXPos(((ProcessCreate) enumerator.Current).Source),GetInstanceXPos(((ProcessCreate) enumerator.Current).Destination),yPos,mDiagramLines[line].Height);
                }
                if (enumerator.Current is ProcessRegion)
                {
                    if (((ProcessRegion) enumerator.Current).Line == line)
                        ((ProcessRegion) enumerator.Current).DrawItem(drawDestination,GetInstanceXPos(((ProcessRegion) enumerator.Current).Process),yPos,mDiagramLines[line].Height);
                }
                if (enumerator.Current is Reference)
                {
                    if (((Reference) enumerator.Current).Line == line){
                        ((Reference) enumerator.Current).DrawItem(drawDestination,GetInstanceXPos(((Reference) enumerator.Current).ProcessBeginn),GetInstanceXPos(((Reference) enumerator.Current).ProcessEnd),yPos,mDiagramLines[line].Height);

                    }
                }
                if (enumerator.Current is InLineBeginn)
                {
                    if (((InLineBeginn) enumerator.Current).Line == line){
                        InLineSize inLineSize;
                        inLineSize = GetInLineSize(((InLineBeginn) enumerator.Current).Identifier);
                        ((InLineBeginn) enumerator.Current).DrawItem(drawDestination,GetInstanceXPos(((InLineBeginn) enumerator.Current).ProcessBeginn),GetInstanceXPos(((InLineBeginn) enumerator.Current).ProcessEnd),inLineSize.Left,inLineSize.Right,yPos,mDiagramLines[line].Height);

                    }
                }
                if (enumerator.Current is InLineEnd)
                {
                    if (((InLineEnd) enumerator.Current).Line == line){
                        InLineSize inLineSize;
                        inLineSize = GetInLineSize(((InLineEnd) enumerator.Current).Identifier);
                        ((InLineEnd) enumerator.Current).DrawItem(drawDestination,GetInstanceXPos(((InLineEnd) enumerator.Current).ProcessBeginn),GetInstanceXPos(((InLineEnd) enumerator.Current).ProcessEnd),inLineSize.Left,inLineSize.Right,yPos,mDiagramLines[line].Height);

                    }
                }
                if (enumerator.Current is InLineSeparator)
                {
                    if (((InLineSeparator) enumerator.Current).Line == line){
                        InLineSize inLineSize;
                        inLineSize = GetInLineSize(((InLineSeparator) enumerator.Current).Identifier);
                        ((InLineSeparator) enumerator.Current).DrawItem(drawDestination,GetInstanceXPos(((InLineSeparator) enumerator.Current).ProcessBeginn),GetInstanceXPos(((InLineSeparator) enumerator.Current).ProcessEnd),inLineSize.Left,inLineSize.Right,yPos,mDiagramLines[line].Height);
                    }
                }
                if (enumerator.Current is InLineText)
                {
                    if (((InLineText) enumerator.Current).Line == line){
                        InLineSize inLineSize;
                        inLineSize = GetInLineSize(((InLineText) enumerator.Current).Identifier);
                        ((InLineText) enumerator.Current).DrawItem(drawDestination,GetInstanceXPos(((InLineText) enumerator.Current).ProcessBeginn),GetInstanceXPos(((InLineText) enumerator.Current).ProcessEnd),inLineSize.Left,inLineSize.Right,yPos,mDiagramLines[line].Height);
                    }
                }
                if (enumerator.Current is MessageBegin)
                {
                    if (((MessageBegin) enumerator.Current).Line == line)
                        ((MessageBegin) enumerator.Current).DrawItem(drawDestination,GetInstanceXPos(((MessageBegin) enumerator.Current).MessageSource),GetInstanceXPos(((MessageBegin) enumerator.Current).MessageDestination),yPos,mDiagramLines[line].Height,worksheet.LeftMargin,worksheet.Width-worksheet.RightMargin, GetLifeLineStyle(((mscElements.MessageBegin) enumerator.Current).MessageSource, line), GetLifeLineStyle(((mscElements.MessageBegin) enumerator.Current).MessageDestination, line));
                }
                if (enumerator.Current is MessageEnd)
                {
                    if (((MessageEnd) enumerator.Current).Line == line)
                        ((MessageEnd) enumerator.Current).DrawItem(drawDestination,GetInstanceXPos(((MessageEnd) enumerator.Current).MessageSource),GetInstanceXPos(((MessageEnd) enumerator.Current).MessageDestination),yPos,mDiagramLines[line].Height,worksheet.LeftMargin,worksheet.Width-worksheet.RightMargin, GetLifeLineStyle(((mscElements.MessageEnd) enumerator.Current).MessageSource, line), GetLifeLineStyle(((mscElements.MessageEnd) enumerator.Current).MessageDestination, line));
                }
            }
        }
Пример #13
0
        public void UpdateValues(Worksheet w)
        {
            if (!this.IsDisposed)
            {
                worksheet = optionWorksheet = w;
                changeByUpdate = true;
                if (worksheet.Height > worksheet.Width)
                    optionWorksheet.Layout = Worksheet.WS_LAYOUT_VERTICAL;
                else
                    optionWorksheet.Layout = Worksheet.WS_LAYOUT_HORIZONTAL;
                if (optionWorksheet.Layout == Worksheet.WS_LAYOUT_HORIZONTAL)
                    this.optLayoutH.Checked = true;
                if (optionWorksheet.Layout == Worksheet.WS_LAYOUT_VERTICAL)
                    this.optLayoutV.Checked = true;
                CheckWSSizeISO();

                SetSize();

                changeByUpdate = false;
            }
        }