如何更改图标标记Gmap Primefaces? [英] How change icon Marker Gmap Primefaces?
问题描述
Hello社区我从Gmap Primefaces组件开始,想知道如何更改图标。
我已经依靠Primefaces的展示:
Hello community I'm starting with Gmap Primefaces component, and want to know how to change the icons. I have relied on the showcase of Primefaces:
this.advancedModel.addOverlay(new Marker(coord1, "Konyaalti", "konyaalti.png", "http://maps.google.com/mapfiles/ms/micons/blue-dot.png"));
this.advancedModel.addOverlay(new Marker(coord2, "Ataturk Parki", "ataturkparki.png"));
this.advancedModel.addOverlay(new Marker(coord4, "Kaleici", "kaleici.png", "http://maps.google.com/mapfiles/ms/micons/pink-dot.png"));
this.advancedModel.addOverlay(new Marker(coord3, "Karaalioglu Parki", "karaalioglu.png", "http://maps.google.com/mapfiles/ms/micons/yellow-dot.png"));
我已将图标下载到我的项目中,并且已路由,但无法正常工作标记图标是样本。
I've downloaded the icons to my project, and I've routed, but just does not work and marker icons are samples.
StringBuilder ruta = new StringBuilder();
ruta.append(getContext().getRealPath(Constantes.DIVISOR));
ruta.append("resources/maps/images/");
StringBuilder bluedot = new StringBuilder();
bluedot.append(ruta);
bluedot.append("blue-dot");
bluedot.append(Constantes.EXTENSION_FORMATO_PNG);
StringBuilder pinkdot = new StringBuilder();
pinkdot.append(ruta);
pinkdot.append("pink-dot");
pinkdot.append(Constantes.EXTENSION_FORMATO_PNG);
StringBuilder yellowdot = new StringBuilder();
yellowdot.append(ruta);
yellowdot.append("yellow-dot");
yellowdot.append(Constantes.EXTENSION_FORMATO_PNG);
System.out.println("---> "+bluedot.toString());
//Icons and Data
this.advancedModel.addOverlay(new Marker(coord1, "Konyaalti", "konyaalti.png", bluedot.toString()));
this.advancedModel.addOverlay(new Marker(coord2, "Ataturk Parki", "ataturkparki.png"));
this.advancedModel.addOverlay(new Marker(coord4, "Kaleici", "kaleici.png", pinkdot.toString()));
this.advancedModel.addOverlay(new Marker(coord3, "Karaalioglu Parki", "karaalioglu.png", yellowdot.toString()));
尽管图像文件路径不错,但仍然不考虑标记PrimeFaces,它应该是
Being well the image file path, but still does not consider the Marker PrimeFaces, to which it should be ???
Console:
D:\springsource\apache tomcat 7.0.53\webapps\geotermica\resources\maps\images\blue-dot.png
推荐答案
如果要指向文件系统上的文件,应该使用 file://
方案。请参阅:如何指定本地文件在html中使用file:scheme?
If you want to point to a file on your file system you should use the file://
scheme. See: How to specify a local file within html using the file: scheme?
如果你想创建一个相对URL来从你的web服务器获取图像,你应该使用上下文路径而不是真实路径:
If you want to create a relative URL to fetch the image from your webserver you should use the context path instead of the real path:
StringBuilder ruta = new StringBuilder();
ruta.append(FacesContext.getCurrentInstance().getExternalContext().getRequestContextPath());
ruta.append("/resources/maps/images/");
这篇关于如何更改图标标记Gmap Primefaces?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!