Example #1
0
        //**********************************************************************
        //							pj_c_findgrid()
        //**********************************************************************
        public static PJ_GRIDINFO pj_gc_findgrid(projCtx ctx, PJ_GridCatalog catalog, bool after, LP location, double date, ref PJ_Region optimal_region, ref double grid_date)
        {
            for (int i = 0; i < catalog.entries.Count; i++)
            {
                PJ_GridCatalog.Entry entry = catalog.entries[i];

                if ((after && entry.date < date) || (!after && entry.date > date))
                {
                    continue;
                }

                if (location.lam < entry.region.ll_long || location.lam > entry.region.ur_long ||
                    location.phi < entry.region.ll_lat || location.phi > entry.region.ur_lat)
                {
                    continue;
                }

                if (entry.available == -1)
                {
                    continue;
                }

                grid_date = entry.date;

                if (entry.gridinfo == null)
                {
                    int           grid_count;
                    PJ_GRIDINFO[] gridlist = pj_gridlist_from_nadgrids(ctx, entry.definition, out grid_count);
                    if (grid_count == 1)
                    {
                        entry.gridinfo = gridlist[0];
                    }
                }

                return(entry.gridinfo);
            }

            grid_date      = 0.0;
            optimal_region = new PJ_Region();
            return(null);
        }
Example #2
0
        //**********************************************************************
        //                            pj_c_findgrid()
        //**********************************************************************
        public static PJ_GRIDINFO pj_gc_findgrid(projCtx ctx, PJ_GridCatalog catalog, bool after, LP location, double date, ref PJ_Region optimal_region, ref double grid_date)
        {
            for(int i=0; i<catalog.entries.Count; i++)
            {
                PJ_GridCatalog.Entry entry=catalog.entries[i];

                if((after&&entry.date<date)||(!after&&entry.date>date)) continue;

                if(location.lam<entry.region.ll_long||location.lam>entry.region.ur_long||
                    location.phi<entry.region.ll_lat||location.phi>entry.region.ur_lat) continue;

                if(entry.available==-1)
                    continue;

                grid_date=entry.date;

                if(entry.gridinfo==null)
                {
                    int grid_count;
                    PJ_GRIDINFO[] gridlist=pj_gridlist_from_nadgrids(ctx, entry.definition, out grid_count);
                    if(grid_count==1) entry.gridinfo=gridlist[0];
                }

                return entry.gridinfo;
            }

            grid_date=0.0;
            optimal_region=new PJ_Region();
            return null;
        }