public void LoadWasterPipe() { TPipeInfo pipeinfo = new TPipeInfo(App._dbpath, App.PassWord); //读取数据库 List <CPipeInfo> pipelist = pipeinfo.Sel_PipeInfo((int)PIPETYPE.PIPE_WASTE); //仅仅读取污水管道 //读取管道内窥数据 TUSInfo usinfo = new TUSInfo(App._dbpath, App.PassWord); List <CUSInfo> uslist = usinfo.Load_USInfo(); foreach (CPipeInfo info in pipelist) { WastePipe pipe = null; WasteCover starjunc = FindStartWJunc(info); //找到起始点坐标 WasteCover endjunc = FindEndWJunc(info); //找到终止点坐标 if (starjunc == null || endjunc == null) { continue; } pipe = new WastePipe(starjunc, endjunc); pipe.pipeInfo = info; pipe.UsInfo = FindUSInfo(uslist, info.ID); WastePipeList.Add(pipe); } }
public void LoadWasterPipe() { TPipeInfo pipeinfo = new TPipeInfo(App._dbpath, App.PassWord); //读取数据库 List<CPipeInfo> pipelist = pipeinfo.Sel_PipeInfo((int)PIPETYPE.PIPE_WASTE); //仅仅读取污水管道 //读取管道内窥数据 TUSInfo usinfo = new TUSInfo(App._dbpath, App.PassWord); List<CUSInfo> uslist = usinfo.Load_USInfo(); foreach (CPipeInfo info in pipelist) { WastePipe pipe = null; WasteCover starjunc = FindStartWJunc(info); //找到起始点坐标 WasteCover endjunc = FindEndWJunc(info); //找到终止点坐标 if (starjunc == null || endjunc == null) continue; pipe = new WastePipe(starjunc, endjunc); pipe.pipeInfo = info; pipe.UsInfo = FindUSInfo(uslist, info.ID); WastePipeList.Add(pipe); } }
public new void OnMouseDown(object sender, MouseButtonEventArgs e) { if (CurrentMode == ADDMODE) { Point cp = e.GetPosition(context); //获取相关坐标 cp.X = cp.X + 7 - App.StrokeThinkness / 2; cp.Y = cp.Y + 7 - App.StrokeThinkness / 2; //设置为中心 Cover c = wastepipes.wastejunc.FindClosedCover(cp); //检测最近点位 if (null == c) { if (mMovingPath != null) { context.Children.Remove(mMovingPath); mMovingPath = null; } if (IsDrawLine) { IsDrawLine = false; } return; } if (IsDrawLine == false) { mStartJunc = c; mStartPoint.X = Mercator2ScreenX(mStartJunc.Location.X) + App.StrokeThinkness / 2; //计算管道第一个点位置坐标 mStartPoint.Y = Mercator2ScreenY(mStartJunc.Location.Y) + App.StrokeThinkness / 2; mMovingPath = new Path(); mMovingPath.Stroke = colorCenter.Seleted_Fill_Color; mMovingPath.Data = DrawPipe(mStartPoint , mStartPoint); mMovingPath.StrokeThickness = App.StrokeThinkness / 2; context.Children.Add(mMovingPath); } else { //removing the tmp moving path context.Children.Remove(mMovingPath); mMovingPath = null; mEndJunc = c; mEndPoint.X = Mercator2ScreenX(mEndJunc.Location.X) + App.StrokeThinkness / 2; mEndPoint.Y = Mercator2ScreenY(mEndJunc.Location.Y) + App.StrokeThinkness / 2; WastePipe pipe = new WastePipe(mStartJunc.Name + "-" + mEndJunc.Name, "双击查看信息", mStartJunc , mEndJunc); pipe.Start.Location = GetMercator(mStartPoint); pipe.End.Location = GetMercator(mEndPoint); PipeAddCommand cmd = new PipeAddCommand(this, pipe, mStartJunc, mEndJunc); cmd.Excute(); CmdManager.getInstance().PushCmd(cmd); } IsDrawLine = !IsDrawLine; } else if (CurrentMode == DELMODE) { Path path = e.Source as Path; if (path == null) { base.OnMouseDown(sender, e); //若都不是添加或删除命令,则交给父类进行处理 return; } PipeDelCommand cmd = new PipeDelCommand(this, path); cmd.Excute(); CmdManager.getInstance().PushCmd(cmd); } base.OnMouseDown(sender, e); //若都不是添加或删除命令,则交给父类进行处理 }