Ejemplo n.º 1
0
        ///<inheritdoc/>
        protected override void SetupHandler()
        {
            BalloonLayout balloonLayout = new BalloonLayout();

            OptionGroup generalGroup = Handler.AddGroup(GENERAL);

            generalGroup.AddList(ROOT_NODE_POLICY, enumRoot.Keys, DIRECTED_ROOT);
            IOptionItem       allowNonTreeItem = generalGroup.AddBool(ALLOW_NON_TREE_EDGES, true);
            IOptionItem       nonTreeStyleItem = generalGroup.AddList(ROUTING_STYLE_FOR_NON_TREE_EDGES, enumRoute, ROUTE_ORTHOGONAL);
            ConstraintManager cm = new ConstraintManager(Handler);

            cm.SetEnabledOnValueEquals(allowNonTreeItem, true, nonTreeStyleItem);
            IOptionItem ebs = generalGroup.AddDouble(EDGE_BUNDLING_STRENGTH, 0.99, 0, 1);

            cm.SetEnabledOnValueEquals(nonTreeStyleItem, ROUTE_BUNDLED, ebs);
            generalGroup.AddBool(ACT_ON_SELECTION_ONLY, false);
            generalGroup.AddInt(PREFERRED_CHILD_WEDGE, balloonLayout.PreferredChildWedge, 1, 359);
            generalGroup.AddInt(PREFERRED_ROOT_WEDGE, balloonLayout.PreferredRootWedge, 1, 360);
            generalGroup.AddInt(MINIMAL_EDGE_LENGTH, balloonLayout.MinimumEdgeLength, 10, int.MaxValue);
            generalGroup.AddDouble(COMPACTNESS_FACTOR, balloonLayout.CompactnessFactor, 0.1, 0.9);
            generalGroup.AddBool(ALLOW_OVERLAPS, balloonLayout.AllowOverlaps);
            generalGroup.AddBool(BALLOON_FROM_SKETCH, balloonLayout.FromSketchMode);
            generalGroup.AddBool(PLACE_CHILDREN_INTERLEAVED, balloonLayout.InterleavedMode == InterleavedMode.AllNodes);
            generalGroup.AddBool(STRAIGHTEN_CHAINS, balloonLayout.ChainStraighteningMode);

            OptionGroup labelingGroup = Handler.AddGroup(LABELING);

            labelingGroup.AddBool(INTEGRATED_EDGE_LABELING, true);
            labelingGroup.AddList(NODE_LABELING_STYLE, nodeLabelingPolicies, nodeLabelingPolicies[3]);
        }
        ///<inheritdoc/>
        protected override void SetupHandler()
        {
            createOrganic();
            OptionGroup visualGroup = Handler.AddGroup(VISUAL);

            visualGroup.AddList(SCOPE, scopeEnum.Keys, ALL);
            visualGroup.AddList(INITIAL_PLACEMENT, initialPlacementEnum.Keys, AS_IS);
            visualGroup.AddDouble(PREFERRED_EDGE_LENGTH, organic.PreferredEdgeLength, 0.0, double.MaxValue);
            visualGroup.AddBool(OBEY_NODE_SIZES, organic.ConsiderNodeSizes);
            visualGroup.AddInt(ATTRACTION, organic.Attraction, 0, 2);
            visualGroup.AddInt(REPULSION, organic.Repulsion, 0, 2);
            visualGroup.AddDouble(GRAVITY_FACTOR, organic.GravityFactor, -0.2, 2);
            visualGroup.AddBool(ACTIVATE_TREE_BEAUTIFIER, organic.ActivateTreeBeautifier);

            OptionGroup algoGroup = Handler.AddGroup(ALGORITHM);

            algoGroup.AddDouble(ITERATION_FACTOR, organic.IterationFactor);
            algoGroup.AddInt(MAXIMAL_DURATION, (int)(organic.MaximumDuration / 1000));
            algoGroup.AddBool(ACTIVATE_DETERMINISTIC_MODE, organic.Deterministic);
            algoGroup.AddBool(ACTIVATE_MULTI_THREADING, organic.MultiThreadingAllowed);

            OptionGroup groupingGroup = Handler.AddGroup(GROUPING);

            groupingGroup.AddList(GROUP_LAYOUT_POLICY, groupPolicyEnum.Keys, LAYOUT_GROUPS);
            groupingGroup.AddDouble(GROUP_NODE_COMPACTNESS, organic.GroupNodeCompactness, 0, 1);
        }
Ejemplo n.º 3
0
        ///<inheritdoc/>
        protected override void SetupHandler()
        {
            createRouter();
            OptionGroup layoutGroup = Handler.AddGroup(GROUP_LAYOUT);

            ConstraintManager cm = new ConstraintManager(Handler);

            //Layout options
            layoutGroup.AddList(SCOPE, new[] { ALL, SUBSET_BUS, SUBSET, PARTIAL }, ALL);
            layoutGroup.AddList(BUSES, new[] { SINGLE, LABEL, TAG, CUSTOM }, SINGLE);
            IOptionItem gridEnabledItem = layoutGroup.AddBool(GRID_ENABLED, router.GridRouting);
            IOptionItem gridSpacingItem = layoutGroup.AddInt(GRID_SPACING, router.GridSpacing, 1, int.MaxValue);

            layoutGroup.AddInt(MIN_DISTANCE_TO_NODES, router.MinimumDistanceToNode, 1, int.MaxValue);
            layoutGroup.AddInt(MIN_DISTANCE_TO_EDGES, router.MinimumDistanceToEdge, 1, int.MaxValue);
            cm.SetEnabledOnValueEquals(gridEnabledItem, true, gridSpacingItem);

            //Selection options
            OptionGroup selectionGroup = Handler.AddGroup(GROUP_SELECTION);

            selectionGroup.AddInt(PREFERRED_BACKBONE_COUNT, router.PreferredBackboneSegmentCount, 1, int.MaxValue);
            selectionGroup.AddDouble(MINIMUM_BACKBONE_LENGTH, router.MinimumBackboneSegmentLength, 1, double.MaxValue);

            //Routing options
            OptionGroup routingGroup = Handler.AddGroup(GROUP_ROUTING);

            routingGroup.AddDouble(CROSSING_COST, router.CrossingCost, 0, double.MaxValue);
            routingGroup.AddBool(CROSSING_REROUTING, router.Rerouting);
            routingGroup.AddInt(MINIMUM_CONNECTIONS_COUNT, router.MinimumBusConnectionsCount, 0, int.MaxValue);
        }
        protected override void SetupHandler()
        {
            CreateLayout();

            OptionGroup generalGroup = Handler.AddGroup(GENERAL);

            generalGroup.AddList(CENTER_STRATEGY, centerNodeStrategies.Keys, CENTER_WEIGHTED_CENTRAL);
            generalGroup.AddList(LAYERING_STRATEGY, layeringStrategies.Keys, LAYERING_BFS);
            generalGroup.AddDouble(MINIMAL_LAYER_DISTANCE, (int)layout.MinimumLayerDistance, 1, 1000);
            generalGroup.AddDouble(MINIMAL_NODE_DISTANCE, (int)layout.MinimumNodeToNodeDistance, 0, 300);
            generalGroup.AddDouble(MAXIMAL_CHILD_SECTOR_SIZE, (int)layout.MaximumChildSectorAngle, 15, 360);

            OptionItem routingStrategyItem = generalGroup.AddList(EDGE_ROUTING_STRATEGY, edgeRoutingStrategies, EDGE_ARC);

            int smoothness =
                (int)
                Math.Min(MAXIMUM_SMOOTHNESS,
                         (1 + MAXIMUM_SMOOTHNESS * SMOOTHNESS_ANGLE_FACTOR - layout.MinimumBendAngle) / SMOOTHNESS_ANGLE_FACTOR);
            IOptionItem       smoothnessItem = generalGroup.AddInt(EDGE_SMOOTHNESS, smoothness, MINIMUM_SMOOTHNESS, MAXIMUM_SMOOTHNESS);
            ConstraintManager cm             = new ConstraintManager(Handler);

            cm.SetEnabledOnValueEquals(routingStrategyItem, EDGE_ARC, smoothnessItem);
            var bundlingStrength = generalGroup.AddDouble(EDGE_BUNDLING_STRENGTH, 0.99, 0, 1);

            cm.SetEnabledOnValueEquals(routingStrategyItem, EDGE_BUNDLES, bundlingStrength);
            generalGroup.AddBool(CONSIDER_NODE_LABELS, layout.ConsiderNodeLabels);
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Initializes the option handler for the export
        /// </summary>
        private void SetupHandler()
        {
            handler = new OptionHandler(IMAGE_EXPORT);
            handler.PropertyChanged += handler_PropertyChanged;
            OptionGroup currentGroup = handler.AddGroup(OUTPUT);
            OptionItem  formatItem   = currentGroup.AddList(FORMAT, Formats.Keys, FORMAT_JPG);

            currentGroup.AddBool(HIDE_DECORATIONS, true);
            currentGroup.AddBool(EXPORT_RECTANGLE, true);
            currentGroup = handler.AddGroup(BOUNDS);


            OptionItem  sizeItem   = currentGroup.AddList(SIZE, SizeModes, USE_ORIGINAL_SIZE);
            IOptionItem widthItem  = currentGroup.AddInt(WIDTH, DefaultWidth, 1, int.MaxValue);
            IOptionItem heightItem = currentGroup.AddInt(HEIGHT, DefaultHeight, 1, Int32.MaxValue);

            currentGroup.AddDouble(SCALE, DefaultScale);

            currentGroup = handler.AddGroup(MARGINS);

            currentGroup.AddInt(LEFT_MARGIN, DefaultMargins);
            currentGroup.AddInt(RIGHT_MARGIN, DefaultMargins);
            currentGroup.AddInt(TOP_MARGIN, DefaultMargins);
            currentGroup.AddInt(BOTTOM_MARGIN, DefaultMargins);

            currentGroup = handler.AddGroup(JPG);
            IOptionItem qualityItem = currentGroup.AddDouble(QUALITY, DefaultQuality);

            currentGroup = handler.AddGroup(TIFF);
            OptionItem compressionItem = currentGroup.AddList(COMPRESSION,
                                                              Compressions.Keys, DefaultCompression);


            currentGroup = handler.AddGroup(PNG);
            var transparentItem = currentGroup.AddBool(TRANSPARENT, false);

            var cm = new ConstraintManager(Handler);

            cm.SetEnabledOnValueEquals(sizeItem, SPECIFY_WIDTH, widthItem);
            cm.SetEnabledOnValueEquals(sizeItem, SPECIFY_HEIGHT, heightItem);

            cm.SetEnabledOnValueEquals(formatItem, FORMAT_PNG, transparentItem);

            cm.SetEnabledOnValueEquals(formatItem, FORMAT_JPG, qualityItem);
            cm.SetEnabledOnValueEquals(formatItem, FORMAT_TIFF, compressionItem);

            // localization
            var rm =
                new ResourceManager("Demo.yFiles.ImageExport.ImageExport",
                                    Assembly.GetExecutingAssembly());
            var rmf = new ResourceManagerI18NFactory();

            rmf.AddResourceManager(Handler.Name, rm);
            Handler.I18nFactory = rmf;
        }
        ///<inheritdoc/>
        protected override void SetupHandler()
        {
            createRouter();
            OptionGroup toplevelGroup = Handler.AddGroup(TOP_LEVEL);

            //the toplevel group will show neither in Table view nor in dialog view explicitely
            toplevelGroup.SetAttribute(TableEditorFactory.RENDERING_HINTS_ATTRIBUTE,
                                       (int)TableEditorFactory.RenderingHints.Invisible);
            toplevelGroup.SetAttribute(DefaultEditorFactory.RENDERING_HINTS_ATTRIBUTE,
                                       (int)DefaultEditorFactory.RenderingHints.Invisible);
            OptionGroup layoutGroup = toplevelGroup.AddGroup(LAYOUT_OPTIONS);
            OptionGroup costGroup   = toplevelGroup.AddGroup(COST);

            if (router.PathFinderStrategy is OrthogonalPatternEdgeRouter)
            {
                OrthogonalPatternEdgeRouter oper = (OrthogonalPatternEdgeRouter)router.PathFinderStrategy;
                layoutGroup.AddList(PATHFINDER, pathFinderList, ORTHOGONAL_PATTERN_PATH_FINDER);
                layoutGroup.AddList(SCOPE, scopes, SCOPE_ALL_EDGES);
                layoutGroup.AddDouble(MINIMUM_DISTANCE, oper.MinimumDistance);
                layoutGroup.AddBool(ACTIVATE_GRID_ROUTING, oper.GridRouting);
                layoutGroup.AddDouble(GRID_SPACING, oper.GridSpacing, 2.0, Double.MaxValue);

                ConstraintManager cm = new ConstraintManager(Handler);
                cm.SetEnabledOnValueEquals(layoutGroup[ACTIVATE_GRID_ROUTING], true, layoutGroup[GRID_SPACING]);

                costGroup.AddDouble(BEND_COST, oper.BendCost);
                cm.SetEnabledOnValueEquals(layoutGroup[PATHFINDER], ORTHOGONAL_PATTERN_PATH_FINDER, costGroup[BEND_COST]);
                costGroup.AddDouble(EDGE_CROSSING_COST, oper.EdgeCrossingCost);
                cm.SetEnabledOnValueEquals(layoutGroup[PATHFINDER], ORTHOGONAL_PATTERN_PATH_FINDER, costGroup[EDGE_CROSSING_COST]);
                costGroup.AddDouble(NODE_CROSSING_COST, oper.NodeCrossingCost);
                cm.SetEnabledOnValueEquals(layoutGroup[PATHFINDER], ORTHOGONAL_PATTERN_PATH_FINDER, costGroup[NODE_CROSSING_COST]);
            }
            else
            {
                layoutGroup.AddList(PATHFINDER, pathFinderList, ORTHOGONAL_PATTERN_PATH_FINDER);
                layoutGroup.AddList(SCOPE, scopes, SCOPE_ALL_EDGES);
                layoutGroup.AddDouble(MINIMUM_DISTANCE, 10);
                layoutGroup.AddBool(ACTIVATE_GRID_ROUTING, true);
                layoutGroup.AddDouble(GRID_SPACING, 20);

                ConstraintManager cm = new ConstraintManager(Handler);
                cm.SetEnabledOnValueEquals(layoutGroup[ACTIVATE_GRID_ROUTING], true, layoutGroup[GRID_SPACING]);

                costGroup.AddDouble(BEND_COST, 1);
                cm.SetEnabledOnValueEquals(layoutGroup[PATHFINDER], ORTHOGONAL_PATTERN_PATH_FINDER, costGroup[BEND_COST]);
                costGroup.AddDouble(EDGE_CROSSING_COST, 5);
                cm.SetEnabledOnValueEquals(layoutGroup[PATHFINDER], ORTHOGONAL_PATTERN_PATH_FINDER, costGroup[EDGE_CROSSING_COST]);
                costGroup.AddDouble(NODE_CROSSING_COST, 50);
                cm.SetEnabledOnValueEquals(layoutGroup[PATHFINDER], ORTHOGONAL_PATTERN_PATH_FINDER, costGroup[NODE_CROSSING_COST]);
            }
        }
        ///<inheritdoc/>
        protected override void SetupHandler()
        {
            OptionGroup generalGroup = Handler.AddGroup(GENERAL);

            generalGroup.AddList(LAYOUT_STYLE, enumStyle, DIRECTED);
            IOptionItem       allowNonTreeItem = generalGroup.AddBool(ALLOW_NON_TREE_EDGES, true);
            IOptionItem       nonTreeStyleItem = generalGroup.AddList(ROUTING_STYLE_FOR_NON_TREE_EDGES, enumRoute, ROUTE_ORTHOGONAL);
            ConstraintManager cm = new ConstraintManager(Handler);

            cm.SetEnabledOnValueEquals(allowNonTreeItem, true, nonTreeStyleItem);

            generalGroup.AddBool(ACT_ON_SELECTION_ONLY, false);
            var bundlingStrength = generalGroup.AddDouble(EDGE_BUNDLING_STRENGTH, 0.99, 0, 1);

            cm.SetEnabledOnValueEquals(nonTreeStyleItem, ROUTE_BUNDLED, bundlingStrength);

            ClassicTreeLayout treeLayout    = new ClassicTreeLayout();
            OptionGroup       directedGroup = Handler.AddGroup(DIRECTED);

            directedGroup.AddInt(MINIMAL_NODE_DISTANCE, (int)treeLayout.MinimumNodeDistance, 1, int.MaxValue);
            directedGroup.AddInt(MINIMAL_LAYER_DISTANCE, (int)treeLayout.MinimumLayerDistance, 10, int.MaxValue);
            directedGroup.AddList(ORIENTATION, enumOrient.Keys, TOP_TO_BOTTOM);
            directedGroup.AddList(PORT_STYLE, enumPortStyle.Keys, NODE_CENTER_PORTS);

            directedGroup.AddBool(INTEGRATED_NODE_LABELING, false);
            directedGroup.AddBool(INTEGRATED_EDGE_LABELING, false);

            IOptionItem edgeRoutingOption  = directedGroup.AddBool(ORTHOGONAL_EDGE_ROUTING, false);
            IOptionItem busAlignmentOption = directedGroup.AddDouble(BUS_ALIGNMENT, 0.5, 0, 1);

            directedGroup.AddDouble(VERTICAL_ALIGNMENT, 0.5, 0, 1);
            var childPolicyItem    = directedGroup.AddList(CHILD_PLACEMENT_POLICY, childPlacementPolicies.Keys, SIBLINGS_ON_SAME_LAYER);
            var globalLayeringItem = directedGroup.AddBool(ENFORCE_GLOBAL_LAYERING, false);

            cm.SetEnabledOnCondition(ConstraintManager.LogicalCondition.And(cm.CreateValueEqualsCondition(edgeRoutingOption, true),
                                                                            ConstraintManager.LogicalCondition.Or(cm.CreateValueEqualsCondition(globalLayeringItem, true),
                                                                                                                  cm.CreateValueEqualsCondition(childPolicyItem, ALL_LEAVES_ON_SAME_LAYER))),
                                     busAlignmentOption);

            var         ar      = new AspectRatioTreeLayout();
            OptionGroup arGroup = Handler.AddGroup(AR);

            arGroup.AddInt(HORIZONTAL_SPACE, (int)ar.HorizontalDistance);
            arGroup.AddInt(VERTICAL_SPACE, (int)ar.VerticalDistance);
            arGroup.AddInt(BEND_DISTANCE, (int)ar.BendDistance);
            IOptionItem ratioItem   = arGroup.AddDouble(ASPECT_RATIO, ar.AspectRatio);
            IOptionItem useViewItem = arGroup.AddBool(USE_VIEW_ASPECT_RATIO, true);

            cm.SetEnabledOnValueEquals(useViewItem, false, ratioItem);
        }
Ejemplo n.º 8
0
        /// <summary>
        /// sets up the option handler for specifying the layout parameters.
        /// </summary>
        protected override void SetupHandler()
        {
            // global layout options
            OptionGroup layoutGroup = Handler.AddGroup(LAYOUT);

            layoutGroup.AddList(STYLE, styles.Keys, NORMAL);
            layoutGroup.AddInt(GRID, 25, 1, int.MaxValue);
            layoutGroup.AddBool(LENGTH_REDUCTION, true);
            var fromSketchItem = layoutGroup.AddBool(USE_EXISTING_DRAWING_AS_SKETCH, false);

            layoutGroup.AddBool(CROSSING_POSTPROCESSING, true);
            layoutGroup.AddBool(PERCEIVED_BENDS_POSTPROCESSING, true);
            layoutGroup.AddBool(USE_RANDOMIZATION, true);
            layoutGroup.AddBool(USE_FACE_MAXIMIZATION, false);

            //edge label options
            OptionGroup labelingGroup = Handler.AddGroup(LABELING);

            labelingGroup.AddList(EDGE_LABELING, edgeLabeling, NONE);
            labelingGroup.AddList(EDGE_LABEL_MODEL, edgeLabelModel, BEST);
            labelingGroup.AddBool(CONSIDER_NODE_LABELS, false);

            ConstraintManager cm = new ConstraintManager(Handler);

            //edge options
            OptionGroup edgeGroup     = Handler.AddGroup(EDGES);
            var         selection     = edgeGroup.AddBool(DRAW_SELECTED_EDGES_UPWARDS, false);
            var         busRouting    = edgeGroup.AddBool(UPWARD_EDGE_BUS_ROUTING, true);
            var         directionEnum = edgeGroup.AddList(ORIENTATION, orientEnum.Keys, TOP_TO_BOTTOM);

            cm.SetEnabledOnValueEquals(selection, true, busRouting);
            cm.SetEnabledOnValueEquals(selection, true, directionEnum);

            edgeGroup.AddDouble(MINIMUM_FIRST_SEGMENT_LENGTH, 15, 1, 500);
            edgeGroup.AddDouble(MINIMUM_SEGMENT_LENGTH, 15, 1, 500);
            edgeGroup.AddDouble(MINIMUM_LAST_SEGMENT_LENGTH, 15, 1, 500);

            // node grouping options
            OptionGroup groupingGroup = Handler.AddGroup(GROUPING);

            groupingGroup.AddList(GROUP_LAYOUT_POLICY, groupPolicy, LAYOUT_GROUPS);

            var c = cm.CreateValueEqualsCondition(fromSketchItem, false);

            cm.SetEnabledOnCondition(c, layoutGroup[CROSSING_POSTPROCESSING]);
            cm.SetEnabledOnCondition(c, layoutGroup[PERCEIVED_BENDS_POSTPROCESSING]);
            cm.SetEnabledOnCondition(c, layoutGroup[STYLE]);
            cm.SetEnabledOnCondition(c, layoutGroup[USE_RANDOMIZATION]);
        }
Ejemplo n.º 9
0
        protected override void SetupHandler()
        {
            OptionGroup toplevelGroup = Handler.AddGroup(TOP_LEVEL);

            //the toplevel group will show neither in Table view nor in dialog view explicitely
            //it's children will be shown one level above
            ((IOptionItem)toplevelGroup).Attributes[TableEditorFactory.RenderingHintsAttribute]   = TableEditorFactory.RenderingHints.Invisible;
            ((IOptionItem)toplevelGroup).Attributes[DefaultEditorFactory.RenderingHintsAttribute] = DefaultEditorFactory.RenderingHints.Invisible;

            OptionGroup spcg = toplevelGroup.AddGroup(SourcePortConstraints);

            spcg.Add(PortConstraintStr, PortConstraintType.Any).Attributes[OptionItem.SupportNullValueAttribute] = false;
            spcg.AddBool(StrongPortConstraint, false);
            OptionGroup tpcg = toplevelGroup.AddGroup(TargetPortConstraints);

            tpcg.Add(PortConstraintStr, PortConstraintType.Any).Attributes[OptionItem.SupportNullValueAttribute] = false;
            tpcg.AddBool(StrongPortConstraint, false);
            CollectionOptionItem <string> scopeItem = toplevelGroup.AddList(Scope, scopes, ScopeAllEdges);
            var clearItem        = toplevelGroup.AddBool(ClearAllConstraints, false);
            ConstraintManager cm = new ConstraintManager(Handler);

            cm.SetEnabledOnValueEquals(clearItem, false, spcg);
            cm.SetEnabledOnValueEquals(clearItem, false, scopeItem);
            cm.SetEnabledOnValueEquals(clearItem, false, tpcg);
        }
        protected override void SetupHandler()
        {
            OptionGroup toplevelGroup = Handler.AddGroup(TOP_LEVEL);

            //the toplevel group will show neither in Table view nor in dialog view explicitely
            //it's children will be shown one level above
            toplevelGroup.SetAttribute(TableEditorFactory.RENDERING_HINTS_ATTRIBUTE,
                                       (int)TableEditorFactory.RenderingHints.Invisible);
            toplevelGroup.SetAttribute(DefaultEditorFactory.RENDERING_HINTS_ATTRIBUTE,
                                       (int)DefaultEditorFactory.RenderingHints.Invisible);

            OptionGroup spcg = toplevelGroup.AddGroup(SourcePortConstraints);

            spcg.AddGeneric(PortConstraintStr, PortConstraintType.Any).SetAttribute(OptionItem.SUPPORT_NULL_VALUE_ATTRIBUTE,
                                                                                    false);
            spcg.AddBool(StrongPortConstraint, false);
            OptionGroup tpcg = toplevelGroup.AddGroup(TargetPortConstraints);

            tpcg.AddGeneric(PortConstraintStr, PortConstraintType.Any).SetAttribute(OptionItem.SUPPORT_NULL_VALUE_ATTRIBUTE,
                                                                                    false);
            tpcg.AddBool(StrongPortConstraint, false);
            CollectionOptionItem <string> scopeItem = toplevelGroup.AddList(Scope, scopes, ScopeAllEdges);
            BoolOptionItem    clearItem             = toplevelGroup.AddBool(ClearAllConstraints, false);
            ConstraintManager cm = new ConstraintManager(Handler);

            cm.SetEnabledOnValueEquals(clearItem, false, spcg);
            cm.SetEnabledOnValueEquals(clearItem, false, scopeItem);
            cm.SetEnabledOnValueEquals(clearItem, false, tpcg);
        }
Ejemplo n.º 11
0
        ///<inheritdoc/>
        protected override void SetupHandler()
        {
            ConstraintManager cm            = new ConstraintManager(Handler);
            OptionGroup       toplevelGroup = Handler.AddGroup(TOP_LEVEL);

            //the toplevel group will show neither in Table view nor in dialog view explicitely
            //it's children will be shown one level above
            toplevelGroup.SetAttribute(TableEditorFactory.RENDERING_HINTS_ATTRIBUTE,
                                       (int)TableEditorFactory.RenderingHints.Invisible);
            toplevelGroup.SetAttribute(DefaultEditorFactory.RENDERING_HINTS_ATTRIBUTE,
                                       (int)DefaultEditorFactory.RenderingHints.Invisible);

            OptionGroup generalGroup  = toplevelGroup.AddGroup(GENERAL);
            OptionItem  operationItem = generalGroup.AddList(OPERATION, operationEnum.Keys, SCALE);

            generalGroup.AddBool(ACT_ON_SELECTION_ONLY, false);

            OptionGroup rotateGroup = toplevelGroup.AddGroup(ROTATE);

            cm.SetEnabledOnValueEquals(operationItem, ROTATE, rotateGroup);
            rotateGroup.AddInt(ROTATION_ANGLE, (int)transformer.RotationAngle, -360, 360);
            rotateGroup.AddBool(APPLY_BEST_FIT_ROTATION, applyBestFitRotation);

            OptionGroup scaleGroup = toplevelGroup.AddGroup(SCALE);

            cm.SetEnabledOnValueEquals(operationItem, SCALE, scaleGroup);
            scaleGroup.AddDouble(SCALE_FACTOR, transformer.ScaleFactorX, 0.1, 10.0);
            scaleGroup.AddBool(SCALE_NODE_SIZE, transformer.ScaleNodeSize);

            OptionGroup translateGroup = toplevelGroup.AddGroup(TRANSLATE);

            cm.SetEnabledOnValueEquals(operationItem, TRANSLATE, translateGroup);
            translateGroup.AddDouble(TRANSLATE_X, transformer.TranslateX);
            translateGroup.AddDouble(TRANSLATE_Y, transformer.TranslateY);
        }
        ///<inheritdoc/>
        protected override void SetupHandler()
        {
            OptionGroup layoutGroup = Handler.AddGroup(GENERAL);

            layoutGroup.SetAttribute(TableEditorFactory.RENDERING_HINTS_ATTRIBUTE, TableEditorFactory.RenderingHints.Invisible);
            layoutGroup.SetAttribute(DefaultEditorFactory.RENDERING_HINTS_ATTRIBUTE, DefaultEditorFactory.RenderingHints.Invisible);

            layoutGroup.AddList(ROUTING_TO_SUBGRAPH, routingStrategies.Keys, ROUTING_TO_SUBGRAPH_AUTO);
            layoutGroup.AddList(MODE_COMPONENT_ASSIGNMENT, componentAssignment.Keys, MODE_COMPONENT_CONNECTED);
            layoutGroup.AddList(SUBGRAPH_LAYOUT, subgraphLayouts, subgraphLayouts[0]);
            layoutGroup.AddList(SUBGRAPH_POSITION_STRATEGY, subgraphPlacementStrategies.Keys,
                                SUBGRAPH_POSITIONING_STRATEGY_FROM_SKETCH);
            layoutGroup.AddInt(MIN_NODE_DIST, 30, 1, 100);
            layoutGroup.AddList(ORIENTATION_MAIN_GRAPH, layoutOrientation.Keys, ORIENTATION_MAIN_GRAPH_AUTO_DETECT);
            layoutGroup.AddBool(CONSIDER_SNAPLINES, true);
            layoutGroup.AddBool(CONSIDER_EDGE_DIRECTION, false);
        }
Ejemplo n.º 13
0
        static OptionHandler CreateHandler(GraphEditorForm form)
        {
            GraphControl         gc   = form.GraphControl;
            IGraph               g    = form.Graph;
            GraphEditorInputMode geim = form.GraphEditorInputMode;


            OptionHandler handler      = new OptionHandler(NAME);
            OptionGroup   controlGroup = handler.AddGroup(UI_DEFAULTS);

            controlGroup.AddDouble(HitTestRadius, gc.HitTestRadius);
            controlGroup.AddBool(AutoRemoveEmptyLabels, geim.AutoRemoveEmptyLabels);

//      var gridEnabledItem = controlGroup.AddBool(GridEnabled, form.Grid.Enabled);
            var gridVisibleItem  = controlGroup.AddBool(GridVisible, form.GridVisible);
            var gridWidthItem    = controlGroup.AddInt(GridWidth, form.GridWidth);
            var gridSnapTypeItem = controlGroup.AddList <GridSnapTypes>(GridSnapeType, new List <GridSnapTypes>
            {
                GridSnapTypes.All, GridSnapTypes.GridPoints, GridSnapTypes.HorizontalLines, GridSnapTypes.Lines, GridSnapTypes.None, GridSnapTypes.VerticalLines
            }, form.GridSnapType);

            ConstraintManager cm = new ConstraintManager(handler);

            cm.SetEnabledOnCondition(
                ConstraintManager.LogicalCondition.Or(cm.CreateValueEqualsCondition(gridVisibleItem, true),
                                                      cm.CreateValueEqualsCondition(gridVisibleItem, true)),
                gridWidthItem);
            cm.SetEnabledOnValueEquals(gridVisibleItem, true, gridSnapTypeItem);

            if (g != null)
            {
                OptionGroup graphGroup = handler.AddGroup(GRAPH_SETTINGS);
                graphGroup.AddBool(AutoAdjustPreferredLabelSize, g.NodeDefaults.Labels.AutoAdjustPreferredSize);
                graphGroup.AddBool(AutoCleanupPorts, g.NodeDefaults.Ports.AutoCleanUp);
                OptionGroup sharingGroup = graphGroup.AddGroup(SHARING_SETTINGS);

                sharingGroup.AddBool(ShareDefaultNodeStyleInstance, g.NodeDefaults.ShareStyleInstance);
                sharingGroup.AddBool(ShareDefaultEdgeStyleInstance, g.EdgeDefaults.ShareStyleInstance);
                sharingGroup.AddBool(ShareDefaultNodeLabelStyleInstance, g.NodeDefaults.Labels.ShareStyleInstance);
                sharingGroup.AddBool(ShareDefaultEdgeLabelStyleInstance, g.EdgeDefaults.Labels.ShareStyleInstance);
                sharingGroup.AddBool(ShareDefaultPortStyleInstance, g.NodeDefaults.Ports.ShareStyleInstance);
                sharingGroup.AddBool(ShareDefaultNodeLabelModelParameter, g.NodeDefaults.Labels.ShareLayoutParameterInstance);
                sharingGroup.AddBool(ShareDefaultEdgeLabelModelParameter, g.EdgeDefaults.Labels.ShareLayoutParameterInstance);
            }
            OptionGroup miscGroup  = handler.AddGroup(MISC_SETTINGS);
            UndoEngine  undoEngine = form.Graph.GetUndoEngine();

            if (undoEngine != null)
            {
                miscGroup.AddInt(UndoEngine_Size, undoEngine.Size);
            }
            return(handler);
        }
Ejemplo n.º 14
0
        protected override void SetupHandler()
        {
            CreateLayout();

            OptionGroup generalGroup = Handler.AddGroup(GENERAL);

            generalGroup.AddList(ORIENTATION, orientations.Keys, TOP_TO_BOTTOM);
            generalGroup.AddList(VERTICAL_ALIGNMENT, verticalAlignments.Keys, ALIGNMENT_TOP);
            generalGroup.AddBool(FROM_SKETCH_MODE, layout.FromSketchMode);
            generalGroup.AddList(ROUTING_STYLE_FOR_NON_SERIES_PARALLEL_EDGES,
                                 new[] { ROUTE_ORGANIC, ROUTE_ORTHOGONAL, ROUTE_STRAIGHTLINE }, ROUTE_ORGANIC);

            generalGroup.AddDouble(NODE_TO_NODE_DISTANCE, 30.0d);
            generalGroup.AddDouble(NODE_TO_EDGE_DISTANCE, 15.0d);
            generalGroup.AddDouble(EDGE_TO_EDGE_DISTANCE, 15.0d);


            generalGroup.AddBool(CONSIDER_NODE_LABELS, true);
            generalGroup.AddBool(INTEGRATED_EDGE_LABELING, true);

            OptionGroup edgesGroup = Handler.AddGroup(EDGE_SETTINGS);

            edgesGroup.AddList(PORT_STYLE, new[] { CENTER_PORTS, DISTRIBUTED_PORTS }, CENTER_PORTS);
            edgesGroup.AddDouble(MINIMUM_FIRST_SEGMENT_LENGTH, layout.DefaultEdgeLayoutDescriptor.MinimumFirstSegmentLength);
            edgesGroup.AddDouble(MINIMUM_LAST_SEGMENT_LENGTH, layout.DefaultEdgeLayoutDescriptor.MinimumLastSegmentLength);
            edgesGroup.AddDouble(MINIMUM_EDGE_LENGTH, 20);
            var routingStyle  = edgesGroup.AddList(ROUTING_STYLE, routingStyles.Keys, ROUTING_STYLE_ORTHOGONAL);
            var segmentLength = edgesGroup.AddDouble(PREFERRED_OCTILINEAR_SEGMENT_LENGTH,
                                                     layout.PreferredOctilinearSegmentLength);
            var distance     = edgesGroup.AddDouble(POLYLINE_DISTANCE, layout.MinimumPolylineSegmentLength);
            var minimumSlope = edgesGroup.AddDouble(MINIMUM_SLOPE, layout.MinimumSlope, 0, 5);

            edgesGroup.AddBool(ROUTE_IN_FLOW, true);

            var cm = new ConstraintManager(Handler);

            cm.SetEnabledOnValueEquals(routingStyle, ROUTING_STYLE_OCTILINEAR, segmentLength);
            cm.SetEnabledOnValueEquals(routingStyle, ROUTING_STYLE_POLYLINE, distance);
            cm.SetEnabledOnValueEquals(routingStyle, ROUTING_STYLE_POLYLINE, minimumSlope);
        }
        /// <summary>
        /// Initializes the option handler for the export
        /// </summary>
        private void SetupHandler()
        {
            handler = new OptionHandler(NODE_LABELING);
            OptionGroup currentGroup = handler;

            //Trigger an automatic relayout whenever an option changes
            currentGroup.AddList(LABEL_MODEL, LabelModels.Keys, "LABEL_MODEL_EXTERIOR").PropertyChanged +=
                HandlerPropertyChanged;
            currentGroup.AddInt(LABEL_SIZE, 8).PropertyChanged += HandlerPropertyChanged;

            // localization
            var rm =
                new ResourceManager("Demo.yFiles.Layout.NodeLabeling.NodeLabeling",
                                    Assembly.GetExecutingAssembly());
            var rmf = new ResourceManagerI18NFactory();

            rmf.AddResourceManager(Handler.Name, rm);
            Handler.I18nFactory = rmf;
        }
        ///<inheritdoc/>
        protected override void SetupHandler()
        {
            CircularLayout layout     = new CircularLayout();
            BalloonLayout  treeLayout = layout.BalloonLayout;

            OptionGroup generalGroup = Handler.AddGroup(GENERAL);
            var         styleItem    = generalGroup.AddList(LAYOUT_STYLE, globalLayoutStyles.Keys, BCC_COMPACT);

            generalGroup.AddBool(ACT_ON_SELECTION_ONLY, false);
            generalGroup.AddBool(FROM_SKETCH, false);
            generalGroup.AddBool(HANDLE_NODE_LABELS, false);

            OptionGroup cycleGroup = Handler.AddGroup(CYCLE);

            cycleGroup.AddList(PARTITION_LAYOUT_STYLE, partitionLayoutStyles.Keys, PARTITION_LAYOUTSTYLE_CYCLIC);
            IOptionItem minDistItem     = cycleGroup.AddInt(MINIMAL_NODE_DISTANCE, 30, 0, int.MaxValue);
            IOptionItem autoRadiusItem  = cycleGroup.AddBool(CHOOSE_RADIUS_AUTOMATICALLY, true);
            IOptionItem fixedRadiusItem = cycleGroup.AddInt(FIXED_RADIUS, 200, 1, int.MaxValue);

            ConstraintManager cm = new ConstraintManager(Handler);

            cm.SetEnabledOnValueEquals(autoRadiusItem, true, minDistItem);
            cm.SetEnabledOnValueEquals(autoRadiusItem, false, fixedRadiusItem);

            OptionGroup bundlingGroup    = Handler.AddGroup(EDGE_BUNDLING);
            IOptionItem bundlingEnabled  = bundlingGroup.AddBool(EDGE_BUNDLING_ENABLED, false);
            IOptionItem bundlingStrength = bundlingGroup.AddDouble(EDGE_BUNDLING_STRENGTH, 0.95, 0, 1);

            cm.SetEnabledOnValueEquals(bundlingEnabled, true, bundlingStrength);

            OptionGroup treeGroup = Handler.AddGroup(TREE);

            treeGroup.AddInt(PREFERRED_CHILD_WEDGE, treeLayout.PreferredChildWedge, 1, 360);
            treeGroup.AddInt(MINIMAL_EDGE_LENGTH, treeLayout.MinimumEdgeLength, 1, int.MaxValue);
            treeGroup.AddInt(MAXIMAL_DEVIATION_ANGLE, layout.MaximumDeviationAngle, 1, 360);
            treeGroup.AddDouble(COMPACTNESS_FACTOR, treeLayout.CompactnessFactor, 0.1, 0.9);
            treeGroup.AddInt(MINIMAL_TREE_NODE_DISTANCE, treeLayout.MinimumNodeDistance, 0, int.MaxValue);
            treeGroup.AddBool(ALLOW_OVERLAPS, treeLayout.AllowOverlaps);
            treeGroup.AddBool(PLACE_CHILDREN_ON_COMMON_RADIUS, true);

            cm.SetEnabledOnCondition(ConstraintManager.LogicalCondition.Not(cm.CreateValueEqualsCondition(styleItem, SINGLE_CYCLE)), treeGroup);
        }
Ejemplo n.º 17
0
        protected override void SetupHandler()
        {
            OptionGroup toplevelGroup = Handler.AddGroup(TOP_LEVEL);

            //the toplevel group will show neither in Table view nor in dialog view explicitely
            //it's children will be shown one level above
            toplevelGroup.SetAttribute(TableEditorFactory.RENDERING_HINTS_ATTRIBUTE, (int)TableEditorFactory.RenderingHints.Invisible);
            toplevelGroup.SetAttribute(DefaultEditorFactory.RENDERING_HINTS_ATTRIBUTE, (int)DefaultEditorFactory.RenderingHints.Invisible);

            var sourceIdItem = toplevelGroup.AddString(SourceID, "");
            var targetIdItem = toplevelGroup.AddString(TargetID, "");

            CollectionOptionItem <string> scopeItem = toplevelGroup.AddList(Scope, scopes, ScopeAllEdges);
            var clearItem        = toplevelGroup.AddBool(ClearAllConstraints, false);
            ConstraintManager cm = new ConstraintManager(Handler);

            cm.SetEnabledOnValueEquals(clearItem, false, sourceIdItem);
            cm.SetEnabledOnValueEquals(clearItem, false, scopeItem);
            cm.SetEnabledOnValueEquals(clearItem, false, targetIdItem);
        }
Ejemplo n.º 18
0
        ///<inheritdoc/>
        protected override void SetupHandler()
        {
            createRouter();
            OptionGroup layoutGroup = Handler.AddGroup(TOP_LEVEL);

            layoutGroup.SetAttribute(TableEditorFactory.RENDERING_HINTS_ATTRIBUTE, TableEditorFactory.RenderingHints.Invisible);
            layoutGroup.SetAttribute(DefaultEditorFactory.RENDERING_HINTS_ATTRIBUTE, DefaultEditorFactory.RenderingHints.Invisible);

            ConstraintManager cm = new ConstraintManager(Handler);

            layoutGroup.AddList(SCOPE, scopes, SCOPE_ALL_EDGES);
            layoutGroup.AddBool(USE_SELECTED_EDGES_AS_MASTER, false);
            layoutGroup.AddBool(CONSIDER_EDGE_DIRECTION, router.DirectedMode);
            layoutGroup.AddBool(USE_ADAPTIVE_LINE_DISTANCE, router.AdaptiveLineDistances);
            layoutGroup.AddInt(LINE_DISTANCE, (int)router.LineDistance, 0, 50);
            IOptionItem joinEndsItem     = layoutGroup.AddBool(JOINS_ENDS, router.JoinEnds);
            IOptionItem joinDistanceItem = layoutGroup.AddInt(JOIN_DISTANCE, (int)router.AbsJoinEndDistance, 0, 50);

            cm.SetEnabledOnValueEquals(joinEndsItem, true, joinDistanceItem);
        }
Ejemplo n.º 19
0
        /// <summary>
        /// Initializes the option handler for the export
        /// </summary>
        private void SetupHandler()
        {
            handler = new OptionHandler(IMAGE_EXPORT);
            handler.PropertyChanged += handler_PropertyChanged;
            OptionGroup currentGroup = handler.AddGroup(OUTPUT);
            OptionItem  formatItem   = currentGroup.AddList(FORMAT, Formats.Keys, FORMAT_JPG);

            currentGroup.AddBool(HIDE_DECORATIONS, true);
            currentGroup.AddBool(EXPORT_RECTANGLE, true);
            currentGroup = handler.AddGroup(BOUNDS);


            OptionItem  sizeItem   = currentGroup.AddList(SIZE, SizeModes, USE_ORIGINAL_SIZE);
            IOptionItem widthItem  = currentGroup.AddInt(WIDTH, DefaultWidth, 1, int.MaxValue);
            IOptionItem heightItem = currentGroup.AddInt(HEIGHT, DefaultHeight, 1, Int32.MaxValue);

            currentGroup.AddDouble(SCALE, DefaultScale);
            currentGroup.AddDouble(ZOOM, DefaultZoom);

            currentGroup = handler.AddGroup(GRAPHICS);

            currentGroup.AddGeneric(SMOOTHING, SimpleSmoothingMode.HighSpeed).SetAttribute(
                OptionItem.SUPPORT_NULL_VALUE_ATTRIBUTE, false);
            currentGroup.AddGeneric(TEXTRENDERING, TextRenderingHint.SystemDefault).SetAttribute(
                OptionItem.SUPPORT_NULL_VALUE_ATTRIBUTE, false);
            currentGroup.AddGeneric(INTERPOLATION, InterpolationMode.Invalid).SetAttribute(
                OptionItem.SUPPORT_NULL_VALUE_ATTRIBUTE, false);
            currentGroup.AddGeneric(PIXELOFFSET, PixelOffsetMode.Invalid).SetAttribute(
                OptionItem.SUPPORT_NULL_VALUE_ATTRIBUTE, false);

            currentGroup = handler.AddGroup(MARGINS);

            currentGroup.AddInt(LEFT_MARGIN, DefaultMargins);
            currentGroup.AddInt(RIGHT_MARGIN, DefaultMargins);
            currentGroup.AddInt(TOP_MARGIN, DefaultMargins);
            currentGroup.AddInt(BOTTOM_MARGIN, DefaultMargins);

            currentGroup = handler.AddGroup(JPG);
            DoubleOptionItem qualityItem = currentGroup.AddDouble(QUALITY, DefaultQuality);

            currentGroup = handler.AddGroup(TIFF);
            OptionItem colorDepthItem  = currentGroup.AddList(COLOR_DEPTH, ColorDepthList.Keys, DefaultDepth);
            OptionItem compressionItem = currentGroup.AddList(COMPRESSION,
                                                              Compressions.Keys, DefaultCompression);


            currentGroup = handler.AddGroup(PNG);
            BoolOptionItem transparentPNGItem = currentGroup.AddBool(TRANSPARENT, false);

            currentGroup = handler.AddGroup(EMF);
            BoolOptionItem transparentEMFItem = currentGroup.AddBool(TRANSPARENT, false);


            var cm = new ConstraintManager(Handler);

            cm.SetEnabledOnValueEquals(sizeItem, SPECIFY_WIDTH, widthItem);
            cm.SetEnabledOnValueEquals(sizeItem, SPECIFY_HEIGHT, heightItem);

            cm.SetEnabledOnValueEquals(formatItem, FORMAT_EMF, transparentEMFItem);
            cm.SetEnabledOnValueEquals(formatItem, FORMAT_PNG, transparentPNGItem);

            cm.SetEnabledOnValueEquals(formatItem, FORMAT_JPG, qualityItem);
            cm.SetEnabledOnValueEquals(formatItem, FORMAT_TIFF, colorDepthItem);
            cm.SetEnabledOnValueEquals(formatItem, FORMAT_TIFF, compressionItem);

            // localization
            var rm =
                new ResourceManager("Demo.yFiles.ImageExport.ImageExport",
                                    Assembly.GetExecutingAssembly());
            var rmf = new ResourceManagerI18NFactory();

            rmf.AddResourceManager(Handler.Name, rm);
            Handler.I18nFactory = rmf;
        }
        ///<inheritdoc/>
        protected override void SetupHandler()
        {
            OptionGroup generalGroup     = Handler.AddGroup(GENERAL);
            OptionGroup interactionGroup = generalGroup.AddGroup(INTERACTION);

            interactionGroup.AddBool(SELECTED_ELEMENTS_INCREMENTALLY, false);
            IOptionItem useDrawingItem = interactionGroup.AddBool(USE_DRAWING_AS_SKETCH, false);

            interactionGroup.SetAttribute(TableEditorFactory.RENDERING_HINTS_ATTRIBUTE, TableEditorFactory.RenderingHints.Invisible);

            generalGroup.AddList(ORIENTATION, orientEnum.Keys, TOP_TO_BOTTOM);
            generalGroup.AddBool(LAYOUT_COMPONENTS_SEPARATELY, false);
            IOptionItem symmetricPlacement = generalGroup.AddBool(SYMMETRIC_PLACEMENT, true);

            generalGroup.AddInt(MAXIMUM_DURATION, 5);

            OptionGroup distanceGroup = generalGroup.AddGroup(MINIMUM_DISTANCES);

            distanceGroup.AddDouble(NODE_TO_NODE_DISTANCE, 30.0d);
            distanceGroup.AddDouble(NODE_TO_EDGE_DISTANCE, 15.0d);
            distanceGroup.AddDouble(EDGE_TO_EDGE_DISTANCE, 15.0d);
            distanceGroup.AddDouble(MINIMUM_LAYER_DISTANCE, 10.0d);

            OptionGroup edgeSettingsGroup = Handler.AddGroup(EDGE_SETTINGS);
            OptionItem  eoi = edgeSettingsGroup.AddList(EDGE_ROUTING, edgeRoutingEnum.Keys, EDGE_ROUTING_ORTHOGONAL);

            edgeSettingsGroup.AddBool(BACKLOOP_ROUTING, false);
            edgeSettingsGroup.AddBool(AUTOMATIC_EDGE_GROUPING_ENABLED, false);
            IOptionItem edgeStraightening = edgeSettingsGroup.AddBool(EDGE_STRAIGHTENING_OPTIMIZATION_ENABLED, false);

            edgeSettingsGroup.AddBool(CONSIDER_EDGE_THICKNESS, false);
            edgeSettingsGroup.AddBool(CONSIDER_EDGE_DIRECTION, false);
            edgeSettingsGroup.AddDouble(MINIMUM_FIRST_SEGMENT_LENGTH, 10.0d);
            edgeSettingsGroup.AddDouble(MINIMUM_LAST_SEGMENT_LENGTH, 15.0d);
            edgeSettingsGroup.AddDouble(MINIMUM_EDGE_LENGTH, 20.0d);
            edgeSettingsGroup.AddDouble(MINIMUM_EDGE_DISTANCE, 15.0d);

            ConstraintManager cm = new ConstraintManager(Handler);

            cm.SetEnabledOnValueEquals(eoi, EDGE_ROUTING_POLYLINE,
                                       edgeSettingsGroup.AddDouble(MINIMUM_SLOPE, 0.25d, 0.0d, 5.0d));
            cm.SetEnabledOnValueEquals(symmetricPlacement, false, edgeStraightening);

            edgeSettingsGroup.AddBool(PC_OPTIMIZATION_ENABLED, false);
            edgeSettingsGroup.AddList(RECURSIVE_EDGE_ROUTING, new[] { RECURSIVE_EDGE_ROUTING_OFF, RECURSIVE_EDGE_ROUTING_DIRECTED, RECURSIVE_EDGE_ROUTING_UNDIRECTED }, RECURSIVE_EDGE_ROUTING_OFF);

            OptionGroup rankGroup = Handler.AddGroup(RANKS);

            rankGroup.AddList(RANKING_POLICY, rankingPolicies.Keys, HIERARCHICAL_OPTIMAL);
            rankGroup.AddList(LAYER_ALIGNMENT, alignmentEnum.Keys, BOTTOM);
            rankGroup.AddList(COMPONENT_ARRANGEMENT_POLICY, componentAlignmentEnum.Keys, POLICY_TOPMOST);

            OptionGroup sketchGroup = rankGroup.AddGroup(FROM_SKETCH_PROPERTIES);

            sketchGroup.AddDouble(SCALE, 1.0d, 0.0d, 5.0d);
            sketchGroup.AddDouble(HALO, 0.0d);
            sketchGroup.AddDouble(MINIMUM_SIZE, 0.0d, 0, Double.MaxValue);
            sketchGroup.AddDouble(MAXIMUM_SIZE, 1000.0d, 0, Double.MaxValue);
            cm.SetEnabledOnValueEquals(Handler.GetItemByName(RANKS + "." + RANKING_POLICY), FROM_SKETCH,
                                       Handler.GetItemByName(RANKS + "." + FROM_SKETCH_PROPERTIES));

            OptionGroup labelingGroup = Handler.AddGroup(LABELING);
            OptionGroup npGroup       = labelingGroup.AddGroup(NODE_PROPERTIES);

            npGroup.AddBool(CONSIDER_NODE_LABELS, true);
            npGroup.SetAttribute(TableEditorFactory.RENDERING_HINTS_ATTRIBUTE, TableEditorFactory.RenderingHints.Invisible);
            //npGroup.SetAttribute(DefaultEditorFactory.RenderingHintsAttribute,
            //  DefaultEditorFactory.RenderingHints.Invisible);
            OptionGroup epGroup = labelingGroup.AddGroup(LABELING_EDGE_PROPERTIES);
            CollectionOptionItem <string> edgeLabelingEnumItem = epGroup.AddList(EDGE_LABELING, edgeLabeling, EDGE_LABELING_NONE);
            CollectionOptionItem <string> labelModelItem       = epGroup.AddList(EDGE_LABEL_MODEL, edgeLabelModel, EDGE_LABEL_MODEL_BEST);

            epGroup.SetAttribute(TableEditorFactory.RENDERING_HINTS_ATTRIBUTE, TableEditorFactory.RenderingHints.Invisible);
            ICondition cond = ConstraintManager.LogicalCondition.Not(cm.CreateValueEqualsCondition(edgeLabelingEnumItem, EDGE_LABELING_NONE));

            cm.SetEnabledOnCondition(cond, labelModelItem);
            IOptionItem compactEdgeLabel = epGroup.AddBool(COMPACT_EDGE_LABEL_PLACEMENT, true);

            cm.SetEnabledOnValueEquals(edgeLabelingEnumItem, EDGE_LABELING_HIERARCHIC, compactEdgeLabel);
            OptionGroup groupingGroup = Handler.AddGroup(GROUPING);
            CollectionOptionItem <string> groupStrategyItem = groupingGroup.AddList(GROUP_LAYERING_STRATEGY, groupStrategyEnum.Keys, RECURSIVE_LAYERING);
            CollectionOptionItem <string> groupAlignItem    = groupingGroup.AddList(GROUP_ALIGNMENT, groupAlignmentEnum.Keys, GROUP_ALIGN_TOP);
            IOptionItem groupCompactionItem = groupingGroup.AddBool(GROUP_ENABLE_COMPACTION, false);

            groupingGroup.AddList(GROUP_HORIZONTAL_COMPACTION, groupHorizCompactionEnum.Keys, GROUP_HORIZONTAL_COMPACTION_NONE);
            cm.SetEnabledOnValueEquals(groupStrategyItem, RECURSIVE_LAYERING, groupCompactionItem);
            cm.SetEnabledOnValueEquals(groupStrategyItem, RECURSIVE_LAYERING, groupAlignItem);

            cm.SetEnabledOnValueEquals(useDrawingItem, false, groupStrategyItem);
            cm.SetEnabledOnCondition(ConstraintManager.LogicalCondition.And(cm.CreateValueEqualsCondition(groupStrategyItem, RECURSIVE_LAYERING),
                                                                            cm.CreateValueEqualsCondition(groupCompactionItem, false)), groupAlignItem);

            cm.SetEnabledOnCondition(ConstraintManager.LogicalCondition.And(cm.CreateValueEqualsCondition(groupStrategyItem, RECURSIVE_LAYERING),
                                                                            cm.CreateValueEqualsCondition(useDrawingItem, false)), groupCompactionItem);

            OptionGroup swimGroup        = Handler.AddGroup(SWIMLANES);
            IOptionItem swimlaneOption   = swimGroup.AddBool(TREAT_ROOT_GROUPS_AS_SWIMLANES, false);
            IOptionItem fromSketchOption = swimGroup.AddBool(USE_ORDER_FROM_SKETCH, false);
            IOptionItem spacingOption    = swimGroup.AddDouble(SWIMLANE_SPACING, 0.0d, 0, Double.MaxValue);

            cm.SetEnabledOnValueEquals(swimlaneOption, true, fromSketchOption);
            cm.SetEnabledOnValueEquals(swimlaneOption, true, spacingOption);

            OptionGroup gridGroup          = Handler.AddGroup(GRID);
            IOptionItem gridEnabled        = gridGroup.AddBool(GRID_ENABLED, false);
            IOptionItem gridSpacing        = gridGroup.AddDouble(GRID_SPACING, 10);
            IOptionItem gridPortAssignment = gridGroup.AddList(GRID_PORT_ASSIGNMENT, new[] { GRID_PORT_ASSIGNMENT_DEFAULT, GRID_PORT_ASSIGNMENT_ON_GRID, GRID_PORT_ASSIGNMENT_ON_SUBGRID }, GRID_PORT_ASSIGNMENT_DEFAULT);

            cm.SetEnabledOnValueEquals(gridEnabled, true, gridSpacing);
            cm.SetEnabledOnValueEquals(gridEnabled, true, gridPortAssignment);
        }
        ///<inheritdoc/>
        protected override void SetupHandler()
        {
            CreateOrganic();

            ConstraintManager cm          = new ConstraintManager(Handler);
            OptionGroup       visualGroup = Handler.AddGroup(VISUAL);

            visualGroup.AddList(SCOPE, scopes.Keys, SCOPE_ALL);
            visualGroup.AddInt(PREFERRED_EDGE_LENGTH, (int)organic.PreferredEdgeLength, 5, int.MaxValue);
            IOptionItem considerNodeLabelsItem = visualGroup.AddBool(CONSIDER_NODE_LABELS, organic.ConsiderNodeLabels);
            IOptionItem allowNodeOverlapsItem  = visualGroup.AddBool(ALLOW_NODE_OVERLAPS, organic.NodeOverlapsAllowed);

            IOptionItem minDistItem = visualGroup.AddDouble(MINIMAL_NODE_DISTANCE, 10, 0, double.MaxValue);
            ICondition  condition   = ConstraintManager.LogicalCondition.Or(cm.CreateValueEqualsCondition(allowNodeOverlapsItem, false),
                                                                            cm.CreateValueEqualsCondition(considerNodeLabelsItem, true));

            cm.SetEnabledOnCondition(condition, minDistItem);

            visualGroup.AddBool(AVOID_NODE_EDGE_OVERLAPS, organic.NodeEdgeOverlapAvoided);
            cm.SetEnabledOnValueEquals(considerNodeLabelsItem, false, allowNodeOverlapsItem);

            visualGroup.AddDouble(COMPACTNESS, organic.CompactnessFactor, 0, 1);
            visualGroup.AddBool(USE_AUTO_CLUSTERING, organic.ClusterNodes);
            visualGroup.AddDouble(AUTO_CLUSTERING_QUALITY, organic.ClusteringQuality, 0, 1);
            cm.SetEnabledOnValueEquals(visualGroup[USE_AUTO_CLUSTERING], true, visualGroup[AUTO_CLUSTERING_QUALITY]);

            OptionGroup outputRestrictionsGroup = Handler.AddGroup(RESTRICTIONS);

            OptionItem outputRestrictionsItem =
                outputRestrictionsGroup.AddList(RESTRICT_OUTPUT, outputRestrictions, NONE);

            OptionGroup outputCageGroup = outputRestrictionsGroup.AddGroup(BOUNDS);

            ICondition cond = cm.CreateValueIsOneOfCondition(outputRestrictionsItem, OUTPUT_CAGE, OUTPUT_ELLIPTICAL_CAGE);

            cm.SetEnabledOnCondition(cond, outputCageGroup);

            //IOptionItem rectCageUseViewItem = new BoolOptionItem(RECT_CAGE_USE_VIEW, true);
            IOptionItem rectCageUseViewItem = outputCageGroup.AddBool(RECT_CAGE_USE_VIEW, true);
            IOptionItem cageXItem           = outputCageGroup.AddDouble(CAGE_X, 0.0d);
            IOptionItem cageYItem           = outputCageGroup.AddDouble(CAGE_Y, 0.0d);
            IOptionItem cageWidthItem       = outputCageGroup.AddDouble(CAGE_WIDTH, 1000.0d, 1, double.MaxValue);
            IOptionItem cageHeightItem      = outputCageGroup.AddDouble(CAGE_HEIGHT, 1000.0d, 1, double.MaxValue);

            cm.SetEnabledOnValueEquals(rectCageUseViewItem, false, cageXItem);
            cm.SetEnabledOnValueEquals(rectCageUseViewItem, false, cageYItem);
            cm.SetEnabledOnValueEquals(rectCageUseViewItem, false, cageWidthItem);
            cm.SetEnabledOnValueEquals(rectCageUseViewItem, false, cageHeightItem);

            OptionGroup outputARGroup = outputRestrictionsGroup.AddGroup(OUTPUT_AR);

            cm.SetEnabledOnValueEquals(outputRestrictionsItem, OUTPUT_AR, outputARGroup);
            IOptionItem arCageUseViewItem = outputARGroup.AddBool(AR_CAGE_USE_VIEW, true);
            IOptionItem cageRatioItem     = outputARGroup.AddDouble(CAGE_RATIO, 1.0d);

            cm.SetEnabledOnValueEquals(arCageUseViewItem, false, cageRatioItem);

            OptionGroup groupingGroup = Handler.AddGroup(GROUPING);

            groupingGroup.AddList(GROUP_LAYOUT_POLICY, groupModes, LAYOUT_GROUPS);

            OptionGroup algorithmGroup = Handler.AddGroup(ALGORITHM);

            algorithmGroup.AddDouble(QUALITY_TIME_RATIO, organic.QualityTimeRatio, 0, 1);
            algorithmGroup.AddInt(MAXIMAL_DURATION, (int)(organic.MaximumDuration / 1000), 0, int.MaxValue);
            algorithmGroup.AddBool(ACTIVATE_DETERMINISTIC_MODE, organic.Deterministic);
            algorithmGroup.AddBool(ALLOW_MULTI_THREADING, true);
        }