コード例 #1
0
        virtual public bool OnCommand(string MenuId)
        {
            if (MenuId.StartsWith("FromModelView_"))
            {
                string name = MenuId.Substring("FromModelView_".Length);
                for (int i = 0; i < project.ModelViewCount; i++)
                {
                    if (project.GetProjectedModel(i).Name == name)
                    {
                        Projection = project.GetProjectedModel(i).Projection.Clone();
                        projectionDirection.SetGeoVector(Projection.Direction);
                        propertyTreeView.SelectEntry(projectionDirection);
                        projectionDirection.Refresh();
                        Projection = project.GetProjectedModel(i).Projection.Clone();
                        // und noch zentrieren (von unten kopiert)
                        double       f  = 1.0;
                        BoundingRect br = model.GetExtent(Projection);
                        f = Math.Min(section.Width / br.Width, section.Height / br.Height) * 0.9;
                        layout.CenterPatch(this, f, Layout.HorizontalCenter.center, Layout.VerticalCenter.center);
                        layoutView.Repaint();
                        scalingProperty.Refresh();

                        return(true);
                    }
                }
            }
            switch (MenuId)
            {
            case "MenuId.Layout.Scale.1To1":
                Scale(1.0);
                return(true);

            case "MenuId.Layout.Scale.1To5":
                Scale(1.0 / 5.0);
                return(true);

            case "MenuId.Layout.Scale.1To10":
                Scale(1.0 / 10.0);
                return(true);

            case "MenuId.Layout.Scale.1To50":
                Scale(1.0 / 50.0);
                return(true);

            case "MenuId.Layout.Scale.1To100":
                Scale(1.0 / 100.0);
                return(true);

            case "MenuId.Layout.Scale.1To1000":
                Scale(1.0 / 1000.0);
                return(true);

            case "MenuId.Layout.Scale.10To1":
                Scale(10.0);
                return(true);

            case "MenuId.Layout.Scale.100To1":
                Scale(100.0);
                return(true);

            case "MenuId.Layout.Scale.Fit":
            {
                double       f  = 1.0;
                BoundingRect br = model.GetExtent(Projection);
                f = Math.Min(section.Width / br.Width, section.Height / br.Height);
                layout.CenterPatch(this, f, Layout.HorizontalCenter.center, Layout.VerticalCenter.center);
                layoutView.Repaint();
                scalingProperty.Refresh();
            }
                return(true);

            case "MenuId.Layout.Horizontal.Left":
                Center(Layout.HorizontalCenter.left, Layout.VerticalCenter.unchanged);
                return(true);

            case "MenuId.Layout.Horizontal.Center":
                Center(Layout.HorizontalCenter.center, Layout.VerticalCenter.unchanged);
                return(true);

            case "MenuId.Layout.Horizontal.Right":
                Center(Layout.HorizontalCenter.right, Layout.VerticalCenter.unchanged);
                return(true);

            case "MenuId.Layout.Vertical.Bottom":
                Center(Layout.HorizontalCenter.unchanged, Layout.VerticalCenter.bottom);
                return(true);

            case "MenuId.Layout.Vertical.Center":
                Center(Layout.HorizontalCenter.unchanged, Layout.VerticalCenter.center);
                return(true);

            case "MenuId.Layout.Vertical.Top":
                Center(Layout.HorizontalCenter.unchanged, Layout.VerticalCenter.top);
                return(true);

            case "MenuId.LayoutPatch.Rename":
                propertyTreeView.StartEditLabel(this);
                return(true);

            case "MenuId.LayoutPatch.Remove":
                layout.RemovePatch(this);
                layoutView.Refresh();
                return(true);

            case "MenuId.LayoutPatch.FillLayout":
                section.Left   = 0;
                section.Right  = layout.PaperWidth;
                section.Bottom = 0;
                section.Top    = layout.PaperHeight;
                SetSection();
                return(true);

            case "MenuId.LayoutPatch.Center":
                Center(Layout.HorizontalCenter.center, Layout.VerticalCenter.center);
                return(true);
            }
            return(false);
        }