class_docstr: A subclass of :class:`~matplotlib.artist.Artist` capable of
  drawing a :class:`cartopy.feature.Feature`.
class_docstr_tok: ["A","subclass","of",":","class",":","`","~matplotlib.artist.Artist","`","capable","of","drawing","a",":","class",":","`","cartopy.feature.Feature","`","."]
docstr: Draw the geometries of the feature that intersect with the extent of
  the :class:`cartopy.mpl.geoaxes.GeoAxes` instance to which this
  object has been added.
docstr_tok: ["Draw","the","geometries","of","the","feature","that","intersect","with","the","extent","of","the",":","class",":","`","cartopy.mpl.geoaxes.GeoAxes","`","instance","to","which","this","object","has","been","added","."]
code: def draw(self, renderer, *args, **kwargs):
      """
      Draw the geometries of the feature that intersect with the extent of
      the :class:`cartopy.mpl.geoaxes.GeoAxes` instance to which this
      object has been added.
  
      """
      if not self.get_visible():
          return
  
      ax = self.axes
      feature_crs = self._feature.crs
  
      # Get geometries that we need to draw.
      extent = None
      try:
          extent = ax.get_extent(feature_crs)
      except ValueError:
          warnings.warn(
              "Unable to determine extent. Defaulting to global."
          )
      geoms = self._feature.intersecting_geometries(extent)
  
      # Combine all the keyword args in priority order.
      prepared_kwargs = style_merge(
          self._feature.kwargs, self._kwargs, kwargs
      )
  
      # Freeze the kwargs so that we can use them as a dict key. We will
      # need to unfreeze this with dict(frozen) before passing to mpl.
      prepared_kwargs = _freeze(prepared_kwargs)
  
      # Project (if necessary) and convert geometries to matplotlib paths.
      stylised_paths = OrderedDict()
      key = ax.projection
      for geom in geoms:
          # As Shapely geometries cannot be relied upon to be
          # hashable, we have to use a WeakValueDictionary to manage
          # their weak references. The key can then be a simple,
          # "disposable", hashable geom-key object that just uses the
          # id() of a geometry to determine equality and hash value.
          # The only persistent, strong reference to the geom-key is
          # in the WeakValueDictionary, so when the geometry is
          # garbage collected so is the geom-key.
          # The geom-key is also used to access the WeakKeyDictionary
          # cache of transformed geometries. So when the geom-key is
          # garbage collected so are the transformed geometries.
          geom_key = _GeomKey(geom)
          FeatureArtist._geom_key_to_geometry_cache.setdefault(
              geom_key, geom
          )
          mapping = FeatureArtist._geom_key_to_path_cache.setdefault(
              geom_key, {}
          )
          geom_paths = mapping.get(key)
          if geom_paths is None:
              if ax.projection != feature_crs:
                  projected_geom = ax.projection.project_geometry(
                      geom, feature_crs
                  )
              else:
                  projected_geom = geom
              geom_paths = cpatch.geos_to_path(projected_geom)
              mapping[key] = geom_paths
  
          if not self._styler:
              style = prepared_kwargs
          else:
              # Unfreeze, then add the computed style, and then re-freeze.
              style = style_merge(
                  dict(prepared_kwargs), self._styler(geom)
              )
              style = _freeze(style)
  
          stylised_paths.setdefault(style, []).extend(geom_paths)
  
      transform = ax.projection._as_mpl_transform(ax)
  
      # Draw one PathCollection per style. We could instead pass an array
      # of style items through to a single PathCollection, but that
      # complexity does not yet justify the effort.
      for style, paths in stylised_paths.items():
          style = style_finalize(dict(style))
          # Build path collection and draw it.
          c = matplotlib.collections.PathCollection(
              paths, transform=transform, **style
          )
          c.set_clip_path(ax.patch)
          c.set_figure(ax.figure)
          c.draw(renderer)
  
      # n.b. matplotlib.collection.Collection.draw returns None
      return None
  
file_path: cartopy/lib/cartopy/mpl/feature_artist.py
imports: from collections import OrderedDict
  import warnings
  import weakref
  import matplotlib.artist
  import matplotlib.collections
  import numpy
  import cartopy.mpl.patch
  from .style import finalize
  from .style import merge
label_desc: Use image node_id 2 for calling the FeatureArtist obj's underlying member method code with example usage: obj.draw(renderer) and returns: None