/// <summary> /// Constructor creating a new renderer attribute /// </summary> /// <param name="type">graphic device type </param> /// <param name="Name">short name</param> /// <param name="NameLong">long name</param> /// <param name="Default">'default' flag</param> public ILRendererAttribute(GraphicDeviceType type, string Name, string NameLong, bool Default, CoordSystem coords) { this.GraphicDeviceType = type; this.Name = Name; this.NameLong = NameLong; this.IsDefault = Default; this.Coords = coords; }
/// <summary> /// Constructor for a new attribute describing non-default renderer /// </summary> /// <param name="type">graphic device type </param> /// <param name="Name">short name</param> /// <param name="NameLong">long name</param> public ILRendererAttribute(GraphicDeviceType type, string Name, string NameLong) { this.GraphicDeviceType = type; this.Name = Name; this.NameLong = NameLong; this.IsDefault = false; this.Coords = CoordSystem.Screen; }
/// <summary> /// Create the default instance of IILTextRenderer for /// the current graphics device and a coord system /// </summary> /// <param name="coords">coord system, the renderer is /// specialized and the default renderer for</param> /// <returns>default IILTextRenderer object</returns> public IILTextRenderer GetDefault(CoordSystem coords) { string key = (coords == CoordSystem.World3D) ? m_defaultRendererWorld : m_defaultRendererScreen; if (m_rendererCache.ContainsKey(key) && m_rendererCache[key] != null) { return(m_rendererCache[key]); } // must create a new instance IILTextRenderer ret; switch (coords) { case CoordSystem.World3D: ret = CreateInstance(m_defaultRendererWorld, null); break; default: ret = CreateInstance(m_defaultRendererScreen, null); break; } m_rendererCache[key] = ret; return(ret); }
/// <summary> /// Constructor creating a new renderer attribute /// </summary> /// <param name="type">graphic device type </param> /// <param name="Name">short name</param> /// <param name="NameLong">long name</param> /// <param name="Default">'default' flag</param> public ILRendererAttribute(GraphicDeviceType type, string Name, string NameLong, bool Default, CoordSystem coords) { this.GraphicDeviceType = type; this.Name = Name; this.NameLong = NameLong; this.IsDefault = Default; this.Coords = coords; }
/// <summary> /// Constructor for a new attribute describing non-default renderer /// </summary> /// <param name="type">graphic device type </param> /// <param name="Name">short name</param> /// <param name="NameLong">long name</param> public ILRendererAttribute(GraphicDeviceType type, string Name, string NameLong) { this.GraphicDeviceType = type; this.Name = Name; this.NameLong = NameLong; this.IsDefault = false; this.Coords = CoordSystem.Screen; }
public ILShapeLabel(ILPanel panel, CoordSystem coordSystem) : base(panel, null, Color.Black) { m_panel = panel; m_coordSystem = CoordSystem.Screen; m_anchor = new PointF(.5f, .5f); // TickLabelAlign.center | TickLabelAlign.vertCenter; m_renderer.CacheCleared -= new EventHandler(m_renderer_CacheCleared); m_renderer = panel.TextRendererManager.GetDefault(coordSystem); m_renderer.CacheCleared += new EventHandler(m_renderer_CacheCleared); }
public Vector3 convertFrom(Vector3 otherLoc, CoordSystem otherCoordSys) { // Debug.Log (this + "convertFrom: " + otherLoc + "," + otherCoordSys.ToString()); return(new Vector3( x.convertFrom(otherLoc.x, otherCoordSys.x), y.convertFrom(otherLoc.y, otherCoordSys.y), z.convertFrom(otherLoc.z, otherCoordSys.z))); }
// Update is called once per frame void Update() { m_Vector = CoordSystem.SphericalToCartesian(m_SphVector); //on fait tourner l'objet transform.RotateAround(m_PivotPoint.position, m_Vector.normalized, m_RotAngularSpeed * Time.deltaTime); VectorDisplayService.Display(name + ".rotVector", m_Vector, m_PivotPoint.position, m_VectorDisplayColor, m_VectorSizeMultiplier); }
/// <summary> /// 将点或矢量从一个坐标系转换到另一个坐标系 /// </summary> /// <param name="pt">坐标,表示点或位移矢量</param> /// <param name="from">源坐标系</param> /// <param name="to">目标坐标系</param> /// <param name="disp">位移矢量标记,1表示位移矢量,0表示点</param> /// <returns>返回转化后的坐标</returns> public static Point3d TranslateCoordinates(this Point3d pt, CoordSystem from, CoordSystem to, int disp) { double[] result = new double[3]; acedTrans(pt.ToArray(), new ResultBuffer(new TypedValue(5003, from)).UnmanagedObject, new ResultBuffer(new TypedValue(5003, to)).UnmanagedObject, disp, result); return(new Point3d(result)); }
public ILShapeLabel(ILPanel panel, CoordSystem coordSystem) : base(panel, null, Color.Black) { m_panel = panel; m_coordSystem = CoordSystem.Screen; m_anchor = new PointF(.5f, .5f); // TickLabelAlign.center | TickLabelAlign.vertCenter; m_renderer.CacheCleared -= new EventHandler(m_renderer_CacheCleared); m_renderer = panel.TextRendererManager.GetDefault(coordSystem); m_renderer.CacheCleared += new EventHandler(m_renderer_CacheCleared); }
// Vector / Coordinates System (displacement) public static Point3d Trans(this Point3d pt, Vector3d from, CoordSystem to, int disp) { double[] result = new double[] { 0, 0, 0 }; acedTrans(pt.ToArray(), new ResultBuffer(new TypedValue(5009, new Point3d(from.X, from.Y, from.Z))).UnmanagedObject, new ResultBuffer(new TypedValue(5003, to)).UnmanagedObject, disp, result); return(new Point3d(result)); }
// Coordinates System / Vector) public static Point3d Trans(this Point3d pt, CoordSystem from, Vector3d to) { double[] result = new double[] { 0, 0, 0 }; acedTrans(pt.ToArray(), new ResultBuffer(new TypedValue(5003, from)).UnmanagedObject, new ResultBuffer(new TypedValue(5009, new Point3d(to.X, to.Y, to.Z))).UnmanagedObject, 0, result); return(new Point3d(result)); }
// Entity / Coordinates System public static Point3d Trans(this Point3d pt, ObjectId from, CoordSystem to) { double[] result = new double[] { 0, 0, 0 }; acedTrans(pt.ToArray(), new ResultBuffer(new TypedValue(5006, from)).UnmanagedObject, new ResultBuffer(new TypedValue(5003, to)).UnmanagedObject, 0, result); return(new Point3d(result)); }
public LatLonCoord( double latitude, double longitude, double altitude, // Above Elipsoid CoordSystem elipsoid) { Latitude = latitude; Longitude = longitude; Altitude = altitude; Elipsoid = elipsoid; }
public ILShapeLabel(ILPanel panel) : base(panel, null, Color.Black) { m_panel = panel; m_coordSystem = CoordSystem.Screen; m_anchor = new PointF(.5f,.5f); // TickLabelAlign.center | TickLabelAlign.vertCenter; m_fringeOffsets = new int[,]{ { -1, -1 }, { -1, 0 }, { -1, 1 }, { 0, -1 }, { 0, 1 }, { 1, -1 }, { 1, 0 }, { 1, 1 }}; m_fringeOffsets = m_fringeOffsets.T; }
public ILShapeLabel(ILPanel panel) : base(panel, null, Color.Black) { m_panel = panel; m_coordSystem = CoordSystem.Screen; m_anchor = new PointF(.5f, .5f); // TickLabelAlign.center | TickLabelAlign.vertCenter; m_fringeOffsets = new int[, ] { { -1, -1 }, { -1, 0 }, { -1, 1 }, { 0, -1 }, { 0, 1 }, { 1, -1 }, { 1, 0 }, { 1, 1 } }; m_fringeOffsets = m_fringeOffsets.T; }
// Update is called once per frame void Update() { m_Vector = CoordSystem.SphericalToCartesian(m_SphVector); //on fait tourner l'objet transform.Rotate(m_Vector.normalized, m_RotAngularSpeed * Time.deltaTime, m_RelativeTo); //On dessine le vecteur de rotation switch (m_RelativeTo) { case Space.World: VectorDisplayService.Display(name + ".vector", m_Vector, transform.position, m_VectorDisplayColor, m_VectorSizeMultiplier); break; case Space.Self: VectorDisplayService.Display(name + ".vector", transform.TransformDirection(m_Vector), transform.position, m_VectorDisplayColor, m_VectorSizeMultiplier); break; } }
public Slice(ushort referenceIndex, int start, int end, bool onReverseStrand, bool isCircular, bool isTopLevel, CoordSystem coordSystem, int sequenceRegionLen, string sequenceRegionName) : base(referenceIndex, start, end) { _onReverseStrand = onReverseStrand; _isCircular = isCircular; _isTopLevel = isTopLevel; CoordinateSystem = coordSystem; _sequenceRegionLen = sequenceRegionLen; _sequenceRegionName = sequenceRegionName; _hashCode = End.GetHashCode() ^ _isCircular.GetHashCode() ^ _isTopLevel.GetHashCode() ^ _onReverseStrand.GetHashCode() ^ ReferenceIndex.GetHashCode() ^ _sequenceRegionLen.GetHashCode() ^ _sequenceRegionName.GetHashCode() ^ Start.GetHashCode(); }
/// <summary> /// [abstract] Create a new labeling element /// </summary> /// <param name="panel">panel hosting the element</param> /// <param name="font">default font for the element</param> /// <param name="color">default color for the element</param> /// <param name="coordSystem">world / screen rendering method</param> public ILLabelingElement(ILPanel panel, Font font, Color color, CoordSystem coordSystem) { if (font != null) { m_font = font; } else { m_font = new System.Drawing.Font( System.Drawing.FontFamily.GenericSansSerif, 10.0f); } m_color = color; m_orientation = TextOrientation.Horizontal; m_renderQueue = null; m_size = Size.Empty; m_expression = string.Empty; // init interpreter & renderer m_renderer = panel.TextRendererManager.GetDefault(coordSystem); m_renderer.CacheCleared += new EventHandler(m_renderer_CacheCleared); m_interpreter = new ILSimpleTexInterpreter(); }
public LatLonCoord( int latitudeDegrees, double latitudeMinutes, int longitudeDegrees, double longitudeMinutes, double altitude, // Above Elipsoid CoordSystem elipsoid) { // TODO: Calculate seconds from double minutes; See http://notinthemanual.blogspot.co.uk/2008/07/convert-nmea-latitude-longitude-to.html Latitude = (double)latitudeDegrees; if (latitudeDegrees >= 0) Latitude += (latitudeMinutes / 60D); else Latitude -= (latitudeMinutes / 60D); Longitude = (double)longitudeDegrees; if (longitudeDegrees >= 0) Longitude += (longitudeMinutes / 60D); else Longitude -= (longitudeMinutes / 60D); Altitude = altitude; Elipsoid = elipsoid; }
/// <summary> /// На сколько нужно сдвинуть <paramref name="rect"/> чтобы он вошел в this. Если размер <paramref name="rect"/> больше, чем this, то выбрасывается исключение. /// </summary> /// <param name="rect"></param> /// <returns></returns> public V2 OffsetToContain(V4 rect, CoordSystem coordSystem) { if (coordSystem != CoordSystem.BOTTOM_LEFT) { throw new Exception(); } double eps = 1E-9; if (rect.Size.X + eps > Size.X || rect.Size.Y + eps > Size.Y) { throw new Exception(); } else { var rectLeft = Math.Min(rect.Origin.X, rect.Destination.X); var rectTop = Math.Max(rect.Origin.Y, rect.Destination.Y); var rectRight = Math.Max(rect.Origin.X, rect.Destination.X); var rectBottom = Math.Min(rect.Origin.Y, rect.Destination.Y); var thisLeft = Math.Min(Origin.X, Destination.X); var thisTop = Math.Max(Origin.Y, Destination.Y); var thisRight = Math.Max(Origin.X, Destination.X); var thisBottom = Math.Min(Origin.Y, Destination.Y); var dLeft = rectLeft - thisLeft; var dTop = rectTop - thisTop; var dRight = rectRight - thisRight; var dBottom = rectBottom - thisBottom; var dx = 0D; var dy = 0D; dx = dLeft < 0 ? -dLeft : dx; dx = dRight > 0 ? -dRight : dx; dy = dTop > 0 ? -dTop : dy; dy = dBottom < 0 ? -dBottom : dy; return(new V2(dx, dy)); } }
public static LatLonCoord Convert( LatLonCoord sourceCoord, CoordSystem targetElipsoid) { if ((sourceCoord.Elipsoid == CoordSystem.WGS84) && (targetElipsoid == CoordSystem.OSGB36)) { return WGS84ToOSGB36(sourceCoord); } throw new NotImplementedException("Conversion not supported");; }
public Vector2 convertFrom2D(Vector3 otherLoc, CoordSystem otherCoordSys) { return(new Vector2( x.convertFrom(otherLoc.x, otherCoordSys.x), z.convertFrom(otherLoc.z, otherCoordSys.z))); }
/// <summary> /// 将点从一个坐标系转换到另一个坐标系 /// </summary> /// <param name="pt">点</param> /// <param name="from">源坐标系</param> /// <param name="to">目标坐标系</param> /// <returns>返回转化后的坐标</returns> public static Point3d TranslateCoordinates(this Point3d pt, CoordSystem from, CoordSystem to) { return(pt.TranslateCoordinates(from, to, 0)); }
/// <summary> /// Transforms a point from a coordinate system to another one in the specified editor. /// </summary> /// <param name="pt">The instance to which the method applies.</param> /// <param name="ed">An instance of the Editor to which the method applies.</param> /// <param name="from">The origin coordinate system.</param> /// <param name="to">The target coordinate system.</param> /// <returns>The corresponding 3d point.</returns> /// <exception cref="Autodesk.AutoCAD.Runtime.Exception"> /// eInvalidInput is thrown if CoordSystem.PSDCS is used with other than CoordSystem.DCS.</exception> public static Point3d Trans(this Point3d pt, Editor ed, CoordSystem from, CoordSystem to) { Matrix3d mat = new Matrix3d(); switch (from) { case CoordSystem.WCS: switch (to) { case CoordSystem.UCS: mat = ed.WCS2UCS(); break; case CoordSystem.DCS: mat = ed.WCS2DCS(); break; case CoordSystem.PSDCS: throw new AcRx.Exception( AcRx.ErrorStatus.InvalidInput, "To be used only with DCS"); default: mat = Matrix3d.Identity; break; } break; case CoordSystem.UCS: switch (to) { case CoordSystem.WCS: mat = ed.UCS2WCS(); break; case CoordSystem.DCS: mat = ed.UCS2WCS() * ed.WCS2DCS(); break; case CoordSystem.PSDCS: throw new AcRx.Exception( AcRx.ErrorStatus.InvalidInput, "To be used only with DCS"); default: mat = Matrix3d.Identity; break; } break; case CoordSystem.DCS: switch (to) { case CoordSystem.WCS: mat = ed.DCS2WCS(); break; case CoordSystem.UCS: mat = ed.DCS2WCS() * ed.WCS2UCS(); break; case CoordSystem.PSDCS: mat = ed.DCS2PSDCS(); break; default: mat = Matrix3d.Identity; break; } break; case CoordSystem.PSDCS: switch (to) { case CoordSystem.WCS: throw new AcRx.Exception( AcRx.ErrorStatus.InvalidInput, "To be used only with DCS"); case CoordSystem.UCS: throw new AcRx.Exception( AcRx.ErrorStatus.InvalidInput, "To be used only with DCS"); case CoordSystem.DCS: mat = ed.PSDCS2DCS(); break; default: mat = Matrix3d.Identity; break; } break; } return pt.TransformBy(mat); }
/// <summary> /// Transforms a point from a coordinate system to another one in the current editor. /// </summary> /// <param name="pt">The instance to which the method applies.</param> /// <param name="from">The origin coordinate system.</param> /// <param name="to">The target coordinate system.</param> /// <returns>The corresponding 3d point.</returns> /// <exception cref="Autodesk.AutoCAD.Runtime.Exception"> /// eInvalidInput is thrown if CoordSystem.PSDCS is used with other than CoordSystem.DCS.</exception> public static Point3d Trans(this Point3d pt, CoordSystem from, CoordSystem to) { Editor ed = Application.DocumentManager.MdiActiveDocument.Editor; return pt.Trans(ed, from, to); }
public static extern int HIMC_CircAbs(int nCtrlID, int nGroupID, CenterPosition center_pos, NormalVector normal_vector, int turns, CoordPosition target_pos, MotionProfile motion_profile, CoordSystem coord_sys, MotionBufferMode buf_mode, MotionTransitionMode trans_mode, double dTransPar);
public static extern int HIMC_LinRel(int nCtrlID, int nGroupID, CoordPosition relative_dist, MotionProfile motion_profile, CoordSystem coord_sys, MotionBufferMode buf_mode, MotionTransitionMode trans_mode, double dTransPar);
public static extern int HIMC_LinAbs(int nCtrlID, int nGroupID, CoordPosition target_pos, MotionProfile motion_profile, CoordSystem coord_sys, MotionBufferMode buf_mode, MotionTransitionMode trans_mode, double dTransPar);
//将实体从装配坐标系acsFrom移位到装配坐标系acsTo public bool TransToAcs(CoordSystem acsFrom, CoordSystem acsTo) { return(false); }
/// <summary> /// 将该实体定义克隆并转换至装配位置 /// </summary> /// <param name="acs">该实体在装配环境下的装配坐标系</param> /// <returns>装配环境下的实体定义</returns> public TidSolidBody CloneToACS(CoordSystem acs) { return(this); }
void Awake() { Axis = this; }
/// <summary> /// Transforms a point from a coordinate system to another one in the current editor. /// </summary> /// <param name="pt">The instance to which the method applies.</param> /// <param name="from">The origin coordinate system.</param> /// <param name="to">The target coordinate system.</param> /// <returns>The corresponding 3d point.</returns> /// <exception cref="Runtime.Exception"> /// eInvalidInput is thrown if CoordSystem.PSDCS is used with other than CoordSystem.DCS.</exception> public static Point3d Trans(this Point3d pt, CoordSystem from, CoordSystem to) { var ed = Application.DocumentManager.MdiActiveDocument.Editor; return(pt.Trans(ed, from, to)); }
/// <summary> /// Transforms a point from a coordinate system to another one in the specified editor. /// </summary> /// <param name="pt">The instance to which the method applies.</param> /// <param name="ed">An instance of the Editor to which the method applies.</param> /// <param name="from">The origin coordinate system.</param> /// <param name="to">The target coordinate system.</param> /// <returns>The corresponding 3d point.</returns> /// <exception cref="Runtime.Exception"> /// eInvalidInput is thrown if CoordSystem.PSDCS is used with other than CoordSystem.DCS.</exception> public static Point3d Trans(this Point3d pt, Editor ed, CoordSystem from, CoordSystem to) { var mat = new Matrix3d(); switch (from) { case CoordSystem.WCS: switch (to) { case CoordSystem.UCS: mat = ed.WCS2UCS(); break; case CoordSystem.DCS: mat = ed.WCS2DCS(); break; case CoordSystem.PSDCS: throw new AcRx.Exception( AcRx.ErrorStatus.InvalidInput, "To be used only with DCS"); default: mat = Matrix3d.Identity; break; } break; case CoordSystem.UCS: switch (to) { case CoordSystem.WCS: mat = ed.UCS2WCS(); break; case CoordSystem.DCS: mat = ed.UCS2WCS() * ed.WCS2DCS(); break; case CoordSystem.PSDCS: throw new AcRx.Exception( AcRx.ErrorStatus.InvalidInput, "To be used only with DCS"); default: mat = Matrix3d.Identity; break; } break; case CoordSystem.DCS: switch (to) { case CoordSystem.WCS: mat = ed.DCS2WCS(); break; case CoordSystem.UCS: mat = ed.DCS2WCS() * ed.WCS2UCS(); break; case CoordSystem.PSDCS: mat = ed.DCS2PSDCS(); break; default: mat = Matrix3d.Identity; break; } break; case CoordSystem.PSDCS: switch (to) { case CoordSystem.WCS: throw new AcRx.Exception( AcRx.ErrorStatus.InvalidInput, "To be used only with DCS"); case CoordSystem.UCS: throw new AcRx.Exception( AcRx.ErrorStatus.InvalidInput, "To be used only with DCS"); case CoordSystem.DCS: mat = ed.PSDCS2DCS(); break; default: mat = Matrix3d.Identity; break; } break; } return(pt.TransformBy(mat)); }
/// <summary> /// Create the default instance of IILTextRenderer for /// the current graphics device and a coord system /// </summary> /// <param name="coords">coord system, the renderer is /// specialized and the default renderer for</param> /// <returns>default IILTextRenderer object</returns> public IILTextRenderer GetDefault(CoordSystem coords) { string key = (coords == CoordSystem.World3D) ? m_defaultRendererWorld : m_defaultRendererScreen; if (m_rendererCache.ContainsKey(key) && m_rendererCache[key] != null) return m_rendererCache[key]; // must create a new instance IILTextRenderer ret; switch (coords) { case CoordSystem.World3D: ret = CreateInstance(m_defaultRendererWorld,null); break; default: ret = CreateInstance(m_defaultRendererScreen,null); break; } m_rendererCache[key] = ret; return ret; }
public CoordSystemAttribute(CoordSystem coordSystem) => this.coordSystem = coordSystem;
/// <summary> /// [abstract] Create a new labeling element /// </summary> /// <param name="panel">panel hosting the element</param> /// <param name="font">default font for the element</param> /// <param name="color">default color for the element</param> /// <param name="coordSystem">world / screen rendering method</param> public ILLabelingElement (ILPanel panel, Font font, Color color, CoordSystem coordSystem) { if (font != null) { m_font = font; } else { m_font = new System.Drawing.Font( System.Drawing.FontFamily.GenericSansSerif,10.0f); } m_color = color; m_orientation = TextOrientation.Horizontal; m_renderQueue = null; m_size = Size.Empty; m_expression = string.Empty; // init interpreter & renderer m_renderer = panel.TextRendererManager.GetDefault(coordSystem); m_renderer.CacheCleared += new EventHandler(m_renderer_CacheCleared); m_interpreter = new ILSimpleTexInterpreter(); }