如何从 UWP 地图上的 MapIcon 中删除点和尾
How to remove dot and tail from MapIcon on UWP Map
有什么方法可以去掉MapIcons上的点和尾吗? (不使用地图子项)
提前致谢
找到答案了。
我必须修改 MapControl 本身的 MapStyleSheet,而不是 MapIcon。特别是样式表中的 userPoint > stemAnchorRadiusScale。
Below code will style your UWP map to look similar to Google Maps. You'll need to adjust below to suit your app.
string highwayColor = mode == MapController.MapMode.Satellite ? "\"strokeColor\": \"#B6F3D072\", \"fillColor\": \"#50FEF0AC\"" : "\"strokeColor\": \"#F3D072\", \"fillColor\": \"#FEF0AC\"";
string accessHighwayColor = mode == MapController.MapMode.Satellite ? "\"strokeColor\": \"#B6E3C072\", \"fillColor\": \"#50EEE0AC\"" : "\"strokeColor\": \"#E3C072\", \"fillColor\": \"#EEE0AC\"";
string jsonString = "{" +
"\"version\": \"1.*\"," +
"\"settings\": { \"landColor\": \"#ECEAE4\", \"fillColor\": \"#FFFFFF\" }," +
"\"elements\": {" +
"\"continent\": { \"labelScale\": 0.5 }," +
"\"political\": { \"borderStrokeColor\": \"#C2C0B9\", \"borderOutlineColor\": \"#00000000\" }," +
"\"userPoint\": { \"scale\": { \"value\": 1.0 }, \"stemAnchorRadiusScale\": { \"value\": 0 } }," +
"\"vegetation\": { \"fillColor\": { \"value\": \"#C2EDB1\" } }," +
"\"water\": { \"fillColor\": \"#AADAFF\" }," +
"\"drivingRoute\": { \"strokeColor\": \"#ffffffff\", \"fillColor\": \"#00b3fd\" }," +
"\"highway\": { " + highwayColor + " }," +
"\"controlledAccessHighway\": { " + accessHighwayColor + ", \"labelOutlineColor\": \"#E0C060\"}" +
"}" +
"}";
MapStyleSheet[] css = new MapStyleSheet[2];
css[0] = mode == MapController.MapMode.Satellite ? MapStyleSheet.AerialWithOverlay() : MapStyleSheet.RoadLight();
css[1] = MapStyleSheet.ParseFromJson(jsonString);
nativeMap.StyleSheet = MapStyleSheet.Combine(css);
有什么方法可以去掉MapIcons上的点和尾吗? (不使用地图子项)
提前致谢
找到答案了。 我必须修改 MapControl 本身的 MapStyleSheet,而不是 MapIcon。特别是样式表中的 userPoint > stemAnchorRadiusScale。
Below code will style your UWP map to look similar to Google Maps. You'll need to adjust below to suit your app.
string highwayColor = mode == MapController.MapMode.Satellite ? "\"strokeColor\": \"#B6F3D072\", \"fillColor\": \"#50FEF0AC\"" : "\"strokeColor\": \"#F3D072\", \"fillColor\": \"#FEF0AC\"";
string accessHighwayColor = mode == MapController.MapMode.Satellite ? "\"strokeColor\": \"#B6E3C072\", \"fillColor\": \"#50EEE0AC\"" : "\"strokeColor\": \"#E3C072\", \"fillColor\": \"#EEE0AC\"";
string jsonString = "{" +
"\"version\": \"1.*\"," +
"\"settings\": { \"landColor\": \"#ECEAE4\", \"fillColor\": \"#FFFFFF\" }," +
"\"elements\": {" +
"\"continent\": { \"labelScale\": 0.5 }," +
"\"political\": { \"borderStrokeColor\": \"#C2C0B9\", \"borderOutlineColor\": \"#00000000\" }," +
"\"userPoint\": { \"scale\": { \"value\": 1.0 }, \"stemAnchorRadiusScale\": { \"value\": 0 } }," +
"\"vegetation\": { \"fillColor\": { \"value\": \"#C2EDB1\" } }," +
"\"water\": { \"fillColor\": \"#AADAFF\" }," +
"\"drivingRoute\": { \"strokeColor\": \"#ffffffff\", \"fillColor\": \"#00b3fd\" }," +
"\"highway\": { " + highwayColor + " }," +
"\"controlledAccessHighway\": { " + accessHighwayColor + ", \"labelOutlineColor\": \"#E0C060\"}" +
"}" +
"}";
MapStyleSheet[] css = new MapStyleSheet[2];
css[0] = mode == MapController.MapMode.Satellite ? MapStyleSheet.AerialWithOverlay() : MapStyleSheet.RoadLight();
css[1] = MapStyleSheet.ParseFromJson(jsonString);
nativeMap.StyleSheet = MapStyleSheet.Combine(css);