Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private void CreateTransformedFeatures(IFeatureClass sourceClass, IQueryFilter sourceQF,
- IFeatureClass targetClass, IAffineTransformation2D3GEN affineTransformation)
- {
- IGeoDataset targetGDS = (IGeoDataset)targetClass;
- IFeatureCursor sourceCur = sourceClass.Search(sourceQF, true);
- IFeature sourceFea = sourceCur.NextFeature();
- while (sourceFea != null)
- {
- // Create the new feature
- IFeature targetFea = targetClass.CreateFeature();
- // Get the source geometry and project to the target spatial reference
- IPolyline sourcePolyline = (IPolyline)sourceFea.ShapeCopy;
- sourcePolyline.Project(targetGDS.SpatialReference);
- // Create a transformed geometry
- IPolyline sourcePolyline = (IPolyline)sourceFea.ShapeCopy;
- ITransform2D transform2D = (ITransform2D)sourcePolyline;
- transform2D.Transform(esriTransformDirection.esriTransformForward,
- (ITransformation)affineTransformation);
- // Assign the transformed geometry
- targetFea.Shape = sourcePolyline;
- // Assign other attributes
- // ...
- targetFea.Store();
- sourceFea = sourceCur.NextFeature();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement