Xamarin.Forms With Nutiteq

85 views
Skip to first unread message

rak...@gmail.com

unread,
Feb 9, 2016, 11:55:08 AM2/9/16
to Nutiteq-dev
Hi,

I looked into using Nutiteq for a project and using Xamarin.Forms for this. I am new to using Nutiteq.

I was just wondering if it is possible to use Nutiteq in a Xamarin.Forms, if so is there an example that can be followed to implement the maps in a project that uses XAML files to navigate through the app.

Thank you.

Jaak Laineste

unread,
Feb 9, 2016, 12:22:27 PM2/9/16
to nutit...@googlegroups.com
Hi,

Thanks for the interest. We don’t have ready-made Xamarin.Forms yet, our samples are based on Xamarin apps which have platform-based native views, and shared business logic level. If there are other developers who have done Forms, then we’d be interested on this also.

Jaak
> --
> You received this message because you are subscribed to the Google Groups "Nutiteq-dev" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to nutiteq-dev...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

bi...@harborlightsoftware.com

unread,
Feb 12, 2016, 1:33:48 PM2/12/16
to Nutiteq-dev, rak...@gmail.com
I am working on developing support in Xamarin.Forms. I have basic functionality working, but I'm working on figuring out some Nutiteq SDK behavior that is unrelated to working with Forms. So, I'm hesitant to release code yet, because it just isn't a completely working example.

But I'll share the approach that I have taken so far. First of all, what I want to support in my app, at least in the short term are:

a) offline use
b) draw lines to locations over time using lat/lon info that I pull from a database.
c) showing dots or markers in locations where certain events have occurred
d) downloading multiple regions to present accurate depictions of the US East Coastline

I can do the first three items - I am still working on how to do multiple regions efficiently (i.e. without downloading a dozen large state files)

My approach so far:
1) I created a class in my XF app that inherits from View and create a number of BindableProperty objects for different properties of the map:

public class xNutiteqMapView : View
{
public xNutiteqMapView ( )
{ }
// Location
public static readonly BindableProperty LocationPathProperty = BindableProperty.Create<xNutiteqMapView, List<Point>>( p => p.LocationPath, new List<Point>() );
public List<Point> LocationPath
{
get { return GetValue( LocationPathProperty ) as List<Point>; }
set { SetValue( LocationPathProperty, value ); }
}
// Location Path Color
public static readonly BindableProperty LocationPathColorProperty = BindableProperty.Create<xNutiteqMapView, Color>( p => p.LocationPathColor, Color.Red );
public Color LocationPathColor
{
get { return (Color)GetValue( LocationPathColorProperty ); }
set { SetValue( LocationPathColorProperty, value ); }
}

2) I then create a Custom Renderer on each platform that gets values from the BindableProperty properties to configure the map. It also handles the PropertyChanged event to modify the map after it has been created.

protected override void OnElementPropertyChanged ( object sender,
System.ComponentModel.PropertyChangedEventArgs e )
{
base.OnElementPropertyChanged( sender, e );

xNutiteqMapView parentUiObj = sender as xNutiteqMapView;

if ( e.PropertyName == "CurrentLocation" ||
e.PropertyName == "MapRotation" ||
e.PropertyName == "Tilt" )
{
SetCurrentLocation( parentUiObj );
}
else if ( e.PropertyName == "Zoom" )
{
SetZoom( parentUiObj );
}
else if ( e.PropertyName == "LocationPath" ||
e.PropertyName == "LocationPathColor" ||
e.PropertyName == "LocationPathWidth" )
{
DrawLocationPath( parentUiObj );
}
else if ( e.PropertyName == "CatchLocations" ||
e.PropertyName == "CatchLocationColor" ||
e.PropertyName == "CatchLocationSize" )
{
DrawCatchLocations( parentUiObj );
}
else if ( e.PropertyName == "MapPackageId" )
{
UpdateDownloadedMaps( parentUiObj );
}
else if ( e.PropertyName == "MapStyle" )
{
ConfigureMapStyle( parentUiObj );
}
}

The functions call in the OnElementPropertyChanged event go off and work with the Nutiteq SDK functions. You can get those details from their documentation.

I don't know how far I can go in terms of implementing everything I might need in the future, and its still not working 100%, so there's still some work to do, but I figured I'd offer this up to start the discussion.

-Bill

1) I have created

rak...@gmail.com

unread,
Feb 15, 2016, 7:29:22 AM2/15/16
to Nutiteq-dev
@Bill

So you set up the map within the portable section and then used the renderer for each platform? Isnt nutiteq component need to be called within the separate platforms?

bi...@harborlightsoftware.com

unread,
Feb 15, 2016, 4:54:23 PM2/15/16
to Nutiteq-dev, rak...@gmail.com
On Tuesday, February 9, 2016 at 11:55:08 AM UTC-5, rak...@gmail.com wrote:
No, the map view is done withing the CustomRenderer, implemented for each platform, although with the similarities in the Nutiteq API between Android and iOS, the code looks extremely similar.

In Android, I am simply implementing a View, where I set the ContentView to a layout file that looks like:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/rootPanel"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<nutiteq.ui.MapView
android:id="@+id/mapView"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</LinearLayout>

In iOS, I am rendering a UIView, and just include the following code in the OnElementChanged event handler:

rootPanel = new UIView( this.Bounds );
m_mapView = new MapView(rootPanel.Bounds);
rootPanel.AddSubview( m_mapView );

-Bill

di...@dinonovak.com

unread,
Jul 21, 2017, 11:35:53 AM7/21/17
to Nutiteq-dev, rak...@gmail.com
Hi all,

any update on this project. i would like to get started with it as I also need just basic mapping functionality, but need offline map option.

Thanx for feedback,
DiNo
Reply all
Reply to author
Forward
0 new messages