com.esri.arcgis.editor
Class LineFeatureTool

java.lang.Object
  extended by com.esri.arcgis.editor.LineFeatureTool
All Implemented Interfaces:
IShapeConstructorTool, com.esri.arcgis.interop.RemoteObjRef, ICommand, ITool, java.io.Serializable

public class LineFeatureTool
extends java.lang.Object
implements com.esri.arcgis.interop.RemoteObjRef, ITool, ICommand, IShapeConstructorTool

COM Class 'LineFeatureTool'. Generated 3/19/2015 1:20:50 PM from 'C:\ArcGIS\COM\esriEditor.olb'

Description 'Tool that creates a new Polyline sketch geometry.' Generator Options: PromptForTypeLibraries = False ClashPrefix = esri_ LowerCaseMemberNames = True IDispatchOnly = False RetryOnReject = False AwtForOcxs = True ArraysAsObjects = False DontRenameSameMethods = False ImplementConflictingInterfaces = True ReuseMethods = True RenameConflictingInterfaceMethods = True GenBeanInfo = True GenerateJavadoc =

See Also:
Serialized Form

Field Summary
 
Fields inherited from interface com.esri.arcgis.editor.IShapeConstructorTool
IID, IID32da1291_7be1_4d75_963f_8ac38dc9b56b, xxDummy
 
Constructor Summary
LineFeatureTool()
          Constructs a LineFeatureTool using ArcGIS Engine.
LineFeatureTool(java.lang.Object obj)
          Deprecated. As of ArcGIS 9.2, replaced by normal Java casts.
LineFeatureTool theLineFeatureTool = (LineFeatureTool) obj;
 
Method Summary
 boolean deactivate()
          Causes the tool to no longer be the active tool.
 boolean equals(java.lang.Object o)
          Compare this object with another
 int getBitmap()
          The bitmap that is used as the icon on this command.
 java.lang.String getCaption()
          The caption of this command.
 java.lang.String getCategory()
          The name of the category with which this command is associated.
static java.lang.String getClsid()
          getClsid.
 int getCursor()
          The mouse pointer for this tool.
 int getHelpContextID()
          The help context ID associated with this command.
 java.lang.String getHelpFile()
          The name of the help file associated with this command.
 com.esri.arcgis.interop.Dispatch getJintegraDispatch()
          Deprecated. Internal use only.
 java.lang.String getMessage()
          The statusbar message for this command.
 java.lang.String getName()
          The name of this commmand.
 java.lang.String getTooltip()
          The tooltip for this command.
 int hashCode()
          the hashcode for this object
 boolean isChecked()
          Indicates if this command is checked.
 boolean isEnabled()
          Indicates if this command is enabled.
 void onClick()
          Occurs when this command is clicked.
 boolean onContextMenu(int x, int y)
          Context menu event occured at the given xy location.
 void onCreate(java.lang.Object hook)
          Occurs when this command is created.
 void onDblClick()
          Occurs when a mouse button is double clicked when this tool is active.
 void onKeyDown(int keyCode, int shift)
          Occurs when a key on the keyboard is pressed when this tool is active.
 void onKeyUp(int keyCode, int shift)
          Occurs when a key on the keyboard is released when this tool is active.
 void onMouseDown(int button, int shift, int x, int y)
          Occurs when a mouse button is pressed when this tool is active.
 void onMouseMove(int button, int shift, int x, int y)
          Occurs when the mouse is moved when this tool is active.
 void onMouseUp(int button, int shift, int x, int y)
          Occurs when a mouse button is released when this tool is active.
 void refresh(int hdc)
          Occurs when a screen display in the application is refreshed.
 void release()
          Release a LineFeatureTool.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LineFeatureTool

public LineFeatureTool()
                throws java.io.IOException,
                       java.net.UnknownHostException
Constructs a LineFeatureTool using ArcGIS Engine.

Throws:
java.io.IOException - if there are interop problems
java.net.UnknownHostException - if there are interop problems

LineFeatureTool

public LineFeatureTool(java.lang.Object obj)
                throws java.io.IOException
Deprecated. As of ArcGIS 9.2, replaced by normal Java casts.
LineFeatureTool theLineFeatureTool = (LineFeatureTool) obj;

Construct a LineFeatureTool using a reference to such an object returned from ArcGIS Engine or Server. This is semantically equivalent to casting obj to LineFeatureTool.

Parameters:
obj - an object returned from ArcGIS Engine or Server
Throws:
java.io.IOException - if there are interop problems
Method Detail

getClsid

public static java.lang.String getClsid()
getClsid.


equals

public boolean equals(java.lang.Object o)
Compare this object with another

Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
the hashcode for this object

Overrides:
hashCode in class java.lang.Object

getJintegraDispatch

public com.esri.arcgis.interop.Dispatch getJintegraDispatch()
Deprecated. Internal use only.

Specified by:
getJintegraDispatch in interface com.esri.arcgis.interop.RemoteObjRef

release

public void release()
Release a LineFeatureTool.

Specified by:
release in interface com.esri.arcgis.interop.RemoteObjRef

getCursor

public int getCursor()
              throws java.io.IOException,
                     AutomationException
The mouse pointer for this tool.

Remarks

When implementing ITool to create a custom tool, use the Cursor property to set the mouse pointer of the tool.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Supported Platforms

Windows, Solaris, Linux

Specified by:
getCursor in interface ITool
Returns:
The cursor (A COM typedef)
Throws:
java.io.IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

onMouseDown

public void onMouseDown(int button,
                        int shift,
                        int x,
                        int y)
                 throws java.io.IOException,
                        AutomationException
Occurs when a mouse button is pressed when this tool is active.

Description

button specifies which mouse button is pressed. The button argument is a bit field. Some, all, or none of the bits can be set indicating that some, all, or none of the mouse buttons are pressed. The values for button are as follows:

1 Left button
2 Right button
3 Left and Right buttons
4 Middle button
5 Left and Middle buttons
6 Right and Middle buttons
7 All buttons

Shift indicates whether the Shift key, Ctrl key, or Alt key is pressed when the mouse button is pressed. The Shift argument is a bit field. Some, all, or none of the bits can be set indicating that some, all, or none of the keys are pressed. The values for Shift are as follows:

0 No key pressed
1 Shift key pressed
2 Ctrl key pressed
3 Shift and Ctrl keys pressed
4 Alt key pressed
5 Shift and Alt keys pressed
6 Ctrl and Atl keys pressed
7 Shift, Ctrl, and Alt keys pressed

X is the X coordinate, in device units, where the mouse button was pressed.

Y is the Y coordinate, in device units, where the mouse button was pressed.

Remarks

When implementing ITool to create a custom tool, write the code that performs the action when the left mouse button is pressed when this tool is the active tool in the OnMouseDown method.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Supported Platforms

Windows, Solaris, Linux

Specified by:
onMouseDown in interface ITool
Parameters:
button - The button (in)
shift - The shift (in)
x - The x (in)
y - The y (in)
Throws:
java.io.IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

onMouseMove

public void onMouseMove(int button,
                        int shift,
                        int x,
                        int y)
                 throws java.io.IOException,
                        AutomationException
Occurs when the mouse is moved when this tool is active.

Description

button specifies which mouse button was pressed while moving the mouse. The button argument is a bit field. Some, all, or none of the bits can be set indicating that some, all, or none of the mouse buttons are pressed. The values for button are as follows:

1 Left button
2 Right button
3 Left and Right buttons
4 Middle button
5 Left and Middle buttons
6 Right and Middle buttons
7 All buttons

Shift indicates whether the Shift key, Ctrl key, or Alt key is pressed when the mouse is moved. The Shift argument is a bit field. Some, all, or none of the bits can be set indicating that some, all, or none of the keys are pressed. The values for Shift are as follows:

0 No key pressed
1 Shift key pressed
2 Ctrl key pressed
3 Shift and Ctrl keys pressed
4 Alt key pressed
5 Shift and Alt keys pressed
6 Ctrl and Atl keys pressed
7 Shift, Ctrl, and Alt keys pressed


X is the X coordinate, in device units, of the mouse location.

Y is the Y coordinate, in device units, of the mouse location.

Remarks

When implementing ITool to create a custom tool, write the code that performs the action when the mouse is moved when this tool is the active tool in the OnMouseMove method.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Supported Platforms

Windows, Solaris, Linux

Specified by:
onMouseMove in interface ITool
Parameters:
button - The button (in)
shift - The shift (in)
x - The x (in)
y - The y (in)
Throws:
java.io.IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

onMouseUp

public void onMouseUp(int button,
                      int shift,
                      int x,
                      int y)
               throws java.io.IOException,
                      AutomationException
Occurs when a mouse button is released when this tool is active.

Description

button specifies which mouse button is released. The button argument is a bit field. Some, all, or none of the bits can be set indicating that some, all, or none of the mouse buttons are pressed. The values for button are as follows:

1 Left button
2 Right button
3 Left and Right buttons
4 Middle button
5 Left and Middle buttons
6 Right and Middle buttons
7 All buttons

Shift indicates whether the Shift key, Ctrl key, or Alt key is pressed when the mouse button is released. The Shift argument is a bit field. Some, all, or none of the bits can be set indicating that some, all, or none of the keys are pressed. The values for Shift are as follows:

0 No key pressed
1 Shift key pressed
2 Ctrl key pressed
3 Shift and Ctrl keys pressed
4 Alt key pressed
5 Shift and Alt keys pressed
6 Ctrl and Atl keys pressed
7 Shift, Ctrl, and Alt keys pressed

X is the X coordinate, in device units, where the mouse button was released.

Y is the Y coordinate, in device units, where the mouse button was released.

Remarks

When implementing ITool to create a custom tool, write the code that performs the action when a mouse button is released when this tool is the active tool in the OnMouseUp method.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Supported Platforms

Windows, Solaris, Linux

Specified by:
onMouseUp in interface ITool
Parameters:
button - The button (in)
shift - The shift (in)
x - The x (in)
y - The y (in)
Throws:
java.io.IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

onDblClick

public void onDblClick()
                throws java.io.IOException,
                       AutomationException
Occurs when a mouse button is double clicked when this tool is active.

Remarks

When implementing ITool to create a custom tool, write the code that performs the action when a mouse button is double-clicked when this tool is the active tool in the OnDblClick method.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Supported Platforms

Windows, Solaris, Linux

Specified by:
onDblClick in interface ITool
Throws:
java.io.IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

onKeyDown

public void onKeyDown(int keyCode,
                      int shift)
               throws java.io.IOException,
                      AutomationException
Occurs when a key on the keyboard is pressed when this tool is active.

Description

keyCode specifies which key on the keyboard was pressed.

Shift indicates whether the Shift key, Ctrl key, or Alt key was pressed when the mouse button was pressed. 0 for no keys pressed. 1 for Shift key pressed. 2 for Ctrl key pressed. 4 for Alt key pressed. If both the Shift key and the Ctrl key were pressed, Shift would be 3. If all three keys were pressed, Shift would be 7.

Remarks

When implementing ITool to create a custom tool, write the code that performs the action when a key on the keyboard is pressed when this tool is the active tool in the OnKeyDown method.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Supported Platforms

Windows, Solaris, Linux

Specified by:
onKeyDown in interface ITool
Parameters:
keyCode - The keyCode (in)
shift - The shift (in)
Throws:
java.io.IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

onKeyUp

public void onKeyUp(int keyCode,
                    int shift)
             throws java.io.IOException,
                    AutomationException
Occurs when a key on the keyboard is released when this tool is active.

Description

keyCode specifies which key on the keyboard was released.

Shift indicates whether the Shift key, Ctrl key, or Alt key was pressed when the mouse button was pressed. 0 for no keys pressed. 1 for Shift key pressed. 2 for Ctrl key pressed. 4 for Alt key pressed. If both the Shift key and the Ctrl key were pressed, Shift would be 3. If all three keys were pressed, Shift would be 7.

Remarks

When implementing ITool to create a custom tool, write the code that performs the action when a key on the keyboard is released when this tool is the active tool in the OnKeyUp method.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Supported Platforms

Windows, Solaris, Linux

Specified by:
onKeyUp in interface ITool
Parameters:
keyCode - The keyCode (in)
shift - The shift (in)
Throws:
java.io.IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

onContextMenu

public boolean onContextMenu(int x,
                             int y)
                      throws java.io.IOException,
                             AutomationException
Context menu event occured at the given xy location.

Description

X is the X coordinate, in device units, where the right mouse button was pressed.

Y is the Y coordinate, in device units, where the right mouse button was pressed.

Remarks

When implementing ITool to create a custom tool, write code to display a custom context menu when the right mouse button is pressed when this tool is the active tool in the OnContext method.

If your tool displays a custom context menu, it should let the application know that it handled the OnContextMenu event by returning True from the OnContext function. If you don't do this, the standard context menu will be displayed after your custom context menu.

This method does not fire in ArcGIS Engine. A context menu is implemented using IToolbarMenu in ArcGIS Engine as illustrated by the ControlsEditingSketchContextMenu command.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Supported Platforms

Windows, Solaris, Linux

Specified by:
onContextMenu in interface ITool
Parameters:
x - The x (in)
y - The y (in)
Returns:
The handled
Throws:
java.io.IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

refresh

public void refresh(int hdc)
             throws java.io.IOException,
                    AutomationException
Occurs when a screen display in the application is refreshed.

Description

hDC is the handle to the display context which just got refreshed in the application.

Remarks

When implementing ITool to create a custom tool, write the code in the Refresh method that performs some action when a screen display in the application is refreshed while this tool is the active tool. When the current screen display in the application is refreshed, the handle to the device context that is associated with that screen display is passed into the Refresh method as an argument.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Supported Platforms

Windows, Solaris, Linux

Specified by:
refresh in interface ITool
Parameters:
hdc - The hdc (A COM typedef) (in)
Throws:
java.io.IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

deactivate

public boolean deactivate()
                   throws java.io.IOException,
                          AutomationException
Causes the tool to no longer be the active tool.

Remarks

When implementing ITool to create a custom tool, add some logic to the Deactivate method to specify whether this tool can be deactivated. If ITool_Deactivate is set to False, the default, you cannot interact with any other tools because this tool cannot be interrupted by another tool.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Supported Platforms

Windows, Solaris, Linux

Specified by:
deactivate in interface ITool
Returns:
The complete
Throws:
java.io.IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

isEnabled

public boolean isEnabled()
                  throws java.io.IOException,
                         AutomationException
Indicates if this command is enabled.

Remarks

When implementing ICommand to create a custom command, add some logic to the Enabled property to specify in what state the application should be in for the command to be enabled.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Supported Platforms

Windows, Solaris, Linux

Specified by:
isEnabled in interface ICommand
Returns:
The enabled
Throws:
java.io.IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

isChecked

public boolean isChecked()
                  throws java.io.IOException,
                         AutomationException
Indicates if this command is checked.

Remarks

The Checked property indicates the state of this Command. If a command item appears depressed on a commandbar, the command is checked. The active tool will appear checked. Also commands that serve as a toggle will be checked when that toggle is on.
A system event is periodically called to set the state of the commands on the commandbars indicating which ones are checked.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Supported Platforms

Windows, Solaris, Linux

Specified by:
isChecked in interface ICommand
Returns:
The checked
Throws:
java.io.IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

getName

public java.lang.String getName()
                         throws java.io.IOException,
                                AutomationException
The name of this commmand.

Remarks

The Name property of a command is a programmatic identifying name string. By convention, a command's name should include its category name. The format of the Name string should be <Category>_<Caption>. For example, the name of the builtin ArcMap command About ArcMap is "Help_About". Since it is an identifier of the command, the Name property should not be localized.

When implementing ICommand to create a custom command, use the Name property to set the internal name of this command.

Note, the Caption property of a command is the string that appears when the command is placed on a command bar.

Example:

 

public String getName () {
     return "MyCustomTool_MyTool";
}

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Supported Platforms

Windows, Solaris, Linux

Specified by:
getName in interface ICommand
Returns:
The name
Throws:
java.io.IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

getCaption

public java.lang.String getCaption()
                            throws java.io.IOException,
                                   AutomationException
The caption of this command.

Remarks

The Caption property of a command is the string that appears when the command is placed on a command bar.

When implementing ICommand to create a custom command, use the Caption property to set the caption of the command.

Example:

public String getCaption() {
     return "MyTool";
}

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Supported Platforms

Windows, Solaris, Linux

Specified by:
getCaption in interface ICommand
Returns:
The caption
Throws:
java.io.IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

getTooltip

public java.lang.String getTooltip()
                            throws java.io.IOException,
                                   AutomationException
The tooltip for this command.

Remarks

When implementing ICommand to create a custom command, use the ToolTip property to set the string that appears in the screen tip when the mouse hovers over the command.

Example:

public String getTooltip () {
    return "MyTool";
}

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Supported Platforms

Windows, Solaris, Linux

Specified by:
getTooltip in interface ICommand
Returns:
The tooltip
Throws:
java.io.IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

getMessage

public java.lang.String getMessage()
                            throws java.io.IOException,
                                   AutomationException
The statusbar message for this command.

Remarks

When implementing ICommand to create a custom command, use the Message property to set the message string that appears in the statusbar of the application when the mouse passes over the command.

Example:

public String getMessage() {
     return "This is my custom tool";
}

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Supported Platforms

Windows, Solaris, Linux

Specified by:
getMessage in interface ICommand
Returns:
The message
Throws:
java.io.IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

getHelpFile

public java.lang.String getHelpFile()
                             throws java.io.IOException,
                                    AutomationException
The name of the help file associated with this command.

Description

The HelpFile property is used to specify the name of the help file that contains the context sensitive help topic for your custom command.

Remarks

If you set both the HelpFile and HelpContextID properties, then an end-user of your command can use the "What's This?" command in ArcMap or ArcCatalog to get help on your command. Note, if you want your What's This help to look and behave the same as the standard ArcGIS commands, then you should create a WinHelp file instead of a HTMLHelp file.

If you have a WinHelp file (*.hlp), set ICommand_HelpFile to the name of the help file containing the topic that describes the command and set ICommand_HelpContextID to the topic ID's mapped numeric value. The topic ID is the so-called # footnote in the RTF file you include in your WinHelp file. You can use Help Workshop to add this numeric value by opening the HPJ file, clicking Map and then clicking Add (to add the mapping for an individual topic). See the help topic "To enable a program to display an individual Help topic" in the Help Workshop's help file.

If you have an HTMLHelp file (*.chm) the procedure is similar; specifiy the .chm file as ICommand_HelpFile and the mapped numeric value as ICommand_HelpContextID. Popup topics are problematic with HTMLHelp, but the help topic will display in a default or user-defined window.

As part of your deployment strategy register the name of the WinHelp file (*.hlp) as a new string value in:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\Help

Or if you're working with a HTMLHelp file (*.chm) register its name as a new string value in:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\HTMLHelp.

Note, if you want to create a custom command that launches your help system, you can call an entire help file and/or use the functionality of the appropriate Help APIs by declaring and using the Windows API WinHelp() function or HTMLHelp() function.

Once you have one of these help functions declared, the OnClick event of your command could call the help function.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Supported Platforms

Windows, Solaris, Linux

Specified by:
getHelpFile in interface ICommand
Returns:
The helpFile
Throws:
java.io.IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.
See Also:
ICommand.getHelpContextID()

getHelpContextID

public int getHelpContextID()
                     throws java.io.IOException,
                            AutomationException
The help context ID associated with this command.

Description

The HelpContextID property is used to specify the mapped numeric value of the topic ID of the context sensitive help topic for your custom command. Specify the name of your help file in the HelpFile property.

Remarks

If you set both the HelpFile and HelpContextID properties, then an end-user of your command can use the "What's This?" command in ArcMap or ArcCatalog to get help on your command. Note, if you want your What's This help to look and behave the same as the standard ArcGIS commands, then you should create a WinHelp file instead of a HTMLHelp file.

If you have a WinHelp file (*.hlp), set ICommand_HelpFile to the name of the help file containing the topic that describes the command and set ICommand_HelpContextID to the topic ID's mapped numeric value. The topic ID is the so-called # footnote in the RTF file you include in your WinHelp file. You can use Help Workshop to add this numeric value by opening the HPJ file, clicking Map and then clicking Add (to add the mapping for an individual topic). See the help topic "To enable a program to display an individual Help topic" in the Help Workshop's help file.

If you have an HTMLHelp file (*.chm) the procedure is similar; specifiy the
.chm file as ICommand_HelpFile and the mapped numeric value as
ICommand_HelpContextID. Popup topics are problematic with HTMLHelp, but the help topic will display in a default or user-defined window.

As part of your deployment strategy register the name of the WinHelp file (*.hlp) as a new string value in:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\Help

Or if you're working with a HTMLHelp file (*.chm) register its name as a new string value in:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\HTMLHelp.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Supported Platforms

Windows, Solaris, Linux

Specified by:
getHelpContextID in interface ICommand
Returns:
The helpID
Throws:
java.io.IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.
See Also:
ICommand.getHelpFile()

getBitmap

public int getBitmap()
              throws java.io.IOException,
                     AutomationException
The bitmap that is used as the icon on this command.

Remarks

When implementing ICommand to create a custom command, use the Bitmap property to set the bitmap to be used as the icon on this command. In your Visual Basic project for this command, the bitmap can be stored in a resource file or in a PictureBox control on a form.

You must use a Bitmap file (.bmp) for the Bitmap property; Icon files (.ico) are not supported. Bitmap files should be 16 X 16 pixels. The color of the upper left pixel of the bitmap is treated as the transparent color. For example, if the upper left pixel of the bitmap is red, then all of the red pixels in the bitmap will be converted to transparent.

When a command is put on a toolbar, the command is displayed with the bitmap only by default; the display type is set to Image Only (ICommandItem::Style = esriCommandStyleIconOnly). When a command is put on a menu, the command is displayed with the bitmap and caption by default; the display type is set to Image and Text (ICommandItem::Style = esriCommandStyleIconAndText). However, if the Bitmap property is not set for this command, then the command will be displayed with the caption only by default when it is put on a toolbar or menu; the display type is set to Text Only (ICommandItem::Style = esriCommandStyleTextOnly).

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Supported Platforms

Windows, Solaris, Linux

When implementing ICommand to create a custom command, there is no need to implement this method. In the custom Java Command class, set the bitmapPath String to the physical location of the bitmap file to be used on the toolbar.

bitmapPath = "/images/mybitmap.bmp";

You must use a Bitmap file (.bmp); Icon files (.ico) are not supported. Bitmap files should be 16 X 16 pixels. The color of the upper left pixel of the bitmap is treated as the transparent color. For example, if the upper left pixel of the bitmap is red, then all of the red pixels in the bitmap will be converted to transparent.

When a command is put on a toolbar, the command is displayed with the bitmap only by default; the display type is set to Image Only (esriCommandStyles.esriCommandStyleIconOnly). When a command is put on a menu, the command is displayed with the bitmap and caption by default; the display type is set to Image and Text (esriCommandStyles.esriCommandStyleIconAndText). However, if the Bitmap property is not set for this command, then the command will be displayed with the caption only by default when it is put on a toolbar or menu; the display type is set to Text Only (esriCommandStyles.esriCommandStyleTextOnly).

Specified by:
getBitmap in interface ICommand
Returns:
The bitmap (A COM typedef)
Throws:
java.io.IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

getCategory

public java.lang.String getCategory()
                             throws java.io.IOException,
                                    AutomationException
The name of the category with which this command is associated.

Remarks

Category determines where the command will appear in the Commands panel of the Customize dialog.

When implementing ICommand to create a custom command, use the Category property to set the category of this command.

Example:

public String getCategory() {
   return "MyCustomTool";
}

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Supported Platforms

Windows, Solaris, Linux

Specified by:
getCategory in interface ICommand
Returns:
The categoryName
Throws:
java.io.IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

onCreate

public void onCreate(java.lang.Object hook)
              throws java.io.IOException,
                     AutomationException
Occurs when this command is created.

Description

hook is a reference to an IApplication object or any of the Controls.

Remarks

The OnCreate method gives the command a hook into the application.

When implementing ICommand to create a custom command, use the OnCreate method to get a hook to the application.

When you implement ICommand to create a custom command, you will find that your class constructor and destructor are called more than once per session. Commands are constructed once initially to get information about them, like the name, bitmap, etc and then they are destroyed. When the final, complete construction takes place, the OnCreate method gets called. OnCreate gets called only once, so you can rely on it to perform initialization of member variables. You can check for initialized member variables in the class destructor to find out if OnCreate has been called previously.

Example:

Object buddyControl = null;

MapControl mapControl = null; 
 
//If your buddy control is of type mapcontrol
 
public void onCreate(Object hook) {
      try { 
      // The hook argument is an instance of control to which this tool is added. 
      // Normally toolbar control.          
      ToolbarControl toolbarControl = new ToolbarControl(hook); 
      //Get the buddy control to which the toolbarcontrol is associated to.         
      buddyControl = toolbarControl.getBuddy();
      mapControl = new MapControl(buddyControl);
       }
      catch (IOException ex) {
      }
}

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Supported Platforms

Windows, Solaris, Linux

Specified by:
onCreate in interface ICommand
Parameters:
hook - A reference to another Automation Object (IDispatch) (in)
Throws:
java.io.IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.
See Also:
IApplication

onClick

public void onClick()
             throws java.io.IOException,
                    AutomationException
Occurs when this command is clicked.

Remarks

When implementing ICommand to create a custom command, write the code that performs the action when the command is clicked in the OnClick method.

Example:

public void onClick() {     
   //In this example, a message is displayed in console.     
   System.out.println("Clicked on my command");
}

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Supported Platforms

Windows, Solaris, Linux

Specified by:
onClick in interface ICommand
Throws:
java.io.IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.