/** * @brief png형식의 이미지 파일을 open할 때 사용한다. * @details 이미지를 불러와서 Bitmap 객체를 생성하고 ImageFigure를 새로 생성하여 객체리스트에 추가한다. * @author 박성식 * @date 16-07-17 * @param fileName 열고자 하는 파일이름 */ public void OpenPNG(string fileName) { Bitmap img = graphicHelper.getUnlockedBitmapHandle(fileName); ((View)viewList[0]).Width = img.Width + 100; ((View)viewList[0]).Height = img.Height + 100; //저장된 이미지를 가지고 imagefigure 생성 //imageFigure가 자기 이미지를 담고 있음 ImageFigure temp = new ImageFigure(img); drawnFigures.Add(temp); }
/** * @brief 복제 * @author 불명(김민규 담당) * @date 불명(2017-1-17 확인) * @return object 똑같은 값을 가지는 새로운 Figure를 생성해 반환한다. 사실상 팩토리 역할을 한다. */ public virtual object Clone() { Figure figure = null; if (this.GetType() == typeof(LineFigure)) { figure = new LineFigure(); } else if (this.GetType() == typeof(PolyLineFigure)) { figure = new PolyLineFigure(); } else if (this.GetType() == typeof(FreeLineFigure)) { figure = new FreeLineFigure(); } else if (this.GetType() == typeof(RectFigure)) { figure = new RectFigure(); } else if (this.GetType() == typeof(OvalFigure)) { figure = new OvalFigure(); } else if (this.GetType() == typeof(ImageFigure)) { figure = new ImageFigure(((ImageFigure)this).getImage()); } else if (this.GetType() == typeof(MergedFigure)) { FigureList figureListToClone = ((MergedFigure)this).getFigList(); figure = new MergedFigure((FigureList)figureListToClone.Clone()); } else { throw new System.NotImplementedException(); } figure.coordinates = (RectList)this.coordinates.Clone(); figure.filledColor = this.filledColor; figure.bFilled = this.bFilled; figure.groupName = this.groupName; return(figure); }
/** * @brief 복제 뒤 상대좌표 반영 * @author 김민규 * @date 2017-02-07 * @param magnificationRatio 확대 비율 * @param screenPos 화면의 현재 위치 */ public virtual Figure RelativeClone(int magnificationRatio, Pos screenPos) { Figure figure = null; if (this.GetType() == typeof(LineFigure)) { figure = new LineFigure(); } else if (this.GetType() == typeof(PolyLineFigure)) { figure = new PolyLineFigure(); } else if (this.GetType() == typeof(FreeLineFigure)) { figure = new FreeLineFigure(); } else if (this.GetType() == typeof(RectFigure)) { figure = new RectFigure(); } else if (this.GetType() == typeof(OvalFigure)) { figure = new OvalFigure(); } else if (this.GetType() == typeof(ImageFigure)) { figure = new ImageFigure(((ImageFigure)this).getImage()); } else if (this.GetType() == typeof(MergedFigure)) { FigureList figureListToClone = ((MergedFigure)this).getFigList(); figure = new MergedFigure((FigureList)figureListToClone.RelativeClone(magnificationRatio, screenPos)); } else { throw new System.NotImplementedException(); } figure.coordinates = (RectList)this.coordinates.RelativeClone(magnificationRatio, screenPos); figure.filledColor = this.filledColor; return(figure); }