本文整理汇总了C#中PropertyValueType类的典型用法代码示例。如果您正苦于以下问题:C# PropertyValueType类的具体用法?C# PropertyValueType怎么用?C# PropertyValueType使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
PropertyValueType类属于命名空间,在下文中一共展示了PropertyValueType类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateElectricalCurrentMeasurePropertyFromCache
/// <summary>
/// Create a label property, or retrieve from cache.
/// </summary>
/// <param name="file">The IFC file.</param>
/// <param name="propertyName">The name of the property.</param>
/// <param name="value">The value of the property.</param>
/// <param name="valueType">The value type of the property.</param>
/// <returns>The created or cached property handle.</returns>
public static IFCAnyHandle CreateElectricalCurrentMeasurePropertyFromCache(IFCFile file, string propertyName, double value, PropertyValueType valueType)
{
// We have a partial cache here - we will only cache multiples of 15 degrees.
bool canCache = false;
double ampsDiv5 = Math.Floor(value / 5.0 + 0.5);
double integerAmps = ampsDiv5 * 5.0;
if (MathUtil.IsAlmostEqual(value, integerAmps))
{
canCache = true;
value = integerAmps;
}
IFCAnyHandle propertyHandle;
if (canCache)
{
propertyHandle = ExporterCacheManager.PropertyInfoCache.ElectricalCurrentCache.Find(propertyName, value);
if (propertyHandle != null)
return propertyHandle;
}
propertyHandle = CreateElectricalCurrentMeasureProperty(file, propertyName, value, valueType);
if (canCache && !IFCAnyHandleUtil.IsNullOrHasNoValue(propertyHandle))
{
ExporterCacheManager.PropertyInfoCache.ElectricalCurrentCache.Add(propertyName, value, propertyHandle);
}
return propertyHandle;
}
示例2: CreateFrequencyPropertyFromElement
/// <summary>
/// Create a Frequency measure property from the element's parameter.
/// </summary>
/// <param name="file">The IFC file.</param>
/// <param name="exporterIFC">The ExporterIFC.</param>
/// <param name="elem">The Element.</param>
/// <param name="revitParameterName">The name of the parameter.</param>
/// <param name="ifcPropertyName">The name of the property.</param>
/// <param name="valueType">The value type of the property.</param>
/// <returns>The created property handle.</returns>
public static IFCAnyHandle CreateFrequencyPropertyFromElement(IFCFile file, ExporterIFC exporterIFC, Element elem,
string revitParameterName, string ifcPropertyName, PropertyValueType valueType)
{
double propertyValue;
if (ParameterUtil.GetDoubleValueFromElement(elem, null, revitParameterName, out propertyValue) != null)
return CreateFrequencyProperty(file, ifcPropertyName, propertyValue, valueType);
return null;
}
示例3: CreateElectricalCurrentMeasureProperty
/// <summary>
/// Create a label property.
/// </summary>
/// <param name="file">The IFC file.</param>
/// <param name="propertyName">The name of the property.</param>
/// <param name="value">The value of the property.</param>
/// <param name="valueType">The value type of the property.</param>
/// <returns>The created property handle.</returns>
public static IFCAnyHandle CreateElectricalCurrentMeasureProperty(IFCFile file, string propertyName, double value, PropertyValueType valueType)
{
switch (valueType)
{
case PropertyValueType.EnumeratedValue:
{
IList<IFCData> valueList = new List<IFCData>();
valueList.Add(IFCDataUtil.CreateAsElectricalCurrentMeasure(value));
return IFCInstanceExporter.CreatePropertyEnumeratedValue(file, propertyName, null, valueList, null);
}
case PropertyValueType.SingleValue:
return IFCInstanceExporter.CreatePropertySingleValue(file, propertyName, null, IFCDataUtil.CreateAsElectricalCurrentMeasure(value), null);
default:
throw new InvalidOperationException("Missing case!");
}
}
示例4: CreatePositivePlaneAngleMeasureProperty
/// <summary>
/// Create a label property.
/// </summary>
/// <param name="file">The IFC file.</param>
/// <param name="propertyName">The name of the property.</param>
/// <param name="value">The value of the property.</param>
/// <param name="valueType">The value type of the property.</param>
/// <returns>The created property handle.</returns>
public static IFCAnyHandle CreatePositivePlaneAngleMeasureProperty(IFCFile file, string propertyName, double value, PropertyValueType valueType)
{
// Ensure it is positive. Don't throw, but should tell user.
if (value <= MathUtil.Eps())
return null;
switch (valueType)
{
case PropertyValueType.EnumeratedValue:
{
IList<IFCData> valueList = new List<IFCData>();
valueList.Add(IFCDataUtil.CreateAsPositivePlaneAngleMeasure(value));
return IFCInstanceExporter.CreatePropertyEnumeratedValue(file, propertyName, null, valueList, null);
}
case PropertyValueType.SingleValue:
return IFCInstanceExporter.CreatePropertySingleValue(file, propertyName, null, IFCDataUtil.CreateAsPositivePlaneAngleMeasure(value), null);
default:
throw new InvalidOperationException("Missing case!");
}
}
示例5: CreateCommonProperty
protected static IFCAnyHandle CreateCommonProperty(IFCFile file, string propertyName, IFCData valueData, PropertyValueType valueType, string unitTypeKey)
{
switch (valueType)
{
case PropertyValueType.EnumeratedValue:
{
IList<IFCData> valueList = new List<IFCData>();
valueList.Add(valueData);
return IFCInstanceExporter.CreatePropertyEnumeratedValue(file, propertyName, null, valueList, null);
}
case PropertyValueType.SingleValue:
{
if (unitTypeKey != null)
return IFCInstanceExporter.CreatePropertySingleValue(file, propertyName, null, valueData, ExporterCacheManager.UnitsCache[unitTypeKey]);
else
return IFCInstanceExporter.CreatePropertySingleValue(file, propertyName, null, valueData, null);
}
default:
throw new InvalidOperationException("Missing case!");
}
}
示例6: CreateFrequencyPropertyFromElementOrSymbol
/// <summary>
/// Create a Frequency measure property from the element's or type's parameter.
/// </summary>
/// <param name="file">The IFC file.</param>
/// <param name="exporterIFC">The ExporterIFC.</param>
/// <param name="elem">The Element.</param>
/// <param name="revitParameterName">The name of the parameter.</param>
/// <param name="revitBuiltInParam">The built in parameter to use, if revitParameterName isn't found.</param>
/// <param name="ifcPropertyName">The name of the property.</param>
/// <param name="valueType">The value type of the property.</param>
/// <returns>The created property handle.</returns>
public static IFCAnyHandle CreateFrequencyPropertyFromElementOrSymbol(IFCFile file, ExporterIFC exporterIFC, Element elem,
string revitParameterName, BuiltInParameter revitBuiltInParam, string ifcPropertyName, PropertyValueType valueType)
{
IFCAnyHandle propHnd = CreateFrequencyPropertyFromElement(file, exporterIFC, elem, revitParameterName, ifcPropertyName, valueType);
if (!IFCAnyHandleUtil.IsNullOrHasNoValue(propHnd))
return propHnd;
if (revitBuiltInParam != BuiltInParameter.INVALID)
{
string builtInParamName = LabelUtils.GetLabelFor(revitBuiltInParam);
propHnd = CreateFrequencyPropertyFromElement(file, exporterIFC, elem, builtInParamName, ifcPropertyName, valueType);
if (!IFCAnyHandleUtil.IsNullOrHasNoValue(propHnd))
return propHnd;
}
// For Symbol
Document document = elem.Document;
ElementId typeId = elem.GetTypeId();
Element elemType = document.GetElement(typeId);
if (elemType != null)
return CreateFrequencyPropertyFromElementOrSymbol(file, exporterIFC, elemType, revitParameterName, revitBuiltInParam, ifcPropertyName, valueType);
else
return null;
}
示例7: CreateFrequencyProperty
/// <summary>Create a FrequencyMeasure property.</summary>
/// <param name="file">The IFC file.</param>
/// <param name="propertyName">The name of the property.</param>
/// <param name="value">The value of the property.</param>
/// <param name="valueType">The value type of the property.</param>
/// <returns>The created property handle.</returns>
public static IFCAnyHandle CreateFrequencyProperty(IFCFile file, string propertyName, double value, PropertyValueType valueType)
{
IFCData frequencyData = IFCDataUtil.CreateAsFrequencyMeasure(value);
return CreateCommonProperty(file, propertyName, frequencyData, valueType, null);
}
示例8: AddProperty
/// <summary>
/// Add property value to product
/// </summary>
private void AddProperty(CatalogProduct product, string propertyName, object value, PropertyValueType propertyValueType)
{
var property = _catalogProperties.FirstOrDefault(x => x.Name == propertyName);
if (property != null)
{
var propertyValue = new PropertyValue
{
PropertyId = property.Id,
PropertyName = property.Name,
Value = value,
ValueType = propertyValueType
};
if (product.PropertyValues == null)
{
product.PropertyValues = new List<PropertyValue>();
}
product.PropertyValues.Add(propertyValue);
}
}
示例9: CreateElectricalVoltageMeasureProperty
/// <summary>
/// Create a label property.
/// </summary>
/// <param name="file">The IFC file.</param>
/// <param name="propertyName">The name of the property.</param>
/// <param name="value">The value of the property.</param>
/// <param name="valueType">The value type of the property.</param>
/// <returns>The created property handle.</returns>
public static IFCAnyHandle CreateElectricalVoltageMeasureProperty(IFCFile file, string propertyName, double value, PropertyValueType valueType)
{
IFCData electricalVoltageData = IFCDataUtil.CreateAsElectricalVoltageMeasure(value);
return CreateCommonProperty(file, propertyName, electricalVoltageData, valueType, null);
}
示例10: CreatePropertyFromElementOrSymbolBase
// This function is static to make sure that no properties are used directly from the entry.
private static IFCAnyHandle CreatePropertyFromElementOrSymbolBase(IFCFile file, ExporterIFC exporterIFC, Element element,
string revitParamNameToUse, string ifcPropertyName, BuiltInParameter builtInParameter,
PropertyType propertyType, PropertyValueType valueType, Type propertyEnumerationType)
{
IFCAnyHandle propHnd = null;
switch (propertyType)
{
case PropertyType.Text:
{
propHnd = PropertyUtil.CreateTextPropertyFromElementOrSymbol(file, element, revitParamNameToUse, builtInParameter, ifcPropertyName, valueType, propertyEnumerationType);
break;
}
case PropertyType.Label:
{
propHnd = PropertyUtil.CreateLabelPropertyFromElementOrSymbol(file, element, revitParamNameToUse, builtInParameter, ifcPropertyName, valueType, propertyEnumerationType);
break;
}
case PropertyType.Identifier:
{
propHnd = PropertyUtil.CreateIdentifierPropertyFromElementOrSymbol(file, element, revitParamNameToUse, builtInParameter, ifcPropertyName, valueType);
break;
}
case PropertyType.Boolean:
{
propHnd = PropertyUtil.CreateBooleanPropertyFromElementOrSymbol(file, element, revitParamNameToUse, ifcPropertyName, valueType);
break;
}
case PropertyType.Logical:
{
propHnd = PropertyUtil.CreateLogicalPropertyFromElementOrSymbol(file, element, revitParamNameToUse, ifcPropertyName, valueType);
break;
}
case PropertyType.Integer:
{
propHnd = PropertyUtil.CreateIntegerPropertyFromElementOrSymbol(file, element, revitParamNameToUse, ifcPropertyName, valueType);
break;
}
case PropertyType.Real:
{
propHnd = PropertyUtil.CreateRealPropertyFromElementOrSymbol(file, element, revitParamNameToUse, ifcPropertyName, valueType);
break;
}
case PropertyType.Length:
{
propHnd = PropertyUtil.CreateLengthMeasurePropertyFromElementOrSymbol(file, exporterIFC, element, revitParamNameToUse,
builtInParameter, ifcPropertyName, valueType);
break;
}
case PropertyType.PositiveLength:
{
propHnd = PropertyUtil.CreatePositiveLengthMeasurePropertyFromElementOrSymbol(file, exporterIFC, element, revitParamNameToUse,
builtInParameter, ifcPropertyName, valueType);
break;
}
case PropertyType.NormalisedRatio:
{
propHnd = PropertyUtil.CreateNormalisedRatioPropertyFromElementOrSymbol(file, exporterIFC, element, revitParamNameToUse,
ifcPropertyName, valueType);
break;
}
case PropertyType.PositiveRatio:
{
propHnd = PropertyUtil.CreatePositiveRatioPropertyFromElementOrSymbol(file, exporterIFC, element, revitParamNameToUse,
ifcPropertyName, valueType);
break;
}
case PropertyType.Ratio:
{
propHnd = PropertyUtil.CreateRatioPropertyFromElementOrSymbol(file, exporterIFC, element, revitParamNameToUse, ifcPropertyName,
valueType);
break;
}
case PropertyType.PlaneAngle:
{
propHnd = PropertyUtil.CreatePlaneAngleMeasurePropertyFromElementOrSymbol(file, element, revitParamNameToUse, ifcPropertyName,
valueType);
break;
}
case PropertyType.PositivePlaneAngle:
{
propHnd = PositivePlaneAnglePropertyUtil.CreatePositivePlaneAngleMeasurePropertyFromElementOrSymbol(file, element, revitParamNameToUse, ifcPropertyName,
valueType);
break;
}
case PropertyType.Area:
{
propHnd = PropertyUtil.CreateAreaMeasurePropertyFromElementOrSymbol(file, exporterIFC, element, revitParamNameToUse,
builtInParameter, ifcPropertyName, valueType);
break;
}
case PropertyType.Volume:
{
propHnd = PropertyUtil.CreateVolumeMeasurePropertyFromElementOrSymbol(file, exporterIFC, element, revitParamNameToUse,
builtInParameter, ifcPropertyName, valueType);
break;
}
case PropertyType.Count:
{
//.........这里部分代码省略.........
示例11: CreateRealPropertyFromCache
/// <summary>Create a real property, using a cached value if possible.</summary>
/// <param name="file">The IFC file.</param>
/// <param name="propertyName">The name of the property.</param>
/// <param name="value">The value of the property.</param>
/// <param name="valueType">The value type of the property.</param>
/// <returns>The created or cached property handle.</returns>
public static IFCAnyHandle CreateRealPropertyFromCache(IFCFile file, double scale, string propertyName, double value, PropertyValueType valueType)
{
double? adjustedValue = CanCacheDouble(scale, value);
bool canCache = adjustedValue.HasValue;
if (canCache)
{
value = adjustedValue.GetValueOrDefault();
}
IFCAnyHandle propertyHandle;
if (canCache)
{
propertyHandle = ExporterCacheManager.PropertyInfoCache.RealCache.Find(propertyName, value);
if (propertyHandle != null)
return propertyHandle;
}
propertyHandle = CreateRealProperty(file, propertyName, value, valueType);
if (canCache && !IFCAnyHandleUtil.IsNullOrHasNoValue(propertyHandle))
{
ExporterCacheManager.PropertyInfoCache.RealCache.Add(propertyName, value, propertyHandle);
}
return propertyHandle;
}
示例12: CreatePositiveLengthMeasureProperty
/// <summary>
/// Create a positive length measure property.
/// </summary>
/// <param name="file">The IFC file.</param>
/// <param name="propertyName">The name of the property.</param>
/// <param name="value">The value of the property.</param>
/// <param name="valueType">The value type of the property.</param>
/// <returns>The created property handle.</returns>
public static IFCAnyHandle CreatePositiveLengthMeasureProperty(IFCFile file, string propertyName, double value, PropertyValueType valueType)
{
if (value > MathUtil.Eps())
{
IFCData posLengthData = IFCDataUtil.CreateAsPositiveLengthMeasure(value);
return CreateCommonProperty(file, propertyName, posLengthData, valueType, null);
}
return null;
}
示例13: CreateElectricalCurrentMeasurePropertyFromElementOrSymbol
/// <summary>
/// Create an electrical current measure property from the element's or type's parameter.
/// </summary>
/// <param name="file">The IFC file.</param>
/// <param name="elem">The Element.</param>
/// <param name="revitParameterName">The name of the parameter.</param>
/// <param name="ifcPropertyName">The name of the property.</param>
/// <param name="valueType">The value type of the property.</param>
/// <returns>The created property handle.</returns>
public static IFCAnyHandle CreateElectricalCurrentMeasurePropertyFromElementOrSymbol(IFCFile file, Element elem, string revitParameterName, string ifcPropertyName, PropertyValueType valueType)
{
double propertyValue;
if (ParameterUtil.GetDoubleValueFromElement(elem, null, revitParameterName, out propertyValue) != null)
{
return CreateElectricalCurrentMeasurePropertyFromCache(file, ifcPropertyName, propertyValue, valueType);
}
// For Symbol
Document document = elem.Document;
ElementId typeId = elem.GetTypeId();
Element elemType = document.GetElement(typeId);
if (elemType != null)
return CreateElectricalCurrentMeasurePropertyFromElementOrSymbol(file, elemType, revitParameterName, ifcPropertyName, valueType);
else
return null;
}
示例14: CreateThermalTransmittancePropertyFromCache
/// <summary>Create a Thermal Transmittance property, using a cached value if possible.</summary>
/// <param name="file">The IFC file.</param>
/// <param name="propertyName">The name of the property.</param>
/// <param name="value">The value of the property.</param>
/// <param name="valueType">The value type of the property.</param>
/// <returns>The created or cached property handle.</returns>
public static IFCAnyHandle CreateThermalTransmittancePropertyFromCache(IFCFile file, string propertyName, double value, PropertyValueType valueType)
{
double? adjustedValue = CanCacheThermalTransmittance(value);
bool canCache = adjustedValue.HasValue;
if (canCache)
value = adjustedValue.GetValueOrDefault();
IFCAnyHandle propertyHandle;
if (canCache)
{
propertyHandle = ExporterCacheManager.PropertyInfoCache.ThermalTransmittanceCache.Find(propertyName, value);
if (propertyHandle != null)
return propertyHandle;
}
propertyHandle = CreateThermalTransmittanceProperty(file, propertyName, value, valueType);
if (canCache && !IFCAnyHandleUtil.IsNullOrHasNoValue(propertyHandle))
ExporterCacheManager.PropertyInfoCache.ThermalTransmittanceCache.Add(propertyName, value, propertyHandle);
return propertyHandle;
}
示例15: CreateThermalTransmittanceProperty
/// <summary>Create a ThermalTransmittance property.</summary>
/// <param name="file">The IFC file.</param>
/// <param name="propertyName">The name of the property.</param>
/// <param name="value">The value of the property.</param>
/// <param name="valueType">The value type of the property.</param>
/// <returns>The created property handle.</returns>
public static IFCAnyHandle CreateThermalTransmittanceProperty(IFCFile file, string propertyName, double value, PropertyValueType valueType)
{
IFCData thermalTransmittanceData = IFCDataUtil.CreateAsThermalTransmittanceMeasure(value);
return CreateCommonProperty(file, propertyName, thermalTransmittanceData, valueType, null);
}