Ejemplo n.º 1
0
        private static int[,] CreateIndexies(byte[][] palette, byte[, ][] texel, bool alphaIgnore)
        {
            int[,] bitPixel = new int[4, 4];

            for (int i = 0; i < texel.GetLength(0); i++)
            {
                for (int k = 0; k < texel.GetLength(1); k++)
                {
                    if (!alphaIgnore && texel[i, k][3] == 0)
                    {
                        bitPixel[i, k] = 3;
                    }
                    else
                    {
                        int    index = 0;
                        double dist  = double.MaxValue;
                        for (int q = 0; q < palette.Length; q++)
                        {
                            double distance = GeometryOperation.Distance(BGR32ToRGB565Array(texel[i, k][0], texel[i, k][1], texel[i, k][2]), palette[q]);
                            if (distance < dist)
                            {
                                dist  = distance;
                                index = q;
                            }
                        }

                        bitPixel[i, k] = index;
                    }
                }
            }

            return(bitPixel);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Load all operations from xml
        /// </summary>
        private void LoadOperations(XPathNavigator navigator)
        {
            //Information of geometry operation
            navigator.MoveToChild("Operations", string.Empty);
            XPathNodeIterator nodes = navigator.SelectChildren("Operation", string.Empty);

            while (nodes.MoveNext( ))
            {
                XPathNavigator operationNavigator = nodes.Current.Clone( );

                string operationId = operationNavigator.GetAttribute("id", string.Empty);
                if (operationId != "-1")
                {
                    XPathNavigator operationNode = navigator.SelectSingleNode("/Document/Operations/Operation[@id='" + operationId + "']");

                    if (operationNode != null)
                    {
                        //Get the geometry operation
                        GeometryOperation operation = GeometryOperation.Create(operationNode, this);

                        if (operation is GeometryCreateOperation)
                        {
                            createOperation = operation as GeometryCreateOperation;
                        }

                        //Add it to the list
                        operations.Add(operation);

                        //Add it to the list of GEMS Project
                        Parent.AddOperation(operation);
                    }
                }
            }
            navigator.MoveToParent( );
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Create an single object with same information of original single
        /// </summary>
        public GEMSSingle Clone(int newId)
        {
            //Create a new single with information copyed from the specified single
            GEMSSingle newSingle = new GEMSSingle(newId, this.parent);

            //Basic information
            newSingle.name        = this.Name + "_" + newId.ToString( );
            newSingle.pec         = this.PEC;
            newSingle.singleColor = this.BaseSingleColor;

            //Material
            newSingle.material = this.material;

            //Excitation or Output
            if (currentEO != null)
            {
                newSingle.currentEO = this.currentEO.Clone(newSingle);
            }

            //Operation
            newSingle.operations = new List <GeometryOperation> ( );

            //Copy each operation mementoes
            foreach (GeometryOperation operation in this.operations)
            {
                GeometryOperation newOperation = operation.Clone(parent.CreateNewOperationId( ), newSingle);
                newSingle.operations.Add(newOperation);

                if (newOperation is GeometryCreateOperation)
                {
                    newSingle.createOperation = newOperation as GeometryCreateOperation;
                }

                //Add the operation to the list of GEMS Project
                Parent.AddOperation(newOperation);
            }

            //Create the model for new single
            newSingle.UpdatePrimaryModel( );
            newSingle.UpdateSingleEOSymbolModel( );

            return(newSingle);
        }
Ejemplo n.º 4
0
        private static Tuple <byte[], byte[]> FindOptimalColors(double[] start, double[] direction, double[,] colorMatrix)
        {
            List <double[]> proj = new List <double[]>();

            for (int i = 0; i < colorMatrix.GetLength(0); i++)
            {
                proj.Add(GeometryOperation.Projection(start, direction, colorMatrix, i));
            }

            double[] ColorA     = proj[0];
            double[] ColorB     = proj[1];
            double   DistanceAB = GeometryOperation.Distance(ColorA, ColorB);

            for (int i = 2; i < proj.Count; i++)
            {
                var DistanceAC = GeometryOperation.Distance(ColorA, proj[i]);
                var DistanceBC = GeometryOperation.Distance(ColorB, proj[i]);

                if (DistanceAB < DistanceAC | DistanceAB < DistanceBC)
                {
                    if (DistanceAC > DistanceBC)
                    {
                        DistanceAB = DistanceAC;
                        ColorB     = proj[i];
                    }
                    else
                    {
                        DistanceAB = DistanceBC;
                        ColorA     = proj[i];
                    }
                }
            }

            for (int i = 0; i < 3; i++)
            {
                if (ColorA[i] < 0)
                {
                    ColorA[i] = 0;
                }
                if (ColorB[i] < 0)
                {
                    ColorB[i] = 0;
                }
            }

            if (ColorA[0] > 31)
            {
                ColorA[0] = 31;
            }
            if (ColorB[0] > 31)
            {
                ColorB[0] = 31;
            }

            if (ColorA[1] > 63)
            {
                ColorA[1] = 63;
            }
            if (ColorB[1] > 63)
            {
                ColorB[1] = 63;
            }

            if (ColorA[2] > 31)
            {
                ColorA[2] = 31;
            }
            if (ColorB[2] > 31)
            {
                ColorB[2] = 31;
            }

            byte[] colorA = new byte[] { Convert.ToByte(ColorA[0]), Convert.ToByte(ColorA[1]), Convert.ToByte(ColorA[2]) };
            byte[] colorB = new byte[] { Convert.ToByte(ColorB[0]), Convert.ToByte(ColorB[1]), Convert.ToByte(ColorB[2]) };

            return(new Tuple <byte[], byte[]>(colorA, colorB));
        }
Ejemplo n.º 5
0
    public void Classify(String str)
    {
        str = str.ToUpper();
        str = str.Replace(" ", "");

        /*
         * 正方体/立方体ABCD-A1B1C1D1
         * 三棱锥P-ABC
         * 旋转体  矩形旋转体、三角形旋转体
         * 长宽高
         *
         * 作空间中一点A(1,1,1)
         * 作两点、线段中点              作AB中点C
         *      线段描点                     取AB上一点C
         *  作平面重心                   作面ABC..重心M
         *  连接两点                     连接MN
         * 过点作线段垂线               过点A作线段MN垂线交线段于点P
         *  过点作平面垂线               过点A作面ABC..垂线交面于点Q
         * 连接点作平面                 连接ABC..作平面
         * 测量长度、角度、面积          ...的长度/角度/面积
         */
        if (state != GeoState.Normal)
        {
            return;
        }
        if (str == "旋转")
        {
            Debug.Log("旋转");
            Tool tool = geoUI.toolPanel.toolGroups[2].Tools[0];
            //Debug.Log(tool.Type);  //reslovedBody
            SetState(GeoState.Auxiliary);

            currentOperation = new AddAuxiliaryOperation(this, geoCamera, stateController, geometry, geometryBehaviour, geoUI, tool);
            currentOperation.Start();
        }
        else if (str == "展开")
        {
            Debug.Log("展开");
            Tool tool = geoUI.toolPanel.toolGroups[2].Tools[1];
            //Debug.Log(tool.Type);  //reslovedBody
            SetState(GeoState.Auxiliary);

            currentOperation = new AddAuxiliaryOperation(this, geoCamera, stateController, geometry, geometryBehaviour, geoUI, tool);
            currentOperation.Start();
        }
        else if (str.Length < 3)
        {
            Debug.Log("input error");
        }
        else if (str.Substring(0, 3) == "正方体" || str.Substring(0, 3) == "立方体")
        {
            Debug.Log("正方体");
            Tool tool = geoUI.toolPanel.toolGroups[0].Tools[0];
            currentOperation = new GeometryOperation(this, toolController, stateController, tool, geometryBehaviour);
            String list = "";

            if (str.Length > 3)
            {
                //Debug.Log(str.Substring(3));
                String cuboidName = str.Substring(3);

                if (cuboidName.Length >= 9)
                {
                    for (int i = 0; i < cuboidName.Length; i++)
                    {
                        String item = cuboidName.Substring(i, 1);
                        if (Regex.IsMatch(cuboidName.Substring(i, 1), @"^[A-Za-z]+$"))
                        {
                            if (i == cuboidName.Length - 1)
                            {
                                list += item;
                            }
                            else
                            {
                                if (Regex.IsMatch(cuboidName.Substring(i + 1, 1), @"^[0-9]*$"))
                                {
                                    list += cuboidName.Substring(i, 2);
                                    if (i != cuboidName.Length - 2)
                                    {
                                        list += " ";
                                    }
                                    i++;
                                }
                                else
                                {
                                    list += item + " ";
                                }
                            }
                        }
                    }
                    //Debug.Log(list);
                    GeometryOperation opt = (GeometryOperation)currentOperation;
                    opt.ReSetSign(list);
                }
                else
                {
                    // default name
                }
            }

            currentOperation.Start();
        }
        else if (str.Substring(0, 3) == "三棱锥")
        {
            Debug.Log("三棱锥");
            Tool tool = geoUI.toolPanel.toolGroups[0].Tools[1];
            currentOperation = new GeometryOperation(this, toolController, stateController, tool, geometryBehaviour);
            String list = "";

            if (str.Length > 3)
            {
                Debug.Log(str.Substring(3));
                String triName = str.Substring(3);

                if (triName.Length >= 5)
                {
                    for (int i = 0; i < triName.Length; i++)
                    {
                        String item = triName.Substring(i, 1);
                        if (Regex.IsMatch(triName.Substring(i, 1), @"^[A-Za-z]+$"))
                        {
                            if (i == triName.Length - 1)
                            {
                                list += item;
                            }
                            else
                            {
                                if (Regex.IsMatch(triName.Substring(i + 1, 1), @"^[0-9]*$"))
                                {
                                    list += triName.Substring(i, 2);
                                    if (i != triName.Length - 2)
                                    {
                                        list += " ";
                                    }
                                    i++;
                                }
                                else
                                {
                                    list += item + " ";
                                }
                            }
                        }
                    }
                    Debug.Log(list);
                    GeometryOperation opt = (GeometryOperation)currentOperation;
                    opt.ReSetSign(list);
                }
                else
                {
                    // default name
                }
            }

            currentOperation.Start();
        }
        else if (str.IndexOf("旋转体") != -1)
        {
            Debug.Log("旋转体");
            Tool tool = geoUI.toolPanel.toolGroups[0].Tools[2];
            currentOperation = new GeometryOperation(this, toolController, stateController, tool, geometryBehaviour);
            currentOperation.Start();
            if (str == "矩形旋转体" || str == "长方形旋转体")
            {
                Tool tool1 = geoUI.toolPanel.toolGroups[1].Tools[0];
                Debug.Log(tool1.Description);
                //Debug.Log(tool1.Type);

                SetState(GeoState.Condition);

                currentOperation = new AddConditionOperation(this, stateController, geometry, geometryBehaviour, geoUI, tool1);
                currentOperation.Start();
            }
            else if (str == "三角形旋转体")
            {
                Tool tool1 = geoUI.toolPanel.toolGroups[1].Tools[1];
                Debug.Log(tool1.Description);
                //Debug.Log(tool1.Type);

                SetState(GeoState.Condition);

                currentOperation = new AddConditionOperation(this, stateController, geometry, geometryBehaviour, geoUI, tool1);
                currentOperation.Start();
            }
        }
        else if (str.IndexOf("空间一点") != -1)
        {
            Debug.Log("取空间一点");
        }
        else if (str.IndexOf("中点") != -1)
        {
            Debug.Log("中点");
            String line = "";
            for (int i = 1; i < str.Length - 2; i++)
            {
                if (Regex.IsMatch(str.Substring(i, 1), @"^[A-Za-z]+$"))
                {
                    if (Regex.IsMatch(str.Substring(i + 1, 1), @"^[0-9]*$"))
                    {
                        line += str.Substring(i, 1) + str.Substring(i + 1, 1) + " ";
                    }
                    else
                    {
                        line += str.Substring(i, 1) + " ";
                    }
                }
            }

            FormText    text1 = new FormText("作");
            String[]    eles  = line.Split(' ');
            FormElement ele1  = new FormElement(eles.Length - 1);
            for (int i = 0; i < eles.Length - 1; i++)
            {
                ele1.fields[i] = eles[i];
            }
            FormText    text2 = new FormText("中点");
            FormElement ele2  = new FormElement(1);
            if (Regex.IsMatch(str.Substring(str.Length - 2), @"^[A-Za-z0-9]+$"))
            {
                ele2.fields[0] = str.Substring(str.Length - 2);
            }
            else
            {
                ele2.fields[0] = str.Substring(str.Length - 1);
            }

            FormInput writeInput = new FormInput(4);
            writeInput.inputs[0] = text1;
            writeInput.inputs[1] = ele1;
            writeInput.inputs[2] = text2;
            writeInput.inputs[3] = ele2;

            Tool tool = geoUI.toolPanel.toolGroups[2].Tools[1];
            SetState(GeoState.Auxiliary);


            currentOperation = new AddAuxiliaryOperation(this, geoCamera, stateController, geometry, geometryBehaviour, geoUI, tool);
            AddAuxiliaryOperation opt = (AddAuxiliaryOperation)currentOperation;
            opt.SetWriteInput(writeInput);
            currentOperation.Start();
        }
        else if ((str.IndexOf("一点") != -1 && str.IndexOf("线段") != -1) || ((str.IndexOf("作线段") != -1 || str.IndexOf("做线段") != -1) && str.IndexOf("的点") != -1))
        {
            Debug.Log("取线段一点");

            String line = "";
            for (int i = 1; i < str.Length - 2; i++)
            {
                if (Regex.IsMatch(str.Substring(i, 1), @"^[A-Za-z]+$"))
                {
                    if (Regex.IsMatch(str.Substring(i + 1, 1), @"^[0-9]*$"))
                    {
                        line += str.Substring(i, 1) + str.Substring(i + 1, 1) + " ";
                    }
                    else
                    {
                        line += str.Substring(i, 1) + " ";
                    }
                }
            }
            //Debug.Log(line);
            FormText    text1 = new FormText("作线段");
            String[]    eles  = line.Split(' ');
            FormElement ele1  = new FormElement(eles.Length - 1);
            for (int i = 0; i < eles.Length - 1; i++)
            {
                ele1.fields[i] = eles[i];
            }
            FormText    text2 = new FormText("的点");
            FormElement ele2  = new FormElement(1);
            if (Regex.IsMatch(str.Substring(str.Length - 2), @"^[A-Za-z0-9]+$"))
            {
                ele2.fields[0] = str.Substring(str.Length - 2);
            }
            else
            {
                ele2.fields[0] = str.Substring(str.Length - 1);
            }
            //Debug.Log(ele2.fields[0]);
            FormInput writeInput = new FormInput(4);
            writeInput.inputs[0] = text1;
            writeInput.inputs[1] = ele1;
            writeInput.inputs[2] = text2;
            writeInput.inputs[3] = ele2;

            Tool tool = geoUI.toolPanel.toolGroups[2].Tools[2];
            SetState(GeoState.Auxiliary);


            currentOperation = new AddAuxiliaryOperation(this, geoCamera, stateController, geometry, geometryBehaviour, geoUI, tool);
            AddAuxiliaryOperation opt = (AddAuxiliaryOperation)currentOperation;
            opt.SetWriteInput(writeInput);
            currentOperation.Start();
        }
        else if (str.IndexOf("重心") != -1 || str.IndexOf("中心") != -1)
        {
            Debug.Log("重心");
            String face = "";
            for (int i = 1; i < str.Length - 3; i++)
            {
                if (Regex.IsMatch(str.Substring(i, 1), @"^[A-Za-z]+$"))
                {
                    if (Regex.IsMatch(str.Substring(i + 1, 1), @"^[0-9]*$"))
                    {
                        face += str.Substring(i, 1) + str.Substring(i + 1, 1) + " ";
                    }
                    else
                    {
                        face += str.Substring(i, 1) + " ";
                    }
                }
            }

            FormText    text1 = new FormText("作平面");
            String[]    eles  = face.Split(' ');
            FormElement ele1  = new FormElement(eles.Length - 1);
            for (int i = 0; i < eles.Length - 1; i++)
            {
                ele1.fields[i] = eles[i];
            }
            FormText    text2 = new FormText("的重心");
            FormElement ele2  = new FormElement(1);
            if (Regex.IsMatch(str.Substring(str.Length - 2), @"^[A-Za-z0-9]+$"))
            {
                ele2.fields[0] = str.Substring(str.Length - 2);
            }
            else
            {
                ele2.fields[0] = str.Substring(str.Length - 1);
            }
            FormInput writeInput = new FormInput(4);
            writeInput.inputs[0] = text1;
            writeInput.inputs[1] = ele1;
            writeInput.inputs[2] = text2;
            writeInput.inputs[3] = ele2;

            Tool tool = geoUI.toolPanel.toolGroups[2].Tools[3];
            SetState(GeoState.Auxiliary);


            currentOperation = new AddAuxiliaryOperation(this, geoCamera, stateController, geometry, geometryBehaviour, geoUI, tool);
            AddAuxiliaryOperation opt = (AddAuxiliaryOperation)currentOperation;
            opt.SetWriteInput(writeInput);
            currentOperation.Start();
        }
        else if (str.IndexOf("连接") != -1 && Regex.IsMatch(str.Substring(2), @"^[A-Za-z0-9]+$"))
        {
            Debug.Log("连接两点");

            String line = "";
            for (int i = 2; i < str.Length - 1; i++)
            {
                if (Regex.IsMatch(str.Substring(i, 1), @"^[A-Za-z]+$"))
                {
                    if (Regex.IsMatch(str.Substring(i + 1, 1), @"^[0-9]*$"))
                    {
                        line += str.Substring(i, 1) + str.Substring(i + 1, 1) + " ";
                    }
                    else
                    {
                        line += str.Substring(i, 1) + " ";
                        if (i == str.Length - 2)
                        {
                            line += str.Substring(i + 1);
                        }
                    }
                }
                else
                {
                    break;
                }
            }

            FormText    text1 = new FormText("连接");
            String[]    eles  = line.Split(' ');
            FormElement ele1  = new FormElement(eles.Length);
            for (int i = 0; i < eles.Length; i++)
            {
                ele1.fields[i] = eles[i];
            }
            FormText text2 = new FormText("作线段");

            FormInput writeInput = new FormInput(3);
            writeInput.inputs[0] = text1;
            writeInput.inputs[1] = ele1;
            writeInput.inputs[2] = text2;

            Tool tool = geoUI.toolPanel.toolGroups[2].Tools[4];
            SetState(GeoState.Auxiliary);


            currentOperation = new AddAuxiliaryOperation(this, geoCamera, stateController, geometry, geometryBehaviour, geoUI, tool);
            AddAuxiliaryOperation opt = (AddAuxiliaryOperation)currentOperation;
            opt.SetWriteInput(writeInput);
            currentOperation.Start();
        }
        else if (str.IndexOf("垂线") != -1 && str.IndexOf("线段") != -1)
        {
            Debug.Log("线段垂线");
            String point1 = "";
            for (int i = 1; i < 4; i++)
            {
                if (Regex.IsMatch(str.Substring(i, 1), @"^[A-Za-z]+$"))
                {
                    if (Regex.IsMatch(str.Substring(i + 1, 1), @"^[0-9]*$"))
                    {
                        point1 += str.Substring(i, 2);
                        //Debug.Log(point1 + "---");
                        break;
                    }
                    else
                    {
                        point1 += str.Substring(i, 1);
                        break;
                    }
                }
            }

            String face = "";
            for (int i = 5; i < str.Length - 2; i++)
            {
                if (Regex.IsMatch(str.Substring(i, 1), @"^[A-Za-z]+$"))
                {
                    if (Regex.IsMatch(str.Substring(i + 1, 1), @"^[0-9]*$"))
                    {
                        face += str.Substring(i, 2) + " ";
                        i++;
                    }
                    else
                    {
                        face += str.Substring(i, 1) + " ";
                    }
                }
            }

            String point2 = "";
            if (Regex.IsMatch(str.Substring(str.Length - 2), @"^[A-Za-z0-9]+$"))
            {
                point2 = str.Substring(str.Length - 2);
            }
            else if (Regex.IsMatch(str.Substring(str.Length - 1), @"^[A-Za-z]+$"))
            {
                point2 = str.Substring(str.Length - 1);
            }
            else
            {
                Debug.Log("point lost error");
                return;
            }

            FormText text1 = new FormText("过点");
            //Debug.Log(text1);
            FormElement ele1 = new FormElement(1);
            ele1.fields[0] = point1;
            //Debug.Log(ele1);
            FormText text2 = new FormText("作平面");
            //Debug.Log(text2);
            String[]    eles = face.Split(' ');
            FormElement ele2 = new FormElement(eles.Length - 1);
            for (int i = 0; i < eles.Length - 1; i++)
            {
                ele2.fields[i] = eles[i];
                //Debug.Log(eles[i] +"*");
            }
            FormText text3 = new FormText("的垂线");
            //Debug.Log(text3);
            FormText text4 = new FormText("交于点");
            //Debug.Log(text4);
            FormElement ele3 = new FormElement(1);
            ele3.fields[0] = point2;
            //Debug.Log(point2);

            FormInput writeInput = new FormInput(7);
            writeInput.inputs[0] = text1;
            writeInput.inputs[1] = ele1;
            writeInput.inputs[2] = text2;
            writeInput.inputs[3] = ele2;
            writeInput.inputs[4] = text3;
            writeInput.inputs[5] = text4;
            writeInput.inputs[6] = ele3;

            Tool tool = geoUI.toolPanel.toolGroups[2].Tools[5];
            SetState(GeoState.Auxiliary);


            currentOperation = new AddAuxiliaryOperation(this, geoCamera, stateController, geometry, geometryBehaviour, geoUI, tool);
            AddAuxiliaryOperation opt = (AddAuxiliaryOperation)currentOperation;
            opt.SetWriteInput(writeInput);
            currentOperation.Start();
        }
        else if (str.IndexOf("垂线") != -1 && str.IndexOf("平面") != -1)
        {
            Debug.Log("面垂线");

            String point1 = "";
            for (int i = 1; i < 4; i++)
            {
                if (Regex.IsMatch(str.Substring(i, 1), @"^[A-Za-z]+$"))
                {
                    if (Regex.IsMatch(str.Substring(i + 1, 1), @"^[0-9]*$"))
                    {
                        point1 += str.Substring(i, 2);
                        //Debug.Log(point1 + "---");
                        break;
                    }
                    else
                    {
                        point1 += str.Substring(i, 1);
                        break;
                    }
                }
            }

            String line = "";
            for (int i = 5; i < str.Length - 2; i++)
            {
                if (Regex.IsMatch(str.Substring(i, 1), @"^[A-Za-z]+$"))
                {
                    if (Regex.IsMatch(str.Substring(i + 1, 1), @"^[0-9]*$"))
                    {
                        line += str.Substring(i, 2) + " ";
                        i++;
                    }
                    else
                    {
                        line += str.Substring(i, 1) + " ";
                    }
                }
            }

            String point2 = "";
            if (Regex.IsMatch(str.Substring(str.Length - 2), @"^[A-Za-z0-9]+$"))
            {
                point2 = str.Substring(str.Length - 2);
            }
            else if (Regex.IsMatch(str.Substring(str.Length - 1), @"^[A-Za-z]+$"))
            {
                point2 = str.Substring(str.Length - 1);
            }
            else
            {
                Debug.Log("point lost error");
                return;
            }

            FormText text1 = new FormText("过点");
            //Debug.Log(text1);
            FormElement ele1 = new FormElement(1);
            ele1.fields[0] = point1;
            //Debug.Log(ele1);
            FormText text2 = new FormText("作线段");
            //Debug.Log(text2);
            String[]    eles = line.Split(' ');
            FormElement ele2 = new FormElement(eles.Length - 1);
            for (int i = 0; i < eles.Length - 1; i++)
            {
                ele2.fields[i] = eles[i];
                //Debug.Log(eles[i] +"*");
            }
            FormText text3 = new FormText("的垂线");
            //Debug.Log(text3);
            FormText text4 = new FormText("交于点");
            //Debug.Log(text4);
            FormElement ele3 = new FormElement(1);
            ele3.fields[0] = point2;
            //Debug.Log(point2);

            FormInput writeInput = new FormInput(7);
            writeInput.inputs[0] = text1;
            writeInput.inputs[1] = ele1;
            writeInput.inputs[2] = text2;
            writeInput.inputs[3] = ele2;
            writeInput.inputs[4] = text3;
            writeInput.inputs[5] = text4;
            writeInput.inputs[6] = ele3;

            Tool tool = geoUI.toolPanel.toolGroups[2].Tools[6];
            SetState(GeoState.Auxiliary);


            currentOperation = new AddAuxiliaryOperation(this, geoCamera, stateController, geometry, geometryBehaviour, geoUI, tool);
            AddAuxiliaryOperation opt = (AddAuxiliaryOperation)currentOperation;
            opt.SetWriteInput(writeInput);
            currentOperation.Start();
        }
        else if (str.IndexOf("连接") != -1 && (str.IndexOf("作平面") != -1 || str.IndexOf("做平面") != -1))
        {
            Debug.Log("平面");

            String face = "";
            for (int i = 2; i < str.Length - 3; i++)
            {
                if (Regex.IsMatch(str.Substring(i, 1), @"^[A-Za-z]+$"))
                {
                    if (Regex.IsMatch(str.Substring(i + 1, 1), @"^[0-9]*$"))
                    {
                        face += str.Substring(i, 1) + str.Substring(i + 1, 1) + " ";
                    }
                    else
                    {
                        face += str.Substring(i, 1) + " ";
                    }
                }
            }

            FormText    text1 = new FormText("连接");
            String[]    eles  = face.Split(' ');
            FormElement ele1  = new FormElement(eles.Length - 1);
            for (int i = 0; i < eles.Length - 1; i++)
            {
                ele1.fields[i] = eles[i];
            }
            FormText  text2      = new FormText("作平面");
            FormInput writeInput = new FormInput(3);
            writeInput.inputs[0] = text1;
            writeInput.inputs[1] = ele1;
            writeInput.inputs[2] = text2;

            Tool tool = geoUI.toolPanel.toolGroups[2].Tools[7];
            SetState(GeoState.Auxiliary);


            currentOperation = new AddAuxiliaryOperation(this, geoCamera, stateController, geometry, geometryBehaviour, geoUI, tool);
            AddAuxiliaryOperation opt = (AddAuxiliaryOperation)currentOperation;
            opt.SetWriteInput(writeInput);
            currentOperation.Start();
        }
        else if (str.IndexOf("长度") != -1)
        {
            Debug.Log("测量长度");

            String line = "";
            for (int i = 0; i < str.Length - 1; i++)
            {
                if (Regex.IsMatch(str.Substring(i, 1), @"^[A-Za-z]+$"))
                {
                    if (Regex.IsMatch(str.Substring(i + 1, 1), @"^[0-9]*$"))
                    {
                        line += str.Substring(i, 1) + str.Substring(i + 1, 1) + " ";
                    }
                    else
                    {
                        line += str.Substring(i, 1) + " ";
                    }
                }
            }

            FormText    text1 = new FormText("线段");
            String[]    eles  = line.Split(' ');
            FormElement ele1  = new FormElement(eles.Length - 1);
            for (int i = 0; i < eles.Length - 1; i++)
            {
                ele1.fields[i] = eles[i];
            }
            FormText  text2      = new FormText("的长度");
            FormInput writeInput = new FormInput(3);
            writeInput.inputs[0] = text1;
            writeInput.inputs[1] = ele1;
            writeInput.inputs[2] = text2;

            Tool tool = geoUI.toolPanel.toolGroups[3].Tools[0];
            SetState(GeoState.Measure);

            currentOperation = new AddMeasureOperation(this, stateController, geometry, geometryBehaviour, geoUI, tool);
            AddMeasureOperation opt = (AddMeasureOperation)currentOperation;
            opt.SetWriteInput(writeInput);
            currentOperation.Start();
        }
        else if (str.IndexOf("角度") != -1)
        {
            Debug.Log("测量角度");

            String angle = "";
            for (int i = 0; i < str.Length - 1; i++)
            {
                if (Regex.IsMatch(str.Substring(i, 1), @"^[A-Za-z]+$"))
                {
                    if (Regex.IsMatch(str.Substring(i + 1, 1), @"^[0-9]*$"))
                    {
                        angle += str.Substring(i, 1) + str.Substring(i + 1, 1) + " ";
                    }
                    else
                    {
                        angle += str.Substring(i, 1) + " ";
                    }
                }
            }

            FormText text1 = new FormText("∠");
            String[] eles  = angle.Split(' ');
            if (eles.Length - 1 != 3)
            {
                Debug.Log("angle input error");
                return;
            }
            FormElement ele1 = new FormElement(eles.Length - 1);
            for (int i = 0; i < eles.Length - 1; i++)
            {
                ele1.fields[i] = eles[i];
            }
            FormText  text2      = new FormText("的角度");
            FormInput writeInput = new FormInput(3);
            writeInput.inputs[0] = text1;
            writeInput.inputs[1] = ele1;
            writeInput.inputs[2] = text2;

            Tool tool = geoUI.toolPanel.toolGroups[3].Tools[1];
            SetState(GeoState.Measure);

            currentOperation = new AddMeasureOperation(this, stateController, geometry, geometryBehaviour, geoUI, tool);
            AddMeasureOperation opt = (AddMeasureOperation)currentOperation;
            opt.SetWriteInput(writeInput);
            currentOperation.Start();
        }
        else if (str.IndexOf("面积") != -1)
        {
            Debug.Log("测量面积");

            String face = "";
            for (int i = 1; i < str.Length - 1; i++)
            {
                if (Regex.IsMatch(str.Substring(i, 1), @"^[A-Za-z]+$"))
                {
                    if (Regex.IsMatch(str.Substring(i + 1, 1), @"^[0-9]*$"))
                    {
                        face += str.Substring(i, 1) + str.Substring(i + 1, 1) + " ";
                    }
                    else
                    {
                        face += str.Substring(i, 1) + " ";
                    }
                }
            }

            FormText    text1 = new FormText("平面");
            String[]    eles  = face.Split(' ');
            FormElement ele1  = new FormElement(eles.Length - 1);
            for (int i = 0; i < eles.Length - 1; i++)
            {
                ele1.fields[i] = eles[i];
            }
            FormText  text2      = new FormText("的面积");
            FormInput writeInput = new FormInput(3);
            writeInput.inputs[0] = text1;
            writeInput.inputs[1] = ele1;
            writeInput.inputs[2] = text2;

            Tool tool = geoUI.toolPanel.toolGroups[3].Tools[2];
            SetState(GeoState.Measure);

            currentOperation = new AddMeasureOperation(this, stateController, geometry, geometryBehaviour, geoUI, tool);
            AddMeasureOperation opt = (AddMeasureOperation)currentOperation;
            opt.SetWriteInput(writeInput);
            currentOperation.Start();
        }
        else
        {
            Debug.Log("analysis error");
        }
    }