Beispiel #1
0
        private void RenderFeatures(Graphics g, QuickTransformArgs quickTransfrom)
        {
            IFeatureClass fetclass = _class as IFeatureClass;

            IGrid[] grids = fetclass.Grids;
            if (grids == null || grids.Length == 0)
            {
                return;
            }
            try
            {
                fetclass.RepeatFeatureRecorder.BeginRender();
                int               gridCount        = grids.Length;
                Envelope          currentExtent    = _environment.ExtentOfProjectionCoord;
                Grid              gd               = null;
                IOutsideIndicator outsideIndicator = null;
                //
                for (int i = 0; i < gridCount; i++)
                {
                    gd = grids[i] as Grid;
                    if (gd.IsEmpty())
                    {
                        continue;
                    }
                    outsideIndicator = (gd as ISupportOutsideIndicator).OutsideIndicator;
                    //test,draw grids
                    //DrawTestGrid(gd, g, quickTransfrom);
                    //

                    /* 为了测试其他投影矢量绘制注释掉
                     * outsideIndicator.SetOutside(!currentExtent.IsInteractived(gd.GridEnvelope,ref gd._isfullInternal));
                     * if (outsideIndicator.IsOutside)
                     *  continue;
                     */
                    outsideIndicator.SetOutside(!currentExtent.IsInteractived(gd.GridEnvelope, ref gd._isfullInternal));
                    if (outsideIndicator.IsOutside)
                    {
                        continue;
                    }
                    _featureRender.Render(_enabledDisplayLevel, quickTransfrom, gd, g, currentExtent, fetclass.RepeatFeatureRecorder);
                }
            }
            finally
            {
                fetclass.RepeatFeatureRecorder.EndRender();
            }
        }
Beispiel #2
0
        public void Render(System.Drawing.Graphics g, QuickTransformArgs quickTransform)
        {
            Envelope currentExtent = _environment.ExtentOfProjectionCoord;

            if (!currentExtent.IsInteractived(_class.FullEnvelope))
            {
                return;
            }
            IMapRuntime        runtime   = _environment as IMapRuntime;
            IRasterDataSource  ds        = _class.DataSource as IRasterDataSource;
            enumCoordinateType coordType = ds.GetCoordinateType();
            Envelope           evp       = null;

            if (coordType == enumCoordinateType.Geographic)
            {
                evp = ToGeoEnvelope(runtime, currentExtent);
            }
            Bitmap bm = ds.Reader.Read(evp, runtime.Host.CanvasSize.Width, runtime.Host.CanvasSize.Height);

            if (bm != null)
            {
                g.DrawImage(bm, 0, 0);
            }
        }
Beispiel #3
0
        private void DrawAllGeometries(ILayerContainer layerContainer, Graphics g)
        {
            int currentScale = _scale;

            try
            {
                ILayer[]              layers         = layerContainer.Layers;
                IFeatureLayer         fetlyr         = null;
                List <ILayerDrawable> twostepsLayers = new List <ILayerDrawable>();
                IFeatureRenderer      preRender      = null;
                foreach (ILayerDrawable lyr in layers)
                {
                    if (!(lyr is IFeatureLayer))
                    {
                        continue;
                    }
                    fetlyr = lyr as IFeatureLayer;
                    if (preRender is IFeatureTwoStepRenderer && !(fetlyr.Renderer is IFeatureTwoStepRenderer))
                    {
                        FinishTwoStep(g, twostepsLayers);
                    }
                    preRender = fetlyr.Renderer;
                    (lyr as FeatureLayer)._isRendered = false;
                    if (!lyr.Visible)
                    {
                        continue;
                    }
                    //如果图层未初始化
                    if (!fetlyr.IsReady)
                    {
                        continue;
                    }
                    //判断整个图层是否在可视区域之外
                    IFeatureClass fetclass = fetlyr.Class as IFeatureClass;
                    if (!_viewportProjection.IsInteractived(fetclass.FullEnvelope))
                    {
                        continue;
                    }
                    //判断在当前比例尺下标注是否显示
                    if (!fetlyr.VisibleAtScale(currentScale))
                    {
                        continue;
                    }
                    //绘制几何形状
                    if (fetlyr.Renderer is IFeatureTwoStepRenderer)
                    {
                        twostepsLayers.Add(lyr);
                        //第一阶段
                        (fetlyr.Renderer as IFeatureTwoStepRenderer).StepType = enumTwoStepType.Outline;
                    }
                    //渲染几何形状
                    lyr.Render(g, _quickTransfrom);
                    (lyr as FeatureLayer)._isRendered = true;
                    //
                    g.Flush(FlushIntention.Sync);
                }
                if (twostepsLayers.Count > 0)//last layer
                {
                    FinishTwoStep(g, twostepsLayers);
                }
            }
            catch (Exception ex)
            {
                Log.WriterException(ex);
            }
        }