private void ConfigureOutputRestrictions(GraphControl graphControl, OrganicLayout layout)
        {
            var    viewInfoIsAvailable = false;
            var    visibleRect = GetVisibleRectangle(graphControl);
            double x = 0, y = 0, w = 0, h = 0;

            if (visibleRect != null)
            {
                viewInfoIsAvailable = true;
                x = visibleRect[0];
                y = visibleRect[1];
                w = visibleRect[2];
                h = visibleRect[3];
            }
            switch (RestrictOutputItem)
            {
            case EnumOutputRestrictions.None:
                layout.ComponentLayoutEnabled = true;
                layout.OutputRestriction      = OutputRestriction.None;
                break;

            case EnumOutputRestrictions.OutputCage:
                if (!viewInfoIsAvailable || !RectCageUseViewItem)
                {
                    x = CageXItem;
                    y = CageYItem;
                    w = CageWidthItem;
                    h = CageHeightItem;
                }
                layout.OutputRestriction      = OutputRestriction.CreateRectangularCageRestriction(x, y, w, h);
                layout.ComponentLayoutEnabled = false;
                break;

            case EnumOutputRestrictions.OutputAr:
                double ratio;
                if (viewInfoIsAvailable && ArCageUseViewItem)
                {
                    ratio = w / h;
                }
                else
                {
                    ratio = CageRatioItem;
                }
                layout.OutputRestriction      = OutputRestriction.CreateAspectRatioRestriction(ratio);
                layout.ComponentLayoutEnabled = true;
                ((ComponentLayout)layout.ComponentLayout).PreferredSize = new YDimension(ratio * 100, 100);
                break;

            case EnumOutputRestrictions.OutputEllipticalCage:
                if (!viewInfoIsAvailable || !RectCageUseViewItem)
                {
                    x = CageXItem;
                    y = CageYItem;
                    w = CageWidthItem;
                    h = CageHeightItem;
                }
                layout.OutputRestriction      = OutputRestriction.CreateEllipticalCageRestriction(x, y, w, h);
                layout.ComponentLayoutEnabled = false;
                break;
            }
        }
        private void ConfigureOutputRestrictions()
        {
            bool viewInfoIsAvailable = false;

            double[] visibleRect = GetVisibleRectangle();
            double   x = 0, y = 0, w = 0, h = 0;

            if (visibleRect != null)
            {
                viewInfoIsAvailable = true;
                x = visibleRect[0];
                y = visibleRect[1];
                w = visibleRect[2];
                h = visibleRect[3];
            }
            OptionGroup restrictionGroup = Handler.GetGroupByName(RESTRICTIONS);
            string      restrictionType  = (string)restrictionGroup[RESTRICT_OUTPUT].Value;
            OptionGroup currentGroup     = null;

            if (restrictionType != NONE)
            {
                if (restrictionType.Equals(OUTPUT_CAGE) || restrictionType.Equals(OUTPUT_ELLIPTICAL_CAGE))
                {
                    currentGroup = (OptionGroup)restrictionGroup.GetGroupByName(BOUNDS);
                }
                else
                {
                    currentGroup = (OptionGroup)restrictionGroup.GetGroupByName(restrictionType);
                }
            }
            switch (restrictionType)
            {
            case NONE: {
                organic.ComponentLayoutEnabled = true;
                organic.OutputRestriction      = OutputRestriction.None;
                break;
            }

            case OUTPUT_CAGE: {
                if (!viewInfoIsAvailable || !(bool)currentGroup[RECT_CAGE_USE_VIEW].Value)
                {
                    x = (double)currentGroup[CAGE_X].Value;
                    y = (double)currentGroup[CAGE_Y].Value;
                    w = (double)currentGroup[CAGE_WIDTH].Value;
                    h = (double)currentGroup[CAGE_HEIGHT].Value;
                }
                organic.OutputRestriction =
                    OutputRestriction.CreateRectangularCageRestriction(x, y, w, h);
                organic.ComponentLayoutEnabled = false;
                break;
            }

            case OUTPUT_AR: {
                double ratio;
                if ((bool)currentGroup[AR_CAGE_USE_VIEW].Value && viewInfoIsAvailable)
                {
                    ratio = w / h;
                }
                else
                {
                    ratio = (double)currentGroup[CAGE_RATIO].Value;
                }
                organic.OutputRestriction      = OutputRestriction.CreateAspectRatioRestriction(ratio);
                organic.ComponentLayoutEnabled = true;
                ((ComponentLayout)organic.ComponentLayout).PreferredSize = new YDimension(ratio * 100, 100);
                break;
            }

            case OUTPUT_ELLIPTICAL_CAGE: {
                if (!viewInfoIsAvailable || !((bool)currentGroup[RECT_CAGE_USE_VIEW].Value))
                {
                    x = (double)currentGroup[CAGE_X].Value;
                    y = (double)currentGroup[CAGE_Y].Value;
                    w = (double)currentGroup[CAGE_WIDTH].Value;
                    h = (double)currentGroup[CAGE_HEIGHT].Value;
                }
                organic.OutputRestriction =
                    OutputRestriction.CreateEllipticalCageRestriction(x, y, w, h);
                organic.ComponentLayoutEnabled = false;
                break;
            }
            }
        }