Description
This sample demonstrates using the SymbologyControl to display north arrow,scale bar,and scale text symbols,which are used by custom commands when adding MapSurround objects to the GraphicsContainer of the PageLayout.The sample uses the SymbologyControl in conjunction with the PageLayoutControl, TOCControl, ToolbarControl,and the controls commands.
Example Code
This example uses the following Java classes:- AddMapSurroundsApplication
- CreateNorthArrowTool
- CreateScaleBarTool
- CreateScaleTextTool
- SymbologyFrame
<ArcGIS>/java/samples/engine/Controls.Symbology.AddMapSurrounds
Download
Instructions
Follow these instructions to run the sample:
- Start the sample application.
- Load a mapdocument into the PageLayoutControl by clicking Open(The first button on the Toolbar).
- Click on the "Map Surrounds" toolbar menu.You can see NorthArrow,ScaleBar and ScaleText listed in there.
- Click on "NorthArrow" and drag a rectangle on the pagelayout frame.
- A Dialog box will open populated with all types of NorthArrow symbols.
- Click on any northarrow and when you click OK it will be added into the pagelayout.
- Repeat steps 4,5,6 to add "ScaleBar" and "ScaleText"on the pagelayout.
Files
- AddMapSurroundsApplication.java -- This java class loads a frame with Map,Toc,Toolbar and a ToolbarMenu with different mapsurrounds as menu items.
- CreateNorthArrowTool.java -- This java class creates a custom tool to handle various mouseevents and calls SymbologyFrame when NorthArrow is clicked.
- CreateScaleBarTool.java -- This java class creates a custom tool to handle various mouseevents and calls SymbologyFrame when ScaleBar is clicked.
- CreateScaleTextTool.java -- This java class creates a custom tool to handle various mouseevents and calls SymbologyFrame when ScaleText is clicked.
- SymbologyFrame.java -- This java class opens up a dialog with northarrow/scalebar/scaletext symbols depending on the type of item clicked from the toolbar Menu.