public static void Transform (string source_path, string destination_path, TransformType transform) { string error_message; if (! f_transform_jpeg (source_path, destination_path, transform, out error_message)) throw new Exception (error_message); }
public override void LoadData( ComponentData componentData ) { ModelBoneControllerData data = componentData as ModelBoneControllerData; if ( data != null ) { m_boneName = data.BoneName; m_transformType = data.TransformType; m_speed = data.Speed; } }
public static Vector3 WorldToLocal( this Transform tf, Vector3 v3, TransformType type = TransformType.Point ) { if( type == TransformType.Point ) return tf.InverseTransformPoint( v3 ); else if( type == TransformType.Direction ) return tf.InverseTransformDirection( v3 ); else return tf.InverseTransformVector( v3 ); }
public override void Import(ClientEffect importObject, IEnumerable<FieldInfo> getters) { base.Import(importObject, getters); if (importObject.reserved[7] != null) this.type = (TransformType)Enum.Parse(typeof(TransformType), importObject.reserved[7].Trim(), true); this.model = Utility.ClientNpcIndex[importObject.reserved[8].Trim()]; }
public static Vector2D CalculateTransform(TransformState state, TransformType type) { var blobs = state.Blobs; var pBlobs = state.PBlobs; if (pBlobs.Count() != blobs.Count()) { return new Vector2D(); } var value = new Vector2D(); var pValue = new Vector2D(); var delta = new Vector2D(); switch (type) { case TransformType.Scale: if (blobs.Count() < 2) { Debug.WriteLine("[WARNING] Scale state have less than 2 fingers"); return new Vector2D(); } value.x = value.y = VMath.Dist(blobs.First().Position, blobs.Last().Position); pValue.x = pValue.y = VMath.Dist(pBlobs.First().Position, pBlobs.Last().Position); delta = value - pValue; //Debug.WriteLine(blobs.Count()); break; case TransformType.Rotate: if (blobs.Count() < 2) { //Debug.WriteLine("[WARNING] Rotate state have less than 2 fingers"); return new Vector2D(); } value.x = value.y = FindAngle(blobs.First(), blobs.Last()); pValue.x = pValue.y = FindAngle(pBlobs.First(), pBlobs.Last()); delta.x = delta.y = SubtractCycles(value.x, pValue.x); break; case TransformType.Translate: value = FindCentroid(blobs); pValue = FindCentroid(pBlobs); delta = value - pValue; break; } //TODO:Check if Min Max needed //if (Math.Abs(delta.x) > 0.1 || Math.Abs(delta.y) > 0.1) delta = new Vector2D(); return delta; //return delta.LinearEasing(pDelta); }
/// <summary> /// Initializes an instance of a CoordinateTransformation /// </summary> /// <param name="sourceCS">Source coordinate system</param> /// <param name="targetCS">Target coordinate system</param> /// <param name="transformType">Transformation type</param> /// <param name="mathTransform">Math transform</param> /// <param name="name">Name of transform</param> /// <param name="authority">Authority</param> /// <param name="authorityCode">Authority code</param> /// <param name="areaOfUse">Area of use</param> /// <param name="remarks">Remarks</param> internal CoordinateTransformation(ICoordinateSystem sourceCS, ICoordinateSystem targetCS, TransformType transformType, IMathTransform mathTransform, string name, string authority, long authorityCode, string areaOfUse, string remarks) : base() { _TargetCS = targetCS; _SourceCS = sourceCS; _TransformType = transformType; _MathTransform = mathTransform; _Name = name; _Authority = authority; _AuthorityCode = authorityCode; _AreaOfUse = areaOfUse; _Remarks = remarks; }
/// <summary> /// Initializes a new instance of the VerticalDatum class. /// </summary> /// <param name="transformType">The type of transform.</param> /// <param name="targetCS">The target coordinate system.</param> /// <param name="sourceCS">The source coordinate system.</param> /// <param name="mathTransform">The object that actually does the transformation.</param> /// <param name="authorityCode">The authority code.</param> /// <param name="authority">The authority.</param> /// <param name="name">The name of the transform.</param> /// <param name="areaOfUse">The area of use.</param> /// <param name="remarks">Remarks about this transformation.</param> /// <param name="abbreviation">The abbreviation for this transformation.</param> public CoordinateTransformation( TransformType transformType, ICoordinateSystem targetCS, ICoordinateSystem sourceCS, IMathTransform mathTransform, string authorityCode, string authority, string name, string areaOfUse, string remarks, string abbreviation) : base(remarks, authority, authorityCode, name, "", "") { _transformType = transformType; _targetCS = targetCS; _mathTransform = mathTransform; _areaOfUse = areaOfUse; _sourceCS = sourceCS; _abbreviation = abbreviation; _authority=authority; _authorityCode=authorityCode; _remarks = remarks; _alias=""; _name=name; }
public static Transform CreateFromType( TransformType type, float value ) { Transform result = new Transform(); switch ( type ) { case TransformType.RotationX: result.Rotation = Matrix.CreateRotationX( value ); break; case TransformType.RotationY: result.Rotation = Matrix.CreateRotationY( value ); break; case TransformType.RotationZ: result.Rotation = Matrix.CreateRotationZ( value ); break; case TransformType.TranslationX: result.Position = new Vector3(value, 0, 0); break; case TransformType.TranslationY: result.Position = new Vector3(0, value, 0); break; case TransformType.TranslationZ: result.Position = new Vector3(0, 0, value); break; case TransformType.ScaleX: result.Scale = new Vector3( value, 1, 1 ); break; case TransformType.ScaleY: result.Scale = new Vector3( 1, value, 1 ); break; case TransformType.ScaleZ: result.Scale = new Vector3( 1, 1, value ); break; } return result; }
/// <summary> /// Initializes a new instance of the <see cref="AsyncCreateXSD"/> class. /// </summary> /// <param name="isi">The isi.</param> /// <param name="SQLServer"></param> /// <param name="DBName"></param> /// <param name="UID"></param> /// <param name="PWD"></param> /// <param name="SQLfile"></param> /// <param name="Translate"></param> /// <param name="Primary"></param> public AsyncTransformSQL(ISynchronizeInvoke isi, string inputFileName, string outputFileName, TransformType type) : base(isi) { // populate private vars _inputFileName = inputFileName; _outputFileName = outputFileName; _type = type; }
/// <summary> /// Applies the specified transform, adds it to the specified transform stack /// </summary> public abstract void SetTransform( TransformType type, Point3 translation, Vector3 xAxis, Vector3 yAxis, Vector3 zAxis );
/// <summary> /// Scales the current transform in the specified transform stack /// </summary> public abstract void Scale( TransformType type, float scaleX, float scaleY, float scaleZ );
public Transform GetTransform(TransformType type) { return(Transforms.FirstOrDefault(x => x.Type == type)); }
/// <summary> /// Add the xdt:Locator attribute to the given element when necessary. /// Will use the Match(attribute) option instead of a Condition when possible. /// </summary> private XmlAttribute AddLocator(XmlNode parent, XNode element, Trait trait, bool addAttribute, TransformType transform) { if (trait != null) { if (trait.Attribute != null) { var attribute = trait.Attribute; if (attribute.Match == MatchType.Match) { if (addAttribute) { CopyAttribute(attribute, parent); } return(AddAttribute(parent, XdtPrefix, XdtLocator, XdtNamespace, string.Format(XdtMatch, attribute.XmlNode.Name))); } if ((transform != TransformType.SetAttributes && transform != TransformType.RemoveAttributes && transform != TransformType.RemoveAndSetAttributes) || !HasChildChanges(element)) { return(AddAttribute(parent, XdtPrefix, XdtLocator, XdtNamespace, string.Format(XdtCondition, BuildPredicate(attribute.XmlNode)))); } } return(AddAttribute(parent, XdtPrefix, XdtLocator, XdtNamespace, string.Format(XdtCondition, trait.Index))); } return(null); }
private Point TransformWorkAreaScreenArea(Point pt, TransformType transformType) { int deltaX = 0; int deltaY = 0; Point retPt; if (!_inTrustedSubWindow) { SecurityHelper.DemandUIWindowPermission(); } // First we get the monitor on which the window is on. [Get/Set]WindowPlacement // co-ods are dependent on the monitor on which the window is on. IntPtr hMonitor = SafeNativeMethods.MonitorFromWindow(new HandleRef(this, CriticalHandle), NativeMethods.MONITOR_DEFAULTTONULL); if (hMonitor != IntPtr.Zero) { NativeMethods.MONITORINFOEX monitorInfo = new NativeMethods.MONITORINFOEX(); monitorInfo.cbSize = Marshal.SizeOf(typeof(NativeMethods.MONITORINFOEX)); SafeNativeMethods.GetMonitorInfo(new HandleRef(this, hMonitor), monitorInfo); NativeMethods.RECT workAreaRect = monitorInfo.rcWork; NativeMethods.RECT screenAreaRect = monitorInfo.rcMonitor; deltaX = workAreaRect.left - screenAreaRect.left; deltaY = workAreaRect.top - screenAreaRect.top; } if (transformType == TransformType.WorkAreaToScreenArea) { retPt = new Point(pt.X + deltaX, pt.Y + deltaY); } else { retPt = new Point(pt.X - deltaX, pt.Y - deltaY); } return retPt; }
public void Move(Marker _marker, MoveMethod _moveMethod, float _transitionTime, AnimationCurve _timeCurve) { if (GetComponent <Rigidbody>() && !GetComponent <Rigidbody>().isKinematic) { GetComponent <Rigidbody>().velocity = GetComponent <Rigidbody>().angularVelocity = Vector3.zero; } StopCoroutine ("_UpdateMovement"); transformType = TransformType.CopyMarker; if (_transitionTime == 0f) { isMoving = false; transform.localPosition = _marker.transform.localPosition; transform.localEulerAngles = _marker.transform.localEulerAngles; transform.localScale = _marker.transform.localScale; } else { isMoving = true; doEulerRotation = false; moveMethod = _moveMethod; startPosition = transform.localPosition; startRotation = transform.localRotation; startScale = transform.localScale; endPosition = _marker.transform.localPosition; endRotation = _marker.transform.localRotation; endScale = _marker.transform.localScale; moveChangeTime = _transitionTime; moveStartTime = Time.time; if (moveMethod == MoveMethod.CustomCurve) { timeCurve = _timeCurve; } else { timeCurve = null; } StartCoroutine ("_UpdateMovement"); } }
Color GetColor(TransformType type, Color normalColor, Color nearColor, bool forceUseNormal = false) { return(GetColor(type, normalColor, nearColor, false, 1, forceUseNormal)); }
public Spring(Transform transform, TransformType modifier) { m_transform = transform; Modifier = modifier; RefreshTransformType(); }
IEnumerator TransformSelected(TransformType type) { isTransforming = true; totalScaleAmount = 0; totalRotationAmount = Quaternion.identity; Vector3 originalPivot = pivotPoint; Vector3 planeNormal = (transform.position - originalPivot).normalized; Vector3 axis = GetNearAxisDirection(); Vector3 projectedAxis = Vector3.ProjectOnPlane(axis, planeNormal).normalized; Vector3 previousMousePosition = Vector3.zero; List <ICommand> transformCommands = new List <ICommand>(); for (int i = 0; i < targetRootsOrdered.Count; i++) { transformCommands.Add(new TransformCommand(this, targetRootsOrdered[i])); } while (!Input.GetMouseButtonUp(0)) { Ray mouseRay = myCamera.ScreenPointToRay(Input.mousePosition); Vector3 mousePosition = Geometry.LinePlaneIntersect(mouseRay.origin, mouseRay.direction, originalPivot, planeNormal); if (previousMousePosition != Vector3.zero && mousePosition != Vector3.zero) { if (type == TransformType.Move) { float moveAmount = ExtVector3.MagnitudeInDirection(mousePosition - previousMousePosition, projectedAxis) * moveSpeedMultiplier; Vector3 movement = axis * moveAmount; for (int i = 0; i < targetRootsOrdered.Count; i++) { Transform target = targetRootsOrdered[i]; target.Translate(movement, Space.World); } SetPivotPointOffset(movement); } else if (type == TransformType.Scale) { Vector3 projected = (nearAxis == Axis.Any) ? transform.right : projectedAxis; float scaleAmount = ExtVector3.MagnitudeInDirection(mousePosition - previousMousePosition, projected) * scaleSpeedMultiplier; //WARNING - There is a bug in unity 5.4 and 5.5 that causes InverseTransformDirection to be affected by scale which will break negative scaling. Not tested, but updating to 5.4.2 should fix it - https://issuetracker.unity3d.com/issues/transformdirection-and-inversetransformdirection-operations-are-affected-by-scale Vector3 localAxis = (space == TransformSpace.Local && nearAxis != Axis.Any) ? mainTargetRoot.InverseTransformDirection(axis) : axis; Vector3 targetScaleAmount = Vector3.one; if (nearAxis == Axis.Any) { targetScaleAmount = (ExtVector3.Abs(mainTargetRoot.localScale.normalized) * scaleAmount); } else { targetScaleAmount = localAxis * scaleAmount; } for (int i = 0; i < targetRootsOrdered.Count; i++) { Transform target = targetRootsOrdered[i]; Vector3 targetScale = target.localScale + targetScaleAmount; if (pivot == TransformPivot.Pivot) { target.localScale = targetScale; } else if (pivot == TransformPivot.Center) { if (scaleType == ScaleType.FromPoint) { target.SetScaleFrom(originalPivot, targetScale); } else if (scaleType == ScaleType.FromPointOffset) { target.SetScaleFromOffset(originalPivot, targetScale); } } } totalScaleAmount += scaleAmount; } else if (type == TransformType.Rotate) { float rotateAmount = 0; Vector3 rotationAxis = axis; if (nearAxis == Axis.Any) { Vector3 rotation = transform.TransformDirection(new Vector3(Input.GetAxis("Mouse Y"), -Input.GetAxis("Mouse X"), 0)); Quaternion.Euler(rotation).ToAngleAxis(out rotateAmount, out rotationAxis); rotateAmount *= allRotateSpeedMultiplier; } else { Vector3 projected = (nearAxis == Axis.Any || ExtVector3.IsParallel(axis, planeNormal)) ? planeNormal : Vector3.Cross(axis, planeNormal); rotateAmount = (ExtVector3.MagnitudeInDirection(mousePosition - previousMousePosition, projected) * rotateSpeedMultiplier) / GetDistanceMultiplier(); } for (int i = 0; i < targetRootsOrdered.Count; i++) { Transform target = targetRootsOrdered[i]; if (pivot == TransformPivot.Pivot) { target.Rotate(rotationAxis, rotateAmount, Space.World); } else if (pivot == TransformPivot.Center) { target.RotateAround(originalPivot, rotationAxis, rotateAmount); } } totalRotationAmount *= Quaternion.Euler(rotationAxis * rotateAmount); } } previousMousePosition = mousePosition; yield return(null); } for (int i = 0; i < transformCommands.Count; i++) { ((TransformCommand)transformCommands[i]).StoreNewTransformValues(); } CommandGroup commandGroup = new CommandGroup(); commandGroup.Set(transformCommands); UndoRedoManager.Insert(commandGroup); totalRotationAmount = Quaternion.identity; totalScaleAmount = 0; isTransforming = false; SetPivotPoint(); }
void SetSpaceAndType() { if (Input.GetKey(ActionKey)) { return; } if (Input.GetKeyDown(SetMoveType)) { type = TransformType.Move; } else if (Input.GetKeyDown(SetRotateType)) { type = TransformType.Rotate; } else if (Input.GetKeyDown(SetScaleType)) { type = TransformType.Scale; } if (Input.GetKeyDown(SetPivotModeToggle)) { if (pivot == TransformPivot.Pivot) { pivot = TransformPivot.Center; } else if (pivot == TransformPivot.Center) { pivot = TransformPivot.Pivot; } SetPivotPoint(); } if (Input.GetKeyDown(SetCenterTypeToggle)) { if (centerType == CenterType.All) { centerType = CenterType.Solo; } else if (centerType == CenterType.Solo) { centerType = CenterType.All; } SetPivotPoint(); } if (Input.GetKeyDown(SetSpaceToggle)) { if (space == TransformSpace.Global) { space = TransformSpace.Local; } else if (space == TransformSpace.Local) { space = TransformSpace.Global; } } if (Input.GetKeyDown(SetScaleTypeToggle)) { if (scaleType == ScaleType.FromPoint) { scaleType = ScaleType.FromPointOffset; } else if (scaleType == ScaleType.FromPointOffset) { scaleType = ScaleType.FromPoint; } } if (type == TransformType.Scale) { space = TransformSpace.Local; //Only support local scale if (pivot == TransformPivot.Pivot) { scaleType = ScaleType.FromPoint; //FromPointOffset can be inaccurate and should only really be used in Center mode if desired. } } }
public Transform(TransformType type, double value) => (Type, Value) = (type, value);
private void DoTransformFile(string inFile, TransformType aType, string newFileName, string alternativeDirectory) { ICryptoTransform transform = null; FileInfo info = new FileInfo(inFile); string initVector = this.InitVector; int num = 0x100; byte[] bytes = Encoding.ASCII.GetBytes(initVector); byte[] rgbSalt = Encoding.ASCII.GetBytes(this.SaltValue); string strHashName = "SHA1"; if ((this.HashType == DCHashTypes._SHA1)) { strHashName = "SHA1"; } if ((this.HashType == DCHashTypes._SHA256)) { strHashName = "SHA256"; } if ((this.HashType == DCHashTypes._SHA384)) { strHashName = "SHA384"; } if ((this.HashType == DCHashTypes._SHA512)) { strHashName = "SHA512"; } byte[] rgbKey = new PasswordDeriveBytes(this.PassPhrase, rgbSalt, strHashName, this.PassPhraseStrength).GetBytes((num / 8)); RijndaelManaged managed = new RijndaelManaged(); managed.Mode = CipherMode.CBC; if ((aType == TransformType._encrypt)) { transform = managed.CreateEncryptor(rgbKey, bytes); } else { transform = managed.CreateDecryptor(rgbKey, bytes); } string path = ""; if ((newFileName == null)) { if ((aType == TransformType._encrypt)) { path = (inFile.Substring(0, inFile.LastIndexOf(".")) + "." + this.FileEncryptExtension); } else { path = (inFile.Substring(0, inFile.LastIndexOf(".")) + "." + this.FileDecryptExtension); } } if (((newFileName != null))) { if (((alternativeDirectory != null))) { DirectoryInfo info2 = new DirectoryInfo(alternativeDirectory); path = (alternativeDirectory + newFileName); } else { FileInfo info3 = new FileInfo(inFile); path = (info3.DirectoryName + "\\" + newFileName); if ((path.LastIndexOf(".") < 1)) { if ((aType == TransformType._encrypt)) { path = (path + "." + this.FileEncryptExtension); } else { path = (path + "." + this.FileDecryptExtension); } } } } FileStream stream = new FileStream(path, FileMode.Create); using (CryptoStream stream2 = new CryptoStream(stream, transform, CryptoStreamMode.Write)) { int count = 0; int num3 = 0; int num4 = (managed.BlockSize / 8); byte[] buffer = new byte[num4]; int num5 = 0; using (FileStream stream3 = new FileStream(inFile, FileMode.Open)) { do { count = stream3.Read(buffer, 0, num4); num3 = (num3 + count); stream2.Write(buffer, 0, count); num5 = (num5 + num4); } while ((count > 0)); stream2.FlushFinalBlock(); stream2.Close(); stream3.Close(); } stream.Close(); } }
public TweenDefinition(float startSpeed, TransformType type) : this() { StartSpeed = startSpeed; Type = type; }
override public void ShowGUI(List <ActionParameter> parameters) { isPlayer = EditorGUILayout.Toggle("Move Player?", isPlayer); if (!isPlayer) { parameterID = Action.ChooseParameterGUI("Moveable object:", parameters, parameterID, ParameterType.GameObject); if (parameterID >= 0) { constantID = 0; linkedProp = null; } else { linkedProp = (Moveable)EditorGUILayout.ObjectField("Moveable object:", linkedProp, typeof(Moveable), true); constantID = FieldToID <Moveable> (linkedProp, constantID); linkedProp = IDToField <Moveable> (linkedProp, constantID, false); } } EditorGUILayout.BeginHorizontal(); transformType = (TransformType)EditorGUILayout.EnumPopup(transformType); if (transformType != TransformType.CopyMarker) { toBy = (ToBy)EditorGUILayout.EnumPopup(toBy); } EditorGUILayout.EndHorizontal(); if (transformType == TransformType.CopyMarker) { markerParameterID = Action.ChooseParameterGUI("Marker:", parameters, markerParameterID, ParameterType.GameObject); if (markerParameterID >= 0) { markerID = 0; marker = null; } else { marker = (Marker)EditorGUILayout.ObjectField("Marker:", marker, typeof(Marker), true); markerID = FieldToID <Marker> (marker, markerID); marker = IDToField <Marker> (marker, markerID, false); } } else { setVectorMethod = (SetVectorMethod)EditorGUILayout.EnumPopup("Vector is: ", setVectorMethod); if (setVectorMethod == SetVectorMethod.EnteredHere) { newVectorParameterID = Action.ChooseParameterGUI("Value:", parameters, newVectorParameterID, ParameterType.Vector3); if (newVectorParameterID < 0) { newVector = EditorGUILayout.Vector3Field("Value:", newVector); } } else if (setVectorMethod == SetVectorMethod.FromVector3Variable) { variableLocation = (VariableLocation)EditorGUILayout.EnumPopup("Source:", variableLocation); switch (variableLocation) { case VariableLocation.Global: vectorVarParameterID = Action.ChooseParameterGUI("Vector3 variable:", parameters, vectorVarParameterID, ParameterType.GlobalVariable); if (vectorVarParameterID < 0) { vectorVarID = AdvGame.GlobalVariableGUI("Vector3 variable:", vectorVarID, VariableType.Vector3); } break; case VariableLocation.Local: if (!isAssetFile) { vectorVarParameterID = Action.ChooseParameterGUI("Vector3 variable:", parameters, vectorVarParameterID, ParameterType.LocalVariable); if (vectorVarParameterID < 0) { vectorVarID = AdvGame.LocalVariableGUI("Vector3 variable:", vectorVarID, VariableType.Vector3); } } else { EditorGUILayout.HelpBox("Local variables cannot be accessed in ActionList assets.", MessageType.Info); } break; case VariableLocation.Component: vectorVarParameterID = Action.ChooseParameterGUI("Vector3 variable:", parameters, vectorVarParameterID, ParameterType.ComponentVariable); if (vectorVarParameterID >= 0) { variables = null; variablesConstantID = 0; } else { variables = (Variables)EditorGUILayout.ObjectField("Component:", variables, typeof(Variables), true); variablesConstantID = FieldToID <Variables> (variables, variablesConstantID); variables = IDToField <Variables> (variables, variablesConstantID, false); if (variables != null) { vectorVarID = AdvGame.ComponentVariableGUI("Vector3 variable:", vectorVarID, VariableType.Vector3, variables); } } break; } } clearExisting = EditorGUILayout.Toggle("Stop existing transforms?", clearExisting); } if (transformType == TransformType.CopyMarker || (transformType == TransformType.Translate && toBy == ToBy.To) || (transformType == TransformType.Rotate && toBy == ToBy.To)) { inWorldSpace = EditorGUILayout.Toggle("Act in world-space?", inWorldSpace); if (inWorldSpace && transformType == TransformType.CopyMarker) { EditorGUILayout.HelpBox("The moveable object's scale will be changed in local space.", MessageType.Info); } } transitionTimeParameterID = Action.ChooseParameterGUI("Transition time (s):", parameters, transitionTimeParameterID, ParameterType.Float); if (transitionTimeParameterID < 0) { transitionTime = EditorGUILayout.FloatField("Transition time (s):", transitionTime); } if (transitionTime > 0f) { if (transformType == TransformType.Rotate) { doEulerRotation = EditorGUILayout.Toggle("Euler rotation?", doEulerRotation); } moveMethod = (MoveMethod)EditorGUILayout.EnumPopup("Move method:", moveMethod); if (moveMethod == MoveMethod.CustomCurve) { timeCurve = EditorGUILayout.CurveField("Time curve:", timeCurve); } willWait = EditorGUILayout.Toggle("Wait until finish?", willWait); } AfterRunningOption(); }
static extern bool f_transform_jpeg (string source_path, string destination_path, TransformType transform, out string error_message_return);
Color GetColor(TransformType type, Color normalColor, Color nearColor, float alpha, bool forceUseNormal = false) { return(GetColor(type, normalColor, nearColor, true, alpha, forceUseNormal)); }
private static byte [] TransformKey(byte [] key, byte [] iv, SecureString securePassword, TransformType t) { //Вычисляет хэш SHA256 для входных данных, используя управляемую библиотеку. using (var sha265 = new SHA256Managed()) { using (var rijAlg = new RijndaelManaged()) { rijAlg.KeySize = 256; var str_pwd = securePassword.GetAsString(); var bytes = Encoding.UTF8.GetBytes(str_pwd); str_pwd = string.Empty; rijAlg.Key = sha265.ComputeHash(bytes); Array.Clear(bytes, 0, bytes.Length); rijAlg.IV = iv; using (var destStream = new MemoryStream()) { using (var sourceStream = new MemoryStream(key)) { switch (t) { case TransformType.Encrypt: Encrypt(rijAlg.CreateEncryptor(), sourceStream, destStream); break; case TransformType.Decrypt: Decrypt(rijAlg.CreateDecryptor(), sourceStream, destStream); break; default: break; } } return(destStream.ToArray()); } } } }
public Spring (Transform transform, TransformType modifier) { m_transform = transform; Modifier = modifier; RefreshTransformType (); }
public bool TransformTypeContains(TransformType type) { return(TransformTypeContains(transformType, type)); }
private void SignObject(XmlDocument doc, object rps) { XmlNodeList nodes = doc.GetElementsByTagName("Signature"); if (nodes.Count > 0) { SignatureType sign = new SignatureType(); //Grupo: Signature->SignedInfo sign.SignedInfo = new SignedInfoType(); sign.SignedInfo.CanonicalizationMethod = new CanonicalizationMethodType(); sign.SignedInfo.CanonicalizationMethod.Algorithm = doc.GetElementsByTagName("CanonicalizationMethod")[0].Attributes[0].Value; // Tag: CanonicalizationMethod sign.SignedInfo.SignatureMethod = new SignatureMethodType(); sign.SignedInfo.SignatureMethod.Algorithm = doc.GetElementsByTagName("SignatureMethod")[0].Attributes[0].Value; // Tag: SignatureMethod // Grupo: Signature->SignedInfo->Reference sign.SignedInfo.Reference = new ReferenceType[1]; ReferenceType teste = new ReferenceType(); teste.URI = doc.GetElementsByTagName("Reference")[0].Attributes[0].Value; teste.DigestMethod = new DigestMethodType(); teste.DigestMethod.Algorithm = doc.GetElementsByTagName("DigestMethod")[0].Attributes[0].Value; teste.DigestValue = GetBytes(doc.GetElementsByTagName("DigestValue")[0].InnerText); sign.SignedInfo.Reference[0] = teste; // Grupo: Signature->SignedInfo->Reference->Transforms XmlNodeList transforms = doc.GetElementsByTagName("Transform"); sign.SignedInfo.Reference[0].Transforms = new TransformType[transforms.Count]; int run = 0; foreach (XmlNode item in transforms) { TransformType qq = new TransformType(); qq.Algorithm = item.Attributes[0].Value; sign.SignedInfo.Reference[0].Transforms[run] = qq; run += 1; } //Tag: Signature->SignatureValue sign.SignatureValue = new SignatureValueType(); sign.SignatureValue.Value = GetBytes(doc.GetElementsByTagName("SignatureValue")[0].InnerText); //Grupo: Signature->KeyInfo sign.KeyInfo = new KeyInfoType(); X509DataType x509 = new X509DataType(); x509.Items = new object[1]; x509.Items[0] = GetBytes(doc.GetElementsByTagName("X509Certificate")[0].InnerText); x509.ItemsElementName = new ItemsChoiceType[1] { ItemsChoiceType.X509Certificate }; sign.KeyInfo.Items = new object[1]; sign.KeyInfo.Items[0] = x509; sign.KeyInfo.ItemsElementName = new ItemsChoiceType2[1] { ItemsChoiceType2.X509Data }; SetProperty(rps, "Signature", sign); } }
public bool TranslatingTypeContains(TransformType type, bool checkIsTransforming = true) { TransformType transType = !checkIsTransforming || isTransforming ? translatingType : transformType; return(TransformTypeContains(transType, type)); }
private void AddTransformCurve(float time, TransformType transType, IReadOnlyList <float> curveValues, IReadOnlyList <float> inSlopeValues, IReadOnlyList <float> outSlopeValues, int offset, string path) { switch (transType) { case TransformType.Translation: { Vector3Curve curve = new Vector3Curve(path); if (!m_translations.TryGetValue(curve, out List <KeyframeTpl <Vector3f> > transCurve)) { transCurve = new List <KeyframeTpl <Vector3f> >(); m_translations.Add(curve, transCurve); } float x = curveValues[offset + 0]; float y = curveValues[offset + 1]; float z = curveValues[offset + 2]; float inX = inSlopeValues[0]; float inY = inSlopeValues[1]; float inZ = inSlopeValues[2]; float outX = outSlopeValues[0]; float outY = outSlopeValues[1]; float outZ = outSlopeValues[2]; Vector3f value = new Vector3f(x, y, z); Vector3f inSlope = new Vector3f(inX, inY, inZ); Vector3f outSlope = new Vector3f(outX, outY, outZ); KeyframeTpl <Vector3f> transKey = new KeyframeTpl <Vector3f>(time, value, inSlope, outSlope, KeyframeTpl <Vector3f> .DefaultVector3Weight); transCurve.Add(transKey); } break; case TransformType.Rotation: { QuaternionCurve curve = new QuaternionCurve(path); if (!m_rotations.TryGetValue(curve, out List <KeyframeTpl <Quaternionf> > rotCurve)) { rotCurve = new List <KeyframeTpl <Quaternionf> >(); m_rotations.Add(curve, rotCurve); } float x = curveValues[offset + 0]; float y = curveValues[offset + 1]; float z = curveValues[offset + 2]; float w = curveValues[offset + 3]; float inX = inSlopeValues[0]; float inY = inSlopeValues[1]; float inZ = inSlopeValues[2]; float inW = inSlopeValues[3]; float outX = outSlopeValues[0]; float outY = outSlopeValues[1]; float outZ = outSlopeValues[2]; float outW = outSlopeValues[3]; Quaternionf value = new Quaternionf(x, y, z, w); Quaternionf inSlope = new Quaternionf(inX, inY, inZ, inW); Quaternionf outSlope = new Quaternionf(outX, outY, outZ, outW); KeyframeTpl <Quaternionf> rotKey = new KeyframeTpl <Quaternionf>(time, value, inSlope, outSlope, KeyframeTpl <Quaternionf> .DefaultQuaternionWeight); rotCurve.Add(rotKey); } break; case TransformType.Scaling: { Vector3Curve curve = new Vector3Curve(path); if (!m_scales.TryGetValue(curve, out List <KeyframeTpl <Vector3f> > scaleCurve)) { scaleCurve = new List <KeyframeTpl <Vector3f> >(); m_scales.Add(curve, scaleCurve); } float x = curveValues[offset + 0]; float y = curveValues[offset + 1]; float z = curveValues[offset + 2]; float inX = inSlopeValues[0]; float inY = inSlopeValues[1]; float inZ = inSlopeValues[2]; float outX = outSlopeValues[0]; float outY = outSlopeValues[1]; float outZ = outSlopeValues[2]; Vector3f value = new Vector3f(x, y, z); Vector3f inSlope = new Vector3f(inX, inY, inZ); Vector3f outSlope = new Vector3f(outX, outY, outZ); KeyframeTpl <Vector3f> scaleKey = new KeyframeTpl <Vector3f>(time, value, inSlope, outSlope, KeyframeTpl <Vector3f> .DefaultVector3Weight); scaleCurve.Add(scaleKey); } break; case TransformType.EulerRotation: { Vector3Curve curve = new Vector3Curve(path); if (!m_eulers.TryGetValue(curve, out List <KeyframeTpl <Vector3f> > eulerCurve)) { eulerCurve = new List <KeyframeTpl <Vector3f> >(); m_eulers.Add(curve, eulerCurve); } float x = curveValues[offset + 0]; float y = curveValues[offset + 1]; float z = curveValues[offset + 2]; float inX = inSlopeValues[0]; float inY = inSlopeValues[1]; float inZ = inSlopeValues[2]; float outX = outSlopeValues[0]; float outY = outSlopeValues[1]; float outZ = outSlopeValues[2]; Vector3f value = new Vector3f(x, y, z); Vector3f inSlope = new Vector3f(inX, inY, inZ); Vector3f outSlope = new Vector3f(outX, outY, outZ); KeyframeTpl <Vector3f> eulerKey = new KeyframeTpl <Vector3f>(time, value, inSlope, outSlope, KeyframeTpl <Vector3f> .DefaultVector3Weight); eulerCurve.Add(eulerKey); } break; default: throw new NotImplementedException(transType.ToString()); } }
public bool TransformTypeContains(TransformType mainType, TransformType type) { return(ExtTransformType.TransformTypeContains(mainType, type, GetProperTransformSpace())); }
/// <summary> /// Rotates the current transform around a given axis /// </summary> public abstract void RotateAroundAxis( TransformType type, Vector3 axis, float angleInRadians );
IEnumerator TransformSelected(TransformType transType) { isTransforming = true; totalScaleAmount = 0; totalRotationAmount = Quaternion.identity; Vector3 originalPivot = pivotPoint; Vector3 axis = GetNearAxisDirection(out Vector3 otherAxis1, out Vector3 otherAxis2); Vector3 planeNormal = hasTranslatingAxisPlane ? axis : (transform.position - originalPivot).normalized; Vector3 projectedAxis = Vector3.ProjectOnPlane(axis, planeNormal).normalized; Vector3 previousMousePosition = Vector3.zero; Vector3 currentSnapMovementAmount = Vector3.zero; while (!Input.GetMouseButtonUp(0)) { Ray mouseRay = myCamera.ScreenPointToRay(Input.mousePosition); Vector3 mousePosition = Geometry.LinePlaneIntersect(mouseRay.origin, mouseRay.direction, originalPivot, planeNormal); if (previousMousePosition != Vector3.zero && mousePosition != Vector3.zero) { if (transType == TransformType.Move) { Vector3 movement; if (hasTranslatingAxisPlane) { movement = mousePosition - previousMousePosition; } else { float moveAmount = ExtVector3.MagnitudeInDirection(mousePosition - previousMousePosition, projectedAxis) * moveSpeedMultiplier; movement = axis * moveAmount; } Vector3 movementPerSecond = movement / Time.deltaTime; movementPerSecond = movementPerSecond.normalized * Mathf.Min(movementPerSecond.magnitude, maxMovePerSecond); movement = movementPerSecond * Time.deltaTime; for (int i = 0; i < targetRootsOrdered.Count; i++) { Transform target = targetRootsOrdered[i]; target.Translate(movement, Space.World); } SetPivotPointOffset(movement); } } previousMousePosition = mousePosition; yield return(null); } totalRotationAmount = Quaternion.identity; totalScaleAmount = 0; isTransforming = false; SetTranslatingAxis(transformType, Axis.None); SetPivotPoint(); }
/// <summary> /// Applies the specified transform, adds it to the specified transform stack /// </summary> public abstract void SetTransform( TransformType type, InvariantMatrix44 matrix );
public void SetTranslatingAxis(TransformType type, Axis axis, Axis planeAxis = Axis.None) { this.translatingType = type; this.nearAxis = axis; this.planeAxis = planeAxis; }
/// <summary> /// Translates the current transform in the specified transform stack /// </summary> public abstract void Translate( TransformType type, float x, float y, float z );
/// <summary> /// Creates a snapshot of the current transform that is immune to changes /// The scale stored will always be the local scale to prevent strange effects with /// lossy scale <see cref="Transform.lossyScale"/> /// </summary> /// <param name="transform">The transform the snapshot should be taken from</param> /// <param name="type">Type of the transform that is processed from the transform. This can either be local or world. /// This value is important once the SimpleTransofrm is applied to a transform to set the right values.</param> /// <returns>A simple transform that holds the information of the given type of the transform</returns> public static SimpleTransform GetSimpleTransform(this Transform transform, TransformType type) { return(new SimpleTransform(transform, type)); }
public AsyncTransformHTML(ISynchronizeInvoke isi, string inputFileName, string outputFileName, TransformType type, string customXSLT) : base(isi) { // populate private vars _inputFileName = inputFileName; _outputFileName = outputFileName; _type = type; _customXSLT = customXSLT; }
/***************************************************************** * Transform one form to anoter based on CryptoTransform * It is used to encrypt to decrypt as well as decrypt to encrypt * Parameters: input [byte array] - which needs to be transform * transformType - encrypt/decrypt transform * * Return Val: byte array - transformed value. ***************************************************************/ private byte[] Transform(byte[] input, TransformType transformType) { CryptoStream cryptoStream = null; // Stream used to encrypt RijndaelManaged rijndael = null; // Rijndael provider ICryptoTransform rijndaelTransform = null; // Encrypting object FileStream fsIn = null; //input file FileStream fsOut = null; //output file MemoryStream memStream = null; // Stream to contain data try { // Create the crypto objects rijndael = new RijndaelManaged(); rijndael.Key = this._Key; rijndael.IV = this._IV; if (transformType == TransformType.ENCRYPT) { rijndaelTransform = rijndael.CreateEncryptor(); } else { rijndaelTransform = rijndael.CreateDecryptor(); } if ((input != null) && (input.Length > 0)) { memStream = new MemoryStream(); cryptoStream = new CryptoStream( memStream, rijndaelTransform, CryptoStreamMode.Write); cryptoStream.Write(input, 0, input.Length); cryptoStream.FlushFinalBlock(); return(memStream.ToArray()); } else if ((_inputFile.Length > 0) && (_outputFile.Length > 0)) { // First we are going to open the file streams fsIn = new FileStream(_inputFile, FileMode.Open, FileAccess.Read); fsOut = new FileStream(_outputFile, FileMode.OpenOrCreate, FileAccess.Write); cryptoStream = new CryptoStream( fsOut, rijndaelTransform, CryptoStreamMode.Write); // Now will will initialize a buffer and will be // processing the input file in chunks. // This is done to avoid reading the whole file (which can be // huge) into memory. int bufferLen = 4096; byte[] buffer = new byte[bufferLen]; int bytesRead; do { // read a chunk of data from the input file bytesRead = fsIn.Read(buffer, 0, bufferLen); // Encrypt it cryptoStream.Write(buffer, 0, bytesRead); } while (bytesRead != 0); cryptoStream.FlushFinalBlock(); } return(null); } catch (CryptographicException) { throw new CryptographicException("Password is invalid. Please verify once again."); } finally { if (rijndael != null) { rijndael.Clear(); } if (rijndaelTransform != null) { rijndaelTransform.Dispose(); } if (cryptoStream != null) { cryptoStream.Close(); } if (memStream != null) { memStream.Close(); } if (fsOut != null) { fsOut.Close(); } if (fsIn != null) { fsIn.Close(); } } }
// -------------------------------------------------------------------------------------------------------------- // Transform_ArgList // ------------------------------------------------------------------------------------------------------------- public int Transform_ArgList(string szXmlFile, TransformType transformType, DocType docType) { // Default value of errorCase is false return(Transform_ArgList(szXmlFile, false, transformType, docType)); }
// -------------------------------------------------------------------------------------------------------------- // TransformResolver // ------------------------------------------------------------------------------------------------------------- public int TransformResolver(string szXmlFile, TransformType transformType, DocType docType, XmlResolver xr) { // Default value of errorCase is false return(TransformResolver(szXmlFile, xr, false, transformType, docType)); }
public void Init(object objParam) { // Get input and transform type from attribute _nInput = GetInputType(String.Empty); _nTransform = GetTransformType(String.Empty); // Get parameter info from runtime variables passed to LTM _fTrace = (InitStringValue("trace").ToUpper() == "TRUE"); _docType = GetDocType(InitStringValue("doctype")); _readerType = GetReaderType(InitStringValue("readertype")); // FullFilePath and FullHttpPath attempt to normalize file paths, however // as an extra step we can normalize them here, when they are first read // from the LTM file. _strPath = Path.Combine(@"TestFiles\", FilePathUtil.GetTestDataPath(), @"XsltApi\"); _httpPath = FilePathUtil.GetHttpTestDataPath() + @"/XsltApi/"; return; }
public int TransformResolver(string szXmlFile, XmlResolver xr, bool errorCase, TransformType transformType, DocType docType) { lock (s_outFileMemoryLock) { szXmlFile = FullFilePath(szXmlFile); _output.WriteLine("Loading XML {0}", szXmlFile); IXPathNavigable xd = LoadXML(szXmlFile, docType); _output.WriteLine("Executing transform"); xrXSLT = null; Stream strmTemp = null; switch (transformType) { case TransformType.Reader: xrXSLT = xslt.Transform(xd, null, xr); using (FileStream outFile = new FileStream(_strOutFile, FileMode.Create, FileAccess.ReadWrite)) using (XmlWriter writer = XmlWriter.Create(outFile)) { writer.WriteNode(xrXSLT, true); } if (errorCase) { try { while (xrXSLT.Read()) { } } catch (Exception ex) { throw (ex); } finally { if (xrXSLT != null) { xrXSLT.Dispose(); } } } break; case TransformType.Stream: try { strmTemp = new FileStream(_strOutFile, FileMode.Create, FileAccess.ReadWrite); xslt.Transform(xd, null, strmTemp, xr); } catch (Exception ex) { throw (ex); } finally { if (strmTemp != null) { strmTemp.Dispose(); } } break; case TransformType.Writer: XmlWriter xw = null; try { xw = new XmlTextWriter(_strOutFile, Encoding.UTF8); xw.WriteStartDocument(); xslt.Transform(xd, null, xw, xr); } catch (Exception ex) { throw (ex); } finally { if (xw != null) { xw.Dispose(); } } break; case TransformType.TextWriter: TextWriter tw = null; try { using (FileStream outFile = new FileStream(_strOutFile, FileMode.Create, FileAccess.Write)) { tw = new StreamWriter(outFile, Encoding.UTF8); xslt.Transform(xd, null, tw, xr); } } catch (Exception ex) { throw (ex); } break; } return(1); } }
void DoTransform(ref double from, float phi, TransformType type, float var1, float var2, float var3, float var4) { switch (type) { case TransformType.None: // No Transform break; case TransformType.Logarithmic: // Logarithmic = Var1 * e^(Var2 * Theta) from *= var1 * Math.Exp(var2 * phi); break; case TransformType.Trigonometric: // Trigonometric = Var1 * cos (Var2 * Theta) + Var3 * sin (Var4 * Theta) from *= var1 * Math.Cos(var2 * phi) + var3 * Math.Sin(var4 * phi); break; case TransformType.TransferFunction: // Transfer Function = (Var1 + Var2 * Theta)/(Var3 + Var4 * Theta) from *= (var1 + (var2 * phi)) / (var3 + (var4 * phi)); break; case TransformType.Polynomial: // Polynomial = Var1 + Var2 * Theta + Var3 * Theta^2 + Var4 * Theta^3 + ... from *= var1 + (var2 * phi) + (var3 * Math.Pow(phi, 2.0f)) + (var4 * Math.Pow(phi, 3.0f)); // TODO: add the reset of the formula break; } }
//------------------------------------------------------------------------------------------------------------ IEnumerator COLerp(TransformType transformType, Easing.Type easingType, Transform myTransform, Vector2 start, Vector2 end, float duration, bool isLocal, float delay, Action callback) { float currentLerpTime = 0; float perc = 0; float progress = 0; WaitForSeconds wait = new WaitForSeconds(delay); yield return(wait); while (currentLerpTime <= duration) { currentLerpTime += Time.deltaTime; if (currentLerpTime > duration) { currentLerpTime = duration; break; } perc = currentLerpTime / duration; progress = Easing.GetEasingFunction(easingType, perc); switch (transformType) { case TransformType.Position: { if (isLocal) { myTransform.localPosition = Vector2.Lerp(start, end, progress); } else { myTransform.position = Vector2.Lerp(start, end, progress); } } break; case TransformType.Rotation: { if (isLocal) { myTransform.localEulerAngles = Vector2.Lerp(start, end, progress); } else { myTransform.eulerAngles = Vector2.Lerp(start, end, progress); } } break; case TransformType.Scale: { myTransform.localScale = Vector2.Lerp(start, end, progress); } break; } yield return(null); } if (callback != null) { callback(); } }
public AbstractTransformEffect() { this.type = TransformType.NONE; }
//------------------------------------------------------------------------------------------------------------ /// <summary> /// Lerp Vector2 /// </summary> /// <param name="transformType">Position, Rotation, Scale</param> /// <param name="easingType">Make lerping more realistic by picking the right easing function</param> /// <param name="myTransform">Target transform</param> /// <param name="startPos">Vector2 Start Position</param> /// <param name="endPos">Vector2 End Position</param> /// <param name="duration">Lerp Time</param> /// <param name="isLocal">If you would like to lerp in local position, use true.</param> /// <param name="delay">Delay before function start</param> /// <param name="callback">Action call at the end of function</param> public void Lerp(TransformType transformType, Easing.Type easingType, Transform myTransform, Vector2 startPos, Vector2 endPos, float duration, bool isLocal, float delay, Action callback) { StartCoroutine(COLerp(transformType, easingType, myTransform, startPos, endPos, duration, isLocal, delay, callback)); }
public virtual void ParseJson(JSONNode json) { //Debug.LogError("PARSE BASE"); Type = EnumParsing.TryParse<TransformType>(json["type"]); PlayOnAwake = json["play_on_awake"].AsBool; IsLocal = json["is_local"].AsBool; IsDependent = json["is_dependent"].AsBool; var vector3 = json["target"].GetVector3(); if (vector3 != null) { Target = (Vector3) vector3; } Time = json["time"].AsFloat; Ease = EnumParsing.TryParse<Ease>(json["ease"]); IsLoop = json["is_loop"].AsBool; Loops = json["loops"].AsInt; LoopType = EnumParsing.TryParse<LoopType>(json["loop_type"]); }
public TransformChangedEventArgs(IDrawable targetModel, TransformType type) { this.TargetModel = targetModel; this.Type = type; }
public void Move(Vector3 _newVector, MoveMethod _moveMethod, float _transitionTime, TransformType _transformType, bool _doEulerRotation, AnimationCurve _timeCurve) { StopCoroutine ("_UpdateMovement"); if (GetComponent <Rigidbody>() && !GetComponent <Rigidbody>().isKinematic) { GetComponent <Rigidbody>().velocity = GetComponent <Rigidbody>().angularVelocity = Vector3.zero; } if (_transitionTime == 0f) { isMoving = false; if (_transformType == TransformType.Translate) { transform.localPosition = _newVector; } else if (_transformType == TransformType.Rotate) { transform.localEulerAngles = _newVector; } else if (_transformType == TransformType.Scale) { transform.localScale = _newVector; } } else { isMoving = true; doEulerRotation = _doEulerRotation; moveMethod = _moveMethod; transformType = _transformType; startPosition = endPosition = transform.localPosition; startEulerRotation = endEulerRotation = transform.localEulerAngles; startRotation = endRotation = transform.localRotation; startScale = endScale = transform.localScale; if (_transformType == TransformType.Translate) { endPosition = _newVector; } else if (_transformType == TransformType.Rotate) { endRotation = Quaternion.Euler (_newVector); endEulerRotation = _newVector; } else if (_transformType == TransformType.Scale) { endScale = _newVector; } moveChangeTime = _transitionTime; moveStartTime = Time.time; if (moveMethod == MoveMethod.CustomCurve) { timeCurve = _timeCurve; } else { timeCurve = null; } StartCoroutine ("_UpdateMovement"); } }
public void Transform(TransformType type) { switch (type) { #region Swap Rows in the same group. case TransformType.SwapRows: { int sourceRow = randGenerator.Next(1, 3); int sourceGroup = randGenerator.Next(0, 2); int destinationRow = randGenerator.Next(-2, 2); int newRowIndex = sourceRow + destinationRow; //Ensure there will be a swap in the group while (sourceRow == newRowIndex || newRowIndex < 1 || newRowIndex > 3) { if (sourceRow == newRowIndex) { destinationRow = randGenerator.Next(-2, 2); } if (sourceRow + destinationRow > 3) { destinationRow--; } else if (sourceRow + destinationRow < 1) { destinationRow++; } newRowIndex = sourceRow + destinationRow; } //Transform values to array indexer-friendly values. sourceRow = sourceRow + SudokuGroupDimension * sourceGroup - 1; newRowIndex = newRowIndex + SudokuGroupDimension * sourceGroup - 1; SwapRows(sourceRow, newRowIndex); break; } #endregion #region Swap whole groups. case TransformType.SwapGroups: { int sourceGroup = randGenerator.Next(1, 3); int destinationGroup = randGenerator.Next(-2, 2); int newGroupIndex = sourceGroup + destinationGroup; //Ensure there will be a swap within grid limits while (sourceGroup == newGroupIndex || newGroupIndex < 1 || newGroupIndex > 3) { if (destinationGroup == 0) { destinationGroup = randGenerator.Next(-2, 2); } if (sourceGroup + destinationGroup > 3) { destinationGroup--; } else if (sourceGroup + destinationGroup < 1) { destinationGroup++; } newGroupIndex = sourceGroup + destinationGroup; } //Transform values to array indexer-friendly values. sourceGroup--; newGroupIndex--; for (int row = 0; row < SudokuGroupDimension; row++) { SwapRows(row + SudokuGroupDimension * sourceGroup, row + SudokuGroupDimension * newGroupIndex); } break; } #endregion #region Transpose whole grid across left-right diagonal. case TransformType.Transpose: { Transpose(); break; } #endregion } }
public void RefreshTransformType () { switch (Modifier) { case TransformType.Position: State = m_transform.localPosition; m_transformFunction = new TransformDelegate (Position); break; case TransformType.Rotation: State = m_transform.localEulerAngles; m_transformFunction = new TransformDelegate (Rotation); break; case TransformType.Scale: State = m_transform.localScale; m_transformFunction = new TransformDelegate (Scale); break; case TransformType.PositionAdditive: State = m_transform.localPosition; m_transformFunction = new TransformDelegate (PositionAdditive); break; case TransformType.RotationAdditive: State = m_transform.localEulerAngles; m_transformFunction = new TransformDelegate (RotationAdditive); break; case TransformType.ScaleAdditive: State = m_transform.localScale; m_transformFunction = new TransformDelegate (ScaleAdditive); break; } m_currentTransformType = Modifier; RestState = State; }
/// <summary> /// Sets the rendering transform (<see cref="IRenderer.SetTransform(TransformType,InvariantMatrix44)"/>) /// </summary> public static void SetRenderTransform( TransformType transformType, UniTransform transform ) { IUniCamera curCam = Current; float x = ( float )Units.Convert.UniToRender( transform.Position.X - curCam.Position.X ); float y = ( float )Units.Convert.UniToRender( transform.Position.Y - curCam.Position.Y ); float z = ( float )Units.Convert.UniToRender( transform.Position.Z - curCam.Position.Z ); Graphics.Renderer.SetTransform( transformType, new Point3( x, y, z ), transform.XAxis, transform.YAxis, transform.ZAxis ); }
public TweenDefinition(float startSpeed, TransformType type) : this() { StartSpeed = startSpeed; Type = type; }
private void TransformEditorBase_DataContextChanged(object sender, DependencyPropertyChangedEventArgs e) { Microsoft.Windows.Design.PropertyEditing.PropertyValue propertyValue = this.DataContext as Microsoft.Windows.Design.PropertyEditing.PropertyValue; SceneNodeProperty sceneNodeProperty = (SceneNodeProperty)null; if (propertyValue != null) { sceneNodeProperty = (SceneNodeProperty)propertyValue.ParentProperty; } if (sceneNodeProperty == this.TransformProperty) { return; } this.Unhook(); this.TransformProperty = sceneNodeProperty; if (this.TransformProperty == null) { return; } this.TransformProperty.PropertyReferenceChanged += new Microsoft.Expression.DesignSurface.Documents.PropertyReferenceChangedEventHandler(this.transformProperty_PropertyReferenceChanged); this.designerContext = this.TransformProperty.SceneNodeObjectSet.DesignerContext; TransformType transformType = TransformType.Transform2D; if (PlatformTypes.Transform3D.IsAssignableFrom((ITypeId)this.TransformProperty.PropertyTypeId)) { transformType = TransformType.Transform3D; } else if (PlatformTypes.Transform.IsAssignableFrom((ITypeId)this.TransformProperty.PropertyTypeId)) { transformType = TransformType.Transform2D; } else if (PlatformTypes.Projection.IsAssignableFrom((ITypeId)this.TransformProperty.PropertyTypeId)) { transformType = TransformType.PlaneProjection; } else { IType type = this.TransformProperty.SceneNodeObjectSet.ProjectContext.GetType(this.TransformProperty.GetValue().GetType()); if (PlatformTypes.Transform3D.IsAssignableFrom((ITypeId)type)) { transformType = TransformType.Transform3D; } else if (PlatformTypes.Transform.IsAssignableFrom((ITypeId)type)) { transformType = TransformType.Transform2D; } else if (PlatformTypes.Projection.IsAssignableFrom((ITypeId)type)) { transformType = TransformType.PlaneProjection; } } this.ObjectSet = this.TransformProperty.SceneNodeObjectSet; this.PropertyLookup = new TransformPropertyLookup(this.TransformProperty, transformType); this.ComponentType = this.PropertyLookup.CreateDefaultRelativeTransform().GetType(); this.Initialize(); foreach (FrameworkElement frameworkElement in (IEnumerable)this.TabCollection) { frameworkElement.DataContext = (object)this; } this.UpdateModel(); }
/// <summary> /// Pushes a rendering transform /// </summary> public static void PushRenderTransform( TransformType transformType, UniTransform transform ) { Graphics.Renderer.PushTransform( transformType ); SetRenderTransform( transformType, transform ); }
override public void ShowGUI(List <ActionParameter> parameters) { parameterID = Action.ChooseParameterGUI("Moveable object:", parameters, parameterID, ParameterType.GameObject); if (parameterID >= 0) { constantID = 0; linkedProp = null; } else { linkedProp = (Moveable)EditorGUILayout.ObjectField("Moveable object:", linkedProp, typeof(Moveable), true); constantID = FieldToID <Moveable> (linkedProp, constantID); linkedProp = IDToField <Moveable> (linkedProp, constantID, false); } EditorGUILayout.BeginHorizontal(); transformType = (TransformType)EditorGUILayout.EnumPopup(transformType); if (transformType != TransformType.CopyMarker) { toBy = (ToBy)EditorGUILayout.EnumPopup(toBy); } EditorGUILayout.EndHorizontal(); if (transformType == TransformType.CopyMarker) { markerParameterID = Action.ChooseParameterGUI("Marker:", parameters, markerParameterID, ParameterType.GameObject); if (markerParameterID >= 0) { markerID = 0; marker = null; } else { marker = (Marker)EditorGUILayout.ObjectField("Marker:", marker, typeof(Marker), true); markerID = FieldToID <Marker> (marker, markerID); marker = IDToField <Marker> (marker, markerID, false); } } else { newVector = EditorGUILayout.Vector3Field("Vector:", newVector); clearExisting = EditorGUILayout.Toggle("Stop existing transforms?", clearExisting); } transitionTimeParameterID = Action.ChooseParameterGUI("Transition time (s):", parameters, transitionTimeParameterID, ParameterType.Float); if (transitionTimeParameterID < 0) { transitionTime = EditorGUILayout.Slider("Transition time (s):", transitionTime, 0, 10f); } if (transitionTime > 0f) { if (transformType == TransformType.Rotate) { doEulerRotation = EditorGUILayout.Toggle("Euler rotation?", doEulerRotation); } moveMethod = (MoveMethod)EditorGUILayout.EnumPopup("Move method:", moveMethod); if (moveMethod == MoveMethod.CustomCurve) { timeCurve = EditorGUILayout.CurveField("Time curve:", timeCurve); } willWait = EditorGUILayout.Toggle("Wait until finish?", willWait); } AfterRunningOption(); }
public override void ShowGUI(List<ActionParameter> parameters) { parameterID = Action.ChooseParameterGUI ("Moveable object:", parameters, parameterID, ParameterType.GameObject); if (parameterID >= 0) { constantID = 0; linkedProp = null; } else { linkedProp = (Moveable) EditorGUILayout.ObjectField ("Moveable object:", linkedProp, typeof (Moveable), true); constantID = FieldToID <Moveable> (linkedProp, constantID); linkedProp = IDToField <Moveable> (linkedProp, constantID, false); } EditorGUILayout.BeginHorizontal (); transformType = (TransformType) EditorGUILayout.EnumPopup (transformType); if (transformType != TransformType.CopyMarker) { toBy = (ToBy) EditorGUILayout.EnumPopup (toBy); } EditorGUILayout.EndHorizontal (); if (transformType == TransformType.CopyMarker) { markerParameterID = Action.ChooseParameterGUI ("Marker:", parameters, markerParameterID, ParameterType.GameObject); if (markerParameterID >= 0) { markerID = 0; marker = null; } else { marker = (Marker) EditorGUILayout.ObjectField ("Marker:", marker, typeof (Marker), true); markerID = FieldToID <Marker> (marker, markerID); marker = IDToField <Marker> (marker, markerID, false); } } else { newVector = EditorGUILayout.Vector3Field ("Vector:", newVector); } transitionTime = EditorGUILayout.Slider ("Transition time:", transitionTime, 0, 10f); if (transitionTime > 0f) { if (transformType == TransformType.Rotate) { doEulerRotation = EditorGUILayout.Toggle ("Euler rotation?", doEulerRotation); } moveMethod = (MoveMethod) EditorGUILayout.EnumPopup ("Move method", moveMethod); if (moveMethod == MoveMethod.CustomCurve) { timeCurve = EditorGUILayout.CurveField ("Time curve:", timeCurve); } willWait = EditorGUILayout.Toggle ("Wait until finish?", willWait); } AfterRunningOption (); }
/// <summary> /// Initializes an instance of a CoordinateTransformation /// </summary> /// <param name="sourceCS">Source coordinate system</param> /// <param name="targetCS">Target coordinate system</param> /// <param name="transformType">Transformation type</param> /// <param name="mathTransform">Math transform</param> /// <param name="name">Name of transform</param> /// <param name="authority">Authority</param> /// <param name="authorityCode">Authority code</param> /// <param name="areaOfUse">Area of use</param> /// <param name="remarks">Remarks</param> internal CoordinateTransformation(ICoordinateSystem sourceCS, ICoordinateSystem targetCS, TransformType transformType, IMathTransform mathTransform, string name, string authority, long authorityCode, string areaOfUse, string remarks) : base() { _TargetCS = targetCS; _SourceCS = sourceCS; _TransformType = transformType; _MathTransform = mathTransform; _Name = name; _Authority = authority; _AuthorityCode = authorityCode; _AreaOfUse = areaOfUse; _Remarks = remarks; }