Esempio n. 1
0
        private void OnButtonClick(object sender, EventArgs e)
        {
            switch (((Button)sender).Name)
            {
            case "btnClear":
                txtVisibilityExpression.Text         = "";
                _shapefileLayer.VisibilityExpression = "";
                global.MappingForm.MapControl.Redraw();
                break;

            case "btnLabelFeatures":
                var labelsForm = LabelsForm.GetInstance(_mapLayers);
                if (!labelsForm.Visible)
                {
                    labelsForm.Show(this);
                }
                else
                {
                    labelsForm.BringToFront();
                }
                break;

            case "btnLabelCategories":
                break;

            case "btnFeatureSymbols":
                switch (_shapefileLayer.ShapefileType)
                {
                case ShpfileType.SHP_POINT:
                    var pointSymbologyForm = PointLayerSymbologyForm.GetInstance(this, _mapLayer);
                    if (pointSymbologyForm.Visible)
                    {
                        pointSymbologyForm.BringToFront();
                    }
                    else
                    {
                        pointSymbologyForm.Show(this);
                    }
                    break;

                case ShpfileType.SHP_POLYGON:
                case ShpfileType.SHP_POLYLINE:
                    var symbologyForm = PolygonLineLayerSymbologyForm.GetInstance(this, _mapLayer);
                    if (symbologyForm.Visible)
                    {
                        symbologyForm.BringToFront();
                    }
                    else
                    {
                        symbologyForm.Show(this);
                    }
                    break;
                }

                break;

            case "btnFeatureCategories":
                break;

            case "btnClose":
                Close();
                break;

            case "btnDefineVisibilityExpression":
                var visibilityQueryForm = VisibilityQueryForm.GetInstance(_mapLayers);
                visibilityQueryForm.VisibilityExpression = txtVisibilityExpression.Text;
                visibilityQueryForm.ExpressionTarget     = VisibilityExpressionTarget.ExpressionTargetShape;
                if (!visibilityQueryForm.Visible)
                {
                    visibilityQueryForm.Show(this);
                }
                else
                {
                    visibilityQueryForm.BringToFront();
                }
                break;

            case "btnApplyVisibility":
                if (txtVisibilityExpression.Text.Length == 0)
                {
                    _shapefileLayer.VisibilityExpression = "";
                }
                else
                {
                    _shapefileLayer.VisibilityExpression = _mapLayer.ShapesVisibilityExpression;
                }
                global.MappingForm.MapControl.Redraw();
                break;

            case "btnApply":
                _mapLayers.UpdateCurrentLayerName(txtLayerName.Text);
                btnApply.Enabled = false;
                break;
            }
        }