maps

Good way to clear nested Maps in Java

末鹿安然 提交于 2019-12-06 07:19:05
public class MyCache { AbstractMap<String, AbstractMap<String, Element>> cache = new TreeMap<String, AbstractMap<String, Element>>(); public Boolean putElement(String targetNamespace, Element element) { ... } public void clear() { cache.clear(); } // is it better this way? public void deepClear() { for(AbstractMap<String, Element> innerMap : cache.values()) { innerMap.clear(); } cache.clear(); } } Is it necessary to iterate over the values of the root map and clear all the maps nested in the root first, or is it enough to clear the outermost map? My main question is, if there is any difference

Crispy edges with topojson?

為{幸葍}努か 提交于 2019-12-06 06:06:22
Mike Bostock shared a range of world wide topojson files. As I wanted more data and higher quality, I now generate my own high quality topojson files from Natural Earth. To make it simple, my makefile / command is such: admin_0: crop ../node_modules/topojson/bin/topojson \ --id-property name \ -p name=name \ -q 1e4 \ --filter=small \ -o admin_0.topo.json \ -- admin_0=./natural_earth_vector/10m_cultural/ne_10m_admin_0_countries.shp But my 3MB .topojson is crispy, nasty, graphically messy. Take a look at the coastline, you will see the most annoying thing : lines looking like "stairs" :

Lighting maps_练习二

穿精又带淫゛_ 提交于 2019-12-06 05:39:40
添加一个叫做放射光贴图(Emission Map)的东西,它是一个储存了每个片段的发光值(Emission Value)的贴图。发光值是一个包含(假设)光源的物体发光(Emit)时可能显现的颜色,这样的话物体就能够忽略光照条件进行发光(Glow)。游戏中某个物体在发光的时候,你通常看到的就是放射光贴图(比如 机器人的眼,或是箱子上的灯带)。将这个纹理(作者为 creativesam)作为放射光贴图添加到箱子上,产生这些字母都在发光的效果 片段着色器代码: 1 #version 330 core 2 struct Material { 3 sampler2D diffuse; 4 sampler2D specular; 5 sampler2D emission; 6 float shininess; 7 }; 8 9 struct Light { 10 vec3 position; 11 12 vec3 ambient; 13 vec3 diffuse; 14 vec3 specular; 15 }; 16 17 in vec2 TexCoords; 18 in vec3 Normal; 19 in vec3 FragPos; 20 out vec4 FragColor; 21 22 uniform Material material; 23 uniform Light light;

Draw grid over polygon in Google map V2

眉间皱痕 提交于 2019-12-06 05:34:47
问题 I have made one polygon over Google map v2 and now on that polygon I want to add one grid as shown in Reference Image and that grid should have to re-sizable and portions of grid should be selectable. I don't have any idea about this so please help on this. I am trying this so far but still don't have any result. All your help is appreciated. Reference Image: 回答1: Not sure about Google Maps, but with osmdroid you should use osmbonuspack and implement a custom Polygon: public class GridPolygon

Lighting maps_练习一

强颜欢笑 提交于 2019-12-06 05:12:07
尝试在片段着色器中反转镜面光贴图的颜色值,让木头显示镜面高光而钢制边缘不反光(由于钢制边缘中有一些裂缝,边缘仍会显示一些镜面高光,虽然强度会小很多) 1 #version 330 core 2 out vec4 FragColor; 3 4 struct Material { 5 sampler2D diffuse; 6 sampler2D specular; 7 float shininess; 8 }; 9 10 struct Light { 11 vec3 position; 12 13 vec3 ambient; 14 vec3 diffuse; 15 vec3 specular; 16 }; 17 18 in vec3 FragPos; 19 in vec3 Normal; 20 in vec2 TexCoords; 21 22 uniform vec3 viewPos; 23 uniform Material material; 24 uniform Light light; 25 26 void main() 27 { 28 // ambient 29 vec3 ambient = light.ambient * vec3(texture(material.diffuse, TexCoords)); 30 31 // diffuse 32 vec3 norm =

Google Maps Places Autocomplete - Uncaught TypeError: Cannot read property 'getPlace' of undefined

北城余情 提交于 2019-12-06 04:48:05
setAutocomplete() { this.originPlaceId = null; this.destinationPlaceId = null; this.travelMode = google.maps.TravelMode.WALKING; this.directionsDisplay.setMap(this.map); this.setMapControls(this.map); this.setupClickListener('changemode-walking', google.maps.TravelMode.WALKING); this.setupClickListener('changemode-transit', google.maps.TravelMode.TRANSIT); this.setupClickListener('changemode-driving', google.maps.TravelMode.DRIVING); console.log(this.originInput); this.originAutocomplete = new google.maps.places.Autocomplete(this.originInput); this.originAutocomplete.bindTo('bounds', this.map)

How to use BOOST_FOREACH with two std::maps?

白昼怎懂夜的黑 提交于 2019-12-06 04:24:14
I have code that looks essentially like this: std::map<int, int> map1, map2; BOOST_FOREACH(int i, map1) { // do steps 1-5 here... } BOOST_FOREACH(int i, map2) { // do steps 1-5 (identical to above) here... } Is there any way to concatenate the maps to eliminate the duplicate code in the second loop? Or a way to extend BOOST_FOREACH to iterate over two different maps in one go? Obviously I don't want to increase the time complexity of the program (otherwise I could just create a new map and insert into it map1 and map2). I have a feeling I am missing something rudimentary here. You could define

Format the ggplot2 map

余生长醉 提交于 2019-12-06 04:03:26
问题 I´m trying to produce a worldmap using ggplot2 in R. I want to show GDP per capita from Brazilian States. There are 2 problems: In the center of Country have two labels aren't easy to read the information. They are overlapping.Reducing the numbers not resolved. I would like to change the colour breaks and don't know how to access it. I would like to use colors to become easy to note the diferences of GDP. My data is: https://docs.google.com/file/d/0B_coFit6AovfcEFkbHBjZEJaQ1E/edit Here is my

How to overlay a circle on an iOS map

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-06 03:49:22
问题 I've got a radius and a location. This is how I'm trying to get the bounding rectangle of the circle. - (MKMapRect)boundingMapRect{ CLLocationCoordinate2D tmp; MKCoordinateSpan radiusSpan = MKCoordinateRegionMakeWithDistance(self.coordinate, 0, self.radius).span; tmp.latitude = self.coordinate.latitude - radiusSpan.longitudeDelta; tmp.longitude = self.coordinate.longitude - radiusSpanSpan.longitudeDelta; MKMapPoint upperLeft = MKMapPointForCoordinate(tmp); MKMapRect bounds = MKMapRectMake

Add download offline map in Android with Here maps

北慕城南 提交于 2019-12-06 03:41:10
I have already developed an Android Here map which has a simple map view but I need to add offline support to the app, how can I add it to my app in order to let the user download a specific country or area? Note that I implemented my app using the tutorial in the link below: https://developer.here.com/mobile-sdks/documentation/android-hybrid-plus/topics/maps.html See the Offline Maps section of the mobile sdk documentation. In particular, you might want to use the following methods of the MapLoader class: installMapPackages(List<Integer> packageIdList) - To download and install new country or