Exemple #1
0
            private IVertexBuffer BindVertexBuffer(DrawList drawList)
            {
                Watertight.Math.Vertex[] Verts = new Math.Vertex[drawList.VertexBuffer.Count];
                ushort[] Indicies = new ushort[drawList.IndexBuffer.Count];

                for (int x = 0; x < drawList.VertexBuffer.Count; x++)
                {
                    FlowUI.Draw.Vertex FlowVtx = drawList.VertexBuffer.ElementAt(x);
                    Verts[x] = new Math.Vertex
                    {
                        Location = new Vector3(FlowVtx.Pos, 0),
                        Color    = FlowVtx.Color,
                        UV       = FlowVtx.UV
                    };
                }

                for (int i = 0; i < drawList.IndexBuffer.Count; i++)
                {
                    Indicies[i] = drawList.IndexBuffer.ElementAt(i);
                }

                if (InternalVertexBuffer == null)
                {
                    InternalVertexBuffer = IEngine.Instance.Renderer.RendererResourceFactory.CreateVertexBuffer();
                }

                InternalVertexBuffer.SetVertexData(Verts, Indicies);

                return(InternalVertexBuffer);
            }
Exemple #2
0
        /// <summary>
        /// Move selected items to front (beginning of the list)
        /// </summary>
        /// <returns>
        /// true if at least one object is moved
        /// </returns>
        public bool MoveSelectionToFront()
        {
            int      n;
            int      i;
            DrawList tempList;

            tempList = new DrawList();
            n        = graphicsList.Count;

            // Read source list in reverse order, add every selected item
            // to temporary list and remove it from source list
            for (i = n - 1; i >= 0; i--)
            {
                if ((graphicsList[i]).Selected)
                {
                    tempList.Add(graphicsList[i]);
                    graphicsList.RemoveAt(i);
                }
            }

            // Read temporary list in direct order and insert every item
            // to the beginning of the source list
            n = tempList.Count;

            for (i = 0; i < n; i++)
            {
                graphicsList.Insert(0, tempList[i]);
            }

            return(n > 0);
        }
        public void RenderDrawList(DrawList drawList, int width, int height)
        {
            DrawMesh(this.shapeMaterial, drawList.ShapeMesh, width, height);
            DrawMesh(this.imageMaterial, drawList.ImageMesh, width, height);

            DrawTextMesh(drawList.TextMesh, width, height);
        }
Exemple #4
0
        /// <summary>
        /// Move selected items to back (end of the list)
        /// </summary>
        /// <returns>
        /// true if at least one object is moved
        /// </returns>
        public bool MoveSelectionToBack()
        {
            int      n;
            int      i;
            DrawList tempList;

            tempList = new DrawList();
            n        = graphicsList.Count;

            // Read source list in reverse order, add every selected item
            // to temporary list and remove it from source list
            for (i = n - 1; i >= 0; i--)
            {
                if ((graphicsList[i]).Selected)
                {
                    tempList.Add(graphicsList[i]);
                    graphicsList.RemoveAt(i);
                }
            }

            // Read temporary list in reverse order and add every item
            // to the end of the source list
            n = tempList.Count;

            for (i = n - 1; i >= 0; i--)
            {
                graphicsList.Add(tempList[i]);
            }

            return(n > 0);
        }
Exemple #5
0
        public void ShouldGetCorrectOffsetOfAGlyph()
        {
            var style = GUIStyle.Default;

            style.Set <double>(GUIStyleName.FontSize, 36);

            var state         = GUIState.Normal;
            var fontFamily    = style.Get <string>(GUIStyleName.FontFamily, state);
            var fontSize      = style.Get <double>(GUIStyleName.FontSize, state);
            var fontStretch   = (FontStretch)style.Get <int>(GUIStyleName.FontStretch, state);
            var fontStyle     = (FontStyle)style.Get <int>(GUIStyleName.FontStyle, state);
            var fontWeight    = (FontWeight)style.Get <int>(GUIStyleName.FontWeight, state);
            var textAlignment = (TextAlignment)style.Get <int>(GUIStyleName.TextAlignment, state);

            var rect        = new Rect(0, 0, 200, 200);
            var textContext = new TypographyTextContext(
                "A",
                fontFamily, (int)fontSize, fontStretch, fontStyle, fontWeight,
                (int)Math.Ceiling(rect.Size.Width), (int)Math.Ceiling(rect.Size.Height),
                textAlignment);

            var textMesh = new TextMesh();

            textMesh.Build(new Point(0, fontSize), style, textContext);

            DrawList drawList = new DrawList();

            drawList.Append(textMesh, Vector.Zero);

            var objFilePath = "D:\\TextRenderingTest_ShouldGetARightMeshFromTypography.obj";

            Utility.SaveToObjFile(objFilePath, drawList.DrawBuffer.VertexBuffer, drawList.DrawBuffer.IndexBuffer);
            Process.Start(ModelViewerPath, objFilePath);
        }
Exemple #6
0
            public void Fill(bool borderBlocks, Blockset.Block oldBlock, Blockset.Block newBlock, int destX, int destY)
            {
                Block[][] outArr = borderBlocks ? BorderBlocks : Blocks;
                int       width  = borderBlocks ? BorderWidth : Width;
                int       height = borderBlocks ? BorderHeight : Height;

                void Fill(int x, int y)
                {
                    if (x >= 0 && x < width && y >= 0 && y < height)
                    {
                        Block b = outArr[y][x];
                        if (b.BlocksetBlock == oldBlock)
                        {
                            b.BlocksetBlock = newBlock;
                            DrawList.Add(b);
                            Fill(x, y + 1);
                            Fill(x, y - 1);
                            Fill(x + 1, y);
                            Fill(x - 1, y);
                        }
                    }
                }

                Fill(destX, destY);
                Draw(borderBlocks);
            }
        private void ComBox_ATTA_SelectedIndexChanged(object sender, EventArgs e)
        {
            TxtPipe.Text = "";
            ComboBox  comb      = sender as ComboBox;
            NameRef   nr        = (NameRef)comb.SelectedItem;
            DbElement dbElement = DbElement.GetElement(nr.Ref);
            DbElement Pipe      = dbElement.Owner.Owner;
            DrawList  dl        = DrawListManager.Instance.CurrentDrawList;

            TxtPipe.Text = Pipe.ToString();
            DbElement hanger = dbElement.GetElement(DbAttributeInstance.CREF);

            dl.Add(Pipe);
            dl.Add(hanger);
            //dl.AddToSelection();
            // DbElement Support = hanger.Owner.GetElement(DbAttributeInstance.STLR);
            ListBox_Element.Items.Clear();
            foreach (DbElement h in hanger.Members())
            {
                ListBox_Element.Items.Add(new NameRef(h.ToString(), h.RefNo()));
            }
            //foreach (DbElement s in Support.Owner.Members())
            //{
            //    ListBox_Element.Items.Add(new NameRef(s.ToString(), s.RefNo()));
            //}
            ListBox_Element.DisplayMember = "Name";
        }
 private void AddToDrawList(MemberVisualizationField memberField, DrawList drawList)
 {
     if (!drawList.ContainsKey(memberField.gameObject))
     {
         drawList.Add(memberField.gameObject, new List <MemberVisualizationField>());
     }
     drawList[memberField.gameObject].Add(memberField);
 }
Exemple #9
0
 /// <summary>
 /// 克隆实体
 /// </summary>
 /// <returns>返回克隆体</returns>
 public object Clone()
 {
     return(new DrawImg
     {
         DrawList = DrawList.ToList(),
         BackgroundPath = BackgroundPath,
         BackgroundUrl = BackgroundUrl,
         BackgroundImage = BackgroundImage,
         BackgroundColor = BackgroundColor,
         Rotate = Rotate,
         Height = Height,
         Width = Width,
         Left = Left,
         Top = Top
     });
 }
Exemple #10
0
        public ControlDrawArea(DrawArea drawArea, FormDlgMain formDlg)
        {
            _drawArea1 = drawArea;
            FormDlgMain formDlgMain = formDlg;

            _drawArea1.DrawingEnd     += new MyEvent1(DisplayArea);
            _drawArea1.RectSeclecting += new RecipeEvent2(Rect_Selected);

            _cusCap = new System.Drawing.Drawing2D.AdjustableArrowCap(5, 5, false);

            _drawArea1.Owner = formDlgMain;
            _nowGraphicsList = new GraphicsList();

            //_drawArea1.Initialize(formDlgMain);
            _drawArea1.Initialize(formDlgMain, ref _nowGraphicsList);

            _rectArray = new DrawList();
        }
Exemple #11
0
        //LOAD OBJECTS AND OTHER STUFF IMPORTANT FOR THE GAMESTATE
        public void OnLoad()
        {
            var hive = new Hive(this, new Vector2(500, 500), 13);

            ObstacleList = GenerateListOfRandomObstacles();

            foreach (IEntity obstacle in ObstacleList)
            {
                DrawList.Add(obstacle);
            }

            DrawList.Add(new Spider(this, new Vector2(32, 32), new Vector2(100, 100), 2));
            DrawList.Add(new Hive(this, new Vector2(500, 500), 10));
            //DrawList.Insert(0, new Flower(this, new Vector2(300,300)));

            //HACK: Do rozróżnienia?
            UpdateList = DrawList;
        }
Exemple #12
0
 public GraphicsList()
 {
     graphicsList = new DrawList();
     _ipverify    = new List <string>();
     _bomverify   = new List <string>();
     _agmverify   = new List <string>();
     //_agmdualverify = new List<string>();
     _tcmverify            = new List <string>();
     _tvmverify            = new List <string>();
     _copyList             = new List <DrawObject>();
     _scverify             = new List <string>();
     _agmdWallSingleverify = new List <string>();
     _aGMWallDualverify    = new List <string>();
     _aGMWallDummyverify   = new List <string>();
     _switchverify         = new List <string>();
     _paidverify           = new List <string>();
     _arrayverify          = new List <string>();
 }
        public Game1()
        {
            graphics = new GraphicsDeviceManager(this);
            Content.RootDirectory    = "Content";
            graphics.IsFullScreen    = false;
            graphics.GraphicsProfile = GraphicsProfile.HiDef;
            graphics.ApplyChanges();

            _clock        = new GameClock();
            _inputState   = new InputState();
            _inputWrapper = new InputWrapper(new ControllerWrapper(PlayerIndex.One, true), _clock.GetCurrentTime);
            _inputWrapper.Controller.UseKeyboard = true;
            _font = new FontBuddy();

            //setup the renderer
            _Renderer = new Renderer(this, Content);
            _DrawList = new DrawList();
            _Grid     = new Grid();
        }
Exemple #14
0
        protected GraphicsList(SerializationInfo info, StreamingContext context)
        {
            _graphicsList = new DrawList();

            var n = info.GetInt32(EntryCount);

            for (int i = 0; i < n; i++)
            {
                var typeName = info.GetString(String.Format(CultureInfo.InvariantCulture, "{0}{1}", EntryType, i));

                var drawObject = (DrawObject)Assembly.GetExecutingAssembly().CreateInstance(typeName);

                if (drawObject == null)
                {
                    continue;
                }
                drawObject.LoadFromStream(info, i);

                _graphicsList.Add(drawObject);
            }
        }
Exemple #15
0
        private Vector2 GenerateNewPositionForFlower()
        {
            var entities = DrawList.FindAll(x => x is Obstacle).ToList();
            int posX = 0, posY = 0;
            var flowerRectangle = new Rectangle(posX, posY, Globals.flowerTexture.Width, Globals.flowerTexture.Height);



            while (true)
            {
                posX = rnd.Next(24 + Globals.flowerTexture.Width, (int)Globals.screenSize.X - 24 - Globals.flowerTexture.Width);
                posY = rnd.Next(24 + Globals.flowerTexture.Height, (int)Globals.screenSize.Y - 24 - Globals.flowerTexture.Height);

                flowerRectangle = new Rectangle(new Point(posX, posY), flowerRectangle.Size);

                if (entities.All(x => !x.BoundingBox.Intersects(flowerRectangle)))
                {
                    return(new Vector2(posX, posY));
                }
            }
        }
Exemple #16
0
        //RYSOWANIE NA EKRANIE
        public void Draw()
        {
            Globals.spriteBatch.Begin();

            Globals.spriteBatch.Draw(Globals.backgroundTexture, new Vector2(0, 0), Color.White);



            foreach (IEntity entity in DrawList)
            {
                entity.Draw();
            }



            List <ChildrenFly> ListOfChildrenFlies = ((Hive)DrawList.Find(x => x is Hive)).ChildrenFlies;


            Globals.spriteBatch.Draw(Globals.hpBar, new Rectangle(30, 2, 100, 22), new Color(0, 0, 0, 150));
            Globals.spriteBatch.DrawString(Globals.defaultFont, "My Hive: " + ListOfChildrenFlies.Count.ToString(), new Vector2(36, 4), Color.White);
            Globals.spriteBatch.End();
        }
Exemple #17
0
        protected GraphicsList(SerializationInfo info, StreamingContext context)
        {
            graphicsList = new DrawList();

            int        n = info.GetInt32(entryCount);
            string     typeName;
            DrawObject drawObject;

            for (int i = 0; i < n; i++)
            {
                typeName = info.GetString(
                    String.Format(CultureInfo.InvariantCulture,
                                  "{0}{1}",
                                  entryType, i));

                drawObject = (DrawObject)Assembly.GetExecutingAssembly().CreateInstance(
                    typeName);

                drawObject.LoadFromStream(info, i);

                graphicsList.Add(drawObject);
            }
        }
Exemple #18
0
        protected GraphicsList(SerializationInfo info, StreamingContext context)
        {
            graphicsList = new DrawList();

            int n = info.GetInt32(entryCount);
            string typeName;
            DrawObject drawObject;

            for (int i = 0; i < n; i++)
            {
                typeName = info.GetString(
                    String.Format(CultureInfo.InvariantCulture,
                        "{0}{1}",
                    entryType, i));

                drawObject = (DrawObject)Assembly.GetExecutingAssembly().CreateInstance(
                    typeName);

                drawObject.LoadFromStream(info, i);

                graphicsList.Add(drawObject);
            }

        }
Exemple #19
0
            public void Render(Renderer renderer)
            {
                Flow.Render();
                DrawData drawData = Flow.DrawData;

                for (int i = 0; i < drawData.DrawLists.Count; i++)
                {
                    DrawList drawList = drawData.DrawLists[i];

                    IVertexBuffer vertexBuffer = BindVertexBuffer(drawList);
                    int           IndexOffset  = 0;

                    for (int cmdi = 0; cmdi < drawList.CommandBuffer.Count; cmdi++)
                    {
                        DrawList.DrawCmd DrawCommand = drawList.CommandBuffer.ElementAt(cmdi);

                        using (RenderingCommand cmd = renderer.RendererResourceFactory.CreateRenderCommand())
                        {
                            cmd.WithVertexBuffer(vertexBuffer)
                            .WithMaterial(FlowMaterialPtr.Get <Material>())
                            .WithCamera(UICamera);

                            //TODO: Textures

                            cmd.WithStartIndex(IndexOffset)
                            .WithPrimitveCount((int)DrawCommand.Elements / 3)
                            .WithDebugName("Flow UI Rendering");

                            renderer.ExecuteRenderCommand(cmd);
                        }


                        IndexOffset += (int)DrawCommand.IndexOffset;
                    }
                }
            }
        public DrawBox RPBlock()
        {
            float width = 500;
            xFont font = new FontGraphicsMeasurer("Calibri", 11);

            Text t = new Text();
            DrawList t1 = new DrawList(font);
            DrawList t2 = new DrawList(font);
            t.addWhitespace(width, 0, true);
            t.add(t1);
            t.addWhitespace(5);
            t.add(t2);

            t1.addWort("Name: " + Charakter.Charakter.VollstandigerName);
            t1.addWort("Alter: " + Charakter.Charakter.Super.RP.Alter);
            t1.addWhitespace(230, 132);
            t1.addWort("Radius: " + Charakter.Charakter.Super.RP.Radius.ToString("F2") + " Meter");
            t1.addWort("Höhe: " + Charakter.Charakter.Super.RP.Hohe.ToString("F2") + " Meter");

            t2.addWort("Hintergrund: " + Charakter.Charakter.Super.RP.Hintergrund);
            t2.addWort("Konfession: " + Charakter.Charakter.Super.RP.Konfession);
            Text vergs = new Text();
            vergs.addWort("Vergangenheit: ");
            vergs.add(new DrawList(font, Charakter.Charakter.Super.RP.Vergangenheiten.Map(s => s.Replace('_', ' '))));
            t2.add(vergs);
            t2.addWhitespace(250, 50);
            t2.addWort("Rassebild:");
            t2.add(new ImageBox(100, CreateFarbBild(this.Charakter.Charakter.Super.RP.Augenfarbe,
                this.Charakter.Charakter.Super.RP.Haarfarbe,
                this.Charakter.Charakter.Super.RP.Hautfarbe)));

            return t;
        }
Exemple #21
0
 public GraphicsList()
 {
     graphicsList = new DrawList();
 }
Exemple #22
0
 private bool IfDrawListHasFlower()
 {
     return(DrawList.Find(x => x is Flower) != null);
 }
Exemple #23
0
        int getCountOfChildrenFlies()
        {
            List <ChildrenFly> ListOfChildrenFlies = ((Hive)DrawList.Find(x => x is Hive)).ChildrenFlies;

            return(ListOfChildrenFlies.Count);
        }
 public Window(string Name, DrawListSharedData sharedData)
 {
     DrawList  = new DrawList(sharedData);
     this.Name = Name;
     NameId    = Name.GetHashCode();
 }
Exemple #25
0
        //OBLICZENIA
        public void Update()
        {
            Globals.newKeyState = Keyboard.GetState();

            if (!isLoaded)
            {
                OnLoad();
                isLoaded = true;
            }
            if (KeypressTest(Keys.Escape))
            {
                Globals.activeState = Globals.enGameStates.PAUSE;
            }


            for (int i = 0; i < UpdateList.Count(); i++)
            {
                UpdateList[i].Update();
            }
            Draw();


            if (getCountOfChildrenFlies() == 0)

            {
                ResetState();

                Globals.winner = "SPIDER!";
            }
            else if (getCountOfChildrenFlies() > 150)
            {
                ResetState();


                Globals.winner = "BUTTERFLY!";
            }


            //FLOWER
            if (!IfDrawListHasFlower())
            {
                counter2 = 0;
                if (counter1 < 60 * 3)
                {
                    counter1++;
                }
                else
                {
                    DrawList.Insert(20, new Flower(this, GenerateNewPositionForFlower()));
                }
            }
            else
            {
                counter1 = 0;
                if (counter2 < 60 * 8)
                {
                    counter2++;
                }
                else
                {
                    counter2 = 0;
                    DrawList.Remove(DrawList.Find(x => x is Flower));
                    DrawList.Insert(20, new Flower(this, GenerateNewPositionForFlower()));
                }
            }
            Globals.oldKeyState = Globals.newKeyState;
        }
Exemple #26
0
 private static void AddDrawListToDrawData(DrawList List, DrawData Data)
 {
     //TODO: Sanity Checks
     Data.DrawLists.Add(List);
 }
Exemple #27
0
        public void ShouldGetARightMeshAfterAppendingATextMesh()
        {
            var style = GUIStyle.Default;

            var state         = GUIState.Normal;
            var fontFamily    = style.Get <string>(GUIStyleName.FontFamily, state);
            var fontSize      = style.Get <double>(GUIStyleName.FontSize, state);
            var fontStretch   = (FontStretch)style.Get <int>(GUIStyleName.FontStretch, state);
            var fontStyle     = (FontStyle)style.Get <int>(GUIStyleName.FontStyle, state);
            var fontWeight    = (FontWeight)style.Get <int>(GUIStyleName.FontWeight, state);
            var textAlignment = (TextAlignment)style.Get <int>(GUIStyleName.TextAlignment, state);

            var rect        = new Rect(0, 0, 200, 200);
            var textContext = Application.platformContext.CreateTextContext(
                "ij = I::oO(0xB81l);",
                fontFamily, (int)fontSize, fontStretch, fontStyle, fontWeight,
                (int)Math.Ceiling(rect.Size.Width), (int)Math.Ceiling(rect.Size.Height),
                textAlignment);

            var textMesh = new TextMesh();

            textMesh.Build(Point.Zero, style, textContext);

            var anotherTextContext = Application.platformContext.CreateTextContext(
                "auto-sized",
                fontFamily, (int)fontSize, fontStretch, fontStyle, fontWeight,
                200, 200,
                textAlignment);

            var anotherTextMesh = new TextMesh();

            anotherTextMesh.Build(new Point(50, 100), style, anotherTextContext);

            DrawList drawList            = new DrawList();
            var      expectedVertexCount = 0;
            var      expectedIndexCount  = 0;

            drawList.AddRectFilled(Point.Zero, new Point(200, 100), Color.Metal);
            expectedVertexCount += 4;
            expectedIndexCount  += 6;
            Assert.Equal(drawList.DrawBuffer.VertexBuffer.Count, expectedVertexCount);
            Assert.Equal(drawList.DrawBuffer.IndexBuffer.Count, expectedIndexCount);

            drawList.Append(textMesh, Vector.Zero);
            expectedVertexCount += textMesh.VertexBuffer.Count;
            expectedIndexCount  += textMesh.IndexBuffer.Count;
            Assert.Equal(drawList.DrawBuffer.VertexBuffer.Count, expectedVertexCount);
            Assert.Equal(drawList.DrawBuffer.IndexBuffer.Count, expectedIndexCount);

            drawList.AddRectFilled(new Point(0, 110), new Point(200, 150), Color.Metal);
            expectedVertexCount += 4;
            expectedIndexCount  += 6;
            Assert.Equal(drawList.DrawBuffer.VertexBuffer.Count, expectedVertexCount);
            Assert.Equal(drawList.DrawBuffer.IndexBuffer.Count, expectedIndexCount);

            drawList.AddRectFilled(new Point(0, 160), new Point(200, 200), Color.Metal);
            expectedVertexCount += 4;
            expectedIndexCount  += 6;
            Assert.Equal(drawList.DrawBuffer.VertexBuffer.Count, expectedVertexCount);
            Assert.Equal(drawList.DrawBuffer.IndexBuffer.Count, expectedIndexCount);

            drawList.Append(anotherTextMesh, Vector.Zero);
            expectedVertexCount += anotherTextMesh.VertexBuffer.Count;
            expectedIndexCount  += anotherTextMesh.IndexBuffer.Count;
            Assert.Equal(drawList.DrawBuffer.VertexBuffer.Count, expectedVertexCount);
            Assert.Equal(drawList.DrawBuffer.IndexBuffer.Count, expectedIndexCount);

            var objFilePath = "D:\\TextRenderingTest_ShouldGetARightMeshAfterAppendingATextMesh.obj";

            Utility.SaveToObjFile(objFilePath, drawList.DrawBuffer.VertexBuffer, drawList.DrawBuffer.IndexBuffer);
            Process.Start(ModelViewerPath, objFilePath);
        }
Exemple #28
0
        /// <summary>
        /// Move selected items to front (beginning of the list)
        /// </summary>
        /// <returns>
        /// true if at least one object is moved
        /// </returns>
        public bool MoveSelectionToFront()
        {
            int n;
            int i;
            DrawList tempList;

            tempList = new DrawList();
            n = graphicsList.Count;

            // Read source list in reverse order, add every selected item
            // to temporary list and remove it from source list
            for (i = n - 1; i >= 0; i--)
            {
                if ((graphicsList[i]).Selected)
                {
                    tempList.Add(graphicsList[i]);
                    graphicsList.RemoveAt(i);
                }
            }

            // Read temporary list in direct order and insert every item
            // to the beginning of the source list
            n = tempList.Count;

            for (i = 0; i < n; i++)
            {
                graphicsList.Insert(0, tempList[i]);
            }

            return (n > 0);
        }
Exemple #29
0
        private void Search_Element(string findstr, bool replace_mode)
        {
            findindex = 0;
            string searchname = "*" + findstr + "*";
            string replacestr = txtreplace.Text;

            //트리에서 Element Type을 선택할수 있게 함.
            List <DbElementType> dbtype_list = new List <DbElementType>();

            foreach (TreeNode firstnode in tree_type.Nodes)
            {
                if (firstnode.Checked)
                {
                    dbtype_list.Add((DbElementType)firstnode.Tag);
                }

                foreach (TreeNode secondnode in firstnode.Nodes)
                {
                    if (secondnode.Checked)
                    {
                        dbtype_list.Add((DbElementType)secondnode.Tag);
                    }
                    foreach (TreeNode thirdnode in secondnode.Nodes)
                    {
                        if (thirdnode.Checked)
                        {
                            dbtype_list.Add((DbElementType)thirdnode.Tag);
                        }
                        foreach (TreeNode forthnode in thirdnode.Nodes)
                        {
                            if (forthnode.Checked)
                            {
                                dbtype_list.Add((DbElementType)forthnode.Tag);
                            }
                        }
                    }
                }
            }
            dbtypes = dbtype_list.ToArray();

            if (radio_3dview.Checked)
            {
                DrawList          drawlist         = DrawListManager.Instance.CurrentDrawList;
                DrawListMember[]  drawlistmems     = drawlist.Members();
                DrawListMember [] FindDrawElements = drawlistmems.Cast <DrawListMember>()
                                                     .Where(item => item.DbElement.GetAsString(DbAttributeInstance.NAMN).Contains(txt_search.Text) && dbtypes.Contains(item.DbElement.GetElementType()))
                                                     .ToArray();


                FindElements = FindDrawElements.Select(x => x.DbElement).ToArray();

                //Highlight시 색은 General Colours에서 Visible의 색을 따라감.
                drawlist.Highlight(FindElements);

                foreach (DbElement item in FindElements)
                {
                    string type = item.GetAsString(DbAttributeInstance.TYPE);
                    string pos  = "";
                    if (type == "BRAN")
                    {
                        pos = item.GetAsString(DbAttributeInstance.HPOS);
                    }
                    else
                    {
                        pos = item.GetAsString(DbAttributeInstance.POS);
                    }

                    string name = item.GetAsString(DbAttributeInstance.NAMN);
                    Aveva.Pdms.Utilities.CommandLine.Command.CreateCommand(string.Format("AID TEXT number 9898   |{0}| at {1}", name, pos)).RunInPdms();
                }
            }
            else
            {
                //Root가 CE일때
                if (radio_ce.Checked)
                {
                    root = CurrentElement.Element;
                }
                else if (radio_entire.Checked)
                {
                    if (ServiceManager.Instance.ApplicationName == "Outfitting")
                    {
                        root = MDB.CurrentMDB.GetFirstWorld(Aveva.Pdms.Database.DbType.Design);
                    }
                    if (ServiceManager.Instance.ApplicationName == "Paragon")
                    {
                        root = MDB.CurrentMDB.GetFirstWorld(Aveva.Pdms.Database.DbType.Catalogue);
                    }
                    if (ServiceManager.Instance.ApplicationName == "MarineDrafting")
                    {
                        root = MDB.CurrentMDB.GetFirstWorld(Aveva.Pdms.Database.DbType.Draft);
                    }
                }
                TypeFilter typefilter  = new TypeFilter(dbtypes);
                AndFilter  finalfilter = new AndFilter();

                AttributeLikeFilter xfilter = new AttributeLikeFilter(DbAttributeInstance.NAMN, searchname);

                finalfilter.Add(typefilter);
                finalfilter.Add(xfilter);
                result       = new DBElementCollection(root, finalfilter);
                FindElements = result.Cast <DbElement>().ToArray();
            }


            //Item 들이 가지고 속해있는 DB리스트생성
            List <Db> dblist = new List <Db>();

            foreach (DbElement item in FindElements)
            {
                if (!dblist.Contains(item.Db))
                {
                    dblist.Add(item.Db);
                }
            }
            //Partial Getwork수행
            MDB.CurrentMDB.GetWork(dblist.ToArray());



            int replace_count = 0;

            if (replace_mode == true)
            {
                foreach (DbElement item in FindElements)
                {
                    try
                    {
                        //listView_searchresult.Items.Add(new ListViewItem(new string[]{"1","2","3","4"}));

                        string element_name = item.GetAsString(DbAttributeInstance.NAME);

                        string    name      = element_name.Replace(findstr, replacestr);
                        DbElement exsititem = DbElement.GetElement(name);
                        if (!exsititem.IsNull)
                        {
                            MessageBox.Show(string.Format("바꿀려는 이름 {0}은 존재하므로 바꿀수 없습니다.", name));
                            return;

                            continue;
                        }

                        item.SetAttribute(DbAttributeInstance.NAME, name);
                        replace_count++;
                        mDesExpCtrl.RefreshNodes(item);
                    }
                    catch (Exception ee)
                    {
                        Console.WriteLine(item.ToString());
                        Console.WriteLine("오류발생");
                    }
                }
                //Tree View 업데이트 부분 아래 구문이 없으면 화면이 업데이트 안됨.
                try
                {
                    var windows = Aveva.ApplicationFramework.Presentation.WindowManager.Instance.Windows.OfType <Presentation.DockedWindow>().Where(x => x.Key == "DesignExplorer").ToArray();
                    if (windows.Count() > 0)
                    {
                        MessageBox.Show(replace_count + "개 항목의 이름 바꾸기 완료!");
                    }
                }
                catch (Exception ee)
                {
                }
            }
            else
            {
                if (!radio_3dview.Checked)
                {
                    if (FindElements.Count() != 0)
                    {
                        string refno = FindElements[0].GetAsString(DbAttributeInstance.REF);
                        Aveva.Pdms.Utilities.CommandLine.Command.CreateCommand(refno).RunInPdms();
                    }
                }
                int idx = 1;
                //listView_searchresult.ColumnClick -= listView_searchresult_ColumnClick;
                listView_searchresult.Items.Clear();
                foreach (DbElement item in FindElements)
                {
                    string elementname = item.GetAsString(DbAttributeInstance.FLNN);
                    string elementtype = item.GetAsString(DbAttributeInstance.TYPE);
                    string marptype    = "0";
                    if (elementtype == "SHEE")
                    {
                        marptype = item.GetAsString(DbAttributeInstance.MARPTY);
                    }
                    bool   lclm      = item.GetBool(DbAttributeInstance.LCLM);
                    string userclaim = item.GetAsString(DbAttributeInstance.USERC);
                    string islock    = "X";
                    if (lclm == true)
                    {
                        islock = "X";
                    }
                    else
                    {
                        if (userclaim == "unset")
                        {
                            islock = "X";
                        }
                        else
                        {
                            islock = "O";
                        }
                    }

                    listView_searchresult.Items.Add(new ListViewItem(new string[] { idx.ToString(), elementname, elementtype, islock, marptype }));

                    idx++;
                }
                //listView_searchresult.ColumnClick += listView_searchresult_ColumnClick;
                lbl_result.Text = "검색결과 : " + FindElements.Count().ToString() + " 건";
            }
        }
Exemple #30
0
 public GraphicsList()
 {
     graphicsList = new DrawList();
 }
        public unsafe static void RenderDrawData(DrawData *drawData, int displayW, int displayH)
        {
            // We are using the OpenGL fixed pipeline to make the example code simpler to read!
            // Setup render state: alpha-blending enabled, no face culling, no depth testing, scissor enabled, vertex/texcoord/color pointers.
            int lastTexture;

            GL.GetInteger(GetPName.TextureBinding2D, out lastTexture);
            Int4           lastViewport = new Int4();
            TypedReference tr           = __makeref(lastViewport);
            IntPtr         ptr          = **(IntPtr **)(&tr);

            GL.GetInteger(GetPName.Viewport, (int *)ptr);
            Int4 lastScissorBox = new Int4();

            tr  = __makeref(lastScissorBox);
            ptr = **(IntPtr **)(&tr);
            GL.GetInteger(GetPName.ScissorBox, (int *)ptr);

            GL.PushAttrib(AttribMask.EnableBit | AttribMask.ColorBufferBit | AttribMask.TransformBit);
            GL.Enable(EnableCap.Blend);
            GL.BlendFunc(BlendingFactorSrc.SrcAlpha, BlendingFactorDest.OneMinusSrcAlpha);
            GL.Disable(EnableCap.CullFace);
            GL.Disable(EnableCap.DepthTest);
            GL.Enable(EnableCap.ScissorTest);
            GL.EnableClientState(ArrayCap.VertexArray);
            GL.EnableClientState(ArrayCap.TextureCoordArray);
            GL.EnableClientState(ArrayCap.ColorArray);
            GL.Enable(EnableCap.Texture2D);

            GL.UseProgram(0);

            // Handle cases of screen coordinates != from framebuffer coordinates (e.g. retina displays)
            IO io = ImGui.GetIO();

            ImGui.ScaleClipRects(drawData, io.DisplayFramebufferScale);

            // Setup orthographic projection matrix
            GL.Viewport(0, 0, displayW, displayH);
            GL.MatrixMode(MatrixMode.Projection);
            GL.PushMatrix();
            GL.LoadIdentity();
            GL.Ortho(
                0.0f,
                io.DisplaySize.X / io.DisplayFramebufferScale.X,
                io.DisplaySize.Y / io.DisplayFramebufferScale.Y,
                0.0f,
                -1.0f,
                1.0f
                );
            GL.MatrixMode(MatrixMode.Modelview);
            GL.PushMatrix();
            GL.LoadIdentity();

            // Render command lists

            for (int n = 0; n < drawData->CmdListsCount; n++)
            {
                DrawList        cmddList  = new DrawList(drawData->CmdLists[n]);
                NativeDrawList *cmdList   = drawData->CmdLists[n];
                ImVector        vtxBuffer = cmdList->VtxBuffer;
                ImVector        idxBuffer = cmdList->IdxBuffer;

                GL.VertexPointer(2, VertexPointerType.Float, sizeof(DrawVert),
                                 new IntPtr((long)vtxBuffer.Data + DrawVert.PosOffset));
                GL.TexCoordPointer(2, TexCoordPointerType.Float, sizeof(DrawVert),
                                   new IntPtr((long)vtxBuffer.Data + DrawVert.UVOffset));
                GL.ColorPointer(4, ColorPointerType.UnsignedByte, sizeof(DrawVert),
                                new IntPtr((long)vtxBuffer.Data + DrawVert.ColOffset));

                long idxBufferOffset = 0;
                for (int cmdi = 0; cmdi < cmdList->CmdBuffer.Size; cmdi++)
                {
                    DrawCmd *pcmd = &(((DrawCmd *)cmdList->CmdBuffer.Data)[cmdi]);

                    /* if (pcmd->UserCallback!= IntPtr.Zero) {
                     *   pcmd->(ref cmdList, ref pcmd);
                     * } else {*/
                    GL.BindTexture(TextureTarget.Texture2D, (int)pcmd->TextureId);
                    GL.Scissor(
                        (int)pcmd->ClipRect.X,
                        (int)(io.DisplaySize.Y - pcmd->ClipRect.W),
                        (int)(pcmd->ClipRect.Z - pcmd->ClipRect.X),
                        (int)(pcmd->ClipRect.W - pcmd->ClipRect.Y)
                        );
                    GL.DrawElements(PrimitiveType.Triangles, (int)pcmd->ElemCount, DrawElementsType.UnsignedByte,
                                    new IntPtr((long)idxBuffer.Data + idxBufferOffset));

                    idxBufferOffset += pcmd->ElemCount * 2 /*sizeof(ushort)*/;
                }
            }

            // Restore modified state
            GL.DisableClientState(ArrayCap.ColorArray);
            GL.DisableClientState(ArrayCap.TextureCoordArray);
            GL.DisableClientState(ArrayCap.VertexArray);
            GL.BindTexture(TextureTarget.Texture2D, lastTexture);
            GL.MatrixMode(MatrixMode.Modelview);
            GL.PopMatrix();
            GL.MatrixMode(MatrixMode.Projection);
            GL.PopMatrix();
            GL.PopAttrib();
            GL.Viewport(lastViewport.X, lastViewport.Y, lastViewport.Z, lastViewport.W);
            GL.Scissor(lastScissorBox.X, lastScissorBox.Y, lastScissorBox.Z, lastScissorBox.W);
        }
Exemple #32
0
 public GraphicsList()
 {
     this.graphicsList = new DrawList();
     this.observers    = new List <DocumentDirtyObserver>();
     this.dirty        = false;
 }
Exemple #33
0
        /// <summary>
        /// Move selected items to back (end of the list)
        /// </summary>
        /// <returns>
        /// true if at least one object is moved
        /// </returns>
        public bool MoveSelectionToBack()
        {
            int n;
            int i;
            DrawList tempList;

            tempList = new DrawList();
            n = graphicsList.Count;

            // Read source list in reverse order, add every selected item
            // to temporary list and remove it from source list
            for (i = n - 1; i >= 0; i--)
            {
                if ((graphicsList[i]).Selected)
                {
                    tempList.Add(graphicsList[i]);
                    graphicsList.RemoveAt(i);
                }
            }

            // Read temporary list in reverse order and add every item
            // to the end of the source list
            n = tempList.Count;

            for (i = n - 1; i >= 0; i--)
            {
                graphicsList.Add(tempList[i]);
            }

            return (n > 0);
        }
 public string[] GetDynamicArgs(DrawList action)
 {
     return(Group(action.Cards.Count()));
 }