-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathScaleThreSholds.cs
82 lines (67 loc) · 1.8 KB
/
ScaleThreSholds.cs
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
using System;
using System.Drawing;
using System.Runtime.InteropServices;
using ESRI.ArcGIS.ADF.BaseClasses;
using ESRI.ArcGIS.ADF.CATIDs;
using ESRI.ArcGIS.Controls;
using ESRI.ArcGIS.SystemUI;
using ESRI.ArcGIS.Carto;
namespace SpatialDataManagement
{
public class ScaleThreSholds : BaseCommand,ICommandSubType
{
private IMapControl3 m_mapControl;
private long m_subType;
public ScaleThreSholds()
{
}
public override void OnCreate(object hook)
{
if(hook is IMapControl3)
m_mapControl = (IMapControl3)hook;
}
public override void OnClick()
{
if (m_mapControl == null) return;
ILayer layer = (ILayer) m_mapControl.CustomProperty;
if (m_subType == 1) layer.MaximumScale = m_mapControl.MapScale;
if (m_subType == 2) layer.MinimumScale = m_mapControl.MapScale;
if (m_subType == 3)
{
layer.MaximumScale = 0;
layer.MinimumScale = 0;
}
m_mapControl.Refresh(esriViewDrawPhase.esriViewGeography,null,null);
}
public int GetCount()
{
return 3;
}
public void SetSubType(int SubType)
{
m_subType = SubType;
}
public override string Caption
{
get
{
if (m_subType == 1) return "Set Maximum Scale";
else if (m_subType == 2) return "Set Minimum Scale";
else return "Remove Scale Thresholds";
}
}
public override bool Enabled
{
get
{
bool enabled = true;
ILayer layer = (ILayer)m_mapControl.CustomProperty;
if (m_subType == 3)
{
if ((layer.MaximumScale == 0) & (layer.MinimumScale == 0)) enabled = false;
}
return enabled;
}
}
}
}