예제 #1
0
파일: GPSLayer.cs 프로젝트: ntj/GravurGIS
        private void SetInvalidateRegions()
        {
            if (mainControler.GpsControler.Opened && mainControler.HasActiveDisplay)
            {
                if (config.GpsViewMode == GpsView.StaticMap)
                {
                    recList.Clear();

                    p = CoordCalculator.calculateDisplayCoords(oldGk, mainControler.MapPanel.DX,
                                                               mainControler.MapPanel.DY, mainControler.LayerManager.Scale);

                    // Clipping: We do not need to invalide if the point is out of our view
                    if (isInDrawingArea(p, mainControler.MapPanel.DrawingArea))
                    {
                        tempRec.X      = Convert.ToInt32(Math.Min(p.x - 2, Int32.MaxValue));
                        tempRec.Y      = Convert.ToInt32(Math.Min(p.y - 2, Int32.MaxValue));
                        tempRec.Width  = config.GpsLayerPointWidth + 4;
                        tempRec.Height = config.GpsLayerPointWidth + 4;
                        recList.Add(tempRec);
                    }
                    p = CoordCalculator.calculateDisplayCoords(gkToRender, mainControler.MapPanel.DX,
                                                               mainControler.MapPanel.DY, mainControler.LayerManager.Scale);

                    // Clipping: We do not need to invalide if the point is out of our view
                    if (isInDrawingArea(p, mainControler.MapPanel.DrawingArea))
                    {
                        tempRec.X = System.Convert.ToInt32(Math.Min(p.x - 2, Int32.MaxValue));
                        tempRec.Y = System.Convert.ToInt32(Math.Min(p.y - 2, Int32.MaxValue));
                        recList.Add(tempRec);
                        oldGk = gkToRender;
                    }
                    this.mainControler.MapPanel.InvalidateRegion(recList);
                }
                else //config.GpsViewMode == GpsView.staticPoint
                {
                    double scale = mainControler.LayerManager.Scale;
                    mainControler.MapPanel.DX =
                        mainControler.MapPanel.DrawingArea.Width / -2 + gkToRender.r_value * scale;
                    mainControler.MapPanel.DY =
                        this.mainControler.MapPanel.DrawingArea.Height / 2 + gkToRender.h_value * scale;
                    this.mainControler.MapPanel.RequesLayerChange();
                    this.mainControler.MapPanel.Invalidate();
                }
            }
        }
예제 #2
0
파일: GPSLayer.cs 프로젝트: ntj/GravurGIS
        public override bool Render(RenderProperties rp)
        {
            // clip everything outside drawingArea
            // in this case this means, draw nothing
            if (isInDrawingArea(p, rp.DrawingArea))
            {
                SolidBrush brush = new SolidBrush(config.GpsLayerPointColor);
                p = CoordCalculator.calculateDisplayCoords(
                    gkToRender, rp.DX, rp.DY, this.mainControler.LayerManager.Scale);
                rp.G.FillEllipse(brush, new Rectangle(
                                     Convert.ToInt32(p.x),
                                     Convert.ToInt32(p.y),
                                     config.GpsLayerPointWidth,
                                     config.GpsLayerPointWidth));
            }

            return(true);
        }