private bool IsPerspectiveView(A.PresetCameraValues Preset)
        {
            var result = false;

            switch (Preset)
            {
            case A.PresetCameraValues.LegacyPerspectiveBottom:
            case A.PresetCameraValues.LegacyPerspectiveBottomLeft:
            case A.PresetCameraValues.LegacyPerspectiveBottomRight:
            case A.PresetCameraValues.LegacyPerspectiveFront:
            case A.PresetCameraValues.LegacyPerspectiveLeft:
            case A.PresetCameraValues.LegacyPerspectiveRight:
            case A.PresetCameraValues.LegacyPerspectiveTop:
            case A.PresetCameraValues.LegacyPerspectiveTopLeft:
            case A.PresetCameraValues.LegacyPerspectiveTopRight:
            case A.PresetCameraValues.PerspectiveAbove:
            case A.PresetCameraValues.PerspectiveAboveLeftFacing:
            case A.PresetCameraValues.PerspectiveAboveRightFacing:
            case A.PresetCameraValues.PerspectiveBelow:
            case A.PresetCameraValues.PerspectiveContrastingLeftFacing:
            case A.PresetCameraValues.PerspectiveContrastingRightFacing:
            case A.PresetCameraValues.PerspectiveFront:
            case A.PresetCameraValues.PerspectiveHeroicExtremeLeftFacing:
            case A.PresetCameraValues.PerspectiveHeroicExtremeRightFacing:
            case A.PresetCameraValues.PerspectiveHeroicLeftFacing:
            case A.PresetCameraValues.PerspectiveHeroicRightFacing:
            case A.PresetCameraValues.PerspectiveLeft:
            case A.PresetCameraValues.PerspectiveRelaxed:
            case A.PresetCameraValues.PerspectiveRelaxedModerately:
            case A.PresetCameraValues.PerspectiveRight:
                result = true;
                break;
            }

            return(result);
        }
 private void SetAllNull()
 {
     this.HasCamera = false;
     this.HasXYZSet = false;
     this.HasPerspectiveSet = false;
     this.CameraPreset = A.PresetCameraValues.OrthographicFront;
     this.decX = 0;
     this.decY = 0;
     this.decZ = 0;
     this.decPerspective = 0;
     this.decDistanceZ = 0;
 }
Example #3
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;
        }
 /// <summary>
 /// Set camera settings using a preset.
 /// </summary>
 /// <param name="Preset">The preset to be used.</param>
 public void SetCameraPreset(SLCameraPresetValues Preset)
 {
     switch (Preset)
     {
         case SLCameraPresetValues.None:
             this.CameraPreset = A.PresetCameraValues.OrthographicFront;
             this.decX = 0;
             this.decY = 0;
             this.decZ = 0;
             this.decPerspective = 0;
             this.HasCamera = false;
             this.HasXYZSet = false;
             this.HasPerspectiveSet = false;
             break;
         case SLCameraPresetValues.IsometricLeftDown:
             this.CameraPreset = A.PresetCameraValues.IsometricLeftDown;
             this.decX = 45;
             this.decY = 35;
             this.decZ = 0;
             this.decPerspective = 0;
             this.HasCamera = true;
             this.HasXYZSet = false;
             this.HasPerspectiveSet = false;
             break;
         case SLCameraPresetValues.IsometricRightUp:
             this.CameraPreset = A.PresetCameraValues.IsometricRightUp;
             this.decX = 315;
             this.decY = 35;
             this.decZ = 0;
             this.decPerspective = 0;
             this.HasCamera = true;
             this.HasXYZSet = false;
             this.HasPerspectiveSet = false;
             break;
         case SLCameraPresetValues.IsometricTopUp:
             this.CameraPreset = A.PresetCameraValues.IsometricTopUp;
             this.decX = 314.7m;
             this.decY = 324.6m;
             this.decZ = 60.2m;
             this.decPerspective = 0;
             this.HasCamera = true;
             this.HasXYZSet = false;
             this.HasPerspectiveSet = false;
             break;
         case SLCameraPresetValues.IsometricBottomDown:
             this.CameraPreset = A.PresetCameraValues.IsometricBottomDown;
             this.decX = 314.7m;
             this.decY = 35.39999999999999m;
             this.decZ = 299.8m;
             this.decPerspective = 0;
             this.HasCamera = true;
             this.HasXYZSet = false;
             this.HasPerspectiveSet = false;
             break;
         case SLCameraPresetValues.OffAxis1Left:
             this.CameraPreset = A.PresetCameraValues.IsometricOffAxis1Left;
             this.decX = 64m;
             this.decY = 18m;
             this.decZ = 0;
             this.decPerspective = 0;
             this.HasCamera = true;
             this.HasXYZSet = false;
             this.HasPerspectiveSet = false;
             break;
         case SLCameraPresetValues.OffAxis1Right:
             this.CameraPreset = A.PresetCameraValues.IsometricOffAxis1Right;
             this.decX = 334m;
             this.decY = 18m;
             this.decZ = 0;
             this.decPerspective = 0;
             this.HasCamera = true;
             this.HasXYZSet = false;
             this.HasPerspectiveSet = false;
             break;
         case SLCameraPresetValues.OffAxis1Top:
             this.CameraPreset = A.PresetCameraValues.IsometricOffAxis1Top;
             this.decX = 306.5m;
             this.decY = 301.3m;
             this.decZ = 57.6m;
             this.decPerspective = 0;
             this.HasCamera = true;
             this.HasXYZSet = false;
             this.HasPerspectiveSet = false;
             break;
         case SLCameraPresetValues.OffAxis2Left:
             this.CameraPreset = A.PresetCameraValues.IsometricOffAxis2Left;
             this.decX = 26m;
             this.decY = 18m;
             this.decZ = 0m;
             this.decPerspective = 0;
             this.HasCamera = true;
             this.HasXYZSet = false;
             this.HasPerspectiveSet = false;
             break;
         case SLCameraPresetValues.OffAxis2Right:
             this.CameraPreset = A.PresetCameraValues.IsometricOffAxis2Right;
             this.decX = 296m;
             this.decY = 18m;
             this.decZ = 0m;
             this.decPerspective = 0;
             this.HasCamera = true;
             this.HasXYZSet = false;
             this.HasPerspectiveSet = false;
             break;
         case SLCameraPresetValues.OffAxis2Top:
             this.CameraPreset = A.PresetCameraValues.IsometricOffAxis2Top;
             this.decX = 53.49999999999999m;
             this.decY = 301.3m;
             this.decZ = 302.4m;
             this.decPerspective = 0;
             this.HasCamera = true;
             this.HasXYZSet = false;
             this.HasPerspectiveSet = false;
             break;
         case SLCameraPresetValues.PerspectiveFront:
             this.CameraPreset = A.PresetCameraValues.PerspectiveFront;
             this.decX = 0m;
             this.decY = 0m;
             this.decZ = 0m;
             this.decPerspective = 45m;
             this.HasCamera = true;
             this.HasXYZSet = false;
             this.HasPerspectiveSet = false;
             break;
         case SLCameraPresetValues.PerspectiveLeft:
             this.CameraPreset = A.PresetCameraValues.PerspectiveLeft;
             this.decX = 20m;
             this.decY = 0m;
             this.decZ = 0m;
             this.decPerspective = 45m;
             this.HasCamera = true;
             this.HasXYZSet = false;
             this.HasPerspectiveSet = false;
             break;
         case SLCameraPresetValues.PerspectiveRight:
             this.CameraPreset = A.PresetCameraValues.PerspectiveRight;
             this.decX = 340m;
             this.decY = 0m;
             this.decZ = 0m;
             this.decPerspective = 45m;
             this.HasCamera = true;
             this.HasXYZSet = false;
             this.HasPerspectiveSet = false;
             break;
         case SLCameraPresetValues.PerspectiveBelow:
             this.CameraPreset = A.PresetCameraValues.PerspectiveBelow;
             this.decX = 0m;
             this.decY = 20m;
             this.decZ = 0m;
             this.decPerspective = 45m;
             this.HasCamera = true;
             this.HasXYZSet = false;
             this.HasPerspectiveSet = false;
             break;
         case SLCameraPresetValues.PerspectiveAbove:
             this.CameraPreset = A.PresetCameraValues.PerspectiveAbove;
             this.decX = 0m;
             this.decY = 340m;
             this.decZ = 0m;
             this.decPerspective = 45m;
             this.HasCamera = true;
             this.HasXYZSet = false;
             this.HasPerspectiveSet = false;
             break;
         case SLCameraPresetValues.PerspectiveRelaxedModerately:
             this.CameraPreset = A.PresetCameraValues.PerspectiveRelaxedModerately;
             this.decX = 0m;
             this.decY = 324.8m;
             this.decZ = 0m;
             this.decPerspective = 45m;
             this.HasCamera = true;
             this.HasXYZSet = false;
             this.HasPerspectiveSet = false;
             break;
         case SLCameraPresetValues.PerspectiveRelaxed:
             this.CameraPreset = A.PresetCameraValues.PerspectiveRelaxed;
             this.decX = 0m;
             this.decY = 309.6m;
             this.decZ = 0m;
             this.decPerspective = 45m;
             this.HasCamera = true;
             this.HasXYZSet = false;
             this.HasPerspectiveSet = false;
             break;
         case SLCameraPresetValues.PerspectiveContrastingLeft:
             this.CameraPreset = A.PresetCameraValues.PerspectiveContrastingLeftFacing;
             this.decX = 43.89999999999999m;
             this.decY = 10.4m;
             this.decZ = 356.4m;
             this.decPerspective = 45m;
             this.HasCamera = true;
             this.HasXYZSet = false;
             this.HasPerspectiveSet = false;
             break;
         case SLCameraPresetValues.PerspectiveContrastingRight:
             this.CameraPreset = A.PresetCameraValues.PerspectiveContrastingRightFacing;
             this.decX = 316.1m;
             this.decY = 10.4m;
             this.decZ = 3.6m;
             this.decPerspective = 45m;
             this.HasCamera = true;
             this.HasXYZSet = false;
             this.HasPerspectiveSet = false;
             break;
         case SLCameraPresetValues.PerspectiveHeroicExtremeLeft:
             this.CameraPreset = A.PresetCameraValues.PerspectiveHeroicExtremeLeftFacing;
             this.decX = 34.49999999999999m;
             this.decY = 8.1m;
             this.decZ = 357.1m;
             this.decPerspective = 80m;
             this.HasCamera = true;
             this.HasXYZSet = false;
             this.HasPerspectiveSet = false;
             break;
         case SLCameraPresetValues.PerspectiveHeroicExtremeRight:
             this.CameraPreset = A.PresetCameraValues.PerspectiveHeroicExtremeRightFacing;
             this.decX = 325.5m;
             this.decY = 8.1m;
             this.decZ = 2.9m;
             this.decPerspective = 80m;
             this.HasCamera = true;
             this.HasXYZSet = false;
             this.HasPerspectiveSet = false;
             break;
         case SLCameraPresetValues.ObliqueTopLeft:
             this.CameraPreset = A.PresetCameraValues.ObliqueTopLeft;
             this.decX = 0m;
             this.decY = 0m;
             this.decZ = 0m;
             this.decPerspective = 0m;
             this.HasCamera = true;
             this.HasXYZSet = false;
             this.HasPerspectiveSet = false;
             break;
         case SLCameraPresetValues.ObliqueTopRight:
             this.CameraPreset = A.PresetCameraValues.ObliqueTopRight;
             this.decX = 0m;
             this.decY = 0m;
             this.decZ = 0m;
             this.decPerspective = 0m;
             this.HasCamera = true;
             this.HasXYZSet = false;
             this.HasPerspectiveSet = false;
             break;
         case SLCameraPresetValues.ObliqueBottomLeft:
             this.CameraPreset = A.PresetCameraValues.ObliqueBottomLeft;
             this.decX = 0m;
             this.decY = 0m;
             this.decZ = 0m;
             this.decPerspective = 0m;
             this.HasCamera = true;
             this.HasXYZSet = false;
             this.HasPerspectiveSet = false;
             break;
         case SLCameraPresetValues.ObliqueBottomRight:
             this.CameraPreset = A.PresetCameraValues.ObliqueBottomRight;
             this.decX = 0m;
             this.decY = 0m;
             this.decZ = 0m;
             this.decPerspective = 0m;
             this.HasCamera = true;
             this.HasXYZSet = false;
             this.HasPerspectiveSet = false;
             break;
     }
 }
Example #5
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);
        }