示例#1
0
    /// <summary>
    /// Constructor of OnlineMapsFindPlaceDetailsResult.
    /// </summary>
    /// <param name="node">Place node from response.</param>
    public OnlineMapsFindPlaceDetailsResult(OnlineMapsXML node)
    {
        this.node              = node;
        formatted_address      = node.Get("formatted_address");
        formatted_phone_number = node.Get("formatted_phone_number");

        OnlineMapsXML locationNode = node.Find("geometry/location");

        if (!locationNode.isNull)
        {
            location = new Vector2(locationNode.Get <float>("lng"), locationNode.Get <float>("lat"));
        }

        icon = node.Get("icon");
        id   = node.Get("id");
        international_phone_number = node.Get("international_phone_number");
        name = node.Get("name");

        OnlineMapsXMLList photosList = node.FindAll("photos");

        photos = new OnlineMapsFindPlacesResultPhoto[photosList.count];
        for (int i = 0; i < photosList.count; i++)
        {
            photos[i] = new OnlineMapsFindPlacesResultPhoto(photosList[i]);
        }

        place_id    = node.Get <string>("place_id");
        price_level = node.Get("price_level", -1);
        rating      = node.Get <float>("rating");
        reference   = node.Get("reference");

        OnlineMapsXMLList typeNode = node.FindAll("type");

        types = new string[typeNode.count];
        for (int i = 0; i < typeNode.count; i++)
        {
            types[i] = typeNode[i].Value();
        }

        url        = node.Get("url");
        utc_offset = node.Get("utc_offset");
        vicinity   = node.Get("vicinity");
        website    = node.Get("website");
    }
    /// <summary>
    /// Constructor of OnlineMapsFindPlaceDetailsResult.
    /// </summary>
    /// <param name="node">Place node from response.</param>
    public OnlineMapsFindPlaceDetailsResult(OnlineMapsXML node)
    {
        this.node = node;
        formatted_address = node.Get("formatted_address");
        formatted_phone_number = node.Get("formatted_phone_number");

        OnlineMapsXML locationNode = node.Find("geometry/location");
        if (!locationNode.isNull) location = new Vector2(locationNode.Get<float>("lng"), locationNode.Get<float>("lat"));

        icon = node.Get("icon");
        id = node.Get("id");
        international_phone_number = node.Get("international_phone_number");
        name = node.Get("name");

        OnlineMapsXMLList photosList = node.FindAll("photos");
        photos = new OnlineMapsFindPlacesResultPhoto[photosList.count];
        for (int i = 0; i < photosList.count; i++) photos[i] = new OnlineMapsFindPlacesResultPhoto(photosList[i]);

        place_id = node.Get<string>("place_id");
        price_level = node.Get("price_level", -1);
        rating = node.Get<float>("rating");
        reference = node.Get("reference");

        OnlineMapsXMLList typeNode = node.FindAll("type");
        types = new string[typeNode.count];
        for (int i = 0; i < typeNode.count; i++) types[i] = typeNode[i].Value();

        url = node.Get("url");
        utc_offset = node.Get("utc_offset");
        vicinity = node.Get("vicinity");
        website = node.Get("website");
    }