Label filtering
来源:互联网 发布:淘宝tm标 r标什么意思 编辑:程序博客网 时间:2024/04/29 18:28
Label filtering
Tags: General Topics
Tags: General Topics
dylanparry
Mar 2 2007 at 7:06 PM
Hi,
I have a label layer that I want to filter. Basically, I only want to label features if they appear within a specific polygon on the map. The polygon will be, for example, a county boundary and the labels are the names of towns within that county. I don't want to label the towns that are outside the county.
Is it possible to do this using the LabelLayer.LabelFilter property? If so, how would I go about doing this? I can't find any documentation for this property :(
Cheers,
Dylan
I have a label layer that I want to filter. Basically, I only want to label features if they appear within a specific polygon on the map. The polygon will be, for example, a county boundary and the labels are the names of towns within that county. I don't want to label the towns that are outside the county.
Is it possible to do this using the LabelLayer.LabelFilter property? If so, how would I go about doing this? I can't find any documentation for this property :(
Cheers,
Dylan
Goran
Mar 2 2007 at 8:14 PM
Hi!
I'd recomend looking into LabelLayer.Theme property and SharpMap.Rendering.Thematics.CustomTheme namespace. This alows you to setup a delegate (public delegate IStyle CustomTheme.GetStyleMethod(FeatureDataRow dr))); pointing to your filter method. There you can examine your FeatureDataRow and build a Style accordingly.
Goran
I'd recomend looking into LabelLayer.Theme property and SharpMap.Rendering.Thematics.CustomTheme namespace. This alows you to setup a delegate (public delegate IStyle CustomTheme.GetStyleMethod(FeatureDataRow dr))); pointing to your filter method. There you can examine your FeatureDataRow and build a Style accordingly.
Goran
dylanparry
Mar 2 2007 at 9:29 PM
Edited Mar 2 2007 at 9:31 PM
That's a good idea! I have used themes for other types of layers, such as colouring roads differently depending on their classification, but I didn't think to do it for this - where I would show or hide the label depending on its location.
Thanks. I'll see what I can come up with.
Thanks. I'll see what I can come up with.
dylanparry
Mar 2 2007 at 10:12 PM
Ok, I've been looking into this for the past 30 mins and I can't figure out how to check whether a point contained within SharpMap.Data.FeatureDataRow is contained within a polygon! I would have presumed that this would work:
where poly is the polygon, and row is the row passed to the method. Yet this appears to return false for all cases including the ones that I know are definitely within the polygon. Any ideas?
if (poly.Contains(row.Geometry)){ // Do something}
where poly is the polygon, and row is the row passed to the method. Yet this appears to return false for all cases including the ones that I know are definitely within the polygon. Any ideas?
codekaizen
Coordinator
Mar 4 2007 at 5:47 AM
I believe spatial containment isn't implemented until the NTS code is integrated.
dylanparry
Mar 6 2007 at 12:44 AM
Right. Is this something that still needs to be done, or is it merely a matter of compiling the latest source code? Or something else?
codekaizen
Coordinator
Mar 7 2007 at 4:21 AM
It's still being worked on - I don't believe the code has been committed yet. Volleyknaller can well correct me on this point, however.
dylanparry
Mar 7 2007 at 7:58 PM
Ah okay. This problem got me thinking, and I realised it was probably a better idea to do the filtering at the data level rather than when it comes to displaying it, so I decided to have a go at doing it using
- Label filtering
- label
- Label
- label
- Label
- label
- Label
- label
- label
- label
- Label
- label
- Filtering Documents
- Collision filtering
- Box Filtering
- Bilateral Filtering
- Bayesian Filtering
- Collaborative Filtering
- 网页播放视频解决代码
- 关于VC启动时产生MSDEV-应用程序错误的处理
- ajax初学笔记
- 国家级示范高等职业院校网址
- Detecting a click / displaying ToolTips
- Label filtering
- 扩展GridView控件(一)——鼠标经过行时改变行的样式
- windows核心编程9
- Javascript中Window.open参数详解
- 微软亚洲技术中心面试题
- Road Layer
- (webabcd)我们来写一个继承自GridView的控件
- Anders Hejlsberg
- 工资系统设计文档及工作流程