MathGroup Archive 2007

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Zoom2D

  • To: mathgroup at smc.vnet.net
  • Subject: [mg78640] Re: Zoom2D
  • From: dimitris <dimmechan at yahoo.com>
  • Date: Thu, 5 Jul 2007 06:20:28 -0400 (EDT)
  • References: <f6i8s9$1in$1@smc.vnet.net>

            dh       :
> Hello All,
>
> here is a slightly improved version of a 2 dimensional zoome utility.
>
> Either copy the code directly into a notebook and execute or put it into
>
> a file with extension *.m and load it by <<"Filename". This will pop up
>
> a palette with a single button "Zoom". Select a 2 dim graphics and hit
>
> the button. This will open a new notebook with 2 panes, the upper pane
>
> contains the original graphics with a transluctance changable rectangle
>
> overlaid. The lower pane contains the zoomed rectangle region. If you
>
> resize the Notebook, the upper pane stays small.
>
> Daniel
>
>
>
>
>
> (*==== CODE ======*)
>
> (*Creates a Palette with a zoom button*)
>
>
>
>
>
> Zoom2D[g0_]:=Module[{g,pp1,pp2},
>
> If[!MatchQ[Head[g0],Graphics| GraphicsBox],CreateDialog[{TextCell["Zoom:
>
> No Input available."],DefaultButton[]}];Return[];];
>
> g=If[Head[g0]=!=Graphics,Replace[g0,head_[x1_,x2___]:>Graphics[{x1},{x2}]],g0];
>
> g = g/.NCache[_, x_] :> x;
>
>
>
> {pp1,pp2}=FullOptions[g,PlotRange]//Transpose;
>
>
>
> g1=DynamicModule[{p1=pp1,p2=pp2,lp={0,0}},
>
> Column[{
>
> LocatorPane[Dynamic[{p1,p2}],Show[{g,Graphics[{Opacity[0.1],Rectangle[Dynamic[p1],Dynamic[p2]]}]},ImageSize->Small]]
>
> ,EventHandler[Show[g,PlotRange:>Dynamic[Transpose[{p1,p2}]],Frame->True,ImageSize->Full]
>
> ,{"MouseClicked":>(lp=MousePosition["Graphics"])}
>
> ]
>
> ,Dynamic[lp]
>
> },Center]];
>
>
>
> CreateDocument[g1,WindowSize->{Small,All},WindowTitle->"Zoom-DH",WindowElements->{},WindowFrame->"Palette",BoxForm`ClosingSaveDialog->False];
>
>
>
> ]
>
>
>
> CreatePalette[
>
> Button["Zoom",Zoom2D[NotebookRead[SelectedNotebook[]]]
>
> ],WindowTitle->""];

Do you have something a similar function for version 5.2?

Dimitris



  • Prev by Date: Re: Re: Rotable Graphics and ViewPoint
  • Next by Date: Re: Version 6 NotebookPrint to file not woking for me
  • Previous by thread: Zoom2D
  • Next by thread: Re: Zoom2D