Example #1
0
        private BuildingRelation generateBuildingRelation(Relation relation)
        {
            BuildingRelation buildingRelation = new BuildingRelation();

            buildingRelation.tags       = relation.tags;
            buildingRelation.innerHoles = new List <Way>();

            for (int k = 0; k < relation.members.Count; k++)
            {
                for (int j = 0; j < wayList.Count; j++)
                {
                    if (relation.members[k].ref_ == wayList[j].id)
                    {
                        if (relation.members[k].role == "inner")
                        {
                            buildingRelation.innerHoles.Add(wayList[j]);
                            buildingRelation.id = wayList[j].id;
                        }
                        else if (relation.members[k].role == "outer")
                        {
                            buildingRelation.outerWall = wayList[j];
                        }
                    }
                }
            }


            for (int k = 0; k < relation.tags.Count; k++)
            {
                if (relation.tags[k].k == "building:levels")
                {
                    buildingRelation.buildingHeight = float.Parse(relation.tags[k].v) * 3.0f;
                }
            }



            return(buildingRelation);
        }
 private void createRoof(BuildingRelation relation, GameObject roof)
 {
     createRoof(relation.outerWall,roof);
 }
        private BuildingRelation generateBuildingRelation(Relation relation)
        {
            BuildingRelation buildingRelation = new BuildingRelation();
            buildingRelation.tags = relation.tags;
            buildingRelation.innerHoles = new List<Way>();

            for (int k = 0; k < relation.members.Count; k++)
            {
            for(int j=0 ; j < wayList.Count ; j++)
            {
                if (relation.members[k].ref_ == wayList[j].id)
                {
                    if (relation.members[k].role == "inner")
                    {
                        buildingRelation.innerHoles.Add(wayList[j]);
                        buildingRelation.id = wayList[j].id;
                    }
                    else if (relation.members[k].role == "outer")
                    buildingRelation.outerWall = wayList[j];
                }
            }
            }

            for (int k = 0; k < relation.tags.Count; k++)
            {
            if (relation.tags[k].k == "building:levels")
                buildingRelation.buildingHeight = float.Parse(relation.tags[k].v) * 3.0f;
            }

            return buildingRelation;
        }
        public Building(BuildingRelation _relation, BuildingConfigurations config, Material mat,int materialID, float texWidth)
        {
            type = buildingType.withholeInside;
            relation = _relation;

            id = relation.outerWall.id;

            buildingConfig = config;
            buildingHeight = getBuildingHeight(relation.tags);
            equalizedBuildingHeight = assingBuildingTopLevel(relation.outerWall);

            isClockwise = getWayOrientation(relation.outerWall);

            defaultMaterial = mat;
            defaultMaterialID = materialID;
            defaultTextureWidth = texWidth;
            facadeSkins = new List<FacadeSkin>();

            building = new GameObject("building" + id);
            building.transform.position = new Vector3(0.0f, 0.0f, 0.0f);

            GOtransform = new Vector3(0, 0, 0);
            GOrotate = new Vector3(0, 0, 0);
            GOscale = new Vector3(1, 1, 1);
        }