示例#1
0
        internal static void Approximate(IFrame frame, IGeoObject toApproximate)
        {   // die Approximation gemäß globaler Einstellung aus einem ShowProperty heraus,
            // also mit SelectObjectsAction als aktiver Aktion
            ICurve app = (toApproximate as ICurve).Approximate(frame.GetIntSetting("Approximate.Mode", 0) == 0, frame.GetDoubleSetting("Approximate.Precision", 0.01));

            Actions.SelectObjectsAction soa   = frame.ActiveAction as Actions.SelectObjectsAction;
            IGeoObjectOwner             addTo = toApproximate.Owner;

            if (addTo == null)
            {
                addTo = frame.ActiveView.Model;
            }
            using (frame.Project.Undo.UndoFrame)
            {
                addTo.Remove(toApproximate);
                IGeoObject go = app as IGeoObject;
                go.CopyAttributes(toApproximate);
                addTo.Add(go);
                soa.SetSelectedObjects(new GeoObjectList(go));
            }
        }