public void SetProgram(string displayName) { if (!MaterialDict.TryGetValue(displayName ?? "unrecognized", out var material)) { var color = random.NextColor(); color.Alpha = 0.5; MaterialDict[displayName] = new Material(displayName, color); material = MaterialDict[displayName]; } this.Material = material; this.ProgramName = displayName; this.Name = Requirements.TryGetValue(displayName, out var fullReq) ? fullReq.HyparSpaceType : displayName; }
public static SpaceBoundary Make(Profile profile, string displayName, Transform xform, double height, Vector3?parentCentroid = null, Vector3?individualCentroid = null) { MaterialDict.TryGetValue(displayName ?? "unspecified", out var material); var representation = new Representation(new[] { new Extrude(profile, height, Vector3.ZAxis, false) }); var name = Requirements.TryGetValue(displayName, out var fullReq) ? fullReq.HyparSpaceType : displayName; var sb = new SpaceBoundary(profile, new List <Polygon> { profile.Perimeter }, xform, material ?? MaterialDict["unrecognized"], representation, false, Guid.NewGuid(), name); sb.ProgramName = displayName; sb.AdditionalProperties.Add("ParentCentroid", parentCentroid ?? xform.OfPoint(profile.Perimeter.Centroid())); sb.AdditionalProperties.Add("IndividualCentroid", individualCentroid ?? xform.OfPoint(profile.Perimeter.Centroid())); return(sb); }