RE: : 6.0 Get Graphics Coordinates...
- To: mathgroup at smc.vnet.net
- Subject: [mg78046] RE: [mg77971]: 6.0 Get Graphics Coordinates...
- From: "Ingolf Dahl" <ingolf.dahl at telia.com>
- Date: Thu, 21 Jun 2007 06:04:35 -0400 (EDT)
- References: <f4on38$7sg$1@smc.vnet.net> <200706140911.FAA05973@smc.vnet.net> <f4tm2d$ira$1@smc.vnet.net> <200706160724.DAA25722@smc.vnet.net> <200706171011.GAA01990@smc.vnet.net> <200706201019.GAA12842@smc.vnet.net>
Of course there was some bug in my GetGraphicsCoordinates palette yesterday. The relation between the Mathematica ClipboardNotebook[] (not present in the Mathematica 6 Documentation Center!) and the Windows system clipboard is a bit complicated, and they sometimes can get out of sync. It seems to me as if pasting between cells uses the Mathematic Clipboard, while pasting into the inside of Input cells uses the Windows clipboard. If the clipboards are out-of-sync, then the result of pasting depends on where you paste. I have corrected the code to improve the behavior. I have also seen some occasional errors and instability in the Mathematica 6 behavior, but someone else has the responsibility for such problems. You have to move the palette to be able to save it. There seems to be some problems also with the palette in the KDE windowing system. In the new version of the palette, the "Copy locator positions" also sets the $LocatorPositions variable to the list of locator positions. Then hopefully that property can be used, even if the copying mechanism does not work. As Robert Novak pointed out yesterday, there are some 5.2 graphics left in the documentation, and there the old GetGraphicsCoordinates mechanism still works. It also seem to work with bitmap images. But the coordinates you obtain are not necessarily connected to the coordinate system inside the graph. A benefit of this palette is that you might operate on already generated graphics. You do not have to regenerate them. That is a benefit of the Mathematica 6 system also: the generated graphics are stored without the memory losses associated to the PostScript conversion. Here is the new code: CreatePalette[ Column[{Button["Add LocatorPane", SelectionMove[InputNotebook[], All, CellContents]; NotebookWrite[ InputNotebook[], (DynamicModuleBox[{$CellContext`pts$$ = {{0., 0.}}}, LocatorPaneBox[Dynamic[$CellContext`pts$$], #, LocatorAutoCreate -> True], DynamicModuleValues :> {}]) &@ NotebookRead[InputNotebook[]]]], "Use Alt+Click to add or delete locators!", Button["Copy locator positions", SelectionMove[InputNotebook[], All, Cell]; FrontEndExecute[FrontEndToken["Copy"]]; SelectionMove[InputNotebook[], All, CellContents]; Module[{b}, b = NotebookRead[InputNotebook[]]; If[And[Length[b] >= 3, MatchQ[b[[2]], _LocatorPaneBox]], b = b[[1, 1]]; $LocatorPositions = b; SelectionMove[ClipboardNotebook[], All, Notebook]; NotebookWrite[ClipboardNotebook[], ToBoxes[b], All]; SelectionMove[ClipboardNotebook[], All, Notebook]]]], Button["Remove LocatorPane", SelectionMove[InputNotebook[], All, CellContents]; Module[{b}, b = NotebookRead[InputNotebook[]]; If[And[Length[b] >= 3, MatchQ[b[[2]], _LocatorPaneBox]], NotebookWrite[InputNotebook[], b[[2, 2]]]]]], Dynamic[MousePosition["Graphics"]]}], WindowTitle -> "Get Graphics Coordinates"]; Suggestions are welcome Best regards Ingolf Dahl > -----Original Message----- > From: Ingolf Dahl [mailto:ingolf.dahl at telia.com] > Sent: den 20 juni 2007 12:20 > To: mathgroup at smc.vnet.net > Subject: [mg77971] RE: [mg77817] Re: [mg77755] Re: 6.0 Get > Graphics Coordinates... > > Here is my suggestion: > I have created a Matematica-6 palette with three buttons, > intended to mimic the GetGraphicsCoordinates from Mathematica 5. > > Use: > 1. Select a graphics cell and press the "Add LocatorPane" button. > 2. Press "Alt" and click the mouse to add or delete point > ("locators") to the graphics. > 3. Press the "Copy locator position" to copy a list of the > locator coordinates to the Clipboard. > 4. Select a graphics cell and phe "Remove LocatorPane" to > reset the graphics to initial conditions (if you want to do that) > > You get the flexibility that it is possible to adjust the > position of the locators. It seems necessary to start with > one point present. I have chosen to put this point at {0,0}. > > Best regards > > Ingolf Dahl
- Follow-Ups:
- Re: RE: : 6.0 Get Graphics Coordinates...
- From: Curtis Osterhoudt <cfo@lanl.gov>
- Re: RE: : 6.0 Get Graphics Coordinates...
- References:
- Re: 6.0 Get Graphics Coordinates...
- From: Jens-Peer Kuska <kuska@informatik.uni-leipzig.de>
- Re: 6.0 Get Graphics Coordinates...
- From: David <habud@hotmail.com>
- Re: Re: 6.0 Get Graphics Coordinates...
- From: Murray Eisenberg <murray@math.umass.edu>
- RE: Re: Re: 6.0 Get Graphics Coordinates...
- From: "Ingolf Dahl" <ingolf.dahl@telia.com>
- Re: 6.0 Get Graphics Coordinates...