Ejemplo n.º 1
0
        private void InitialisePicture()
        {
            // should be true once we get *everyone* to stop using those confoundedly
            // hard to understand EMUs and absolute positionings...
            UseEasyPositioning = false;
            TopPosition = 0;
            LeftPosition = 0;

            UseRelativePositioning = true;
            AnchorRowIndex = 1;
            AnchorColumnIndex = 1;
            OffsetX = 0;
            OffsetY = 0;
            WidthInEMU = 0;
            HeightInEMU = 0;
            WidthInPixels = 0;
            HeightInPixels = 0;
            fHorizontalResolutionRatio = 1;
            fVerticalResolutionRatio = 1;

            this.bLockWithSheet = true;
            this.bPrintWithSheet = true;
            this.vCompressionState = A.BlipCompressionValues.Print;
            this.decBrightness = 0;
            this.decContrast = 0;
            //this.decRotationAngle = 0;

            this.vPictureShape = A.ShapeTypeValues.Rectangle;

            this.FillType = SLPictureFillType.None;
            this.FillClassInnerXml = string.Empty;

            this.HasOutline = false;
            this.PictureOutline = new A.Outline();
            this.HasOutlineFill = false;
            this.PictureOutlineFill = new A.SolidFill();

            this.HasGlow = false;
            this.GlowRadius = 0;
            this.GlowColorInnerXml = string.Empty;

            this.HasInnerShadow = false;
            this.PictureInnerShadow = new A.InnerShadow();
            this.HasOuterShadow = false;
            this.PictureOuterShadow = new A.OuterShadow();

            this.HasReflection = false;
            this.ReflectionBlurRadius = 0;
            this.ReflectionStartOpacity = 100000;
            this.ReflectionStartPosition = 0;
            this.ReflectionEndAlpha = 0;
            this.ReflectionEndPosition = 100000;
            this.ReflectionDistance = 0;
            this.ReflectionDirection = 0;
            this.ReflectionFadeDirection = 5400000;
            this.ReflectionHorizontalRatio = 100000;
            this.ReflectionVerticalRatio = 100000;
            this.ReflectionHorizontalSkew = 0;
            this.ReflectionVerticalSkew = 0;
            this.ReflectionAlignment = A.RectangleAlignmentValues.Bottom;
            this.ReflectionRotateWithShape = true;

            this.HasSoftEdge = false;
            this.SoftEdgeRadius = 0;

            this.HasScene3D = false;

            this.CameraLatitude = 0;
            this.CameraLongitude = 0;
            this.CameraRevolution = 0;
            this.CameraPreset = A.PresetCameraValues.OrthographicFront;
            this.CameraFieldOfView = 0;
            this.CameraZoom = 0;

            this.LightRigLatitude = 0;
            this.LightRigLongitude = 0;
            this.LightRigRevolution = 0;
            this.LightRigType = A.LightRigValues.ThreePoints;
            this.LightRigDirection = A.LightRigDirectionValues.Top;

            //this.HasBackdrop = false;
            //this.BackdropAnchorX = 0;
            //this.BackdropAnchorY = 0;
            //this.BackdropAnchorZ = 0;
            //this.BackdropNormalDx = 0;
            //this.BackdropNormalDy = 0;
            //this.BackdropNormalDz = 0;
            //this.BackdropUpVectorDx = 0;
            //this.BackdropUpVectorDy = 0;
            //this.BackdropUpVectorDz = 0;

            this.HasBevelTop = false;
            this.BevelTopPreset = A.BevelPresetValues.Circle;
            this.BevelTopWidth = 76200;
            this.BevelTopHeight = 76200;

            this.HasBevelBottom = false;
            this.BevelBottomPreset = A.BevelPresetValues.Circle;
            this.BevelBottomWidth = 76200;
            this.BevelBottomHeight = 76200;

            this.HasExtrusion = false;
            this.ExtrusionHeight = 0;
            this.ExtrusionColorInnerXml = string.Empty;

            this.HasContour = false;
            this.ContourWidth = 0;
            this.ContourColorInnerXml = string.Empty;

            this.HasMaterialType = false;
            this.MaterialType = A.PresetMaterialTypeValues.WarmMatte;

            this.HasZDistance = false;
            this.ZDistance = 0;

            this.HasUri = false;
            this.HyperlinkUri = string.Empty;
            this.HyperlinkUriKind = UriKind.Absolute;
            this.IsHyperlinkExternal = true;

            this.DataIsInFile = true;
            this.PictureFileName = string.Empty;
            this.PictureByteData = new byte[1];
            this.PictureImagePartType = ImagePartType.Bmp;
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Set the camera and light properties.
        /// </summary>
        /// <param name="CameraPreset">A preset set of properties for the camera, which can be overridden. Default value is OrthographicFront.</param>
        /// <param name="FieldOfView">Field of view, ranging from 0 degrees to 180 degrees. Accurate to 1/60000 of a degree.</param>
        /// <param name="Zoom">Zoom percentage, ranging from 0% to 2147483.647%. Accurate to 1/1000 of a percent.</param>
        /// <param name="CameraLatitude">Camera latitude angle, ranging from 0 degrees to 359.9 degrees. Accurate to 1/60000 of a degree.</param>
        /// <param name="CameraLongitude">Camera longitude angle, ranging from 0 degrees to 359.9 degrees. Accurate to 1/60000 of a degree.</param>
        /// <param name="CameraRevolution">Camera revolution angle, ranging from 0 degrees to 359.9 degrees. Accurate to 1/60000 of a degree.</param>
        /// <param name="LightRigType">The type of light used. Default value is ThreePoints.</param>
        /// <param name="LightRigDirection">The direction of the light. Default value is Top.</param>
        /// <param name="LightRigLatitude">Light rig latitude angle, ranging from 0 degrees to 359.9 degrees. Accurate to 1/60000 of a degree.</param>
        /// <param name="LightRigLongitude">Light rig longitude angle, ranging from 0 degrees to 359.9 degrees. Accurate to 1/60000 of a degree.</param>
        /// <param name="LightRigRevolution">Light rig revolution angle, ranging from 0 degrees to 359.9 degrees. Accurate to 1/60000 of a degree.</param>
        /// <remarks>Imagine the screen to be the X-Y plane, the positive X-axis pointing to the right, and the positive Y-axis pointing up.
        /// The positive Z-axis points perpendicularly from the screen towards you.
        /// The latitude value increases as you turn around the X-axis, using the right-hand rule.
        /// The longitude value increases as you turn around the Y-axis, using the <em>left-hand rule</em> (meaning it decreases according to right-hand rule).
        /// The revolution value increases as you turn around the Z-axis, using the right-hand rule.
        /// And if you're mapping values directly from Microsoft Excel, don't treat the X, Y and Z values as values related to the axes.
        /// The latitude maps to the Y value, longitude maps to the X value, and revolution maps to the Z value.</remarks>
        public void Set3DScene(A.PresetCameraValues CameraPreset, decimal FieldOfView, decimal Zoom, decimal CameraLatitude, decimal CameraLongitude, decimal CameraRevolution, A.LightRigValues LightRigType, A.LightRigDirectionValues LightRigDirection, decimal LightRigLatitude, decimal LightRigLongitude, decimal LightRigRevolution)
        {
            this.HasScene3D = true;

            this.CameraPreset = CameraPreset;

            if (FieldOfView < 0m) FieldOfView = 0m;
            if (FieldOfView > 180m) FieldOfView = 180m;
            this.CameraFieldOfView = Convert.ToInt32(FieldOfView * (decimal)SLConstants.DegreeToAngleRepresentation);

            this.CameraLatitude = SLDrawingTool.CalculatePositiveFixedAngle(CameraLatitude);
            this.CameraLongitude = SLDrawingTool.CalculatePositiveFixedAngle(CameraLongitude);
            this.CameraRevolution = SLDrawingTool.CalculatePositiveFixedAngle(CameraRevolution);

            // Zoom is held in an Int32, so the max is 2147483.647 (after the division by 1000).
            // But seriously, 2147483.647% zoom ?!?!
            if (Zoom < 0m) Zoom = 0m;
            if (Zoom > 2147483.647m) Zoom = 2147483.647m;
            this.CameraZoom = Convert.ToInt32(Zoom * 1000m);

            this.LightRigType = LightRigType;
            this.LightRigDirection = LightRigDirection;
            this.LightRigLatitude = SLDrawingTool.CalculatePositiveFixedAngle(LightRigLatitude);
            this.LightRigLongitude = SLDrawingTool.CalculatePositiveFixedAngle(LightRigLongitude);
            this.LightRigRevolution = SLDrawingTool.CalculatePositiveFixedAngle(LightRigRevolution);
        }