Not work on the Geodatabase featureclass, OK for ShapeFile featureclass

482
0
09-17-2012 09:39 PM
XiaodongZHAO
New Contributor
The following code is to change the size of feaures. It works on the Shapefile, but not work on the featureclass of File Geodatabase. There is no error in the code. Nothing will happen for the featureclass of Geodatabase.
IFeatureCursor pFCursor = pFeatureclass.Update(null, false);
            IFeature pFeature = pFCursor.NextFeature();
            while (pFeature != null)
            {
                IGeometryCollection pPolColl = pFeature.Shape as IGeometryCollection;
                //??uv??????????
                ISegmentCollection pPathColl = pPolColl.get_Geometry(0) as ISegmentCollection;
                ISegment pSegment = pPathColl.get_Segment(0);
                //???uv???????????????????????????????????
                ILine pLine = pSegment as ILine;
                IPoint pPointOrigin = new PointClass();
                pPointOrigin.PutCoords(pLine.FromPoint.X, pLine.FromPoint.Y);
                //???uv??????????????????
                Double dblOldX, dblOldY;
                dblOldX = pLine.ToPoint.X;
                dblOldY = pLine.ToPoint.Y;
                ITransform2D pTransform2D = pLine as ITransform2D;
                //uv????????????????????????
                //double dblScale = Convert.ToDouble(this.numUpDownScale.Value);
                pTransform2D.Scale(pPointOrigin, dblScale, dblScale);
                //???uv?????????????????
                Double dblNewX, dblNewY;
                dblNewX = pLine.ToPoint.X;
                dblNewY = pLine.ToPoint.Y;
                //?????????????????????????
                for (int i = 1; i < 3; i++)
                {
                    pPathColl = pPolColl.get_Geometry(i) as ISegmentCollection;
                    pSegment = pPathColl.get_Segment(0);
                    pLine = pSegment as ILine;
                    //???????????
                    pPointOrigin.PutCoords(pLine.FromPoint.X, pLine.FromPoint.Y);
                    pTransform2D = pLine as ITransform2D;
                    //????
                    pTransform2D.Scale(pPointOrigin, dblScale, dblScale);
                    //?????????????????
                    pTransform2D.Move(dblNewX - dblOldX, dblNewY - dblOldY);
                }
                pPolColl.GeometriesChanged();
                //??????
                pFCursor.UpdateFeature(pFeature);
                pFeature = pFCursor.NextFeature();
            }
            pFCursor.Flush();
0 Kudos
0 Replies