private void AddElement2d(MeshBuilder bldr, Element2D elm)
        {
            if (elm.Nodes.Length == 4)
            {
                var p1 = elm.Nodes[0].Location;
                var p2 = elm.Nodes[1].Location;
                var p3 = elm.Nodes[2].Location;
                var p4 = elm.Nodes[3].Location;


                bldr.AddTriangle(p1, p2, p3);

                bldr.AddTriangle(p1, p3, p4);
            }


            if (elm.Nodes.Length == 3)
            {
                var p1 = elm.Nodes[0].Location;
                var p2 = elm.Nodes[1].Location;
                var p3 = elm.Nodes[2].Location;


                bldr.AddTriangle(p1, p2, p3);
            }
        }
Esempio n. 2
0
        public override void OnControlMsg(Element2D the_control, ControlMsg msg, float xparam, float yparam)
        {
            if (the_control.ID == 0)
            {
                if (msg != ControlMsg.SCROLL_MOVE)
                {
                    return;
                }

                if (verticalSlider.Visible)
                {
                    var scrollbarWidth = scrollbar_width;
                }
                ScollableChildframe.Y = -(int)xparam;
            }
            else if (the_control.ID == 1)
            {
                if (msg != ControlMsg.SCROLL_MOVE)
                {
                    return;
                }

                if (horizonalSlider.Visible)
                {
                    var scrollbarWidth = scrollbar_width;
                }
                ScollableChildframe.X = -(int)xparam;
            }
            else
            {
                base.OnControlMsg(the_control, msg, xparam, yparam);
            }
        }
Esempio n. 3
0
        private void OnControlMsg(Element2D the_control, ControlMsg msg, float xparam, float yparam)
        {
            if (the_control.ID != layout.ID || msg != ControlMsg.LAYOUT_RESIZED_BY_CHILDREN)
            {
                return;
            }

            scroll_frame.Pane_Height = layout.Height;
            var num = (int)(scroll_frame.Parent.Height * 0.649999976158142);

            if (scroll_frame.Pane_Height > 100)
            {
                scroll_frame.Visible = true;
                if (scroll_frame.Pane_Height < num)
                {
                    scroll_frame.Height = scroll_frame.Pane_Height;
                }
                else
                {
                    scroll_frame.Height = num;
                }
            }
            else
            {
                scroll_frame.Visible = false;
            }

            scroll_frame.Refresh();
        }
Esempio n. 4
0
File: Frame.cs Progetto: ye-man/M3D
 public Frame(int ID, Element2D parent)
     : base(ID, parent)
 {
     bordercolor = new Color4(0, 0, 0, 0);
     bgcolor     = new Color4(0, 0, 0, 0);
     Clipping    = false;
 }
Esempio n. 5
0
 public override ErrorCode onEndElement(string elem)
 {
     if (elem == "Dificultat")
     {
         escenari.addDificultat(dificultat);
         dificultat = null;
     }
     else if (elem == "Layer")
     {
         escenari.addLayer(layer);
         layer = null;
     }
     else if (elem == "Escenari")
     {
         EnvironmentManager.Instance.setScene(escenari);
     }
     else if (elem == "Escenaris")
     {
         //Eliminar tot
         obstacle   = null;
         enemic     = null;
         plataforma = null;
         granota    = null;
         element2d  = null;
     }
     return(ErrorCode.IS_OK);
 }
Esempio n. 6
0
        public List <ApplicationPlaceholderObject> AnalyticalSurfaceToNative(Element2D speckleElement)
        {
            List <ApplicationPlaceholderObject> placeholderObjects = new List <ApplicationPlaceholderObject> {
            };

            switch (speckleElement.property.type)
            {
            case Structural.PropertyType2D.Wall:
                Geometry.Line baseline         = GetBottomLine(speckleElement.topology);
                double        lowestElvevation = speckleElement.topology.Min(node => node.basePoint.z);
                double        topElevation     = speckleElement.topology.Max(node => node.basePoint.z);
                Node          bottomNode       = speckleElement.topology.Find(node => node.basePoint.z == lowestElvevation);
                Node          topNode          = speckleElement.topology.Find(node => node.basePoint.z == topElevation);
                var           bottemLevel      = LevelFromPoint(PointToNative(bottomNode.basePoint));
                var           topLevel         = LevelFromPoint(PointToNative(topNode.basePoint));
                RevitWall     revitWall        = new RevitWall(speckleElement.property.name, speckleElement.property.name, baseline, bottemLevel, topLevel);
                return(WallToNative(revitWall));

                break;

            default:
                var        polycurve  = PolycurveFromTopology(speckleElement.topology);
                var        level      = LevelFromPoint(PointToNative(speckleElement.topology[0].basePoint));
                RevitFloor revitFloor = new RevitFloor(speckleElement.property.name, speckleElement.property.name, polycurve, level);
                return(FloorToNative(revitFloor));

                break;
            }
            return(placeholderObjects);
        }
Esempio n. 7
0
 public Frame3DView(int ID, Element2D parent)
     : base(ID, parent)
 {
     viewPointPos    = new M3D.Model.Utils.Vector3(0.0f, 100f, 400f);
     cameraLookAtPos = new M3D.Model.Utils.Vector3(0.0f, 0.0f, 0.0f);
     SetCameraPerspective(45f, 100f, 1000f);
 }
Esempio n. 8
0
        private bool GetStateChangeInfo(Element2D element, string settingName, SlicerSettingsItem setting, string parentTag, out AdvancedPrintSettingsFrame.ErrorStateEnum oldState, out AdvancedPrintSettingsFrame.ErrorStateEnum currentState)
        {
            if (!tabsErrorWarningCount.ContainsKey(parentTag))
            {
                tabsErrorWarningCount[parentTag] = new AdvancedPrintSettingsFrame.TabErrorStateCount();
            }

            oldState = AdvancedPrintSettingsFrame.ErrorStateEnum.AllGood;
            var flag = false;

            if (settingErrorWarningState.ContainsKey(settingName))
            {
                oldState = settingErrorWarningState[settingName];
            }

            if (setting.HasError && setting.IsSettingOn)
            {
                currentState = AdvancedPrintSettingsFrame.ErrorStateEnum.Error;
                flag         = true;
                if (!settingErrorWarningState.ContainsKey(settingName))
                {
                    settingErrorWarningState.Add(settingName, AdvancedPrintSettingsFrame.ErrorStateEnum.Error);
                }
                else
                {
                    flag = settingErrorWarningState[settingName] != AdvancedPrintSettingsFrame.ErrorStateEnum.Error;
                    settingErrorWarningState[settingName] = AdvancedPrintSettingsFrame.ErrorStateEnum.Error;
                }
            }
            else if (setting.HasWarning && setting.IsSettingOn)
            {
                currentState = AdvancedPrintSettingsFrame.ErrorStateEnum.Warning;
                flag         = true;
                if (!settingErrorWarningState.ContainsKey(settingName))
                {
                    settingErrorWarningState.Add(settingName, AdvancedPrintSettingsFrame.ErrorStateEnum.Warning);
                }
                else
                {
                    flag = settingErrorWarningState[settingName] != AdvancedPrintSettingsFrame.ErrorStateEnum.Warning;
                    settingErrorWarningState[settingName] = AdvancedPrintSettingsFrame.ErrorStateEnum.Warning;
                }
            }
            else
            {
                currentState = AdvancedPrintSettingsFrame.ErrorStateEnum.AllGood;
                if (settingErrorWarningState.ContainsKey(settingName))
                {
                    settingErrorWarningState.Remove(settingName);
                    flag = true;
                }
                element.Enabled = setting.IsSettingOn;
                if (!element.Enabled)
                {
                    flag = true;
                }
            }
            return(flag);
        }
Esempio n. 9
0
 public HorizontalLayout(int ID, Element2D parent)
     : base(ID, parent)
 {
     use_fixed_column_width = false;
     info_list     = new List <HorizontalLayout.ColumnInfo>();
     border_width  = 10;
     border_height = 10;
 }
Esempio n. 10
0
 public VerticalLayout(int ID, Element2D parent)
     : base(ID, parent)
 {
     use_fixed_row_height = false;
     info_list            = new List <VerticalLayout.RowInfo>();
     border_width         = 10;
     border_height        = 10;
 }
Esempio n. 11
0
 public GridLayout(int ID, Element2D parent)
     : base(ID, parent)
 {
     element_list  = new List <Element2D>();
     border_width  = 10;
     border_height = 10;
     column_width  = 100;
     row_height    = 100;
 }
Esempio n. 12
0
        public override void AddChildElement(Element2D child)
        {
            base.AddChildElement(child);
            if (child is Frame frame)
            {
                frame.DarkenBackground = true;
            }

            Refresh();
        }
Esempio n. 13
0
        public override bool OnMouseCommand(MouseEvent mouseevent)
        {
            Element2D element2D = ChildList.Last();

            if (element2D != null)
            {
                return(element2D.OnMouseCommand(mouseevent));
            }

            return(false);
        }
Esempio n. 14
0
        public override bool OnKeyboardEvent(KeyboardEvent keyboardevent)
        {
            Element2D element2D = ChildList.Last();

            if (element2D != null)
            {
                return(element2D.OnKeyboardEvent(keyboardevent));
            }

            return(false);
        }
Esempio n. 15
0
 private bool IsOneOFOurs(Element2D element)
 {
     foreach (Frame popUpDialog in PopUpDialogList)
     {
         if (popUpDialog == element)
         {
             return(true);
         }
     }
     return(false);
 }
Esempio n. 16
0
 public override void OnControlMsg(Element2D the_control, ControlMsg msg, float xparam, float yparam)
 {
     if (msg == ControlMsg.LAYOUT_RESIZED_BY_CHILDREN)
     {
         Refresh();
     }
     else
     {
         base.OnControlMsg(the_control, msg, xparam, yparam);
     }
 }
Esempio n. 17
0
 public override void InitChildren(Element2D parent, GUIHost host, ButtonCallback MyButtonCallback)
 {
     base.InitChildren(parent, host, MyButtonCallback);
     foreach (Element2D child in ScollableChildframe.ChildList)
     {
         if (child is TreeNodeWidget)
         {
             ((TreeNodeWidget)child).TopLevel = true;
         }
     }
 }
Esempio n. 18
0
 public override void OnControlMsg(Element2D the_control, ControlMsg msg, float xparam, float yparam)
 {
     if (the_control.GetElementType() == ElementType.ButtonWidget && msg == ControlMsg.MSG_MOVE)
     {
         base.OnControlMsg(the_control, msg, yparam - m_trackSubControl.Y, m_trackSubControl.Height - m_buttonSubControl.Height);
     }
     else
     {
         base.OnControlMsg(the_control, msg, xparam, yparam);
     }
 }
Esempio n. 19
0
        private void UpdateGUIFromSetting(string name, SlicerSettingsItem setting)
        {
            if (tab_frame == null)
            {
                return;
            }

            Element2D childElement = tab_frame.FindChildElement(name);

            if (childElement == null)
            {
                return;
            }

            var userValue = setting.TranslateToUserValue();

            switch (setting.GetItemType())
            {
            case SettingItemType.IntType:
            case SettingItemType.FloatMMType:
                var editBoxWidget = childElement as EditBoxWidget;
                if (editBoxWidget != null)
                {
                    editBoxWidget.Text = userValue;
                    break;
                }
                break;

            case SettingItemType.BoolType:
                var buttonWidget = childElement as ButtonWidget;
                if (buttonWidget != null)
                {
                    buttonWidget.Checked = bool.Parse(userValue);
                    break;
                }
                break;

            case SettingItemType.FillPatternType:
            case SettingItemType.SupportPatternType:
                var comboBoxWidget   = childElement as ComboBoxWidget;
                var settingsEnumItem = setting as SlicerSettingsEnumItem;
                if (comboBoxWidget != null && settingsEnumItem != null)
                {
                    comboBoxWidget.Select = settingsEnumItem.ValueInt;
                    break;
                }
                break;

            default:
                throw new NotImplementedException("GenerateAdvancedSettings was given an unknown setting");
            }
            ProcessValidity(name, setting, childElement);
        }
Esempio n. 20
0
        public override void OnRender(GUIHost host)
        {
            Element2D element2D = ChildList.Last();

            if (element2D == null)
            {
                return;
            }

            base.OnRender(host);
            element2D.OnRender(host);
        }
Esempio n. 21
0
 public override void RemoveChildElement(Element2D child)
 {
     for (var index = 0; index < info_list.Count; ++index)
     {
         if (info_list[index].element == child)
         {
             info_list.RemoveAt(index);
             base.RemoveChildElement(child);
             RecalcChildSizes();
             break;
         }
     }
 }
Esempio n. 22
0
        public void AddChildElement(Element2D child, int index)
        {
            if (index > element_list.Count)
            {
                index = element_list.Count;
            }
            else if (index < 0)
            {
                index = 0;
            }

            element_list.Insert(index, child);
            base.AddChildElement(child);
        }
Esempio n. 23
0
 public PrinterStatusDialog(Printer base_printer, GUIHost host, Element2D parent_element, PopupMessageBox messagebox, Form1 mainform, SettingsManager settings)
     : base(base_printer)
 {
     found = true;
     previous_jobs_count        = 0;
     previous_job_image         = "";
     base_printer.OnUpdateData += new OnUpdateDataDel(OnUpdateData);
     this.mainform              = mainform;
     this.messagebox            = messagebox;
     current_job   = Info.current_job ?? null;
     this.settings = settings;
     InitGUIElement(host, parent_element);
     m_host = host;
 }
Esempio n. 24
0
        public void SetFocus(int ID)
        {
            if (m_oeFocusElement != null)
            {
                m_oeFocusElement.HasFocus = false;
            }

            m_oeFocusElement = m_oframeRootMasterElement.FindChildElement(ID);
            if (m_oeFocusElement == null)
            {
                return;
            }

            m_oeFocusElement.HasFocus = true;
        }
Esempio n. 25
0
        public override void InitChildren(Element2D parent, GUIHost host, ButtonCallback MyButtonCallback)
        {
            base.InitChildren(parent, host, MyButtonCallback);
            var index = 0;

            foreach (Element2D child in ChildList)
            {
                HorizontalLayout.ColumnInfo columnInfo;
                columnInfo.element       = child;
                columnInfo.ispercent     = false;
                columnInfo.prefered_size = child.Width;
                info_list.Insert(index, columnInfo);
                ++index;
            }
            RecalcChildSizes();
        }
Esempio n. 26
0
 public GenericScrollFrame(int ID, Element2D parent)
     : base(ID, parent)
 {
     verticalSlider        = new VerticalSliderWidget(0, this);
     horizonalSlider       = new HorizontalSliderWidget(1, this);
     m_frameDrawableRegion = new Frame
     {
         Clipping = true
     };
     m_frameDrawableRegion.SetPosition(2, 2);
     ScollableChildframe        = Activator.CreateInstance <T>();
     ScollableChildframe.ID     = 2;
     ScollableChildframe.Parent = (this);
     ScollableChildframe.always_contains_point = true;
     m_frameDrawableRegion.AddChildElement(ScollableChildframe);
 }
Esempio n. 27
0
        public override void InitChildren(Element2D parent, GUIHost host, ButtonCallback MyButtonCallback)
        {
            base.InitChildren(parent, host, MyButtonCallback);
            var index = 0;

            foreach (Element2D child in ChildList)
            {
                VerticalLayout.RowInfo rowInfo;
                rowInfo.element       = child;
                rowInfo.ispercent     = false;
                rowInfo.prefered_size = child.Height;
                info_list.Insert(index, rowInfo);
                ++index;
            }
            Recalc();
        }
Esempio n. 28
0
        public override void InitChildren(Element2D parent, GUIHost host, ButtonCallback MyButtonCallback)
        {
            Parent = parent;
            lock (ChildList)
            {
                foreach (Element2D child in ChildList)
                {
                    ScollableChildframe.AddChildElement(child);
                }

                ChildList.Clear();
                ScollableChildframe.InitChildren(this, host, MyButtonCallback);
            }
            Init(host);
            ScollableChildframe.Refresh();
        }
Esempio n. 29
0
        private void gestionCollision()
        {
            Vector2 v;

            // Test de collision
            float[] infosBalle = { uneballe.Position.X, uneballe.Position.Y, TAILLEX, TAILLEY };
            int[]   posRel;
            // avec les raquettes
            // On récupère la vitesse courante
            v = uneballe.Vitesse;
            if (Element2D.testCollision(this, this.raquette.Bbox))
            {
                // Le prochain mouvement entraîne une collision, on évalue la position relative de la balle
                // par rapport à la raquette pour mettre à jour le vecteur vitesse
                float[] infosRaquette = { raquette.Uneraquette.Position.X, raquette.Uneraquette.Position.Y, raquette.Uneraquette.Size.X, raquette.Uneraquette.Size.Y };
                posRel = Element2D.getRelativePosition(infosBalle, infosRaquette);

                if (posRel[0] == Element2D.CROISEMENT)
                {
                    v.Y *= -1;

                    if (Math.Abs(v.Y) < v_max.Y)
                    {
                        v.Y *= 1.2f;
                    }
                    uneballe.Vitesse = v;
                }

                // Si les 2 objets se croisent sur l'axe des Y
                if (posRel[1] == Element2D.CROISEMENT)
                {
                    v.X *= -1;
                    if (Math.Abs(v.X) < v_max.X)
                    {
                        v.X *= 1.2f;
                    }
                    uneballe.Vitesse = v;
                }

                /*SoundEffectInstance soundInstRaquette = soundRaquette.CreateInstance();
                 * soundInstRaquette.Volume = 0.3f;
                 * soundInstRaquette.Play();*/
            }


            gestionCollisionBrique();
        }
Esempio n. 30
0
        public override Element2D GetSelfOrDependantAtPoint(int x, int y)
        {
            Element2D element2D1 = ChildList.Last();
            var       element2D2 = (Element2D)null;

            if (element2D1 != null)
            {
                element2D2 = element2D1.GetSelfOrDependantAtPoint(x, y);
            }

            if (element2D2 == null)
            {
                element2D2 = (this);
            }

            return(element2D2);
        }