示例#1
0
        public override nfloat GetHeightForHeader(UITableView tableView, nint section)
        {
            SectionModel currentSection = sections[(int)section];

            if (currentSection.HeaderHeight > 0)
            {
                return(currentSection.HeaderHeight);
            }
            return(UITableView.AutomaticDimension);
        }
        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;
        }
示例#3
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();
            }
        }