Module fmeobjects :: Class FMEPalette
[hide private]
[frames] | no frames]

Class FMEPalette


init(MultipleInvocations)

FMEPalette class.

Create an instance of a FMEPalette object.

init(name, key, value)

Creates a palette with the given properties.

The keys tile and values tile must have the same number of entries.

Parameters

Returns: FMEPalette

init(palette)

Create a copy of the passed in palette object.

Parameters

Returns: FMEPalette

Instance Methods [hide private]
 
__getObject__(args)
 
__init__(MultipleInvocations)
x.__init__(...) initializes x; see help(type(x)) for signature
a new object with type S, a subtype of T
__new__(T, S, ...)
None
addKeysAndValues(keys, values)
Adds keys and values to the palette.
bool
containsKeys(keys)
Returns whether the specified keys are contained in the palette.
bool
containsValues(values)
Returns whether the specified values are contained in the palette.
bool
equals(palette)
Evaluates whether two palettes are identical.
FMETile
getKeyIndices(keys)
Returns the indices of the specified keys in the palette.
FMETile
getKeyTile()
Returns the keys of the palette.
FMETile
getMaxComponentValues()
Returns a tile containing the maximum values of each component in the palette.
FMETile
getMaxKey()
Returns a maximum key of the palette.
FMETile
getMaxValue()
Returns a maximum value of the palette.
FMETile
getMinComponentValues()
Returns a tile containing the minimum values of each component in the palette.
FMETile
getMinKey()
Returns a minimum key of the palette.
FMETile
getMinValue()
Returns a minimum value of the palette.
string
getName()
Returns a name of the palette.
FMETile
getNextAvailableKeys(numKeys)
Returns the next available keys from the palette.
int
getNumEntries()
Returns the number of entries in the palette.
FMETile
getValueTile()
Returns the values of the palette.
FMETile
getValuesFromKeys(keys)
Returns resolved values from the keys parameter.
bool
hasBeenModified()
Returns whether the palette has been modified from its baseline state.
bool
isSelected()
Returns whether the palette is selected for operations.
None
removeKeysAndValues(keys)
Removes specified keys and corresponding values from the palette.
None
setModified(modified)
Sets whether palette has been modified from baseline state.
None
setSelected(selected)
Selects/ Deselects palette for operations.
None
setValuesFromKeys(keys, values)
Sets value associated with the key of the palette.

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(MultipleInvocations)
(Constructor)

 

x.__init__(...) initializes x; see help(type(x)) for signature

Overrides: object.__init__

__new__(T, S, ...)

 
Returns: a new object with type S, a subtype of T
Overrides: object.__new__

addKeysAndValues(keys, values)

 

Adds keys and values to the palette. This method can add and/or set multiple values at once.

The input keys tile must be the same interpretation as the palette keys. The input values tile must be the same interpretation as the palette values.

The size of keys must be the same as the size of the values.

Parameters:
  • keys (FMETile) - Key tile to add. Must be the same interpretation as the palette keys.
  • values (FMETile) - Value tile to add. Must be the same interpretation as the palette values.
Returns: None
Raises:
  • FMEException - An exception is raised
    • if an error occurred.
    • if the number of new keys exceed the maximum number of keys this palette can handle.

containsKeys(keys)

 

Returns whether the specified keys are contained in the palette. The input tile may contain multiple keys.

Parameters:
  • keys (FMETile) - Key tile to look for.
Returns: bool
True if the specified keys are contained in the palette. False if not.

containsValues(values)

 

Returns whether the specified values are contained in the palette. The input tile may contain multiple values.

Parameters:
  • values (FMETile) - Value tile to look for.
Returns: bool
True if the specified values are contained in the palette. False if not.

equals(palette)

 

Evaluates whether two palettes are identical.

Parameters:
  • palette (FMEPalette) - The palette object to compare to.
Returns: bool
True if the two palette are the same.

getKeyIndices(keys)

 

Returns the indices of the specified keys in the palette.

An index represents the position of a key in the overall list of keys. For example, if a palette contains the following keys: 0 2 5 8, then the corresponding indices are: 0 1 2 3.

Parameters:
  • keys (FMETile) - The keys tiles to look for. The keys tiles must be the same interpretation as the palette keys.
Returns: FMETile
Indices of the specified keys in the palette.
Raises:
  • FMEException - An exception is raised
    • if an error occurred.
    • if the palette does not contain one of the specified keys.

getKeyTile()

 

Returns the keys of the palette.

Returns: FMETile
Keys of the palette.
Raises:
  • FMEException - An exception is raised if an error occurred.

getMaxComponentValues()

 

Returns a tile containing the maximum values of each component in the palette.

This tile might not be part of the palette itself and might not have a corresponding key tile.

Returns: FMETile
A tile containing the maximum value of each component in this palette.
Raises:
  • FMEException - An exception is raised if an error occurred.

getMaxKey()

 

Returns a maximum key of the palette.

Returns: FMETile
The maximum key of the palette.
Raises:
  • FMEException - An exception is raised if an error occurred.

getMaxValue()

 

Returns a maximum value of the palette.

Returns: FMETile
The maximum value of the palette.
Raises:
  • FMEException - An exception is raised if an error occurred.

getMinComponentValues()

 

Returns a tile containing the minimum values of each component in the palette.

This tile might not be part of the palette itself and might not have a corresponding key tile.

Returns: FMETile
A tile containing the minimum value of each component in this palette.
Raises:
  • FMEException - An exception is raised if an error occurred.

getMinKey()

 

Returns a minimum key of the palette.

Returns: FMETile
The minimum key of the palette.
Raises:
  • FMEException - An exception is raised if an error occurred.

getMinValue()

 

Returns a minimum value of the palette.

Returns: FMETile
The minimum value of the palette.
Raises:
  • FMEException - An exception is raised if an error occurred.

getName()

 

Returns a name of the palette.

Returns: string
Name of the palette.

getNextAvailableKeys(numKeys)

 

Returns the next available keys from the palette.

This method can get multiple available keys at once.

This routine can be used before the addKeysAndValues routine to make sure that there are enough new keys.

Parameters:
  • numKeys (int) - Number of keys to look up.
Returns: FMETile
The next available keys from the palette.
Raises:
  • FMEException - An exception is raised if an error occurred.

getNumEntries()

 

Returns the number of entries in the palette.

Returns: int
The number of entries in the palette.

getValueTile()

 

Returns the values of the palette.

Returns: FMETile
Values of the palette.
Raises:
  • FMEException - An exception is raised if an error occurred.

getValuesFromKeys(keys)

 

Returns resolved values from the keys parameter.

This method allow multiple key-to-value lookups.

The input keys tile must be the same interpretation as the palette keys.

Parameters:
  • keys (FMETile) - Input key tile. It must be the same interpretation as the palette keys.
Returns: FMETile
Values associated with keys.
  • If specified key is not found in the palette, the value will be set to 0.
Raises:
  • FMEException - An exception is raised if an error occurred.

hasBeenModified()

 

Returns whether the palette has been modified from its baseline state.

Returns: bool
True if it has been modified, False if it has not.

isSelected()

 

Returns whether the palette is selected for operations.

Returns: bool
True if it is selected, False if it is not.

removeKeysAndValues(keys)

 

Removes specified keys and corresponding values from the palette. This method can remove multiple keys and values at once.

The input keys tile must be the same interpretation as the palette keys.

Note that palette cannot be empty, meaning that there must be at least one entry in the palette. Therefore, attempting to remove everything from the palette will give an error and raise an exception.

Parameters:
Returns: None
Raises:
  • FMEException - An exception is raised if an error occurred.

setModified(modified)

 

Sets whether palette has been modified from baseline state.

Note that hasBeenModified is initially set to False. Then, any calls that alter the palette will cause the modified state to become True (this does not need to be explicitly set; it will occur automatically).

Parameters:
  • modified (bool) - True when properties is altered.
Returns: None

setSelected(selected)

 

Selects/ Deselects palette for operations.

Parameters:
  • selected (bool) - True to select, False to deselect.
Returns: None

setValuesFromKeys(keys, values)

 

Sets value associated with the key of the palette. This method can set multiple values at once.

The input keys tile must be the same interpretation as the palette keys. The input values tile must be the same interpretation as the palette values.

The size of the keys must be the same as the size of the values.

Parameters:
Returns: None
Raises:
  • FMEException - An exception is raised
    • if an error occurred.
    • if some of the keys do not exist.