public static VisibilityQueryForm GetInstance(MapLayersHandler handler) { if (_instance == null) { _instance = new VisibilityQueryForm(handler); } return(_instance); }
private void OnButtonClick(object sender, EventArgs e) { switch (((Button)sender).Name) { case "btnClear": txtVisibilityExpression.Text = ""; _shapefileLayer.VisibilityExpression = ""; _parentForm.MainForm.MapControl.Redraw(); break; case "btnLabelFeatures": var labelsForm = LabelsForm.GetInstance(_mapLayers, this); 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; } _parentForm.MainForm.MapControl.Redraw(); break; case "btnApply": _mapLayers.UpdateCurrentLayerName(txtLayerName.Text); btnApply.Enabled = false; break; } }
private void OnFormClosing(object sender, FormClosingEventArgs e) { _instance = null; }