private void CreateLayout()
        {
            this.View.BackgroundColor = UIColor.White;

            // Create a stack view to organize the query controls
            _controlsStackView              = new UIStackView();
            _controlsStackView.Axis         = UILayoutConstraintAxis.Vertical;
            _controlsStackView.Alignment    = UIStackViewAlignment.Center;
            _controlsStackView.Distribution = UIStackViewDistribution.EqualSpacing;
            _controlsStackView.Spacing      = 5;

            // Button for launching the UI to view or define statistics definitions for the query
            UIButton showStatDefinitionsButton = new UIButton();

            showStatDefinitionsButton.SetTitle("Statistic Definitions", UIControlState.Normal);
            showStatDefinitionsButton.SetTitleColor(UIColor.Blue, UIControlState.Normal);
            showStatDefinitionsButton.BackgroundColor = UIColor.White;
            showStatDefinitionsButton.Frame           = new CGRect(30, 20, 220, 30);
            showStatDefinitionsButton.TouchUpInside  += ShowStatDefinitions;

            // Button to choose fields with which to group results
            UIButton showGroupFieldsButton = new UIButton();

            showGroupFieldsButton.SetTitle("Group Fields", UIControlState.Normal);
            showGroupFieldsButton.SetTitleColor(UIColor.Blue, UIControlState.Normal);
            showGroupFieldsButton.BackgroundColor = UIColor.White;
            showGroupFieldsButton.Frame           = new CGRect(30, 60, 220, 30);
            showGroupFieldsButton.TouchUpInside  += ShowGroupFields;

            // Button to choose fields with which to sort results (must be one of the 'group by' fields)
            UIButton showOrderByFieldsButton = new UIButton();

            showOrderByFieldsButton.SetTitle("Order By Fields", UIControlState.Normal);
            showOrderByFieldsButton.SetTitleColor(UIColor.Blue, UIControlState.Normal);
            showOrderByFieldsButton.BackgroundColor = UIColor.White;
            showOrderByFieldsButton.Frame           = new CGRect(30, 100, 220, 30);
            showOrderByFieldsButton.TouchUpInside  += ShowOrderByFields;

            // Create a button to invoke the query using the query parameters defined
            UIButton getStatsButton = new UIButton();

            getStatsButton.SetTitle("Get Statistics", UIControlState.Normal);
            getStatsButton.SetTitleColor(UIColor.Blue, UIControlState.Normal);
            getStatsButton.BackgroundColor = UIColor.White;
            getStatsButton.Frame           = new CGRect(30, 340, 220, 30);

            // Handle the button tap to execute the statistics query
            getStatsButton.TouchUpInside += ExecuteStatisticsQuery;

            // Add controls to the stack view
            _controlsStackView.AddSubviews(showStatDefinitionsButton, showGroupFieldsButton, showOrderByFieldsButton, getStatsButton);

            // Add UI controls to the page
            View.AddSubview(_controlsStackView);
        }
Esempio n. 2
0
        private void CreateLayout()
        {
            // Lay out the spatial operations UI vertically.
            _operationToolsView.Axis = UILayoutConstraintAxis.Vertical;

            // Create a label to prompt for a spatial operation.
            UILabel operationLabel = new UILabel(new CGRect(5, 0, View.Bounds.Width, 30))
            {
                Text          = "Choose a spatial operation:",
                TextAlignment = UITextAlignment.Left,
                TextColor     = UIColor.Blue
            };

            // Create a picker model with spatial operation choices.
            List <string> operationsList = new List <string> {
                "", "Difference", "Intersection", "Symmetric difference", "Union"
            };
            PickerDataModel operationModel = new PickerDataModel(operationsList);

            // Handle the selection change for spatial operations.
            operationModel.ValueChanged += OperationModel_ValueChanged;

            // Create a picker to show the spatial operations.
            _operationPicker = new UIPickerView(new CGRect(20, 25, View.Bounds.Width - 20, 100))
            {
                Model = operationModel
            };

            // Create a button to reset the operation result.
            UIButton resetButton = new UIButton(UIButtonType.Plain);

            resetButton.Frame = new CGRect(20, 110, View.Bounds.Width - 20, 30);
            resetButton.SetTitle("Reset operation", UIControlState.Normal);
            resetButton.SetTitleColor(UIColor.Blue, UIControlState.Normal);
            resetButton.TouchUpInside += ResetButton_TouchUpInside;

            // Add the controls to the tools UI (stack view).
            _operationToolsView.AddSubviews(operationLabel, _operationPicker, resetButton);

            // Add the map view and tools sub-views to the view.
            View.AddSubviews(_myMapView, _operationToolsView);

            // Set the view background color.
            View.BackgroundColor = UIColor.White;
        }
Esempio n. 3
0
        private void CreateLayout()
        {
            // Place the map view in the upper half of the display.
            _myMapView.Frame = new CGRect(0, 0, View.Bounds.Width, _mapViewHeight);

            // Place the transformations UI in the bottom half.
            _transformToolsView.Axis  = UILayoutConstraintAxis.Vertical;
            _transformToolsView.Frame = new CGRect(0, _mapViewHeight, View.Bounds.Width, _transformToolsHeight);

            // View for the input/output WKID labels.
            UIStackView wkidLabelsStackView = new UIStackView(new CGRect(10, 5, View.Bounds.Width - 10, 35))
            {
                Axis = UILayoutConstraintAxis.Horizontal
            };

            // Create a label for the input spatial reference.
            _inWkidLabel = new UILabel(new CGRect(5, 0, View.Bounds.Width / 2 - 15, 30))
            {
                Text          = "In WKID = ",
                TextAlignment = UITextAlignment.Left,
                TextColor     = UIColor.Black
            };

            // Create a label for the output spatial reference.
            _outWkidLabel = new UILabel(new CGRect(View.Bounds.Width / 2 + 5, 0, View.Bounds.Width / 2 - 15, 30))
            {
                Text          = "Out WKID = ",
                TextAlignment = UITextAlignment.Left,
                TextColor     = UIColor.Black
            };

            // Add the WKID labels to the stack view.
            wkidLabelsStackView.Add(_inWkidLabel);
            wkidLabelsStackView.Add(_outWkidLabel);

            // Create a horizontal stack view for the 'use extent' switch and label.
            UIStackView extentSwitchRow = new UIStackView(new CGRect(20, 35, View.Bounds.Width - 20, 35))
            {
                Axis = UILayoutConstraintAxis.Horizontal
            };

            _useExtentSwitch = new UISwitch
            {
                On = false
            };
            _useExtentSwitch.ValueChanged += UseExtentSwitch_ValueChanged;

            // Create a label for the use extent switch.
            UILabel useExtentLabel = new UILabel(new CGRect(70, 0, View.Bounds.Width - 70, 30))
            {
                Text          = "Use extent",
                TextAlignment = UITextAlignment.Left,
                TextColor     = UIColor.Black
            };

            // Add the switch and the label to the horizontal stack view.
            extentSwitchRow.Add(_useExtentSwitch);
            extentSwitchRow.Add(useExtentLabel);

            // Create a picker for datum transformations.
            _transformationsPicker = new UIPickerView(new CGRect(20, 70, View.Bounds.Width - 20, 120));

            // Create a text view to show messages.
            _messagesTextView = new UITextView(new CGRect(20, 200, View.Bounds.Width - 20, 60));

            // Add the controls to the transform UI (stack view).
            _transformToolsView.AddSubviews(wkidLabelsStackView, extentSwitchRow, _transformationsPicker, _messagesTextView);

            // Add the map view and tools subviews to the view.
            View.AddSubviews(_myMapView, _transformToolsView);

            // Set the view background color.
            View.BackgroundColor = UIColor.White;
        }