Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languagec#
using System;
using Alastri.RR.Ui;
using Alastri.RR.Service;

public class LabelFormat : ILabel
{         
    public string GetLabel(ShadingContext context)
    {
        return "Blast " + context.GetLevelName("Solid") + "\n"
		+ context.GetReserveValue("Volume").ToString("#,##0") + " bcm \n"
		+ context.GetReserveValue("DryTonnes").ToString("#,##0") + "t";
    }
}

...

Площадь/периметр
Code Block
languagec#
using System;
using Alastri.RR.Ui;
using Alastri.RR.Service;

public class LabelFormat : ILabel
{         
    public string GetLabel(ShadingContext context)
    {
        return (context.SurfaceArea / context.Perimeter).ToString("#,##0.00"); 
    }
}

...

Code Block
languagec#
using System;
using System.Collections.Generic;
using System.Linq;
using Alastri.RR.Ui;
using Alastri.RR.Service;

public class LabelFormat : ILabel
{   
    public string GetLabel(ShadingContext context)
    {
    List<string> temp = context.GetParcels();
	List<string> parcels = context.GetParcels(temp.ConvertAll(low => low.ToLowerInvariant());
	List<string> ores = new List<string>(){ "hg", "mg", "lg" };
		
	double oreTonnes = 0;
		
	foreach(var parcel in parcels)
	{
		if(ores.Any(ore => parcel.StartsWith(ore)))
		{
			oreTonnes += context.GetReserveValue("DryTonnes", parcel);
		}
	}
		
	return oreTonnes.ToString("#,##0");
    }
}
Приобладающий

...

полезный компонент
Code Block
languagec#
using System;
using Alastri.RR.Ui;
using Alastri.RR.Service;

public class LabelFormat : ILabel
{         
    public string GetLabel(ShadingContext context)
    {
        var parcels = context.GetParcels();
		
	string majorityParcel = "";
        double majorityTonnes = -1e7;
        foreach (var parcel in parcels)
        {
            double t = context.GetReserveValue("DryTonnes", parcel);
            if (t > majorityTonnes)
            {
                majorityTonnes = t;
                majorityParcel = parcel;
            }
        }
	return majorityParcel;
    }
}

...