Options
All
  • Public
  • Public/Protected
  • All
Menu

Module "geocortex/infrastructure/GraphicUtils"

Index

Functions

Private _getEnhancedGeometriesOfMultiPoint

  • _getEnhancedGeometriesOfMultiPoint(multipointGraphic: Graphic, app: ViewerApplication, markerSymbolBufferSize: number): Array<Polygon>
  • Parameters

    Returns Array<Polygon>

Private _getEnhancedGeometryOfPointGraphic

  • _getEnhancedGeometryOfPointGraphic(pointGraphic: Graphic, pointSymbol: Symbol, app: ViewerApplication, markerSymbolBufferSize: number): Polygon
  • Parameters

    • pointGraphic: Graphic
    • pointSymbol: Symbol
    • app: ViewerApplication
    • markerSymbolBufferSize: number

    Returns Polygon

Private _getEnhancedGeometryOfTextGraphic

  • _getEnhancedGeometryOfTextGraphic(textGraphic: Graphic, textSymbol: TextSymbol, app: ViewerApplication): Polygon
  • Parameters

    Returns Polygon

Private _getenhancedPolygonGeometryOfMultipoint

  • _getenhancedPolygonGeometryOfMultipoint(multipointGraphic: Graphic, multipointSymbol: Symbol, app: ViewerApplication, markerSymbolBufferSize: number): Polygon
  • Parameters

    • multipointGraphic: Graphic
    • multipointSymbol: Symbol
    • app: ViewerApplication
    • markerSymbolBufferSize: number

    Returns Polygon

Private _isSEPCodedDomainField

  • _isSEPCodedDomainField(field: Field, layer: Layer): boolean
  • Parameters

    Returns boolean

Private _toRadians

  • _toRadians(degrees: number): number
  • Parameters

    • degrees: number

    Returns number

addGraphicToLayer

  • addGraphicToLayer(graphic: Graphic, layerId: string, app: ViewerApplication): boolean
  • Add a graphic to the specified layer. You must create the layer first.

    app

    The app that this module belongs to

    deprecated

    2.8 - Use GraphicsLayerUtils.addGraphicToLayer.

    Parameters

    • graphic: Graphic

      The graphic to be added

    • layerId: string

      The layer ID to add the graphic to

    • app: ViewerApplication

    Returns boolean

    A boolean returning true on success and false otherwise

deleteMarkup

  • deleteMarkup(geometry: Geometry, layerIds: string[], app: ViewerApplication, callback?: function, onlyMeasurementMarkup?: boolean, multipleMarkupWarnMsg?: string, multipleMarkupWarnTitle?: string, libraryId?: string): void
  • Utility method for the "DeleteMarkup" and "DeleteMeasurement" commands, common to the Markup and Measurement modules. Placing it here ensures that there's no dependency between the two modules and no duplication of code. This method will delete all graphics from the given layer(s) and will display a warning if multiple items are being deleted (if configured). It can be run in two modes - if onlyMeasurementMarkup is true, it will delete only markup which is tagged by the measurement module - otherwise it will delete all markup.

    Parameters

    • geometry: Geometry

      The geometry defining the area within which to delete markup. Typically passed in by the MapTool

    • layerIds: string[]

      A string array of id's of layers to delete markup from

    • app: ViewerApplication

      The current application instance

    • Optional callback: function

      An optional callback function which, if defined, will be passed the array of deleted graphics.

        • (deletedGraphics: Graphic[]): void
        • Parameters

          • deletedGraphics: Graphic[]

          Returns void

    • Optional onlyMeasurementMarkup: boolean
    • Optional multipleMarkupWarnMsg: string

      An optional string defining the language resource for the warning to be displayed if more than one markup is being deleted. If not provided, will disable this warning.

    • Optional multipleMarkupWarnTitle: string

      An optional string defining the language resource for the title for the aforementioned warning.

    • Optional libraryId: string

      An optional string defining the library id to retrieve the aforementioned language resources from. Defaults to "Mapping"

    Returns void

deleteMarkupSilently

  • deleteMarkupSilently(geometry: Geometry, layerIds: string[], app: ViewerApplication, callback?: function, onlyMeasurementMarkup?: boolean): void
  • Utility method to execute the deleteMarkup function silently without any prompts even if multiple markup are being deleted

    Parameters

    • geometry: Geometry

      The geometry defining the area within which to delete markup. Typically passed in by the MapTool

    • layerIds: string[]

      A string array of id's of layers to delete markup from

    • app: ViewerApplication

      The current application instance

    • Optional callback: function

      An optional callback function which, if defined, will be passed the array of deleted graphics.

        • (deletedGraphics: Graphic[]): void
        • Parameters

          • deletedGraphics: Graphic[]

          Returns void

    • Optional onlyMeasurementMarkup: boolean

    Returns void

geometryIntersectsGraphic

  • geometryIntersectsGraphic(geometry: Geometry, graphic: Graphic, app: ViewerApplication): Promise<boolean>
  • Checks if the supplied geometry intersects the supplied graphic.

    Parameters

    • geometry: Geometry

      The geometry defining the area which might contain the graphic.

    • graphic: Graphic

      The graphic which might be contained within the supplied geometry.

    • app: ViewerApplication

      The current application instance.

    Returns Promise<boolean>

    Promise Indicating if the esri.Graphic is contained within the supplied geometry.

getBoundingBoxSize

  • Utility method to get size of the bounding box for simplemarkersymbol and picturemarkersymbol. Note - Supports only simplemarkersymbol and picturemarkersymbol. Doesn't support visual variables.

    Parameters

    • sourceGraphic: Graphic

      The graphic for which we want to get size of bounding box.

    • Optional app: ViewerApplication

      Optional The current application instance.

    Returns number

    The size of the bounding box.

getCapabilitiesForGraphic

  • Given a clickable graphic and a layerInfo (optional) returns the capabilities of that graphic

    Parameters

    Returns string[]

getClickableLayerInfo

  • Returns the clickable layer info for a supplied graphic

    Parameters

    Returns ClickableLayerInfo

getExtentFromGeometry

  • getExtentFromGeometry(geometry: Geometry, app: ViewerApplication, pointBufferSize: number): Extent
  • Get the extent represented by the geometry @param geometry The geometry whose extent needs to be returned. @param app The current application instance. @param pointBufferSize. Represents the size of extent to be created. Only applicable for point geometry. @returns The extent created from geometry.

    Parameters

    Returns Extent

getGraphicsLayer

  • getGraphicsLayer(id: string, create: boolean, app: ViewerApplication): GraphicsLayer
  • Retrieve the graphic layer with the specified id if it exists. If 'create' is true, create it if it doesn't

    deprecated

    2.8 - Use GraphicsLayerUtils.getInternalGraphicsLayer directly.

    Parameters

    • id: string

      The layer ID to retrieve or to create

    • create: boolean

      Create the layer if it doesn't exist if this is true

    • app: ViewerApplication

      The application that this module belongs to

    Returns GraphicsLayer

    The retrieved or created Graphics layer

getMarkupFromGeometry

  • getMarkupFromGeometry(geometry: Geometry, graphicsLayer: GraphicsLayer, app: ViewerApplication, markerSymbolBufferSize?: number, pointBufferSize?: number): Graphic[]
  • Retrieves graphics contained within an extent specified by the given geometry from a given layer on the map.

    Parameters

    • geometry: Geometry

      The geometry defining the area on the specified layer from which to extract markup

    • graphicsLayer: GraphicsLayer

      The esri layer from which to extract markup

    • app: ViewerApplication

      The current application instance

    • Optional markerSymbolBufferSize: number

      Optional. Represents the size of the box to buffer for a graphic with a simple/picture marker symbol. Defaults to the size of the bounding box of symbol in pixels.

    • Optional pointBufferSize: number

      Optional. Represents the size of the box to buffer with the given point geometry as it's center. Defaults to 6.

    Returns Graphic[]

    An array of esri.Graphic objects contained within the specified geometry on the specified layer.

getMarkupLayer

  • Retrieve the markup layer with the specified id if it exists. If it doesn't exist, it will be created. This method also optionally registers the markup layer as a clickable graphic layer.

    deprecated

    2.8 - Use GraphicsLayerUtils.getInternalGraphicsLayer directly

    Parameters

    Returns GraphicsLayer

    The retrieved or created Graphics layer

getPolygonFromPoint

  • getPolygonFromPoint(point: Point, diameter: number, app: ViewerApplication, xoffset?: number, yoffset?: number): Polygon
  • Function to generate a polygon containing a specified incircle with a given point as it's center. @param point The center of the specified incircle @param diameter The diameter of the specified incircle @param app The current application instance @param xoffset Optional. Represents the x offset. @param yoffset Optional. Represents the y offset. @return A polygon containing an incircle of the specified diameter, with the specified point as its center

    Parameters

    • point: Point
    • diameter: number
    • app: ViewerApplication
    • Optional xoffset: number
    • Optional yoffset: number

    Returns Polygon

getRenderedTextMarkupSize

  • getRenderedTextMarkupSize(labelStr: string, fontFamily: string, fontSize: number | string, fontWeight?: string): object
  • Measures the actual rendered size of a text markup in pixels

    Parameters

    • labelStr: string
    • fontFamily: string

      The font family to be applied to the text

    • fontSize: number | string

      The size of the text in pixels

    • Optional fontWeight: string

      Specifies weight of the font. Defaults to normal.

    Returns object

    An object with the width and height of the specified label

    • height: number
    • width: number

getUserGraphicsLayers

  • Gets the map's graphics layers that are neither associated with the Essentials site nor used internally by GVH.

    deprecated

    as of GVH 2.8. use GraphicsLayerUtils.getGraphicsLayersExceptExcluded instead.

    Parameters

    Returns GraphicsLayer[]

isAutoEditableClickableFeature

  • Check whether the supplied feature is an auto-editable clickable feature

    Parameters

    Returns boolean

isClickableGraphic

  • Checks whether the supplied graphic belongs to a clickable graphic layer.

    Parameters

    • app: ViewerApplication

      The application that this module belongs to

    • graphic: Graphic

      The graphic to be checked

    Returns boolean

    A boolean returning true if the supplied graphic belongs to a clickable graphic layer, false otherwise

isEditableButNotAutoEditableClickableFeature

  • Check whether the supplied feature is an editable (but not auto editable) clickable feature

    Parameters

    Returns boolean

moveGraphicToTop

  • moveGraphicToTop(graphic: Graphic): void
  • Move a graphic on a graphics layer to the top. A low cost way to keep graphics organized

    Parameters

    • graphic: Graphic

      The graphic to move.

    Returns void

rotatePolygon

  • rotatePolygon(degreesClockwise: number, pivotMapPoint: Point, polygon: Polygon): Polygon
  • Function to rotate any given polygon by a specified angle. Returns a rotated copy of the original polygon.

    Parameters

    • degreesClockwise: number

      The angle to rotate the polygon in, specified in degrees, in a clockwise direction (as is standard for esri)

    • pivotMapPoint: Point

      The "pivot" around which to rotate the polygon. Is not required to lie on or within the polygon

    • polygon: Polygon

      The polygon to rotate.

    Returns Polygon

    A rotated copy of the original polygon

sanitizeAttributeNames

  • sanitizeAttributeNames(graphic: Graphic, layer: Layer): void
  • Modifies the attributes array of the graphic so that it the keys are attribute names instead of aliases (as defined in ArcGIS Server). Those attributes that are defined using attribute names will not be modified.

    Parameters

    • graphic: Graphic

      The ESRI graphic

    • layer: Layer

      The Geocortex Essentials layer

    Returns void