Presentation is loading. Please wait.

Presentation is loading. Please wait.

Printing to Scale with MO Example uses Visual Basic 5.0Example uses Visual Basic 5.0 OutputMap2 methodOutputMap2 method Convert to device coordinatesConvert.

Similar presentations


Presentation on theme: "Printing to Scale with MO Example uses Visual Basic 5.0Example uses Visual Basic 5.0 OutputMap2 methodOutputMap2 method Convert to device coordinatesConvert."— Presentation transcript:

1 Printing to Scale with MO Example uses Visual Basic 5.0Example uses Visual Basic 5.0 OutputMap2 methodOutputMap2 method Convert to device coordinatesConvert to device coordinates

2 Prototype Project Demo “PrtToScale.vbp”Demo “PrtToScale.vbp” Stand alone app that generates scale-based printing.Stand alone app that generates scale-based printing. One form module, all code attached to VB basic controls.One form module, all code attached to VB basic controls.

3 Code walk-thru (1 of 3) Get the map units of your dataGet the map units of your data –feet, meters, or DD –convert to inches Get the default printerGet the default printer –determine page size in inches –determine twips per pixel

4 Code walk-thru (2 of 3) Get the map extentGet the map extent –convert ground units into inches –divide by the ratio scale given Simple math now that all are inches:Simple math now that all are inches: –scale ratio –map extent in the display –output page coordinates

5 Test to ensure scale chosen is not too large for the page.Test to ensure scale chosen is not too large for the page. Convert output rectangle dimensions into device coordinates (pixels)Convert output rectangle dimensions into device coordinates (pixels) Determine the page locationDetermine the page location Code walk-thru (3 of 3)

6 Scale printing “triangle” Scale Page Size Geographic Extent You really only have control over two of these elements. What you choose for two will determine the third.

7 Measurements Absolute vs. Device Dependent Twips Points x 20 Inches x 72 Feet x 12 Meters x 3.1 ??? Pixels ??? (e.g. printers and monitors) Device dependentAbsolute

8 Flow diagram of code for printing to scale 1. map units 2. convert to inches 8. printer 7. convert to pixels 6. convert to twips 3. map extent rectangle in ground inches 4. divide by ratio scale 5. map extent rectangle in page inches

9 1. Map Units Map control with MapLayer of New Jersey counties returns an Extent rectangle with the following properties, MapUnits in FEET:Map control with MapLayer of New Jersey counties returns an Extent rectangle with the following properties, MapUnits in FEET: –.Width = 590448 –.Height = 871987 2, 3. Convert to Inches Conversion so that MapUnits are now expressed in inches:Conversion so that MapUnits are now expressed in inches: –.Width = 7085376 –.Height = 10463844

10 4. Divide by ratio scale User wants ratio scale of 1 : 2,000,000User wants ratio scale of 1 : 2,000,000 5. Map extent rectangle in printer page inches Divide MapUnits in inches by 2,000,000, which gives:Divide MapUnits in inches by 2,000,000, which gives: –.Width = 3.5427 –.Height = 5.2319

11 6. Extent rectangle in twips Multiply output rectangle dimensions by 1440 to convert the units into TwipsMultiply output rectangle dimensions by 1440 to convert the units into Twips –.Width = 5101.49 –.Height = 7533.94 7. Convert to pixels Divide output rectangle dimensions by the device dependent “TwipsPerPixel” property to convert the units into pixels. This printer for example has a DPI of 600, therefore, the TwipsPerPixel value is 2.4.Divide output rectangle dimensions by the device dependent “TwipsPerPixel” property to convert the units into pixels. This printer for example has a DPI of 600, therefore, the TwipsPerPixel value is 2.4. –.Width = 2125.62 –.Height = 3139.14

12 MapUnits as String RatioScale as Long PrintNow PTSobj (createable) ‘MOPrintToScale.dll’‘MOPrintToScale.dll’ One object: PTSobj OneInchToUnits as Double MapControl as MO.Map Go to the MapObjects Developer Connection for this DLL and all full set of source code for all examples shown during this presentation. http://www.esri.com/base/products/mapobjects/… developerconnection/modeveloperext.htm


Download ppt "Printing to Scale with MO Example uses Visual Basic 5.0Example uses Visual Basic 5.0 OutputMap2 methodOutputMap2 method Convert to device coordinatesConvert."

Similar presentations


Ads by Google