public void Add(TransformedImage image) { if (!selection.Contains(image)) { selection.Add(image); } }
public override void LocationTransform(int[] imagekey, TransformedImage image, out Vector3 pos, ref Quaternion rot, ref Vector3 scl) { float x = (float)imagekey[idx[0]]; float z = (float)imagekey[idx[1]]; pos = new Vector3(x * 2.1f, y[(imagekey[idx[0]] + arguments[idx[0]].values.Length * imagekey[idx[1]]) % 1024], z * 2.1f); }
private void DoMoveImage(TransformedImage image, Vector3 deltapos) { image.Position += deltapos; image.skipPosAnimation(); if (image.Selected) { SelectionMoved(); } }
public void OnAddTransform(int[] imagekey, TransformedImage img) { if (transformAabb.IncludeAndCheckChanged(GetImageBounds(imagekey, img))) { foreach (TransformedImage updateImage in updateImageSet) { updateImage.ComputeLocation(); } } }
public override void RenderImage(int[] imagekey, TransformedImage image, ImageCloud.FreeView freeview) { float x = (float)imagekey[idx[0]]; float z = (float)imagekey[idx[1]]; Matrix4 worldmatrix = Matrix4.CreateScale(x * 2.1f, y[(imagekey[idx[0]] + arguments[idx[0]].values.Length * imagekey[idx[1]]) % 1024], z * 2.1f); Common.sdrSolidColor.Bind(worldmatrix * freeview.viewprojmatrix); meshValueLine.Bind(Common.sdrSolidColor, null); meshValueLine.Draw(); }
public void ApplyHaarTransform(bool Forward, bool Safe, int iterations) { decimal[][,] temp = Forward ? OriginalImage.DeepClone() : TransformedImage.DeepClone(); //int Iterations = 0; //int.TryParse(sIterations, out Iterations); decimal[,] Red = temp[0]; decimal[,] Green = temp[1]; decimal[,] Blue = temp[2]; int maxScale = (int)(Math.Log(Red.GetLength(0) < Red.GetLength(1) ? Red.GetLength(0) : Red.GetLength(1)) / Math.Log(2)); if (iterations < 1 || iterations > maxScale) { MessageBox.Show("Iteration must be Integer from 1 to " + maxScale); return; } int time = Environment.TickCount; if (Forward) { DwtF(Red, iterations); DwtF(Green, iterations); DwtF(Blue, iterations); } else { IDwtF(Red, iterations); IDwtF(Green, iterations); IDwtF(Blue, iterations); } if (Forward) { TransformedImage = temp.DeepClone(); } else { OriginalImage = temp.DeepClone(); } string transformationTime = ((int)(Environment.TickCount - time)).ToString() + " milis."; }
public override void OnImageMouseDown(MouseButtons button, TransformedImage image, Vector2 uv, out bool enableDrag) { enableDrag = false; if (button != MouseButtons.Left || image.Selected == true) { return; } int timeidx = Array.IndexOf(image.args[0].values, image.values[0]); int selection_timeidx; if (Viewer.selection.Count == 0) { selection_timeidx = -1; } else { IEnumerator <TransformedImage> selection_enum = Viewer.selection.GetEnumerator(); selection_enum.MoveNext(); selection_timeidx = Array.IndexOf(selection_enum.Current.args[0].values, selection_enum.Current.values[0]); } if (timeidx == expandedTimeIdx) { Select(image); if (selection_timeidx != expandedTimeIdx) { ExecuteISQL(string.Format("focus WHERE #time == {0}", timeidx)); } SetOption(Option.ViewRotationCenter, new Vector3((float)timeidx * 3.0f + 5.0f, 0.0f, 0.0f)); } else { SetOption(Option.ViewControl, ImageCloud.ViewControl.CoordinateSystemCentric); ExecuteISQL(string.Format("select WHERE #time == {0}", timeidx)); FocusSelection(); } }
public override void OnImageMouseDown(MouseButtons button, TransformedImage image, Vector2 uv, out bool enableDrag) { if (button == MouseButtons.Left) { enableDrag = true; if (!Viewer.selection.Contains(image)) { if (InputDevices.kbstate.IsKeyDown(OpenTK.Input.Key.LWin)) { AddToSelection(image); } else { Select(image); } } } else { enableDrag = false; } }
public override void OnImageDoubleClick(TransformedImage image) { int timeidx = Array.IndexOf(image.args[0].values, image.values[0]); if (timeidx == expandedTimeIdx) { expandedTimeIdx = -1; SetOption(Option.ViewControl, ImageCloud.ViewControl.CoordinateSystemCentric); ExecuteISQL(string.Format("clear all")); ExecuteISQL(string.Format("x all BY #time * 3.0f")); ExecuteISQL(string.Format("look all BY pi - $theta * pi / 180.0f, pi / 2.0f - $phi * pi / 180.0f")); ExecuteISQL(string.Format("select WHERE #time == {0}", timeidx)); FocusSelection(); } else { expandedTimeIdx = timeidx; ExecuteISQL(string.Format("clear all")); ExecuteISQL(string.Format("x BY #time * 3.0f WHERE #time < {0}", timeidx)); ExecuteISQL(string.Format("x BY #time * 3.0f + 5.0f WHERE #time == {0}", timeidx)); ExecuteISQL(string.Format("x BY #time * 3.0f + 10.0f WHERE #time > {0}", timeidx)); FocusSelection(); SetOption(Option.ViewRotationCenter, new Vector3((float)timeidx * 3.0f + 5.0f, 0.0f, 0.0f)); //SetOption(Option.ViewControl, ImageCloud.ViewControl.PointCentric); ExecuteISQL(string.Format("thetaPhi BY pi - $theta * pi / 180.0f, pi / 2.0f - $phi * pi / 180.0f, 5.0f WHERE #time == {0}", timeidx)); FocusSelection(); Select(image); } }
public virtual void OnImageMouseDown(MouseButtons button, TransformedImage image, Vector2 uv, out bool enableDrag) { enableDrag = false; }
public override void OnImageMouseDown(MouseButtons button, TransformedImage image, Vector2 uv, out bool enableDrag) { if(button == MouseButtons.Left) { enableDrag = true; if(!Viewer.selection.Contains(image)) { if(InputDevices.kbstate.IsKeyDown(OpenTK.Input.Key.LWin)) AddToSelection(image); else Select(image); } } else enableDrag = false; }
public override void OnImageDoubleClick(TransformedImage image) { //ClearSelection(); //MoveIntoView(image); }
private void OnImageSaved(TransformedImage sender) { Hide(sender); System.Console.WriteLine(string.Format("{0} of {1} done", imageIdx++, Viewer.images.Count)); }
public void Show(TransformedImage image) { ActionManager.Do(ShowImageAction, image); }
protected void Focus(TransformedImage image, bool animate = true) { imageCloud.FocusSingle(image, animate); }
public void Hide(TransformedImage image) { ActionManager.Do(HideImageAction, image); }
public void RemoveImage(TransformedImage image) { texstream.RemoveImage(image); }
public void AddImage(TransformedImage image) { texstream.AddImage(image); }
public void MoveIntoView(TransformedImage image) { float tanY = (float)Math.Tan(FOV_Y / 2.0f), tanX = tanY * aspectRatio; Vector3 pos = Vector3.Transform(new Vector3(0.0f, 0.0f, -Math.Max(0.5f / tanY, 0.5f * image.FirstLayer.originalAspectRatio / tanX)), freeview.viewmatrix.Inverted()); image.Position = pos; if(image.Selected) SelectionMoved(); }
public void FocusSingle(TransformedImage image, bool animate) { AABB imageBounds; if(viewControl == ViewControl.TwoDimensional) { imageBounds = image.GetBounds().Clone(); imageBounds.min.Z = imageBounds.max.Z = (imageBounds.min.Z + imageBounds.max.Z) / 2.0f; } else imageBounds = image.GetBounds(); if(imageBounds.max.X >= imageBounds.min.X) { FocusAABB(imageBounds, animate); Status("Focus images"); } }
public void DoubleClick(object sender, Point mousepos) { Viewer.RequestInputProcessing(); Matrix4 invvieworient = freeview.viewmatrix; invvieworient.M41 = invvieworient.M42 = invvieworient.M43 = 0.0f; invvieworient.Transpose(); Vector3 vnear = new Vector3(mouseDownPos.X, mouseDownPos.Y, 0.0f); Vector3 vfar = new Vector3(vnear.X, vnear.Y, 1.0f); Matrix4 invviewprojmatrix = freeview.viewprojmatrix.Inverted(); vnear = Vector3.TransformPerspective(vnear, invviewprojmatrix); vfar = Vector3.TransformPerspective(vfar, invviewprojmatrix); Vector3 vdir = (vfar - vnear).Normalized(); float dist, closest_dist = float.MaxValue; Vector2 uv, closest_uv; TransformedImage closest_image = default(TransformedImage); foreach(TransformedImage image in images.Values) if(image != null && (dist = image.CastRay(vnear, vdir, invvieworient, out uv)) < closest_dist) { closest_dist = dist; closest_uv = uv; closest_image = image; } if(closest_dist < float.MaxValue) { dragImage = mouseDownImage = closest_image; dragImageOffset = closest_image.Position - (vnear + vdir * closest_dist); // dragImagePlane = plane parallel to screen, going through point of intersection Vector3 vsnear = Vector3.TransformPerspective(new Vector3(0.0f, 0.0f, 0.0f), invviewprojmatrix); Vector3 vsfar = Vector3.TransformPerspective(new Vector3(0.0f, 0.0f, 1.0f), invviewprojmatrix); Vector3 vsdir = (vsfar - vsnear).Normalized(); dragImagePlane = new Plane(vnear + vdir * closest_dist, vsdir); Viewer.browser.OnImageDoubleClick(closest_image); } }
public virtual void OnImageDoubleClick(TransformedImage image) { }
protected void Select(TransformedImage image) { Viewer.selection.Clear(); Viewer.selection.Add(image); SelectionChanged(); }
public void Move(TransformedImage image, Vector3 deltapos) { ActionManager.Do(MoveImageAction, image, deltapos); }
public override bool SkipImage(int[] imagekey, TransformedImage image) { return(true); }
public void MoveIntoView(TransformedImage image) { imageCloud.MoveIntoView(image); }
public void MouseUp(object sender, System.Windows.Forms.MouseEventArgs e) { if(!glcontrol.Focused) return; #if USE_ARG_IDX mouseDownInsideArgIndex = false; if(argIndex.Visible && argIndex.MouseUp(Size, e)) return; #endif #if USE_PARAM_IDX mouseDownInsideParamIndex = false; if(paramIndex.Visible && paramIndex.MouseUp(Size, e)) return; #endif #if USE_CUSTOM_CONTROLS mouseDownInsideCcContainer = false; if(ccContainer.Visible && ccContainer.MouseUp(Size, e)) return; #endif Viewer.RequestInputProcessing(); if(Math.Abs(mouseDownLocation.X - e.Location.X) + Math.Abs(mouseDownLocation.Y - e.Location.Y) < 2) { if(e.Button == MouseButtons.Left) Viewer.browser.OnImageClick(mouseDownImage); else if(e.Button == MouseButtons.Right) Viewer.browser.OnImageRightClick(mouseDownImage); } else if(!ContextMenu.MouseUp(sender, e, backbuffersize) && colorTableMgr.Visible) colorTableMgr.MouseUp(e); dragImage = mouseDownImage = null; mouseRect = null; }
public virtual void OnImageDrag(TransformedImage image, Vector3 delta) { }
public override void OnImageMouseDown(System.Windows.Forms.MouseButtons button, TransformedImage image, Vector2 uv, out bool enableDrag) { enableDrag = button == MouseButtons.Left; }
public override void OnImageDrag(TransformedImage image, Vector3 delta) { MoveSelection(delta); }
public virtual void OnImageRightClick(TransformedImage image) { }
public override void OnImageRightClick(TransformedImage image) { ShowContextMenu(cmImage); }
protected void AddToSelection(TransformedImage image) { Viewer.selection.Add(image); SelectionChanged(); }
public override void OnImageRightClick(TransformedImage image) { //ShowContextMenu(cmImage); }
private void DoShowImage(TransformedImage image) { image.Visible = true; Viewer.visible.Add(image); }
public override bool Contains(TransformedImage image) { return(selection.Contains(image)); }
private void DoHideImage(TransformedImage image) { image.Visible = false; Viewer.visible.Remove(image); }
public override void OnImageMouseDown(MouseButtons button, TransformedImage image, Vector2 uv, out bool enableDrag) { enableDrag = false; if(button != MouseButtons.Left || image.Selected == true) return; int timeidx = Array.IndexOf(image.args[0].values, image.values[0]); int selection_timeidx; if(Viewer.selection.Count == 0) selection_timeidx = -1; else { IEnumerator<TransformedImage> selection_enum = Viewer.selection.GetEnumerator(); selection_enum.MoveNext(); selection_timeidx = Array.IndexOf(selection_enum.Current.args[0].values, selection_enum.Current.values[0]); } if(timeidx == expandedTimeIdx) { Select(image); if(selection_timeidx != expandedTimeIdx) ExecuteISQL(string.Format("focus WHERE #time == {0}", timeidx)); SetOption(Option.ViewRotationCenter, new Vector3((float)timeidx * 3.0f + 5.0f, 0.0f, 0.0f)); } else { SetOption(Option.ViewControl, ImageCloud.ViewControl.CoordinateSystemCentric); ExecuteISQL(string.Format("select WHERE #time == {0}", timeidx)); FocusSelection(); } }
private void saveImage() { saveFileDialog.ShowDialog(); TransformedImage.Save(saveFileDialog.FileName); }
private void DoMoveImage(TransformedImage image, Vector3 deltapos) { image.Position += deltapos; image.skipPosAnimation(); if(image.Selected) SelectionMoved(); }
public override void OnImageDoubleClick(TransformedImage image) { ClearSelection(); MoveIntoView(image); }
public override void OnImageDoubleClick(TransformedImage image) { int timeidx = Array.IndexOf(image.args[0].values, image.values[0]); if(timeidx == expandedTimeIdx) { expandedTimeIdx = -1; SetOption(Option.ViewControl, ImageCloud.ViewControl.CoordinateSystemCentric); ExecuteISQL(string.Format("clear all")); ExecuteISQL(string.Format("x all BY #time * 3.0f")); ExecuteISQL(string.Format("look all BY pi - $theta * pi / 180.0f, pi / 2.0f - $phi * pi / 180.0f")); ExecuteISQL(string.Format("select WHERE #time == {0}", timeidx)); FocusSelection(); } else { expandedTimeIdx = timeidx; ExecuteISQL(string.Format("clear all")); ExecuteISQL(string.Format("x BY #time * 3.0f WHERE #time < {0}", timeidx)); ExecuteISQL(string.Format("x BY #time * 3.0f + 5.0f WHERE #time == {0}", timeidx)); ExecuteISQL(string.Format("x BY #time * 3.0f + 10.0f WHERE #time > {0}", timeidx)); FocusSelection(); SetOption(Option.ViewRotationCenter, new Vector3((float)timeidx * 3.0f + 5.0f, 0.0f, 0.0f)); //SetOption(Option.ViewControl, ImageCloud.ViewControl.PointCentric); ExecuteISQL(string.Format("thetaPhi BY pi - $theta * pi / 180.0f, pi / 2.0f - $phi * pi / 180.0f, 5.0f WHERE #time == {0}", timeidx)); FocusSelection(); Select(image); } }