コード例 #1
0
ファイル: LevelAdjuster.cs プロジェクト: configare/hispeed
        private void ComputeQuickArgs(Matrix transform)
        {
            if (_quickTranArgs == null)
            {
                _quickTranArgs = new QuickTransformArgs();
            }
            ShapePoint geoPt1 = _features[0].Geometry.Centroid;
            ShapePoint geoPt2 = _features[_features.Count - 1].Geometry.Centroid;
            PointF     prjPt1 = geoPt1.ToPointF();
            PointF     prjPt2 = geoPt2.ToPointF();

            PointF[] screenPts = new PointF[] { prjPt1, prjPt2 };
            transform.TransformPoints(screenPts);
            //
            _quickTranArgs.kLon = (screenPts[0].X - screenPts[1].X) / (prjPt1.X - prjPt2.X);
            _quickTranArgs.kLat = (screenPts[0].Y - screenPts[1].Y) / (prjPt1.Y - prjPt2.Y);
            _quickTranArgs.bLon = screenPts[0].X - _quickTranArgs.kLon * prjPt1.X;
            _quickTranArgs.bLat = screenPts[0].Y - _quickTranArgs.kLat * prjPt1.Y;
        }
コード例 #2
0
        public void Render(RenderArgs arg)
        {
            if (_location == null)
            {
                return;
            }
            PointF[] pts = new PointF[] { _location.ToPointF() };
            (_runtime as IFeatureRenderEnvironment).CoordinateTransform.PrjCoord2PixelCoord(pts);
            PointF pt = pts[0];

            if (_isShowBubble)
            {
                DrawBubbleImage(arg, pt);
            }
            if (!_isFlash)
            {
                return;
            }
            int halfw = 6;
            int w     = 2 * halfw;

            if (_needRender)
            {
                SmoothingMode oldM = arg.Graphics.SmoothingMode;
                try
                {
                    using (Pen p = new Pen(Color.Gray, 2))
                    {
                        arg.Graphics.SmoothingMode = SmoothingMode.HighQuality;
                        arg.Graphics.DrawLine(p, pt.X, 0, pt.X, _runtime.Host.CanvasSize.Height);
                        arg.Graphics.DrawLine(p, 0, pt.Y, _runtime.Host.CanvasSize.Width, pt.Y);
                        arg.Graphics.FillEllipse(Brushes.Green, (float)pt.X - halfw, (float)pt.Y - halfw, w, w);
                    }
                }
                finally
                {
                    arg.Graphics.SmoothingMode = oldM;
                }
            }
        }