Exemple #1
0
        private static ICircleEntity ByCenterPointRadiusCore(Point centerPoint, double radius, ref Vector normal)
        {
            if (null == centerPoint)
            {
                throw new ArgumentNullException("centerPoint");
            }
            if (null == normal)
            {
                throw new ArgumentNullException("normal");
            }
            if (normal.IsZeroVector())
            {
                throw new ArgumentException(string.Format(Properties.Resources.IsZeroVector, "normal"), "normal");
            }
            if (radius <= 0.0)
            {
                throw new ArgumentException(Properties.Resources.IsZeroRadius);
            }

            normal = normal.IsNormalized ? normal : normal.Normalize();
            ICircleEntity entity = HostFactory.Factory.CircleByCenterPointRadius(centerPoint.PointEntity, radius, normal.IVector);

            if (null == entity)
            {
                throw new Exception(string.Format(Properties.Resources.OperationFailed, "Circle.ByCenterPointRadius"));
            }
            return(entity);
        }
        public string WriteEntity(ICircleEntity circle, string paramName = null)
        {
            if (string.IsNullOrEmpty(paramName))
            {
                paramName = string.Format("__circle_{0}", ++id);
            }

            string center = WriteEntity(circle.CenterPoint);
            string normal = WriteEntity(circle.Normal);

            mExpression.AppendFormat("{0} = Circle.ByCenterPointRadius({1}, {2}, {3});", paramName, center, circle.Radius, normal);
            mExpression.AppendLine();
            return(paramName);
        }
Exemple #3
0
 private DSCircle(ICircleEntity entity, bool persist = false)
     : base(entity, persist)
 {
     InitializeGuaranteedProperties();
 }
Exemple #4
0
 private Circle(ICircleEntity entity, bool persist = false) : base(entity, persist)
 {
     InitializeGuaranteedProperties();
 }
 public void WriteObject(ICircleEntity circle)
 {
     WriteEntity("CenterPoint", circle.CenterPoint);
     WriteDouble("Radius", circle.Radius);
     WriteEntity("Normal", circle.Normal);
 }