Carbon Layer Model
MVC model for carbon layer paths.
CarbonLayerItem
Bases: QStandardItem
Represents a single carbon layer path.
Source code in src/cplus_plugin/gui/carbon_item_model.py
is_valid
property
Returns the validity status of the carbon layer path.
The path could be invalid if it does not exist or if the corresponding map layer is invalid.
Returns:
Type | Description |
---|---|
bool
|
True if valid, else False. |
layer_path
property
Returns the path to the carbon layer.
Returns:
Type | Description |
---|---|
str
|
Path to the carbon layer. |
type
Returns the type of the standard item.
Returns:
Type | Description |
---|---|
int
|
Type identifier of the carbob item. |
update
Update the UI properties.
Source code in src/cplus_plugin/gui/carbon_item_model.py
CarbonLayerModel
Bases: QStandardItemModel
View model for carbon layers.
Source code in src/cplus_plugin/gui/carbon_item_model.py
add_carbon_layer
Adds a carbon layer to the model.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
layer_path |
str
|
Carbon layer path. |
required |
Returns:
Type | Description |
---|---|
bool
|
True if the carbon layer was successfully added, else False if there is an existing item with the same path. |
Source code in src/cplus_plugin/gui/carbon_item_model.py
carbon_layer_index
Get the model index for the given layer path.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
layer_path |
str
|
Carbon layer path. |
required |
Returns:
Type | Description |
---|---|
QtCore.QModelIndex
|
The index corresponding to the given layer path else an invalid index if not found. |
Source code in src/cplus_plugin/gui/carbon_item_model.py
carbon_paths
Gets all the carbon paths in the model.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
valid_only |
bool
|
Only return the carbon paths that are valid. |
False
|
Returns:
Type | Description |
---|---|
list
|
A collection of carbon paths in the model. |
Source code in src/cplus_plugin/gui/carbon_item_model.py
contains_layer_path
Checks if the specified layer path exists in the model.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
layer_path |
str
|
Carbon layer path. |
required |
Returns:
Type | Description |
---|---|
bool
|
True if the path exists, else False. |
Source code in src/cplus_plugin/gui/carbon_item_model.py
update_carbon_path
Update the carbon path at the given position specified by the index.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
index |
QModelIndex
|
Location to modify the carbon path. |
required |
layer_path |
str
|
Carbon layer path. |
required |
Returns:
Type | Description |
---|---|
bool
|
True if the path was successfully updated else False if there is no carbon item at the given location. |