简体   繁体   English

如何使用route-me创建透明层

[英]How to create transparent layer with route-me

Im struggling with something which I can't get my head arround 我正在努力解决一些我无法解决的问题

I have a tile source with transparent tiles that I want to add on top of a base map (open streetmap) but it's not working as it should 我有一个带有透明图块的图块源,我想在底图(开放式街道图)上添加透明图块,但它无法正常工作

// setup a base map
baseMapView = [[RMMapView alloc]initWithFrame: CGRectMake(0, 0, self.view.frame.size.width - self.view.frame.origin.x, self.view.frame.size.height - self.view.frame.origin.y) ];
[baseMapView setBackgroundColor:[UIColor blackColor]];
[baseMapView setDelegate:self];
[baseMapView setDeceleration:YES];
[[baseMapView contents] setTileSource:[[[RMOpenStreetMapSource alloc] init] autorelease]];
[self.view addSubview: baseMapView];

// markings in transparent png
markerMapView = [[RMMapView alloc]initWithFrame: CGRectMake(0, 0, self.view.frame.size.width - self.view.frame.origin.x, self.view.frame.size.height - self.view.frame.origin.y) ];
[markerMapView setBackgroundColor:[UIColor redColor]];
[markerMapView setAlpha: 0.5];
[markerMapView setOpaque:NO];
[markerMapView setDelegate:self];
[markerMapView setDeceleration:YES];
LLOpenSeaMapSource *tileSource = [[LLOpenSeaMapSource alloc] init];
tileSource.baseURL = @"http://tiles.luky.nl/mark";
[[markerMapView contents] setTileSource: tileSource]; 
[self.view addSubview: markerMapView];

The images are transparent png tiles. 图像是透明的png图块。 The result is however not as I expected: 但是结果却不是我所期望的:

las作为叠加不是很有用 Note that the snippet I posted is after some hair pulling, I started by setting the background to clearColor and not red, but as you can see it is gray anyway :-( 请注意,我发布的代码段是在拔头发后开始的,我首先将背景设置为clearColor而不是红色,但是无论如何您都可以看到它是灰色的:-(

Looks like you're using the straight route-me/route-me branch. 好像您使用的是route-me / route-me分支一样。 AFAIK, the current project isn't set up for multiple map sources. AFAIK,当前项目未针对多个地图源设置。 You might want to check out the route-me/alpstein fork or the mapbox fork , they both support multiple tile sources. 您可能想查看route-me / alpstein分支或mapbox分支 ,它们都支持多个图块源。 Because of the work that mapbox is doing, they are getting updates and features added much more frequently. 由于mapbox正在做的工作,他们越来越频繁地更新和添加功能。 IT IS NOT A PLUG AND PLAY SUBSTITUTION FROM route-me/route-me to either of these branches. 从route-me / route-me到这两个分支中的任何一个,都不是即插即用的替代品。

BTW, do you really need a new tile source, or could you do what you're doing with RMMarkers? 顺便说一句,您是否真的需要一个新的图块源,或者您可以使用RMMarkers做您正在做的事情?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM