To incorporate google map in our XAF app

StatusIDPriorityType
Closed22944BlockerQuestion
ProfileReply
Lars PlatzdaschClient

We are following the link properly (https://galaktika-soft.com/documentation/xafari/index.html?google_map_property_editor.html)

but in WebModule.cs the following method raises build exception and didn't find required reference. Already referenced DLL (Xafari,Xafari.Editors, Xafari.Editors.Web,Xafari.Web, Xafari.Utils)

public override void ExtendModelInterfaces(ModelInterfaceExtenders extenders)
{
extenders.Add();
extenders.Add();
}

Error:
1. The type or namespace name 'IModelPropertyEditorWebLayout' could not be found (are you missing a using directive or an assembly reference?)
2. The type or namespace name 'IModelMapPropertyEditorWeb' could not be found (are you missing a using directive or an assembly reference?)

Environment:

XAF 14.2.4 , Xafari 14.2.407.114, VS 2012, Windows Server 2008 R2

what we do wrong?

Replies

UserDescriptionPosted On
NikolayAgent

Hello Lars,

There are some issues on the documentation page that you used. Below I will describe what you need to do to make GeoPoint work.

  1. You don't need to override RegisterEditorDescriptors and ExtendModelInterfaces methods in your WebModule.cs and RegisterEditorDescriptors in your Module.cs.
  2. You need to modify your ClassWithGeoPoint class so its content should be like this:

    [DefaultClassOptions]
    public class ClassWithGeoPoint : BaseObject
    {
    public ClassWithGeoPoint(Session session)
    : base(session)
    {
    }

    public override void AfterConstruction()
    {
    base.AfterConstruction();
    this.Point = new GeoPoint();
    }

    private string title;
    private string office;
    private GeoPoint point;

    public string Title
    {
    get { return title; }
    set { SetPropertyValue("Title", ref title, value); }
    }

    public string Office
    {
    get { return office; }
    set { SetPropertyValue("Office", ref office, value); }
    }

    [ValueConverter(typeof(GeoPointConverter))]
    public GeoPoint Point
    {
    get { return point; }
    set { this.SetPropertyValue("Point", ref point, value); }
    }
    }

  3. Add a class GeoPointConverter to your project.

    public class GeoPointConverter : ValueConverter
    {
    public override object ConvertFromStorageType(object value)
    {
    if (value == null)
    return null;
    return GeoPoint.Parse(value);
    }

    public override object ConvertToStorageType(object value)
    {
    if (value == null)
    return null;
    return value.ToString();
    }

    public override Type StorageType
    {
    get { return typeof(String); }
    }
    }

Let me know if you have further questions.

Lars Platzdasch

Hi, In our app,

All business objects are DC but
Domain Component (DC) doesn't support "GeoPoint" as attribute to show google map.
Is there any DC supported class?

NikolayAgent

Hello Lars,

You can use GeoPoint in your DC-based application almost the same way as in a XPO-based app.
Here is the sample domain component with GeoPoint.

[DomainComponent]
[DefaultClassOptions]
public interface GeoPointDomainComponent
{
string Title { get; set; }

[ValueConverter(typeof(GeoPointConverter))]
GeoPoint Point { get; set; }
}

Here is the sample domain logic for the domain component.

[DomainLogic(typeof(GeoPointDomainComponent))]
public class DomainComponent1Logic {
public static void AfterConstruction(GeoPointDomainComponent instance) {
instance.Point = new GeoPoint();
}
}

Also do not forget to register entity in the Setup method of the Module.

XafTypesInfo.Instance.RegisterEntity("GeoPointDomainComponent", typeof(GeoPointDomainComponent));

Let me know if this information helps.

Nikolay.

× This ticket is closed.

Write US