02.05.2014 Views

CoreandServices.book - Ocean - Schlumberger

CoreandServices.book - Ocean - Schlumberger

CoreandServices.book - Ocean - Schlumberger

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Template Catalog<br />

measurement for the data. Converters must be created for the direction of conversion<br />

being performed from storage to UI or from UI to storage.<br />

...<br />

ITemplate DensityT = PetrelUnitSystem.TemplateGroupLogTypes.Density;<br />

// Create converter from UI to canonical using the template<br />

IUnitConverter fromUI = PetrelUnitSystem.GetConverterFromUI(DensityT);<br />

// Convert a density value<br />

double newDensityValue = fromUI.Convert(2.65);<br />

// Create converter from UI to canonical using the unit measurement<br />

IUnitMeasurement um = DensityT.UnitMeasurement;<br />

// Create converter from canonical to UI using the unit measurement<br />

IUnitConverter toUI = PetrelUnitSystem.GetConverterToUI(um);<br />

// Convert a value for display<br />

double displayDensityValue = toUI.Convert(2.65);<br />

...<br />

5-260 <strong>Ocean</strong> Application Development Framework 2008.1<br />

<strong>Schlumberger</strong> Private

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!