Differences between revisions 3 and 4
Revision 3 as of 2004-02-28 15:24:09
Size: 2452
Editor: sub20-89
Comment:
Revision 4 as of 2004-03-07 22:53:52
Size: 3044
Editor: sub20-89
Comment: No progress. I should probably think vector.
Deletions are marked like this. Additions are marked like this.
Line 2: Line 2:

set pixel to latLongToPixel(45.5192, -122.6856)
Line 8: Line 10:
  with properties {name:"MarkerLayer", blend mode:normal}   with properties {name:"MakerLayer", blend mode:normal}
   set x to item 1 of pixel
 set y to item 2 of pixel
Line 11: Line 16:
 set selTop to 100.0
 set selLeft to 100.0
 set selBottom to 140.0
 set selRight to 140.0
 set selTop to x
 set selLeft to y
 set selBottom to 40 + x
 set selRight to 40 + y
Line 39: Line 44:
 resize image current document width 450
 save current document in (homePath & "Desktop:pdx.png") as PNG
 quit
 -- resize image current document width 450
 -- save current document in (homePath & "Desktop:pdx.png") as PNG
 -- quit
Line 44: Line 49:
on geoToPixel(latitude, longitude) on latLongToPixel(lat, long)
Line 46: Line 51:
 -- Burnside Bridge 45.523 -122.667
 -- Pioneer Square 45.519 -122.686
 -- This function leaves a lot to be desired

 set lat to 45.5192
Line 49: Line 55:
 -- Map Pixel Center 520, 647  -- Burnside Bridge 45.5229 -122.6673
 -- Pioneer Square 45.5192 -122.6856
 -- Burnside Bridge 520, 647
 -- Pioneer Square 464, 678
Line 51: Line 60:
end geoToPixel}}}  set burnsideGeo to {45.5229, -122.6673}
 set piosqrGeo to {45.5192, -122.6856}
 
 set burnsidePix to {520, 647}
 set piosqrPix to {464, 678}
 
 set pixPerGeo to ((item 1 of burnsideGeo) - (item 1 of piosqrGeo)) / ((item 1 of burnsidePix) - (item 1 of piosqrPix))
 
 display dialog (item 1 of burnsidePix) - ((item 1 of burnsideGeo) - lat) * pixPerGeo
 
 return {0, 0}
 
end latLongToPixel}}}

{{{tell application "Finder" to set homePath to (home as string)

set pixel to latLongToPixel(45.5192, -122.6856)

tell application "Adobe Photoshop CS"

  • activate

    open (homePath & "Desktop:bikemap.pdf" as alias) crop current document bounds {46, 72, 1276, 1220} make new art layer at beginning of current document ¬

    • with properties {name:"MakerLayer", blend mode:normal}

    set x to item 1 of pixel set y to item 2 of pixel set selShape to "Elps" -- "Rctn" set selTop to x set selLeft to y set selBottom to 40 + x set selRight to 40 + y set antiAlias to true set featherAmt to 0.0 do javascript ("function makeEllipseSelection(selShape, selTop, selLeft, selBottom, selRight, antiAlias, featherAmt) {
    • var selectionChannel = new ActionReference();

      • selectionChannel.putProperty( charIDToTypeID( \"Chnl\" ), charIDToTypeID( \"fsel\" ) );

      var makeSelection = new ActionDescriptor();

      • makeSelection.putReference( charIDToTypeID( \"null\" ), selectionChannel );

      var selectionParameters = new ActionDescriptor();

      • selectionParameters.putUnitDouble( charIDToTypeID( \"Top \" ), charIDToTypeID( \"#Pxl\" ), selTop ); selectionParameters.putUnitDouble( charIDToTypeID( \"Left\" ), charIDToTypeID( \"#Pxl\" ), selLeft ); selectionParameters.putUnitDouble( charIDToTypeID( \"Btom\" ), charIDToTypeID( \"#Pxl\" ), selBottom ); selectionParameters.putUnitDouble( charIDToTypeID( \"Rght\" ), charIDToTypeID( \"#Pxl\" ), selRight ); makeSelection.putObject( charIDToTypeID( \"T \" ), charIDToTypeID( selShape ), selectionParameters ); makeSelection.putUnitDouble( charIDToTypeID( \"Fthr\" ), charIDToTypeID( \"#Pxl\" ), featherAmt ); makeSelection.putBoolean( charIDToTypeID( \"AntA\" ), antiAlias );

      executeAction( charIDToTypeID( \"setd\" ), makeSelection, DialogModes.NO );

    } makeEllipseSelection( arguments[0] , arguments[1] , arguments[2] , arguments[3] , arguments[4] , arguments[5] , arguments[6] );") ¬
    • with arguments {selShape, selTop, selLeft, selBottom, selRight, antiAlias, featherAmt}
    fill selection of current document with contents ¬
    • {class:RGB color, red:81, green:172, blue:205} blend mode ¬ vivid light opacity 90 without preserving transparency
    -- resize image current document width 450

    -- save current document in (homePath & "Desktop:pdx.png") as PNG -- quit

end tell

on latLongToPixel(lat, long)

  • -- This function leaves a lot to be desired set lat to 45.5192 -- Burnside Bridge 45.5229 -122.6673 -- Pioneer Square 45.5192 -122.6856 -- Burnside Bridge 520, 647 -- Pioneer Square 464, 678 set burnsideGeo to {45.5229, -122.6673} set piosqrGeo to {45.5192, -122.6856} set burnsidePix to {520, 647} set piosqrPix to {464, 678} set pixPerGeo to ((item 1 of burnsideGeo) - (item 1 of piosqrGeo)) / ((item 1 of burnsidePix) - (item 1 of piosqrPix)) display dialog (item 1 of burnsidePix) - ((item 1 of burnsideGeo) - lat) * pixPerGeo return {0, 0}

end latLongToPixel}}}

SexyMapApp (last edited 2007-11-23 18:01:09 by localhost)