Пример #1
0
        /// <summary>
        /// Stamp a string at the current turtle position.
        /// </summary>
        /// <param name="str">The text to be written</param>
        /// <param name="offsetX">Relative X offset of text from turtle's current position.</param>
        /// <param name="offsetY">Relative Y offset of text from turtle's current position.</param>
        /// <param name="useRotation">If true, the text will rotate to the same heading as the turtle.</param>
        /// <returns></returns>
        public virtual Footprint Stamp(string str, double offsetX = 0.0, double offsetY = 0.0, bool useRotation = false)
        {
            Label lbl = new Label()
            {
                Content    = str,
                FontFamily = TextFontFamily,
                FontSize   = TextFontSize,
                FontWeight = TextFontWeight,
                Foreground = TextBrush
            };
            TransformGroup tfg = buildCurrentTurtleTransform();

            if (!useRotation)
            {
                tfg.Children.RemoveAt(0);
            }
            if (offsetX != 0.0 || offsetY != 0.0)
            {
                tfg.Children.Insert(0, new TranslateTransform(offsetX, offsetY));
            }
            lbl.RenderTransform = tfg;

            Canvas.SetZIndex(lbl, footprintlayer);
            Footprint fp = new Footprint(lbl);

            Footprints.Add(fp);
            pumpAnimation();
            return(fp);
        }
Пример #2
0
        /// <summary>
        /// Stamp an image at the current turtle position.
        /// If the offsets are zero, the top left corner of the image will be placed at the turtle's hotspot.
        /// </summary>
        /// <param name="imgSrc">The image to be stamped</param>
        /// <param name="hotspotX">X offset of image that will be aligned to turtle's current X position.</param>
        /// <param name="hotspotY">Y offset of image that will be aligned to turtle's current Y position.</param>
        /// <param name="useRotation">If true, the image will be rotated to the same heading as the turtle.</param>
        /// <returns></returns>
        public virtual Footprint Stamp(ImageSource imgSrc, double hotspotX = 0.0, double hotspotY = 0.0, bool useRotation = false)
        {
            Image img = new Image()
            {
                Source = imgSrc
            };
            TransformGroup tfg = buildCurrentTurtleTransform();

            if (!useRotation)
            {
                tfg.Children.RemoveAt(0);
            }
            if (hotspotX != 0.0 || hotspotY != 0.0)
            {
                tfg.Children.Insert(0, new TranslateTransform(-hotspotX, -hotspotY));
            }
            img.RenderTransform = tfg;

            Canvas.SetZIndex(img, footprintlayer);
            Footprint fp = new Footprint(img);

            Footprints.Add(fp);
            pumpAnimation();
            return(fp);
        }
Пример #3
0
        /// <summary>
        /// Stamp a uiElement at the current position, as a footprint.   The opacity settings for footprints are not applied here.
        /// </summary>
        /// <param name="theUIE"></param>
        /// <returns>The Footprint that was created.</returns>
        public virtual Footprint Stamp(UIElement theUIE)
        {
            TransformGroup tfg = theUIE.RenderTransform as TransformGroup;

            if (tfg == null)
            {
                tfg = new TransformGroup();
            }

            tfg.Children.Add(new RotateTransform(heading));
            tfg.Children.Add(new TranslateTransform(Position.X, Position.Y));
            theUIE.RenderTransform = tfg;

            Canvas.SetZIndex(theUIE, footprintlayer);
            Footprint fp = new Footprint(theUIE);

            Footprints.Add(fp);
            pumpAnimation();
            return(fp);
        }
Пример #4
0
        public MedinaSiteSectorBuilder CategorizeObjects()
        {
            foreach (var obj in Objects)
            {
                var layerName = File.AllLayers.FindIndex(obj.Attributes.LayerIndex).Name;

                //Console.WriteLine(layerName);

                var geo = obj.Geometry as Brep;
                var pt  = Point3d.Unset;

                if (geo == null)
                {
                    if (layerName != "ruins__points")
                    {
                        if (layerName == "mass__object--building")
                        {
                            //Console.WriteLine(obj.Geometry.ObjectType);
                            var extrusion = obj.Geometry as Extrusion;
                            geo = extrusion.ToBrep();
                        }
                        else
                        {
                            continue;
                        }
                    }
                    else
                    {
                        var ptRef = obj.Geometry as Point;

                        if (ptRef != null)
                        {
                            RuinPoints.Add(ptRef.Location);
                            continue;
                        }

                        continue;
                    }
                }

                switch (layerName)
                {
                case "base":
                    Base = geo;
                    break;

                case "datum__ground--footprints":
                    Footprints.Add(geo);
                    break;

                case "datum__ground--courtyard":
                    Courtyards.Add(geo);
                    break;

                case "datum_ground--public":
                    Plazas.Add(geo);
                    break;

                case "datum__floor":
                    Floors.Add(geo);
                    break;

                case "datum__roof":
                    Roofs.Add(geo);
                    break;

                case "datum__balcony":
                    Balconies.Add(geo);
                    break;

                case "mass__object--building":
                    Massing.Add(geo);
                    break;

                case "mass__space--openings":
                    Windows.Add(geo);
                    break;

                case "mass__space--doors":
                    Doors.Add(geo);
                    break;

                default:
                    break;
                }
            }

            return(this);
        }