FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
MapWindow5/src/MW5.Tools/Helpers/InputHelper.cs at develop · MapWindow/MapWindow5 · GitHub
MapWindow
/
MapWindow5
Public
Notifications
You must be signed in to change notification settings
Fork
102
Star
308
Code
Issues
14
Pull requests
12
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
MapWindow5
/
src
/
MW5.Tools
/
Helpers
/
InputHelper.cs
Copy path
More file actions
More file actions
Latest commit
History
History
History
60 lines (57 loc) · 1.89 KB
Breadcrumbs
MapWindow5
/
src
/
MW5.Tools
/
Helpers
/
InputHelper.cs
Copy path
File metadata and controls
60 lines (57 loc) · 1.89 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
using
System
;
using
System
.
Collections
.
Generic
;
using
System
.
Linq
;
using
System
.
Text
;
using
System
.
Threading
.
Tasks
;
using
MW5
.
Shared
;
using
MW5
.
Shared
.
Log
;
using
MW5
.
Tools
.
Model
.
Layers
;
using
MW5
.
Tools
.
Model
.
Parameters
;
using
MW5
.
Tools
.
Model
.
Parameters
.
Layers
;
namespace
MW5
.
Tools
.
Helpers
{
/// <summary>
/// Extension method to work with input layer / datasource input parameters.
/// </summary>
internal
static
class
InputHelper
{
/// <summary>
/// Sets callback to the input datasource to provide IStopExecution implementation
/// for MapWinGIS methods.
/// </summary>
public
static
void
SetCallbackToInputs
(
this
IEnumerable
<
BaseParameter
>
parameters
,
IGlobalListener
callback
)
{
foreach
(
var
p
in
parameters
.
OfType
<
LayerParameterBase
>
(
)
)
{
var
ds
=
p
.
Datasource
;
if
(
ds
!=
null
)
{
ds
.
Callback
=
callback
;
}
}
}
/// <summary>
/// Closes the input datasources.
/// </summary>
public
static
void
CloseInputDatasources
(
this
IEnumerable
<
BaseParameter
>
parameters
)
{
foreach
(
var
p
in
parameters
.
OfType
<
LayerParameterBase
>
(
)
)
{
var
info
=
p
.
Value
as
IDatasourceInput
;
if
(
info
!=
null
)
{
p
.
ClosedPointer
=
info
.
Pointer
;
info
.
Close
(
)
;
}
}
}
/// <summary>
/// Returns true if both inputs hold the same datasource.
/// </summary>
public
static
bool
InputsAreEqual
(
IVectorInput
input1
,
IVectorInput
input2
)
{
return
input1
.
Datasource
==
input2
.
Datasource
||
(
input1
.
Filename
.
EqualsIgnoreCase
(
input2
.
Filename
)
&&
!
string
.
IsNullOrWhiteSpace
(
input1
.
Filename
)
)
;
}
}
}
Back
|
FazBrowse Home
|
New Git URL