Exemplo n.º 1
0
        private void ProcessRelation(PrimitiveBlock block, Formats.Pbf.Relation relation)
        {
            var elementRelation = new Entities.Relation();

            elementRelation.Id = relation.id;
            if (relation.types.Count > 0)
            {
                elementRelation.Members = new List <RelationMember>();
                long memberId = 0;
                for (int memberIdx = 0; memberIdx < relation.types.Count; memberIdx++)
                {
                    memberId = memberId + relation.memids[memberIdx];
                    var    roleBytes = block.stringtable.s[relation.roles_sid[memberIdx]];
                    string role      = String.Intern(Encoding.UTF8.GetString(roleBytes, 0, roleBytes.Length));
                    var    member    = new RelationMember();
                    member.MemberId = memberId;
                    member.Role     = role;
                    member.TypeId   = (int)relation.types[memberIdx];
                    elementRelation.Members.Add(member);
                }
            }
            if (relation.keys.Count > 0)
            {
                elementRelation.Tags = new TagCollection(relation.keys.Count);
                for (int tagIdx = 0; tagIdx < relation.keys.Count; tagIdx++)
                {
                    var    keyBytes   = block.stringtable.s[(int)relation.keys[tagIdx]];
                    string key        = String.Intern(Encoding.UTF8.GetString(keyBytes, 0, keyBytes.Length));
                    var    valueBytes = block.stringtable.s[(int)relation.vals[tagIdx]];
                    string value      = String.Intern(Encoding.UTF8.GetString(valueBytes, 0, valueBytes.Length));
                    elementRelation.Tags.Add(key, value);
                }
            }
            _context.Builder.ProcessRelation(elementRelation, relation.keys.Count);
        }
Exemplo n.º 2
0
        protected void btnSalvar_Click(object sender, EventArgs e)
        {
            Entities.Relation relation = new Entities.Relation(idRelation, Convert.ToInt32(ddlEnterpriseName.SelectedValue), Convert.ToInt32(ddlUserName.SelectedValue));
            relationRepository.Save(relation);

            Response.Redirect("~/Inforelation/Relation.aspx");
        }
Exemplo n.º 3
0
        private void UpdateForm()
        {
            Entities.Relation relation = this.relationRepository.GetById(idRelation);

            if (relation != null)
            {
                formStatus.InnerText            = "Editar Relacionamento";
                ddlUserName.SelectedValue       = relation.IdUser.ToString();
                ddlEnterpriseName.SelectedValue = relation.IdEnterprise.ToString();
            }
        }
Exemplo n.º 4
0
        /// <inheritdoc />
        public override void VisitRelation(Entities.Relation relation)
        {
            string actualValue;
            var    modelRelation = new Relation()
            {
                Id   = relation.Id,
                Tags = relation.Tags,
            };

            if (relation.Tags != null && relation.Tags.TryGetValue("type", out actualValue) &&
                actualValue == "multipolygon")
            {
                // TODO use object pool
                modelRelation.Areas = new List <Area>(relation.Members.Count);
                MultipolygonProcessor.FillAreas(relation, modelRelation.Areas);
            }
            ModelLoader.LoadRelation(Tile, modelRelation);
        }