Example #1
0
        public static IGhost GetGhost(object pars, GhostTypes type, IView View)
        {
            Point[] points;
            switch (type)
            {
            case GhostTypes.Rectangle:
                var mRectangular = new RectGhost(View);
                points             = (Point[])pars;
                mRectangular.Start = points[0];
                mRectangular.End   = points[1];
                return(mRectangular);

            case GhostTypes.Ellipse:
                var mEllipse = new EllipticGhost(View);
                points         = (Point[])pars;
                mEllipse.Start = points[0];
                mEllipse.End   = points[1];
                return(mEllipse);

            case GhostTypes.Line:
                var mLine = new LineGhost(View);
                points      = (Point[])pars;
                mLine.Start = points[0];
                mLine.End   = points[1];
                return(mLine);

            case GhostTypes.MultiLine:
                var mMultiLine = new MultiLineGhost(View);
                points            = (Point[])pars;
                mMultiLine.Points = points;
                return(mMultiLine);

            case GhostTypes.CurvedLine:
                var mCurvedLine = new CurvedLineGhost(View);
                points             = (Point[])pars;
                mCurvedLine.Points = points;
                return(mCurvedLine);

            case GhostTypes.Polygon:
                var mPolygon = new PolygonGhost(View);
                points          = (Point[])pars;
                mPolygon.Points = points;
                return(mPolygon);

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