コード例 #1
0
        /// <summary>
        /// This form of the constructor uses specifies the padding parameters.
        /// <param name="isHorizontal">Whether to generate horizontal or vertical constraints</param>
        /// <param name="padding">Padding outside nodes in the parallel direction</param>
        /// <param name="paddingP">Padding outside nodes in the perpendicular direction</param>
        /// <param name="clusterPadding">Padding outside clusters in the parallel direction</param>
        /// <param name="clusterPaddingP">Padding outside clusters in the perpendicular direction</param>
        /// </summary>
        public ConstraintGenerator(bool isHorizontal, double padding, double paddingP, double clusterPadding, double clusterPaddingP)
        {
            ValidateArg.IsPositive(padding, "padding");
            this.IsHorizontal    = isHorizontal;
            this.Padding         = padding;
            this.PaddingP        = paddingP;
            this.ClusterPadding  = clusterPadding;
            this.ClusterPaddingP = clusterPaddingP;

            // Create the DefaultClusterHierarchy.
            this.clusterHierarchies.Add(new OverlapRemovalCluster(0, null /* parentCluster */, 0 /* default userData is 0 id */, Padding, PaddingP));
            this.nextNodeId += OverlapRemovalCluster.NumInternalNodes;
        }
コード例 #2
0
        // This is the normal node ctor, from ConstraintGenerator.
        internal OverlapRemovalNode(uint id, object userData, double position, double positionP,
                                    double size, double sizeP, double weight)
        {
            ValidateArg.IsPositive(size, "size");
            ValidateArg.IsPositive(size, "sizeP");
            ValidateArg.IsPositive(weight, "weight");
            if (weight <= 0)
            {
                throw new ArgumentOutOfRangeException("weight"
#if DEBUG
                                                      , "Invalid node properties"
#endif // DEBUG
                                                      );
            }
            double dblCheck = (Math.Abs(position) + size) * weight;
            if (double.IsInfinity(dblCheck) || double.IsNaN(dblCheck))
            {
                throw new ArgumentOutOfRangeException("position"
#if DEBUG
                                                      , "Invalid node properties"
#endif // DEBUG
                                                      );
            }
            dblCheck = (Math.Abs(positionP) + sizeP) * weight;
            if (double.IsInfinity(dblCheck) || double.IsNaN(dblCheck))
            {
                throw new ArgumentOutOfRangeException("positionP"
#if DEBUG
                                                      , "Invalid node properties"
#endif // DEBUG
                                                      );
            }
            this.Id        = id;
            this.UserData  = userData;
            this.Position  = position;
            this.PositionP = positionP;
            this.Size      = size;
            this.SizeP     = sizeP;
            this.Weight    = weight;
        }