Exemplo n.º 1
0
        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);
            }
        }
Exemplo n.º 2
0
 public void DelRainPipe(RainPipe pipe)
 {
     int index = 0;
     foreach(RainPipe rp in listRains)
     {
         if (pipe.Name.Equals(rp.Name))
         {
             break;
         }
         index++;
     }
     if (index < listRains.Count)
     {
         listRains.RemoveAt(index);
         mListVLine.RemoveAt(index);
     }
 }
Exemplo n.º 3
0
        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);
            }
        }
Exemplo n.º 4
0
        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 = rainpipes.rainjunc.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;

                    RainPipe pipe = new RainPipe(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);                //若都不是添加或删除命令,则交给父类进行处理
        }
Exemplo n.º 5
0
 public void AddRainPipe(RainPipe pipe)
 {
     listRains.Add(pipe);
     mListVLine.Add(new VectorLine(state.Mercator2Screen(pipe.Start.Location),
                                   state.Mercator2Screen(pipe.End.Location)));
 }