public static IGhost GetGhost(object pars, GhostTypes type) { Point[] points; switch (type) { case GhostTypes.Rectangle: if (mRectangular == null) { mRectangular = new RectGhost(View); } points = (Point[])pars; mRectangular.Start = points[0]; mRectangular.End = points[1]; return(mRectangular); case GhostTypes.Ellipse: if (mEllipse == null) { mEllipse = new EllipticGhost(View); } points = (Point[])pars; mEllipse.Start = points[0]; mEllipse.End = points[1]; return(mEllipse); case GhostTypes.Line: if (mLine == null) { mLine = new LineGhost(View); } points = (Point[])pars; mLine.Start = points[0]; mLine.End = points[1]; return(mLine); case GhostTypes.MultiLine: if (mMultiLine == null) { mMultiLine = new MultiLineGhost(View); } points = (Point[])pars; mMultiLine.Points = points; return(mMultiLine); case GhostTypes.CurvedLine: if (mCurvedLine == null) { mCurvedLine = new CurvedLineGhost(View); } points = (Point[])pars; mCurvedLine.Points = points; return(mCurvedLine); case GhostTypes.Polygon: if (mPolygon == null) { mPolygon = new PolygonGhost(View); } points = (Point[])pars; mPolygon.Points = points; return(mPolygon); default: return(null); } }
public static IGhost GetGhost(object pars, GhostTypes type) { Point[] points; switch(type) { case GhostTypes.Rectangle: if(mRectangular == null) mRectangular = new RectGhost(View); points = (Point[]) pars; mRectangular.Start = points[0]; mRectangular.End = points[1]; return mRectangular; case GhostTypes.Ellipse: if(mEllipse == null) mEllipse = new EllipticGhost(View); points = (Point[]) pars; mEllipse.Start = points[0]; mEllipse.End = points[1]; return mEllipse; case GhostTypes.Line: if(mLine == null) mLine = new LineGhost(View); points = (Point[]) pars; mLine.Start = points[0]; mLine.End = points[1]; return mLine; case GhostTypes.MultiLine: if(mMultiLine == null) mMultiLine = new MultiLineGhost(View); points = (Point[]) pars; mMultiLine.Points = points; return mMultiLine; case GhostTypes.CurvedLine: if(mCurvedLine == null) mCurvedLine = new CurvedLineGhost(View); points = (Point[]) pars; mCurvedLine.Points = points; return mCurvedLine; case GhostTypes.Polygon: if(mPolygon == null) mPolygon = new PolygonGhost(View); points = (Point[]) pars; mPolygon.Points = points; return mPolygon; default: return null; } }