Exemplo n.º 1
0
 //int clickCount = 0;
 public SelectPoint(IGeoReference geoRef, string fileName)
 {
     //
     // TODO: Define values for the public properties
     //
     base.m_category = ""; //localizable text
     base.m_caption  = ""; //localizable text
     base.m_message  = ""; //localizable text
     base.m_toolTip  = ""; //localizable text
     base.m_name     = ""; //unique id, non-localizable (e.g. "MyCategory_MyTool")
     try
     {
         //
         // TODO: change resource name if necessary
         //
         string bitmapResourceName = GetType().Name + ".bmp";
         base.m_bitmap = new Bitmap(GetType(), bitmapResourceName);
         base.m_cursor = new System.Windows.Forms.Cursor(GetType(), GetType().Name + ".cur");
     }
     catch (Exception ex)
     {
         System.Diagnostics.Trace.WriteLine(ex.Message, "Invalid Bitmap");
     }
     m_geoRef   = geoRef;
     m_fileName = fileName;
 }
Exemplo n.º 2
0
        /// <summary>
        /// Occurs when this command is clicked
        /// </summary>
        public override void OnClick()
        {
            // TODO: Add CmdRasterRotate.OnClick implementation
            IMapControl2 pMapCtr = (((IToolbarControl)m_hookHelper.Hook).Buddy) as IMapControl2;

            if (pMapCtr != null)
            {
                //IPoint mapPoint = pMapCtr.ToMapPoint(X, Y);
                m_frmRasterRotate = new FrmRasterRotate();
                IRaster      pRaster      = pRasterLayer.Raster;
                IRasterProps pRasterProps = pRaster as IRasterProps;
                IEnvelope    pEnvelope    = pRasterProps.Extent;
                double       X            = (pEnvelope.XMax + pEnvelope.XMin) / 2;
                double       Y            = (pEnvelope.YMax + pEnvelope.YMin) / 2;
                m_frmRasterRotate.X = X;
                m_frmRasterRotate.Y = Y;
                if (m_frmRasterRotate.ShowDialog() == DialogResult.OK)
                {
                    if (m_frmRasterRotate.isture == true)
                    {
                        IGeoReference pGR    = pRasterLayer as IGeoReference;
                        IPoint        pPoint = new PointClass();
                        pPoint.X = m_frmRasterRotate.X;
                        pPoint.Y = m_frmRasterRotate.Y;
                        pGR.Rotate(pPoint, m_frmRasterRotate.angle);
                        pMapCtr.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewAll, null, null);
                    }
                }
            }
        }
Exemplo n.º 3
0
 //int clickCount = 0;
 public SelectPoint(IGeoReference geoRef,string fileName)
 {
     //
     // TODO: Define values for the public properties
     //
     base.m_category = ""; //localizable text
     base.m_caption = "";  //localizable text
     base.m_message = "";  //localizable text
     base.m_toolTip = "";  //localizable text
     base.m_name = "";   //unique id, non-localizable (e.g. "MyCategory_MyTool")
     try
     {
         //
         // TODO: change resource name if necessary
         //
         string bitmapResourceName = GetType().Name + ".bmp";
         base.m_bitmap = new Bitmap(GetType(), bitmapResourceName);
         base.m_cursor = new System.Windows.Forms.Cursor(GetType(), GetType().Name + ".cur");
     }
     catch (Exception ex)
     {
         System.Diagnostics.Trace.WriteLine(ex.Message, "Invalid Bitmap");
     }
     m_geoRef = geoRef;
     m_fileName = fileName;
 }
Exemplo n.º 4
0
        //这个版本虽然XY互换了,但会改变影像的分辨率
        public bool NorthEastToEastNorth3(IRasterLayer pRasterLayer) //坐标系x,y变换
        {
            if (pRasterLayer == null)
            {
                return(false);
            }

            IGeoReference pGeoReference = pRasterLayer as IGeoReference;
            IPoint        pt            = new PointClass();

            pt.X = 0;
            pt.Y = 0;
            pGeoReference.Rotate(pt, -90);  //顺时针旋转90

            //水平旋转
            IRaster2     pRaster2  = pRasterLayer.Raster as IRaster2;
            IRasterProps pProps    = pRaster2 as IRasterProps;
            int          nWidth    = pProps.Width;
            int          nHeight   = pProps.Height;
            double       dbCenterY = (pProps.Extent.UpperLeft.Y + pProps.Extent.LowerRight.Y) / 2;
            double       dbDeltaX  = 0;
            double       dbDeltaY  = -dbCenterY * 2;

            pGeoReference.Flip();
            pGeoReference.Shift(dbDeltaX, dbDeltaY);

            //IRasterEdit pRasterEdit = pRaster2 as IRasterEdit;
            //System.Runtime.InteropServices.Marshal.ReleaseComObject(pRasterEdit);

            return(true);
        }
Exemplo n.º 5
0
        public void WarpLayer()
        {
            IGeoReference pGR = pRasterLayer as IGeoReference;

            if (pGR != null)
            {
                pGR.Reset();
                if (OriginPoints == null || TargetPoints == null || OriginPoints.PointCount < 1 || TargetPoints.PointCount < 1)
                {
                    return;
                }
                if (OriginPoints.PointCount == 1)
                {
                    IPoint pt1, pt2;
                    pt1 = OriginPoints.get_Point(0);
                    pt2 = TargetPoints.get_Point(0);
                    pGR.Shift(pt2.X - pt1.X, pt2.Y - pt1.Y);
                }
                else
                {
                    if (OriginPoints.PointCount == 2)
                    {
                        pGR.TwoPointsAdjust(OriginPoints, TargetPoints);
                    }
                    else
                    {
                        pGR.Warp(OriginPoints, TargetPoints, WarpType);
                    }
                    TransformedOriginPoints = pGR.PointsTransform(OriginPoints, true);

                    //RefreshWarpType();
                }
            }
        }
Exemplo n.º 6
0
        //private delegate void DoWork();

        public frmAdjustPoint(IGeoReference geoRef, IActiveView activeView, IMap map, string fileName)
        {
            InitializeComponent();
            m_geoRef     = geoRef;
            m_activeView = activeView;
            m_map        = map;
            m_fileName   = fileName;
        }
Exemplo n.º 7
0
 //private delegate void DoWork();
 public frmAdjustPoint(IGeoReference geoRef, IActiveView activeView,IMap map,string fileName)
 {
     InitializeComponent();
     m_geoRef = geoRef;
     m_activeView = activeView;
     m_map = map;
     m_fileName = fileName;
 }
Exemplo n.º 8
0
        /// <summary>
        /// Occurs when this command is clicked
        /// </summary>
        public override void OnClick()
        {
            // TODO: Add CmdRasterFlip.OnClick implementation
            IMapControl2 pMapCtr = (((IToolbarControl)m_hookHelper.Hook).Buddy) as IMapControl2;

            if (pMapCtr != null)
            {
                IGeoReference pGR = pRasterLayer as IGeoReference;
                pGR.Flip();
                pMapCtr.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewAll, null, null);
            }
        }
Exemplo n.º 9
0
        public override void OnMouseUp(int Button, int Shift, int X, int Y)
        {
            // TODO:  Add ToolRasterShift.OnMouseUp implementation
            pMoveEnvelopeFeedback.Stop();
            IMapControl2 pMapCtr = (((IToolbarControl)m_hookHelper.Hook).Buddy) as IMapControl2;

            if (pMapCtr != null)
            {
                IPoint        mapPoint = pMapCtr.ToMapPoint(X, Y);
                IGeoReference pGR      = pRasterLayer as IGeoReference;
                pGR.Shift(mapPoint.X - DownPoint.X, mapPoint.Y - DownPoint.Y);
                pMapCtr.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewAll, null, null);
            }
        }
Exemplo n.º 10
0
        /// <summary>
        /// Occurs when this command is clicked
        /// </summary>
        public override void OnClick()
        {
            IMapControl2 pMapCtr = (((IToolbarControl)m_hookHelper.Hook).Buddy) as IMapControl2;

            if (pMapCtr != null)
            {
                //IPoint mapPoint = pMapCtr.ToMapPoint(X, Y);
                m_frmRasterShift = new FrmRasterShift();
                //m_frmRasterShift.ShowDialog();
                if (m_frmRasterShift.ShowDialog() == DialogResult.OK)
                {
                    IGeoReference pGR = pRasterLayer as IGeoReference;
                    pGR.Shift(m_frmRasterShift.X, m_frmRasterShift.Y);
                    pMapCtr.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewAll, null, null);
                }
            }
        }
Exemplo n.º 11
0
        public void DeleteAllControlPoints()
        {
            IMapControl2 pMapCtr = (((IToolbarControl)m_hookHelper.Hook).Buddy) as IMapControl2;

            if (pMapCtr != null)
            {
                IGeoReference pGR = pRasterLayer as IGeoReference;
                if (pGR != null)
                {
                    pGR.Reset();
                    TransformedOriginPoints.RemovePoints(0, TransformedOriginPoints.PointCount);
                    OriginPoints.RemovePoints(0, OriginPoints.PointCount);
                    TargetPoints.RemovePoints(0, TargetPoints.PointCount);
                    m_FrmLinkTableRaster.RefreshControlAllPoints();
                    pMapCtr.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGeography, null, null);
                }
            }
        }
Exemplo n.º 12
0
        private void MainForm_Load(object sender, EventArgs e)
        {
            //get the MapControl
            m_mapControl = (IMapControl3)axMapControl1.Object;
            activeView   = m_mapControl.ActiveView;
            LayerMenu.SetHook(m_mapControl);
            LayerMenu.AddItem(new ZoomToLayer(), 0, 0, false, esriCommandStyles.esriCommandStyleIconAndText);

            //打开两张影像。
            if (BaseMap != null && TopMap != null)
            {
                topRasterLayer.CreateFromFilePath(TopMap);
                axMapControl1.AddLayer(topRasterLayer, 0);
                baseRasterLayer.CreateFromFilePath(BaseMap);
                axMapControl1.AddLayer(baseRasterLayer, 1);
                geoReference           = topRasterLayer as IGeoReference;
                this.Text              = "正在配准:" + System.IO.Path.GetFileName(TopMap) + " -> " + System.IO.Path.GetFileName(BaseMap);
                TransparencyLabel.Text = "顶层透明度:" + TransparencyTrackBar.Value.ToString() + "%";
            }
        }
Exemplo n.º 13
0
        //AE+C#修改栅格数据像素值
        //private void ChangeRasterValue(IRasterDataset2 pRasterDatset, double dbScale, double dbOffset)
        //{
        //    IRaster2 pRaster2 = pRasterDatset.CreateFullRaster() as IRaster2;

        //    IPnt pPntBlock = new PntClass();

        //    pPntBlock.X = 128;
        //    pPntBlock.Y = 128;

        //    IRasterCursor pRasterCursor = pRaster2.CreateCursorEx(pPntBlock);
        //    IRasterEdit pRasterEdit = pRaster2 as IRasterEdit;

        //    if (pRasterEdit.CanEdit())
        //    {
        //        IRasterBandCollection pBands = pRasterDatset as IRasterBandCollection;
        //        IPixelBlock3 pPixelblock3 = null;
        //        int pBlockwidth = 0;
        //        int pBlockheight = 0;
        //        System.Array pixels;
        //        IPnt pPnt = null;
        //        object pValue;
        //        long pBandCount = pBands.Count;

        //        //获取Nodata
        //        IRasterProps pRasterPro = pRaster2 as IRasterProps;
        //        object pNodata = pRasterPro.NoDataValue;
        //        //double dbNoData = Convert.ToDouble(((double[])pNodata)[0]);
        //        double dbNoData = getNoDataValue(pNodata);
        //        if (double.IsNaN(dbNoData))
        //            return;

        //        do
        //        {
        //            pPixelblock3 = pRasterCursor.PixelBlock as IPixelBlock3;
        //            pBlockwidth = pPixelblock3.Width;
        //            pBlockheight = pPixelblock3.Height;

        //            for (int k = 0; k < pBandCount; k++)
        //            {
        //                pixels = (System.Array)pPixelblock3.get_PixelData(k);
        //                for (int i = 0; i < pBlockwidth; i++)
        //                {
        //                    for (int j = 0; j < pBlockheight; j++)
        //                    {
        //                        pValue = pixels.GetValue(i, j);
        //                        double ob = Convert.ToDouble(pValue);
        //                        if (ob != dbNoData)
        //                        {
        //                            ob *= dbScale;  //翻转
        //                            ob += dbOffset; //Z方向偏移
        //                        }

        //                        //pixels.SetValue(ob, i, j);
        //                        IRasterProps pRP = pRaster2 as IRasterProps;
        //                        if (pRP.PixelType == rstPixelType.PT_CHAR)
        //                            pixels.SetValue(Convert.ToChar(ob), i, j);
        //                        else if (pRP.PixelType == rstPixelType.PT_UCHAR)
        //                            pixels.SetValue(Convert.ToByte(ob), i, j);
        //                        else if (pRP.PixelType == rstPixelType.PT_FLOAT)
        //                            pixels.SetValue(Convert.ToSingle(ob), i, j);
        //                        else if (pRP.PixelType == rstPixelType.PT_DOUBLE)
        //                            pixels.SetValue(Convert.ToDouble(ob), i, j);
        //                        else if (pRP.PixelType == rstPixelType.PT_ULONG)
        //                            pixels.SetValue(Convert.ToInt32(ob), i, j);
        //                        else
        //                            ;
        //                    }
        //                }
        //                pPixelblock3.set_PixelData(k, pixels);

        //                System.Array textPixel = null;
        //                textPixel = (System.Array)pPixelblock3.get_PixelData(k);
        //            }

        //            pPnt = pRasterCursor.TopLeft;
        //            pRasterEdit.Write(pPnt, (IPixelBlock)pPixelblock3);
        //        }
        //        while (pRasterCursor.Next());

        //        pRasterEdit.Refresh();
        //        System.Runtime.InteropServices.Marshal.ReleaseComObject(pRasterEdit);
        //    }
        //}

        private bool rasterTransfer(IRasterLayer pRasterLayer, string szFilename, double[] dbRotateMatrix, double[] dbOffsetMatrix)
        {
            if (pRasterLayer == null || dbRotateMatrix == null || dbOffsetMatrix == null || dbRotateMatrix.Length != 9 || dbOffsetMatrix.Length != 3)
            {
                return(false);
            }

            //IRasterLayer pResultLayer = new RasterLayerClass();
            //pResultLayer.CreateFromRaster(pRasterLayer.Raster);
            //pResult = new RasterLayer();
            //pResult.co

            IGeoReference pGeoReference = pRasterLayer as IGeoReference;

            //XY平面平移和旋转
            double dbScale = Math.Sqrt(dbRotateMatrix[0] * dbRotateMatrix[0] + dbRotateMatrix[1] * dbRotateMatrix[1]);
            double dbTheta = Math.Acos(dbRotateMatrix[0] / dbScale);

            IPoint pt = new PointClass();

            pt.X = 0; pt.Y = 0;
            pGeoReference.Rotate(pt, -dbTheta / Math.PI * 180);           //旋转
            pGeoReference.Shift(-dbOffsetMatrix[0], -dbOffsetMatrix[1]);  //平移
            //pGeoReference.Rotate(pt, dbTheta / Math.PI * 180);                                   //旋转
            pGeoReference.ReScale(1 / dbScale, 1 / dbScale);              //拉伸

            try
            {
                if (!File.Exists(szFilename))
                {
                    pGeoReference.Rectify(szFilename, "TIFF");

                    IRaster2    pRaster2    = pRasterLayer.Raster as IRaster2;
                    IRasterEdit pRasterEdit = pRaster2 as IRasterEdit;
                    System.Runtime.InteropServices.Marshal.ReleaseComObject(pRasterEdit);
                }
                //MessageBox.Show("转换完成!");
            }
            catch (System.Exception ex)
            {
                //MessageBox.Show("转换出错!");
                return(false);
            }
            finally
            {
                pGeoReference.Reset();
            }


            //Open a raster file workspace.
            IWorkspaceFactory workspaceFactory = new RasterWorkspaceFactoryClass();
            IRasterWorkspace  rasterWorkspace  = (IRasterWorkspace)
                                                 workspaceFactory.OpenFromFile(System.IO.Path.GetDirectoryName(szFilename), 0);

            //Open a file raster dataset.
            IRasterDataset  rasterDataset  = rasterWorkspace.OpenRasterDataset(System.IO.Path.GetFileName(szFilename));
            IRasterDataset2 rasterDataset2 = rasterDataset as IRasterDataset2;

            ClsRasterOp pRasterOp = new ClsRasterOp();

            pRasterOp.ChangeRasterValue(rasterDataset2, dbRotateMatrix[8], dbOffsetMatrix[2]);

            ////Z方向变化

            //System.Array pixels, dstPixels;
            //IPixelBlock3 pixelBlock3 = null;
            //IRaster2 pRaster2 = rasterDataset.Raster as IRaster2;
            //IRaster pRaster = pDstLayer.Raster;
            //IRasterEdit pEdit = pRaster as IRasterEdit;
            //IRasterCursor rasterCursor = pRaster2.CreateCursorEx(null);//null时为128*128

            //do
            //{
            //    IPnt nSize = new PntClass();
            //    nSize.X = rasterCursor.PixelBlock.Width;
            //    nSize.Y = rasterCursor.PixelBlock.Height;
            //    pixelblock4 = rasterCursor.PixelBlock as IPixelBlock3;
            //    pixelBlock3 = pRaster.CreatePixelBlock(nSize) as IPixelBlock3;

            //    int nWidth = pixelBlock3.Width;
            //    int nHeight = pixelBlock3.Height;
            //    pixels = (System.Array)pixelBlock3.get_PixelData(0);
            //    dstPixels = (System.Array)pixelblock4.get_PixelData(0);
            //    for (int i = 0; i < nWidth; i++)
            //    {
            //        for (int j = 0; j < nHeight; j++)
            //        {
            //            object obj = pixels.GetValue(i, j);
            //            double ob = Convert.ToDouble(obj);

            //            ob *= dbRotateMatrix[8];  //翻转
            //            ob += dbOffsetMatrix[2]; //Z方向偏移

            //            dstPixels.SetValue(ob, i, j);
            //        }
            //    }

            //    //写回数据
            //    pEdit.Write(rasterCursor.TopLeft, pixelblock4 as IPixelBlock);
            //} while (rasterCursor.Next() == true);

            return(true);
        }
Exemplo n.º 14
0
        public override void OnMouseDown(int Button, int Shift, int X, int Y)
        {
            // TODO:  Add ToolAddControlPoints.OnMouseDown implementation
            object       Miss    = Type.Missing;
            IMapControl2 pMapCtr = (((IToolbarControl)m_hookHelper.Hook).Buddy) as IMapControl2;

            if (pMapCtr != null)
            {
                IGeoReference pGR      = pRasterLayer as IGeoReference;
                IPoint        mapPoint = pMapCtr.ToMapPoint(X, Y);
                m_NewLineFeedback.Display = pMapCtr.ActiveView.ScreenDisplay;
                if (FirstPoint == true)//起始点
                {
                    IPointCollection pPCFrom;
                    IPointCollection pPCTo = new MultipointClass();
                    pPCTo.AddPoint(mapPoint, ref Miss, ref Miss);
                    pPCFrom = pGR.PointsTransform(pPCTo, false);
                    //for (int i = 0; i < OriginPoints.PointCount; i++)
                    //{
                    //    pPCFrom.AddPoint(OriginPoints.get_Point(i));
                    //}
                    //pPCFrom.AddPoint(mapPoint);

                    m_NewLineFeedback.Start(mapPoint);
                    // OriginPoints.AddPoint(mapPoint);
                    IPoint pt = pPCFrom.get_Point(0);
                    OriginPoints.AddPoint(pt);
                    FirstPoint = false;
                }
                else//目标点
                {
                    TargetPoints.AddPoint(mapPoint);
                    FirstPoint = true;
                    m_NewLineFeedback.Stop();
                    // IPointCollection pPC = pGR.PointsTransform(TargetPoints, false);
                    //IPointCollection pPC = OriginPoints;
                    //IPoint pt1, pt2;
                    //pt1 = pPC.get_Point(0);
                    //pt2 = TargetPoints.get_Point(0);
                    //if (pPC.PointCount == 1)
                    //{
                    //    //IPoint pt1,pt2;
                    //    //pt1 = pPC.get_Point(0);
                    //    //pt2 = TargetPoints.get_Point(0);
                    //    pGR.Shift(pt2.X - pt1.X, pt2.Y - pt1.Y);

                    //}
                    //else
                    //if (pPC.PointCount ==2 )
                    //{
                    //    pGR.TwoPointsAdjust(pPC, TargetPoints);
                    //}
                    //else
                    //{
                    //    pGR.Warp(pPC, TargetPoints, m_FrmLinkTableRaster.WarpType);
                    //}
                    //m_FrmLinkTableRaster.AddControlPoints(OriginPoints.get_Point(OriginPoints.PointCount -1)
                    //    ,TargetPoints.get_Point(TargetPoints.PointCount -1));
                    m_FrmLinkTableRaster.pRasterLayer = pRasterLayer;
                    m_FrmLinkTableRaster.pMapCtr      = pMapCtr;
                    m_FrmLinkTableRaster.RefreshControlAllPoints();
                }

                TransformedOriginPoints = pGR.PointsTransform(OriginPoints, true);

                // pMapCtr.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGeography, null, null);
            }
        }
Exemplo n.º 15
0
        private void buttonXSaveRaster_Click(object sender, EventArgs e)
        {
            SaveFileDialog dlg = new SaveFileDialog();

            dlg.Filter          = "(*.tif)|*.tif";
            dlg.OverwritePrompt = false;
            if (dlg.ShowDialog() == DialogResult.OK)
            {
                IGeoReference pGR = pRasterLayer as IGeoReference;
                if (pGR != null)
                {
                    try
                    {
                        pGR.Rectify(dlg.FileName, "TIFF");
                        MessageBox.Show("\"" + dlg.FileName + "\"保存成功!");
                    }
                    catch (SystemException ee)
                    {
                        MessageBox.Show(ee.Message);
                    }
                }
            }

            /*
             * if (pRasterLayer == null)
             * {
             *  return;
             * }
             * FrmSaveRasterTransformation dlg = new FrmSaveRasterTransformation();
             *
             * double dxcellsize = ((IRasterProps)pRasterLayer.Raster).MeanCellSize().X;
             * dlg.SetCellSize(dxcellsize);
             * double y = ((IRasterProps)pRasterLayer.Raster).MeanCellSize().Y;
             * dlg.SetCellSize(((IRasterProps)pRasterLayer.Raster).Extent.Height / ((IRasterProps)pRasterLayer.Raster).Height);
             * if (dlg.ShowDialog() == DialogResult.OK)
             * {
             *
             *  try
             *  {
             *      //IGeoReference pGR = pRasterLayer as IGeoReference;
             *      //if (pGR != null)
             *      //{
             *      //    pGR.Rectify(dlg.FileName, "TIFF");
             *      //}
             *     ITransformationOp TO = new RasterTransformationOpClass();
             *      ESRI.ArcGIS.Geodatabase.IGeoDataset ds= TO.Warp(pRasterLayer.Raster as ESRI.ArcGIS.Geodatabase.IGeoDataset,
             *          OriginPoints, TargetPoints,
             *          (ESRI.ArcGIS.DataSourcesRaster.esriGeoTransTypeEnum)(WarpType + 1),
             *          (esriGeoAnalysisResampleEnum)dlg.InterationType);
             *      ClsGDBDataCommon cgc = new ClsGDBDataCommon();
             *      DirectoryInfo di = new DirectoryInfo(dlg.savefilepath);
             *      string strName = di.Name;
             *      string parentpath = di.Parent.FullName;
             *      IWorkspaceFactory workspaceFactory = new RasterWorkspaceFactoryClass ();
             *      ESRI.ArcGIS.esriSystem.IPropertySet propertySet = new ESRI.ArcGIS.esriSystem.PropertySetClass();
             *      propertySet.SetProperty("DATABASE", parentpath);
             *      IWorkspace inmemWor = workspaceFactory.OpenFromFile(parentpath, 0);
             *
             *      IRasterLayer player = new RasterLayerClass();
             *      player.CreateFromDataset(ds as IRasterDataset);
             *      pMapCtr.Map.AddLayer(player as ILayer);
             *      pMapCtr.Refresh();
             *
             *      //ISaveAs2 sa = ds as ISaveAs2;
             *      ISaveAs2 sa = (ds) as ISaveAs2;
             *      if (sa != null)
             *      {
             *         sa.SaveAs(strName,   inmemWor, "TIFF");
             *         ((IRasterDataset3)ds).Refresh();
             *      }
             *
             *      MessageBox.Show("保存\"" + dlg.savefilepath + "\"成功!");
             *  }
             *  catch (SystemException ee)
             *  {
             *      MessageBox.Show(ee.Message);
             *  }
             * }
             */
        }