Ejemplo n.º 1
0
 public AxisElement CreateAxisElement(ScaleLevel scale, int interval, string format, DayOfWeek? firstDay)
 {
     AxisElement element = new AxisElement(this, scale, interval, format, firstDay);
     element.ViewStartDate = _startDate;
     _axes.Add(element);
     AddElement(element, _head);
     return element;
 }
Ejemplo n.º 2
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="anchor">the edges of the viewport to which a SimpleUIRect is bound and determines how it is resized with its parent.
        /// <para>something like AnchorStyles.Left | AnchorStyles.Bottom.</para></param>
        /// <param name="margin">the space between viewport and SimpleRect.</param>
        /// <param name="size">Stores width when <see cref="OpenGLUIRect.Anchor"/>.Left & <see cref="OpenGLUIRect.Anchor"/>.Right is <see cref="OpenGLUIRect.Anchor"/>.None.
        /// <para> and height when <see cref="OpenGLUIRect.Anchor"/>.Top & <see cref="OpenGLUIRect.Anchor"/>.Bottom is <see cref="OpenGLUIRect.Anchor"/>.None.</para></param>
        /// <param name="zNear"></param>
        /// <param name="zFar"></param>
        /// <param name="rectColor">default color is red.</param>
        public SimpleUIAxis(IUILayoutParam param, GLColor rectColor = null,
            float radius = 0.3f, float axisLength = 10, int faceCount = 10)
        {
            // 把AxiesElement缩放到恰好放进此UI
            radius = radius / axisLength / 2;
            axisLength = 0.5f;
            this.axisElement = new AxisElement(radius, axisLength, faceCount);

            IUILayout layout = this;
            layout.Param = param;
        }
Ejemplo n.º 3
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="anchor">the edges of the viewport to which a SimpleUIRect is bound and determines how it is resized with its parent.
        /// <para>something like AnchorStyles.Left | AnchorStyles.Bottom.</para></param>
        /// <param name="margin">the space between viewport and SimpleRect.</param>
        /// <param name="size">Stores width when <see cref="OpenGLUIRect.Anchor"/>.Left & <see cref="OpenGLUIRect.Anchor"/>.Right is <see cref="OpenGLUIRect.Anchor"/>.None.
        /// <para> and height when <see cref="OpenGLUIRect.Anchor"/>.Top & <see cref="OpenGLUIRect.Anchor"/>.Bottom is <see cref="OpenGLUIRect.Anchor"/>.None.</para></param>
        /// <param name="zNear"></param>
        /// <param name="zFar"></param>
        /// <param name="rectColor">default color is red.</param>
        public SimpleUIAxis(IUILayoutParam param, GLColor rectColor = null,
                            float radius = 0.3f, float axisLength = 10, int faceCount = 10)
        {
            // 把AxiesElement缩放到恰好放进此UI
            radius           = radius / axisLength / 2;
            axisLength       = 0.5f;
            this.axisElement = new AxisElement(radius, axisLength, faceCount);

            IUILayout layout = this;

            layout.Param = param;
        }
Ejemplo n.º 4
0
        public FormSimpleUICube()
        {
            InitializeComponent();

            //if (CameraDictionary.Instance.ContainsKey(this.GetType().Name))
            //{
            //    this.camera = CameraDictionary.Instance[this.GetType().Name];
            //}
            //else
            {
                this.camera = new Camera(CameraType.Ortho, this.glCanvas1.Width, this.glCanvas1.Height);
                //CameraDictionary.Instance.Add(this.GetType().Name, this.camera);
            }

            satelliteRoration = new SatelliteRotator(camera);

            Padding padding = new System.Windows.Forms.Padding(038, 038, 038, 038);
            Size    size    = new Size(100, 100);
            //Size size = new Size(5, 5);
            IUILayoutParam param;

            param             = new IUILayoutParam(AnchorStyles.Left | AnchorStyles.Bottom, padding, size);
            uiLeftBottomRect  = new SimpleUICube(param);
            param             = new IUILayoutParam(AnchorStyles.Left | AnchorStyles.Top, padding, size);
            uiLeftTopRect     = new SimpleUICube(param);
            param             = new IUILayoutParam(AnchorStyles.Right | AnchorStyles.Bottom, padding, size);
            uiRightBottomRect = new SimpleUICube(param);
            param             = new IUILayoutParam(AnchorStyles.Right | AnchorStyles.Top, padding, size);
            uiRightTopRect    = new SimpleUICube(param);

            uiLeftBottomRect.Initialize();
            uiLeftTopRect.Initialize();
            uiRightBottomRect.Initialize();
            uiRightTopRect.Initialize();

            axisElement = new AxisElement();
            axisElement.Initialize();
            axisElement.BeforeRendering += axisElement_BeforeRendering;
            axisElement.AfterRendering  += axisElement_AfterRendering;

            this.glCanvas1.MouseWheel += glCanvas1_MouseWheel;
            this.glCanvas1.KeyPress   += glCanvas1_KeyPress;
            this.glCanvas1.MouseDown  += glCanvas1_MouseDown;
            this.glCanvas1.MouseMove  += glCanvas1_MouseMove;
            this.glCanvas1.MouseUp    += glCanvas1_MouseUp;
            this.glCanvas1.OpenGLDraw += glCanvas1_OpenGLDraw;
            this.glCanvas1.Resize     += glCanvas1_Resize;
        }
Ejemplo n.º 5
0
        public FormDebugging()
        {
            InitializeComponent();

            //if (CameraDictionary.Instance.ContainsKey(this.GetType().Name))
            //{
            //    this.camera = CameraDictionary.Instance[this.GetType().Name];
            //}
            //else
            {
                this.camera = new ScientificCamera(CameraTypes.Ortho, this.glCanvas1.Width, this.glCanvas1.Height);
                //CameraDictionary.Instance.Add(this.GetType().Name, this.camera);
            }

            satelliteRoration = new SatelliteRotator(camera);

            Padding        padding = new System.Windows.Forms.Padding(10, 10, 10, 10);
            Size           size    = new Size(100, 100);
            IUILayoutParam param;

            param                = new IUILayoutParam(AnchorStyles.Left | AnchorStyles.Bottom | AnchorStyles.Right, padding, size);
            uiLeftBottomRect     = new SimpleUIRect(param);
            legacyLeftBottomRect = new LegacySimpleUIRect(param, new Objects.GLColor(1, 1, 1, 1));
            param                = new IUILayoutParam(AnchorStyles.Left | AnchorStyles.Bottom, padding, size);
            uiLeftBottomAxis     = new SimpleUIAxis(param);

            uiLeftBottomRect.Initialize();
            legacyLeftBottomRect.Initialize();
            uiLeftBottomAxis.Initialize();

            legacyLeftBottomRect.BeforeRendering += legacyUIRect_BeforeRendering;
            legacyLeftBottomRect.AfterRendering  += legacyUIRect_AfterRendering;

            axisElement = new AxisElement();
            axisElement.Initialize();
            axisElement.BeforeRendering += axisElement_BeforeRendering;
            axisElement.AfterRendering  += axisElement_AfterRendering;

            this.glCanvas1.MouseWheel += glCanvas1_MouseWheel;
            this.glCanvas1.KeyPress   += glCanvas1_KeyPress;
            this.glCanvas1.MouseDown  += glCanvas1_MouseDown;
            this.glCanvas1.MouseMove  += glCanvas1_MouseMove;
            this.glCanvas1.MouseUp    += glCanvas1_MouseUp;
            this.glCanvas1.OpenGLDraw += glCanvas1_OpenGLDraw;
            this.glCanvas1.Resize     += glCanvas1_Resize;
        }
Ejemplo n.º 6
0
        public FormSimpleUIColorIndicator()
        {
            InitializeComponent();

            //if (CameraDictionary.Instance.ContainsKey(this.GetType().Name))
            //{
            //    this.camera = CameraDictionary.Instance[this.GetType().Name];
            //}
            //else
            {
                this.camera = new Camera(CameraType.Ortho, this.glCanvas1.Width, this.glCanvas1.Height);
                //CameraDictionary.Instance.Add(this.GetType().Name, this.camera);
            }

            satelliteRoration = new SatelliteRotator(camera);

            ColorPalette colorPalette = ColorPaletteFactory.CreateRainbow();

            Padding        padding = new System.Windows.Forms.Padding(40, 40, 40, 40);
            Size           size    = new Size(100, 30);
            IUILayoutParam param;

            param = new IUILayoutParam(AnchorStyles.Left | AnchorStyles.Bottom | AnchorStyles.Right, padding, size);
            this.colorIndicator = new SimpleUIColorIndicator(param, colorPalette, new GLColor(1, 1, 1, 1), -100, 100, 5);
            this.colorIndicator.Initialize();

            axisElement = new AxisElement();
            axisElement.Initialize();
            axisElement.BeforeRendering += axisElement_BeforeRendering;
            axisElement.AfterRendering  += axisElement_AfterRendering;

            this.glCanvas1.MouseWheel += glCanvas1_MouseWheel;
            this.glCanvas1.KeyPress   += glCanvas1_KeyPress;
            this.glCanvas1.MouseDown  += glCanvas1_MouseDown;
            this.glCanvas1.MouseMove  += glCanvas1_MouseMove;
            this.glCanvas1.MouseUp    += glCanvas1_MouseUp;
            this.glCanvas1.OpenGLDraw += glCanvas1_OpenGLDraw;
            this.glCanvas1.Resize     += glCanvas1_Resize;
        }
Ejemplo n.º 7
0
 public void CalculateWidth(AxisElement nextAxis)
 {
     if (this.Width <= 0)
     {
         if (nextAxis != null)
         {
             this.Width = Convert.ToSingle(nextAxis.Width * this.Interval.TotalMinutes / nextAxis.Interval.TotalMinutes);
         }
         else
         {
             // TODO: Calculate cell width.
             switch (_scale)
             {
                 case ScaleLevel.Hour:
                     this.Width = 60;
                     break;
                 case ScaleLevel.Day:
                     this.Width = 24;
                     break;
             }
         }
     }
 }
            public override IDeepCopyable CopyTo(IDeepCopyable other)
            {
                var dest = other as DispenseComponent;

                if (dest != null)
                {
                    base.CopyTo(dest);
                    if (Product != null)
                    {
                        dest.Product = (Hl7.Fhir.Model.Coding)Product.DeepCopy();
                    }
                    if (EyeElement != null)
                    {
                        dest.EyeElement = (Code <Hl7.Fhir.Model.VisionPrescription.VisionEyes>)EyeElement.DeepCopy();
                    }
                    if (SphereElement != null)
                    {
                        dest.SphereElement = (Hl7.Fhir.Model.FhirDecimal)SphereElement.DeepCopy();
                    }
                    if (CylinderElement != null)
                    {
                        dest.CylinderElement = (Hl7.Fhir.Model.FhirDecimal)CylinderElement.DeepCopy();
                    }
                    if (AxisElement != null)
                    {
                        dest.AxisElement = (Hl7.Fhir.Model.Integer)AxisElement.DeepCopy();
                    }
                    if (PrismElement != null)
                    {
                        dest.PrismElement = (Hl7.Fhir.Model.FhirDecimal)PrismElement.DeepCopy();
                    }
                    if (BaseElement != null)
                    {
                        dest.BaseElement = (Code <Hl7.Fhir.Model.VisionPrescription.VisionBase>)BaseElement.DeepCopy();
                    }
                    if (AddElement != null)
                    {
                        dest.AddElement = (Hl7.Fhir.Model.FhirDecimal)AddElement.DeepCopy();
                    }
                    if (PowerElement != null)
                    {
                        dest.PowerElement = (Hl7.Fhir.Model.FhirDecimal)PowerElement.DeepCopy();
                    }
                    if (BackCurveElement != null)
                    {
                        dest.BackCurveElement = (Hl7.Fhir.Model.FhirDecimal)BackCurveElement.DeepCopy();
                    }
                    if (DiameterElement != null)
                    {
                        dest.DiameterElement = (Hl7.Fhir.Model.FhirDecimal)DiameterElement.DeepCopy();
                    }
                    if (Duration != null)
                    {
                        dest.Duration = (Hl7.Fhir.Model.SimpleQuantity)Duration.DeepCopy();
                    }
                    if (ColorElement != null)
                    {
                        dest.ColorElement = (Hl7.Fhir.Model.FhirString)ColorElement.DeepCopy();
                    }
                    if (BrandElement != null)
                    {
                        dest.BrandElement = (Hl7.Fhir.Model.FhirString)BrandElement.DeepCopy();
                    }
                    if (NotesElement != null)
                    {
                        dest.NotesElement = (Hl7.Fhir.Model.FhirString)NotesElement.DeepCopy();
                    }
                    return(dest);
                }
                else
                {
                    throw new ArgumentException("Can only copy to an object of the same type", "other");
                }
            }
Ejemplo n.º 9
0
 // method
 internal void Push(int depth)
 {
     AxisElement eaxis = new AxisElement(_subtree.RootNode, depth);
     _stack.Add(eaxis);
 }
Ejemplo n.º 10
0
        private Element LoadElement(XPathNavigator node)
        {
            Element element = null;

            switch (node.Name)
            {
                case DataElement.ElementName:
                    _data = new DataElement(this, node);
                    if(_data.StartDate != null)
                        _startDate = _data.StartDate.Value;
                    element = _data;
                    break;
                case HeadElement.ElementName:
                    _head = new HeadElement(this, node);
                    element = _head;
                    break;
                case BodyElement.ElementName:
                    _body = new BodyElement(this, node);
                    element = _body;
                    break;
                case CalendarElement.ElementName:
                    _calendar = new CalendarElement(this, node);
                    element = _calendar;
                    break;
                case DayElement.ElementName:
                    element = new DayElement(this, node);
                    break;
                case AxisElement.ElementName:
                    AxisElement axis = new AxisElement(this, node);
                    axis.ViewStartDate = _startDate;
                    _axes.Add(axis);
                    element = axis;
                    break;
                case SpanElement.ElementName:
                    element = new SpanElement(this, node);
                    break;
                case IntervalElement.ElementName:
                    element = new IntervalElement(this, node);
                    break;
                case PointElement.ElementName:
                    element = new PointElement(this, node);
                    break;
                case RelationElement.ElementName:
                    RelationElement relation = new RelationElement(this, node);
                    relation.Origin = _map[relation.OriginId];
                    relation.Target = _map[relation.TargetId];
                    element = relation;
                    break;
                default:
                    element = new GanttElement(this, node);
                    break;
            }

            if (element != null)
            {
                AddElementToMap(element);

                if (node.HasChildren)
                {
                    foreach (XPathNavigator childNode in node.SelectChildren(XPathNodeType.Element))
                    {
                        Element childElement = LoadElement(childNode);
                        if (childElement != null)
                            element.AddChild(childElement);
                    }
                }
            }

            return element;
        }