Mappolyline in WP8 from XAML does not work? - windows-phone-8

all I am working with WP 8 new Maps from Nokia.
Having a bit problem with mappolyline from xaml, it won't show.
Tried (Some init code removed):
Where Coords is just a public property of type GeoCoordinateCollection
I can show the polygon by doing code but that's not what I want now when I have learned about binding code to templates and so on.
<maps:Map x:Name="Map" Grid.Row="1" >
<maps:Map.MapElements >
<maps:MapPolyline StrokeColor="red" StrokeThickness="2" Path="{Binding Coords}"></maps:MapPolyline>
</maps:Map.MapElements>
</maps:Map>

Try adding polyline through code,
var _polyline = new MapPolyline();
line.StrokeColor = Colors.Red;
line.StrokeThickness = 2;
line.Path.Add(new GeoCoordinate(lat,long));
line.Path.Add(new GeoCoordinate(lat, long));
MyMap.MapElements.Add(line);

Related

Vaadin how to add Google heat map

I have a Vaadin application where I would like to integrate Google heatmaps. I am using com.vaadin.tapio.googlemaps dependency for displaying a map and it works fine. However, I am not sure how to add a heatmap layer on top of the Google map and I couldn't find any relevant resource.
Relevant part of my trial code looks like this:
VerticalLayout rootLayout = new VerticalLayout();
rootLayout.setSizeFull();
// Google Map
GoogleMap googleMap = new GoogleMap("api_key", null, null);
googleMap.setZoom(10);
googleMap.setSizeFull();
googleMap.setMinZoom(4);
googleMap.setMaxZoom(16);
Panel mapsPanel = new Panel();
mapsPanel.setSizeFull();
mapsPanel.setContent(googleMap);
rootLayout.addComponent(mapsPanel);
double centerLon = 8.5417;
double centerLat = 47.3769;
googleMap.setCenter(new LatLon(centerLat, centerLon));
GoogleMapMarker centerMarker = new GoogleMapMarker("Zurich", new LatLon(centerLat, centerLon),true, null);
googleMap.addMarker(centerMarker);
HeatMapLayer heatMapLayer = HeatMapLayer.newInstance(HeatMapLayerOptions.newInstance());
// Add data to heatmap
...
// How can I add this HeatMapLayer to the existing map?
// Or do I need a different approach?
UI.getCurrent().setContent(rootLayout);
HeatMapLayer is a GWT (client-side) object, you can't use it directly with GoogleMap which is a server-side component. You can check this fork of com.vaadin.tapio.googlemaps, it adds support for HeatMapLayer with GoogleMapHeatMapLayer class.

p:lineChart - continuous line, without dots

how to remove the dots from p:lineChart and draw the chart as just the continuous line?
Thanks
For others with similar problem, I did:
<p:chart type="line" model="#{myController.model}"/>
and:
LineChartSeries serie = new LineChartSeries();
serie.setShowMarker(false);
and worked fine. I'm using PrimeFaces 5.1.
There is a showMarkers attribute that isn't working for me (I'm using PrimeFaces 3.4.2) but I found a way to hide them.
It's a bit hacky, I made it working on the showcase, you just need to replace widget_category by the widget of your chart. You can even test it online from the showcase using a javascript console if your web browser allows it (tested under chromium) :
// loop through the series
for (var i = 0; i < widget_category.cfg.series.length; ++i) {
// Hide markers
widget_category.cfg.series[i].showMarker = false;
// I'm not sure you want this when talking about 'continuous line'
// but you can make your chart smooth this way :
widget_category.cfg.series[i].rendererOptions = { smooth: true };
}
// Ask a refresh using the modified configuration object
widget_category.refresh(widget_category.cfg);

How to set app bar button image via resource or programmatically in windows store app

I want to load an AppBar programmatically, but I'm having trouble setting the image to a bitmap. Is this allowed? Or can only the Segoe UI Symbol characters be used?
I tried doing it in a resource:
<Style x:Key="StudyAppBarButtonStyle" TargetType="ButtonBase" BasedOn="{StaticResource AppBarButtonStyle}">
<Setter Property="AutomationProperties.AutomationId" Value="StudyAppBarButton"/>
<Setter Property="AutomationProperties.Name" Value="Study"/>
<Setter Property="Content">
<Setter.Value>
<Image Source="Assets/AppBar/Study.png" />
</Setter.Value>
</Setter>
</Style>
No bitmap appears.
I can set the bitmap programmatically:
Uri _BaseUri = new Uri("ms-appx:///");
foreach (MenuItem menuItem in Model.MainMenu.MenuItems)
{
Button button = new Button();
button.Name = menuItem.Name;
button.Click += AppBar_Click;
button.Tag = menuItem.Name;
Style style = (Style)App.Instance.Resources["AppBarButtonStyle"];
button.Style = style;
Image image = new Image();
Uri uri = new Uri(_BaseUri, "Assets/AppBar/" + menuItem.Name + ".png");
image.Source = new BitmapImage(uri);
image.Width = 25;
image.Height = 25;
button.Content = image;
AutomationProperties.SetName(button, menuItem.Title);
TopLeftPanel.Children.Add(button);
}
but if I do:
button.Content = "\uE10F";
I don't see the home character.
In general, are there any examples or guidelines for using custom images in app bars? Segoe doesn't have applicable images for all my menu items.
Unfortunately my app is pretty complex, with two levels of menus, so any suggestions on handling this would be appreciated. Basically, I'm trying to turn my website http://www.jtlanguage.com into an app.
Thanks.
-John
You have to create your own style, AppBarButtonStyle can't be used with image. I recommend you to check this MSDN forum thread, it might be helpful to you. how I can customize my AppBarIcons Images?. Please don't forget to accept this answer if you find your solution.

disable all other views not including map view Gmap2

I am using Google Map v2 and I only want map view and nothing more. I also would like to get rid of the zoom in and out buttons.
If anyone knows what I need to add to the following that would be great.
function stores()
{
$('#storelist ul#stores').html("");
fetch(203,"task=location&location=vic");
map = new GMap2(document.getElementById("map_canvas"));
map.setCenter(new GLatLng(-37.810013, 144.962683), 8);
map.setUIToDefault();
yellowIcon.image = "http://gmaps-samples.googlecode.com/svn/trunk/markers/orange/blank.png";
markerOptions = { icon:yellowIcon };
}
Remove map.setUIToDefault(). It adds the default look and feel to the Map.
(Reference docs: http://code.google.com/apis/maps/documentation/javascript/v2/reference.html#GMap2.setUIToDefault)
If you want, you can also customise how the map can be interacted with. For example map.disableDoubleClickZoom() or map.disableDragging(). See the reference above for details.

Making Google map marker mouse-over more interactive

I have a map with a google marker, but I would like to do some fun things with it like post a link in there, and format the text there to have an information item per line instead of all in one line.
Is that possible? If so, then what can be done and how? :)
Here is my current boring map and marker at the bottom of this page:
http://www.comehike.com/outdoors/parks/trailhead.php
You could do:
<script...
var marker = new GMarker(point);
map.addOverlay(marker);
var myHtml = "<your html here/>";
GEvent.addListener(marker, 'mouseover', function() {
map.openInfoWindow(point, myHtml);
};
.../>
where
<your html here/>
is what you want to show, for example image and contact info or something.
That is if you want the info window opened on mouseover event. You could either open it by default by calling that function ( map.openInfoWindow(point, myHtml) ) right away.
Hope that helps.