/// <summary> /// 响应鼠标按下事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> public override 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; //设置为中心 RainCover c = new RainCover("雨水检查井", GetMercator(cp), "双击查看详细信息"); //添加其他相关信息 c.Location = GetMercator(cp); JuncAddCommand cmd = new JuncAddCommand(this, c); cmd.Excute(); CmdManager.getInstance().PushCmd(cmd); } else if(CurrentMode==DELMODE) { Path path = e.Source as Path; if (path == null) { base.OnMouseDown(sender, e); //若都不是添加或删除命令,则交给父类进行处理 return; } JuncDelCommand cmd = new JuncDelCommand(this, path); cmd.Excute(); CmdManager.getInstance().PushCmd(cmd); } base.OnMouseDown(sender, e); //若都不是添加或删除命令,则交给父类进行处理 }
public void LoadRainPipe() { TPipeInfo pipeinfo = new TPipeInfo(App._dbpath, App.PassWord); //读取数据库 List <CPipeInfo> pipelist = pipeinfo.Sel_PipeInfo((int)PIPETYPE.PIPE_RAIN); //仅仅读取雨水管道 TUSInfo usinfo = new TUSInfo(App._dbpath, App.PassWord); List <CUSInfo> uslist = usinfo.Load_USInfo(); foreach (CPipeInfo info in pipelist) { RainPipe pipe = null; RainCover starjunc = FindStartRJunc(info); //找到起始点坐标 RainCover endjunc = FindEndRJunc(info); //找到终止点坐标 if (starjunc == null || endjunc == null) { continue; } pipe = new RainPipe(starjunc, endjunc); pipe.pipeInfo = info; pipe.UsInfo = FindUSInfo(uslist, info.ID); RainPipeList.Add(pipe); } }
RainCover FindEndRJunc(CPipeInfo cp) { RainCover c = null; c = RainCoverList.Find(cc => cc.juncInfo.ID == cp.Out_JunID); return(c); }
public void AddJunc(RainCover c) //添加雨水检查井 { listRains.Add(c); //计算点的坐标 mListScreenpoint.Add(state.Mercator2Screen(c.Location)); }
public void LoadRainCover() { TJuncInfo juninfo = new TJuncInfo(App._dbpath, App.PassWord); List<CJuncInfo> tmplist = juninfo.Sel_JuncInfoByCaty((int)JUNCTYPE.JUNC_RAIN); //仅仅加载雨水检查井 //进行坐标转换 foreach (CJuncInfo mJunc in tmplist) { if (mJunc.X_Coor == 0) //无座标 continue; RainCover cover = null; Point p = new Point(mJunc.X_Coor - Constants.COOR_X_OFFSET, mJunc.Y_Coor - Constants.COOR_Y_OFFSET); cover = new RainCover(mJunc.JuncName, GISConverter.WGS842Merator(p), mJunc.SystemID); cover.juncInfo = mJunc; RainCoverList.Add(cover); } }
public void DelJunc(RainCover c) { int index = 0; foreach(RainCover tmpc in listRains) { if(c.Name.Equals(tmpc.Name)) { break; } index++; } if (index < listRains.Count) { listRains.RemoveAt(index); mListScreenpoint.RemoveAt(index); } }
public void LoadRainCover() { TJuncInfo juninfo = new TJuncInfo(App._dbpath, App.PassWord); List <CJuncInfo> tmplist = juninfo.Sel_JuncInfoByCaty((int)JUNCTYPE.JUNC_RAIN); //仅仅加载雨水检查井 //进行坐标转换 foreach (CJuncInfo mJunc in tmplist) { if (mJunc.X_Coor == 0) //无座标 { continue; } RainCover cover = null; Point p = new Point(mJunc.X_Coor - Constants.COOR_X_OFFSET, mJunc.Y_Coor - Constants.COOR_Y_OFFSET); cover = new RainCover(mJunc.JuncName, GISConverter.WGS842Merator(p), mJunc.SystemID); cover.juncInfo = mJunc; RainCoverList.Add(cover); } }