private void RowClick(UITableView tableView, NSIndexPath indexPath)
        {
            if (OptionRowClick != null)
            {
                DataTableSource source   = (DataTableSource)tableView.Source;
                string          itemName = source.Sections[indexPath.Section].Rows[indexPath.Row].Name;

                OptionRowClick(itemName);
            }
        }
        private void BaseMapTypeRowClick(UITableView tableView, NSIndexPath indexPath)
        {
            DataTableSource source       = (DataTableSource)tableView.Source;
            string          selectedItem = source.Sections[indexPath.Section].Rows[indexPath.Row].Name;

            Global.BaseMapTypeString = selectedItem;

            foreach (var row in source.Sections[0].Rows)
            {
                row.IsChecked = row.Name.Equals(selectedItem);
            }

            tableView.ReloadData();
            RefreshBaseMap();
            if (RowClick != null)
            {
                RowClick(tableView, indexPath);
            }
        }
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            UITableView           baseMapTypeTableView = new UITableView(View.Frame);
            DataTableSource       baseMapTypeSource    = new DataTableSource();
            Collection <RowModel> baseMapTypeRows      = new Collection <RowModel>();

            string[] baseMapTypeItems = { "World Map Kit Road", "World Map Kit Aerial", "World Map Kit Aerial With Labels", "Open Street Map", "Bing Maps Aerial", "Bing Maps Road" };
            foreach (var nameItem in baseMapTypeItems)
            {
                RowModel row = new RowModel(nameItem);
                row.CellAccessory = UITableViewCellAccessory.Checkmark;
                baseMapTypeRows.Add(row);
            }
            baseMapTypeRows[0].IsChecked = true;

            SectionModel baseMapTypeSection = new SectionModel(string.Empty, baseMapTypeRows);

            baseMapTypeSource.Sections.Add(baseMapTypeSection);
            baseMapTypeSource.RowClick  = BaseMapTypeRowClick;
            baseMapTypeTableView.Source = baseMapTypeSource;
            View = baseMapTypeTableView;
        }
        private void InitializeOptionsSource()
        {
            earthquakePointLayer = (ShapeFileFeatureLayer)Global.HighLightOverlay.Layers["EarthquakePointLayer"];
            earthquakeHeatLayer  = (HeatLayer)Global.HighLightOverlay.Layers["EarthquakeHeatLayer"];

            int rowWidth   = 400;
            int sliderWith = 190;

            if (Global.UserInterfaceIdiomIsPhone)
            {
                rowWidth   = 300;
                sliderWith = 90;
            }

            baseMapTypeSource           = new DataTableSource();
            baseMapTypeSource.RowClick += RowClick;

            RectangleF rowFrame = new RectangleF(10, 5, rowWidth, 30);

            Collection <RowModel> baseMapRows = new Collection <RowModel>();
            RowModel baseMapModel             = new RowModel("Base Map");

            baseMapLabel = new UILabel(new RectangleF(5, 5, rowWidth * 0.6f, 40));
            baseMapLabel.TextAlignment          = UITextAlignment.Right;
            baseMapLabel.TextColor              = UIColor.Black;
            baseMapLabel.UserInteractionEnabled = false;

            baseMapModel.CellAccessory  = UITableViewCellAccessory.DisclosureIndicator;
            baseMapModel.CustomUI       = baseMapLabel;
            baseMapModel.CustomUIBounds = new RectangleF(rowWidth * 0.35f, 10, rowWidth * 0.6f, 30);
            baseMapModel.RowHeight      = 50;
            baseMapRows.Add(baseMapModel);
            baseMapTypeSource.Sections.Add(new SectionModel("Base Map Type", baseMapRows)
            {
                HeaderHeight = 30
            });

            Collection <RowModel> displayTypeRows = new Collection <RowModel>();
            RowModel           displayTypeModel   = new RowModel(string.Empty);
            UISegmentedControl displayTypeSegment = new UISegmentedControl();

            displayTypeSegment.InsertSegment("Point Type", 1, true);
            displayTypeSegment.InsertSegment("Heat Style", 2, true);
            displayTypeSegment.InsertSegment("IsoLine Style", 3, true);
            displayTypeSegment.ValueChanged   += DisplayTypeSegmentValueChanged;
            displayTypeSegment.SelectedSegment = 0;
            displayTypeModel.CustomUI          = displayTypeSegment;
            displayTypeModel.CustomUIBounds    = new RectangleF(10, 10, rowWidth, 30);
            displayTypeModel.RowHeight         = 50;

            displayTypeRows.Add(displayTypeModel);
            baseMapTypeSource.Sections.Add(new SectionModel("Display Type", displayTypeRows)
            {
                HeaderHeight = 30
            });

            Collection <RowModel> queryOperation = new Collection <RowModel>();
            RowModel magnitude = new RowModel(string.Empty);
            RowModel depth     = new RowModel(string.Empty);
            RowModel date      = new RowModel(string.Empty);

            RectangleF silderFrame = new RectangleF(150, 0, sliderWith, 30);

            RangeSliderView magnitudeView =
                new RangeSliderView(new UIRangeSlider(silderFrame, Global.QueryConfiguration.LowerMagnitude,
                                                      Global.QueryConfiguration.UpperMagnitude, Global.QueryConfiguration.LowerMagnitude,
                                                      Global.QueryConfiguration.UpperMagnitude)
            {
                Name = "Magnitude:"
            });

            magnitudeView.Frame      = rowFrame;
            magnitude.CustomUI       = magnitudeView;
            magnitude.CustomUIBounds = rowFrame;
            magnitude.RowHeight      = 45;

            RangeSliderView depthView =
                new RangeSliderView(new UIRangeSlider(silderFrame, Global.QueryConfiguration.LowerDepth,
                                                      Global.QueryConfiguration.UpperDepth, Global.QueryConfiguration.LowerDepth,
                                                      Global.QueryConfiguration.UpperDepth)
            {
                Name = "Depth(KM):"
            });

            depthView.Frame      = rowFrame;
            depth.CustomUI       = depthView;
            depth.CustomUIBounds = rowFrame;
            depth.RowHeight      = 45;

            RangeSliderView dateView =
                new RangeSliderView(new UIRangeSlider(silderFrame, Global.QueryConfiguration.LowerYear,
                                                      Global.QueryConfiguration.UpperYear, Global.QueryConfiguration.LowerYear,
                                                      Global.QueryConfiguration.UpperYear)
            {
                Name = "Date(Year):"
            });

            dateView.Frame      = rowFrame;
            date.CustomUI       = dateView;
            date.CustomUIBounds = rowFrame;
            date.RowHeight      = 45;

            queryOperation.Add(magnitude);
            queryOperation.Add(depth);
            queryOperation.Add(date);
            baseMapTypeSource.Sections.Add(new SectionModel("Query Operation", queryOperation)
            {
                HeaderHeight = 30
            });
            tbvBaseMapType.Source = baseMapTypeSource;
        }
Beispiel #5
0
        private void RefreshQueryResultData()
        {
            if (queryResultView.Hidden)
            {
                queryResultView.AnimatedShow();
            }
            DataTableSource earthquakeSource;

            if (tbvQueryResult.Source == null)
            {
                earthquakeSource          = new DataTableSource();
                earthquakeSource.RowClick = EarthquakeRowClicked;
            }
            else
            {
                earthquakeSource = (DataTableSource)tbvQueryResult.Source;
            }
            earthquakeSource.Sections.Clear();

            Proj4Projection mercatorToWgs84Projection = Global.GetWgs84ToMercatorProjection();

            mercatorToWgs84Projection.Open();

            try
            {
                Global.FilterSelectedEarthquakeFeatures();

                InMemoryFeatureLayer selectMarkerLayer = (InMemoryFeatureLayer)Global.HighLightOverlay.Layers["SelectMarkerLayer"];

                GeoCollection <Feature> selectFeatures = selectMarkerLayer.InternalFeatures;

                SectionModel detailSection = new SectionModel("Queried Count: " + selectFeatures.Count);
                detailSection.HeaderHeight = 50;
                foreach (var feature in selectFeatures)
                {
                    double longitude, latitude = 0;

                    if (double.TryParse(feature.ColumnValues["LONGITUDE"], out longitude) && double.TryParse(feature.ColumnValues["LATITIUDE"], out latitude))
                    {
                        PointShape point = new PointShape(longitude, latitude);
                        point     = (PointShape)mercatorToWgs84Projection.ConvertToInternalProjection(point);
                        longitude = point.X;
                        latitude  = point.Y;
                    }

                    double year, depth, magnitude;
                    double.TryParse(feature.ColumnValues["MAGNITUDE"], out magnitude);
                    double.TryParse(feature.ColumnValues["DEPTH_KM"], out depth);
                    double.TryParse(feature.ColumnValues["YEAR"], out year);

                    EarthquakeRow result = new EarthquakeRow();

                    result.YearValue      = year != -9999 ? year.ToString(CultureInfo.InvariantCulture) : "Unknown";
                    result.LocationValue  = longitude.ToString("f2", CultureInfo.InvariantCulture);
                    result.LatitudeValue  = latitude.ToString("f2", CultureInfo.InvariantCulture);
                    result.DepthValue     = depth != -9999 ? depth.ToString(CultureInfo.InvariantCulture) : "Unknown";
                    result.MagnitudeValue = magnitude != -9999 ? magnitude.ToString(CultureInfo.InvariantCulture) : "Unknown";
                    result.LocationValue  = feature.ColumnValues["LOCATION"];

                    detailSection.Rows.Add(new RowModel(result.ToString(), new UIImageView(UIImage.FromBundle("location"))));
                }
                earthquakeSource.Sections.Add(detailSection);

                tbvQueryResult.Source = earthquakeSource;
                tbvQueryResult.ReloadData();
            }
            finally
            {
                mercatorToWgs84Projection.Close();
            }
        }