void ChangeHeightType(XYPlotLayerSizeType newType)
        {
            XYPlotLayerSizeType oldType = m_HeightType;

            if (newType == oldType)
            {
                return;
            }
            double oldSize = m_Layer.HeightToPointUnits(m_Height, oldType);

            m_Height     = m_Layer.HeightToUserUnits(oldSize, newType);
            m_HeightType = newType;
            InitializeHeightValue();
        }
        void ChangeWidthType(XYPlotLayerSizeType newType)
        {
            XYPlotLayerSizeType oldType = m_WidthType;

            if (newType == oldType)
            {
                return;
            }
            double oldSize = m_Layer.WidthToPointUnits(m_Width, oldType);

            m_Width     = m_Layer.WidthToUserUnits(oldSize, newType);
            m_WidthType = newType;
            InitializeWidthValue();
        }
        public void CopyFrom(XYPlotLayerPositionAndSize from)
        {
            this._layerXPosition     = from._layerXPosition;
            this._layerXPositionType = from._layerXPositionType;
            this._layerYPosition     = from._layerYPosition;
            this._layerYPositionType = from._layerYPositionType;

            this._layerWidth      = from._layerWidth;
            this._layerWidthType  = from._layerWidthType;
            this._layerHeight     = from._layerHeight;
            this._layerHeightType = from._layerHeightType;

            this._layerAngle = from._layerAngle;
            this._layerScale = from._layerScale;
        }
        /// <summary>
        /// Get the list of size types in dependence of whether or not we have a linked layer.
        /// </summary>
        /// <returns>List of possible size types.</returns>
        SelectableListNodeList GetSizeTypeList()
        {
            SelectableListNodeList list  = new SelectableListNodeList();
            XYPlotLayerSizeType    toadd = XYPlotLayerSizeType.AbsoluteValue;

            list.Add(new SelectableListNode(Current.Gui.GetUserFriendlyName(toadd), toadd, false));
            toadd = XYPlotLayerSizeType.RelativeToGraphDocument;
            list.Add(new SelectableListNode(Current.Gui.GetUserFriendlyName(toadd), toadd, false));
            if (null != m_LinkedLayer)
            {
                toadd = XYPlotLayerSizeType.RelativeToLinkedLayer;
                list.Add(new SelectableListNode(Current.Gui.GetUserFriendlyName(toadd), toadd, false));
            }
            return(list);
        }
Exemple #5
0
            public XYPlotLayerPositionAndSize_V0(XYPlotLayerSizeType xzt, double xs, XYPlotLayerSizeType yzt, double ys, XYPlotLayerPositionType xpt, double xp, XYPlotLayerPositionType ypt, double yp, double rotation, double scale)
            {
                _layerWidthType  = xzt;
                _layerWidth      = xs;
                _layerHeightType = yzt;
                _layerHeight     = ys;

                _layerXPositionType = xpt;
                _layerXPosition     = xp;
                _layerYPositionType = ypt;
                _layerYPosition     = yp;

                _layerAngle = rotation;
                _layerScale = scale;
            }
        public void SetElements(bool bInit)
        {
            if (bInit)
            {
                m_Height          = m_Layer.UserHeight;
                m_Width           = m_Layer.UserWidth;
                m_Left            = m_Layer.UserXPosition;
                m_Top             = m_Layer.UserYPosition;
                m_Rotation        = m_Layer.Rotation;
                m_Scale           = m_Layer.Scale;
                m_ClipDataToFrame = m_Layer.ClipDataToFrame == LayerDataClipping.StrictToCS;

                m_LeftType    = m_Layer.UserXPositionType;
                m_TopType     = m_Layer.UserYPositionType;
                m_HeightType  = m_Layer.UserHeightType;
                m_WidthType   = m_Layer.UserWidthType;
                m_LinkedLayer = m_Layer.LinkedLayer;


                m_XAxisLink = new AxisLinkController(m_Layer, true);
                m_YAxisLink = new AxisLinkController(m_Layer, false);
            }

            if (View != null)
            {
                InitializeWidthValue();
                InitializeHeightValue();

                InitializeLeftValue();
                InitializeTopValue();

                View.InitializeRotation((float)m_Rotation);
                View.InitializeScale(Serialization.GUIConversion.GetPercentMeasureText(m_Scale));
                View.InitializeClipDataToFrame(m_ClipDataToFrame);

                InitializePositionTypes();
                InitializeSizeTypes();
                InitializeLinkedAxisChoices();

                // initialize the axis link properties
                m_XAxisLink.View = View.GetXAxisLink();
                m_YAxisLink.View = View.GetYAxisLink();
            }
        }
    /// <summary>
    /// Convert the heigth in points (1/72 inch) to user units of the type <paramref name="heighttype_to_convert_to"/>.
    /// </summary>
    /// <param name="height">The height value to convert (in point units).</param>
    /// <param name="heighttype_to_convert_to">The user unit type to convert to.</param>
    /// <returns>The value of the height in user units.</returns>
    public double HeightToUserUnits(double height, XYPlotLayerSizeType heighttype_to_convert_to)
    {

      switch (heighttype_to_convert_to)
      {
        case XYPlotLayerSizeType.RelativeToGraphDocument:
          height /= PrintableGraphSize.Height;
          break;
        case XYPlotLayerSizeType.RelativeToLinkedLayer:
          if (null != LinkedLayer)
            height /= LinkedLayer.Size.Height;
          break;
      }
      return height;
    }
    /// <summary>
    /// Convert the width in points (1/72 inch) to user units of the type <paramref name="widthtype_to_convert_to"/>.
    /// </summary>
    /// <param name="width">The height value to convert (in point units).</param>
    /// <param name="widthtype_to_convert_to">The user unit type to convert to.</param>
    /// <returns>The value of the width in user units.</returns>
    public double WidthToUserUnits(double width, XYPlotLayerSizeType widthtype_to_convert_to)
    {

      switch (widthtype_to_convert_to)
      {
        case XYPlotLayerSizeType.RelativeToGraphDocument:
          width /= PrintableGraphSize.Width;
          break;
        case XYPlotLayerSizeType.RelativeToLinkedLayer:
          if (null != LinkedLayer)
            width /= LinkedLayer.Size.Width;
          break;
      }
      return width;
    }
    public void SetSize(double width, XYPlotLayerSizeType widthtype, double height, XYPlotLayerSizeType heighttype)
    {
      this._location.Width = width;
      this._location.WidthType = widthtype;
      this._location.Height = height;
      this._location.HeightType = heighttype;

      CalculateCachedSize();
    }
    public void CopyFrom(XYPlotLayerPositionAndSize from)
    {
      this._layerXPosition = from._layerXPosition;
      this._layerXPositionType = from._layerXPositionType;
      this._layerYPosition = from._layerYPosition;
      this._layerYPositionType = from._layerYPositionType;

      this._layerWidth = from._layerWidth;
      this._layerWidthType = from._layerWidthType;
      this._layerHeight = from._layerHeight;
      this._layerHeightType = from._layerHeightType;

      this._layerAngle = from._layerAngle;
      this._layerScale = from._layerScale;
    }
    void ChangeHeightType(XYPlotLayerSizeType newType)
    {
      XYPlotLayerSizeType oldType = m_HeightType;
      if (newType == oldType)
        return;
      double oldSize = m_Layer.HeightToPointUnits(m_Height, oldType);
      m_Height = m_Layer.HeightToUserUnits(oldSize, newType);
      m_HeightType = newType;
      InitializeHeightValue();

    }
    void ChangeWidthType(XYPlotLayerSizeType newType)
    {
      XYPlotLayerSizeType oldType = m_WidthType;
      if (newType == oldType)
        return;
      double oldSize = m_Layer.WidthToPointUnits(m_Width, oldType);
      m_Width = m_Layer.WidthToUserUnits(oldSize, newType);
      m_WidthType = newType;
      InitializeWidthValue();

    }
    public void SetElements(bool bInit)
    {


      if(bInit)
      {
        m_Height    = m_Layer.UserHeight;
        m_Width     = m_Layer.UserWidth;
        m_Left      = m_Layer.UserXPosition;
        m_Top       = m_Layer.UserYPosition;
        m_Rotation  = m_Layer.Rotation;
        m_Scale     = m_Layer.Scale;
        m_ClipDataToFrame = m_Layer.ClipDataToFrame == LayerDataClipping.StrictToCS;

        m_LeftType = m_Layer.UserXPositionType;
        m_TopType  = m_Layer.UserYPositionType;
        m_HeightType = m_Layer.UserHeightType;
        m_WidthType = m_Layer.UserWidthType;
        m_LinkedLayer = m_Layer.LinkedLayer;


        m_XAxisLink = new AxisLinkController(m_Layer,true);
        m_YAxisLink = new AxisLinkController(m_Layer,false);
      }

      if(View!=null)
      {

        InitializeWidthValue();
        InitializeHeightValue();

        InitializeLeftValue();
        InitializeTopValue();

        View.InitializeRotation((float)m_Rotation);
        View.InitializeScale(Serialization.GUIConversion.GetPercentMeasureText(m_Scale));
        View.InitializeClipDataToFrame(m_ClipDataToFrame);

        InitializePositionTypes();
        InitializeSizeTypes();
        InitializeLinkedAxisChoices();

        // initialize the axis link properties
        m_XAxisLink.View = View.GetXAxisLink();
        m_YAxisLink.View = View.GetYAxisLink();

      }

    }