How to work with the snap environment
How to work with the snap environment |
In this topic
Working with the snap environment
[C#]
publicvoid SnapEnvirSettings(IEngineEditor editor)
{
//Get the snap environment from the editor.
IEngineSnapEnvironment snapEnvironment = editor as IEngineSnapEnvironment; //Ensure there is a snap agent turned on in the snap environment.if (snapEnvironment.SnapAgentCount == 0)
{
System.Windows.Forms.MessageBox.Show(
"You need to turn on at least one snapping agent!!!");
return ;
} //Code to display the snap tolerance in a message box. double tolerance = snapEnvironment.SnapTolerance;
System.Windows.Forms.MessageBox.Show(Convert.ToString(tolerance)); //Set the snap tolerance.
snapEnvironment.SnapToleranceUnits =
esriEngineSnapToleranceUnits.esriEngineSnapToleranceMapUnits;
snapEnvironment.SnapTolerance = 15; //Turn on snap tips.
((IEngineEditProperties2)editor).SnapTips = true;
}
[VB.NET]
PublicSub SnapEnvirSettings(ByVal editor As IEngineEditor)
'Get the snap environment from the editor.Dim snapEnvironment As IEngineSnapEnvironment = editor As IEngineSnapEnvironment 'Ensure there is a snap agent turned on in the snap environment.If snapEnvironment.SnapAgentCount = 0 Then
System.Windows.Forms.MessageBox.Show("You need to turn on at least one snapping agent!!!")
ReturnEndIf'Code to display the snap tolerance in a message box.Dim tolerance AsDouble = snapEnvironment.SnapTolerance
System.Windows.Forms.MessageBox.Show(Convert.ToString(tolerance)) 'Set the snap tolerance.
snapEnvironment.SnapToleranceUnits = esriEngineSnapToleranceUnits.esriEngineSnapToleranceMapUnits
snapEnvironment.SnapTolerance = 15 'Turn on snap tips.
((IEngineEditProperties2)editor).SnapTips = TrueEndSub
[C#]
privatebool CheckIsAnySnapAgentSelected(IEngineSnapEnvironment snapEnvironment)
{
int snapAgentCount = snapEnvironment.SnapAgentCount;
int checkedFeatureSnapAgentCount = 0;
int featureSnapAgentCount = 0; //Loop through all registered snap agents in the snap environment. Count feature snap agents,//checked feature snap agents, and nonfeature snap agents.for (int i = 0; i < snapAgentCount; i++)
{
IEngineSnapAgent currentSnapAgent = snapEnvironment.get_SnapAgent(i);
if (currentSnapAgent is IEngineFeatureSnapAgent)
{
IEngineFeatureSnapAgent featureSnapAgent = currentSnapAgent as
IEngineFeatureSnapAgent;
featureSnapAgentCount++; //Determine if the feature snap agent is checked.if (featureSnapAgent.HitType !=
esriGeometryHitPartType.esriGeometryPartNone)
{
checkedFeatureSnapAgentCount++;
}
}
}
if (checkedFeatureSnapAgentCount > 0 || snapAgentCount > featureSnapAgentCount)
{
returntrue;
}
else
{
returnfalse;
}
}
[VB.NET]
PrivateFunction CheckIsAnySnapAgentSelected(ByVal snapEnvironment As IEngineSnapEnvironment) AsBooleanDim snapAgentCount AsInteger = snapEnvironment.SnapAgentCount
Dim checkedFeatureSnapAgentCount AsInteger = 0
Dim featureSnapAgentCount AsInteger = 0 'Loop through all registered snap agents in the snap environment. Count feature snap agents,'checked feature snap agents, and nonfeature snap agents.Dim i AsIntegerFor i = 0 To snapAgentCount - 1 Step i + 1
Dim currentSnapAgent As IEngineSnapAgent = snapEnvironment.get_SnapAgent(i)
IfTypeOf currentSnapAgent Is IEngineFeatureSnapAgent ThenDim featureSnapAgent As IEngineFeatureSnapAgent = currentSnapAgent As IEngineFeatureSnapAgent
featureSnapAgentCount = featureSnapAgentCount + 1 'Determine if the feature snap agent is checked.If featureSnapAgent.HitType <> esriGeomeTryHitPartType.esriGeomeTryPartNone Then
checkedFeatureSnapAgentCount = checkedFeatureSnapAgentCount + 1
EndIfEndIfNextIf checkedFeatureSnapAgentCount > 0 Or snapAgentCount > featureSnapAgentCount ThenReturnTrueElseReturnFalseEndIfEndFunction
Snap agents
[C#]
publicvoid AddNewSnapAgent()
{
IEngineEditor editor = new EngineEditorClass();
IEngineEditLayers editLayers = editor as IEngineEditLayers;
IEngineSnapEnvironment snapEnvironment = editor as IEngineSnapEnvironment; //Check that the user is editing; otherwise, there will be no snap agent loaded.if (editLayers.TargetLayer == null)
{
System.Windows.Forms.MessageBox.Show("Please start an edit session");
return ;
} //Clear all existing snap agents.
snapEnvironment.ClearSnapAgents(); //Create a feature snap agent.
IEngineFeatureSnapAgent featureSnapAgent = new EngineFeatureSnap();
IFeatureClass layerFeatureClass = editLayers.TargetLayer.FeatureClass;
featureSnapAgent.FeatureClass = layerFeatureClass;
featureSnapAgent.HitType = esriGeometryHitPartType.esriGeometryPartBoundary; //Activate only the snap agent for the target layer.
snapEnvironment.AddSnapAgent(featureSnapAgent);
}
[VB.NET]
PublicSub AddNewSnapAgent()
Dim editor As IEngineEditor = New EngineEditorClass()
Dim editLayers As IEngineEditLayers = editor As IEngineEditLayers
Dim snapEnvironment As IEngineSnapEnvironment = editor As IEngineSnapEnvironment 'Check that the user is editing; otherwise, there will be no snap agent loaded.If editLayers.TargetLayer IsNothingThen
System.Windows.Forms.MessageBox.Show("Please start an edit session")
ReturnEndIf'Clear all existing snap agents.
snapEnvironment.ClearSnapAgents() 'Create a feature snap agent.Dim featureSnapAgent As IEngineFeatureSnapAgent = New EngineFeatureSnap()
Dim layerFeatureClass As IFeatureClass = editLayers.TargetLayer.FeatureClass
featureSnapAgent.FeatureClass = layerFeatureClass
featureSnapAgent.HitType = esriGeomeTryHitPartType.esriGeomeTryPartBoundary 'Activate only the snap agent for the target layer.
snapEnvironment.AddSnapAgent(featureSnapAgent)
EndSub
Snapping in z-dimension
Snap point method
See Also:
How to work with the snap environment的更多相关文章
- Ieditor
Interfaces Description IActiveViewEvents (esriCarto) Provides access to events that occur when the s ...
- arcgis arcengine Using environment settings
In this topic About using environment settings Environment settings summary table About using enviro ...
- 重新想象 Windows 8 Store Apps (56) - 系统 UI: Scale, Snap, Orientation, High Contrast 等
[源码下载] 重新想象 Windows 8 Store Apps (56) - 系统 UI: Scale, Snap, Orientation, High Contrast 等 作者:webabcd ...
- 关于Ubuntu中snap安装软件太慢解决办法
两种方法,一是下载好包手动安装,二设置snap的代理. 下载安装包方式 到 https://uappexplorer.com/snaps 搜索需要的 snap 包,然后下载 下载的时候选择对应的平台. ...
- deepin20使用snap并设置代理
snap下载 $ sudo apt update $ sudo apt install snapd https://snapcraft.io/docs/installing-snap-on-ubunt ...
- OpenCloudOS使用snap安装.NET 6
开源操作系统社区 OpenCloudOS 由腾讯与合作伙伴共同倡议发起,是完全中立.全面开放.安全稳定.高性能的操作系统及生态.OpenCloudOS 沉淀了多家厂商在软件和开源生态的优势,继承了腾讯 ...
- IEEE 802.11p (WAVE,Wireless Access in the Vehicular Environment)
IEEE 802.11p(又称WAVE,Wireless Access in the Vehicular Environment)是一个由IEEE 802.11标准扩充的通讯协定.这个通讯协定主要用在 ...
- 修改/etc/profile和/etc/environment导致图形界面无法登陆的问题
在使用ubuntu开发时,往往要修改PATH变量,有时会通过修改/etc/profile和/etc/environment来修改默认的PATH变量,但是一旦出错,很容易造成无法登陆进入图形界面的问题. ...
- System.Environment.CurrentDirectory和Application.StartupPath
System.Environment.CurrentDirectory的含义是获取或设置当前工作路径,而Application.StartupPath是获取程序启动路径,表面上看二者没什么区别,但实际 ...
随机推荐
- Understanding Undefined Behavior
"undefined behavior: behavior for which this International Standard imposes no requirements.&qu ...
- 【learning】微信跳一跳辅助c++详解 轻松上万 【下】
如果你还没有看完本blog的上篇,建议您先看完上篇!! 第一代辅助如何死的? 我们先来看四张图 如上方最左图所示,前面是一个小圆柱子,看起来很人畜无害似不似?? 由于上一步跳出了偏差,并没有 ...
- 转MVC3介绍
第一节:Asp.Net MVC3项目介绍 让我们先看一下,一个普通的Asp.Net MVC3项目的样例,如下图所示 跟WebFrom还是有区别的,如果你已经了解Asp.Net MVC2的话,那就感觉异 ...
- javascript数据结构与算法--基本排序算法(冒泡、选择、排序)及效率比较
javascript数据结构与算法--基本排序算法(冒泡.选择.排序)及效率比较 一.数组测试平台. javascript数据结构与算法--基本排序(封装基本数组的操作),封装常规数组操作的函数,比如 ...
- Shell之expect的测试
测试:./sshLogin.sh Slave1 caipeichao 1qaz@WSX hadoop lk198981 HadoopCluster #!/usr/bin/expect -f #auto ...
- Win下Eclipse提交Hadoop程序出错:org.apache.hadoop.security.AccessControlException: Permission denied: user=D
描述:在Windows下使用Eclipse进行Hadoop的程序编写,然后Run on hadoop 后,出现如下错误: 11/10/28 16:05:53 INFO mapred.JobClient ...
- linux一键安装php环境
1.下载一键安装包: http://pan.baidu.com/s/1o6lWyeu 2.unzip -x sh.zip chmod -R 755 sh ./install.sh 等待半小时左右 3. ...
- echart 饼图数据为0不显示或者太小显示其他的解决办法
饼图数据为0或者太小显示如下,不美观 解决办法: 为0的去掉,小于0.005的累加起来 方法 function getsData(_rowData){ var rowData=JSON.parse(J ...
- Selenium Web自动化 原理
文章转自 白月黑羽教Python 原理 说到web应用自动化测试,第一选择就是 Selenium 框架. Selenium 是一个 Web 应用的自动化框架. 通过它,我们可以写出自动化程序像人一样( ...
- hexo上部署博客到Github失败
fatal: could not read Username for 'https://github.com': No error 今天在上传博客到搭建到 Github 的个人博客上的时候,已经使用 ...