Пример #1
0
        private static IConeEntity ByStartPointEndPointRadiusCore(DSPoint startPoint, DSPoint endPoint, double startRadius, double endRadius)
        {
            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 (null == startPoint)
            {
                throw new System.ArgumentNullException("startPoint");
            }
            if (null == endPoint)
            {
                throw new System.ArgumentNullException("endPoint");
            }
            if (startPoint.DistanceTo(endPoint).EqualsTo(0.0))
            {
                throw new System.ArgumentException(string.Format(Properties.Resources.IsZeroDistance, "start point", "end point"), "startPoint, endPoint");
            }

            IConeEntity entity = HostFactory.Factory.ConeByPointsRadius(startPoint.PointEntity, endPoint.PointEntity, startRadius, endRadius);

            if (null == entity)
            {
                throw new System.Exception(string.Format(Properties.Resources.OperationFailed, "DSCone.ByStartPointEndPointRadius"));
            }
            return(entity);
        }
Пример #2
0
        internal static DSCone ToCone(IConeEntity host, bool persist = false)
        {
            if (host.Owner == null)
            {
                return(new DSCone(host, persist));
            }

            return(host.Owner as DSCone);
        }
Пример #3
0
        protected override DSGeometry Translate(DSVector offset)
        {
            IConeEntity clone = GeomEntity.CopyAndTranslate(offset.IVector) as IConeEntity;

            if (null == clone)
            {
                throw new System.InvalidOperationException("Failed to clone and translate geometry.");
            }

            return(new DSCone(clone, true));
        }
Пример #4
0
        private static IConeEntity ByCenterLineRadiusCore(DSLine centerLine, double startRadius, double endRadius)
        {
            if (null == centerLine)
            {
                throw new System.ArgumentNullException("centerLine");
            }

            IConeEntity entity = ByStartPointEndPointRadiusCore(centerLine.StartPoint, centerLine.EndPoint, startRadius, endRadius);

            return(entity);
        }
Пример #5
0
        internal override DSGeometry TransformBy(ICoordinateSystemEntity csEntity)
        {
            IGeometryEntity clone = GeomEntity.CopyAndTransform(DSCoordinateSystem.WCS.CSEntity, csEntity);

            if (null == clone)
            {
                throw new System.InvalidOperationException("Failed to clone and transform cone.");
            }

            IConeEntity cone = clone as IConeEntity;

            if (null != cone)
            {
                return(new DSCone(cone, true));
            }
            return(ToGeometry(clone, true));
        }
Пример #6
0
        static Solid CreateGeometry(IGeometryEntity host, bool persist)
        {
            IConeEntity cone = host as IConeEntity;

            if (null == cone)
            {
                return(null);
            }

            if (cone.Owner != null)
            {
                return(cone.Owner as Solid);
            }

            if (IsCylinder(cone))
            {
                return(new Cylinder(cone, persist));
            }

            return(Cone.ToCone(cone, persist));
        }
Пример #7
0
        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);
        }
Пример #8
0
 private DSCone(IConeEntity entity, bool persist = false)
     : base(entity, persist)
 {
     InitializeGuaranteedProperties();
 }
Пример #9
0
        internal static DSCone ToCone(IConeEntity host, bool persist = false)
        {
            if (host.Owner == null)
                return new DSCone(host, persist);

            return host.Owner as DSCone;
        }
Пример #10
0
 private DSCone(IConeEntity entity, bool persist = false)
     : base(entity, persist)
 {
     InitializeGuaranteedProperties();
 }
Пример #11
0
 static bool IsCylinder(IConeEntity cone)
 {
     return(cone.GetRadiusRatio().EqualsTo(1.0));
 }
Пример #12
0
 bool CategoryCheck(IConeEntity entity)
 {
     return (includedCategories.IsEmpty() || entity.Categories.Any(includedCategories.Contains))
         && !entity.Categories.Any(excludedCategories.Contains);
 }
Пример #13
0
 static bool IsCylinder(IConeEntity cone)
 {
     return cone.GetRadiusRatio().EqualsTo(1.0);
 }