Ejemplo n.º 1
0
        public void loadCartography(ref Cartography cartography, int cityID)
        {
            WebService.Cartography c = this.Ws.CityCartographyFull(cityID);

            Intersection itr;

            foreach (WebService.Intersection i in c.intersections)
            {
                itr = new Intersection(i.id);
                itr.Position.set(i.position.x, i.position.y, i.position.z);
                cartography.intersections.Add(itr);
            }

            RoadSegment rs;

            foreach (WebService.RoadSegment r in c.roadSegments)
            {
                rs             = new RoadSegment(cartography.getIntersectionWithID(r.idIntersectionBegin), cartography.getIntersectionWithID(r.idIntersectionEnd));
                rs.SegmentName = r.name;
                cartography.segments.Add(rs);
            }

            PointOfInterest poi;

            foreach (WebService.PointOfInterest p in c.pointsOfInterest)
            {
                poi           = new PointOfInterest(new Vector3D(p.position.x, p.position.y, p.position.z));
                poi.ID        = p.id;
                poi.ModelName = p.model;

                /// TODO: Alterar para "Nome"
                poi.Nome        = p.description;
                poi.Description = p.description;

                poi.Facing = p.facing;

                for (int i = 0; i < p.features.Length; i++)
                {
                    poi.Features.Add(p.features[i]);
                }

                //adjustment = new String[0];
                //dimensions = new String[0];


                //NameValueConfigurationCollection nvc = ModelSettings.Default.Properties;
                //Console.WriteLine(ConfigurationSettings.AppSettings.AllKeys.);

                //if (poi.ModelName == "Castelo")
                //{

                //    //if (ModelSettings.Default.PropertyValues..Contains(poi.ModelName + "Adjustment"))
                //    //{
                //    adjustment = ModelSettings.Default[poi.ModelName + "Adjustment"].ToString().Split('|');
                //    //}

                //    //if (ModelSettings.Default.SettingsKey.Contains(poi.ModelName + "Dimensions"))
                //    //{
                //    dimensions = ModelSettings.Default[poi.ModelName + "Dimensions"].ToString().Split('|');
                //    //}

                //    //if (ModelSettings.Default.SettingsKey.Contains(poi.ModelName + "SoundName"))
                //    //{
                //    poi.SoundName = ModelSettings.Default[poi.ModelName + "SoundName"].ToString();
                //    //}

                //    if (adjustment.Length > 0)
                //    {
                //        poi.ColisionArea.Adjustment.set(Double.Parse(adjustment[0]), Double.Parse(adjustment[1]), Double.Parse(adjustment[2]));
                //    }

                //    if (dimensions.Length > 0)
                //    {
                //        poi.ColisionArea.Dimensions.set(Double.Parse(dimensions[0]), Double.Parse(dimensions[1]), Double.Parse(dimensions[2]));
                //    }

                //    poi.ColisionArea.Visible = true;
                //}

                poi.ColisionArea.Visible = true;

                poi.ColisionArea.Adjustment.set(0, 0, -1.5);
                poi.ColisionArea.Dimensions.set(3, 1, 2);

                cartography.pointsOfInterest.Add(poi);
            }

            GenericObject go;

            foreach (WebService.GenericObject g in c.genericObjects)
            {
                go = GenericObjectFactory.getGenericObject(g.type);
                go.Position.set(g.position.x, g.position.y, g.position.z);
                cartography.genericObjects.Add(go);
            }
        }
Ejemplo n.º 2
0
        public void loadCartography(ref Cartography cartography, int cityID)
        {

            WebService.Cartography c = this.Ws.CityCartographyFull(cityID);

            Intersection itr;
            foreach (WebService.Intersection i in c.intersections)
            {
                itr = new Intersection(i.id);
                itr.Position.set(i.position.x, i.position.y, i.position.z);
                cartography.intersections.Add(itr);
            }

            RoadSegment rs;
            foreach (WebService.RoadSegment r in c.roadSegments)
            {
                rs = new RoadSegment(cartography.getIntersectionWithID(r.idIntersectionBegin), cartography.getIntersectionWithID(r.idIntersectionEnd));
                rs.SegmentName = r.name;
                cartography.segments.Add(rs);
            }

            PointOfInterest poi;
            foreach (WebService.PointOfInterest p in c.pointsOfInterest)
            {
                poi = new PointOfInterest(new Vector3D(p.position.x, p.position.y, p.position.z));
                poi.ID = p.id;
                poi.ModelName = p.model;

                /// TODO: Alterar para "Nome"
                poi.Nome = p.description;
                poi.Description = p.description;

                poi.Facing = p.facing;

                for (int i = 0; i < p.features.Length; i++)
                {
                    poi.Features.Add(p.features[i]);
                }

                //adjustment = new String[0];
                //dimensions = new String[0];


                //NameValueConfigurationCollection nvc = ModelSettings.Default.Properties;
                //Console.WriteLine(ConfigurationSettings.AppSettings.AllKeys.);

                //if (poi.ModelName == "Castelo")
                //{

                //    //if (ModelSettings.Default.PropertyValues..Contains(poi.ModelName + "Adjustment"))
                //    //{
                //    adjustment = ModelSettings.Default[poi.ModelName + "Adjustment"].ToString().Split('|');
                //    //}

                //    //if (ModelSettings.Default.SettingsKey.Contains(poi.ModelName + "Dimensions"))
                //    //{
                //    dimensions = ModelSettings.Default[poi.ModelName + "Dimensions"].ToString().Split('|');
                //    //}

                //    //if (ModelSettings.Default.SettingsKey.Contains(poi.ModelName + "SoundName"))
                //    //{
                //    poi.SoundName = ModelSettings.Default[poi.ModelName + "SoundName"].ToString();
                //    //}

                //    if (adjustment.Length > 0)
                //    {
                //        poi.ColisionArea.Adjustment.set(Double.Parse(adjustment[0]), Double.Parse(adjustment[1]), Double.Parse(adjustment[2]));
                //    }

                //    if (dimensions.Length > 0)
                //    {
                //        poi.ColisionArea.Dimensions.set(Double.Parse(dimensions[0]), Double.Parse(dimensions[1]), Double.Parse(dimensions[2]));
                //    }

                //    poi.ColisionArea.Visible = true;
                //}

                poi.ColisionArea.Visible = true;

                poi.ColisionArea.Adjustment.set(0, 0, -1.5);
                poi.ColisionArea.Dimensions.set(3, 1, 2);

                cartography.pointsOfInterest.Add(poi);
            }

            GenericObject go;
            foreach (WebService.GenericObject g in c.genericObjects)
            {
                go = GenericObjectFactory.getGenericObject(g.type);
                go.Position.set(g.position.x, g.position.y, g.position.z);
                cartography.genericObjects.Add(go);
            }
        }