コード例 #1
0
ファイル: Cone.cs プロジェクト: samuto/designscript
        private static IConeEntity ByRadiusHeightCore(DSCoordinateSystem contextCoordinateSystem, double startRadius, double endRadius, double height)
        {
            string kMethod = "DSCone.ByRadiusHeight";

            if (startRadius.LessThanOrEqualTo(0.0))
                throw new System.ArgumentException(string.Format(Properties.Resources.LessThanZero, "start radius"), "startRadius");
            if (endRadius < 0.0)
                throw new System.ArgumentException(string.Format(Properties.Resources.LessThanZero, "end radius"), "endRadius");
            if (height.LessThanOrEqualTo(0.0))
                throw new System.ArgumentException(string.Format(Properties.Resources.IsZero, "height"), "height");
            if (null == contextCoordinateSystem)
                throw new System.ArgumentNullException("contextCoordinateSystem");
            if (!contextCoordinateSystem.IsUniscaledOrtho())
            {
                if (contextCoordinateSystem.IsScaledOrtho())
                    throw new System.ArgumentException(string.Format(Properties.Resources.InvalidInput, "Non Uniform Scaled DSCoordinateSystem", kMethod));
                else
                    throw new System.ArgumentException(string.Format(Properties.Resources.InvalidInput, "Shear DSCoordinateSystem", kMethod));
            }

            IConeEntity entity = HostFactory.Factory.ConeByRadiusLength(contextCoordinateSystem.CSEntity, startRadius, endRadius, height);
            if (null == entity)
                throw new System.Exception(string.Format(Properties.Resources.OperationFailed, kMethod));
            return entity;
        }