Exemplo n.º 1
0
        public void Save(ContourLine[] contLines, ContourLine.ContourEnvelope envelope, string spatialRef, string fname)
        {
            if (contLines == null || contLines.Length == 0)
            {
                return;
            }
            IContourPersisit persist = new ContourPersist();

            persist.Write(contLines, GeoDo.RSS.RasterTools.ContourPersist.enumCoordType.Prj,
                          envelope, spatialRef, fname);
        }
Exemplo n.º 2
0
        public void Render(object sender, IDrawArgs drawArgs)
        {
            if (_cntLines == null || _cntLines.Length == 0 || _contourClassItems == null || _contourClassItems.Length == 0)
            {
                return;
            }
            if (_canvas == null)
            {
                _canvas                    = sender as ICanvas;
                _canvasSizeChanged         = new EventHandler(Container_SizeChanged);
                _canvas.OnEnvelopeChanged += _canvasSizeChanged;
                _conflictor                = new PixelConflictor(_canvas.Container.Size);
            }
            CoordEnvelope evp = _canvas.CurrentEnvelope;

            _crtCanvasEnvelope = new ContourLine.ContourEnvelope((float)evp.MinX, (float)evp.MaxX, (float)evp.MinY, (float)evp.MaxY);
            TryUpdateLabelBuffers(drawArgs);
            TryProject();
            TrySetSmoothMode(drawArgs);
            TryResetConflictor();
            float minWidth  = MIN_WIDTH * _canvas.ResolutionX;
            float minHeight = MIN_WIDTH * _canvas.ResolutionY;

            ContourLine.ContourEnvelope thisEvp = null;
            int          classIdx = 0;
            ContourClass cntClass = null;

            foreach (ContourLine cntLine in _cntLines)
            {
                if (cntLine == null)
                {
                    continue;
                }
                classIdx = cntLine.ClassIndex;
                cntClass = _contourClassItems[classIdx];
                thisEvp  = cntLine.Envelope;
                //如果不在可视区域则绘制
                if (!_crtCanvasEnvelope.IsInteractived(thisEvp))
                {
                    continue;
                }
                //如果在当前比例尺下太小则不显示
                if (thisEvp.Width > minWidth || thisEvp.Height > minHeight)
                {
                    DrawContour(drawArgs, cntLine, cntClass, _canvas);
                }
            }
        }
Exemplo n.º 3
0
        private void GetSpatialRefEnvelope(out ContourLine.ContourEnvelope envelope, out string spatialRef)
        {
            envelope   = null;
            spatialRef = null;
            if (_canvas == null || _canvas.PrimaryDrawObject == null)
            {
                return;
            }
            IPrimaryDrawObject primaryObj = _canvas.PrimaryDrawObject;

            envelope = new ContourLine.ContourEnvelope(
                (float)primaryObj.OriginalEnvelope.MinX,
                (float)primaryObj.OriginalEnvelope.MaxX,
                (float)primaryObj.OriginalEnvelope.MinY,
                (float)primaryObj.OriginalEnvelope.MaxY);
            spatialRef = primaryObj.SpatialRef;
        }
Exemplo n.º 4
0
 public void Save(string fname, bool isWithDataFile)
 {
     if (string.IsNullOrEmpty(fname))
     {
         return;
     }
     if (!fname.ToLower().EndsWith(".xml"))
     {
         fname += ".xml";
     }
     _fileName = fname;
     //保存视图(等值线绘制及标绘的设置)
     (new Object2Xml()).ToXmlFile(this, fname);
     //保存等值线数据(采用投影坐标)
     if (isWithDataFile)
     {
         ContourDataStorager         st       = new ContourDataStorager();
         ContourLine.ContourEnvelope envelope = null;
         string spatialRef = null;
         GetSpatialRefEnvelope(out envelope, out spatialRef);
         string dataFileName = fname + ".contour";
         st.Save(_cntLines, envelope, spatialRef, dataFileName);
     }
 }