public PipeAddCommand(PipeState state, Pipe pipe , Cover injunc , Cover outjunc) { mState = state; mPipe = pipe; mInJunc = injunc; mOutJunc = outjunc; }
//添加单个检查井 /// <summary> /// 增加井盖 /// </summary> /// <param name="cover"></param> /// <param name="cp"></param> public void AddJunc(Cover cover, Point cp) { Path path = new Path(); path.Fill = cover.GetColorBrush(); path.Stroke = colorCenter.UnSelected_Border_Color; EllipseGeometry eg = new EllipseGeometry(); eg.Center = cp; eg.RadiusX = App.StrokeThinkness; eg.RadiusY = App.StrokeThinkness; path.Data = eg; path.ToolTip = cover; context.Children.Add(path); listpath.Add(path); }
public void Undo() { if (mState == null) return; Pipe pipe = mPath.ToolTip as Pipe; mPath = mState.AddPipe(pipe, new VectorLine(pipe.Start.Location, pipe.End.Location)); Cover start = new Cover(); start.juncInfo = new DBCtrl.DBClass.CJuncInfo(); start.juncInfo.ID = pipe.pipeInfo.In_JunID; Cover end = new Cover(); end.juncInfo = new DBCtrl.DBClass.CJuncInfo(); end.juncInfo.ID = pipe.pipeInfo.Out_JunID; mCurId = mState.AddPipe2Data(pipe, start, end); }
public Path AddJunc(Cover cover) { Path path = new Path(); path.Fill = cover.GetColorBrush(); path.Stroke = colorCenter.UnSelected_Border_Color; EllipseGeometry eg = new EllipseGeometry(); eg.Center = Mercator2Screen(cover.Location); eg.RadiusX = App.StrokeThinkness; eg.RadiusY = App.StrokeThinkness; path.Data = eg; path.ToolTip = cover; context.Children.Add(path); listpath.Add(path); return path; }
/// <summary> /// set the new junction point to buffer and insert into database /// </summary> /// <param name="c"></param> public override int AddJunc2Data(Cover c) { rainjuncs.AddJunc((RainCover)c); return InsterDB(c); }
public JuncAddCommand(JuncState state , Cover c) { mState = state; mCover = c; }
public override int AddPipe2Data(Pipe pipe, Cover injunc, Cover outjunc) { wastepipes.AddWastePipe((WastePipe)pipe); //插入后台数据库 return InsterDb(pipe, injunc, outjunc); }
protected void DelDB(Cover c) { if (c == null) return; CJuncInfo info = c.juncInfo; DeleteCmd cmd = new DeleteCmd(); JuncRev rev = new JuncRev(); rev.ListJunc = new List<CJuncInfo>(); rev.ListJunc.Add(info); cmd.SetReceiver(rev); cmd.Execute(); }
//添加数据到缓存数据以及数据库 public virtual int AddPipe2Data(Pipe pipe, Cover injuc, Cover outjunc) { return 0; }
public virtual void DelJuncFromData(Cover c) { }
public virtual int AddJunc2Data(Cover c) { return 0; }
public override void DelJuncFromData(Cover c) { wastejunc.DelWasteJunc((WasteCover)c); //删除数据库中数据 DelDB(c); }
public override int AddJunc2Data(Cover c) { wastejunc.AddWasteJunc((WasteCover)c); return InsterDB(c); }
public override void DelJuncFromData(Cover c) { rainjuncs.DelJunc((RainCover)c); //删除数据库中数据 DelDB(c); }
//返回插入junction的id protected int InsterDB(Cover c) { if (c == null) return 0; //change the coordinate Mercator to WGS84 Coords.Point p = new Coords.Point(); p.x = c.Location.X; p.y = c.Location.Y; p = Coords.Mercator2WGS84(p); //store to CJuncInfo info = new CJuncInfo(); info.X_Coor = p.x + Constants.COOR_X_OFFSET; info.Y_Coor = p.y + Constants.COOR_Y_OFFSET; info.Junc_Category = c.juncInfo.Junc_Category; //数据库操作 TJuncInfo juncinfo = new TJuncInfo(App._dbpath, App.PassWord); TJuncExtInfo juncextinfo = new TJuncExtInfo(App._dbpath, App.PassWord); if (!juncinfo.Insert_JuncInfo(ref info)) { return 0; } CJuncExtInfo extinfo = new CJuncExtInfo(); extinfo.JuncID = info.ID; juncextinfo.Insert_JuncExtInfo(ref extinfo); return info.ID; }
public override int AddPipe2Data(Pipe pipe , Cover injunc , Cover outjunc) { rainpipes.AddRainPipe((RainPipe)pipe); //插入后台数据库 return InsterDb(pipe , injunc , outjunc); }
protected int InsterDb(Pipe pipe , Cover injunc , Cover outjunc) { CPipeInfo pipeInfo = new CPipeInfo(); CPipeExtInfo pipeExtInfo = new CPipeExtInfo(); CUSInfo UsInfo = new CUSInfo(); pipeInfo.PipeName = pipe.Name; pipeInfo.In_JunID = injunc.juncInfo.ID; pipeInfo.Out_JunID = outjunc.juncInfo.ID; pipeInfo.Pipe_Category = pipe.pipeInfo.Pipe_Category; UsInfo.Struct_Class = 0; TPipeInfo tpipeinfo = new TPipeInfo(App._dbpath, App.PassWord); TPipeExtInfo tpipextinfo = new TPipeExtInfo(App._dbpath, App.PassWord); TUSInfo tusinfo = new TUSInfo(App._dbpath, App.PassWord); tpipeinfo.Insert_PipeInfo(ref pipeInfo); pipeExtInfo.PipeID = pipeInfo.ID; tpipextinfo.Insert_PipeExtInfo(ref pipeExtInfo); UsInfo.PipeID = pipeInfo.ID; tusinfo.Insert_USInfo(ref UsInfo); return pipeInfo.ID; }