码迷,mamicode.com
首页 > 其他好文 > 详细

IRasterGeometryProc,一个可以控制raster对象的接口

时间:2018-11-22 11:48:48      阅读:201      评论:0      收藏:0      [点我收藏+]

标签:call   href   The   ace   ber   rpo   nts   cto   ima   

栅格影像加载到MapControl中以后,如果想更改影像的旋转、扭曲等形状,接口IRasterGeometryProc是个不错的选择。

Remarks

The RasterGeometryProc manipulates only Raster objects, not RasterBand or RasterDataset object. This is because the Raster is transient, as are the effects of the RasterGeometryProc. This means that any transformation will also go away when the Raster object goes out of scope.

To keep the transformed data for later use, you must persist the transformation using Register or Rectify. If used on a Raster contained within a RasterLayer, processing performed by this object will be visible when the display is refreshed.

Although Merge and Mosaic take Raster object as an input, any changes to the Raster object before calling the two methods will be ignored.

 

该接口只能操作Raster对象,所以针对已经加载的RasterLayer对象,可以通过Rasterlayer.Raster获取到Raster对象,然后做相应的操作。比如如下代码,使用Warp方法修改形状

IWorkspaceFactory pWSF = new RasterWorkspaceFactoryClass();
IWorkspace pWS = pWSF.OpenFromFile(workSpace, 0);

IRasterWorkspace pRWS = pWS as IRasterWorkspace;
IRasterDataset pRasterDataset = pRWS.OpenRasterDataset(file.Name);
IRasterLayer pRasterLayer = new RasterLayerClass();
pRasterLayer.CreateFromDataset(pRasterDataset);

IEnvelope envelope = pRasterLayer.AreaOfInterest;
IPointCollection originPC = new PolygonClass();
originPC.AddPoint(envelope.LowerLeft);
originPC.AddPoint(envelope.UpperLeft);
originPC.AddPoint(envelope.UpperRight);
originPC.AddPoint(envelope.LowerRight);

IPointCollection targetPointCollect = new PolygonClass();
List<CPoint> targetPointList = ImageProcessHandler.GenerateFourCoordinateList(centerPoint, entity.ImageProcessConfig.CamaraParameter, true);

IRaster raster = pRasterLayer.Raster;
IRasterGeometryProc rasterGeometryProc = new RasterGeometryProcClass();
rasterGeometryProc.Warp(originPC, targetPointCollect, esriGeoTransTypeEnum.esriGeoTransSpline, raster);

axMapControl.AddLayer(pRasterLayer);
axMapControl.Refresh();

 

 

Members

 Description
技术分享图片 Clip Clips the input raster based on the specified envelope.
技术分享图片 Flip Flips the input raster.
技术分享图片 IsPixelToMapTransSimple Indicates if the transformation of pixel to map is simple.
技术分享图片 LeastSquareFit Computes a least squares fit for the input control points.
技术分享图片 Merge Merges the input rasters into a single dataset.
技术分享图片 Mirror Mirrors the input raster.
技术分享图片 Mosaic Mosaics the input rasters into a single dataset.
技术分享图片 PointsTransform Transforms a set of points based upon the transformation being applied to the input raster.
技术分享图片 ProjectFast Projects the input raster using a single polynomial fit to compute the adjustment between coordinate systems.
技术分享图片 Rectify Persists the input raster to a new dataset of the specified format.
技术分享图片 Register Outputs the current transformation properties to the dataset header or auxilliary file.
技术分享图片 Resample Resamples the input raster to a new cellsize.
技术分享图片 ReScale Scales the input raster by the specified x and y scale factors.
技术分享图片 Reset Resets the input raster to its native coordinate space.
技术分享图片 Rotate Rotates the input raster around the specified pivot by an angle specified in degrees.
技术分享图片 Shift Shifts the input raster by deltaX and deltaY map units.
技术分享图片 TwoPointsAdjust Performs a Hermite transformation on the input raster based upon the 2 input control point pairs.
技术分享图片 Warp Warps the input raster based upon the input control points using the transformation type specified.

IRasterGeometryProc,一个可以控制raster对象的接口

标签:call   href   The   ace   ber   rpo   nts   cto   ima   

原文地址:https://www.cnblogs.com/yingrufeng/p/9999715.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!