예제 #1
0
    public void AddColor(Mesh mesh, List <Vector3> displacements, List <int> surfaceIndices, int[] surfaceValues)
    {
        Vector3 maxVector = Vector3.zero;
        Vector3 minVector = Vector3.positiveInfinity;

        for (int i = 0; i < displacements.Count; i++)
        {
            maxVector = (displacements[i].magnitude > maxVector.magnitude) ? displacements[i] : maxVector;
            minVector = (displacements[i].magnitude < minVector.magnitude) ? displacements[i] : minVector;
        }

        float interval = ((maxVector.magnitude - minVector.magnitude) / (colorCode.Length - 1));

        Vector3[] vertices = mesh.vertices;
        int[]     faces    = mesh.triangles;
        Color[]   colors   = new Color[vertices.Length];
        for (int i = 0; i < surfaceIndices.Count; i++)
        {
            int vertexIndex = surfaceValues[surfaceIndices[i]];

            colors[vertexIndex] = CalculateColor(displacements[i].magnitude, minVector.magnitude, interval);
        }
        mesh.colors = colors;
        mesh.RecalculateNormals();
        ScaleText scaleText = GameObject.Find("ScaleText").GetComponent <ScaleText>();

        scaleText.writeText(maxVector.ToString());
    }
예제 #2
0
        private void Scale_LostFocus(object sender, RoutedEventArgs e)
        {
            BindingExpression bindingExp = ScaleText.GetBindingExpression(TextBox.TextProperty);

            bindingExp.UpdateSource();

            CalculateAndAddLineGraphics();
        }
예제 #3
0
        void PrintToUI()
        {
            ScaleText scaler = GameObject.FindGameObjectWithTag("TextContent").GetComponent <ScaleText>();

            foreach (var line in lines)
            {
                scaler.SetText(line);
            }
        }
예제 #4
0
        /// <summary>
        /// 속성 중 Attribute Node로 표현해야 한다.
        /// </summary>
        /// <param name="writer"></param>
        public override void GenerateXmlAttributes(System.Xml.XmlWriter writer)
        {
            base.GenerateXmlAttributes(writer);

            if (OrigW.HasValue)
            {
                writer.WriteAttributeString("origW", OrigW.ToString());
            }
            if (OrigH.HasValue)
            {
                writer.WriteAttributeString("origH", OrigH.ToString());
            }

            if (AutoScale.HasValue)
            {
                writer.WriteAttributeString("AutoScale", AutoScale.GetHashCode().ToString());
            }
            if (ConstrainedScale.HasValue)
            {
                writer.WriteAttributeString("ConstrainedScale", ConstrainedScale.GetHashCode().ToString());
            }
            if (ScaleImages.HasValue)
            {
                writer.WriteAttributeString("ScaleImages", ScaleImages.GetHashCode().ToString());
            }
            if (ScaleText.HasValue)
            {
                writer.WriteAttributeString("ScaleText", ScaleText.GetHashCode().ToString());
            }

            if (XShift.HasValue)
            {
                writer.WriteAttributeString("XShift", XShift.ToString());
            }
            if (YShift.HasValue)
            {
                writer.WriteAttributeString("YShift", YShift.ToString());
            }
        }
예제 #5
0
                /// <summary>
                /// Displays the specified text within the specified rectangular region.
                /// </summary>
                /// <param name="text">The text to display.</param>
                /// <param name="x">The X coordinate of the rectangular region.</param>
                /// <param name="y">The Y coordinate of the rectangular region.</param>
                /// <param name="width">The width of the rectangular region.</param>
                /// <param name="height">The height of the rectangular region.</param>
                /// <param name="color">The text color.</param>
                /// <param name="font">The text font.</param>
                /// <param name="textAlignment">A value from the <see cref="TextAlign"/> enumeration that specifies how to align the text within the rectangular region.</param>
                /// <param name="wordWrap">A value from the <see cref="WordWrap"/> enumeration that specifies how to wrap the text within the rectangular region.</param>
                /// <param name="trimming">A value from the <see cref="Trimming"/> enumeration that specifies how to trim excess text.</param>
                /// <param name="scaleTextToFit">A value from the <see cref="ScaleText"/> enumeration that specifies how the text should be scaled.</param>
                public void DisplayTextInRectangle(string text, uint x, uint y, uint width, uint height,
                    Color color, Font font, TextAlign textAlignment, WordWrap wordWrap, Trimming trimming, ScaleText scaleTextToFit)
                {
                    uint dtFlags = Bitmap.DT_None;

                    switch (textAlignment)
                    {
                        case TextAlign.Center:
                            dtFlags |= Bitmap.DT_AlignmentCenter;
                            break;
                        case TextAlign.Left:
                            dtFlags |= Bitmap.DT_AlignmentLeft;
                            break;
                        case TextAlign.Right:
                            dtFlags |= Bitmap.DT_AlignmentRight;
                            break;
                        default:
                            break;
                    }

                    switch (trimming)
                    {
                        case Trimming.CharacterEllipsis:
                            dtFlags |= Bitmap.DT_TrimmingCharacterEllipsis;
                            break;
                        case Trimming.WordEllipsis:
                            dtFlags |= Bitmap.DT_TrimmingWordEllipsis;
                            break;
                        default:
                            break;
                    }


                    if (wordWrap == WordWrap.Wrap)
                        dtFlags |= Bitmap.DT_WordWrap;

                    if (scaleTextToFit == ScaleText.None)
                        dtFlags |= Bitmap.DT_IgnoreHeight;

                    _display.DrawTextInRect(text, (int)x, (int)y, (int)width, (int)height, dtFlags, color, font);

                    if (AutoRedraw) Redraw();
                }
                /// <summary>
                /// Displays the specified text within the specified rectangular region.
                /// </summary>
                /// <param name="text">The text to display.</param>
                /// <param name="x">The X coordinate of the rectangular region.</param>
                /// <param name="y">The Y coordinate of the rectangular region.</param>
                /// <param name="width">The width of the rectangular region.</param>
                /// <param name="height">The height of the rectangular region.</param>
                /// <param name="color">The text color.</param>
                /// <param name="font">The text font.</param>
                /// <param name="textAlignment">A value from the <see cref="TextAlign"/> enumeration that specifies how to align the text within the rectangular region.</param>
                /// <param name="wordWrap">A value from the <see cref="WordWrap"/> enumeration that specifies how to wrap the text within the rectangular region.</param>
                /// <param name="trimming">A value from the <see cref="Trimming"/> enumeration that specifies how to trim excess text.</param>
                /// <param name="scaleTextToFit">A value from the <see cref="ScaleText"/> enumeration that specifies how the text should be scaled.</param>
                public void DisplayTextInRectangle(string text, uint x, uint y, uint width, uint height,
                                                   Color color, Font font, TextAlign textAlignment, WordWrap wordWrap, Trimming trimming, ScaleText scaleTextToFit)
                {
                    uint dtFlags = Bitmap.DT_None;

                    switch (textAlignment)
                    {
                    case TextAlign.Center:
                        dtFlags |= Bitmap.DT_AlignmentCenter;
                        break;

                    case TextAlign.Left:
                        dtFlags |= Bitmap.DT_AlignmentLeft;
                        break;

                    case TextAlign.Right:
                        dtFlags |= Bitmap.DT_AlignmentRight;
                        break;

                    default:
                        break;
                    }

                    switch (trimming)
                    {
                    case Trimming.CharacterEllipsis:
                        dtFlags |= Bitmap.DT_TrimmingCharacterEllipsis;
                        break;

                    case Trimming.WordEllipsis:
                        dtFlags |= Bitmap.DT_TrimmingWordEllipsis;
                        break;

                    default:
                        break;
                    }


                    if (wordWrap == WordWrap.Wrap)
                    {
                        dtFlags |= Bitmap.DT_WordWrap;
                    }

                    if (scaleTextToFit == ScaleText.None)
                    {
                        dtFlags |= Bitmap.DT_IgnoreHeight;
                    }

                    _display.DrawTextInRect(text, (int)x, (int)y, (int)width, (int)height, dtFlags, color, font);

                    if (AutoRedraw)
                    {
                        Redraw();
                    }
                }
예제 #7
0
        /// <summary>
        /// 속성 중 Attribute Node로 표현해야 한다.
        /// </summary>
        /// <param name="writer"></param>
        public override void GenerateXmlAttributes(System.Xml.XmlWriter writer)
        {
            base.GenerateXmlAttributes(writer);

            if (Id.IsNotWhiteSpace())
            {
                writer.WriteAttributeString("Id", Id);
            }
            if (X.HasValue)
            {
                writer.WriteAttributeString("x", X.ToString());
            }
            if (Y.HasValue)
            {
                writer.WriteAttributeString("y", Y.ToString());
            }
            if (Alpha.HasValue)
            {
                writer.WriteAttributeString("Alpha", Alpha.ToString());
            }
            if (XScale.HasValue)
            {
                writer.WriteAttributeString("XScale", XScale.ToString());
            }
            if (YScale.HasValue)
            {
                writer.WriteAttributeString("YScale", YScale.ToString());
            }
            if (OrigW.HasValue)
            {
                writer.WriteAttributeString("origW", OrigW.ToString());
            }
            if (OrigH.HasValue)
            {
                writer.WriteAttributeString("origH", OrigH.ToString());
            }
            if (AutoScale.HasValue)
            {
                writer.WriteAttributeString("AutoScale", AutoScale.GetHashCode().ToString());
            }
            if (ConstrainedScale.HasValue)
            {
                writer.WriteAttributeString("ConstrainedScale", ConstrainedScale.GetHashCode().ToString());
            }
            if (ScaleImages.HasValue)
            {
                writer.WriteAttributeString("ScaleImages", ScaleImages.GetHashCode().ToString());
            }
            if (ScaleText.HasValue)
            {
                writer.WriteAttributeString("ScaleText", ScaleText.GetHashCode().ToString());
            }
            if (GrpXShift.HasValue)
            {
                writer.WriteAttributeString("GrpXShift", GrpXShift.ToString());
            }
            if (GrpYShift.HasValue)
            {
                writer.WriteAttributeString("GrpXShift", GrpXShift.ToString());
            }

            if (ShowBelow.HasValue)
            {
                writer.WriteAttributeString("ShowBelow", ShowBelow.GetHashCode().ToString());
            }
            if (Visible.HasValue)
            {
                writer.WriteAttributeString("Visible", Visible.GetHashCode().ToString());
            }

            if (ToolText.IsNotWhiteSpace())
            {
                writer.WriteAttributeString("ToolText", ToolText);
            }

            if (_link != null)
            {
                _link.GenerateXmlAttributes(writer);
            }
        }
예제 #8
0
        public void PrintToUI(string newLine)
        {
            ScaleText scaler = GameObject.FindGameObjectWithTag("TextContent").GetComponent <ScaleText>();

            scaler.SetText(newLine + "\n");
        }
예제 #9
0
                /// <summary>
                /// Displays the specified text within the specified rectangular region.
                /// </summary>
                /// <param name="text">The text to display.</param>
                /// <param name="x">The X coordinate of the rectangular region.</param>
                /// <param name="y">The Y coordinate of the rectangular region.</param>
                /// <param name="width">The width of the rectangular region.</param>
                /// <param name="height">The height of the rectangular region.</param>
                /// <param name="color">The text color.</param>
                /// <param name="font">The text font.</param>
                /// <param name="textAlignment">A value from the <see cref="TextAlign"/> enumeration that specifies how to align the text within the rectangular region.</param>
                /// <param name="wordWrap">A value from the <see cref="WordWrap"/> enumeration that specifies how to wrap the text within the rectangular region.</param>
                /// <param name="trimming">A value from the <see cref="Trimming"/> enumeration that specifies how to trim excess text.</param>
                /// <param name="scaleTextToFit">A value from the <see cref="ScaleText"/> enumeration that specifies how the text should be scaled.</param>
                public void DisplayTextInRectangle(string text, int x, int y, int width, int height,
                    Color color, Font font, TextAlign textAlignment, WordWrap wordWrap, Trimming trimming, ScaleText scaleTextToFit)
                {
                    uint dtFlags = Bitmap.DT_None;

                    switch (textAlignment)
                    {
                        case TextAlign.Center:
                            dtFlags |= Bitmap.DT_AlignmentCenter;
                            break;
                        case TextAlign.Left:
                            dtFlags |= Bitmap.DT_AlignmentLeft;
                            break;
                        case TextAlign.Right:
                            dtFlags |= Bitmap.DT_AlignmentRight;
                            break;
                        default:
                            break;
                    }

                    switch (trimming)
                    {
                        case Trimming.CharacterEllipsis:
                            dtFlags |= Bitmap.DT_TrimmingCharacterEllipsis;
                            break;
                        case Trimming.WordEllipsis:
                            dtFlags |= Bitmap.DT_TrimmingWordEllipsis;
                            break;
                        default:
                            break;
                    }


                    if (wordWrap == WordWrap.Wrap)
                        dtFlags |= Bitmap.DT_WordWrap;

                    if (scaleTextToFit == ScaleText.None)
                        dtFlags |= Bitmap.DT_IgnoreHeight;

                    _screen.DrawTextInRect(text, x, y, width, height, dtFlags, color, font);

                    if (_autoRedraw)
                    {
                        if (_redrawAll)
                        {
                            _displayModule.Paint(_screen, 0, 0, _width, _height);
                            _redrawAll = false;
                        }
                        else
                        {
                            int right, bottom;
                            font.ComputeTextInRect(text, out right, out bottom, 0, 0, width, height, dtFlags);

                            right += x;
                            bottom += y;

                            if (right >= _width) right = _width - 1;
                            if (bottom >= _height) bottom = _height - 1;

                            if (x < 0) x = 0;
                            if (y < 0) y = 0;

                            if (right >= 0 && bottom >= 0 && x < _width && y < _height)
                                _displayModule.Paint(_screen, x, y, right - x + 1, bottom - y + 1);
                        }
                    }
                }
예제 #10
0
    void Start()
    {
        // OpCode Hash Tables that use strings. Will further be used in OperationManager and UIManager
        rFormat = new Dictionary <Tuple <byte, byte>, string>()
        {
            { new Tuple <byte, byte>(0, 0), "SLL" },
            { new Tuple <byte, byte>(0, 2), "SRL" },
            { new Tuple <byte, byte>(0, 3), "SRA" },
            { new Tuple <byte, byte>(0, 4), "SLLV" },
            { new Tuple <byte, byte>(0, 6), "SRLV" },
            { new Tuple <byte, byte>(0, 7), "SRAV" },
            { new Tuple <byte, byte>(0, 8), "JR" },
            { new Tuple <byte, byte>(0, 9), "JALR" },
            { new Tuple <byte, byte>(0, 10), "MOVZ" },
            { new Tuple <byte, byte>(0, 11), "MOVN" },
            { new Tuple <byte, byte>(0, 12), "SYSCALL" },
            { new Tuple <byte, byte>(0, 16), "MFHI" },
            { new Tuple <byte, byte>(0, 17), "MTHI" },
            { new Tuple <byte, byte>(0, 18), "MFLO" },
            { new Tuple <byte, byte>(0, 19), "MTLO" },
            { new Tuple <byte, byte>(0, 24), "MULT" },
            { new Tuple <byte, byte>(0, 25), "MULTU" },
            { new Tuple <byte, byte>(0, 26), "DIV" },
            { new Tuple <byte, byte>(0, 27), "DIVU" },
            { new Tuple <byte, byte>(0, 32), "ADD" },
            { new Tuple <byte, byte>(0, 33), "ADDU" },
            { new Tuple <byte, byte>(0, 34), "SUB" },
            { new Tuple <byte, byte>(0, 35), "SUBU" },
            { new Tuple <byte, byte>(0, 36), "AND" },
            { new Tuple <byte, byte>(0, 37), "OR" },
            { new Tuple <byte, byte>(0, 38), "XOR" },
            { new Tuple <byte, byte>(0, 39), "NOR" },
            { new Tuple <byte, byte>(0, 42), "SLT" },
            { new Tuple <byte, byte>(0, 43), "SLTU" }
        };

        iFormat = new Dictionary <byte, string>()
        {
            { 4, "BEQ" },
            { 5, "BNE" },
            { 6, "BLEZ" },
            { 7, "BGTZ" },
            { 8, "ADDI" },
            { 9, "ADDIU" },
            { 10, "SLTI" },
            { 11, "SLTIU" },
            { 12, "ANDI" },
            { 13, "ORI" },
            { 14, "XORI" },
            { 15, "LUI" },
            { 32, "LB" },
            { 33, "LH" },
            { 35, "LW" },
            { 36, "LBU" },
            { 37, "LHU" },
            { 40, "SB" },
            { 41, "SH" },
            { 43, "SW" }
        };

        jFormat = new Dictionary <byte, string>()
        {
            { 2, "J" },
            { 3, "JAL" }
        };

        consoleText = GameObject.FindGameObjectWithTag("ConsoleContent").GetComponent <ScaleText>();
        programText = GameObject.FindGameObjectWithTag("TextContent").GetComponent <ScaleText>();

        memoryDynaTexts  = new Dictionary <uint, DynamicText>();
        programDynaTexts = new Dictionary <uint, DynamicText>();

        tempPC = 0x003FFFFC;         // start 4 below normal PC starting point
    }
예제 #11
0
        private bool method_0()
        {
            IActiveView        activeView        = this._context.ActiveView;
            IGraphicsContainer graphicsContainer = activeView.GraphicsContainer;
            bool result;

            if (graphicsContainer == null)
            {
                result = false;
            }
            else
            {
                try
                {
                    frmSymbolSelector frmSymbolSelector = new frmSymbolSelector();
                    if (frmSymbolSelector == null)
                    {
                        result = false;
                        return(result);
                    }
                    IScaleText scaleText = new ScaleText();
                    frmSymbolSelector.SetSymbol(scaleText);
                    frmSymbolSelector.SetStyleGallery(this._context.StyleGallery);
                    if (frmSymbolSelector.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                    {
                        scaleText = (frmSymbolSelector.GetSymbol() as IScaleText);
                        if (scaleText == null)
                        {
                            result = false;
                            return(result);
                        }
                        UID clsid = new UID
                        {
                            Value = "esriCarto.ScaleText"
                        };
                        IMapFrame mapFrame = graphicsContainer.FindFrame(activeView.FocusMap) as IMapFrame;
                        scaleText.MapUnits = mapFrame.Map.MapUnits;
                        IMapSurroundFrame mapSurroundFrame = mapFrame.CreateSurroundFrame(clsid, scaleText);
                        IElement          element          = mapSurroundFrame as IElement;
                        IEnvelope         envelope         = new Envelope() as IEnvelope;
                        envelope.PutCoords(5.0, 13.0, 8.0, 14.0);
                        IEnvelope envelope2 = new Envelope() as IEnvelope;
                        scaleText.QueryBounds(this._context.ActiveView.ScreenDisplay, envelope, envelope2);
                        element.Geometry = envelope2;
                        INewElementOperation operation = new NewElementOperation
                        {
                            ActiveView = this._context.ActiveView,
                            Element    = element
                        };
                        this._context.OperationStack.Do(operation);
                        result = true;
                        return(result);
                    }
                }
                catch
                {
                }
                result = false;
            }
            return(result);
        }