02.05.2014 Views

CoreandServices.book - Ocean - Schlumberger

CoreandServices.book - Ocean - Schlumberger

CoreandServices.book - Ocean - Schlumberger

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Units<br />

Below is an example using IUnitSystem:<br />

...<br />

// Get the unit service settings<br />

IUnitServiceSettings uss;<br />

uss = CoreSystem.GetService();<br />

// Get the current catalog<br />

IUnitCatalog currentCatalog = uss.CurrentCatalog;<br />

// Get the measurement for Inside Diameter<br />

IUnitMeasurement m = catalog.GetUnitMeasurement(“Inside Diameter”);<br />

// Get the current unit system<br />

IUnitSystem unitSystem = uss.InvariantSystem;<br />

// Get the units for Inside Diameter from the unit system.<br />

IUnit units = unitSystem.GetUnit(m);<br />

...<br />

Custom Unit Systems<br />

You can define custom unit systems in your module. A custom unit system allows the<br />

module to control the default mapping between measurements and units. You only need<br />

to provide a mapping between the measurements and units you care about.<br />

Measurements not in your custom unit system will be mapped to units as defined by the<br />

IUnitServiceSettings.InvariantSystem unit system. This is the unit system<br />

initialized in memory when the product family implements IUnitServiceSettings in<br />

the module Initialize lifecycle step.<br />

You create a custom unit system by providing a name, description, and dictionary that<br />

maps the units to measurements. The custom unit system will only be available in memory<br />

and cannot be saved to the catalog. It should be set up in the modules Integration<br />

step. The unit service does not provide a method to persist the new custom unit system. It<br />

is the responsibility of the product family to persist the custom unit system should it be<br />

required by the application.<br />

<strong>Schlumberger</strong> Private<br />

<strong>Ocean</strong> Services 4-207

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

Saved successfully!

Ooh no, something went wrong!