//这个版本虽然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); }
/// <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); } }