Ejemplo n.º 1
0
 public static LabelsForm GetInstance(MapLayersHandler layersHandler)
 {
     if (_instance == null)
     {
         _instance = new LabelsForm(layersHandler);
     }
     return(_instance);
 }
Ejemplo n.º 2
0
 private void OnFormClosed(object sender, FormClosedEventArgs e)
 {
     _mapLayer.IsLabeled = _shapeFile.Labels.Count > 0;
     if (_mapLayer.IsLabeled && txtLabelSourceField.Text.Length > 0)
     {
         _mapLayer.LabelSource = "Expression";
         _mapLayer.Expression  = txtLabelSourceField.Text;
     }
     CleanUp();
     _instance = null;
 }
Ejemplo n.º 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;
            }
        }