You are currently reviewing an older revision of this page.
When using the WaterObjects.NET API to execute a "Find ____" or "PathToNearest ___" predefined drawing query (such as DrawingQuery.FindAdjacentStartNodes), how do you specify the selected element(s)? What are the parameters needed?
To select elements in WaterObjects.Net, use the IFeatureManager. This can be retrieved by casting the ApplicationModel to IMappingApplicationModel.
FeatureManager.SelectElements(IDominProject, SelectionSetItemCollection)
A SelectionSetItemCollection is a list of SelectionSetItem objects. Each SelectionSetItem contains the ElementTypeID and list of IDs of that type. When SelectElements is called, it will mark these elements as “selected” internally so that calls to ExecuteDrawingQuery will correctly see one or more elements selected.
This will require you to open the project (wtg) file, not the sqlite file directly as you will need an instance of the IProject (cast to IDomainProject in most cases).
The related predefined drawing queries are listed below with their respective query parameters:
Query Parameters:
Name
Value
Type
◢
queryParameters
{Haestad.Framework.Support.IQueryParameter[1]}
Haestad.Framework.Support.IQueryParameter[]
◢ [0]
{Haestad.Framework.Support.QueryParameter}
Haestad.Framework.Support.IQueryParameter {Haestad.Framework.Support.QueryParameter}
[Haestad.Framework.Support.QueryParameter]
Haestad.Framework.Support.QueryParameter
DefaultValue
-1
object {int}
DescriptionKey
"findConnectedParameterDescription"
string
Label
"Find Elements Connected To"
LabelKey
"findConnectedParameter"
TypeCategory
""
Unit
{None}
Haestad.Support.Units.Unit
1058
ValueType
{Name = "Int32" FullName = "System.Int32"}
System.Type {System.RuntimeType}
Supported ElementTypes
These are the ElementTypeIDs supported by the above query – equivalent to using (int)DomainElementType.[member]
availableElementTypeIds
{int[24]}
int[]
[0]
54
int
[1]
55
[2]
52
[3]
308
[4]
302
[5]
56
[6]
301
[7]
303
[8]
305
[9]
306
[10]
321
[11]
60
[12]
61
[13]
62
[14]
64
[15]
65
[16]
66
[17]
310
[18]
68
[19]
72
[20]
300
[21]
307
[22]
309
[23]
24
Query Parameters
"findDisconnectedParameterDescription"
"Find Elements Disconnected From"
"findDisconnectedParameter"
153
Supported ElementTypeIDs
{Haestad.Framework.Support.IQueryParameter[2]}
"pathToNearestElementStartParameterDescription"
"Start Element"
"pathToNearestElementStartParameter"
127
◢ [1]
2
"pathToNearestElementTypeParameterDescription"
"Element Type"
"pathToNearestElementTypeParameter"
The second parameter defined above can have the following values:
"pathToNearestUpstreamElementStartParameterDescription"
"pathToNearestUpstreamElementStartParameter"
"pathToNearestUpstreamElementTypeParameterDescription"
"pathToNearestUpstreamElementTypeParameter"
"pathToNearestDownstreamElementStartParameterDescription"
"pathToNearestDownstreamElementStartParameter"
128
"pathToNearestDownstreamElementTypeParameterDescription"
"pathToNearestDownstreamElementTypeParameter"
3
Waterobjects.NET - Extending the capabilities of your OpenFlows product
Related Forum Discussion