public CSPlaneID(CSPlaneID from) { this._perpendicularAxisNumber = from._perpendicularAxisNumber; this._logicalValue = from._logicalValue; this._usePhysicalValue = from._usePhysicalValue; this._physicalValue = from._physicalValue; }
public override bool Equals(object obj) { if (!(obj is CSPlaneID)) { return(false); } CSPlaneID from = (CSPlaneID)obj; bool result = true; result &= this._perpendicularAxisNumber == from._perpendicularAxisNumber; result &= this._usePhysicalValue == from._usePhysicalValue; if (result == false) { return(result); } if (_usePhysicalValue) { return(this._physicalValue == from._physicalValue); } else { return(this._logicalValue == from._logicalValue); } }
/// <summary> /// Gets the two planes parallel to the provided axis that are oriented to the main coordinate system axes. /// </summary> /// <param name="id">The line identifier.</param> /// <returns></returns> public static IEnumerable <CSPlaneID> GetPlanesParallelToAxis3D(CSLineID id) { switch (id.ParallelAxisNumber) { case 0: yield return(id.UsePhysicalValueOtherFirst ? CSPlaneID.FromPhysicalVariant(1, id.PhysicalValueOtherFirst) : new CSPlaneID(1, id.LogicalValueOtherFirst)); yield return(id.UsePhysicalValueOtherSecond ? CSPlaneID.FromPhysicalVariant(2, id.PhysicalValueOtherSecond) : new CSPlaneID(2, id.LogicalValueOtherSecond)); break; case 1: yield return(id.UsePhysicalValueOtherFirst ? CSPlaneID.FromPhysicalVariant(0, id.PhysicalValueOtherFirst) : new CSPlaneID(0, id.LogicalValueOtherFirst)); yield return(id.UsePhysicalValueOtherSecond ? CSPlaneID.FromPhysicalVariant(2, id.PhysicalValueOtherSecond) : new CSPlaneID(2, id.LogicalValueOtherSecond)); break; case 2: yield return(id.UsePhysicalValueOtherFirst ? CSPlaneID.FromPhysicalVariant(0, id.PhysicalValueOtherFirst) : new CSPlaneID(0, id.LogicalValueOtherFirst)); yield return(id.UsePhysicalValueOtherSecond ? CSPlaneID.FromPhysicalVariant(1, id.PhysicalValueOtherSecond) : new CSPlaneID(1, id.LogicalValueOtherSecond)); break; default: throw new ArgumentOutOfRangeException(nameof(id.ParallelAxisNumber)); } }
public void CopyFrom(CSPlaneInformation from) { if (object.ReferenceEquals(this, from)) return; this._identifier = from._identifier; CopyWithoutIdentifierFrom(from); }
public void CopyFrom(CSPlaneInformation from) { if (object.ReferenceEquals(this, from)) { return; } _identifier = from._identifier; CopyWithoutIdentifierFrom(from); }
public virtual void Serialize(object obj, Altaxo.Serialization.Xml.IXmlSerializationInfo info) { CSPlaneID s = (CSPlaneID)obj; info.AddValue("Axis", s._perpendicularAxisNumber); info.AddValue("Logical", s._logicalValue); info.AddValue("UsePhysical", s._usePhysicalValue); if (s._usePhysicalValue) { info.AddValue("Physical", (object)s._physicalValue); } }
public static CSPlaneID GetPlaneParallelToAxis2D(CSLineID id) { switch (id.ParallelAxisNumber) { case 0: return(id.UsePhysicalValueOtherFirst ? CSPlaneID.FromPhysicalVariant(1, id.PhysicalValueOtherFirst) : new CSPlaneID(1, id.LogicalValueOtherFirst)); case 1: return(id.UsePhysicalValueOtherFirst ? CSPlaneID.FromPhysicalVariant(0, id.PhysicalValueOtherFirst) : new CSPlaneID(0, id.LogicalValueOtherFirst)); default: throw new ArgumentOutOfRangeException(nameof(id.ParallelAxisNumber)); } }
protected virtual CSPlaneID SDeserialize(object o, Altaxo.Serialization.Xml.IXmlDeserializationInfo info, object parent) { CSPlaneID s = (o == null ? new CSPlaneID() : (CSPlaneID)o); s._perpendicularAxisNumber = info.GetInt32("Axis"); s._logicalValue = info.GetDouble("Logical"); s._usePhysicalValue = info.GetBoolean("UsePhysical"); if (s._usePhysicalValue) { s._physicalValue = (AltaxoVariant)info.GetValue("Physical", s); } return(s); }
public static CSPlaneID FromPhysicalValue(int perpendicularAxisNumber, double physicalValue) { if (double.IsNaN(physicalValue)) { throw new ArgumentException("You can not set physical values that return false when compared to itself, value is: " + physicalValue.ToString()); } CSPlaneID id = new CSPlaneID(); id._perpendicularAxisNumber = perpendicularAxisNumber; id._physicalValue = physicalValue; id._logicalValue = double.NaN; id._usePhysicalValue = true; return(id); }
/// <summary> /// Draws an isoline on a plane beginning from r0 to r1. For r0,r1 either ry0,ry1 is used (if it is an x-axis), /// otherwise rx0,rx1 is used. The other parameter pair is not used. /// </summary> /// <param name="path">Graphics path to fill with the isoline.</param> /// <param name="r0">Logical coordinate of the start point.</param> /// <param name="r1">Logical coordinate of the end point.</param> /// <param name="id">The axis to end the isoline.</param> public virtual void GetIsolineOnPlane(CSPlaneID id, Logical3D r0, Logical3D r1, IPolylineD3D path) { if (id.PerpendicularAxisNumber == 0) { path = GetIsoline(new Logical3D(id.LogicalValue, r0.RY, r0.RZ), new Logical3D(id.LogicalValue, r1.RY, r1.RZ)); } else if (id.PerpendicularAxisNumber == 1) { path = GetIsoline(new Logical3D(r0.RX, id.LogicalValue, r0.RZ), new Logical3D(r1.RX, id.LogicalValue, r1.RZ)); } else { path = GetIsoline(new Logical3D(r0.RX, r0.RY, id.LogicalValue), new Logical3D(r1.RX, r1.RY, id.LogicalValue)); } }
/// <summary> /// Gets an isoline beginning from a given point to the axis. /// </summary> /// <param name="path">Graphics path to fill with the isoline.</param> /// <param name="r">Logical coordinate of the start point.</param> /// <param name="id">The logical plane to end the isoline.</param> public virtual void GetIsolineFromPointToPlane(Logical3D r, CSPlaneID id, out IPolylineD3D path) { if (id.PerpendicularAxisNumber == 0) { path = GetIsoline(r, new Logical3D(id.LogicalValue, r.RY, r.RZ)); } else if (id.PerpendicularAxisNumber == 1) { path = GetIsoline(r, new Logical3D(r.RX, id.LogicalValue, r.RZ)); } else { path = GetIsoline(r, new Logical3D(r.RX, r.RY, id.LogicalValue)); } }
public void CopyFrom(CSPlaneInformation from) { this._identifier = from._identifier; CopyWithoutIdentifierFrom(from); }
public void EhView_AttachedAxisChanged(ListNode newValue) { _attachedEdge = ((CSPlaneID)newValue.Item); }
public static CSPlaneID FromPhysicalVariant(int perpendicularAxisNumber, AltaxoVariant physicalValue) { if (!(physicalValue == physicalValue)) throw new ArgumentException("You can not set physical values that return false when compared to itself, value is: " + physicalValue.ToString()); CSPlaneID id = new CSPlaneID(); id._perpendicularAxisNumber = perpendicularAxisNumber; id._physicalValue = physicalValue; id._logicalValue = double.NaN; id._usePhysicalValue = true; return id; }
public CSPlaneInformation(CSPlaneID identifier) { _identifier = identifier; }
/// <summary> /// Gets the name of the provided plane. /// </summary> /// <param name="planeId">The plane identifier.</param> /// <returns>The name of the provided plane.</returns> public abstract string GetNameOfPlane(CSPlaneID planeId);
LayerController(XYPlotLayer layer, string currentPage, int axisScaleIdx, CSLineID id) { _originalDoc = layer; _doc = (XYPlotLayer)layer.Clone(); _docSuspendLock = _doc.BeginUpdate(); SetCoordinateSystemDependentObjects(id); _currentScale = axisScaleIdx; _currentAxisID = id; _currentPlaneID = CSPlaneID.Front; _currentPageName = currentPage; if (null != View) SetViewElements(); }
public void EhView_SecondChoiceChanged(int index, string item) { if (!ApplyCurrentController(false)) return; if (_primaryChoice == TabType.Scales) { _currentScale = index; } else if (_primaryChoice == TabType.Styles) { _currentAxisID = _axisStyleInfoSortedByName[index].Identifier; } else if (_primaryChoice == TabType.Planes) { _currentPlaneID = _planeIdentifier[index]; } SetCurrentTabController(false); }
public PointD3D GetPointOnPlane(CSPlaneID id, Logical3D r) { PointD3D result; if (id.PerpendicularAxisNumber == 0) LogicalToLayerCoordinates(new Logical3D(id.LogicalValue, r.RY, r.RZ), out result); else if (id.PerpendicularAxisNumber == 1) LogicalToLayerCoordinates(new Logical3D(r.RX, id.LogicalValue, r.RZ), out result); else LogicalToLayerCoordinates(new Logical3D(r.RX, r.RY, id.LogicalValue), out result); return result; }
public CSPlaneID UpdateCSPlaneID(CSPlaneID id) { throw new NotImplementedException(); }
public PointD3D GetPointOnPlane(CSPlaneID id, double logicalFirstOther, double logicalSecondOther) { PointD3D result; if (id.PerpendicularAxisNumber == 0) LogicalToLayerCoordinates(new Logical3D(id.LogicalValue, logicalFirstOther, logicalSecondOther), out result); else if (id.PerpendicularAxisNumber == 1) LogicalToLayerCoordinates(new Logical3D(logicalFirstOther, id.LogicalValue, logicalSecondOther), out result); else LogicalToLayerCoordinates(new Logical3D(logicalFirstOther, logicalSecondOther, id.LogicalValue), out result); return result; }
public object Deserialize(object o, Altaxo.Serialization.Xml.IXmlDeserializationInfo info, object parent) { CSPlaneID s = SDeserialize(o, info, parent); return(s); }
public CSPlaneInformation GetPlaneInformation(CSPlaneID planeID) { return new CSPlaneInformation(planeID) { Name = GetNameOfPlane(planeID) }; }
public UseDocument UseDocumentCopy { set { _useDocumentCopy = value; } } // not used here void Initialize(bool bInit) { if(bInit) { _font = _doc.Font; _independentColor = _doc.IndependentColor; _color = _doc.Color; _horizontalAlignment = _doc.HorizontalAlignment; _verticalAlignment = _doc.VerticalAlignment; _attachToEdge = _doc.AttachedAxis!=null; _attachedEdge = _doc.AttachedAxis; _xOffset = _doc.XOffset; _yOffset = _doc.YOffset; _labelColumn = _doc.LabelColumn; _backgroundStyle = _doc.BackgroundStyle; } if(null!=View) { View.Font_Initialize(_font); View.IndependentColor_Initialize(_independentColor); View.Color_Initialize(_color); View.HorizontalAlignment_Initialize(System.Enum.GetNames(typeof(System.Drawing.StringAlignment)),System.Enum.GetName(typeof(System.Drawing.StringAlignment),_horizontalAlignment)); View.VerticalAlignment_Initialize(System.Enum.GetNames(typeof(System.Drawing.StringAlignment)),System.Enum.GetName(typeof(System.Drawing.StringAlignment),_verticalAlignment)); View.AttachToAxis_Initialize(_attachToEdge); SetAttachmentDirection(); View.Rotation = (float)_doc.Rotation; View.XOffset_Initialize(Serialization.NumberConversion.ToString(_xOffset*100)); View.YOffset_Initialize(Serialization.NumberConversion.ToString(_yOffset*100)); View.Background = _backgroundStyle; InitializeLabelColumnText(); } }
/// <summary> /// Updates the logical value of a plane id in case it uses a physical value. /// </summary> /// <param name="id">The plane identifier</param> public CSPlaneID UpdateCSPlaneID(CSPlaneID id) { if (id.UsePhysicalValue) { double l = this.Scales[id.PerpendicularAxisNumber].PhysicalVariantToNormal(id.PhysicalValue); id = id.WithLogicalValue(l); } return id; }