Example #1
0
    void init(UnityProp p, LabVariables v)
    {
        p.pathSizeModifier  = v.pathSizeModifier.value;
        p.pathDirection     = v.pathDirection.value;
        p.pathSpeed         = v.pathSpeed.value;
        p.pathAngleModifier = v.pathAngleModifier.value;
        p.pathRotation      = v.pathRotation.value;

        p.setPropDirection(v.propDirection.value);
        p.propSpeed         = v.propSpeed.value;
        p.propAngleModifier = v.propAngleModifier.value;

        p.xAdj = v.xAdj.value;
        p.yAdj = v.yAdj.value;

        p.use3D   = v.use3D.value;
        p.mod3D   = v.mod3D.value;
        p.flip3D  = v.flip3D.value;
        p.twist3D = v.twist3D.value;

        p.path3DMask = v.path3DMask.value;
        p.prop3DMask = v.prop3DMask.value;

        p.speedControl            = SpeedHelper.getSpeed(v.speedControl.value, 1, 0);
        p.speedChangeModifier     = v.speedChangeModifier.value;
        p.directionChange         = DirectionHelper.getDirectionControl(v.directionChange.value);
        p.directionChangeModifier = v.directionChangeModifier.value;

        p.setShape(ShapeHelper.getShape(v.shape.value));
        p.setComplexShape(v.complexShape.value);

        propA = L.propAngleIncrement;
        pathA = L.pathAngleIncrement;
    }
Example #2
0
        static void notesImagePlanar_Executing(object sender, EventArgs e)
        {
            Bitmap bitmap = OpenBitmap();

            if (bitmap == null)
            {
                return;
            }

            Part part = CreateImagePart();

            Point[] points = new Point[4];
            for (int i = 0; i < bitmap.Width; i++)
            {
                for (int j = 0; j < bitmap.Height; j++)
                {
                    points[0] = Point.Create((i + 0) * stepSize, (j + 0) * stepSize, 0);
                    points[1] = Point.Create((i + 1) * stepSize, (j + 0) * stepSize, 0);
                    points[2] = Point.Create((i + 1) * stepSize, (j + 1) * stepSize, 0);
                    points[3] = Point.Create((i + 0) * stepSize, (j + 1) * stepSize, 0);

                    DesignBody designBody = ShapeHelper.CreatePolygon(points, Plane.PlaneXY, 0, part);
                    designBody.SetColor(null, GetOpaquePixel(bitmap, i, j));
                }
            }
        }
Example #3
0
        public static void InitScrollbarImage()
        {
            Image[] tmpImages = ImageHelper.CutImage(HScrollbarImage, 4, true);

            Image[] tmpRightImages        = ImageHelper.CutImage(tmpImages[0], 3, false);
            Image[] tmpLeftImages         = ImageHelper.CutImage(tmpImages[1], 3, false);
            Image[] tmpScrollButtonImages = ImageHelper.CutImage(tmpImages[2], 3, false);

            Rectangle[] srcLeftButtonRect   = ShapeHelper.GetRectangles(new Rectangle(new Point(0, 0), tmpLeftImages[0].Size), LeftBorderWidth, RightBorderWidth, TopBorderHeight, BottomBorderHeight);
            Rectangle[] srcRightButtonRect  = ShapeHelper.GetRectangles(new Rectangle(new Point(0, 0), tmpRightImages[0].Size), LeftBorderWidth, RightBorderWidth, TopBorderHeight, BottomBorderHeight);
            Rectangle[] srcScrollButtonRect = ShapeHelper.GetRectangles(new Rectangle(new Point(0, 0), tmpScrollButtonImages[0].Size), LeftBorderWidth, RightBorderWidth, TopBorderHeight, BottomBorderHeight);

            for (int i = 0; i <= tmpLeftImages.Length - 1; i++)
            {
                for (int j = 0; j <= srcLeftButtonRect.Length - 1; j++)
                {
                    SourceRightButtonImages[i, j]  = ImageHelper.GetImage(tmpRightImages[i], srcRightButtonRect[j]);
                    SourceLeftButtonImages[i, j]   = ImageHelper.GetImage(tmpLeftImages[i], srcLeftButtonRect[j]);
                    SourceScrollButtonImages[i, j] = ImageHelper.GetImage(tmpScrollButtonImages[i], srcScrollButtonRect[j]);

                    //加边框
                    SourceRightButtonImages[i, j]  = ImageHelper.AddBorder(SourceRightButtonImages[i, j]);
                    SourceLeftButtonImages[i, j]   = ImageHelper.AddBorder(SourceLeftButtonImages[i, j]);
                    SourceScrollButtonImages[i, j] = ImageHelper.AddBorder(SourceScrollButtonImages[i, j]);
                }
            }

            SourceBackImage = tmpImages[3];
            SourceBackImage = ImageHelper.AddBorder(SourceBackImage);
        }
Example #4
0
        public void shape_helper_get_shape_3dim()
        {
            var x      = np.arange(24).reshape((4, 3, 2));
            var shape1 = ShapeHelper.GetShape(x.shape, new Slice(1, isIndex: true));

            Assert.AreEqual(shape1, (3, 2));

            var shape2 = ShapeHelper.GetShape(x.shape, new Slice(1));

            Assert.AreEqual(shape2, (3, 3, 2));

            var shape3 = ShapeHelper.GetShape(x.shape, new Slice(2), Slice.All);

            Assert.AreEqual(shape3, (2, 3, 2));

            var shape4 = ShapeHelper.GetShape(x.shape, new Slice(1, isIndex: true), new Slice(2));

            Assert.AreEqual(shape4, (1, 2));

            var shape5 = ShapeHelper.GetShape(x.shape, new Slice(1, isIndex: true), new Slice(1));

            Assert.AreEqual(shape5, (2, 2));

            var shape6 = ShapeHelper.GetShape(x.shape, new Slice(1), new Slice(1, isIndex: true), new Slice(1));

            Assert.AreEqual(shape6, (3, 1));
        }
Example #5
0
        public override void UpdateCurvesGeometry()
        {
            var circle3d = ShapeHelper.GenerateCircle(Center, new Vector3D(1, 0, 0), new Vector3D(0, 1, 0), Radius, 20);
            var circle   = ShapeHelper.ProjectCurve(circle3d);

            SilhouetteCircle.Points = circle.Append(circle.First()).ToArray();
        }
Example #6
0
        public override void UpdateCurvesGeometry()
        {
            base.UpdateCurvesGeometry();

            // get projected versions of top/bottom circles
            var top         = Center.Value + 0.5 * Length.Value * Axis.Value;
            var topCircle3d = ShapeHelper.GenerateCircle(top, Axis, TopRadiusInternal, 20);
            var topCircle   = ShapeHelper.ProjectCurve(topCircle3d);

            var bottom         = Center.Value - 0.5 * Length.Value * Axis.Value;
            var bottomCircle3d = ShapeHelper.GenerateCircle(bottom, Axis, BottomRadiusInternal, 20);
            var bottomCircle   = ShapeHelper.ProjectCurve(bottomCircle3d);

            // find the axis in projected coordinates
            var tb     = ShapeHelper.ProjectCurve(top, bottom);
            var axis2d = tb[0] - tb[1];

            // find the 2 silhouette lines
            var perp = new Vector(axis2d.Y, -axis2d.X);

            perp.Normalize();
            var lt = tb[0] + TopRadiusInternal * perp;
            var lb = tb[1] + BottomRadiusInternal * perp;
            var rt = tb[0] - TopRadiusInternal * perp;
            var rb = tb[1] - BottomRadiusInternal * perp;

            var leftLine  = new Point[] { lt, lb };
            var rightLine = new Point[] { rt, rb };
        }
Example #7
0
        /// <summary>
        /// Changed but not tested. 93.03.21
        /// </summary>
        /// <returns></returns>
        public byte[] AsWkb()
        {
            List <byte> result = new List <byte>();


            if (this.Parts.Count() == 1)
            {
                result.AddRange(OgcWkbMapFunctions.ToWkbLineStringZM(
                                    ShapeHelper.GetPoints(this, 0), ShapeHelper.GetZValues(this, 0), ShapeHelper.GetMeasures(this, 0)));
            }
            else
            {
                result.Add((byte)IRI.Standards.OGC.SFA.WkbByteOrder.WkbNdr);

                result.AddRange(BitConverter.GetBytes((uint)IRI.Standards.OGC.SFA.WkbGeometryType.MultiLineStringZM));

                result.AddRange(BitConverter.GetBytes((uint)this.parts.Length));

                for (int i = 0; i < this.parts.Length; i++)
                {
                    result.AddRange(
                        OgcWkbMapFunctions.ToWkbLineStringZM(
                            ShapeHelper.GetPoints(this, this.Parts[i]), ShapeHelper.GetZValues(this, this.Parts[i]), ShapeHelper.GetMeasures(this, this.Parts[i])));
                }
            }

            return(result.ToArray());
        }
Example #8
0
        //always returns polygon not multi polygon
        public Geometry <Point> AsGeometry()
        {
            if (this.NumberOfParts > 1)
            {
                List <Geometry <Point> > parts = new List <Geometry <Point> >(this.NumberOfParts);

                for (int i = 0; i < NumberOfParts; i++)
                {
                    //parts[i] = new Geometry<Point>(ShapeHelper.GetPoints(this, Parts[i]), GeometryType.LineString, Srid);
                    parts.Add(new Geometry <Point>(ShapeHelper.GetPoints(this, Parts[i]), GeometryType.LineString, Srid));
                }

                //1399.07.26
                //return new Geometry<Point>(parts, GeometryType.Polygon, Srid);
                return(Geometry <Point> .CreatePolygonOrMultiPolygon(parts, Srid));
            }
            else if (this.NumberOfParts == 1)
            {
                return(new Geometry <Point>(new List <Geometry <Point> >()
                {
                    new Geometry <Point>(ShapeHelper.GetPoints(this, Parts[0]), GeometryType.LineString, Srid)
                }, GeometryType.Polygon, Srid));
            }
            else
            {
                return(Geometry <Point> .CreateEmpty(GeometryType.Polygon, Srid));
            }
        }
Example #9
0
        private Geometry3D GenerateMeshGeometry(Point3D center, Vector3D normal, Vector3D widthVector, double width, double height)
        {
            var         points  = ShapeHelper.GenerateRectangle(center, normal, widthVector, width, height);
            MeshBuilder builder = new MeshBuilder();

            builder.AddTube(points, thickness, 10, isTubeClosed: true);
            return(builder.ToMesh());
        }
Example #10
0
        private Bitmap GetInitialZone()
        {
            _currentRadius = _size / 2 * CONTRACT_RATIO;
            _currentCenter = GetInitialRandomCenter();
            var bitmapWithCirlce = ShapeHelper.AddCircle(new Bitmap(_fortniteMap), Brushes.WhiteSmoke, _currentCenter, (float)_currentRadius);

            return(ShapeHelper.CropToCircle(bitmapWithCirlce, Color.MediumOrchid, _currentCenter, _currentRadius));
        }
        private Geometry GetGeometry(CircleFeatureCurve circle)
        {
            var circlePoints = ShapeHelper.GenerateCircle(circle.CenterResult,
                                                          circle.NormalResult,
                                                          circle.RadiusResult,
                                                          20);

            return(GetProjectedGeometry(circlePoints));
        }
        public void ComputePerimeterTest()
        {
            double expected = 0;
            circle input    = new circle();

            input.Radius = 0;
            double actual = ShapeHelper.ComputePerimeter(input);

            Assert.AreEqual(expected, actual);
        }
        private Geometry GetGeometry(RectangleFeatureCurve rect)
        {
            var rectPoints = ShapeHelper.GenerateRectangle(rect.CenterResult,
                                                           rect.NormalResult,
                                                           rect.WidthVectorResult,
                                                           rect.WidthResult,
                                                           rect.HeightResult);

            return(GetProjectedGeometry(rectPoints));
        }
        public void ComputePerinmeterTest()
        {
            double    expected = 40;
            Rectangle input    = new Rectangle();

            input.Width = 5;
            input.Heigt = 4;
            double actual = ShapeHelper.ComputePerinmeter(input);

            Assert.AreEqual(expected, actual);
        }
Example #15
0
        public Bitmap GetNextZoneSet()
        {
            _nextCenter = GetRandCircle(_currentCenter, _currentRadius * (1 - CONTRACT_RATIO));
            _nextRadius = _currentRadius * CONTRACT_RATIO;

            var bitmapWithCirlce   = ShapeHelper.AddCircle(new Bitmap(_fortniteMap), Brushes.Blue, _currentCenter, (float)_currentRadius);
            var bitmapCropToCircle = ShapeHelper.CropToCircle(bitmapWithCirlce, Color.MediumOrchid, _currentCenter, _currentRadius);

            _currentZoneSet = ShapeHelper.AddCircle(new Bitmap(_fortniteMap), Brushes.WhiteSmoke, _nextCenter, (float)_nextRadius);

            return(ShapeHelper.AddCircle(new Bitmap(bitmapCropToCircle), Brushes.WhiteSmoke, _nextCenter, (float)_nextRadius));;
        }
Example #16
0
        public void Update()
        {
            var normal = featureCurve.NormalResult;
            var center = featureCurve.CenterResult;
            var radius = featureCurve.RadiusResult;

            var points = ShapeHelper.GenerateCircle(center, normal, radius, CIRCLE_SAMPLES_COUNT).ToList();

            points.Add(points.First());

            model3d.Geometry = GenerateMeshGeometry(points, normal);
        }
Example #17
0
        public static void InitButtonImage()
        {
            Image tmpButtonImage = (Bitmap)ButtonImage.Clone();

            //设置透明
            tmpButtonImage = ImageHelper.ReplaceColor(tmpButtonImage, Color.FromArgb(255, 0, 255), Color.Transparent);

            //切分图片
            Image[] SrcButtonImages = ImageHelper.CutImage(tmpButtonImage, 3, true);

            if (SrcButtonImages.Length == 3)
            {
                Image[] tmpImages = new Image[4];
                SrcButtonImages.CopyTo(tmpImages, 0);
                tmpImages[3]    = ImageHelper.ReplaceColor(SrcButtonImages[0], Color.DarkGray);
                SrcButtonImages = tmpImages;
            }

            //原始矩形划分
            Rectangle[] tmpRects = ShapeHelper.GetRectangles(new Rectangle(new Point(0, 0), SrcButtonImages[0].Size), LeftBorderWidth, RightBorderWidth, TopBorderHeight, BottomBorderHeight);

            for (int i = 0; i <= SrcButtonImages.Length - 1; i++)
            {
                Image tmpImage = SrcButtonImages[i];

                //切分出九个部分的图片
                SrcLeftTopImages[i]  = ImageHelper.GetImage(tmpImage, tmpRects[0]);
                SrcTopImages[i]      = ImageHelper.GetImage(tmpImage, tmpRects[1]);
                SrcRightTopImages[i] = ImageHelper.GetImage(tmpImage, tmpRects[2]);

                SrcLeftImages[i]   = ImageHelper.GetImage(tmpImage, tmpRects[3]);
                SrcCenterImages[i] = ImageHelper.GetImage(tmpImage, tmpRects[4]);
                SrcRightImages[i]  = ImageHelper.GetImage(tmpImage, tmpRects[5]);

                SrcLeftBottomImages[i]  = ImageHelper.GetImage(tmpImage, tmpRects[6]);
                SrcBottomImages[i]      = ImageHelper.GetImage(tmpImage, tmpRects[7]);
                SrcRightBottomImages[i] = ImageHelper.GetImage(tmpImage, tmpRects[8]);

                //加边框
                SrcLeftTopImages[i]  = ImageHelper.AddBorder(SrcLeftTopImages[i]);
                SrcTopImages[i]      = ImageHelper.AddBorder(SrcTopImages[i]);
                SrcRightTopImages[i] = ImageHelper.AddBorder(SrcRightTopImages[i]);

                SrcLeftImages[i]   = ImageHelper.AddBorder(SrcLeftImages[i]);
                SrcCenterImages[i] = ImageHelper.AddBorder(SrcCenterImages[i]);
                SrcRightImages[i]  = ImageHelper.AddBorder(SrcRightImages[i]);

                SrcLeftBottomImages[i]  = ImageHelper.AddBorder(SrcLeftBottomImages[i]);
                SrcBottomImages[i]      = ImageHelper.AddBorder(SrcBottomImages[i]);
                SrcRightBottomImages[i] = ImageHelper.AddBorder(SrcRightBottomImages[i]);
            }
        }
Example #18
0
        void Reset()
        {
            StopThread();
            Rendering  = null;
            StatusText = "Get ready for some mayhem.";


            DesignBody desBody = ShapeHelper.CreateCircle(Frame.World, 11, Window.ActiveWindow.Scene as Part);

            desBody.SetVisibility(null, false);

            lawson.Reset();
        }
Example #19
0
        void Reset()
        {
            StopThread();
            Rendering  = null;
            StatusText = "Get ready for some mayhem.";

            double     size    = Math.PI;
            DesignBody desBody = ShapeHelper.CreateBlock(Point.Create(-size, -size, -size), Point.Origin, Window.ActiveWindow.Scene as Part);

            desBody.SetVisibility(null, false);

            gyroid.Reset();
        }
Example #20
0
        public string AsSqlServerWkt()
        {
            StringBuilder result = new StringBuilder("MULTILINESTRING(");

            for (int i = 0; i < NumberOfParts; i++)
            {
                result.Append(
                    string.Format("{0},",
                                  SqlServerWktMapFunctions.PointZGroupElementToWkt(
                                      ShapeHelper.GetPoints(this, i), ShapeHelper.GetZValues(this, i), ShapeHelper.GetMeasures(this, this.Parts[i]))));
            }

            return(result.Remove(result.Length - 1, 1).Append(")").ToString());
        }
Example #21
0
        static void CreateShotNearPoint(Point point, double height, double radius)
        {
            Window        activeWindow = Window.ActiveWindow;
            Line          rayLine      = Line.Create(point, activeWindow.Projection.Inverse * Direction.DirZ);
            ITrimmedCurve rayCurve     = CurveSegment.Create(rayLine, Interval.Create(1000, -1000));

            //DesignCurve.Create(activeWindow.Scene as Part, rayCurve);	// draws the ray as a design object

            var intersectionList = new List <IntPoint <SurfaceEvaluation, CurveEvaluation> >();

            foreach (IDesignBody designBody in (activeWindow.Scene as Part).Bodies)
            {
                foreach (IDesignFace designFace in designBody.Faces)
                {
                    intersectionList.AddRange(designFace.Shape.IntersectCurve(rayCurve));
                }
            }

            Point? closePoint = null;
            double closeParam = Double.MinValue;

            foreach (IntPoint <SurfaceEvaluation, CurveEvaluation> intersection in intersectionList)
            {
                if (intersection.EvaluationB.Param > closeParam)
                {
                    closeParam = intersection.EvaluationB.Param;
                    closePoint = intersection.Point;
                }
            }

            if (closePoint == null)
            {
                return;
            }

            DesignBody toolBody = ShapeHelper.CreateSphere(closePoint.Value, radius, activeWindow.Scene as Part);              //TBD why doesn't this work on spacklePart?

            //Frame? frame = GetFrameFromPoint(designFace, point);
            //if (frame == null)
            //    return;

            //Body body = CreateCylinder(point, frame.Value.DirX, frame.Value.DirY, radius, height);
            //DesignBody toolBody = AddInHelper.CreateSphere(frame.Value.Origin, radius, spacklePart);

            // TBD XXX Fix for v5
            //if (spackleMode == SpackleMode.Add)
            //    targetBody.Unite(new IDesignBody[] { toolBody });
            //else if (spackleMode == SpackleMode.Cut)
            //    targetBody.Subtract(new IDesignBody[] { toolBody });
        }
        public static void AddVideoOutput(this WebDocument document, string outputPath, Presentation pres)
        {
            List <VideoFrame> videoFrames = ShapeHelper.GetListOfShapes <VideoFrame>(pres);

            for (int i = 0; i < videoFrames.Count; i++)
            {
                IVideo video = videoFrames[i].EmbeddedVideo;
                string ext   = MimeTypesMap.GetExtension(videoFrames[i].EmbeddedVideo.ContentType);
                string path  = Path.Combine(outputPath, string.Format("video{0}.{1}", i, ext));

                var outputFile = document.Output.Add(path, video);
                document.Output.BindResource(outputFile, video);
            }
        }
        private static Geometry GetProjectedGeometry(Point3D[] points3d)
        {
            var projectedPoints = ShapeHelper.ProjectCurve(points3d);

            var geometry = new StreamGeometry();

            using (var ctx = geometry.Open())
            {
                ctx.BeginFigure(projectedPoints[0], true, true);
                ctx.PolyLineTo(projectedPoints.Skip(1).ToList(), true, true);
                ctx.Close();
            }

            return(geometry);
        }
Example #24
0
        public Bitmap DoContractSteps(int stepCount, int step)
        {
            // Abbildung von current -> next
            var stepRadius       = _nextRadius + (stepCount - step) / (double)stepCount * (_currentRadius - _nextRadius);
            var stepCenter       = _nextCenter + (stepCount - step) / (double)stepCount * (_currentCenter - _nextCenter);
            var bitmapWithCirlce = ShapeHelper.AddCircle(new Bitmap(_currentZoneSet), Brushes.Blue, stepCenter, (float)stepRadius);

            if (step == stepCount)
            {
                _currentRadius = stepRadius;
                _currentCenter = stepCenter;
            }

            return(ShapeHelper.CropToCircle(bitmapWithCirlce, Color.MediumOrchid, stepCenter, stepRadius));
        }
Example #25
0
        /// <summary>
        /// Returs Kml representation of the point. Note: Z,M values are igonred
        /// </summary>
        /// <returns></returns>
        static IRI.Ket.KmlFormat.Primitives.PlacemarkType AsPlacemark(PolyLineZ polyline, Func <IRI.Ham.SpatialBase.Point, IRI.Ham.SpatialBase.Point> projectToGeodeticFunc = null, byte[] color = null)
        {
            IRI.Ket.KmlFormat.Primitives.PlacemarkType placemark =
                new KmlFormat.Primitives.PlacemarkType();

            List <IRI.Ket.KmlFormat.Primitives.LineStringType> linestrings =
                new List <KmlFormat.Primitives.LineStringType>();

            IRI.Ket.KmlFormat.Primitives.MultiGeometryType multiGeometry =
                new KmlFormat.Primitives.MultiGeometryType();

            IEnumerable <string> coordinates;

            if (projectToGeodeticFunc != null)
            {
                coordinates = polyline.parts
                              .Select(i =>
                                      string.Join(" ", ShapeHelper.GetPoints(polyline, i)
                                                  .Select(j =>
                {
                    var temp = projectToGeodeticFunc(new IRI.Ham.SpatialBase.Point(j.X, j.Y));
                    return(string.Format("{0},{1}", temp.X, temp.Y));
                }).ToArray()));
            }
            else
            {
                coordinates = polyline.Parts
                              .Select(i =>
                                      string.Join(" ", ShapeHelper.GetPoints(polyline, i)
                                                  .Select(j => string.Format("{0},{1}", j.X, j.Y))
                                                  .ToArray()));
            }

            foreach (string item in coordinates)
            {
                IRI.Ket.KmlFormat.Primitives.LineStringType linestring = new KmlFormat.Primitives.LineStringType();

                linestring.coordinates = item;

                linestrings.Add(linestring);
            }

            multiGeometry.AbstractGeometryObjectExtensionGroup = linestrings.ToArray();

            placemark.AbstractFeatureObjectExtensionGroup = new KmlFormat.Primitives.AbstractObjectType[] { multiGeometry };

            return(placemark);
        }
        public void setComplexShape(string newShape)
        {
            // exiting a complex shape
            if (newShape != null && (newShape.Equals("") || newShape.ToLower().Equals("None")))
            {
                if (shape is ComplexShape)
                {
                    shape = ((ComplexShape)this.shape).getBaseShape();
                    return;
                }
                //else shape = new Circle();
            }

            Shape bShape = ShapeHelper.getShape(newShape);

            if (bShape is ComplexShape)
            {
                ComplexShape complex = (ComplexShape)bShape;
                if (shape is ComplexShape)
                {
                    Shape baseShape = ((ComplexShape)shape).getBaseShape();
                    complex.setBaseShape(baseShape);
                    shape = complex;
                }
                else
                {
                    /* if(shape.getName().Equals("Plus") ||
                     *       shape.getName().Equals("PlusCorner") ||
                     *       shape.getName().Equals("HCurve") ||
                     *       shape.getName().Equals("HCurveFig8") ||
                     *       shape.getName().Equals("HLine") ||
                     *       shape.getName().Equals("HLineFig8") ||
                     *       shape.getName().Equals("HCircle") ||
                     *       shape.getName().Equals("HCircleFig8") ||
                     *       shape.getName().Equals("PlusHalf") ||
                     *       shape.getName().Equals("PlusHalfCap") ){
                     *   // TODO refactor this to allow for correct selection behaviour
                     *   shape = new Circle();
                     *   complex.setBaseShape(this.shape);
                     *   shape = complex;
                     * }
                     * else { /**/
                    complex.setBaseShape(this.shape);
                    shape = complex;
                    // }
                }
            }
        }
Example #27
0
        protected override void OnExecute(Command command, System.Drawing.Rectangle buttonRect)
        {
            base.OnExecute(command, buttonRect);

            foreach (VideoForm videoForm in controlForm.VideoForms)
            {
                Line line         = videoForm.TrackingCamera.GetLine();
                var  curveSegment = CurveSegment.Create(line, Interval.Create(-10, 10));
                var  desCurve     = DesignCurve.Create(part, curveSegment);
                desCurve.Layer = referenceLayer;

                Point      point   = line.Origin;
                DesignBody desBody = ShapeHelper.CreateSphere(point, 0.1, part);
                desBody.Layer = referenceLayer;
            }
        }
Example #28
0
        public void shape_helper_get_shape_4dim()
        {
            var x      = np.arange(120).reshape((4, 3, 2, 5));
            var slices = new[] { new Slice(1, isIndex: true), new Slice(1), new Slice(0, isIndex: true), new Slice(1) };
            var shape1 = ShapeHelper.GetShape(x.shape, slices);

            Assert.AreEqual(shape1, (2, 4));

            var shape2 = ShapeHelper.GetShape(x.shape, Slice.All);

            Assert.AreEqual(shape2, (4, 3, 2, 5));

            var shape3 = ShapeHelper.GetShape(x.shape, Slice.All, new Slice(0, isIndex: true));

            Assert.AreEqual(shape3, (4, 3, 2));
        }
Example #29
0
        protected override void CreateAlignmentBodies(out Body addendumBody, out Body dedendumBody)
        {
            addendumBody = ShapeHelper.CreatePolygon(new Point[] {
                StartCone.WrapPoint(GearData.PitchAngle, GearData.AddendumRadius - GearData.PitchRadius),
                StartCone.WrapPoint(GearData.PitchAngle, 0),
                EndCone.WrapPoint(GearData.PitchAngle, 0),
                EndCone.WrapPoint(GearData.PitchAngle, EndScale * (GearData.AddendumRadius - GearData.PitchRadius))
            }, 0);

            dedendumBody = ShapeHelper.CreatePolygon(new Point[] {
                StartCone.WrapPoint(0, GearData.BaseRadius - GearData.PitchRadius),
                StartCone.WrapPoint(0, 0),
                EndCone.WrapPoint(0, 0),
                EndCone.WrapPoint(0, EndScale * (GearData.BaseRadius - GearData.PitchRadius))
            }, 0);
        }
        public static void AddShapeAsImagesOutput <T>(this WebDocument document, string outputPath, Presentation pres)
        {
            List <T> shapes = ShapeHelper.GetListOfShapes <T>(pres);

            uint counter = 0;

            Bitmap thumbnail;

            foreach (var shape in shapes)
            {
                if (shape is AutoShape)
                {
                    //skip ShapeType.Rectangle and ShapeType.NotDefined because there is specific template for these types
                    if ((shape as AutoShape).ShapeType == ShapeType.Rectangle ||
                        (shape as AutoShape).ShapeType == ShapeType.NotDefined)
                    {
                        continue;
                    }
                }

                //Make shape clone -> remove text from the clone -> get image of the clone -> remove the clone. Export text as HTML markup in the template.
                if (shape is AutoShape && !string.IsNullOrEmpty((shape as AutoShape).TextFrame.Text))
                {
                    IShape clone = pres.Slides[0].Shapes.AddClone(shape as AutoShape);

                    try
                    {
                        (clone as AutoShape).TextFrame.Paragraphs.Clear();
                        thumbnail = clone.GetThumbnail();
                    }
                    finally
                    {
                        pres.Slides[0].Shapes.Remove(clone);
                    }
                }
                else
                {
                    thumbnail = (shape as Shape).GetThumbnail();
                }

                string path = Path.Combine(outputPath, string.Format("{0}{1}.png", typeof(T).Name.ToLower(), counter++));

                // todo: images must by disposed
                var outputFile = document.Output.Add(path, thumbnail);
                document.Output.BindResource(outputFile, shape);
            }
        }