WSOpenNetwork
An open network. An open network allows access to the network contents, similar to opening the network as a grid or GeoPlan in the UI.
Methods:
- add_scenario
- cancel_mesh_job
- clear_selection
- csv_export
- csv_import
- current_scenario
- current_scenario= (Set)
- current_timestep
- current_timestep= (Set)
- current_timestep_time
- delete_scenario
- delete_selection
- download_mesh_job_log
- each
- each_selected
- export_ids
- field_names
- gauge_timestep_count
- gauge_timestep_time
- gis_export
- infodrainage_import
- list_gauge_timesteps
- list_gis_export_tables
- list_timesteps
- load_mesh_job
- load_selection
- mesh
- mesh_async
- mesh_job_status
- model_object
- mscc_export_cctv_surveys
- mscc_export_manhole_surveys
- mscc_import_cctv_surveys
- mscc_import_manhole_surveys
- network_model_object
- new_row_object
- objects_in_polygon
- odec_export_ex
- odic_import_ex
- ribx_export_surveys
- ribx_import_surveys
- row_object
- row_object_collection
- row_object_collection_selection
- row_objects
- row_objects_from_asset_id
- row_objects_selection
- run_sql
- run_inference
- run_stored_query_object
- save_selection
- scenarios
- search_at_point
- selection_size
- set_projection_string
- snapshot_export
- snapshot_export_ex
- snapshot_import_ex
- snapshot_scan
- table
- table_names
- tables
- timestep_count
- timestep_time
- transaction_begin
- transaction_commit
- transaction_rollback
- update_cctv_scores
- xprafts_import
add_scenario
#add_scenario(name, based_on, notes) ⇒ void
EXCHANGE
, UI
Adds a new scenario to the network.
network.add_scenario('MyNewScenario', nil, 'Some notes...')
Parameters
Name | Type(s) | Description |
---|---|---|
name | String | Name of the new scenario. |
based_on | String, nil | The name of the scenario to use as a base, if any. |
notes | String | Notes or description for this scenario. |
cancel_mesh_job
#cancel_mesh_job(job_id) ⇒ void
EXCHANGE
Cancels a mesh job.
Parameters
Name | Type(s) | Description |
---|---|---|
job_id | Integer | The job id from the #mesh_async method. |
clear_selection
#clear_selection ⇒ void
EXCHANGE
, UI
Clears the current selection, i.e. any WSRowObjects that are currently selected will be deselected.
csv_export
#csv_export(filename, options) ⇒ void
EXCHANGE
, UI
Exports data to CSV.
See WSBaseNetworkObject.csv_export
.
csv_import
#csv_import(filename, options) ⇒ void
EXCHANGE
, UI
Imports data from CSV.
See WSBaseNetworkObject.csv_import
.
current_scenario
#current_scenario ⇒ String
EXCHANGE
, UI
Returns the current scenario of the network. If the current scenario is the base scenario, returns the string Base
(in English).
Parameters
Name | Type(s) | Description |
---|---|---|
Return | String |
current_scenario= (Set)
#current_scenario=(name) ⇒ void
EXCHANGE
, UI
Sets the current scenario of the network. The scenario must exist.
Parameters
Name | Type(s) | Description |
---|---|---|
name | String, nil | The name of the scenario, if nil then the scenario is set to the base scenario. |
current_timestep
#current_timestep ⇒ Integer
EXCHANGE
, UI
The WSOpenNetwork object has a current timestep corresponding to the current timestep results have when opened in the software's UI. It determines the timestep for which the 'result' method of the WSRowObject returns its value. This method returns the index of the current timestep, with the first timestep being index 0 and the final timestep begin timestep_count - 1. The value of -1, representing the 'maximum' 'timestep' is also possible. The initial value when a sim is opened in ICM Exchange will be 0 if there are time varying results, otherwise -1 for the 'maximum' 'timestep'.
puts network.current_timestep_time
=> 0
Parameters
Name | Type(s) | Description |
---|---|---|
Return | Integer |
current_timestep= (Set)
#current_timestep=(index) ⇒ void
EXCHANGE
Sets the current network timestep.
Parameters
Name | Type(s) | Description |
---|---|---|
index | Integer | The timestep index, 0 sets the current timestep to the first timestep, -1 returns the maximum timestep. |
current_timestep_time
#current_timestep_time ⇒ DateTime
EXCHANGE
, UI
Returns the actual time of the current timestep.
puts network.current_timestep_time
=> ?
Parameters
Name | Type(s) | Description |
---|---|---|
Return | DateTime |
delete_scenario
#delete_scenario(name) ⇒ void
EXCHANGE
, UI
Deletes a named scenario from the network. If the deleted scenario is the current scenario, the network will switch to the base scenario.
puts network.current_scenario
=> 'ScenarioBadger'
network.delete_scenario('ScenarioBadger')
puts network.current_scenario
=> 'Base'
Parameters
Name | Type(s) | Description |
---|---|---|
name | String | The name of the scenario to delete. |
delete_selection
#delete_selection ⇒ void
EXCHANGE
, UI
Deletes the currently selected objects from the network, in the current scenario.
download_mesh_job_log
#download_mesh_job_log(job_id, path) ⇒ void
EXCHANGE
Copies the log output from a #mesh_async job to a new file.
Parameters
Name | Type(s) | Description |
---|---|---|
job_id | Integer | The job id from the #mesh_async method. |
path | String | Path to the new file, including extension (.txt ). |
each
#each { |ro| ... } ⇒ WSRowObject
EXCHANGE
, UI
Iterates through each object in the network.
Parameters
Name | Type(s) | Description |
---|---|---|
Return | WSRowObject |
each_selected
#each_selected { |ro| ... } ⇒ WSRowObject
EXCHANGE
, UI
Iterates through each selected object in the network.
Parameters
Name | Type(s) | Description |
---|---|---|
Return | WSRowObject |
export_ids
#export_ids(filename, options) ⇒ void
EXCHANGE
, UI
Exports the IDs of WSRowObjects to a file, grouped by table.
The options hash has the following keys:
Key | Type | Default | Description |
---|---|---|---|
Selection Only | Boolean | false | If true, only the currently selected WSRowObjects will be exported |
UTF8 | Boolean | false | If true will save the file with UTF8 encoding, otherwise will use current locale |
Parameters
Name | Type(s) | Description |
---|---|---|
filename | String | Path to the file, including extension (.txt ). |
options | Hash, nil | See description. |
field_names
#field_names(table) ⇒ Array<String>
EXCHANGE
, UI
Returns the field names for a given table.
network.field_names('wn_node').each { |s| puts s }
Parameters
Name | Type(s) | Description |
---|---|---|
table | String | The name of the table (type) of wsrowobject. |
Return | Array<String> |
gauge_timestep_count
#gauge_timestep_count ⇒ Integer
EXCHANGE
, UI
Returns the number of gauge timesteps.
Parameters
Name | Type(s) | Description |
---|---|---|
Return | Integer | The number of gauge timesteps, if there are no gauge timesteps (e.g. no objects are gauged, or the gauge timestep multiplier is 0) this will be 0. |
gauge_timestep_time
#gauge_timestep_time(index) ⇒ DateTime
EXCHANGE
, UI
Returns the actual time of the timestep.
puts network.gauge_timestep_time(0)
=> ?
Parameters
Name | Type(s) | Description |
---|---|---|
index | Integer | The gauge timestep index. |
Return | DateTime |
gis_export
#gis_export(format, options, location) ⇒ void
EXCHANGE
, UI
Exports the network data to GIS format. See the WSNumbatNetworkObject.gis_export method.
infodrainage_import
#infodrainage_import(filename, log) ⇒ void
EXCHANGE
Imports an InfoDrainage model into the network.
Parameters
Name | Type(s) | Description |
---|---|---|
filename | String | Filepath to the infodrainage file including extension .iddx . |
log | String | Filepath to save the import log including extension .txt , which will be in rich text format. |
list_gauge_timesteps
#list_gauge_timesteps ⇒ Array<DateTime>
EXCHANGE
, UI
Returns the times of all gauge timesteps, in order.
Parameters
Name | Type(s) | Description |
---|---|---|
Return | Array<DateTime> |
list_gis_export_tables
#list_gis_export_tables ⇒ Array<String>
EXCHANGE
Returns the tables that can be exported using the #gis_export method.
Parameters
Name | Type(s) | Description |
---|---|---|
Return | Array<String> |
list_timesteps
#list_timesteps ⇒ Array<DateTime>
EXCHANGE
, UI
Returns the times of all timesteps, in order.
Parameters
Name | Type(s) | Description |
---|---|---|
Return | Array<DateTime> |
load_mesh_job
#load_mesh_job(job_id) ⇒ void
EXCHANGE
Loads the the completed mesh from a #mesh_async job into the network.
Parameters
Name | Type(s) | Description |
---|---|---|
job_id | Integer | The job id from the #mesh_async method. |
load_selection
#load_selection(selection_list) ⇒ void
EXCHANGE
, UI
Selects objects in the network from the selection list object.
Parameters
Name | Type(s) | Description |
---|---|---|
selection_list | Integer, String, WSModelObject | The selection list - can be the id, scripting path, or a wsmodelobject of the correct type. |
mesh
#mesh(options) ⇒ Hash<String, Boolean>
EXCHANGE
Meshes one or more 2D zones. This method performs meshing synchronously i.e. it blocks the script thread. To perform meshing asynchronously, see the #mesh_async method.
The options hash contains the following keys:
Name | Type | Required | Description |
---|---|---|---|
GroundModel | Integer, String, WSModelObject | Yes | This may either be the scripting path, the ID, or the WSModelObject representing a ground model (either grid or TIN). If the ID is negative then it represents a TIN ground model i.e. -7 represents the TIN ground model with ID 7. If the ID is positive it represents a gridded ground model. |
VoidsFile | String | No | The path of a GIS file containing the voids |
VoidsFeatureClass | String | No | For a GeoDatabase, the feature class within the GeoDatabase for the voids |
VoidsCategory | String | No | The category of polygon within the network used for voids |
BreakLinesFile | String | No | The path of a GIS file containing the break lines |
BreakLinesFeatureClass | String | No | For a GeoDatabase, the feature class within the GeoDatabase for the break lines |
BreakLinesCategory | String | No | The category of polyline within the network used for break lines |
WallsFile | String | No | The path of a GIS file containing the walls |
WallsFeatureClass | String | No | For a GeoDatabase, the feature class within the GeoDatabase for the walls |
WallsCategory | String | No | The category of polyline within the network used for walls |
2DZones | String, Array<String> | Yes | If the 2DZonesSelectionList parameter is absent and this parameter is absent or nil all 2D zones will be meshed. Otherwise can contain the name of a 2D zone as a string, or an array of strings containing the names of 2D zones |
2DZonesSelectionList | Integer, String, WSModelObject | No | A selection list of 2D zones to mesh |
LowerElementGroundLevels | Boolean | No | If present and evaluates to true, the process will lower 2D mesh elements with ground levels higher than the adjacent bank levels |
RunOn | String | No | The computer to run the job on - . for 'this computer', * for 'any computer' |
LogFile | String | No | The path of the log file with .HTML extension, if empty one will not be saved. This can only be used if only one 2D zone is meshed. |
LogPath | String | No | The path of a folder for the log files. This may be used however many 2D zones are meshed. The file will be given the name of the 2D zone with the file type HTML. |
- For the pairs of keys (voids, break lines and wall) only one of the two values may be set.
- If any of the VoidsFile, WallsFile or BreakLinesFile values are set, i.e. if any voids, walls or break lines are to be read in from a GIS files, the GIS component must be set with
WSApplication.map_component=
The user must have the GIS component they are selecting. - The FeatureClass keys can only be set if the corresponding File key is set and the map control is set and is not MapXTreme.
- Only one of the 2DZones and 2DZonesSelectionList keys may be present.
- Only one of the LogFile and LogDir keys may be present.
Parameters
Name | Type(s) | Description |
---|---|---|
options | Hash | An options hash, see method description. |
Return | Hash<String, Boolean> | A hash with the 2d zone names as keys, with a boolean indicating success or failure. |
mesh_async
#mesh_async(options) ⇒ Array<Integer>
EXCHANGE
Meshes one or more 2D zones. Similar to the #mesh
method, except it runs asynchronously i.e. it does not block the script thread.
Each 2D zone will have a unique job ID, returned in the array. These are integers that can be used in the #load_mesh_job
, #cancel_mesh_job
, #download_mesh_job_log
, and #mesh_job_status
methods of this network class, or the WSApplication.wait_for_jobs method.
Parameters
Name | Type(s) | Description |
---|---|---|
options | Hash | An options hash, identical to #mesh except it does not have the logfile or logdir keys. |
Return | Array<Integer> | An array of job ids, which can be used in other methods (see description). |
mesh_job_status
#mesh_job_status(job_id) ⇒ String
EXCHANGE
Returns the current status of a mesh job, identified by a job ID from #mesh_async.
Parameters
Name | Type(s) | Description |
---|---|---|
job_id | Integer | The job id from the #mesh_async method. |
Return | String |
model_object
#model_object ⇒ WSModelObject
EXCHANGE
, UI
Returns a WSModelObject
(or derived class) associated with this network.
If the network was loaded from a sim, then the model object of that sim will be returned. This is different from #network_model_object
which always returns the network.
Parameters
Name | Type(s) | Description |
---|---|---|
Return | WSModelObject |
mscc_export_cctv_surveys
#mscc_export_cctv_surveys(export_file, export_images, selection_only, log_file ⇒ Boolean
EXCHANGE
, UI
This method exports CCTV survey data from a Collection Network to the MSCC4 XML format.
The export_file argument specified the output XML file and log_file the location of a text file for errors.
The other two arguments take Boolean values. export_images controls whether defect images are to be exported and selection_only will limit the export to selected objects.
Parameters
Name | Type(s) | Description |
---|---|---|
Return | Boolean |
mscc_export_manhole_surveys
#mscc_export_manhole_surveys(export_file, export_images, selection_only, log_file) ⇒ Boolean
EXCHANGE
, UI
This method exports manhole survey data from a Collection Network to the MSCC5 XML format.
The export_file argument specified the output XML file and log_file the location of a text file for errors.
The other two arguments take Boolean values. export_images controls whether defect images are to be exported and selection_only will limit the export to selected objects.
Parameters
Name | Type(s) | Description |
---|---|---|
Return | Boolean |
mscc_import_cctv_surveys
#mscc_import_cctv_surveys(import_file, import_flag, import_images, id_gen, overwrite, log_file)
EXCHANGE
, UI
This method imports CCTV survey data into a Collection Network from the MSCC4 XML format.
The import_file argument specifies the XML file and log_file the location of a text file for errors.
The import_flag text specifies the data flag for imported fields. import_images controls whether defect images are to be imported.
To prevent the overwriting of existing surveys in the event of name clashes, set overwite to false.
The id generation parameter, id_gen, uses the following values (these correspond to the user interface options in the help):
- 1 - StartNodeRef, Direction, Date and Time
- 2 - StartNodeRef, Direction and an index for uniqueness
- 3 - US node ID, Direction, Date and Time
- 4 - US node ID, Direction and an index for uniqueness
- 5 - ClientDefined1
- 6 - ClientDefined2
- 7 - ClientDefined3
mscc_import_manhole_surveys
#mscc_import_manhole_surveys(import_file, import_flag, import_images, id_gen, overwrite, log_file)
EXCHANGE
, UI
This method imports manhole survey data into a Collection Network from the MSCC5 XML format.
The import_file argument specifies the XML file and log_file the location of a text file for errors.
The import_flag text specifies the data flag for imported fields. import_images controls whether defect images are to be imported.
To prevent the overwriting of existing surveys in the event of name clashes, set overwite to false.
The id generation parameter, id_gen, uses the following values (these correspond to the user interface options in the help):
- 1 - Manhole/Node reference, Date and Time
- 2 - Manhole/Node reference and an index for uniqueness
network_model_object
#network_model_object ⇒ WSModelObject
EXCHANGE
, UI
Returns the WSModelObject
(or derived class) associated with this network.
If the network was loaded from a sim, then the model object of that network will be returned. This is different from #model_object
which would return the sim.
Parameters
Name | Type(s) | Description |
---|---|---|
Return | WSModelObject |
new_row_object
#new_row_object(type) ⇒ WSRowObject
EXCHANGE
, UI
Creates a new object in this network. This must be done within a network transaction, and you must set a primary ID for the object before you can write changes to it.
Parameters
Name | Type(s) | Description |
---|---|---|
type | String | The object type. |
Return | WSRowObject |
objects_in_polygon
#objects_in_polygon(polygon, type) ⇒ Array<WSRowObject>
EXCHANGE
, UI
Returns an array of the WSRowObject
objects inside the polygon
geometry, matching the type
parameter.
When using an array of strings as the type
, all values must be unique (no duplicates) and cannot contain a category and a table within the same category.
Parameters
Name | Type(s) | Description |
---|---|---|
polygon | WSRowObject | An object containing polygon geometry. |
type | String, Array<String>, nil | The name(s) of a type or category of object, nil will search all tables. |
Return | Array<WSRowObject> |
odec_export_ex
#odec_export_ex(format, config, options, table, *args) ⇒ void
EXCHANGE
, UI
Exports network data using the Open Data Export Centre.
See WSBaseNetworkObject.odec_export_ex.
odic_import_ex
#odic_import_ex(format, config, options, table, *args) ⇒ Array<WSRowObject>
EXCHANGE
, UI
Imports and updates network data using the Open Data Import Centre, returning an array of the objects created or updated in the process. Objects may also be deleted, but these are not returned / listed.
See WSBaseNetworkObject.odec_import_ex.
Parameters
Name | Type(s) | Description |
---|---|---|
Return | Array<WSRowObject> |
ribx_export_surveys
#ribx_export_surveys(export_file, selection_only, log_file) ⇒ Boolean
EXCHANGE
, UI
Exports manhole survey and cctv survey data from a Collection Network to the RIBX XML format.
The export_file argument specified the output XML file and log_file the location of a text file for errors.
The selection_only argument is a Boolean value and will limit the export to selected objects if it is true.
Parameters
Name | Type(s) | Description |
---|---|---|
Return | Boolean |
ribx_import_surveys
#ribx_import_surveys(import_file, import_flag, id_gen, overwrite, log_file)
EXCHANGE
, UI
This method imports CCTV survey & manhole survey data into a Collection Network from the RIBX XML format.
The import_file argument specifies the XML file and log_file the location of a text file for errors.
The import_flag text specifies the data flag for imported fields.
To prevent the overwriting of existing surveys in the event of name clashes, set overwite to false.
The id generation parameter, id_gen, uses the following values (these correspond to the user interface options in the help).
- 1 - StartNodeRef, Direction, Date and Time
- 2 - StartNodeRef, Direction and an index for uniqueness
- 3 - US node ID, Direction, Date and Time
- 4 - US node ID, Direction and an index for uniqueness
row_object
#row_object(type, id) ⇒ WSRowObject?
EXCHANGE
, UI
Returns a specific row object by type and ID.
node = network.row_object('wn_node', 'ST543643')
raise "Could not get node" if node.nil?
Parameters
Name | Type(s) | Description |
---|---|---|
type | String | The object type. |
id | String | The object id, e.g. 'st543643' or st543643.st543473.1 . |
Return | WSRowObject, nil | The object found, or nil if there is no such object in the network. |
row_object_collection
#row_object_collection(type) ⇒ WSRowObjectCollection
EXCHANGE
, UI
Returns all row objects of a given type as a WSRowObjectCollection
.
Parameters
Name | Type(s) | Description |
---|---|---|
type | String | The object type. |
Return | WSRowObjectCollection | All objects of this type in the network, will be empty if there are none of this type. |
row_object_collection_selection
#row_object_collection_selection(type) ⇒ WSRowObjectCollection
EXCHANGE
, UI
Returns all selected row objects of a given type as a WSRowObjectCollection
.
Parameters
Name | Type(s) | Description |
---|---|---|
type | String | The object type. |
Return | WSRowObjectCollection | The selected objects of this type in the network, will be empty if there are none of this type selected. |
row_objects
#row_objects(type) ⇒ Array<WSRowObject>
EXCHANGE
, UI
Returns all row objects of a given type in an Array.
Parameters
Name | Type(s) | Description |
---|---|---|
type | String | The object type. |
Return | Array<WSRowObject> | The objects of this type in the network, will be empty if there are none. |
row_objects_from_asset_id
#row_objects_from_asset_id(type, id) ⇒ Array<WSRowObject>
EXCHANGE
, UI
Returns all row objects of a given type with this Asset ID. This method is useful when working with imported link objects, where you may not know the multi-part ID.
Asset ID's are not guaranteed to be unique, so there may be multiple results. You can use the first
Array method to access the first object.
nodes = network.row_objects_from_asset_id('wn_node', 'ST543643')
puts nodes.first['asset_id']
=> 'ST543643'
You can also create your own method which enforces a single result, returning nil if no object is found or multiple objects are found:
def unique_row_object_from_asset_id(network, type, id)
nodes = network.row_objects_from_asset_id(type, id)
return (nodes.size != 1) ? nil : nodes.first
end
Parameters
Name | Type(s) | Description |
---|---|---|
type | String | The object type - cannot be _nodes or _links . |
id | String | The object's asset id e.g. 'st543643'. |
Return | Array<WSRowObject> | The objects found in the network, will be an empty array if there are none. |
row_objects_selection
#row_objects_selection(type) ⇒ Array<WSRowObject>
EXCHANGE
, UI
Returns all selected row objects of a given type in an Array.
Parameters
Name | Type(s) | Description |
---|---|---|
type | String | The object type. |
Return | Array<WSRowObject> | The selected objects of this type in the network, will be empty if there are none of this type selected. |
run_sql
#run_sql(table, query) ⇒ void
EXCHANGE
, UI
Runs a SQL query on this network.
The SQL query can include multiple clauses, including saving results to a file, but cannot use any of the options that open results or prompt grids.
Parameters
Name | Type(s) | Description |
---|---|---|
table | String | The table name, _nodes or _links are equivalent to 'all nodes' and 'all links' in sql. |
query | String | The sql query. |
run_inference
#run_inference(inference, ground_model, mode, zone, error_file) ⇒ void
EXCHANGE
, UI
Runs the inference object on this network, which must be a collection asset network or a distribution asset network.
The supported modes are:
- nil, false or the string
Network
- run the inference on the whole network - true or the string
Selection
- run the inference on the current selection (which, of course, must be set up within the script) - the string
Zone
- run the inference for the zone specified in the following parameter. - The string
Category
- run the inference for zones with the zone specified in the following parameter.
The ground model parameter must be nil when this method is used from the UI. If there is a ground model loaded into the network (either TIN or grid), it will be used instead.
Parameters
Name | Type(s) | Description |
---|---|---|
inference | Integer, String, WSModelObject | The inference object - can be the id, scripting path, or a wsmodelobject of the correct type. |
ground_model | Integer, String, WSModelObject, nil | Optional ground model to use (exchange only) - can be the id (grid ground model only), scripting path, or a wsmodelobject of the correct type. |
mode | String, Boolean, nil | See method description. |
zone | String, nil | If the mode parameter is zone or category , this string should be the name of the zone or zone category. |
error_file | String, nil | Path to an error file. |
run_stored_query_object
#run_stored_query_object(stored_query) ⇒ void
EXCHANGE
, UI
Runs a stored query on this network.
Parameters
Name | Type(s) | Description |
---|---|---|
stored_query | Integer, String, WSModelObject | The stored query object - can be the id, scripting path, or a wsmodelobject of the correct type. |
save_selection
#save_selection(selection_list) ⇒ void
EXCHANGE
, UI
Saves the current selection (in the current scenario) to an already existing selection list model object.
Parameters
Name | Type(s) | Description |
---|---|---|
selection_list | Integer, String, WSModelObject | The selection list object - can be the id, scripting path, or a wsmodelobject of the correct type. |
scenarios
#scenarios { |s| ... } ⇒ String
EXCHANGE
, UI
Iterates through the scenarios, yielding a String of each scenario name. The base scenario is included as the string Base
in English.
network.scenarios { |scenario| puts scenario }
network.scenarios do |scenario|
puts scenario
end
Parameters
Name | Type(s) | Description |
---|---|---|
Return | String |
search_at_point
#search_at_point(x, y, distance, types) ⇒ Array<WSRowObject>
EXCHANGE
, UI
Find all objects within a distance of a given point.
When using an array of strings as the type
, all values must be unique and cannot contain a category and a table within that category. This is similar to the WSRowObject.objects_in_polygon
method.
Parameters
Name | Type(s) | Description |
---|---|---|
x | Numeric | X coordinate. |
y | Numeric | Y coordinate. |
distance | Numeric | Search radius around point. |
type | String, Array<String>. nil | The name of a table or category, an array of names, or nil to search all tables. |
Return | Array<WSRowObject> |
selection_size
#selection_size ⇒ Integer
EXCHANGE
, UI
Returns the number of objects currently selected.
Parameters
Name | Type(s) | Description |
---|---|---|
Return | Integer |
set_projection_string
#set_projection_string(string) ⇒ void
EXCHANGE
Sets the map projection string. The format of the string depends on the current map control.
Compatible projection strings or MapXTreme can be found in C:\Program Files\Common Files\MapInfo\MapXtreme\VERSION\MapInfoCoordinateSystemSet.xml
, where VERSION will depend on the current application version.
E.g. for British National Grid [EPSG 27700]:
<gml:srsID>
<gml:name gml:codeSpace="mapinfo">coordsys 8,79,7,-2,49,0.9996012717,400000,-100000</gml:name>
</gml:srsID>
The projection string is: 8,79,7,-2,49,0.9996012717,400000,-100000
.
Parameters
Name | Type(s) | Description |
---|---|---|
string | String |
snapshot_export
#snapshot_export(file) ⇒ void
EXCHANGE
, UI
Exports a snapshot of the network to the given file. All objects are exported from all tables, but image files and GeoPlan properties and themes are not exported.
Snapshots cannot be exported from networks with uncommitted changes.
Parameters
Name | Type(s) | Description |
---|---|---|
file | String | Path to the file. |
snapshot_export_ex
#snapshot_export_ex(file, options) ⇒ void
EXCHANGE
, UI
Exports a snapshot of the network to the given file. If no options hash is provided, all objects are exported from all tables, but image files and GeoPlan properties and themes are not exported.
Snapshots cannot be exported from networks with uncommitted changes.
The options hash contains the following keys:
Name | Type | Description |
---|---|---|
SelectedOnly | Boolean | If present and true, only the currently selected objects are exported, otherwise by default all objects of the appropriate tables are exported. |
IncludeImageFiles | Boolean | If present and true, includes the data for image files in the network, otherwise by default images are not exported. |
IncludeGeoPlanPropertiesAndThemes | Boolean | If present and true, includes the data for GeoPlan properties and themes, otherwise by default they are not exported. |
ChangesFromVersion | Integer | If present, the snapshot will be of the different from the network's version with this commit ID, otherwise by default the current version of the network will be exported. |
Tables | Array<String> | If present, a list of the internal table names (as returned by the table_names method of this class) If not present then all tables will be exported. |
The SelectedOnlyOptions must not be mixed with the Tables option or the ChangesFromVersion option.
Parameters
Name | Type(s) | Description |
---|---|---|
file | String | Path to the file. |
options | Hash | See method description. |
snapshot_import_ex
#snapshot_import_ex(file, options) ⇒ void
EXCHANGE
, UI
Imports a snapshot file into the network from a file, with the provided options.
The options hash contains the following keys:
Name | Type | Description |
---|---|---|
Tables | Array<String> | A list of network table names to import. If this key is not provided then all tables will be imported. |
AllowDeletes | Boolean | |
ImportGeoPlanPropertiesAndThemes | Boolean | |
UpdateExistingObjectsFoundByID | Boolean | |
UpdateExistingObjectsFoundByUID | Boolean | |
ImportImageFiles | Boolean |
Parameters
Name | Type(s) | Description |
---|---|---|
file | String | Path to the file. |
options | Hash | See method description. |
snapshot_scan
#snapshot_scan(file) ⇒ Hash<String, Any>
EXCHANGE
, UI
Scans a snapshot file and returns a hash containing the following details:
- NetworkGUID (String) the GUID of the network from which the snapshot was exported.
- CommitGUID (String) the GUID of the commit of the network from which the snapshot was exported.
- CommitID (Integer) the ID of the commit of the network from which the snapshot was exported.
- NetworkTypeCode (String) the type of network from which the snapshot was exported. This matches the name of the network type e.g. 'Collection Network'
- DatabaseGUID (String) the GUID associated with the database version from which the snapshot was exported.
- DatabaseSubVersion (Integer) the 'subversion' associated with the database version from which the snapshot was exported.
- UnknownTableCount (Integer) the number of tables in the snapshot not recognised by the software, this will only be greater than 0 if the snapshot were exported from a more recent version of the software.
- FileCount (Integer) the number of image files contained within the snapshot.
- ContainsGeoPlanPropertiesAndThemes - Boolean - true if the snapshot was exported with the option to included GeoPlan properties and themes.
- Tables (Hash) a hash containing information about the tables exported:
- ObjectCount (Integer) the number of objects in the snapshot for the table.
- ObjectsWithOldVersionsCount (Integer)
- ObjectsFoundByUID (Integer)
- ObjectsFoundByID (Integer)
- DeleteRecordsCount (Integer)
- UnknownFieldCount (Integer) the number of unknown fields for the table, this will be zero unless the export is from a more recent version of the software than the user is using to import the data.
Parameters
Name | Type(s) | Description |
---|---|---|
file | String | Path to the snapshot file. |
Return | Hash<String, Any> |
table
#table(name) ⇒ WSTableInfo
EXCHANGE
, UI
Returns a WSTableInfo
object for a specific table in this network.
Parameters
Name | Type(s) | Description |
---|---|---|
name | String | Name of the table. |
Return | WSTableInfo |
table_names
#table_names ⇒ Array<String>
EXCHANGE
, UI
Returns the names of all tables in this network.
Parameters
Name | Type(s) | Description |
---|---|---|
Return | Array<String> |
tables
#tables ⇒ Array<WSTableInfo>
EXCHANGE
, UI
Returns an array of WSTableInfo objects for the tables in this network.
Parameters
Name | Type(s) | Description |
---|---|---|
Return | Array<WSTableInfo> |
timestep_count
#timestep_count ⇒ Integer
EXCHANGE
, UI
Returns the number of result timesteps, not including the maximum timestep.
Parameters
Name | Type(s) | Description |
---|---|---|
Return | Integer |
timestep_time
#timestep_time(timestep_no) ⇒ DateTime
EXCHANGE
, UI
Returns the actual time of the timestep index provided.
Parameters
Name | Type(s) | Description |
---|---|---|
timestep_no | Integer | |
Return | DateTime |
transaction_begin
#transaction_begin ⇒ void
EXCHANGE
, UI
Begins a transaction, during which you can modify network data such as adding/removing objects or changing fields. Most changes to a network must be within a transaction.
A transaction can be ended with #transaction_commit
(to save the changes) or #transaction_rollback
(to abandon them).
transaction_commit
#transaction_commit ⇒ void
EXCHANGE
, UI
Commits any changes to the network since #transaction_begin
.
transaction_rollback
#transaction_rollback ⇒ void
EXCHANGE
, UI
Rolls back (ends) the transaction, which reverts any changes made since #transaction_begin
.
This should be used with caution if you are storing references to WSRowObjects or associated data, as this may break references and cause an exception when you attempt to access or work with them.
update_cctv_scores
#update_cctv_scores ⇒ void
EXCHANGE
, UI
Calculates CCTV scores for all surveys in the network using the current standard.
xprafts_import
#xprafts_import(file, use_large_size, split_on_lag_links, combine_subcatchments, log) ⇒ void
EXCHANGE
Updates the network from an XPRAFTS .xpx
file.
model_group.xprafts_import('C:/temp/1.xpx', true, false, true, 'C:/temp/log.txt')
Parameters
Name | Type(s) | Description |
---|---|---|
file | String | The absolute path to the xprafts model, including extension (.xpx ). |
use_large_size | Boolean | If the xprafts model is configured to use the large unit size. |
split_on_lag_links | Boolean | If true networks are split downstream of channel links and maintain lag link data, if false network connectivity is maintained by converting downstream lag links to channel links. |
combine_subcatchments | Boolean | If true combine the 1st and 2nd subcatchment as a single subcatchment polygon. this would set the per-surface rafts b option and setting the rafts adapt factor and manning's roughness at the runoff surface level. |
log | String | Path to save the import log including extension (.txt ). |