MetaData
ReferencesRepresents an unbounded collection of meta data.
Constructors
MetaData
#Metadata constructor collection initializer.
Parameters:
| namesAndValues (params (MetaName name, MetaValue value)[]) |
Properties
Indexers
Methods
Add
#Add an angle value.
Add
#Add a boolean value.
Add
#Add a byte array. This method will duplicate the array, as internally it is stored as an ImmutableArray.
Add
#Add a Colour value.
Add
#Add a date/time value.
Add
#Add a double precision floating point value.
Add
#Add a Gradient value.
Add
#Add a globally unique identifier value.
Add
#Add an integer value.
Add
#Add a Plane value.
Add
#Add a Point3d value.
Add
#Add a string value.
Add
#Add a timespan value.
Add
#Add a Transformation matrix value.
Add
#Add a Vector3d value.
AddRhinoId
#Add the 'Rhino.Id' to this meta data and harvest all values from attributes userstrings.
Parameters:
| id (Guid) | |
| index (int) | |
| attributes (ObjectAttributes) |
AddRhinoId
#Add a Rhino reference ID to this meta data.
AddRhinoId
#Add the 'Rhino.Id' meta data and harvest all values from attributes userstrings.
Parameters:
| id (Guid) | |
| attributes (ObjectAttributes) |
Compare
#Perform sort comparison on two blobs of meta data.
ContainsName
#Determines whether this data contains an element with the specified name.
Parameters:
| name (MetaName) | Name to test. |
Returns: True if the name exists within this data.
DebugData
#Create a meta data palette containing all supported data types. This is handy for debugging purposes.
Returns: Custom data filled with debug entries.
DebugDataSmall
#Create a meta data palette containing only system types. This is handy for debugging purposes.
Returns: Custom data filled with debug entries.
Equals
#Compare two meta data values for equality.
FindCommonData
#public static MetaData FindCommonData(IEnumerable<MetaData> stream, out IEnumerable<MetaName> conflicts)
Find all non-conflicting meta data in a collection.
Parameters:
| stream (IEnumerable<MetaData>) | |
| conflicts (out IEnumerable<MetaName>) |
FindCommonData
#Find all non-conflicting meta data in a collection.
Parameters:
| stream (IEnumerable<MetaData>) |
FindCommonData
#public static MetaData FindCommonData(IList<IPear> pears, IEnumerable<int> indices, out IEnumerable<MetaName> conflicts)
Find all non-conflicting meta data in an indexed array of pears.
Parameters:
| pears (IList<IPear>) | |
| indices (IEnumerable<int>) | |
| conflicts (out IEnumerable<MetaName>) |
FindCommonData
#public static MetaData FindCommonData(IList<MetaData> collection, IEnumerable<int> indices, out IEnumerable<MetaName> conflicts)
Find all non-conflicting meta data in an indexed collection.
Parameters:
| collection (IList<MetaData>) | |
| indices (IEnumerable<int>) | |
| conflicts (out IEnumerable<MetaName>) |
FindCommonData
#public static MetaData FindCommonData(ITwig twig, IEnumerable<int> indices, out IEnumerable<MetaName> conflicts)
Find all non-conflicting meta data in a twig by index.
Parameters:
| twig (ITwig) | |
| indices (IEnumerable<int>) | |
| conflicts (out IEnumerable<MetaName>) |
Get<T>
#Gets the value with the given or alternate name. This overload makes it easier to check for names which may have different spellings, such as Color/Colour, or Neighbor/Neighbour.
Get<T>
#Gets the value with the given name. If the name is defined but associated with a value type other than T, a widening conversion will be performed if possible.
Parameters:
| name (MetaName) | Name to retrieve. |
| value (out T) | Value will be returned here. |
Returns: True if value was found, false if name is undefined or if the type doesn't match.
GetNamesAndValues
#Get two string arrays describing both the names and the values.
Parameters:
| names (out MetaName[]) | Names will be returned here. |
| values (out MetaValue[]) | Value descriptions will be returned here. |
GetNamesAndValues
#Get two string arrays describing both the names and the values.
Matches
#Tests whether any of the names matches any of the patterns.
Parameters:
| patterns (params string[]) | Patterns to test against. |
Returns: True if at least a single name can be matched up to one of the patterns.
Merge
#public static MetaData Merge(MergeBehaviour behaviour, List<MetaName> conflicts, params MetaData[] metaData)
Merged multiple metas data collections into a single meta data.
Parameters:
| behaviour (MergeBehaviour) | Merge behaviour. |
| conflicts (List<MetaName>) | If not null, unmerged conflicting names will be appended here. |
| metaData (params MetaData[]) | Meta data to merge. |
Returns: Merged data.
Merge
#Merged multiple metas data collections into a single meta data.
Parameters:
| behaviour (MergeBehaviour) | Merge behaviour. |
| metaData (params MetaData[]) | Dictionaries to merge. |
Returns: Merged data.
Merge
#public MetaData Merge(MetaData other, MergeBehaviour mergeBehaviour, out int identicals, out int collisions)
Merge all data from another MetaData instance.
Parameters:
| other (MetaData) | MetaData to merge from. |
| mergeBehaviour (MergeBehaviour) | Behaviour for colliding names. |
| identicals (out int) | Number of meta data entries that were identical in both this and the other meta collection. |
| collisions (out int) | Number of meta data entries which had the same name but different values. |
Merge
#Merge all data from another MetaData instance.
Parameters:
| other (MetaData) | MetaData to merge from. |
| mergeBehaviour (MergeBehaviour) | Behaviour for colliding names. |
| conflicts (out MetaName[]) | List of conflicting values that couldn't be merged. |
Merge
#Merge all data from another MetaData instance.
Parameters:
| other (MetaData) | MetaData to merge from. |
| mergeBehaviour (MergeBehaviour) | Behaviour for colliding names. |
Names
#Enumerate over all names in this data that fit a specific pattern.
Parameters:
| pattern (string) | Wildcard pattern. |
Remove
#Remove entries with the specified names.
Parameters:
| names (params MetaName[]) | Names to remove. |
Returns: Modified metadata. This method returns null if the removed entry was the last remaining one.
Remove
#Remove the entry with the specified name.
Parameters:
| name (string) | Name to remove. |
Returns: True if an entry was removed.
RemovePattern
#Remove all entries which match the specified wildcard pattern.
Parameters:
| pattern (string) | Wildcard pattern to test against. |
Returns: The number of entries removed.
RemoveTransient
#Remove all transient values from this metadata.
Parameters:
| removeTransient (bool = true) | If true, all entries marked as MetaName.IsTransient are removed. |
| removeRhinoId (bool = false) | If true, Rhino.Id entries are removed as well. |
| removeUserText (bool = false) | If true, Record.UserText entries are removed as well. |
Rename
#Rename one of the entries in this metadata. If there is already an entry with the 'replace' name, it will be overwritten.
ToString
#Returns a string representing the meta data.
Returns: A string that represents the current data.
Overrides: Object.ToString
ToString
#Return a string representing the meta data.
Parameters:
| format (string) | Formatting template. Use '{0}' to insert the meta data count into the format. Use '{1}' to insert comma separated meta data names into the format. Use '{2}' to insert comma separated meta data name-value pairs into the format. |
Returns: Formatted string.
Transform
#Deform this meta data. Note that this is much less well defined than linear transforms. We'll do the best we can, but sometimes meta data simply cannot be deformed correctly. Only points and planes can be deformed as they have a location in space.
Parameters:
| deform (SpaceMorph) | Deformation. |
Returns: Deformed data.
Transform
#Transform this meta data.
Parameters:
| transform (Transform) | Transformation matrix. |
Returns: Transformed data.
TransformableNames
#Gets all transformable names. These names represent items which will be affected when this data is transformed using a 4x4 matrix.
Returns: Enumeration of all transformable names.
Validate
#Validate a bunch of meta data using the currently known rules. Plugins may supply their own rules so the behaviour of this method depends on the state of the loaded plugins. As a result, no action should be taken based on the return value of this method, it is meant purely to provide interface feedback, nothing more.
Events
ValidationRequired
#A static event used for testing meta data validity. Handle this event if you wish to flag warnings when the wrong kind of data or the wrong kind of value is associated with a name you care about.
Operators
| Operation | Result | Description | ||
|---|---|---|---|---|
| MetaData | + | MetaData | MetaData | Merge two metadata instances. This operator correctly handles null instances. In the case of conflicting entries, the left hand instance wins. |
| MetaData | + | (MetaName name, MetaValue value) | MetaData | Merge two metadata instances. This operator correctly handles null instances. In the case of conflicting entries, the left hand instance wins. |
| MetaData | - | MetaName | MetaData | |