//Загрузить в бинарном формате public static Shape LoadBinary(BinaryReader br, DelegateContainer _dlc) { byte Signature = br.ReadByte(); switch (Signature) { case 0: return(new sCross(_dlc, br.ReadDouble(), br.ReadDouble())); case 1: return(new sLine(_dlc, br.ReadDouble(), br.ReadDouble(), br.ReadDouble(), br.ReadDouble())); case 2: return(new sCircle(_dlc, br.ReadDouble(), br.ReadDouble(), br.ReadDouble())); case 3: return(new sRect(_dlc, br.ReadDouble(), br.ReadDouble(), br.ReadDouble(), br.ReadDouble())); default: return(null); } }
//Загрузить в бинарном формате public static Shape LoadBinary(BinaryReader br, DelegateContainer _dlc) { byte Signature = br.ReadByte(); switch (Signature) { case 0: return new sCross(_dlc, br.ReadDouble(), br.ReadDouble()); case 1: return new sLine(_dlc, br.ReadDouble(), br.ReadDouble(), br.ReadDouble(), br.ReadDouble()); case 2: return new sCircle(_dlc, br.ReadDouble(), br.ReadDouble(), br.ReadDouble()); case 3: return new sRect(_dlc, br.ReadDouble(), br.ReadDouble(), br.ReadDouble(), br.ReadDouble()); default: return null; } }
protected Shape(DelegateContainer _dlc) { this.dlc = _dlc; }
public sCross(DelegateContainer _dlc, double x, double y) : base(_dlc) { Center = new fpoint(x, y); }
public sCross(DelegateContainer _dlc, int x, int y) : base(_dlc) { Center = base.dlc.fScreenToReal(new Point(x, y)); }
public sCircle(DelegateContainer _dlc, Point Down, Point Up) : base(_dlc) { this.Center = base.dlc.fScreenToReal(Down); this.Radius = fpoint.GetRasst(base.dlc.fScreenToReal(Down), base.dlc.fScreenToReal(Up)); }
public sRect(DelegateContainer _dlc, Point Down, Point Up) : base(_dlc) { this.Up = base.dlc.fScreenToReal(Down); this.Down = base.dlc.fScreenToReal(Up); }
public sRect(DelegateContainer _dlc, double x1, double y1, double x2, double y2) : base(_dlc) { this.Up = new fpoint(x1, y1); this.Down = new fpoint(x2, y2); }
public sCircle(DelegateContainer _dlc, double x1, double y1, double r) : base(_dlc) { this.Center = new fpoint(x1, y1); this.Radius = r; }
public sLine(DelegateContainer _dlc, double x1, double y1, double x2, double y2) : base(_dlc) { fpBeg = new fpoint(x1, y1); fpEnd = new fpoint(x2, y2); }
public sLine(DelegateContainer _dlc, Point p1, Point p2) : base(_dlc) { fpBeg = base.dlc.fScreenToReal(p1); fpEnd = base.dlc.fScreenToReal(p2); }
//Формирует контейнер с функциями, которые нужны для отрисовки фигур private DelegateContainer GetDeleateContainer() { DelegateContainer dlc = new DelegateContainer(); dlc.fGetGraphics = new DelegateContainer.dGetGraphics(GetGraphics); dlc.fRealToSreeen = new DelegateContainer.dRealToScreen(RealToScreen); dlc.fScreenToReal = new DelegateContainer.dScreenToReal(ScreenToReal); return dlc; }