public void Invert() { foreach (LightStampWithTreeSize si in lightStampsWithTreeSizes) { LightStamp s = si.Stamp; float[] p = s.Data; for (int index = 0; index < p.Length; ++index) { p[index] = 1.0F - p[index]; } } }
public void AddReaderStamp(LightStamp stamp, float crownRadiusInMeters) { float rest = (crownRadiusInMeters % 1.0F) + 0.0001F; int hdClass = (int)(10.0F * rest); // 0 .. 9.99999999 if (hdClass >= Constant.Stamp.HeightDiameterClassCount) { hdClass = Constant.Stamp.HeightDiameterClassCount - 1; } int diameterClass = (int)crownRadiusInMeters; //Debug.WriteLine("Readerstamp r="<< crown_radius_m<<" index dbh hd:" << cls_dbh << cls_hd; stamp.SetCrownRadiusAndArea(crownRadiusInMeters); // prepare special keys for reader stamps this.AddStamp(stamp, diameterClass, hdClass, crownRadiusInMeters, 0.0F, 0.0F); // set crownradius, but not dbh/hd }
public void AttachReaderStamps(TreeSpeciesStamps source) { int found = 0, total = 0; foreach (LightStampWithTreeSize stampItem in this.lightStampsWithTreeSizes) { LightStamp stamp = source.GetReaderStamp(stampItem.CrownRadius); stampItem.Stamp.SetReader(stamp); if (stamp != null) { ++found; } ++total; //si.crown_radius } //if (GlobalSettings.Instance.LogInfo()) //{ // Debug.WriteLine("attachReaderStamps: found " + found + " stamps of " + total); //} }
private void AddStamp(LightStamp stamp, int diameterClass, int hdClass, float crownRadiusInM, float dbh, float hdRatio) { //if (this.UseLookup) //{ if (diameterClass < 0 || diameterClass >= Constant.Stamp.DbhClassCount || hdClass < 0 || hdClass >= Constant.Stamp.HeightDiameterClassCount) { throw new NotSupportedException(String.Format("addStamp: Stamp out of range. dbh={0} hd={1}.", dbh, hdRatio)); } lightStampsByDbhAndHDRatio[diameterClass, hdClass] = stamp; // save address in look up table //} // if (useLookup) stamp.SetCrownRadiusAndArea(crownRadiusInM); LightStampWithTreeSize si = new() { Dbh = dbh, HDratio = hdRatio, CrownRadius = crownRadiusInM, Stamp = stamp }; lightStampsWithTreeSizes.Add(si); // store entry in list of stamps }
/** add a stamp to the internal storage. * After loading the function finalizeSetup() must be called to ensure that gaps in the matrix get filled. */ public void AddStamp(LightStamp stamp, float dbh, float hdRatio, float crownRadius) { TreeSpeciesStamps.GetClasses(dbh, hdRatio, out int diameterClass, out int hdClass); // decode dbh/hd-value this.AddStamp(stamp, diameterClass, hdClass, crownRadius, dbh, hdRatio); // dont set crownradius }