1#----------------------------------------------------------------------------- 2# Copyright (c) 2012 - 2021, Anaconda, Inc., and Bokeh Contributors. 3# All rights reserved. 4# 5# The full license is in the file LICENSE.txt, distributed with this software. 6#----------------------------------------------------------------------------- 7''' Models for various kinds of arrow heads that can be added to 8Arrow annotations. 9 10''' 11 12#----------------------------------------------------------------------------- 13# Boilerplate 14#----------------------------------------------------------------------------- 15import logging # isort:skip 16log = logging.getLogger(__name__) 17 18#----------------------------------------------------------------------------- 19# Imports 20#----------------------------------------------------------------------------- 21 22# Bokeh imports 23from ..core.has_props import abstract 24from ..core.properties import Include, NumberSpec, Override 25from ..core.property_mixins import FillProps, LineProps 26from ..model import Model 27 28#----------------------------------------------------------------------------- 29# Globals and constants 30#----------------------------------------------------------------------------- 31 32__all__ = ( 33 'ArrowHead', 34 'NormalHead', 35 'OpenHead', 36 'TeeHead', 37 'VeeHead', 38) 39 40#----------------------------------------------------------------------------- 41# General API 42#----------------------------------------------------------------------------- 43 44@abstract 45class ArrowHead(Model): 46 ''' Base class for arrow heads. 47 48 ''' 49 50 size = NumberSpec(default=25, help=""" 51 The size, in pixels, of the arrow head. 52 """) 53 54class OpenHead(ArrowHead): 55 ''' Render an open-body arrow head. 56 57 ''' 58 59 line_props = Include(LineProps, use_prefix=False, help=""" 60 61 The %s values for the arrow head outline. 62 """) 63 64class NormalHead(ArrowHead): 65 ''' Render a closed-body arrow head. 66 67 ''' 68 69 line_props = Include(LineProps, use_prefix=False, help=""" 70 The %s values for the arrow head outline. 71 """) 72 73 fill_props = Include(FillProps, use_prefix=False, help=""" 74 The %s values for the arrow head interior. 75 """) 76 77 fill_color = Override(default="black") 78 79class TeeHead(ArrowHead): 80 ''' Render a tee-style arrow head. 81 82 ''' 83 84 line_props = Include(LineProps, use_prefix=False, help=""" 85 The %s values for the arrow head outline. 86 """) 87 88class VeeHead(ArrowHead): 89 ''' Render a vee-style arrow head. 90 91 ''' 92 93 line_props = Include(LineProps, use_prefix=False, help=""" 94 The %s values for the arrow head outline. 95 """) 96 97 fill_props = Include(FillProps, use_prefix=False, help=""" 98 The %s values for the arrow head interior. 99 """) 100 101 fill_color = Override(default="black") 102 103#----------------------------------------------------------------------------- 104# Dev API 105#----------------------------------------------------------------------------- 106 107#----------------------------------------------------------------------------- 108# Private API 109#----------------------------------------------------------------------------- 110 111#----------------------------------------------------------------------------- 112# Code 113#----------------------------------------------------------------------------- 114