Exemplo n.º 1
0
        public void SetCoordinate(IFeature feature, int coordinateIndex, ICoordinate coordinate)
        {
            IGeometry geometry = feature.Geometry;
            Collection <IGeometry> trackers      = new Collection <IGeometry>();
            List <int>             handleIndices = new List <int>();

            for (int i = 0; i < geometry.Coordinates.Length; i++)
            {
                trackers.Add(GeometryFactory.CreatePoint((ICoordinate)geometry.Coordinates[i].Clone()));
            }
            handleIndices.Add(coordinateIndex);

            IFeatureProvider provider = GetFeatureProviderByFeature(feature);
            int geometryIndex         = provider.IndexOf(feature);

            if (geometryIndex == -1)
            {
                log.DebugFormat("Can't find layer for geometry (via feature): {0}", geometry);
                return;
            }

            IGeometry updatedGeometry = (IGeometry)geometry.Clone();

            double deltaX = coordinate.X - geometry.Coordinates[coordinateIndex].X;
            double deltaY = coordinate.Y - geometry.Coordinates[coordinateIndex].Y;

            fallOffPolicy.Reset();
            fallOffPolicy.Move(updatedGeometry, trackers, handleIndices, coordinateIndex, deltaX, deltaY);
            fallOffPolicy.Reset();

            ((IFeature)provider.Features[geometryIndex]).Geometry = updatedGeometry;
        }