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); }
internal static DSCone ToCone(IConeEntity host, bool persist = false) { if (host.Owner == null) { return(new DSCone(host, persist)); } return(host.Owner as DSCone); }
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)); }
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); }
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)); }
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)); }
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); }
private DSCone(IConeEntity entity, bool persist = false) : base(entity, persist) { InitializeGuaranteedProperties(); }
internal static DSCone ToCone(IConeEntity host, bool persist = false) { if (host.Owner == null) return new DSCone(host, persist); return host.Owner as DSCone; }
static bool IsCylinder(IConeEntity cone) { return(cone.GetRadiusRatio().EqualsTo(1.0)); }
bool CategoryCheck(IConeEntity entity) { return (includedCategories.IsEmpty() || entity.Categories.Any(includedCategories.Contains)) && !entity.Categories.Any(excludedCategories.Contains); }
static bool IsCylinder(IConeEntity cone) { return cone.GetRadiusRatio().EqualsTo(1.0); }