public static VisibilityQueryForm GetInstance(MapLayersHandler handler)
 {
     if (_instance == null)
     {
         _instance = new VisibilityQueryForm(handler);
     }
     return(_instance);
 }
Пример #2
0
        private void OnButtonClick(object sender, EventArgs e)
        {
            switch (((Button)sender).Name)
            {
            case "btnOk":
                DialogResult = DialogResult.OK;
                ApplyLabelProperties();
                if (_gearInventoryForm != null)
                {
                    _gearInventoryForm.Labels = _shapeFile.Labels;
                }
                Close();
                break;

            case "btnApply":
                ApplyLabelProperties();
                break;

            case "btnCancel":
                DialogResult = DialogResult.Cancel;
                Close();
                break;

            case "btnClear":
                PromptRemoveLabels();
                break;

            case "btnNewLine":
                txtLabelSourceField.Text += Environment.NewLine;
                break;

            case "btnQuotes":
                txtLabelSourceField.Text += "\" \"";
                break;

            case "btnPlus":
                txtLabelSourceField.Text += " + ";
                break;

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

                break;
            }
        }
Пример #3
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;
            }
        }
 private void OnFormClosing(object sender, FormClosingEventArgs e)
 {
     _instance = null;
 }