使用jQuery过滤Google地图(Filtering Google Maps with jQuery)
有没有办法用jQuery过滤谷歌地图的位置变量?
例如:
汽车 船 点击带有ID car的链接,过滤ID car的所有字符串。 点击身份证汽车会在地图上隐藏带有ID船的所有字符串,并在地图中仅显示带有ID汽车的字符串。
可能吗?
function initialize() { var locations = [ ['<strong>Firm 1</strong><br />1111 Country<br />Street<br /><br />', 47.6801806,8.7499505, 1, id car here?? ], ['<strong>Firm 2</strong><br />2222 Country<br />Street<br /><br />', 47.6801806,8.7499505, 2, id boat here?? ], ]; var map = new google.maps.Map(document.getElementById('map_canvas'), { zoom: 10, center: new google.maps.LatLng(47.603786, 9.055737), mapTypeId: google.maps.MapTypeId.ROADMAP }); var infowindow = new google.maps.InfoWindow(); var marker, i; for (i = 0; i < locations.length; i++) { marker = new google.maps.Marker({ position: new google.maps.LatLng(locations[i][1], locations[i][2]), map: map, icon: new google.maps.MarkerImage('/assets/templates/style/images/iconKarte.png') }); google.maps.event.addListener(marker, 'click', (function(marker, i) { return function() { infowindow.setContent(locations[i][0]); infowindow.open(map, marker); } })(marker, i)); } } </script> <div id="map_canvas" style="width:750px;height:500px;"></div>
Is there a way to filter Google Maps location variables with jQuery?
Ex:
Car Boat Clicking on the link with ID car, filters all strings with ID car. Clicking by the ID car hides all strings with ID boat on the Maps and show only strings with ID car in the Maps.
Is it possible?
function initialize() { var locations = [ ['<strong>Firm 1</strong><br />1111 Country<br />Street<br /><br />', 47.6801806,8.7499505, 1, id car here?? ], ['<strong>Firm 2</strong><br />2222 Country<br />Street<br /><br />', 47.6801806,8.7499505, 2, id boat here?? ], ]; var map = new google.maps.Map(document.getElementById('map_canvas'), { zoom: 10, center: new google.maps.LatLng(47.603786, 9.055737), mapTypeId: google.maps.MapTypeId.ROADMAP }); var infowindow = new google.maps.InfoWindow(); var marker, i; for (i = 0; i < locations.length; i++) { marker = new google.maps.Marker({ position: new google.maps.LatLng(locations[i][1], locations[i][2]), map: map, icon: new google.maps.MarkerImage('/assets/templates/style/images/iconKarte.png') }); google.maps.event.addListener(marker, 'click', (function(marker, i) { return function() { infowindow.setContent(locations[i][0]); infowindow.open(map, marker); } })(marker, i)); } } </script> <div id="map_canvas" style="width:750px;height:500px;"></div>
原文:https://stackoverflow.com/questions/14585719
最满意答案
我只想创建新的Java项目(File / New Project / Java), 从模板中选择Create project并选择Command line app 。 这将创建一个包含具有空main方法的类的项目,您可以通过按SHIFT + F10或使用SHIFT + F9进行调试来运行该方法。
整个过程只需20秒。
就目录结构的复杂性而言,你只需要关注一个目录--src /。 如果需要,可以将所有类保留在默认包中,因此所有代码都将位于src /中,而不包含任何子目录。
我不认为这比这更容易。
I would just create new Java project (File/New Project/Java), select Create project from template and choose Command line app. This creates a project containing a class with empty main method, which you can run by hitting SHIFT + F10 or debug using SHIFT + F9.
This whole process takes only like 20 seconds.
And as far as the directory structure complexity goes, you have just one directory that you need to be concerned about - src/. You can keep all your classes in the default package if you want and therefore all your code will be in src/ without any subdirectories for packages.
I don't think it gets any easier than this.
相关问答
更多-
创建和编辑运行/调试配置 Go into Edit Configuration: Main Class: akka.Main Program arguments: HelloWorld Then run.
-
下列中不属于面向对象的编程语言的是?[2022-05-30]
a -
我不确定是否右键单击Gradle任务并点击Debug是正确的解决方案(您可能在这里调试Gradle,而不是您的应用程序)。 最简单的解决方案是直接运行/调试com.test.creator.Main类(来自IntelliJ)。 PS:在IntelliJ 13(EAP)中,Gradle支持要好得多。 I'm not sure if right-clicking the Gradle task and hitting Debug is the right solution (you might be debug ...
-
我认为你是用IntelliJ中的调试选项启动的。 如果从常规运行按钮开始,则不应尝试连接到调试器。 编辑:然后尝试你的Android设备转到开发人员选项并在那里禁用调试。 EDIT2:杀死你电脑上的adb.exe进程? EDIT3:build - > clean ?? I think you are starting it with the debugging option in IntelliJ. If you start with the regular run button it shouldn't ...
-
我喜欢语法感知选择。 控制+ W. 当我被迫与其他IDE一起使用时,该键序列通常会导致文件关闭。 这是一个讨厌的负反馈回路。 I love syntax-aware selection. Control + W. When I'm forced to work with other IDEs, that key sequence usually causes files to close. It's a nasty negative feedback loop.
-
有几种方法可以实现这一目标。 如果你正在使用gradle,你可以按照这里的答案中的说明: gradle run ,或者如果你正在使用maven,你可以按照这里的答案: maven run 。 配置maven或gradle解决方案后,可以从与正在使用的构建工具关联的工具窗口中运行它,也可以使用同一窗口为运行任务分配键盘快捷方式。 这些解决方案很有用,因为它们为您构建了类路径。 如果您愿意以某种方式手动构建它(可能是当您要求IntelliJ为您运行该方法时从运行窗口复制它),那么您可以编写自己的shell脚本并 ...
-
我只想创建新的Java项目(File / New Project / Java), 从模板中选择Create project并选择Command line app 。 这将创建一个包含具有空main方法的类的项目,您可以通过按SHIFT + F10或使用SHIFT + F9进行调试来运行该方法。 整个过程只需20秒。 就目录结构的复杂性而言,你只需要关注一个目录--src /。 如果需要,可以将所有类保留在默认包中,因此所有代码都将位于src /中,而不包含任何子目录。 我不认为这比这更容易。 I woul ...
-
当您在Intellij中运行程序时,在运行窗口(底部面板)中,第一行是intellij terminal命令。 这条线通常缩短为这样: /Library/Java/JavaVirtualMachines/jdk1.8.0_31.jdk/Contents/Home/bin/java... 如果您点击它,它会向您显示Intellij运行的完整命令。 When you run a program in Intellij, in the run window (bottom panel) the very fir ...
-
IntelliJ如何在不编译它们的情况下运行.java文件?(how does IntelliJ run .java files without compiling them? [duplicate])[2023-05-19]
看到那个com.myorg.MyClass ? 这是编译的 Java类的名称。 它不是指一个java源代码文件! IntelliJ是一个IDE 。 它包含一个编译器(实际上,它可以使用javac编译器,或者即使在该类中发生错误后仍可继续编译类的“eclipse”编译器)。 它知道如何构建东西。 这是整个秘密。 换句话说:Java源文件实际上是编译的。 IDE不会告诉你这样做。 See that com.myorg.MyClass? That is the name of a compiled Java cl ... -
Lab6应该是一个对象,而不是一个类。 这将允许您将其作为主方法运行 Lab6 should be an object, not a class. This will allow you to run it as a main method