Ejemplo n.º 1
0
    public SiteRecord(LayerSite layerSite, Patch patch)
    {
        this.layerSite = layerSite;
        Year           = patch.Year;

        Add(patch);
    }
Ejemplo n.º 2
0
    public LayerSite AddSite(Site site, Patch patch)
    {
        var layerSite = new LayerSite(site, patch);

        layerSites.Add(layerSite);
        return(layerSite);
    }
Ejemplo n.º 3
0
	public SiteRecord(LayerSite layerSite, Patch patch)
    {
		this.layerSite = layerSite;
        year = patch.year;

        patches.Add(patch);
    }
Ejemplo n.º 4
0
    public LayerSite AddSite(string name, Patch patch)
    {
        var layerSite = new LayerSite(this, name, patch);

        layerSites.Add(layerSite);
        return(layerSite);
    }
Ejemplo n.º 5
0
    private void UpdateSitePatchesMinMaxFilters(LayerSite layerSite)
    {
        float siteMin = Mathf.Lerp(layerSite.minValue, layerSite.maxValue, minFilter);
        float siteMax = Mathf.Lerp(layerSite.minValue, layerSite.maxValue, maxFilter);

        foreach (var record in layerSite.records.Values)
        {
            foreach (GridedPatch patch in record.patches)
            {
                patch.SetMinMaxFilter(siteMin, siteMax);
            }
        }
    }
Ejemplo n.º 6
0
    private void OnSiteButtonPressed(LayerSite site)
    {
        double east  = float.MinValue;
        double west  = float.MaxValue;
        double north = float.MinValue;
        double south = float.MaxValue;

        foreach (var patch in site.lastRecord.patches)
        {
            east  = Math.Max(east, patch.Data.east);
            west  = Math.Min(west, patch.Data.west);
            north = Math.Max(north, patch.Data.north);
            south = Math.Min(south, patch.Data.south);
        }

        map.SetZoom(map.dataLevels.levels[site.lastRecord.patches[0].level].minZoom);
        map.SetCenter((west + east) * 0.5, (north + south) * 0.5);
    }
Ejemplo n.º 7
0
    private void UpdateSiteMean(LayerSite layerSite)
    {
        layerSite.mean = 0;
        foreach (var record in layerSite.records.Values)
        {
            foreach (var patch in record.patches)
            {
                var grid = patch.Data as GridData;
                if (grid != null && grid.values != null)
                {
                    float mean  = 0;
                    int   count = grid.countX * grid.countY;
                    for (int i = 0; i < count; i++)
                    {
                        mean += grid.valuesMask[i] ? grid.values[i] : layerSite.minValue;
                    }
                    mean /= count;

                    float meanPercent = Mathf.InverseLerp(layerSite.minValue, layerSite.maxValue, mean);
                    layerSite.mean = Mathf.Max(layerSite.mean, meanPercent);
                }
            }
        }
    }