Ejemplo n.º 1
0
    public override void Start()
    {
        if (conditionTool == null)
        {
            Debug.LogWarning(tool.Name + " Error!");
            geoController.EndOperation();
            return;
        }

        FormInput formInput = conditionTool.FormInput();

        if (formInput != null)
        {
            inputPanel.SetFormForInput(conditionTool.FormInput());

            inputPanel.OnValidate = (form) =>
            {
                return(conditionTool.ValidateInput(geometry, form));
            };

            inputPanel.OnClickSubmit = (form) =>
            {
                addCondition(geometry, form);
            };

            inputPanel.OnClickCancel = (form) =>
            {
                geoController.EndOperation();
            };
        }
        else
        {
            addCondition(geometry, null);
        }
    }
Ejemplo n.º 2
0
    public override void Start()
    {
        if (conditionTool == null)
        {
            Debug.LogWarning(tool.Name + " Error!");
            geoController.EndOperation();
            return;
        }

        inputPanel.SetFormForInput(conditionTool.FormInput());

        inputPanel.OnValidate = (form) =>
        {
            return(conditionTool.ValidateInput(geometry, form));
        };

        inputPanel.OnClickSubmit = (form) =>
        {
            Condition condition = conditionTool.GenerateCondition(geometry, form);

            bool result = geometry.Constructor.AddCondition(condition);

            if (result)
            {
                AddState(condition);
                geometryBehaviour.UpdateElements();
                geometryBehaviour.UpdateSignsPosition();
                geometryBehaviour.UpdateGizmos();

                Gizmo[] gizmos = condition.gizmos;
                if (gizmos != null)
                {
                    foreach (Gizmo gizmo in gizmos)
                    {
                        geometry.AddGizmo(gizmo);
                        geometryBehaviour.AddGizmo(gizmo);
                    }
                }

                stateController.RefreshStateCells();
            }
            else
            {
                // TODO
            }

            geoController.EndOperation();
        };

        inputPanel.OnClickCancel = (form) =>
        {
            geoController.EndOperation();
        };
    }
Ejemplo n.º 3
0
    public override void Start()
    {
        FormElement formElement = geoController.EdgeForm(geoEdge);

        activePanel.SetEdge(formElement);

        Vector2 position = geoCamera.WorldToViewPoint(geometry.EdgeCenter(geoEdge));

        elementPanel.SetPositionByAnchor(position);

        elementPanel.OnElementClickColor = (element, color) =>
        {
            geometry.SetElementColor(element, color);
            geometryBehaviour.GeometryElementColorChange(geoEdge, color);
        };

        elementPanel.OnElementClickStyle = (element, style) =>
        {
            geometry.SetElementStyle(element, style);
            geometryBehaviour.GeometryElementStyleChange(geoEdge, style);
        };

        elementPanel.OnElementVisible = () =>
        {
            return(geometryBehaviour.GeometryElementDiaplay(geoEdge));
        };

        elementPanel.OnElementClickDisplay = (visible) =>
        {
            geometryBehaviour.GeometryElementDiaplayChange(geoEdge, visible);
        };

        elementPanel.OnElementClickDelete = () =>
        {
            if (geoEdge.isBased)
            {
                return;
            }

            elementPanel.Close();
            geoController.EndOperation();
            geoController.DeleteEdgeOperation(geoEdge);
        };

        elementPanel.OnClose = () =>
        {
            geoController.EndOperation();
        };


        elementPanel.SetEdge(geoEdge);
    }
Ejemplo n.º 4
0
    public override void Start()
    {
        if (measureTool == null)
        {
            Debug.LogWarning(tool.Name + " Error!");
            geoController.EndOperation();
            return;
        }

        inputPanel.SetFormForInput(measureTool.FormInput());

        inputPanel.OnValidate = (form) =>
        {
            return(measureTool.ValidateInput(geometry, form));
        };

        inputPanel.OnClickSubmit = (form) =>
        {
            Measure measure = measureTool.GenerateMeasure(geometry, form);
            measure.InitWithGeometry(geometry);


            bool result = geometry.Implement.AddMeasure(measure);

            if (result)
            {
                AddState(measure);

                Gizmo[] gizmos = measure.gizmos;
                if (gizmos != null)
                {
                    foreach (Gizmo gizmo in gizmos)
                    {
                        geometry.AddGizmo(gizmo);
                        geometryBehaviour.AddGizmo(gizmo);
                    }
                }
            }
            else
            {
                // TODO
            }

            geoController.EndOperation();
        };

        inputPanel.OnClickCancel = (form) =>
        {
            geoController.EndOperation();
        };
    }
Ejemplo n.º 5
0
    public override void Start()
    {
        if (geometryTool == null)
        {
            Debug.LogWarning(tool.Name + " Error!");
            geoController.EndOperation();
            return;
        }

        geometry = geometryTool.GenerateGeometry();
        geoController.SetGeometry(geometry);

        AddState(geometry);

        geoController.EndOperation();
    }
Ejemplo n.º 6
0
    public override void Start()
    {
        HashSet <VertexUnit> vertices = geometry.Assistor.AuxiliaryTotalObserveVertices(auxiliary);

        SortedSet <Auxiliary> oberveAuxiliaries = new SortedSet <Auxiliary>(
            Comparer <Auxiliary> .Create((x, y) => y.id - x.id)
            );

        SortedSet <Measure> oberveMeasures = new SortedSet <Measure>(
            Comparer <Measure> .Create((x, y) => y.id - x.id)
            );

        foreach (VertexUnit unit in vertices)
        {
            oberveAuxiliaries.UnionWith(geometry.Assistor.VertexAuxiliaries(unit));
            oberveMeasures.UnionWith(geometry.Implement.VertexMeasures(unit));
        }

        oberveAuxiliaries.Add(auxiliary);

        foreach (Auxiliary oAuxiliary in oberveAuxiliaries)
        {
            geoController.RemoveAuxiliary(oAuxiliary);
        }
        foreach (Measure oMeasure in oberveMeasures)
        {
            geoController.RemoveMeasure(oMeasure);
        }

        geoController.RefreshGeometryBehaviour();

        geoController.EndOperation();
    }
Ejemplo n.º 7
0
    public override void Start()
    {
        geoController.RemoveCondition(condition);
        if (condition is RectangleCondition || condition is TriangleCondition)
        {
            geoController.ClearGeometry();
        }

        geoController.EndOperation();
    }
Ejemplo n.º 8
0
    public override void Start()
    {
        if (auxiliaryTool == null)
        {
            Debug.LogWarning(tool.Name + " Error!");
            geoController.EndOperation();
            return;
        }
        if (writeInput == null)
        {
            FormInput formInput = auxiliaryTool.FormInput();

            if (formInput != null)
            {
                inputPanel.SetFormForInput(formInput);

                inputPanel.OnValidate = (form) =>
                {
                    return(auxiliaryTool.ValidateInput(geometry, form));
                };

                inputPanel.OnClickSubmit = (form) =>
                {
                    geoController.record.SetForm(form);
                    geoController.records.Add(geoController.record);
                    addAuxiliary(geometry, form);
                };

                inputPanel.OnClickCancel = (form) =>
                {
                    geoController.EndOperation();
                };
            }
            else
            {
                addAuxiliary(geometry, null);
            }
        }
        else
        {
            addAuxiliary(geometry, writeInput);
        }
    }
Ejemplo n.º 9
0
    public override void Start()
    {
        if (geometryTool == null)
        {
            Debug.LogWarning(tool.Name + " Error!");
            geoController.EndOperation();
            return;
        }

        geometry = geometryTool.GenerateGeometry();

        //Debug.Log(geometry.VertexUnit(0));
        //Debug.Log(geometry.VertexSign(0));
        //Debug.Log(signs.Length);
        if (signs != null)
        {
            if (signs.Length == 8)
            {
                geometry.SetVertexSign(0, signs[0]);
                geometry.SetVertexSign(1, signs[1]);
                geometry.SetVertexSign(2, signs[2]);
                geometry.SetVertexSign(3, signs[3]);
                geometry.SetVertexSign(4, signs[4]);
                geometry.SetVertexSign(5, signs[5]);
                geometry.SetVertexSign(6, signs[6]);
                geometry.SetVertexSign(7, signs[7]);
            }
            else if (signs.Length == 4)
            {
                geometry.SetVertexSign(3, signs[0]);
                geometry.SetVertexSign(0, signs[1]);
                geometry.SetVertexSign(1, signs[2]);
                geometry.SetVertexSign(2, signs[3]);
            }
        }

        geoController.SetGeometry(geometry);

        AddState(geometry);

        geoController.EndOperation();
    }
Ejemplo n.º 10
0
    public override void Start()
    {
        if (measureTool == null)
        {
            Debug.LogWarning(tool.Name + " Error!");
            geoController.EndOperation();
            return;
        }
        if (writeInput == null)
        {
            FormInput formInput = measureTool.FormInput();
            if (formInput != null)
            {
                inputPanel.SetFormForInput(formInput);

                inputPanel.OnValidate = (form) =>
                {
                    return(measureTool.ValidateInput(geometry, form));
                };

                inputPanel.OnClickSubmit = (form) =>
                {
                    AddMeasure(geometry, form);
                };

                inputPanel.OnClickCancel = (form) =>
                {
                    geoController.EndOperation();
                };
            }
            else
            {
                AddMeasure(geometry, null);
            }
        }
        else
        {
            AddMeasure(geometry, writeInput);
        }
    }
    public override void Start()
    {
        geoController.RemoveCondition(condition);

        geoController.EndOperation();
    }
Ejemplo n.º 12
0
    public override void Start()
    {
        if (auxiliaryTool == null)
        {
            Debug.LogWarning(tool.Name + " Error!");
            geoController.EndOperation();
            return;
        }

        inputPanel.SetFormForInput(auxiliaryTool.FormInput());

        inputPanel.OnValidate = (form) =>
        {
            return(auxiliaryTool.ValidateInput(geometry, form));
        };

        inputPanel.OnClickSubmit = (form) =>
        {
            Auxiliary auxiliary = auxiliaryTool.GenerateAuxiliary(geometry, form);
            auxiliary.InitWithGeometry(geometry);

            VertexUnit[] units    = auxiliary.units;
            GeoElement[] elements = auxiliary.elements;

            bool result = geometry.Assistor.AddAuxiliary(auxiliary);

            if (result)
            {
                foreach (VertexUnit unit in units)
                {
                    geometry.AddVertexUnit(unit);
                }

                foreach (GeoElement element in elements)
                {
                    geometry.AddElement(element);
                }

                AddState(auxiliary);

                geometryBehaviour.UpdateElements();
                foreach (GeoElement element in elements)
                {
                    geometryBehaviour.AddElement(element);
                }

                geometryBehaviour.UpdateSignsPosition();
                foreach (VertexUnit unit in units)
                {
                    geometryBehaviour.AddSign(unit.id);
                }


                Gizmo[] gizmos = auxiliary.gizmos;
                if (gizmos != null)
                {
                    foreach (Gizmo gizmo in gizmos)
                    {
                        geometry.AddGizmo(gizmo);
                        geometryBehaviour.AddGizmo(gizmo);
                    }
                }

                geometryBehaviour.UpdateGeometryShade();
            }
            else
            {
                // TODO
            }

            geoController.EndOperation();
        };

        inputPanel.OnClickCancel = (form) =>
        {
            geoController.EndOperation();
        };
    }
Ejemplo n.º 13
0
    public override void Start()
    {
        geometryBehaviour.HighlightVertex(geoVertex, true);

        FormElement formElement = geoController.VertexForm(geoVertex);

        activePanel.SetVertex(formElement);

        Vector3 worldPosition = geometry.UnitVector(geoVertex.Id);
        Vector2 position      = geoCamera.WorldToViewPoint(worldPosition);

        elementPanel.SetPositionByAnchor(position);


        elementPanel.OnElementClickColor = (element, color) =>
        {
            geometry.SetElementColor(element, color);
            geometryBehaviour.GeometryElementColorChange(geoVertex, color);
        };

        elementPanel.OnElementClickStyle = (element, style) =>
        {
            geometry.SetElementStyle(element, style);
            geometryBehaviour.GeometryElementStyleChange(geoVertex, style);
        };

        elementPanel.OnElementVisible = () =>
        {
            return(geometryBehaviour.GeometryElementDiaplay(geoVertex));
        };

        elementPanel.OnElementClickDisplay = (visible) =>
        {
            geometryBehaviour.GeometryElementDiaplayChange(geoVertex, visible);
        };

        // Sign
        int    vertexId = geoVertex.Id;
        string newSign  = geometry.VertexSign(vertexId);

        elementPanel.OnSignButtonChange = (open) =>
        {
            if (open)
            {
                geometryBehaviour.SignState(vertexId, SignState.Highlight);
            }
            else
            {
                geometry.SetVertexSign(vertexId, newSign);
                geometryBehaviour.SignState(vertexId, SignState.Normal);
                geometryBehaviour.UpdateSignText(vertexId);

                stateController.RefreshStateCellById(vertexId);
            }
        };

        elementPanel.OnSignDefault = () =>
        {
            return(geometry.VertexSign(vertexId));
        };

        elementPanel.OnSignInputChanged = (sign) =>
        {
            newSign = sign;
            geometryBehaviour.SignText(vertexId, sign);
        };

        elementPanel.OnSignInputValidate = (sign) =>
        {
            bool valid = sign != "" && geometry.CanSetVertexSign(vertexId, sign);
            geometryBehaviour.SignState(vertexId, valid ? SignState.Valid : SignState.Error);
            return(valid);
        };


        elementPanel.OnElementClickDelete = () =>
        {
            if (geoVertex.isBased)
            {
                return;
            }

            elementPanel.Close();
            geoController.EndOperation();
            geoController.DeleteVertexOperation(geoVertex);
        };

        elementPanel.OnElementClickCoordinate = () =>
        {
            if (!geoVertex.isSpace)
            {
                return;
            }

            elementPanel.Close();
            geoController.EndOperation();
            geoController.VertexCoordinateOperation(geoVertex);
        };


        elementPanel.OnClose = () =>
        {
            geoController.EndOperation();
        };

        // Final
        elementPanel.SetVertex(geoVertex);
    }
Ejemplo n.º 14
0
    public override void Start()
    {
        FormInput formInput;

        string  sign     = geometry.VertexSign(vertexUnit.id);
        Vector3 position = vertexUnit.Position();


        formInput = new FormInput(8);
        FormNum formNumX = new FormNum(position.x);
        FormNum formNumY = new FormNum(position.y);
        FormNum formNumZ = new FormNum(position.z);

        formNumX.format = UIConstants.PointFormat;
        formNumY.format = UIConstants.PointFormat;
        formNumZ.format = UIConstants.PointFormat;

        FormElement formElement = new FormElement(1);

        formElement.fields[0] = sign;

        formInput.inputs[0] = formElement;
        formInput.inputs[1] = new FormText("(");
        formInput.inputs[2] = formNumX;
        formInput.inputs[3] = new FormText(",");
        formInput.inputs[4] = formNumY;
        formInput.inputs[5] = new FormText(",");
        formInput.inputs[6] = formNumZ;
        formInput.inputs[7] = new FormText(")");

        inputPanel.SetFormForInput(formInput);

        inputPanel.OnValidate = (form) =>
        {
            return(!formNumX.isEmpty && !formNumY.isEmpty && !formNumZ.isEmpty);
        };

        inputPanel.OnClickSubmit = (form) =>
        {
            float x = formNumX.num;
            float y = formNumY.num;
            float z = formNumZ.num;

            Vector3 newPosition = new Vector3(x, y, z);

            geometry.SetUnitVector(vertexUnit.id, newPosition);

            stateController.RefreshStateCellById(vertexUnit.id);

            geometryBehaviour.UpdateElements();
            geometryBehaviour.UpdateSignsPosition();
            geometryBehaviour.UpdateGizmos();

            geoController.EndOperation();
        };

        inputPanel.OnClickCancel = (form) =>
        {
            geoController.EndOperation();
        };
    }
Ejemplo n.º 15
0
    public override void Start()
    {
        geoController.ClearGeometry(3);

        geoController.EndOperation();
    }
Ejemplo n.º 16
0
    public override void Start()
    {
        geoController.RemoveMeasure(measure);

        geoController.EndOperation();
    }
Ejemplo n.º 17
0
 public override void Start()
 {
     geoController.EndOperation();
 }
Ejemplo n.º 18
0
 private void LongPressEnd()
 {
     geoController.EndOperation();
 }