com.esri.arcgis.carto
Class ScaleDependentRenderer

java.lang.Object
  extended by com.esri.arcgis.carto.ScaleDependentRenderer
All Implemented Interfaces:
IExportSupport, IFeatureRenderer, ILegendInfo, IScaleDependentRenderer, com.esri.arcgis.interop.RemoteObjRef, IPersist, IPersistStream, Externalizable, Serializable

public class ScaleDependentRenderer
extends Object
implements com.esri.arcgis.interop.RemoteObjRef, IScaleDependentRenderer, IFeatureRenderer, ILegendInfo, IPersistStream, IPersist, IExportSupport, Externalizable

A scale dependent renderer that is composed of multiple renderers, each operating within a particular scale range.

Description

This renderer contains other renderers, and it allows you to specify different renderers for different scale ranges. For example, when a user views a layer at its full extent, features can be drawn with one symbology, and when the user zooms in far enough, the symbology can change to another. You can specify as many renderers and scale ranges as you need.

Remarks

For example, you could use the ScaleDependentRenderer when symbolizing a road network. Specify two different sub renderers and scale ranges. When zoomed out to the full extent, all of the roads could be drawn with the same line symbol -- using a SimpleRenderer. When zoomed in, the roads could be drawn based on road class by using a UniqueValueRenderer. With this renderer type, more important roads can be drawn with thicker, cased-line symbols.

The ScaleDependentRenderer is not available using the ArcGIS interface. To use this renderer you must use code to build and assign the renderer to a layer.

You can create scale dependent symbology using multiple layers, instead of multiple renderer assigned to a single layer through a ScaleDependentRenderer. For example, you can set up multiple feature layers and specify valid min and max display scales for each using IFeatureLayer::MinimumScale and IFeatureLayer::MaximumScale. This functionality is available using out of the box ArcGIS. To learn more see the ArcGIS desktop help.

Product Availability

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

Supported Platforms

Windows, Solaris, Linux

See Also:
Serialized Form

Constructor Summary
ScaleDependentRenderer()
          Constructs a ScaleDependentRenderer using ArcGIS Engine.
ScaleDependentRenderer(Object obj)
          Deprecated. As of ArcGIS 9.2, replaced by normal Java casts.
ScaleDependentRenderer theScaleDependentRenderer = (ScaleDependentRenderer) obj;
 
Method Summary
 void addRenderer(IFeatureRenderer renderer)
          Adds a renderer to the end of the list.
 boolean canRender(IFeatureClass featClass, IDisplay display)
          Indicates if the specified feature class can be rendered on the given display.
 void draw(IFeatureCursor cursor, int drawPhase, IDisplay display, ITrackCancel trackCancel)
          Draws features from the specified cursor on the given display.
 boolean equals(Object o)
          Compare this object with another
 double getBreak(int index)
          Scale value at which to break for the specified index.
 void getClassID(GUID[] pClassID)
          getClassID
static String getClsid()
          getClsid.
 ILegendGroup getLegendGroup(int index)
          Legend group at the specified index.
 int getLegendGroupCount()
          Number of legend groups contained by the object.
 ILegendItem getLegendItem()
          Optional.
 Object getRenderer(int index)
          The renderer at the specified index.
 int getRendererCount()
          Number of renderers.
 void getSizeMax(_ULARGE_INTEGER[] pcbSize)
          getSizeMax
 ISymbol getSymbolByFeature(IFeature feature)
          Symbol used to draw the specified feature.
 int hashCode()
          the hashcode for this object
 void isDirty()
          isDirty
 boolean isRenderPhase(int drawPhase)
          Indicates if renderer uses the specified draw phase.
 boolean isSymbolsAreGraduated()
          Indicates if symbols are graduated.
 void load(IStream pstm)
          load
 void moveRenderer(IFeatureRenderer renderer, int toIndex)
          Moves renderer to the specified location in the list.
 void prepareFilter(IFeatureClass fc, IQueryFilter queryFilter)
          Prepares the query filter for the rendering process.
 void readExternal(ObjectInput in)
           
 void removeRenderer(IFeatureRenderer renderer)
          Removes the specified renderer from the list.
 void save(IStream pstm, int fClearDirty)
          save
 void setBreak(int index, double breakValue)
          Scale value at which to break for the specified index.
 void setExclusionSetByRef(IFeatureIDSet rhs1)
          An object reference to a temporary drawing exclusion set.
 void setExportInfoByRef(IFeatureExportInfoGenerator rhs1)
          The helper oject to generate export information.
 void setRendererByRef(int index, Object renderer)
          The renderer at the specified index.
 void setRendererCount(int rendererCount)
          Number of renderers.
 void setSymbolsAreGraduated(boolean symbolsAreGraduated)
          Indicates if symbols are graduated.
 void writeExternal(ObjectOutput out)
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.esri.arcgis.interop.RemoteObjRef
getJintegraDispatch, release
 

Constructor Detail

ScaleDependentRenderer

public ScaleDependentRenderer()
                       throws IOException,
                              UnknownHostException
Constructs a ScaleDependentRenderer using ArcGIS Engine.

Throws:
IOException - if there are interop problems
UnknownHostException - if there are interop problems

ScaleDependentRenderer

public ScaleDependentRenderer(Object obj)
                       throws IOException
Deprecated. As of ArcGIS 9.2, replaced by normal Java casts.
ScaleDependentRenderer theScaleDependentRenderer = (ScaleDependentRenderer) obj;

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

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

getClsid

public static String getClsid()
getClsid.


equals

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

Overrides:
equals in class Object

hashCode

public int hashCode()
the hashcode for this object

Overrides:
hashCode in class Object

getRendererCount

public int getRendererCount()
                     throws IOException,
                            AutomationException
Number of renderers.

Description

Specifies the number of sub renderers currently assigned to the scale dependent renderer. The number of sub renderers is equal to the number of Break values.

Product Availability

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

Supported Platforms

Windows, Solaris, Linux

Specified by:
getRendererCount in interface IScaleDependentRenderer
Returns:
The rendererCount
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

setRendererCount

public void setRendererCount(int rendererCount)
                      throws IOException,
                             AutomationException
Number of renderers.

Description

RendererCount is the number of renderers currently assigned to a IScaleDependentRenderer .

Product Availability

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

Supported Platforms

Windows, Solaris, Linux

Specified by:
setRendererCount in interface IScaleDependentRenderer
Parameters:
rendererCount - The rendererCount (in)
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

getRenderer

public Object getRenderer(int index)
                   throws IOException,
                          AutomationException
The renderer at the specified index.

Product Availability

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

Specified by:
getRenderer in interface IScaleDependentRenderer
Parameters:
index - The index (in)
Returns:
A reference to another Object (IUnknown)
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

setRendererByRef

public void setRendererByRef(int index,
                             Object renderer)
                      throws IOException,
                             AutomationException
The renderer at the specified index.

Description

Renderer is renderer used to draw features within a given scale range. The number of renderers equals the number of breaks. When setting check RendererCount first to ensure you do not specify an index that is out of range.
As an example of renderers and breaks, if Break(0) = 1,000, Break(1) = 10,000, and Break(2) = 250,000, then renderers are applied in the following manner:

If scale denominator <= 1,000 then features are drawn with Renderer(0).
If 1,000 < scale denominator <= 10,000 then features are drawn with Renderer(1).
If 10,000 < scale denominator <= 250,000 then features are drawn with Renderer(2)
If 250,000 < scale demoninator then NO renderer assigned and features are not drawn.

Product Availability

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

Supported Platforms

Windows, Solaris, Linux

Specified by:
setRendererByRef in interface IScaleDependentRenderer
Parameters:
index - The index (in)
renderer - A reference to another Object (IUnknown) (in)
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

getBreak

public double getBreak(int index)
                throws IOException,
                       AutomationException
Scale value at which to break for the specified index.

Product Availability

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

Specified by:
getBreak in interface IScaleDependentRenderer
Parameters:
index - The index (in)
Returns:
The breakValue
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

setBreak

public void setBreak(int index,
                     double breakValue)
              throws IOException,
                     AutomationException
Scale value at which to break for the specified index.

Product Availability

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

Specified by:
setBreak in interface IScaleDependentRenderer
Parameters:
index - The index (in)
breakValue - The breakValue (in)
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

addRenderer

public void addRenderer(IFeatureRenderer renderer)
                 throws IOException,
                        AutomationException
Adds a renderer to the end of the list.

Description

This method adds a feature renderer to a scale dependent renderer. You must then set a corresponding Break to indicate the minimum scale at which the renderer will be used to draw features. For example, set Break(0) = 1,000 to specify that the first sub renderer be used at scales greater than or equal to 1:1,000. 1:500 is an example of a scale that is greater than or equal to 1:1,000.

Product Availability

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

Supported Platforms

Windows, Solaris, Linux

Specified by:
addRenderer in interface IScaleDependentRenderer
Parameters:
renderer - A reference to a com.esri.arcgis.carto.IFeatureRenderer (in)
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

removeRenderer

public void removeRenderer(IFeatureRenderer renderer)
                    throws IOException,
                           AutomationException
Removes the specified renderer from the list.

Description

This method removes the specified renderer object from the scale dependent renderer.

Product Availability

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

Supported Platforms

Windows, Solaris, Linux

Specified by:
removeRenderer in interface IScaleDependentRenderer
Parameters:
renderer - A reference to a com.esri.arcgis.carto.IFeatureRenderer (in)
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

moveRenderer

public void moveRenderer(IFeatureRenderer renderer,
                         int toIndex)
                  throws IOException,
                         AutomationException
Moves renderer to the specified location in the list.

Description

This method moves the specified renderer to a different scale range within the scale dependent renderer.

Product Availability

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

Supported Platforms

Windows, Solaris, Linux

Specified by:
moveRenderer in interface IScaleDependentRenderer
Parameters:
renderer - A reference to a com.esri.arcgis.carto.IFeatureRenderer (in)
toIndex - The toIndex (in)
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

canRender

public boolean canRender(IFeatureClass featClass,
                         IDisplay display)
                  throws IOException,
                         AutomationException
Indicates if the specified feature class can be rendered on the given display.

Remarks

If the renderer is not applicable to a feature layer, then it can return False in response to a CanRender method. For example, the dot-density renderer is only applicable to polygon feature layers and returns False in response to other feature layers.

Product Availability

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

Supported Platforms

Windows, Solaris, Linux

Specified by:
canRender in interface IFeatureRenderer
Parameters:
featClass - A reference to a com.esri.arcgis.geodatabase.IFeatureClass (in)
display - A reference to a com.esri.arcgis.display.IDisplay (in)
Returns:
The result
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

prepareFilter

public void prepareFilter(IFeatureClass fc,
                          IQueryFilter queryFilter)
                   throws IOException,
                          AutomationException
Prepares the query filter for the rendering process.

Remarks

This method is called prior to the Draw method and gives the renderer a chance to adjust the query filter to incorporate extra constraints. For example, if a particular field is required for the renderer, it would add this field to the filter to ensure it is accessible during the Draw method.

Product Availability

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

Supported Platforms

Windows, Solaris, Linux

Specified by:
prepareFilter in interface IFeatureRenderer
Parameters:
fc - A reference to a com.esri.arcgis.geodatabase.IFeatureClass (in)
queryFilter - A reference to a com.esri.arcgis.geodatabase.IQueryFilter (in)
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

draw

public void draw(IFeatureCursor cursor,
                 int drawPhase,
                 IDisplay display,
                 ITrackCancel trackCancel)
          throws IOException,
                 AutomationException
Draws features from the specified cursor on the given display.

Remarks

This method is typically called by the framework to renderer features to a display. This could be in response to a refresh on the map. This method typically iterates through all the features and renders each feature with an appropriate symbol.

An individual feature is typically drawn by calling the Draw method on the feature's IFeatureDraw with the symbol created by the renderer. However, when writing a custom feature renderer you can draw anything you want using a number of different methods. To learn more see the section on writing a custom feature renderer in Extending ArcObjects.

To allow complex rendering to be canceled halfway through a draw, the renderer typically checks the TrackCancel object after each feature or set of features. If a cancel action has occurred, the renderer will exit.

There are three drawing phases: selection, annotation, and geography, and this method can be called by the framework up to three times. With the exception of the selection phase, this method will only be called for a particular draw phase if the call by the framework to RenderPhase returns true for that phase.

Feature renderers typically only draw features during the geography phase, though in some cases features are drawn in the annotation phase. Take for example a case where proportional symbols are drawn for polygon features. The ProportionalSymbolRenderer draws the background fill symbol during the geography phase and the proportionally sized marker symbol during the annotation phase.

Product Availability

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

Supported Platforms

Windows, Solaris, Linux

Specified by:
draw in interface IFeatureRenderer
Parameters:
cursor - A reference to a com.esri.arcgis.geodatabase.IFeatureCursor (in)
drawPhase - A com.esri.arcgis.system.esriDrawPhase constant (in)
display - A reference to a com.esri.arcgis.display.IDisplay (in)
trackCancel - A reference to a com.esri.arcgis.system.ITrackCancel (in)
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

getSymbolByFeature

public ISymbol getSymbolByFeature(IFeature feature)
                           throws IOException,
                                  AutomationException
Symbol used to draw the specified feature.

Product Availability

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

Specified by:
getSymbolByFeature in interface IFeatureRenderer
Parameters:
feature - A reference to a com.esri.arcgis.geodatabase.IFeature (in)
Returns:
A reference to a com.esri.arcgis.display.ISymbol
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

isRenderPhase

public boolean isRenderPhase(int drawPhase)
                      throws IOException,
                             AutomationException
Indicates if renderer uses the specified draw phase.

Product Availability

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

Specified by:
isRenderPhase in interface IFeatureRenderer
Parameters:
drawPhase - A com.esri.arcgis.system.esriDrawPhase constant (in)
Returns:
The result
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

setExclusionSetByRef

public void setExclusionSetByRef(IFeatureIDSet rhs1)
                          throws IOException,
                                 AutomationException
An object reference to a temporary drawing exclusion set.

Description

The list of feature IDs to be excluded from drawing.

Remarks

Some feature renderers support IDataExclusion which allows you to build a where clause to exclude features.

Exclusion prevents features from drawing. To prevent features from drawing as well as from appearing in tables and in query results, set a layer definition query using IFeatureLayerDefinition.

Product Availability

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

Supported Platforms

Windows, Solaris, Linux

Specified by:
setExclusionSetByRef in interface IFeatureRenderer
Parameters:
rhs1 - A reference to a com.esri.arcgis.carto.IFeatureIDSet (in)
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

getLegendGroupCount

public int getLegendGroupCount()
                        throws IOException,
                               AutomationException
Number of legend groups contained by the object.

Remarks

The number of legend groups is determined by the implementation of the renderer, consequently this property is read only. For example, SimpleRenderer has one group, while a BiUniqueValueRenderer has any number of groups.

Product Availability

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

Supported Platforms

Windows, Solaris, Linux

Specified by:
getLegendGroupCount in interface ILegendInfo
Returns:
The count
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

getLegendGroup

public ILegendGroup getLegendGroup(int index)
                            throws IOException,
                                   AutomationException
Legend group at the specified index.

Product Availability

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

Specified by:
getLegendGroup in interface ILegendInfo
Parameters:
index - The index (in)
Returns:
A reference to a com.esri.arcgis.carto.ILegendGroup
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

getLegendItem

public ILegendItem getLegendItem()
                          throws IOException,
                                 AutomationException
Optional. Defines legend formatting for layer rendered with this object.

Remarks

Layer or renderer legend information is further formatted for display in ArcMap legends. A renderer can override this formatting by returning a LegendItem for this property. ESRI renderers typically do not return anything for this property. With this configuration, legend formatting becomes a user or developer choice on the legend object.

Product Availability

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

Supported Platforms

Windows, Solaris, Linux

Specified by:
getLegendItem in interface ILegendInfo
Returns:
A reference to a com.esri.arcgis.carto.ILegendItem
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

isSymbolsAreGraduated

public boolean isSymbolsAreGraduated()
                              throws IOException,
                                     AutomationException
Indicates if symbols are graduated.

Description

Indicates whether the symbols used for a layer or renderer's legend vary by size.

Remarks

For example the proportional symbol renderer returns True for this property.

You can use this property to distinguish between a layer symbolized with graduated color or graduated symbol type layer symbology. Both of these symbolizations use a ClassBreaksRenderer, but only a graduated symbol symbolization will return True for this property.

Product Availability

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

Supported Platforms

Windows, Solaris, Linux

Specified by:
isSymbolsAreGraduated in interface ILegendInfo
Returns:
The symbolsAreGraduated
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

setSymbolsAreGraduated

public void setSymbolsAreGraduated(boolean symbolsAreGraduated)
                            throws IOException,
                                   AutomationException
Indicates if symbols are graduated.

Product Availability

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

Supported Platforms

Windows, Solaris, Linux

Specified by:
setSymbolsAreGraduated in interface ILegendInfo
Parameters:
symbolsAreGraduated - The symbolsAreGraduated (in)
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

isDirty

public void isDirty()
             throws IOException,
                    AutomationException
isDirty

Description

IPersistStream is a Microsoft interface. Please refer to MSDN for information about this interface.

Product Availability

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

Supported Platforms

Windows, Solaris, Linux

Specified by:
isDirty in interface IPersistStream
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

load

public void load(IStream pstm)
          throws IOException,
                 AutomationException
load

Description

IPersistStream is a Microsoft interface. Please refer to MSDN for information about this interface.

Product Availability

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

Supported Platforms

Windows, Solaris, Linux

Specified by:
load in interface IPersistStream
Parameters:
pstm - A reference to a com.esri.arcgis.system.IStream (in)
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

save

public void save(IStream pstm,
                 int fClearDirty)
          throws IOException,
                 AutomationException
save

Description

IPersistStream is a Microsoft interface. Please refer to MSDN for information about this interface.

Product Availability

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

Supported Platforms

Windows, Solaris, Linux

Specified by:
save in interface IPersistStream
Parameters:
pstm - A reference to a com.esri.arcgis.system.IStream (in)
fClearDirty - The fClearDirty (in)
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

getSizeMax

public void getSizeMax(_ULARGE_INTEGER[] pcbSize)
                throws IOException,
                       AutomationException
getSizeMax

Description

IPersistStream is a Microsoft interface. Please refer to MSDN for information about this interface.

Product Availability

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

Supported Platforms

Windows, Solaris, Linux

Specified by:
getSizeMax in interface IPersistStream
Parameters:
pcbSize - A Structure: com.esri.arcgis.system._ULARGE_INTEGER (out: use single element array)
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

getClassID

public void getClassID(GUID[] pClassID)
                throws IOException,
                       AutomationException
getClassID

Description

IPersist is a Microsoft interface. Please refer to MSDN for information about this interface.

Product Availability

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

Supported Platforms

Windows, Solaris, Linux

Specified by:
getClassID in interface IPersist
Parameters:
pClassID - A Structure: com.esri.arcgis.support.ms.stdole.GUID (out: use single element array)
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

setExportInfoByRef

public void setExportInfoByRef(IFeatureExportInfoGenerator rhs1)
                        throws IOException,
                               AutomationException
The helper oject to generate export information.

Product Availability

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

Specified by:
setExportInfoByRef in interface IExportSupport
Parameters:
rhs1 - A reference to a com.esri.arcgis.carto.IFeatureExportInfoGenerator (in)
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

writeExternal

public void writeExternal(ObjectOutput out)
                   throws IOException
Specified by:
writeExternal in interface Externalizable
Throws:
IOException

readExternal

public void readExternal(ObjectInput in)
                  throws IOException,
                         ClassNotFoundException
Specified by:
readExternal in interface Externalizable
Throws:
IOException
ClassNotFoundException